diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index d8b90a0146..df9c72dcc1 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -3145,7 +3145,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "unique", .type = FUNCTION_TYPE_UNIQUE, - .classification = FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC, .translateFunc = translateUnique, .getEnvFunc = getUniqueFuncEnv, .initFunc = uniqueFunctionSetup, diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 1a6fbfef87..1b36801d6b 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -490,6 +490,7 @@ static int32_t logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) { COPY_SCALAR_FIELD(allEqTags); COPY_SCALAR_FIELD(isSingleTableJoin); COPY_SCALAR_FIELD(hasSubQuery); + COPY_SCALAR_FIELD(isLowLevelJoin); COPY_SCALAR_FIELD(seqWinGroup); COPY_SCALAR_FIELD(grpJoin); return TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 1d9bfc67bc..21a18cbe4e 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3677,8 +3677,8 @@ EDealRes joinCondsValidater(SNode* pNode, void* pContext) { if (OP_TYPE_EQUAL < pOp->opType || OP_TYPE_GREATER_THAN > pOp->opType) { break; } - if ((QUERY_NODE_COLUMN != nodeType(pOp->pLeft) && QUERY_NODE_FUNCTION != nodeType(pOp->pLeft)) || - (QUERY_NODE_COLUMN != nodeType(pOp->pRight) && QUERY_NODE_FUNCTION != nodeType(pOp->pRight))){ + if ((QUERY_NODE_COLUMN != nodeType(pOp->pLeft) && QUERY_NODE_FUNCTION != nodeType(pOp->pLeft) && !(QUERY_NODE_OPERATOR == nodeType(pOp->pLeft) && OP_TYPE_JSON_GET_VALUE ==((SOperatorNode*)pOp->pLeft)->opType)) || + (QUERY_NODE_COLUMN != nodeType(pOp->pRight) && QUERY_NODE_FUNCTION != nodeType(pOp->pRight) && !(QUERY_NODE_OPERATOR == nodeType(pOp->pRight) && OP_TYPE_JSON_GET_VALUE ==((SOperatorNode*)pOp->pRight)->opType))){ break; } if (QUERY_NODE_COLUMN == nodeType(pOp->pLeft)) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 8c8b4a8550..b293b27528 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -881,18 +881,34 @@ static bool pdcJoinIsEqualOnCond(SJoinLogicNode* pJoin, SNode* pCond, bool* allT return false; } SOperatorNode* pOper = (SOperatorNode*)pCond; - if (QUERY_NODE_COLUMN != nodeType(pOper->pLeft) || NULL == pOper->pRight || QUERY_NODE_COLUMN != nodeType(pOper->pRight)) { + if ((QUERY_NODE_COLUMN != nodeType(pOper->pLeft) && !(QUERY_NODE_OPERATOR == nodeType(pOper->pLeft) && OP_TYPE_JSON_GET_VALUE ==((SOperatorNode*)pOper->pLeft)->opType)) + || NULL == pOper->pRight || + (QUERY_NODE_COLUMN != nodeType(pOper->pRight) && !(QUERY_NODE_OPERATOR == nodeType(pOper->pRight) && OP_TYPE_JSON_GET_VALUE ==((SOperatorNode*)pOper->pRight)->opType))) { return false; } - SColumnNode* pLeft = (SColumnNode*)(pOper->pLeft); - SColumnNode* pRight = (SColumnNode*)(pOper->pRight); - - *allTags = (COLUMN_TYPE_TAG == pLeft->colType) && (COLUMN_TYPE_TAG == pRight->colType); - + if (OP_TYPE_EQUAL != pOper->opType) { return false; } + if ((QUERY_NODE_OPERATOR == nodeType(pOper->pLeft) || QUERY_NODE_OPERATOR == nodeType(pOper->pRight)) && + !(IS_ASOF_JOIN(pJoin->subType) || IS_WINDOW_JOIN(pJoin->subType))) { + return false; + } + + SColumnNode* pLeft = (SColumnNode*)(pOper->pLeft); + SColumnNode* pRight = (SColumnNode*)(pOper->pRight); + + if (QUERY_NODE_OPERATOR == nodeType(pOper->pLeft)) { + pLeft = (SColumnNode*)((SOperatorNode*)pOper->pLeft)->pLeft; + } + + if (QUERY_NODE_OPERATOR == nodeType(pOper->pRight)) { + pRight = (SColumnNode*)((SOperatorNode*)pOper->pRight)->pLeft; + } + + *allTags = (COLUMN_TYPE_TAG == pLeft->colType) && (COLUMN_TYPE_TAG == pRight->colType); + if (pLeft->node.resType.type != pRight->node.resType.type || pLeft->node.resType.bytes != pRight->node.resType.bytes) { return false; @@ -900,17 +916,17 @@ static bool pdcJoinIsEqualOnCond(SJoinLogicNode* pJoin, SNode* pCond, bool* allT SNodeList* pLeftCols = ((SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 0))->pTargets; SNodeList* pRightCols = ((SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 1))->pTargets; bool isEqual = false; - if (pdcJoinColInTableColList(pOper->pLeft, pLeftCols)) { - isEqual = pdcJoinColInTableColList(pOper->pRight, pRightCols); + if (pdcJoinColInTableColList((SNode*)pLeft, pLeftCols)) { + isEqual = pdcJoinColInTableColList((SNode*)pRight, pRightCols); if (isEqual) { nodesListMakeStrictAppend(&pJoin->pLeftEqNodes, nodesCloneNode(pOper->pLeft)); nodesListMakeStrictAppend(&pJoin->pRightEqNodes, nodesCloneNode(pOper->pRight)); } - } else if (pdcJoinColInTableColList(pOper->pLeft, pRightCols)) { - isEqual = pdcJoinColInTableColList(pOper->pRight, pLeftCols); + } else if (pdcJoinColInTableColList((SNode*)pLeft, pRightCols)) { + isEqual = pdcJoinColInTableColList((SNode*)pRight, pLeftCols); if (isEqual) { - nodesListMakeStrictAppend(&pJoin->pLeftEqNodes, nodesCloneNode(pOper->pRight)); - nodesListMakeStrictAppend(&pJoin->pRightEqNodes, nodesCloneNode(pOper->pLeft)); + nodesListMakeStrictAppend(&pJoin->pLeftEqNodes, nodesCloneNode(pOper->pLeft)); + nodesListMakeStrictAppend(&pJoin->pRightEqNodes, nodesCloneNode(pOper->pRight)); } } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index a449071eb7..9e17b99207 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -1251,6 +1251,7 @@ static int32_t stbSplSplitSortNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) } if (TSDB_CODE_SUCCESS == code) { nodesDestroyNode((SNode*)pInfo->pSplitNode); + pInfo->pSplitNode = NULL; if (groupSort) { stbSplSetScanPartSort(pPartSort); } diff --git a/tests/script/tsim/join/join.sim b/tests/script/tsim/join/join.sim index 47620f34eb..d281c96464 100644 --- a/tests/script/tsim/join/join.sim +++ b/tests/script/tsim/join/join.sim @@ -57,6 +57,22 @@ sql insert into ctb22 using st2 tags(2) values('2023-10-16 09:10:12', 110222, 11 sql insert into ctb23 using st2 tags(3) values('2023-10-16 09:10:13', 110223, 1102230); sql insert into ctb24 using st2 tags(4) values('2023-10-16 09:10:14', 110224, 1102240); +sql drop database if exists testc; +sql create database testc vgroups 3; +sql use testc; + +sql create table stc1(ts timestamp, f int) tags (t json); +sql insert into ctb11 using stc1 tags("{\"tag1\":\"1-11\",\"tag2\":1}") values('2023-10-16 09:10:11', 11); +sql insert into ctb11 using stc1 tags("{\"tag1\":\"1-11\",\"tag2\":1}") values('2023-10-16 09:10:12', 12); +sql insert into ctb12 using stc1 tags("{\"tag1\":\"1-12\",\"tag2\":2}") values('2023-10-16 09:10:11', 21); +sql insert into ctb12 using stc1 tags("{\"tag1\":\"1-12\",\"tag2\":2}") values('2023-10-16 09:10:12', 22); + +sql create table stc2(ts timestamp, f int) tags (t json); +sql insert into ctb21 using stc2 tags("{\"tag1\":\"1-21\",\"tag2\":1}") values('2023-10-16 09:10:11', 110); +sql insert into ctb21 using stc2 tags("{\"tag1\":\"1-21\",\"tag2\":1}") values('2023-10-16 09:10:12', 120); +sql insert into ctb22 using stc2 tags("{\"tag1\":\"1-22\",\"tag2\":2}") values('2023-10-16 09:10:11', 210); +sql insert into ctb22 using stc2 tags("{\"tag1\":\"1-22\",\"tag2\":2}") values('2023-10-16 09:10:12', 220); + run tsim/join/inner_join.sim run tsim/join/left_join.sim run tsim/join/right_join.sim @@ -74,6 +90,7 @@ run tsim/join/join_timeline.sim run tsim/join/join_nested.sim run tsim/join/join_boundary.sim run tsim/join/join_explain.sim +run tsim/join/join_json.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -97,5 +114,6 @@ run tsim/join/join_timeline.sim run tsim/join/join_nested.sim run tsim/join/join_boundary.sim run tsim/join/join_explain.sim +run tsim/join/join_json.sim system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/join/join_json.sim b/tests/script/tsim/join/join_json.sim new file mode 100644 index 0000000000..d335057c51 --- /dev/null +++ b/tests/script/tsim/join/join_json.sim @@ -0,0 +1,135 @@ +sql connect +sql use testc; + +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a join stc2 b on a.ts = b.ts; +if $rows != 8 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1'; +if $rows != 0 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2'; +if $rows != 4 then + return -1 +endi + +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left join stc2 b on a.ts = b.ts; +if $rows != 8 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1'; +if $rows != 4 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2'; +if $rows != 4 then + return -1 +endi + +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left semi join stc2 b on a.ts = b.ts; +if $rows != 4 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left semi join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1'; +if $rows != 0 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left semi join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2'; +if $rows != 4 then + return -1 +endi + +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left anti join stc2 b on a.ts = b.ts; +if $rows != 0 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left anti join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1'; +if $rows != 4 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left anti join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2'; +if $rows != 0 then + return -1 +endi + +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left asof join stc2 b; +if $rows != 4 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left asof join stc2 b on a.t->'tag1' = b.t->'tag1'; +if $rows != 4 then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data12 != NULL then + return -1 +endi +if $data22 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left asof join stc2 b on a.t->'tag2' = b.t->'tag2'; +if $rows != 4 then + return -1 +endi +if $data02 != @23-10-16 09:10:11.000@ then + return -1 +endi +if $data12 != @23-10-16 09:10:12.000@ then + return -1 +endi +if $data22 != @23-10-16 09:10:11.000@ then + return -1 +endi +if $data32 != @23-10-16 09:10:12.000@ then + return -1 +endi + +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left window join stc2 b window_offset(0s, 1s); +if $rows != 12 then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left window join stc2 b on a.t->'tag1' = b.t->'tag1' window_offset(0s, 1s); +if $rows != 4 then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data12 != NULL then + return -1 +endi +if $data22 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi +sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left window join stc2 b on a.t->'tag2' = b.t->'tag2' window_offset(0s, 1s); +if $rows != 6 then + return -1 +endi +if $data02 != @23-10-16 09:10:11.000@ then + return -1 +endi +if $data12 != @23-10-16 09:10:12.000@ then + return -1 +endi +if $data22 != @23-10-16 09:10:12.000@ then + return -1 +endi +if $data32 != @23-10-16 09:10:11.000@ then + return -1 +endi +if $data42 != @23-10-16 09:10:12.000@ then + return -1 +endi +if $data52 != @23-10-16 09:10:12.000@ then + return -1 +endi + diff --git a/tests/script/tsim/join/join_timeline.sim b/tests/script/tsim/join/join_timeline.sim index 76cba1d044..ea1270cb89 100644 --- a/tests/script/tsim/join/join_timeline.sim +++ b/tests/script/tsim/join/join_timeline.sim @@ -12,8 +12,20 @@ endi sql_error select diff(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; sql_error select csum(b.col1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; -sql_error select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; -sql_error select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 and a.t1 > 0; +sql select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; +if $rows != 1 then + return -1 +endi +if $data00 != 7 then + return -1 +endi +sql select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 and a.t1 > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 7 then + return -1 +endi sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 interval(1s); if $rows != 6 then diff --git a/tests/system-test/2-query/nestedQuery.py b/tests/system-test/2-query/nestedQuery.py index 90004def13..5adc6e5543 100755 --- a/tests/system-test/2-query/nestedQuery.py +++ b/tests/system-test/2-query/nestedQuery.py @@ -1377,7 +1377,7 @@ class TDTestCase: tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - elif (mathlist == ['MAVG']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['statecount','stateduration']) : + elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) or (mathlist == ['statecount','stateduration']) : sql = "select count(asct1) from ( select " sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " @@ -1389,7 +1389,7 @@ class TDTestCase: tdLog.info(sql) tdLog.info(len(sql)) tdSql.error(sql) - elif (mathlist == ['SAMPLE']) or (mathlist == ['UNIQUE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : + elif (mathlist == ['TAIL']) or (mathlist == ['SAMPLE']) or (mathlist == ['UNIQUE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : sql = "select count(asct1) from ( select " sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " diff --git a/tests/system-test/2-query/para_tms.py b/tests/system-test/2-query/para_tms.py index d5b297523e..9c0a37d572 100755 --- a/tests/system-test/2-query/para_tms.py +++ b/tests/system-test/2-query/para_tms.py @@ -1239,7 +1239,7 @@ class TDTestCase: tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - elif (mathlist == ['SAMPLE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : + elif (mathlist == ['SAMPLE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) or (mathlist == ['UNIQUE']) or (mathlist == ['TAIL']) : sql = "select /*+ para_tables_sort() */ %s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) @@ -1249,7 +1249,7 @@ class TDTestCase: tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - elif (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['MAVG']) or (mathlist == ['UNIQUE']) or (mathlist == ['statecount','stateduration']) : + elif (mathlist == ['CSUM']) or (mathlist == ['MAVG']) or (mathlist == ['statecount','stateduration']) : sql = "select /*+ para_tables_sort() */ %s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " sql += "%s " % random.choice(self.t_join_where) @@ -1449,7 +1449,7 @@ class TDTestCase: tdLog.info(sql) tdSql.query(sql) self.explain_sql(sql) - elif (mathlist == ['MAVG']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['UNIQUE']) or (mathlist == ['statecount','stateduration']) : + elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) or (mathlist == ['statecount','stateduration']) : sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ " sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " @@ -1461,7 +1461,7 @@ class TDTestCase: sql += "%s ;" % random.choice(self.limit_u_where) tdLog.info(sql) tdSql.error(sql) - elif (mathlist == ['SAMPLE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : + elif (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['UNIQUE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ " sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and " diff --git a/tests/system-test/2-query/para_tms2.py b/tests/system-test/2-query/para_tms2.py index 4e55fdff0c..a79456ecfa 100755 --- a/tests/system-test/2-query/para_tms2.py +++ b/tests/system-test/2-query/para_tms2.py @@ -1385,7 +1385,7 @@ class TDTestCase: tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - elif (mathlist == ['SAMPLE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : + elif (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['UNIQUE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) : sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ " sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " @@ -1399,8 +1399,8 @@ class TDTestCase: tdSql.query(sql) self.cur1.execute(sql) self.explain_sql(sql) - elif (mathlist == ['MAVG']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \ - or (mathlist == ['UNIQUE']) or (mathlist == ['statecount','stateduration']) : + elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) \ + or (mathlist == ['statecount','stateduration']) : sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ " sql += "%s as asct1 " % math_fun_join_2 sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and " diff --git a/tests/system-test/2-query/tail.py b/tests/system-test/2-query/tail.py index d3cacbdaf1..ff175b4204 100644 --- a/tests/system-test/2-query/tail.py +++ b/tests/system-test/2-query/tail.py @@ -412,13 +412,13 @@ class TDTestCase: tdSql.checkData(0,0,4) tdSql.checkData(1,0,1) - tdSql.error(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 group by c2);") + tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 group by c2);") - tdSql.error(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 partition by c2);") + tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 partition by c2);") - tdSql.error(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 order by c2);") + tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 order by c2);") - tdSql.error(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 union select _rowts, first(c2) as a from {dbname}.ct1);") + tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 union select _rowts, first(c2) as a from {dbname}.ct1);") def check_boundary_values(self, dbname="bound_test"): diff --git a/tests/system-test/2-query/union.py b/tests/system-test/2-query/union.py index 547ab07eb0..2aa01f2c02 100644 --- a/tests/system-test/2-query/union.py +++ b/tests/system-test/2-query/union.py @@ -253,8 +253,8 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 0) - tdSql.error(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") - tdSql.error(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.query(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.query(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") tdSql.error(f"select irate(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") tdSql.error(f"select elapsed(ts) from (select * from {dbname}.t1 union select * from {dbname}.t1)") tdSql.error(f"select diff(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)")