diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index d4f473cb187b97875422763ec91d293e7c7ee931..f1e5ad529896b7a8912ed3d6e31ea7d186e5f3c3 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 7ed96cf3876644ff40b614a9d1f75875295fd94a..79011e693789cef5c45932d11f0118d8708c1db4 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__)