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

fix bugs and add test case

上级 389cf916
...@@ -627,7 +627,7 @@ int32_t jsonCompareUnit(const char* f1, const char* f2, bool* canReturn){ ...@@ -627,7 +627,7 @@ int32_t jsonCompareUnit(const char* f1, const char* f2, bool* canReturn){
return 1; return 1;
}else{ }else{
bool f1IsJsonNull = (*f1 == TSDB_DATA_TYPE_BINARY && *(uint32_t*)varDataVal(f1 + CHAR_BYTES) == TSDB_DATA_JSON_null); bool f1IsJsonNull = (*f1 == TSDB_DATA_TYPE_BINARY && *(uint32_t*)varDataVal(f1 + CHAR_BYTES) == TSDB_DATA_JSON_null);
bool f2IsJsonNull = (*f2 == TSDB_DATA_TYPE_BINARY && *(uint32_t*)varDataVal(f1 + CHAR_BYTES) == TSDB_DATA_JSON_null); bool f2IsJsonNull = (*f2 == TSDB_DATA_TYPE_BINARY && *(uint32_t*)varDataVal(f2 + CHAR_BYTES) == TSDB_DATA_JSON_null);
if(f1IsJsonNull && f2IsJsonNull){ if(f1IsJsonNull && f2IsJsonNull){
return 0; return 0;
}else if(f1IsJsonNull && !f2IsJsonNull){ }else if(f1IsJsonNull && !f2IsJsonNull){
......
...@@ -337,16 +337,37 @@ class TDTestCase: ...@@ -337,16 +337,37 @@ class TDTestCase:
# test group by & order by json tag # test group by & order by json tag
tdSql.query("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' desc") tdSql.query("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' desc")
#tdSql.checkData(1, 0, 2.5) tdSql.checkRows(8)
#tdSql.checkData(1, 1, 2) tdSql.checkData(0, 0, 2)
#tdSql.checkData(1, 2, "\"beijing\"") tdSql.checkData(0, 1, '"femail"')
#tdSql.checkData(2, 2, None) tdSql.checkData(2, 0, 1)
tdSql.checkData(2, 1, 11)
tdSql.checkData(5, 0, 1)
tdSql.checkData(5, 1, "false")
tdSql.checkData(6, 0, 1)
tdSql.checkData(6, 1, "null")
tdSql.checkData(7, 0, 2)
tdSql.checkData(7, 1, None)
tdSql.query("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' asc")
tdSql.checkRows(8)
tdSql.checkData(0, 0, 2)
tdSql.checkData(0, 1, None)
tdSql.checkData(2, 0, 1)
tdSql.checkData(2, 1, "false")
tdSql.checkData(5, 0, 1)
tdSql.checkData(5, 1, 11)
tdSql.checkData(7, 0, 2)
tdSql.checkData(7, 1, '"femail"')
# test stddev with group by json tag # test stddev with group by json tag
tdSql.query("select stddev(dataint) from jsons1 group by jtag->'tag1'") tdSql.query("select stddev(dataint) from jsons1 group by jtag->'tag1'")
#tdSql.checkData(0, 1, None) tdSql.checkData(0, 0, 10)
#tdSql.checkData(1, 0, 0.5) tdSql.checkData(0, 1, None)
#tdSql.checkData(2, 0, 0) tdSql.checkData(1, 0, 0)
tdSql.checkData(1, 1, "null")
tdSql.checkData(7, 0, 11)
tdSql.checkData(7, 1, '"femail"')
res = tdSql.getColNameList("select stddev(dataint) from jsons1 group by jsons1.jtag->'tag1'") res = tdSql.getColNameList("select stddev(dataint) from jsons1 group by jsons1.jtag->'tag1'")
cname_list = [] cname_list = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册