4paradigm / 4paradigm/OpenMLDB

ddl_parser: add yaml test & support json schema to make test easier

オープン
#931 コメント 0 件 リアクション 0 件 担当者 1 名 @vagetablechicken が担当を希望しています GitHub で見る
call-for-contributions
主要言語
C++
スター
1.7k
フォーク
331
平均マージ
12日 12時間
マージ済み PR(30日)
1

説明

When the user reports an `ExtractIndexes`(DDLParser) error, the user usually provides a sql with a schema json str.
If we want to run the test, we need to hard code in ddl_parser_test.cc. And the json schema should be converted to a vector or a string manually(`AddTableToDB` doesn't support json schema). It's not good.

We should support the json schema. A new `AddTableToDB`. The json schema input is like:
```
{
"tableInfo":{
"t1":[
{
"name":"rank",
"type":"string"
},
...
],
"t2":[
{
"name":"c1",
"type":"string"
},
...
]
}
}
```

Then if we support reading test cases from yaml files, we can avoid adding every test to the source code. Just add it to the yaml files.
For example, the yaml file could be:
```
extract_indexes_cases:
- id: xx
sql: ...
schema: ...
result: ...
- id: yy
```
or you can use the json style, like:
```
{ "table_info": {"t1": [...], "t2": [...], ...}, "sql": "..." }
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Look at ddl_parser_test.cc to understand the current test structure and the AddTableToDB function. The task is to modify AddTableToDB to accept a JSON schema string as described, and to add support for reading test cases from YAML files. Start by examining how the existing tests are structured and where the schema data is currently hardcoded. The goal is to create a new test harness that can load cases from YAML, parse the JSON schema, and run the ExtractIndexes tests.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, json, yaml
領域
databases, testing
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。