From c472bf6b08032305e3cd36433cdd003e5d08acfc Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Thu, 14 Mar 2024 19:00:31 +0800 Subject: [PATCH 01/64] feat: tag supported with group/partition --- source/libs/parser/src/parTranslater.c | 51 ++++++++++++++------ tests/develop-test/2-query/pseudo_column.py | 8 +-- tests/system-test/2-query/count.py | 2 + tests/system-test/2-query/csum.py | 2 +- tests/system-test/2-query/group_partition.py | 6 +++ 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 38737d7a17..6e34ab1b3b 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2688,6 +2688,20 @@ static EDealRes rewriteExprToGroupKeyFunc(STranslateContext* pCxt, SNode** pNode return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); } +static bool isTbnameFuction(SNode* pNode) { + return QUERY_NODE_FUNCTION == nodeType(pNode) && FUNCTION_TYPE_TBNAME == ((SFunctionNode*)pNode)->funcType; +} + +static bool hasTbnameFunction(SNodeList* pPartitionByList) { + SNode* pPartKey = NULL; + FOREACH(pPartKey, pPartitionByList) { + if (isTbnameFuction(pPartKey)) { + return true; + } + } + return false; +} + static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { STranslateContext* pCxt = (STranslateContext*)pContext; SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt; @@ -2699,15 +2713,25 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { } SNode* pGroupNode = NULL; FOREACH(pGroupNode, getGroupByList(pCxt)) { - if (nodesEqualNode(getGroupByNode(pGroupNode), *pNode)) { + SNode* pActualNode = getGroupByNode(pGroupNode); + if (nodesEqualNode(pActualNode, *pNode)) { return DEAL_RES_IGNORE_CHILD; } + if (isTbnameFuction(pActualNode) && QUERY_NODE_COLUMN == nodeType(*pNode) && + ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) { + return rewriteExprToGroupKeyFunc(pCxt, pNode); + } } SNode* pPartKey = NULL; + bool partionByTbname = hasTbnameFunction(pSelect->pPartitionByList); FOREACH(pPartKey, pSelect->pPartitionByList) { if (nodesEqualNode(pPartKey, *pNode)) { return rewriteExprToGroupKeyFunc(pCxt, pNode); } + if ((partionByTbname) && QUERY_NODE_COLUMN == nodeType(*pNode) && + ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) { + return rewriteExprToGroupKeyFunc(pCxt, pNode); + } } if (NULL != pSelect->pWindow && QUERY_NODE_STATE_WINDOW == nodeType(pSelect->pWindow)) { if (nodesEqualNode(((SStateWindowNode*)pSelect->pWindow)->pExpr, *pNode)) { @@ -2771,10 +2795,15 @@ static EDealRes doCheckAggColCoexist(SNode** pNode, void* pContext) { return DEAL_RES_IGNORE_CHILD; } SNode* pPartKey = NULL; + bool partionByTbname = hasTbnameFunction(((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pPartitionByList); FOREACH(pPartKey, ((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pPartitionByList) { if (nodesEqualNode(pPartKey, *pNode)) { return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode); } + if (partionByTbname && QUERY_NODE_COLUMN == nodeType(*pNode) && + ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) { + return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode); + } } if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) { pCxt->existCol = true; @@ -3946,22 +3975,12 @@ static int32_t checkStateExpr(STranslateContext* pCxt, SNode* pNode) { return TSDB_CODE_SUCCESS; } -static bool hasPartitionByTbname(SNodeList* pPartitionByList) { - SNode* pPartKey = NULL; - FOREACH(pPartKey, pPartitionByList) { - if (QUERY_NODE_FUNCTION == nodeType(pPartKey) && FUNCTION_TYPE_TBNAME == ((SFunctionNode*)pPartKey)->funcType) { - return true; - } - } - return false; -} - static int32_t checkStateWindowForStream(STranslateContext* pCxt, SSelectStmt* pSelect) { if (!pCxt->createStream) { return TSDB_CODE_SUCCESS; } if (TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && - !hasPartitionByTbname(pSelect->pPartitionByList)) { + !hasTbnameFunction(pSelect->pPartitionByList)) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Unsupported stream query"); } return TSDB_CODE_SUCCESS; @@ -7539,12 +7558,12 @@ static int32_t translateKillTransaction(STranslateContext* pCxt, SKillStmt* pStm static bool crossTableWithoutAggOper(SSelectStmt* pSelect) { return NULL == pSelect->pWindow && !pSelect->hasAggFuncs && !pSelect->hasIndefiniteRowsFunc && !pSelect->hasInterpFunc && TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && - !hasPartitionByTbname(pSelect->pPartitionByList); + !hasTbnameFunction(pSelect->pPartitionByList); } static bool crossTableWithUdaf(SSelectStmt* pSelect) { return pSelect->hasUdaf && TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && - !hasPartitionByTbname(pSelect->pPartitionByList); + !hasTbnameFunction(pSelect->pPartitionByList); } static int32_t checkCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { @@ -7802,7 +7821,7 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; if ( (SRealTableNode*)pSelect->pFromTable && ((SRealTableNode*)pSelect->pFromTable)->pMeta && TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType - && !hasPartitionByTbname(pSelect->pPartitionByList) + && !hasTbnameFunction(pSelect->pPartitionByList) && pSelect->pWindow != NULL && pSelect->pWindow->type == QUERY_NODE_EVENT_WINDOW) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Event window for stream on super table must patitioned by table name"); @@ -7830,7 +7849,7 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm if (pSelect->pWindow != NULL && pSelect->pWindow->type == QUERY_NODE_COUNT_WINDOW) { if ( (SRealTableNode*)pSelect->pFromTable && ((SRealTableNode*)pSelect->pFromTable)->pMeta && TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType - && !hasPartitionByTbname(pSelect->pPartitionByList) ) { + && !hasTbnameFunction(pSelect->pPartitionByList) ) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Count window for stream on super table must patitioned by table name"); } diff --git a/tests/develop-test/2-query/pseudo_column.py b/tests/develop-test/2-query/pseudo_column.py index 1d94df4cff..61ea53433f 100644 --- a/tests/develop-test/2-query/pseudo_column.py +++ b/tests/develop-test/2-query/pseudo_column.py @@ -66,10 +66,10 @@ class TDTestCase: tdSql.query('select * from (select tbname, avg(f) from st partition by tbname) a partition by a.tbname order by a.tbname'); tdSql.checkRows(2) tdSql.checkCols(2) - tdSql.checkData(0, 0, 'ct1'); - tdSql.checkData(0, 1, 6.0); - tdSql.checkData(1, 0, 'ct2'); - tdSql.checkData(1, 1, 12.0); + tdSql.checkData(0, 0, 'ct1') + tdSql.checkData(0, 1, 6.0) + tdSql.checkData(1, 0, 'ct2') + tdSql.checkData(1, 1, 12.0) tdSql.error('select tbname from (select * from st)') tdSql.error('select st.tbname from (select st.tbname from st)') diff --git a/tests/system-test/2-query/count.py b/tests/system-test/2-query/count.py index c06ee28d02..f94e9eac00 100644 --- a/tests/system-test/2-query/count.py +++ b/tests/system-test/2-query/count.py @@ -103,6 +103,8 @@ class TDTestCase: tdSql.checkRows(row) tdSql.query(f'select {function_name}(c1),sum(c1) from {self.stbname} partition by tbname') tdSql.checkRows(row) + tdSql.query(f'select t0, {function_name}(c1),sum(c1) from {self.stbname} partition by tbname') + tdSql.checkRows(row) tdSql.query(f'select {function_name}(c1),sum(c1) from {self.stbname} partition by c1') tdSql.checkRows(0) tdSql.query(f'select {function_name}(c1),sum(c1) from {self.stbname} partition by t0') diff --git a/tests/system-test/2-query/csum.py b/tests/system-test/2-query/csum.py index b16f511491..f5e7456049 100644 --- a/tests/system-test/2-query/csum.py +++ b/tests/system-test/2-query/csum.py @@ -470,7 +470,7 @@ class TDTestCase: tdSql.checkRows(40) # bug need fix - tdSql.query("select tbname , csum(c1), csum(c12) from db.stb1 partition by tbname") + tdSql.query("select tbname , st1, csum(c1), csum(c12) from db.stb1 partition by tbname") tdSql.checkRows(40) tdSql.query("select tbname , csum(st1) from db.stb1 partition by tbname") tdSql.checkRows(70) diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py index a20b124c33..2d206ce228 100644 --- a/tests/system-test/2-query/group_partition.py +++ b/tests/system-test/2-query/group_partition.py @@ -100,6 +100,12 @@ class TDTestCase: tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} partition by t2, t3, tbname") tdSql.checkRows(check_num) + tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} group by tbname") + tdSql.checkRows(check_num) + + tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} partition by tbname") + tdSql.checkRows(check_num) + # multi tag + col tdSql.query(f"select t1, t2, c1, count(*) from {self.dbname}.{self.stable} partition by t1, t2, c1 ") tdSql.checkRows(nonempty_tb_num * self.row_nums) From 1d1770ecca3a5f5530ff2c316b74552a996f45c4 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Fri, 15 Mar 2024 09:09:51 +0800 Subject: [PATCH 02/64] fix: test case --- tests/script/tsim/parser/select_with_tags.sim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/script/tsim/parser/select_with_tags.sim b/tests/script/tsim/parser/select_with_tags.sim index 0e777de7e8..0cc8a7db8a 100644 --- a/tests/script/tsim/parser/select_with_tags.sim +++ b/tests/script/tsim/parser/select_with_tags.sim @@ -870,7 +870,7 @@ sql_error select stddev(c2), tbname from select_tags_mt0; sql_error select twa(c2), tbname from select_tags_mt0; sql_error select interp(c2), tbname from select_tags_mt0 where ts=100001; -sql_error select t1,t2,tbname from select_tags_mt0 group by tbname; + sql select count(tbname) from select_tags_mt0 interval(1d); sql select count(tbname) from select_tags_mt0 group by t1; sql select count(tbname),SUM(T1) from select_tags_mt0 interval(1d); @@ -888,16 +888,16 @@ sql_error select tbname, t1 from select_tags_mt0 interval(1y); print ==================================>TD-4231 sql select t1,tbname from select_tags_mt0 where c1<0 sql select t1,tbname from select_tags_mt0 where c1<0 and tbname in ('select_tags_tb12') - sql select tbname from select_tags_mt0 where tbname in ('select_tags_tb12'); -sql_error select first(c1), last(c2), t1 from select_tags_mt0 group by tbname; -sql_error select first(c1), last(c2), tbname, t2 from select_tags_mt0 group by tbname; -sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group by tbname; -#valid sql: select first(c1), t2 from select_tags_mt0 group by tbname; +sql select first(ts), tbname from select_tags_mt0 group by tbname; +sql select count(c1) from select_tags_mt0 where c1=99 group by tbname; +sql select count(*),tbname from select_tags_mt0 group by tbname -#sql select first(ts), tbname from select_tags_mt0 group by tbname; -#sql select count(c1) from select_tags_mt0 where c1=99 group by tbname; -#sql select count(*),tbname from select_tags_mt0 group by tbname +print ==================================> tag supported in group +sql select t1,t2,tbname from select_tags_mt0 group by tbname; +sql select first(c1), last(c2), t1 from select_tags_mt0 group by tbname; +sql select first(c1), last(c2), tbname, t2 from select_tags_mt0 group by tbname; +sql select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group by tbname; system sh/exec.sh -n dnode1 -s stop -x SIGINT From 932fba9f340056b3abd8c8b42a22daad190c70e4 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Fri, 15 Mar 2024 14:23:30 +0800 Subject: [PATCH 03/64] add test case --- tests/system-test/2-query/group_partition.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py index 2d206ce228..50325579c4 100644 --- a/tests/system-test/2-query/group_partition.py +++ b/tests/system-test/2-query/group_partition.py @@ -100,11 +100,18 @@ class TDTestCase: tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} partition by t2, t3, tbname") tdSql.checkRows(check_num) - tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} group by tbname") + tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} group by tbname order by tbname asc") tdSql.checkRows(check_num) + tdSql.checkData(0, 0, 0) + tdSql.checkData(1, 0, 1) + tdSql.checkData(2, 1, 20) + tdSql.checkData(3, 1, 30) - tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} partition by tbname") + tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} partition by tbname order by tbname asc") tdSql.checkRows(check_num) + tdSql.checkData(0, 0, 0) + tdSql.checkData(2, 1, 20) + tdSql.checkData(3, 1, 30) # multi tag + col tdSql.query(f"select t1, t2, c1, count(*) from {self.dbname}.{self.stable} partition by t1, t2, c1 ") From f0c6515e362df3d96a49fa418b1d32eb96a89e8d Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 19 Mar 2024 15:01:39 +0800 Subject: [PATCH 04/64] add testcase of disorder and null data in tmq test --- tests/system-test/7-tmq/tmq_ts4563.py | 38 ++++++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/tests/system-test/7-tmq/tmq_ts4563.py b/tests/system-test/7-tmq/tmq_ts4563.py index fc1cc259ce..a4b739f1ab 100644 --- a/tests/system-test/7-tmq/tmq_ts4563.py +++ b/tests/system-test/7-tmq/tmq_ts4563.py @@ -29,9 +29,11 @@ class TDTestCase: tdSql.execute(f'use db_stmt') tdSql.query("select ts,k from st") - tdSql.checkRows(2) + tdSql.checkRows(self.expected_affected_rows) tdSql.execute(f'create topic t_unorder_data as select ts,k from st') + tdSql.execute(f'create topic t_unorder_data_none as select i,k from st') + consumer_dict = { "group.id": "g1", "td.connect.user": "root", @@ -41,7 +43,7 @@ class TDTestCase: consumer = Consumer(consumer_dict) try: - consumer.subscribe(["t_unorder_data"]) + consumer.subscribe(["t_unorder_data", "t_unorder_data_none"]) except TmqError: tdLog.exit(f"subscribe error") @@ -49,19 +51,23 @@ class TDTestCase: try: while True: res = consumer.poll(1) - print(res) + print(cnt,res) if not res: - if cnt == 0: + print("111",cnt) + if cnt == 0 or cnt != 2*self.expected_affected_rows: tdLog.exit("consume error") break val = res.value() + print(val) if val is None: continue for block in val: + print(block.fetchall(),len(block.fetchall())) cnt += len(block.fetchall()) - - if cnt != 2: - tdLog.exit("consume error") + # print(cnt) + # if cnt != 3: + # tdLog.exit("consume error") + # print("polling") finally: consumer.close() @@ -110,20 +116,32 @@ class TDTestCase: params = new_multi_binds(2) params[0].timestamp((1626861392589, 1626861392590)) params[1].int([3, None]) - + # print(type(stmt)) tdLog.debug("bind_param_batch start") stmt.bind_param_batch(params) + tdLog.debug("bind_param_batch end") stmt.execute() tdLog.debug("execute end") + conn.execute("flush database %s" % dbname) + + params1 = new_multi_binds(2) + params1[0].timestamp((1626861392587,1626861392586)) + params1[1].int([None,3]) + stmt.bind_param_batch(params1) + stmt.execute() + end = datetime.now() print("elapsed time: ", end - start) - assert stmt.affected_rows == 2 + print(stmt.affected_rows) + self.expected_affected_rows = 4 + if stmt.affected_rows != self.expected_affected_rows : + tdLog.exit("affected_rows error") tdLog.debug("close start") stmt.close() - + # conn.execute("drop database if exists %s" % dbname) conn.close() From 34d081b1382a00103ff5c148250518af4eccc0f2 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 19 Mar 2024 16:45:28 +0800 Subject: [PATCH 05/64] add testcase of disorder and null data in tmq test --- tests/system-test/7-tmq/tmq_ts4563.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/system-test/7-tmq/tmq_ts4563.py b/tests/system-test/7-tmq/tmq_ts4563.py index a4b739f1ab..13f510ffe6 100644 --- a/tests/system-test/7-tmq/tmq_ts4563.py +++ b/tests/system-test/7-tmq/tmq_ts4563.py @@ -51,24 +51,17 @@ class TDTestCase: try: while True: res = consumer.poll(1) - print(cnt,res) + print(res) if not res: - print("111",cnt) if cnt == 0 or cnt != 2*self.expected_affected_rows: tdLog.exit("consume error") break val = res.value() - print(val) if val is None: continue for block in val: print(block.fetchall(),len(block.fetchall())) cnt += len(block.fetchall()) - # print(cnt) - # if cnt != 3: - # tdLog.exit("consume error") - # print("polling") - finally: consumer.close() From a60f390cdca214ecf3236a9ae4ebd61bd931f3a0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 21 Mar 2024 10:50:07 +0800 Subject: [PATCH 06/64] stream primary key --- include/common/tmsg.h | 2 + include/libs/nodes/plannodes.h | 1 + include/libs/planner/planner.h | 2 + source/common/src/tmsg.c | 32 + source/dnode/mnode/impl/src/mndStream.c | 45 +- source/libs/executor/inc/executorInt.h | 13 +- .../executor/src/streamcountwindowoperator.c | 26 +- .../executor/src/streameventwindowoperator.c | 42 +- .../executor/src/streamtimewindowoperator.c | 123 +- source/libs/nodes/src/nodesCloneFuncs.c | 14 + source/libs/nodes/src/nodesCodeFuncs.c | 7 + source/libs/nodes/src/nodesMsgFuncs.c | 9 +- source/libs/parser/inc/sql.y | 14 +- source/libs/parser/src/parTranslater.c | 139 +- source/libs/parser/src/sql.c | 6342 +++++++---------- source/libs/planner/src/planPhysiCreater.c | 3 + source/libs/stream/src/streamState.c | 4 +- source/libs/stream/src/tstreamFileState.c | 8 +- tests/script/auto.sh | 59 + tests/script/grep.sh | 1 + .../script/tsim/stream/checkpointSession1.sim | 2 + .../script/tsim/stream/streamPrimaryKey0.sim | 245 + .../script/tsim/stream/streamPrimaryKey1.sim | 123 + .../script/tsim/stream/streamPrimaryKey2.sim | 141 + tests/script/tsim/stream/udTableAndCol0.sim | 65 + tests/script/tsim/stream/udTableAndTag1.sim | 59 + 26 files changed, 3831 insertions(+), 3690 deletions(-) create mode 100755 tests/script/auto.sh create mode 100755 tests/script/grep.sh create mode 100644 tests/script/tsim/stream/streamPrimaryKey0.sim create mode 100644 tests/script/tsim/stream/streamPrimaryKey1.sim create mode 100644 tests/script/tsim/stream/streamPrimaryKey2.sim create mode 100644 tests/script/tsim/stream/udTableAndCol0.sim diff --git a/include/common/tmsg.h b/include/common/tmsg.h index abaa1b1854..79d0357c4f 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2467,6 +2467,8 @@ typedef struct { int8_t igUpdate; int64_t lastTs; SArray* pVgroupVerList; + // 3.3.0.0 + SArray* pCols; // array of SField } SCMCreateStreamReq; typedef struct { diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index cbf38102de..f199e572fd 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -578,6 +578,7 @@ typedef struct SWindowPhysiNode { int64_t watermark; int64_t deleteMark; int8_t igExpired; + int8_t destHasPrimayKey; bool mergeDataBlock; } SWindowPhysiNode; diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index 707d70b71b..a78fc4d2a6 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -44,6 +44,8 @@ typedef struct SPlanContext { const char* pUser; bool sysInfo; int64_t allocatorId; + bool destHasPrimaryKey; + bool sourceHasPrimaryKey; } SPlanContext; // Create the physical plan for the query, according to the AST. diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 9138d7c983..015cd55f79 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -7311,6 +7311,16 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI64(&encoder, p->ver) < 0) return -1; } + int32_t colSize = taosArrayGetSize(pReq->pCols); + if (tEncodeI32(&encoder, colSize) < 0) return -1; + for (int32_t i = 0; i < colSize; ++i) { + SField *pField = taosArrayGet(pReq->pCols, i); + if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI8(&encoder, pField->flags) < 0) return -1; + if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; + if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + } + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -7416,6 +7426,27 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea } } } + int32_t colSize = 0; + if (tDecodeI32(&decoder, &colSize) < 0) return -1; + if (colSize > 0) { + pReq->pCols = taosArrayInit(colSize, sizeof(SField)); + if (pReq->pCols == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + for (int32_t i = 0; i < colSize; ++i) { + SField field = {0}; + if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI8(&decoder, &field.flags) < 0) return -1; + if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; + if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + if (taosArrayPush(pReq->pCols, &field) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + } tEndDecode(&decoder); tDecoderClear(&decoder); @@ -7496,6 +7527,7 @@ void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) { taosArrayDestroy(pReq->pTags); taosArrayDestroy(pReq->fillNullCols); taosArrayDestroy(pReq->pVgroupVerList); + taosArrayDestroy(pReq->pCols); } int32_t tEncodeSRSmaParam(SEncoder *pCoder, const SRSmaParam *pRSmaParam) { diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 50e3dd0d03..bf88efdf10 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -287,6 +287,45 @@ static int32_t mndCheckCreateStreamReq(SCMCreateStreamReq *pCreate) { return 0; } +static int32_t createSchemaByFields(const SArray* pFields, SSchemaWrapper* pWrapper) { + pWrapper->nCols = taosArrayGetSize(pFields); + pWrapper->pSchema = taosMemoryCalloc(pWrapper->nCols, sizeof(SSchema)); + if (NULL == pWrapper->pSchema) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + SNode* pNode; + int32_t index = 0; + for(int32_t i = 0; i < pWrapper->nCols; i++) { + SField* pField = (SField*)taosArrayGet(pFields, i); + if (TSDB_DATA_TYPE_NULL == pField->type) { + pWrapper->pSchema[index].type = TSDB_DATA_TYPE_VARCHAR; + pWrapper->pSchema[index].bytes = VARSTR_HEADER_SIZE; + } else { + pWrapper->pSchema[index].type = pField->type; + pWrapper->pSchema[index].bytes = pField->bytes; + } + pWrapper->pSchema[index].colId = index + 1; + strcpy(pWrapper->pSchema[index].name, pField->name); + pWrapper->pSchema[index].flags = pField->flags; + index += 1; + } + + return TSDB_CODE_SUCCESS; +} + +static bool hasPrimaryKey(SSchemaWrapper* pWrapper) { + if (pWrapper->nCols < 2) { + return false; + } + for (int32_t i = 1; i < pWrapper->nCols; i++) { + if(pWrapper->pSchema[i].flags & COL_IS_KEY) { + return true; + } + } + return false; +} + static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, SCMCreateStreamReq *pCreate) { SNode *pAst = NULL; SQueryPlan *pPlan = NULL; @@ -352,8 +391,8 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, goto FAIL; } - // extract output schema from ast - if (qExtractResultSchema(pAst, (int32_t *)&pObj->outputSchema.nCols, &pObj->outputSchema.pSchema) != 0) { + // create output schema + if (createSchemaByFields(pCreate->pCols, &pObj->outputSchema) != TSDB_CODE_SUCCESS) { goto FAIL; } @@ -389,6 +428,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, pObj->outputSchema.pSchema = pFullSchema; } + bool hasKey = hasPrimaryKey(&pObj->outputSchema); SPlanContext cxt = { .pAstRoot = pAst, .topicQuery = false, @@ -398,6 +438,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, .igExpired = pObj->conf.igExpired, .deleteMark = pObj->deleteMark, .igCheckUpdate = pObj->igCheckUpdate, + .destHasPrimaryKey = hasKey, }; // using ast and param to build physical plan diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 98e96bb250..5e3469b8db 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -602,6 +602,8 @@ typedef struct SStreamIntervalOperatorInfo { bool recvPullover; SSDataBlock* pMidPulloverRes; bool clearState; + SSHashObj* pDeletedMap; + bool destHasPrimaryKey; } SStreamIntervalOperatorInfo; typedef struct SDataGroupInfo { @@ -652,6 +654,8 @@ typedef struct SStreamSessionAggOperatorInfo { SSDataBlock* pCheckpointRes; bool clearState; bool recvGetAll; + bool destHasPrimaryKey; + SSHashObj* pPkDeleted; } SStreamSessionAggOperatorInfo; typedef struct SStreamStateAggOperatorInfo { @@ -676,6 +680,8 @@ typedef struct SStreamStateAggOperatorInfo { bool reCkBlock; SSDataBlock* pCheckpointRes; bool recvGetAll; + SSHashObj* pPkDeleted; + bool destHasPrimaryKey; } SStreamStateAggOperatorInfo; typedef struct SStreamEventAggOperatorInfo { @@ -702,6 +708,8 @@ typedef struct SStreamEventAggOperatorInfo { SSDataBlock* pCheckpointRes; SFilterInfo* pStartCondInfo; SFilterInfo* pEndCondInfo; + SSHashObj* pPkDeleted; + bool destHasPrimaryKey; } SStreamEventAggOperatorInfo; typedef struct SStreamCountAggOperatorInfo { @@ -723,6 +731,8 @@ typedef struct SStreamCountAggOperatorInfo { bool reCkBlock; bool recvGetAll; SSDataBlock* pCheckpointRes; + SSHashObj* pPkDeleted; + bool destHasPrimaryKey; } SStreamCountAggOperatorInfo; typedef struct SStreamPartitionOperatorInfo { @@ -901,7 +911,7 @@ void initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* p void getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins); void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList); void getSessionHashKey(const SSessionKey* pKey, SSessionKey* pHashKey); -void deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, SSHashObj* pMapDelete); +void deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd); int32_t getAllSessionWindow(SSHashObj* pHashMap, SSHashObj* pStUpdated); int32_t closeSessionWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SSHashObj* pClosed); int32_t copyUpdateResult(SSHashObj** ppWinUpdated, SArray* pUpdated, __compar_fn_t compar); @@ -951,6 +961,7 @@ bool doDeleteSessionWindow(SStreamAggSupporter* pAggSup, SSessionKey* pK void saveDeleteInfo(SArray* pWins, SSessionKey key); void removeSessionResults(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SArray* pWins); void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted); +void copyDeleteSessionKey(SSHashObj* source, SSHashObj* dest); bool inSlidingWindow(SInterval* pInterval, STimeWindow* pWin, SDataBlockInfo* pBlockInfo); bool inCalSlidingWindow(SInterval* pInterval, STimeWindow* pWin, TSKEY calStart, TSKEY calEnd, EStreamType blockType); diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 720734431f..8199fe141f 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -24,7 +24,7 @@ #include "tlog.h" #include "ttime.h" -#define IS_FINAL_COUNT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_COUNT) +#define IS_NORMAL_COUNT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT) #define STREAM_COUNT_OP_STATE_NAME "StreamCountHistoryState" #define STREAM_COUNT_OP_CHECKPOINT_NAME "StreamCountOperator_Checkpoint" @@ -61,6 +61,8 @@ void destroyStreamCountAggOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); + taosMemoryFreeClear(param); } @@ -274,16 +276,20 @@ static void doStreamCountAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl pOperator, 0); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { qError("%s do stream count aggregate impl error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } saveSessionOutputBuf(pAggSup, &curWin.winInfo); + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_COUNT_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pStUpdated) { code = saveResult(curWin.winInfo, pStUpdated); if (code != TSDB_CODE_SUCCESS) { qError("%s do stream count aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { @@ -484,7 +490,7 @@ void doDeleteCountWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SAr } void deleteCountWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, - SSHashObj* pMapDelete) { + SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd) { SArray* pWins = taosArrayInit(16, sizeof(SSessionKey)); if (isSlidingCountWindow(pAggSup)) { doDeleteCountWindows(pAggSup, pBlock, pWins); @@ -493,6 +499,9 @@ void deleteCountWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHa } removeSessionResults(pAggSup, pMapUpdate, pWins); copyDeleteWindowInfo(pWins, pMapDelete); + if (needAdd) { + copyDeleteWindowInfo(pWins, pPkDelete); + } taosArrayDestroy(pWins); } @@ -542,7 +551,8 @@ static SSDataBlock* doStreamCountAgg(SOperatorInfo* pOperator) { printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo)); if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT) { - deleteCountWinState(&pInfo->streamAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted); + bool add = pInfo->destHasPrimaryKey && IS_NORMAL_COUNT_OP(pOperator); + deleteCountWinState(&pInfo->streamAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted, pInfo->pPkDeleted, add); continue; } else if (pBlock->info.type == STREAM_CLEAR) { doResetCountWindows(&pInfo->streamAggSup, pBlock); @@ -582,6 +592,10 @@ static SSDataBlock* doStreamCountAgg(SOperatorInfo* pOperator) { pInfo->pUpdated = NULL; blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); + if (pInfo->destHasPrimaryKey && IS_NORMAL_COUNT_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pStDeleted); + } + SSDataBlock* opRes = buildCountResult(pOperator); if (opRes) { return opRes; @@ -694,6 +708,8 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->recvGetAll = false; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); + pInfo->destHasPrimaryKey = pCountNode->window.destHasPrimayKey; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, true, diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index 11d8d1487a..1f5cb6be18 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -27,7 +27,7 @@ #include "tlog.h" #include "ttime.h" -#define IS_FINAL_EVENT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_EVENT) +#define IS_NORMAL_EVENT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT) #define STREAM_EVENT_OP_STATE_NAME "StreamEventHistoryState" #define STREAM_EVENT_OP_CHECKPOINT_NAME "StreamEventOperator_Checkpoint" @@ -66,6 +66,8 @@ void destroyStreamEventOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); + if (pInfo->pStartCondInfo != NULL) { filterFreeInfo(pInfo->pStartCondInfo); pInfo->pStartCondInfo = NULL; @@ -99,12 +101,17 @@ int32_t getEndCondIndex(bool* pEnd, int32_t start, int32_t rows) { return -1; } -void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupId, bool* pStart, bool* pEnd, int32_t index, int32_t rows, SEventWindowInfo* pCurWin, SSessionKey* pNextWinKey) { +static bool isWindowIncomplete(SEventWindowInfo* pWinInfo) { + return !(pWinInfo->pWinFlag->startFlag && pWinInfo->pWinFlag->endFlag); +} + +void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupId, bool* pStart, bool* pEnd, + int32_t index, int32_t rows, SEventWindowInfo* pCurWin, SSessionKey* pNextWinKey) { int32_t code = TSDB_CODE_SUCCESS; int32_t size = pAggSup->resultRowSize; - TSKEY ts = pTs [index]; - bool start = pStart[index]; - bool end = pEnd[index]; + TSKEY ts = pTs[index]; + bool start = pStart[index]; + bool end = pEnd[index]; pCurWin->winInfo.sessionWin.groupId = groupId; pCurWin->winInfo.sessionWin.win.skey = ts; pCurWin->winInfo.sessionWin.win.ekey = ts; @@ -117,7 +124,7 @@ void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupI bool inWin = isInTimeWindow(&leftWinKey.win, ts, 0); setEventWindowInfo(pAggSup, &leftWinKey, pVal, pCurWin); if(inWin || (pCurWin->pWinFlag->startFlag && !pCurWin->pWinFlag->endFlag) ) { - pCurWin->winInfo.isOutput = true; + pCurWin->winInfo.isOutput = !isWindowIncomplete(pCurWin); goto _end; } } @@ -130,7 +137,7 @@ void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupI int32_t endi = getEndCondIndex(pEnd, index, rows); if (endi < 0 || pTs[endi] >= rightWinKey.win.skey) { setEventWindowInfo(pAggSup, &rightWinKey, pVal, pCurWin); - pCurWin->winInfo.isOutput = true; + pCurWin->winInfo.isOutput = !isWindowIncomplete(pCurWin); goto _end; } } @@ -241,10 +248,6 @@ static int32_t compactEventWindow(SOperatorInfo* pOperator, SEventWindowInfo* pC return winNum; } -static bool isWindowIncomplete(SEventWindowInfo* pWinInfo) { - return !(pWinInfo->pWinFlag->startFlag && pWinInfo->pWinFlag->endFlag); -} - bool doDeleteEventWindow(SStreamAggSupporter* pAggSup, SSHashObj* pSeUpdated, SSessionKey* pKey) { pAggSup->stateStore.streamStateSessionDel(pAggSup->pState, pKey); removeSessionResult(pAggSup, pSeUpdated, pAggSup->pResultRows, pKey); @@ -322,6 +325,9 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); tSimpleHashRemove(pSeUpdated, &curWin.winInfo.sessionWin, sizeof(SSessionKey)); doDeleteEventWindow(pAggSup, pSeUpdated, &curWin.winInfo.sessionWin); + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_EVENT_OP(pOperator) && !isWindowIncomplete(&curWin)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } releaseOutputBuf(pAggSup->pState, curWin.winInfo.pStatePos, &pAPI->stateStore); SSessionKey tmpSeInfo = {0}; getSessionHashKey(&curWin.winInfo.sessionWin, &tmpSeInfo); @@ -331,7 +337,7 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl code = doOneWindowAggImpl(&pInfo->twAggSup.timeWindowData, &curWin.winInfo, &pResult, i, winRows, rows, numOfOutput, pOperator, 0); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } compactEventWindow(pOperator, &curWin, pInfo->pSeUpdated, pInfo->pSeDeleted, false); saveSessionOutputBuf(pAggSup, &curWin.winInfo); @@ -344,6 +350,10 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl continue; } + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_EVENT_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { code = saveResult(curWin.winInfo, pSeUpdated); } @@ -516,7 +526,8 @@ static SSDataBlock* doStreamEventAgg(SOperatorInfo* pOperator) { if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { - deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted); + bool add = pInfo->destHasPrimaryKey && IS_NORMAL_EVENT_OP(pOperator); + deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted, pInfo->pPkDeleted, add); continue; } else if (pBlock->info.type == STREAM_GET_ALL) { pInfo->recvGetAll = true; @@ -556,6 +567,9 @@ static SSDataBlock* doStreamEventAgg(SOperatorInfo* pOperator) { getMaxTsWins(pHisWins, pInfo->historyWins); taosArrayDestroy(pHisWins); } + if (pInfo->destHasPrimaryKey && IS_NORMAL_EVENT_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pSeDeleted); + } initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; @@ -737,6 +751,8 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->reCkBlock = false; pInfo->recvGetAll = false; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); + pInfo->destHasPrimaryKey = pEventNode->window.destHasPrimayKey; setOperatorInfo(pOperator, "StreamEventAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, true, OP_NOT_OPENED, pInfo, pTaskInfo); diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index a05e6fbfb8..07e81ed334 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -29,7 +29,13 @@ #define IS_FINAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) #define IS_MID_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) +#define IS_NORMAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) + #define IS_FINAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) +#define IS_NORMAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION || (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) + +#define IS_NORMAL_STATE_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) + #define DEAULT_DELETE_MARK INT64_MAX #define STREAM_INTERVAL_OP_STATE_NAME "StreamIntervalHistoryState" #define STREAM_SESSION_OP_STATE_NAME "StreamSessionHistoryState" @@ -426,6 +432,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { tSimpleHashCleanup(pInfo->pUpdatedMap); pInfo->pUpdatedMap = NULL; pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated); + tSimpleHashCleanup(pInfo->pDeletedMap); blockDataDestroy(pInfo->pCheckpointRes); @@ -520,9 +527,7 @@ int32_t setIntervalOutputBuf(void* pState, STimeWindow* win, SRowBuffPos** pResu char* value = NULL; int32_t size = pAggSup->resultRowSize; - if (pStore->streamStateAddIfNotExist(pState, &key, (void**)&value, &size) < 0) { - return TSDB_CODE_OUT_OF_MEMORY; - } + int32_t code = pStore->streamStateAddIfNotExist(pState, &key, (void**)&value, &size); *pResult = (SRowBuffPos*)value; SResultRow* res = (SResultRow*)((*pResult)->pRowBuff); @@ -530,7 +535,7 @@ int32_t setIntervalOutputBuf(void* pState, STimeWindow* win, SRowBuffPos** pResu // set time window for current result res->win = (*win); setResultRowInitCtx(res, pCtx, numOfOutput, rowEntryInfoOffset); - return TSDB_CODE_SUCCESS; + return code; } bool isDeletedStreamWindow(STimeWindow* pWin, uint64_t groupId, void* pState, STimeWindowAggSupp* pTwSup, @@ -606,6 +611,7 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, SInterval* pInterval, SArray* pPullWins, int32_t numOfCh, SOperatorInfo* pOperator) { + SStreamIntervalOperatorInfo* pInfo = pOperator->info; SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); TSKEY* tsData = (TSKEY*)pStartCol->pData; SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); @@ -644,6 +650,9 @@ static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFina // add pull data request if (savePullWindow(&pull, pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pMap, &winRes, numOfCh); + if (pInfo->destHasPrimaryKey) { + tSimpleHashPut(pInfo->pDeletedMap,&winRes, sizeof(SWinKey), NULL, 0); + } qDebug("===stream===prepare final retrive for delete %" PRId64 ", size:%d", winRes.ts, numOfCh); } } @@ -668,6 +677,9 @@ static void addRetriveWindow(SArray* wins, SStreamIntervalOperatorInfo* pInfo, i // add pull data request if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pInfo->pPullDataMap, winKey, pInfo->numOfChild); + if (pInfo->destHasPrimaryKey) { + tSimpleHashPut(pInfo->pDeletedMap,winKey, sizeof(SWinKey), NULL, 0); + } qDebug("===stream===prepare retrive for delete %" PRId64 ", size:%d", winKey->ts, pInfo->numOfChild); } } else { @@ -798,7 +810,7 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN } static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, uint64_t groupId, - SSHashObj* pUpdatedMap) { + SSHashObj* pUpdatedMap, SSHashObj* pDeletedMap) { SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperator->info; pInfo->dataVersion = TMAX(pInfo->dataVersion, pSDataBlock->info.version); @@ -866,6 +878,9 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat // add pull data request if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pInfo->pPullDataMap, &winRes, pInfo->numOfChild); + if (pInfo->destHasPrimaryKey) { + tSimpleHashPut(pInfo->pDeletedMap,&winRes, sizeof(SWinKey), NULL, 0); + } } } else { int32_t index = -1; @@ -893,9 +908,9 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat int32_t code = setIntervalOutputBuf(pInfo->pState, &nextWin, &pResPos, groupId, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, &pInfo->stateStore); pResult = (SResultRow*)pResPos->pRowBuff; - if (code != TSDB_CODE_SUCCESS || pResult == NULL) { + if (pResult == NULL) { qError("%s set interval output buff error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } if (IS_FINAL_INTERVAL_OP(pOperator)) { forwardRows = 1; @@ -908,6 +923,11 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat .ts = pResult->win.skey, .groupId = groupId, }; + + if (pInfo->destHasPrimaryKey && code == TSDB_CODE_SUCCESS && IS_NORMAL_INTERVAL_OP(pOperator)) { + tSimpleHashPut(pDeletedMap,&key, sizeof(SWinKey), NULL, 0); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pUpdatedMap) { saveWinResult(&key, pResPos, pUpdatedMap); } @@ -1165,6 +1185,16 @@ void doStreamIntervalSaveCheckpoint(SOperatorInfo* pOperator) { taosMemoryFree(buf); } +static void copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins) { + void* pIte = NULL; + int32_t iter = 0; + while ((pIte = tSimpleHashIterate(pMap, pIte, &iter)) != NULL) { + void* pKey = tSimpleHashGetKey(pIte, NULL); + taosArrayPush(pWins, pKey); + } + tSimpleHashClear(pMap); +} + static SSDataBlock* buildIntervalResult(SOperatorInfo* pOperator) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; @@ -1363,7 +1393,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL); } setInputDataBlock(pSup, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true); - doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap); + doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.watermark); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); @@ -1373,6 +1403,9 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { if (IS_FINAL_INTERVAL_OP(pOperator)) { closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, pInfo->pPullDataMap, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); + if (pInfo->destHasPrimaryKey) { + copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + } } pInfo->binfo.pRes->info.watermark = pInfo->twAggSup.maxTs; @@ -1567,6 +1600,8 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->pMidRetriveRes = createSpecialDataBlock(STREAM_MID_RETRIEVE); pInfo->pMidPulloverRes = createSpecialDataBlock(STREAM_MID_RETRIEVE); pInfo->clearState = false; + pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); + pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimayKey; pOperator->operatorType = pPhyNode->type; if (!IS_FINAL_INTERVAL_OP(pOperator) || numOfChild == 0) { @@ -1648,6 +1683,7 @@ void destroyStreamSessionAggOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); taosMemoryFreeClear(param); } @@ -1872,10 +1908,10 @@ void removeSessionDeleteResults(SSHashObj* pHashMap, SArray* pWins) { } int32_t size = taosArrayGetSize(pWins); for (int32_t i = 0; i < size; i++) { - SSessionKey* pWin = taosArrayGet(pWins, i); + SResultWindowInfo* pWin = taosArrayGet(pWins, i); if (!pWin) continue; SSessionKey key = {0}; - getSessionHashKey(pWin, &key); + getSessionHashKey(&pWin->sessionWin, &key); tSimpleHashRemove(pHashMap, &key, sizeof(SSessionKey)); } } @@ -2116,17 +2152,20 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData pOperator, winDelta); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { qError("%s do stream session aggregate impl error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } compactSessionWindow(pOperator, &winInfo, pStUpdated, pStDeleted, addGap); saveSessionOutputBuf(pAggSup, &winInfo); + if (pInfo->destHasPrimaryKey && winInfo.isOutput && IS_NORMAL_SESSION_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, winInfo.sessionWin); + } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pStUpdated) { code = saveResult(winInfo, pStUpdated); if (code != TSDB_CODE_SUCCESS) { qError("%s do stream session aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { @@ -2652,6 +2691,20 @@ void resetUnCloseSessionWinInfo(SSHashObj* winMap) { } } +void copyDeleteSessionKey(SSHashObj* source, SSHashObj* dest) { + if (tSimpleHashGetSize(source) == 0) { + return; + } + void* pIte = NULL; + int32_t iter = 0; + size_t keyLen = 0; + while ((pIte = tSimpleHashIterate(source, pIte, &iter)) != NULL) { + SSessionKey* pKey = tSimpleHashGetKey(pIte, &keyLen); + saveDeleteRes(dest, *pKey); + } + tSimpleHashClear(source); +} + static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { SExprSupp* pSup = &pOperator->exprSupp; SStreamSessionAggOperatorInfo* pInfo = pOperator->info; @@ -2712,6 +2765,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { rebuildSessionWindow(pOperator, pWins, pInfo->pStUpdated); } copyDeleteWindowInfo(pWins, pInfo->pStDeleted); + if (pInfo->destHasPrimaryKey && IS_NORMAL_SESSION_OP(pOperator)) { + copyDeleteWindowInfo(pWins, pInfo->pPkDeleted); + } taosArrayDestroy(pWins); continue; } else if (pBlock->info.type == STREAM_GET_ALL) { @@ -2767,6 +2823,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { if (pInfo->isHistoryOp) { getMaxTsWins(pInfo->pUpdated, pInfo->historyWins); } + if (pInfo->destHasPrimaryKey && IS_NORMAL_SESSION_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pStDeleted); + } initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); @@ -2992,6 +3051,8 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->clearState = false; pInfo->recvGetAll = false; + pInfo->destHasPrimaryKey = pSessionNode->window.destHasPrimayKey; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true, @@ -3032,11 +3093,14 @@ static void clearStreamSessionOperator(SStreamSessionAggOperatorInfo* pInfo) { } void deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, - SSHashObj* pMapDelete) { + SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd) { SArray* pWins = taosArrayInit(16, sizeof(SSessionKey)); doDeleteTimeWindows(pAggSup, pBlock, pWins); removeSessionResults(pAggSup, pMapUpdate, pWins); copyDeleteWindowInfo(pWins, pMapDelete); + if (needAdd) { + copyDeleteWindowInfo(pWins, pPkDelete); + } taosArrayDestroy(pWins); } @@ -3099,7 +3163,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { // gap must be 0 - deleteSessionWinState(pAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted); + deleteSessionWinState(pAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted, NULL, false); pInfo->clearState = true; break; } else if (pBlock->info.type == STREAM_GET_ALL) { @@ -3225,6 +3289,7 @@ void destroyStreamStateOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); blockDataDestroy(pInfo->pCheckpointRes); + tSimpleHashCleanup(pInfo->pPkDeleted); taosMemoryFreeClear(param); } @@ -3466,15 +3531,19 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl pOperator, 0); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { qError("%s do one window aggregate impl error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } saveSessionOutputBuf(pAggSup, &curWin.winInfo); + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_STATE_OP(pOperator)) { + saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); + } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { code = saveResult(curWin.winInfo, pSeUpdated); if (code != TSDB_CODE_SUCCESS) { qError("%s do stream state aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + break; } } @@ -3661,7 +3730,8 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { - deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted); + bool add = pInfo->destHasPrimaryKey && IS_NORMAL_STATE_OP(pOperator); + deleteSessionWinState(&pInfo->streamAggSup, pBlock, pInfo->pSeUpdated, pInfo->pSeDeleted, pInfo->pPkDeleted, add); continue; } else if (pBlock->info.type == STREAM_GET_ALL) { pInfo->recvGetAll = true; @@ -3697,6 +3767,9 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { if (pInfo->isHistoryOp) { getMaxTsWins(pInfo->pUpdated, pInfo->historyWins); } + if (pInfo->destHasPrimaryKey && IS_NORMAL_STATE_OP(pOperator)) { + copyDeleteSessionKey(pInfo->pPkDeleted, pInfo->pSeDeleted); + } initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; @@ -3878,6 +3951,8 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->recvGetAll = false; + pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); + pInfo->destHasPrimaryKey = pStateNode->window.destHasPrimayKey; setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED, pInfo, pTaskInfo); @@ -4018,7 +4093,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { } #endif - doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap); + doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap, pInfo->pDeletedMap); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); } @@ -4026,6 +4101,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); + if (pInfo->destHasPrimaryKey && IS_NORMAL_INTERVAL_OP(pOperator)) { + copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + } void* pIte = NULL; int32_t iter = 0; @@ -4142,6 +4220,10 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->recvGetAll = false; pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); + pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimayKey; + // for stream void* buff = NULL; int32_t len = 0; @@ -4220,8 +4302,9 @@ static void doStreamMidIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pS int32_t code = setIntervalOutputBuf(pInfo->pState, &nextWin, &pResPos, groupId, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, &pInfo->stateStore); pResult = (SResultRow*)pResPos->pRowBuff; - if (code != TSDB_CODE_SUCCESS || pResult == NULL) { - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + if (pResult == NULL) { + qError("%s set interval output buff error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); + break; } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 3e4b3cad31..0fb83fbac2 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include "cmdnodes.h" #include "nodesUtil.h" #include "plannodes.h" #include "querynodes.h" @@ -124,6 +125,15 @@ static int32_t columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) { return TSDB_CODE_SUCCESS; } +static int32_t columnDefNodeCopy(const SColumnDefNode* pSrc, SColumnDefNode* pDst) { + COPY_CHAR_ARRAY_FIELD(colName); + COPY_OBJECT_FIELD(dataType, sizeof(SDataType)); + COPY_CHAR_ARRAY_FIELD(comments); + COPY_SCALAR_FIELD(sma); + COPY_SCALAR_FIELD(is_pk); + return TSDB_CODE_SUCCESS; +} + static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { COPY_BASE_OBJECT_FIELD(node, exprNodeCopy); COPY_CHAR_POINT_FIELD(literal); @@ -717,6 +727,7 @@ static int32_t physiWindowCopy(const SWindowPhysiNode* pSrc, SWindowPhysiNode* p COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); COPY_SCALAR_FIELD(igExpired); + COPY_SCALAR_FIELD(destHasPrimayKey); return TSDB_CODE_SUCCESS; } @@ -834,6 +845,9 @@ SNode* nodesCloneNode(const SNode* pNode) { case QUERY_NODE_COLUMN: code = columnNodeCopy((const SColumnNode*)pNode, (SColumnNode*)pDst); break; + case QUERY_NODE_COLUMN_DEF: + code = columnDefNodeCopy((const SColumnDefNode*)pNode, (SColumnDefNode*)pDst); + break; case QUERY_NODE_VALUE: code = valueNodeCopy((const SValueNode*)pNode, (SValueNode*)pDst); break; diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 3191fa4774..2d2d2ad102 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -2511,6 +2511,7 @@ static const char* jkWindowPhysiPlanDeleteMark = "DeleteMark"; static const char* jkWindowPhysiPlanIgnoreExpired = "IgnoreExpired"; static const char* jkWindowPhysiPlanInputTsOrder = "InputTsOrder"; static const char* jkWindowPhysiPlanMergeDataBlock = "MergeDataBlock"; +static const char* jkWindowPhysiPlanDestHasPrimaryKey = "DestHasPrimaryKey"; static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { const SWindowPhysiNode* pNode = (const SWindowPhysiNode*)pObj; @@ -2543,6 +2544,9 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkWindowPhysiPlanMergeDataBlock, pNode->mergeDataBlock); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanDestHasPrimaryKey, pNode->destHasPrimayKey); + } return code; } @@ -2578,6 +2582,9 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkWindowPhysiPlanMergeDataBlock, &pNode->mergeDataBlock); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanDestHasPrimaryKey, &pNode->destHasPrimayKey); + } return code; } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 0639a161bd..20531798d7 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -2907,7 +2907,8 @@ enum { PHY_WINDOW_CODE_IG_EXPIRED, PHY_WINDOW_CODE_INPUT_TS_ORDER, PHY_WINDOW_CODE_OUTPUT_TS_ORDER, - PHY_WINDOW_CODE_MERGE_DATA_BLOCK + PHY_WINDOW_CODE_MERGE_DATA_BLOCK, + PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY, }; static int32_t physiWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { @@ -2941,6 +2942,9 @@ static int32_t physiWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeBool(pEncoder, PHY_WINDOW_CODE_MERGE_DATA_BLOCK, pNode->mergeDataBlock); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeI8(pEncoder, PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY, pNode->destHasPrimayKey); + } return code; } @@ -2982,6 +2986,9 @@ static int32_t msgToPhysiWindowNode(STlvDecoder* pDecoder, void* pObj) { case PHY_WINDOW_CODE_MERGE_DATA_BLOCK: code = tlvDecodeBool(pTlv, &pNode->mergeDataBlock); break; + case PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY: + code = tlvDecodeI8(pTlv, &pNode->destHasPrimayKey); + break; default: break; } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 6ae4f30443..6f53a3d252 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -680,13 +680,23 @@ cmd ::= RESUME STREAM exists_opt(A) ignore_opt(C) stream_name(B). %type col_list_opt { SNodeList* } %destructor col_list_opt { nodesDestroyList($$); } col_list_opt(A) ::= . { A = NULL; } -col_list_opt(A) ::= NK_LP col_name_list(B) NK_RP. { A = B; } +col_list_opt(A) ::= NK_LP column_stream_def_list(B) NK_RP. { A = B; } + +%type column_stream_def_list { SNodeList* } +%destructor column_stream_def_list { nodesDestroyList($$); } +column_stream_def_list(A) ::= column_stream_def(B). { A = createNodeList(pCxt, B); } +column_stream_def_list(A) ::= column_stream_def_list(B) + NK_COMMA column_stream_def(C). { A = addNodeToList(pCxt, B, C); } + +column_stream_def(A) ::= column_name(B). { A = createColumnDefNode(pCxt, &B, createDataType(TSDB_DATA_TYPE_NULL), NULL, false); } +column_stream_def(A) ::= column_name(B) PRIMARY KEY. { A = createColumnDefNode(pCxt, &B, createDataType(TSDB_DATA_TYPE_NULL), NULL, true); } +//column_stream_def(A) ::= column_def(B). { A = B; } %type tag_def_or_ref_opt { SNodeList* } %destructor tag_def_or_ref_opt { nodesDestroyList($$); } tag_def_or_ref_opt(A) ::= . { A = NULL; } tag_def_or_ref_opt(A) ::= tags_def(B). { A = B; } -tag_def_or_ref_opt(A) ::= TAGS NK_LP col_name_list(B) NK_RP. { A = B; } +tag_def_or_ref_opt(A) ::= TAGS NK_LP column_stream_def_list(B) NK_RP. { A = B; } stream_options(A) ::= . { A = createStreamOptions(pCxt); } stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index bc444ca042..f2285d57fd 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6060,22 +6060,26 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in return code; } -static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt) { - SHashObj* pHash = taosHashInit(LIST_LENGTH(pStmt->pTags) + LIST_LENGTH(pStmt->pCols), +static int32_t checkTableSchemaImpl(STranslateContext* pCxt, SNodeList* pTags, SNodeList* pCols, SNodeList* pRollupFuncs) { + SHashObj* pHash = taosHashInit(LIST_LENGTH(pTags) + LIST_LENGTH(pCols), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); if (NULL == pHash) { return TSDB_CODE_OUT_OF_MEMORY; } - int32_t code = checkTableTagsSchema(pCxt, pHash, pStmt->pTags); + int32_t code = checkTableTagsSchema(pCxt, pHash, pTags); if (TSDB_CODE_SUCCESS == code) { - code = checkTableColsSchema(pCxt, pHash, LIST_LENGTH(pStmt->pTags), pStmt->pCols, pStmt->pOptions->pRollupFuncs); + code = checkTableColsSchema(pCxt, pHash, LIST_LENGTH(pTags), pCols, pRollupFuncs); } taosHashCleanup(pHash); return code; } +static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt) { + return checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, pStmt->pOptions->pRollupFuncs); +} + static int32_t getTableDelayOrWatermarkOption(STranslateContext* pCxt, const char* pName, int64_t minVal, int64_t maxVal, SValueNode* pVal, int64_t* pMaxDelay) { int32_t code = (DEAL_RES_ERROR == translateValue(pCxt, pVal) ? pCxt->errCode : TSDB_CODE_SUCCESS); @@ -7693,7 +7697,7 @@ static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* a } static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, - SHashObj* pUserAliasSet) { + SHashObj* pUserAliasSet, SNodeList* pCols, SCMCreateStreamReq* pReq) { SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); if (NULL == pSelect->pWindow || (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstart", ((SFunctionNode*)pProj)->functionName))) { @@ -7709,18 +7713,27 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele if (TSDB_CODE_SUCCESS == code) { code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); } + + if (TSDB_CODE_SUCCESS == code && STREAM_CREATE_STABLE_TRUE == pReq->createStb) { + SColumnDefNode* pColDef = (SColumnDefNode*)nodesMakeNode(QUERY_NODE_COLUMN_DEF); + strcpy(pColDef->colName, pFunc->node.aliasName); + pColDef->dataType = pFunc->node.resType; + pColDef->sma = true; + pColDef->is_pk = false; + code = nodesListPushFront(pCols, (SNode*)pColDef); + } if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode((SNode*)pFunc); } return code; } -static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt) { +static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SNodeList* pCols, SCMCreateStreamReq* pReq) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; SHashObj* pUserAliasSet = NULL; int32_t code = checkProjectAlias(pCxt, pSelect->pProjectionList, &pUserAliasSet); if (TSDB_CODE_SUCCESS == code) { - code = addWstartTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet); + code = addWstartTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet, pCols, pReq); } taosHashCleanup(pUserAliasSet); return code; @@ -7838,6 +7851,44 @@ static int32_t addNullTagsToCreateStreamQuery(STranslateContext* pCxt, STableMet return addNullTagsForExistTable(pCxt, pMeta, (SSelectStmt*)pStmt->pQuery); } +static int32_t addColDefNodeByProj(SNodeList** ppCols, SNode* pProject, int8_t flags) { + SExprNode* pExpr = (SExprNode*)pProject; + SColumnDefNode* pColDef = (SColumnDefNode*)nodesMakeNode(QUERY_NODE_COLUMN_DEF); + strcpy(pColDef->colName, pExpr->userAlias); + pColDef->dataType = pExpr->resType; + pColDef->sma = flags & COL_SMA_ON; + pColDef->is_pk = flags & COL_IS_KEY; + return nodesListMakeAppend(ppCols, (SNode*)pColDef); +} + +static int32_t addColsToCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { + if ( STREAM_CREATE_STABLE_FALSE == pReq->createStb) { + return TSDB_CODE_SUCCESS; + } + SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; + SNode* pProject = NULL; + SNode* pNode = NULL; + if (0 != LIST_LENGTH(pStmt->pCols)) { + if (LIST_LENGTH(pStmt->pCols) != LIST_LENGTH(pSelect->pProjectionList)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); + } + FORBOTH(pNode, pStmt->pCols, pProject, pSelect->pProjectionList) { + SExprNode* pExpr = (SExprNode*)pProject; + SColumnDefNode* pColDef = (SColumnDefNode*)pNode; + pColDef->dataType = pExpr->resType; + } + return TSDB_CODE_SUCCESS; + } + + FOREACH(pProject, pSelect->pProjectionList) { + int32_t code = addColDefNodeByProj(&pStmt->pCols, pProject, 0); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + } + return TSDB_CODE_SUCCESS; +} + static int32_t addSubtableInfoToCreateStreamQuery(STranslateContext* pCxt, STableMeta* pMeta, SCreateStreamStmt* pStmt) { int32_t code = TSDB_CODE_SUCCESS; @@ -7944,7 +7995,8 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm return TSDB_CODE_SUCCESS; } -static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STableMeta* pMeta, SNodeList* pProjections) { +static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STableMeta* pMeta, SNodeList* pProjections, + SNodeList** ppCols) { if (getNumOfColumns(pMeta) != LIST_LENGTH(pProjections)) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); } @@ -7963,6 +8015,15 @@ static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STable } REPLACE_NODE(pFunc); } + SColumnDefNode* pColDef = (SColumnDefNode*)nodesMakeNode(QUERY_NODE_COLUMN_DEF); + strcpy(pColDef->colName, pSchema->name); + pColDef->dataType = dt; + pColDef->sma = pSchema->flags & COL_SMA_ON; + pColDef->is_pk = pSchema->flags & COL_IS_KEY; + int32_t code = nodesListMakeAppend(ppCols, (SNode*)pColDef); + if (TSDB_CODE_SUCCESS != code) { + return code; + } } return TSDB_CODE_SUCCESS; @@ -7970,6 +8031,7 @@ static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STable typedef struct SProjColPos { int32_t colId; + int8_t flags; SNode* pProj; } SProjColPos; @@ -7993,10 +8055,11 @@ static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSche if (!dataTypeEqual(&dt, &((SExprNode*)pNewProj)->resType)) { SNode* pFunc = NULL; code = createCastFunc(pCxt, pNewProj, dt, &pFunc); + strcpy(((SExprNode*)pFunc)->userAlias, ((SExprNode*)pNewProj)->userAlias); pNewProj = pFunc; } if (TSDB_CODE_SUCCESS == code) { - SProjColPos pos = {.colId = pSchema->colId, .pProj = pNewProj}; + SProjColPos pos = {.colId = pSchema->colId, .pProj = pNewProj, .flags = pSchema->flags}; code = (NULL == taosArrayPush(pProjColPos, &pos) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS); } if (TSDB_CODE_SUCCESS != code) { @@ -8028,13 +8091,13 @@ static int32_t setFillNullCols(SArray* pProjColPos, const STableMeta* pMeta, SCM return TSDB_CODE_SUCCESS; } -static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList* pCols, const STableMeta* pMeta, +static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppCols, const STableMeta* pMeta, SNodeList** pProjections, SCMCreateStreamReq* pReq) { - if (LIST_LENGTH(pCols) != LIST_LENGTH(*pProjections)) { + if (LIST_LENGTH((*ppCols)) != LIST_LENGTH(*pProjections)) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); } - SArray* pProjColPos = taosArrayInit(LIST_LENGTH(pCols), sizeof(SProjColPos)); + SArray* pProjColPos = taosArrayInit(LIST_LENGTH((*ppCols)), sizeof(SProjColPos)); if (NULL == pProjColPos) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -8043,10 +8106,10 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList* pCol bool hasPrimaryKey = false; SNode* pCol = NULL; SNode* pProj = NULL; - FORBOTH(pCol, pCols, pProj, *pProjections) { - const SSchema* pSchema = getNormalColSchema(pMeta, ((SColumnNode*)pCol)->colName); + FORBOTH(pCol, (*ppCols), pProj, *pProjections) { + const SSchema* pSchema = getNormalColSchema(pMeta, ((SColumnDefNode*)pCol)->colName); if (NULL == pSchema) { - code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, ((SColumnNode*)pCol)->colName); + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, ((SColumnDefNode*)pCol)->colName); } if (TSDB_CODE_SUCCESS == code) { code = addProjToProjColPos(pCxt, pSchema, pProj, pProjColPos); @@ -8065,31 +8128,37 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList* pCol } SNodeList* pNewProjections = NULL; + SNodeList* pNewCols = NULL; if (TSDB_CODE_SUCCESS == code) { taosArraySort(pProjColPos, projColPosCompar); int32_t num = taosArrayGetSize(pProjColPos); pNewProjections = nodesMakeList(); + pNewCols = nodesMakeList(); if (NULL == pNewProjections) { code = TSDB_CODE_OUT_OF_MEMORY; } for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < num; ++i) { SProjColPos* pPos = taosArrayGet(pProjColPos, i); code = nodesListStrictAppend(pNewProjections, pPos->pProj); + addColDefNodeByProj(&pNewCols, pPos->pProj, pPos->flags); pPos->pProj = NULL; } } - if (TSDB_CODE_SUCCESS == code && pMeta->tableInfo.numOfColumns > LIST_LENGTH(pCols)) { + if (TSDB_CODE_SUCCESS == code && pMeta->tableInfo.numOfColumns > LIST_LENGTH((*ppCols)) ) { code = setFillNullCols(pProjColPos, pMeta, pReq); } if (TSDB_CODE_SUCCESS == code) { taosArrayDestroy(pProjColPos); nodesDestroyList(*pProjections); + nodesDestroyList(*ppCols); *pProjections = pNewProjections; + *ppCols = pNewCols; } else { taosArrayDestroyEx(pProjColPos, projColPosDelete); nodesDestroyList(pNewProjections); + nodesDestroyList(pNewCols); } return code; @@ -8099,9 +8168,9 @@ static int32_t adjustProjectionsForExistTable(STranslateContext* pCxt, SCreateSt const STableMeta* pMeta, SCMCreateStreamReq* pReq) { SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; if (NULL == pStmt->pCols) { - return adjustDataTypeOfProjections(pCxt, pMeta, pSelect->pProjectionList); + return adjustDataTypeOfProjections(pCxt, pMeta, pSelect->pProjectionList, &pStmt->pCols); } - return adjustOrderOfProjections(pCxt, pStmt->pCols, pMeta, &pSelect->pProjectionList, pReq); + return adjustOrderOfProjections(pCxt, &pStmt->pCols, pMeta, &pSelect->pProjectionList, pReq); } static bool isGroupIdTagStream(const STableMeta* pMeta, SNodeList* pTags) { @@ -8151,9 +8220,9 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons SNode* pTag = NULL; SNode* pTagExpr = NULL; FORBOTH(pTag, pTags, pTagExpr, *pTagExprs) { - const SSchema* pSchema = getTagSchema(pMeta, ((SColumnNode*)pTag)->colName); + const SSchema* pSchema = getTagSchema(pMeta, ((SColumnDefNode*)pTag)->colName); if (NULL == pSchema) { - code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, ((SColumnNode*)pTag)->colName); + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, ((SColumnDefNode*)pTag)->colName); } if (TSDB_CODE_SUCCESS == code) { code = addProjToProjColPos(pCxt, pSchema, pTagExpr, pTagPos); @@ -8250,21 +8319,23 @@ static bool isTagDef(SNodeList* pTags) { if (NULL == pTags) { return false; } - return QUERY_NODE_COLUMN_DEF == nodeType(nodesListGetNode(pTags, 0)); + SColumnDefNode* pColDef = (SColumnDefNode*)nodesListGetNode(pTags, 0); + return TSDB_DATA_TYPE_NULL != pColDef->dataType.type; } static bool isTagBound(SNodeList* pTags) { if (NULL == pTags) { return false; } - return QUERY_NODE_COLUMN == nodeType(nodesListGetNode(pTags, 0)); + SColumnDefNode* pColDef = (SColumnDefNode*)nodesListGetNode(pTags, 0); + return TSDB_DATA_TYPE_NULL == pColDef->dataType.type; } static int32_t translateStreamTargetTable(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq, STableMeta** pMeta) { int32_t code = getTableMeta(pCxt, pStmt->targetDbName, pStmt->targetTabName, pMeta); if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) { - if (NULL != pStmt->pCols || isTagBound(pStmt->pTags)) { + if (isTagBound(pStmt->pTags)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pStmt->targetTabName); } pReq->createStb = STREAM_CREATE_STABLE_TRUE; @@ -8405,6 +8476,19 @@ static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta return nodesListAppend((*pSelect1)->pGroupByList, (SNode*)pNode2); } +static int32_t checkStreamDestTableSchema(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { + SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; + SNode* pProj = nodesListGetNode(pStmt->pCols, 0); + SColumnDefNode* pCol = (SColumnDefNode*)pProj; + if (pCol && pCol->dataType.type != TSDB_DATA_TYPE_TIMESTAMP) { + pCol->dataType = (SDataType){.type = TSDB_DATA_TYPE_TIMESTAMP, + .precision = 0, + .scale = 0, + .bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes}; + } + return checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, NULL); +} + static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { pCxt->createStream = true; STableMeta* pMeta = NULL; @@ -8416,7 +8500,10 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt code = translateQuery(pCxt, pStmt->pQuery); } if (TSDB_CODE_SUCCESS == code) { - code = addWstartTsToCreateStreamQuery(pCxt, pStmt->pQuery); + code = addColsToCreateStreamQuery(pCxt, pStmt, pReq); + } + if (TSDB_CODE_SUCCESS == code) { + code = addWstartTsToCreateStreamQuery(pCxt, pStmt->pQuery, pStmt->pCols, pReq); } if (TSDB_CODE_SUCCESS == code) { code = checkStreamQuery(pCxt, pStmt); @@ -8427,6 +8514,9 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt if (TSDB_CODE_SUCCESS == code) { code = adjustTags(pCxt, pStmt, pMeta, pReq); } + if (TSDB_CODE_SUCCESS == code) { + code = checkStreamDestTableSchema(pCxt, pStmt); + } if (TSDB_CODE_SUCCESS == code) { getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB); code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL); @@ -8495,6 +8585,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* columnDefNodeToField(pStmt->pTags, &pReq->pTags); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); } + columnDefNodeToField(pStmt->pCols, &pReq->pCols); pReq->igUpdate = pStmt->pOptions->ignoreUpdate; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 9b1e929b09..cb961f039b 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -25,8 +25,6 @@ ** input grammar file: */ /************ Begin %include sections from the grammar ************************/ -#line 11 "sql.y" - #include #include #include @@ -42,7 +40,6 @@ #include "parAst.h" #define YYSTACKDEPTH 0 -#line 46 "sql.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ @@ -457,29 +454,29 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 513 +#define YYNOCODE 515 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy18; - ENullOrder yy109; - int8_t yy125; - EOrder yy164; - int64_t yy207; - SShowTablesOption yy385; - SNodeList* yy388; - SDataType yy412; - int32_t yy424; - SAlterOption yy443; - STokenPair yy453; - SNode* yy560; - EShowKind yy591; - EOperatorType yy668; - EJoinType yy684; - SToken yy965; - bool yy983; + int32_t yy10; + int64_t yy89; + SShowTablesOption yy147; + EOrder yy248; + SNodeList* yy264; + EFillMode yy284; + EShowKind yy319; + STokenPair yy357; + bool yy547; + SDataType yy624; + SNode* yy752; + EJoinType yy792; + SToken yy879; + SAlterOption yy935; + ENullOrder yy937; + EOperatorType yy980; + int8_t yy983; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -495,18 +492,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 854 -#define YYNRULE 650 -#define YYNRULE_WITH_ACTION 650 +#define YYNSTATE 857 +#define YYNRULE 654 +#define YYNRULE_WITH_ACTION 654 #define YYNTOKEN 352 -#define YY_MAX_SHIFT 853 -#define YY_MIN_SHIFTREDUCE 1258 -#define YY_MAX_SHIFTREDUCE 1907 -#define YY_ERROR_ACTION 1908 -#define YY_ACCEPT_ACTION 1909 -#define YY_NO_ACTION 1910 -#define YY_MIN_REDUCE 1911 -#define YY_MAX_REDUCE 2560 +#define YY_MAX_SHIFT 856 +#define YY_MIN_SHIFTREDUCE 1264 +#define YY_MAX_SHIFTREDUCE 1917 +#define YY_ERROR_ACTION 1918 +#define YY_ACCEPT_ACTION 1919 +#define YY_NO_ACTION 1920 +#define YY_MIN_REDUCE 1921 +#define YY_MAX_REDUCE 2574 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -573,646 +570,652 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3149) +#define YY_ACTTAB_COUNT (3202) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 422, 413, 567, 2155, 704, 568, 1954, 2531, 168, 171, - /* 10 */ 399, 173, 48, 46, 1829, 400, 2103, 2103, 2153, 2040, - /* 20 */ 419, 1912, 1670, 2153, 1909, 703, 203, 716, 146, 468, - /* 30 */ 2532, 705, 484, 2216, 467, 1755, 1997, 1668, 2240, 38, - /* 40 */ 321, 2536, 127, 1698, 2531, 126, 125, 124, 123, 122, - /* 50 */ 121, 120, 119, 118, 41, 40, 2238, 724, 47, 45, - /* 60 */ 44, 43, 42, 2535, 184, 1750, 1699, 2532, 2534, 41, - /* 70 */ 40, 19, 1695, 47, 45, 44, 43, 42, 1676, 675, - /* 80 */ 575, 219, 2531, 568, 1954, 1696, 385, 127, 2220, 736, - /* 90 */ 126, 125, 124, 123, 122, 121, 120, 119, 118, 68, - /* 100 */ 2537, 203, 196, 434, 850, 2532, 705, 15, 433, 825, - /* 110 */ 824, 823, 822, 431, 2142, 821, 820, 151, 815, 814, - /* 120 */ 813, 812, 811, 810, 809, 150, 803, 802, 801, 430, - /* 130 */ 429, 798, 797, 796, 183, 182, 795, 301, 2458, 715, - /* 140 */ 1305, 138, 714, 238, 2531, 1757, 1758, 570, 572, 1962, - /* 150 */ 172, 737, 2101, 675, 569, 341, 2531, 47, 45, 44, - /* 160 */ 43, 42, 703, 203, 1303, 1304, 2240, 2532, 705, 1873, - /* 170 */ 2173, 137, 339, 74, 2537, 203, 73, 736, 610, 2532, - /* 180 */ 705, 412, 1730, 1740, 2237, 724, 368, 240, 2155, 1756, - /* 190 */ 1759, 570, 658, 1962, 63, 383, 1695, 587, 236, 549, - /* 200 */ 547, 544, 63, 2153, 1671, 584, 1669, 303, 41, 40, - /* 210 */ 1498, 1499, 47, 45, 44, 43, 42, 1934, 41, 40, - /* 220 */ 9, 34, 47, 45, 44, 43, 42, 41, 40, 52, - /* 230 */ 199, 47, 45, 44, 43, 42, 1674, 1675, 1727, 63, - /* 240 */ 1729, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 749, - /* 250 */ 745, 1748, 1749, 1751, 1752, 1753, 1754, 2, 48, 46, - /* 260 */ 698, 585, 2233, 365, 51, 1693, 419, 699, 1670, 794, - /* 270 */ 2326, 377, 518, 704, 475, 537, 2531, 737, 2101, 64, - /* 280 */ 536, 1755, 583, 1668, 1700, 41, 40, 2465, 2378, 47, - /* 290 */ 45, 44, 43, 42, 703, 203, 498, 208, 538, 2532, - /* 300 */ 705, 41, 40, 366, 500, 47, 45, 44, 43, 42, - /* 310 */ 1833, 1750, 1911, 2462, 478, 1784, 1695, 19, 1845, 534, - /* 320 */ 532, 1324, 367, 1323, 1676, 174, 217, 1923, 84, 83, - /* 330 */ 471, 513, 512, 216, 716, 146, 136, 135, 134, 133, - /* 340 */ 132, 131, 130, 129, 128, 656, 463, 461, 1765, 697, - /* 350 */ 850, 386, 1405, 15, 1695, 1463, 1325, 364, 1569, 1570, - /* 360 */ 450, 305, 486, 447, 443, 439, 436, 464, 736, 305, - /* 370 */ 12, 1454, 782, 781, 780, 1458, 779, 1460, 1461, 778, - /* 380 */ 775, 1785, 1469, 772, 1471, 1472, 769, 766, 763, 2149, - /* 390 */ 2150, 1757, 1758, 1407, 2227, 2206, 305, 525, 524, 523, - /* 400 */ 522, 517, 516, 515, 514, 369, 305, 428, 427, 504, - /* 410 */ 503, 502, 501, 495, 494, 493, 1676, 488, 487, 384, - /* 420 */ 44, 43, 42, 479, 1557, 1558, 716, 146, 1730, 1740, - /* 430 */ 1576, 305, 1677, 41, 40, 1756, 1759, 47, 45, 44, - /* 440 */ 43, 42, 1786, 718, 201, 2458, 2459, 564, 144, 2463, - /* 450 */ 1671, 1818, 1669, 2465, 2536, 51, 562, 2531, 30, 558, - /* 460 */ 554, 37, 417, 1779, 1780, 1781, 1782, 1783, 1787, 1788, - /* 470 */ 1789, 1790, 2199, 1904, 391, 390, 2535, 170, 1731, 2461, - /* 480 */ 2532, 2533, 1674, 1675, 1727, 1727, 1729, 1732, 1733, 1734, - /* 490 */ 1735, 1736, 1737, 1738, 1739, 749, 745, 1748, 1749, 1751, - /* 500 */ 1752, 1753, 1754, 2, 12, 48, 46, 63, 674, 785, - /* 510 */ 716, 146, 1298, 419, 482, 1670, 1731, 490, 2216, 41, - /* 520 */ 40, 1695, 35, 47, 45, 44, 43, 42, 1755, 2360, - /* 530 */ 1668, 1305, 1791, 1874, 1728, 256, 202, 2458, 2459, 2319, - /* 540 */ 144, 2463, 719, 326, 520, 2216, 389, 388, 1695, 612, - /* 550 */ 12, 179, 10, 659, 1300, 1303, 1304, 197, 1750, 1933, - /* 560 */ 604, 600, 596, 592, 19, 255, 221, 629, 628, 627, - /* 570 */ 2378, 1676, 1728, 614, 619, 143, 623, 613, 1903, 273, - /* 580 */ 622, 1854, 2326, 272, 753, 621, 626, 393, 392, 675, - /* 590 */ 2536, 620, 2531, 226, 616, 1696, 1855, 850, 1670, 808, - /* 600 */ 15, 1680, 2062, 466, 2360, 465, 96, 1698, 63, 253, - /* 610 */ 2537, 203, 2326, 1668, 2465, 2532, 705, 754, 1932, 1931, - /* 620 */ 204, 2458, 2459, 2359, 144, 2463, 2397, 577, 2279, 114, - /* 630 */ 2361, 757, 2363, 2364, 752, 464, 747, 1853, 1757, 1758, - /* 640 */ 2460, 186, 61, 2450, 1324, 2378, 1323, 415, 2446, 2078, - /* 650 */ 672, 659, 98, 452, 1676, 372, 112, 2326, 398, 753, - /* 660 */ 649, 142, 205, 792, 161, 160, 789, 788, 787, 158, - /* 670 */ 2480, 2326, 2326, 147, 305, 1730, 1740, 243, 36, 1325, - /* 680 */ 850, 2093, 1756, 1759, 41, 40, 252, 245, 47, 45, - /* 690 */ 44, 43, 42, 250, 581, 1897, 2090, 1671, 2359, 1669, - /* 700 */ 2155, 2397, 1930, 2288, 114, 2361, 757, 2363, 2364, 752, - /* 710 */ 1731, 747, 242, 2086, 149, 723, 156, 2421, 2450, 223, - /* 720 */ 1589, 1590, 415, 2446, 424, 661, 2279, 2148, 2150, 1674, - /* 730 */ 1675, 1727, 184, 1729, 1732, 1733, 1734, 1735, 1736, 1737, - /* 740 */ 1738, 1739, 749, 745, 1748, 1749, 1751, 1752, 1753, 1754, - /* 750 */ 2, 48, 46, 1760, 2360, 2326, 2221, 275, 1417, 419, - /* 760 */ 90, 1670, 2088, 89, 1588, 1591, 1728, 719, 2076, 2189, - /* 770 */ 1862, 303, 2084, 1416, 1755, 305, 1668, 95, 737, 2101, - /* 780 */ 1671, 528, 1669, 456, 694, 274, 2360, 792, 161, 160, - /* 790 */ 789, 788, 787, 158, 387, 2378, 737, 2101, 137, 754, - /* 800 */ 1929, 1964, 805, 2096, 1750, 615, 739, 2326, 2422, 753, - /* 810 */ 458, 454, 1674, 1675, 2336, 647, 56, 1676, 14, 13, - /* 820 */ 691, 690, 1860, 1861, 1863, 1864, 1865, 2378, 2092, 2155, - /* 830 */ 645, 88, 643, 270, 269, 741, 409, 2422, 2340, 2326, - /* 840 */ 539, 753, 1699, 850, 2153, 228, 49, 784, 2359, 1327, - /* 850 */ 1328, 2397, 1699, 2326, 114, 2361, 757, 2363, 2364, 752, - /* 860 */ 2000, 747, 2360, 1638, 1639, 281, 186, 807, 2450, 527, - /* 870 */ 227, 1928, 415, 2446, 1927, 751, 700, 695, 688, 684, - /* 880 */ 2359, 748, 2342, 2397, 1757, 1758, 114, 2361, 757, 2363, - /* 890 */ 2364, 752, 747, 747, 1926, 2481, 737, 2101, 2551, 617, - /* 900 */ 2450, 106, 1925, 2378, 415, 2446, 792, 161, 160, 789, - /* 910 */ 788, 787, 158, 312, 313, 2326, 472, 753, 311, 737, - /* 920 */ 2101, 1730, 1740, 1402, 2326, 1798, 2094, 2326, 1756, 1759, - /* 930 */ 737, 2101, 511, 629, 628, 627, 510, 606, 605, 473, - /* 940 */ 619, 143, 623, 1671, 509, 1669, 622, 2326, 625, 624, - /* 950 */ 492, 621, 626, 393, 392, 2326, 2359, 620, 2041, 2397, - /* 960 */ 616, 1699, 357, 2361, 757, 2363, 2364, 752, 750, 747, - /* 970 */ 738, 2415, 2077, 608, 607, 1674, 1675, 1727, 1922, 1729, - /* 980 */ 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 749, 745, - /* 990 */ 1748, 1749, 1751, 1752, 1753, 1754, 2, 48, 46, 2360, - /* 1000 */ 1826, 737, 2101, 2320, 2155, 419, 194, 1670, 1921, 614, - /* 1010 */ 636, 414, 754, 613, 2488, 737, 2101, 737, 2101, 2153, - /* 1020 */ 1755, 505, 1668, 737, 2101, 648, 737, 2101, 737, 2101, - /* 1030 */ 1920, 2326, 2360, 819, 817, 506, 95, 507, 737, 2101, - /* 1040 */ 2378, 271, 794, 586, 1695, 754, 2098, 2501, 276, 2307, - /* 1050 */ 1750, 171, 2326, 675, 753, 1919, 2531, 639, 284, 2104, - /* 1060 */ 1700, 2326, 2097, 1676, 633, 631, 737, 2101, 422, 148, - /* 1070 */ 1700, 268, 2421, 2378, 2537, 203, 171, 737, 2101, 2532, - /* 1080 */ 705, 2535, 1307, 2326, 2103, 2326, 722, 753, 1694, 850, - /* 1090 */ 737, 2101, 49, 2359, 737, 2101, 2397, 316, 711, 114, - /* 1100 */ 2361, 757, 2363, 2364, 752, 2310, 747, 2360, 2326, 2155, - /* 1110 */ 734, 2551, 72, 2450, 735, 71, 654, 415, 2446, 1918, - /* 1120 */ 754, 737, 2101, 660, 732, 198, 2359, 1917, 2336, 2397, - /* 1130 */ 1757, 1758, 114, 2361, 757, 2363, 2364, 752, 2155, 747, - /* 1140 */ 786, 322, 2344, 2146, 2551, 423, 2450, 708, 2378, 425, - /* 1150 */ 415, 2446, 2340, 2153, 1924, 2155, 441, 171, 737, 2101, - /* 1160 */ 2326, 790, 753, 1916, 2146, 2103, 675, 1730, 1740, 2531, - /* 1170 */ 2154, 1915, 2326, 675, 1756, 1759, 2531, 298, 426, 1700, - /* 1180 */ 2326, 791, 99, 1421, 2146, 1939, 845, 2537, 203, 1671, - /* 1190 */ 692, 1669, 2532, 705, 2537, 203, 2342, 416, 1420, 2532, - /* 1200 */ 705, 2359, 1914, 744, 2397, 3, 747, 175, 2361, 757, - /* 1210 */ 2363, 2364, 752, 1617, 747, 335, 2326, 54, 2132, 2470, - /* 1220 */ 1818, 1674, 1675, 1727, 2326, 1729, 1732, 1733, 1734, 1735, - /* 1230 */ 1736, 1737, 1738, 1739, 749, 745, 1748, 1749, 1751, 1752, - /* 1240 */ 1753, 1754, 2, 48, 46, 2360, 159, 2336, 2079, 676, - /* 1250 */ 2491, 419, 720, 1670, 76, 2326, 261, 139, 754, 259, - /* 1260 */ 686, 2345, 1728, 618, 263, 541, 1755, 262, 1668, 86, - /* 1270 */ 265, 2340, 1825, 264, 267, 1984, 159, 266, 2360, 210, - /* 1280 */ 159, 152, 1982, 651, 141, 650, 2378, 1400, 1973, 1971, - /* 1290 */ 285, 754, 682, 2524, 50, 50, 1750, 630, 2326, 2494, - /* 1300 */ 753, 1679, 675, 2347, 632, 2531, 14, 13, 87, 1676, - /* 1310 */ 634, 637, 187, 159, 50, 2342, 1906, 1907, 292, 2378, - /* 1320 */ 310, 55, 2379, 2537, 203, 747, 75, 157, 2532, 705, - /* 1330 */ 159, 2326, 66, 753, 100, 850, 50, 2038, 15, 2359, - /* 1340 */ 50, 2037, 2397, 2225, 761, 114, 2361, 757, 2363, 2364, - /* 1350 */ 752, 1633, 747, 157, 159, 1636, 1965, 2551, 140, 2450, - /* 1360 */ 1955, 2349, 111, 415, 2446, 712, 157, 1849, 1776, 1859, - /* 1370 */ 1858, 108, 2359, 2484, 707, 2397, 1757, 1758, 114, 2361, - /* 1380 */ 757, 2363, 2364, 752, 1678, 747, 799, 290, 721, 1586, - /* 1390 */ 2551, 1360, 2450, 800, 689, 314, 415, 2446, 405, 696, - /* 1400 */ 401, 729, 318, 2360, 726, 1447, 432, 1792, 843, 2226, - /* 1410 */ 1379, 1741, 709, 1730, 1740, 334, 754, 1377, 2469, 1476, - /* 1420 */ 1756, 1759, 1961, 2143, 668, 2485, 717, 2063, 1480, 1487, - /* 1430 */ 2495, 300, 1361, 1485, 297, 1671, 304, 1669, 440, 5, - /* 1440 */ 435, 162, 381, 448, 2378, 449, 1703, 459, 211, 212, - /* 1450 */ 460, 214, 329, 462, 1610, 1693, 2326, 476, 753, 1694, - /* 1460 */ 483, 225, 485, 489, 491, 530, 496, 1674, 1675, 1727, - /* 1470 */ 1682, 1729, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, - /* 1480 */ 749, 745, 1748, 1749, 1751, 1752, 1753, 1754, 2, 428, - /* 1490 */ 427, 508, 543, 519, 2218, 526, 521, 2359, 529, 1684, - /* 1500 */ 2397, 531, 542, 114, 2361, 757, 2363, 2364, 752, 540, - /* 1510 */ 747, 231, 1755, 230, 1677, 2551, 545, 2450, 546, 233, - /* 1520 */ 548, 415, 2446, 2360, 550, 1701, 565, 566, 4, 573, - /* 1530 */ 1696, 574, 576, 578, 241, 92, 754, 1702, 1704, 579, - /* 1540 */ 580, 244, 1750, 582, 1705, 2234, 588, 609, 655, 247, - /* 1550 */ 2297, 249, 93, 1681, 94, 1676, 254, 2360, 640, 641, - /* 1560 */ 653, 116, 97, 361, 2378, 153, 1697, 663, 664, 330, - /* 1570 */ 754, 277, 2280, 611, 662, 280, 2326, 2091, 753, 258, - /* 1580 */ 2087, 743, 260, 282, 164, 165, 2089, 2085, 166, 167, - /* 1590 */ 2360, 693, 667, 2294, 670, 2500, 727, 8, 2378, 2472, - /* 1600 */ 2499, 178, 702, 754, 2293, 291, 679, 293, 680, 678, - /* 1610 */ 2326, 295, 753, 677, 2554, 713, 406, 2359, 299, 294, - /* 1620 */ 2397, 287, 1818, 114, 2361, 757, 2363, 2364, 752, 710, - /* 1630 */ 747, 2378, 289, 145, 1698, 2425, 669, 2450, 1823, 296, - /* 1640 */ 206, 415, 2446, 2326, 2530, 753, 1821, 190, 306, 331, - /* 1650 */ 154, 2359, 725, 2466, 2397, 332, 730, 115, 2361, 757, - /* 1660 */ 2363, 2364, 752, 731, 747, 2360, 2248, 62, 2247, 155, - /* 1670 */ 105, 2450, 107, 759, 2246, 411, 2447, 333, 754, 2147, - /* 1680 */ 2431, 1685, 324, 1680, 2359, 2102, 336, 2397, 1282, 844, - /* 1690 */ 114, 2361, 757, 2363, 2364, 752, 847, 747, 2360, 1, - /* 1700 */ 360, 163, 2423, 53, 2450, 849, 2378, 2318, 415, 2446, - /* 1710 */ 373, 754, 345, 1688, 1690, 340, 359, 374, 2326, 349, - /* 1720 */ 753, 338, 2317, 2316, 81, 2311, 437, 745, 1748, 1749, - /* 1730 */ 1751, 1752, 1753, 1754, 2360, 438, 1661, 1662, 209, 2378, - /* 1740 */ 442, 2309, 444, 445, 446, 1660, 2308, 754, 382, 2306, - /* 1750 */ 451, 2326, 2305, 753, 453, 2304, 455, 2303, 457, 2359, - /* 1760 */ 1649, 2284, 2397, 213, 2283, 114, 2361, 757, 2363, 2364, - /* 1770 */ 752, 215, 747, 1613, 82, 2378, 1612, 740, 2261, 2450, - /* 1780 */ 2260, 2259, 470, 415, 2446, 469, 2258, 2326, 2257, 753, - /* 1790 */ 2208, 2360, 2359, 474, 1556, 2397, 2205, 477, 115, 2361, - /* 1800 */ 757, 2363, 2364, 752, 754, 747, 2204, 2198, 480, 481, - /* 1810 */ 2195, 218, 2450, 2194, 2360, 85, 2449, 2446, 2193, 2192, - /* 1820 */ 2197, 220, 2196, 2191, 2190, 2188, 2187, 754, 2359, 2360, - /* 1830 */ 2186, 2397, 2378, 2185, 115, 2361, 757, 2363, 2364, 752, - /* 1840 */ 222, 747, 754, 499, 2326, 497, 753, 2183, 2450, 2182, - /* 1850 */ 2181, 2180, 742, 2446, 2203, 2378, 2179, 2178, 2177, 2201, - /* 1860 */ 2184, 2176, 2175, 2174, 2172, 2171, 2170, 2326, 2169, 753, - /* 1870 */ 2378, 2168, 2167, 2166, 91, 2165, 224, 2164, 2163, 2202, - /* 1880 */ 2200, 2162, 2326, 2161, 753, 755, 2160, 229, 2397, 1562, - /* 1890 */ 2159, 115, 2361, 757, 2363, 2364, 752, 533, 747, 2158, - /* 1900 */ 2157, 535, 2156, 370, 1418, 2450, 1422, 2003, 2359, 376, - /* 1910 */ 2446, 2397, 2002, 232, 176, 2361, 757, 2363, 2364, 752, - /* 1920 */ 371, 747, 1414, 2359, 2001, 1999, 2397, 1996, 551, 175, - /* 1930 */ 2361, 757, 2363, 2364, 752, 553, 747, 2360, 552, 234, - /* 1940 */ 1995, 235, 555, 556, 1988, 557, 559, 560, 1975, 1950, - /* 1950 */ 754, 563, 561, 237, 2360, 78, 185, 1306, 1949, 79, - /* 1960 */ 2346, 239, 2282, 2278, 195, 571, 2268, 754, 706, 2552, - /* 1970 */ 2256, 246, 2492, 2360, 248, 2255, 2232, 251, 2378, 2080, - /* 1980 */ 1998, 1994, 589, 403, 590, 1992, 754, 593, 591, 594, - /* 1990 */ 2326, 1353, 753, 595, 1990, 2378, 597, 599, 598, 1987, - /* 2000 */ 404, 601, 603, 602, 1970, 1968, 1969, 2326, 1967, 753, - /* 2010 */ 1946, 2082, 65, 1491, 2378, 1492, 2081, 257, 1985, 1404, - /* 2020 */ 1403, 1401, 816, 1399, 1398, 1397, 2326, 1396, 753, 1395, - /* 2030 */ 818, 2359, 1392, 1391, 2397, 1390, 394, 358, 2361, 757, - /* 2040 */ 2363, 2364, 752, 1983, 747, 395, 1389, 2360, 2359, 1974, - /* 2050 */ 396, 2397, 1972, 635, 358, 2361, 757, 2363, 2364, 752, - /* 2060 */ 754, 747, 397, 638, 1945, 1944, 1943, 2359, 642, 2360, - /* 2070 */ 2397, 644, 1941, 351, 2361, 757, 2363, 2364, 752, 1942, - /* 2080 */ 747, 646, 754, 117, 2360, 1643, 2281, 1645, 2378, 2277, - /* 2090 */ 1642, 279, 1621, 1619, 2267, 665, 169, 751, 2254, 1623, - /* 2100 */ 2326, 1647, 753, 2253, 57, 29, 58, 2536, 69, 20, - /* 2110 */ 2378, 17, 671, 283, 31, 410, 666, 681, 1598, 701, - /* 2120 */ 1597, 402, 2326, 1876, 753, 2378, 673, 286, 6, 1850, - /* 2130 */ 685, 683, 7, 687, 21, 288, 177, 2326, 22, 753, - /* 2140 */ 1857, 2359, 188, 32, 2397, 1844, 189, 176, 2361, 757, - /* 2150 */ 2363, 2364, 752, 80, 747, 2360, 200, 2347, 33, 1896, - /* 2160 */ 67, 24, 1897, 2359, 1891, 657, 2397, 1890, 754, 358, - /* 2170 */ 2361, 757, 2363, 2364, 752, 407, 747, 23, 2359, 1895, - /* 2180 */ 18, 2397, 1894, 853, 357, 2361, 757, 2363, 2364, 752, - /* 2190 */ 2360, 747, 408, 2416, 60, 1815, 2378, 2252, 1814, 328, - /* 2200 */ 302, 418, 2553, 754, 2231, 180, 101, 102, 2326, 59, - /* 2210 */ 753, 2230, 103, 25, 26, 193, 108, 309, 1852, 191, - /* 2220 */ 320, 315, 70, 104, 841, 837, 833, 829, 1767, 325, - /* 2230 */ 11, 2378, 728, 317, 1766, 13, 420, 1686, 1777, 2400, - /* 2240 */ 181, 1745, 746, 2326, 1743, 753, 39, 192, 1742, 2359, - /* 2250 */ 16, 27, 2397, 1720, 1712, 358, 2361, 757, 2363, 2364, - /* 2260 */ 752, 2360, 747, 760, 758, 28, 421, 1477, 1474, 762, - /* 2270 */ 113, 764, 756, 319, 754, 765, 767, 1473, 770, 768, - /* 2280 */ 773, 1470, 771, 774, 2359, 2360, 1464, 2397, 1462, 776, - /* 2290 */ 358, 2361, 757, 2363, 2364, 752, 777, 747, 754, 109, - /* 2300 */ 323, 110, 2378, 1453, 1468, 783, 1486, 733, 77, 1467, - /* 2310 */ 1482, 1386, 1351, 1466, 2326, 1465, 753, 793, 1383, 1382, - /* 2320 */ 1381, 1380, 1378, 1376, 1375, 1412, 2378, 1374, 2360, 804, - /* 2330 */ 207, 1411, 1372, 806, 1369, 1371, 1370, 1368, 2326, 1367, - /* 2340 */ 753, 754, 1366, 1408, 1406, 1363, 1362, 1359, 1358, 1357, - /* 2350 */ 308, 1356, 1993, 826, 827, 652, 1991, 307, 2397, 828, - /* 2360 */ 830, 353, 2361, 757, 2363, 2364, 752, 832, 747, 2378, - /* 2370 */ 831, 1989, 834, 835, 836, 1986, 278, 838, 840, 2359, - /* 2380 */ 839, 2326, 2397, 753, 842, 343, 2361, 757, 2363, 2364, - /* 2390 */ 752, 1966, 747, 2360, 1295, 1940, 1283, 846, 327, 848, - /* 2400 */ 1910, 1672, 337, 851, 1910, 852, 754, 1910, 1910, 1910, - /* 2410 */ 2360, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2420 */ 1910, 1910, 2359, 754, 1910, 2397, 2360, 1910, 342, 2361, - /* 2430 */ 757, 2363, 2364, 752, 2378, 747, 1910, 1910, 1910, 754, - /* 2440 */ 1910, 1910, 1910, 1910, 1910, 1910, 2326, 1910, 753, 1910, - /* 2450 */ 1910, 2378, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2460 */ 1910, 1910, 1910, 2326, 1910, 753, 1910, 2378, 1910, 1910, - /* 2470 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 2326, - /* 2480 */ 1910, 753, 1910, 1910, 1910, 1910, 1910, 2359, 1910, 1910, - /* 2490 */ 2397, 1910, 1910, 344, 2361, 757, 2363, 2364, 752, 1910, - /* 2500 */ 747, 1910, 1910, 2360, 2359, 1910, 1910, 2397, 1910, 1910, - /* 2510 */ 350, 2361, 757, 2363, 2364, 752, 754, 747, 1910, 1910, - /* 2520 */ 2359, 2360, 1910, 2397, 1910, 1910, 354, 2361, 757, 2363, - /* 2530 */ 2364, 752, 1910, 747, 754, 1910, 1910, 2360, 1910, 1910, - /* 2540 */ 1910, 1910, 1910, 1910, 2378, 1910, 1910, 1910, 1910, 1910, - /* 2550 */ 754, 1910, 1910, 1910, 1910, 1910, 2326, 1910, 753, 1910, - /* 2560 */ 1910, 1910, 2378, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2570 */ 1910, 1910, 1910, 1910, 2326, 1910, 753, 1910, 2378, 1910, - /* 2580 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2590 */ 2326, 1910, 753, 1910, 1910, 1910, 1910, 2359, 1910, 1910, - /* 2600 */ 2397, 1910, 1910, 346, 2361, 757, 2363, 2364, 752, 1910, - /* 2610 */ 747, 1910, 1910, 1910, 2360, 2359, 1910, 1910, 2397, 1910, - /* 2620 */ 1910, 355, 2361, 757, 2363, 2364, 752, 754, 747, 1910, - /* 2630 */ 2360, 2359, 1910, 1910, 2397, 1910, 1910, 347, 2361, 757, - /* 2640 */ 2363, 2364, 752, 754, 747, 1910, 2360, 1910, 1910, 1910, - /* 2650 */ 1910, 1910, 1910, 1910, 1910, 2378, 1910, 1910, 1910, 754, - /* 2660 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 2326, 1910, 753, - /* 2670 */ 1910, 2378, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2680 */ 1910, 1910, 1910, 2326, 1910, 753, 1910, 2378, 1910, 1910, - /* 2690 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 2326, - /* 2700 */ 1910, 753, 1910, 1910, 1910, 1910, 1910, 1910, 2359, 1910, - /* 2710 */ 1910, 2397, 1910, 2360, 356, 2361, 757, 2363, 2364, 752, - /* 2720 */ 1910, 747, 1910, 1910, 2359, 1910, 754, 2397, 1910, 1910, - /* 2730 */ 348, 2361, 757, 2363, 2364, 752, 1910, 747, 1910, 2360, - /* 2740 */ 2359, 1910, 1910, 2397, 1910, 1910, 362, 2361, 757, 2363, - /* 2750 */ 2364, 752, 754, 747, 2378, 1910, 1910, 1910, 1910, 1910, - /* 2760 */ 1910, 1910, 1910, 1910, 1910, 1910, 2326, 1910, 753, 1910, - /* 2770 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2780 */ 2378, 1910, 2360, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2790 */ 1910, 1910, 2326, 1910, 753, 754, 1910, 1910, 1910, 1910, - /* 2800 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 2359, 1910, 1910, - /* 2810 */ 2397, 1910, 1910, 363, 2361, 757, 2363, 2364, 752, 2360, - /* 2820 */ 747, 1910, 1910, 2378, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2830 */ 1910, 1910, 754, 2359, 1910, 2326, 2397, 753, 1910, 2372, - /* 2840 */ 2361, 757, 2363, 2364, 752, 1910, 747, 1910, 1910, 2360, - /* 2850 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2860 */ 2378, 1910, 754, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2870 */ 1910, 1910, 2326, 1910, 753, 1910, 2359, 1910, 1910, 2397, - /* 2880 */ 1910, 1910, 2371, 2361, 757, 2363, 2364, 752, 1910, 747, - /* 2890 */ 2378, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2900 */ 1910, 1910, 2326, 1910, 753, 1910, 1910, 1910, 1910, 1910, - /* 2910 */ 1910, 1910, 1910, 2359, 2360, 1910, 2397, 1910, 1910, 2370, - /* 2920 */ 2361, 757, 2363, 2364, 752, 1910, 747, 754, 1910, 1910, - /* 2930 */ 1910, 1910, 2360, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2940 */ 1910, 1910, 1910, 2359, 1910, 754, 2397, 1910, 2360, 378, - /* 2950 */ 2361, 757, 2363, 2364, 752, 2378, 747, 1910, 1910, 1910, - /* 2960 */ 1910, 754, 1910, 1910, 1910, 1910, 1910, 2326, 1910, 753, - /* 2970 */ 1910, 1910, 1910, 2378, 1910, 1910, 1910, 1910, 1910, 1910, - /* 2980 */ 1910, 1910, 1910, 1910, 1910, 2326, 1910, 753, 1910, 2378, - /* 2990 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 3000 */ 1910, 2326, 1910, 753, 1910, 1910, 1910, 1910, 2359, 1910, - /* 3010 */ 1910, 2397, 1910, 1910, 379, 2361, 757, 2363, 2364, 752, - /* 3020 */ 1910, 747, 1910, 1910, 1910, 2360, 2359, 1910, 1910, 2397, - /* 3030 */ 1910, 1910, 375, 2361, 757, 2363, 2364, 752, 754, 747, - /* 3040 */ 1910, 2360, 2359, 1910, 1910, 2397, 1910, 1910, 380, 2361, - /* 3050 */ 757, 2363, 2364, 752, 754, 747, 1910, 1910, 1910, 1910, - /* 3060 */ 1910, 1910, 1910, 1910, 1910, 1910, 2378, 1910, 1910, 1910, - /* 3070 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 2326, 1910, - /* 3080 */ 753, 1910, 2378, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 3090 */ 1910, 1910, 1910, 1910, 2326, 1910, 753, 1910, 1910, 1910, - /* 3100 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, - /* 3110 */ 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 755, - /* 3120 */ 1910, 1910, 2397, 1910, 1910, 353, 2361, 757, 2363, 2364, - /* 3130 */ 752, 1910, 747, 1910, 1910, 2359, 1910, 1910, 2397, 1910, - /* 3140 */ 1910, 352, 2361, 757, 2363, 2364, 752, 1910, 747, + /* 0 */ 568, 2165, 423, 569, 1964, 576, 38, 322, 569, 1964, + /* 10 */ 165, 239, 48, 46, 1839, 571, 726, 1972, 2113, 2350, + /* 20 */ 420, 1922, 1680, 41, 40, 719, 146, 47, 45, 44, + /* 30 */ 43, 42, 175, 2102, 1933, 1765, 2007, 1678, 2250, 1705, + /* 40 */ 719, 146, 127, 2354, 618, 126, 125, 124, 123, 122, + /* 50 */ 121, 120, 119, 118, 41, 40, 2248, 727, 47, 45, + /* 60 */ 44, 43, 42, 401, 2297, 1760, 1709, 1330, 1408, 1329, + /* 70 */ 425, 19, 739, 2158, 2160, 41, 40, 1706, 1686, 47, + /* 80 */ 45, 44, 43, 42, 142, 740, 2111, 127, 588, 2356, + /* 90 */ 126, 125, 124, 123, 122, 121, 120, 119, 118, 750, + /* 100 */ 30, 742, 1331, 2436, 853, 209, 739, 15, 573, 828, + /* 110 */ 827, 826, 825, 432, 570, 824, 823, 151, 818, 817, + /* 120 */ 816, 815, 814, 813, 812, 150, 806, 805, 804, 431, + /* 130 */ 430, 801, 800, 799, 184, 183, 798, 302, 2472, 718, + /* 140 */ 174, 138, 717, 2165, 2545, 1767, 1768, 185, 2050, 106, + /* 150 */ 173, 721, 202, 2472, 2473, 342, 144, 2477, 735, 51, + /* 160 */ 740, 2111, 706, 204, 2550, 453, 224, 2546, 708, 386, + /* 170 */ 661, 2230, 340, 74, 2104, 1884, 73, 2165, 648, 1411, + /* 180 */ 137, 1708, 1740, 1750, 384, 811, 369, 611, 2072, 1766, + /* 190 */ 1769, 63, 2163, 646, 63, 644, 271, 270, 237, 550, + /* 200 */ 548, 545, 1504, 1505, 1681, 739, 1679, 90, 41, 40, + /* 210 */ 89, 1914, 47, 45, 44, 43, 42, 584, 41, 40, + /* 220 */ 1413, 1919, 47, 45, 44, 43, 42, 41, 40, 52, + /* 230 */ 200, 47, 45, 44, 43, 42, 1684, 1685, 1737, 63, + /* 240 */ 1739, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 752, + /* 250 */ 748, 1758, 1759, 1761, 1762, 1763, 1764, 2, 48, 46, + /* 260 */ 797, 476, 1705, 366, 707, 1703, 420, 2545, 1680, 1907, + /* 270 */ 1705, 378, 519, 740, 2111, 538, 697, 185, 88, 64, + /* 280 */ 537, 1765, 197, 1678, 1710, 706, 204, 467, 111, 466, + /* 290 */ 2546, 708, 51, 56, 2152, 457, 499, 108, 539, 707, + /* 300 */ 435, 2231, 2545, 367, 501, 434, 535, 533, 1708, 368, + /* 310 */ 2199, 1760, 1921, 218, 479, 1794, 1913, 19, 1883, 465, + /* 320 */ 706, 204, 459, 455, 1686, 2546, 708, 1855, 84, 83, + /* 330 */ 472, 429, 428, 217, 1944, 2374, 136, 135, 134, 133, + /* 340 */ 132, 131, 130, 129, 128, 304, 464, 462, 722, 63, + /* 350 */ 853, 387, 678, 15, 657, 2545, 1687, 365, 306, 1686, + /* 360 */ 451, 306, 487, 448, 444, 440, 437, 465, 703, 698, + /* 370 */ 691, 687, 702, 2551, 204, 12, 2392, 10, 2546, 708, + /* 380 */ 2088, 1795, 47, 45, 44, 43, 42, 2340, 2340, 657, + /* 390 */ 756, 1767, 1768, 2086, 2237, 2216, 306, 526, 525, 524, + /* 400 */ 523, 518, 517, 516, 515, 370, 306, 400, 2297, 505, + /* 410 */ 504, 503, 502, 496, 495, 494, 241, 489, 488, 385, + /* 420 */ 571, 2479, 1972, 480, 1563, 1564, 740, 2111, 1740, 1750, + /* 430 */ 1582, 2373, 1575, 1576, 2411, 1766, 1769, 114, 2375, 760, + /* 440 */ 2377, 2378, 755, 2298, 750, 565, 137, 2476, 2479, 187, + /* 450 */ 1681, 2464, 1679, 616, 563, 416, 2460, 559, 555, 306, + /* 460 */ 2302, 37, 418, 1789, 1790, 1791, 1792, 1793, 1797, 1798, + /* 470 */ 1799, 1800, 304, 512, 2475, 392, 391, 511, 2495, 2159, + /* 480 */ 2160, 701, 1684, 1685, 1737, 510, 1739, 1742, 1743, 1744, + /* 490 */ 1745, 1746, 1747, 1748, 1749, 752, 748, 1758, 1759, 1761, + /* 500 */ 1762, 1763, 1764, 2, 12, 48, 46, 485, 2226, 2392, + /* 510 */ 44, 43, 42, 420, 276, 1680, 306, 3, 795, 162, + /* 520 */ 161, 792, 791, 790, 159, 1690, 2250, 257, 1765, 54, + /* 530 */ 1678, 795, 162, 161, 792, 791, 790, 159, 2374, 2550, + /* 540 */ 1304, 413, 2545, 180, 2247, 727, 68, 390, 389, 12, + /* 550 */ 613, 722, 605, 601, 597, 593, 220, 256, 1760, 1311, + /* 560 */ 1709, 2549, 313, 314, 19, 2546, 2548, 312, 630, 629, + /* 570 */ 628, 1686, 700, 327, 615, 620, 143, 624, 614, 2392, + /* 580 */ 2479, 623, 1306, 1309, 1310, 2350, 622, 627, 394, 393, + /* 590 */ 1737, 2340, 621, 756, 1469, 617, 1843, 853, 96, 2358, + /* 600 */ 15, 254, 1705, 808, 491, 2226, 2474, 2374, 658, 2354, + /* 610 */ 1460, 785, 784, 783, 1464, 782, 1466, 1467, 781, 778, + /* 620 */ 757, 1475, 775, 1477, 1478, 772, 769, 766, 659, 1330, + /* 630 */ 1775, 1329, 1706, 662, 2373, 2087, 1705, 2411, 1767, 1768, + /* 640 */ 114, 2375, 760, 2377, 2378, 755, 95, 750, 2392, 63, + /* 650 */ 788, 662, 187, 222, 2464, 2356, 417, 160, 416, 2460, + /* 660 */ 2340, 585, 756, 388, 1331, 750, 521, 2226, 810, 244, + /* 670 */ 740, 2111, 2106, 206, 2550, 1740, 1750, 2545, 253, 246, + /* 680 */ 1796, 2494, 1766, 1769, 1709, 251, 582, 41, 40, 787, + /* 690 */ 473, 47, 45, 44, 43, 42, 2549, 1681, 2100, 1679, + /* 700 */ 2546, 2547, 1943, 2373, 243, 797, 2411, 578, 2289, 114, + /* 710 */ 2375, 760, 2377, 2378, 755, 227, 750, 586, 2243, 149, + /* 720 */ 1942, 157, 2435, 2464, 195, 664, 2289, 416, 2460, 1684, + /* 730 */ 1685, 1737, 55, 1739, 1742, 1743, 1744, 1745, 1746, 1747, + /* 740 */ 1748, 1749, 752, 748, 1758, 1759, 1761, 1762, 1763, 1764, + /* 750 */ 2, 48, 46, 1770, 2374, 2340, 1680, 1595, 1596, 420, + /* 760 */ 35, 1680, 740, 2111, 1741, 719, 146, 757, 274, 1974, + /* 770 */ 1801, 1678, 273, 2340, 1765, 1941, 1678, 198, 1710, 34, + /* 780 */ 1872, 2165, 474, 112, 2374, 41, 40, 1940, 410, 47, + /* 790 */ 45, 44, 43, 42, 9, 2392, 2163, 757, 1741, 2502, + /* 800 */ 147, 1594, 1597, 2165, 1760, 414, 1705, 2340, 2103, 756, + /* 810 */ 415, 2374, 1686, 172, 1423, 615, 306, 1686, 2163, 614, + /* 820 */ 1738, 2113, 740, 2111, 757, 2392, 2515, 2209, 2340, 1422, + /* 830 */ 694, 693, 1870, 1871, 1873, 1874, 1875, 2340, 853, 756, + /* 840 */ 2340, 98, 493, 853, 373, 529, 49, 399, 199, 650, + /* 850 */ 2373, 2096, 2392, 2411, 1738, 1709, 114, 2375, 760, 2377, + /* 860 */ 2378, 755, 2549, 750, 2340, 744, 756, 2436, 2565, 483, + /* 870 */ 2464, 2098, 740, 2111, 416, 2460, 1705, 203, 2472, 2473, + /* 880 */ 2373, 144, 2477, 2411, 1767, 1768, 114, 2375, 760, 2377, + /* 890 */ 2378, 755, 506, 750, 275, 423, 540, 2165, 2565, 1311, + /* 900 */ 2464, 2094, 1710, 172, 416, 2460, 282, 2373, 2183, 229, + /* 910 */ 2411, 2113, 2164, 114, 2375, 760, 2377, 2378, 755, 751, + /* 920 */ 750, 1740, 1750, 1309, 1310, 2565, 2051, 2464, 1766, 1769, + /* 930 */ 1469, 416, 2460, 528, 228, 1934, 740, 2111, 1681, 148, + /* 940 */ 1679, 677, 2435, 1681, 711, 1679, 1460, 785, 784, 783, + /* 950 */ 1464, 782, 1466, 1467, 781, 778, 507, 1475, 775, 1477, + /* 960 */ 1478, 772, 769, 766, 14, 13, 1333, 1334, 1741, 1689, + /* 970 */ 1684, 1685, 1648, 1649, 95, 1684, 1685, 1737, 1836, 1739, + /* 980 */ 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 752, 748, + /* 990 */ 1758, 1759, 1761, 1762, 1763, 1764, 2, 48, 46, 2374, + /* 1000 */ 2107, 740, 2111, 336, 2165, 420, 2142, 1680, 740, 2111, + /* 1010 */ 426, 424, 757, 2324, 689, 2508, 1864, 1427, 172, 2163, + /* 1020 */ 1765, 587, 1678, 36, 1738, 1828, 2113, 637, 508, 41, + /* 1030 */ 40, 1865, 1426, 47, 45, 44, 43, 42, 2374, 2321, + /* 1040 */ 2392, 2350, 649, 795, 162, 161, 792, 791, 790, 159, + /* 1050 */ 1760, 757, 2340, 2538, 756, 2359, 740, 2111, 272, 1939, + /* 1060 */ 740, 2111, 299, 1686, 442, 2354, 619, 740, 2111, 514, + /* 1070 */ 513, 1808, 1863, 1710, 640, 61, 2108, 740, 2111, 2392, + /* 1080 */ 277, 634, 632, 675, 719, 146, 1938, 285, 269, 853, + /* 1090 */ 1406, 2340, 49, 756, 1738, 2373, 1937, 725, 2411, 542, + /* 1100 */ 1936, 114, 2375, 760, 2377, 2378, 755, 789, 750, 2374, + /* 1110 */ 2156, 2356, 2340, 2565, 714, 2464, 740, 2111, 1935, 416, + /* 1120 */ 2460, 750, 754, 607, 606, 172, 740, 2111, 695, 72, + /* 1130 */ 1767, 1768, 71, 2114, 2373, 1932, 317, 2411, 1692, 2340, + /* 1140 */ 114, 2375, 760, 2377, 2378, 755, 737, 750, 99, 2340, + /* 1150 */ 2392, 1931, 2565, 2340, 2464, 710, 740, 2111, 416, 2460, + /* 1160 */ 740, 2111, 2340, 293, 756, 626, 625, 1740, 1750, 609, + /* 1170 */ 608, 2340, 740, 2111, 1766, 1769, 738, 41, 40, 1623, + /* 1180 */ 323, 47, 45, 44, 43, 42, 2484, 1828, 2340, 1681, + /* 1190 */ 2010, 1679, 427, 1930, 1929, 1928, 205, 2472, 2473, 1927, + /* 1200 */ 144, 2477, 1926, 1925, 2340, 2373, 1924, 793, 2411, 712, + /* 1210 */ 2156, 358, 2375, 760, 2377, 2378, 755, 753, 750, 741, + /* 1220 */ 2429, 1684, 1685, 1737, 76, 1739, 1742, 1743, 1744, 1745, + /* 1230 */ 1746, 1747, 1748, 1749, 752, 748, 1758, 1759, 1761, 1762, + /* 1240 */ 1763, 1764, 2, 48, 46, 2374, 2340, 2340, 2340, 469, + /* 1250 */ 1835, 420, 2340, 1680, 468, 2340, 2340, 747, 757, 2340, + /* 1260 */ 2483, 822, 820, 630, 629, 628, 1765, 1313, 1678, 211, + /* 1270 */ 620, 143, 624, 1704, 794, 2089, 623, 2156, 87, 1949, + /* 1280 */ 848, 622, 627, 394, 393, 139, 2392, 621, 262, 264, + /* 1290 */ 617, 260, 263, 1994, 153, 286, 1760, 86, 2340, 266, + /* 1300 */ 756, 678, 265, 268, 2545, 2361, 267, 1992, 152, 1686, + /* 1310 */ 1983, 1981, 652, 153, 651, 631, 2333, 141, 2334, 1916, + /* 1320 */ 1917, 1688, 2551, 204, 685, 50, 2393, 2546, 708, 633, + /* 1330 */ 14, 13, 635, 638, 50, 853, 188, 1366, 15, 100, + /* 1340 */ 2048, 2373, 160, 2047, 2411, 2235, 1965, 114, 2375, 760, + /* 1350 */ 2377, 2378, 755, 171, 750, 1975, 50, 429, 428, 2565, + /* 1360 */ 655, 2464, 802, 2363, 2498, 416, 2460, 1694, 678, 1639, + /* 1370 */ 678, 2545, 692, 2545, 803, 311, 1767, 1768, 1367, 406, + /* 1380 */ 1765, 715, 1687, 75, 699, 158, 1385, 160, 1646, 2551, + /* 1390 */ 204, 2551, 204, 729, 2546, 708, 2546, 708, 1383, 1859, + /* 1400 */ 1869, 433, 402, 2236, 1971, 2153, 2374, 846, 671, 1868, + /* 1410 */ 1760, 291, 678, 1740, 1750, 2545, 66, 724, 2499, 757, + /* 1420 */ 1766, 1769, 1786, 1686, 50, 50, 764, 2509, 158, 720, + /* 1430 */ 298, 1592, 301, 2551, 204, 1681, 305, 1679, 2546, 708, + /* 1440 */ 2073, 5, 436, 382, 449, 441, 1713, 2392, 450, 746, + /* 1450 */ 315, 2374, 461, 160, 140, 158, 212, 460, 732, 2340, + /* 1460 */ 319, 756, 1453, 213, 757, 463, 663, 1684, 1685, 1737, + /* 1470 */ 215, 1739, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, + /* 1480 */ 752, 748, 1758, 1759, 1761, 1762, 1763, 1764, 2, 1616, + /* 1490 */ 1691, 1802, 2392, 330, 1703, 477, 1704, 484, 226, 1751, + /* 1500 */ 335, 1482, 2373, 1486, 2340, 2411, 756, 486, 114, 2375, + /* 1510 */ 760, 2377, 2378, 755, 490, 750, 492, 531, 678, 497, + /* 1520 */ 2439, 2545, 2464, 2374, 509, 2228, 416, 2460, 1493, 1491, + /* 1530 */ 163, 520, 522, 723, 527, 530, 757, 532, 543, 2551, + /* 1540 */ 204, 544, 541, 232, 2546, 708, 231, 2373, 546, 1695, + /* 1550 */ 2411, 1690, 234, 114, 2375, 760, 2377, 2378, 755, 547, + /* 1560 */ 750, 549, 551, 1711, 2392, 2437, 566, 2464, 4, 567, + /* 1570 */ 574, 416, 2460, 575, 577, 242, 2340, 92, 756, 1706, + /* 1580 */ 579, 1698, 1700, 245, 1712, 678, 580, 1714, 2545, 581, + /* 1590 */ 248, 583, 2374, 1715, 250, 748, 1758, 1759, 1761, 1762, + /* 1600 */ 1763, 1764, 93, 94, 2244, 757, 2551, 204, 589, 255, + /* 1610 */ 610, 2546, 708, 116, 362, 612, 2101, 259, 641, 2373, + /* 1620 */ 2097, 261, 2411, 642, 166, 114, 2375, 760, 2377, 2378, + /* 1630 */ 755, 167, 750, 2392, 656, 2099, 2095, 743, 168, 2464, + /* 1640 */ 169, 654, 2311, 416, 2460, 2340, 97, 756, 154, 1707, + /* 1650 */ 278, 2308, 2374, 2307, 331, 2290, 667, 666, 665, 670, + /* 1660 */ 283, 672, 281, 673, 696, 757, 682, 2514, 730, 2513, + /* 1670 */ 8, 179, 705, 288, 290, 683, 294, 680, 407, 2486, + /* 1680 */ 292, 681, 1828, 295, 716, 2568, 713, 296, 2373, 297, + /* 1690 */ 145, 2411, 1708, 2392, 115, 2375, 760, 2377, 2378, 755, + /* 1700 */ 2544, 750, 1833, 1831, 300, 2340, 191, 756, 2464, 307, + /* 1710 */ 728, 2480, 2463, 2460, 155, 332, 2258, 733, 156, 207, + /* 1720 */ 2257, 2374, 2256, 412, 333, 1, 734, 105, 2112, 62, + /* 1730 */ 334, 107, 762, 2445, 757, 2157, 337, 325, 1288, 850, + /* 1740 */ 847, 53, 164, 361, 374, 375, 852, 346, 2373, 360, + /* 1750 */ 339, 2411, 350, 341, 115, 2375, 760, 2377, 2378, 755, + /* 1760 */ 2332, 750, 2392, 2331, 2330, 81, 2374, 2325, 2464, 438, + /* 1770 */ 439, 1671, 745, 2460, 2340, 1672, 756, 210, 443, 757, + /* 1780 */ 2323, 445, 446, 447, 1670, 2322, 383, 2320, 452, 2319, + /* 1790 */ 454, 2374, 2318, 456, 2317, 458, 1659, 2294, 214, 2293, + /* 1800 */ 216, 1619, 82, 1618, 757, 2271, 2270, 2392, 2269, 470, + /* 1810 */ 471, 2268, 2267, 2218, 475, 1562, 2215, 758, 478, 2340, + /* 1820 */ 2411, 756, 2214, 115, 2375, 760, 2377, 2378, 755, 2208, + /* 1830 */ 750, 2205, 2392, 481, 482, 219, 2374, 2464, 2204, 2203, + /* 1840 */ 85, 377, 2460, 2202, 2340, 2207, 756, 221, 2206, 757, + /* 1850 */ 2201, 2200, 2198, 2197, 2196, 223, 498, 2195, 500, 2193, + /* 1860 */ 2192, 2191, 2373, 2190, 2213, 2411, 2374, 2189, 176, 2375, + /* 1870 */ 760, 2377, 2378, 755, 2188, 750, 2187, 2392, 2211, 757, + /* 1880 */ 2194, 2186, 2185, 2184, 2182, 2181, 2180, 2373, 2179, 2340, + /* 1890 */ 2411, 756, 2178, 177, 2375, 760, 2377, 2378, 755, 2177, + /* 1900 */ 750, 2176, 2175, 2374, 225, 2174, 2173, 2392, 2212, 2210, + /* 1910 */ 679, 2505, 2172, 91, 2171, 1568, 757, 2170, 230, 2340, + /* 1920 */ 2169, 756, 534, 2168, 536, 2167, 2166, 371, 2013, 1424, + /* 1930 */ 233, 1420, 2373, 2012, 235, 2411, 2011, 2374, 115, 2375, + /* 1940 */ 760, 2377, 2378, 755, 2392, 750, 1428, 709, 2566, 404, + /* 1950 */ 757, 2009, 2464, 372, 236, 2006, 2340, 2461, 756, 552, + /* 1960 */ 554, 553, 2373, 2005, 556, 2411, 557, 1998, 176, 2375, + /* 1970 */ 760, 2377, 2378, 755, 558, 750, 560, 562, 2392, 1985, + /* 1980 */ 561, 564, 2374, 405, 78, 238, 186, 2360, 1312, 1959, + /* 1990 */ 2340, 1960, 756, 2292, 196, 757, 572, 240, 79, 2373, + /* 2000 */ 2288, 2278, 2411, 2266, 247, 359, 2375, 760, 2377, 2378, + /* 2010 */ 755, 2506, 750, 249, 2265, 252, 2242, 2090, 1359, 2008, + /* 2020 */ 2004, 591, 590, 2392, 592, 2002, 595, 594, 596, 2000, + /* 2030 */ 600, 598, 599, 2373, 1997, 2340, 2411, 756, 603, 359, + /* 2040 */ 2375, 760, 2377, 2378, 755, 602, 750, 604, 1980, 2374, + /* 2050 */ 1978, 1979, 1977, 1956, 2092, 1498, 65, 1497, 2091, 1410, + /* 2060 */ 1409, 258, 757, 1407, 2374, 1405, 1396, 1404, 1403, 1402, + /* 2070 */ 1401, 819, 821, 1398, 1397, 1995, 1993, 757, 2373, 1395, + /* 2080 */ 1984, 2411, 395, 396, 352, 2375, 760, 2377, 2378, 755, + /* 2090 */ 2392, 750, 397, 636, 1982, 398, 639, 1955, 1954, 1953, + /* 2100 */ 643, 1952, 2340, 645, 756, 2392, 647, 117, 1653, 1655, + /* 2110 */ 411, 1951, 1657, 29, 1652, 2291, 658, 2340, 57, 756, + /* 2120 */ 69, 1643, 2287, 280, 2374, 1625, 1627, 1629, 2277, 668, + /* 2130 */ 704, 2264, 2263, 58, 674, 20, 669, 754, 170, 6, + /* 2140 */ 2550, 17, 1604, 1603, 284, 2373, 684, 403, 2411, 1886, + /* 2150 */ 31, 177, 2375, 760, 2377, 2378, 755, 1860, 750, 676, + /* 2160 */ 2373, 688, 287, 2411, 686, 2392, 359, 2375, 760, 2377, + /* 2170 */ 2378, 755, 690, 750, 7, 289, 21, 2340, 22, 756, + /* 2180 */ 190, 33, 201, 2361, 67, 24, 1867, 1854, 178, 189, + /* 2190 */ 32, 1901, 23, 80, 1900, 408, 1905, 2374, 1906, 1907, + /* 2200 */ 18, 1904, 409, 1825, 1824, 303, 2567, 60, 2262, 59, + /* 2210 */ 757, 181, 2241, 102, 2240, 101, 108, 103, 321, 25, + /* 2220 */ 2373, 2374, 310, 2411, 1862, 192, 358, 2375, 760, 2377, + /* 2230 */ 2378, 755, 316, 750, 757, 2430, 70, 104, 2392, 26, + /* 2240 */ 1777, 1776, 11, 419, 13, 1696, 1787, 2414, 318, 1755, + /* 2250 */ 2340, 749, 756, 731, 1753, 1730, 39, 763, 1752, 182, + /* 2260 */ 16, 422, 2392, 1722, 193, 767, 2374, 421, 27, 770, + /* 2270 */ 28, 773, 1474, 776, 2340, 1483, 756, 761, 1480, 757, + /* 2280 */ 765, 779, 324, 768, 759, 1479, 771, 1492, 1476, 774, + /* 2290 */ 786, 1470, 777, 2373, 1468, 660, 2411, 780, 1473, 359, + /* 2300 */ 2375, 760, 2377, 2378, 755, 2374, 750, 2392, 1472, 109, + /* 2310 */ 1459, 110, 77, 856, 1471, 1488, 796, 2373, 757, 2340, + /* 2320 */ 2411, 756, 1392, 359, 2375, 760, 2377, 2378, 755, 329, + /* 2330 */ 750, 1357, 1389, 1388, 1387, 1386, 1384, 1382, 1381, 2374, + /* 2340 */ 1380, 1418, 807, 1417, 809, 194, 2392, 208, 1378, 1377, + /* 2350 */ 1376, 1375, 757, 1374, 844, 840, 836, 832, 2340, 326, + /* 2360 */ 756, 1373, 653, 1372, 2374, 2411, 1414, 1412, 354, 2375, + /* 2370 */ 760, 2377, 2378, 755, 1369, 750, 1368, 757, 1365, 1364, + /* 2380 */ 2392, 1363, 1362, 2003, 829, 830, 831, 2001, 833, 834, + /* 2390 */ 835, 1999, 2340, 837, 756, 839, 1996, 841, 1976, 843, + /* 2400 */ 113, 2373, 1950, 320, 2411, 2392, 838, 344, 2375, 760, + /* 2410 */ 2377, 2378, 755, 842, 750, 845, 1301, 2340, 849, 756, + /* 2420 */ 1920, 1289, 328, 1682, 851, 855, 338, 854, 1920, 1920, + /* 2430 */ 1920, 1920, 1920, 1920, 1920, 2373, 1920, 736, 2411, 1920, + /* 2440 */ 2374, 343, 2375, 760, 2377, 2378, 755, 1920, 750, 1920, + /* 2450 */ 1920, 1920, 1920, 757, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2460 */ 2373, 2374, 1920, 2411, 1920, 1920, 345, 2375, 760, 2377, + /* 2470 */ 2378, 755, 1920, 750, 757, 1920, 1920, 1920, 1920, 1920, + /* 2480 */ 309, 2392, 1920, 1920, 1920, 1920, 1920, 308, 1920, 1920, + /* 2490 */ 1920, 1920, 1920, 2340, 1920, 756, 1920, 1920, 1920, 1920, + /* 2500 */ 1920, 1920, 2392, 1920, 1920, 1920, 279, 1920, 1920, 1920, + /* 2510 */ 1920, 1920, 1920, 1920, 2340, 1920, 756, 1920, 1920, 1920, + /* 2520 */ 1920, 2374, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2530 */ 1920, 1920, 1920, 1920, 757, 1920, 2373, 1920, 1920, 2411, + /* 2540 */ 1920, 1920, 351, 2375, 760, 2377, 2378, 755, 1920, 750, + /* 2550 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 2373, 1920, 1920, + /* 2560 */ 2411, 1920, 2392, 355, 2375, 760, 2377, 2378, 755, 1920, + /* 2570 */ 750, 1920, 1920, 1920, 2340, 1920, 756, 1920, 1920, 1920, + /* 2580 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2590 */ 2374, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2600 */ 1920, 1920, 1920, 757, 1920, 1920, 2374, 1920, 1920, 1920, + /* 2610 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 2373, 1920, 757, + /* 2620 */ 2411, 1920, 2374, 347, 2375, 760, 2377, 2378, 755, 1920, + /* 2630 */ 750, 2392, 1920, 1920, 1920, 757, 1920, 1920, 1920, 1920, + /* 2640 */ 1920, 1920, 1920, 2340, 1920, 756, 1920, 2392, 1920, 1920, + /* 2650 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 2340, + /* 2660 */ 1920, 756, 1920, 2392, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2670 */ 1920, 1920, 1920, 1920, 1920, 2340, 1920, 756, 1920, 1920, + /* 2680 */ 1920, 1920, 1920, 1920, 1920, 1920, 2373, 1920, 1920, 2411, + /* 2690 */ 1920, 1920, 356, 2375, 760, 2377, 2378, 755, 1920, 750, + /* 2700 */ 1920, 2374, 2373, 1920, 1920, 2411, 1920, 1920, 348, 2375, + /* 2710 */ 760, 2377, 2378, 755, 757, 750, 1920, 1920, 2373, 1920, + /* 2720 */ 2374, 2411, 1920, 1920, 357, 2375, 760, 2377, 2378, 755, + /* 2730 */ 1920, 750, 1920, 757, 1920, 1920, 2374, 1920, 1920, 1920, + /* 2740 */ 1920, 1920, 2392, 1920, 1920, 1920, 1920, 1920, 1920, 757, + /* 2750 */ 1920, 1920, 1920, 1920, 2340, 1920, 756, 1920, 1920, 1920, + /* 2760 */ 1920, 2392, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2770 */ 1920, 1920, 1920, 2340, 1920, 756, 1920, 2392, 1920, 1920, + /* 2780 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 2340, + /* 2790 */ 1920, 756, 1920, 1920, 1920, 1920, 2374, 2373, 1920, 1920, + /* 2800 */ 2411, 1920, 1920, 349, 2375, 760, 2377, 2378, 755, 757, + /* 2810 */ 750, 1920, 1920, 1920, 1920, 1920, 2373, 2374, 1920, 2411, + /* 2820 */ 1920, 1920, 363, 2375, 760, 2377, 2378, 755, 1920, 750, + /* 2830 */ 757, 1920, 2373, 1920, 1920, 2411, 1920, 2392, 364, 2375, + /* 2840 */ 760, 2377, 2378, 755, 1920, 750, 1920, 1920, 1920, 2340, + /* 2850 */ 1920, 756, 1920, 1920, 1920, 1920, 1920, 1920, 2392, 1920, + /* 2860 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2870 */ 2340, 1920, 756, 1920, 1920, 1920, 1920, 2374, 1920, 1920, + /* 2880 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2890 */ 757, 1920, 2373, 1920, 1920, 2411, 1920, 1920, 2386, 2375, + /* 2900 */ 760, 2377, 2378, 755, 1920, 750, 1920, 1920, 1920, 1920, + /* 2910 */ 1920, 1920, 1920, 2373, 1920, 1920, 2411, 1920, 2392, 2385, + /* 2920 */ 2375, 760, 2377, 2378, 755, 1920, 750, 1920, 1920, 1920, + /* 2930 */ 2340, 1920, 756, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2940 */ 1920, 1920, 1920, 1920, 1920, 1920, 2374, 1920, 1920, 1920, + /* 2950 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 757, + /* 2960 */ 1920, 1920, 2374, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 2970 */ 1920, 1920, 1920, 2373, 1920, 757, 2411, 1920, 2374, 2384, + /* 2980 */ 2375, 760, 2377, 2378, 755, 1920, 750, 2392, 1920, 1920, + /* 2990 */ 1920, 757, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 2340, + /* 3000 */ 1920, 756, 1920, 2392, 1920, 1920, 1920, 1920, 1920, 1920, + /* 3010 */ 1920, 1920, 1920, 1920, 1920, 2340, 1920, 756, 1920, 2392, + /* 3020 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, + /* 3030 */ 1920, 2340, 1920, 756, 1920, 1920, 1920, 1920, 1920, 1920, + /* 3040 */ 1920, 1920, 2373, 1920, 1920, 2411, 1920, 1920, 379, 2375, + /* 3050 */ 760, 2377, 2378, 755, 1920, 750, 1920, 2374, 2373, 1920, + /* 3060 */ 1920, 2411, 1920, 1920, 380, 2375, 760, 2377, 2378, 755, + /* 3070 */ 757, 750, 1920, 1920, 2373, 1920, 2374, 2411, 1920, 1920, + /* 3080 */ 376, 2375, 760, 2377, 2378, 755, 1920, 750, 1920, 757, + /* 3090 */ 1920, 1920, 2374, 1920, 1920, 1920, 1920, 1920, 2392, 1920, + /* 3100 */ 1920, 1920, 1920, 1920, 1920, 757, 1920, 1920, 1920, 1920, + /* 3110 */ 2340, 1920, 756, 1920, 1920, 1920, 1920, 2392, 1920, 1920, + /* 3120 */ 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 1920, 2340, + /* 3130 */ 1920, 756, 1920, 2392, 1920, 1920, 1920, 1920, 1920, 1920, + /* 3140 */ 1920, 1920, 1920, 1920, 1920, 2340, 1920, 756, 1920, 1920, + /* 3150 */ 1920, 1920, 1920, 2373, 1920, 1920, 2411, 1920, 1920, 381, + /* 3160 */ 2375, 760, 2377, 2378, 755, 1920, 750, 1920, 1920, 1920, + /* 3170 */ 1920, 1920, 758, 1920, 1920, 2411, 1920, 1920, 354, 2375, + /* 3180 */ 760, 2377, 2378, 755, 1920, 750, 1920, 1920, 2373, 1920, + /* 3190 */ 1920, 2411, 1920, 1920, 353, 2375, 760, 2377, 2378, 755, + /* 3200 */ 1920, 750, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 388, 388, 362, 396, 481, 365, 366, 484, 396, 396, - /* 10 */ 403, 377, 12, 13, 14, 403, 404, 404, 411, 385, - /* 20 */ 20, 0, 22, 411, 352, 502, 503, 367, 368, 431, - /* 30 */ 507, 508, 367, 368, 436, 35, 0, 37, 410, 470, - /* 40 */ 471, 481, 21, 20, 484, 24, 25, 26, 27, 28, + /* 0 */ 362, 396, 388, 365, 366, 362, 472, 473, 365, 366, + /* 10 */ 396, 363, 12, 13, 14, 367, 411, 369, 404, 384, + /* 20 */ 20, 0, 22, 8, 9, 367, 368, 12, 13, 14, + /* 30 */ 15, 16, 354, 398, 356, 35, 0, 37, 410, 20, + /* 40 */ 367, 368, 21, 408, 13, 24, 25, 26, 27, 28, /* 50 */ 29, 30, 31, 32, 8, 9, 428, 429, 12, 13, - /* 60 */ 14, 15, 16, 503, 396, 65, 20, 507, 508, 8, - /* 70 */ 9, 71, 20, 12, 13, 14, 15, 16, 78, 481, - /* 80 */ 362, 416, 484, 365, 366, 20, 418, 21, 420, 20, - /* 90 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 4, - /* 100 */ 502, 503, 395, 431, 104, 507, 508, 107, 436, 73, - /* 110 */ 74, 75, 76, 77, 407, 79, 80, 81, 82, 83, + /* 60 */ 14, 15, 16, 449, 450, 65, 20, 20, 37, 22, + /* 70 */ 406, 71, 20, 409, 410, 8, 9, 20, 78, 12, + /* 80 */ 13, 14, 15, 16, 37, 367, 368, 21, 70, 454, + /* 90 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 464, + /* 100 */ 33, 468, 55, 470, 104, 387, 20, 107, 14, 73, + /* 110 */ 74, 75, 76, 77, 20, 79, 80, 81, 82, 83, /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - /* 130 */ 94, 95, 96, 97, 98, 99, 100, 477, 478, 479, - /* 140 */ 23, 481, 482, 363, 484, 145, 146, 367, 14, 369, - /* 150 */ 18, 367, 368, 481, 20, 23, 484, 12, 13, 14, - /* 160 */ 15, 16, 502, 503, 47, 48, 410, 507, 508, 108, - /* 170 */ 0, 387, 40, 41, 502, 503, 44, 20, 394, 507, - /* 180 */ 508, 425, 182, 183, 428, 429, 54, 363, 396, 189, - /* 190 */ 190, 367, 20, 369, 107, 403, 20, 70, 66, 67, - /* 200 */ 68, 69, 107, 411, 204, 367, 206, 184, 8, 9, - /* 210 */ 145, 146, 12, 13, 14, 15, 16, 355, 8, 9, - /* 220 */ 42, 2, 12, 13, 14, 15, 16, 8, 9, 107, + /* 130 */ 94, 95, 96, 97, 98, 99, 100, 479, 480, 481, + /* 140 */ 377, 483, 484, 396, 486, 145, 146, 396, 385, 374, + /* 150 */ 18, 478, 479, 480, 481, 23, 483, 484, 411, 107, + /* 160 */ 367, 368, 504, 505, 3, 69, 65, 509, 510, 418, + /* 170 */ 20, 420, 40, 41, 399, 108, 44, 396, 21, 37, + /* 180 */ 387, 20, 182, 183, 403, 383, 54, 394, 386, 189, + /* 190 */ 190, 107, 411, 36, 107, 38, 39, 40, 66, 67, + /* 200 */ 68, 69, 145, 146, 204, 20, 206, 106, 8, 9, + /* 210 */ 109, 196, 12, 13, 14, 15, 16, 20, 8, 9, + /* 220 */ 78, 352, 12, 13, 14, 15, 16, 8, 9, 107, /* 230 */ 184, 12, 13, 14, 15, 16, 236, 237, 238, 107, /* 240 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, /* 250 */ 250, 251, 252, 253, 254, 255, 256, 257, 12, 13, - /* 260 */ 368, 423, 424, 18, 107, 20, 20, 20, 22, 70, - /* 270 */ 408, 71, 27, 481, 367, 30, 484, 367, 368, 147, - /* 280 */ 35, 35, 20, 37, 238, 8, 9, 454, 396, 12, - /* 290 */ 13, 14, 15, 16, 502, 503, 51, 387, 53, 507, - /* 300 */ 508, 8, 9, 58, 59, 12, 13, 14, 15, 16, - /* 310 */ 14, 65, 0, 480, 69, 115, 20, 71, 108, 412, - /* 320 */ 413, 20, 415, 22, 78, 354, 419, 356, 196, 197, - /* 330 */ 198, 161, 162, 201, 367, 368, 24, 25, 26, 27, - /* 340 */ 28, 29, 30, 31, 32, 117, 214, 215, 14, 457, - /* 350 */ 104, 106, 37, 107, 20, 104, 55, 225, 182, 183, - /* 360 */ 228, 274, 117, 231, 232, 233, 234, 235, 20, 274, - /* 370 */ 258, 120, 121, 122, 123, 124, 125, 126, 127, 128, - /* 380 */ 129, 181, 131, 132, 133, 134, 135, 136, 137, 409, - /* 390 */ 410, 145, 146, 78, 149, 150, 274, 152, 153, 154, - /* 400 */ 155, 156, 157, 158, 159, 160, 274, 12, 13, 164, - /* 410 */ 165, 166, 167, 168, 169, 170, 78, 172, 173, 174, - /* 420 */ 14, 15, 16, 178, 179, 180, 367, 368, 182, 183, - /* 430 */ 185, 274, 37, 8, 9, 189, 190, 12, 13, 14, - /* 440 */ 15, 16, 181, 476, 477, 478, 479, 51, 481, 482, - /* 450 */ 204, 273, 206, 454, 481, 107, 60, 484, 33, 63, - /* 460 */ 64, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 470 */ 270, 271, 0, 196, 39, 40, 503, 184, 182, 480, - /* 480 */ 507, 508, 236, 237, 238, 238, 240, 241, 242, 243, + /* 260 */ 70, 367, 20, 18, 483, 20, 20, 486, 22, 108, + /* 270 */ 20, 71, 27, 367, 368, 30, 188, 396, 177, 147, + /* 280 */ 35, 35, 395, 37, 238, 504, 505, 203, 107, 205, + /* 290 */ 509, 510, 107, 387, 407, 199, 51, 116, 53, 483, + /* 300 */ 431, 420, 486, 58, 59, 436, 412, 413, 20, 415, + /* 310 */ 0, 65, 0, 419, 69, 115, 301, 71, 108, 235, + /* 320 */ 504, 505, 226, 227, 78, 509, 510, 108, 196, 197, + /* 330 */ 198, 12, 13, 201, 355, 355, 24, 25, 26, 27, + /* 340 */ 28, 29, 30, 31, 32, 184, 214, 215, 368, 107, + /* 350 */ 104, 106, 483, 107, 396, 486, 37, 225, 274, 78, + /* 360 */ 228, 274, 117, 231, 232, 233, 234, 235, 280, 281, + /* 370 */ 282, 283, 20, 504, 505, 258, 396, 260, 509, 510, + /* 380 */ 0, 181, 12, 13, 14, 15, 16, 408, 408, 396, + /* 390 */ 410, 145, 146, 0, 149, 150, 274, 152, 153, 154, + /* 400 */ 155, 156, 157, 158, 159, 160, 274, 449, 450, 164, + /* 410 */ 165, 166, 167, 168, 169, 170, 363, 172, 173, 174, + /* 420 */ 367, 456, 369, 178, 179, 180, 367, 368, 182, 183, + /* 430 */ 185, 451, 182, 183, 454, 189, 190, 457, 458, 459, + /* 440 */ 460, 461, 462, 450, 464, 51, 387, 482, 456, 469, + /* 450 */ 204, 471, 206, 394, 60, 475, 476, 63, 64, 274, + /* 460 */ 392, 261, 262, 263, 264, 265, 266, 267, 268, 269, + /* 470 */ 270, 271, 184, 163, 482, 39, 40, 167, 498, 409, + /* 480 */ 410, 368, 236, 237, 238, 175, 240, 241, 242, 243, /* 490 */ 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - /* 500 */ 254, 255, 256, 257, 258, 12, 13, 107, 50, 117, - /* 510 */ 367, 368, 4, 20, 42, 22, 182, 367, 368, 8, - /* 520 */ 9, 20, 261, 12, 13, 14, 15, 16, 35, 355, - /* 530 */ 37, 23, 271, 108, 238, 35, 477, 478, 479, 431, - /* 540 */ 481, 482, 368, 34, 367, 368, 111, 112, 20, 114, - /* 550 */ 258, 51, 260, 367, 46, 47, 48, 437, 65, 355, - /* 560 */ 60, 61, 62, 63, 71, 65, 416, 73, 74, 75, - /* 570 */ 396, 78, 238, 138, 80, 81, 82, 142, 301, 140, - /* 580 */ 86, 22, 408, 144, 410, 91, 92, 93, 94, 481, - /* 590 */ 3, 97, 484, 416, 100, 20, 37, 104, 22, 383, - /* 600 */ 107, 206, 386, 203, 355, 205, 106, 20, 107, 109, - /* 610 */ 502, 503, 408, 37, 454, 507, 508, 368, 355, 355, - /* 620 */ 477, 478, 479, 449, 481, 482, 452, 441, 442, 455, - /* 630 */ 456, 457, 458, 459, 460, 235, 462, 78, 145, 146, - /* 640 */ 480, 467, 184, 469, 20, 396, 22, 473, 474, 0, - /* 650 */ 192, 367, 213, 69, 78, 216, 374, 408, 219, 410, - /* 660 */ 221, 37, 488, 138, 139, 140, 141, 142, 143, 144, - /* 670 */ 496, 408, 408, 391, 274, 182, 183, 177, 2, 55, - /* 680 */ 104, 399, 189, 190, 8, 9, 186, 187, 12, 13, - /* 690 */ 14, 15, 16, 193, 194, 108, 397, 204, 449, 206, - /* 700 */ 396, 452, 355, 392, 455, 456, 457, 458, 459, 460, - /* 710 */ 182, 462, 212, 397, 465, 411, 467, 468, 469, 65, - /* 720 */ 145, 146, 473, 474, 406, 441, 442, 409, 410, 236, - /* 730 */ 237, 238, 396, 240, 241, 242, 243, 244, 245, 246, + /* 500 */ 254, 255, 256, 257, 258, 12, 13, 367, 368, 396, + /* 510 */ 14, 15, 16, 20, 446, 22, 274, 33, 138, 139, + /* 520 */ 140, 141, 142, 143, 144, 206, 410, 35, 35, 45, + /* 530 */ 37, 138, 139, 140, 141, 142, 143, 144, 355, 483, + /* 540 */ 4, 425, 486, 51, 428, 429, 4, 111, 112, 258, + /* 550 */ 114, 368, 60, 61, 62, 63, 416, 65, 65, 23, + /* 560 */ 20, 505, 139, 140, 71, 509, 510, 144, 73, 74, + /* 570 */ 75, 78, 459, 34, 138, 80, 81, 82, 142, 396, + /* 580 */ 456, 86, 46, 47, 48, 384, 91, 92, 93, 94, + /* 590 */ 238, 408, 97, 410, 104, 100, 14, 104, 106, 398, + /* 600 */ 107, 109, 20, 13, 367, 368, 482, 355, 118, 408, + /* 610 */ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + /* 620 */ 368, 131, 132, 133, 134, 135, 136, 137, 117, 20, + /* 630 */ 14, 22, 20, 367, 451, 0, 20, 454, 145, 146, + /* 640 */ 457, 458, 459, 460, 461, 462, 376, 464, 396, 107, + /* 650 */ 117, 367, 469, 416, 471, 454, 455, 33, 475, 476, + /* 660 */ 408, 367, 410, 393, 55, 464, 367, 368, 78, 177, + /* 670 */ 367, 368, 402, 490, 483, 182, 183, 486, 186, 187, + /* 680 */ 181, 498, 189, 190, 20, 193, 194, 8, 9, 397, + /* 690 */ 387, 12, 13, 14, 15, 16, 505, 204, 397, 206, + /* 700 */ 509, 510, 355, 451, 212, 70, 454, 441, 442, 457, + /* 710 */ 458, 459, 460, 461, 462, 416, 464, 423, 424, 467, + /* 720 */ 355, 469, 470, 471, 184, 441, 442, 475, 476, 236, + /* 730 */ 237, 238, 108, 240, 241, 242, 243, 244, 245, 246, /* 740 */ 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - /* 750 */ 257, 12, 13, 14, 355, 408, 420, 446, 22, 20, - /* 760 */ 106, 22, 397, 109, 189, 190, 238, 368, 0, 0, - /* 770 */ 236, 184, 397, 37, 35, 274, 37, 376, 367, 368, - /* 780 */ 204, 87, 206, 199, 188, 139, 355, 138, 139, 140, - /* 790 */ 141, 142, 143, 144, 393, 396, 367, 368, 387, 368, - /* 800 */ 355, 370, 13, 402, 65, 394, 466, 408, 468, 410, - /* 810 */ 226, 227, 236, 237, 384, 21, 387, 78, 1, 2, - /* 820 */ 286, 287, 288, 289, 290, 291, 292, 396, 398, 396, - /* 830 */ 36, 177, 38, 39, 40, 466, 403, 468, 408, 408, - /* 840 */ 104, 410, 20, 104, 411, 151, 107, 397, 449, 56, - /* 850 */ 57, 452, 20, 408, 455, 456, 457, 458, 459, 460, - /* 860 */ 0, 462, 355, 217, 218, 397, 467, 78, 469, 175, - /* 870 */ 176, 355, 473, 474, 355, 368, 280, 281, 282, 283, - /* 880 */ 449, 397, 452, 452, 145, 146, 455, 456, 457, 458, - /* 890 */ 459, 460, 462, 462, 355, 496, 367, 368, 467, 13, - /* 900 */ 469, 374, 355, 396, 473, 474, 138, 139, 140, 141, - /* 910 */ 142, 143, 144, 139, 140, 408, 387, 410, 144, 367, - /* 920 */ 368, 182, 183, 37, 408, 108, 399, 408, 189, 190, - /* 930 */ 367, 368, 163, 73, 74, 75, 167, 372, 373, 387, - /* 940 */ 80, 81, 82, 204, 175, 206, 86, 408, 381, 382, - /* 950 */ 387, 91, 92, 93, 94, 408, 449, 97, 385, 452, - /* 960 */ 100, 20, 455, 456, 457, 458, 459, 460, 461, 462, - /* 970 */ 463, 464, 0, 372, 373, 236, 237, 238, 355, 240, + /* 750 */ 257, 12, 13, 14, 355, 408, 22, 145, 146, 20, + /* 760 */ 261, 22, 367, 368, 182, 367, 368, 368, 140, 370, + /* 770 */ 271, 37, 144, 408, 35, 355, 37, 437, 238, 2, + /* 780 */ 236, 396, 387, 374, 355, 8, 9, 355, 403, 12, + /* 790 */ 13, 14, 15, 16, 42, 396, 411, 368, 182, 370, + /* 800 */ 391, 189, 190, 396, 65, 388, 20, 408, 399, 410, + /* 810 */ 403, 355, 78, 396, 22, 138, 274, 78, 411, 142, + /* 820 */ 238, 404, 367, 368, 368, 396, 370, 0, 408, 37, + /* 830 */ 286, 287, 288, 289, 290, 291, 292, 408, 104, 410, + /* 840 */ 408, 213, 387, 104, 216, 87, 107, 219, 184, 221, + /* 850 */ 451, 397, 396, 454, 238, 20, 457, 458, 459, 460, + /* 860 */ 461, 462, 3, 464, 408, 468, 410, 470, 469, 42, + /* 870 */ 471, 397, 367, 368, 475, 476, 20, 479, 480, 481, + /* 880 */ 451, 483, 484, 454, 145, 146, 457, 458, 459, 460, + /* 890 */ 461, 462, 387, 464, 139, 388, 104, 396, 469, 23, + /* 900 */ 471, 397, 238, 396, 475, 476, 397, 451, 0, 151, + /* 910 */ 454, 404, 411, 457, 458, 459, 460, 461, 462, 397, + /* 920 */ 464, 182, 183, 47, 48, 469, 385, 471, 189, 190, + /* 930 */ 104, 475, 476, 175, 176, 356, 367, 368, 204, 467, + /* 940 */ 206, 50, 470, 204, 33, 206, 120, 121, 122, 123, + /* 950 */ 124, 125, 126, 127, 128, 129, 387, 131, 132, 133, + /* 960 */ 134, 135, 136, 137, 1, 2, 56, 57, 182, 37, + /* 970 */ 236, 237, 217, 218, 376, 236, 237, 238, 4, 240, /* 980 */ 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, /* 990 */ 251, 252, 253, 254, 255, 256, 257, 12, 13, 355, - /* 1000 */ 4, 367, 368, 431, 396, 20, 184, 22, 355, 138, - /* 1010 */ 4, 403, 368, 142, 370, 367, 368, 367, 368, 411, - /* 1020 */ 35, 387, 37, 367, 368, 19, 367, 368, 367, 368, - /* 1030 */ 355, 408, 355, 381, 382, 387, 376, 387, 367, 368, - /* 1040 */ 396, 35, 70, 387, 20, 368, 387, 370, 387, 0, - /* 1050 */ 65, 396, 408, 481, 410, 355, 484, 51, 387, 404, - /* 1060 */ 238, 408, 402, 78, 58, 59, 367, 368, 388, 465, - /* 1070 */ 238, 65, 468, 396, 502, 503, 396, 367, 368, 507, - /* 1080 */ 508, 3, 14, 408, 404, 408, 387, 410, 20, 104, - /* 1090 */ 367, 368, 107, 449, 367, 368, 452, 387, 33, 455, - /* 1100 */ 456, 457, 458, 459, 460, 0, 462, 355, 408, 396, - /* 1110 */ 387, 467, 106, 469, 387, 109, 431, 473, 474, 355, - /* 1120 */ 368, 367, 368, 431, 411, 184, 449, 355, 384, 452, - /* 1130 */ 145, 146, 455, 456, 457, 458, 459, 460, 396, 462, - /* 1140 */ 405, 387, 398, 408, 467, 403, 469, 33, 396, 388, - /* 1150 */ 473, 474, 408, 411, 356, 396, 51, 396, 367, 368, - /* 1160 */ 408, 405, 410, 355, 408, 404, 481, 182, 183, 484, - /* 1170 */ 411, 355, 408, 481, 189, 190, 484, 511, 387, 238, - /* 1180 */ 408, 405, 177, 22, 408, 358, 359, 502, 503, 204, - /* 1190 */ 500, 206, 507, 508, 502, 503, 452, 453, 37, 507, - /* 1200 */ 508, 449, 355, 71, 452, 33, 462, 455, 456, 457, - /* 1210 */ 458, 459, 460, 208, 462, 389, 408, 45, 392, 272, - /* 1220 */ 273, 236, 237, 238, 408, 240, 241, 242, 243, 244, + /* 1000 */ 402, 367, 368, 389, 396, 20, 392, 22, 367, 368, + /* 1010 */ 388, 403, 368, 0, 370, 421, 22, 22, 396, 411, + /* 1020 */ 35, 387, 37, 2, 238, 273, 404, 4, 387, 8, + /* 1030 */ 9, 37, 37, 12, 13, 14, 15, 16, 355, 0, + /* 1040 */ 396, 384, 19, 138, 139, 140, 141, 142, 143, 144, + /* 1050 */ 65, 368, 408, 370, 410, 398, 367, 368, 35, 355, + /* 1060 */ 367, 368, 513, 78, 51, 408, 13, 367, 368, 161, + /* 1070 */ 162, 108, 78, 238, 51, 184, 387, 367, 368, 396, + /* 1080 */ 387, 58, 59, 192, 367, 368, 355, 387, 65, 104, + /* 1090 */ 37, 408, 107, 410, 238, 451, 355, 387, 454, 104, + /* 1100 */ 355, 457, 458, 459, 460, 461, 462, 405, 464, 355, + /* 1110 */ 408, 454, 408, 469, 33, 471, 367, 368, 355, 475, + /* 1120 */ 476, 464, 368, 372, 373, 396, 367, 368, 502, 106, + /* 1130 */ 145, 146, 109, 404, 451, 355, 387, 454, 206, 408, + /* 1140 */ 457, 458, 459, 460, 461, 462, 387, 464, 177, 408, + /* 1150 */ 396, 355, 469, 408, 471, 296, 367, 368, 475, 476, + /* 1160 */ 367, 368, 408, 495, 410, 381, 382, 182, 183, 372, + /* 1170 */ 373, 408, 367, 368, 189, 190, 387, 8, 9, 208, + /* 1180 */ 387, 12, 13, 14, 15, 16, 272, 273, 408, 204, + /* 1190 */ 0, 206, 387, 355, 355, 355, 479, 480, 481, 355, + /* 1200 */ 483, 484, 355, 355, 408, 451, 355, 405, 454, 298, + /* 1210 */ 408, 457, 458, 459, 460, 461, 462, 463, 464, 465, + /* 1220 */ 466, 236, 237, 238, 117, 240, 241, 242, 243, 244, /* 1230 */ 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - /* 1240 */ 255, 256, 257, 12, 13, 355, 33, 384, 0, 497, - /* 1250 */ 498, 20, 431, 22, 117, 408, 110, 33, 368, 113, - /* 1260 */ 370, 398, 238, 13, 110, 104, 35, 113, 37, 45, - /* 1270 */ 110, 408, 276, 113, 110, 0, 33, 113, 355, 230, - /* 1280 */ 33, 33, 0, 220, 371, 222, 396, 37, 0, 0, - /* 1290 */ 65, 368, 33, 370, 33, 33, 65, 22, 408, 421, - /* 1300 */ 410, 37, 481, 49, 22, 484, 1, 2, 171, 78, - /* 1310 */ 22, 22, 33, 33, 33, 452, 145, 146, 493, 396, - /* 1320 */ 33, 108, 396, 502, 503, 462, 33, 33, 507, 508, - /* 1330 */ 33, 408, 33, 410, 109, 104, 33, 384, 107, 449, - /* 1340 */ 33, 384, 452, 421, 33, 455, 456, 457, 458, 459, - /* 1350 */ 460, 108, 462, 33, 33, 108, 0, 467, 33, 469, - /* 1360 */ 366, 107, 107, 473, 474, 300, 33, 108, 236, 108, - /* 1370 */ 108, 116, 449, 421, 296, 452, 145, 146, 455, 456, - /* 1380 */ 457, 458, 459, 460, 37, 462, 13, 108, 108, 108, - /* 1390 */ 467, 37, 469, 13, 499, 108, 473, 474, 499, 499, - /* 1400 */ 430, 108, 108, 355, 499, 108, 371, 108, 52, 421, - /* 1410 */ 37, 108, 298, 182, 183, 108, 368, 37, 370, 108, - /* 1420 */ 189, 190, 368, 407, 438, 421, 483, 386, 108, 108, - /* 1430 */ 421, 504, 78, 108, 475, 204, 486, 206, 51, 277, - /* 1440 */ 432, 108, 451, 42, 396, 450, 20, 219, 448, 376, - /* 1450 */ 443, 376, 434, 443, 202, 20, 408, 367, 410, 20, - /* 1460 */ 368, 45, 417, 368, 417, 181, 414, 236, 237, 238, - /* 1470 */ 206, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 1480 */ 249, 250, 251, 252, 253, 254, 255, 256, 257, 12, - /* 1490 */ 13, 367, 380, 368, 367, 414, 417, 449, 414, 22, - /* 1500 */ 452, 414, 105, 455, 456, 457, 458, 459, 460, 103, - /* 1510 */ 462, 367, 35, 379, 37, 467, 102, 469, 378, 367, - /* 1520 */ 367, 473, 474, 355, 367, 20, 360, 364, 50, 360, - /* 1530 */ 20, 364, 443, 410, 376, 376, 368, 20, 20, 369, - /* 1540 */ 433, 376, 65, 369, 20, 424, 367, 360, 447, 376, - /* 1550 */ 408, 376, 376, 206, 376, 78, 376, 355, 358, 358, - /* 1560 */ 223, 367, 107, 360, 396, 445, 20, 210, 440, 443, - /* 1570 */ 368, 374, 442, 396, 209, 439, 408, 396, 410, 396, - /* 1580 */ 396, 104, 396, 374, 396, 396, 396, 396, 396, 396, - /* 1590 */ 355, 285, 410, 408, 367, 492, 284, 293, 396, 495, - /* 1600 */ 492, 492, 195, 368, 408, 494, 408, 491, 295, 294, - /* 1610 */ 408, 489, 410, 278, 512, 299, 302, 449, 505, 490, - /* 1620 */ 452, 426, 273, 455, 456, 457, 458, 459, 460, 297, - /* 1630 */ 462, 396, 426, 368, 20, 467, 432, 469, 117, 432, - /* 1640 */ 485, 473, 474, 408, 506, 410, 275, 369, 374, 426, - /* 1650 */ 374, 449, 408, 454, 452, 426, 187, 455, 456, 457, - /* 1660 */ 458, 459, 460, 422, 462, 355, 408, 107, 408, 374, - /* 1670 */ 374, 469, 107, 400, 408, 408, 474, 392, 368, 408, - /* 1680 */ 472, 204, 374, 206, 449, 368, 367, 452, 22, 38, - /* 1690 */ 455, 456, 457, 458, 459, 460, 357, 462, 355, 487, - /* 1700 */ 444, 361, 467, 435, 469, 360, 396, 0, 473, 474, - /* 1710 */ 427, 368, 390, 236, 237, 353, 390, 427, 408, 390, - /* 1720 */ 410, 375, 0, 0, 45, 0, 37, 250, 251, 252, - /* 1730 */ 253, 254, 255, 256, 355, 229, 37, 37, 37, 396, - /* 1740 */ 229, 0, 37, 37, 229, 37, 0, 368, 229, 0, - /* 1750 */ 37, 408, 0, 410, 37, 0, 22, 0, 37, 449, - /* 1760 */ 224, 0, 452, 212, 0, 455, 456, 457, 458, 459, - /* 1770 */ 460, 212, 462, 206, 213, 396, 204, 467, 0, 469, - /* 1780 */ 0, 0, 199, 473, 474, 200, 0, 408, 0, 410, - /* 1790 */ 150, 355, 449, 49, 49, 452, 0, 37, 455, 456, - /* 1800 */ 457, 458, 459, 460, 368, 462, 0, 0, 37, 51, - /* 1810 */ 0, 49, 469, 0, 355, 45, 473, 474, 0, 0, - /* 1820 */ 0, 49, 0, 0, 0, 0, 0, 368, 449, 355, - /* 1830 */ 0, 452, 396, 0, 455, 456, 457, 458, 459, 460, - /* 1840 */ 167, 462, 368, 167, 408, 37, 410, 0, 469, 0, - /* 1850 */ 0, 0, 473, 474, 0, 396, 0, 0, 0, 0, - /* 1860 */ 0, 0, 0, 0, 0, 0, 0, 408, 0, 410, - /* 1870 */ 396, 0, 0, 0, 45, 0, 49, 0, 0, 0, - /* 1880 */ 0, 0, 408, 0, 410, 449, 0, 150, 452, 22, - /* 1890 */ 0, 455, 456, 457, 458, 459, 460, 149, 462, 0, - /* 1900 */ 0, 148, 0, 50, 22, 469, 22, 0, 449, 473, - /* 1910 */ 474, 452, 0, 65, 455, 456, 457, 458, 459, 460, - /* 1920 */ 50, 462, 37, 449, 0, 0, 452, 0, 37, 455, - /* 1930 */ 456, 457, 458, 459, 460, 42, 462, 355, 51, 65, - /* 1940 */ 0, 65, 37, 51, 0, 42, 37, 51, 0, 0, - /* 1950 */ 368, 37, 42, 45, 355, 42, 33, 14, 0, 42, - /* 1960 */ 49, 43, 0, 0, 49, 49, 0, 368, 509, 510, - /* 1970 */ 0, 42, 498, 355, 195, 0, 0, 49, 396, 0, - /* 1980 */ 0, 0, 37, 401, 51, 0, 368, 37, 42, 51, - /* 1990 */ 408, 72, 410, 42, 0, 396, 37, 42, 51, 0, - /* 2000 */ 401, 37, 42, 51, 0, 0, 0, 408, 0, 410, - /* 2010 */ 0, 0, 115, 22, 396, 37, 0, 113, 0, 37, - /* 2020 */ 37, 37, 33, 37, 37, 37, 408, 37, 410, 37, - /* 2030 */ 33, 449, 37, 37, 452, 22, 22, 455, 456, 457, - /* 2040 */ 458, 459, 460, 0, 462, 22, 37, 355, 449, 0, - /* 2050 */ 22, 452, 0, 53, 455, 456, 457, 458, 459, 460, - /* 2060 */ 368, 462, 22, 37, 0, 0, 0, 449, 37, 355, - /* 2070 */ 452, 37, 0, 455, 456, 457, 458, 459, 460, 0, - /* 2080 */ 462, 22, 368, 20, 355, 37, 0, 37, 396, 0, - /* 2090 */ 37, 49, 22, 37, 0, 22, 207, 368, 0, 211, - /* 2100 */ 408, 108, 410, 0, 184, 107, 184, 3, 107, 33, - /* 2110 */ 396, 279, 191, 187, 107, 401, 184, 37, 184, 501, - /* 2120 */ 184, 37, 408, 108, 410, 396, 191, 107, 50, 108, - /* 2130 */ 105, 107, 50, 103, 33, 108, 107, 408, 33, 410, - /* 2140 */ 108, 449, 107, 107, 452, 108, 33, 455, 456, 457, - /* 2150 */ 458, 459, 460, 107, 462, 355, 49, 49, 33, 108, - /* 2160 */ 3, 33, 108, 449, 37, 1, 452, 37, 368, 455, - /* 2170 */ 456, 457, 458, 459, 460, 37, 462, 279, 449, 37, - /* 2180 */ 279, 452, 37, 19, 455, 456, 457, 458, 459, 460, - /* 2190 */ 355, 462, 37, 464, 33, 108, 396, 0, 108, 35, - /* 2200 */ 49, 401, 510, 368, 0, 49, 107, 42, 408, 272, - /* 2210 */ 410, 0, 42, 107, 33, 51, 116, 108, 108, 107, - /* 2220 */ 49, 107, 107, 107, 60, 61, 62, 63, 105, 65, - /* 2230 */ 259, 396, 188, 186, 105, 2, 401, 22, 236, 107, - /* 2240 */ 49, 108, 107, 408, 108, 410, 107, 49, 108, 449, - /* 2250 */ 107, 107, 452, 22, 108, 455, 456, 457, 458, 459, - /* 2260 */ 460, 355, 462, 37, 117, 107, 37, 108, 108, 107, - /* 2270 */ 106, 37, 239, 109, 368, 107, 37, 108, 37, 107, - /* 2280 */ 37, 108, 107, 107, 449, 355, 108, 452, 108, 37, - /* 2290 */ 455, 456, 457, 458, 459, 460, 107, 462, 368, 107, - /* 2300 */ 33, 107, 396, 119, 130, 118, 37, 143, 107, 130, - /* 2310 */ 22, 37, 72, 130, 408, 130, 410, 71, 37, 37, - /* 2320 */ 37, 37, 37, 37, 37, 78, 396, 37, 355, 101, - /* 2330 */ 33, 78, 37, 101, 22, 37, 37, 37, 408, 37, - /* 2340 */ 410, 368, 37, 78, 37, 37, 37, 37, 37, 22, - /* 2350 */ 186, 37, 0, 37, 51, 449, 0, 193, 452, 42, - /* 2360 */ 37, 455, 456, 457, 458, 459, 460, 42, 462, 396, - /* 2370 */ 51, 0, 37, 51, 42, 0, 212, 37, 42, 449, - /* 2380 */ 51, 408, 452, 410, 37, 455, 456, 457, 458, 459, - /* 2390 */ 460, 0, 462, 355, 37, 0, 22, 33, 22, 21, - /* 2400 */ 513, 22, 22, 21, 513, 20, 368, 513, 513, 513, - /* 2410 */ 355, 513, 513, 513, 513, 513, 513, 513, 513, 513, - /* 2420 */ 513, 513, 449, 368, 513, 452, 355, 513, 455, 456, - /* 2430 */ 457, 458, 459, 460, 396, 462, 513, 513, 513, 368, - /* 2440 */ 513, 513, 513, 513, 513, 513, 408, 513, 410, 513, - /* 2450 */ 513, 396, 513, 513, 513, 513, 513, 513, 513, 513, - /* 2460 */ 513, 513, 513, 408, 513, 410, 513, 396, 513, 513, - /* 2470 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 408, - /* 2480 */ 513, 410, 513, 513, 513, 513, 513, 449, 513, 513, - /* 2490 */ 452, 513, 513, 455, 456, 457, 458, 459, 460, 513, - /* 2500 */ 462, 513, 513, 355, 449, 513, 513, 452, 513, 513, - /* 2510 */ 455, 456, 457, 458, 459, 460, 368, 462, 513, 513, - /* 2520 */ 449, 355, 513, 452, 513, 513, 455, 456, 457, 458, - /* 2530 */ 459, 460, 513, 462, 368, 513, 513, 355, 513, 513, - /* 2540 */ 513, 513, 513, 513, 396, 513, 513, 513, 513, 513, - /* 2550 */ 368, 513, 513, 513, 513, 513, 408, 513, 410, 513, - /* 2560 */ 513, 513, 396, 513, 513, 513, 513, 513, 513, 513, - /* 2570 */ 513, 513, 513, 513, 408, 513, 410, 513, 396, 513, - /* 2580 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - /* 2590 */ 408, 513, 410, 513, 513, 513, 513, 449, 513, 513, - /* 2600 */ 452, 513, 513, 455, 456, 457, 458, 459, 460, 513, - /* 2610 */ 462, 513, 513, 513, 355, 449, 513, 513, 452, 513, - /* 2620 */ 513, 455, 456, 457, 458, 459, 460, 368, 462, 513, - /* 2630 */ 355, 449, 513, 513, 452, 513, 513, 455, 456, 457, - /* 2640 */ 458, 459, 460, 368, 462, 513, 355, 513, 513, 513, - /* 2650 */ 513, 513, 513, 513, 513, 396, 513, 513, 513, 368, - /* 2660 */ 513, 513, 513, 513, 513, 513, 513, 408, 513, 410, - /* 2670 */ 513, 396, 513, 513, 513, 513, 513, 513, 513, 513, - /* 2680 */ 513, 513, 513, 408, 513, 410, 513, 396, 513, 513, - /* 2690 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 408, - /* 2700 */ 513, 410, 513, 513, 513, 513, 513, 513, 449, 513, - /* 2710 */ 513, 452, 513, 355, 455, 456, 457, 458, 459, 460, - /* 2720 */ 513, 462, 513, 513, 449, 513, 368, 452, 513, 513, - /* 2730 */ 455, 456, 457, 458, 459, 460, 513, 462, 513, 355, - /* 2740 */ 449, 513, 513, 452, 513, 513, 455, 456, 457, 458, - /* 2750 */ 459, 460, 368, 462, 396, 513, 513, 513, 513, 513, - /* 2760 */ 513, 513, 513, 513, 513, 513, 408, 513, 410, 513, - /* 2770 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - /* 2780 */ 396, 513, 355, 513, 513, 513, 513, 513, 513, 513, - /* 2790 */ 513, 513, 408, 513, 410, 368, 513, 513, 513, 513, - /* 2800 */ 513, 513, 513, 513, 513, 513, 513, 449, 513, 513, - /* 2810 */ 452, 513, 513, 455, 456, 457, 458, 459, 460, 355, - /* 2820 */ 462, 513, 513, 396, 513, 513, 513, 513, 513, 513, - /* 2830 */ 513, 513, 368, 449, 513, 408, 452, 410, 513, 455, - /* 2840 */ 456, 457, 458, 459, 460, 513, 462, 513, 513, 355, - /* 2850 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - /* 2860 */ 396, 513, 368, 513, 513, 513, 513, 513, 513, 513, - /* 2870 */ 513, 513, 408, 513, 410, 513, 449, 513, 513, 452, - /* 2880 */ 513, 513, 455, 456, 457, 458, 459, 460, 513, 462, - /* 2890 */ 396, 513, 513, 513, 513, 513, 513, 513, 513, 513, - /* 2900 */ 513, 513, 408, 513, 410, 513, 513, 513, 513, 513, - /* 2910 */ 513, 513, 513, 449, 355, 513, 452, 513, 513, 455, - /* 2920 */ 456, 457, 458, 459, 460, 513, 462, 368, 513, 513, - /* 2930 */ 513, 513, 355, 513, 513, 513, 513, 513, 513, 513, - /* 2940 */ 513, 513, 513, 449, 513, 368, 452, 513, 355, 455, - /* 2950 */ 456, 457, 458, 459, 460, 396, 462, 513, 513, 513, - /* 2960 */ 513, 368, 513, 513, 513, 513, 513, 408, 513, 410, - /* 2970 */ 513, 513, 513, 396, 513, 513, 513, 513, 513, 513, - /* 2980 */ 513, 513, 513, 513, 513, 408, 513, 410, 513, 396, - /* 2990 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - /* 3000 */ 513, 408, 513, 410, 513, 513, 513, 513, 449, 513, - /* 3010 */ 513, 452, 513, 513, 455, 456, 457, 458, 459, 460, - /* 3020 */ 513, 462, 513, 513, 513, 355, 449, 513, 513, 452, - /* 3030 */ 513, 513, 455, 456, 457, 458, 459, 460, 368, 462, - /* 3040 */ 513, 355, 449, 513, 513, 452, 513, 513, 455, 456, - /* 3050 */ 457, 458, 459, 460, 368, 462, 513, 513, 513, 513, - /* 3060 */ 513, 513, 513, 513, 513, 513, 396, 513, 513, 513, - /* 3070 */ 513, 513, 513, 513, 513, 513, 513, 513, 408, 513, - /* 3080 */ 410, 513, 396, 513, 513, 513, 513, 513, 513, 513, - /* 3090 */ 513, 513, 513, 513, 408, 513, 410, 513, 513, 513, - /* 3100 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 513, - /* 3110 */ 513, 513, 513, 513, 513, 513, 513, 513, 513, 449, - /* 3120 */ 513, 513, 452, 513, 513, 455, 456, 457, 458, 459, - /* 3130 */ 460, 513, 462, 513, 513, 449, 513, 513, 452, 513, - /* 3140 */ 513, 455, 456, 457, 458, 459, 460, 513, 462, 352, - /* 3150 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - /* 3160 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - /* 3170 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - /* 3180 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - /* 3190 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - /* 3200 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + /* 1240 */ 255, 256, 257, 12, 13, 355, 408, 408, 408, 431, + /* 1250 */ 276, 20, 408, 22, 436, 408, 408, 71, 368, 408, + /* 1260 */ 370, 381, 382, 73, 74, 75, 35, 14, 37, 230, + /* 1270 */ 80, 81, 82, 20, 405, 0, 86, 408, 171, 358, + /* 1280 */ 359, 91, 92, 93, 94, 33, 396, 97, 110, 110, + /* 1290 */ 100, 113, 113, 0, 33, 65, 65, 45, 408, 110, + /* 1300 */ 410, 483, 113, 110, 486, 49, 113, 0, 33, 78, + /* 1310 */ 0, 0, 220, 33, 222, 22, 431, 371, 431, 145, + /* 1320 */ 146, 37, 504, 505, 33, 33, 396, 509, 510, 22, + /* 1330 */ 1, 2, 22, 22, 33, 104, 33, 37, 107, 109, + /* 1340 */ 384, 451, 33, 384, 454, 421, 366, 457, 458, 459, + /* 1350 */ 460, 461, 462, 184, 464, 0, 33, 12, 13, 469, + /* 1360 */ 431, 471, 13, 107, 421, 475, 476, 22, 483, 108, + /* 1370 */ 483, 486, 501, 486, 13, 33, 145, 146, 78, 501, + /* 1380 */ 35, 300, 37, 33, 501, 33, 37, 33, 108, 504, + /* 1390 */ 505, 504, 505, 501, 509, 510, 509, 510, 37, 108, + /* 1400 */ 108, 371, 430, 421, 368, 407, 355, 52, 438, 108, + /* 1410 */ 65, 108, 483, 182, 183, 486, 33, 108, 421, 368, + /* 1420 */ 189, 190, 236, 78, 33, 33, 33, 421, 33, 485, + /* 1430 */ 477, 108, 506, 504, 505, 204, 488, 206, 509, 510, + /* 1440 */ 386, 277, 432, 453, 42, 51, 20, 396, 452, 104, + /* 1450 */ 108, 355, 443, 33, 33, 33, 448, 219, 108, 408, + /* 1460 */ 108, 410, 108, 376, 368, 443, 431, 236, 237, 238, + /* 1470 */ 376, 240, 241, 242, 243, 244, 245, 246, 247, 248, + /* 1480 */ 249, 250, 251, 252, 253, 254, 255, 256, 257, 202, + /* 1490 */ 206, 108, 396, 434, 20, 367, 20, 368, 45, 108, + /* 1500 */ 108, 108, 451, 108, 408, 454, 410, 417, 457, 458, + /* 1510 */ 459, 460, 461, 462, 368, 464, 417, 181, 483, 414, + /* 1520 */ 469, 486, 471, 355, 367, 367, 475, 476, 108, 108, + /* 1530 */ 108, 368, 417, 431, 414, 414, 368, 414, 105, 504, + /* 1540 */ 505, 380, 103, 367, 509, 510, 379, 451, 102, 204, + /* 1550 */ 454, 206, 367, 457, 458, 459, 460, 461, 462, 378, + /* 1560 */ 464, 367, 367, 20, 396, 469, 360, 471, 50, 364, + /* 1570 */ 360, 475, 476, 364, 443, 376, 408, 376, 410, 20, + /* 1580 */ 410, 236, 237, 376, 20, 483, 369, 20, 486, 433, + /* 1590 */ 376, 369, 355, 20, 376, 250, 251, 252, 253, 254, + /* 1600 */ 255, 256, 376, 376, 424, 368, 504, 505, 367, 376, + /* 1610 */ 360, 509, 510, 367, 360, 396, 396, 396, 358, 451, + /* 1620 */ 396, 396, 454, 358, 396, 457, 458, 459, 460, 461, + /* 1630 */ 462, 396, 464, 396, 447, 396, 396, 469, 396, 471, + /* 1640 */ 396, 223, 408, 475, 476, 408, 107, 410, 445, 20, + /* 1650 */ 374, 408, 355, 408, 443, 442, 440, 210, 209, 410, + /* 1660 */ 374, 432, 439, 367, 285, 368, 408, 494, 284, 494, + /* 1670 */ 293, 494, 195, 426, 426, 295, 493, 278, 302, 497, + /* 1680 */ 496, 294, 273, 492, 299, 514, 297, 491, 451, 432, + /* 1690 */ 368, 454, 20, 396, 457, 458, 459, 460, 461, 462, + /* 1700 */ 508, 464, 117, 275, 507, 408, 369, 410, 471, 374, + /* 1710 */ 408, 456, 475, 476, 374, 426, 408, 187, 374, 487, + /* 1720 */ 408, 355, 408, 408, 426, 489, 422, 374, 368, 107, + /* 1730 */ 392, 107, 400, 474, 368, 408, 367, 374, 22, 357, + /* 1740 */ 38, 435, 361, 444, 427, 427, 360, 390, 451, 390, + /* 1750 */ 375, 454, 390, 353, 457, 458, 459, 460, 461, 462, + /* 1760 */ 0, 464, 396, 0, 0, 45, 355, 0, 471, 37, + /* 1770 */ 229, 37, 475, 476, 408, 37, 410, 37, 229, 368, + /* 1780 */ 0, 37, 37, 229, 37, 0, 229, 0, 37, 0, + /* 1790 */ 37, 355, 0, 22, 0, 37, 224, 0, 212, 0, + /* 1800 */ 212, 206, 213, 204, 368, 0, 0, 396, 0, 200, + /* 1810 */ 199, 0, 0, 150, 49, 49, 0, 451, 37, 408, + /* 1820 */ 454, 410, 0, 457, 458, 459, 460, 461, 462, 0, + /* 1830 */ 464, 0, 396, 37, 51, 49, 355, 471, 0, 0, + /* 1840 */ 45, 475, 476, 0, 408, 0, 410, 49, 0, 368, + /* 1850 */ 0, 0, 0, 0, 0, 167, 37, 0, 167, 0, + /* 1860 */ 0, 0, 451, 0, 0, 454, 355, 0, 457, 458, + /* 1870 */ 459, 460, 461, 462, 0, 464, 0, 396, 0, 368, + /* 1880 */ 0, 0, 0, 0, 0, 0, 0, 451, 0, 408, + /* 1890 */ 454, 410, 0, 457, 458, 459, 460, 461, 462, 0, + /* 1900 */ 464, 0, 0, 355, 49, 0, 0, 396, 0, 0, + /* 1910 */ 499, 500, 0, 45, 0, 22, 368, 0, 150, 408, + /* 1920 */ 0, 410, 149, 0, 148, 0, 0, 50, 0, 22, + /* 1930 */ 65, 37, 451, 0, 65, 454, 0, 355, 457, 458, + /* 1940 */ 459, 460, 461, 462, 396, 464, 22, 511, 512, 401, + /* 1950 */ 368, 0, 471, 50, 65, 0, 408, 476, 410, 37, + /* 1960 */ 42, 51, 451, 0, 37, 454, 51, 0, 457, 458, + /* 1970 */ 459, 460, 461, 462, 42, 464, 37, 42, 396, 0, + /* 1980 */ 51, 37, 355, 401, 42, 45, 33, 49, 14, 0, + /* 1990 */ 408, 0, 410, 0, 49, 368, 49, 43, 42, 451, + /* 2000 */ 0, 0, 454, 0, 42, 457, 458, 459, 460, 461, + /* 2010 */ 462, 500, 464, 195, 0, 49, 0, 0, 72, 0, + /* 2020 */ 0, 51, 37, 396, 42, 0, 51, 37, 42, 0, + /* 2030 */ 42, 37, 51, 451, 0, 408, 454, 410, 51, 457, + /* 2040 */ 458, 459, 460, 461, 462, 37, 464, 42, 0, 355, + /* 2050 */ 0, 0, 0, 0, 0, 37, 115, 22, 0, 37, + /* 2060 */ 37, 113, 368, 37, 355, 37, 22, 37, 37, 37, + /* 2070 */ 37, 33, 33, 37, 37, 0, 0, 368, 451, 37, + /* 2080 */ 0, 454, 22, 22, 457, 458, 459, 460, 461, 462, + /* 2090 */ 396, 464, 22, 53, 0, 22, 37, 0, 0, 0, + /* 2100 */ 37, 0, 408, 37, 410, 396, 22, 20, 37, 37, + /* 2110 */ 401, 0, 108, 107, 37, 0, 118, 408, 184, 410, + /* 2120 */ 107, 119, 0, 49, 355, 37, 22, 211, 0, 22, + /* 2130 */ 503, 0, 0, 184, 191, 33, 184, 368, 207, 50, + /* 2140 */ 3, 279, 184, 184, 187, 451, 37, 37, 454, 108, + /* 2150 */ 107, 457, 458, 459, 460, 461, 462, 108, 464, 191, + /* 2160 */ 451, 105, 107, 454, 107, 396, 457, 458, 459, 460, + /* 2170 */ 461, 462, 103, 464, 50, 108, 33, 408, 33, 410, + /* 2180 */ 33, 33, 49, 49, 3, 33, 108, 108, 107, 107, + /* 2190 */ 107, 37, 279, 107, 37, 37, 37, 355, 108, 108, + /* 2200 */ 279, 37, 37, 108, 108, 49, 512, 33, 0, 272, + /* 2210 */ 368, 49, 0, 42, 0, 107, 116, 42, 49, 107, + /* 2220 */ 451, 355, 108, 454, 108, 107, 457, 458, 459, 460, + /* 2230 */ 461, 462, 107, 464, 368, 466, 107, 107, 396, 33, + /* 2240 */ 105, 105, 259, 401, 2, 22, 236, 107, 186, 108, + /* 2250 */ 408, 107, 410, 188, 108, 22, 107, 37, 108, 49, + /* 2260 */ 107, 37, 396, 108, 49, 37, 355, 401, 107, 37, + /* 2270 */ 107, 37, 130, 37, 408, 108, 410, 117, 108, 368, + /* 2280 */ 107, 37, 33, 107, 239, 108, 107, 37, 108, 107, + /* 2290 */ 118, 108, 107, 451, 108, 1, 454, 107, 130, 457, + /* 2300 */ 458, 459, 460, 461, 462, 355, 464, 396, 130, 107, + /* 2310 */ 119, 107, 107, 19, 130, 22, 71, 451, 368, 408, + /* 2320 */ 454, 410, 37, 457, 458, 459, 460, 461, 462, 35, + /* 2330 */ 464, 72, 37, 37, 37, 37, 37, 37, 37, 355, + /* 2340 */ 37, 78, 101, 78, 101, 51, 396, 33, 37, 37, + /* 2350 */ 37, 22, 368, 37, 60, 61, 62, 63, 408, 65, + /* 2360 */ 410, 37, 451, 37, 355, 454, 78, 37, 457, 458, + /* 2370 */ 459, 460, 461, 462, 37, 464, 37, 368, 37, 37, + /* 2380 */ 396, 22, 37, 0, 37, 51, 42, 0, 37, 51, + /* 2390 */ 42, 0, 408, 37, 410, 42, 0, 37, 0, 42, + /* 2400 */ 106, 451, 0, 109, 454, 396, 51, 457, 458, 459, + /* 2410 */ 460, 461, 462, 51, 464, 37, 37, 408, 33, 410, + /* 2420 */ 515, 22, 22, 22, 21, 20, 22, 21, 515, 515, + /* 2430 */ 515, 515, 515, 515, 515, 451, 515, 143, 454, 515, + /* 2440 */ 355, 457, 458, 459, 460, 461, 462, 515, 464, 515, + /* 2450 */ 515, 515, 515, 368, 515, 515, 515, 515, 515, 515, + /* 2460 */ 451, 355, 515, 454, 515, 515, 457, 458, 459, 460, + /* 2470 */ 461, 462, 515, 464, 368, 515, 515, 515, 515, 515, + /* 2480 */ 186, 396, 515, 515, 515, 515, 515, 193, 515, 515, + /* 2490 */ 515, 515, 515, 408, 515, 410, 515, 515, 515, 515, + /* 2500 */ 515, 515, 396, 515, 515, 515, 212, 515, 515, 515, + /* 2510 */ 515, 515, 515, 515, 408, 515, 410, 515, 515, 515, + /* 2520 */ 515, 355, 515, 515, 515, 515, 515, 515, 515, 515, + /* 2530 */ 515, 515, 515, 515, 368, 515, 451, 515, 515, 454, + /* 2540 */ 515, 515, 457, 458, 459, 460, 461, 462, 515, 464, + /* 2550 */ 515, 515, 515, 515, 515, 515, 515, 451, 515, 515, + /* 2560 */ 454, 515, 396, 457, 458, 459, 460, 461, 462, 515, + /* 2570 */ 464, 515, 515, 515, 408, 515, 410, 515, 515, 515, + /* 2580 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + /* 2590 */ 355, 515, 515, 515, 515, 515, 515, 515, 515, 515, + /* 2600 */ 515, 515, 515, 368, 515, 515, 355, 515, 515, 515, + /* 2610 */ 515, 515, 515, 515, 515, 515, 515, 451, 515, 368, + /* 2620 */ 454, 515, 355, 457, 458, 459, 460, 461, 462, 515, + /* 2630 */ 464, 396, 515, 515, 515, 368, 515, 515, 515, 515, + /* 2640 */ 515, 515, 515, 408, 515, 410, 515, 396, 515, 515, + /* 2650 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 408, + /* 2660 */ 515, 410, 515, 396, 515, 515, 515, 515, 515, 515, + /* 2670 */ 515, 515, 515, 515, 515, 408, 515, 410, 515, 515, + /* 2680 */ 515, 515, 515, 515, 515, 515, 451, 515, 515, 454, + /* 2690 */ 515, 515, 457, 458, 459, 460, 461, 462, 515, 464, + /* 2700 */ 515, 355, 451, 515, 515, 454, 515, 515, 457, 458, + /* 2710 */ 459, 460, 461, 462, 368, 464, 515, 515, 451, 515, + /* 2720 */ 355, 454, 515, 515, 457, 458, 459, 460, 461, 462, + /* 2730 */ 515, 464, 515, 368, 515, 515, 355, 515, 515, 515, + /* 2740 */ 515, 515, 396, 515, 515, 515, 515, 515, 515, 368, + /* 2750 */ 515, 515, 515, 515, 408, 515, 410, 515, 515, 515, + /* 2760 */ 515, 396, 515, 515, 515, 515, 515, 515, 515, 515, + /* 2770 */ 515, 515, 515, 408, 515, 410, 515, 396, 515, 515, + /* 2780 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 408, + /* 2790 */ 515, 410, 515, 515, 515, 515, 355, 451, 515, 515, + /* 2800 */ 454, 515, 515, 457, 458, 459, 460, 461, 462, 368, + /* 2810 */ 464, 515, 515, 515, 515, 515, 451, 355, 515, 454, + /* 2820 */ 515, 515, 457, 458, 459, 460, 461, 462, 515, 464, + /* 2830 */ 368, 515, 451, 515, 515, 454, 515, 396, 457, 458, + /* 2840 */ 459, 460, 461, 462, 515, 464, 515, 515, 515, 408, + /* 2850 */ 515, 410, 515, 515, 515, 515, 515, 515, 396, 515, + /* 2860 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + /* 2870 */ 408, 515, 410, 515, 515, 515, 515, 355, 515, 515, + /* 2880 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + /* 2890 */ 368, 515, 451, 515, 515, 454, 515, 515, 457, 458, + /* 2900 */ 459, 460, 461, 462, 515, 464, 515, 515, 515, 515, + /* 2910 */ 515, 515, 515, 451, 515, 515, 454, 515, 396, 457, + /* 2920 */ 458, 459, 460, 461, 462, 515, 464, 515, 515, 515, + /* 2930 */ 408, 515, 410, 515, 515, 515, 515, 515, 515, 515, + /* 2940 */ 515, 515, 515, 515, 515, 515, 355, 515, 515, 515, + /* 2950 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 368, + /* 2960 */ 515, 515, 355, 515, 515, 515, 515, 515, 515, 515, + /* 2970 */ 515, 515, 515, 451, 515, 368, 454, 515, 355, 457, + /* 2980 */ 458, 459, 460, 461, 462, 515, 464, 396, 515, 515, + /* 2990 */ 515, 368, 515, 515, 515, 515, 515, 515, 515, 408, + /* 3000 */ 515, 410, 515, 396, 515, 515, 515, 515, 515, 515, + /* 3010 */ 515, 515, 515, 515, 515, 408, 515, 410, 515, 396, + /* 3020 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, + /* 3030 */ 515, 408, 515, 410, 515, 515, 515, 515, 515, 515, + /* 3040 */ 515, 515, 451, 515, 515, 454, 515, 515, 457, 458, + /* 3050 */ 459, 460, 461, 462, 515, 464, 515, 355, 451, 515, + /* 3060 */ 515, 454, 515, 515, 457, 458, 459, 460, 461, 462, + /* 3070 */ 368, 464, 515, 515, 451, 515, 355, 454, 515, 515, + /* 3080 */ 457, 458, 459, 460, 461, 462, 515, 464, 515, 368, + /* 3090 */ 515, 515, 355, 515, 515, 515, 515, 515, 396, 515, + /* 3100 */ 515, 515, 515, 515, 515, 368, 515, 515, 515, 515, + /* 3110 */ 408, 515, 410, 515, 515, 515, 515, 396, 515, 515, + /* 3120 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 408, + /* 3130 */ 515, 410, 515, 396, 515, 515, 515, 515, 515, 515, + /* 3140 */ 515, 515, 515, 515, 515, 408, 515, 410, 515, 515, + /* 3150 */ 515, 515, 515, 451, 515, 515, 454, 515, 515, 457, + /* 3160 */ 458, 459, 460, 461, 462, 515, 464, 515, 515, 515, + /* 3170 */ 515, 515, 451, 515, 515, 454, 515, 515, 457, 458, + /* 3180 */ 459, 460, 461, 462, 515, 464, 515, 515, 451, 515, + /* 3190 */ 515, 454, 515, 515, 457, 458, 459, 460, 461, 462, + /* 3200 */ 515, 464, 352, 352, 352, 352, 352, 352, 352, 352, /* 3210 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, /* 3220 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, /* 3230 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, @@ -1242,225 +1245,230 @@ static const YYCODETYPE yy_lookahead[] = { /* 3470 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, /* 3480 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, /* 3490 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - /* 3500 */ 352, + /* 3500 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + /* 3510 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + /* 3520 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + /* 3530 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + /* 3540 */ 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, + /* 3550 */ 352, 352, 352, 352, }; -#define YY_SHIFT_COUNT (853) +#define YY_SHIFT_COUNT (856) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2395) +#define YY_SHIFT_MAX (2406) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 132, 0, 246, 0, 493, 493, 493, 493, 493, 493, /* 10 */ 493, 493, 493, 493, 493, 493, 739, 985, 985, 1231, /* 20 */ 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, /* 30 */ 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, /* 40 */ 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, - /* 50 */ 985, 157, 501, 400, 348, 87, 122, 87, 87, 348, - /* 60 */ 348, 87, 1477, 87, 245, 1477, 1477, 95, 87, 52, - /* 70 */ 575, 69, 69, 508, 508, 575, 176, 65, 134, 134, - /* 80 */ 247, 69, 69, 69, 69, 69, 69, 69, 69, 69, - /* 90 */ 69, 69, 172, 262, 69, 69, 127, 52, 69, 172, - /* 100 */ 69, 52, 69, 69, 52, 69, 69, 52, 69, 52, - /* 110 */ 52, 52, 69, 199, 200, 200, 494, 66, 576, 576, - /* 120 */ 576, 576, 576, 576, 576, 576, 576, 576, 576, 576, - /* 130 */ 576, 576, 576, 576, 576, 576, 576, 435, 587, 176, - /* 140 */ 65, 793, 793, 315, 23, 23, 23, 972, 292, 292, - /* 150 */ 789, 315, 127, 228, 52, 52, 112, 52, 338, 52, - /* 160 */ 338, 338, 392, 509, 251, 251, 251, 251, 251, 251, - /* 170 */ 251, 251, 2164, 860, 21, 46, 277, 534, 596, 624, - /* 180 */ 296, 334, 395, 395, 822, 117, 941, 559, 559, 559, - /* 190 */ 458, 559, 528, 301, 832, 1068, 871, 1005, 832, 832, - /* 200 */ 1024, 947, 178, 1078, 947, 1172, 996, 789, 1162, 1387, - /* 210 */ 1401, 1426, 1228, 127, 1426, 127, 1252, 1435, 1439, 1416, - /* 220 */ 1439, 1416, 1284, 1435, 1439, 1435, 1416, 1284, 1284, 1284, - /* 230 */ 1397, 1406, 1435, 1414, 1435, 1435, 1435, 1505, 1478, 1505, - /* 240 */ 1478, 1426, 127, 127, 1510, 127, 1517, 1518, 127, 1517, - /* 250 */ 127, 1524, 127, 127, 1435, 127, 1505, 52, 52, 52, - /* 260 */ 52, 52, 52, 52, 52, 52, 52, 52, 1435, 509, - /* 270 */ 509, 1505, 338, 338, 338, 1337, 1455, 1426, 199, 1546, - /* 280 */ 1357, 1365, 1510, 199, 1162, 1435, 338, 1306, 1312, 1306, - /* 290 */ 1312, 1304, 1407, 1306, 1313, 1315, 1335, 1162, 1314, 1316, - /* 300 */ 1332, 1349, 1439, 1614, 1521, 1371, 1517, 199, 199, 1312, - /* 310 */ 338, 338, 338, 338, 1312, 338, 1469, 199, 392, 199, - /* 320 */ 1439, 1560, 1565, 338, 1435, 199, 1666, 1651, 1505, 3149, - /* 330 */ 3149, 3149, 3149, 3149, 3149, 3149, 3149, 3149, 36, 500, - /* 340 */ 312, 1006, 425, 61, 210, 649, 219, 676, 293, 768, - /* 350 */ 511, 511, 511, 511, 511, 511, 511, 511, 511, 525, - /* 360 */ 439, 794, 145, 145, 584, 654, 769, 694, 396, 170, - /* 370 */ 736, 1161, 646, 774, 774, 406, 817, 261, 406, 406, - /* 380 */ 406, 1105, 1049, 1213, 472, 1224, 1137, 1248, 1146, 1154, - /* 390 */ 1160, 1164, 886, 1250, 1275, 1282, 1288, 1289, 1063, 1243, - /* 400 */ 1247, 1225, 1259, 1261, 1262, 1279, 1171, 1114, 1065, 1280, - /* 410 */ 1281, 1287, 1293, 1294, 1297, 1305, 1299, 1132, 1303, 1254, - /* 420 */ 1307, 1311, 1320, 1321, 1325, 1333, 1255, 1264, 1347, 1373, - /* 430 */ 1380, 1354, 1356, 1707, 1722, 1723, 1679, 1725, 1689, 1506, - /* 440 */ 1699, 1700, 1701, 1511, 1741, 1705, 1706, 1515, 1708, 1746, - /* 450 */ 1519, 1749, 1713, 1752, 1717, 1755, 1734, 1757, 1721, 1536, - /* 460 */ 1761, 1551, 1764, 1559, 1561, 1567, 1572, 1778, 1780, 1781, - /* 470 */ 1585, 1583, 1786, 1788, 1640, 1744, 1745, 1796, 1760, 1806, - /* 480 */ 1807, 1771, 1758, 1810, 1762, 1813, 1770, 1818, 1819, 1820, - /* 490 */ 1772, 1822, 1823, 1824, 1825, 1826, 1830, 1673, 1808, 1833, - /* 500 */ 1676, 1847, 1849, 1850, 1851, 1854, 1856, 1857, 1858, 1859, - /* 510 */ 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1868, 1871, 1872, - /* 520 */ 1827, 1873, 1829, 1875, 1877, 1878, 1879, 1880, 1881, 1883, - /* 530 */ 1867, 1886, 1737, 1890, 1748, 1899, 1753, 1900, 1902, 1882, - /* 540 */ 1853, 1884, 1870, 1907, 1848, 1885, 1912, 1874, 1924, 1876, - /* 550 */ 1925, 1927, 1891, 1887, 1893, 1940, 1905, 1892, 1903, 1944, - /* 560 */ 1909, 1896, 1910, 1948, 1914, 1949, 1908, 1913, 1923, 1911, - /* 570 */ 1915, 1943, 1916, 1958, 1918, 1917, 1962, 1963, 1966, 1970, - /* 580 */ 1929, 1779, 1975, 1911, 1928, 1976, 1979, 1919, 1980, 1981, - /* 590 */ 1945, 1933, 1946, 1985, 1950, 1938, 1951, 1994, 1959, 1947, - /* 600 */ 1955, 1999, 1964, 1952, 1960, 2004, 2005, 2006, 2008, 2010, - /* 610 */ 2011, 1897, 1904, 1978, 1991, 2016, 1982, 1983, 1984, 1986, - /* 620 */ 1987, 1988, 1990, 1992, 1989, 1997, 1995, 1996, 2013, 2009, - /* 630 */ 2018, 2014, 2043, 2023, 2049, 2028, 2000, 2052, 2040, 2026, - /* 640 */ 2064, 2065, 2066, 2031, 2079, 2034, 2072, 2059, 2063, 2048, - /* 650 */ 2050, 2053, 1993, 1998, 2086, 1920, 2001, 1888, 1911, 2042, - /* 660 */ 2089, 1922, 2056, 2070, 2094, 1889, 2073, 1932, 1926, 2098, - /* 670 */ 2103, 1934, 1921, 1936, 1935, 2104, 2076, 1832, 2007, 2015, - /* 680 */ 2020, 2021, 2080, 2084, 2024, 2078, 2025, 2082, 2030, 2027, - /* 690 */ 2101, 2105, 2032, 2029, 2035, 2036, 2037, 2113, 2107, 2108, - /* 700 */ 2046, 2125, 1898, 2051, 2054, 2157, 2128, 1901, 2127, 2130, - /* 710 */ 2138, 2142, 2145, 2155, 2087, 2090, 2151, 1937, 2161, 2156, - /* 720 */ 2197, 2204, 2099, 2165, 2106, 2109, 2110, 2112, 2114, 2044, - /* 730 */ 2115, 2211, 2170, 2047, 2116, 2100, 1911, 2171, 2181, 2123, - /* 740 */ 1971, 2129, 2233, 2215, 2002, 2132, 2133, 2135, 2136, 2139, - /* 750 */ 2140, 2191, 2143, 2144, 2198, 2146, 2231, 2033, 2158, 2147, - /* 760 */ 2159, 2226, 2229, 2162, 2160, 2234, 2168, 2169, 2239, 2172, - /* 770 */ 2173, 2241, 2175, 2178, 2243, 2176, 2180, 2252, 2189, 2174, - /* 780 */ 2179, 2183, 2185, 2184, 2187, 2192, 2267, 2194, 2269, 2201, - /* 790 */ 2267, 2267, 2288, 2240, 2246, 2274, 2281, 2282, 2283, 2284, - /* 800 */ 2285, 2286, 2287, 2290, 2247, 2228, 2253, 2232, 2297, 2295, - /* 810 */ 2298, 2299, 2312, 2300, 2302, 2305, 2265, 1989, 2307, 1997, - /* 820 */ 2308, 2309, 2310, 2311, 2327, 2314, 2352, 2316, 2303, 2317, - /* 830 */ 2356, 2323, 2319, 2325, 2371, 2335, 2322, 2332, 2375, 2340, - /* 840 */ 2329, 2336, 2391, 2347, 2357, 2395, 2374, 2364, 2376, 2378, - /* 850 */ 2379, 2380, 2382, 2385, + /* 50 */ 985, 185, 242, 84, 52, 87, 122, 87, 87, 52, + /* 60 */ 52, 87, 1345, 87, 245, 1345, 1345, 542, 87, 19, + /* 70 */ 612, 86, 86, 536, 536, 612, 250, 57, 94, 94, + /* 80 */ 352, 86, 86, 86, 86, 86, 86, 86, 86, 86, + /* 90 */ 86, 86, 150, 197, 86, 86, 18, 19, 86, 150, + /* 100 */ 86, 19, 86, 86, 19, 86, 86, 19, 86, 19, + /* 110 */ 19, 19, 86, 190, 200, 200, 495, 66, 734, 734, + /* 120 */ 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, + /* 130 */ 734, 734, 734, 734, 734, 734, 734, 436, 161, 250, + /* 140 */ 57, 910, 910, 142, 288, 288, 288, 635, 117, 117, + /* 150 */ 590, 142, 18, 19, 511, 19, 19, 291, 19, 281, + /* 160 */ 19, 281, 281, 533, 539, 490, 826, 826, 826, 826, + /* 170 */ 826, 826, 826, 2294, 1190, 21, 46, 15, 544, 88, + /* 180 */ 47, 582, 616, 319, 319, 540, 876, 664, 994, 994, + /* 190 */ 994, 891, 994, 786, 609, 835, 1253, 677, 971, 835, + /* 200 */ 835, 856, 914, 752, 859, 914, 484, 974, 590, 1164, + /* 210 */ 1394, 1402, 1426, 1238, 18, 1426, 18, 1287, 1474, 1476, + /* 220 */ 1453, 1476, 1453, 1336, 1474, 1476, 1474, 1453, 1336, 1336, + /* 230 */ 1336, 1433, 1439, 1474, 1446, 1474, 1474, 1474, 1543, 1518, + /* 240 */ 1543, 1518, 1426, 18, 18, 1559, 18, 1564, 1567, 18, + /* 250 */ 1564, 18, 1573, 18, 18, 1474, 18, 1543, 19, 19, + /* 260 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 1474, + /* 270 */ 539, 539, 1543, 281, 281, 281, 1418, 1539, 1426, 190, + /* 280 */ 1629, 1447, 1449, 1559, 190, 1164, 1474, 281, 1379, 1384, + /* 290 */ 1379, 1384, 1377, 1477, 1379, 1380, 1387, 1399, 1164, 1376, + /* 300 */ 1385, 1389, 1409, 1476, 1672, 1585, 1428, 1564, 190, 190, + /* 310 */ 1384, 281, 281, 281, 281, 1384, 281, 1530, 190, 533, + /* 320 */ 190, 1476, 1622, 1624, 281, 1474, 190, 1716, 1702, 1543, + /* 330 */ 3202, 3202, 3202, 3202, 3202, 3202, 3202, 3202, 3202, 36, + /* 340 */ 492, 312, 1023, 67, 210, 219, 380, 777, 1021, 1169, + /* 350 */ 393, 679, 679, 679, 679, 679, 679, 679, 679, 679, + /* 360 */ 905, 628, 157, 370, 370, 96, 101, 310, 758, 394, + /* 370 */ 908, 792, 995, 755, 423, 423, 496, 963, 499, 496, + /* 380 */ 496, 496, 1013, 1039, 624, 827, 1252, 1107, 1275, 1178, + /* 390 */ 1179, 1189, 1193, 31, 1053, 1293, 1307, 1310, 1311, 1092, + /* 400 */ 1261, 1280, 1230, 1291, 1292, 1301, 1303, 1174, 911, 1081, + /* 410 */ 1309, 1323, 1342, 1350, 1352, 1354, 1329, 1383, 1186, 1391, + /* 420 */ 1256, 1392, 1393, 1395, 1420, 1421, 1422, 181, 932, 1284, + /* 430 */ 1349, 1361, 1300, 1355, 1760, 1763, 1764, 1720, 1767, 1732, + /* 440 */ 1541, 1734, 1738, 1740, 1549, 1780, 1744, 1745, 1554, 1747, + /* 450 */ 1785, 1557, 1787, 1751, 1789, 1753, 1792, 1771, 1794, 1758, + /* 460 */ 1572, 1797, 1586, 1799, 1588, 1589, 1595, 1599, 1805, 1806, + /* 470 */ 1808, 1609, 1611, 1811, 1812, 1663, 1765, 1766, 1816, 1781, + /* 480 */ 1822, 1829, 1796, 1783, 1831, 1786, 1838, 1795, 1839, 1843, + /* 490 */ 1845, 1798, 1848, 1850, 1851, 1852, 1853, 1854, 1688, 1819, + /* 500 */ 1857, 1691, 1859, 1860, 1861, 1863, 1864, 1867, 1874, 1876, + /* 510 */ 1878, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1888, 1892, + /* 520 */ 1899, 1855, 1901, 1868, 1902, 1905, 1906, 1908, 1909, 1912, + /* 530 */ 1914, 1893, 1917, 1768, 1920, 1773, 1923, 1776, 1925, 1926, + /* 540 */ 1907, 1877, 1924, 1903, 1928, 1865, 1894, 1933, 1869, 1936, + /* 550 */ 1889, 1951, 1955, 1922, 1910, 1918, 1963, 1927, 1915, 1932, + /* 560 */ 1967, 1939, 1929, 1935, 1979, 1944, 1991, 1940, 1942, 1953, + /* 570 */ 1938, 1945, 1974, 1947, 1989, 1954, 1956, 1993, 2000, 2001, + /* 580 */ 2003, 1962, 1818, 2014, 1938, 1966, 2016, 2017, 1946, 2019, + /* 590 */ 2020, 1985, 1970, 1982, 2025, 1990, 1975, 1986, 2029, 1994, + /* 600 */ 1981, 1988, 2034, 2008, 1987, 2005, 2048, 2050, 2051, 2052, + /* 610 */ 2053, 2054, 1941, 1948, 2018, 2035, 2058, 2022, 2023, 2026, + /* 620 */ 2028, 2030, 2031, 2032, 2033, 2038, 2039, 2036, 2037, 2044, + /* 630 */ 2042, 2075, 2060, 2076, 2061, 2080, 2070, 2040, 2094, 2073, + /* 640 */ 2059, 2097, 2098, 2099, 2063, 2101, 2066, 2111, 2084, 2087, + /* 650 */ 2071, 2072, 2077, 2004, 2006, 2115, 1934, 1998, 2002, 2013, + /* 660 */ 1916, 1938, 2074, 2122, 1949, 2088, 2104, 2128, 1931, 2107, + /* 670 */ 1952, 1957, 2131, 2132, 1958, 1943, 1959, 1968, 2137, 2102, + /* 680 */ 1862, 2043, 2041, 2055, 2049, 2109, 2110, 2057, 2089, 2056, + /* 690 */ 2124, 2069, 2067, 2143, 2145, 2078, 2081, 2082, 2083, 2079, + /* 700 */ 2147, 2133, 2134, 2086, 2148, 1913, 2090, 2091, 2181, 2152, + /* 710 */ 1921, 2154, 2157, 2158, 2159, 2164, 2165, 2095, 2096, 2156, + /* 720 */ 1937, 2174, 2162, 2208, 2212, 2108, 2171, 2112, 2114, 2116, + /* 730 */ 2118, 2125, 2065, 2129, 2214, 2175, 2062, 2130, 2100, 1938, + /* 740 */ 2169, 2206, 2135, 1983, 2136, 2242, 2223, 2010, 2140, 2141, + /* 750 */ 2144, 2146, 2149, 2150, 2210, 2153, 2161, 2215, 2155, 2233, + /* 760 */ 2045, 2163, 2160, 2167, 2220, 2224, 2173, 2170, 2228, 2176, + /* 770 */ 2177, 2232, 2179, 2180, 2234, 2182, 2183, 2236, 2185, 2186, + /* 780 */ 2244, 2190, 2142, 2168, 2178, 2184, 2191, 2172, 2202, 2249, + /* 790 */ 2204, 2250, 2205, 2249, 2249, 2293, 2259, 2245, 2285, 2295, + /* 800 */ 2296, 2297, 2298, 2299, 2300, 2301, 2303, 2263, 2241, 2265, + /* 810 */ 2243, 2314, 2311, 2312, 2313, 2329, 2316, 2324, 2326, 2288, + /* 820 */ 2038, 2330, 2039, 2337, 2339, 2341, 2342, 2359, 2345, 2383, + /* 830 */ 2347, 2334, 2344, 2387, 2351, 2338, 2348, 2391, 2356, 2355, + /* 840 */ 2353, 2396, 2360, 2362, 2357, 2398, 2378, 2379, 2402, 2399, + /* 850 */ 2385, 2400, 2403, 2401, 2404, 2406, 2405, }; -#define YY_REDUCE_COUNT (337) -#define YY_REDUCE_MIN (-477) -#define YY_REDUCE_MAX (2686) +#define YY_REDUCE_COUNT (338) +#define YY_REDUCE_MIN (-466) +#define YY_REDUCE_MAX (2737) static const short yy_reduce_ofst[] = { - /* 0 */ -328, 174, 249, 399, 431, 644, 677, 890, 923, 1048, - /* 10 */ 1168, 1235, 1310, 1343, 1379, 1436, 507, 752, 1459, 1202, - /* 20 */ 1474, 1582, 1599, 1618, 1692, 1714, 1729, 1800, 1835, 1906, - /* 30 */ 1930, 1973, 2038, 2055, 2071, 2148, 2166, 2182, 2259, 2275, - /* 40 */ 2291, 2358, 2384, 2427, 2464, 2494, 2559, 2577, 2593, 2670, - /* 50 */ 2686, -340, -208, -402, -33, 108, 572, 685, 692, 59, - /* 60 */ 143, 821, 744, -477, -93, 430, 863, -440, -27, -388, - /* 70 */ -244, -216, 411, -360, -282, -372, -332, 318, -220, -176, - /* 80 */ -108, -90, 429, 529, 552, -335, 150, 563, 634, 648, - /* 90 */ 650, 177, 186, -162, 656, 659, 401, -393, 661, 284, - /* 100 */ 671, 433, 699, 710, -387, 723, 727, 608, 754, 680, - /* 110 */ 742, 761, 791, 282, -431, -431, -366, -29, -138, 204, - /* 120 */ 263, 264, 347, 445, 516, 519, 539, 547, 623, 653, - /* 130 */ 675, 700, 764, 772, 808, 816, 847, -293, -167, 336, - /* 140 */ -20, 565, 601, 567, -167, -1, 160, 527, 340, 369, - /* 150 */ 216, 652, 660, 311, 304, 713, 604, 655, 735, 759, - /* 160 */ 756, 776, 826, 827, 299, 316, 365, 375, 450, 468, - /* 170 */ 484, 450, 120, 573, 798, 878, 666, 690, 825, 913, - /* 180 */ 926, 926, 953, 957, 922, 994, 952, 895, 899, 900, - /* 190 */ 970, 905, 926, 1035, 988, 1054, 1016, 986, 1004, 1009, - /* 200 */ 926, 943, 943, 927, 943, 959, 950, 1041, 1008, 991, - /* 210 */ 995, 1007, 1000, 1073, 1010, 1075, 1018, 1090, 1092, 1045, - /* 220 */ 1095, 1047, 1052, 1124, 1125, 1127, 1079, 1081, 1084, 1087, - /* 230 */ 1112, 1134, 1144, 1140, 1152, 1153, 1157, 1166, 1163, 1169, - /* 240 */ 1167, 1089, 1158, 1159, 1123, 1165, 1170, 1107, 1173, 1174, - /* 250 */ 1175, 1121, 1176, 1178, 1179, 1180, 1187, 1177, 1181, 1183, - /* 260 */ 1184, 1186, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1200, - /* 270 */ 1201, 1203, 1142, 1185, 1196, 1101, 1120, 1126, 1197, 1130, - /* 280 */ 1128, 1136, 1182, 1209, 1204, 1227, 1198, 1103, 1195, 1108, - /* 290 */ 1206, 1104, 1111, 1109, 1116, 1129, 1122, 1207, 1102, 1138, - /* 300 */ 1113, 943, 1265, 1199, 1212, 1155, 1278, 1274, 1276, 1223, - /* 310 */ 1244, 1258, 1260, 1266, 1229, 1267, 1241, 1295, 1285, 1296, - /* 320 */ 1317, 1208, 1273, 1271, 1319, 1308, 1339, 1340, 1345, 1268, - /* 330 */ 1256, 1283, 1290, 1322, 1326, 1329, 1346, 1362, + /* 0 */ -131, 183, 252, -20, 399, 429, 456, 644, 683, 890, + /* 10 */ 1051, 1096, 1168, 1237, 1297, 1366, 754, 1411, 1436, 1481, + /* 20 */ 1511, 1548, 1582, 1627, 1694, 1709, 1769, 1842, 1866, 1911, + /* 30 */ 1950, 1984, 2009, 2085, 2106, 2166, 2235, 2251, 2267, 2346, + /* 40 */ 2365, 2381, 2441, 2462, 2522, 2591, 2607, 2623, 2702, 2721, + /* 50 */ 2737, -342, -219, 818, -327, 885, 887, 929, 1035, 398, + /* 60 */ 717, 1102, 201, -184, -106, -365, 657, 56, 191, -386, + /* 70 */ 116, -207, 59, -362, -357, -372, -249, -336, -352, 53, + /* 80 */ 113, -282, -94, 303, 395, 140, 237, 455, 505, 569, + /* 90 */ 641, 299, 266, 294, 634, 689, 270, -42, 693, 284, + /* 100 */ 700, 385, 710, 749, 417, 759, 789, 407, 793, 507, + /* 110 */ 608, 622, 805, 409, -466, -466, -237, -322, -21, 347, + /* 120 */ 365, 420, 432, 704, 731, 741, 745, 763, 780, 796, + /* 130 */ 838, 839, 840, 844, 847, 848, 851, -113, -35, -119, + /* 140 */ 70, 751, 797, 784, -35, -8, 124, -225, -367, 397, + /* 150 */ -198, 880, 598, -7, 68, -395, -253, 472, 729, 702, + /* 160 */ 501, 802, 869, 614, 921, 292, 301, 454, 474, 504, + /* 170 */ 509, 522, 292, 340, 541, 579, 594, 549, 626, 668, + /* 180 */ 946, 930, 930, 956, 959, 924, 980, 943, 871, 878, + /* 190 */ 883, 972, 892, 930, 1030, 982, 1036, 998, 970, 997, + /* 200 */ 1006, 930, 944, 944, 926, 944, 953, 948, 1054, 1010, + /* 210 */ 990, 996, 1009, 1008, 1087, 1022, 1094, 1059, 1128, 1129, + /* 220 */ 1090, 1146, 1099, 1105, 1157, 1163, 1158, 1115, 1120, 1121, + /* 230 */ 1123, 1161, 1167, 1176, 1181, 1185, 1194, 1195, 1206, 1205, + /* 240 */ 1210, 1209, 1131, 1199, 1201, 1170, 1207, 1217, 1156, 1214, + /* 250 */ 1222, 1218, 1180, 1226, 1227, 1241, 1233, 1250, 1219, 1220, + /* 260 */ 1221, 1224, 1225, 1228, 1235, 1239, 1240, 1242, 1244, 1246, + /* 270 */ 1260, 1265, 1254, 1234, 1243, 1245, 1187, 1203, 1211, 1276, + /* 280 */ 1213, 1216, 1223, 1249, 1286, 1229, 1296, 1258, 1173, 1247, + /* 290 */ 1175, 1248, 1182, 1184, 1177, 1183, 1191, 1196, 1257, 1171, + /* 300 */ 1192, 1197, 944, 1322, 1255, 1236, 1232, 1337, 1335, 1340, + /* 310 */ 1289, 1302, 1308, 1312, 1314, 1298, 1315, 1304, 1344, 1338, + /* 320 */ 1353, 1360, 1259, 1332, 1327, 1369, 1363, 1382, 1381, 1386, + /* 330 */ 1306, 1299, 1317, 1318, 1357, 1359, 1362, 1375, 1400, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 10 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 20 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 30 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 40 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 50 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 60 */ 1908, 2249, 1908, 1908, 2212, 1908, 1908, 1908, 1908, 1908, - /* 70 */ 1908, 1908, 1908, 1908, 1908, 1908, 2219, 1908, 1908, 1908, - /* 80 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 90 */ 1908, 1908, 1908, 1908, 1908, 1908, 2007, 1908, 1908, 1908, - /* 100 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 110 */ 1908, 1908, 1908, 2005, 2452, 1908, 1908, 1908, 1908, 1908, - /* 120 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 130 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 2464, 1908, - /* 140 */ 1908, 1979, 1979, 1908, 2464, 2464, 2464, 2005, 2424, 2424, - /* 150 */ 1908, 1908, 2007, 2287, 1908, 1908, 1908, 1908, 1908, 1908, - /* 160 */ 1908, 1908, 2131, 1938, 1908, 1908, 1908, 1908, 2155, 1908, - /* 170 */ 1908, 1908, 2275, 1908, 1908, 2493, 2555, 1908, 2496, 1908, - /* 180 */ 1908, 1908, 1908, 1908, 2224, 1908, 2483, 1908, 1908, 1908, - /* 190 */ 1908, 1908, 1908, 1908, 1908, 1908, 2083, 2269, 1908, 1908, - /* 200 */ 1908, 2456, 2470, 2539, 2457, 2454, 2477, 1908, 2487, 1908, - /* 210 */ 2312, 1908, 2301, 2007, 1908, 2007, 2262, 2207, 1908, 2217, - /* 220 */ 1908, 2217, 2214, 1908, 1908, 1908, 2217, 2214, 2214, 2214, - /* 230 */ 2072, 2068, 1908, 2066, 1908, 1908, 1908, 1908, 1963, 1908, - /* 240 */ 1963, 1908, 2007, 2007, 1908, 2007, 1908, 1908, 2007, 1908, - /* 250 */ 2007, 1908, 2007, 2007, 1908, 2007, 1908, 1908, 1908, 1908, - /* 260 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 270 */ 1908, 1908, 1908, 1908, 1908, 2299, 2285, 1908, 2005, 1908, - /* 280 */ 2273, 2271, 1908, 2005, 2487, 1908, 1908, 2509, 2504, 2509, - /* 290 */ 2504, 2523, 2519, 2509, 2528, 2525, 2489, 2487, 2558, 2545, - /* 300 */ 2541, 2470, 1908, 1908, 2475, 2473, 1908, 2005, 2005, 2504, - /* 310 */ 1908, 1908, 1908, 1908, 2504, 1908, 1908, 2005, 1908, 2005, - /* 320 */ 1908, 1908, 2099, 1908, 1908, 2005, 1908, 1947, 1908, 2264, - /* 330 */ 2290, 2245, 2245, 2134, 2134, 2134, 2008, 1913, 1908, 1908, - /* 340 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 350 */ 2522, 2521, 2377, 1908, 2428, 2427, 2426, 2417, 2376, 2095, - /* 360 */ 1908, 1908, 2375, 2374, 1908, 1908, 1908, 1908, 1908, 1908, - /* 370 */ 1908, 1908, 1908, 2236, 2235, 2368, 1908, 1908, 2369, 2367, - /* 380 */ 2366, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 390 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 400 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 2542, 2546, 1908, - /* 410 */ 1908, 1908, 1908, 1908, 1908, 2453, 1908, 1908, 1908, 2348, - /* 420 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 430 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 440 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 450 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 460 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 470 */ 1908, 1908, 1908, 1908, 2213, 1908, 1908, 1908, 1908, 1908, - /* 480 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 490 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 500 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 510 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 520 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 530 */ 1908, 1908, 1908, 1908, 1908, 1908, 2228, 1908, 1908, 1908, - /* 540 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 550 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 560 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1952, 2355, - /* 570 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 580 */ 1908, 1908, 1908, 2358, 1908, 1908, 1908, 1908, 1908, 1908, - /* 590 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 600 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 610 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 620 */ 1908, 1908, 1908, 1908, 2047, 2046, 1908, 1908, 1908, 1908, - /* 630 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 640 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 650 */ 1908, 1908, 2359, 1908, 1908, 1908, 1908, 1908, 2350, 1908, - /* 660 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 670 */ 1908, 1908, 1908, 1908, 1908, 2538, 2490, 1908, 1908, 1908, - /* 680 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 690 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 2348, - /* 700 */ 1908, 2520, 1908, 1908, 2536, 1908, 2540, 1908, 1908, 1908, - /* 710 */ 1908, 1908, 1908, 1908, 2463, 2459, 1908, 1908, 2455, 1908, - /* 720 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 730 */ 1908, 1908, 1908, 1908, 1908, 1908, 2347, 1908, 2414, 1908, - /* 740 */ 1908, 1908, 2448, 1908, 1908, 2399, 1908, 1908, 1908, 1908, - /* 750 */ 1908, 1908, 1908, 1908, 1908, 2359, 1908, 2362, 1908, 1908, - /* 760 */ 1908, 1908, 1908, 2128, 1908, 1908, 1908, 1908, 1908, 1908, - /* 770 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 2112, - /* 780 */ 2110, 2109, 2108, 1908, 2105, 1908, 2141, 1908, 1908, 1908, - /* 790 */ 2137, 2136, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 800 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 2026, 1908, - /* 810 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 2018, 1908, 2017, - /* 820 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 830 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1908, - /* 840 */ 1908, 1908, 1908, 1908, 1908, 1908, 1908, 1937, 1908, 1908, - /* 850 */ 1908, 1908, 1908, 1908, + /* 0 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 10 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 20 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 30 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 40 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 50 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 60 */ 1918, 2259, 1918, 1918, 2222, 1918, 1918, 1918, 1918, 1918, + /* 70 */ 1918, 1918, 1918, 1918, 1918, 1918, 2229, 1918, 1918, 1918, + /* 80 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 90 */ 1918, 1918, 1918, 1918, 1918, 1918, 2017, 1918, 1918, 1918, + /* 100 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 110 */ 1918, 1918, 1918, 2015, 2466, 1918, 1918, 1918, 1918, 1918, + /* 120 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 130 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2478, 1918, + /* 140 */ 1918, 1989, 1989, 1918, 2478, 2478, 2478, 2015, 2438, 2438, + /* 150 */ 1918, 1918, 2017, 1918, 2301, 1918, 1918, 1918, 1918, 1918, + /* 160 */ 1918, 1918, 1918, 2141, 1948, 2299, 1918, 1918, 1918, 1918, + /* 170 */ 1918, 1918, 1918, 2285, 1918, 1918, 2507, 2569, 1918, 2510, + /* 180 */ 1918, 1918, 1918, 1918, 1918, 2234, 1918, 2497, 1918, 1918, + /* 190 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2093, 2279, 1918, + /* 200 */ 1918, 1918, 2470, 2484, 2553, 2471, 2468, 2491, 1918, 2501, + /* 210 */ 1918, 2326, 1918, 2315, 2017, 1918, 2017, 2272, 2217, 1918, + /* 220 */ 2227, 1918, 2227, 2224, 1918, 1918, 1918, 2227, 2224, 2224, + /* 230 */ 2224, 2082, 2078, 1918, 2076, 1918, 1918, 1918, 1918, 1973, + /* 240 */ 1918, 1973, 1918, 2017, 2017, 1918, 2017, 1918, 1918, 2017, + /* 250 */ 1918, 2017, 1918, 2017, 2017, 1918, 2017, 1918, 1918, 1918, + /* 260 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 270 */ 1918, 1918, 1918, 1918, 1918, 1918, 2313, 2295, 1918, 2015, + /* 280 */ 1918, 2283, 2281, 1918, 2015, 2501, 1918, 1918, 2523, 2518, + /* 290 */ 2523, 2518, 2537, 2533, 2523, 2542, 2539, 2503, 2501, 2572, + /* 300 */ 2559, 2555, 2484, 1918, 1918, 2489, 2487, 1918, 2015, 2015, + /* 310 */ 2518, 1918, 1918, 1918, 1918, 2518, 1918, 1918, 2015, 1918, + /* 320 */ 2015, 1918, 1918, 2109, 1918, 1918, 2015, 1918, 1957, 1918, + /* 330 */ 2274, 2304, 2255, 2255, 2144, 2144, 2144, 2018, 1923, 1918, + /* 340 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 350 */ 1918, 2536, 2535, 2391, 1918, 2442, 2441, 2440, 2431, 2390, + /* 360 */ 2105, 1918, 1918, 2389, 2388, 1918, 1918, 1918, 1918, 1918, + /* 370 */ 1918, 1918, 1918, 1918, 2246, 2245, 2382, 1918, 1918, 2383, + /* 380 */ 2381, 2380, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 390 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 400 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2556, 2560, + /* 410 */ 1918, 1918, 1918, 1918, 1918, 1918, 2467, 1918, 1918, 1918, + /* 420 */ 2362, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 430 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 440 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 450 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 460 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 470 */ 1918, 1918, 1918, 1918, 1918, 2223, 1918, 1918, 1918, 1918, + /* 480 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 490 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 500 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 510 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 520 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 530 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2238, 1918, 1918, + /* 540 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 550 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 560 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1962, + /* 570 */ 2369, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 580 */ 1918, 1918, 1918, 1918, 2372, 1918, 1918, 1918, 1918, 1918, + /* 590 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 600 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 610 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 620 */ 1918, 1918, 1918, 1918, 1918, 2057, 2056, 1918, 1918, 1918, + /* 630 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 640 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 650 */ 1918, 1918, 1918, 2373, 1918, 1918, 1918, 2299, 1918, 1918, + /* 660 */ 1918, 2364, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 670 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2552, 2504, + /* 680 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 690 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 700 */ 1918, 1918, 2362, 1918, 2534, 1918, 1918, 2550, 1918, 2554, + /* 710 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2477, 2473, 1918, + /* 720 */ 1918, 2469, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 730 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2361, + /* 740 */ 1918, 2428, 1918, 1918, 1918, 2462, 1918, 1918, 2413, 1918, + /* 750 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 2373, 1918, + /* 760 */ 2376, 1918, 1918, 1918, 1918, 1918, 2138, 1918, 1918, 1918, + /* 770 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 780 */ 1918, 1918, 2122, 2120, 2119, 2118, 1918, 2115, 1918, 2151, + /* 790 */ 1918, 1918, 1918, 2147, 2146, 1918, 1918, 1918, 1918, 1918, + /* 800 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 810 */ 1918, 2036, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 820 */ 2028, 1918, 2027, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 830 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 840 */ 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, + /* 850 */ 1947, 1918, 1918, 1918, 1918, 1918, 1918, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2369,70 +2377,72 @@ static const char *const yyTokenName[] = { /* 446 */ "tag_def_or_ref_opt", /* 447 */ "subtable_opt", /* 448 */ "ignore_opt", - /* 449 */ "expression", - /* 450 */ "on_vgroup_id", - /* 451 */ "dnode_list", - /* 452 */ "literal_func", - /* 453 */ "literal_list", - /* 454 */ "table_alias", - /* 455 */ "expr_or_subquery", - /* 456 */ "pseudo_column", - /* 457 */ "column_reference", - /* 458 */ "function_expression", - /* 459 */ "case_when_expression", - /* 460 */ "star_func", - /* 461 */ "star_func_para_list", - /* 462 */ "noarg_func", - /* 463 */ "other_para_list", - /* 464 */ "star_func_para", - /* 465 */ "when_then_list", - /* 466 */ "case_when_else_opt", - /* 467 */ "common_expression", - /* 468 */ "when_then_expr", - /* 469 */ "predicate", - /* 470 */ "compare_op", - /* 471 */ "in_op", - /* 472 */ "in_predicate_value", - /* 473 */ "boolean_value_expression", - /* 474 */ "boolean_primary", - /* 475 */ "from_clause_opt", - /* 476 */ "table_reference_list", - /* 477 */ "table_reference", - /* 478 */ "table_primary", - /* 479 */ "joined_table", - /* 480 */ "alias_opt", - /* 481 */ "subquery", - /* 482 */ "parenthesized_joined_table", - /* 483 */ "join_type", - /* 484 */ "query_specification", - /* 485 */ "hint_list", - /* 486 */ "set_quantifier_opt", - /* 487 */ "tag_mode_opt", - /* 488 */ "select_list", - /* 489 */ "partition_by_clause_opt", - /* 490 */ "range_opt", - /* 491 */ "every_opt", - /* 492 */ "fill_opt", - /* 493 */ "twindow_clause_opt", - /* 494 */ "group_by_clause_opt", - /* 495 */ "having_clause_opt", - /* 496 */ "select_item", - /* 497 */ "partition_list", - /* 498 */ "partition_item", - /* 499 */ "interval_sliding_duration_literal", - /* 500 */ "fill_mode", - /* 501 */ "group_by_list", - /* 502 */ "query_expression", - /* 503 */ "query_simple", - /* 504 */ "order_by_clause_opt", - /* 505 */ "slimit_clause_opt", - /* 506 */ "limit_clause_opt", - /* 507 */ "union_query_expression", - /* 508 */ "query_simple_or_subquery", - /* 509 */ "sort_specification_list", - /* 510 */ "sort_specification", - /* 511 */ "ordering_specification_opt", - /* 512 */ "null_ordering_opt", + /* 449 */ "column_stream_def_list", + /* 450 */ "column_stream_def", + /* 451 */ "expression", + /* 452 */ "on_vgroup_id", + /* 453 */ "dnode_list", + /* 454 */ "literal_func", + /* 455 */ "literal_list", + /* 456 */ "table_alias", + /* 457 */ "expr_or_subquery", + /* 458 */ "pseudo_column", + /* 459 */ "column_reference", + /* 460 */ "function_expression", + /* 461 */ "case_when_expression", + /* 462 */ "star_func", + /* 463 */ "star_func_para_list", + /* 464 */ "noarg_func", + /* 465 */ "other_para_list", + /* 466 */ "star_func_para", + /* 467 */ "when_then_list", + /* 468 */ "case_when_else_opt", + /* 469 */ "common_expression", + /* 470 */ "when_then_expr", + /* 471 */ "predicate", + /* 472 */ "compare_op", + /* 473 */ "in_op", + /* 474 */ "in_predicate_value", + /* 475 */ "boolean_value_expression", + /* 476 */ "boolean_primary", + /* 477 */ "from_clause_opt", + /* 478 */ "table_reference_list", + /* 479 */ "table_reference", + /* 480 */ "table_primary", + /* 481 */ "joined_table", + /* 482 */ "alias_opt", + /* 483 */ "subquery", + /* 484 */ "parenthesized_joined_table", + /* 485 */ "join_type", + /* 486 */ "query_specification", + /* 487 */ "hint_list", + /* 488 */ "set_quantifier_opt", + /* 489 */ "tag_mode_opt", + /* 490 */ "select_list", + /* 491 */ "partition_by_clause_opt", + /* 492 */ "range_opt", + /* 493 */ "every_opt", + /* 494 */ "fill_opt", + /* 495 */ "twindow_clause_opt", + /* 496 */ "group_by_clause_opt", + /* 497 */ "having_clause_opt", + /* 498 */ "select_item", + /* 499 */ "partition_list", + /* 500 */ "partition_item", + /* 501 */ "interval_sliding_duration_literal", + /* 502 */ "fill_mode", + /* 503 */ "group_by_list", + /* 504 */ "query_expression", + /* 505 */ "query_simple", + /* 506 */ "order_by_clause_opt", + /* 507 */ "slimit_clause_opt", + /* 508 */ "limit_clause_opt", + /* 509 */ "union_query_expression", + /* 510 */ "query_simple_or_subquery", + /* 511 */ "sort_specification_list", + /* 512 */ "sort_specification", + /* 513 */ "ordering_specification_opt", + /* 514 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2815,281 +2825,285 @@ static const char *const yyRuleName[] = { /* 372 */ "cmd ::= PAUSE STREAM exists_opt stream_name", /* 373 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", /* 374 */ "col_list_opt ::=", - /* 375 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 376 */ "tag_def_or_ref_opt ::=", - /* 377 */ "tag_def_or_ref_opt ::= tags_def", - /* 378 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 379 */ "stream_options ::=", - /* 380 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 381 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 382 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 383 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 384 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 385 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 386 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 387 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 388 */ "subtable_opt ::=", - /* 389 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 390 */ "ignore_opt ::=", - /* 391 */ "ignore_opt ::= IGNORE UNTREATED", - /* 392 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 393 */ "cmd ::= KILL QUERY NK_STRING", - /* 394 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 395 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 396 */ "cmd ::= BALANCE VGROUP", - /* 397 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 398 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 399 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 400 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 401 */ "on_vgroup_id ::=", - /* 402 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 403 */ "dnode_list ::= DNODE NK_INTEGER", - /* 404 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 405 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 406 */ "cmd ::= query_or_subquery", - /* 407 */ "cmd ::= insert_query", - /* 408 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 409 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 410 */ "literal ::= NK_INTEGER", - /* 411 */ "literal ::= NK_FLOAT", - /* 412 */ "literal ::= NK_STRING", - /* 413 */ "literal ::= NK_BOOL", - /* 414 */ "literal ::= TIMESTAMP NK_STRING", - /* 415 */ "literal ::= duration_literal", - /* 416 */ "literal ::= NULL", - /* 417 */ "literal ::= NK_QUESTION", - /* 418 */ "duration_literal ::= NK_VARIABLE", - /* 419 */ "signed ::= NK_INTEGER", - /* 420 */ "signed ::= NK_PLUS NK_INTEGER", - /* 421 */ "signed ::= NK_MINUS NK_INTEGER", - /* 422 */ "signed ::= NK_FLOAT", - /* 423 */ "signed ::= NK_PLUS NK_FLOAT", - /* 424 */ "signed ::= NK_MINUS NK_FLOAT", - /* 425 */ "signed_literal ::= signed", - /* 426 */ "signed_literal ::= NK_STRING", - /* 427 */ "signed_literal ::= NK_BOOL", - /* 428 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 429 */ "signed_literal ::= duration_literal", - /* 430 */ "signed_literal ::= NULL", - /* 431 */ "signed_literal ::= literal_func", - /* 432 */ "signed_literal ::= NK_QUESTION", - /* 433 */ "literal_list ::= signed_literal", - /* 434 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 435 */ "db_name ::= NK_ID", - /* 436 */ "table_name ::= NK_ID", - /* 437 */ "column_name ::= NK_ID", - /* 438 */ "function_name ::= NK_ID", - /* 439 */ "view_name ::= NK_ID", - /* 440 */ "table_alias ::= NK_ID", - /* 441 */ "column_alias ::= NK_ID", - /* 442 */ "column_alias ::= NK_ALIAS", - /* 443 */ "user_name ::= NK_ID", - /* 444 */ "topic_name ::= NK_ID", - /* 445 */ "stream_name ::= NK_ID", - /* 446 */ "cgroup_name ::= NK_ID", - /* 447 */ "index_name ::= NK_ID", - /* 448 */ "expr_or_subquery ::= expression", - /* 449 */ "expression ::= literal", - /* 450 */ "expression ::= pseudo_column", - /* 451 */ "expression ::= column_reference", - /* 452 */ "expression ::= function_expression", - /* 453 */ "expression ::= case_when_expression", - /* 454 */ "expression ::= NK_LP expression NK_RP", - /* 455 */ "expression ::= NK_PLUS expr_or_subquery", - /* 456 */ "expression ::= NK_MINUS expr_or_subquery", - /* 457 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 458 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 459 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 460 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 461 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 462 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 463 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 464 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 465 */ "expression_list ::= expr_or_subquery", - /* 466 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 467 */ "column_reference ::= column_name", - /* 468 */ "column_reference ::= table_name NK_DOT column_name", - /* 469 */ "column_reference ::= NK_ALIAS", - /* 470 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 471 */ "pseudo_column ::= ROWTS", - /* 472 */ "pseudo_column ::= TBNAME", - /* 473 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 474 */ "pseudo_column ::= QSTART", - /* 475 */ "pseudo_column ::= QEND", - /* 476 */ "pseudo_column ::= QDURATION", - /* 477 */ "pseudo_column ::= WSTART", - /* 478 */ "pseudo_column ::= WEND", - /* 479 */ "pseudo_column ::= WDURATION", - /* 480 */ "pseudo_column ::= IROWTS", - /* 481 */ "pseudo_column ::= ISFILLED", - /* 482 */ "pseudo_column ::= QTAGS", - /* 483 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 484 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 485 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 486 */ "function_expression ::= literal_func", - /* 487 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 488 */ "literal_func ::= NOW", - /* 489 */ "noarg_func ::= NOW", - /* 490 */ "noarg_func ::= TODAY", - /* 491 */ "noarg_func ::= TIMEZONE", - /* 492 */ "noarg_func ::= DATABASE", - /* 493 */ "noarg_func ::= CLIENT_VERSION", - /* 494 */ "noarg_func ::= SERVER_VERSION", - /* 495 */ "noarg_func ::= SERVER_STATUS", - /* 496 */ "noarg_func ::= CURRENT_USER", - /* 497 */ "noarg_func ::= USER", - /* 498 */ "star_func ::= COUNT", - /* 499 */ "star_func ::= FIRST", - /* 500 */ "star_func ::= LAST", - /* 501 */ "star_func ::= LAST_ROW", - /* 502 */ "star_func_para_list ::= NK_STAR", - /* 503 */ "star_func_para_list ::= other_para_list", - /* 504 */ "other_para_list ::= star_func_para", - /* 505 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 506 */ "star_func_para ::= expr_or_subquery", - /* 507 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 508 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 509 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 510 */ "when_then_list ::= when_then_expr", - /* 511 */ "when_then_list ::= when_then_list when_then_expr", - /* 512 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 513 */ "case_when_else_opt ::=", - /* 514 */ "case_when_else_opt ::= ELSE common_expression", - /* 515 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 516 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 517 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 518 */ "predicate ::= expr_or_subquery IS NULL", - /* 519 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 520 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 521 */ "compare_op ::= NK_LT", - /* 522 */ "compare_op ::= NK_GT", - /* 523 */ "compare_op ::= NK_LE", - /* 524 */ "compare_op ::= NK_GE", - /* 525 */ "compare_op ::= NK_NE", - /* 526 */ "compare_op ::= NK_EQ", - /* 527 */ "compare_op ::= LIKE", - /* 528 */ "compare_op ::= NOT LIKE", - /* 529 */ "compare_op ::= MATCH", - /* 530 */ "compare_op ::= NMATCH", - /* 531 */ "compare_op ::= CONTAINS", - /* 532 */ "in_op ::= IN", - /* 533 */ "in_op ::= NOT IN", - /* 534 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 535 */ "boolean_value_expression ::= boolean_primary", - /* 536 */ "boolean_value_expression ::= NOT boolean_primary", - /* 537 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 538 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 539 */ "boolean_primary ::= predicate", - /* 540 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 541 */ "common_expression ::= expr_or_subquery", - /* 542 */ "common_expression ::= boolean_value_expression", - /* 543 */ "from_clause_opt ::=", - /* 544 */ "from_clause_opt ::= FROM table_reference_list", - /* 545 */ "table_reference_list ::= table_reference", - /* 546 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 547 */ "table_reference ::= table_primary", - /* 548 */ "table_reference ::= joined_table", - /* 549 */ "table_primary ::= table_name alias_opt", - /* 550 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 551 */ "table_primary ::= subquery alias_opt", - /* 552 */ "table_primary ::= parenthesized_joined_table", - /* 553 */ "alias_opt ::=", - /* 554 */ "alias_opt ::= table_alias", - /* 555 */ "alias_opt ::= AS table_alias", - /* 556 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 557 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 558 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 559 */ "join_type ::=", - /* 560 */ "join_type ::= INNER", - /* 561 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 562 */ "hint_list ::=", - /* 563 */ "hint_list ::= NK_HINT", - /* 564 */ "tag_mode_opt ::=", - /* 565 */ "tag_mode_opt ::= TAGS", - /* 566 */ "set_quantifier_opt ::=", - /* 567 */ "set_quantifier_opt ::= DISTINCT", - /* 568 */ "set_quantifier_opt ::= ALL", - /* 569 */ "select_list ::= select_item", - /* 570 */ "select_list ::= select_list NK_COMMA select_item", - /* 571 */ "select_item ::= NK_STAR", - /* 572 */ "select_item ::= common_expression", - /* 573 */ "select_item ::= common_expression column_alias", - /* 574 */ "select_item ::= common_expression AS column_alias", - /* 575 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 576 */ "where_clause_opt ::=", - /* 577 */ "where_clause_opt ::= WHERE search_condition", - /* 578 */ "partition_by_clause_opt ::=", - /* 579 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 580 */ "partition_list ::= partition_item", - /* 581 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 582 */ "partition_item ::= expr_or_subquery", - /* 583 */ "partition_item ::= expr_or_subquery column_alias", - /* 584 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 585 */ "twindow_clause_opt ::=", - /* 586 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 587 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 588 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 589 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 590 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 591 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 592 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 593 */ "sliding_opt ::=", - /* 594 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 595 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 596 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 597 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 598 */ "fill_opt ::=", - /* 599 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 600 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 601 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 602 */ "fill_mode ::= NONE", - /* 603 */ "fill_mode ::= PREV", - /* 604 */ "fill_mode ::= NULL", - /* 605 */ "fill_mode ::= NULL_F", - /* 606 */ "fill_mode ::= LINEAR", - /* 607 */ "fill_mode ::= NEXT", - /* 608 */ "group_by_clause_opt ::=", - /* 609 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 610 */ "group_by_list ::= expr_or_subquery", - /* 611 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 612 */ "having_clause_opt ::=", - /* 613 */ "having_clause_opt ::= HAVING search_condition", - /* 614 */ "range_opt ::=", - /* 615 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 616 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 617 */ "every_opt ::=", - /* 618 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 619 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 620 */ "query_simple ::= query_specification", - /* 621 */ "query_simple ::= union_query_expression", - /* 622 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 623 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 624 */ "query_simple_or_subquery ::= query_simple", - /* 625 */ "query_simple_or_subquery ::= subquery", - /* 626 */ "query_or_subquery ::= query_expression", - /* 627 */ "query_or_subquery ::= subquery", - /* 628 */ "order_by_clause_opt ::=", - /* 629 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 630 */ "slimit_clause_opt ::=", - /* 631 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 632 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 633 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 634 */ "limit_clause_opt ::=", - /* 635 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 636 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 637 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 638 */ "subquery ::= NK_LP query_expression NK_RP", - /* 639 */ "subquery ::= NK_LP subquery NK_RP", - /* 640 */ "search_condition ::= common_expression", - /* 641 */ "sort_specification_list ::= sort_specification", - /* 642 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 643 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 644 */ "ordering_specification_opt ::=", - /* 645 */ "ordering_specification_opt ::= ASC", - /* 646 */ "ordering_specification_opt ::= DESC", - /* 647 */ "null_ordering_opt ::=", - /* 648 */ "null_ordering_opt ::= NULLS FIRST", - /* 649 */ "null_ordering_opt ::= NULLS LAST", + /* 375 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", + /* 376 */ "column_stream_def_list ::= column_stream_def", + /* 377 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", + /* 378 */ "column_stream_def ::= column_name", + /* 379 */ "column_stream_def ::= column_name PRIMARY KEY", + /* 380 */ "tag_def_or_ref_opt ::=", + /* 381 */ "tag_def_or_ref_opt ::= tags_def", + /* 382 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", + /* 383 */ "stream_options ::=", + /* 384 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 385 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 386 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 387 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 388 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 389 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 390 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 391 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 392 */ "subtable_opt ::=", + /* 393 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 394 */ "ignore_opt ::=", + /* 395 */ "ignore_opt ::= IGNORE UNTREATED", + /* 396 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 397 */ "cmd ::= KILL QUERY NK_STRING", + /* 398 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 399 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 400 */ "cmd ::= BALANCE VGROUP", + /* 401 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 402 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 403 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 404 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 405 */ "on_vgroup_id ::=", + /* 406 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 407 */ "dnode_list ::= DNODE NK_INTEGER", + /* 408 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 409 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 410 */ "cmd ::= query_or_subquery", + /* 411 */ "cmd ::= insert_query", + /* 412 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 413 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 414 */ "literal ::= NK_INTEGER", + /* 415 */ "literal ::= NK_FLOAT", + /* 416 */ "literal ::= NK_STRING", + /* 417 */ "literal ::= NK_BOOL", + /* 418 */ "literal ::= TIMESTAMP NK_STRING", + /* 419 */ "literal ::= duration_literal", + /* 420 */ "literal ::= NULL", + /* 421 */ "literal ::= NK_QUESTION", + /* 422 */ "duration_literal ::= NK_VARIABLE", + /* 423 */ "signed ::= NK_INTEGER", + /* 424 */ "signed ::= NK_PLUS NK_INTEGER", + /* 425 */ "signed ::= NK_MINUS NK_INTEGER", + /* 426 */ "signed ::= NK_FLOAT", + /* 427 */ "signed ::= NK_PLUS NK_FLOAT", + /* 428 */ "signed ::= NK_MINUS NK_FLOAT", + /* 429 */ "signed_literal ::= signed", + /* 430 */ "signed_literal ::= NK_STRING", + /* 431 */ "signed_literal ::= NK_BOOL", + /* 432 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 433 */ "signed_literal ::= duration_literal", + /* 434 */ "signed_literal ::= NULL", + /* 435 */ "signed_literal ::= literal_func", + /* 436 */ "signed_literal ::= NK_QUESTION", + /* 437 */ "literal_list ::= signed_literal", + /* 438 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 439 */ "db_name ::= NK_ID", + /* 440 */ "table_name ::= NK_ID", + /* 441 */ "column_name ::= NK_ID", + /* 442 */ "function_name ::= NK_ID", + /* 443 */ "view_name ::= NK_ID", + /* 444 */ "table_alias ::= NK_ID", + /* 445 */ "column_alias ::= NK_ID", + /* 446 */ "column_alias ::= NK_ALIAS", + /* 447 */ "user_name ::= NK_ID", + /* 448 */ "topic_name ::= NK_ID", + /* 449 */ "stream_name ::= NK_ID", + /* 450 */ "cgroup_name ::= NK_ID", + /* 451 */ "index_name ::= NK_ID", + /* 452 */ "expr_or_subquery ::= expression", + /* 453 */ "expression ::= literal", + /* 454 */ "expression ::= pseudo_column", + /* 455 */ "expression ::= column_reference", + /* 456 */ "expression ::= function_expression", + /* 457 */ "expression ::= case_when_expression", + /* 458 */ "expression ::= NK_LP expression NK_RP", + /* 459 */ "expression ::= NK_PLUS expr_or_subquery", + /* 460 */ "expression ::= NK_MINUS expr_or_subquery", + /* 461 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 462 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 463 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 464 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 465 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 466 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 467 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 468 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 469 */ "expression_list ::= expr_or_subquery", + /* 470 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 471 */ "column_reference ::= column_name", + /* 472 */ "column_reference ::= table_name NK_DOT column_name", + /* 473 */ "column_reference ::= NK_ALIAS", + /* 474 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 475 */ "pseudo_column ::= ROWTS", + /* 476 */ "pseudo_column ::= TBNAME", + /* 477 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 478 */ "pseudo_column ::= QSTART", + /* 479 */ "pseudo_column ::= QEND", + /* 480 */ "pseudo_column ::= QDURATION", + /* 481 */ "pseudo_column ::= WSTART", + /* 482 */ "pseudo_column ::= WEND", + /* 483 */ "pseudo_column ::= WDURATION", + /* 484 */ "pseudo_column ::= IROWTS", + /* 485 */ "pseudo_column ::= ISFILLED", + /* 486 */ "pseudo_column ::= QTAGS", + /* 487 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 488 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 489 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 490 */ "function_expression ::= literal_func", + /* 491 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 492 */ "literal_func ::= NOW", + /* 493 */ "noarg_func ::= NOW", + /* 494 */ "noarg_func ::= TODAY", + /* 495 */ "noarg_func ::= TIMEZONE", + /* 496 */ "noarg_func ::= DATABASE", + /* 497 */ "noarg_func ::= CLIENT_VERSION", + /* 498 */ "noarg_func ::= SERVER_VERSION", + /* 499 */ "noarg_func ::= SERVER_STATUS", + /* 500 */ "noarg_func ::= CURRENT_USER", + /* 501 */ "noarg_func ::= USER", + /* 502 */ "star_func ::= COUNT", + /* 503 */ "star_func ::= FIRST", + /* 504 */ "star_func ::= LAST", + /* 505 */ "star_func ::= LAST_ROW", + /* 506 */ "star_func_para_list ::= NK_STAR", + /* 507 */ "star_func_para_list ::= other_para_list", + /* 508 */ "other_para_list ::= star_func_para", + /* 509 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 510 */ "star_func_para ::= expr_or_subquery", + /* 511 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 512 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 513 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 514 */ "when_then_list ::= when_then_expr", + /* 515 */ "when_then_list ::= when_then_list when_then_expr", + /* 516 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 517 */ "case_when_else_opt ::=", + /* 518 */ "case_when_else_opt ::= ELSE common_expression", + /* 519 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 520 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 521 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 522 */ "predicate ::= expr_or_subquery IS NULL", + /* 523 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 524 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 525 */ "compare_op ::= NK_LT", + /* 526 */ "compare_op ::= NK_GT", + /* 527 */ "compare_op ::= NK_LE", + /* 528 */ "compare_op ::= NK_GE", + /* 529 */ "compare_op ::= NK_NE", + /* 530 */ "compare_op ::= NK_EQ", + /* 531 */ "compare_op ::= LIKE", + /* 532 */ "compare_op ::= NOT LIKE", + /* 533 */ "compare_op ::= MATCH", + /* 534 */ "compare_op ::= NMATCH", + /* 535 */ "compare_op ::= CONTAINS", + /* 536 */ "in_op ::= IN", + /* 537 */ "in_op ::= NOT IN", + /* 538 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 539 */ "boolean_value_expression ::= boolean_primary", + /* 540 */ "boolean_value_expression ::= NOT boolean_primary", + /* 541 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 542 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 543 */ "boolean_primary ::= predicate", + /* 544 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 545 */ "common_expression ::= expr_or_subquery", + /* 546 */ "common_expression ::= boolean_value_expression", + /* 547 */ "from_clause_opt ::=", + /* 548 */ "from_clause_opt ::= FROM table_reference_list", + /* 549 */ "table_reference_list ::= table_reference", + /* 550 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 551 */ "table_reference ::= table_primary", + /* 552 */ "table_reference ::= joined_table", + /* 553 */ "table_primary ::= table_name alias_opt", + /* 554 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 555 */ "table_primary ::= subquery alias_opt", + /* 556 */ "table_primary ::= parenthesized_joined_table", + /* 557 */ "alias_opt ::=", + /* 558 */ "alias_opt ::= table_alias", + /* 559 */ "alias_opt ::= AS table_alias", + /* 560 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 561 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 562 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 563 */ "join_type ::=", + /* 564 */ "join_type ::= INNER", + /* 565 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 566 */ "hint_list ::=", + /* 567 */ "hint_list ::= NK_HINT", + /* 568 */ "tag_mode_opt ::=", + /* 569 */ "tag_mode_opt ::= TAGS", + /* 570 */ "set_quantifier_opt ::=", + /* 571 */ "set_quantifier_opt ::= DISTINCT", + /* 572 */ "set_quantifier_opt ::= ALL", + /* 573 */ "select_list ::= select_item", + /* 574 */ "select_list ::= select_list NK_COMMA select_item", + /* 575 */ "select_item ::= NK_STAR", + /* 576 */ "select_item ::= common_expression", + /* 577 */ "select_item ::= common_expression column_alias", + /* 578 */ "select_item ::= common_expression AS column_alias", + /* 579 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 580 */ "where_clause_opt ::=", + /* 581 */ "where_clause_opt ::= WHERE search_condition", + /* 582 */ "partition_by_clause_opt ::=", + /* 583 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 584 */ "partition_list ::= partition_item", + /* 585 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 586 */ "partition_item ::= expr_or_subquery", + /* 587 */ "partition_item ::= expr_or_subquery column_alias", + /* 588 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 589 */ "twindow_clause_opt ::=", + /* 590 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 591 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 592 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 593 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 594 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 595 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 596 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 597 */ "sliding_opt ::=", + /* 598 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 599 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 600 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 601 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 602 */ "fill_opt ::=", + /* 603 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 604 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 605 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 606 */ "fill_mode ::= NONE", + /* 607 */ "fill_mode ::= PREV", + /* 608 */ "fill_mode ::= NULL", + /* 609 */ "fill_mode ::= NULL_F", + /* 610 */ "fill_mode ::= LINEAR", + /* 611 */ "fill_mode ::= NEXT", + /* 612 */ "group_by_clause_opt ::=", + /* 613 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 614 */ "group_by_list ::= expr_or_subquery", + /* 615 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 616 */ "having_clause_opt ::=", + /* 617 */ "having_clause_opt ::= HAVING search_condition", + /* 618 */ "range_opt ::=", + /* 619 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 620 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 621 */ "every_opt ::=", + /* 622 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 623 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 624 */ "query_simple ::= query_specification", + /* 625 */ "query_simple ::= union_query_expression", + /* 626 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 627 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 628 */ "query_simple_or_subquery ::= query_simple", + /* 629 */ "query_simple_or_subquery ::= subquery", + /* 630 */ "query_or_subquery ::= query_expression", + /* 631 */ "query_or_subquery ::= subquery", + /* 632 */ "order_by_clause_opt ::=", + /* 633 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 634 */ "slimit_clause_opt ::=", + /* 635 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 636 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 637 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 638 */ "limit_clause_opt ::=", + /* 639 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 640 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 641 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 642 */ "subquery ::= NK_LP query_expression NK_RP", + /* 643 */ "subquery ::= NK_LP subquery NK_RP", + /* 644 */ "search_condition ::= common_expression", + /* 645 */ "sort_specification_list ::= sort_specification", + /* 646 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 647 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 648 */ "ordering_specification_opt ::=", + /* 649 */ "ordering_specification_opt ::= ASC", + /* 650 */ "ordering_specification_opt ::= DESC", + /* 651 */ "null_ordering_opt ::=", + /* 652 */ "null_ordering_opt ::= NULLS FIRST", + /* 653 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3254,48 +3268,47 @@ static void yy_destructor( case 441: /* full_view_name */ case 444: /* stream_options */ case 447: /* subtable_opt */ - case 449: /* expression */ - case 452: /* literal_func */ - case 455: /* expr_or_subquery */ - case 456: /* pseudo_column */ - case 457: /* column_reference */ - case 458: /* function_expression */ - case 459: /* case_when_expression */ - case 464: /* star_func_para */ - case 466: /* case_when_else_opt */ - case 467: /* common_expression */ - case 468: /* when_then_expr */ - case 469: /* predicate */ - case 472: /* in_predicate_value */ - case 473: /* boolean_value_expression */ - case 474: /* boolean_primary */ - case 475: /* from_clause_opt */ - case 476: /* table_reference_list */ - case 477: /* table_reference */ - case 478: /* table_primary */ - case 479: /* joined_table */ - case 481: /* subquery */ - case 482: /* parenthesized_joined_table */ - case 484: /* query_specification */ - case 490: /* range_opt */ - case 491: /* every_opt */ - case 492: /* fill_opt */ - case 493: /* twindow_clause_opt */ - case 495: /* having_clause_opt */ - case 496: /* select_item */ - case 498: /* partition_item */ - case 499: /* interval_sliding_duration_literal */ - case 502: /* query_expression */ - case 503: /* query_simple */ - case 505: /* slimit_clause_opt */ - case 506: /* limit_clause_opt */ - case 507: /* union_query_expression */ - case 508: /* query_simple_or_subquery */ - case 510: /* sort_specification */ + case 450: /* column_stream_def */ + case 451: /* expression */ + case 454: /* literal_func */ + case 457: /* expr_or_subquery */ + case 458: /* pseudo_column */ + case 459: /* column_reference */ + case 460: /* function_expression */ + case 461: /* case_when_expression */ + case 466: /* star_func_para */ + case 468: /* case_when_else_opt */ + case 469: /* common_expression */ + case 470: /* when_then_expr */ + case 471: /* predicate */ + case 474: /* in_predicate_value */ + case 475: /* boolean_value_expression */ + case 476: /* boolean_primary */ + case 477: /* from_clause_opt */ + case 478: /* table_reference_list */ + case 479: /* table_reference */ + case 480: /* table_primary */ + case 481: /* joined_table */ + case 483: /* subquery */ + case 484: /* parenthesized_joined_table */ + case 486: /* query_specification */ + case 492: /* range_opt */ + case 493: /* every_opt */ + case 494: /* fill_opt */ + case 495: /* twindow_clause_opt */ + case 497: /* having_clause_opt */ + case 498: /* select_item */ + case 500: /* partition_item */ + case 501: /* interval_sliding_duration_literal */ + case 504: /* query_expression */ + case 505: /* query_simple */ + case 507: /* slimit_clause_opt */ + case 508: /* limit_clause_opt */ + case 509: /* union_query_expression */ + case 510: /* query_simple_or_subquery */ + case 512: /* sort_specification */ { -#line 7 "sql.y" - nodesDestroyNode((yypminor->yy560)); -#line 3298 "sql.c" + nodesDestroyNode((yypminor->yy752)); } break; case 353: /* account_options */ @@ -3305,9 +3318,7 @@ static void yy_destructor( case 430: /* with_meta */ case 439: /* bufsize_opt */ { -#line 54 "sql.y" -#line 3310 "sql.c" } break; case 357: /* ip_range_list */ @@ -3330,23 +3341,22 @@ static void yy_destructor( case 425: /* func_list */ case 445: /* col_list_opt */ case 446: /* tag_def_or_ref_opt */ - case 451: /* dnode_list */ - case 453: /* literal_list */ - case 461: /* star_func_para_list */ - case 463: /* other_para_list */ - case 465: /* when_then_list */ - case 485: /* hint_list */ - case 488: /* select_list */ - case 489: /* partition_by_clause_opt */ - case 494: /* group_by_clause_opt */ - case 497: /* partition_list */ - case 501: /* group_by_list */ - case 504: /* order_by_clause_opt */ - case 509: /* sort_specification_list */ + case 449: /* column_stream_def_list */ + case 453: /* dnode_list */ + case 455: /* literal_list */ + case 463: /* star_func_para_list */ + case 465: /* other_para_list */ + case 467: /* when_then_list */ + case 487: /* hint_list */ + case 490: /* select_list */ + case 491: /* partition_by_clause_opt */ + case 496: /* group_by_clause_opt */ + case 499: /* partition_list */ + case 503: /* group_by_list */ + case 506: /* order_by_clause_opt */ + case 511: /* sort_specification_list */ { -#line 85 "sql.y" - nodesDestroyList((yypminor->yy388)); -#line 3349 "sql.c" + nodesDestroyList((yypminor->yy264)); } break; case 360: /* user_name */ @@ -3363,38 +3373,30 @@ static void yy_destructor( case 440: /* language_opt */ case 442: /* view_name */ case 443: /* stream_name */ - case 450: /* on_vgroup_id */ - case 454: /* table_alias */ - case 460: /* star_func */ - case 462: /* noarg_func */ - case 480: /* alias_opt */ + case 452: /* on_vgroup_id */ + case 456: /* table_alias */ + case 462: /* star_func */ + case 464: /* noarg_func */ + case 482: /* alias_opt */ { -#line 820 "sql.y" -#line 3374 "sql.c" } break; case 361: /* sysinfo_opt */ { -#line 112 "sql.y" -#line 3381 "sql.c" } break; case 362: /* privileges */ case 365: /* priv_type_list */ case 366: /* priv_type */ { -#line 121 "sql.y" -#line 3390 "sql.c" } break; case 363: /* priv_level */ { -#line 138 "sql.y" -#line 3397 "sql.c" } break; case 372: /* force_opt */ @@ -3405,78 +3407,58 @@ static void yy_destructor( case 437: /* or_replace_opt */ case 438: /* agg_func_opt */ case 448: /* ignore_opt */ - case 486: /* set_quantifier_opt */ - case 487: /* tag_mode_opt */ + case 488: /* set_quantifier_opt */ + case 489: /* tag_mode_opt */ { -#line 167 "sql.y" -#line 3413 "sql.c" } break; case 385: /* alter_db_option */ case 407: /* alter_table_option */ { -#line 269 "sql.y" -#line 3421 "sql.c" } break; case 397: /* type_name */ { -#line 393 "sql.y" -#line 3428 "sql.c" } break; case 412: /* db_kind_opt */ case 419: /* table_kind */ { -#line 561 "sql.y" -#line 3436 "sql.c" } break; case 413: /* table_kind_db_name_cond_opt */ { -#line 526 "sql.y" -#line 3443 "sql.c" } break; - case 470: /* compare_op */ - case 471: /* in_op */ + case 472: /* compare_op */ + case 473: /* in_op */ { -#line 1010 "sql.y" -#line 3451 "sql.c" } break; - case 483: /* join_type */ + case 485: /* join_type */ { -#line 1086 "sql.y" -#line 3458 "sql.c" } break; - case 500: /* fill_mode */ + case 502: /* fill_mode */ { -#line 1181 "sql.y" -#line 3465 "sql.c" } break; - case 511: /* ordering_specification_opt */ + case 513: /* ordering_specification_opt */ { -#line 1266 "sql.y" -#line 3472 "sql.c" } break; - case 512: /* null_ordering_opt */ + case 514: /* null_ordering_opt */ { -#line 1272 "sql.y" -#line 3479 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -4140,281 +4122,285 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 352, /* (372) cmd ::= PAUSE STREAM exists_opt stream_name */ 352, /* (373) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ 445, /* (374) col_list_opt ::= */ - 445, /* (375) col_list_opt ::= NK_LP col_name_list NK_RP */ - 446, /* (376) tag_def_or_ref_opt ::= */ - 446, /* (377) tag_def_or_ref_opt ::= tags_def */ - 446, /* (378) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 444, /* (379) stream_options ::= */ - 444, /* (380) stream_options ::= stream_options TRIGGER AT_ONCE */ - 444, /* (381) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 444, /* (382) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 444, /* (383) stream_options ::= stream_options WATERMARK duration_literal */ - 444, /* (384) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 444, /* (385) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 444, /* (386) stream_options ::= stream_options DELETE_MARK duration_literal */ - 444, /* (387) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 447, /* (388) subtable_opt ::= */ - 447, /* (389) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 448, /* (390) ignore_opt ::= */ - 448, /* (391) ignore_opt ::= IGNORE UNTREATED */ - 352, /* (392) cmd ::= KILL CONNECTION NK_INTEGER */ - 352, /* (393) cmd ::= KILL QUERY NK_STRING */ - 352, /* (394) cmd ::= KILL TRANSACTION NK_INTEGER */ - 352, /* (395) cmd ::= KILL COMPACT NK_INTEGER */ - 352, /* (396) cmd ::= BALANCE VGROUP */ - 352, /* (397) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 352, /* (398) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 352, /* (399) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 352, /* (400) cmd ::= SPLIT VGROUP NK_INTEGER */ - 450, /* (401) on_vgroup_id ::= */ - 450, /* (402) on_vgroup_id ::= ON NK_INTEGER */ - 451, /* (403) dnode_list ::= DNODE NK_INTEGER */ - 451, /* (404) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 352, /* (405) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 352, /* (406) cmd ::= query_or_subquery */ - 352, /* (407) cmd ::= insert_query */ - 436, /* (408) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 436, /* (409) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 355, /* (410) literal ::= NK_INTEGER */ - 355, /* (411) literal ::= NK_FLOAT */ - 355, /* (412) literal ::= NK_STRING */ - 355, /* (413) literal ::= NK_BOOL */ - 355, /* (414) literal ::= TIMESTAMP NK_STRING */ - 355, /* (415) literal ::= duration_literal */ - 355, /* (416) literal ::= NULL */ - 355, /* (417) literal ::= NK_QUESTION */ - 408, /* (418) duration_literal ::= NK_VARIABLE */ - 384, /* (419) signed ::= NK_INTEGER */ - 384, /* (420) signed ::= NK_PLUS NK_INTEGER */ - 384, /* (421) signed ::= NK_MINUS NK_INTEGER */ - 384, /* (422) signed ::= NK_FLOAT */ - 384, /* (423) signed ::= NK_PLUS NK_FLOAT */ - 384, /* (424) signed ::= NK_MINUS NK_FLOAT */ - 398, /* (425) signed_literal ::= signed */ - 398, /* (426) signed_literal ::= NK_STRING */ - 398, /* (427) signed_literal ::= NK_BOOL */ - 398, /* (428) signed_literal ::= TIMESTAMP NK_STRING */ - 398, /* (429) signed_literal ::= duration_literal */ - 398, /* (430) signed_literal ::= NULL */ - 398, /* (431) signed_literal ::= literal_func */ - 398, /* (432) signed_literal ::= NK_QUESTION */ - 453, /* (433) literal_list ::= signed_literal */ - 453, /* (434) literal_list ::= literal_list NK_COMMA signed_literal */ - 367, /* (435) db_name ::= NK_ID */ - 368, /* (436) table_name ::= NK_ID */ - 396, /* (437) column_name ::= NK_ID */ - 410, /* (438) function_name ::= NK_ID */ - 442, /* (439) view_name ::= NK_ID */ - 454, /* (440) table_alias ::= NK_ID */ - 421, /* (441) column_alias ::= NK_ID */ - 421, /* (442) column_alias ::= NK_ALIAS */ - 360, /* (443) user_name ::= NK_ID */ - 369, /* (444) topic_name ::= NK_ID */ - 443, /* (445) stream_name ::= NK_ID */ - 433, /* (446) cgroup_name ::= NK_ID */ - 424, /* (447) index_name ::= NK_ID */ - 455, /* (448) expr_or_subquery ::= expression */ - 449, /* (449) expression ::= literal */ - 449, /* (450) expression ::= pseudo_column */ - 449, /* (451) expression ::= column_reference */ - 449, /* (452) expression ::= function_expression */ - 449, /* (453) expression ::= case_when_expression */ - 449, /* (454) expression ::= NK_LP expression NK_RP */ - 449, /* (455) expression ::= NK_PLUS expr_or_subquery */ - 449, /* (456) expression ::= NK_MINUS expr_or_subquery */ - 449, /* (457) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 449, /* (458) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 449, /* (459) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 449, /* (460) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 449, /* (461) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 449, /* (462) expression ::= column_reference NK_ARROW NK_STRING */ - 449, /* (463) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 449, /* (464) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 401, /* (465) expression_list ::= expr_or_subquery */ - 401, /* (466) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 457, /* (467) column_reference ::= column_name */ - 457, /* (468) column_reference ::= table_name NK_DOT column_name */ - 457, /* (469) column_reference ::= NK_ALIAS */ - 457, /* (470) column_reference ::= table_name NK_DOT NK_ALIAS */ - 456, /* (471) pseudo_column ::= ROWTS */ - 456, /* (472) pseudo_column ::= TBNAME */ - 456, /* (473) pseudo_column ::= table_name NK_DOT TBNAME */ - 456, /* (474) pseudo_column ::= QSTART */ - 456, /* (475) pseudo_column ::= QEND */ - 456, /* (476) pseudo_column ::= QDURATION */ - 456, /* (477) pseudo_column ::= WSTART */ - 456, /* (478) pseudo_column ::= WEND */ - 456, /* (479) pseudo_column ::= WDURATION */ - 456, /* (480) pseudo_column ::= IROWTS */ - 456, /* (481) pseudo_column ::= ISFILLED */ - 456, /* (482) pseudo_column ::= QTAGS */ - 458, /* (483) function_expression ::= function_name NK_LP expression_list NK_RP */ - 458, /* (484) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 458, /* (485) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 458, /* (486) function_expression ::= literal_func */ - 452, /* (487) literal_func ::= noarg_func NK_LP NK_RP */ - 452, /* (488) literal_func ::= NOW */ - 462, /* (489) noarg_func ::= NOW */ - 462, /* (490) noarg_func ::= TODAY */ - 462, /* (491) noarg_func ::= TIMEZONE */ - 462, /* (492) noarg_func ::= DATABASE */ - 462, /* (493) noarg_func ::= CLIENT_VERSION */ - 462, /* (494) noarg_func ::= SERVER_VERSION */ - 462, /* (495) noarg_func ::= SERVER_STATUS */ - 462, /* (496) noarg_func ::= CURRENT_USER */ - 462, /* (497) noarg_func ::= USER */ - 460, /* (498) star_func ::= COUNT */ - 460, /* (499) star_func ::= FIRST */ - 460, /* (500) star_func ::= LAST */ - 460, /* (501) star_func ::= LAST_ROW */ - 461, /* (502) star_func_para_list ::= NK_STAR */ - 461, /* (503) star_func_para_list ::= other_para_list */ - 463, /* (504) other_para_list ::= star_func_para */ - 463, /* (505) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 464, /* (506) star_func_para ::= expr_or_subquery */ - 464, /* (507) star_func_para ::= table_name NK_DOT NK_STAR */ - 459, /* (508) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 459, /* (509) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 465, /* (510) when_then_list ::= when_then_expr */ - 465, /* (511) when_then_list ::= when_then_list when_then_expr */ - 468, /* (512) when_then_expr ::= WHEN common_expression THEN common_expression */ - 466, /* (513) case_when_else_opt ::= */ - 466, /* (514) case_when_else_opt ::= ELSE common_expression */ - 469, /* (515) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 469, /* (516) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 469, /* (517) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 469, /* (518) predicate ::= expr_or_subquery IS NULL */ - 469, /* (519) predicate ::= expr_or_subquery IS NOT NULL */ - 469, /* (520) predicate ::= expr_or_subquery in_op in_predicate_value */ - 470, /* (521) compare_op ::= NK_LT */ - 470, /* (522) compare_op ::= NK_GT */ - 470, /* (523) compare_op ::= NK_LE */ - 470, /* (524) compare_op ::= NK_GE */ - 470, /* (525) compare_op ::= NK_NE */ - 470, /* (526) compare_op ::= NK_EQ */ - 470, /* (527) compare_op ::= LIKE */ - 470, /* (528) compare_op ::= NOT LIKE */ - 470, /* (529) compare_op ::= MATCH */ - 470, /* (530) compare_op ::= NMATCH */ - 470, /* (531) compare_op ::= CONTAINS */ - 471, /* (532) in_op ::= IN */ - 471, /* (533) in_op ::= NOT IN */ - 472, /* (534) in_predicate_value ::= NK_LP literal_list NK_RP */ - 473, /* (535) boolean_value_expression ::= boolean_primary */ - 473, /* (536) boolean_value_expression ::= NOT boolean_primary */ - 473, /* (537) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 473, /* (538) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 474, /* (539) boolean_primary ::= predicate */ - 474, /* (540) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 467, /* (541) common_expression ::= expr_or_subquery */ - 467, /* (542) common_expression ::= boolean_value_expression */ - 475, /* (543) from_clause_opt ::= */ - 475, /* (544) from_clause_opt ::= FROM table_reference_list */ - 476, /* (545) table_reference_list ::= table_reference */ - 476, /* (546) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 477, /* (547) table_reference ::= table_primary */ - 477, /* (548) table_reference ::= joined_table */ - 478, /* (549) table_primary ::= table_name alias_opt */ - 478, /* (550) table_primary ::= db_name NK_DOT table_name alias_opt */ - 478, /* (551) table_primary ::= subquery alias_opt */ - 478, /* (552) table_primary ::= parenthesized_joined_table */ - 480, /* (553) alias_opt ::= */ - 480, /* (554) alias_opt ::= table_alias */ - 480, /* (555) alias_opt ::= AS table_alias */ - 482, /* (556) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 482, /* (557) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 479, /* (558) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 483, /* (559) join_type ::= */ - 483, /* (560) join_type ::= INNER */ - 484, /* (561) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 485, /* (562) hint_list ::= */ - 485, /* (563) hint_list ::= NK_HINT */ - 487, /* (564) tag_mode_opt ::= */ - 487, /* (565) tag_mode_opt ::= TAGS */ - 486, /* (566) set_quantifier_opt ::= */ - 486, /* (567) set_quantifier_opt ::= DISTINCT */ - 486, /* (568) set_quantifier_opt ::= ALL */ - 488, /* (569) select_list ::= select_item */ - 488, /* (570) select_list ::= select_list NK_COMMA select_item */ - 496, /* (571) select_item ::= NK_STAR */ - 496, /* (572) select_item ::= common_expression */ - 496, /* (573) select_item ::= common_expression column_alias */ - 496, /* (574) select_item ::= common_expression AS column_alias */ - 496, /* (575) select_item ::= table_name NK_DOT NK_STAR */ - 432, /* (576) where_clause_opt ::= */ - 432, /* (577) where_clause_opt ::= WHERE search_condition */ - 489, /* (578) partition_by_clause_opt ::= */ - 489, /* (579) partition_by_clause_opt ::= PARTITION BY partition_list */ - 497, /* (580) partition_list ::= partition_item */ - 497, /* (581) partition_list ::= partition_list NK_COMMA partition_item */ - 498, /* (582) partition_item ::= expr_or_subquery */ - 498, /* (583) partition_item ::= expr_or_subquery column_alias */ - 498, /* (584) partition_item ::= expr_or_subquery AS column_alias */ - 493, /* (585) twindow_clause_opt ::= */ - 493, /* (586) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 493, /* (587) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 493, /* (588) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 493, /* (589) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 493, /* (590) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 493, /* (591) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 493, /* (592) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 426, /* (593) sliding_opt ::= */ - 426, /* (594) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 499, /* (595) interval_sliding_duration_literal ::= NK_VARIABLE */ - 499, /* (596) interval_sliding_duration_literal ::= NK_STRING */ - 499, /* (597) interval_sliding_duration_literal ::= NK_INTEGER */ - 492, /* (598) fill_opt ::= */ - 492, /* (599) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 492, /* (600) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 492, /* (601) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 500, /* (602) fill_mode ::= NONE */ - 500, /* (603) fill_mode ::= PREV */ - 500, /* (604) fill_mode ::= NULL */ - 500, /* (605) fill_mode ::= NULL_F */ - 500, /* (606) fill_mode ::= LINEAR */ - 500, /* (607) fill_mode ::= NEXT */ - 494, /* (608) group_by_clause_opt ::= */ - 494, /* (609) group_by_clause_opt ::= GROUP BY group_by_list */ - 501, /* (610) group_by_list ::= expr_or_subquery */ - 501, /* (611) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 495, /* (612) having_clause_opt ::= */ - 495, /* (613) having_clause_opt ::= HAVING search_condition */ - 490, /* (614) range_opt ::= */ - 490, /* (615) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 490, /* (616) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 491, /* (617) every_opt ::= */ - 491, /* (618) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 502, /* (619) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 503, /* (620) query_simple ::= query_specification */ - 503, /* (621) query_simple ::= union_query_expression */ - 507, /* (622) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 507, /* (623) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 508, /* (624) query_simple_or_subquery ::= query_simple */ - 508, /* (625) query_simple_or_subquery ::= subquery */ - 431, /* (626) query_or_subquery ::= query_expression */ - 431, /* (627) query_or_subquery ::= subquery */ - 504, /* (628) order_by_clause_opt ::= */ - 504, /* (629) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 505, /* (630) slimit_clause_opt ::= */ - 505, /* (631) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 505, /* (632) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 505, /* (633) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 506, /* (634) limit_clause_opt ::= */ - 506, /* (635) limit_clause_opt ::= LIMIT NK_INTEGER */ - 506, /* (636) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 506, /* (637) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 481, /* (638) subquery ::= NK_LP query_expression NK_RP */ - 481, /* (639) subquery ::= NK_LP subquery NK_RP */ - 370, /* (640) search_condition ::= common_expression */ - 509, /* (641) sort_specification_list ::= sort_specification */ - 509, /* (642) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 510, /* (643) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 511, /* (644) ordering_specification_opt ::= */ - 511, /* (645) ordering_specification_opt ::= ASC */ - 511, /* (646) ordering_specification_opt ::= DESC */ - 512, /* (647) null_ordering_opt ::= */ - 512, /* (648) null_ordering_opt ::= NULLS FIRST */ - 512, /* (649) null_ordering_opt ::= NULLS LAST */ + 445, /* (375) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 449, /* (376) column_stream_def_list ::= column_stream_def */ + 449, /* (377) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 450, /* (378) column_stream_def ::= column_name */ + 450, /* (379) column_stream_def ::= column_name PRIMARY KEY */ + 446, /* (380) tag_def_or_ref_opt ::= */ + 446, /* (381) tag_def_or_ref_opt ::= tags_def */ + 446, /* (382) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 444, /* (383) stream_options ::= */ + 444, /* (384) stream_options ::= stream_options TRIGGER AT_ONCE */ + 444, /* (385) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 444, /* (386) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 444, /* (387) stream_options ::= stream_options WATERMARK duration_literal */ + 444, /* (388) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 444, /* (389) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 444, /* (390) stream_options ::= stream_options DELETE_MARK duration_literal */ + 444, /* (391) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 447, /* (392) subtable_opt ::= */ + 447, /* (393) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 448, /* (394) ignore_opt ::= */ + 448, /* (395) ignore_opt ::= IGNORE UNTREATED */ + 352, /* (396) cmd ::= KILL CONNECTION NK_INTEGER */ + 352, /* (397) cmd ::= KILL QUERY NK_STRING */ + 352, /* (398) cmd ::= KILL TRANSACTION NK_INTEGER */ + 352, /* (399) cmd ::= KILL COMPACT NK_INTEGER */ + 352, /* (400) cmd ::= BALANCE VGROUP */ + 352, /* (401) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 352, /* (402) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 352, /* (403) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 352, /* (404) cmd ::= SPLIT VGROUP NK_INTEGER */ + 452, /* (405) on_vgroup_id ::= */ + 452, /* (406) on_vgroup_id ::= ON NK_INTEGER */ + 453, /* (407) dnode_list ::= DNODE NK_INTEGER */ + 453, /* (408) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 352, /* (409) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 352, /* (410) cmd ::= query_or_subquery */ + 352, /* (411) cmd ::= insert_query */ + 436, /* (412) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 436, /* (413) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 355, /* (414) literal ::= NK_INTEGER */ + 355, /* (415) literal ::= NK_FLOAT */ + 355, /* (416) literal ::= NK_STRING */ + 355, /* (417) literal ::= NK_BOOL */ + 355, /* (418) literal ::= TIMESTAMP NK_STRING */ + 355, /* (419) literal ::= duration_literal */ + 355, /* (420) literal ::= NULL */ + 355, /* (421) literal ::= NK_QUESTION */ + 408, /* (422) duration_literal ::= NK_VARIABLE */ + 384, /* (423) signed ::= NK_INTEGER */ + 384, /* (424) signed ::= NK_PLUS NK_INTEGER */ + 384, /* (425) signed ::= NK_MINUS NK_INTEGER */ + 384, /* (426) signed ::= NK_FLOAT */ + 384, /* (427) signed ::= NK_PLUS NK_FLOAT */ + 384, /* (428) signed ::= NK_MINUS NK_FLOAT */ + 398, /* (429) signed_literal ::= signed */ + 398, /* (430) signed_literal ::= NK_STRING */ + 398, /* (431) signed_literal ::= NK_BOOL */ + 398, /* (432) signed_literal ::= TIMESTAMP NK_STRING */ + 398, /* (433) signed_literal ::= duration_literal */ + 398, /* (434) signed_literal ::= NULL */ + 398, /* (435) signed_literal ::= literal_func */ + 398, /* (436) signed_literal ::= NK_QUESTION */ + 455, /* (437) literal_list ::= signed_literal */ + 455, /* (438) literal_list ::= literal_list NK_COMMA signed_literal */ + 367, /* (439) db_name ::= NK_ID */ + 368, /* (440) table_name ::= NK_ID */ + 396, /* (441) column_name ::= NK_ID */ + 410, /* (442) function_name ::= NK_ID */ + 442, /* (443) view_name ::= NK_ID */ + 456, /* (444) table_alias ::= NK_ID */ + 421, /* (445) column_alias ::= NK_ID */ + 421, /* (446) column_alias ::= NK_ALIAS */ + 360, /* (447) user_name ::= NK_ID */ + 369, /* (448) topic_name ::= NK_ID */ + 443, /* (449) stream_name ::= NK_ID */ + 433, /* (450) cgroup_name ::= NK_ID */ + 424, /* (451) index_name ::= NK_ID */ + 457, /* (452) expr_or_subquery ::= expression */ + 451, /* (453) expression ::= literal */ + 451, /* (454) expression ::= pseudo_column */ + 451, /* (455) expression ::= column_reference */ + 451, /* (456) expression ::= function_expression */ + 451, /* (457) expression ::= case_when_expression */ + 451, /* (458) expression ::= NK_LP expression NK_RP */ + 451, /* (459) expression ::= NK_PLUS expr_or_subquery */ + 451, /* (460) expression ::= NK_MINUS expr_or_subquery */ + 451, /* (461) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 451, /* (462) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 451, /* (463) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 451, /* (464) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 451, /* (465) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 451, /* (466) expression ::= column_reference NK_ARROW NK_STRING */ + 451, /* (467) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 451, /* (468) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 401, /* (469) expression_list ::= expr_or_subquery */ + 401, /* (470) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 459, /* (471) column_reference ::= column_name */ + 459, /* (472) column_reference ::= table_name NK_DOT column_name */ + 459, /* (473) column_reference ::= NK_ALIAS */ + 459, /* (474) column_reference ::= table_name NK_DOT NK_ALIAS */ + 458, /* (475) pseudo_column ::= ROWTS */ + 458, /* (476) pseudo_column ::= TBNAME */ + 458, /* (477) pseudo_column ::= table_name NK_DOT TBNAME */ + 458, /* (478) pseudo_column ::= QSTART */ + 458, /* (479) pseudo_column ::= QEND */ + 458, /* (480) pseudo_column ::= QDURATION */ + 458, /* (481) pseudo_column ::= WSTART */ + 458, /* (482) pseudo_column ::= WEND */ + 458, /* (483) pseudo_column ::= WDURATION */ + 458, /* (484) pseudo_column ::= IROWTS */ + 458, /* (485) pseudo_column ::= ISFILLED */ + 458, /* (486) pseudo_column ::= QTAGS */ + 460, /* (487) function_expression ::= function_name NK_LP expression_list NK_RP */ + 460, /* (488) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 460, /* (489) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 460, /* (490) function_expression ::= literal_func */ + 454, /* (491) literal_func ::= noarg_func NK_LP NK_RP */ + 454, /* (492) literal_func ::= NOW */ + 464, /* (493) noarg_func ::= NOW */ + 464, /* (494) noarg_func ::= TODAY */ + 464, /* (495) noarg_func ::= TIMEZONE */ + 464, /* (496) noarg_func ::= DATABASE */ + 464, /* (497) noarg_func ::= CLIENT_VERSION */ + 464, /* (498) noarg_func ::= SERVER_VERSION */ + 464, /* (499) noarg_func ::= SERVER_STATUS */ + 464, /* (500) noarg_func ::= CURRENT_USER */ + 464, /* (501) noarg_func ::= USER */ + 462, /* (502) star_func ::= COUNT */ + 462, /* (503) star_func ::= FIRST */ + 462, /* (504) star_func ::= LAST */ + 462, /* (505) star_func ::= LAST_ROW */ + 463, /* (506) star_func_para_list ::= NK_STAR */ + 463, /* (507) star_func_para_list ::= other_para_list */ + 465, /* (508) other_para_list ::= star_func_para */ + 465, /* (509) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 466, /* (510) star_func_para ::= expr_or_subquery */ + 466, /* (511) star_func_para ::= table_name NK_DOT NK_STAR */ + 461, /* (512) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 461, /* (513) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 467, /* (514) when_then_list ::= when_then_expr */ + 467, /* (515) when_then_list ::= when_then_list when_then_expr */ + 470, /* (516) when_then_expr ::= WHEN common_expression THEN common_expression */ + 468, /* (517) case_when_else_opt ::= */ + 468, /* (518) case_when_else_opt ::= ELSE common_expression */ + 471, /* (519) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 471, /* (520) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 471, /* (521) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 471, /* (522) predicate ::= expr_or_subquery IS NULL */ + 471, /* (523) predicate ::= expr_or_subquery IS NOT NULL */ + 471, /* (524) predicate ::= expr_or_subquery in_op in_predicate_value */ + 472, /* (525) compare_op ::= NK_LT */ + 472, /* (526) compare_op ::= NK_GT */ + 472, /* (527) compare_op ::= NK_LE */ + 472, /* (528) compare_op ::= NK_GE */ + 472, /* (529) compare_op ::= NK_NE */ + 472, /* (530) compare_op ::= NK_EQ */ + 472, /* (531) compare_op ::= LIKE */ + 472, /* (532) compare_op ::= NOT LIKE */ + 472, /* (533) compare_op ::= MATCH */ + 472, /* (534) compare_op ::= NMATCH */ + 472, /* (535) compare_op ::= CONTAINS */ + 473, /* (536) in_op ::= IN */ + 473, /* (537) in_op ::= NOT IN */ + 474, /* (538) in_predicate_value ::= NK_LP literal_list NK_RP */ + 475, /* (539) boolean_value_expression ::= boolean_primary */ + 475, /* (540) boolean_value_expression ::= NOT boolean_primary */ + 475, /* (541) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 475, /* (542) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 476, /* (543) boolean_primary ::= predicate */ + 476, /* (544) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 469, /* (545) common_expression ::= expr_or_subquery */ + 469, /* (546) common_expression ::= boolean_value_expression */ + 477, /* (547) from_clause_opt ::= */ + 477, /* (548) from_clause_opt ::= FROM table_reference_list */ + 478, /* (549) table_reference_list ::= table_reference */ + 478, /* (550) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 479, /* (551) table_reference ::= table_primary */ + 479, /* (552) table_reference ::= joined_table */ + 480, /* (553) table_primary ::= table_name alias_opt */ + 480, /* (554) table_primary ::= db_name NK_DOT table_name alias_opt */ + 480, /* (555) table_primary ::= subquery alias_opt */ + 480, /* (556) table_primary ::= parenthesized_joined_table */ + 482, /* (557) alias_opt ::= */ + 482, /* (558) alias_opt ::= table_alias */ + 482, /* (559) alias_opt ::= AS table_alias */ + 484, /* (560) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 484, /* (561) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 481, /* (562) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 485, /* (563) join_type ::= */ + 485, /* (564) join_type ::= INNER */ + 486, /* (565) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 487, /* (566) hint_list ::= */ + 487, /* (567) hint_list ::= NK_HINT */ + 489, /* (568) tag_mode_opt ::= */ + 489, /* (569) tag_mode_opt ::= TAGS */ + 488, /* (570) set_quantifier_opt ::= */ + 488, /* (571) set_quantifier_opt ::= DISTINCT */ + 488, /* (572) set_quantifier_opt ::= ALL */ + 490, /* (573) select_list ::= select_item */ + 490, /* (574) select_list ::= select_list NK_COMMA select_item */ + 498, /* (575) select_item ::= NK_STAR */ + 498, /* (576) select_item ::= common_expression */ + 498, /* (577) select_item ::= common_expression column_alias */ + 498, /* (578) select_item ::= common_expression AS column_alias */ + 498, /* (579) select_item ::= table_name NK_DOT NK_STAR */ + 432, /* (580) where_clause_opt ::= */ + 432, /* (581) where_clause_opt ::= WHERE search_condition */ + 491, /* (582) partition_by_clause_opt ::= */ + 491, /* (583) partition_by_clause_opt ::= PARTITION BY partition_list */ + 499, /* (584) partition_list ::= partition_item */ + 499, /* (585) partition_list ::= partition_list NK_COMMA partition_item */ + 500, /* (586) partition_item ::= expr_or_subquery */ + 500, /* (587) partition_item ::= expr_or_subquery column_alias */ + 500, /* (588) partition_item ::= expr_or_subquery AS column_alias */ + 495, /* (589) twindow_clause_opt ::= */ + 495, /* (590) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 495, /* (591) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 495, /* (592) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 495, /* (593) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 495, /* (594) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 495, /* (595) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 495, /* (596) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 426, /* (597) sliding_opt ::= */ + 426, /* (598) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 501, /* (599) interval_sliding_duration_literal ::= NK_VARIABLE */ + 501, /* (600) interval_sliding_duration_literal ::= NK_STRING */ + 501, /* (601) interval_sliding_duration_literal ::= NK_INTEGER */ + 494, /* (602) fill_opt ::= */ + 494, /* (603) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 494, /* (604) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 494, /* (605) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 502, /* (606) fill_mode ::= NONE */ + 502, /* (607) fill_mode ::= PREV */ + 502, /* (608) fill_mode ::= NULL */ + 502, /* (609) fill_mode ::= NULL_F */ + 502, /* (610) fill_mode ::= LINEAR */ + 502, /* (611) fill_mode ::= NEXT */ + 496, /* (612) group_by_clause_opt ::= */ + 496, /* (613) group_by_clause_opt ::= GROUP BY group_by_list */ + 503, /* (614) group_by_list ::= expr_or_subquery */ + 503, /* (615) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 497, /* (616) having_clause_opt ::= */ + 497, /* (617) having_clause_opt ::= HAVING search_condition */ + 492, /* (618) range_opt ::= */ + 492, /* (619) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 492, /* (620) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 493, /* (621) every_opt ::= */ + 493, /* (622) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 504, /* (623) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 505, /* (624) query_simple ::= query_specification */ + 505, /* (625) query_simple ::= union_query_expression */ + 509, /* (626) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 509, /* (627) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 510, /* (628) query_simple_or_subquery ::= query_simple */ + 510, /* (629) query_simple_or_subquery ::= subquery */ + 431, /* (630) query_or_subquery ::= query_expression */ + 431, /* (631) query_or_subquery ::= subquery */ + 506, /* (632) order_by_clause_opt ::= */ + 506, /* (633) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 507, /* (634) slimit_clause_opt ::= */ + 507, /* (635) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 507, /* (636) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 507, /* (637) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 508, /* (638) limit_clause_opt ::= */ + 508, /* (639) limit_clause_opt ::= LIMIT NK_INTEGER */ + 508, /* (640) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 508, /* (641) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 483, /* (642) subquery ::= NK_LP query_expression NK_RP */ + 483, /* (643) subquery ::= NK_LP subquery NK_RP */ + 370, /* (644) search_condition ::= common_expression */ + 511, /* (645) sort_specification_list ::= sort_specification */ + 511, /* (646) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 512, /* (647) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 513, /* (648) ordering_specification_opt ::= */ + 513, /* (649) ordering_specification_opt ::= ASC */ + 513, /* (650) ordering_specification_opt ::= DESC */ + 514, /* (651) null_ordering_opt ::= */ + 514, /* (652) null_ordering_opt ::= NULLS FIRST */ + 514, /* (653) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4795,281 +4781,285 @@ static const signed char yyRuleInfoNRhs[] = { -4, /* (372) cmd ::= PAUSE STREAM exists_opt stream_name */ -5, /* (373) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ 0, /* (374) col_list_opt ::= */ - -3, /* (375) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (376) tag_def_or_ref_opt ::= */ - -1, /* (377) tag_def_or_ref_opt ::= tags_def */ - -4, /* (378) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (379) stream_options ::= */ - -3, /* (380) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (381) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (382) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (383) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (384) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (385) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (386) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (387) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (388) subtable_opt ::= */ - -4, /* (389) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (390) ignore_opt ::= */ - -2, /* (391) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (392) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (393) cmd ::= KILL QUERY NK_STRING */ - -3, /* (394) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (395) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (396) cmd ::= BALANCE VGROUP */ - -4, /* (397) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -4, /* (398) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (399) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (400) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (401) on_vgroup_id ::= */ - -2, /* (402) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (403) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (404) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (405) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (406) cmd ::= query_or_subquery */ - -1, /* (407) cmd ::= insert_query */ - -7, /* (408) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (409) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (410) literal ::= NK_INTEGER */ - -1, /* (411) literal ::= NK_FLOAT */ - -1, /* (412) literal ::= NK_STRING */ - -1, /* (413) literal ::= NK_BOOL */ - -2, /* (414) literal ::= TIMESTAMP NK_STRING */ - -1, /* (415) literal ::= duration_literal */ - -1, /* (416) literal ::= NULL */ - -1, /* (417) literal ::= NK_QUESTION */ - -1, /* (418) duration_literal ::= NK_VARIABLE */ - -1, /* (419) signed ::= NK_INTEGER */ - -2, /* (420) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (421) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (422) signed ::= NK_FLOAT */ - -2, /* (423) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (424) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (425) signed_literal ::= signed */ - -1, /* (426) signed_literal ::= NK_STRING */ - -1, /* (427) signed_literal ::= NK_BOOL */ - -2, /* (428) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (429) signed_literal ::= duration_literal */ - -1, /* (430) signed_literal ::= NULL */ - -1, /* (431) signed_literal ::= literal_func */ - -1, /* (432) signed_literal ::= NK_QUESTION */ - -1, /* (433) literal_list ::= signed_literal */ - -3, /* (434) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (435) db_name ::= NK_ID */ - -1, /* (436) table_name ::= NK_ID */ - -1, /* (437) column_name ::= NK_ID */ - -1, /* (438) function_name ::= NK_ID */ - -1, /* (439) view_name ::= NK_ID */ - -1, /* (440) table_alias ::= NK_ID */ - -1, /* (441) column_alias ::= NK_ID */ - -1, /* (442) column_alias ::= NK_ALIAS */ - -1, /* (443) user_name ::= NK_ID */ - -1, /* (444) topic_name ::= NK_ID */ - -1, /* (445) stream_name ::= NK_ID */ - -1, /* (446) cgroup_name ::= NK_ID */ - -1, /* (447) index_name ::= NK_ID */ - -1, /* (448) expr_or_subquery ::= expression */ - -1, /* (449) expression ::= literal */ - -1, /* (450) expression ::= pseudo_column */ - -1, /* (451) expression ::= column_reference */ - -1, /* (452) expression ::= function_expression */ - -1, /* (453) expression ::= case_when_expression */ - -3, /* (454) expression ::= NK_LP expression NK_RP */ - -2, /* (455) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (456) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (457) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (458) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (459) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (460) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (461) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (462) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (463) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (464) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (465) expression_list ::= expr_or_subquery */ - -3, /* (466) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (467) column_reference ::= column_name */ - -3, /* (468) column_reference ::= table_name NK_DOT column_name */ - -1, /* (469) column_reference ::= NK_ALIAS */ - -3, /* (470) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (471) pseudo_column ::= ROWTS */ - -1, /* (472) pseudo_column ::= TBNAME */ - -3, /* (473) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (474) pseudo_column ::= QSTART */ - -1, /* (475) pseudo_column ::= QEND */ - -1, /* (476) pseudo_column ::= QDURATION */ - -1, /* (477) pseudo_column ::= WSTART */ - -1, /* (478) pseudo_column ::= WEND */ - -1, /* (479) pseudo_column ::= WDURATION */ - -1, /* (480) pseudo_column ::= IROWTS */ - -1, /* (481) pseudo_column ::= ISFILLED */ - -1, /* (482) pseudo_column ::= QTAGS */ - -4, /* (483) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (484) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (485) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (486) function_expression ::= literal_func */ - -3, /* (487) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (488) literal_func ::= NOW */ - -1, /* (489) noarg_func ::= NOW */ - -1, /* (490) noarg_func ::= TODAY */ - -1, /* (491) noarg_func ::= TIMEZONE */ - -1, /* (492) noarg_func ::= DATABASE */ - -1, /* (493) noarg_func ::= CLIENT_VERSION */ - -1, /* (494) noarg_func ::= SERVER_VERSION */ - -1, /* (495) noarg_func ::= SERVER_STATUS */ - -1, /* (496) noarg_func ::= CURRENT_USER */ - -1, /* (497) noarg_func ::= USER */ - -1, /* (498) star_func ::= COUNT */ - -1, /* (499) star_func ::= FIRST */ - -1, /* (500) star_func ::= LAST */ - -1, /* (501) star_func ::= LAST_ROW */ - -1, /* (502) star_func_para_list ::= NK_STAR */ - -1, /* (503) star_func_para_list ::= other_para_list */ - -1, /* (504) other_para_list ::= star_func_para */ - -3, /* (505) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (506) star_func_para ::= expr_or_subquery */ - -3, /* (507) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (508) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (509) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (510) when_then_list ::= when_then_expr */ - -2, /* (511) when_then_list ::= when_then_list when_then_expr */ - -4, /* (512) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (513) case_when_else_opt ::= */ - -2, /* (514) case_when_else_opt ::= ELSE common_expression */ - -3, /* (515) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (516) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (517) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (518) predicate ::= expr_or_subquery IS NULL */ - -4, /* (519) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (520) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (521) compare_op ::= NK_LT */ - -1, /* (522) compare_op ::= NK_GT */ - -1, /* (523) compare_op ::= NK_LE */ - -1, /* (524) compare_op ::= NK_GE */ - -1, /* (525) compare_op ::= NK_NE */ - -1, /* (526) compare_op ::= NK_EQ */ - -1, /* (527) compare_op ::= LIKE */ - -2, /* (528) compare_op ::= NOT LIKE */ - -1, /* (529) compare_op ::= MATCH */ - -1, /* (530) compare_op ::= NMATCH */ - -1, /* (531) compare_op ::= CONTAINS */ - -1, /* (532) in_op ::= IN */ - -2, /* (533) in_op ::= NOT IN */ - -3, /* (534) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (535) boolean_value_expression ::= boolean_primary */ - -2, /* (536) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (537) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (538) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (539) boolean_primary ::= predicate */ - -3, /* (540) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (541) common_expression ::= expr_or_subquery */ - -1, /* (542) common_expression ::= boolean_value_expression */ - 0, /* (543) from_clause_opt ::= */ - -2, /* (544) from_clause_opt ::= FROM table_reference_list */ - -1, /* (545) table_reference_list ::= table_reference */ - -3, /* (546) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (547) table_reference ::= table_primary */ - -1, /* (548) table_reference ::= joined_table */ - -2, /* (549) table_primary ::= table_name alias_opt */ - -4, /* (550) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (551) table_primary ::= subquery alias_opt */ - -1, /* (552) table_primary ::= parenthesized_joined_table */ - 0, /* (553) alias_opt ::= */ - -1, /* (554) alias_opt ::= table_alias */ - -2, /* (555) alias_opt ::= AS table_alias */ - -3, /* (556) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (557) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (558) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (559) join_type ::= */ - -1, /* (560) join_type ::= INNER */ - -14, /* (561) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 0, /* (562) hint_list ::= */ - -1, /* (563) hint_list ::= NK_HINT */ - 0, /* (564) tag_mode_opt ::= */ - -1, /* (565) tag_mode_opt ::= TAGS */ - 0, /* (566) set_quantifier_opt ::= */ - -1, /* (567) set_quantifier_opt ::= DISTINCT */ - -1, /* (568) set_quantifier_opt ::= ALL */ - -1, /* (569) select_list ::= select_item */ - -3, /* (570) select_list ::= select_list NK_COMMA select_item */ - -1, /* (571) select_item ::= NK_STAR */ - -1, /* (572) select_item ::= common_expression */ - -2, /* (573) select_item ::= common_expression column_alias */ - -3, /* (574) select_item ::= common_expression AS column_alias */ - -3, /* (575) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (576) where_clause_opt ::= */ - -2, /* (577) where_clause_opt ::= WHERE search_condition */ - 0, /* (578) partition_by_clause_opt ::= */ - -3, /* (579) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (580) partition_list ::= partition_item */ - -3, /* (581) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (582) partition_item ::= expr_or_subquery */ - -2, /* (583) partition_item ::= expr_or_subquery column_alias */ - -3, /* (584) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (585) twindow_clause_opt ::= */ - -6, /* (586) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (587) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (588) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (589) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (590) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (591) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (592) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (593) sliding_opt ::= */ - -4, /* (594) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (595) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (596) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (597) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (598) fill_opt ::= */ - -4, /* (599) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (600) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (601) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (602) fill_mode ::= NONE */ - -1, /* (603) fill_mode ::= PREV */ - -1, /* (604) fill_mode ::= NULL */ - -1, /* (605) fill_mode ::= NULL_F */ - -1, /* (606) fill_mode ::= LINEAR */ - -1, /* (607) fill_mode ::= NEXT */ - 0, /* (608) group_by_clause_opt ::= */ - -3, /* (609) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (610) group_by_list ::= expr_or_subquery */ - -3, /* (611) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (612) having_clause_opt ::= */ - -2, /* (613) having_clause_opt ::= HAVING search_condition */ - 0, /* (614) range_opt ::= */ - -6, /* (615) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (616) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (617) every_opt ::= */ - -4, /* (618) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (619) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (620) query_simple ::= query_specification */ - -1, /* (621) query_simple ::= union_query_expression */ - -4, /* (622) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (623) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (624) query_simple_or_subquery ::= query_simple */ - -1, /* (625) query_simple_or_subquery ::= subquery */ - -1, /* (626) query_or_subquery ::= query_expression */ - -1, /* (627) query_or_subquery ::= subquery */ - 0, /* (628) order_by_clause_opt ::= */ - -3, /* (629) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (630) slimit_clause_opt ::= */ - -2, /* (631) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (632) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (633) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (634) limit_clause_opt ::= */ - -2, /* (635) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (636) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (637) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (638) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (639) subquery ::= NK_LP subquery NK_RP */ - -1, /* (640) search_condition ::= common_expression */ - -1, /* (641) sort_specification_list ::= sort_specification */ - -3, /* (642) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (643) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (644) ordering_specification_opt ::= */ - -1, /* (645) ordering_specification_opt ::= ASC */ - -1, /* (646) ordering_specification_opt ::= DESC */ - 0, /* (647) null_ordering_opt ::= */ - -2, /* (648) null_ordering_opt ::= NULLS FIRST */ - -2, /* (649) null_ordering_opt ::= NULLS LAST */ + -3, /* (375) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + -1, /* (376) column_stream_def_list ::= column_stream_def */ + -3, /* (377) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + -1, /* (378) column_stream_def ::= column_name */ + -3, /* (379) column_stream_def ::= column_name PRIMARY KEY */ + 0, /* (380) tag_def_or_ref_opt ::= */ + -1, /* (381) tag_def_or_ref_opt ::= tags_def */ + -4, /* (382) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 0, /* (383) stream_options ::= */ + -3, /* (384) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (385) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (386) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (387) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (388) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (389) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (390) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (391) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (392) subtable_opt ::= */ + -4, /* (393) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (394) ignore_opt ::= */ + -2, /* (395) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (396) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (397) cmd ::= KILL QUERY NK_STRING */ + -3, /* (398) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (399) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (400) cmd ::= BALANCE VGROUP */ + -4, /* (401) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -4, /* (402) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (403) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (404) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (405) on_vgroup_id ::= */ + -2, /* (406) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (407) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (408) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (409) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (410) cmd ::= query_or_subquery */ + -1, /* (411) cmd ::= insert_query */ + -7, /* (412) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (413) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (414) literal ::= NK_INTEGER */ + -1, /* (415) literal ::= NK_FLOAT */ + -1, /* (416) literal ::= NK_STRING */ + -1, /* (417) literal ::= NK_BOOL */ + -2, /* (418) literal ::= TIMESTAMP NK_STRING */ + -1, /* (419) literal ::= duration_literal */ + -1, /* (420) literal ::= NULL */ + -1, /* (421) literal ::= NK_QUESTION */ + -1, /* (422) duration_literal ::= NK_VARIABLE */ + -1, /* (423) signed ::= NK_INTEGER */ + -2, /* (424) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (425) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (426) signed ::= NK_FLOAT */ + -2, /* (427) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (428) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (429) signed_literal ::= signed */ + -1, /* (430) signed_literal ::= NK_STRING */ + -1, /* (431) signed_literal ::= NK_BOOL */ + -2, /* (432) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (433) signed_literal ::= duration_literal */ + -1, /* (434) signed_literal ::= NULL */ + -1, /* (435) signed_literal ::= literal_func */ + -1, /* (436) signed_literal ::= NK_QUESTION */ + -1, /* (437) literal_list ::= signed_literal */ + -3, /* (438) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (439) db_name ::= NK_ID */ + -1, /* (440) table_name ::= NK_ID */ + -1, /* (441) column_name ::= NK_ID */ + -1, /* (442) function_name ::= NK_ID */ + -1, /* (443) view_name ::= NK_ID */ + -1, /* (444) table_alias ::= NK_ID */ + -1, /* (445) column_alias ::= NK_ID */ + -1, /* (446) column_alias ::= NK_ALIAS */ + -1, /* (447) user_name ::= NK_ID */ + -1, /* (448) topic_name ::= NK_ID */ + -1, /* (449) stream_name ::= NK_ID */ + -1, /* (450) cgroup_name ::= NK_ID */ + -1, /* (451) index_name ::= NK_ID */ + -1, /* (452) expr_or_subquery ::= expression */ + -1, /* (453) expression ::= literal */ + -1, /* (454) expression ::= pseudo_column */ + -1, /* (455) expression ::= column_reference */ + -1, /* (456) expression ::= function_expression */ + -1, /* (457) expression ::= case_when_expression */ + -3, /* (458) expression ::= NK_LP expression NK_RP */ + -2, /* (459) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (460) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (461) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (462) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (463) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (464) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (465) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (466) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (467) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (468) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (469) expression_list ::= expr_or_subquery */ + -3, /* (470) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (471) column_reference ::= column_name */ + -3, /* (472) column_reference ::= table_name NK_DOT column_name */ + -1, /* (473) column_reference ::= NK_ALIAS */ + -3, /* (474) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (475) pseudo_column ::= ROWTS */ + -1, /* (476) pseudo_column ::= TBNAME */ + -3, /* (477) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (478) pseudo_column ::= QSTART */ + -1, /* (479) pseudo_column ::= QEND */ + -1, /* (480) pseudo_column ::= QDURATION */ + -1, /* (481) pseudo_column ::= WSTART */ + -1, /* (482) pseudo_column ::= WEND */ + -1, /* (483) pseudo_column ::= WDURATION */ + -1, /* (484) pseudo_column ::= IROWTS */ + -1, /* (485) pseudo_column ::= ISFILLED */ + -1, /* (486) pseudo_column ::= QTAGS */ + -4, /* (487) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (488) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (489) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (490) function_expression ::= literal_func */ + -3, /* (491) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (492) literal_func ::= NOW */ + -1, /* (493) noarg_func ::= NOW */ + -1, /* (494) noarg_func ::= TODAY */ + -1, /* (495) noarg_func ::= TIMEZONE */ + -1, /* (496) noarg_func ::= DATABASE */ + -1, /* (497) noarg_func ::= CLIENT_VERSION */ + -1, /* (498) noarg_func ::= SERVER_VERSION */ + -1, /* (499) noarg_func ::= SERVER_STATUS */ + -1, /* (500) noarg_func ::= CURRENT_USER */ + -1, /* (501) noarg_func ::= USER */ + -1, /* (502) star_func ::= COUNT */ + -1, /* (503) star_func ::= FIRST */ + -1, /* (504) star_func ::= LAST */ + -1, /* (505) star_func ::= LAST_ROW */ + -1, /* (506) star_func_para_list ::= NK_STAR */ + -1, /* (507) star_func_para_list ::= other_para_list */ + -1, /* (508) other_para_list ::= star_func_para */ + -3, /* (509) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (510) star_func_para ::= expr_or_subquery */ + -3, /* (511) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (512) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (513) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (514) when_then_list ::= when_then_expr */ + -2, /* (515) when_then_list ::= when_then_list when_then_expr */ + -4, /* (516) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (517) case_when_else_opt ::= */ + -2, /* (518) case_when_else_opt ::= ELSE common_expression */ + -3, /* (519) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (520) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (521) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (522) predicate ::= expr_or_subquery IS NULL */ + -4, /* (523) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (524) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (525) compare_op ::= NK_LT */ + -1, /* (526) compare_op ::= NK_GT */ + -1, /* (527) compare_op ::= NK_LE */ + -1, /* (528) compare_op ::= NK_GE */ + -1, /* (529) compare_op ::= NK_NE */ + -1, /* (530) compare_op ::= NK_EQ */ + -1, /* (531) compare_op ::= LIKE */ + -2, /* (532) compare_op ::= NOT LIKE */ + -1, /* (533) compare_op ::= MATCH */ + -1, /* (534) compare_op ::= NMATCH */ + -1, /* (535) compare_op ::= CONTAINS */ + -1, /* (536) in_op ::= IN */ + -2, /* (537) in_op ::= NOT IN */ + -3, /* (538) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (539) boolean_value_expression ::= boolean_primary */ + -2, /* (540) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (541) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (542) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (543) boolean_primary ::= predicate */ + -3, /* (544) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (545) common_expression ::= expr_or_subquery */ + -1, /* (546) common_expression ::= boolean_value_expression */ + 0, /* (547) from_clause_opt ::= */ + -2, /* (548) from_clause_opt ::= FROM table_reference_list */ + -1, /* (549) table_reference_list ::= table_reference */ + -3, /* (550) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (551) table_reference ::= table_primary */ + -1, /* (552) table_reference ::= joined_table */ + -2, /* (553) table_primary ::= table_name alias_opt */ + -4, /* (554) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (555) table_primary ::= subquery alias_opt */ + -1, /* (556) table_primary ::= parenthesized_joined_table */ + 0, /* (557) alias_opt ::= */ + -1, /* (558) alias_opt ::= table_alias */ + -2, /* (559) alias_opt ::= AS table_alias */ + -3, /* (560) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (561) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (562) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (563) join_type ::= */ + -1, /* (564) join_type ::= INNER */ + -14, /* (565) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (566) hint_list ::= */ + -1, /* (567) hint_list ::= NK_HINT */ + 0, /* (568) tag_mode_opt ::= */ + -1, /* (569) tag_mode_opt ::= TAGS */ + 0, /* (570) set_quantifier_opt ::= */ + -1, /* (571) set_quantifier_opt ::= DISTINCT */ + -1, /* (572) set_quantifier_opt ::= ALL */ + -1, /* (573) select_list ::= select_item */ + -3, /* (574) select_list ::= select_list NK_COMMA select_item */ + -1, /* (575) select_item ::= NK_STAR */ + -1, /* (576) select_item ::= common_expression */ + -2, /* (577) select_item ::= common_expression column_alias */ + -3, /* (578) select_item ::= common_expression AS column_alias */ + -3, /* (579) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (580) where_clause_opt ::= */ + -2, /* (581) where_clause_opt ::= WHERE search_condition */ + 0, /* (582) partition_by_clause_opt ::= */ + -3, /* (583) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (584) partition_list ::= partition_item */ + -3, /* (585) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (586) partition_item ::= expr_or_subquery */ + -2, /* (587) partition_item ::= expr_or_subquery column_alias */ + -3, /* (588) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (589) twindow_clause_opt ::= */ + -6, /* (590) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (591) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (592) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (593) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (594) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + -4, /* (595) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + -6, /* (596) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (597) sliding_opt ::= */ + -4, /* (598) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (599) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (600) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (601) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (602) fill_opt ::= */ + -4, /* (603) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (604) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (605) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (606) fill_mode ::= NONE */ + -1, /* (607) fill_mode ::= PREV */ + -1, /* (608) fill_mode ::= NULL */ + -1, /* (609) fill_mode ::= NULL_F */ + -1, /* (610) fill_mode ::= LINEAR */ + -1, /* (611) fill_mode ::= NEXT */ + 0, /* (612) group_by_clause_opt ::= */ + -3, /* (613) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (614) group_by_list ::= expr_or_subquery */ + -3, /* (615) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (616) having_clause_opt ::= */ + -2, /* (617) having_clause_opt ::= HAVING search_condition */ + 0, /* (618) range_opt ::= */ + -6, /* (619) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (620) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (621) every_opt ::= */ + -4, /* (622) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (623) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (624) query_simple ::= query_specification */ + -1, /* (625) query_simple ::= union_query_expression */ + -4, /* (626) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (627) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (628) query_simple_or_subquery ::= query_simple */ + -1, /* (629) query_simple_or_subquery ::= subquery */ + -1, /* (630) query_or_subquery ::= query_expression */ + -1, /* (631) query_or_subquery ::= subquery */ + 0, /* (632) order_by_clause_opt ::= */ + -3, /* (633) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (634) slimit_clause_opt ::= */ + -2, /* (635) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (636) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (637) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (638) limit_clause_opt ::= */ + -2, /* (639) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (640) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (641) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (642) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (643) subquery ::= NK_LP subquery NK_RP */ + -1, /* (644) search_condition ::= common_expression */ + -1, /* (645) sort_specification_list ::= sort_specification */ + -3, /* (646) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (647) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (648) ordering_specification_opt ::= */ + -1, /* (649) ordering_specification_opt ::= ASC */ + -1, /* (650) ordering_specification_opt ::= DESC */ + 0, /* (651) null_ordering_opt ::= */ + -2, /* (652) null_ordering_opt ::= NULLS FIRST */ + -2, /* (653) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -5112,21 +5102,15 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ -#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5117 "sql.c" yy_destructor(yypParser,353,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ -#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5123 "sql.c" yy_destructor(yypParser,354,&yymsp[0].minor); break; case 2: /* account_options ::= */ -#line 55 "sql.y" { } -#line 5129 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5138,24 +5122,18 @@ static YYACTIONTYPE yy_reduce( case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); { yy_destructor(yypParser,353,&yymsp[-2].minor); -#line 56 "sql.y" { } -#line 5143 "sql.c" yy_destructor(yypParser,355,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ { yy_destructor(yypParser,356,&yymsp[0].minor); -#line 68 "sql.y" { } -#line 5151 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,354,&yymsp[-1].minor); -#line 69 "sql.y" { } -#line 5158 "sql.c" yy_destructor(yypParser,356,&yymsp[0].minor); } break; @@ -5169,252 +5147,170 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); -#line 73 "sql.y" { } -#line 5174 "sql.c" yy_destructor(yypParser,355,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -#line 86 "sql.y" -{ yylhsminor.yy388 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5180 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; +{ yylhsminor.yy264 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -#line 87 "sql.y" -{ yylhsminor.yy388 = addNodeToList(pCxt, yymsp[-2].minor.yy388, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5186 "sql.c" - yymsp[-2].minor.yy388 = yylhsminor.yy388; +{ yylhsminor.yy264 = addNodeToList(pCxt, yymsp[-2].minor.yy264, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy264 = yylhsminor.yy264; break; case 26: /* white_list ::= HOST ip_range_list */ -#line 91 "sql.y" -{ yymsp[-1].minor.yy388 = yymsp[0].minor.yy388; } -#line 5192 "sql.c" +{ yymsp[-1].minor.yy264 = yymsp[0].minor.yy264; } break; case 27: /* white_list_opt ::= */ case 188: /* specific_cols_opt ::= */ yytestcase(yyruleno==188); case 220: /* tags_def_opt ::= */ yytestcase(yyruleno==220); case 308: /* tag_list_opt ::= */ yytestcase(yyruleno==308); case 374: /* col_list_opt ::= */ yytestcase(yyruleno==374); - case 376: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==376); - case 578: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==578); - case 608: /* group_by_clause_opt ::= */ yytestcase(yyruleno==608); - case 628: /* order_by_clause_opt ::= */ yytestcase(yyruleno==628); -#line 95 "sql.y" -{ yymsp[1].minor.yy388 = NULL; } -#line 5205 "sql.c" + case 380: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==380); + case 582: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==582); + case 612: /* group_by_clause_opt ::= */ yytestcase(yyruleno==612); + case 632: /* order_by_clause_opt ::= */ yytestcase(yyruleno==632); +{ yymsp[1].minor.yy264 = NULL; } break; case 28: /* white_list_opt ::= white_list */ case 221: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==221); - case 377: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==377); - case 503: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==503); -#line 96 "sql.y" -{ yylhsminor.yy388 = yymsp[0].minor.yy388; } -#line 5213 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 381: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==381); + case 507: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==507); +{ yylhsminor.yy264 = yymsp[0].minor.yy264; } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ -#line 100 "sql.y" { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy965, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy125); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy388); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy879, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy983); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy264); } -#line 5222 "sql.c" break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -#line 104 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy965, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 5227 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy879, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -#line 105 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy965, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 5232 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy879, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -#line 106 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy965, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 5237 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy879, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ -#line 107 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy965, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy388); } -#line 5242 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy879, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy264); } break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ -#line 108 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy965, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy388); } -#line 5247 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy879, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy264); } break; case 35: /* cmd ::= DROP USER user_name */ -#line 109 "sql.y" -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy965); } -#line 5252 "sql.c" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy879); } break; case 36: /* sysinfo_opt ::= */ -#line 113 "sql.y" -{ yymsp[1].minor.yy125 = 1; } -#line 5257 "sql.c" +{ yymsp[1].minor.yy983 = 1; } break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -#line 114 "sql.y" -{ yymsp[-1].minor.yy125 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5262 "sql.c" +{ yymsp[-1].minor.yy983 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -#line 117 "sql.y" -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy207, &yymsp[-3].minor.yy453, &yymsp[0].minor.yy965, yymsp[-2].minor.yy560); } -#line 5267 "sql.c" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy89, &yymsp[-3].minor.yy357, &yymsp[0].minor.yy879, yymsp[-2].minor.yy752); } break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -#line 118 "sql.y" -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy207, &yymsp[-3].minor.yy453, &yymsp[0].minor.yy965, yymsp[-2].minor.yy560); } -#line 5272 "sql.c" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy89, &yymsp[-3].minor.yy357, &yymsp[0].minor.yy879, yymsp[-2].minor.yy752); } break; case 40: /* privileges ::= ALL */ -#line 122 "sql.y" -{ yymsp[0].minor.yy207 = PRIVILEGE_TYPE_ALL; } -#line 5277 "sql.c" +{ yymsp[0].minor.yy89 = PRIVILEGE_TYPE_ALL; } break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); -#line 123 "sql.y" -{ yylhsminor.yy207 = yymsp[0].minor.yy207; } -#line 5283 "sql.c" - yymsp[0].minor.yy207 = yylhsminor.yy207; +{ yylhsminor.yy89 = yymsp[0].minor.yy89; } + yymsp[0].minor.yy89 = yylhsminor.yy89; break; case 42: /* privileges ::= SUBSCRIBE */ -#line 124 "sql.y" -{ yymsp[0].minor.yy207 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5289 "sql.c" +{ yymsp[0].minor.yy89 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -#line 129 "sql.y" -{ yylhsminor.yy207 = yymsp[-2].minor.yy207 | yymsp[0].minor.yy207; } -#line 5294 "sql.c" - yymsp[-2].minor.yy207 = yylhsminor.yy207; +{ yylhsminor.yy89 = yymsp[-2].minor.yy89 | yymsp[0].minor.yy89; } + yymsp[-2].minor.yy89 = yylhsminor.yy89; break; case 45: /* priv_type ::= READ */ -#line 133 "sql.y" -{ yymsp[0].minor.yy207 = PRIVILEGE_TYPE_READ; } -#line 5300 "sql.c" +{ yymsp[0].minor.yy89 = PRIVILEGE_TYPE_READ; } break; case 46: /* priv_type ::= WRITE */ -#line 134 "sql.y" -{ yymsp[0].minor.yy207 = PRIVILEGE_TYPE_WRITE; } -#line 5305 "sql.c" +{ yymsp[0].minor.yy89 = PRIVILEGE_TYPE_WRITE; } break; case 47: /* priv_type ::= ALTER */ -#line 135 "sql.y" -{ yymsp[0].minor.yy207 = PRIVILEGE_TYPE_ALTER; } -#line 5310 "sql.c" +{ yymsp[0].minor.yy89 = PRIVILEGE_TYPE_ALTER; } break; case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -#line 139 "sql.y" -{ yylhsminor.yy453.first = yymsp[-2].minor.yy0; yylhsminor.yy453.second = yymsp[0].minor.yy0; } -#line 5315 "sql.c" - yymsp[-2].minor.yy453 = yylhsminor.yy453; +{ yylhsminor.yy357.first = yymsp[-2].minor.yy0; yylhsminor.yy357.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy357 = yylhsminor.yy357; break; case 49: /* priv_level ::= db_name NK_DOT NK_STAR */ -#line 140 "sql.y" -{ yylhsminor.yy453.first = yymsp[-2].minor.yy965; yylhsminor.yy453.second = yymsp[0].minor.yy0; } -#line 5321 "sql.c" - yymsp[-2].minor.yy453 = yylhsminor.yy453; +{ yylhsminor.yy357.first = yymsp[-2].minor.yy879; yylhsminor.yy357.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy357 = yylhsminor.yy357; break; case 50: /* priv_level ::= db_name NK_DOT table_name */ -#line 141 "sql.y" -{ yylhsminor.yy453.first = yymsp[-2].minor.yy965; yylhsminor.yy453.second = yymsp[0].minor.yy965; } -#line 5327 "sql.c" - yymsp[-2].minor.yy453 = yylhsminor.yy453; +{ yylhsminor.yy357.first = yymsp[-2].minor.yy879; yylhsminor.yy357.second = yymsp[0].minor.yy879; } + yymsp[-2].minor.yy357 = yylhsminor.yy357; break; case 51: /* priv_level ::= topic_name */ -#line 142 "sql.y" -{ yylhsminor.yy453.first = yymsp[0].minor.yy965; yylhsminor.yy453.second = nil_token; } -#line 5333 "sql.c" - yymsp[0].minor.yy453 = yylhsminor.yy453; +{ yylhsminor.yy357.first = yymsp[0].minor.yy879; yylhsminor.yy357.second = nil_token; } + yymsp[0].minor.yy357 = yylhsminor.yy357; break; case 52: /* with_opt ::= */ case 157: /* start_opt ::= */ yytestcase(yyruleno==157); case 161: /* end_opt ::= */ yytestcase(yyruleno==161); case 303: /* like_pattern_opt ::= */ yytestcase(yyruleno==303); - case 388: /* subtable_opt ::= */ yytestcase(yyruleno==388); - case 513: /* case_when_else_opt ::= */ yytestcase(yyruleno==513); - case 543: /* from_clause_opt ::= */ yytestcase(yyruleno==543); - case 576: /* where_clause_opt ::= */ yytestcase(yyruleno==576); - case 585: /* twindow_clause_opt ::= */ yytestcase(yyruleno==585); - case 593: /* sliding_opt ::= */ yytestcase(yyruleno==593); - case 598: /* fill_opt ::= */ yytestcase(yyruleno==598); - case 612: /* having_clause_opt ::= */ yytestcase(yyruleno==612); - case 614: /* range_opt ::= */ yytestcase(yyruleno==614); - case 617: /* every_opt ::= */ yytestcase(yyruleno==617); - case 630: /* slimit_clause_opt ::= */ yytestcase(yyruleno==630); - case 634: /* limit_clause_opt ::= */ yytestcase(yyruleno==634); -#line 144 "sql.y" -{ yymsp[1].minor.yy560 = NULL; } -#line 5354 "sql.c" + case 392: /* subtable_opt ::= */ yytestcase(yyruleno==392); + case 517: /* case_when_else_opt ::= */ yytestcase(yyruleno==517); + case 547: /* from_clause_opt ::= */ yytestcase(yyruleno==547); + case 580: /* where_clause_opt ::= */ yytestcase(yyruleno==580); + case 589: /* twindow_clause_opt ::= */ yytestcase(yyruleno==589); + case 597: /* sliding_opt ::= */ yytestcase(yyruleno==597); + case 602: /* fill_opt ::= */ yytestcase(yyruleno==602); + case 616: /* having_clause_opt ::= */ yytestcase(yyruleno==616); + case 618: /* range_opt ::= */ yytestcase(yyruleno==618); + case 621: /* every_opt ::= */ yytestcase(yyruleno==621); + case 634: /* slimit_clause_opt ::= */ yytestcase(yyruleno==634); + case 638: /* limit_clause_opt ::= */ yytestcase(yyruleno==638); +{ yymsp[1].minor.yy752 = NULL; } break; case 53: /* with_opt ::= WITH search_condition */ - case 544: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==544); - case 577: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==577); - case 613: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==613); -#line 145 "sql.y" -{ yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; } -#line 5362 "sql.c" + case 548: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==548); + case 581: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==581); + case 617: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==617); +{ yymsp[-1].minor.yy752 = yymsp[0].minor.yy752; } break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint */ -#line 148 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy965, NULL); } -#line 5367 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy879, NULL); } break; case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -#line 149 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0); } -#line 5372 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy0); } break; case 56: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -#line 150 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy983, false); } -#line 5377 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy547, false); } break; case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -#line 151 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy965, yymsp[0].minor.yy983, false); } -#line 5382 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy879, yymsp[0].minor.yy547, false); } break; case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -#line 152 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy983); } -#line 5387 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy547); } break; case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -#line 153 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy965, false, yymsp[0].minor.yy983); } -#line 5392 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy879, false, yymsp[0].minor.yy547); } break; case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ -#line 154 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 5397 "sql.c" break; case 61: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ -#line 155 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5402 "sql.c" break; case 62: /* cmd ::= ALTER ALL DNODES NK_STRING */ -#line 156 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 5407 "sql.c" break; case 63: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ -#line 157 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5412 "sql.c" break; case 64: /* cmd ::= RESTORE DNODE NK_INTEGER */ -#line 158 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 5417 "sql.c" break; case 65: /* dnode_endpoint ::= NK_STRING */ case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66); @@ -5423,36 +5319,34 @@ static YYACTIONTYPE yy_reduce( case 331: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==331); case 332: /* sma_func_name ::= LAST */ yytestcase(yyruleno==332); case 333: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==333); - case 435: /* db_name ::= NK_ID */ yytestcase(yyruleno==435); - case 436: /* table_name ::= NK_ID */ yytestcase(yyruleno==436); - case 437: /* column_name ::= NK_ID */ yytestcase(yyruleno==437); - case 438: /* function_name ::= NK_ID */ yytestcase(yyruleno==438); - case 439: /* view_name ::= NK_ID */ yytestcase(yyruleno==439); - case 440: /* table_alias ::= NK_ID */ yytestcase(yyruleno==440); - case 441: /* column_alias ::= NK_ID */ yytestcase(yyruleno==441); - case 442: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==442); - case 443: /* user_name ::= NK_ID */ yytestcase(yyruleno==443); - case 444: /* topic_name ::= NK_ID */ yytestcase(yyruleno==444); - case 445: /* stream_name ::= NK_ID */ yytestcase(yyruleno==445); - case 446: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==446); - case 447: /* index_name ::= NK_ID */ yytestcase(yyruleno==447); - case 489: /* noarg_func ::= NOW */ yytestcase(yyruleno==489); - case 490: /* noarg_func ::= TODAY */ yytestcase(yyruleno==490); - case 491: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==491); - case 492: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==492); - case 493: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==493); - case 494: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==494); - case 495: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==495); - case 496: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==496); - case 497: /* noarg_func ::= USER */ yytestcase(yyruleno==497); - case 498: /* star_func ::= COUNT */ yytestcase(yyruleno==498); - case 499: /* star_func ::= FIRST */ yytestcase(yyruleno==499); - case 500: /* star_func ::= LAST */ yytestcase(yyruleno==500); - case 501: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==501); -#line 162 "sql.y" -{ yylhsminor.yy965 = yymsp[0].minor.yy0; } -#line 5454 "sql.c" - yymsp[0].minor.yy965 = yylhsminor.yy965; + case 439: /* db_name ::= NK_ID */ yytestcase(yyruleno==439); + case 440: /* table_name ::= NK_ID */ yytestcase(yyruleno==440); + case 441: /* column_name ::= NK_ID */ yytestcase(yyruleno==441); + case 442: /* function_name ::= NK_ID */ yytestcase(yyruleno==442); + case 443: /* view_name ::= NK_ID */ yytestcase(yyruleno==443); + case 444: /* table_alias ::= NK_ID */ yytestcase(yyruleno==444); + case 445: /* column_alias ::= NK_ID */ yytestcase(yyruleno==445); + case 446: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==446); + case 447: /* user_name ::= NK_ID */ yytestcase(yyruleno==447); + case 448: /* topic_name ::= NK_ID */ yytestcase(yyruleno==448); + case 449: /* stream_name ::= NK_ID */ yytestcase(yyruleno==449); + case 450: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==450); + case 451: /* index_name ::= NK_ID */ yytestcase(yyruleno==451); + case 493: /* noarg_func ::= NOW */ yytestcase(yyruleno==493); + case 494: /* noarg_func ::= TODAY */ yytestcase(yyruleno==494); + case 495: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==495); + case 496: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==496); + case 497: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==497); + case 498: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==498); + case 499: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==499); + case 500: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==500); + case 501: /* noarg_func ::= USER */ yytestcase(yyruleno==501); + case 502: /* star_func ::= COUNT */ yytestcase(yyruleno==502); + case 503: /* star_func ::= FIRST */ yytestcase(yyruleno==503); + case 504: /* star_func ::= LAST */ yytestcase(yyruleno==504); + case 505: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==505); +{ yylhsminor.yy879 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy879 = yylhsminor.yy879; break; case 68: /* force_opt ::= */ case 94: /* not_exists_opt ::= */ yytestcase(yyruleno==94); @@ -5460,454 +5354,300 @@ static YYACTIONTYPE yy_reduce( case 351: /* analyze_opt ::= */ yytestcase(yyruleno==351); case 358: /* agg_func_opt ::= */ yytestcase(yyruleno==358); case 364: /* or_replace_opt ::= */ yytestcase(yyruleno==364); - case 390: /* ignore_opt ::= */ yytestcase(yyruleno==390); - case 564: /* tag_mode_opt ::= */ yytestcase(yyruleno==564); - case 566: /* set_quantifier_opt ::= */ yytestcase(yyruleno==566); -#line 168 "sql.y" -{ yymsp[1].minor.yy983 = false; } -#line 5468 "sql.c" + case 394: /* ignore_opt ::= */ yytestcase(yyruleno==394); + case 568: /* tag_mode_opt ::= */ yytestcase(yyruleno==568); + case 570: /* set_quantifier_opt ::= */ yytestcase(yyruleno==570); +{ yymsp[1].minor.yy547 = false; } break; case 69: /* force_opt ::= FORCE */ case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70); case 352: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==352); case 359: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==359); - case 565: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==565); - case 567: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==567); -#line 169 "sql.y" -{ yymsp[0].minor.yy983 = true; } -#line 5478 "sql.c" + case 569: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==569); + case 571: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==571); +{ yymsp[0].minor.yy547 = true; } break; case 71: /* cmd ::= ALTER CLUSTER NK_STRING */ -#line 176 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5483 "sql.c" break; case 72: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ -#line 177 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5488 "sql.c" break; case 73: /* cmd ::= ALTER LOCAL NK_STRING */ -#line 180 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5493 "sql.c" break; case 74: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ -#line 181 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5498 "sql.c" break; case 75: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ -#line 184 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5503 "sql.c" break; case 76: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ -#line 185 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5508 "sql.c" break; case 77: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ -#line 186 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5513 "sql.c" break; case 78: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ -#line 189 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5518 "sql.c" break; case 79: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ -#line 190 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5523 "sql.c" break; case 80: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ -#line 193 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5528 "sql.c" break; case 81: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ -#line 194 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5533 "sql.c" break; case 82: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ -#line 197 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5538 "sql.c" break; case 83: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ -#line 198 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5543 "sql.c" break; case 84: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ -#line 199 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5548 "sql.c" break; case 85: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ -#line 202 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 5553 "sql.c" break; case 86: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -#line 205 "sql.y" -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy983, &yymsp[-1].minor.yy965, yymsp[0].minor.yy560); } -#line 5558 "sql.c" +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy547, &yymsp[-1].minor.yy879, yymsp[0].minor.yy752); } break; case 87: /* cmd ::= DROP DATABASE exists_opt db_name */ -#line 206 "sql.y" -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy965); } -#line 5563 "sql.c" +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy547, &yymsp[0].minor.yy879); } break; case 88: /* cmd ::= USE db_name */ -#line 207 "sql.y" -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy965); } -#line 5568 "sql.c" +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy879); } break; case 89: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -#line 208 "sql.y" -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy965, yymsp[0].minor.yy560); } -#line 5573 "sql.c" +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy879, yymsp[0].minor.yy752); } break; case 90: /* cmd ::= FLUSH DATABASE db_name */ -#line 209 "sql.y" -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy965); } -#line 5578 "sql.c" +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy879); } break; case 91: /* cmd ::= TRIM DATABASE db_name speed_opt */ -#line 210 "sql.y" -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy965, yymsp[0].minor.yy424); } -#line 5583 "sql.c" +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy879, yymsp[0].minor.yy10); } break; case 92: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -#line 211 "sql.y" -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy965, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 5588 "sql.c" +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy879, yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } break; case 93: /* not_exists_opt ::= IF NOT EXISTS */ -#line 215 "sql.y" -{ yymsp[-2].minor.yy983 = true; } -#line 5593 "sql.c" +{ yymsp[-2].minor.yy547 = true; } break; case 95: /* exists_opt ::= IF EXISTS */ case 365: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==365); - case 391: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==391); -#line 220 "sql.y" -{ yymsp[-1].minor.yy983 = true; } -#line 5600 "sql.c" + case 395: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==395); +{ yymsp[-1].minor.yy547 = true; } break; case 97: /* db_options ::= */ -#line 223 "sql.y" -{ yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); } -#line 5605 "sql.c" +{ yymsp[1].minor.yy752 = createDefaultDatabaseOptions(pCxt); } break; case 98: /* db_options ::= db_options BUFFER NK_INTEGER */ -#line 224 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 5610 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 99: /* db_options ::= db_options CACHEMODEL NK_STRING */ -#line 225 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 5616 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 100: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -#line 226 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 5622 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 101: /* db_options ::= db_options COMP NK_INTEGER */ -#line 227 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 5628 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 102: /* db_options ::= db_options DURATION NK_INTEGER */ case 103: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==103); -#line 228 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 5635 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 104: /* db_options ::= db_options MAXROWS NK_INTEGER */ -#line 230 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 5641 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 105: /* db_options ::= db_options MINROWS NK_INTEGER */ -#line 231 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 5647 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 106: /* db_options ::= db_options KEEP integer_list */ case 107: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==107); -#line 232 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy388); } -#line 5654 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_KEEP, yymsp[0].minor.yy264); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 108: /* db_options ::= db_options PAGES NK_INTEGER */ -#line 234 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 5660 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 109: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -#line 235 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5666 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 110: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -#line 236 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5672 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 111: /* db_options ::= db_options PRECISION NK_STRING */ -#line 237 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 5678 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 112: /* db_options ::= db_options REPLICA NK_INTEGER */ -#line 238 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 5684 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 113: /* db_options ::= db_options VGROUPS NK_INTEGER */ -#line 240 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 5690 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 114: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -#line 241 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 5696 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 115: /* db_options ::= db_options RETENTIONS retention_list */ -#line 242 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy388); } -#line 5702 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_RETENTIONS, yymsp[0].minor.yy264); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 116: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -#line 243 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 5708 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 117: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -#line 244 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 5714 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 118: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -#line 245 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 5720 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 119: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -#line 246 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 5726 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 120: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 247 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-3].minor.yy752, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 5736 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; case 121: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -#line 252 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 5742 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 122: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 253 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-3].minor.yy752, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 5752 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; case 123: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -#line 258 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 5758 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 124: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -#line 259 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 5764 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 125: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -#line 260 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 5770 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 126: /* db_options ::= db_options TABLE_PREFIX signed */ -#line 261 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy560); } -#line 5776 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy752); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 127: /* db_options ::= db_options TABLE_SUFFIX signed */ -#line 262 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy560); } -#line 5782 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy752); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 128: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -#line 263 "sql.y" -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } -#line 5788 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setDatabaseOption(pCxt, yymsp[-2].minor.yy752, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 129: /* alter_db_options ::= alter_db_option */ -#line 265 "sql.y" -{ yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy443); } -#line 5794 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterDatabaseOptions(pCxt); yylhsminor.yy752 = setAlterDatabaseOption(pCxt, yylhsminor.yy752, &yymsp[0].minor.yy935); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 130: /* alter_db_options ::= alter_db_options alter_db_option */ -#line 266 "sql.y" -{ yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy443); } -#line 5800 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy752, &yymsp[0].minor.yy935); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; case 131: /* alter_db_option ::= BUFFER NK_INTEGER */ -#line 270 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5806 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 132: /* alter_db_option ::= CACHEMODEL NK_STRING */ -#line 271 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5811 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 133: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -#line 272 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5816 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 134: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -#line 273 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5821 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 135: /* alter_db_option ::= KEEP integer_list */ case 136: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==136); -#line 274 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_KEEP; yymsp[-1].minor.yy443.pList = yymsp[0].minor.yy388; } -#line 5827 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_KEEP; yymsp[-1].minor.yy935.pList = yymsp[0].minor.yy264; } break; case 137: /* alter_db_option ::= PAGES NK_INTEGER */ -#line 276 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_PAGES; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5832 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_PAGES; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 138: /* alter_db_option ::= REPLICA NK_INTEGER */ -#line 277 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5837 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 139: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -#line 279 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_WAL; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5842 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_WAL; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 140: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -#line 280 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5847 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 141: /* alter_db_option ::= MINROWS NK_INTEGER */ -#line 281 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5852 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 142: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -#line 282 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5857 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 143: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 283 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy443.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy443.val = t; + yymsp[-2].minor.yy935.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy935.val = t; } -#line 5866 "sql.c" break; case 144: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -#line 288 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5871 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 145: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 289 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy443.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy443.val = t; + yymsp[-2].minor.yy935.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy935.val = t; } -#line 5880 "sql.c" break; case 146: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -#line 294 "sql.y" -{ yymsp[-1].minor.yy443.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 5885 "sql.c" +{ yymsp[-1].minor.yy935.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 147: /* integer_list ::= NK_INTEGER */ -#line 298 "sql.y" -{ yylhsminor.yy388 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5890 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; +{ yylhsminor.yy264 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; case 148: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 404: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==404); -#line 299 "sql.y" -{ yylhsminor.yy388 = addNodeToList(pCxt, yymsp[-2].minor.yy388, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5897 "sql.c" - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 408: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==408); +{ yylhsminor.yy264 = addNodeToList(pCxt, yymsp[-2].minor.yy264, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy264 = yylhsminor.yy264; break; case 149: /* variable_list ::= NK_VARIABLE */ -#line 303 "sql.y" -{ yylhsminor.yy388 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5903 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; +{ yylhsminor.yy264 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; case 150: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -#line 304 "sql.y" -{ yylhsminor.yy388 = addNodeToList(pCxt, yymsp[-2].minor.yy388, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5909 "sql.c" - yymsp[-2].minor.yy388 = yylhsminor.yy388; +{ yylhsminor.yy264 = addNodeToList(pCxt, yymsp[-2].minor.yy264, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy264 = yylhsminor.yy264; break; case 151: /* retention_list ::= retention */ case 182: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==182); @@ -5917,16 +5657,15 @@ static YYACTIONTYPE yy_reduce( case 242: /* col_name_list ::= col_name */ yytestcase(yyruleno==242); case 309: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==309); case 326: /* func_list ::= func */ yytestcase(yyruleno==326); - case 433: /* literal_list ::= signed_literal */ yytestcase(yyruleno==433); - case 504: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==504); - case 510: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==510); - case 569: /* select_list ::= select_item */ yytestcase(yyruleno==569); - case 580: /* partition_list ::= partition_item */ yytestcase(yyruleno==580); - case 641: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==641); -#line 308 "sql.y" -{ yylhsminor.yy388 = createNodeList(pCxt, yymsp[0].minor.yy560); } -#line 5928 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 376: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==376); + case 437: /* literal_list ::= signed_literal */ yytestcase(yyruleno==437); + case 508: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==508); + case 514: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==514); + case 573: /* select_list ::= select_item */ yytestcase(yyruleno==573); + case 584: /* partition_list ::= partition_item */ yytestcase(yyruleno==584); + case 645: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==645); +{ yylhsminor.yy264 = createNodeList(pCxt, yymsp[0].minor.yy752); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; case 152: /* retention_list ::= retention_list NK_COMMA retention */ case 186: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==186); @@ -5935,1908 +5674,1279 @@ static YYACTIONTYPE yy_reduce( case 243: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==243); case 310: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==310); case 327: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==327); - case 434: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==434); - case 505: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==505); - case 570: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==570); - case 581: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==581); - case 642: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==642); -#line 309 "sql.y" -{ yylhsminor.yy388 = addNodeToList(pCxt, yymsp[-2].minor.yy388, yymsp[0].minor.yy560); } -#line 5945 "sql.c" - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 377: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==377); + case 438: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==438); + case 509: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==509); + case 574: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==574); + case 585: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==585); + case 646: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==646); +{ yylhsminor.yy264 = addNodeToList(pCxt, yymsp[-2].minor.yy264, yymsp[0].minor.yy752); } + yymsp[-2].minor.yy264 = yylhsminor.yy264; break; case 153: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 154: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==154); -#line 311 "sql.y" -{ yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5952 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 155: /* speed_opt ::= */ case 360: /* bufsize_opt ::= */ yytestcase(yyruleno==360); -#line 316 "sql.y" -{ yymsp[1].minor.yy424 = 0; } -#line 5959 "sql.c" +{ yymsp[1].minor.yy10 = 0; } break; case 156: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 361: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==361); -#line 317 "sql.y" -{ yymsp[-1].minor.yy424 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5965 "sql.c" +{ yymsp[-1].minor.yy10 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 158: /* start_opt ::= START WITH NK_INTEGER */ case 162: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==162); -#line 320 "sql.y" -{ yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 5971 "sql.c" +{ yymsp[-2].minor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 159: /* start_opt ::= START WITH NK_STRING */ case 163: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==163); -#line 321 "sql.y" -{ yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5977 "sql.c" +{ yymsp[-2].minor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 160: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 164: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==164); -#line 322 "sql.y" -{ yymsp[-3].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5983 "sql.c" +{ yymsp[-3].minor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 165: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 167: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==167); -#line 331 "sql.y" -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy983, yymsp[-5].minor.yy560, yymsp[-3].minor.yy388, yymsp[-1].minor.yy388, yymsp[0].minor.yy560); } -#line 5989 "sql.c" +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy547, yymsp[-5].minor.yy752, yymsp[-3].minor.yy264, yymsp[-1].minor.yy264, yymsp[0].minor.yy752); } break; case 166: /* cmd ::= CREATE TABLE multi_create_clause */ -#line 332 "sql.y" -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy388); } -#line 5994 "sql.c" +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy264); } break; case 168: /* cmd ::= DROP TABLE multi_drop_clause */ -#line 335 "sql.y" -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy388); } -#line 5999 "sql.c" +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy264); } break; case 169: /* cmd ::= DROP STABLE exists_opt full_table_name */ -#line 336 "sql.y" -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy560); } -#line 6004 "sql.c" +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy547, yymsp[0].minor.yy752); } break; case 170: /* cmd ::= ALTER TABLE alter_table_clause */ - case 406: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==406); - case 407: /* cmd ::= insert_query */ yytestcase(yyruleno==407); -#line 338 "sql.y" -{ pCxt->pRootNode = yymsp[0].minor.yy560; } -#line 6011 "sql.c" + case 410: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==410); + case 411: /* cmd ::= insert_query */ yytestcase(yyruleno==411); +{ pCxt->pRootNode = yymsp[0].minor.yy752; } break; case 171: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 339 "sql.y" -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); } -#line 6016 "sql.c" +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy752); } break; case 172: /* alter_table_clause ::= full_table_name alter_table_options */ -#line 341 "sql.y" -{ yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 6021 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; case 173: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -#line 343 "sql.y" -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy965, yymsp[0].minor.yy412); } -#line 6027 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy752, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy879, yymsp[0].minor.yy624); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 174: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 344 "sql.y" -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy965); } -#line 6033 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy752, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy879); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; case 175: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -#line 346 "sql.y" -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy965, yymsp[0].minor.yy412); } -#line 6039 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy752, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy879, yymsp[0].minor.yy624); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 176: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -#line 348 "sql.y" -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 6045 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy752, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy879, &yymsp[0].minor.yy879); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 177: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -#line 350 "sql.y" -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy965, yymsp[0].minor.yy412); } -#line 6051 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy752, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy879, yymsp[0].minor.yy624); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 178: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 351 "sql.y" -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy965); } -#line 6057 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy752, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy879); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; case 179: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -#line 353 "sql.y" -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy965, yymsp[0].minor.yy412); } -#line 6063 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy752, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy879, yymsp[0].minor.yy624); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 180: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -#line 355 "sql.y" -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 6069 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy752, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy879, &yymsp[0].minor.yy879); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 181: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -#line 357 "sql.y" -{ yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy965, yymsp[0].minor.yy560); } -#line 6075 "sql.c" - yymsp[-5].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy752, &yymsp[-2].minor.yy879, yymsp[0].minor.yy752); } + yymsp[-5].minor.yy752 = yylhsminor.yy752; break; case 183: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 511: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==511); -#line 362 "sql.y" -{ yylhsminor.yy388 = addNodeToList(pCxt, yymsp[-1].minor.yy388, yymsp[0].minor.yy560); } -#line 6082 "sql.c" - yymsp[-1].minor.yy388 = yylhsminor.yy388; + case 515: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==515); +{ yylhsminor.yy264 = addNodeToList(pCxt, yymsp[-1].minor.yy264, yymsp[0].minor.yy752); } + yymsp[-1].minor.yy264 = yylhsminor.yy264; break; case 184: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -#line 366 "sql.y" -{ yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy983, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy388, yymsp[-2].minor.yy388, yymsp[0].minor.yy560); } -#line 6088 "sql.c" - yymsp[-9].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy547, yymsp[-8].minor.yy752, yymsp[-6].minor.yy752, yymsp[-5].minor.yy264, yymsp[-2].minor.yy264, yymsp[0].minor.yy752); } + yymsp[-9].minor.yy752 = yylhsminor.yy752; break; case 187: /* drop_table_clause ::= exists_opt full_table_name */ -#line 373 "sql.y" -{ yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy560); } -#line 6094 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createDropTableClause(pCxt, yymsp[-1].minor.yy547, yymsp[0].minor.yy752); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; case 189: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 375: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==375); -#line 378 "sql.y" -{ yymsp[-2].minor.yy388 = yymsp[-1].minor.yy388; } -#line 6101 "sql.c" + case 375: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==375); +{ yymsp[-2].minor.yy264 = yymsp[-1].minor.yy264; } break; case 190: /* full_table_name ::= table_name */ -#line 380 "sql.y" -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy965, NULL); } -#line 6106 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy879, NULL); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 191: /* full_table_name ::= db_name NK_DOT table_name */ -#line 381 "sql.y" -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965, NULL); } -#line 6112 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createRealTableNode(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy879, NULL); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 194: /* column_def ::= column_name type_name */ -#line 388 "sql.y" -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy965, yymsp[0].minor.yy412, NULL, false); } -#line 6118 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy879, yymsp[0].minor.yy624, NULL, false); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; case 195: /* column_def ::= column_name type_name PRIMARY KEY */ -#line 389 "sql.y" -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy965, yymsp[-2].minor.yy412, NULL, true); } -#line 6124 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy879, yymsp[-2].minor.yy624, NULL, true); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; case 196: /* type_name ::= BOOL */ -#line 394 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 6130 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 197: /* type_name ::= TINYINT */ -#line 395 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 6135 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 198: /* type_name ::= SMALLINT */ -#line 396 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 6140 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 199: /* type_name ::= INT */ case 200: /* type_name ::= INTEGER */ yytestcase(yyruleno==200); -#line 397 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_INT); } -#line 6146 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_INT); } break; case 201: /* type_name ::= BIGINT */ -#line 399 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 6151 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 202: /* type_name ::= FLOAT */ -#line 400 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 6156 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 203: /* type_name ::= DOUBLE */ -#line 401 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 6161 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 204: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 402 "sql.y" -{ yymsp[-3].minor.yy412 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 6166 "sql.c" +{ yymsp[-3].minor.yy624 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 205: /* type_name ::= TIMESTAMP */ -#line 403 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 6171 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 206: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 404 "sql.y" -{ yymsp[-3].minor.yy412 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 6176 "sql.c" +{ yymsp[-3].minor.yy624 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 207: /* type_name ::= TINYINT UNSIGNED */ -#line 405 "sql.y" -{ yymsp[-1].minor.yy412 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 6181 "sql.c" +{ yymsp[-1].minor.yy624 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 208: /* type_name ::= SMALLINT UNSIGNED */ -#line 406 "sql.y" -{ yymsp[-1].minor.yy412 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 6186 "sql.c" +{ yymsp[-1].minor.yy624 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 209: /* type_name ::= INT UNSIGNED */ -#line 407 "sql.y" -{ yymsp[-1].minor.yy412 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 6191 "sql.c" +{ yymsp[-1].minor.yy624 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 210: /* type_name ::= BIGINT UNSIGNED */ -#line 408 "sql.y" -{ yymsp[-1].minor.yy412 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 6196 "sql.c" +{ yymsp[-1].minor.yy624 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 211: /* type_name ::= JSON */ -#line 409 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 6201 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 212: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 410 "sql.y" -{ yymsp[-3].minor.yy412 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 6206 "sql.c" +{ yymsp[-3].minor.yy624 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 213: /* type_name ::= MEDIUMBLOB */ -#line 411 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 6211 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 214: /* type_name ::= BLOB */ -#line 412 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 6216 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 215: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 413 "sql.y" -{ yymsp[-3].minor.yy412 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 6221 "sql.c" +{ yymsp[-3].minor.yy624 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 216: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -#line 414 "sql.y" -{ yymsp[-3].minor.yy412 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 6226 "sql.c" +{ yymsp[-3].minor.yy624 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; case 217: /* type_name ::= DECIMAL */ -#line 415 "sql.y" -{ yymsp[0].minor.yy412 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6231 "sql.c" +{ yymsp[0].minor.yy624 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 218: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 416 "sql.y" -{ yymsp[-3].minor.yy412 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6236 "sql.c" +{ yymsp[-3].minor.yy624 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 219: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 417 "sql.y" -{ yymsp[-5].minor.yy412 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6241 "sql.c" +{ yymsp[-5].minor.yy624 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 222: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 378: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==378); -#line 426 "sql.y" -{ yymsp[-3].minor.yy388 = yymsp[-1].minor.yy388; } -#line 6247 "sql.c" + case 382: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==382); +{ yymsp[-3].minor.yy264 = yymsp[-1].minor.yy264; } break; case 223: /* table_options ::= */ -#line 428 "sql.y" -{ yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); } -#line 6252 "sql.c" +{ yymsp[1].minor.yy752 = createDefaultTableOptions(pCxt); } break; case 224: /* table_options ::= table_options COMMENT NK_STRING */ -#line 429 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 6257 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-2].minor.yy752, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 225: /* table_options ::= table_options MAX_DELAY duration_list */ -#line 430 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy388); } -#line 6263 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-2].minor.yy752, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy264); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 226: /* table_options ::= table_options WATERMARK duration_list */ -#line 431 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy388); } -#line 6269 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-2].minor.yy752, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy264); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 227: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -#line 432 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy388); } -#line 6275 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-4].minor.yy752, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy264); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 228: /* table_options ::= table_options TTL NK_INTEGER */ -#line 433 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 6281 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-2].minor.yy752, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 229: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 434 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy388); } -#line 6287 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-4].minor.yy752, TABLE_OPTION_SMA, yymsp[-1].minor.yy264); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; case 230: /* table_options ::= table_options DELETE_MARK duration_list */ -#line 435 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy388); } -#line 6293 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-2].minor.yy752, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy264); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 231: /* alter_table_options ::= alter_table_option */ -#line 437 "sql.y" -{ yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy443.type, &yymsp[0].minor.yy443.val); } -#line 6299 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createAlterTableOptions(pCxt); yylhsminor.yy752 = setTableOption(pCxt, yylhsminor.yy752, yymsp[0].minor.yy935.type, &yymsp[0].minor.yy935.val); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 232: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 438 "sql.y" -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy443.type, &yymsp[0].minor.yy443.val); } -#line 6305 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setTableOption(pCxt, yymsp[-1].minor.yy752, yymsp[0].minor.yy935.type, &yymsp[0].minor.yy935.val); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; case 233: /* alter_table_option ::= COMMENT NK_STRING */ -#line 442 "sql.y" -{ yymsp[-1].minor.yy443.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 6311 "sql.c" +{ yymsp[-1].minor.yy935.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 234: /* alter_table_option ::= TTL NK_INTEGER */ -#line 443 "sql.y" -{ yymsp[-1].minor.yy443.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy443.val = yymsp[0].minor.yy0; } -#line 6316 "sql.c" +{ yymsp[-1].minor.yy935.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy935.val = yymsp[0].minor.yy0; } break; case 235: /* duration_list ::= duration_literal */ - case 465: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==465); -#line 447 "sql.y" -{ yylhsminor.yy388 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } -#line 6322 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 469: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==469); +{ yylhsminor.yy264 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy752)); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; case 236: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 466: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==466); -#line 448 "sql.y" -{ yylhsminor.yy388 = addNodeToList(pCxt, yymsp[-2].minor.yy388, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } -#line 6329 "sql.c" - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 470: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==470); +{ yylhsminor.yy264 = addNodeToList(pCxt, yymsp[-2].minor.yy264, releaseRawExprNode(pCxt, yymsp[0].minor.yy752)); } + yymsp[-2].minor.yy264 = yylhsminor.yy264; break; case 239: /* rollup_func_name ::= function_name */ -#line 455 "sql.y" -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy965, NULL); } -#line 6335 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createFunctionNode(pCxt, &yymsp[0].minor.yy879, NULL); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 240: /* rollup_func_name ::= FIRST */ case 241: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==241); case 312: /* tag_item ::= QTAGS */ yytestcase(yyruleno==312); -#line 456 "sql.y" -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6343 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 244: /* col_name ::= column_name */ case 313: /* tag_item ::= column_name */ yytestcase(yyruleno==313); -#line 464 "sql.y" -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy965); } -#line 6350 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy879); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 245: /* cmd ::= SHOW DNODES */ -#line 467 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6356 "sql.c" break; case 246: /* cmd ::= SHOW USERS */ -#line 468 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6361 "sql.c" break; case 247: /* cmd ::= SHOW USER PRIVILEGES */ -#line 469 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6366 "sql.c" break; case 248: /* cmd ::= SHOW db_kind_opt DATABASES */ -#line 470 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy591); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy319); } -#line 6374 "sql.c" break; case 249: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -#line 474 "sql.y" { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy385, yymsp[0].minor.yy560, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy147, yymsp[0].minor.yy752, OP_TYPE_LIKE); } -#line 6381 "sql.c" break; case 250: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 477 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } -#line 6386 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy752, yymsp[0].minor.yy752, OP_TYPE_LIKE); } break; case 251: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 478 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); } -#line 6391 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy752, NULL, OP_TYPE_LIKE); } break; case 252: /* cmd ::= SHOW MNODES */ -#line 479 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 6396 "sql.c" break; case 253: /* cmd ::= SHOW QNODES */ -#line 481 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 6401 "sql.c" break; case 254: /* cmd ::= SHOW FUNCTIONS */ -#line 482 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 6406 "sql.c" break; case 255: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 483 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } -#line 6411 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy752, yymsp[-1].minor.yy752, OP_TYPE_EQUAL); } break; case 256: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -#line 484 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy965), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy965), OP_TYPE_EQUAL); } -#line 6416 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy879), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy879), OP_TYPE_EQUAL); } break; case 257: /* cmd ::= SHOW STREAMS */ -#line 485 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 6421 "sql.c" break; case 258: /* cmd ::= SHOW ACCOUNTS */ -#line 486 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6426 "sql.c" break; case 259: /* cmd ::= SHOW APPS */ -#line 487 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 6431 "sql.c" break; case 260: /* cmd ::= SHOW CONNECTIONS */ -#line 488 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 6436 "sql.c" break; case 261: /* cmd ::= SHOW LICENCES */ case 262: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==262); -#line 489 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 6442 "sql.c" break; case 263: /* cmd ::= SHOW GRANTS FULL */ -#line 491 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } -#line 6447 "sql.c" break; case 264: /* cmd ::= SHOW GRANTS LOGS */ -#line 492 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } -#line 6452 "sql.c" break; case 265: /* cmd ::= SHOW CLUSTER MACHINES */ -#line 493 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } -#line 6457 "sql.c" break; case 266: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 494 "sql.y" -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy965); } -#line 6462 "sql.c" +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy879); } break; case 267: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 495 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); } -#line 6467 "sql.c" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy752); } break; case 268: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 496 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy560); } -#line 6472 "sql.c" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy752); } break; case 269: /* cmd ::= SHOW QUERIES */ -#line 497 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 6477 "sql.c" break; case 270: /* cmd ::= SHOW SCORES */ -#line 498 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 6482 "sql.c" break; case 271: /* cmd ::= SHOW TOPICS */ -#line 499 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 6487 "sql.c" break; case 272: /* cmd ::= SHOW VARIABLES */ case 273: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==273); -#line 500 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 6493 "sql.c" break; case 274: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 502 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 6498 "sql.c" break; case 275: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 503 "sql.y" -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy560); } -#line 6503 "sql.c" +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy752); } break; case 276: /* cmd ::= SHOW BNODES */ -#line 504 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 6508 "sql.c" break; case 277: /* cmd ::= SHOW SNODES */ -#line 505 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 6513 "sql.c" break; case 278: /* cmd ::= SHOW CLUSTER */ -#line 506 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 6518 "sql.c" break; case 279: /* cmd ::= SHOW TRANSACTIONS */ -#line 507 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 6523 "sql.c" break; case 280: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 508 "sql.y" -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); } -#line 6528 "sql.c" +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy752); } break; case 281: /* cmd ::= SHOW CONSUMERS */ -#line 509 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 6533 "sql.c" break; case 282: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 510 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 6538 "sql.c" break; case 283: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 511 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } -#line 6543 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy752, yymsp[-1].minor.yy752, OP_TYPE_EQUAL); } break; case 284: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -#line 512 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy965), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy965), OP_TYPE_EQUAL); } -#line 6548 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy879), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy879), OP_TYPE_EQUAL); } break; case 285: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 513 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560, yymsp[-3].minor.yy388); } -#line 6553 "sql.c" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy752, yymsp[0].minor.yy752, yymsp[-3].minor.yy264); } break; case 286: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -#line 514 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy965), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy965), yymsp[-4].minor.yy388); } -#line 6558 "sql.c" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy879), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy879), yymsp[-4].minor.yy264); } break; case 287: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -#line 515 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 6563 "sql.c" break; case 288: /* cmd ::= SHOW VNODES */ -#line 516 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 6568 "sql.c" break; case 289: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 518 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy560, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 6573 "sql.c" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy752, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; case 290: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 519 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 6578 "sql.c" break; case 291: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -#line 520 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } -#line 6583 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy752, yymsp[0].minor.yy752, OP_TYPE_LIKE); } break; case 292: /* cmd ::= SHOW CREATE VIEW full_table_name */ -#line 521 "sql.y" -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy560); } -#line 6588 "sql.c" +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy752); } break; case 293: /* cmd ::= SHOW COMPACTS */ -#line 522 "sql.y" { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } -#line 6593 "sql.c" break; case 294: /* cmd ::= SHOW COMPACT NK_INTEGER */ -#line 523 "sql.y" { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6598 "sql.c" break; case 295: /* table_kind_db_name_cond_opt ::= */ -#line 527 "sql.y" -{ yymsp[1].minor.yy385.kind = SHOW_KIND_ALL; yymsp[1].minor.yy385.dbName = nil_token; } -#line 6603 "sql.c" +{ yymsp[1].minor.yy147.kind = SHOW_KIND_ALL; yymsp[1].minor.yy147.dbName = nil_token; } break; case 296: /* table_kind_db_name_cond_opt ::= table_kind */ -#line 528 "sql.y" -{ yylhsminor.yy385.kind = yymsp[0].minor.yy591; yylhsminor.yy385.dbName = nil_token; } -#line 6608 "sql.c" - yymsp[0].minor.yy385 = yylhsminor.yy385; +{ yylhsminor.yy147.kind = yymsp[0].minor.yy319; yylhsminor.yy147.dbName = nil_token; } + yymsp[0].minor.yy147 = yylhsminor.yy147; break; case 297: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -#line 529 "sql.y" -{ yylhsminor.yy385.kind = SHOW_KIND_ALL; yylhsminor.yy385.dbName = yymsp[-1].minor.yy965; } -#line 6614 "sql.c" - yymsp[-1].minor.yy385 = yylhsminor.yy385; +{ yylhsminor.yy147.kind = SHOW_KIND_ALL; yylhsminor.yy147.dbName = yymsp[-1].minor.yy879; } + yymsp[-1].minor.yy147 = yylhsminor.yy147; break; case 298: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -#line 530 "sql.y" -{ yylhsminor.yy385.kind = yymsp[-2].minor.yy591; yylhsminor.yy385.dbName = yymsp[-1].minor.yy965; } -#line 6620 "sql.c" - yymsp[-2].minor.yy385 = yylhsminor.yy385; +{ yylhsminor.yy147.kind = yymsp[-2].minor.yy319; yylhsminor.yy147.dbName = yymsp[-1].minor.yy879; } + yymsp[-2].minor.yy147 = yylhsminor.yy147; break; case 299: /* table_kind ::= NORMAL */ -#line 534 "sql.y" -{ yymsp[0].minor.yy591 = SHOW_KIND_TABLES_NORMAL; } -#line 6626 "sql.c" +{ yymsp[0].minor.yy319 = SHOW_KIND_TABLES_NORMAL; } break; case 300: /* table_kind ::= CHILD */ -#line 535 "sql.y" -{ yymsp[0].minor.yy591 = SHOW_KIND_TABLES_CHILD; } -#line 6631 "sql.c" +{ yymsp[0].minor.yy319 = SHOW_KIND_TABLES_CHILD; } break; case 301: /* db_name_cond_opt ::= */ case 306: /* from_db_opt ::= */ yytestcase(yyruleno==306); -#line 537 "sql.y" -{ yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); } -#line 6637 "sql.c" +{ yymsp[1].minor.yy752 = createDefaultDatabaseCondValue(pCxt); } break; case 302: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 538 "sql.y" -{ yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy965); } -#line 6642 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy879); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; case 304: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 541 "sql.y" -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 6648 "sql.c" +{ yymsp[-1].minor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 305: /* table_name_cond ::= table_name */ -#line 543 "sql.y" -{ yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy965); } -#line 6653 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy879); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 307: /* from_db_opt ::= FROM db_name */ -#line 546 "sql.y" -{ yymsp[-1].minor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy965); } -#line 6659 "sql.c" +{ yymsp[-1].minor.yy752 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy879); } break; case 311: /* tag_item ::= TBNAME */ -#line 554 "sql.y" -{ yylhsminor.yy560 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 6664 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 314: /* tag_item ::= column_name column_alias */ -#line 557 "sql.y" -{ yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy965), &yymsp[0].minor.yy965); } -#line 6670 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy879), &yymsp[0].minor.yy879); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; case 315: /* tag_item ::= column_name AS column_alias */ -#line 558 "sql.y" -{ yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy965), &yymsp[0].minor.yy965); } -#line 6676 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy879), &yymsp[0].minor.yy879); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 316: /* db_kind_opt ::= */ -#line 562 "sql.y" -{ yymsp[1].minor.yy591 = SHOW_KIND_ALL; } -#line 6682 "sql.c" +{ yymsp[1].minor.yy319 = SHOW_KIND_ALL; } break; case 317: /* db_kind_opt ::= USER */ -#line 563 "sql.y" -{ yymsp[0].minor.yy591 = SHOW_KIND_DATABASES_USER; } -#line 6687 "sql.c" +{ yymsp[0].minor.yy319 = SHOW_KIND_DATABASES_USER; } break; case 318: /* db_kind_opt ::= SYSTEM */ -#line 564 "sql.y" -{ yymsp[0].minor.yy591 = SHOW_KIND_DATABASES_SYSTEM; } -#line 6692 "sql.c" +{ yymsp[0].minor.yy319 = SHOW_KIND_DATABASES_SYSTEM; } break; case 319: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -#line 568 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy983, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } -#line 6697 "sql.c" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy547, yymsp[-3].minor.yy752, yymsp[-1].minor.yy752, NULL, yymsp[0].minor.yy752); } break; case 320: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 570 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy983, yymsp[-5].minor.yy560, yymsp[-3].minor.yy560, yymsp[-1].minor.yy388, NULL); } -#line 6702 "sql.c" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy547, yymsp[-5].minor.yy752, yymsp[-3].minor.yy752, yymsp[-1].minor.yy264, NULL); } break; case 321: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 571 "sql.y" -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy560); } -#line 6707 "sql.c" +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy547, yymsp[0].minor.yy752); } break; case 322: /* full_index_name ::= index_name */ -#line 573 "sql.y" -{ yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy965); } -#line 6712 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy879); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 323: /* full_index_name ::= db_name NK_DOT index_name */ -#line 574 "sql.y" -{ yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965); } -#line 6718 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy879); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 324: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 577 "sql.y" -{ yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy388, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 6724 "sql.c" +{ yymsp[-9].minor.yy752 = createIndexOption(pCxt, yymsp[-7].minor.yy264, releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), NULL, yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } break; case 325: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 580 "sql.y" -{ yymsp[-11].minor.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy388, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 6729 "sql.c" +{ yymsp[-11].minor.yy752 = createIndexOption(pCxt, yymsp[-9].minor.yy264, releaseRawExprNode(pCxt, yymsp[-5].minor.yy752), releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } break; case 328: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 587 "sql.y" -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy965, yymsp[-1].minor.yy388); } -#line 6734 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createFunctionNode(pCxt, &yymsp[-3].minor.yy879, yymsp[-1].minor.yy264); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; case 329: /* sma_func_name ::= function_name */ - case 554: /* alias_opt ::= table_alias */ yytestcase(yyruleno==554); -#line 591 "sql.y" -{ yylhsminor.yy965 = yymsp[0].minor.yy965; } -#line 6741 "sql.c" - yymsp[0].minor.yy965 = yylhsminor.yy965; + case 558: /* alias_opt ::= table_alias */ yytestcase(yyruleno==558); +{ yylhsminor.yy879 = yymsp[0].minor.yy879; } + yymsp[0].minor.yy879 = yylhsminor.yy879; break; case 334: /* sma_stream_opt ::= */ - case 379: /* stream_options ::= */ yytestcase(yyruleno==379); -#line 597 "sql.y" -{ yymsp[1].minor.yy560 = createStreamOptions(pCxt); } -#line 6748 "sql.c" + case 383: /* stream_options ::= */ yytestcase(yyruleno==383); +{ yymsp[1].minor.yy752 = createStreamOptions(pCxt); } break; case 335: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 598 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } -#line 6753 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy752)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy752); yylhsminor.yy752 = yymsp[-2].minor.yy752; } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 336: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 599 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } -#line 6759 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy752)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy752); yylhsminor.yy752 = yymsp[-2].minor.yy752; } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 337: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 600 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } -#line 6765 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ ((SStreamOptions*)yymsp[-2].minor.yy752)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy752); yylhsminor.yy752 = yymsp[-2].minor.yy752; } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 338: /* with_meta ::= AS */ -#line 605 "sql.y" -{ yymsp[0].minor.yy424 = 0; } -#line 6771 "sql.c" +{ yymsp[0].minor.yy10 = 0; } break; case 339: /* with_meta ::= WITH META AS */ -#line 606 "sql.y" -{ yymsp[-2].minor.yy424 = 1; } -#line 6776 "sql.c" +{ yymsp[-2].minor.yy10 = 1; } break; case 340: /* with_meta ::= ONLY META AS */ -#line 607 "sql.y" -{ yymsp[-2].minor.yy424 = 2; } -#line 6781 "sql.c" +{ yymsp[-2].minor.yy10 = 2; } break; case 341: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 609 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy983, &yymsp[-2].minor.yy965, yymsp[0].minor.yy560); } -#line 6786 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy547, &yymsp[-2].minor.yy879, yymsp[0].minor.yy752); } break; case 342: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -#line 611 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy983, &yymsp[-3].minor.yy965, &yymsp[0].minor.yy965, yymsp[-2].minor.yy424); } -#line 6791 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy547, &yymsp[-3].minor.yy879, &yymsp[0].minor.yy879, yymsp[-2].minor.yy10); } break; case 343: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -#line 613 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy983, &yymsp[-4].minor.yy965, yymsp[-1].minor.yy560, yymsp[-3].minor.yy424, yymsp[0].minor.yy560); } -#line 6796 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy547, &yymsp[-4].minor.yy879, yymsp[-1].minor.yy752, yymsp[-3].minor.yy10, yymsp[0].minor.yy752); } break; case 344: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 615 "sql.y" -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy965); } -#line 6801 "sql.c" +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy547, &yymsp[0].minor.yy879); } break; case 345: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 616 "sql.y" -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy983, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965); } -#line 6806 "sql.c" +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy547, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy879); } break; case 346: /* cmd ::= DESC full_table_name */ case 347: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==347); -#line 619 "sql.y" -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); } -#line 6812 "sql.c" +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy752); } break; case 348: /* cmd ::= RESET QUERY CACHE */ -#line 623 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 6817 "sql.c" break; case 349: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 350: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==350); -#line 626 "sql.y" -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy983, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 6823 "sql.c" +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy547, yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } break; case 353: /* explain_options ::= */ -#line 634 "sql.y" -{ yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); } -#line 6828 "sql.c" +{ yymsp[1].minor.yy752 = createDefaultExplainOptions(pCxt); } break; case 354: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 635 "sql.y" -{ yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } -#line 6833 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setExplainVerbose(pCxt, yymsp[-2].minor.yy752, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 355: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 636 "sql.y" -{ yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } -#line 6839 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = setExplainRatio(pCxt, yymsp[-2].minor.yy752, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 356: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -#line 641 "sql.y" -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy983, yymsp[-9].minor.yy983, &yymsp[-6].minor.yy965, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy412, yymsp[-1].minor.yy424, &yymsp[0].minor.yy965, yymsp[-10].minor.yy983); } -#line 6845 "sql.c" +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy547, yymsp[-9].minor.yy547, &yymsp[-6].minor.yy879, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy624, yymsp[-1].minor.yy10, &yymsp[0].minor.yy879, yymsp[-10].minor.yy547); } break; case 357: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 642 "sql.y" -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy965); } -#line 6850 "sql.c" +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy547, &yymsp[0].minor.yy879); } break; case 362: /* language_opt ::= */ - case 401: /* on_vgroup_id ::= */ yytestcase(yyruleno==401); -#line 656 "sql.y" -{ yymsp[1].minor.yy965 = nil_token; } -#line 6856 "sql.c" + case 405: /* on_vgroup_id ::= */ yytestcase(yyruleno==405); +{ yymsp[1].minor.yy879 = nil_token; } break; case 363: /* language_opt ::= LANGUAGE NK_STRING */ - case 402: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==402); -#line 657 "sql.y" -{ yymsp[-1].minor.yy965 = yymsp[0].minor.yy0; } -#line 6862 "sql.c" + case 406: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==406); +{ yymsp[-1].minor.yy879 = yymsp[0].minor.yy0; } break; case 366: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -#line 666 "sql.y" -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy983, yymsp[-2].minor.yy560, &yymsp[-1].minor.yy0, yymsp[0].minor.yy560); } -#line 6867 "sql.c" +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy547, yymsp[-2].minor.yy752, &yymsp[-1].minor.yy0, yymsp[0].minor.yy752); } break; case 367: /* cmd ::= DROP VIEW exists_opt full_view_name */ -#line 667 "sql.y" -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy560); } -#line 6872 "sql.c" +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy547, yymsp[0].minor.yy752); } break; case 368: /* full_view_name ::= view_name */ -#line 669 "sql.y" -{ yylhsminor.yy560 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy965); } -#line 6877 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy879); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; case 369: /* full_view_name ::= db_name NK_DOT view_name */ -#line 670 "sql.y" -{ yylhsminor.yy560 = createViewNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965); } -#line 6883 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy752 = createViewNode(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy879); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; case 370: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -#line 675 "sql.y" -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy983, &yymsp[-8].minor.yy965, yymsp[-5].minor.yy560, yymsp[-7].minor.yy560, yymsp[-3].minor.yy388, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, yymsp[-4].minor.yy388); } -#line 6889 "sql.c" +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy547, &yymsp[-8].minor.yy879, yymsp[-5].minor.yy752, yymsp[-7].minor.yy752, yymsp[-3].minor.yy264, yymsp[-2].minor.yy752, yymsp[0].minor.yy752, yymsp[-4].minor.yy264); } break; case 371: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 676 "sql.y" -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy965); } -#line 6894 "sql.c" +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy547, &yymsp[0].minor.yy879); } break; case 372: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 677 "sql.y" -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy965); } -#line 6899 "sql.c" +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy547, &yymsp[0].minor.yy879); } break; case 373: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 678 "sql.y" -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy983, yymsp[-1].minor.yy983, &yymsp[0].minor.yy965); } -#line 6904 "sql.c" +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy547, yymsp[-1].minor.yy547, &yymsp[0].minor.yy879); } break; - case 380: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 381: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==381); -#line 692 "sql.y" -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6910 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 378: /* column_stream_def ::= column_name */ +{ yylhsminor.yy752 = createColumnDefNode(pCxt, &yymsp[0].minor.yy879, createDataType(TSDB_DATA_TYPE_NULL), NULL, false); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 382: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 694 "sql.y" -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } -#line 6916 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 379: /* column_stream_def ::= column_name PRIMARY KEY */ +{ yylhsminor.yy752 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy879, createDataType(TSDB_DATA_TYPE_NULL), NULL, true); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 383: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 695 "sql.y" -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } -#line 6922 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 384: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 385: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==385); +{ yylhsminor.yy752 = setStreamOptions(pCxt, yymsp[-2].minor.yy752, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 384: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 696 "sql.y" -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 6928 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 386: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy752 = setStreamOptions(pCxt, yymsp[-3].minor.yy752, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy752)); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 385: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 697 "sql.y" -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 6934 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 387: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy752 = setStreamOptions(pCxt, yymsp[-2].minor.yy752, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy752)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 386: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 698 "sql.y" -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } -#line 6940 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 388: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy752 = setStreamOptions(pCxt, yymsp[-3].minor.yy752, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 387: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 699 "sql.y" -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6946 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 389: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy752 = setStreamOptions(pCxt, yymsp[-2].minor.yy752, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 389: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 594: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==594); - case 618: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==618); -#line 702 "sql.y" -{ yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); } -#line 6954 "sql.c" + case 390: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy752 = setStreamOptions(pCxt, yymsp[-2].minor.yy752, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy752)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 392: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 710 "sql.y" + case 391: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy752 = setStreamOptions(pCxt, yymsp[-3].minor.yy752, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; + break; + case 393: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 598: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==598); + case 622: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==622); +{ yymsp[-3].minor.yy752 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy752); } + break; + case 396: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 6959 "sql.c" break; - case 393: /* cmd ::= KILL QUERY NK_STRING */ -#line 711 "sql.y" + case 397: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6964 "sql.c" break; - case 394: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 712 "sql.y" + case 398: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 6969 "sql.c" break; - case 395: /* cmd ::= KILL COMPACT NK_INTEGER */ -#line 713 "sql.y" + case 399: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } -#line 6974 "sql.c" break; - case 396: /* cmd ::= BALANCE VGROUP */ -#line 716 "sql.y" + case 400: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 6979 "sql.c" break; - case 397: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -#line 717 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy965); } -#line 6984 "sql.c" + case 401: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy879); } break; - case 398: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 718 "sql.y" + case 402: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6989 "sql.c" break; - case 399: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 719 "sql.y" -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy388); } -#line 6994 "sql.c" + case 403: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy264); } break; - case 400: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 720 "sql.y" + case 404: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6999 "sql.c" break; - case 403: /* dnode_list ::= DNODE NK_INTEGER */ -#line 729 "sql.y" -{ yymsp[-1].minor.yy388 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7004 "sql.c" + case 407: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy264 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 405: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 736 "sql.y" -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 7009 "sql.c" + case 409: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } break; - case 408: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 745 "sql.y" -{ yymsp[-6].minor.yy560 = createInsertStmt(pCxt, yymsp[-4].minor.yy560, yymsp[-2].minor.yy388, yymsp[0].minor.yy560); } -#line 7014 "sql.c" + case 412: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy752 = createInsertStmt(pCxt, yymsp[-4].minor.yy752, yymsp[-2].minor.yy264, yymsp[0].minor.yy752); } break; - case 409: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 746 "sql.y" -{ yymsp[-3].minor.yy560 = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } -#line 7019 "sql.c" + case 413: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy752 = createInsertStmt(pCxt, yymsp[-1].minor.yy752, NULL, yymsp[0].minor.yy752); } break; - case 410: /* literal ::= NK_INTEGER */ -#line 749 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 7024 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 414: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 411: /* literal ::= NK_FLOAT */ -#line 750 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 7030 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 415: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 412: /* literal ::= NK_STRING */ -#line 751 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 7036 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 416: /* literal ::= NK_STRING */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 413: /* literal ::= NK_BOOL */ -#line 752 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 7042 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 417: /* literal ::= NK_BOOL */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 414: /* literal ::= TIMESTAMP NK_STRING */ -#line 753 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 7048 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 418: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 415: /* literal ::= duration_literal */ - case 425: /* signed_literal ::= signed */ yytestcase(yyruleno==425); - case 448: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==448); - case 449: /* expression ::= literal */ yytestcase(yyruleno==449); - case 451: /* expression ::= column_reference */ yytestcase(yyruleno==451); - case 452: /* expression ::= function_expression */ yytestcase(yyruleno==452); - case 453: /* expression ::= case_when_expression */ yytestcase(yyruleno==453); - case 486: /* function_expression ::= literal_func */ yytestcase(yyruleno==486); - case 535: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==535); - case 539: /* boolean_primary ::= predicate */ yytestcase(yyruleno==539); - case 541: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==541); - case 542: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==542); - case 545: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==545); - case 547: /* table_reference ::= table_primary */ yytestcase(yyruleno==547); - case 548: /* table_reference ::= joined_table */ yytestcase(yyruleno==548); - case 552: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==552); - case 620: /* query_simple ::= query_specification */ yytestcase(yyruleno==620); - case 621: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==621); - case 624: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==624); - case 626: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==626); -#line 754 "sql.y" -{ yylhsminor.yy560 = yymsp[0].minor.yy560; } -#line 7073 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 419: /* literal ::= duration_literal */ + case 429: /* signed_literal ::= signed */ yytestcase(yyruleno==429); + case 452: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==452); + case 453: /* expression ::= literal */ yytestcase(yyruleno==453); + case 455: /* expression ::= column_reference */ yytestcase(yyruleno==455); + case 456: /* expression ::= function_expression */ yytestcase(yyruleno==456); + case 457: /* expression ::= case_when_expression */ yytestcase(yyruleno==457); + case 490: /* function_expression ::= literal_func */ yytestcase(yyruleno==490); + case 539: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==539); + case 543: /* boolean_primary ::= predicate */ yytestcase(yyruleno==543); + case 545: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==545); + case 546: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==546); + case 549: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==549); + case 551: /* table_reference ::= table_primary */ yytestcase(yyruleno==551); + case 552: /* table_reference ::= joined_table */ yytestcase(yyruleno==552); + case 556: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==556); + case 624: /* query_simple ::= query_specification */ yytestcase(yyruleno==624); + case 625: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==625); + case 628: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==628); + case 630: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==630); +{ yylhsminor.yy752 = yymsp[0].minor.yy752; } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 416: /* literal ::= NULL */ -#line 755 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 7079 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 420: /* literal ::= NULL */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 417: /* literal ::= NK_QUESTION */ -#line 756 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7085 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 421: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 418: /* duration_literal ::= NK_VARIABLE */ - case 595: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==595); - case 596: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==596); - case 597: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==597); -#line 758 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7094 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 422: /* duration_literal ::= NK_VARIABLE */ + case 599: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==599); + case 600: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==600); + case 601: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==601); +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 419: /* signed ::= NK_INTEGER */ -#line 760 "sql.y" -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7100 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 423: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 420: /* signed ::= NK_PLUS NK_INTEGER */ -#line 761 "sql.y" -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7106 "sql.c" + case 424: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 421: /* signed ::= NK_MINUS NK_INTEGER */ -#line 762 "sql.y" + case 425: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 7115 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 422: /* signed ::= NK_FLOAT */ -#line 767 "sql.y" -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7121 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 426: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 423: /* signed ::= NK_PLUS NK_FLOAT */ -#line 768 "sql.y" -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7127 "sql.c" + case 427: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 424: /* signed ::= NK_MINUS NK_FLOAT */ -#line 769 "sql.y" + case 428: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 7136 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 426: /* signed_literal ::= NK_STRING */ -#line 776 "sql.y" -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7142 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 430: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 427: /* signed_literal ::= NK_BOOL */ -#line 777 "sql.y" -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 7148 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 431: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 428: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 778 "sql.y" -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7154 "sql.c" + case 432: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 429: /* signed_literal ::= duration_literal */ - case 431: /* signed_literal ::= literal_func */ yytestcase(yyruleno==431); - case 506: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==506); - case 572: /* select_item ::= common_expression */ yytestcase(yyruleno==572); - case 582: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==582); - case 625: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==625); - case 627: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==627); - case 640: /* search_condition ::= common_expression */ yytestcase(yyruleno==640); -#line 779 "sql.y" -{ yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } -#line 7166 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 433: /* signed_literal ::= duration_literal */ + case 435: /* signed_literal ::= literal_func */ yytestcase(yyruleno==435); + case 510: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==510); + case 576: /* select_item ::= common_expression */ yytestcase(yyruleno==576); + case 586: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==586); + case 629: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==629); + case 631: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==631); + case 644: /* search_condition ::= common_expression */ yytestcase(yyruleno==644); +{ yylhsminor.yy752 = releaseRawExprNode(pCxt, yymsp[0].minor.yy752); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 430: /* signed_literal ::= NULL */ -#line 780 "sql.y" -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 7172 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 434: /* signed_literal ::= NULL */ +{ yylhsminor.yy752 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 432: /* signed_literal ::= NK_QUESTION */ -#line 782 "sql.y" -{ yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 7178 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 436: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy752 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 450: /* expression ::= pseudo_column */ -#line 844 "sql.y" -{ yylhsminor.yy560 = yymsp[0].minor.yy560; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy560, true); } -#line 7184 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 454: /* expression ::= pseudo_column */ +{ yylhsminor.yy752 = yymsp[0].minor.yy752; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy752, true); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 454: /* expression ::= NK_LP expression NK_RP */ - case 540: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==540); - case 639: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==639); -#line 848 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } -#line 7192 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 458: /* expression ::= NK_LP expression NK_RP */ + case 544: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==544); + case 643: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==643); +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy752)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 455: /* expression ::= NK_PLUS expr_or_subquery */ -#line 849 "sql.y" + case 459: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy752)); } -#line 7201 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 456: /* expression ::= NK_MINUS expr_or_subquery */ -#line 853 "sql.y" + case 460: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy752), NULL)); } -#line 7210 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 457: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 857 "sql.y" + case 461: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7220 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 458: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 862 "sql.y" + case 462: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7230 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 459: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 867 "sql.y" + case 463: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7240 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 460: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 872 "sql.y" + case 464: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7250 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 461: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 877 "sql.y" + case 465: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7260 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 462: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 882 "sql.y" + case 466: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 7269 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 463: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 886 "sql.y" + case 467: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7279 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 464: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 891 "sql.y" + case 468: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7289 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 467: /* column_reference ::= column_name */ -#line 902 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy965, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy965)); } -#line 7295 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 471: /* column_reference ::= column_name */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy879, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy879)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 468: /* column_reference ::= table_name NK_DOT column_name */ -#line 903 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965, createColumnNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965)); } -#line 7301 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 472: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy879, createColumnNode(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy879)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 469: /* column_reference ::= NK_ALIAS */ -#line 904 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 7307 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 473: /* column_reference ::= NK_ALIAS */ +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 470: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -#line 905 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0)); } -#line 7313 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 474: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 471: /* pseudo_column ::= ROWTS */ - case 472: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==472); - case 474: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==474); - case 475: /* pseudo_column ::= QEND */ yytestcase(yyruleno==475); - case 476: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==476); - case 477: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==477); - case 478: /* pseudo_column ::= WEND */ yytestcase(yyruleno==478); - case 479: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==479); - case 480: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==480); - case 481: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==481); - case 482: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==482); - case 488: /* literal_func ::= NOW */ yytestcase(yyruleno==488); -#line 907 "sql.y" -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 7330 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 475: /* pseudo_column ::= ROWTS */ + case 476: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==476); + case 478: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==478); + case 479: /* pseudo_column ::= QEND */ yytestcase(yyruleno==479); + case 480: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==480); + case 481: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==481); + case 482: /* pseudo_column ::= WEND */ yytestcase(yyruleno==482); + case 483: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==483); + case 484: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==484); + case 485: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==485); + case 486: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==486); + case 492: /* literal_func ::= NOW */ yytestcase(yyruleno==492); +{ yylhsminor.yy752 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 473: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 909 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy965)))); } -#line 7336 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 477: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy879)))); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 483: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 484: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==484); -#line 920 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy965, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy965, yymsp[-1].minor.yy388)); } -#line 7343 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 487: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 488: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==488); +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy879, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy879, yymsp[-1].minor.yy264)); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 485: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -#line 923 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy412)); } -#line 7349 "sql.c" - yymsp[-5].minor.yy560 = yylhsminor.yy560; + case 489: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), yymsp[-1].minor.yy624)); } + yymsp[-5].minor.yy752 = yylhsminor.yy752; break; - case 487: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 926 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy965, NULL)); } -#line 7355 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 491: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy879, NULL)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 502: /* star_func_para_list ::= NK_STAR */ -#line 950 "sql.y" -{ yylhsminor.yy388 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 7361 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 506: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy264 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; - case 507: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 575: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==575); -#line 959 "sql.y" -{ yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0); } -#line 7368 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 511: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 579: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==579); +{ yylhsminor.yy752 = createColumnNode(pCxt, &yymsp[-2].minor.yy879, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 508: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 962 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy388, yymsp[-1].minor.yy560)); } -#line 7374 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 512: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy264, yymsp[-1].minor.yy752)); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 509: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 964 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy388, yymsp[-1].minor.yy560)); } -#line 7380 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 513: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), yymsp[-2].minor.yy264, yymsp[-1].minor.yy752)); } + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; - case 512: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 971 "sql.y" -{ yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } -#line 7386 "sql.c" + case 516: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy752 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752)); } break; - case 514: /* case_when_else_opt ::= ELSE common_expression */ -#line 974 "sql.y" -{ yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } -#line 7391 "sql.c" + case 518: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy752 = releaseRawExprNode(pCxt, yymsp[0].minor.yy752); } break; - case 515: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 520: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==520); -#line 977 "sql.y" + case 519: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 524: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==524); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy668, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy980, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7401 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 516: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 984 "sql.y" + case 520: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy752), releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7411 "sql.c" - yymsp[-4].minor.yy560 = yylhsminor.yy560; + yymsp[-4].minor.yy752 = yylhsminor.yy752; break; - case 517: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 990 "sql.y" + case 521: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy752), releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7421 "sql.c" - yymsp[-5].minor.yy560 = yylhsminor.yy560; + yymsp[-5].minor.yy752 = yylhsminor.yy752; break; - case 518: /* predicate ::= expr_or_subquery IS NULL */ -#line 995 "sql.y" + case 522: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), NULL)); } -#line 7430 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 519: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 999 "sql.y" + case 523: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), NULL)); } -#line 7439 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 521: /* compare_op ::= NK_LT */ -#line 1011 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_THAN; } -#line 7445 "sql.c" + case 525: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy980 = OP_TYPE_LOWER_THAN; } break; - case 522: /* compare_op ::= NK_GT */ -#line 1012 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_THAN; } -#line 7450 "sql.c" + case 526: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy980 = OP_TYPE_GREATER_THAN; } break; - case 523: /* compare_op ::= NK_LE */ -#line 1013 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_EQUAL; } -#line 7455 "sql.c" + case 527: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy980 = OP_TYPE_LOWER_EQUAL; } break; - case 524: /* compare_op ::= NK_GE */ -#line 1014 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_EQUAL; } -#line 7460 "sql.c" + case 528: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy980 = OP_TYPE_GREATER_EQUAL; } break; - case 525: /* compare_op ::= NK_NE */ -#line 1015 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_NOT_EQUAL; } -#line 7465 "sql.c" + case 529: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy980 = OP_TYPE_NOT_EQUAL; } break; - case 526: /* compare_op ::= NK_EQ */ -#line 1016 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_EQUAL; } -#line 7470 "sql.c" + case 530: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy980 = OP_TYPE_EQUAL; } break; - case 527: /* compare_op ::= LIKE */ -#line 1017 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_LIKE; } -#line 7475 "sql.c" + case 531: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy980 = OP_TYPE_LIKE; } break; - case 528: /* compare_op ::= NOT LIKE */ -#line 1018 "sql.y" -{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_LIKE; } -#line 7480 "sql.c" + case 532: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy980 = OP_TYPE_NOT_LIKE; } break; - case 529: /* compare_op ::= MATCH */ -#line 1019 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_MATCH; } -#line 7485 "sql.c" + case 533: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy980 = OP_TYPE_MATCH; } break; - case 530: /* compare_op ::= NMATCH */ -#line 1020 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_NMATCH; } -#line 7490 "sql.c" + case 534: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy980 = OP_TYPE_NMATCH; } break; - case 531: /* compare_op ::= CONTAINS */ -#line 1021 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_JSON_CONTAINS; } -#line 7495 "sql.c" + case 535: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy980 = OP_TYPE_JSON_CONTAINS; } break; - case 532: /* in_op ::= IN */ -#line 1025 "sql.y" -{ yymsp[0].minor.yy668 = OP_TYPE_IN; } -#line 7500 "sql.c" + case 536: /* in_op ::= IN */ +{ yymsp[0].minor.yy980 = OP_TYPE_IN; } break; - case 533: /* in_op ::= NOT IN */ -#line 1026 "sql.y" -{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_IN; } -#line 7505 "sql.c" + case 537: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy980 = OP_TYPE_NOT_IN; } break; - case 534: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 1028 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy388)); } -#line 7510 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 538: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy264)); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 536: /* boolean_value_expression ::= NOT boolean_primary */ -#line 1032 "sql.y" + case 540: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy752), NULL)); } -#line 7519 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 537: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 1037 "sql.y" + case 541: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7529 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 538: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 1043 "sql.y" + case 542: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy752); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy752); + yylhsminor.yy752 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } -#line 7539 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 546: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1061 "sql.y" -{ yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); } -#line 7545 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 550: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy752 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy752, yymsp[0].minor.yy752, NULL); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 549: /* table_primary ::= table_name alias_opt */ -#line 1067 "sql.y" -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 7551 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 553: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy752 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy879, &yymsp[0].minor.yy879); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 550: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1068 "sql.y" -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy965, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 7557 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 554: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy752 = createRealTableNode(pCxt, &yymsp[-3].minor.yy879, &yymsp[-1].minor.yy879, &yymsp[0].minor.yy879); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 551: /* table_primary ::= subquery alias_opt */ -#line 1069 "sql.y" -{ yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy965); } -#line 7563 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 555: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy752 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy752), &yymsp[0].minor.yy879); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 553: /* alias_opt ::= */ -#line 1074 "sql.y" -{ yymsp[1].minor.yy965 = nil_token; } -#line 7569 "sql.c" + case 557: /* alias_opt ::= */ +{ yymsp[1].minor.yy879 = nil_token; } break; - case 555: /* alias_opt ::= AS table_alias */ -#line 1076 "sql.y" -{ yymsp[-1].minor.yy965 = yymsp[0].minor.yy965; } -#line 7574 "sql.c" + case 559: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy879 = yymsp[0].minor.yy879; } break; - case 556: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 557: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==557); -#line 1078 "sql.y" -{ yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; } -#line 7580 "sql.c" + case 560: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 561: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==561); +{ yymsp[-2].minor.yy752 = yymsp[-1].minor.yy752; } break; - case 558: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -#line 1083 "sql.y" -{ yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-4].minor.yy684, yymsp[-5].minor.yy560, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } -#line 7585 "sql.c" - yymsp[-5].minor.yy560 = yylhsminor.yy560; + case 562: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy752 = createJoinTableNode(pCxt, yymsp[-4].minor.yy792, yymsp[-5].minor.yy752, yymsp[-2].minor.yy752, yymsp[0].minor.yy752); } + yymsp[-5].minor.yy752 = yylhsminor.yy752; break; - case 559: /* join_type ::= */ -#line 1087 "sql.y" -{ yymsp[1].minor.yy684 = JOIN_TYPE_INNER; } -#line 7591 "sql.c" + case 563: /* join_type ::= */ +{ yymsp[1].minor.yy792 = JOIN_TYPE_INNER; } break; - case 560: /* join_type ::= INNER */ -#line 1088 "sql.y" -{ yymsp[0].minor.yy684 = JOIN_TYPE_INNER; } -#line 7596 "sql.c" + case 564: /* join_type ::= INNER */ +{ yymsp[0].minor.yy792 = JOIN_TYPE_INNER; } break; - case 561: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ -#line 1094 "sql.y" + case 565: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-13].minor.yy560 = createSelectStmt(pCxt, yymsp[-11].minor.yy983, yymsp[-9].minor.yy388, yymsp[-8].minor.yy560, yymsp[-12].minor.yy388); - yymsp[-13].minor.yy560 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy560, yymsp[-10].minor.yy983); - yymsp[-13].minor.yy560 = addWhereClause(pCxt, yymsp[-13].minor.yy560, yymsp[-7].minor.yy560); - yymsp[-13].minor.yy560 = addPartitionByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-6].minor.yy388); - yymsp[-13].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy560, yymsp[-2].minor.yy560); - yymsp[-13].minor.yy560 = addGroupByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-1].minor.yy388); - yymsp[-13].minor.yy560 = addHavingClause(pCxt, yymsp[-13].minor.yy560, yymsp[0].minor.yy560); - yymsp[-13].minor.yy560 = addRangeClause(pCxt, yymsp[-13].minor.yy560, yymsp[-5].minor.yy560); - yymsp[-13].minor.yy560 = addEveryClause(pCxt, yymsp[-13].minor.yy560, yymsp[-4].minor.yy560); - yymsp[-13].minor.yy560 = addFillClause(pCxt, yymsp[-13].minor.yy560, yymsp[-3].minor.yy560); + yymsp[-13].minor.yy752 = createSelectStmt(pCxt, yymsp[-11].minor.yy547, yymsp[-9].minor.yy264, yymsp[-8].minor.yy752, yymsp[-12].minor.yy264); + yymsp[-13].minor.yy752 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy752, yymsp[-10].minor.yy547); + yymsp[-13].minor.yy752 = addWhereClause(pCxt, yymsp[-13].minor.yy752, yymsp[-7].minor.yy752); + yymsp[-13].minor.yy752 = addPartitionByClause(pCxt, yymsp[-13].minor.yy752, yymsp[-6].minor.yy264); + yymsp[-13].minor.yy752 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy752, yymsp[-2].minor.yy752); + yymsp[-13].minor.yy752 = addGroupByClause(pCxt, yymsp[-13].minor.yy752, yymsp[-1].minor.yy264); + yymsp[-13].minor.yy752 = addHavingClause(pCxt, yymsp[-13].minor.yy752, yymsp[0].minor.yy752); + yymsp[-13].minor.yy752 = addRangeClause(pCxt, yymsp[-13].minor.yy752, yymsp[-5].minor.yy752); + yymsp[-13].minor.yy752 = addEveryClause(pCxt, yymsp[-13].minor.yy752, yymsp[-4].minor.yy752); + yymsp[-13].minor.yy752 = addFillClause(pCxt, yymsp[-13].minor.yy752, yymsp[-3].minor.yy752); } -#line 7612 "sql.c" break; - case 562: /* hint_list ::= */ -#line 1109 "sql.y" -{ yymsp[1].minor.yy388 = createHintNodeList(pCxt, NULL); } -#line 7617 "sql.c" + case 566: /* hint_list ::= */ +{ yymsp[1].minor.yy264 = createHintNodeList(pCxt, NULL); } break; - case 563: /* hint_list ::= NK_HINT */ -#line 1110 "sql.y" -{ yylhsminor.yy388 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 7622 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 567: /* hint_list ::= NK_HINT */ +{ yylhsminor.yy264 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; - case 568: /* set_quantifier_opt ::= ALL */ -#line 1121 "sql.y" -{ yymsp[0].minor.yy983 = false; } -#line 7628 "sql.c" + case 572: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy547 = false; } break; - case 571: /* select_item ::= NK_STAR */ -#line 1128 "sql.y" -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 7633 "sql.c" - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 575: /* select_item ::= NK_STAR */ +{ yylhsminor.yy752 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy752 = yylhsminor.yy752; break; - case 573: /* select_item ::= common_expression column_alias */ - case 583: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==583); -#line 1130 "sql.y" -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy965); } -#line 7640 "sql.c" - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 577: /* select_item ::= common_expression column_alias */ + case 587: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==587); +{ yylhsminor.yy752 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy752), &yymsp[0].minor.yy879); } + yymsp[-1].minor.yy752 = yylhsminor.yy752; break; - case 574: /* select_item ::= common_expression AS column_alias */ - case 584: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==584); -#line 1131 "sql.y" -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy965); } -#line 7647 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 578: /* select_item ::= common_expression AS column_alias */ + case 588: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==588); +{ yylhsminor.yy752 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), &yymsp[0].minor.yy879); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 579: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 609: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==609); - case 629: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==629); -#line 1140 "sql.y" -{ yymsp[-2].minor.yy388 = yymsp[0].minor.yy388; } -#line 7655 "sql.c" + case 583: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 613: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==613); + case 633: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==633); +{ yymsp[-2].minor.yy264 = yymsp[0].minor.yy264; } break; - case 586: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -#line 1153 "sql.y" -{ yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } -#line 7660 "sql.c" + case 590: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +{ yymsp[-5].minor.yy752 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), releaseRawExprNode(pCxt, yymsp[-1].minor.yy752)); } break; - case 587: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1154 "sql.y" -{ yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } -#line 7665 "sql.c" + case 591: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy752 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy752)); } break; - case 588: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1156 "sql.y" -{ yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 7670 "sql.c" + case 592: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy752 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), NULL, yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } break; - case 589: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1160 "sql.y" -{ yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } -#line 7675 "sql.c" + case 593: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy752 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy752), releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), yymsp[-1].minor.yy752, yymsp[0].minor.yy752); } break; - case 590: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1162 "sql.y" -{ yymsp[-6].minor.yy560 = createEventWindowNode(pCxt, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } -#line 7680 "sql.c" + case 594: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy752 = createEventWindowNode(pCxt, yymsp[-3].minor.yy752, yymsp[0].minor.yy752); } break; - case 591: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -#line 1164 "sql.y" -{ yymsp[-3].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } -#line 7685 "sql.c" + case 595: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy752 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 592: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 1166 "sql.y" -{ yymsp[-5].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } -#line 7690 "sql.c" + case 596: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy752 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 599: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1176 "sql.y" -{ yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); } -#line 7695 "sql.c" + case 603: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy752 = createFillNode(pCxt, yymsp[-1].minor.yy284, NULL); } break; - case 600: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1177 "sql.y" -{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy388)); } -#line 7700 "sql.c" + case 604: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy752 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy264)); } break; - case 601: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1178 "sql.y" -{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy388)); } -#line 7705 "sql.c" + case 605: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy752 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy264)); } break; - case 602: /* fill_mode ::= NONE */ -#line 1182 "sql.y" -{ yymsp[0].minor.yy18 = FILL_MODE_NONE; } -#line 7710 "sql.c" + case 606: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy284 = FILL_MODE_NONE; } break; - case 603: /* fill_mode ::= PREV */ -#line 1183 "sql.y" -{ yymsp[0].minor.yy18 = FILL_MODE_PREV; } -#line 7715 "sql.c" + case 607: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy284 = FILL_MODE_PREV; } break; - case 604: /* fill_mode ::= NULL */ -#line 1184 "sql.y" -{ yymsp[0].minor.yy18 = FILL_MODE_NULL; } -#line 7720 "sql.c" + case 608: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy284 = FILL_MODE_NULL; } break; - case 605: /* fill_mode ::= NULL_F */ -#line 1185 "sql.y" -{ yymsp[0].minor.yy18 = FILL_MODE_NULL_F; } -#line 7725 "sql.c" + case 609: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy284 = FILL_MODE_NULL_F; } break; - case 606: /* fill_mode ::= LINEAR */ -#line 1186 "sql.y" -{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; } -#line 7730 "sql.c" + case 610: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy284 = FILL_MODE_LINEAR; } break; - case 607: /* fill_mode ::= NEXT */ -#line 1187 "sql.y" -{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; } -#line 7735 "sql.c" + case 611: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy284 = FILL_MODE_NEXT; } break; - case 610: /* group_by_list ::= expr_or_subquery */ -#line 1196 "sql.y" -{ yylhsminor.yy388 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } -#line 7740 "sql.c" - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 614: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy264 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } + yymsp[0].minor.yy264 = yylhsminor.yy264; break; - case 611: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1197 "sql.y" -{ yylhsminor.yy388 = addNodeToList(pCxt, yymsp[-2].minor.yy388, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } -#line 7746 "sql.c" - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 615: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy264 = addNodeToList(pCxt, yymsp[-2].minor.yy264, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy752))); } + yymsp[-2].minor.yy264 = yylhsminor.yy264; break; - case 615: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1204 "sql.y" -{ yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } -#line 7752 "sql.c" + case 619: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy752 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy752), releaseRawExprNode(pCxt, yymsp[-1].minor.yy752)); } break; - case 616: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1206 "sql.y" -{ yymsp[-3].minor.yy560 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } -#line 7757 "sql.c" + case 620: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy752 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy752)); } break; - case 619: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1213 "sql.y" + case 623: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy388); - yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy752 = addOrderByClause(pCxt, yymsp[-3].minor.yy752, yymsp[-2].minor.yy264); + yylhsminor.yy752 = addSlimitClause(pCxt, yylhsminor.yy752, yymsp[-1].minor.yy752); + yylhsminor.yy752 = addLimitClause(pCxt, yylhsminor.yy752, yymsp[0].minor.yy752); } -#line 7766 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 622: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1223 "sql.y" -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } -#line 7772 "sql.c" - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 626: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy752 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy752, yymsp[0].minor.yy752); } + yymsp[-3].minor.yy752 = yylhsminor.yy752; break; - case 623: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1225 "sql.y" -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } -#line 7778 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 627: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy752 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy752, yymsp[0].minor.yy752); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 631: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 635: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==635); -#line 1239 "sql.y" -{ yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 7785 "sql.c" + case 635: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 639: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==639); +{ yymsp[-1].minor.yy752 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 632: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 636: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==636); -#line 1240 "sql.y" -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 7791 "sql.c" + case 636: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 640: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==640); +{ yymsp[-3].minor.yy752 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 633: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 637: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==637); -#line 1241 "sql.y" -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 7797 "sql.c" + case 637: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 641: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==641); +{ yymsp[-3].minor.yy752 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 638: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1249 "sql.y" -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); } -#line 7802 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 642: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy752 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy752); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 643: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1263 "sql.y" -{ yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy164, yymsp[0].minor.yy109); } -#line 7808 "sql.c" - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 647: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy752 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy752), yymsp[-1].minor.yy248, yymsp[0].minor.yy937); } + yymsp[-2].minor.yy752 = yylhsminor.yy752; break; - case 644: /* ordering_specification_opt ::= */ -#line 1267 "sql.y" -{ yymsp[1].minor.yy164 = ORDER_ASC; } -#line 7814 "sql.c" + case 648: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy248 = ORDER_ASC; } break; - case 645: /* ordering_specification_opt ::= ASC */ -#line 1268 "sql.y" -{ yymsp[0].minor.yy164 = ORDER_ASC; } -#line 7819 "sql.c" + case 649: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy248 = ORDER_ASC; } break; - case 646: /* ordering_specification_opt ::= DESC */ -#line 1269 "sql.y" -{ yymsp[0].minor.yy164 = ORDER_DESC; } -#line 7824 "sql.c" + case 650: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy248 = ORDER_DESC; } break; - case 647: /* null_ordering_opt ::= */ -#line 1273 "sql.y" -{ yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; } -#line 7829 "sql.c" + case 651: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy937 = NULL_ORDER_DEFAULT; } break; - case 648: /* null_ordering_opt ::= NULLS FIRST */ -#line 1274 "sql.y" -{ yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; } -#line 7834 "sql.c" + case 652: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy937 = NULL_ORDER_FIRST; } break; - case 649: /* null_ordering_opt ::= NULLS LAST */ -#line 1275 "sql.y" -{ yymsp[-1].minor.yy109 = NULL_ORDER_LAST; } -#line 7839 "sql.c" + case 653: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy937 = NULL_ORDER_LAST; } break; default: break; @@ -7898,7 +7008,6 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ -#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -7909,7 +7018,6 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } -#line 7912 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 8748cc7c17..190f608473 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1573,6 +1573,9 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* pWindow->watermark = pWindowLogicNode->watermark; pWindow->deleteMark = pWindowLogicNode->deleteMark; pWindow->igExpired = pWindowLogicNode->igExpired; + if (pCxt->pPlanCxt->streamQuery) { + pWindow->destHasPrimayKey = pCxt->pPlanCxt->destHasPrimaryKey; + } pWindow->mergeDataBlock = (GROUP_ACTION_KEEP == pWindowLogicNode->node.groupAction ? false : true); pWindow->node.inputTsOrder = pWindowLogicNode->node.inputTsOrder; pWindow->node.outputTsOrder = pWindowLogicNode->node.outputTsOrder; diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index b53dc9daa6..17c4f8e15d 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -278,11 +278,11 @@ int32_t streamStateFuncPut(SStreamState* pState, const SWinKey* key, const void* #ifdef USE_ROCKSDB void* pVal = NULL; int32_t len = 0; - int32_t code = getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), &pVal, &len); + getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), &pVal, &len); char* buf = ((SRowBuffPos*)pVal)->pRowBuff; uint32_t rowSize = streamFileStateGeSelectRowSize(pState->pFileState); memcpy(buf + len - rowSize, value, vLen); - return code; + return TSDB_CODE_SUCCESS; #else return tdbTbUpsert(pState->pTdbState->pFuncStateDb, key, sizeof(STupleKey), value, vLen, pState->pTdbState->txn); #endif diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index f86ab6b8a3..f7c3965196 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -438,6 +438,7 @@ SRowBuffPos* getNewRowPosForWrite(SStreamFileState* pFileState) { } int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen) { + int32_t code = TSDB_CODE_SUCCESS; pFileState->maxTs = TMAX(pFileState->maxTs, pFileState->getTs(pKey)); SRowBuffPos** pos = tSimpleHashGet(pFileState->rowStateBuff, pKey, keyLen); if (pos) { @@ -445,17 +446,18 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi *pVal = *pos; (*pos)->beUsed = true; (*pos)->beFlushed = false; - return TSDB_CODE_SUCCESS; + return code; } SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); ASSERT(pNewPos->pRowBuff); memcpy(pNewPos->pKey, pKey, keyLen); + code = TSDB_CODE_FAILED; TSKEY ts = pFileState->getTs(pKey); if (!isDeteled(pFileState, ts) && isFlushedState(pFileState, ts, 0)) { int32_t len = 0; void* p = NULL; - int32_t code = streamStateGet_rocksdb(pFileState->pFileStore, pKey, &p, &len); + code = streamStateGet_rocksdb(pFileState->pFileStore, pKey, &p, &len); qDebug("===stream===get %" PRId64 " from disc, res %d", ts, code); if (code == TSDB_CODE_SUCCESS) { memcpy(pNewPos->pRowBuff, p, len); @@ -468,7 +470,7 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi *pVLen = pFileState->rowSize; *pVal = pNewPos; } - return TSDB_CODE_SUCCESS; + return code; } int32_t deleteRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t keyLen) { diff --git a/tests/script/auto.sh b/tests/script/auto.sh new file mode 100755 index 0000000000..59b4e2f774 --- /dev/null +++ b/tests/script/auto.sh @@ -0,0 +1,59 @@ +./test.sh -f tsim/stream/streamPrimaryKey0.sim +./test.sh -f tsim/stream/streamPrimaryKey1.sim +./test.sh -f tsim/stream/streamPrimaryKey2.sim + + +./test.sh -f tsim/stream/basic0.sim +./test.sh -f tsim/stream/basic1.sim +./test.sh -f tsim/stream/basic2.sim +./test.sh -f tsim/stream/basic3.sim +./test.sh -f tsim/stream/basic4.sim +./test.sh -f tsim/stream/checkpointInterval0.sim +./test.sh -f tsim/stream/checkpointInterval1.sim +./test.sh -f tsim/stream/checkpointSession0.sim +./test.sh -f tsim/stream/checkpointSession1.sim +./test.sh -f tsim/stream/checkpointState0.sim +./test.sh -f tsim/stream/checkStreamSTable1.sim +./test.sh -f tsim/stream/checkStreamSTable.sim +./test.sh -f tsim/stream/deleteInterval.sim +./test.sh -f tsim/stream/deleteSession.sim +./test.sh -f tsim/stream/deleteState.sim +./test.sh -f tsim/stream/distributeInterval0.sim +./test.sh -f tsim/stream/distributeIntervalRetrive0.sim +./test.sh -f tsim/stream/distributeSession0.sim +./test.sh -f tsim/stream/drop_stream.sim +./test.sh -f tsim/stream/fillHistoryBasic1.sim +./test.sh -f tsim/stream/fillHistoryBasic2.sim +./test.sh -f tsim/stream/fillHistoryBasic3.sim +./test.sh -f tsim/stream/fillHistoryTransform.sim +./test.sh -f tsim/stream/fillIntervalDelete0.sim +./test.sh -f tsim/stream/fillIntervalDelete1.sim +./test.sh -f tsim/stream/fillIntervalLinear.sim +./test.sh -f tsim/stream/fillIntervalPartitionBy.sim +./test.sh -f tsim/stream/fillIntervalPrevNext1.sim +./test.sh -f tsim/stream/fillIntervalPrevNext.sim +./test.sh -f tsim/stream/fillIntervalRange.sim +./test.sh -f tsim/stream/fillIntervalValue.sim +./test.sh -f tsim/stream/ignoreCheckUpdate.sim +./test.sh -f tsim/stream/ignoreExpiredData.sim +./test.sh -f tsim/stream/partitionby1.sim +./test.sh -f tsim/stream/partitionbyColumnInterval.sim +./test.sh -f tsim/stream/partitionbyColumnSession.sim +./test.sh -f tsim/stream/partitionbyColumnState.sim +./test.sh -f tsim/stream/partitionby.sim +./test.sh -f tsim/stream/pauseAndResume.sim +./test.sh -f tsim/stream/schedSnode.sim +./test.sh -f tsim/stream/session0.sim +./test.sh -f tsim/stream/session1.sim +./test.sh -f tsim/stream/sliding.sim +./test.sh -f tsim/stream/state0.sim +./test.sh -f tsim/stream/state1.sim +./test.sh -f tsim/stream/streamPrimaryKey0.sim +./test.sh -f tsim/stream/streamPrimaryKey1.sim +./test.sh -f tsim/stream/streamPrimaryKey2.sim +./test.sh -f tsim/stream/triggerInterval0.sim +./test.sh -f tsim/stream/triggerSession0.sim +./test.sh -f tsim/stream/udTableAndTag0.sim +./test.sh -f tsim/stream/udTableAndTag1.sim +./test.sh -f tsim/stream/udTableAndTag2.sim +./test.sh -f tsim/stream/windowClose.sim diff --git a/tests/script/grep.sh b/tests/script/grep.sh new file mode 100755 index 0000000000..bd34ca3a25 --- /dev/null +++ b/tests/script/grep.sh @@ -0,0 +1 @@ +sh auto.sh|grep "success\|fail\|asan error_num" diff --git a/tests/script/tsim/stream/checkpointSession1.sim b/tests/script/tsim/stream/checkpointSession1.sim index ea93e1525a..9720803145 100644 --- a/tests/script/tsim/stream/checkpointSession1.sim +++ b/tests/script/tsim/stream/checkpointSession1.sim @@ -15,6 +15,8 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create stream streams0 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, count(*) c1, sum(a) from st session(ts, 10s); +sleep 1000 + sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791213001,2,2,3,1.1); diff --git a/tests/script/tsim/stream/streamPrimaryKey0.sim b/tests/script/tsim/stream/streamPrimaryKey0.sim new file mode 100644 index 0000000000..258154f8aa --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey0.sim @@ -0,0 +1,245 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt0(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create table streamt2(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams0 trigger at_once ignore expired 0 ignore update 0 into streamt0 as select _wstart, count(*) c1, max(b) from t1 interval(1s); +sql create stream streams2 trigger at_once ignore expired 0 ignore update 0 into streamt2 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta interval(1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop0: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt0 +sql select * from streamt0; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop0 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop0 +endi + +$loop_count = 0 + +loop2: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt2 +sql select * from streamt2; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop2 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop2 +endi + +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt3(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create table streamt5(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams3 trigger at_once ignore expired 0 ignore update 0 into streamt3 as select _wstart, count(*) c1, max(b) from t1 session(ts,1s); +sql create stream streams5 trigger at_once ignore expired 0 ignore update 0 into streamt5 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta session(ts,1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 +sql select * from streamt3; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop3 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop3 +endi + +$loop_count = 0 + +loop5: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt5 +sql select * from streamt5; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop5 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop5 +endi + + +sql create database test2 vgroups 4; +sql use test2; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt6(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams6 trigger at_once ignore expired 0 ignore update 0 into streamt6 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta state_window(a); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,1,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,5,2,3,3.1); + +$loop_count = 0 + +loop6: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt6 +sql select * from streamt6; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop6 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop6 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stream/streamPrimaryKey1.sim b/tests/script/tsim/stream/streamPrimaryKey1.sim new file mode 100644 index 0000000000..2496ce0124 --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey1.sim @@ -0,0 +1,123 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt1(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); + +sql create stream streams1 trigger at_once ignore expired 0 ignore update 0 into streamt1 as select _wstart, count(*) c1, max(b) from st interval(1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1 +sql select * from streamt1; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 2 then + print =====data00=$data00 + goto loop1 +endi + + +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt3(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams3 trigger at_once ignore expired 0 ignore update 0 into streamt3 as select _wstart, count(*) c1, max(b) from st session(ts,1s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791250000,4,2,3,3.1); + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 +sql select * from streamt3; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop3 +endi + +if $data01 != 2 then + print =====data00=$data00 + goto loop3 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stream/streamPrimaryKey2.sim b/tests/script/tsim/stream/streamPrimaryKey2.sim new file mode 100644 index 0000000000..590f7a562f --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey2.sim @@ -0,0 +1,141 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt1(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); + +sql create stream streams1 trigger at_once ignore expired 0 ignore update 0 into streamt1 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta EVENT_WINDOW start with a = 1 end with a = 3; + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); +sql insert into t1 values(1648791210010,3,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,2,2,3,1.0); + +sql insert into t1 values(1648791220000,1,2,3,1.1); +sql insert into t1 values(1648791220001,3,2,3,1.1); + +sql insert into t1 values(1648791230000,1,2,3,2.1); +sql insert into t1 values(1648791230001,3,2,3,2.1); + +sql insert into t1 values(1648791240000,1,2,3,3.1); +sql insert into t1 values(1648791240001,3,2,3,3.1); + +sql insert into t1 values(1648791250000,1,2,3,3.1); +sql insert into t1 values(1648791250001,3,2,3,3.1); + + +$loop_count = 0 + +loop1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1 +sql select * from streamt1; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop1 +endi + + +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); +sql create table streamt3(ts timestamp, a int primary key, b bigint ) tags(ta varchar(100),tb int,tc int); +sql create stream streams3 trigger at_once ignore expired 1 ignore update 0 WATERMARK 1000s into streamt3 tags(ta) as select _wstart, count(*) c1, max(b) from st partition by tbname ta COUNT_WINDOW(2); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210001,4,2,3,4.1); + +sql insert into t1 values(1648791220000,2,2,3,1.1); +sql insert into t1 values(1648791220001,2,2,3,1.1); + +sql insert into t1 values(1648791230000,3,2,3,2.1); +sql insert into t1 values(1648791230001,3,2,3,2.1); + +sql insert into t1 values(1648791240000,4,2,3,3.1); +sql insert into t1 values(1648791240001,4,2,3,3.1); + +sql insert into t1 values(1648791250000,4,2,3,3.1); +sql insert into t1 values(1648791250001,4,2,3,3.1); + + + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 +sql select * from streamt3; + +print $data00 $data01 $data01 +print $data10 $data11 $data11 +print $data20 $data21 $data21 +print $data30 $data31 $data31 +print $data40 $data41 $data41 +print $data50 $data51 $data51 +print $data60 $data61 $data61 +print $data70 $data71 $data71 + +if $rows != 5 then + print =====rows=$rows + goto loop3 +endi + +if $data01 != 2 then + print =====data01=$data01 + goto loop3 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stream/udTableAndCol0.sim b/tests/script/tsim/stream/udTableAndCol0.sim new file mode 100644 index 0000000000..22561dc044 --- /dev/null +++ b/tests/script/tsim/stream/udTableAndCol0.sim @@ -0,0 +1,65 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 + +print ===== step1 + +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print ===== step2 +print ===== table name + +sql create database test vgroups 4; +sql use test; + + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1(a, b, c, d) as select _wstart, count(*) c1, max(a) from st interval(10s); +sql_error create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2(a, b) as select _wstart, count(*) c1, max(a) from st interval(10s); + + +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3(a, b) as select count(*) c1, max(a) from st interval(10s); + +sleep 1000 + +sql desc streamt3; + +print $data00 +print $data10 +print $data20 +print $data30 +print $data40 + +if $rows != 4 then + return -1 +endi + +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4(a, b, c) as select _wstart, count(*) c1, max(a) from st interval(10s); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt5(a, b, c) as select _wstart, count(*) c1, max(a) from st partition by tbname interval(10s); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6(a, b, c) tags(tbn varchar(60)) as select _wstart, count(*) c1, max(a) from st partition by tbname tbn interval(10s); + + + +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt7(a, b primary key, c) tags(tbn varchar(60)) as select _wstart, count(*) c1, max(a) from st partition by tbname tbn interval(10s); +sql_error create stream streams8 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt8(a, b, c primary key) as select _wstart, count(*) c1, max(a) from st interval(10s); + +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt9(a primary key, b) as select count(*) c1, max(a) from st interval(10s); + +sql_error create stream streams10 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt10(a, b primary key, c) as select count(*) c1, max(a), max(b) from st interval(10s); +sql_error create stream streams11 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt11(a, b , a) as select count(*) c1, max(a), max(b) from st interval(10s); +sql_error create stream streams12 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt12(a, b , c) tags(c varchar(60)) as select count(*) c1, max(a), max(b) from st partition by tbname c interval(10s); + +sql_error create stream streams13 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt13(a, b , c) tags(tc varchar(60)) as select count(*) c1, max(a) c1, max(b) from st partition by tbname tc interval(10s); + +sql_error create stream streams14 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt14 tags(tc varchar(60)) as select count(*) tc, max(a) c1, max(b) from st partition by tbname tc interval(10s); + +sql_error create stream streams15 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt15 tags(tc varchar(100) primary key) as select _wstart, count(*) c1, max(a) from st partition by tbname tc interval(10s); + + +print ======over + +system sh/stop_dnodes.sh diff --git a/tests/script/tsim/stream/udTableAndTag1.sim b/tests/script/tsim/stream/udTableAndTag1.sim index e6427aab10..b109a4dbc9 100644 --- a/tests/script/tsim/stream/udTableAndTag1.sim +++ b/tests/script/tsim/stream/udTableAndTag1.sim @@ -339,6 +339,65 @@ if $data22 != t3 then goto loop8 endi +print ===== step6 + +sql create database test5 vgroups 4; +sql use test5; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stable streamt5(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create stream streams5 trigger at_once ignore expired 0 ignore update 0 into streamt5(ts,b,a) as select _wstart, count(*), 1000 c1 from t1 interval(10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,1,2,3,1.0); +sql insert into t1 values(1648791223001,2,2,3,1.1); +sql insert into t1 values(1648791233002,3,2,3,2.1); +sql insert into t1 values(1648791243003,4,2,3,3.1); + +$loop_count = 0 +loop9: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt5; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 4 then + print =====rows=$rows + goto loop9 +endi + +if $data01 != 1000 then + print =====data01=$data01 + goto loop9 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop9 +endi + + +if $data31 != 1000 then + print =====data31=$data31 + goto loop9 +endi + +if $data32 != 1 then + print =====data32=$data32 + goto loop9 +endi + print ======over system sh/stop_dnodes.sh From 85ccba0fab6a2bfa5ab6c407385fbd5b800484e6 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Fri, 22 Mar 2024 15:27:22 +0800 Subject: [PATCH 07/64] enh: support changeless transaction of tasks --- source/dnode/mnode/impl/inc/mndDef.h | 1 + source/dnode/mnode/impl/inc/mndTrans.h | 1 + source/dnode/mnode/impl/src/mndTrans.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index a63157445b..924af2b0a7 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -160,6 +160,7 @@ typedef struct { ETrnConflct conflict; ETrnExec exec; EOperType oper; + bool changeless; int32_t code; int32_t failedTimes; void* rpcRsp; diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h index 8689df98af..8c9ca87fb1 100644 --- a/source/dnode/mnode/impl/inc/mndTrans.h +++ b/source/dnode/mnode/impl/inc/mndTrans.h @@ -81,6 +81,7 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbnam void mndTransSetArbGroupId(STrans *pTrans, int32_t groupId); void mndTransSetSerial(STrans *pTrans); void mndTransSetParallel(STrans *pTrans); +void mndTransSetChangeless(STrans *pTrans); void mndTransSetOper(STrans *pTrans, EOperType oper); int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans); #ifndef BUILD_NO_CALL diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 3af372a432..0e4f4210fb 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -739,6 +739,8 @@ void mndTransSetSerial(STrans *pTrans) { pTrans->exec = TRN_EXEC_SERIAL; } void mndTransSetParallel(STrans *pTrans) { pTrans->exec = TRN_EXEC_PARALLEL; } +void mndTransSetChangeless(STrans *pTrans) { pTrans->changeless = true; } + void mndTransSetOper(STrans *pTrans, EOperType oper) { pTrans->oper = oper; } static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) { @@ -862,7 +864,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { return -1; } - if (taosArrayGetSize(pTrans->commitActions) <= 0) { + if (!pTrans->changeless && taosArrayGetSize(pTrans->commitActions) <= 0) { terrno = TSDB_CODE_MND_TRANS_CLOG_IS_NULL; mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); return -1; From 02528eaa48b40d334700a64f699789472a8f61f1 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Fri, 22 Mar 2024 16:24:13 +0800 Subject: [PATCH 08/64] enh: not to touch meta data during balance vgroup leader --- source/dnode/mnode/impl/src/mndVgroup.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 571f17fab6..56e0c482e3 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -2348,18 +2348,6 @@ int32_t mndAddVgroupBalanceToTrans(SMnode *pMnode, SVgObj *pVgroup, STrans *pTra } mndReleaseDb(pMnode, pDb); - - SSdbRaw *pRaw = mndVgroupActionEncode(pVgroup); - if (pRaw == NULL) { - mError("trans:%d, vgid:%d failed to encode action to dnode:%d", pTrans->id, vgid, dnodeId); - return -1; - } - if (mndTransAppendCommitlog(pTrans, pRaw) != 0) { - sdbFreeRaw(pRaw); - mError("trans:%d, vgid:%d failed to append commit log dnode:%d", pTrans->id, vgid, dnodeId); - return -1; - } - (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); } else { mInfo("trans:%d, vgid:%d cant be balanced to dnode:%d, exist:%d, online:%d", pTrans->id, vgid, dnodeId, exist, online); From d1b974228f8782c53b13962f6b63775e89c52f0a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 25 Mar 2024 11:16:28 +0800 Subject: [PATCH 09/64] add stream check --- source/libs/parser/src/parTranslater.c | 45 ++++++++++++++++++-- tests/script/tsim/stream/udTableAndCol0.sim | 46 +++++++++++++++++++++ 2 files changed, 87 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 14a12b8893..2163113a66 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3981,7 +3981,12 @@ static int32_t checkStateWindowForStream(STranslateContext* pCxt, SSelectStmt* p } if (TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && !hasPartitionByTbname(pSelect->pPartitionByList)) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Unsupported stream query"); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "State window for stream on super table must patitioned by table name"); + } + if ((SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table of State window must not has primary key"); } return TSDB_CODE_SUCCESS; } @@ -7969,6 +7974,13 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Event window for stream on super table must patitioned by table name"); } + + if (pSelect->pWindow != NULL && pSelect->pWindow->type == QUERY_NODE_EVENT_WINDOW && + (SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table of Event window must not has primary key"); + } + if (TSDB_DATA_TYPE_TIMESTAMP != ((SExprNode*)nodesListGetNode(pSelect->pProjectionList, 0))->resType.type || !isTimeLineQuery(pStmt->pQuery) || crossTableWithoutAggOper(pSelect) || NULL != pSelect->pOrderByList || crossTableWithUdaf(pSelect) || hasJsonTypeProjection(pSelect)) { @@ -8011,6 +8023,11 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Ignore expired data of Count window must be 1."); } + + if ((SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table of Count window must not has primary key"); + } } return TSDB_CODE_SUCCESS; @@ -8499,15 +8516,35 @@ static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta static int32_t checkStreamDestTableSchema(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; - SNode* pProj = nodesListGetNode(pStmt->pCols, 0); - SColumnDefNode* pCol = (SColumnDefNode*)pProj; + SNode* pNode = nodesListGetNode(pStmt->pCols, 0); + SColumnDefNode* pCol = (SColumnDefNode*)pNode; if (pCol && pCol->dataType.type != TSDB_DATA_TYPE_TIMESTAMP) { pCol->dataType = (SDataType){.type = TSDB_DATA_TYPE_TIMESTAMP, .precision = 0, .scale = 0, .bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes}; } - return checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, NULL); + int32_t code = checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, NULL); + if (TSDB_CODE_SUCCESS == code && NULL == pSelect->pWindow && + ((SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta))) { + if (1 >= LIST_LENGTH(pStmt->pCols) || 1 >= LIST_LENGTH(pSelect->pProjectionList)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY); + } + + SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 1); + if (QUERY_NODE_COLUMN != nodeType(pProj) || + 0 != strcmp(((SColumnNode*)pProj)->colName, ((SRealTableNode*)pSelect->pFromTable)->pMeta->schema[1].name)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Source table has primary key, result must has primary key"); + } + + pNode = nodesListGetNode(pStmt->pCols, 1); + pCol = (SColumnDefNode*)pNode; + if (!pCol->is_pk) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Source table has primary key, dest table must has primary key"); + } + } + return code; } static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { diff --git a/tests/script/tsim/stream/udTableAndCol0.sim b/tests/script/tsim/stream/udTableAndCol0.sim index 22561dc044..9c8a5aaaad 100644 --- a/tests/script/tsim/stream/udTableAndCol0.sim +++ b/tests/script/tsim/stream/udTableAndCol0.sim @@ -60,6 +60,52 @@ sql_error create stream streams14 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE sql_error create stream streams15 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt15 tags(tc varchar(100) primary key) as select _wstart, count(*) c1, max(a) from st partition by tbname tc interval(10s); +sql create database test1 vgroups 4; +sql use test1; + + +sql create stable st(ts timestamp, a int primary key, b int, c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql_error create stream streams16 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt16 as select _wstart, count(*) c1, max(a) from st partition by tbname tc state_window(b); +sql_error create stream streams17 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt17 as select _wstart, count(*) c1, max(a) from st partition by tbname tc event_window start with a = 0 end with a = 9; +sql_error create stream streams18 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 watermark 10s into streamt18 as select _wstart, count(*) c1, max(a) from st partition by tbname tc count_window(2); + +print ===== step2 +print ===== scalar + +sql create database test2 vgroups 4; +sql use test2; + +sql create table t1 (ts timestamp, a int, b int); + +sql create table rst(ts timestamp, a int primary key, b int) tags(ta varchar(100)); +sql create table rct1 using rst tags("aa"); + +sql create table rst6(ts timestamp, a int primary key, b int) tags(ta varchar(100)); +sql create table rst7(ts timestamp, a int primary key, b int) tags(ta varchar(100)); + +sql create stream streams19 trigger at_once ignore expired 0 ignore update 0 into streamt19 as select ts,a, b from t1; + +sql create stream streams20 trigger at_once ignore expired 0 ignore update 0 into streamt20(ts, a primary key, b) as select ts,a, b from t1; +sql create stream streams21 trigger at_once ignore expired 0 ignore update 0 into rst as select ts,a, b from t1; + +sql_error create stream streams22 trigger at_once ignore expired 0 ignore update 0 into streamt22 as select ts,1, b from rct1; + +sql_error create stream streams23 trigger at_once ignore expired 0 ignore update 0 into streamt23 as select ts, a, b from rct1; + +sql create stream streams24 trigger at_once ignore expired 0 ignore update 0 into streamt24(ts, a primary key, b) as select ts, a, b from rct1; +sql create stream streams25 trigger at_once ignore expired 0 ignore update 0 into rst6 as select ts, a, b from rct1; + +sql_error create stream streams26 trigger at_once ignore expired 0 ignore update 0 into rst7 as select ts, 1,b from rct1; + +sql_error create stream streams27 trigger at_once ignore expired 0 ignore update 0 into streamt27(ts, a primary key, b) as select ts, 1,b from rct1; + + + + + print ======over system sh/stop_dnodes.sh From 61e7ae53c84195bfc69b4edbdf303dd2f377d0d8 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Mon, 25 Mar 2024 21:23:27 +0800 Subject: [PATCH 10/64] fix: tag supported when count on subtable --- tests/system-test/2-query/group_partition.py | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py index 50325579c4..73be70defa 100644 --- a/tests/system-test/2-query/group_partition.py +++ b/tests/system-test/2-query/group_partition.py @@ -91,6 +91,25 @@ class TDTestCase: tdSql.query(f"select t2, t3, c1, count(*) from {self.dbname}.{self.stable} {keyword} by t2, t3, c1 ") tdSql.checkRows(nonempty_tb_num * self.row_nums) + def test_groupby_sub_table(self): + for i in range(self.tb_nums): + tbname = f"{self.dbname}.sub_{self.stable}_{i}" + ts = self.ts + i*10000 + tdSql.query(f"select t1, t2, t3,count(*) from {tbname}") + tdSql.checkRows(1) + tdSql.checkData(0, 1, i) + tdSql.checkData(0, 2, i*10) + + tdSql.query(f"select t1, t2, t3, count(*) from {tbname} group by tbname") + tdSql.checkRows(1) + tdSql.checkData(0, 1, i) + tdSql.checkData(0, 2, i*10) + + tdSql.query(f"select t1, t2, t3, count(*) from {tbname} partition by tbname") + tdSql.checkRows(1) + tdSql.checkData(0, 1, i) + tdSql.checkData(0, 2, i*10) + def test_multi_group_key(self, check_num, nonempty_tb_num): # multi tag/tbname @@ -235,12 +254,14 @@ class TDTestCase: self.test_groupby('group', self.tb_nums, nonempty_tb_num) self.test_groupby('partition', self.tb_nums, nonempty_tb_num) + self.test_groupby_sub_table() self.test_innerSelect(self.tb_nums) self.test_multi_group_key(self.tb_nums, nonempty_tb_num) self.test_multi_agg(self.tb_nums, nonempty_tb_num) self.test_window(nonempty_tb_num) self.test_event_window(nonempty_tb_num) + ## test old version before changed # self.test_groupby('group', 0, 0) # self.insert_db(5, self.row_nums) From aa9962318f6b37a6dc254603ef5c25902bcfeec8 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 26 Mar 2024 16:38:24 +0800 Subject: [PATCH 11/64] read preversion data of primary key --- include/common/tcommon.h | 1 + source/libs/executor/inc/executorInt.h | 5 +- source/libs/executor/src/scanoperator.c | 142 ++++++++++++++---- .../executor/src/streamcountwindowoperator.c | 2 +- .../executor/src/streameventwindowoperator.c | 2 +- .../executor/src/streamtimewindowoperator.c | 6 +- source/libs/nodes/src/nodesCodeFuncs.c | 7 + 7 files changed, 131 insertions(+), 34 deletions(-) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index d68ba1534a..c84185c120 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -392,6 +392,7 @@ typedef struct STUidTagInfo { #define CALCULATE_START_TS_COLUMN_INDEX 4 #define CALCULATE_END_TS_COLUMN_INDEX 5 #define TABLE_NAME_COLUMN_INDEX 6 +#define PRIMARY_KEY_COLUMN_INDEX 7 // stream create table block column #define UD_TABLE_NAME_COLUMN_INDEX 0 diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index c896869a24..73d1e08f37 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -453,6 +453,7 @@ typedef struct SStreamScanInfo { SExprSupp tbnameCalSup; SExprSupp tagCalSup; int32_t primaryTsIndex; // primary time stamp slot id + int32_t primaryKeyIndex; SReadHandle readHandle; SInterval interval; // if the upstream is an interval operator, the interval info is also kept here. SColMatchInfo matchInfo; @@ -873,10 +874,8 @@ bool isOverdue(TSKEY ts, STimeWindowAggSupp* pSup); bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup); bool isDeletedStreamWindow(STimeWindow* pWin, uint64_t groupId, void* pState, STimeWindowAggSupp* pTwSup, SStateStore* pStore); -void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, +void appendDataToSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName); -void appendAllColumnToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, - TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName); uint64_t calGroupIdByData(SPartitionBySupporter* pParSup, SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a51e627272..0ab291d25b 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1372,13 +1372,51 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU return pBlock->info.rows > 0 ? pBlock : NULL; } -static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion) { +bool comparePrimaryKey(SColumnInfoData* pCol, int32_t rowId, void* pVal) { + void* pData = colDataGetData(pCol, rowId); + if (IS_VAR_DATA_TYPE(pCol->info.type)) { + int32_t colLen = varDataLen(pData); + int32_t keyLen = varDataLen(pVal); + if (pCol->info.type == TSDB_DATA_TYPE_JSON) { + colLen = getJsonValueLen(pData); + keyLen = getJsonValueLen(pVal); + } + + if (colLen == keyLen && memcmp(pData, pVal, colLen) == 0) { + return true; + } + } else { + if (memcmp(pData, pVal, pCol->info.bytes) == 0) { + return true; + } + } + return false; +} + +bool hasPrimaryKey(SStreamScanInfo* pInfo) { + return pInfo->primaryKeyIndex != -1; +} + +static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion, void* pVal) { SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uid, ts, ts, maxVersion); if (!pPreRes || pPreRes->info.rows == 0) { return 0; } - ASSERT(pPreRes->info.rows == 1); - return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, 0); + + int32_t rowId = 0; + if (hasPrimaryKey(pInfo)) { + SColumnInfoData* pPkCol = taosArrayGet(pPreRes->pDataBlock, pInfo->primaryKeyIndex); + for (; rowId < pPreRes->info.rows; rowId++) { + if (comparePrimaryKey(pPkCol, rowId, pVal)) { + break; + } + } + } + if (rowId >= pPreRes->info.rows) { + qInfo("===stream===read preversion data of primary key failed. ts:%" PRId64 ",version:%" PRId64); + return 0; + } + return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, rowId); } static uint64_t getGroupIdByUid(SStreamScanInfo* pInfo, uint64_t uid) { @@ -1386,9 +1424,9 @@ static uint64_t getGroupIdByUid(SStreamScanInfo* pInfo, uint64_t uid) { return tableListGetTableGroupId(pTableScanInfo->base.pTableListInfo, uid); } -static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion) { +static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion, void* pVal) { if (pInfo->partitionSup.needCalc) { - return getGroupIdByCol(pInfo, uid, ts, maxVersion); + return getGroupIdByCol(pInfo, uid, ts, maxVersion, pVal); } return getGroupIdByUid(pInfo, uid); @@ -1573,6 +1611,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; + SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1582,7 +1621,11 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); int64_t ver = pSrcBlock->info.version - 1; for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { - uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver); + void* pVal = NULL; + if (hasPrimaryKey(pInfo)) { + pVal = colDataGetData(pSrcPkCol, i); + } + uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); // gap must be 0. SSessionKey startWin = {0}; getCurSessionWindow(pInfo->windowSup.pStreamAggSup, startData[i], startData[i], groupId, &startWin); @@ -1628,6 +1671,7 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; + SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1637,7 +1681,11 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); int64_t ver = pSrcBlock->info.version - 1; for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { - uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver); + void* pVal = NULL; + if (hasPrimaryKey(pInfo)) { + pVal = colDataGetData(pSrcPkCol, i); + } + uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); SSessionKey startWin = {.win.skey = startData[i], .win.ekey = endData[i], .groupId = groupId}; SSessionKey range = {0}; getCountWinRange(pInfo->windowSup.pStreamAggSup, &startWin, mode, &range); @@ -1664,6 +1712,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); @@ -1688,7 +1737,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS for (int32_t i = 0; i < rows; i++) { uint64_t groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, i); - appendOneRowToStreamSpecialBlock(pSrcBlock, ((TSKEY*)pTsCol->pData) + i, ((TSKEY*)pTsCol->pData) + i, &srcUid, + appendDataToSpecialBlock(pSrcBlock, ((TSKEY*)pTsCol->pData) + i, ((TSKEY*)pTsCol->pData) + i, &srcUid, &groupId, NULL); } printDataBlock(pSrcBlock, "new delete", GET_TASKID(pTaskInfo)); @@ -1713,7 +1762,11 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS uint64_t srcUid = srcUidData[i]; uint64_t groupId = srcGp[i]; if (groupId == 0) { - groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver); + void* pVal = NULL; + if (hasPrimaryKey(pInfo)) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver, pVal); } TSKEY calStartTs = srcStartTsCol[i]; colDataSetVal(pCalStartTsCol, pDestBlock->info.rows, (const char*)(&calStartTs), false); @@ -1758,6 +1811,8 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; + SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; @@ -1767,12 +1822,17 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS uint64_t groupId = srcGp[i]; char tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; if (groupId == 0) { - groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver); + void* pVal = NULL; + if (hasPrimaryKey(pInfo) && pSrcPkCol) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver, pVal); } if (pInfo->tbnameCalSup.pExprInfo) { void* parTbname = NULL; code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname); if (code != TSDB_CODE_SUCCESS) { + // todo(liuyao) 这里可能需要修改,需要考虑复合主键时,pPreRes包含多行数据。 SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[i], srcStartTsCol[i], ver); printDataBlock(pPreRes, "pre res", GET_TASKID(pInfo->pStreamScanOp->pTaskInfo)); calBlockTbName(pInfo, pPreRes); @@ -1783,7 +1843,7 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS varDataSetLen(tbname, strlen(varDataVal(tbname))); pInfo->stateStore.streamStateFreeVal(parTbname); } - appendOneRowToStreamSpecialBlock(pDestBlock, srcStartTsCol + i, srcEndTsCol + i, srcUidData + i, &groupId, + appendDataToSpecialBlock(pDestBlock, srcStartTsCol + i, srcEndTsCol + i, srcUidData + i, &groupId, tbname[0] == 0 ? NULL : tbname); } return TSDB_CODE_SUCCESS; @@ -1807,13 +1867,8 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, return code; } -void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, - uint64_t* pGp, void* pTbName) { - appendAllColumnToStreamSpecialBlock(pBlock, pStartTs, pEndTs, pStartTs, pEndTs, pUid, pGp, pTbName); -} - -void appendAllColumnToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, - TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName) { +void appendOneRowToSpecialBlockImpl(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, + TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName, void* pPkData) { SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX); @@ -1828,9 +1883,24 @@ void appendAllColumnToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, T colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pCalStartTs, false); colDataSetVal(pCalEndCol, pBlock->info.rows, (const char*)pCalEndTs, false); colDataSetVal(pTableCol, pBlock->info.rows, (const char*)pTbName, pTbName == NULL); + if (taosArrayGetSize(pBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { + SColumnInfoData* pPkCol = taosArrayGet(pBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + colDataSetVal(pPkCol, pBlock->info.rows, (const char*)pPkData, pPkData == NULL); + } pBlock->info.rows++; } +void appendPkToSpecialBlock(SSDataBlock* pBlock, TSKEY* pTsArray, SColumnInfoData* pPkCol, int32_t rowId, + uint64_t* pUid, uint64_t* pGp, void* pTbName) { + appendOneRowToSpecialBlockImpl(pBlock, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pUid, + pGp, pTbName, colDataGetData(pPkCol, rowId)); +} + +void appendDataToSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, uint64_t* pGp, + void* pTbName) { + appendOneRowToSpecialBlockImpl(pBlock, pStartTs, pEndTs, pStartTs, pEndTs, pUid, pGp, pTbName, NULL); +} + bool checkExpiredData(SStateStore* pAPI, SUpdateInfo* pUpdateInfo, STimeWindowAggSupp* pTwSup, uint64_t tableId, TSKEY ts) { bool isExpired = false; bool isInc = pAPI->isIncrementalTimeStamp(pUpdateInfo, tableId, ts); @@ -1848,6 +1918,11 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); ASSERT(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* tsCol = (TSKEY*)pColDataInfo->pData; + SColumnInfoData* pPkColDataInfo = NULL; + if (hasPrimaryKey(pInfo)) { + pPkColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryKeyIndex); + } + bool tableInserted = pInfo->stateStore.updateInfoIsTableInserted(pInfo->pUpdateInfo, pBlock->info.id.uid); for (int32_t rowId = 0; rowId < pBlock->info.rows; rowId++) { SResultRowInfo dumyInfo; @@ -1865,17 +1940,15 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock } // must check update info first. bool update = pInfo->stateStore.updateInfoIsUpdated(pInfo->pUpdateInfo, pBlock->info.id.uid, tsCol[rowId]); - bool closedWin = isClosed && isSignleIntervalWindow(pInfo) && + bool isDeleted = isClosed && isSignleIntervalWindow(pInfo) && isDeletedStreamWindow(&win, pBlock->info.id.groupId, pInfo->pState, &pInfo->twAggSup, &pInfo->stateStore); - if ((update || closedWin) && out) { - qDebug("stream update check not pass, update %d, closedWin %d", update, closedWin); + if ((update || isDeleted) && out) { + qDebug("stream update check not pass, update %d, deleted Win %d", update, isDeleted); uint64_t gpId = 0; - appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.id.uid, &gpId, - NULL); - if (closedWin && pInfo->partitionSup.needCalc) { + appendPkToSpecialBlock(pInfo->pUpdateDataRes, tsCol, pPkColDataInfo, rowId, &pBlock->info.id.uid, &gpId, NULL); + if (isDeleted && pInfo->partitionSup.needCalc) { gpId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pBlock, rowId); - appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.id.uid, - &gpId, NULL); + appendPkToSpecialBlock(pInfo->pUpdateDataRes, tsCol, pPkColDataInfo, rowId, &pBlock->info.id.uid, &gpId, NULL); } } } @@ -2809,6 +2882,14 @@ void streamScanReloadState(SOperatorInfo* pOperator) { } } +void addPrimaryKeyCol(SSDataBlock* pBlock, uint8_t type, int32_t bytes) { + pBlock->info.rowSize += bytes; + SColumnInfoData infoData = {0}; + infoData.info.type = type; + infoData.info.bytes = bytes; + taosArrayPush(pBlock->pDataBlock, &infoData); +} + SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond, STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo) { SArray* pColIds = NULL; @@ -2837,6 +2918,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys goto _error; } + SDataType pkType = {0}; + pInfo->primaryKeyIndex = -1; int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList); pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); for (int32_t i = 0; i < numOfOutput; ++i) { @@ -2847,6 +2930,10 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys if (id->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { pInfo->primaryTsIndex = id->dstSlotId; } + if (id->isPk) { + pInfo->primaryKeyIndex = id->dstSlotId; + pkType = id->dataType; + } } if (pTableScanNode->pSubtable != NULL) { @@ -2964,6 +3051,9 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pInfo->pDeleteDataRes = createSpecialDataBlock(STREAM_DELETE_DATA); pInfo->updateWin = (STimeWindow){.skey = INT64_MAX, .ekey = INT64_MAX}; pInfo->pUpdateDataRes = createSpecialDataBlock(STREAM_CLEAR); + if (hasPrimaryKey(pInfo)) { + addPrimaryKeyCol(pInfo->pUpdateDataRes, pkType.type, pkType.bytes); + } pInfo->assignBlockUid = pTableScanNode->assignBlockUid; pInfo->partitionSup.needCalc = false; pInfo->igCheckUpdate = pTableScanNode->igCheckUpdate; diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 8199fe141f..5b2db5bb4f 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -269,7 +269,7 @@ static void doStreamCountAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl range.win.skey = TMIN(startTsCols[i], range.win.skey); range.win.ekey = TMAX(startTsCols[rows-1], range.win.ekey); uint64_t uid = 0; - appendOneRowToStreamSpecialBlock(pAggSup->pScanBlock, &range.win.skey, &range.win.ekey, &uid, &range.groupId, NULL); + appendDataToSpecialBlock(pAggSup->pScanBlock, &range.win.skey, &range.win.ekey, &uid, &range.groupId, NULL); break; } code = doOneWindowAggImpl(&pInfo->twAggSup.timeWindowData, &curWin.winInfo, &pResult, i, winRows, rows, numOfOutput, diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index 6db5a60ed4..f93ca1a04c 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -326,7 +326,7 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl ASSERT(winRows >= 1); if (rebuild) { uint64_t uid = 0; - appendOneRowToStreamSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, + appendDataToSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); tSimpleHashRemove(pSeUpdated, &curWin.winInfo.sessionWin, sizeof(SSessionKey)); doDeleteEventWindow(pAggSup, pSeUpdated, &curWin.winInfo.sessionWin); diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 075a58e932..ed67c69771 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -377,11 +377,11 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin void* tbname = NULL; pInfo->stateStore.streamStateGetParName(pInfo->pState, pWin->groupId, &tbname); if (tbname == NULL) { - appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL); + appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL); } else { char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN]; STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName)); - appendOneRowToStreamSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, parTbName); + appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, parTbName); } pInfo->stateStore.streamStateFreeVal(tbname); (*index)++; @@ -3514,7 +3514,7 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl pAggSup->pResultRows, pSeUpdated, pStDeleted); if (!allEqual) { uint64_t uid = 0; - appendOneRowToStreamSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, + appendDataToSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); tSimpleHashRemove(pSeUpdated, &curWin.winInfo.sessionWin, sizeof(SSessionKey)); doDeleteSessionWindow(pAggSup, &curWin.winInfo.sessionWin); diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 36bcfdc43b..8c7184f378 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -514,6 +514,7 @@ static const char* jkSchemaType = "Type"; static const char* jkSchemaColId = "ColId"; static const char* jkSchemaBytes = "bytes"; static const char* jkSchemaName = "Name"; +static const char* jkSchemaFlags = "Flags"; static int32_t schemaToJson(const void* pObj, SJson* pJson) { const SSchema* pNode = (const SSchema*)pObj; @@ -528,6 +529,9 @@ static int32_t schemaToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddStringToObject(pJson, jkSchemaName, pNode->name); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkSchemaFlags, pNode->flags); + } return code; } @@ -546,6 +550,9 @@ static int32_t jsonToSchema(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetStringValue(pJson, jkSchemaName, pNode->name); } + if (TSDB_CODE_SUCCESS == code) { + tjsonGetNumberValue(pJson, jkSchemaFlags, pNode->flags, code); + } return code; } From 293548212864d1b9ecfb5c88902f2c8d261294e6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 26 Mar 2024 16:46:44 +0800 Subject: [PATCH 12/64] read preversion data of primary key --- tests/script/auto.sh | 59 -------------------------------------------- tests/script/grep.sh | 1 - 2 files changed, 60 deletions(-) delete mode 100755 tests/script/auto.sh delete mode 100755 tests/script/grep.sh diff --git a/tests/script/auto.sh b/tests/script/auto.sh deleted file mode 100755 index 59b4e2f774..0000000000 --- a/tests/script/auto.sh +++ /dev/null @@ -1,59 +0,0 @@ -./test.sh -f tsim/stream/streamPrimaryKey0.sim -./test.sh -f tsim/stream/streamPrimaryKey1.sim -./test.sh -f tsim/stream/streamPrimaryKey2.sim - - -./test.sh -f tsim/stream/basic0.sim -./test.sh -f tsim/stream/basic1.sim -./test.sh -f tsim/stream/basic2.sim -./test.sh -f tsim/stream/basic3.sim -./test.sh -f tsim/stream/basic4.sim -./test.sh -f tsim/stream/checkpointInterval0.sim -./test.sh -f tsim/stream/checkpointInterval1.sim -./test.sh -f tsim/stream/checkpointSession0.sim -./test.sh -f tsim/stream/checkpointSession1.sim -./test.sh -f tsim/stream/checkpointState0.sim -./test.sh -f tsim/stream/checkStreamSTable1.sim -./test.sh -f tsim/stream/checkStreamSTable.sim -./test.sh -f tsim/stream/deleteInterval.sim -./test.sh -f tsim/stream/deleteSession.sim -./test.sh -f tsim/stream/deleteState.sim -./test.sh -f tsim/stream/distributeInterval0.sim -./test.sh -f tsim/stream/distributeIntervalRetrive0.sim -./test.sh -f tsim/stream/distributeSession0.sim -./test.sh -f tsim/stream/drop_stream.sim -./test.sh -f tsim/stream/fillHistoryBasic1.sim -./test.sh -f tsim/stream/fillHistoryBasic2.sim -./test.sh -f tsim/stream/fillHistoryBasic3.sim -./test.sh -f tsim/stream/fillHistoryTransform.sim -./test.sh -f tsim/stream/fillIntervalDelete0.sim -./test.sh -f tsim/stream/fillIntervalDelete1.sim -./test.sh -f tsim/stream/fillIntervalLinear.sim -./test.sh -f tsim/stream/fillIntervalPartitionBy.sim -./test.sh -f tsim/stream/fillIntervalPrevNext1.sim -./test.sh -f tsim/stream/fillIntervalPrevNext.sim -./test.sh -f tsim/stream/fillIntervalRange.sim -./test.sh -f tsim/stream/fillIntervalValue.sim -./test.sh -f tsim/stream/ignoreCheckUpdate.sim -./test.sh -f tsim/stream/ignoreExpiredData.sim -./test.sh -f tsim/stream/partitionby1.sim -./test.sh -f tsim/stream/partitionbyColumnInterval.sim -./test.sh -f tsim/stream/partitionbyColumnSession.sim -./test.sh -f tsim/stream/partitionbyColumnState.sim -./test.sh -f tsim/stream/partitionby.sim -./test.sh -f tsim/stream/pauseAndResume.sim -./test.sh -f tsim/stream/schedSnode.sim -./test.sh -f tsim/stream/session0.sim -./test.sh -f tsim/stream/session1.sim -./test.sh -f tsim/stream/sliding.sim -./test.sh -f tsim/stream/state0.sim -./test.sh -f tsim/stream/state1.sim -./test.sh -f tsim/stream/streamPrimaryKey0.sim -./test.sh -f tsim/stream/streamPrimaryKey1.sim -./test.sh -f tsim/stream/streamPrimaryKey2.sim -./test.sh -f tsim/stream/triggerInterval0.sim -./test.sh -f tsim/stream/triggerSession0.sim -./test.sh -f tsim/stream/udTableAndTag0.sim -./test.sh -f tsim/stream/udTableAndTag1.sim -./test.sh -f tsim/stream/udTableAndTag2.sim -./test.sh -f tsim/stream/windowClose.sim diff --git a/tests/script/grep.sh b/tests/script/grep.sh deleted file mode 100755 index bd34ca3a25..0000000000 --- a/tests/script/grep.sh +++ /dev/null @@ -1 +0,0 @@ -sh auto.sh|grep "success\|fail\|asan error_num" From 93edc9d1ff9ea33adee4790ecced40af5a4bd45d Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 26 Mar 2024 17:36:37 +0800 Subject: [PATCH 13/64] read preversion data of primary key --- source/libs/executor/src/scanoperator.c | 6 +++++- tests/parallel_test/cases.task | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 0ab291d25b..064ec4c18f 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1892,8 +1892,12 @@ void appendOneRowToSpecialBlockImpl(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* void appendPkToSpecialBlock(SSDataBlock* pBlock, TSKEY* pTsArray, SColumnInfoData* pPkCol, int32_t rowId, uint64_t* pUid, uint64_t* pGp, void* pTbName) { + void* pVal = NULL; + if (pPkCol) { + pVal = colDataGetData(pPkCol, rowId); + } appendOneRowToSpecialBlockImpl(pBlock, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pUid, - pGp, pTbName, colDataGetData(pPkCol, rowId)); + pGp, pTbName, pVal); } void appendDataToSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, uint64_t* pGp, diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 2402f6a94a..33913b7848 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1254,8 +1254,12 @@ ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,y,script,./test.sh -f tsim/stream/state0.sim ,,y,script,./test.sh -f tsim/stream/state1.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey0.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey1.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey2.sim ,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,y,script,./test.sh -f tsim/stream/triggerSession0.sim +,,y,script,./test.sh -f tsim/stream/udTableAndCol0.sim ,,y,script,./test.sh -f tsim/stream/udTableAndTag0.sim ,,y,script,./test.sh -f tsim/stream/udTableAndTag1.sim ,,y,script,./test.sh -f tsim/stream/udTableAndTag2.sim From ed87ac75a7f510dece0b71ee8b0500d7d8f69836 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 26 Mar 2024 19:11:19 +0800 Subject: [PATCH 14/64] add ci --- .../script/tsim/stream/streamPrimaryKey0.sim | 80 +++++++++---------- .../script/tsim/stream/streamPrimaryKey1.sim | 32 ++++---- .../script/tsim/stream/streamPrimaryKey2.sim | 32 ++++---- .../script/tsim/stream/streamPrimaryKey3.sim | 74 +++++++++++++++++ 4 files changed, 146 insertions(+), 72 deletions(-) create mode 100644 tests/script/tsim/stream/streamPrimaryKey3.sim diff --git a/tests/script/tsim/stream/streamPrimaryKey0.sim b/tests/script/tsim/stream/streamPrimaryKey0.sim index 258154f8aa..8905078a3e 100644 --- a/tests/script/tsim/stream/streamPrimaryKey0.sim +++ b/tests/script/tsim/stream/streamPrimaryKey0.sim @@ -46,14 +46,14 @@ endi print 1 select * from streamt0 sql select * from streamt0; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows @@ -79,14 +79,14 @@ endi print 1 select * from streamt2 sql select * from streamt2; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows @@ -136,14 +136,14 @@ endi print 1 select * from streamt3 sql select * from streamt3; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows @@ -169,14 +169,14 @@ endi print 1 select * from streamt5 sql select * from streamt5; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows @@ -223,14 +223,14 @@ endi print 1 select * from streamt6 sql select * from streamt6; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows diff --git a/tests/script/tsim/stream/streamPrimaryKey1.sim b/tests/script/tsim/stream/streamPrimaryKey1.sim index 2496ce0124..71971166d6 100644 --- a/tests/script/tsim/stream/streamPrimaryKey1.sim +++ b/tests/script/tsim/stream/streamPrimaryKey1.sim @@ -45,14 +45,14 @@ endi print 1 select * from streamt1 sql select * from streamt1; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows @@ -101,14 +101,14 @@ endi print 1 select * from streamt3 sql select * from streamt3; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows diff --git a/tests/script/tsim/stream/streamPrimaryKey2.sim b/tests/script/tsim/stream/streamPrimaryKey2.sim index 590f7a562f..c47dc2bb4b 100644 --- a/tests/script/tsim/stream/streamPrimaryKey2.sim +++ b/tests/script/tsim/stream/streamPrimaryKey2.sim @@ -54,14 +54,14 @@ endi print 1 select * from streamt1 sql select * from streamt1; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows @@ -119,14 +119,14 @@ endi print 1 select * from streamt3 sql select * from streamt3; -print $data00 $data01 $data01 -print $data10 $data11 $data11 -print $data20 $data21 $data21 -print $data30 $data31 $data31 -print $data40 $data41 $data41 -print $data50 $data51 $data51 -print $data60 $data61 $data61 -print $data70 $data71 $data71 +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 if $rows != 5 then print =====rows=$rows diff --git a/tests/script/tsim/stream/streamPrimaryKey3.sim b/tests/script/tsim/stream/streamPrimaryKey3.sim new file mode 100644 index 0000000000..39d55bda6c --- /dev/null +++ b/tests/script/tsim/stream/streamPrimaryKey3.sim @@ -0,0 +1,74 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 135 +system sh/cfg.sh -n dnode1 -c streamBufferSize -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 500 + +sql connect + +print step1============= + +sql create database test vgroups 4; +sql use test; +sql create table st(ts timestamp, a int primary key, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); + +sql create stream streams1 trigger at_once ignore expired 0 ignore update 0 into streamt1(ts, a primary key, b) as select ts, a, b from t1 partition by b; + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,3,1.0); +sql insert into t1 values(1648791210000,2,4,3,1.0); + +sleep 500 + +sql insert into t1 values(1648791210000,1,3,3,1.0); + + +$loop_count = 0 + +loop0: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1 order by 1,2 +sql select * from streamt1 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 2 then + print =====rows=$rows + goto loop0 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop0 +endi + +if $data02 != 3 then + print =====data02=$data02 + goto loop0 +endi + +if $data11 != 2 then + print =====data11=$data11 + goto loop0 +endi + +if $data12 != 4 then + print =====data12=$data12 + goto loop0 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 0a206f5819979e2700732468757edad288b4c5d0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 09:32:24 +0800 Subject: [PATCH 15/64] add log --- source/libs/executor/src/scanoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 064ec4c18f..8c04095943 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1413,7 +1413,7 @@ static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, } } if (rowId >= pPreRes->info.rows) { - qInfo("===stream===read preversion data of primary key failed. ts:%" PRId64 ",version:%" PRId64); + qInfo("===stream===read preversion data of primary key failed. ts:%" PRId64 ",version:%" PRId64, ts, maxVersion); return 0; } return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, rowId); From 65457d2cf463c2d72e158bc39ba677ad5f46ef17 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 14:16:19 +0800 Subject: [PATCH 16/64] delete data for scalar function --- source/libs/executor/inc/executorInt.h | 1 + source/libs/executor/src/groupoperator.c | 5 +- source/libs/executor/src/scanoperator.c | 89 ++++++--- tests/script/tsim/stream/deleteScalar.sim | 175 ++++++++++++++++++ .../script/tsim/stream/streamPrimaryKey3.sim | 31 ++++ 5 files changed, 277 insertions(+), 24 deletions(-) create mode 100644 tests/script/tsim/stream/deleteScalar.sim diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 73d1e08f37..531a89b3f7 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -451,6 +451,7 @@ typedef struct SStreamScanInfo { SExprInfo* pPseudoExpr; int32_t numOfPseudoExpr; SExprSupp tbnameCalSup; + SExprSupp* pPartTbnameSup; SExprSupp tagCalSup; int32_t primaryTsIndex; // primary time stamp slot id int32_t primaryKeyIndex; diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 87b8cd366c..670771adcc 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -1255,7 +1255,7 @@ static void destroyStreamPartitionOperatorInfo(void* param) { taosMemoryFreeClear(param); } -void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr) { +void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr, SExprSupp* pTbnameExpr) { SStorageAPI* pAPI = &downstream->pTaskInfo->storageAPI; if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { @@ -1265,6 +1265,7 @@ void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->partitionSup = *pParSup; pScanInfo->pPartScalarSup = pExpr; + pScanInfo->pPartTbnameSup = pTbnameExpr; if (!pScanInfo->pUpdateInfo) { pScanInfo->pUpdateInfo = pAPI->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0, pScanInfo->igCheckUpdate); } @@ -1408,7 +1409,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr destroyStreamPartitionOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState); - initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup); + initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup); code = appendDownstream(pOperator, &downstream, 1); return pOperator; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8c04095943..7062b0dd27 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1783,28 +1783,57 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS return TSDB_CODE_SUCCESS; } -static void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { - SExprSupp* pTbNameCalSup = &pInfo->tbnameCalSup; +static void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t rowId) { blockDataCleanup(pInfo->pCreateTbRes); if (pInfo->tbnameCalSup.numOfExprs == 0 && pInfo->tagCalSup.numOfExprs == 0) { pBlock->info.parTbName[0] = 0; } else { appendCreateTableRow(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, &pInfo->tbnameCalSup, &pInfo->tagCalSup, - pBlock->info.id.groupId, pBlock, 0, pInfo->pCreateTbRes, &pInfo->stateStore); + pBlock->info.id.groupId, pBlock, rowId, pInfo->pCreateTbRes, &pInfo->stateStore); } } -static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { - blockDataCleanup(pDestBlock); - int32_t rows = pSrcBlock->info.rows; - if (rows == 0) { - return TSDB_CODE_SUCCESS; - } - int32_t code = blockDataEnsureCapacity(pDestBlock, rows); - if (code != TSDB_CODE_SUCCESS) { - return code; - } +static int32_t generatePartitionDelResBlock(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { + SColumnInfoData* pSrcStartTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); + uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; + SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; + SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; + TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; + int64_t ver = pSrcBlock->info.version - 1; + for (int32_t delI = 0; delI < pSrcBlock->info.rows; delI++) { + uint64_t groupId = 0; + uint64_t srcUid = srcUidData[delI]; + char tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; + SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[delI], srcEndTsCol[delI], ver); + blockDataEnsureCapacity(pDestBlock, pDestBlock->info.rows + pPreRes->info.rows); + for (int32_t preJ = 0; preJ < pPreRes->info.rows; preJ++) { + groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, preJ); + if (pInfo->pPartTbnameSup) { + void* parTbname = NULL; + int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname); + if (code != TSDB_CODE_SUCCESS) { + calBlockTbName(pInfo, pPreRes, preJ); + memcpy(varDataVal(tbname), pPreRes->info.parTbName, strlen(pPreRes->info.parTbName)); + } else { + memcpy(varDataVal(tbname), parTbname, TSDB_TABLE_NAME_LEN); + } + varDataSetLen(tbname, strlen(varDataVal(tbname))); + pInfo->stateStore.streamStateFreeVal(parTbname); + } + appendDataToSpecialBlock(pDestBlock, srcStartTsCol + delI, srcEndTsCol + delI, srcUidData + delI, &groupId, + tbname[0] == 0 ? NULL : tbname); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t generateDeleteResultBlockImpl(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { SColumnInfoData* pSrcStartTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); @@ -1830,12 +1859,11 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS } if (pInfo->tbnameCalSup.pExprInfo) { void* parTbname = NULL; - code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname); + int32_t code = pInfo->stateStore.streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, groupId, &parTbname); if (code != TSDB_CODE_SUCCESS) { - // todo(liuyao) 这里可能需要修改,需要考虑复合主键时,pPreRes包含多行数据。 SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, srcStartTsCol[i], srcStartTsCol[i], ver); printDataBlock(pPreRes, "pre res", GET_TASKID(pInfo->pStreamScanOp->pTaskInfo)); - calBlockTbName(pInfo, pPreRes); + calBlockTbName(pInfo, pPreRes, 0); memcpy(varDataVal(tbname), pPreRes->info.parTbName, strlen(pPreRes->info.parTbName)); } else { memcpy(varDataVal(tbname), parTbname, TSDB_TABLE_NAME_LEN); @@ -1849,6 +1877,22 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS return TSDB_CODE_SUCCESS; } +static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { + blockDataCleanup(pDestBlock); + int32_t rows = pSrcBlock->info.rows; + if (rows == 0) { + return TSDB_CODE_SUCCESS; + } + int32_t code = blockDataEnsureCapacity(pDestBlock, rows); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (pInfo->partitionSup.needCalc) { + return generatePartitionDelResBlock(pInfo, pSrcBlock, pDestBlock); + } + return generateDeleteResultBlockImpl(pInfo, pSrcBlock, pDestBlock); +} + static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, EStreamType type) { int32_t code = TSDB_CODE_SUCCESS; if (isIntervalWindow(pInfo)) { @@ -2120,7 +2164,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock return 0; } - calBlockTbName(pInfo, pInfo->pRes); + calBlockTbName(pInfo, pInfo->pRes, 0); return 0; } @@ -2380,7 +2424,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pInfo->pRecoverRes = doTableScan(pInfo->pTableScanOp); if (pInfo->pRecoverRes != NULL) { - calBlockTbName(pInfo, pInfo->pRecoverRes); + calBlockTbName(pInfo, pInfo->pRecoverRes, 0); if (!pInfo->igCheckUpdate && pInfo->pUpdateInfo) { TSKEY maxTs = pAPI->stateStore.updateInfoFillBlockData(pInfo->pUpdateInfo, pInfo->pRecoverRes, pInfo->primaryTsIndex); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs); @@ -2469,11 +2513,11 @@ FETCH_NEXT_BLOCK: if (!isStreamWindow(pInfo)) { generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes); - pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; - printSpecDataBlock(pDelBlock, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); + pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA; blockDataDestroy(pDelBlock); if (pInfo->pDeleteDataRes->info.rows > 0) { + printSpecDataBlock(pInfo->pDeleteDataRes, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); return pInfo->pDeleteDataRes; } else { goto FETCH_NEXT_BLOCK; @@ -2485,12 +2529,12 @@ FETCH_NEXT_BLOCK: prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex); copyDataBlock(pInfo->pDeleteDataRes, pInfo->pUpdateRes); pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA; - printSpecDataBlock(pDelBlock, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); if (pInfo->tqReader) { blockDataDestroy(pDelBlock); } if (pInfo->pDeleteDataRes->info.rows > 0) { pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE; + printSpecDataBlock(pInfo->pDeleteDataRes, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo)); return pInfo->pDeleteDataRes; } else { goto FETCH_NEXT_BLOCK; @@ -2542,7 +2586,7 @@ FETCH_NEXT_BLOCK: checkUpdateData(pInfo, true, pSDB, false); } printSpecDataBlock(pSDB, getStreamOpName(pOperator->operatorType), "update", GET_TASKID(pTaskInfo)); - calBlockTbName(pInfo, pSDB); + calBlockTbName(pInfo, pSDB, 0); return pSDB; } blockDataCleanup(pInfo->pUpdateDataRes); @@ -2940,6 +2984,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys } } + pInfo->pPartTbnameSup = NULL; if (pTableScanNode->pSubtable != NULL) { SExprInfo* pSubTableExpr = taosMemoryCalloc(1, sizeof(SExprInfo)); if (pSubTableExpr == NULL) { diff --git a/tests/script/tsim/stream/deleteScalar.sim b/tests/script/tsim/stream/deleteScalar.sim new file mode 100644 index 0000000000..c489d1d0d8 --- /dev/null +++ b/tests/script/tsim/stream/deleteScalar.sim @@ -0,0 +1,175 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 1000 +sql connect + +sql drop database if exists test; +sql create database test vgroups 1; +sql use test; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select ts, a, b from t1 partition by a; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +$loop_count = 0 + +loop0: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop1: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 + +if $rows != 3 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop1 +endi + +print ======================step 2 + +sql drop database if exists test1; +sql create database test1 vgroups 1; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 subtable(concat("aaa-", cast( a as varchar(10) ))) as select ts, a, b from t1 partition by a; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +$loop_count = 0 + +loop2: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 6 then + print ======rows=$rows + goto loop2 +endi + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop3: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 + +if $rows != 3 then + print ======rows=$rows + goto loop3 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop3 +endi + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/streamPrimaryKey3.sim b/tests/script/tsim/stream/streamPrimaryKey3.sim index 39d55bda6c..319fa59da6 100644 --- a/tests/script/tsim/stream/streamPrimaryKey3.sim +++ b/tests/script/tsim/stream/streamPrimaryKey3.sim @@ -70,5 +70,36 @@ if $data12 != 4 then goto loop0 endi +sql insert into t1 values(1648791210001,3,1,1,2.0); + +print sql delete from t1 where ts = 1648791210000; +sql delete from t1 where ts = 1648791210000; + +$loop_count = 0 + +loop1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt1 order by 1,2 +sql select * from streamt1 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 1 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 3 then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 28cda4dc815d4243884b01fd96b752fdb1f713f9 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 15:07:26 +0800 Subject: [PATCH 17/64] add ci --- source/libs/executor/src/scanoperator.c | 31 ++++++-- tests/parallel_test/cases.task | 1 + tests/script/tsim/stream/deleteScalar.sim | 89 ++++++++++++++++++++++- 3 files changed, 113 insertions(+), 8 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 7062b0dd27..c0f5ddde7c 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1611,7 +1611,10 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; - SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1671,7 +1674,10 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; - SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1712,7 +1718,10 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); - SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); @@ -1800,7 +1809,10 @@ static int32_t generatePartitionDelResBlock(SStreamScanInfo* pInfo, SSDataBlock* uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; @@ -1840,7 +1852,10 @@ static int32_t generateDeleteResultBlockImpl(SStreamScanInfo* pInfo, SSDataBlock uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - SColumnInfoData* pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; @@ -2513,7 +2528,11 @@ FETCH_NEXT_BLOCK: if (!isStreamWindow(pInfo)) { generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes); - pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA; + if (pInfo->partitionSup.needCalc) { + pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA; + } else { + pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; + } blockDataDestroy(pDelBlock); if (pInfo->pDeleteDataRes->info.rows > 0) { diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 107435fb4e..96c48c738d 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1220,6 +1220,7 @@ ,,y,script,./test.sh -f tsim/stream/countSliding1.sim ,,y,script,./test.sh -f tsim/stream/countSliding2.sim ,,y,script,./test.sh -f tsim/stream/deleteInterval.sim +,,y,script,./test.sh -f tsim/stream/deleteScalar.sim ,,y,script,./test.sh -f tsim/stream/deleteSession.sim ,,y,script,./test.sh -f tsim/stream/deleteState.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim diff --git a/tests/script/tsim/stream/deleteScalar.sim b/tests/script/tsim/stream/deleteScalar.sim index c489d1d0d8..9a634a5c2d 100644 --- a/tests/script/tsim/stream/deleteScalar.sim +++ b/tests/script/tsim/stream/deleteScalar.sim @@ -5,7 +5,7 @@ sleep 1000 sql connect sql drop database if exists test; -sql create database test vgroups 1; +sql create database test vgroups 4; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); sql create stream streams0 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select ts, a, b from t1 partition by a; @@ -89,7 +89,7 @@ endi print ======================step 2 sql drop database if exists test1; -sql create database test1 vgroups 1; +sql create database test1 vgroups 4; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 subtable(concat("aaa-", cast( a as varchar(10) ))) as select ts, a, b from t1 partition by a; @@ -170,6 +170,91 @@ if $data21 != 2 then goto loop3 endi +print ======================step 3 + +sql drop database if exists test1; +sql create database test2 vgroups 4; +sql use test2; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 subtable("aaa-a") as select ts, a, b from t1; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +$loop_count = 0 + +loop4: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 +print $data50 $data51 $data52 +print $data60 $data61 $data62 +print $data70 $data71 $data72 + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop5: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt2 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop5 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop5 +endi + system sh/stop_dnodes.sh #goto looptest \ No newline at end of file From d7fe41d05f325eaa3d83e4cab27563bba42282e4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 16:04:35 +0800 Subject: [PATCH 18/64] add ci --- .../script/tsim/stream/streamPrimaryKey3.sim | 104 +++++++++++++++++- 1 file changed, 98 insertions(+), 6 deletions(-) diff --git a/tests/script/tsim/stream/streamPrimaryKey3.sim b/tests/script/tsim/stream/streamPrimaryKey3.sim index 319fa59da6..367060a92d 100644 --- a/tests/script/tsim/stream/streamPrimaryKey3.sim +++ b/tests/script/tsim/stream/streamPrimaryKey3.sim @@ -70,10 +70,24 @@ if $data12 != 4 then goto loop0 endi -sql insert into t1 values(1648791210001,3,1,1,2.0); +print step2============= + +sql create database test1 vgroups 4; +sql use test1; +sql create table st(ts timestamp, a int primary key, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); + +sql create stream streams2 trigger at_once ignore expired 0 ignore update 0 into streamt2(ts, a primary key, b) as select _wstart, max(b), count(*) from t1 partition by b interval(10s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,1,1.0); +sql insert into t1 values(1648791210000,2,4,2,1.0); + +sleep 500 + +sql insert into t1 values(1648791210000,1,3,3,1.0); -print sql delete from t1 where ts = 1648791210000; -sql delete from t1 where ts = 1648791210000; $loop_count = 0 @@ -86,20 +100,98 @@ if $loop_count == 10 then return -1 endi -print 1 select * from streamt1 order by 1,2 -sql select * from streamt1 order by 1,2; +print 1 select * from streamt2 order by 1,2 +sql select * from streamt2 order by 1,2; print $data00 $data01 $data02 print $data10 $data11 $data12 print $data20 $data21 $data22 -if $rows != 1 then +if $rows != 2 then print =====rows=$rows goto loop1 endi if $data01 != 3 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop1 +endi + +if $data11 != 4 then + print =====data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop1 +endi + +print step3============= + +sql create database test2 vgroups 4; +sql use test2; +sql create table st(ts timestamp, a int primary key, b int , c int, d double) tags(ta varchar(100),tb int,tc int); +sql create table t1 using st tags("aa", 1, 2); + +sql create stream streams3 trigger at_once ignore expired 0 ignore update 0 into streamt3(ts, a primary key, b) as select _wstart, max(b), count(*) from t1 partition by b session(ts, 10s); + +sleep 1000 + +sql insert into t1 values(1648791210000,1,2,1,1.0); +sql insert into t1 values(1648791210000,2,4,2,1.0); + +sleep 500 + +sql insert into t1 values(1648791210000,1,3,3,1.0); + + +$loop_count = 0 + +loop2: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then return -1 endi +print 1 select * from streamt3 order by 1,2 +sql select * from streamt3 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 2 then + print =====rows=$rows + goto loop2 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop2 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop2 +endi + +if $data11 != 4 then + print =====data11=$data11 + goto loop2 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop2 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From ffeabb132a77525d9f8237c71c1e898f244f6af8 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 18:18:06 +0800 Subject: [PATCH 19/64] fix issue --- source/libs/parser/src/parTranslater.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2163113a66..a3d64f59b0 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5861,12 +5861,17 @@ static int32_t translateTrimDatabase(STranslateContext* pCxt, STrimDatabaseStmt* return buildCmdMsg(pCxt, TDMT_MND_TRIM_DB, (FSerializeFunc)tSerializeSTrimDbReq, &req); } -static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray) { +static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) { *pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SField)); SNode* pNode; FOREACH(pNode, pList) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; - SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)}; + SField field = {.type = pCol->dataType.type,}; + if (calBytes) { + field.bytes = calcTypeBytes(pCol->dataType); + } else { + field.bytes = pCol->dataType.bytes; + } strcpy(field.name, pCol->colName); if (pCol->sma) { field.flags |= COL_SMA_ON; @@ -6575,8 +6580,8 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm pReq->colVer = 1; pReq->tagVer = 1; pReq->source = TD_REQ_FROM_APP; - columnDefNodeToField(pStmt->pCols, &pReq->pColumns); - columnDefNodeToField(pStmt->pTags, &pReq->pTags); + columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true); + columnDefNodeToField(pStmt->pTags, &pReq->pTags, true); pReq->numOfColumns = LIST_LENGTH(pStmt->pCols); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); if (pStmt->pOptions->commentNull == false) { @@ -8640,10 +8645,10 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pReq->fillHistory = pStmt->pOptions->fillHistory; pReq->igExpired = pStmt->pOptions->ignoreExpired; if (pReq->createStb) { - columnDefNodeToField(pStmt->pTags, &pReq->pTags); + columnDefNodeToField(pStmt->pTags, &pReq->pTags, true); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); } - columnDefNodeToField(pStmt->pCols, &pReq->pCols); + columnDefNodeToField(pStmt->pCols, &pReq->pCols, false); pReq->igUpdate = pStmt->pOptions->ignoreUpdate; } From ea33f08d02b1f4b72555d9b1400af45a42acf886 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 29 Mar 2024 13:52:56 +0800 Subject: [PATCH 20/64] add ic --- source/libs/executor/src/scanoperator.c | 99 +++++++------ tests/parallel_test/cases.task | 1 + .../tsim/stream/partitionbyColumnInterval.sim | 64 ++++++++- .../tsim/stream/partitionbyColumnOther.sim | 130 ++++++++++++++++++ .../tsim/stream/partitionbyColumnSession.sim | 63 ++++++++- .../tsim/stream/partitionbyColumnState.sim | 63 ++++++++- 6 files changed, 366 insertions(+), 54 deletions(-) create mode 100644 tests/script/tsim/stream/partitionbyColumnOther.sim diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index c0f5ddde7c..8d93cbb001 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1595,16 +1595,29 @@ static int32_t getPreSessionWindow(SStreamAggSupporter* pAggSup, TSKEY startTs, return code; } +static void getPreVersionDataBlock(uint64_t uid, TSKEY startTs, TSKEY endTs, int64_t version, char* taskIdStr, + SStreamScanInfo* pInfo, SSDataBlock* pBlock) { + SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uid, startTs, endTs, version); + printDataBlock(pPreRes, "pre res", taskIdStr); + blockDataCleanup(pBlock); + int32_t code = blockDataEnsureCapacity(pBlock, pPreRes->info.rows); + if (code != TSDB_CODE_SUCCESS) { + return ; + } + + SColumnInfoData* pTsCol = (SColumnInfoData*)taosArrayGet(pPreRes->pDataBlock, pInfo->primaryTsIndex); + for (int32_t i = 0; i < pPreRes->info.rows; i++) { + uint64_t groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, i); + appendDataToSpecialBlock(pBlock, ((TSKEY*)pTsCol->pData) + i, ((TSKEY*)pTsCol->pData) + i, &uid, &groupId, NULL); + } + printDataBlock(pBlock, "new delete", taskIdStr); +} + static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { - blockDataCleanup(pDestBlock); if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } - int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); + SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1612,9 +1625,22 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; SColumnInfoData* pSrcPkCol = NULL; - if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); } + int64_t ver = pSrcBlock->info.version - 1; + + if (pInfo->partitionSup.needCalc && (startData[0] != endData[0] || hasPrimaryKey(pInfo))) { + getPreVersionDataBlock(uidCol[0], startData[0], endData[0], ver, GET_TASKID(pTaskInfo), pInfo, pSrcBlock); + startData = (TSKEY*)pStartTsCol->pData; + endData = (TSKEY*)pEndTsCol->pData; + uidCol = (uint64_t*)pUidCol->pData; + } + blockDataCleanup(pDestBlock); + int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); + if (code != TSDB_CODE_SUCCESS) { + return code; + } SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1622,7 +1648,6 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - int64_t ver = pSrcBlock->info.version - 1; for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { void* pVal = NULL; if (hasPrimaryKey(pInfo)) { @@ -1663,11 +1688,7 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } - int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); + SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1678,6 +1699,19 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); } + int64_t ver = pSrcBlock->info.version - 1; + + if (pInfo->partitionSup.needCalc && (startData[0] != endData[0] || hasPrimaryKey(pInfo))) { + getPreVersionDataBlock(uidCol[0], startData[0], endData[0], ver, GET_TASKID(pTaskInfo), pInfo, pSrcBlock); + startData = (TSKEY*)pStartTsCol->pData; + endData = (TSKEY*)pEndTsCol->pData; + uidCol = (uint64_t*)pUidCol->pData; + } + + int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); + if (code != TSDB_CODE_SUCCESS) { + return code; + } SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1685,7 +1719,6 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - int64_t ver = pSrcBlock->info.version - 1; for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { void* pVal = NULL; if (hasPrimaryKey(pInfo)) { @@ -1709,8 +1742,7 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) { blockDataCleanup(pDestBlock); - int32_t rows = pSrcBlock->info.rows; - if (rows == 0) { + if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; @@ -1729,34 +1761,15 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; int64_t ver = pSrcBlock->info.version - 1; - if (pInfo->partitionSup.needCalc && srcStartTsCol[0] != srcEndTsCol[0]) { - uint64_t srcUid = srcUidData[0]; - TSKEY startTs = srcStartTsCol[0]; - TSKEY endTs = srcEndTsCol[0]; - SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, srcUid, startTs, endTs, ver); - printDataBlock(pPreRes, "pre res", GET_TASKID(pTaskInfo)); - blockDataCleanup(pSrcBlock); - int32_t code = blockDataEnsureCapacity(pSrcBlock, pPreRes->info.rows); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - SColumnInfoData* pTsCol = (SColumnInfoData*)taosArrayGet(pPreRes->pDataBlock, pInfo->primaryTsIndex); - rows = pPreRes->info.rows; - - for (int32_t i = 0; i < rows; i++) { - uint64_t groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, i); - appendDataToSpecialBlock(pSrcBlock, ((TSKEY*)pTsCol->pData) + i, ((TSKEY*)pTsCol->pData) + i, &srcUid, - &groupId, NULL); - } - printDataBlock(pSrcBlock, "new delete", GET_TASKID(pTaskInfo)); + if (pInfo->partitionSup.needCalc && (srcStartTsCol[0] != srcEndTsCol[0] || hasPrimaryKey(pInfo))) { + getPreVersionDataBlock(srcUidData[0], srcStartTsCol[0], srcEndTsCol[0], ver, GET_TASKID(pTaskInfo), pInfo, pSrcBlock); + srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; + srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; + srcUidData = (uint64_t*)pSrcUidCol->pData; } - uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; - srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; - srcUidData = (uint64_t*)pSrcUidCol->pData; - int32_t code = blockDataEnsureCapacity(pDestBlock, rows); + uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; + int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1767,7 +1780,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - for (int32_t i = 0; i < rows;) { + for (int32_t i = 0; i < pSrcBlock->info.rows;) { uint64_t srcUid = srcUidData[i]; uint64_t groupId = srcGp[i]; if (groupId == 0) { diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 96c48c738d..aaa0ffc7e7 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1246,6 +1246,7 @@ ,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/partitionby1.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim +,,y,script,./test.sh -f tsim/stream/partitionbyColumnOther.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnState.sim ,,y,script,./test.sh -f tsim/stream/partitionby.sim diff --git a/tests/script/tsim/stream/partitionbyColumnInterval.sim b/tests/script/tsim/stream/partitionbyColumnInterval.sim index d5f815d533..cc70242172 100644 --- a/tests/script/tsim/stream/partitionbyColumnInterval.sim +++ b/tests/script/tsim/stream/partitionbyColumnInterval.sim @@ -1,6 +1,3 @@ -$loop_all = 0 -looptest: - system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start @@ -660,8 +657,65 @@ if $rows != 4 then #goto loop17 endi -$loop_all = $loop_all + 1 -print ============loop_all=$loop_all +print ================step2 +sql drop database if exists test1; +sql create database test6 vgroups 4; +sql use test6; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a interval(10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop18: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop18 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop18 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop18 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop18 +endi + +print ========over system sh/stop_dnodes.sh diff --git a/tests/script/tsim/stream/partitionbyColumnOther.sim b/tests/script/tsim/stream/partitionbyColumnOther.sim new file mode 100644 index 0000000000..8e6c0c1f23 --- /dev/null +++ b/tests/script/tsim/stream/partitionbyColumnOther.sim @@ -0,0 +1,130 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print ================step1 +sql drop database if exists test1; +sql create database test0 vgroups 4; +sql use test0; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams0 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 watermark 100s into streamt0 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a count_window(10); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop0: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt0 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop0 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop0 +endi + +print ================step1 +sql drop database if exists test1; +sql create database test1 vgroups 4; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a event_window start with b = 2 end with b = 2; + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop1: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop1 +endi + +print ========over + +system sh/stop_dnodes.sh + +#goto looptest diff --git a/tests/script/tsim/stream/partitionbyColumnSession.sim b/tests/script/tsim/stream/partitionbyColumnSession.sim index a22e36e499..1daa033399 100644 --- a/tests/script/tsim/stream/partitionbyColumnSession.sim +++ b/tests/script/tsim/stream/partitionbyColumnSession.sim @@ -561,9 +561,66 @@ if $data21 != 1 then goto loop14 endi +print ================step2 +sql drop database if exists test5; +sql create database test5 vgroups 4; +sql use test5; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a session(ts, 10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop15: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop15 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop15 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop15 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop15 +endi + +print ========over + system sh/stop_dnodes.sh -$loop_all = $loop_all + 1 -print ============loop_all=$loop_all - #goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/partitionbyColumnState.sim b/tests/script/tsim/stream/partitionbyColumnState.sim index 8435e753d4..d741426786 100644 --- a/tests/script/tsim/stream/partitionbyColumnState.sim +++ b/tests/script/tsim/stream/partitionbyColumnState.sim @@ -266,9 +266,66 @@ if $data32 != 8 then goto loop6 endi +print ================step2 +sql drop database if exists test2; +sql create database test2 vgroups 4; +sql use test2; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 subtable("aaa-a") as select _wstart, count(*) from t1 partition by a session(ts, 10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,0,2,3,1.0); +sql insert into t1 values(1648791213001,1,2,3,1.0); +sql insert into t1 values(1648791213002,2,2,3,1.0); + +sql insert into t1 values(1648791213003,0,2,3,1.0); +sql insert into t1 values(1648791213004,1,2,3,1.0); +sql insert into t1 values(1648791213005,2,2,3,1.0); + +print delete from t1 where ts <= 1648791213002; +sql delete from t1 where ts <= 1648791213002; + +$loop_count = 0 + +loop7: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by 1; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 +print $data40 $data41 $data42 + +if $rows != 3 then + print ======rows=$rows + goto loop7 +endi + +if $data01 != 1 then + print ======data01=$data01 + goto loop7 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop7 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop7 +endi + +print ========over + system sh/stop_dnodes.sh -$loop_all = $loop_all + 1 -print ============loop_all=$loop_all - #goto looptest From 603e856c033aeb30622616edc34e462985ed05ee Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 29 Mar 2024 16:38:10 +0800 Subject: [PATCH 21/64] add ci --- .../script/tsim/stream/streamPrimaryKey3.sim | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/script/tsim/stream/streamPrimaryKey3.sim b/tests/script/tsim/stream/streamPrimaryKey3.sim index 367060a92d..16b05d02ae 100644 --- a/tests/script/tsim/stream/streamPrimaryKey3.sim +++ b/tests/script/tsim/stream/streamPrimaryKey3.sim @@ -132,6 +132,91 @@ if $data12 != 1 then goto loop1 endi +sql insert into t1 values(1648791210000,3,5,3,1.0); + +sql insert into t1 values(1648791210001,1,3,3,1.0); +sql insert into t1 values(1648791210001,2,4,3,1.0); +sql insert into t1 values(1648791210001,3,5,3,1.0); + +$loop_count = 0 + +loop2: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt2 order by 1,2 +sql select * from streamt2 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 3 then + print =====rows=$rows + goto loop2 +endi + +if $data02 != 2 then + print =====data02=$data02 + goto loop2 +endi + +if $data12 != 2 then + print =====data12=$data12 + goto loop2 +endi + +if $data22 != 2 then + print =====data22=$data22 + goto loop2 +endi + +print delete from t1 where ts = 1648791210000; +sql delete from t1 where ts = 1648791210000; + +$loop_count = 0 + +loop3: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt2 order by 1,2 +sql select * from streamt2 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 3 then + print =====rows=$rows + goto loop3 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop3 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop3 +endi + +if $data22 != 1 then + print =====data22=$data22 + goto loop3 +endi + print step3============= sql create database test2 vgroups 4; From a65ce818deeeeb3dcd3e6830668e39e41d1b82c4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 1 Apr 2024 16:20:45 +0800 Subject: [PATCH 22/64] add ci --- source/libs/executor/src/scanoperator.c | 100 +++++++++------- tests/parallel_test/cases.task | 1 + .../script/tsim/stream/streamPrimaryKey3.sim | 112 ++++++++++++++++-- 3 files changed, 158 insertions(+), 55 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8d93cbb001..fefc1d6b79 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1595,6 +1595,39 @@ static int32_t getPreSessionWindow(SStreamAggSupporter* pAggSup, TSKEY startTs, return code; } +void appendOneRowToSpecialBlockImpl(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, + TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName, void* pPkData) { + SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX); + SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); + SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); + SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); + colDataSetVal(pStartTsCol, pBlock->info.rows, (const char*)pStartTs, false); + colDataSetVal(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false); + colDataSetVal(pUidCol, pBlock->info.rows, (const char*)pUid, false); + colDataSetVal(pGpCol, pBlock->info.rows, (const char*)pGp, false); + colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pCalStartTs, false); + colDataSetVal(pCalEndCol, pBlock->info.rows, (const char*)pCalEndTs, false); + colDataSetVal(pTableCol, pBlock->info.rows, (const char*)pTbName, pTbName == NULL); + if (taosArrayGetSize(pBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { + SColumnInfoData* pPkCol = taosArrayGet(pBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + colDataSetVal(pPkCol, pBlock->info.rows, (const char*)pPkData, pPkData == NULL); + } + pBlock->info.rows++; +} + +void appendPkToSpecialBlock(SSDataBlock* pBlock, TSKEY* pTsArray, SColumnInfoData* pPkCol, int32_t rowId, + uint64_t* pUid, uint64_t* pGp, void* pTbName) { + void* pVal = NULL; + if (pPkCol) { + pVal = colDataGetData(pPkCol, rowId); + } + appendOneRowToSpecialBlockImpl(pBlock, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pUid, + pGp, pTbName, pVal); +} + static void getPreVersionDataBlock(uint64_t uid, TSKEY startTs, TSKEY endTs, int64_t version, char* taskIdStr, SStreamScanInfo* pInfo, SSDataBlock* pBlock) { SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uid, startTs, endTs, version); @@ -1606,9 +1639,13 @@ static void getPreVersionDataBlock(uint64_t uid, TSKEY startTs, TSKEY endTs, int } SColumnInfoData* pTsCol = (SColumnInfoData*)taosArrayGet(pPreRes->pDataBlock, pInfo->primaryTsIndex); + SColumnInfoData* pPkCol = NULL; + if (hasPrimaryKey(pInfo)) { + pPkCol = (SColumnInfoData*)taosArrayGet(pPreRes->pDataBlock, pInfo->primaryKeyIndex); + } for (int32_t i = 0; i < pPreRes->info.rows; i++) { uint64_t groupId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, i); - appendDataToSpecialBlock(pBlock, ((TSKEY*)pTsCol->pData) + i, ((TSKEY*)pTsCol->pData) + i, &uid, &groupId, NULL); + appendPkToSpecialBlock(pBlock, (TSKEY*)pTsCol->pData, pPkCol, i, &uid, &groupId, NULL); } printDataBlock(pBlock, "new delete", taskIdStr); } @@ -1624,7 +1661,9 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; + SColumnInfoData* pGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pSrcPkCol = NULL; + uint64_t* pSrcGp = (uint64_t*)pGpCol->pData; if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); } @@ -1635,6 +1674,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr startData = (TSKEY*)pStartTsCol->pData; endData = (TSKEY*)pEndTsCol->pData; uidCol = (uint64_t*)pUidCol->pData; + pSrcGp = (uint64_t*)pGpCol->pData; } blockDataCleanup(pDestBlock); int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); @@ -1649,11 +1689,14 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { - void* pVal = NULL; - if (hasPrimaryKey(pInfo)) { - pVal = colDataGetData(pSrcPkCol, i); + uint64_t groupId = pSrcGp[i]; + if (groupId == 0) { + void* pVal = NULL; + if (hasPrimaryKey(pInfo)) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); } - uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); // gap must be 0. SSessionKey startWin = {0}; getCurSessionWindow(pInfo->windowSup.pStreamAggSup, startData[i], startData[i], groupId, &startWin); @@ -1695,6 +1738,8 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB TSKEY* endData = (TSKEY*)pEndTsCol->pData; SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); uint64_t* uidCol = (uint64_t*)pUidCol->pData; + SColumnInfoData* pGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* pSrcGp = (uint64_t*)pGpCol->pData; SColumnInfoData* pSrcPkCol = NULL; if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); @@ -1706,6 +1751,7 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB startData = (TSKEY*)pStartTsCol->pData; endData = (TSKEY*)pEndTsCol->pData; uidCol = (uint64_t*)pUidCol->pData; + pSrcGp = (uint64_t*)pGpCol->pData; } int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); @@ -1720,11 +1766,14 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { - void* pVal = NULL; - if (hasPrimaryKey(pInfo)) { - pVal = colDataGetData(pSrcPkCol, i); + uint64_t groupId = pSrcGp[i]; + if (groupId == 0) { + void* pVal = NULL; + if (hasPrimaryKey(pInfo)) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); } - uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); SSessionKey startWin = {.win.skey = startData[i], .win.ekey = endData[i], .groupId = groupId}; SSessionKey range = {0}; getCountWinRange(pInfo->windowSup.pStreamAggSup, &startWin, mode, &range); @@ -1939,39 +1988,6 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, return code; } -void appendOneRowToSpecialBlockImpl(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs, - TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName, void* pPkData) { - SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); - SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); - SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX); - SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); - SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); - SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); - colDataSetVal(pStartTsCol, pBlock->info.rows, (const char*)pStartTs, false); - colDataSetVal(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false); - colDataSetVal(pUidCol, pBlock->info.rows, (const char*)pUid, false); - colDataSetVal(pGpCol, pBlock->info.rows, (const char*)pGp, false); - colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pCalStartTs, false); - colDataSetVal(pCalEndCol, pBlock->info.rows, (const char*)pCalEndTs, false); - colDataSetVal(pTableCol, pBlock->info.rows, (const char*)pTbName, pTbName == NULL); - if (taosArrayGetSize(pBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { - SColumnInfoData* pPkCol = taosArrayGet(pBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); - colDataSetVal(pPkCol, pBlock->info.rows, (const char*)pPkData, pPkData == NULL); - } - pBlock->info.rows++; -} - -void appendPkToSpecialBlock(SSDataBlock* pBlock, TSKEY* pTsArray, SColumnInfoData* pPkCol, int32_t rowId, - uint64_t* pUid, uint64_t* pGp, void* pTbName) { - void* pVal = NULL; - if (pPkCol) { - pVal = colDataGetData(pPkCol, rowId); - } - appendOneRowToSpecialBlockImpl(pBlock, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pTsArray + rowId, pUid, - pGp, pTbName, pVal); -} - void appendDataToSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName) { appendOneRowToSpecialBlockImpl(pBlock, pStartTs, pEndTs, pStartTs, pEndTs, pUid, pGp, pTbName, NULL); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 48ee9137f6..89926b1041 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1262,6 +1262,7 @@ ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey0.sim ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey1.sim ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey2.sim +,,y,script,./test.sh -f tsim/stream/streamPrimaryKey3.sim ,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,y,script,./test.sh -f tsim/stream/triggerSession0.sim ,,y,script,./test.sh -f tsim/stream/udTableAndCol0.sim diff --git a/tests/script/tsim/stream/streamPrimaryKey3.sim b/tests/script/tsim/stream/streamPrimaryKey3.sim index 16b05d02ae..73038b6732 100644 --- a/tests/script/tsim/stream/streamPrimaryKey3.sim +++ b/tests/script/tsim/stream/streamPrimaryKey3.sim @@ -238,7 +238,57 @@ sql insert into t1 values(1648791210000,1,3,3,1.0); $loop_count = 0 -loop2: +loop6: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 order by 1,2 +sql select * from streamt3 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 +print $data30 $data31 $data32 + +if $rows != 2 then + print =====rows=$rows + goto loop6 +endi + +if $data01 != 3 then + print =====data01=$data01 + goto loop6 +endi + +if $data02 != 1 then + print =====data02=$data02 + goto loop6 +endi + +if $data11 != 4 then + print =====data11=$data11 + goto loop6 +endi + +if $data12 != 1 then + print =====data12=$data12 + goto loop6 +endi + +sql insert into t1 values(1648791210000,3,5,3,1.0); + +sql insert into t1 values(1648791210001,1,3,3,1.0); +sql insert into t1 values(1648791210001,2,4,3,1.0); +sql insert into t1 values(1648791210001,3,5,3,1.0); + +$loop_count = 0 + +loop7: sleep 200 @@ -254,29 +304,65 @@ print $data00 $data01 $data02 print $data10 $data11 $data12 print $data20 $data21 $data22 -if $rows != 2 then +if $rows != 3 then print =====rows=$rows - goto loop2 + goto loop7 endi -if $data01 != 3 then - print =====data01=$data01 - goto loop2 +if $data02 != 2 then + print =====data02=$data02 + goto loop7 +endi + +if $data12 != 2 then + print =====data12=$data12 + goto loop7 +endi + +if $data22 != 2 then + print =====data22=$data22 + goto loop7 +endi + +print delete from t1 where ts = 1648791210000; +sql delete from t1 where ts = 1648791210000; + +$loop_count = 0 + +loop8: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt3 order by 1,2 +sql select * from streamt3 order by 1,2; + +print $data00 $data01 $data02 +print $data10 $data11 $data12 +print $data20 $data21 $data22 + +if $rows != 3 then + print =====rows=$rows + goto loop8 endi if $data02 != 1 then print =====data02=$data02 - goto loop2 -endi - -if $data11 != 4 then - print =====data11=$data11 - goto loop2 + goto loop8 endi if $data12 != 1 then print =====data12=$data12 - goto loop2 + goto loop8 +endi + +if $data22 != 1 then + print =====data22=$data22 + goto loop8 endi system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 3257c7c08216af559cf6a7aa656719380e630d61 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Mon, 1 Apr 2024 19:44:26 +0800 Subject: [PATCH 23/64] fix: tag is null when table is empty --- source/libs/executor/src/executil.c | 3 +++ source/libs/executor/src/scanoperator.c | 5 +++-- source/libs/parser/src/parTranslater.c | 22 +++++++++++++++++----- source/libs/planner/src/planLogicCreater.c | 3 +++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index bb89fb587b..1d58666625 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -2132,6 +2132,9 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* } pTableListInfo->oneTableForEachGroup = groupByTbname; + if (numOfTables == 1 && pTableListInfo->idInfo.tableType == TSDB_CHILD_TABLE) { + pTableListInfo->oneTableForEachGroup = true; + } if (groupSort && groupByTbname) { taosArraySort(pTableListInfo->pTableList, orderbyGroupIdComparFn); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 51edfcb42c..49006186bb 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -889,14 +889,15 @@ static SSDataBlock* doGroupedTableScan(SOperatorInfo* pOperator) { if (pTableScanInfo->countState < TABLE_COUNT_STATE_END) { STableListInfo* pTableListInfo = pTableScanInfo->base.pTableListInfo; - if (pTableListInfo->oneTableForEachGroup || pTableListInfo->groupOffset) { // group by tbname, group by tag + sort + if (pTableListInfo->oneTableForEachGroup || pTableListInfo->groupOffset) { // group by tbname, group by tag + sort if (pTableScanInfo->countState < TABLE_COUNT_STATE_PROCESSED) { pTableScanInfo->countState = TABLE_COUNT_STATE_PROCESSED; STableKeyInfo* pStart = (STableKeyInfo*)tableListGetInfo(pTableScanInfo->base.pTableListInfo, pTableScanInfo->tableStartIndex); + if (NULL == pStart) return NULL; return getBlockForEmptyTable(pOperator, pStart); } - } else { // group by tag + no sort + } else { // group by tag + no sort int32_t numOfTables = tableListGetSize(pTableListInfo); if (pTableScanInfo->tableEndIndex + 1 >= numOfTables) { // get empty group, mark processed & rm from hash diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 6e34ab1b3b..72cc2df632 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2702,6 +2702,15 @@ static bool hasTbnameFunction(SNodeList* pPartitionByList) { return false; } +static bool fromSubtable(SNode* table) { + if (NULL == table) return false; + if (table->type == QUERY_NODE_REAL_TABLE && ((SRealTableNode*)table)->pMeta && + ((SRealTableNode*)table)->pMeta->tableType == TSDB_CHILD_TABLE) { + return true; + } + return false; +} + static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { STranslateContext* pCxt = (STranslateContext*)pContext; SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt; @@ -2795,15 +2804,18 @@ static EDealRes doCheckAggColCoexist(SNode** pNode, void* pContext) { return DEAL_RES_IGNORE_CHILD; } SNode* pPartKey = NULL; - bool partionByTbname = hasTbnameFunction(((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pPartitionByList); + bool partionByTbname = false; + if (fromSubtable(((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pFromTable) || + hasTbnameFunction(((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pPartitionByList)) { + partionByTbname = true; + } FOREACH(pPartKey, ((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pPartitionByList) { if (nodesEqualNode(pPartKey, *pNode)) { return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode); } - if (partionByTbname && QUERY_NODE_COLUMN == nodeType(*pNode) && - ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) { - return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode); - } + } + if (partionByTbname && QUERY_NODE_COLUMN == nodeType(*pNode) && ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) { + return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode); } if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) { pCxt->existCol = true; diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index c34d8ac64f..7ce623e788 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -494,6 +494,9 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect } else if (pSelect->pPartitionByList) { isCountByTag = !keysHasCol(pSelect->pPartitionByList); } + if (pScan->tableType == TSDB_CHILD_TABLE) { + isCountByTag = true; + } } pScan->isCountByTag = isCountByTag; From 588f05c7dda0ced63daba9767e22570f3a638b20 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 2 Apr 2024 08:49:48 +0000 Subject: [PATCH 24/64] port main to 30 --- source/libs/scheduler/src/schRemote.c | 2 +- source/libs/scheduler/src/schTask.c | 23 ++- source/libs/transport/inc/transComm.h | 13 +- source/libs/transport/src/transCli.c | 195 +++++++++++++++++--------- source/libs/transport/src/transSvr.c | 7 +- 5 files changed, 155 insertions(+), 85 deletions(-) diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index aa33d6f2fc..980b9aa6bf 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -1181,7 +1181,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, qMsg.queryId = pJob->queryId; qMsg.taskId = pTask->taskId; qMsg.refId = pJob->refId; - qMsg.execId = pTask->execId; + qMsg.execId = *(int32_t*)param; msgSize = tSerializeSTaskDropReq(NULL, 0, &qMsg); if (msgSize < 0) { diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index d96c01fc76..97c3c7d276 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -371,14 +371,13 @@ int32_t schChkUpdateRedirectCtx(SSchJob *pJob, SSchTask *pTask, SEpSet *pEpSet, pCtx->roundTotal = pEpSet->numOfEps; } - if (pCtx->roundTimes >= pCtx->roundTotal) { int64_t nowTs = taosGetTimestampMs(); int64_t lastTime = nowTs - pCtx->startTs; if (lastTime > tsMaxRetryWaitTime) { SCH_TASK_DLOG("task no more redirect retry since timeout, now:%" PRId64 ", start:%" PRId64 ", max:%d, total:%d", nowTs, pCtx->startTs, tsMaxRetryWaitTime, pCtx->totalTimes); - pJob->noMoreRetry = true; + pJob->noMoreRetry = true; SCH_ERR_RET(SCH_GET_REDIRECT_CODE(pJob, rspCode)); } @@ -418,7 +417,7 @@ void schResetTaskForRetry(SSchJob *pJob, SSchTask *pTask) { taosMemoryFreeClear(pTask->msg); pTask->msgLen = 0; pTask->lastMsgType = 0; - pTask->childReady = 0; + pTask->childReady = 0; memset(&pTask->succeedAddr, 0, sizeof(pTask->succeedAddr)); } @@ -505,11 +504,11 @@ int32_t schHandleTaskSetRetry(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, i pLevel->taskExecDoneNum = 0; pLevel->taskLaunchedNum = 0; } - + SCH_RESET_JOB_LEVEL_IDX(pJob); - + code = schDoTaskRedirect(pJob, pTask, pData, rspCode); - + taosMemoryFreeClear(pData->pData); taosMemoryFreeClear(pData->pEpSet); @@ -627,7 +626,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo pTask->maxRetryTimes); return TSDB_CODE_SUCCESS; } - + if (TSDB_CODE_SCH_TIMEOUT_ERROR == errCode) { pTask->maxExecTimes++; pTask->maxRetryTimes++; @@ -862,7 +861,9 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { while (nodeInfo) { if (nodeInfo->handle) { SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); - schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK, NULL); + void *pExecId = taosHashGetKey(nodeInfo, NULL); + schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK, pExecId); + SCH_TASK_DLOG("start to drop task's %dth execNode", i); } else { SCH_TASK_DLOG("no need to drop task %dth execNode", i); @@ -901,7 +902,6 @@ int32_t schNotifyTaskOnExecNode(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType return TSDB_CODE_SUCCESS; } - int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) { int32_t taskNum = (int32_t)taosArrayGetSize(pStatusList); SSchTask *pTask = NULL; @@ -1269,7 +1269,7 @@ int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType t int32_t code = TSDB_CODE_SUCCESS; SCH_ERR_RET(schNotifyTaskOnExecNode(pJob, pCurrTask, type)); - + void *pIter = taosHashIterate(list, NULL); while (pIter) { SSchTask *pTask = *(SSchTask **)pIter; @@ -1277,7 +1277,7 @@ int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType t SCH_LOCK_TASK(pTask); code = schNotifyTaskOnExecNode(pJob, pTask, type); SCH_UNLOCK_TASK(pTask); - + if (TSDB_CODE_SUCCESS != code) { break; } @@ -1289,7 +1289,6 @@ int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType t SCH_RET(code); } - int32_t schExecRemoteFetch(SSchJob *pJob, SSchTask *pTask) { SCH_RET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask), NULL)); } diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index c010e31320..da6d71e07b 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -19,16 +19,12 @@ extern "C" { #endif #include -#include "os.h" -#include "taoserror.h" #include "theap.h" -#include "tmisce.h" #include "tmsg.h" #include "transLog.h" #include "transportInt.h" #include "trpc.h" #include "ttrace.h" -#include "tutil.h" typedef bool (*FilteFunc)(void* arg); @@ -115,9 +111,12 @@ typedef SRpcConnInfo STransHandleInfo; // ref mgt handle typedef struct SExHandle { - void* handle; - int64_t refId; - void* pThrd; + void* handle; + int64_t refId; + void* pThrd; + queue q; + int8_t inited; + SRWLatch latch; } SExHandle; typedef struct { diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 2d8f4ed3c2..062609baac 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -92,6 +92,7 @@ typedef struct SCliMsg { int64_t refId; uint64_t st; int sent; //(0: no send, 1: alread sent) + queue seqq; } SCliMsg; typedef struct SCliThrd { @@ -121,11 +122,7 @@ typedef struct SCliThrd { SHashObj* batchCache; SCliMsg* stopMsg; - - bool quit; - - int newConnCount; - SHashObj* msgCount; + bool quit; } SCliThrd; typedef struct SCliObj { @@ -262,10 +259,8 @@ static void cliWalkCb(uv_handle_t* handle, void* arg); } \ if (i == sz) { \ pMsg = NULL; \ - tDebug("msg not found, %" PRIu64 "", ahandle); \ } else { \ pMsg = transQueueRm(&conn->cliMsgs, i); \ - tDebug("msg found, %" PRIu64 "", ahandle); \ } \ } while (0) @@ -343,6 +338,34 @@ bool cliMaySendCachedMsg(SCliConn* conn) { _RETURN: return false; } +bool cliConnSendSeqMsg(int64_t refId, SCliConn* conn) { + if (refId == 0) return false; + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId); + if (exh == NULL) { + tDebug("release conn %p, refId: %" PRId64 "", conn, refId); + return false; + } + taosWLockLatch(&exh->latch); + if (exh->handle == NULL) exh->handle = conn; + exh->inited = 1; + if (!QUEUE_IS_EMPTY(&exh->q)) { + queue* h = QUEUE_HEAD(&exh->q); + QUEUE_REMOVE(h); + taosWUnLockLatch(&exh->latch); + SCliMsg* t = QUEUE_DATA(h, SCliMsg, seqq); + transCtxMerge(&conn->ctx, &t->ctx->appCtx); + transQueuePush(&conn->cliMsgs, t); + tDebug("pop from conn %p, refId: %" PRId64 "", conn, refId); + transReleaseExHandle(transGetRefMgt(), refId); + cliSend(conn); + return true; + } + taosWUnLockLatch(&exh->latch); + tDebug("empty conn %p, refId: %" PRId64 "", conn, refId); + transReleaseExHandle(transGetRefMgt(), refId); + return false; +} + void cliHandleResp(SCliConn* conn) { SCliThrd* pThrd = conn->hostThrd; STrans* pTransInst = pThrd->pTransInst; @@ -439,8 +462,14 @@ void cliHandleResp(SCliConn* conn) { return; } } + int64_t refId = (pMsg == NULL ? 0 : (int64_t)(pMsg->msg.info.handle)); + tDebug("conn %p msg refId: %" PRId64 "", conn, refId); destroyCmsg(pMsg); + if (cliConnSendSeqMsg(refId, conn)) { + return; + } + if (cliMaySendCachedMsg(conn) == true) { return; } @@ -451,6 +480,21 @@ void cliHandleResp(SCliConn* conn) { uv_read_start((uv_stream_t*)conn->stream, cliAllocRecvBufferCb, cliRecvCb); } +static void cliDestroyMsgInExhandle(int64_t refId) { + if (refId == 0) return; + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId); + if (exh) { + taosWLockLatch(&exh->latch); + while (!QUEUE_IS_EMPTY(&exh->q)) { + queue* h = QUEUE_HEAD(&exh->q); + QUEUE_REMOVE(h); + SCliMsg* t = QUEUE_DATA(h, SCliMsg, seqq); + destroyCmsg(t); + } + taosWUnLockLatch(&exh->latch); + transReleaseExHandle(transGetRefMgt(), refId); + } +} void cliHandleExceptImpl(SCliConn* pConn, int32_t code) { if (transQueueEmpty(&pConn->cliMsgs)) { @@ -510,6 +554,8 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) { } if (pMsg == NULL || (pMsg && pMsg->type != Release)) { + int64_t refId = (pMsg == NULL ? 0 : (int64_t)(pMsg->msg.info.handle)); + cliDestroyMsgInExhandle(refId); if (cliAppCb(pConn, &transMsg, pMsg) != 0) { return; } @@ -678,7 +724,7 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { } list->numOfConn++; } - tTrace("%s numOfConn: %d, limit: %d", pTransInst->label, list->numOfConn, pTransInst->connLimitNum); + tDebug("%s numOfConn: %d, limit: %d, dst:%s", pTransInst->label, list->numOfConn, pTransInst->connLimitNum, key); return NULL; } @@ -742,13 +788,13 @@ static void addConnToPool(void* pool, SCliConn* conn) { QUEUE_PUSH(&conn->list->conns, &conn->q); conn->list->size += 1; - if (conn->list->size >= 20) { + if (conn->list->size >= 10) { STaskArg* arg = taosMemoryCalloc(1, sizeof(STaskArg)); arg->param1 = conn; arg->param2 = thrd; STrans* pTransInst = thrd->pTransInst; - conn->task = transDQSched(thrd->timeoutQueue, doCloseIdleConn, arg, CONN_PERSIST_TIME(pTransInst->idleTime)); + conn->task = transDQSched(thrd->timeoutQueue, doCloseIdleConn, arg, 10 * CONN_PERSIST_TIME(pTransInst->idleTime)); } } static int32_t allocConnRef(SCliConn* conn, bool update) { @@ -761,8 +807,10 @@ static int32_t allocConnRef(SCliConn* conn, bool update) { exh->handle = conn; exh->pThrd = conn->hostThrd; exh->refId = transAddExHandle(transGetRefMgt(), exh); - conn->refId = exh->refId; + QUEUE_INIT(&exh->q); + taosInitRWLatch(&exh->latch); + conn->refId = exh->refId; if (conn->refId == -1) { taosMemoryFree(exh); } @@ -779,9 +827,11 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { if (exh == NULL) { return -1; } + taosWLockLatch(&exh->latch); exh->handle = conn; exh->pThrd = conn->hostThrd; conn->refId = exh->refId; + taosWUnLockLatch(&exh->latch); transReleaseExHandle(transGetRefMgt(), handle); return 0; @@ -882,7 +932,6 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { } conn->list = NULL; - pThrd->newConnCount--; transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); @@ -1190,7 +1239,6 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(pList->port); tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst); - pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1392,7 +1440,10 @@ static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) { return; } + taosRLockLatch(&exh->latch); SCliConn* conn = exh->handle; + taosRUnLockLatch(&exh->latch); + transReleaseExHandle(transGetRefMgt(), refId); tDebug("%s conn %p start to release to inst", CONN_GET_INST_LABEL(conn), conn); @@ -1425,7 +1476,9 @@ SCliConn* cliGetConn(SCliMsg** pMsg, SCliThrd* pThrd, bool* ignore, char* addr) *ignore = true; return NULL; } else { + taosRLockLatch(&exh->latch); conn = exh->handle; + taosRUnLockLatch(&exh->latch); if (conn == NULL) { conn = getConnFromPool2(pThrd, addr, pMsg); if (conn != NULL) specifyConnRef(conn, true, refId); @@ -1439,7 +1492,7 @@ SCliConn* cliGetConn(SCliMsg** pMsg, SCliThrd* pThrd, bool* ignore, char* addr) if (conn != NULL) { tTrace("%s conn %p get from conn pool:%p", CONN_GET_INST_LABEL(conn), conn, pThrd->pool); } else { - tTrace("%s not found conn in conn pool:%p", ((STrans*)pThrd->pTransInst)->label, pThrd->pool); + tTrace("%s not found conn in conn pool:%p, dst:%s", ((STrans*)pThrd->pTransInst)->label, pThrd->pool, addr); } return conn; } @@ -1598,7 +1651,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(port); tGTrace("%s conn %p try to connect to %s", pTransInst->label, conn, conn->dstAddr); - pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1858,9 +1910,10 @@ void cliIteraConnMsgs(SCliConn* conn) { bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) { if (pHead->release == 1 && (pHead->msgLen) == sizeof(*pHead)) { uint64_t ahandle = pHead->ahandle; - tDebug("ahandle = %" PRIu64 "", ahandle); SCliMsg* pMsg = NULL; CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle); + tDebug("%s conn %p receive release request, refId:%" PRId64 ", may ignore", CONN_GET_INST_LABEL(conn), conn, + conn->refId); transClearBuffer(&conn->readBuf); transFreeMsg(transContFromHead((char*)pHead)); @@ -1869,6 +1922,9 @@ bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) { SCliMsg* cliMsg = transQueueGet(&conn->cliMsgs, i); if (cliMsg->type == Release) { ASSERTS(pMsg == NULL, "trans-cli recv invaid release-req"); + tDebug("%s conn %p receive release request, refId:%" PRId64 ", ignore msg", CONN_GET_INST_LABEL(conn), conn, + conn->refId); + cliDestroyConn(conn, true); return true; } } @@ -1984,11 +2040,9 @@ static SCliThrd* createThrdObj(void* trans) { taosMemoryFree(pThrd); return NULL; } - if (pTransInst->supportBatch) { - pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 4, pThrd, cliAsyncCb); - } else { - pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 8, pThrd, cliAsyncCb); - } + int32_t nSync = pTransInst->supportBatch ? 4 : 8; + pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, nSync, pThrd, cliAsyncCb); + if (pThrd->asyncPool == NULL) { tError("failed to init async pool"); uv_loop_close(pThrd->loop); @@ -2029,8 +2083,6 @@ static SCliThrd* createThrdObj(void* trans) { pThrd->quit = false; - pThrd->newConnCount = 0; - pThrd->msgCount = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); return pThrd; } static void destroyThrdObj(SCliThrd* pThrd) { @@ -2076,7 +2128,6 @@ static void destroyThrdObj(SCliThrd* pThrd) { pIter = (void**)taosHashIterate(pThrd->batchCache, pIter); } taosHashCleanup(pThrd->batchCache); - taosHashCleanup(pThrd->msgCount); taosMemoryFree(pThrd); } @@ -2095,14 +2146,7 @@ void cliSendQuit(SCliThrd* thrd) { void cliWalkCb(uv_handle_t* handle, void* arg) { if (!uv_is_closing(handle)) { if (uv_handle_get_type(handle) == UV_TIMER) { - // SCliConn* pConn = handle->data; - // if (pConn != NULL && pConn->timer != NULL) { - // SCliThrd* pThrd = pConn->hostThrd; - // uv_timer_stop((uv_timer_t*)handle); - // handle->data = NULL; - // taosArrayPush(pThrd->timerList, &pConn->timer); - // pConn->timer = NULL; - // } + // do nothing } else { uv_read_stop((uv_stream_t*)handle); } @@ -2137,18 +2181,23 @@ static void doCloseIdleConn(void* param) { cliDestroyConn(conn, true); taosMemoryFree(arg); } +static void cliSchedMsgToDebug(SCliMsg* pMsg, char* label) { + if (!(rpcDebugFlag & DEBUG_DEBUG)) { + return; + } + STransConnCtx* pCtx = pMsg->ctx; + STraceId* trace = &pMsg->msg.info.traceId; + char tbuf[512] = {0}; + EPSET_TO_STR(&pCtx->epSet, tbuf); + tGDebug("%s retry on next node,use:%s, step: %d,timeout:%" PRId64 "", label, tbuf, pCtx->retryStep, + pCtx->retryNextInterval); + return; +} static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) { STrans* pTransInst = pThrd->pTransInst; STransConnCtx* pCtx = pMsg->ctx; - - if (rpcDebugFlag & DEBUG_DEBUG) { - STraceId* trace = &pMsg->msg.info.traceId; - char tbuf[512] = {0}; - EPSET_TO_STR(&pCtx->epSet, tbuf); - tGDebug("%s retry on next node,use:%s, step: %d,timeout:%" PRId64 "", transLabel(pThrd->pTransInst), tbuf, - pCtx->retryStep, pCtx->retryNextInterval); - } + cliSchedMsgToDebug(pMsg, transLabel(pThrd->pTransInst)); STaskArg* arg = taosMemoryMalloc(sizeof(STaskArg)); arg->param1 = pMsg; @@ -2157,12 +2206,6 @@ static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) { transDQSched(pThrd->delayQueue, doDelayTask, arg, pCtx->retryNextInterval); } -FORCE_INLINE void cliCompareAndSwap(int8_t* val, int8_t exp, int8_t newVal) { - if (*val != exp) { - *val = newVal; - } -} - FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) { if ((pResp == NULL || pResp->info.hasEpSet == 0)) { return false; @@ -2504,21 +2547,7 @@ int transReleaseCliHandle(void* handle) { } return 0; } - -int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { - STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); - if (pTransInst == NULL) { - transFreeMsg(pReq->pCont); - return TSDB_CODE_RPC_BROKEN_LINK; - } - - SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle); - if (pThrd == NULL) { - transFreeMsg(pReq->pCont); - transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); - return TSDB_CODE_RPC_BROKEN_LINK; - } - +static SCliMsg* transInitMsg(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64()); STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx)); epsetAssign(&pCtx->epSet, pEpSet); @@ -2535,12 +2564,48 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran cliMsg->st = taosGetTimestampUs(); cliMsg->type = Normal; cliMsg->refId = (int64_t)shandle; + QUEUE_INIT(&cliMsg->seqq); + return cliMsg; +} + +int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { + STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); + if (pTransInst == NULL) { + transFreeMsg(pReq->pCont); + return TSDB_CODE_RPC_BROKEN_LINK; + } + + int64_t handle = (int64_t)pReq->info.handle; + SCliThrd* pThrd = transGetWorkThrd(pTransInst, handle); + if (pThrd == NULL) { + transFreeMsg(pReq->pCont); + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); + return TSDB_CODE_RPC_BROKEN_LINK; + } + if (handle != 0) { + SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle); + if (exh != NULL) { + taosWLockLatch(&exh->latch); + if (exh->handle == NULL && exh->inited != 0) { + SCliMsg* pCliMsg = transInitMsg(shandle, pEpSet, pReq, ctx); + QUEUE_PUSH(&exh->q, &pCliMsg->seqq); + taosWUnLockLatch(&exh->latch); + tDebug("msg refId: %" PRId64 "", handle); + transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); + return 0; + } + exh->inited = 1; + taosWUnLockLatch(&exh->latch); + transReleaseExHandle(transGetRefMgt(), handle); + } + } + SCliMsg* pCliMsg = transInitMsg(shandle, pEpSet, pReq, ctx); STraceId* trace = &pReq->info.traceId; tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pTransInst), pThrd->pid, - EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle); - if (0 != transAsyncSend(pThrd->asyncPool, &(cliMsg->q))) { - destroyCmsg(cliMsg); + EPSET_GET_INUSE_IP(pEpSet), EPSET_GET_INUSE_PORT(pEpSet), pReq->info.ahandle); + if (0 != transAsyncSend(pThrd->asyncPool, &(pCliMsg->q))) { + destroyCmsg(pCliMsg); transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return TSDB_CODE_RPC_BROKEN_LINK; } @@ -2726,6 +2791,8 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { int64_t transAllocHandle() { SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle)); exh->refId = transAddExHandle(transGetRefMgt(), exh); + QUEUE_INIT(&exh->q); + taosInitRWLatch(&exh->latch); tDebug("pre alloc refId %" PRId64 "", exh->refId); return exh->refId; diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index f47a688e6f..21ad5be869 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -761,9 +761,12 @@ static bool uvRecvReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) { tTrace("conn %p received release request", pConn); STraceId traceId = pHead->traceId; - pConn->status = ConnRelease; transClearBuffer(&pConn->readBuf); transFreeMsg(transContFromHead((char*)pHead)); + if (pConn->status != ConnAcquire) { + return true; + } + pConn->status = ConnRelease; STransMsg tmsg = {.code = 0, .info.handle = (void*)pConn, .info.traceId = traceId, .info.ahandle = (void*)0x9527}; SSvrMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrMsg)); @@ -1090,6 +1093,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { STrans* pTransInst = pThrd->pTransInst; pConn->refId = exh->refId; + QUEUE_INIT(&exh->q); transRefSrvHandle(pConn); tTrace("%s handle %p, conn %p created, refId:%" PRId64, transLabel(pTransInst), exh, pConn, pConn->refId); return pConn; @@ -1121,6 +1125,7 @@ static int reallocConnRef(SSvrConn* conn) { exh->handle = conn; exh->pThrd = conn->hostThrd; exh->refId = transAddExHandle(transGetRefMgt(), exh); + QUEUE_INIT(&exh->q); transAcquireExHandle(transGetRefMgt(), exh->refId); conn->refId = exh->refId; From 018d388278abf9ecf3e6ff6c615ebbf84c0cb5f8 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 2 Apr 2024 18:20:26 +0800 Subject: [PATCH 25/64] enh: not to write confirm after balance vgroup leader --- source/dnode/mnode/impl/src/mndVgroup.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 56e0c482e3..2ee9af0486 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -2342,11 +2342,6 @@ int32_t mndAddVgroupBalanceToTrans(SMnode *pMnode, SVgObj *pVgroup, STrans *pTra return -1; } - if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, pVgroup) != 0) { - mError("trans:%d, vgid:%d failed to be balanced to dnode:%d", pTrans->id, vgid, dnodeId); - return -1; - } - mndReleaseDb(pMnode, pDb); } else { mInfo("trans:%d, vgid:%d cant be balanced to dnode:%d, exist:%d, online:%d", pTrans->id, vgid, dnodeId, exist, From 24559725daf8cc03d5b8b1d137b5de3383e9c9bf Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 2 Apr 2024 18:45:30 +0800 Subject: [PATCH 26/64] fix(stream): add lock for when set checkpoint dispatch msg. --- source/dnode/vnode/src/tqCommon/tqCommon.c | 6 ++++++ source/libs/stream/src/streamDispatch.c | 7 ++++++- source/libs/stream/src/streamTaskSm.c | 4 ---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 1b67dce9b0..0f7f74f78b 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -850,12 +850,18 @@ int32_t tqStreamTaskProcessTaskResetReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { tqDebug("s-task:%s receive task-reset msg from mnode, reset status and ready for data processing", pTask->id.idStr); + taosThreadMutexLock(&pTask->lock); + // clear flag set during do checkpoint, and open inputQ for all upstream tasks if (streamTaskGetStatus(pTask)->state == TASK_STATUS__CK) { + tqDebug("s-task:%s reset task status from checkpoint, current checkpointingId:%" PRId64 ", transId:%d", + pTask->id.idStr, pTask->chkInfo.checkpointingId, pTask->chkInfo.transId); streamTaskClearCheckInfo(pTask, true); streamTaskSetStatusReady(pTask); } + taosThreadMutexUnlock(&pTask->lock); + streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 0af664f1e1..4a16fe869b 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -947,9 +947,14 @@ void streamClearChkptReadyMsg(SStreamTask* pTask) { // this message has been sent successfully, let's try next one. static int32_t handleDispatchSuccessRsp(SStreamTask* pTask, int32_t downstreamId) { stDebug("s-task:%s destroy dispatch msg:%p", pTask->id.idStr, pTask->msgInfo.pData); + bool delayDispatch = (pTask->msgInfo.dispatchMsgType == STREAM_INPUT__CHECKPOINT_TRIGGER); if (delayDispatch) { - pTask->chkInfo.dispatchCheckpointTrigger = true; + taosThreadMutexLock(&pTask->lock); + if (streamTaskGetStatus(pTask)->state == TASK_STATUS__CK) { + pTask->chkInfo.dispatchCheckpointTrigger = true; + } + taosThreadMutexUnlock(&pTask->lock); } clearBufferedDispatchMsg(pTask); diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index 6aa215586a..cfa94209f6 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -543,8 +543,6 @@ void streamTaskSetStatusReady(SStreamTask* pTask) { return; } - taosThreadMutexLock(&pTask->lock); - pSM->prev.state = pSM->current; pSM->prev.evt = 0; @@ -552,8 +550,6 @@ void streamTaskSetStatusReady(SStreamTask* pTask) { pSM->startTs = taosGetTimestampMs(); pSM->pActiveTrans = NULL; taosArrayClear(pSM->pWaitingEventList); - - taosThreadMutexUnlock(&pTask->lock); } STaskStateTrans createStateTransform(ETaskStatus current, ETaskStatus next, EStreamTaskEvent event, __state_trans_fn fn, From dcc97472d319535283b96a9b07187c53fb9ae0ad Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 2 Apr 2024 21:53:50 +0800 Subject: [PATCH 27/64] fix(stream): add strict check for checkpoint-trigger msg dispatach rsp confirmation flag. --- include/libs/stream/tstream.h | 2 ++ source/libs/stream/src/streamDispatch.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index e7c6491b9d..138fad0ddb 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -355,6 +355,8 @@ typedef struct SMetaHbInfo SMetaHbInfo; typedef struct SDispatchMsgInfo { SStreamDispatchReq* pData; // current dispatch data int8_t dispatchMsgType; + int64_t checkpointId;// checkpoint id msg + int32_t transId; // transId for current checkpoint int16_t msgType; // dispatch msg type int32_t retryCount; // retry send data count int64_t startTs; // dispatch start time, record total elapsed time for dispatch diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index e5709aab6e..44a496811f 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -321,6 +321,8 @@ void clearBufferedDispatchMsg(SStreamTask* pTask) { destroyDispatchMsg(pMsgInfo->pData, getNumOfDispatchBranch(pTask)); } + pMsgInfo->checkpointId = -1; + pMsgInfo->transId = -1; pMsgInfo->pData = NULL; pMsgInfo->dispatchMsgType = 0; } @@ -332,6 +334,12 @@ static int32_t doBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* pD pTask->msgInfo.dispatchMsgType = pData->type; + if (pData->type == STREAM_INPUT__CHECKPOINT_TRIGGER) { + SSDataBlock* p = taosArrayGet(pData->blocks, 0); + pTask->msgInfo.checkpointId = p->info.version; + pTask->msgInfo.transId = p->info.window.ekey; + } + if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) { SStreamDispatchReq* pReq = taosMemoryCalloc(1, sizeof(SStreamDispatchReq)); @@ -954,7 +962,9 @@ static int32_t handleDispatchSuccessRsp(SStreamTask* pTask, int32_t downstreamId bool delayDispatch = (pTask->msgInfo.dispatchMsgType == STREAM_INPUT__CHECKPOINT_TRIGGER); if (delayDispatch) { taosThreadMutexLock(&pTask->lock); - if (streamTaskGetStatus(pTask)->state == TASK_STATUS__CK) { + // we only set the dispatch msg info for current checkpoint trans + if (streamTaskGetStatus(pTask)->state == TASK_STATUS__CK && pTask->chkInfo.checkpointingId == pTask->msgInfo.checkpointId) { + ASSERT(pTask->chkInfo.transId == pTask->msgInfo.transId); pTask->chkInfo.dispatchCheckpointTrigger = true; } taosThreadMutexUnlock(&pTask->lock); From 3619518d54c1e69eed78d16775c3f61a162af43e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 2 Apr 2024 21:57:21 +0800 Subject: [PATCH 28/64] fix(stream): add logs. --- source/libs/stream/src/streamDispatch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 44a496811f..baf5ebf8cb 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -966,6 +966,11 @@ static int32_t handleDispatchSuccessRsp(SStreamTask* pTask, int32_t downstreamId if (streamTaskGetStatus(pTask)->state == TASK_STATUS__CK && pTask->chkInfo.checkpointingId == pTask->msgInfo.checkpointId) { ASSERT(pTask->chkInfo.transId == pTask->msgInfo.transId); pTask->chkInfo.dispatchCheckpointTrigger = true; + stDebug("s-task:%s checkpoint-trigger msg rsp for checkpointId:%" PRId64 " transId:%d confirmed", + pTask->id.idStr, pTask->msgInfo.checkpointId, pTask->msgInfo.transId); + } else { + stWarn("s-task:%s checkpoint-trigger msg rsp for checkpointId:%" PRId64 " transId:%d discard, since expired", + pTask->id.idStr, pTask->msgInfo.checkpointId, pTask->msgInfo.transId); } taosThreadMutexUnlock(&pTask->lock); } From 71292f45ef1116440df1151c3880a87c884ee37b Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 2 Apr 2024 23:59:23 +0800 Subject: [PATCH 29/64] fix:data compatibility in tmq --- source/client/src/clientTmq.c | 38 ++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index c8fc556150..ce149921e3 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1626,6 +1626,22 @@ void changeByteEndian(char* pData){ } } +static void tmqGetRawDataRowsPrecisionFromRes(void *pRetrieve, void** rawData, int64_t *rows, int32_t *precision){ + if(*(int64_t*)pRetrieve == 0){ + *rawData = ((SRetrieveTableRsp*)pRetrieve)->data; + *rows = htobe64(((SRetrieveTableRsp*)pRetrieve)->numOfRows); + if(precision != NULL){ + *precision = ((SRetrieveTableRsp*)pRetrieve)->precision; + } + }else if(*(int64_t*)pRetrieve == 1){ + *rawData = ((SRetrieveTableRspForTmq*)pRetrieve)->data; + *rows = htobe64(((SRetrieveTableRspForTmq*)pRetrieve)->numOfRows); + if(precision != NULL){ + *precision = ((SRetrieveTableRspForTmq*)pRetrieve)->precision; + } + } +} + static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows, SMqRspObj* pRspObj) { (*numOfRows) = 0; tstrncpy(pRspObj->topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN); @@ -1648,13 +1664,7 @@ static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg void* rawData = NULL; int64_t rows = 0; // deal with compatibility - if(*(int64_t*)pRetrieve == 0){ - rawData = ((SRetrieveTableRsp*)pRetrieve)->data; - rows = htobe64(((SRetrieveTableRsp*)pRetrieve)->numOfRows); - }else if(*(int64_t*)pRetrieve == 1){ - rawData = ((SRetrieveTableRspForTmq*)pRetrieve)->data; - rows = htobe64(((SRetrieveTableRspForTmq*)pRetrieve)->numOfRows); - } + tmqGetRawDataRowsPrecisionFromRes(pRetrieve, &rawData, &rows, NULL); pVg->numOfRows += rows; (*numOfRows) += rows; @@ -2625,18 +2635,22 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) { pRspObj->resIter++; if (pRspObj->resIter < pRspObj->rsp.blockNum) { - SRetrieveTableRspForTmq* pRetrieveTmq = - (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter); if (pRspObj->rsp.withSchema) { doFreeReqResultInfo(&pRspObj->resInfo); SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRspObj->rsp.blockSchema, pRspObj->resIter); setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols); } - pRspObj->resInfo.pData = (void*)pRetrieveTmq->data; - pRspObj->resInfo.numOfRows = htobe64(pRetrieveTmq->numOfRows); + void* pRetrieve = taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter); + void* rawData = NULL; + int64_t rows = 0; + int32_t precision = 0; + tmqGetRawDataRowsPrecisionFromRes(pRetrieve, &rawData, &rows, &precision); + + pRspObj->resInfo.pData = rawData; + pRspObj->resInfo.numOfRows = rows; pRspObj->resInfo.current = 0; - pRspObj->resInfo.precision = pRetrieveTmq->precision; + pRspObj->resInfo.precision = precision; // TODO handle the compressed case pRspObj->resInfo.totalRows += pRspObj->resInfo.numOfRows; From c2afd95c4e7dc273ae506eb8fc015c41a277c485 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Wed, 3 Apr 2024 10:07:02 +0800 Subject: [PATCH 30/64] fix taosd crash query ins_tags with empty nchar tag --- source/libs/executor/src/sysscanoperator.c | 5 ++++- tests/system-test/0-others/information_schema.py | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 628aacf3c3..903e2f85aa 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -983,7 +983,10 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, : (3 + DBL_MANT_DIG - DBL_MIN_EXP + VARSTR_HEADER_SIZE); tagVarChar = taosMemoryCalloc(1, bufSize + 1); int32_t len = -1; - convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len); + if (tagLen > 0) + convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len); + else + len = 0; varDataSetLen(tagVarChar, len); } } diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 63718417b4..c3d65482fc 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -50,10 +50,11 @@ class TDTestCase: self.tbnum = 20 self.rowNum = 10 self.tag_dict = { - 't0':'int' + 't0':'int', + 't1':f'nchar({self.nchar_length})' } self.tag_values = [ - f'1' + f'1', '""' ] self.binary_str = 'taosdata' self.nchar_str = '涛思数据' @@ -72,7 +73,7 @@ class TDTestCase: tdSql.execute(f'use {self.dbname}') tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) for i in range(self.tbnum): - tdSql.execute(f"create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[0]})") + tdSql.execute(f"create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[0]}, {self.tag_values[1]})") self.insert_data(self.column_dict,f'{self.stbname}_{i}',self.rowNum) def count_check(self): tdSql.query('select count(*) from information_schema.ins_tables') @@ -313,6 +314,11 @@ class TDTestCase: tdSql.error('alter cluster "activeCode" ""') tdSql.execute('alter cluster "activeCode" "revoked"') + def test_query_ins_tags(self): + sql = f'select tag_name, tag_value from information_schema.ins_tags where table_name = "{self.stbname}_0"' + tdSql.query(sql) + tdSql.checkRows(2) + def run(self): self.prepare_data() self.count_check() @@ -322,6 +328,7 @@ class TDTestCase: self.ins_stable_check2() self.ins_dnodes_check() self.ins_grants_check() + self.test_query_ins_tags() def stop(self): From 94f703889df3c56e89249546319854438c6aa3c3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 3 Apr 2024 12:42:53 +0800 Subject: [PATCH 31/64] fix(stream): remove invalid assert. --- source/libs/stream/src/streamStart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamStart.c b/source/libs/stream/src/streamStart.c index cb340ade32..0161f382ba 100644 --- a/source/libs/stream/src/streamStart.c +++ b/source/libs/stream/src/streamStart.c @@ -119,7 +119,11 @@ int32_t streamReExecScanHistoryFuture(SStreamTask* pTask, int32_t idleDuration) // add ref for task SStreamTask* p = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId); - ASSERT(p != NULL); + if (p == NULL) { + stError("s-task:0x%x failed to acquire task, status:%s, not exec scan-history data", pTask->id.taskId, + streamTaskGetStatus(pTask)->name); + return TSDB_CODE_SUCCESS; + } pTask->schedHistoryInfo.numOfTicks = numOfTicks; From f95c57695fbe5f465890e4041c60dedaab6fd279 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Wed, 3 Apr 2024 13:56:52 +0800 Subject: [PATCH 32/64] add test case --- tests/system-test/2-query/count.py | 2 ++ tests/system-test/2-query/csum.py | 2 ++ tests/system-test/2-query/group_partition.py | 13 ++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/system-test/2-query/count.py b/tests/system-test/2-query/count.py index f94e9eac00..6d34dde791 100644 --- a/tests/system-test/2-query/count.py +++ b/tests/system-test/2-query/count.py @@ -105,6 +105,8 @@ class TDTestCase: tdSql.checkRows(row) tdSql.query(f'select t0, {function_name}(c1),sum(c1) from {self.stbname} partition by tbname') tdSql.checkRows(row) + tdSql.query(f'select cast(t0 as binary(12)), {function_name}(c1),sum(c1) from {self.stbname} partition by tbname') + tdSql.checkRows(row) tdSql.query(f'select {function_name}(c1),sum(c1) from {self.stbname} partition by c1') tdSql.checkRows(0) tdSql.query(f'select {function_name}(c1),sum(c1) from {self.stbname} partition by t0') diff --git a/tests/system-test/2-query/csum.py b/tests/system-test/2-query/csum.py index f5e7456049..e3ac529d5e 100644 --- a/tests/system-test/2-query/csum.py +++ b/tests/system-test/2-query/csum.py @@ -472,6 +472,8 @@ class TDTestCase: # bug need fix tdSql.query("select tbname , st1, csum(c1), csum(c12) from db.stb1 partition by tbname") tdSql.checkRows(40) + tdSql.query("select tbname , cast(st1 as binary(24)), csum(c1), csum(c12) from db.stb1 partition by tbname") + tdSql.checkRows(40) tdSql.query("select tbname , csum(st1) from db.stb1 partition by tbname") tdSql.checkRows(70) tdSql.query("select tbname , csum(st1) from db.stb1 partition by tbname slimit 1") diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py index 73be70defa..7c5f110cc9 100644 --- a/tests/system-test/2-query/group_partition.py +++ b/tests/system-test/2-query/group_partition.py @@ -100,11 +100,19 @@ class TDTestCase: tdSql.checkData(0, 1, i) tdSql.checkData(0, 2, i*10) + tdSql.query(f"select cast(t2 as binary(12)),count(*) from {tbname}") + tdSql.checkRows(1) + tdSql.checkData(0, 0, i) + + tdSql.query(f"select t2 + 1, count(*) from {tbname}") + tdSql.checkRows(1) + tdSql.checkData(0, 0, i + 1) + tdSql.query(f"select t1, t2, t3, count(*) from {tbname} group by tbname") tdSql.checkRows(1) tdSql.checkData(0, 1, i) tdSql.checkData(0, 2, i*10) - + tdSql.query(f"select t1, t2, t3, count(*) from {tbname} partition by tbname") tdSql.checkRows(1) tdSql.checkData(0, 1, i) @@ -116,6 +124,9 @@ class TDTestCase: tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} group by t2, t3, tbname") tdSql.checkRows(check_num) + tdSql.query(f"select cast(t2 as binary(12)), count(*) from {self.dbname}.{self.stable} group by t2, t3, tbname") + tdSql.checkRows(check_num) + tdSql.query(f"select t2, t3, tbname, count(*) from {self.dbname}.{self.stable} partition by t2, t3, tbname") tdSql.checkRows(check_num) From a0bf82878d8fe2e5720f2cfbbe3e71a6180c58bf Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 3 Apr 2024 09:11:49 +0000 Subject: [PATCH 33/64] free handle --- source/libs/executor/src/executil.c | 49 +++++++++++++++------------ source/libs/scheduler/src/schRemote.c | 2 ++ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 9a480359ed..add2955a2b 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -45,8 +45,8 @@ static FilterCondType checkTagCond(SNode* cond); static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* list, SNode* pTagCond, SStorageAPI* pAPI); static int32_t optimizeTbnameInCondImpl(void* metaHandle, SArray* list, SNode* pTagCond, SStorageAPI* pStoreAPI); -static int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, SNode* pTagIndexCond, - STableListInfo* pListInfo, uint8_t* digest, const char* idstr, SStorageAPI* pStorageAPI); +static int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, SNode* pTagIndexCond, + STableListInfo* pListInfo, uint8_t* digest, const char* idstr, SStorageAPI* pStorageAPI); static int64_t getLimit(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->limit; } static int64_t getOffset(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->offset; } @@ -642,7 +642,8 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf info->groupId = calcGroupId(keyBuf, len); if (initRemainGroups) { // groupId ~ table uid - taosHashPut(pTableListInfo->remainGroups, &(info->groupId), sizeof(info->groupId), &(info->uid), sizeof(info->uid)); + taosHashPut(pTableListInfo->remainGroups, &(info->groupId), sizeof(info->groupId), &(info->uid), + sizeof(info->uid)); } } @@ -858,7 +859,7 @@ static int32_t optimizeTbnameInCondImpl(void* pVnode, SArray* pExistedUidList, S } SSDataBlock* createTagValBlockForFilter(SArray* pColList, int32_t numOfTables, SArray* pUidTagList, void* pVnode, - SStorageAPI* pStorageAPI) { + SStorageAPI* pStorageAPI) { SSDataBlock* pResBlock = createDataBlock(); if (pResBlock == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -939,11 +940,12 @@ SSDataBlock* createTagValBlockForFilter(SArray* pColList, int32_t numOfTables, S return pResBlock; } -static int32_t doSetQualifiedUid(STableListInfo* pListInfo, SArray* pUidList, const SArray* pUidTagList, bool* pResultList, bool addUid) { +static int32_t doSetQualifiedUid(STableListInfo* pListInfo, SArray* pUidList, const SArray* pUidTagList, + bool* pResultList, bool addUid) { taosArrayClear(pUidList); STableKeyInfo info = {.uid = 0, .groupId = 0}; - int32_t numOfTables = taosArrayGetSize(pUidTagList); + int32_t numOfTables = taosArrayGetSize(pUidTagList); for (int32_t i = 0; i < numOfTables; ++i) { if (pResultList[i]) { uint64_t uid = ((STUidTagInfo*)taosArrayGet(pUidTagList, i))->uid; @@ -1143,7 +1145,7 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S if (code != 0 || status == SFLT_NOT_INDEX) { // temporarily disable it for performance sake qDebug("failed to get tableIds from index, suid:%" PRIu64, pScanNode->uid); } else { - qInfo("succ to get filter result, table num: %d", (int)taosArrayGetSize(pUidList)); + qDebug("succ to get filter result, table num: %d", (int)taosArrayGetSize(pUidList)); } } } @@ -1165,7 +1167,8 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S memcpy(pPayload + sizeof(int32_t), taosArrayGet(pUidList, 0), numOfTables * sizeof(uint64_t)); } - pStorageAPI->metaFn.putCachedTableList(pVnode, pScanNode->suid, context.digest, tListLen(context.digest), pPayload, size, 1); + pStorageAPI->metaFn.putCachedTableList(pVnode, pScanNode->suid, context.digest, tListLen(context.digest), + pPayload, size, 1); digest[0] = 1; memcpy(digest + 1, context.digest, tListLen(context.digest)); } @@ -1725,7 +1728,8 @@ SColumn extractColumnFromColumnNode(SColumnNode* pColNode) { return c; } -int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysiNode* pTableScanNode, const SReadHandle* readHandle) { +int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysiNode* pTableScanNode, + const SReadHandle* readHandle) { pCond->order = pTableScanNode->scanSeq[0] > 0 ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; pCond->numOfCols = LIST_LENGTH(pTableScanNode->scan.pScanCols); @@ -1748,8 +1752,7 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi // allowed read stt file optimization mode pCond->notLoadData = (pTableScanNode->dataRequired == FUNC_DATA_REQUIRED_NOT_LOAD) && - (pTableScanNode->scan.node.pConditions == NULL) && - (pTableScanNode->interval == 0); + (pTableScanNode->scan.node.pConditions == NULL) && (pTableScanNode->interval == 0); int32_t j = 0; for (int32_t i = 0; i < pCond->numOfCols; ++i) { @@ -1891,7 +1894,8 @@ void getNextTimeWindow(const SInterval* pInterval, STimeWindow* tw, int32_t orde int32_t factor = GET_FORWARD_DIRECTION_FACTOR(order); slidingStart = taosTimeAdd(slidingStart, factor * pInterval->sliding, pInterval->slidingUnit, pInterval->precision); tw->skey = taosTimeAdd(slidingStart, pInterval->offset, pInterval->offsetUnit, pInterval->precision); - int64_t slidingEnd = taosTimeAdd(slidingStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; + int64_t slidingEnd = + taosTimeAdd(slidingStart, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; tw->ekey = taosTimeAdd(slidingEnd, pInterval->offset, pInterval->offsetUnit, pInterval->precision); } @@ -2136,7 +2140,7 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* if (groupSort && groupByTbname) { taosArraySort(pTableListInfo->pTableList, orderbyGroupIdComparFn); pTableListInfo->numOfOuputGroups = numOfTables; - } else if (groupByTbname && pScanNode->groupOrderScan){ + } else if (groupByTbname && pScanNode->groupOrderScan) { pTableListInfo->numOfOuputGroups = numOfTables; } else if (groupByTbname && tsCountAlwaysReturnValue && ((STableScanPhysiNode*)pScanNode)->needCountEmptyTable) { pTableListInfo->numOfOuputGroups = numOfTables; @@ -2147,7 +2151,8 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* bool initRemainGroups = false; if (QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN == nodeType(pScanNode)) { STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pScanNode; - if (tsCountAlwaysReturnValue && pTableScanNode->needCountEmptyTable && !(groupSort || pScanNode->groupOrderScan)) { + if (tsCountAlwaysReturnValue && pTableScanNode->needCountEmptyTable && + !(groupSort || pScanNode->groupOrderScan)) { initRemainGroups = true; } } @@ -2271,7 +2276,7 @@ void printSpecDataBlock(SSDataBlock* pBlock, const char* flag, const char* opStr } if (qDebugFlag & DEBUG_DEBUG) { char* pBuf = NULL; - char flagBuf[64]; + char flagBuf[64]; snprintf(flagBuf, sizeof(flagBuf), "%s %s", flag, opStr); qDebug("%s", dumpBlockData(pBlock, flagBuf, &pBuf, taskIdStr)); taosMemoryFree(pBuf); @@ -2280,7 +2285,7 @@ void printSpecDataBlock(SSDataBlock* pBlock, const char* flag, const char* opStr TSKEY getStartTsKey(STimeWindow* win, const TSKEY* tsCols) { return tsCols == NULL ? win->skey : tsCols[0]; } -void updateTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pWin, int64_t delta) { +void updateTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pWin, int64_t delta) { int64_t* ts = (int64_t*)pColData->pData; int64_t duration = pWin->ekey - pWin->skey + delta; @@ -2289,13 +2294,14 @@ void updateTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pWin, int64_t ts[4] = pWin->ekey + delta; // window end key } -int32_t compKeys(const SArray* pSortGroupCols, const char* oldkeyBuf, int32_t oldKeysLen, const SSDataBlock* pBlock, int32_t rowIndex) { +int32_t compKeys(const SArray* pSortGroupCols, const char* oldkeyBuf, int32_t oldKeysLen, const SSDataBlock* pBlock, + int32_t rowIndex) { SColumnDataAgg* pColAgg = NULL; const char* isNull = oldkeyBuf; const char* p = oldkeyBuf + sizeof(int8_t) * pSortGroupCols->size; for (int32_t i = 0; i < pSortGroupCols->size; ++i) { - const SColumn* pCol = (SColumn*)TARRAY_GET_ELEM(pSortGroupCols, i); + const SColumn* pCol = (SColumn*)TARRAY_GET_ELEM(pSortGroupCols, i); const SColumnInfoData* pColInfoData = TARRAY_GET_ELEM(pBlock->pDataBlock, pCol->slotId); if (pBlock->pBlockAgg) pColAgg = pBlock->pBlockAgg[pCol->slotId]; @@ -2321,8 +2327,7 @@ int32_t compKeys(const SArray* pSortGroupCols, const char* oldkeyBuf, int32_t ol return 0; } -int32_t buildKeys(char* keyBuf, const SArray* pSortGroupCols, const SSDataBlock* pBlock, - int32_t rowIndex) { +int32_t buildKeys(char* keyBuf, const SArray* pSortGroupCols, const SSDataBlock* pBlock, int32_t rowIndex) { uint32_t colNum = pSortGroupCols->size; SColumnDataAgg* pColAgg = NULL; char* isNull = keyBuf; @@ -2370,7 +2375,7 @@ uint64_t calcGroupId(char* pData, int32_t len) { } SNodeList* makeColsNodeArrFromSortKeys(SNodeList* pSortKeys) { - SNode* node; + SNode* node; SNodeList* ret = NULL; FOREACH(node, pSortKeys) { SOrderByExprNode* pSortKey = (SOrderByExprNode*)node; @@ -2386,6 +2391,6 @@ int32_t extractKeysLen(const SArray* keys) { SColumn* pCol = (SColumn*)taosArrayGet(keys, i); len += pCol->bytes; } - len += sizeof(int8_t) * keyNum; //null flag + len += sizeof(int8_t) * keyNum; // null flag return len; } diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 980b9aa6bf..079fd7d29d 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -486,6 +486,7 @@ int32_t schHandleNotifyCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " task notify rsp received, code:0x%x", pParam->queryId, pParam->taskId, code); + rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); if (pMsg) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); @@ -526,6 +527,7 @@ int32_t schHandleHbCallback(void *param, SDataBuf *pMsg, int32_t code) { if (code) { qError("hb rsp error:%s", tstrerror(code)); + rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); SCH_ERR_JRET(code); } From 8c34d14a9bf26ecb5775a3666f1ded313ed686ce Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Wed, 3 Apr 2024 17:26:51 +0800 Subject: [PATCH 34/64] fix test case --- tests/script/tsim/query/count_spread.sim | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/script/tsim/query/count_spread.sim b/tests/script/tsim/query/count_spread.sim index c03783b7fe..082b32d1fb 100644 --- a/tests/script/tsim/query/count_spread.sim +++ b/tests/script/tsim/query/count_spread.sim @@ -3,15 +3,24 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start sql connect -sql create database test; +sql create database test KEEP 36500; sql use test; sql create table st(ts timestamp, f int) tags(t int); -sql insert into ct1 using st tags(1) values(now, 0)(now+1s, 1)(now+2s, 10)(now+3s, 11) -sql insert into ct2 using st tags(2) values(now+2s, 2)(now+3s, 3) -sql insert into ct3 using st tags(3) values(now+4s, 4)(now+5s, 5) -sql insert into ct4 using st tags(4) values(now+6s, 6)(now+7s, 7) -sql select count(*), spread(ts) from st where tbname='ct1' +$ms = 1712135244502 +$ms1 = $ms + 1000 +$ms2 = $ms + 2000 +$ms3 = $ms + 3000 +$ms4 = $ms + 4000 +$ms5 = $ms + 5000 +$ms6 = $ms + 6000 +$ms7 = $ms + 7000 +sql insert into ct1 using st tags(1) values($ms , 0)($ms1 , 1)($ms2 , 10)($ms3 , 11) +sql insert into ct2 using st tags(2) values($ms2 , 2)($ms3 , 3) +sql insert into ct3 using st tags(3) values($ms4 , 4)($ms5 , 5) +sql insert into ct4 using st tags(4) values($ms6 , 6)($ms7 , 7) + +sql select count(*), spread(ts) from st where tbname='ct1' print $data00, $data01 if $data00 != @4@ then return -1 From ae0a95b27ec2dcecef99826283c10412a49fd246 Mon Sep 17 00:00:00 2001 From: liuyao <38781207+54liuyao@users.noreply.github.com> Date: Sun, 7 Apr 2024 09:49:52 +0800 Subject: [PATCH 35/64] Update 14-stream.md --- docs/zh/12-taos-sql/14-stream.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md index 2ed3c9afae..125f868758 100644 --- a/docs/zh/12-taos-sql/14-stream.md +++ b/docs/zh/12-taos-sql/14-stream.md @@ -201,9 +201,9 @@ TDengine 对于过期数据提供两种处理方式,由 IGNORE EXPIRED 选项 TDengine 对于修改数据提供两种处理方式,由 IGNORE UPDATE 选项指定: -1. 检查数据是否被修改,即 IGNORE UPDATE 0:默认配置,如果被修改,则重新计算对应窗口。 +1. 检查数据是否被修改,即 IGNORE UPDATE 0,如果数据被修改,则重新计算对应窗口。 -2. 不检查数据是否被修改,全部按增量数据计算,即 IGNORE UPDATE 1。 +2. 不检查数据是否被修改,全部按增量数据计算,即 IGNORE UPDATE 1,默认配置。 ## 写入已存在的超级表 From f65a7a7afaab839ad8e46e33a1cc49fb1afb21b9 Mon Sep 17 00:00:00 2001 From: liuyao <38781207+54liuyao@users.noreply.github.com> Date: Sun, 7 Apr 2024 10:01:27 +0800 Subject: [PATCH 36/64] Update 14-stream.md --- docs/en/12-taos-sql/14-stream.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md index c41839390f..337660a36c 100644 --- a/docs/en/12-taos-sql/14-stream.md +++ b/docs/en/12-taos-sql/14-stream.md @@ -148,7 +148,7 @@ T = latest event time - watermark The window closing time for each batch of data that arrives at the system is updated using the preceding formula, and all windows are closed whose closing time is less than T. If the triggering method is WINDOW_CLOSE or MAX_DELAY, the aggregate result for the window is pushed. -Stream processing strategy for expired data +## Stream processing strategy for expired data The data in expired windows is tagged as expired. TDengine stream processing provides two methods for handling such data: 1. Drop the data. This is the default and often only handling method for most stream processing engines. @@ -157,6 +157,14 @@ The data in expired windows is tagged as expired. TDengine stream processing pro In both of these methods, configuring the watermark is essential for obtaining accurate results (if expired data is dropped) and avoiding repeated triggers that affect system performance (if expired data is recalculated). +## Stream processing strategy for modifying data + +TDengine provides two ways to handle modified data, which are specified by the IGNORE UPDATE option: + +1. Check whether the data has been modified, i.e. IGNORE UPDATE 0, and recalculate the corresponding window if the data has been modified. + +2. Do not check whether the data has been modified, and calculate all the data as incremental data, i.e. IGNORE UPDATE 1, the default configuration. + ## Supported functions All [scalar functions](../function/#scalar-functions) are available in stream processing. All [Aggregate functions](../function/#aggregate-functions) and [Selection functions](../function/#selection-functions) are available in stream processing, except the followings: From 1b343e662c0ac1e74bd731935b77b67f4be9349e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 10:18:01 +0800 Subject: [PATCH 37/64] fix(stream): retry stop timer for trigger tmr. --- source/libs/stream/src/streamTask.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index c7a1a00a46..c610e86322 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -375,17 +375,22 @@ void tFreeStreamTask(SStreamTask* pTask) { } if (pTask->schedInfo.pDelayTimer != NULL) { - taosTmrStop(pTask->schedInfo.pDelayTimer); + while(!taosTmrStop(pTask->schedInfo.pDelayTimer)) { + stError("failed to stop the trigger sched timer, wait for 100ms and retry"); + taosMsleep(100); + } pTask->schedInfo.pDelayTimer = NULL; } if (pTask->hTaskInfo.pTimer != NULL) { - taosTmrStop(pTask->hTaskInfo.pTimer); + bool ret = taosTmrStop(pTask->hTaskInfo.pTimer); + ASSERT(ret); pTask->hTaskInfo.pTimer = NULL; } if (pTask->msgInfo.pTimer != NULL) { - taosTmrStop(pTask->msgInfo.pTimer); + bool ret = taosTmrStop(pTask->msgInfo.pTimer); + ASSERT(ret); pTask->msgInfo.pTimer = NULL; } From ece59a7cf0ba00d2978e7b2790969a61d67d3945 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Sun, 7 Apr 2024 10:18:36 +0800 Subject: [PATCH 38/64] create pk stable --- source/libs/parser/src/parTranslater.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 8edb7a19aa..59ce465c08 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8534,7 +8534,7 @@ static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta return nodesListAppend((*pSelect1)->pGroupByList, (SNode*)pNode2); } -static int32_t checkStreamDestTableSchema(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { +static int32_t checkAndAdjStreamDestTableSchema(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; SNode* pNode = nodesListGetNode(pStmt->pCols, 0); SColumnDefNode* pCol = (SColumnDefNode*)pNode; @@ -8560,6 +8560,9 @@ static int32_t checkStreamDestTableSchema(STranslateContext* pCxt, SCreateStream pNode = nodesListGetNode(pStmt->pCols, 1); pCol = (SColumnDefNode*)pNode; + if (STREAM_CREATE_STABLE_TRUE == pReq->createStb) { + pCol->is_pk = true; + } if (!pCol->is_pk) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Source table has primary key, dest table must has primary key"); } @@ -8593,7 +8596,7 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt code = adjustTags(pCxt, pStmt, pMeta, pReq); } if (TSDB_CODE_SUCCESS == code) { - code = checkStreamDestTableSchema(pCxt, pStmt); + code = checkAndAdjStreamDestTableSchema(pCxt, pStmt, pReq); } if (TSDB_CODE_SUCCESS == code) { getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB); From f82505ba1661d186394ae75163eab2dabf53a3a5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 14:06:25 +0800 Subject: [PATCH 39/64] fix(stream): remove invalid assert --- source/libs/stream/src/streamTask.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index c610e86322..113983806b 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -383,14 +383,12 @@ void tFreeStreamTask(SStreamTask* pTask) { } if (pTask->hTaskInfo.pTimer != NULL) { - bool ret = taosTmrStop(pTask->hTaskInfo.pTimer); - ASSERT(ret); + /*bool ret = */taosTmrStop(pTask->hTaskInfo.pTimer); pTask->hTaskInfo.pTimer = NULL; } if (pTask->msgInfo.pTimer != NULL) { - bool ret = taosTmrStop(pTask->msgInfo.pTimer); - ASSERT(ret); + /*bool ret = */taosTmrStop(pTask->msgInfo.pTimer); pTask->msgInfo.pTimer = NULL; } From 049de874de13168daa23f20508811b0d147de644 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Sun, 7 Apr 2024 14:48:54 +0800 Subject: [PATCH 40/64] test case --- tests/system-test/2-query/group_partition.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py index 7c5f110cc9..7bd5ff7954 100644 --- a/tests/system-test/2-query/group_partition.py +++ b/tests/system-test/2-query/group_partition.py @@ -113,11 +113,24 @@ class TDTestCase: tdSql.checkData(0, 1, i) tdSql.checkData(0, 2, i*10) + tdSql.query(f"select t1, t2, t3, count(*) from {tbname} group by tbname, c1, t4") + tdSql.checkData(0, 1, i) + tdSql.checkData(0, 2, i*10) + tdSql.query(f"select t1, t2, t3, count(*) from {tbname} partition by tbname") tdSql.checkRows(1) tdSql.checkData(0, 1, i) tdSql.checkData(0, 2, i*10) + tdSql.query(f"select t1, t2, t3, count(*) from {tbname} partition by c1, tbname") + tdSql.checkData(0, 1, i) + tdSql.checkData(0, 2, i*10) + + tdSql.query(f"select t1, t2, t3, count(*) from {self.stable} partition by c1, tbname order by tbname desc") + tdSql.checkRows(50) + tdSql.checkData(0, 1, 4) + tdSql.checkData(0, 2, 40) + def test_multi_group_key(self, check_num, nonempty_tb_num): # multi tag/tbname From ac6846d76c9d78b691ba1c162f72890626a0df27 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sun, 7 Apr 2024 14:41:00 +0800 Subject: [PATCH 41/64] enh: check validity of parallel actions of trans --- source/dnode/mnode/impl/src/mndTrans.c | 41 ++++++++++++++++++++++++++ source/util/src/terror.c | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 0e4f4210fb..eb9df06894 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -857,6 +857,43 @@ int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) { return 0; } +static bool mndTransActionsOfSameType(SArray *pActions) { + int32_t size = taosArrayGetSize(pActions); + ETrnAct lastActType = TRANS_ACTION_NULL; + bool same = true; + for (int32_t i = 0; i < size; ++i) { + STransAction *pAction = taosArrayGet(pActions, i); + if (i > 0) { + if (lastActType != pAction->actionType) { + same = false; + break; + } + } + lastActType = pAction->actionType; + } + return same; +} + +static int32_t mndTransCheckParallelActions(SMnode *pMnode, STrans *pTrans) { + if (pTrans->exec == TRN_EXEC_PARALLEL) { + if (mndTransActionsOfSameType(pTrans->redoActions) == false) { + terrno = TSDB_CODE_MND_TRANS_INVALID_STAGE; + mError("trans:%d, types of parallel redo actions are not the same", pTrans->id); + return -1; + } + + if (pTrans->policy == TRN_POLICY_ROLLBACK) { + if (mndTransActionsOfSameType(pTrans->undoActions) == false) { + terrno = TSDB_CODE_MND_TRANS_INVALID_STAGE; + mError("trans:%d, types of parallel undo actions are not the same", pTrans->id); + return -1; + } + } + } + + return 0; +} + int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { if (pTrans == NULL) return -1; @@ -864,6 +901,10 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { return -1; } + if (mndTransCheckParallelActions(pMnode, pTrans) != 0) { + return -1; + } + if (!pTrans->changeless && taosArrayGetSize(pTrans->commitActions) <= 0) { terrno = TSDB_CODE_MND_TRANS_CLOG_IS_NULL; mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 8723f227dd..187588f399 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -285,7 +285,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_DROPPING, "Dnode in dropping sta // mnode-trans TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid stage to kill") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid transaction stage") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CONFLICT, "Conflict transaction not completed") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CLOG_IS_NULL, "Transaction commitlog is null") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL, "Unable to establish connection While execute transaction and will continue in the background") From ccc7a0bf08e69dbc9475a018d880a799fb08d862 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sun, 7 Apr 2024 15:00:47 +0800 Subject: [PATCH 42/64] enh: skip trans context switch in error logging --- source/dnode/mnode/impl/src/mndTrans.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index eb9df06894..3b6043479c 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -1324,24 +1324,25 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA static int32_t mndTransExecuteRedoActions(SMnode *pMnode, STrans *pTrans, bool topHalf) { int32_t code = mndTransExecuteActions(pMnode, pTrans, pTrans->redoActions, topHalf); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("failed to execute redoActions since:%s, code:0x%x", terrstr(), terrno); + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS && code != TSDB_CODE_MND_TRANS_CTX_SWITCH) { + mError("trans:%d, failed to execute redoActions since:%s, code:0x%x, topHalf:%d", pTrans->id, terrstr(), terrno, + topHalf); } return code; } static int32_t mndTransExecuteUndoActions(SMnode *pMnode, STrans *pTrans, bool topHalf) { int32_t code = mndTransExecuteActions(pMnode, pTrans, pTrans->undoActions, topHalf); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("failed to execute undoActions since %s", terrstr()); + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS && code != TSDB_CODE_MND_TRANS_CTX_SWITCH) { + mError("trans:%d, failed to execute undoActions since %s. topHalf:%d", pTrans->id, terrstr(), topHalf); } return code; } static int32_t mndTransExecuteCommitActions(SMnode *pMnode, STrans *pTrans, bool topHalf) { int32_t code = mndTransExecuteActions(pMnode, pTrans, pTrans->commitActions, topHalf); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("failed to execute commitActions since %s", terrstr()); + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS && code != TSDB_CODE_MND_TRANS_CTX_SWITCH) { + mError("trans:%d, failed to execute commitActions since %s. topHalf:%d", pTrans->id, terrstr(), topHalf); } return code; } From 2fa55f04e13995c7c7366b28c8692e33c5057137 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sun, 7 Apr 2024 15:08:04 +0800 Subject: [PATCH 43/64] enh: check validity of commit actions of trans --- source/dnode/mnode/impl/src/mndTrans.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 3b6043479c..41ff45038f 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -894,6 +894,21 @@ static int32_t mndTransCheckParallelActions(SMnode *pMnode, STrans *pTrans) { return 0; } +static int32_t mndTransCheckCommitActions(SMnode *pMnode, STrans *pTrans) { + if (!pTrans->changeless && taosArrayGetSize(pTrans->commitActions) <= 0) { + terrno = TSDB_CODE_MND_TRANS_CLOG_IS_NULL; + mError("trans:%d, commit actions of non-changeless trans are empty", pTrans->id); + return -1; + } + if (mndTransActionsOfSameType(pTrans->commitActions) == false) { + terrno = TSDB_CODE_MND_TRANS_INVALID_STAGE; + mError("trans:%d, types of commit actions are not the same", pTrans->id); + return -1; + } + + return 0; +} + int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { if (pTrans == NULL) return -1; @@ -905,9 +920,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { return -1; } - if (!pTrans->changeless && taosArrayGetSize(pTrans->commitActions) <= 0) { - terrno = TSDB_CODE_MND_TRANS_CLOG_IS_NULL; - mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); + if (mndTransCheckCommitActions(pMnode, pTrans) != 0) { return -1; } From 30c0d944d93b56f75683e2fe27fc3c0733e80adf Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Sun, 7 Apr 2024 17:45:45 +0800 Subject: [PATCH 44/64] fix test case --- tests/system-test/2-query/group_partition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py index 7bd5ff7954..7c3c0555c9 100644 --- a/tests/system-test/2-query/group_partition.py +++ b/tests/system-test/2-query/group_partition.py @@ -126,7 +126,7 @@ class TDTestCase: tdSql.checkData(0, 1, i) tdSql.checkData(0, 2, i*10) - tdSql.query(f"select t1, t2, t3, count(*) from {self.stable} partition by c1, tbname order by tbname desc") + tdSql.query(f"select t1, t2, t3, count(*) from {self.dbname}.{self.stable} partition by c1, tbname order by tbname desc") tdSql.checkRows(50) tdSql.checkData(0, 1, 4) tdSql.checkData(0, 2, 40) From fb58ca8592724b106aa1d322b769b79227fdd385 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 18:53:25 +0800 Subject: [PATCH 45/64] fix(stream): not wait for the timer stopped. --- source/libs/stream/src/streamTask.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 113983806b..44f70f8b19 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -375,10 +375,7 @@ void tFreeStreamTask(SStreamTask* pTask) { } if (pTask->schedInfo.pDelayTimer != NULL) { - while(!taosTmrStop(pTask->schedInfo.pDelayTimer)) { - stError("failed to stop the trigger sched timer, wait for 100ms and retry"); - taosMsleep(100); - } + taosTmrStop(pTask->schedInfo.pDelayTimer); pTask->schedInfo.pDelayTimer = NULL; } From 3ba45df0a0b4e9be45f68ddf5bc7c103230cb4e9 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 8 Apr 2024 09:22:05 +0800 Subject: [PATCH 46/64] check pk column --- source/libs/executor/src/scanoperator.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index fefc1d6b79..eaf26effd5 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1692,7 +1692,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr uint64_t groupId = pSrcGp[i]; if (groupId == 0) { void* pVal = NULL; - if (hasPrimaryKey(pInfo)) { + if (hasPrimaryKey(pInfo) && pSrcPkCol) { pVal = colDataGetData(pSrcPkCol, i); } groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); @@ -1769,7 +1769,7 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB uint64_t groupId = pSrcGp[i]; if (groupId == 0) { void* pVal = NULL; - if (hasPrimaryKey(pInfo)) { + if (hasPrimaryKey(pInfo) && pSrcPkCol) { pVal = colDataGetData(pSrcPkCol, i); } groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); @@ -1834,7 +1834,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS uint64_t groupId = srcGp[i]; if (groupId == 0) { void* pVal = NULL; - if (hasPrimaryKey(pInfo)) { + if (hasPrimaryKey(pInfo) && pSrcPkCol) { pVal = colDataGetData(pSrcPkCol, i); } groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver, pVal); @@ -1871,10 +1871,6 @@ static int32_t generatePartitionDelResBlock(SStreamScanInfo* pInfo, SSDataBlock* uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - SColumnInfoData* pSrcPkCol = NULL; - if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX ) { - pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); - } ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; From e6764af48f0a2cd33e98a2ee5c6feecf7c5cdf84 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 8 Apr 2024 11:12:18 +0800 Subject: [PATCH 47/64] fix: heartbeat error handling issue --- source/client/src/clientHb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index a146712cab..b1f0ea55d8 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -496,6 +496,11 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { if (code != 0) { pInst->onlineDnodes = pInst->totalDnodes ? 0 : -1; tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), pInst->onlineDnodes, pInst->totalDnodes); + taosThreadMutexUnlock(&clientHbMgr.lock); + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); + tFreeClientHbBatchRsp(&pRsp); + return -1; } if (rspNum) { From 2a6c40e8c5ee5dd7c8d3c4ff56586e05c14296a6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 8 Apr 2024 16:53:13 +0800 Subject: [PATCH 48/64] set winkey for selectivity function --- source/libs/function/src/builtinsimpl.c | 14 +- tests/script/tsim/stream/basic5.sim | 230 ++++++++++++++++++++++++ 2 files changed, 237 insertions(+), 7 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 5ab6d5e075..b709abc30b 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -3201,15 +3201,15 @@ static int32_t doSaveTupleData(SSerializeDataHandle* pHandle, const void* pBuf, int32_t saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STuplePos* pPos) { prepareBuf(pCtx); - SWinKey key; + SWinKey key = {0}; if (pCtx->saveHandle.pBuf == NULL) { - SColumnInfoData* pColInfo = taosArrayGet(pSrcBlock->pDataBlock, 0); - if (pColInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP) { - int64_t skey = *(int64_t*)colDataGetData(pColInfo, rowIndex); - - key.groupId = pSrcBlock->info.id.groupId; - key.ts = skey; + SColumnInfoData* pColInfo = pCtx->input.pPTS; + if (!pColInfo || pColInfo->info.type != TSDB_DATA_TYPE_TIMESTAMP) { + pColInfo = taosArrayGet(pSrcBlock->pDataBlock, 0); } + ASSERT(pColInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); + key.groupId = pSrcBlock->info.id.groupId; + key.ts = *(int64_t*)colDataGetData(pColInfo, rowIndex);; } char* buf = serializeTupleData(pSrcBlock, rowIndex, &pCtx->subsidiaries, pCtx->subsidiaries.buf); diff --git a/tests/script/tsim/stream/basic5.sim b/tests/script/tsim/stream/basic5.sim index 583c803e4e..f507ab7d3b 100644 --- a/tests/script/tsim/stream/basic5.sim +++ b/tests/script/tsim/stream/basic5.sim @@ -15,6 +15,8 @@ sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double); sql create stream streams3 trigger at_once ignore expired 0 ignore update 0 into streamt3 as select _wstart, count(*) c1 from t1 state_window(a); +sleep 1000 + sql insert into t1 values(1648791211000,1,2,3,1.0); sql insert into t1 values(1648791213000,2,2,3,1.1); sql insert into t1 values(1648791215000,3,2,3,1.1); @@ -214,4 +216,232 @@ if $data[29][1] != 2 then goto loop11 endi +print step2============= + +sql create database test4 vgroups 4; +sql use test4; +sql create stable st(ts timestamp,a int,b int,c int,d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams4 trigger at_once ignore expired 0 ignore update 0 into streamt4 as select _wstart, first(a), b, c, ta, tb from st interval(1s); + +sleep 1000 + +sql insert into t1 values(1648791211000,1,2,3,1.0); +sql insert into t1 values(1648791213000,2,3,4,1.1); +sql insert into t2 values(1648791215000,3,4,5,1.1); +sql insert into t2 values(1648791217000,4,5,6,1.1); + +$loop_count = 0 + +loop12: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt4 order by 1; +sql select * from streamt4 order by 1; + +if $rows != 4 then + print ======rows=$rows + goto loop12 +endi + +if $data02 != 2 then + print ======data02=$data02 + goto loop12 +endi + +if $data03 != 3 then + print ======data03=$data03 + goto loop12 +endi + +if $data04 != 1 then + print ======data04=$data04 + goto loop12 +endi + +if $data05 != 1 then + print ======data05=$data05 + goto loop12 +endi + + +if $data22 != 4 then + print ======data22=$data22 + goto loop12 +endi + +if $data23 != 5 then + print ======data23=$data23 + goto loop12 +endi + +if $data24 != 2 then + print ======data24=$data24 + goto loop12 +endi + +if $data25 != 2 then + print ======data25=$data25 + goto loop12 +endi + +print step3============= + +sql create database test5 vgroups 4; +sql use test5; +sql create stable st(ts timestamp,a int,b int,c int,d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams5 trigger at_once ignore expired 0 ignore update 0 into streamt5 as select _wstart, b, c, ta, tb, max(b) from t1 interval(1s); + +sleep 1000 + +sql insert into t1 values(1648791211000,1,2,3,1.0); +sql insert into t1 values(1648791213000,2,3,4,1.1); +sql insert into t1 values(1648791215000,3,4,5,1.1); +sql insert into t1 values(1648791217000,4,5,6,1.1); + +$loop_count = 0 + +loop13: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt5 order by 1; +sql select * from streamt5 order by 1; + +if $rows != 4 then + print ======rows=$rows + goto loop13 +endi + +if $data01 != 2 then + print ======data02=$data02 + goto loop13 +endi + +if $data02 != 3 then + print ======data03=$data03 + goto loop13 +endi + +if $data03 != 1 then + print ======data04=$data04 + goto loop13 +endi + +if $data04 != 1 then + print ======data05=$data05 + goto loop13 +endi + + +if $data21 != 4 then + print ======data22=$data22 + goto loop13 +endi + +if $data22 != 5 then + print ======data23=$data23 + goto loop13 +endi + +if $data23 != 1 then + print ======data24=$data24 + goto loop13 +endi + +if $data24 != 1 then + print ======data25=$data25 + goto loop13 +endi + +print step4============= + +sql create database test6 vgroups 4; +sql use test6; +sql create stable st(ts timestamp,a int,b int,c int,d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams6 trigger at_once ignore expired 0 ignore update 0 into streamt6 as select _wstart, b, c,min(c), ta, tb from st interval(1s); + +sleep 1000 + +sql insert into t1 values(1648791211000,1,2,3,1.0); +sql insert into t1 values(1648791213000,2,3,4,1.1); +sql insert into t2 values(1648791215000,3,4,5,1.1); +sql insert into t2 values(1648791217000,4,5,6,1.1); + +$loop_count = 0 + +loop14: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 select * from streamt6 order by 1; +sql select * from streamt6 order by 1; + +if $rows != 4 then + print ======rows=$rows + goto loop14 +endi + +if $data01 != 2 then + print ======data02=$data02 + goto loop14 +endi + +if $data02 != 3 then + print ======data03=$data03 + goto loop14 +endi + +if $data04 != 1 then + print ======data04=$data04 + goto loop14 +endi + +if $data05 != 1 then + print ======data05=$data05 + goto loop14 +endi + + +if $data21 != 4 then + print ======data22=$data22 + goto loop14 +endi + +if $data22 != 5 then + print ======data23=$data23 + goto loop14 +endi + +if $data24 != 2 then + print ======data24=$data24 + goto loop14 +endi + +if $data25 != 2 then + print ======data25=$data25 + goto loop14 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 858d61072e79c61261f0eb3aeaa37be2fb418dde Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 8 Apr 2024 17:23:46 +0800 Subject: [PATCH 49/64] check preversion data --- source/libs/executor/src/scanoperator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index eaf26effd5..818bdbbc84 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1633,6 +1633,9 @@ static void getPreVersionDataBlock(uint64_t uid, TSKEY startTs, TSKEY endTs, int SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uid, startTs, endTs, version); printDataBlock(pPreRes, "pre res", taskIdStr); blockDataCleanup(pBlock); + if (!pPreRes) { + return ; + } int32_t code = blockDataEnsureCapacity(pBlock, pPreRes->info.rows); if (code != TSDB_CODE_SUCCESS) { return ; @@ -2522,6 +2525,7 @@ FETCH_NEXT_BLOCK: switch (pBlock->info.type) { case STREAM_NORMAL: case STREAM_GET_ALL: + printDataBlock(pBlock, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); return pBlock; case STREAM_RETRIEVE: { pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; @@ -2603,6 +2607,7 @@ FETCH_NEXT_BLOCK: pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); if (pInfo->pRes->info.rows > 0) { + printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); return pInfo->pRes; } } break; @@ -2724,6 +2729,7 @@ FETCH_NEXT_BLOCK: qDebug("stream scan completed, and return source rows:%" PRId64", %s", pBlockInfo->rows, id); if (pBlockInfo->rows > 0) { + printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); return pInfo->pRes; } @@ -2747,7 +2753,7 @@ FETCH_NEXT_BLOCK: if (pBlock->info.type == STREAM_CHECKPOINT) { streamScanOperatorSaveCheckpoint(pInfo); } - // printDataBlock(pBlock, "stream scan ck"); + // printDataBlock(pInfo->pCheckpointRes, "stream scan ck", GET_TASKID(pTaskInfo)); return pInfo->pCheckpointRes; } From ccc3491cdd92d9f775ccc046606c35ca05ef7026 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 8 Apr 2024 18:39:35 +0800 Subject: [PATCH 50/64] fix:send data to large in tmq if subscribe stable --- source/dnode/vnode/src/tq/tqScan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 9940164ee2..cc9e8c0136 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -311,7 +311,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR SSDataBlock* pBlock = taosArrayGet(pBlocks, i); tqAddBlockDataToRsp(pBlock, (SMqDataRsp*)pRsp, taosArrayGetSize(pBlock->pDataBlock), pTq->pVnode->config.tsdbCfg.precision); - totalRows += pBlock->info.rows; + *totalRows += pBlock->info.rows; blockDataFreeRes(pBlock); SSchemaWrapper* pSW = taosArrayGetP(pSchemas, i); taosArrayPush(pRsp->blockSchema, &pSW); From 16e0fc44e24f33474c74596da6d8a798a69db9c5 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 8 Apr 2024 19:55:11 +0800 Subject: [PATCH 51/64] fix: arb reply to set-assigned no matter what error --- source/dnode/mnode/impl/src/mndMain.c | 2 +- source/libs/sync/src/syncMain.c | 53 +++++++++++++++------------ 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index ee7cd83a8c..76a9d804e6 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -822,7 +822,7 @@ _OVER: "msg:%p, type:%s failed to process since %s, mnode restored:%d stopped:%d, sync restored:%d " "role:%s, redirect numOfEps:%d inUse:%d, type:%s", pMsg, TMSG_INFO(pMsg->msgType), terrstr(), pMnode->restored, pMnode->stopped, state.restored, - syncStr(state.restored), epSet.numOfEps, epSet.inUse, TMSG_INFO(pMsg->msgType)); + syncStr(state.state), epSet.numOfEps, epSet.inUse, TMSG_INFO(pMsg->msgType)); if (epSet.numOfEps <= 0) return -1; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index da18bbdea2..85aa3a2796 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -276,16 +276,18 @@ int32_t syncForceBecomeFollower(SSyncNode* ths, const SRpcMsg* pRpcMsg) { int32_t syncBecomeAssignedLeader(SSyncNode* ths, SRpcMsg* pRpcMsg) { int32_t ret = -1; + int32_t errcode = TSDB_CODE_MND_ARB_TOKEN_MISMATCH; + void* pHead = NULL; + int32_t contLen = 0; SVArbSetAssignedLeaderReq req = {0}; if (tDeserializeSVArbSetAssignedLeaderReq((char*)pRpcMsg->pCont + sizeof(SMsgHead), pRpcMsg->contLen, &req) != 0) { sError("vgId:%d, failed to deserialize SVArbSetAssignedLeaderReq", ths->vgId); terrno = TSDB_CODE_INVALID_MSG; - return -1; + errcode = terrno; + goto _OVER; } - int32_t errcode = TSDB_CODE_MND_ARB_TOKEN_MISMATCH; - if (ths->arbTerm > req.arbTerm) { sInfo("vgId:%d, skip to set assigned leader, msg with lower term, local:%" PRId64 "msg:%" PRId64, ths->vgId, ths->arbTerm, req.arbTerm); @@ -294,50 +296,58 @@ int32_t syncBecomeAssignedLeader(SSyncNode* ths, SRpcMsg* pRpcMsg) { ths->arbTerm = TMAX(req.arbTerm, ths->arbTerm); - if (strncmp(req.memberToken, ths->arbToken, TSDB_ARB_TOKEN_SIZE) == 0) { - if (ths->state != TAOS_SYNC_STATE_ASSIGNED_LEADER) { - raftStoreNextTerm(ths); - if (terrno != TSDB_CODE_SUCCESS) { - sError("vgId:%d, failed to set next term since:%s", ths->vgId, terrstr()); - goto _OVER; - } - syncNodeBecomeAssignedLeader(ths); - - if (syncNodeAppendNoop(ths) < 0) { - sError("vgId:%d, assigned leader failed to append noop entry since %s", ths->vgId, terrstr()); - } - } - errcode = TSDB_CODE_SUCCESS; - } else { + if (strncmp(req.memberToken, ths->arbToken, TSDB_ARB_TOKEN_SIZE) != 0) { sInfo("vgId:%d, skip to set assigned leader, token mismatch, local:%s, msg:%s", ths->vgId, ths->arbToken, req.memberToken); goto _OVER; } + if (ths->state != TAOS_SYNC_STATE_ASSIGNED_LEADER) { + terrno = TSDB_CODE_SUCCESS; + raftStoreNextTerm(ths); + if (terrno != TSDB_CODE_SUCCESS) { + sError("vgId:%d, failed to set next term since:%s", ths->vgId, terrstr()); + errcode = terrno; + goto _OVER; + } + syncNodeBecomeAssignedLeader(ths); + + if (syncNodeAppendNoop(ths) < 0) { + sError("vgId:%d, assigned leader failed to append noop entry since %s", ths->vgId, terrstr()); + } + } + SVArbSetAssignedLeaderRsp rsp = {0}; rsp.arbToken = req.arbToken; rsp.memberToken = req.memberToken; rsp.vgId = ths->vgId; - int32_t contLen = tSerializeSVArbSetAssignedLeaderRsp(NULL, 0, &rsp); + contLen = tSerializeSVArbSetAssignedLeaderRsp(NULL, 0, &rsp); if (contLen <= 0) { sError("vgId:%d, failed to serialize SVArbSetAssignedLeaderRsp", ths->vgId); terrno = TSDB_CODE_OUT_OF_MEMORY; + errcode = terrno; goto _OVER; } - void* pHead = rpcMallocCont(contLen); + pHead = rpcMallocCont(contLen); if (!pHead) { sError("vgId:%d, failed to malloc memory for SVArbSetAssignedLeaderRsp", ths->vgId); terrno = TSDB_CODE_OUT_OF_MEMORY; + errcode = terrno; goto _OVER; } if (tSerializeSVArbSetAssignedLeaderRsp(pHead, contLen, &rsp) <= 0) { sError("vgId:%d, failed to serialize SVArbSetAssignedLeaderRsp", ths->vgId); terrno = TSDB_CODE_OUT_OF_MEMORY; + errcode = terrno; rpcFreeCont(pHead); goto _OVER; } + errcode = TSDB_CODE_SUCCESS; + ret = 0; + +_OVER:; SRpcMsg rspMsg = { .code = errcode, .pCont = pHead, @@ -347,9 +357,6 @@ int32_t syncBecomeAssignedLeader(SSyncNode* ths, SRpcMsg* pRpcMsg) { tmsgSendRsp(&rspMsg); - ret = 0; - -_OVER: tFreeSVArbSetAssignedLeaderReq(&req); return ret; } From 4285f07f766b2a5bff8038cfe9c7c960b9f46cff Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 8 Apr 2024 23:33:58 +0800 Subject: [PATCH 52/64] fix:memory leak --- utils/test/c/sml_test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index bf37e7a182..9e04cfb75b 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1923,6 +1923,9 @@ int sml_td29373_Test() { ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); taos_free_result(pRes); + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql3[i]); + } // case 4 const char *sql4[] = { From df516703e15b0f0639525c737a7ad35d6fa26d13 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 9 Apr 2024 10:22:13 +0800 Subject: [PATCH 53/64] fix(stream): check the pk during merge rows with identical timestamp. --- source/dnode/vnode/src/tq/tqSink.c | 42 +++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 7f5ddf4f1e..d43846bcf4 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -324,6 +324,7 @@ int32_t doBuildAndSendSubmitMsg(SVnode* pVnode, SStreamTask* pTask, SSubmitReq2* int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, const char* id) { int32_t oldLen = taosArrayGetSize(pExisted->aRowP); int32_t newLen = taosArrayGetSize(pNew->aRowP); + int32_t numOfPk = 0; int32_t j = 0, k = 0; SArray* pFinal = taosArrayInit(oldLen + newLen, POINTER_BYTES); @@ -335,17 +336,40 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c while (j < newLen && k < oldLen) { SRow* pNewRow = taosArrayGetP(pNew->aRowP, j); SRow* pOldRow = taosArrayGetP(pExisted->aRowP, k); - if (pNewRow->ts <= pOldRow->ts) { + if (pNewRow->ts < pOldRow->ts) { taosArrayPush(pFinal, &pNewRow); j += 1; - - if (pNewRow->ts == pOldRow->ts) { - k += 1; - tRowDestroy(pOldRow); - } - } else { + } else if (pNewRow->ts > pOldRow->ts) { taosArrayPush(pFinal, &pOldRow); k += 1; + } else { + // check for the existance of primary key + if (pNewRow->numOfPKs == 0) { + taosArrayPush(pFinal, &pNewRow); + k += 1; + j += 1; + tRowDestroy(pOldRow); + } else { + numOfPk = pNewRow->numOfPKs; + + SRowKey kNew, kOld; + tRowGetKey(pNewRow, &kNew); + tRowGetKey(pOldRow, &kOld); + + int32_t ret = tRowKeyCompare(&kNew, &kOld); + if (ret <= 0) { + taosArrayPush(pFinal, &pNewRow); + j += 1; + + if (ret == 0) { + k += 1; + tRowDestroy(pOldRow); + } + } else { + taosArrayPush(pFinal, &pOldRow); + k += 1; + } + } } } @@ -363,8 +387,8 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c taosArrayDestroy(pExisted->aRowP); pExisted->aRowP = pFinal; - tqTrace("s-task:%s rows merged, final rows:%d, uid:%" PRId64 ", existed auto-create table:%d, new-block:%d", id, - (int32_t)taosArrayGetSize(pFinal), pExisted->uid, (pExisted->pCreateTbReq != NULL), + tqTrace("s-task:%s rows merged, final rows:%d, pk:%d uid:%" PRId64 ", existed auto-create table:%d, new-block:%d", + id, (int32_t)taosArrayGetSize(pFinal), numOfPk, pExisted->uid, (pExisted->pCreateTbReq != NULL), (pNew->pCreateTbReq != NULL)); tdDestroySVCreateTbReq(pNew->pCreateTbReq); From 87b04c4eeafb79b0f604b1d5c84d9a7f137ef340 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 9 Apr 2024 14:52:51 +0800 Subject: [PATCH 54/64] fix(stream): add null check. --- source/dnode/vnode/src/tq/tqSink.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index d43846bcf4..2b99c6f6ef 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -570,20 +570,35 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat taosArrayClear(pVals); int32_t dataIndex = 0; + int64_t ts = 0; + for (int32_t k = 0; k < pTSchema->numOfCols; k++) { const STColumn* pCol = &pTSchema->columns[k]; + + // primary timestamp column, for debug purpose if (k == 0) { SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, dataIndex); - void* colData = colDataGetData(pColData, j); - tqTrace("s-task:%s sink row %d, col %d ts %" PRId64, id, j, k, *(int64_t*)colData); + ts = *(int64_t*)colDataGetData(pColData, j); + tqTrace("s-task:%s sink row %d, col %d ts %" PRId64, id, j, k, ts); } if (IS_SET_NULL(pCol)) { + if (pCol->flags & COL_IS_KEY) { + qError("ts:%" PRId64 " Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, ts, + pCol->colId, pCol->type); + break; + } SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); taosArrayPush(pVals, &cv); } else { SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, dataIndex); if (colDataIsNull_s(pColData, j)) { + if (pCol->flags & COL_IS_KEY) { + qError("ts:%" PRId64 "Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, + ts, pCol->colId, pCol->type); + break; + } + SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); taosArrayPush(pVals, &cv); dataIndex++; @@ -607,6 +622,8 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat } SRow* pRow = NULL; + tqInfo("result column flag:%d", pTSchema->columns[1].flags); + code = tRowBuild(pVals, (STSchema*)pTSchema, &pRow); if (code != TSDB_CODE_SUCCESS) { tDestroySubmitTbData(pTableData, TSDB_MSG_FLG_ENCODE); From 36066d8f6353f2dc446f201c09777aab8a632aa6 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Tue, 9 Apr 2024 15:22:16 +0800 Subject: [PATCH 55/64] fix: multiresFunction --- source/libs/parser/src/parTranslater.c | 1 - .../system-test/2-query/multi_res_function.py | 130 ++++++++++++++++++ 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 tests/system-test/2-query/multi_res_function.py diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2110013310..e236c5194e 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2105,7 +2105,6 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu } if (tsKeepColumnName && 1 == LIST_LENGTH(pFunc->pParameterList) && !pFunc->node.asAlias && !pFunc->node.asParam) { strcpy(pFunc->node.userAlias, ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->userAlias); - strcpy(pFunc->node.aliasName, pFunc->node.userAlias); } return TSDB_CODE_SUCCESS; } diff --git a/tests/system-test/2-query/multi_res_function.py b/tests/system-test/2-query/multi_res_function.py new file mode 100644 index 0000000000..89038e5c08 --- /dev/null +++ b/tests/system-test/2-query/multi_res_function.py @@ -0,0 +1,130 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import random +import string +import sys +import taos +from util.common import * +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.tbnum = 20 + self.ts = 1537146000000 + self.binary_str = 'taosdata' + self.nchar_str = '涛思数据' + + def first_check_base(self): + dbname = "db" + tdSql.prepare(dbname) + column_dict = { + 'col1': 'tinyint', + 'col2': 'smallint', + 'col3': 'int', + 'col4': 'bigint', + 'col5': 'tinyint unsigned', + 'col6': 'smallint unsigned', + 'col7': 'int unsigned', + 'col8': 'bigint unsigned', + 'col9': 'float', + 'col10': 'double', + 'col11': 'bool', + 'col12': 'binary(20)', + 'col13': 'nchar(20)' + } + tdSql.execute(f"alter local \'keepColumnName\' \'1\'") + tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 tinyint unsigned, col6 smallint unsigned, + col7 int unsigned, col8 bigint unsigned, col9 float, col10 double, col11 bool, col12 binary(20), col13 nchar(20)) tags(loc nchar(20))''') + tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')") + tdSql.execute(f"create table {dbname}.stb_2 using {dbname}.stb tags('beijing')") + + column_list = ['col1','col2','col3','col4','col5','col6','col7','col8','col9','col10','col11','col12','col13'] + for i in column_list: + for j in ['stb_1']: + tdSql.query(f"select first({i}) from {dbname}.{j}") + tdSql.checkRows(0) + for n in range(self.rowNum): + i = n + tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')" + % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1)) + + for n in range(self.rowNum): + i = n + 10 + tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')" + % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1)) + + for n in range(self.rowNum): + i = n + 100 + tdSql.execute(f"insert into {dbname}.stb_2 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')" + % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1)) + + for k, v in column_dict.items(): + + if v == 'tinyint' or v == 'smallint' or v == 'int' or v == 'bigint' or v == 'tinyint unsigned' or v == 'smallint unsigned'\ + or v == 'int unsigned' or v == 'bigint unsigned': + tdSql.query(f"select last({k})-first({k}) from {dbname}.stb") + tdSql.checkData(0, 0, 109) + tdSql.query(f"select first({k})+last({k}) from {dbname}.stb") + tdSql.checkData(0, 0, 111) + tdSql.query(f"select max({k})-first({k}) from {dbname}.stb") + tdSql.checkData(0, 0, 109) + tdSql.query(f"select max({k})-min({k}) from {dbname}.stb") + tdSql.checkData(0, 0, 109) + + tdSql.query(f"select last({k})-first({k}) from {dbname}.stb_1") + tdSql.checkData(0, 0, 19) + tdSql.query(f"select first({k})+last({k}) from {dbname}.stb_1") + tdSql.checkData(0, 0, 21) + tdSql.query(f"select max({k})-first({k}) from {dbname}.stb_1") + tdSql.checkData(0, 0, 19) + tdSql.query(f"select max({k})-min({k}) from {dbname}.stb_1") + tdSql.checkData(0, 0, 19) + + # float,double + elif v == 'float' or v == 'double': + tdSql.query(f"select first({k})+last({k}) from {dbname}.stb") + tdSql.checkData(0, 0, 109.2) + tdSql.query(f"select first({k})+last({k}) from {dbname}.stb_1") + tdSql.checkData(0, 0, 19.2) + # bool + elif v == 'bool': + continue + # binary + elif 'binary' in v: + continue + # nchar + elif 'nchar' in v: + continue + + #tdSql.execute(f'drop database {dbname}') + + def run(self): + self.first_check_base() + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From dd55034c94a47718c31f5a6f13ba094932329b26 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Tue, 9 Apr 2024 17:42:20 +0800 Subject: [PATCH 56/64] fix: pk last write error --- source/dnode/vnode/src/inc/tsdb.h | 1 + source/dnode/vnode/src/tsdb/tsdbCache.c | 116 +++++++++++++++++------- 2 files changed, 86 insertions(+), 31 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index a082d33a02..a2bd9889fc 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -895,6 +895,7 @@ typedef enum { } EExecMode; typedef struct { + int64_t version; SRowKey rowKey; int8_t dirty; SColVal colVal; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 3a178f7ade..eac0678f3e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -339,6 +339,7 @@ static void rocksMayWrite(STsdb *pTsdb, bool force, bool read, bool lock) { static SLastCol *tsdbCacheConvertLastColV1(SLastColV1 *pLastColV1) { SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); if (pLastCol == NULL) return NULL; + pLastCol->version = LAST_COL_VERSION; pLastCol->rowKey.ts = pLastColV1->ts; pLastCol->rowKey.numOfPKs = 0; pLastCol->dirty = pLastColV1->dirty; @@ -408,7 +409,7 @@ static SLastCol *tsdbCacheDeserialize(char const *value) { if (!hasVersion) { return tsdbCacheDeserializeV1(value); } - return tsdbCacheDeserializeV2(value + sizeof(int64_t)); + return tsdbCacheDeserializeV2(value); } static uint32_t tsdbCacheCopyVarData(SValue *from, SValue *to) { @@ -423,7 +424,7 @@ static uint32_t tsdbCacheCopyVarData(SValue *from, SValue *to) { static void tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size) { SColVal *pColVal = &pLastCol->colVal; - size_t length = sizeof(int64_t) + sizeof(*pLastCol); + size_t length = sizeof(*pLastCol); for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { if (IS_VAR_DATA_TYPE(pLastCol->rowKey.pks[i].type)) { length += pLastCol->rowKey.pks[i].nData; @@ -435,14 +436,11 @@ static void tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size) { // set version *value = taosMemoryMalloc(length); - char *currentPos = *value; - *(int64_t *)currentPos = LAST_COL_VERSION; - currentPos += sizeof(int64_t); // copy last col - SLastCol* pToLastCol = (SLastCol *)currentPos; + SLastCol* pToLastCol = (SLastCol *)(*value); *pToLastCol = *pLastCol; - currentPos += sizeof(*pLastCol); + char *currentPos = *value + sizeof(*pLastCol); // copy var data pks for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { @@ -535,18 +533,22 @@ int32_t tsdbCacheCommit(STsdb *pTsdb) { return code; } -static void reallocVarData(SColVal *pColVal) { - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - uint8_t *pVal = pColVal->value.pData; - if (pColVal->value.nData > 0) { - pColVal->value.pData = taosMemoryMalloc(pColVal->value.nData); - memcpy(pColVal->value.pData, pVal, pColVal->value.nData); +static void reallocVarDataVal(SValue *pValue) { + if (IS_VAR_DATA_TYPE(pValue->type)) { + uint8_t *pVal = pValue->pData; + if (pValue->nData > 0) { + pValue->pData = taosMemoryMalloc(pValue->nData); + memcpy(pValue->pData, pVal, pValue->nData); } else { - pColVal->value.pData = NULL; + pValue->pData = NULL; } } } +static void reallocVarData(SColVal *pColVal) { + reallocVarDataVal(&pColVal->value); +} + static void tsdbCacheDeleter(const void *key, size_t klen, void *value, void *ud) { SLastCol *pLastCol = (SLastCol *)value; @@ -569,16 +571,26 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i SRowKey noneRowKey = {0}; noneRowKey.ts = TSKEY_MIN; noneRowKey.numOfPKs = 0; - SLastCol noneCol = {.rowKey = noneRowKey, .colVal = COL_VAL_NONE(cid, col_type), .dirty = 1}; + SLastCol noneCol = { + .version = LAST_COL_VERSION, .rowKey = noneRowKey, .colVal = COL_VAL_NONE(cid, col_type), .dirty = 1}; SLastCol *pLastCol = &noneCol; SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); *pTmpLastCol = *pLastCol; pLastCol = pTmpLastCol; - reallocVarData(&pLastCol->colVal); size_t charge = sizeof(*pLastCol); + + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue *pValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pValue->type)) { + reallocVarDataVal(pValue); + charge += pValue->nData; + } + } + if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) { + reallocVarData(&pLastCol->colVal); charge += pLastCol->colVal.value.nData; } @@ -923,6 +935,7 @@ static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal int nData = 0; // update rowkey + pLastCol->version = LAST_COL_VERSION; pLastCol->rowKey.ts = pRowKey->ts; pLastCol->rowKey.numOfPKs = pRowKey->numOfPKs; for (int8_t i = 0; i < pRowKey->numOfPKs; i++) { @@ -1015,7 +1028,6 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); - if (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1) { tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal); } @@ -1032,7 +1044,6 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); - if (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1) { tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal); } @@ -1096,9 +1107,17 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow *pTmpLastCol = *pLastCol; pLastCol = pTmpLastCol; - reallocVarData(&pLastCol->colVal); size_t charge = sizeof(*pLastCol); + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue *pValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pValue->type)) { + reallocVarDataVal(pValue); + charge += pValue->nData; + } + } + if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) { + reallocVarData(&pLastCol->colVal); charge += pLastCol->colVal.value.nData; } @@ -1128,9 +1147,17 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow *pTmpLastCol = *pLastCol; pLastCol = pTmpLastCol; - reallocVarData(&pLastCol->colVal); size_t charge = sizeof(*pLastCol); + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue *pValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pValue->type)) { + reallocVarDataVal(pValue); + charge += pValue->nData; + } + } + if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) { + reallocVarData(&pLastCol->colVal); charge += pLastCol->colVal.value.nData; } @@ -1428,7 +1455,8 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr } // still null, then make up a none col value - SLastCol noneCol = {.rowKey.ts = TSKEY_MIN, + SLastCol noneCol = {.version = LAST_COL_VERSION, + .rowKey.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(idxKey->key.cid, pr->pSchema->columns[slotIds[i]].type)}; if (!pLastCol) { pLastCol = &noneCol; @@ -1446,9 +1474,16 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr *pTmpLastCol = *pLastCol; pLastCol = pTmpLastCol; - reallocVarData(&pLastCol->colVal); size_t charge = sizeof(*pLastCol); + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue *pValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pValue->type)) { + reallocVarDataVal(pValue); + charge += pValue->nData; + } + } if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) { + reallocVarData(&pLastCol->colVal); charge += pLastCol->colVal.value.nData; } @@ -1530,9 +1565,16 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA *pTmpLastCol = *pLastCol; pLastCol = pTmpLastCol; - reallocVarData(&pLastCol->colVal); size_t charge = sizeof(*pLastCol); + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue *pValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pValue->type)) { + reallocVarDataVal(pValue); + charge += pValue->nData; + } + } if (IS_VAR_DATA_TYPE(pLastCol->colVal.value.type)) { + reallocVarData(&pLastCol->colVal); charge += pLastCol->colVal.value.nData; } @@ -1543,6 +1585,9 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA } SLastCol lastCol = *pLastCol; + for (int8_t i = 0; i < lastCol.rowKey.numOfPKs; i++) { + reallocVarDataVal(&lastCol.rowKey.pks[i]); + } reallocVarData(&lastCol.colVal); taosArraySet(pLastArray, idxKey->idx, &lastCol); taosArrayRemove(remainCols, j); @@ -1591,12 +1636,17 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); SLastCol lastCol = *pLastCol; + for (int8_t i = 0; i < lastCol.rowKey.numOfPKs; i++) { + reallocVarDataVal(&lastCol.rowKey.pks[i]); + } reallocVarData(&lastCol.colVal); taosArrayPush(pLastArray, &lastCol); taosLRUCacheRelease(pCache, h, false); } else { - SLastCol noneCol = {.rowKey.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)}; + SLastCol noneCol = {.version = LAST_COL_VERSION, + .rowKey.ts = TSKEY_MIN, + .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)}; taosArrayPush(pLastArray, &noneCol); @@ -1616,6 +1666,9 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); SLastCol lastCol = *pLastCol; + for (int8_t i = 0; i < lastCol.rowKey.numOfPKs; i++) { + reallocVarDataVal(&lastCol.rowKey.pks[i]); + } reallocVarData(&lastCol.colVal); taosArraySet(pLastArray, idxKey->idx, &lastCol); @@ -1702,7 +1755,6 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) { rocksdb_writebatch_delete(wb, keys_list[i], klen); } - taosMemoryFreeClear(pLastCol); pLastCol = tsdbCacheDeserialize(values_list[i + num_keys]); @@ -3232,7 +3284,9 @@ static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, for (int32_t i = 0; i < nCols; ++i) { int16_t slotId = slotIds[i]; - SLastCol col = {.rowKey.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)}; + SLastCol col = {.version = LAST_COL_VERSION, + .rowKey.ts = 0, + .colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)}; taosArrayPush(pColArray, &col); } *ppColArray = pColArray; @@ -3337,12 +3391,12 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, ((SValue){.type = pTColumn->type, .val = rowTs})); - taosArraySet(pColArray, 0, &(SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}); + taosArraySet(pColArray, 0, &(SLastCol){.version = LAST_COL_VERSION, .rowKey.ts = rowTs, .colVal = *pColVal}); continue; } tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); - *pCol = (SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.version = LAST_COL_VERSION, .rowKey.ts = rowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->value.type) /*&& pColVal->value.nData > 0*/) { if (pColVal->value.nData > 0) { pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); @@ -3392,7 +3446,7 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); if (!COL_VAL_IS_VALUE(tColVal) && COL_VAL_IS_VALUE(pColVal)) { - SLastCol lastCol = {.rowKey.ts = rowTs, .colVal = *pColVal}; + SLastCol lastCol = {.version = LAST_COL_VERSION, .rowKey.ts = rowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->value.type) /* && pColVal->value.nData > 0 */) { SLastCol *pLastCol = (SLastCol *)taosArrayGet(pColArray, iCol); taosMemoryFree(pLastCol->colVal.value.pData); @@ -3516,12 +3570,12 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, ((SValue){.type = pTColumn->type, .val = rowTs})); - taosArraySet(pColArray, 0, &(SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}); + taosArraySet(pColArray, 0, &(SLastCol){.version = LAST_COL_VERSION, .rowKey.ts = rowTs, .colVal = *pColVal}); continue; } tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); - *pCol = (SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.version = LAST_COL_VERSION, .rowKey.ts = rowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->value.type) /*&& pColVal->value.nData > 0*/) { if (pColVal->value.nData > 0) { pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); From 22b0067819a42ecf228d68ee5d07441b1eb5283a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 9 Apr 2024 17:58:03 +0800 Subject: [PATCH 57/64] fix(stream): add dropped stream task check. --- source/dnode/vnode/src/tq/tq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index ccfc8cc7c9..7886967be0 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -923,13 +923,14 @@ int32_t handleStep2Async(SStreamTask* pStreamTask, void* param) { STaskId hId = pStreamTask->hTaskInfo.id; SStreamTask* pTask = streamMetaAcquireTask(pStreamTask->pMeta, hId.streamId, hId.taskId); if (pTask == NULL) { - // todo handle error + tqWarn("s-task:0x%x failed to acquired it to exec step 2, scan wal quit", (int32_t) hId.taskId); + return TSDB_CODE_SUCCESS; } doStartFillhistoryStep2(pTask, pStreamTask, pTq); streamMetaReleaseTask(pMeta, pTask); - return 0; + return TSDB_CODE_SUCCESS; } // this function should be executed by only one thread, so we set an sentinel to protect this function From b664e2078b58c1806d7c71cb9dd81afbd55642da Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Tue, 9 Apr 2024 18:33:33 +0800 Subject: [PATCH 58/64] fix: last memory errors --- source/dnode/vnode/src/tsdb/tsdbCache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index eac0678f3e..3c0ec6d0c1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1089,6 +1089,7 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow // SColVal *pColVal = (SColVal *)taosArrayGet(aColVal, idxKey->idx); SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); + SLastCol *PToFree = pLastCol; if (IS_LAST_ROW_KEY(idxKey->key)) { if (NULL == pLastCol || (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1)) { @@ -1170,10 +1171,9 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow taosMemoryFree(value); } } - - taosMemoryFree(pLastCol); } + taosMemoryFreeClear(PToFree); rocksdb_free(values_list[i]); } @@ -1559,6 +1559,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA SLRUCache *pCache = pTsdb->lruCache; for (int i = 0, j = 0; i < num_keys && j < TARRAY_SIZE(remainCols); ++i) { SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); + SLastCol* PToFree = pLastCol; SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[j]; if (pLastCol) { SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); @@ -1592,7 +1593,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA taosArraySet(pLastArray, idxKey->idx, &lastCol); taosArrayRemove(remainCols, j); - taosMemoryFree(pLastCol); + taosMemoryFreeClear(PToFree); taosMemoryFree(values_list[i]); } else { ++j; From e4a450fa6927733382fcdc518acd890999c26229 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 9 Apr 2024 19:28:19 +0800 Subject: [PATCH 59/64] enh: insert nchar by sql --- source/libs/parser/src/parInsertSql.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 9a7d0f4839..344a6e7fe2 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1572,11 +1572,13 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, case TSDB_DATA_TYPE_NCHAR: { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' int32_t len = 0; - char* pUcs4 = taosMemoryCalloc(1, pSchema->bytes - VARSTR_HEADER_SIZE); + int64_t maxLen = pToken->n << 2; + if (maxLen > pSchema->bytes - VARSTR_HEADER_SIZE) maxLen = pSchema->bytes - VARSTR_HEADER_SIZE; + char* pUcs4 = taosMemoryMalloc(maxLen); if (NULL == pUcs4) { return TSDB_CODE_OUT_OF_MEMORY; } - if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, pSchema->bytes - VARSTR_HEADER_SIZE, &len)) { + if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, maxLen, &len)) { taosMemoryFree(pUcs4); if (errno == E2BIG) { return generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); From 706ac9a9e600d7b517e7cec117a8160961695126 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 9 Apr 2024 19:33:32 +0800 Subject: [PATCH 60/64] enh: insert nchar by sql --- source/libs/parser/src/parInsertSql.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 344a6e7fe2..afdd6089d2 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1572,13 +1572,13 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, case TSDB_DATA_TYPE_NCHAR: { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' int32_t len = 0; - int64_t maxLen = pToken->n << 2; - if (maxLen > pSchema->bytes - VARSTR_HEADER_SIZE) maxLen = pSchema->bytes - VARSTR_HEADER_SIZE; - char* pUcs4 = taosMemoryMalloc(maxLen); + int64_t realLen = pToken->n << 2; + if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE; + char* pUcs4 = taosMemoryMalloc(realLen); if (NULL == pUcs4) { return TSDB_CODE_OUT_OF_MEMORY; } - if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, maxLen, &len)) { + if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, realLen, &len)) { taosMemoryFree(pUcs4); if (errno == E2BIG) { return generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); From e0f1e8502ee6de1f0a300e0348bdc28705d89129 Mon Sep 17 00:00:00 2001 From: slzhou Date: Wed, 10 Apr 2024 09:03:04 +0800 Subject: [PATCH 61/64] fix: add pk col to last row scan cols --- source/libs/planner/src/planOptimizer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 1e2f3c53af..f52fd4d51c 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -2997,6 +2997,15 @@ static int32_t lastRowScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogic if (FUNCTION_TYPE_LAST == funcType) { nodesWalkExpr(nodesListGetNode(pFunc->pParameterList, 0), lastRowScanOptSetColDataType, &cxt); nodesListErase(pFunc->pParameterList, nodesListGetCell(pFunc->pParameterList, 1)); + if (pFunc->hasPk) { + if (LIST_LENGTH(pFunc->pParameterList) != 2) { + planError("last func which has pk but its parameter list length is not 2"); + nodesClearList(cxt.pLastCols); + taosArrayDestroy(isDuplicateCol); + return TSDB_CODE_PLAN_INTERNAL_ERROR; + } + nodesWalkExpr(nodesListGetNode(pFunc->pParameterList, 1), lastRowScanOptSetColDataType, &cxt); + } } } else { pNode = nodesListGetNode(pFunc->pParameterList, 0); From 46b21a7a5ba2cf22daf7a47ae6f95fc179952483 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 10 Apr 2024 09:07:47 +0800 Subject: [PATCH 62/64] fix(test): update cases. --- tests/script/tsim/stream/udTableAndCol0.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/stream/udTableAndCol0.sim b/tests/script/tsim/stream/udTableAndCol0.sim index 9c8a5aaaad..a0aeb5bb30 100644 --- a/tests/script/tsim/stream/udTableAndCol0.sim +++ b/tests/script/tsim/stream/udTableAndCol0.sim @@ -93,7 +93,7 @@ sql create stream streams21 trigger at_once ignore expired 0 ignore update 0 in sql_error create stream streams22 trigger at_once ignore expired 0 ignore update 0 into streamt22 as select ts,1, b from rct1; -sql_error create stream streams23 trigger at_once ignore expired 0 ignore update 0 into streamt23 as select ts, a, b from rct1; +sql create stream streams23 trigger at_once ignore expired 0 ignore update 0 into streamt23 as select ts, a, b from rct1; sql create stream streams24 trigger at_once ignore expired 0 ignore update 0 into streamt24(ts, a primary key, b) as select ts, a, b from rct1; sql create stream streams25 trigger at_once ignore expired 0 ignore update 0 into rst6 as select ts, a, b from rct1; From 4137c719094f4b78c95f0c622105df49933222c3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 10 Apr 2024 13:54:27 +0800 Subject: [PATCH 63/64] add stream check --- source/libs/parser/src/parTranslater.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 59ce465c08..1a37ae811d 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8161,6 +8161,7 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC } int32_t code = TSDB_CODE_SUCCESS; + bool hasTsKey = false; bool hasPrimaryKey = false; SNode* pCol = NULL; SNode* pProj = NULL; @@ -8176,13 +8177,22 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC break; } if (PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { + hasTsKey = true; + } + + if (pSchema->flags & COL_IS_KEY) { hasPrimaryKey = true; } } - if (TSDB_CODE_SUCCESS == code && !hasPrimaryKey) { + if (TSDB_CODE_SUCCESS == code && !hasTsKey) { code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, - "primary timestamp column can not be null"); + "Primary timestamp column of dest table can not be null"); + } + + if (TSDB_CODE_SUCCESS == code && !hasPrimaryKey && hasPkInTable(pMeta)) { + code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, + "Primary key column of dest table can not be null"); } SNodeList* pNewProjections = NULL; From 1bcf693f071c392f4b5b24e9b4f1ff035c8ae3fe Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 10 Apr 2024 15:06:43 +0800 Subject: [PATCH 64/64] more code --- include/common/tdataformat.h | 7 +++-- include/common/tmsg.h | 1 + source/common/src/tdataformat.c | 41 +++++++++++++++++++++++++-- source/common/src/tmsg.c | 15 +++++++--- source/dnode/vnode/src/vnd/vnodeSvr.c | 20 +++++++------ 5 files changed, 66 insertions(+), 18 deletions(-) diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 6c8a39caf6..3f3ec30569 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -126,7 +126,7 @@ int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag); int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag); void tRowGetKey(SRow *pRow, SRowKey *key); int32_t tRowKeyCompare(const void *p1, const void *p2); -int32_t tRowKeyAssign(SRowKey* pDst, SRowKey* pSrc); +int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc); // SRowIter ================================ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter); @@ -174,6 +174,7 @@ int32_t tColDataUpdateValue(SColData *pColData, SColVal *pColVal, bool forward); void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal); uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal); int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMalloc, void *arg); +void tColDataArrGetRowKey(SColData *aColData, int32_t nColData, int32_t iRow, SRowKey *key); extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min, int16_t *numOfNull); @@ -188,8 +189,8 @@ void tColDataSortMerge(SArray *colDataArr); int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap, char *data); // for encode/decode -int32_t tPutColData(uint8_t *pBuf, SColData *pColData); -int32_t tGetColData(uint8_t *pBuf, SColData *pColData); +int32_t tPutColData(uint8_t version, uint8_t *pBuf, SColData *pColData); +int32_t tGetColData(uint8_t version, uint8_t *pBuf, SColData *pColData); // STRUCT ================================ struct STColumn { diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 1be5abbf76..33e77aee2b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -4037,6 +4037,7 @@ int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq); #define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2 #define SUBMIT_REQ_FROM_FILE 0x4 #define TD_REQ_FROM_TAOX 0x8 +#define SUBMIT_REQUEST_VERSION (1) #define TD_REQ_FROM_TAOX_OLD 0x1 // for compatibility diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 1585c12ac1..f13a0a0825 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -3111,7 +3111,7 @@ static int32_t tColDataCopyRowAppend(SColData *aFromColData, int32_t iFromRow, S return code; } -static FORCE_INLINE void tColDataArrGetRowKey(SColData *aColData, int32_t nColData, int32_t iRow, SRowKey *key) { +void tColDataArrGetRowKey(SColData *aColData, int32_t nColData, int32_t iRow, SRowKey *key) { SColVal cv; key->ts = ((TSKEY *)aColData[0].pData)[iRow]; @@ -3490,7 +3490,7 @@ _exit: return; } -int32_t tPutColData(uint8_t *pBuf, SColData *pColData) { +static int32_t tPutColDataVersion0(uint8_t *pBuf, SColData *pColData) { int32_t n = 0; n += tPutI16v(pBuf ? pBuf + n : NULL, pColData->cid); @@ -3532,7 +3532,7 @@ int32_t tPutColData(uint8_t *pBuf, SColData *pColData) { return n; } -int32_t tGetColData(uint8_t *pBuf, SColData *pColData) { +static int32_t tGetColDataVersion0(uint8_t *pBuf, SColData *pColData) { int32_t n = 0; n += tGetI16v(pBuf + n, &pColData->cid); @@ -3571,10 +3571,45 @@ int32_t tGetColData(uint8_t *pBuf, SColData *pColData) { n += pColData->nData; } } + pColData->cflag = 0; return n; } +static int32_t tPutColDataVersion1(uint8_t *pBuf, SColData *pColData) { + int32_t n = tPutColDataVersion0(pBuf, pColData); + n += tPutI8(pBuf ? pBuf + n : NULL, pColData->cflag); + return n; +} + +static int32_t tGetColDataVersion1(uint8_t *pBuf, SColData *pColData) { + int32_t n = tGetColDataVersion0(pBuf, pColData); + n += tGetI8(pBuf ? pBuf + n : NULL, &pColData->cflag); + return n; +} + +int32_t tPutColData(uint8_t version, uint8_t *pBuf, SColData *pColData) { + if (version == 0) { + return tPutColDataVersion0(pBuf, pColData); + } else if (version == 1) { + return tPutColDataVersion1(pBuf, pColData); + } else { + ASSERT(0); + return -1; + } +} + +int32_t tGetColData(uint8_t version, uint8_t *pBuf, SColData *pColData) { + if (version == 0) { + return tGetColDataVersion0(pBuf, pColData); + } else if (version == 1) { + return tGetColDataVersion1(pBuf, pColData); + } else { + ASSERT(0); + return -1; + } +} + #define CALC_SUM_MAX_MIN(SUM, MAX, MIN, VAL) \ do { \ (SUM) += (VAL); \ diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 3fd8d53885..e4c6c9494a 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -9074,7 +9074,8 @@ int32_t tDecodeSBatchDeleteReqSetCtime(SDecoder *pDecoder, SBatchDeleteReq *pReq static int32_t tEncodeSSubmitTbData(SEncoder *pCoder, const SSubmitTbData *pSubmitTbData) { if (tStartEncode(pCoder) < 0) return -1; - if (tEncodeI32v(pCoder, pSubmitTbData->flags) < 0) return -1; + int32_t flags = pSubmitTbData->flags | ((SUBMIT_REQUEST_VERSION) << 8); + if (tEncodeI32v(pCoder, flags) < 0) return -1; // auto create table if (pSubmitTbData->flags & SUBMIT_REQ_AUTO_CREATE_TABLE) { @@ -9094,7 +9095,8 @@ static int32_t tEncodeSSubmitTbData(SEncoder *pCoder, const SSubmitTbData *pSubm if (tEncodeU64v(pCoder, nColData) < 0) return -1; for (uint64_t i = 0; i < nColData; i++) { - pCoder->pos += tPutColData(pCoder->data ? pCoder->data + pCoder->pos : NULL, &aColData[i]); + pCoder->pos += + tPutColData(SUBMIT_REQUEST_VERSION, pCoder->data ? pCoder->data + pCoder->pos : NULL, &aColData[i]); } } else { if (tEncodeU64v(pCoder, TARRAY_SIZE(pSubmitTbData->aRowP)) < 0) return -1; @@ -9113,13 +9115,18 @@ static int32_t tEncodeSSubmitTbData(SEncoder *pCoder, const SSubmitTbData *pSubm static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbData) { int32_t code = 0; + int32_t flags; + uint8_t version; if (tStartDecode(pCoder) < 0) { code = TSDB_CODE_INVALID_MSG; goto _exit; } - if (tDecodeI32v(pCoder, &pSubmitTbData->flags) < 0) return -1; + if (tDecodeI32v(pCoder, &flags) < 0) return -1; + + pSubmitTbData->flags = flags & 0xff; + version = (flags >> 8) & 0xff; if (pSubmitTbData->flags & SUBMIT_REQ_AUTO_CREATE_TABLE) { pSubmitTbData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq)); @@ -9163,7 +9170,7 @@ static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbDa } for (int32_t i = 0; i < nColData; ++i) { - pCoder->pos += tGetColData(pCoder->data + pCoder->pos, taosArrayReserve(pSubmitTbData->aCol, 1)); + pCoder->pos += tGetColData(version, pCoder->data + pCoder->pos, taosArrayReserve(pSubmitTbData->aCol, 1)); } } else { uint64_t nRow; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index a4af782ad7..fae28ca32c 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -240,10 +240,13 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int } SSubmitTbData submitTbData; + uint8_t version; if (tDecodeI32v(pCoder, &submitTbData.flags) < 0) { code = TSDB_CODE_INVALID_MSG; TSDB_CHECK_CODE(code, lino, _exit); } + version = (submitTbData.flags >> 8) & 0xff; + submitTbData.flags = submitTbData.flags & 0xff; if (submitTbData.flags & SUBMIT_REQ_FROM_FILE) { code = grantCheck(TSDB_GRANT_CSV); @@ -307,7 +310,7 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int } SColData colData = {0}; - pCoder->pos += tGetColData(pCoder->data + pCoder->pos, &colData); + pCoder->pos += tGetColData(version, pCoder->data + pCoder->pos, &colData); if (colData.flag != HAS_VALUE) { code = TSDB_CODE_INVALID_MSG; goto _exit; @@ -321,7 +324,7 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int } for (uint64_t i = 1; i < nColData; i++) { - pCoder->pos += tGetColData(pCoder->data + pCoder->pos, &colData); + pCoder->pos += tGetColData(version, pCoder->data + pCoder->pos, &colData); } } else { uint64_t nRow; @@ -1572,17 +1575,18 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in goto _exit; } - SColData *pColData = (SColData *)taosArrayGet(pSubmitTbData->aCol, 0); - TSKEY *aKey = (TSKEY *)(pColData->pData); - - for (int32_t iRow = 0; iRow < pColData->nVal; iRow++) { - if (aKey[iRow] < minKey || aKey[iRow] > maxKey || (iRow > 0 && aKey[iRow] <= aKey[iRow - 1])) { + SColData *colDataArr = TARRAY_DATA(pSubmitTbData->aCol); + SRowKey lastKey; + tColDataArrGetRowKey(colDataArr, TARRAY_SIZE(pSubmitTbData->aCol), 0, &lastKey); + for (int32_t iRow = 1; iRow < colDataArr[0].nVal; iRow++) { + SRowKey key; + tColDataArrGetRowKey(TARRAY_DATA(pSubmitTbData->aCol), TARRAY_SIZE(pSubmitTbData->aCol), iRow, &key); + if (tRowKeyCompare(&lastKey, &key) >= 0) { code = TSDB_CODE_INVALID_MSG; vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), ver); goto _exit; } } - } else { int32_t nRow = TARRAY_SIZE(pSubmitTbData->aRowP); SRow **aRow = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP);