未验证 提交 f69557fb 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-3544] <fix>: move query times detect to query meta file parse. (#5597)

Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 868ee107
...@@ -3076,16 +3076,6 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { ...@@ -3076,16 +3076,6 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto PARSE_OVER; goto PARSE_OVER;
} }
cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times");
if (gQueryTimes && gQueryTimes->type == cJSON_Number) {
g_args.query_times = gQueryTimes->valueint;
} else if (!gQueryTimes) {
g_args.query_times = 1;
} else {
errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", __func__, __LINE__);
goto PARSE_OVER;
}
cJSON* interlaceRows = cJSON_GetObjectItem(root, "interlace_rows"); cJSON* interlaceRows = cJSON_GetObjectItem(root, "interlace_rows");
if (interlaceRows && interlaceRows->type == cJSON_Number) { if (interlaceRows && interlaceRows->type == cJSON_Number) {
g_args.interlace_rows = interlaceRows->valueint; g_args.interlace_rows = interlaceRows->valueint;
...@@ -3729,6 +3719,16 @@ static bool getMetaFromQueryJsonFile(cJSON* root) { ...@@ -3729,6 +3719,16 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
goto PARSE_OVER; goto PARSE_OVER;
} }
cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times");
if (gQueryTimes && gQueryTimes->type == cJSON_Number) {
g_args.query_times = gQueryTimes->valueint;
} else if (!gQueryTimes) {
g_args.query_times = 1;
} else {
errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", __func__, __LINE__);
goto PARSE_OVER;
}
cJSON* dbs = cJSON_GetObjectItem(root, "databases"); cJSON* dbs = cJSON_GetObjectItem(root, "databases");
if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) { if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) {
tstrncpy(g_queryInfo.dbName, dbs->valuestring, MAX_DB_NAME_SIZE); tstrncpy(g_queryInfo.dbName, dbs->valuestring, MAX_DB_NAME_SIZE);
...@@ -4050,12 +4050,12 @@ static bool getInfoFromJsonFile(char* file) { ...@@ -4050,12 +4050,12 @@ static bool getInfoFromJsonFile(char* file) {
if (INSERT_TEST == g_args.test_mode) { if (INSERT_TEST == g_args.test_mode) {
ret = getMetaFromInsertJsonFile(root); ret = getMetaFromInsertJsonFile(root);
} else if (QUERY_TEST == g_args.test_mode) { } else if ((QUERY_TEST == g_args.test_mode)
ret = getMetaFromQueryJsonFile(root); || (SUBSCRIBE_TEST == g_args.test_mode)) {
} else if (SUBSCRIBE_TEST == g_args.test_mode) {
ret = getMetaFromQueryJsonFile(root); ret = getMetaFromQueryJsonFile(root);
} else { } else {
errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n", __func__, __LINE__); errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n",
__func__, __LINE__);
goto PARSE_OVER; goto PARSE_OVER;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册