diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e33f9d6c22d3b056fef0cc4cbfa44bca5fbbc703..d92cae4c920bb451aceb74d7cde2995a06f7569d 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -7370,7 +7370,6 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS SSqlNode* p = taosArrayGetP(subInfo->pSubquery, 0); SQueryInfo* pSub = calloc(1, sizeof(SQueryInfo)); - printf("-------------queryinfo:%p\n", pSub); tscInitQueryInfo(pSub); int32_t code = validateSqlNode(pSql, p, pSub); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 513b85b2a6c7d7e8182e1a0a226eaf90d3245526..9222dc5d5700bc979f59911169a9d6a8c873b5bb 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1614,6 +1614,7 @@ int tscProcessRetrieveLocalMergeRsp(SSqlObj *pSql) { taosArrayPush(group, &tableKeyInfo); taosArrayPush(tableGroupInfo.pGroupList, &group); + // todo remove it SExprInfo* list = calloc(tscNumOfExprs(pQueryInfo), sizeof(SExprInfo)); for(int32_t i = 0; i < tscNumOfExprs(pQueryInfo); ++i) { SExprInfo* pExprInfo = tscExprGet(pQueryInfo, i); @@ -1621,6 +1622,7 @@ int tscProcessRetrieveLocalMergeRsp(SSqlObj *pSql) { } pQueryInfo->pQInfo = createQInfoFromQueryNode(pQueryInfo, list, &tableGroupInfo, NULL, NULL, pRes->pLocalMerger, MERGE_STAGE); + tfree(list); } uint64_t localQueryId = 0; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 1b36e3cb00ec12d0bf7f9d3d18bee28a523b9a18..0907961145f93164ba4c327c334051a4a7fa2c97 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1010,6 +1010,11 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue pSourceOperator = createJoinOperator(p, px->numOfTables, schema, num); tfree(p); + } else { + int32_t num = taosArrayGetSize(px->colList); + + schema = calloc(num, sizeof(SSchema)); + memcpy(schema, pSchema, numOfCol1*sizeof(SSchema)); } SExprInfo* exprInfo = NULL; diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/general/parser/nestquery.sim index 082457438f3048d62192b8e1063d968360778165..d6fde199dc5adfaf2bed7db7427a3670376587b1 100644 --- a/tests/script/general/parser/nestquery.sim +++ b/tests/script/general/parser/nestquery.sim @@ -61,6 +61,43 @@ sleep 100 $i = 1 $tb = $tbPrefix . $i -sql select count(*) from (select + +print simple nest query test +sql select count(*) from (select count(*) from nest_mt0)) +if $rows != 1 then + return -1 +endi + +if $data00 != 1 then + return -1 +endi + +sql select count(*) from (select count(*) from nest_mt0 group by tbname) +if $rows != 1 then + return -1 +endi + +if $data00 != 10 then + return -1 +endi + +sql select count(*) from (select count(*) from nest_mt0 interval(10h) group by tbname) +if $rows != 1 then + return -1 +endi + +if $data00 != 10 then + return -1 +endi + +print =================> alias name test +sql select count(a) from (select count(*) a from nest_tb0 interval(1h)) +if $rows != 1 then + return -1 +endi + +if $data00 != 1 then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file