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

<fix>[TD-10990] fix stddev empty group by json->key

上级 7fab0805
......@@ -1841,7 +1841,7 @@ int tscProcessRetrieveGlobalMergeRsp(SSqlObj *pSql) {
uint64_t localQueryId = pSql->self;
qTableQuery(pQueryInfo->pQInfo, &localQueryId);
bool convertJson = true;
if (tscMultiRoundQuery(pQueryInfo, 0)) convertJson = false;
if (pQueryInfo->isStddev == true) convertJson = false;
convertQueryResult(pRes, pQueryInfo, pSql->self, true, convertJson);
code = pRes->code;
......
......@@ -2450,6 +2450,7 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pNewQueryInfo, 0);
tscInitQueryInfo(pNewQueryInfo);
pNewQueryInfo->isStddev = true; // for json tag
// add the group cond
pNewQueryInfo->groupbyExpr = pQueryInfo->groupbyExpr;
......@@ -3708,7 +3709,7 @@ TAOS_ROW doSetResultRowData(SSqlObj *pSql) {
int32_t type = pInfo->field.type;
int32_t bytes = pInfo->field.bytes;
if (tscMultiRoundQuery(pQueryInfo, 0) && pQueryInfo->round == 0 && type == TSDB_DATA_TYPE_JSON){ // for json tag compare in the second round of stddev
if (pQueryInfo->isStddev && type == TSDB_DATA_TYPE_JSON){ // for json tag compare in the second round of stddev
pRes->tsrow[j] = pRes->urow[i];
}else if (!IS_VAR_DATA_TYPE(type) && type != TSDB_DATA_TYPE_JSON) {
pRes->tsrow[j] = isNull(pRes->urow[i], type) ? NULL : pRes->urow[i];
......
......@@ -166,6 +166,7 @@ typedef struct SQueryInfo {
bool stateWindow;
bool globalMerge;
bool multigroupResult;
bool isStddev;
} SQueryInfo;
/**
......
......@@ -105,7 +105,6 @@ class TDTestCase:
tdSql.checkRows(0)
tdSql.query("select jtag->'sex' from db_json_tag_test.jsons1 where jtag?'sex' or jtag?'num'")
tdSql.checkData(0, 0, "\"femail\"")
tdSql.checkRows(3)
tdSql.query("select *,tbname from db_json_tag_test.jsons1 where jtag->'location'='beijing'")
......@@ -290,6 +289,11 @@ class TDTestCase:
tdSql.checkData(1, 2, 1)
tdSql.checkData(3, 2, 11)
tdSql.query("select stddev(dataint) from db_json_tag_test.jsons1 group by jtag->'location'")
tdSql.checkData(0, 1, None)
tdSql.checkData(1, 0, 0.5)
tdSql.checkData(2, 0, 0)
# test json->'key'=null
tdSql.execute("insert into db_json_tag_test.jsons1_9 values('2020-04-17 15:20:00.000', 5, false, 'json19')")
tdSql.query("select * from db_json_tag_test.jsons1")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册