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

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

......@@ -699,7 +699,7 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo
if (isNull(p, TSDB_DATA_TYPE_NCHAR) && pInfo->field.type == TSDB_DATA_TYPE_NCHAR) {
memcpy(dst, p, varDataTLen(p));
} else if(isNuselect jtag from db_json_tag_test.jsons1_6ll(p, TSDB_DATA_TYPE_JSON && pInfo->field.type == TSDB_DATA_TYPE_JSON)) {
} else if(isNull(p, TSDB_DATA_TYPE_JSON) && pInfo->field.type == TSDB_DATA_TYPE_JSON) {
memcpy(dst, p, varDataTLen(p));
}else if (varDataLen(p) > 0) {
int32_t length = taosUcs4ToMbs(varDataVal(p), varDataLen(p), varDataVal(dst));
......@@ -5158,11 +5158,12 @@ void getJsonTagValueElment(STable* data, char* key, int32_t keyLen, char* dst, i
return;
}
char out[TSDB_MAX_TAGS_LEN] = {0};
char out[20] = {0};
char* realData = POINTER_SHIFT(result, CHAR_BYTES);
if(*(char*)result == TSDB_DATA_TYPE_NCHAR) {
assert(varDataTLen(result) <= TSDB_MAX_TAGS_LEN);
varDataCopy(out, result);
assert(varDataTLen(realData) <= bytes);
varDataCopy(dst, realData);
return;
}else if (*(char*)result == TSDB_DATA_TYPE_DOUBLE) {
double jsonVd = *(double*)(realData);
sprintf(varDataVal(out), "%.9lf", jsonVd);
......
......@@ -175,20 +175,21 @@ class TDTestCase:
tdSql.error("CREATE TABLE if not exists db_json_tag_test.jsons1_5 using db_json_tag_test.jsons1 tags('efwewf')")
tdSql.execute("CREATE TABLE if not exists db_json_tag_test.jsons1_5 using db_json_tag_test.jsons1 tags('\t')")
tdSql.execute("CREATE TABLE if not exists db_json_tag_test.jsons1_6 using db_json_tag_test.jsons1 tags('')")
#tdSql.query("select jtag from db_json_tag_test.jsons1_6")
tdSql.checkData(0, 0, "NULL")
tdSql.query("select jtag from db_json_tag_test.jsons1_6")
tdSql.checkData(0, 0, None)
tdSql.execute("CREATE TABLE if not exists db_json_tag_test.jsons1_7 using db_json_tag_test.jsons1 tags('{}')")
#tdSql.query("select jtag from db_json_tag_test.jsons1_7")
#tdSql.checkData(0, 0, "NULL")
tdSql.query("select jtag from db_json_tag_test.jsons1_7")
tdSql.checkData(0, 0, None)
tdSql.execute("CREATE TABLE if not exists db_json_tag_test.jsons1_8 using db_json_tag_test.jsons1 tags('null')")
#tdSql.query("select jtag from db_json_tag_test.jsons1_8")
#tdSql.checkData(0, 0, "NULL")
tdSql.query("select jtag from db_json_tag_test.jsons1_8")
tdSql.checkData(0, 0, None)
tdSql.execute("CREATE TABLE if not exists db_json_tag_test.jsons1_9 using db_json_tag_test.jsons1 tags('{\"\":4, \"time\":null}')")
#tdSql.query("select jtag from db_json_tag_test.jsons1_9")
#tdSql.checkData(0, 0, "NULL")
tdSql.query("select jtag from db_json_tag_test.jsons1_9")
tdSql.checkData(0, 0, None)
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 jtag from db_json_tag_test.jsons1_10")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册