From c45f24d0c4eea5687e072c4414d35346f1b3fdd6 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 16 Oct 2021 15:44:31 +0800 Subject: [PATCH] TD-6129 support null true false for json tag --- src/client/src/tscUtil.c | 2 +- tests/pytest/stable/json_tag.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index d4f473cb18..f1e5ad5298 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -5310,7 +5310,7 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in char nullTypeKey[VARSTR_HEADER_SIZE + CHAR_BYTES] = {0}; varDataSetLen(nullTypeKey, CHAR_BYTES); *(uint8_t*)(varDataVal(nullTypeKey)) = jsonNULL; - tdAddColToKVRow(kvRowBuilder, jsonIndex++, TSDB_DATA_TYPE_JSON, nullTypeKey, false); // add json null type + tdAddColToKVRow(kvRowBuilder, jsonIndex++, TSDB_DATA_TYPE_NCHAR, nullTypeKey, false); // add json null type if (strtrim(json) == 0 || strcasecmp(json, "null") == 0){ tdAddColToKVRow(kvRowBuilder, jsonIndex++, TSDB_DATA_TYPE_JSON, &jsonNULL, false); // add json null value return TSDB_CODE_SUCCESS; diff --git a/tests/pytest/stable/json_tag.py b/tests/pytest/stable/json_tag.py index 7ed96cf387..79011e6937 100644 --- a/tests/pytest/stable/json_tag.py +++ b/tests/pytest/stable/json_tag.py @@ -161,7 +161,7 @@ class TDTestCase: tdSql.query("select * from db_json_tag_test.jsons1 where jtag->'location' match 'jin'") tdSql.checkRows(2) - tdSql.query("select * from db_json_tag_test.jsons1 where datastr match 'json and jtag->'location' match 'jin'") + tdSql.query("select * from db_json_tag_test.jsons1 where datastr match 'json' and jtag->'location' match 'jin'") tdSql.checkRows(2) tdSql.error("select * from db_json_tag_test.jsons1 where jtag->'num' match '5'") @@ -176,7 +176,7 @@ class TDTestCase: tdSql.execute("CREATE TABLE if not exists db_json_tag_test.jsons1_10 using db_json_tag_test.jsons1 tags('{\"k1\":\"\",\"k1\":\"v1\",\"k2\":true,\"k3\":false,\"k4\":55}')") tdSql.query("select * from db_json_tag_test.jsons1 where datastr match 'json and jtag->'location' match 'jin'") tdSql.checkRows(2) - + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) -- GitLab