提交 c45f24d0 编写于 作者: wmmhello's avatar wmmhello

TD-6129<feature> support null true false for json tag

上级 4cdaa9e2
...@@ -5310,7 +5310,7 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in ...@@ -5310,7 +5310,7 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in
char nullTypeKey[VARSTR_HEADER_SIZE + CHAR_BYTES] = {0}; char nullTypeKey[VARSTR_HEADER_SIZE + CHAR_BYTES] = {0};
varDataSetLen(nullTypeKey, CHAR_BYTES); varDataSetLen(nullTypeKey, CHAR_BYTES);
*(uint8_t*)(varDataVal(nullTypeKey)) = jsonNULL; *(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){ if (strtrim(json) == 0 || strcasecmp(json, "null") == 0){
tdAddColToKVRow(kvRowBuilder, jsonIndex++, TSDB_DATA_TYPE_JSON, &jsonNULL, false); // add json null value tdAddColToKVRow(kvRowBuilder, jsonIndex++, TSDB_DATA_TYPE_JSON, &jsonNULL, false); // add json null value
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
......
...@@ -161,7 +161,7 @@ class TDTestCase: ...@@ -161,7 +161,7 @@ class TDTestCase:
tdSql.query("select * from db_json_tag_test.jsons1 where jtag->'location' match 'jin'") tdSql.query("select * from db_json_tag_test.jsons1 where jtag->'location' match 'jin'")
tdSql.checkRows(2) 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.checkRows(2)
tdSql.error("select * from db_json_tag_test.jsons1 where jtag->'num' match '5'") tdSql.error("select * from db_json_tag_test.jsons1 where jtag->'num' match '5'")
...@@ -176,7 +176,7 @@ class TDTestCase: ...@@ -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.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.query("select * from db_json_tag_test.jsons1 where datastr match 'json and jtag->'location' match 'jin'")
tdSql.checkRows(2) tdSql.checkRows(2)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册