From f0c6515e362df3d96a49fa418b1d32eb96a89e8d Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 19 Mar 2024 15:01:39 +0800 Subject: [PATCH 001/106] 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 002/106] 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 003/106] 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 7d27ba20d665a04fe33cd436c6f24bde821298cd Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 21 Mar 2024 03:58:24 +0000 Subject: [PATCH 004/106] fix queue log --- source/util/src/tworker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 138d4bc1f4..0712010458 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -19,7 +19,7 @@ #include "tgeosctx.h" #include "tlog.h" -#define QUEUE_THRESHOLD 1000 * 1000 +#define QUEUE_THRESHOLD (1000 * 1000) typedef void *(*ThreadFp)(void *param); From f853272d77fb8388ac1e9535a3f30508aa407f25 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 21 Mar 2024 08:54:13 +0000 Subject: [PATCH 005/106] port main to 3.0 --- source/libs/transport/src/transCli.c | 71 +++++----------------------- 1 file changed, 13 insertions(+), 58 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index ac45f1eef6..e27e9a4ac0 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -585,11 +585,11 @@ void* destroyConnPool(SCliThrd* pThrd) { static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { void* pool = pThrd->pool; STrans* pTranInst = pThrd->pTransInst; - SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1); + SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key)); if (plist == NULL) { SConnList list = {0}; - taosHashPut((SHashObj*)pool, key, strlen(key) + 1, (void*)&list, sizeof(list)); - plist = taosHashGet(pool, key, strlen(key) + 1); + taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list)); + plist = taosHashGet(pool, key, strlen(key)); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); QUEUE_INIT(&nList->msgQ); @@ -624,11 +624,11 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { void* pool = pThrd->pool; STrans* pTransInst = pThrd->pTransInst; - SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1); + SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key)); if (plist == NULL) { SConnList list = {0}; - taosHashPut((SHashObj*)pool, key, strlen(key) + 1, (void*)&list, sizeof(list)); - plist = taosHashGet(pool, key, strlen(key) + 1); + taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list)); + plist = taosHashGet(pool, key, strlen(key)); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); QUEUE_INIT(&nList->msgQ); @@ -714,7 +714,7 @@ static void addConnToPool(void* pool, SCliConn* conn) { cliDestroyConnMsgs(conn, false); if (conn->list == NULL) { - conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr) + 1); + conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr)); } SConnList* pList = conn->list; @@ -1279,7 +1279,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { if (pMsg != NULL && REQUEST_NO_RESP(&pMsg->msg) && (pTransInst->failFastFp != NULL && pTransInst->failFastFp(pMsg->msg.msgType))) { - SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr) + 1); + SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr)); int64_t cTimestamp = taosGetTimestampMs(); if (item != NULL) { int32_t elapse = cTimestamp - item->timestamp; @@ -1291,7 +1291,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { } } else { SFailFastItem item = {.count = 1, .timestamp = cTimestamp}; - taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr) + 1, &item, sizeof(SFailFastItem)); + taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem)); } } } else { @@ -1471,7 +1471,7 @@ FORCE_INLINE int32_t cliBuildExceptResp(SCliMsg* pMsg, STransMsg* pResp) { } static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) { uint32_t addr = 0; - uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn) + 1); + uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn)); if (v == NULL) { addr = taosGetIpv4FromFqdn(fqdn); if (addr == 0xffffffff) { @@ -1480,7 +1480,7 @@ static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) return addr; } - taosHashPut(cache, fqdn, strlen(fqdn) + 1, &addr, sizeof(addr)); + taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr)); } else { addr = *v; } @@ -1490,13 +1490,13 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn) { // impl later uint32_t addr = taosGetIpv4FromFqdn(fqdn); if (addr != 0xffffffff) { - uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn) + 1); + uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn)); if (addr != *v) { char old[64] = {0}, new[64] = {0}; tinet_ntoa(old, *v); tinet_ntoa(new, addr); tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new); - taosHashPut(cache, fqdn, strlen(fqdn) + 1, &addr, sizeof(addr)); + taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr)); } } return; @@ -1537,21 +1537,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { return; } - if (rpcDebugFlag & DEBUG_TRACE) { - if (tmsgIsValid(pMsg->msg.msgType)) { - char buf[128] = {0}; - sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType)); - int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); - if (NULL == 0) { - int localCount = 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } else { - int localCount = *count + 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } - } - } - char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet); uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet); char addr[TSDB_FQDN_LEN + 64] = {0}; @@ -1705,7 +1690,6 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) { char key[TSDB_FQDN_LEN + 64] = {0}; CONN_CONSTRUCT_HASH_KEY(key, ip, port); - // SCliBatch** ppBatch = taosHashGet(pThrd->batchCache, key, sizeof(key)); SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, sizeof(key)); if (ppBatchList == NULL || *ppBatchList == NULL) { SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList)); @@ -1800,21 +1784,6 @@ static void cliAsyncCb(uv_async_t* handle) { QUEUE_MOVE(&item->qmsg, &wq); taosThreadMutexUnlock(&item->mtx); - if (rpcDebugFlag & DEBUG_TRACE) { - void* pIter = taosHashIterate(pThrd->msgCount, NULL); - while (pIter != NULL) { - int* count = pIter; - size_t len = 0; - char* key = taosHashGetKey(pIter, &len); - if (*count != 0) { - tDebug("key: %s count: %d", key, *count); - } - - pIter = taosHashIterate(pThrd->msgCount, pIter); - } - tDebug("all conn count: %d", pThrd->newConnCount); - } - int8_t supportBatch = pTransInst->supportBatch; if (supportBatch == 0) { cliNoBatchDealReq(&wq, pThrd); @@ -2411,20 +2380,6 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); } } - if (rpcDebugFlag & DEBUG_TRACE) { - if (tmsgIsValid(pResp->msgType - 1)) { - char buf[128] = {0}; - sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); - int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); - if (NULL == 0) { - int localCount = 0; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } else { - int localCount = *count - 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } - } - } if (pCtx->pSem || pCtx->syncMsgRef != 0) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pSem) { From 89b9f87b7d2486c349169d1dd81b707e449b9b0c Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 21 Mar 2024 09:01:13 +0000 Subject: [PATCH 006/106] port main to 3.0 --- source/libs/transport/src/transCli.c | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e27e9a4ac0..b335979cd5 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -585,11 +585,12 @@ void* destroyConnPool(SCliThrd* pThrd) { static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { void* pool = pThrd->pool; STrans* pTranInst = pThrd->pTransInst; - SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key)); + size_t klen = strlen(key); + SConnList* plist = taosHashGet((SHashObj*)pool, key, klen); if (plist == NULL) { SConnList list = {0}; - taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list)); - plist = taosHashGet(pool, key, strlen(key)); + taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list)); + plist = taosHashGet(pool, key, klen); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); QUEUE_INIT(&nList->msgQ); @@ -624,11 +625,12 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { void* pool = pThrd->pool; STrans* pTransInst = pThrd->pTransInst; - SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key)); + size_t klen = strlen(key); + SConnList* plist = taosHashGet((SHashObj*)pool, key, klen); if (plist == NULL) { SConnList list = {0}; - taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list)); - plist = taosHashGet(pool, key, strlen(key)); + taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list)); + plist = taosHashGet(pool, key, klen); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); QUEUE_INIT(&nList->msgQ); @@ -1471,7 +1473,8 @@ FORCE_INLINE int32_t cliBuildExceptResp(SCliMsg* pMsg, STransMsg* pResp) { } static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) { uint32_t addr = 0; - uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn)); + size_t len = strlen(fqdn); + uint32_t* v = taosHashGet(cache, fqdn, len); if (v == NULL) { addr = taosGetIpv4FromFqdn(fqdn); if (addr == 0xffffffff) { @@ -1480,7 +1483,7 @@ static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) return addr; } - taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr)); + taosHashPut(cache, fqdn, len, &addr, sizeof(addr)); } else { addr = *v; } @@ -1490,13 +1493,14 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn) { // impl later uint32_t addr = taosGetIpv4FromFqdn(fqdn); if (addr != 0xffffffff) { - uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn)); + size_t len = strlen(fqdn); + uint32_t* v = taosHashGet(cache, fqdn, len); if (addr != *v) { char old[64] = {0}, new[64] = {0}; tinet_ntoa(old, *v); tinet_ntoa(new, addr); tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new); - taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr)); + taosHashPut(cache, fqdn, len, &addr, sizeof(addr)); } } return; @@ -1689,8 +1693,8 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) { uint32_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet); char key[TSDB_FQDN_LEN + 64] = {0}; CONN_CONSTRUCT_HASH_KEY(key, ip, port); - - SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, sizeof(key)); + size_t klen = strlen(key); + SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, klen); if (ppBatchList == NULL || *ppBatchList == NULL) { SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList)); QUEUE_INIT(&pBatchList->wq); @@ -1714,7 +1718,7 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) { QUEUE_PUSH(&pBatchList->wq, &pBatch->listq); - taosHashPut(pThrd->batchCache, key, sizeof(key), &pBatchList, sizeof(void*)); + taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*)); } else { if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) { SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch)); From 85ccba0fab6a2bfa5ab6c407385fbd5b800484e6 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Fri, 22 Mar 2024 15:27:22 +0800 Subject: [PATCH 007/106] 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 008/106] 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 ea424e822ece6f9aa17ed9e074a1dfc91c594adf Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 25 Mar 2024 11:00:33 +0800 Subject: [PATCH 009/106] fix(tsdb/util): fix missing column value with row iter --- source/dnode/vnode/src/tsdb/tsdbUtil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 44621bf4e6..076db8b3ca 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -642,8 +642,8 @@ SColVal *tsdbRowIterNext(STSDBRowIter *pIter) { return &pIter->cv; } - if (pIter->iColData < pIter->pRow->pBlockData->nColData) { - tColDataGetValue(&pIter->pRow->pBlockData->aColData[pIter->iColData], pIter->pRow->iRow, &pIter->cv); + if (pIter->iColData <= pIter->pRow->pBlockData->nColData) { + tColDataGetValue(&pIter->pRow->pBlockData->aColData[pIter->iColData - 1], pIter->pRow->iRow, &pIter->cv); ++pIter->iColData; return &pIter->cv; } else { From d1b974228f8782c53b13962f6b63775e89c52f0a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 25 Mar 2024 11:16:28 +0800 Subject: [PATCH 010/106] 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 ced7c19943cc0dd5932cec4207a3fa752aca9621 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Mon, 25 Mar 2024 17:01:06 +0800 Subject: [PATCH 011/106] enh: not to start snap replication if too many open files already --- source/libs/sync/src/syncPipeline.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index d40fff447f..3543ed574c 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -866,9 +866,14 @@ int32_t syncLogReplRecover(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEn SyncTerm term = -1; SyncIndex firstVer = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore); SyncIndex index = TMIN(pMsg->matchIndex, pNode->pLogBuf->matchIndex); + errno = 0; if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) { term = syncLogReplGetPrevLogTerm(pMgr, pNode, index + 1); + if (term < 0 && (errno == ENFILE || errno == EMFILE)) { + sError("vgId:%d, failed to get prev log term since %s. index:%" PRId64, pNode->vgId, terrstr(), index + 1); + return -1; + } if ((index + 1 < firstVer) || (term < 0) || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); From 6aaac7c0dcb656bf08d3248f15acd5ecf40bcd9c Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 25 Mar 2024 17:57:13 +0800 Subject: [PATCH 012/106] fix:decode task error if task version is smaller than 2 --- source/libs/stream/src/streamTask.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 4ca784a32f..13a4f5012d 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -287,7 +287,9 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { if (tDecodeCStrTo(pDecoder, pTask->outputInfo.shuffleDispatcher.stbFullName) < 0) return -1; } if (tDecodeI64(pDecoder, &pTask->info.triggerParam) < 0) return -1; - if (tDecodeI8(pDecoder, &pTask->subtableWithoutMd5) < 0) return -1; + if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + if (tDecodeI8(pDecoder, &pTask->subtableWithoutMd5) < 0) return -1; + } if (tDecodeCStrTo(pDecoder, pTask->reserve) < 0) return -1; tEndDecode(pDecoder); From 44ce5b951df0f4851163cae18cc283077fe70c12 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 25 Mar 2024 17:43:45 +0800 Subject: [PATCH 013/106] fix: arb group leak --- source/dnode/mnode/impl/inc/mndArbGroup.h | 1 + source/dnode/mnode/impl/src/mndArbGroup.c | 27 ++++++++++++++++++----- source/dnode/mnode/impl/src/mndDb.c | 19 ++++++++++++++++ 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndArbGroup.h b/source/dnode/mnode/impl/inc/mndArbGroup.h index ed852cf581..fcd11310e7 100644 --- a/source/dnode/mnode/impl/inc/mndArbGroup.h +++ b/source/dnode/mnode/impl/inc/mndArbGroup.h @@ -35,6 +35,7 @@ int32_t mndSetCreateArbGroupRedoLogs(STrans *pTrans, SArbGroup *pGroup); int32_t mndSetCreateArbGroupUndoLogs(STrans *pTrans, SArbGroup *pGroup); int32_t mndSetCreateArbGroupCommitLogs(STrans *pTrans, SArbGroup *pGroup); +int32_t mndSetDropArbGroupPrepareLogs(STrans *pTrans, SArbGroup *pGroup); int32_t mndSetDropArbGroupCommitLogs(STrans *pTrans, SArbGroup *pGroup); bool mndUpdateArbGroupByHeartBeat(SArbGroup *pGroup, SVArbHbRspMember *pRspMember, int64_t nowMs, int32_t dnodeId, diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index e056e698f3..92ab5274e4 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -260,6 +260,14 @@ int32_t mndSetCreateArbGroupCommitLogs(STrans *pTrans, SArbGroup *pGroup) { return 0; } +int32_t mndSetDropArbGroupPrepareLogs(STrans *pTrans, SArbGroup *pGroup) { + SSdbRaw *pRedoRaw = mndArbGroupActionEncode(pGroup); + if (pRedoRaw == NULL) return -1; + if (mndTransAppendPrepareLog(pTrans, pRedoRaw) != 0) return -1; + if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING) != 0) return -1; + return 0; +} + static int32_t mndSetDropArbGroupRedoLogs(STrans *pTrans, SArbGroup *pGroup) { SSdbRaw *pRedoRaw = mndArbGroupActionEncode(pGroup); if (pRedoRaw == NULL) return -1; @@ -535,10 +543,10 @@ static int32_t mndProcessArbCheckSyncTimer(SRpcMsg *pReq) { int32_t vgId = arbGroupDup.vgId; int64_t nowMs = taosGetTimestampMs(); - bool member0IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 0, nowMs); - bool member1IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 1, nowMs); - SArbAssignedLeader* pAssignedLeader = &arbGroupDup.assignedLeader; - int32_t currentAssignedDnodeId = pAssignedLeader->dnodeId; + bool member0IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 0, nowMs); + bool member1IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 1, nowMs); + SArbAssignedLeader *pAssignedLeader = &arbGroupDup.assignedLeader; + int32_t currentAssignedDnodeId = pAssignedLeader->dnodeId; // 1. has assigned && is sync => send req if (currentAssignedDnodeId != 0 && arbGroupDup.isSync == true) { @@ -667,9 +675,16 @@ static int32_t mndProcessArbUpdateGroupReq(SRpcMsg *pReq) { memcpy(newGroup.assignedLeader.token, req.assignedLeader.token, TSDB_ARB_TOKEN_SIZE); newGroup.version = req.version; - SMnode *pMnode = pReq->info.node; + SMnode *pMnode = pReq->info.node; + SArbGroup *pOldGroup = sdbAcquire(pMnode->pSdb, SDB_ARBGROUP, &newGroup.vgId); + if (!pOldGroup) { + mInfo("vgId:%d, arb skip to update arbgroup, since no obj found", newGroup.vgId); + return 0; + } + sdbRelease(pMnode->pSdb, pOldGroup); + if (mndArbGroupUpdateTrans(pMnode, &newGroup) != 0) { - mError("vgId:%d, arb failed to update arbgroup, since %s", req.vgId, terrstr()); + mError("vgId:%d, arb failed to update arbgroup, since %s", newGroup.vgId, terrstr()); ret = -1; } diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index a1f3a24661..527105a7b8 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1209,6 +1209,25 @@ static int32_t mndSetDropDbPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p if (mndTransAppendPrepareLog(pTrans, pRedoRaw) != 0) return -1; if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING) != 0) return -1; + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + + while (1) { + SArbGroup *pArbGroup = NULL; + pIter = sdbFetch(pSdb, SDB_ARBGROUP, pIter, (void **)&pArbGroup); + if (pIter == NULL) break; + + if (pArbGroup->dbUid == pDb->uid) { + if (mndSetDropArbGroupPrepareLogs(pTrans,pArbGroup) != 0) { + sdbCancelFetch(pSdb, pIter); + sdbRelease(pSdb, pArbGroup); + return -1; + } + } + + sdbRelease(pSdb, pArbGroup); + } + return 0; } From e5abe34c84ae04f9ee652feb3274d354d22ba348 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 25 Mar 2024 21:34:31 +0800 Subject: [PATCH 014/106] fix: replace strdup for release build --- source/libs/executor/src/sysscanoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 589c23ed3a..628aacf3c3 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -879,7 +879,7 @@ static int32_t sysTableGetGeomText(char* iGeom, int32_t nGeom, char** output, in char* outputWKT = NULL; if (nGeom == 0) { - if (!(*output = strdup(""))) code = TSDB_CODE_OUT_OF_MEMORY; + if (!(*output = taosStrdup(""))) code = TSDB_CODE_OUT_OF_MEMORY; *nOutput = 0; return code; } From a11b2c614e3c83e58d19e4dad09f5b3dfd65d70c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 25 Mar 2024 23:41:22 +0800 Subject: [PATCH 015/106] fix(stream): not return error when failing to load stream task meta. --- source/dnode/vnode/src/tq/tq.c | 5 +--- source/libs/stream/src/streamMeta.c | 40 ++++++++++++----------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index ffebd783ac..ccfc8cc7c9 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -101,10 +101,7 @@ int32_t tqInitialize(STQ* pTq) { return -1; } - if (streamMetaLoadAllTasks(pTq->pStreamMeta) < 0) { - return -1; - } - + /*int32_t code = */streamMetaLoadAllTasks(pTq->pStreamMeta); return 0; } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 5f6440c06d..fc06a8975f 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -824,13 +824,6 @@ int64_t streamMetaGetLatestCheckpointId(SStreamMeta* pMeta) { return chkpId; } -static void doClear(void* pKey, void* pVal, TBC* pCur, SArray* pRecycleList) { - tdbFree(pKey); - tdbFree(pVal); - tdbTbcClose(pCur); - taosArrayDestroy(pRecycleList); -} - int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { TBC* pCur = NULL; void* pKey = NULL; @@ -847,10 +840,11 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { int32_t vgId = pMeta->vgId; stInfo("vgId:%d load stream tasks from meta files", vgId); - if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) { - stError("vgId:%d failed to open stream meta, code:%s", vgId, tstrerror(terrno)); + int32_t code = tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL); + if (code != TSDB_CODE_SUCCESS) { + stError("vgId:%d failed to open stream meta, code:%s, not load any stream tasks", vgId, tstrerror(terrno)); taosArrayDestroy(pRecycleList); - return -1; + return TSDB_CODE_SUCCESS; } tdbTbcMoveToFirst(pCur); @@ -859,20 +853,18 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { if (pTask == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; stError("vgId:%d failed to load stream task from meta-files, code:%s", vgId, tstrerror(terrno)); - doClear(pKey, pVal, pCur, pRecycleList); - return -1; + break; } tDecoderInit(&decoder, (uint8_t*)pVal, vLen); if (tDecodeStreamTask(&decoder, pTask) < 0) { tDecoderClear(&decoder); - doClear(pKey, pVal, pCur, pRecycleList); tFreeStreamTask(pTask); stError( "vgId:%d stream read incompatible data, rm %s/vnode/vnode*/tq/stream if taosd cannot start, and rebuild " "stream manually", vgId, tsDataDir); - return -1; + break; } tDecoderClear(&decoder); @@ -892,10 +884,11 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId}; void* p = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); if (p == NULL) { - if (pMeta->expandFunc(pMeta->ahandle, pTask, pTask->chkInfo.checkpointVer + 1) < 0) { - doClear(pKey, pVal, pCur, pRecycleList); + code = pMeta->expandFunc(pMeta->ahandle, pTask, pTask->chkInfo.checkpointVer + 1); + if (code < 0) { + stError("failed to expand s-task:0x%"PRIx64", code:%s, continue", id.taskId, tstrerror(terrno)); tFreeStreamTask(pTask); - return -1; + continue; } taosArrayPush(pMeta->pTaskList, &pTask->id); @@ -907,9 +900,10 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { } if (taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES) < 0) { - doClear(pKey, pVal, pCur, pRecycleList); + stError("s-task:0x%x failed to put into hashTable, code:%s, continue", pTask->id.taskId, tstrerror(terrno)); + taosArrayPop(pMeta->pTaskList); tFreeStreamTask(pTask); - return -1; + continue; } if (pTask->info.fillHistory == 0) { @@ -925,10 +919,9 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { tdbFree(pKey); tdbFree(pVal); + if (tdbTbcClose(pCur) < 0) { - stError("vgId:%d failed to close meta-file cursor", vgId); - taosArrayDestroy(pRecycleList); - return -1; + stError("vgId:%d failed to close meta-file cursor, code:%s, continue", vgId, tstrerror(terrno)); } if (taosArrayGetSize(pRecycleList) > 0) { @@ -942,8 +935,9 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { ASSERT(pMeta->numOfStreamTasks <= numOfTasks && pMeta->numOfPausedTasks <= numOfTasks); stDebug("vgId:%d load %d tasks into meta from disk completed, streamTask:%d, paused:%d", pMeta->vgId, numOfTasks, pMeta->numOfStreamTasks, pMeta->numOfPausedTasks); + taosArrayDestroy(pRecycleList); - return 0; + return TSDB_CODE_SUCCESS; } int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pReq) { From 8e45bebd66770855794a1f6e83ec9cc512793b46 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 26 Mar 2024 15:16:09 +0800 Subject: [PATCH 016/106] fix:decode task error if task version is smaller than 2 --- source/libs/stream/src/streamTask.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 13a4f5012d..c7a1a00a46 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -216,7 +216,7 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { if (tStartDecode(pDecoder) < 0) return -1; if (tDecodeI64(pDecoder, &pTask->ver) < 0) return -1; - if (pTask->ver <= SSTREAM_TASK_INCOMPATIBLE_VER) return -1; + if (pTask->ver <= SSTREAM_TASK_INCOMPATIBLE_VER || pTask->ver > SSTREAM_TASK_VER) return -1; if (tDecodeI64(pDecoder, &pTask->id.streamId) < 0) return -1; if (tDecodeI32(pDecoder, &pTask->id.taskId) < 0) return -1; From aa9962318f6b37a6dc254603ef5c25902bcfeec8 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 26 Mar 2024 16:38:24 +0800 Subject: [PATCH 017/106] 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 018/106] 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 019/106] 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 020/106] 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 530e0133b9bba75f7ed33ccda676e3ba108ce1f3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 26 Mar 2024 19:39:58 +0800 Subject: [PATCH 021/106] fix(stream): acquire the stream task in exec buffer if not in mnode store. --- source/dnode/mnode/impl/src/mndStream.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 60b522f6fa..ceb239ee96 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -2153,11 +2153,20 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId); if (pStream == NULL) { - mError("failed to find the stream:0x%" PRIx64 " not handle the checkpoint req", req.streamId); - terrno = TSDB_CODE_MND_STREAM_NOT_EXIST; - taosThreadMutexUnlock(&execInfo.lock); + mWarn("failed to find the stream:0x%" PRIx64 ", not handle the checkpoint req, try to acquire in buf", req.streamId); - return -1; + // not in meta-store yet, try to acquire the task in exec buffer + STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; + void* p = taosHashGet(execInfo.pTaskMap, &id, sizeof(id)); + if (p == NULL) { + mError("failed to find the stream:0x%" PRIx64 " in buf, not handle the checkpoint req", req.streamId); + terrno = TSDB_CODE_MND_STREAM_NOT_EXIST; + taosThreadMutexUnlock(&execInfo.lock); + return -1; + } else { + mDebug("s-task:0x%" PRIx64 "-0x%x in buf not in mnode/meta, create stream trans may not complete yet", + req.streamId, req.taskId); + } } int32_t numOfTasks = mndGetNumOfStreamTasks(pStream); @@ -2175,7 +2184,7 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { int32_t total = taosArrayGetSize(*pReqTaskList); if (total == numOfTasks) { // all tasks has send the reqs int64_t checkpointId = mndStreamGenChkpId(pMnode); - mDebug("stream:0x%" PRIx64 " all tasks req, start checkpointId:%" PRId64, pStream->uid, checkpointId); + mInfo("stream:0x%" PRIx64 " all tasks req checkpoint, start checkpointId:%" PRId64, pStream->uid, checkpointId); // TODO:handle error int32_t code = mndProcessStreamCheckpointTrans(pMnode, pStream, checkpointId, 0, false); From 46280bfee95e634e4bf36f1197d77f046faa3526 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 26 Mar 2024 19:40:47 +0800 Subject: [PATCH 022/106] fix(stream): add some comments. --- source/dnode/mnode/impl/src/mndStream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index ceb239ee96..93b4e70de7 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -2156,6 +2156,7 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { mWarn("failed to find the stream:0x%" PRIx64 ", not handle the checkpoint req, try to acquire in buf", req.streamId); // not in meta-store yet, try to acquire the task in exec buffer + // the checkpoint req arrives too soon before the completion of the create stream trans. STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; void* p = taosHashGet(execInfo.pTaskMap, &id, sizeof(id)); if (p == NULL) { From 3c7fe5fd01b464693f5fe2ac429084ba5f2af906 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 26 Mar 2024 23:27:38 +0800 Subject: [PATCH 023/106] fix(stream): check null ptr. --- source/dnode/mnode/impl/src/mndStream.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 93b4e70de7..bed946bc24 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -2170,34 +2170,39 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { } } - int32_t numOfTasks = mndGetNumOfStreamTasks(pStream); + int32_t numOfTasks = (pStream == NULL)? 0: mndGetNumOfStreamTasks(pStream); + SArray **pReqTaskList = (SArray **)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId)); if (pReqTaskList == NULL) { SArray *pList = taosArrayInit(4, sizeof(int32_t)); - doAddTaskId(pList, req.taskId, pStream->uid, numOfTasks); + doAddTaskId(pList, req.taskId, req.streamId, numOfTasks); taosHashPut(execInfo.pTransferStateStreams, &req.streamId, sizeof(int64_t), &pList, sizeof(void *)); pReqTaskList = (SArray **)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId)); } else { - doAddTaskId(*pReqTaskList, req.taskId, pStream->uid, numOfTasks); + doAddTaskId(*pReqTaskList, req.taskId, req.streamId, numOfTasks); } int32_t total = taosArrayGetSize(*pReqTaskList); if (total == numOfTasks) { // all tasks has send the reqs int64_t checkpointId = mndStreamGenChkpId(pMnode); - mInfo("stream:0x%" PRIx64 " all tasks req checkpoint, start checkpointId:%" PRId64, pStream->uid, checkpointId); + mInfo("stream:0x%" PRIx64 " all tasks req checkpoint, start checkpointId:%" PRId64, req.streamId, checkpointId); - // TODO:handle error - int32_t code = mndProcessStreamCheckpointTrans(pMnode, pStream, checkpointId, 0, false); + if (pStream != NULL) { + // TODO:handle error + int32_t code = mndProcessStreamCheckpointTrans(pMnode, pStream, checkpointId, 0, false); + mndReleaseStream(pMnode, pStream); + } else { + // todo: wait for the create stream trans completed, and launch the checkpoint trans + } // remove this entry taosHashRemove(execInfo.pTransferStateStreams, &req.streamId, sizeof(int64_t)); int32_t numOfStreams = taosHashGetSize(execInfo.pTransferStateStreams); - mDebug("stream:0x%" PRIx64 " removed, remain streams:%d fill-history not completed", pStream->uid, numOfStreams); + mDebug("stream:0x%" PRIx64 " removed, remain streams:%d fill-history not completed", req.streamId, numOfStreams); } - mndReleaseStream(pMnode, pStream); taosThreadMutexUnlock(&execInfo.lock); { From f3c306d582b1e2d7005ae3d3340b93d04df085d5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 26 Mar 2024 23:28:20 +0800 Subject: [PATCH 024/106] fix(stream): add some comments. --- source/dnode/mnode/impl/src/mndStream.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index bed946bc24..9a79f6ff5b 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -2194,6 +2194,8 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { mndReleaseStream(pMnode, pStream); } else { // todo: wait for the create stream trans completed, and launch the checkpoint trans + // SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId); + // sleep(500ms) } // remove this entry From e776cde461a11151549c1e9f746f676d843daef0 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 27 Mar 2024 09:02:21 +0800 Subject: [PATCH 025/106] fix(stream):fix unrelease stream obj. --- source/dnode/mnode/impl/src/mndStream.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 9a79f6ff5b..6067af199e 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -2188,10 +2188,8 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { int64_t checkpointId = mndStreamGenChkpId(pMnode); mInfo("stream:0x%" PRIx64 " all tasks req checkpoint, start checkpointId:%" PRId64, req.streamId, checkpointId); - if (pStream != NULL) { - // TODO:handle error + if (pStream != NULL) { // TODO:handle error int32_t code = mndProcessStreamCheckpointTrans(pMnode, pStream, checkpointId, 0, false); - mndReleaseStream(pMnode, pStream); } else { // todo: wait for the create stream trans completed, and launch the checkpoint trans // SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId); @@ -2205,6 +2203,10 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { mDebug("stream:0x%" PRIx64 " removed, remain streams:%d fill-history not completed", req.streamId, numOfStreams); } + if (pStream != NULL) { + mndReleaseStream(pMnode, pStream); + } + taosThreadMutexUnlock(&execInfo.lock); { From c0a394876d1a47780db7f90de915505204bbe95a Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 27 Mar 2024 02:41:05 +0000 Subject: [PATCH 026/106] fix invalid free while taosd quit --- source/libs/transport/src/transCli.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index b335979cd5..2d8f4ed3c2 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1944,8 +1944,9 @@ static FORCE_INLINE void destroyCmsgWrapper(void* arg, void* param) { if (pMsg == NULL) { return; } - if (param != NULL) { - SCliThrd* pThrd = param; + + SCliThrd* pThrd = param; + if (pMsg->msg.info.notFreeAhandle == 0 && pThrd != NULL) { if (pThrd->destroyAhandleFp) (*pThrd->destroyAhandleFp)(pMsg->msg.info.ahandle); } destroyCmsg(pMsg); @@ -1957,12 +1958,9 @@ static FORCE_INLINE void destroyCmsgAndAhandle(void* param) { SCliMsg* pMsg = arg->param1; SCliThrd* pThrd = arg->param2; - tDebug("destroy Ahandle A"); - if (pThrd != NULL && pThrd->destroyAhandleFp != NULL) { - tDebug("destroy Ahandle B"); + if (pMsg->msg.info.notFreeAhandle == 0 && pThrd != NULL && pThrd->destroyAhandleFp != NULL) { pThrd->destroyAhandleFp(pMsg->ctx->ahandle); } - tDebug("destroy Ahandle C"); transDestroyConnCtx(pMsg->ctx); transFreeMsg(pMsg->msg.pCont); From f4fed29739d97f04603f315025930a685913cceb Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 27 Mar 2024 15:04:37 +0800 Subject: [PATCH 027/106] fix:write schema error if schema ver is 1 more than origin version --- source/dnode/mnode/impl/src/mndStb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 7ee1b36916..a507631128 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1104,14 +1104,16 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { } else if (createReq.tagVer > 0 || createReq.colVer > 0) { int32_t tagDelta = createReq.tagVer - pStb->tagVer; int32_t colDelta = createReq.colVer - pStb->colVer; - int32_t verDelta = tagDelta + colDelta; mInfo("stb:%s, already exist while create, input tagVer:%d colVer:%d, exist tagVer:%d colVer:%d", createReq.name, createReq.tagVer, createReq.colVer, pStb->tagVer, pStb->colVer); if (tagDelta <= 0 && colDelta <= 0) { mInfo("stb:%s, schema version is not incremented and nothing needs to be done", createReq.name); code = 0; goto _OVER; - } else if ((tagDelta == 1 || colDelta == 1) && (verDelta == 1)) { + } else if ((tagDelta == 1 && colDelta == 0) || + (tagDelta == 0 && colDelta == 1) || + pStb->colVer == 1 || + pStb->tagVer == 1) { isAlter = true; mInfo("stb:%s, schema version is only increased by 1 number, do alter operation", createReq.name); } else { From 4722f8be8787596d8c88939fc2f7166530eff5aa Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 27 Mar 2024 15:17:49 +0800 Subject: [PATCH 028/106] fix:write schema error if schema ver is 1 more than origin version --- source/dnode/mnode/impl/src/mndStb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index a507631128..79c62df766 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1112,8 +1112,8 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { goto _OVER; } else if ((tagDelta == 1 && colDelta == 0) || (tagDelta == 0 && colDelta == 1) || - pStb->colVer == 1 || - pStb->tagVer == 1) { + (pStb->colVer == 1 && createReq.colVer > 1) || + (pStb->tagVer == 1 && createReq.tagVer > 1)) { isAlter = true; mInfo("stb:%s, schema version is only increased by 1 number, do alter operation", createReq.name); } else { From 5157d5b97d44474edbc4612180a57e591e308ff1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 27 Mar 2024 15:52:48 +0800 Subject: [PATCH 029/106] fix(stream): fix invalid read. --- source/libs/stream/src/streamMeta.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index fc06a8975f..c24763c024 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -648,14 +648,17 @@ SStreamTask* streamMetaAcquireOneTask(SStreamTask* pTask) { } void streamMetaReleaseTask(SStreamMeta* UNUSED_PARAM(pMeta), SStreamTask* pTask) { + int32_t taskId = pTask->id.taskId; int32_t ref = atomic_sub_fetch_32(&pTask->refCnt, 1); + + // not safe to use the pTask->id.idStr, since pTask may be released by other threads when print logs. if (ref > 0) { - stTrace("s-task:%s release task, ref:%d", pTask->id.idStr, ref); + stTrace("s-task:0x%x release task, ref:%d", taskId, ref); } else if (ref == 0) { - stTrace("s-task:%s all refs are gone, free it", pTask->id.idStr); + stTrace("s-task:0x%x all refs are gone, free it", taskId); tFreeStreamTask(pTask); } else if (ref < 0) { - stError("task ref is invalid, ref:%d, %s", ref, pTask->id.idStr); + stError("task ref is invalid, ref:%d, 0x%x", ref, taskId); } } From c611974247abfdbc40ece8230bea04ab7f9b4595 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Wed, 27 Mar 2024 14:17:53 +0800 Subject: [PATCH 030/106] fix: tmsg encode error --- source/common/src/tmsg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index ff424ee558..8430c67321 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -51,8 +51,8 @@ #define ENCODESQL() \ do { \ + if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; \ if (pReq->sqlLen > 0 && pReq->sql != NULL) { \ - if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; \ if (tEncodeBinary(&encoder, pReq->sql, pReq->sqlLen) < 0) return -1; \ } \ } while (0) @@ -3025,7 +3025,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { ENCODESQL(); - if (tEncodeI32(&encoder, pReq->withArbitrator) < 0) return -1; + if (tEncodeI8(&encoder, pReq->withArbitrator) < 0) return -1; tEndEncode(&encoder); @@ -3140,7 +3140,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tEncodeI32(&encoder, pReq->walRetentionSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->keepTimeOffset) < 0) return -1; ENCODESQL(); - if (tEncodeI32(&encoder, pReq->withArbitrator) < 0) return -1; + if (tEncodeI8(&encoder, pReq->withArbitrator) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; From 277a009677b958a68f898818c53c7443e5aae85d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 27 Mar 2024 16:42:32 +0800 Subject: [PATCH 031/106] fix(test): fix unit test compiler error. --- source/util/test/tbaseCodecTest.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/util/test/tbaseCodecTest.cpp b/source/util/test/tbaseCodecTest.cpp index 4c56979885..63bbfcaa68 100644 --- a/source/util/test/tbaseCodecTest.cpp +++ b/source/util/test/tbaseCodecTest.cpp @@ -17,11 +17,6 @@ using namespace std; #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" -int main(int argc, char **argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - static void checkBase58Codec(uint8_t *pRaw, int32_t rawLen, int32_t index) { int64_t start = taosGetTimestampUs(); char *pEnc = base58_encode((const uint8_t *)pRaw, rawLen); From 0a206f5819979e2700732468757edad288b4c5d0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 09:32:24 +0800 Subject: [PATCH 032/106] 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 8e2a2414c0d19f1470d5b17be331588a45896849 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 28 Mar 2024 13:48:46 +0800 Subject: [PATCH 033/106] fix:same subtable same partition by leads to same table name in stream --- include/common/tdatablock.h | 2 +- include/libs/stream/tstream.h | 2 +- source/common/src/tdatablock.c | 11 ++++++++--- source/dnode/mnode/impl/src/mndDef.c | 4 +++- source/dnode/mnode/impl/src/mndStream.c | 4 +++- source/dnode/vnode/src/tq/tqSink.c | 18 +++++++++++------- source/libs/stream/src/streamDispatch.c | 9 ++++++--- source/libs/stream/src/streamMeta.c | 4 +++- tests/system-test/8-stream/stream_basic.py | 22 ++++++++++++++++++++++ 9 files changed, 58 insertions(+), 18 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index fa6e4c3ae8..cf6d4ba2b0 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -267,7 +267,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** pReq, const SSDataBlock* pData bool alreadyAddGroupId(char* ctbName); bool isAutoTableName(char* ctbName); -void buildCtbNameAddGroupId(char* ctbName, uint64_t groupId); +void buildCtbNameAddGroupId(const char* stbName, char* ctbName, uint64_t groupId); char* buildCtbNameByGroupId(const char* stbName, uint64_t groupId); int32_t buildCtbNameByGroupIdImpl(const char* stbName, uint64_t groupId, char* pBuf); diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 5f3761d7b7..e7c6491b9d 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -61,7 +61,7 @@ typedef struct SStreamTask SStreamTask; typedef struct SStreamQueue SStreamQueue; typedef struct SStreamTaskSM SStreamTaskSM; -#define SSTREAM_TASK_VER 3 +#define SSTREAM_TASK_VER 4 #define SSTREAM_TASK_INCOMPATIBLE_VER 1 #define SSTREAM_TASK_NEED_CONVERT_VER 2 #define SSTREAM_TASK_SUBTABLE_CHANGED_VER 3 diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index f4455be206..dc1c27b123 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -2141,10 +2141,14 @@ _end: return TSDB_CODE_SUCCESS; } -void buildCtbNameAddGroupId(char* ctbName, uint64_t groupId){ +void buildCtbNameAddGroupId(const char* stbName, char* ctbName, uint64_t groupId){ char tmp[TSDB_TABLE_NAME_LEN] = {0}; - snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%"PRIu64, groupId); - ctbName[TSDB_TABLE_NAME_LEN - strlen(tmp) - 1] = 0; // put groupId to the end + if (stbName == NULL){ + snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%"PRIu64, groupId); + }else{ + snprintf(tmp, TSDB_TABLE_NAME_LEN, "_%s_%"PRIu64, stbName, groupId); + } + ctbName[TSDB_TABLE_NAME_LEN - strlen(tmp) - 1] = 0; // put stbname + groupId to the end strcat(ctbName, tmp); } @@ -2154,6 +2158,7 @@ bool isAutoTableName(char* ctbName) { return (strlen(ctbName) == 34 && ctbName[0 bool alreadyAddGroupId(char* ctbName) { size_t len = strlen(ctbName); + if (len == 0) return false; size_t _location = len - 1; while (_location > 0) { if (ctbName[_location] < '0' || ctbName[_location] > '9') { diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index 3f69c7def3..091edc6ab0 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -72,7 +72,9 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) { if (tEncodeI32(pEncoder, innerSz) < 0) return -1; for (int32_t j = 0; j < innerSz; j++) { SStreamTask *pTask = taosArrayGetP(pArray, j); - pTask->ver = SSTREAM_TASK_VER; + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + pTask->ver = SSTREAM_TASK_VER; + } if (tEncodeStreamTask(pEncoder, pTask) < 0) return -1; } } diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 6067af199e..ff05db417e 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -434,7 +434,9 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) { SEncoder encoder; tEncoderInit(&encoder, NULL, 0); - pTask->ver = SSTREAM_TASK_VER; + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + pTask->ver = SSTREAM_TASK_VER; + } tEncodeStreamTask(&encoder, pTask); int32_t size = encoder.pos; diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 5374b9aa78..1e0ae7a854 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -71,8 +71,8 @@ int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* p if (varTbName != NULL && varTbName != (void*)-1) { name = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN); memcpy(name, varDataVal(varTbName), varDataLen(varTbName)); - if (newSubTableRule && !isAutoTableName(name) && !alreadyAddGroupId(name) && groupId != 0) { - buildCtbNameAddGroupId(name, groupId); + if (newSubTableRule && !isAutoTableName(name) && !alreadyAddGroupId(name) && groupId != 0 && stbFullName) { + buildCtbNameAddGroupId(stbFullName, name, groupId); } } else if (stbFullName) { name = buildCtbNameByGroupId(stbFullName, groupId); @@ -182,10 +182,10 @@ void setCreateTableMsgTableName(SVCreateTbReq* pCreateTableReq, SSDataBlock* pDa int64_t gid, bool newSubTableRule) { if (pDataBlock->info.parTbName[0]) { if (newSubTableRule && !isAutoTableName(pDataBlock->info.parTbName) && - !alreadyAddGroupId(pDataBlock->info.parTbName) && gid != 0) { + !alreadyAddGroupId(pDataBlock->info.parTbName) && gid != 0 && stbFullName) { pCreateTableReq->name = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN); strcpy(pCreateTableReq->name, pDataBlock->info.parTbName); - buildCtbNameAddGroupId(pCreateTableReq->name, gid); + buildCtbNameAddGroupId(stbFullName, pCreateTableReq->name, gid); // tqDebug("gen name from:%s", pDataBlock->info.parTbName); } else { pCreateTableReq->name = taosStrdup(pDataBlock->info.parTbName); @@ -671,10 +671,14 @@ int32_t setDstTableDataUid(SVnode* pVnode, SStreamTask* pTask, SSDataBlock* pDat memset(dstTableName, 0, TSDB_TABLE_NAME_LEN); buildCtbNameByGroupIdImpl(stbFullName, groupId, dstTableName); } else { - if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && pTask->subtableWithoutMd5 != 1 && - !isAutoTableName(dstTableName) && !alreadyAddGroupId(dstTableName) && groupId != 0) { + if (pTask->subtableWithoutMd5 != 1 && !isAutoTableName(dstTableName) && + !alreadyAddGroupId(dstTableName) && groupId != 0) { tqDebug("s-task:%s append groupId:%" PRId64 " for generated dstTable:%s", id, groupId, dstTableName); - buildCtbNameAddGroupId(dstTableName, groupId); + if(pTask->ver == SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + buildCtbNameAddGroupId(NULL, dstTableName, groupId); + }else if(pTask->ver > SSTREAM_TASK_SUBTABLE_CHANGED_VER && stbFullName) { + buildCtbNameAddGroupId(stbFullName, dstTableName, groupId); + } } } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 0af664f1e1..9542009d72 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -580,12 +580,15 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S } else { char ctbName[TSDB_TABLE_FNAME_LEN] = {0}; if (pDataBlock->info.parTbName[0]) { - if(pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && - pTask->subtableWithoutMd5 != 1 && + if(pTask->subtableWithoutMd5 != 1 && !isAutoTableName(pDataBlock->info.parTbName) && !alreadyAddGroupId(pDataBlock->info.parTbName) && groupId != 0){ - buildCtbNameAddGroupId(pDataBlock->info.parTbName, groupId); + if(pTask->ver == SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + buildCtbNameAddGroupId(NULL, pDataBlock->info.parTbName, groupId); + }else if(pTask->ver > SSTREAM_TASK_SUBTABLE_CHANGED_VER) { + buildCtbNameAddGroupId(pTask->outputInfo.shuffleDispatcher.stbFullName, pDataBlock->info.parTbName, groupId); + } } } else { buildCtbNameByGroupIdImpl(pTask->outputInfo.shuffleDispatcher.stbFullName, groupId, pDataBlock->info.parTbName); diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index c24763c024..aae3594905 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -542,7 +542,6 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) { void* buf = NULL; int32_t len; int32_t code; - pTask->ver = SSTREAM_TASK_VER; tEncodeSize(tEncodeStreamTask, pTask, len, code); if (code < 0) { return -1; @@ -552,6 +551,9 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) { return -1; } + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + pTask->ver = SSTREAM_TASK_VER; + } SEncoder encoder = {0}; tEncoderInit(&encoder, buf, len); tEncodeStreamTask(&encoder, pTask); diff --git a/tests/system-test/8-stream/stream_basic.py b/tests/system-test/8-stream/stream_basic.py index 3ebc255114..f08cca1e13 100644 --- a/tests/system-test/8-stream/stream_basic.py +++ b/tests/system-test/8-stream/stream_basic.py @@ -78,8 +78,30 @@ class TDTestCase: tdLog.info(cmd) os.system(cmd) + def case1(self): + + tdSql.execute(f'create database if not exists d1 vgroups 1') + tdSql.execute(f'use d1') + tdSql.execute(f'create table st(ts timestamp, i int) tags(t int)') + tdSql.execute(f'insert into t1 using st tags(1) values(now, 1) (now+1s, 2)') + tdSql.execute(f'insert into t2 using st tags(2) values(now, 1) (now+1s, 2)') + tdSql.execute(f'insert into t3 using st tags(3) values(now, 1) (now+1s, 2)') + + tdSql.execute("create stream stream1 fill_history 1 into sta subtable(concat('new-', tname)) AS SELECT " + "_wstart, count(*), avg(i) FROM st PARTITION BY tbname tname INTERVAL(1m)", show=True) + + tdSql.execute("create stream stream2 fill_history 1 into sta subtable(concat('new-', tname)) AS SELECT " + "_wstart, count(*), avg(i) FROM st PARTITION BY tbname tname INTERVAL(1m)", show=True) + + time.sleep(2) + tdSql.query("select * from sta") + tdSql.checkRows(3) + + tdSql.query("select * from stb") + tdSql.checkRows(3) # run def run(self): + self.case1() # gen data random.seed(int(time.time())) self.taosBenchmark(" -d db -t 2 -v 2 -n 1000000 -y") From 65457d2cf463c2d72e158bc39ba677ad5f46ef17 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 14:16:19 +0800 Subject: [PATCH 034/106] 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 035/106] 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 036/106] 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 570d78c58d201aa275bf716a0d971b80d08a7b4c Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 28 Mar 2024 17:54:00 +0800 Subject: [PATCH 037/106] fix:test case error --- tests/system-test/8-stream/stream_basic.py | 2 +- tests/system-test/buildJson.py | 243 +++++++++++++++++++++ 2 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 tests/system-test/buildJson.py diff --git a/tests/system-test/8-stream/stream_basic.py b/tests/system-test/8-stream/stream_basic.py index f08cca1e13..8dfb14da56 100644 --- a/tests/system-test/8-stream/stream_basic.py +++ b/tests/system-test/8-stream/stream_basic.py @@ -90,7 +90,7 @@ class TDTestCase: tdSql.execute("create stream stream1 fill_history 1 into sta subtable(concat('new-', tname)) AS SELECT " "_wstart, count(*), avg(i) FROM st PARTITION BY tbname tname INTERVAL(1m)", show=True) - tdSql.execute("create stream stream2 fill_history 1 into sta subtable(concat('new-', tname)) AS SELECT " + tdSql.execute("create stream stream2 fill_history 1 into stb subtable(concat('new-', tname)) AS SELECT " "_wstart, count(*), avg(i) FROM st PARTITION BY tbname tname INTERVAL(1m)", show=True) time.sleep(2) diff --git a/tests/system-test/buildJson.py b/tests/system-test/buildJson.py new file mode 100644 index 0000000000..6e9e9f83e1 --- /dev/null +++ b/tests/system-test/buildJson.py @@ -0,0 +1,243 @@ +# 写一段python代码,生成一个JSON串,json 串为数组,数组长度为10000,每个元素为包含4000个key-value对的JSON字符串,json 数组里每个元素里的4000个key不相同,元素之间使用相同的key,key值为英文单词,value 为int值,且value 的范围是[0, 256]。把json串紧凑形式写入文件,把json串存入parquet文件中,把json串写入avro文件中,把json串写入到postgre sql表中,表有两列第一列主int类型主键,第二列为json类型,数组的每个元素写入json类型里 +import csv +import json +import os +import random +import string +import time + +from faker import Faker +import pandas as pd +import pyarrow as pa +import pyarrow.parquet as pq +import fastavro +import psycopg2 +from psycopg2.extras import Json + + +def get_dir_size(start_path='.'): + total = 0 + for dirpath, dirs, files in os.walk(start_path): + for f in files: + fp = os.path.join(dirpath, f) + # 获取文件大小并累加到total上 + total += os.path.getsize(fp) + return total + + +def to_avro_record(obj): + return {key: value for key, value in obj.items()} + + +def generate_random_string(length): + return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) + + +def generate_random_values(t): + if t == 0: + return random.randint(-255, 256) + elif t == 1: + return random.randint(-2100000000, 2100000000) + elif t == 2: + return random.uniform(-10000.0, 10000.0) + elif t == 3: + return generate_random_string(10) + elif t == 4: + return random.choice([True, False]) + + +def generate_json_object(key_set, value_set): + values = [generate_random_values(t) for t in value_set] + return dict(zip(key_set, values)) + + +def generate_json_array(keys, values, array_length): + return [generate_json_object(keys, values) for _ in range(array_length)] + + +def write_parquet_file(parquet_file, json_array): + df = pd.DataFrame(json_array) + table = pa.Table.from_pandas(df) + pq.write_table(table, parquet_file + ".parquet") + + +def write_json_file(json_file, json_array): + with open(json_file + ".json", 'w') as f: + json.dump(json_array, f, separators=(',', ':')) + + +def generate_avro_schema(k, t): + if t == 0: + return {"name": k, "type": "int", "logicalType": "int"} + elif t == 1: + return {"name": k, "type": "int", "logicalType": "int"} + elif t == 2: + return {"name": k, "type": "float"} + elif t == 3: + return {"name": k, "type": "string"} + elif t == 4: + return {"name": k, "type": "boolean"} + + +def write_avro_file(avro_file, json_array, keys, values): + k = list(json_array[0].keys()) + + if keys != k: + raise ValueError("keys and values should have the same length") + + avro_schema = { + "type": "record", + "name": "MyRecord", + "fields": [generate_avro_schema(k, v) for k, v in dict(zip(keys, values)).items()] + } + + avro_records = [to_avro_record(obj) for obj in json_array] + with open(avro_file + ".avro", 'wb') as f: + fastavro.writer(f, avro_schema, avro_records) + + +def write_pg_file(json_array): + conn_str = "dbname=mydatabase user=myuser host=localhost" + conn = psycopg2.connect(conn_str) + cur = conn.cursor() + + cur.execute("drop table if exists my_table") + conn.commit() + + # 创建表(如果不存在) + cur.execute(""" + CREATE TABLE IF NOT EXISTS my_table ( + id SERIAL PRIMARY KEY, + json_data JSONB + ); + """) + conn.commit() + + # 执行SQL查询 + cur.execute("SELECT count(*) FROM my_table") + # 获取查询结果 + rows = cur.fetchall() + # 打印查询结果 + for row in rows: + print("rows before:", row[0]) + + # 插入数据 + for idx, json_obj in enumerate(json_array): + # print(json.dumps(json_obj)) + cur.execute("INSERT INTO my_table (json_data) VALUES (%s)", (json.dumps(json_obj),)) + + conn.commit() # 提交事务 + + # 执行SQL查询 + cur.execute("SELECT count(*) FROM my_table") + # 获取查询结果 + rows = cur.fetchall() + # 打印查询结果 + for row in rows: + print("rows after:", row[0]) + + # # 执行SQL查询 + # cur.execute("SELECT pg_relation_size('my_table')") + # # 获取查询结果 + # rows = cur.fetchall() + # # 打印查询结果 + # size = 0 + # for row in rows: + # size = row[0] + # print("table size:", row[0]) + + # 关闭游标和连接 + cur.close() + conn.close() + +def read_parquet_file(parquet_file): + table = pq.read_table(parquet_file + ".parquet") + df = table.to_pandas() + print(df) + + +def read_avro_file(avg_file): + with open(avg_file + ".avro", 'rb') as f: + reader = fastavro.reader(f) + + for record in reader: + print(record) + + +def read_json_file(csv_file): + with open(csv_file + ".json", 'r') as f: + data = json.load(f) + print(data) + + +def main(): + key_length = 7 + key_sizes = 4000 + row_sizes = 10000 + file_name = "output" + + # cases = [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (0, 4)] + cases = [(2, 2), (3, 3), (0, 4)] + + for data in cases: + begin, end = data + print(f"执行类型:{begin}-{end}") + + N = 2 + for _ in range(N): + + t0 = time.time() + + keys = [generate_random_string(key_length) for _ in range(key_sizes)] + values = [random.randint(begin, end) for _ in range(key_sizes)] + # 生成JSON数组 + json_array = generate_json_array(keys, values, row_sizes) + + t1 = time.time() + + write_json_file(file_name, json_array) + + t2 = time.time() + + write_parquet_file(file_name, json_array) + + t3 = time.time() + + write_avro_file(file_name, json_array, keys, values) + + t4 = time.time() + + size = write_pg_file(json_array) + + t5 = time.time() + + print("生成json 速度:", t2 - t0, "文件大小:", os.path.getsize(file_name + ".json")) + print("parquet 速度:", t3 - t2, "文件大小:", os.path.getsize(file_name + ".parquet")) + print("avro 速度:", t4 - t3, "文件大小:", os.path.getsize(file_name + ".avro")) + print("pg json 速度:", t5 - t4, "文件大小:", get_dir_size("/opt/homebrew/var/postgresql@14/base/16385") - 8 * 1024 * 1024) + + # read_json_file(file_name) + # read_parquet_file(file_name) + # read_avro_file(file_name) + print(f"\n---------------\n") + +if __name__ == "__main__": + main() + +# 压缩文件 +# import os +# +# import lz4.frame +# +# +# files =["output.json", "output.parquet", "output.avro"] +# def compress_file(input_path, output_path): +# with open(input_path, 'rb') as f_in: +# compressed_data = lz4.frame.compress(f_in.read()) +# +# with open(output_path, 'wb') as f_out: +# f_out.write(compressed_data) +# +# for file in files: +# compress_file(file, file + ".lz4") +# print(file, "origin size:", os.path.getsize(file), " after lsz size:", os.path.getsize(file + ".lz4")) From ffeabb132a77525d9f8237c71c1e898f244f6af8 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 28 Mar 2024 18:18:06 +0800 Subject: [PATCH 038/106] 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 00cc68a7903e689941bf32b8da2a69a921f7b350 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 29 Mar 2024 09:07:09 +0800 Subject: [PATCH 039/106] fix:test case error --- tests/system-test/8-stream/stream_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/8-stream/stream_basic.py b/tests/system-test/8-stream/stream_basic.py index 8dfb14da56..5167423ea3 100644 --- a/tests/system-test/8-stream/stream_basic.py +++ b/tests/system-test/8-stream/stream_basic.py @@ -107,7 +107,7 @@ class TDTestCase: self.taosBenchmark(" -d db -t 2 -v 2 -n 1000000 -y") # create stream tdSql.execute("use db") - tdSql.execute("create stream stream1 fill_history 1 into sta as select count(*) as cnt from meters interval(10a);",show=True) + tdSql.execute("create stream stream3 fill_history 1 into sta as select count(*) as cnt from meters interval(10a);",show=True) sql = "select count(*) from sta" # loop wait max 60s to check count is ok tdLog.info("loop wait result ...") From ea33f08d02b1f4b72555d9b1400af45a42acf886 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 29 Mar 2024 13:52:56 +0800 Subject: [PATCH 040/106] 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 041/106] 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 ba65f5a519622acaad6dcb2ae8b9f5c13edaa223 Mon Sep 17 00:00:00 2001 From: kailixu Date: Sun, 31 Mar 2024 20:50:02 +0800 Subject: [PATCH 042/106] enh: integer with duration literal for timestamp --- source/libs/parser/inc/sql.y | 120 + source/libs/parser/src/sql.c | 4823 +++++++---------- tests/script/tsim/parser/columnValue_bool.sim | 3 + tests/script/tsim/parser/columnValue_int.sim | 2 + .../tsim/parser/columnValue_timestamp.sim | 271 + .../tsim/parser/columnValue_varbinary.sim | 6 + .../tsim/parser/columnValue_varchar.sim | 11 + 7 files changed, 2229 insertions(+), 3007 deletions(-) diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index b96a02e136..88af526d79 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -747,16 +747,52 @@ insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). /************************************************ tags_literal *************************************************************/ tags_literal(A) ::= NK_INTEGER(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); } +tags_literal(A) ::= NK_INTEGER(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_INTEGER(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_PLUS(B) NK_INTEGER(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_MINUS(B) NK_INTEGER(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_FLOAT(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B, NULL); } tags_literal(A) ::= NK_PLUS(B) NK_FLOAT(C). { SToken t = B; @@ -770,29 +806,113 @@ tags_literal(A) ::= NK_MINUS(B) NK_FLOAT(C). } tags_literal(A) ::= NK_BIN(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); } +tags_literal(A) ::= NK_BIN(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_BIN(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_PLUS(B) NK_BIN(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_MINUS(B) NK_BIN(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_HEX(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); } +tags_literal(A) ::= NK_HEX(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_HEX(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_PLUS(B) NK_HEX(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_MINUS(B) NK_HEX(C). { SToken t = B; t.n = (C.z + C.n) - B.z; A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_STRING(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B, NULL); } +tags_literal(A) ::= NK_STRING(B) NK_PLUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } +tags_literal(A) ::= NK_STRING(B) NK_MINUS duration_literal(C). { + SToken l = B; + SToken r = getTokenFromRawExprNode(pCxt, C); + l.n = (r.z + r.n) - l.z; + A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); + } tags_literal(A) ::= NK_BOOL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B, NULL); } tags_literal(A) ::= NULL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B, NULL); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a0b47af082..b8d1bb7f27 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,5 +1,3 @@ -/* This file is automatically generated by Lemon from input grammar -** source file "sql.y". */ /* ** 2000-05-29 ** @@ -24,8 +22,9 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ +#include +#include /************ Begin %include sections from the grammar ************************/ -#line 11 "sql.y" #include #include @@ -42,366 +41,12 @@ #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 *************************************/ -#ifndef TK_OR -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_NK_COMMA 33 -#define TK_HOST 34 -#define TK_USER 35 -#define TK_ENABLE 36 -#define TK_NK_INTEGER 37 -#define TK_SYSINFO 38 -#define TK_ADD 39 -#define TK_DROP 40 -#define TK_GRANT 41 -#define TK_ON 42 -#define TK_TO 43 -#define TK_REVOKE 44 -#define TK_FROM 45 -#define TK_SUBSCRIBE 46 -#define TK_READ 47 -#define TK_WRITE 48 -#define TK_NK_DOT 49 -#define TK_WITH 50 -#define TK_DNODE 51 -#define TK_PORT 52 -#define TK_DNODES 53 -#define TK_RESTORE 54 -#define TK_NK_IPTOKEN 55 -#define TK_FORCE 56 -#define TK_UNSAFE 57 -#define TK_CLUSTER 58 -#define TK_LOCAL 59 -#define TK_QNODE 60 -#define TK_BNODE 61 -#define TK_SNODE 62 -#define TK_MNODE 63 -#define TK_VNODE 64 -#define TK_DATABASE 65 -#define TK_USE 66 -#define TK_FLUSH 67 -#define TK_TRIM 68 -#define TK_COMPACT 69 -#define TK_IF 70 -#define TK_NOT 71 -#define TK_EXISTS 72 -#define TK_BUFFER 73 -#define TK_CACHEMODEL 74 -#define TK_CACHESIZE 75 -#define TK_COMP 76 -#define TK_DURATION 77 -#define TK_NK_VARIABLE 78 -#define TK_MAXROWS 79 -#define TK_MINROWS 80 -#define TK_KEEP 81 -#define TK_PAGES 82 -#define TK_PAGESIZE 83 -#define TK_TSDB_PAGESIZE 84 -#define TK_PRECISION 85 -#define TK_REPLICA 86 -#define TK_VGROUPS 87 -#define TK_SINGLE_STABLE 88 -#define TK_RETENTIONS 89 -#define TK_SCHEMALESS 90 -#define TK_WAL_LEVEL 91 -#define TK_WAL_FSYNC_PERIOD 92 -#define TK_WAL_RETENTION_PERIOD 93 -#define TK_WAL_RETENTION_SIZE 94 -#define TK_WAL_ROLL_PERIOD 95 -#define TK_WAL_SEGMENT_SIZE 96 -#define TK_STT_TRIGGER 97 -#define TK_TABLE_PREFIX 98 -#define TK_TABLE_SUFFIX 99 -#define TK_KEEP_TIME_OFFSET 100 -#define TK_NK_COLON 101 -#define TK_BWLIMIT 102 -#define TK_START 103 -#define TK_TIMESTAMP 104 -#define TK_END 105 -#define TK_TABLE 106 -#define TK_NK_LP 107 -#define TK_NK_RP 108 -#define TK_STABLE 109 -#define TK_COLUMN 110 -#define TK_MODIFY 111 -#define TK_RENAME 112 -#define TK_TAG 113 -#define TK_SET 114 -#define TK_NK_EQ 115 -#define TK_USING 116 -#define TK_TAGS 117 -#define TK_BOOL 118 -#define TK_TINYINT 119 -#define TK_SMALLINT 120 -#define TK_INT 121 -#define TK_INTEGER 122 -#define TK_BIGINT 123 -#define TK_FLOAT 124 -#define TK_DOUBLE 125 -#define TK_BINARY 126 -#define TK_NCHAR 127 -#define TK_UNSIGNED 128 -#define TK_JSON 129 -#define TK_VARCHAR 130 -#define TK_MEDIUMBLOB 131 -#define TK_BLOB 132 -#define TK_VARBINARY 133 -#define TK_GEOMETRY 134 -#define TK_DECIMAL 135 -#define TK_COMMENT 136 -#define TK_MAX_DELAY 137 -#define TK_WATERMARK 138 -#define TK_ROLLUP 139 -#define TK_TTL 140 -#define TK_SMA 141 -#define TK_DELETE_MARK 142 -#define TK_FIRST 143 -#define TK_LAST 144 -#define TK_SHOW 145 -#define TK_PRIVILEGES 146 -#define TK_DATABASES 147 -#define TK_TABLES 148 -#define TK_STABLES 149 -#define TK_MNODES 150 -#define TK_QNODES 151 -#define TK_ARBGROUPS 152 -#define TK_FUNCTIONS 153 -#define TK_INDEXES 154 -#define TK_ACCOUNTS 155 -#define TK_APPS 156 -#define TK_CONNECTIONS 157 -#define TK_LICENCES 158 -#define TK_GRANTS 159 -#define TK_FULL 160 -#define TK_LOGS 161 -#define TK_MACHINES 162 -#define TK_QUERIES 163 -#define TK_SCORES 164 -#define TK_TOPICS 165 -#define TK_VARIABLES 166 -#define TK_BNODES 167 -#define TK_SNODES 168 -#define TK_TRANSACTIONS 169 -#define TK_DISTRIBUTED 170 -#define TK_CONSUMERS 171 -#define TK_SUBSCRIPTIONS 172 -#define TK_VNODES 173 -#define TK_ALIVE 174 -#define TK_VIEWS 175 -#define TK_VIEW 176 -#define TK_COMPACTS 177 -#define TK_NORMAL 178 -#define TK_CHILD 179 -#define TK_LIKE 180 -#define TK_TBNAME 181 -#define TK_QTAGS 182 -#define TK_AS 183 -#define TK_SYSTEM 184 -#define TK_INDEX 185 -#define TK_FUNCTION 186 -#define TK_INTERVAL 187 -#define TK_COUNT 188 -#define TK_LAST_ROW 189 -#define TK_META 190 -#define TK_ONLY 191 -#define TK_TOPIC 192 -#define TK_CONSUMER 193 -#define TK_GROUP 194 -#define TK_DESC 195 -#define TK_DESCRIBE 196 -#define TK_RESET 197 -#define TK_QUERY 198 -#define TK_CACHE 199 -#define TK_EXPLAIN 200 -#define TK_ANALYZE 201 -#define TK_VERBOSE 202 -#define TK_NK_BOOL 203 -#define TK_RATIO 204 -#define TK_NK_FLOAT 205 -#define TK_OUTPUTTYPE 206 -#define TK_AGGREGATE 207 -#define TK_BUFSIZE 208 -#define TK_LANGUAGE 209 -#define TK_REPLACE 210 -#define TK_STREAM 211 -#define TK_INTO 212 -#define TK_PAUSE 213 -#define TK_RESUME 214 -#define TK_TRIGGER 215 -#define TK_AT_ONCE 216 -#define TK_WINDOW_CLOSE 217 -#define TK_IGNORE 218 -#define TK_EXPIRED 219 -#define TK_FILL_HISTORY 220 -#define TK_UPDATE 221 -#define TK_SUBTABLE 222 -#define TK_UNTREATED 223 -#define TK_KILL 224 -#define TK_CONNECTION 225 -#define TK_TRANSACTION 226 -#define TK_BALANCE 227 -#define TK_VGROUP 228 -#define TK_LEADER 229 -#define TK_MERGE 230 -#define TK_REDISTRIBUTE 231 -#define TK_SPLIT 232 -#define TK_DELETE 233 -#define TK_INSERT 234 -#define TK_NK_BIN 235 -#define TK_NK_HEX 236 -#define TK_NULL 237 -#define TK_NK_QUESTION 238 -#define TK_NK_ALIAS 239 -#define TK_NK_ARROW 240 -#define TK_ROWTS 241 -#define TK_QSTART 242 -#define TK_QEND 243 -#define TK_QDURATION 244 -#define TK_WSTART 245 -#define TK_WEND 246 -#define TK_WDURATION 247 -#define TK_IROWTS 248 -#define TK_ISFILLED 249 -#define TK_CAST 250 -#define TK_NOW 251 -#define TK_TODAY 252 -#define TK_TIMEZONE 253 -#define TK_CLIENT_VERSION 254 -#define TK_SERVER_VERSION 255 -#define TK_SERVER_STATUS 256 -#define TK_CURRENT_USER 257 -#define TK_CASE 258 -#define TK_WHEN 259 -#define TK_THEN 260 -#define TK_ELSE 261 -#define TK_BETWEEN 262 -#define TK_IS 263 -#define TK_NK_LT 264 -#define TK_NK_GT 265 -#define TK_NK_LE 266 -#define TK_NK_GE 267 -#define TK_NK_NE 268 -#define TK_MATCH 269 -#define TK_NMATCH 270 -#define TK_CONTAINS 271 -#define TK_IN 272 -#define TK_JOIN 273 -#define TK_INNER 274 -#define TK_SELECT 275 -#define TK_NK_HINT 276 -#define TK_DISTINCT 277 -#define TK_WHERE 278 -#define TK_PARTITION 279 -#define TK_BY 280 -#define TK_SESSION 281 -#define TK_STATE_WINDOW 282 -#define TK_EVENT_WINDOW 283 -#define TK_COUNT_WINDOW 284 -#define TK_SLIDING 285 -#define TK_FILL 286 -#define TK_VALUE 287 -#define TK_VALUE_F 288 -#define TK_NONE 289 -#define TK_PREV 290 -#define TK_NULL_F 291 -#define TK_LINEAR 292 -#define TK_NEXT 293 -#define TK_HAVING 294 -#define TK_RANGE 295 -#define TK_EVERY 296 -#define TK_ORDER 297 -#define TK_SLIMIT 298 -#define TK_SOFFSET 299 -#define TK_LIMIT 300 -#define TK_OFFSET 301 -#define TK_ASC 302 -#define TK_NULLS 303 -#define TK_ABORT 304 -#define TK_AFTER 305 -#define TK_ATTACH 306 -#define TK_BEFORE 307 -#define TK_BEGIN 308 -#define TK_BITAND 309 -#define TK_BITNOT 310 -#define TK_BITOR 311 -#define TK_BLOCKS 312 -#define TK_CHANGE 313 -#define TK_COMMA 314 -#define TK_CONCAT 315 -#define TK_CONFLICT 316 -#define TK_COPY 317 -#define TK_DEFERRED 318 -#define TK_DELIMITERS 319 -#define TK_DETACH 320 -#define TK_DIVIDE 321 -#define TK_DOT 322 -#define TK_EACH 323 -#define TK_FAIL 324 -#define TK_FILE 325 -#define TK_FOR 326 -#define TK_GLOB 327 -#define TK_ID 328 -#define TK_IMMEDIATE 329 -#define TK_IMPORT 330 -#define TK_INITIALLY 331 -#define TK_INSTEAD 332 -#define TK_ISNULL 333 -#define TK_KEY 334 -#define TK_MODULES 335 -#define TK_NK_BITNOT 336 -#define TK_NK_SEMI 337 -#define TK_NOTNULL 338 -#define TK_OF 339 -#define TK_PLUS 340 -#define TK_PRIVILEGE 341 -#define TK_RAISE 342 -#define TK_RESTRICT 343 -#define TK_ROW 344 -#define TK_SEMI 345 -#define TK_STAR 346 -#define TK_STATEMENT 347 -#define TK_STRICT 348 -#define TK_STRING 349 -#define TK_TIMES 350 -#define TK_VALUES 351 -#define TK_VARIABLE 352 -#define TK_WAL 353 -#endif -/**************** End token definitions ***************************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +/**************** End makeheaders token definitions ***************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -497,18 +142,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 860 -#define YYNRULE 671 -#define YYNRULE_WITH_ACTION 671 +#define YYNSTATE 890 +#define YYNRULE 691 +#define YYNRULE_WITH_ACTION 691 #define YYNTOKEN 354 -#define YY_MAX_SHIFT 859 -#define YY_MIN_SHIFTREDUCE 1282 -#define YY_MAX_SHIFTREDUCE 1952 -#define YY_ERROR_ACTION 1953 -#define YY_ACCEPT_ACTION 1954 -#define YY_NO_ACTION 1955 -#define YY_MIN_REDUCE 1956 -#define YY_MAX_REDUCE 2626 +#define YY_MAX_SHIFT 889 +#define YY_MIN_SHIFTREDUCE 1322 +#define YY_MAX_SHIFTREDUCE 2012 +#define YY_ERROR_ACTION 2013 +#define YY_ACCEPT_ACTION 2014 +#define YY_NO_ACTION 2015 +#define YY_MIN_REDUCE 2016 +#define YY_MAX_REDUCE 2706 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -577,311 +222,311 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (3048) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 481, 428, 2122, 2384, 711, 2401, 426, 2597, 2531, 169, - /* 10 */ 37, 310, 47, 45, 1874, 574, 405, 2148, 575, 1999, - /* 20 */ 419, 2285, 1714, 2531, 2197, 710, 204, 760, 474, 2405, - /* 30 */ 2598, 712, 2285, 473, 2528, 1800, 2042, 1712, 1740, 2283, - /* 40 */ 748, 2602, 654, 2425, 2597, 541, 539, 422, 370, 2527, - /* 50 */ 2282, 748, 218, 723, 147, 2199, 726, 652, 425, 650, - /* 60 */ 271, 270, 404, 2601, 666, 1795, 2199, 2598, 2600, 765, - /* 70 */ 2197, 19, 800, 388, 2407, 2409, 416, 571, 1720, 682, - /* 80 */ 705, 2197, 2597, 1739, 2443, 765, 569, 40, 39, 565, - /* 90 */ 561, 46, 44, 43, 42, 41, 2391, 66, 743, 582, - /* 100 */ 2603, 204, 575, 1999, 856, 2598, 712, 15, 2443, 831, - /* 110 */ 830, 829, 828, 437, 50, 827, 826, 152, 821, 820, - /* 120 */ 819, 818, 817, 816, 815, 151, 809, 808, 807, 436, - /* 130 */ 435, 804, 803, 802, 184, 183, 801, 760, 2424, 584, - /* 140 */ 2324, 2462, 1429, 1802, 1803, 115, 2426, 747, 2428, 2429, - /* 150 */ 742, 706, 765, 711, 1740, 1979, 2597, 187, 591, 2516, - /* 160 */ 9, 1613, 1614, 415, 2512, 302, 2524, 722, 1329, 139, - /* 170 */ 721, 704, 2597, 62, 710, 204, 723, 147, 206, 2598, - /* 180 */ 712, 1774, 1784, 1431, 761, 2146, 2546, 1978, 1801, 1804, - /* 190 */ 710, 204, 1327, 1328, 1739, 2598, 712, 1956, 430, 665, - /* 200 */ 62, 2192, 2194, 1715, 209, 1713, 1612, 1615, 2391, 1977, - /* 210 */ 723, 147, 40, 39, 592, 2278, 46, 44, 43, 42, + /* 0 */ 511, 458, 2182, 2464, 741, 2481, 456, 2677, 2611, 169, + /* 10 */ 37, 310, 47, 45, 1934, 604, 425, 2208, 605, 2059, + /* 20 */ 439, 2345, 1774, 2611, 2257, 740, 204, 790, 504, 2485, + /* 30 */ 2678, 742, 2345, 503, 2608, 1860, 2102, 1772, 1800, 2343, + /* 40 */ 778, 2682, 684, 2505, 2677, 571, 569, 442, 390, 2607, + /* 50 */ 2342, 778, 218, 753, 147, 2259, 756, 682, 445, 680, + /* 60 */ 271, 270, 424, 2681, 696, 1855, 2259, 2678, 2680, 795, + /* 70 */ 2257, 19, 830, 408, 2487, 2489, 436, 601, 1780, 712, + /* 80 */ 735, 2257, 2677, 1799, 2523, 795, 599, 40, 39, 595, + /* 90 */ 591, 46, 44, 43, 42, 41, 2471, 66, 773, 612, + /* 100 */ 2683, 204, 605, 2059, 886, 2678, 742, 15, 2523, 861, + /* 110 */ 860, 859, 858, 467, 50, 857, 856, 152, 851, 850, + /* 120 */ 849, 848, 847, 846, 845, 151, 839, 838, 837, 466, + /* 130 */ 465, 834, 833, 832, 184, 183, 831, 790, 2504, 614, + /* 140 */ 2384, 2542, 1469, 1862, 1863, 115, 2506, 777, 2508, 2509, + /* 150 */ 772, 736, 795, 741, 1800, 2039, 2677, 187, 621, 2596, + /* 160 */ 9, 1653, 1654, 435, 2592, 302, 2604, 752, 1369, 139, + /* 170 */ 751, 734, 2677, 62, 740, 204, 753, 147, 206, 2678, + /* 180 */ 742, 1834, 1844, 1471, 791, 2206, 2626, 2038, 1861, 1864, + /* 190 */ 740, 204, 1367, 1368, 1799, 2678, 742, 2016, 460, 695, + /* 200 */ 62, 2252, 2254, 1775, 209, 1773, 1652, 1655, 2471, 2037, + /* 210 */ 753, 147, 40, 39, 622, 2338, 46, 44, 43, 42, /* 220 */ 41, 137, 136, 135, 134, 133, 132, 131, 130, 129, - /* 230 */ 798, 162, 161, 795, 794, 793, 159, 1718, 1719, 1771, - /* 240 */ 2391, 1773, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, - /* 250 */ 739, 763, 762, 1794, 1796, 1797, 1798, 1799, 2, 47, - /* 260 */ 45, 107, 2391, 760, 368, 2333, 1737, 419, 472, 1714, - /* 270 */ 471, 761, 2146, 524, 1949, 380, 544, 1521, 1522, 621, - /* 280 */ 1831, 543, 1800, 620, 1712, 2045, 2139, 725, 202, 2524, - /* 290 */ 2525, 138, 145, 2529, 761, 2146, 33, 504, 617, 545, - /* 300 */ 470, 1899, 40, 39, 369, 506, 46, 44, 43, 42, - /* 310 */ 41, 175, 1795, 1968, 138, 484, 1900, 1486, 19, 1829, - /* 320 */ 276, 622, 203, 2524, 2525, 1720, 145, 2529, 434, 433, - /* 330 */ 811, 1477, 790, 789, 788, 1481, 787, 1483, 1484, 786, - /* 340 */ 783, 306, 1492, 780, 1494, 1495, 777, 774, 771, 1742, - /* 350 */ 50, 856, 391, 1721, 15, 1593, 1594, 1898, 636, 635, - /* 360 */ 634, 2602, 34, 492, 2597, 626, 144, 630, 306, 239, - /* 370 */ 1771, 629, 1836, 577, 579, 2007, 628, 633, 398, 397, - /* 380 */ 576, 1948, 627, 2601, 1830, 623, 2123, 2598, 2599, 1322, - /* 390 */ 1802, 1803, 1863, 2272, 2251, 813, 532, 531, 530, 529, - /* 400 */ 528, 523, 522, 521, 520, 374, 761, 2146, 1329, 510, - /* 410 */ 509, 508, 507, 501, 500, 499, 1957, 494, 493, 389, - /* 420 */ 2193, 2194, 458, 485, 1581, 1582, 55, 1976, 1774, 1784, - /* 430 */ 1600, 1324, 1327, 1328, 160, 1801, 1804, 128, 396, 395, - /* 440 */ 127, 126, 125, 124, 123, 122, 121, 120, 119, 2124, - /* 450 */ 1715, 128, 1713, 197, 127, 126, 125, 124, 123, 122, - /* 460 */ 121, 120, 119, 1739, 1714, 2186, 36, 417, 1824, 1825, - /* 470 */ 1826, 1827, 1828, 1832, 1833, 1834, 1835, 241, 1975, 1712, - /* 480 */ 2391, 577, 153, 2007, 1718, 1719, 1771, 701, 1773, 1776, - /* 490 */ 1777, 1778, 1779, 1780, 1781, 1782, 1783, 739, 763, 762, - /* 500 */ 1794, 1796, 1797, 1798, 1799, 2, 12, 47, 45, 54, - /* 510 */ 394, 393, 304, 619, 173, 419, 12, 1714, 306, 344, - /* 520 */ 1720, 1724, 798, 162, 161, 795, 794, 793, 159, 2121, - /* 530 */ 1800, 2391, 1712, 535, 590, 621, 342, 75, 160, 620, - /* 540 */ 74, 2602, 314, 315, 490, 2261, 856, 313, 40, 39, - /* 550 */ 371, 462, 46, 44, 43, 42, 41, 12, 1742, 10, - /* 560 */ 1795, 1743, 237, 556, 554, 551, 19, 636, 635, 634, - /* 570 */ 658, 2137, 657, 1720, 626, 144, 630, 1907, 464, 460, - /* 580 */ 629, 707, 702, 695, 691, 628, 633, 398, 397, 723, - /* 590 */ 147, 627, 1878, 220, 623, 229, 613, 612, 1739, 856, - /* 600 */ 40, 39, 15, 62, 46, 44, 43, 42, 41, 2425, - /* 610 */ 40, 39, 1743, 1657, 46, 44, 43, 42, 41, 2401, - /* 620 */ 534, 228, 744, 1348, 1775, 1347, 425, 698, 697, 1905, - /* 630 */ 1906, 1908, 1909, 1910, 2234, 663, 1694, 765, 1802, 1803, - /* 640 */ 143, 63, 35, 2405, 1739, 1715, 1942, 1713, 40, 39, - /* 650 */ 2443, 185, 46, 44, 43, 42, 41, 1810, 1349, 1348, - /* 660 */ 160, 1347, 2391, 1739, 743, 798, 162, 161, 795, 794, - /* 670 */ 793, 159, 62, 390, 594, 2265, 1774, 1784, 224, 1718, - /* 680 */ 1719, 800, 1772, 1801, 1804, 43, 42, 41, 2407, 2410, - /* 690 */ 51, 85, 84, 477, 1349, 732, 217, 2488, 1715, 765, - /* 700 */ 1713, 205, 2524, 2525, 2424, 145, 2529, 2462, 2385, 469, - /* 710 */ 467, 177, 2426, 747, 2428, 2429, 742, 2352, 765, 91, - /* 720 */ 367, 304, 90, 456, 496, 2261, 453, 449, 445, 442, - /* 730 */ 470, 62, 1718, 1719, 1771, 1660, 1773, 1776, 1777, 1778, - /* 740 */ 1779, 1780, 1781, 1782, 1783, 739, 763, 762, 1794, 1796, - /* 750 */ 1797, 1798, 1799, 2, 47, 45, 1805, 2425, 2412, 1775, - /* 760 */ 2364, 174, 419, 425, 1714, 713, 2618, 791, 274, 2085, - /* 770 */ 744, 306, 273, 222, 765, 200, 1693, 1800, 1720, 1712, - /* 780 */ 1744, 761, 2146, 761, 2146, 171, 2425, 526, 2261, 89, - /* 790 */ 46, 44, 43, 42, 41, 734, 517, 2488, 2443, 726, - /* 800 */ 516, 478, 2365, 479, 1697, 761, 2146, 1795, 515, 1871, - /* 810 */ 2391, 682, 743, 423, 2597, 2199, 2414, 1772, 172, 1743, - /* 820 */ 1720, 172, 414, 185, 1775, 498, 2149, 2443, 666, 2148, - /* 830 */ 2197, 1744, 2603, 204, 1700, 1703, 227, 2598, 712, 2391, - /* 840 */ 306, 743, 99, 1743, 2218, 377, 856, 2266, 403, 48, - /* 850 */ 656, 814, 2424, 682, 2107, 2462, 2597, 2425, 306, 115, - /* 860 */ 2426, 747, 2428, 2429, 742, 1974, 765, 761, 2146, 149, - /* 870 */ 744, 156, 2487, 2516, 2603, 204, 2135, 415, 2512, 2598, - /* 880 */ 712, 2424, 1772, 2029, 2462, 1802, 1803, 511, 115, 2426, - /* 890 */ 747, 2428, 2429, 742, 96, 765, 761, 2146, 2443, 306, - /* 900 */ 187, 428, 2516, 668, 2324, 637, 415, 2512, 664, 172, - /* 910 */ 2391, 392, 743, 2010, 761, 2146, 512, 2148, 2391, 681, - /* 920 */ 2141, 761, 2146, 1774, 1784, 100, 859, 2531, 2199, 2547, - /* 930 */ 1801, 1804, 40, 39, 513, 424, 46, 44, 43, 42, - /* 940 */ 41, 593, 331, 2197, 1696, 1715, 211, 1713, 329, 14, - /* 950 */ 13, 275, 2424, 2526, 1954, 2462, 1641, 29, 194, 115, - /* 960 */ 2426, 747, 2428, 2429, 742, 849, 765, 847, 843, 839, - /* 970 */ 835, 2491, 328, 2516, 1699, 1702, 2131, 415, 2512, 1718, - /* 980 */ 1719, 1771, 195, 1773, 1776, 1777, 1778, 1779, 1780, 1781, - /* 990 */ 1782, 1783, 739, 763, 762, 1794, 1796, 1797, 1798, 1799, - /* 1000 */ 2, 47, 45, 2601, 519, 518, 199, 761, 2146, 419, - /* 1010 */ 112, 1714, 689, 114, 1351, 1352, 321, 761, 2146, 109, - /* 1020 */ 761, 2146, 2425, 1973, 1800, 431, 1712, 2143, 113, 2199, - /* 1030 */ 1662, 1663, 1919, 172, 440, 744, 429, 277, 1744, 439, - /* 1040 */ 285, 2148, 2425, 1331, 2197, 150, 761, 2146, 757, 1738, - /* 1050 */ 615, 614, 60, 2138, 1795, 744, 1843, 2009, 761, 2146, - /* 1060 */ 679, 1972, 1744, 2443, 40, 39, 729, 1720, 46, 44, - /* 1070 */ 43, 42, 41, 632, 631, 2391, 2391, 743, 318, 825, - /* 1080 */ 823, 2425, 1870, 2443, 96, 682, 1971, 1894, 2597, 761, - /* 1090 */ 2146, 1739, 309, 856, 744, 2391, 48, 743, 2133, 308, - /* 1100 */ 2425, 761, 2146, 761, 2146, 792, 2603, 204, 2190, 758, - /* 1110 */ 2142, 2598, 712, 744, 2391, 2554, 49, 2424, 279, 1970, - /* 1120 */ 2462, 759, 2443, 325, 116, 2426, 747, 2428, 2429, 742, - /* 1130 */ 2129, 765, 1802, 1803, 2391, 1441, 743, 2424, 2516, 2391, - /* 1140 */ 2462, 2443, 2199, 2513, 115, 2426, 747, 2428, 2429, 742, - /* 1150 */ 1440, 765, 2199, 2391, 715, 743, 2617, 730, 2516, 1967, - /* 1160 */ 761, 2146, 415, 2512, 1918, 1966, 1965, 756, 718, 1964, - /* 1170 */ 1774, 1784, 2391, 1984, 851, 2027, 2424, 1801, 1804, 2462, - /* 1180 */ 432, 2199, 1723, 354, 2426, 747, 2428, 2429, 742, 3, - /* 1190 */ 765, 1904, 1715, 1445, 1713, 2424, 2198, 639, 2462, 1963, - /* 1200 */ 1962, 53, 115, 2426, 747, 2428, 2429, 742, 1444, 765, - /* 1210 */ 661, 737, 2391, 1961, 2617, 1960, 2516, 546, 2391, 2391, - /* 1220 */ 415, 2512, 2391, 1959, 2536, 1863, 1718, 1719, 1771, 708, - /* 1230 */ 1773, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 739, - /* 1240 */ 763, 762, 1794, 1796, 1797, 1798, 1799, 2, 47, 45, - /* 1250 */ 2425, 148, 2391, 2391, 2487, 667, 419, 796, 1714, 797, - /* 1260 */ 2190, 682, 2190, 744, 2597, 2567, 2391, 338, 2391, 2355, - /* 1270 */ 2176, 1800, 140, 1712, 624, 548, 2391, 2244, 77, 286, - /* 1280 */ 1951, 1952, 2603, 204, 87, 2018, 2016, 2598, 712, 2425, - /* 1290 */ 262, 2443, 2086, 260, 2150, 727, 264, 714, 1426, 263, - /* 1300 */ 49, 1795, 744, 2391, 693, 743, 682, 641, 644, 2597, - /* 1310 */ 1772, 625, 266, 198, 1720, 265, 434, 433, 268, 488, - /* 1320 */ 447, 267, 188, 101, 160, 282, 1728, 2603, 204, 64, - /* 1330 */ 2443, 88, 2598, 712, 1722, 1424, 49, 14, 13, 1800, - /* 1340 */ 856, 1721, 2391, 15, 743, 2424, 682, 2425, 2462, 2597, - /* 1350 */ 1726, 49, 115, 2426, 747, 2428, 2429, 742, 738, 765, - /* 1360 */ 744, 1969, 2590, 312, 2617, 76, 2516, 2603, 204, 1795, - /* 1370 */ 415, 2512, 2598, 712, 299, 1903, 2560, 1821, 699, 1802, - /* 1380 */ 1803, 293, 1720, 158, 2424, 160, 142, 2462, 2443, 73, - /* 1390 */ 769, 115, 2426, 747, 2428, 2429, 742, 291, 765, 728, - /* 1400 */ 2391, 2083, 743, 2617, 1837, 2516, 324, 323, 736, 415, - /* 1410 */ 2512, 1785, 2444, 805, 2082, 643, 2270, 1774, 1784, 806, - /* 1420 */ 716, 158, 160, 141, 1801, 1804, 1610, 40, 39, 158, - /* 1430 */ 655, 46, 44, 43, 42, 41, 719, 1403, 316, 1715, - /* 1440 */ 753, 1713, 2424, 1401, 2000, 2462, 272, 2550, 696, 115, - /* 1450 */ 2426, 747, 2428, 2429, 742, 410, 765, 703, 320, 1384, - /* 1460 */ 1471, 2617, 646, 2516, 337, 1499, 406, 415, 2512, 640, - /* 1470 */ 638, 750, 438, 1718, 1719, 1771, 269, 1773, 1776, 1777, - /* 1480 */ 1778, 1779, 1780, 1781, 1782, 1783, 739, 763, 762, 1794, - /* 1490 */ 1796, 1797, 1798, 1799, 2, 2425, 1503, 1510, 1508, 2006, - /* 1500 */ 1385, 2271, 1725, 2187, 163, 675, 724, 1729, 744, 1724, - /* 1510 */ 2535, 2551, 2561, 301, 298, 305, 2108, 71, 5, 441, - /* 1520 */ 70, 446, 386, 454, 1747, 455, 466, 1890, 465, 213, - /* 1530 */ 212, 468, 215, 332, 1634, 1737, 2443, 482, 1738, 489, - /* 1540 */ 226, 1732, 1734, 491, 495, 497, 537, 502, 2391, 525, - /* 1550 */ 743, 514, 2263, 2425, 549, 763, 762, 1794, 1796, 1797, - /* 1560 */ 1798, 1799, 527, 533, 536, 538, 744, 550, 547, 231, - /* 1570 */ 232, 552, 553, 234, 555, 557, 1745, 572, 4, 573, - /* 1580 */ 580, 242, 581, 1740, 585, 583, 1746, 93, 245, 1748, - /* 1590 */ 2424, 586, 2425, 2462, 2443, 587, 1749, 115, 2426, 747, - /* 1600 */ 2428, 2429, 742, 248, 765, 744, 2391, 250, 743, 2617, - /* 1610 */ 2279, 2516, 373, 372, 589, 415, 2512, 595, 616, 94, - /* 1620 */ 95, 618, 1704, 2425, 255, 2136, 259, 117, 2132, 261, - /* 1630 */ 165, 166, 2134, 2443, 647, 1800, 744, 1692, 648, 660, - /* 1640 */ 662, 364, 2130, 167, 98, 2391, 154, 743, 2424, 168, - /* 1650 */ 1741, 2462, 278, 333, 670, 115, 2426, 747, 2428, 2429, - /* 1660 */ 742, 669, 765, 2342, 2443, 1795, 2325, 2489, 281, 2516, - /* 1670 */ 2339, 674, 2338, 415, 2512, 283, 2391, 677, 743, 700, - /* 1680 */ 671, 686, 676, 2566, 751, 288, 8, 2424, 2538, 2565, - /* 1690 */ 2462, 290, 709, 292, 115, 2426, 747, 2428, 2429, 742, - /* 1700 */ 687, 765, 685, 684, 411, 296, 733, 179, 2516, 720, - /* 1710 */ 297, 2425, 415, 2512, 294, 2620, 295, 1863, 2424, 717, - /* 1720 */ 1742, 2462, 2532, 146, 744, 116, 2426, 747, 2428, 2429, - /* 1730 */ 742, 1868, 765, 257, 2596, 1866, 191, 307, 155, 2516, - /* 1740 */ 1, 207, 61, 2515, 2512, 334, 2497, 300, 749, 180, - /* 1750 */ 2293, 2292, 2443, 2291, 335, 421, 754, 157, 611, 607, - /* 1760 */ 603, 599, 336, 256, 2391, 2147, 743, 106, 755, 2383, - /* 1770 */ 2382, 108, 767, 2191, 339, 1306, 850, 853, 327, 164, - /* 1780 */ 52, 363, 855, 343, 384, 341, 2363, 385, 2362, 351, - /* 1790 */ 362, 2361, 82, 2356, 443, 352, 444, 1685, 1686, 210, - /* 1800 */ 448, 2354, 450, 1705, 97, 1695, 2424, 254, 2425, 2462, - /* 1810 */ 451, 452, 1684, 116, 2426, 747, 2428, 2429, 742, 2353, - /* 1820 */ 765, 744, 387, 2351, 457, 2350, 459, 2516, 2349, 461, - /* 1830 */ 2348, 735, 2512, 463, 1673, 1698, 1701, 1706, 2329, 214, - /* 1840 */ 2328, 83, 216, 1636, 1637, 2425, 2306, 2305, 2304, 2443, - /* 1850 */ 475, 763, 762, 1794, 1796, 1797, 1798, 1799, 741, 476, - /* 1860 */ 2303, 2391, 2302, 743, 2253, 480, 2425, 1580, 2250, 483, - /* 1870 */ 2249, 2243, 486, 487, 244, 2240, 219, 2239, 86, 744, - /* 1880 */ 2238, 2237, 2242, 253, 246, 2241, 2443, 2236, 221, 2235, - /* 1890 */ 251, 588, 2233, 2232, 2231, 223, 503, 2230, 2391, 505, - /* 1900 */ 743, 2228, 2227, 745, 2226, 2225, 2462, 2443, 2248, 243, - /* 1910 */ 116, 2426, 747, 2428, 2429, 742, 2224, 765, 2223, 2391, - /* 1920 */ 2222, 743, 225, 2211, 2516, 2246, 2229, 2221, 379, 2512, - /* 1930 */ 2220, 2219, 2217, 2216, 2215, 2214, 2213, 2212, 2210, 2209, - /* 1940 */ 2424, 92, 2208, 2462, 2207, 2247, 2245, 360, 2426, 747, - /* 1950 */ 2428, 2429, 742, 740, 765, 731, 2481, 2206, 2205, 2204, - /* 1960 */ 230, 2424, 1586, 2425, 2462, 2203, 2202, 540, 176, 2426, - /* 1970 */ 747, 2428, 2429, 742, 2201, 765, 744, 542, 2200, 375, - /* 1980 */ 2425, 1330, 1442, 1446, 2048, 1438, 233, 2047, 2046, 235, - /* 1990 */ 2044, 376, 2041, 744, 559, 2425, 560, 2040, 564, 558, - /* 2000 */ 562, 563, 2033, 567, 2443, 566, 568, 2020, 744, 570, - /* 2010 */ 683, 2557, 236, 1995, 238, 79, 2391, 1994, 743, 186, - /* 2020 */ 2411, 2443, 240, 2327, 196, 578, 2323, 80, 2313, 2301, - /* 2030 */ 2300, 247, 252, 2391, 2277, 743, 2443, 249, 2125, 2043, - /* 2040 */ 2039, 596, 1377, 598, 597, 2037, 600, 601, 2391, 2035, - /* 2050 */ 743, 604, 602, 606, 605, 408, 2032, 608, 2424, 609, - /* 2060 */ 610, 2462, 2015, 2013, 2425, 176, 2426, 747, 2428, 2429, - /* 2070 */ 742, 2014, 765, 2012, 1991, 2424, 2127, 744, 2462, 2425, - /* 2080 */ 1515, 1514, 361, 2426, 747, 2428, 2429, 742, 2126, 765, - /* 2090 */ 2424, 1428, 741, 2462, 1427, 72, 2030, 177, 2426, 747, - /* 2100 */ 2428, 2429, 742, 1425, 765, 2443, 1423, 258, 2558, 1422, - /* 2110 */ 2028, 1414, 1421, 822, 1420, 1419, 824, 2391, 1416, 743, - /* 2120 */ 2443, 1415, 1413, 399, 400, 2019, 401, 2017, 402, 645, - /* 2130 */ 1990, 1989, 2391, 1988, 743, 642, 649, 1987, 1986, 409, - /* 2140 */ 651, 653, 118, 1671, 1667, 1669, 1666, 2326, 28, 67, - /* 2150 */ 2322, 1643, 2619, 2312, 280, 2299, 1645, 2298, 672, 2424, - /* 2160 */ 56, 1647, 2462, 2425, 2602, 57, 361, 2426, 747, 2428, - /* 2170 */ 2429, 742, 20, 765, 2424, 17, 744, 2462, 2425, 688, - /* 2180 */ 407, 360, 2426, 747, 2428, 2429, 742, 1921, 765, 673, - /* 2190 */ 2482, 744, 21, 2425, 30, 678, 6, 170, 284, 1622, - /* 2200 */ 287, 7, 1895, 692, 2443, 1621, 744, 690, 22, 2425, - /* 2210 */ 190, 680, 201, 32, 694, 2412, 2391, 65, 743, 2443, - /* 2220 */ 289, 1902, 744, 178, 189, 31, 24, 1936, 1889, 1941, - /* 2230 */ 81, 2391, 1942, 743, 2443, 23, 1935, 412, 418, 1940, - /* 2240 */ 1939, 413, 59, 303, 181, 2297, 2391, 2276, 743, 1860, - /* 2250 */ 2443, 25, 1859, 420, 103, 102, 13, 1812, 2424, 11, - /* 2260 */ 1730, 2462, 2391, 1811, 743, 361, 2426, 747, 2428, 2429, - /* 2270 */ 742, 58, 765, 2424, 1822, 18, 2462, 1787, 38, 2425, - /* 2280 */ 361, 2426, 747, 2428, 2429, 742, 1786, 765, 659, 182, - /* 2290 */ 16, 2462, 744, 26, 1764, 356, 2426, 747, 2428, 2429, - /* 2300 */ 742, 192, 765, 27, 2424, 1756, 2425, 2462, 746, 311, - /* 2310 */ 2275, 346, 2426, 747, 2428, 2429, 742, 104, 765, 744, - /* 2320 */ 2443, 1897, 193, 317, 69, 322, 105, 752, 2467, 2466, - /* 2330 */ 319, 1789, 2391, 764, 743, 68, 109, 1500, 2425, 768, - /* 2340 */ 427, 766, 770, 772, 1497, 1496, 773, 2443, 775, 776, - /* 2350 */ 778, 744, 1493, 779, 781, 784, 1487, 782, 785, 2391, - /* 2360 */ 1491, 743, 1490, 1485, 110, 326, 111, 1509, 78, 1489, - /* 2370 */ 1505, 1488, 1375, 1410, 2424, 799, 2425, 2462, 1407, 2443, - /* 2380 */ 1406, 345, 2426, 747, 2428, 2429, 742, 1405, 765, 744, - /* 2390 */ 1404, 2391, 1402, 743, 1400, 1399, 1398, 1436, 810, 1435, - /* 2400 */ 812, 2424, 208, 1396, 2462, 1395, 1393, 1394, 347, 2426, - /* 2410 */ 747, 2428, 2429, 742, 1381, 765, 1392, 2443, 1391, 1390, - /* 2420 */ 1432, 2038, 2425, 1430, 1387, 1386, 1383, 1382, 1380, 2391, - /* 2430 */ 832, 743, 2036, 2424, 833, 744, 2462, 834, 836, 838, - /* 2440 */ 353, 2426, 747, 2428, 2429, 742, 2034, 765, 2425, 837, - /* 2450 */ 840, 841, 842, 2031, 844, 845, 846, 2011, 1985, 848, - /* 2460 */ 1319, 744, 1307, 2443, 852, 330, 854, 1955, 1955, 1716, - /* 2470 */ 340, 2424, 857, 1955, 2462, 2391, 858, 743, 357, 2426, - /* 2480 */ 747, 2428, 2429, 742, 1955, 765, 1955, 1955, 1955, 2443, - /* 2490 */ 1955, 1955, 2425, 1955, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2500 */ 1955, 2391, 1955, 743, 1955, 744, 1955, 1955, 1955, 1955, - /* 2510 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2424, 1955, 1955, - /* 2520 */ 2462, 2425, 1955, 1955, 348, 2426, 747, 2428, 2429, 742, - /* 2530 */ 1955, 765, 1955, 2443, 744, 1955, 2425, 1955, 1955, 1955, - /* 2540 */ 1955, 1955, 1955, 2424, 1955, 2391, 2462, 743, 1955, 744, - /* 2550 */ 358, 2426, 747, 2428, 2429, 742, 1955, 765, 1955, 1955, - /* 2560 */ 1955, 1955, 2443, 1955, 1955, 1955, 1955, 2425, 1955, 1955, - /* 2570 */ 1955, 1955, 1955, 1955, 2391, 1955, 743, 2443, 1955, 1955, - /* 2580 */ 744, 1955, 1955, 1955, 1955, 1955, 1955, 2424, 1955, 2391, - /* 2590 */ 2462, 743, 1955, 1955, 349, 2426, 747, 2428, 2429, 742, - /* 2600 */ 1955, 765, 1955, 1955, 1955, 1955, 1955, 1955, 2443, 1955, - /* 2610 */ 1955, 1955, 1955, 1955, 1955, 1955, 2424, 1955, 1955, 2462, - /* 2620 */ 2391, 1955, 743, 359, 2426, 747, 2428, 2429, 742, 1955, - /* 2630 */ 765, 2424, 1955, 1955, 2462, 1955, 1955, 2425, 350, 2426, - /* 2640 */ 747, 2428, 2429, 742, 1955, 765, 1955, 1955, 1955, 1955, - /* 2650 */ 744, 1955, 1955, 2425, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2660 */ 1955, 1955, 2424, 1955, 1955, 2462, 744, 1955, 1955, 365, - /* 2670 */ 2426, 747, 2428, 2429, 742, 1955, 765, 1955, 2443, 1955, - /* 2680 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2690 */ 2391, 1955, 743, 1955, 2443, 1955, 1955, 1955, 1955, 1955, - /* 2700 */ 1955, 1955, 1955, 1955, 1955, 1955, 2391, 1955, 743, 1955, - /* 2710 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2720 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2730 */ 1955, 1955, 2424, 1955, 2425, 2462, 1955, 1955, 1955, 366, - /* 2740 */ 2426, 747, 2428, 2429, 742, 1955, 765, 744, 2424, 1955, - /* 2750 */ 1955, 2462, 1955, 1955, 1955, 2437, 2426, 747, 2428, 2429, - /* 2760 */ 742, 1955, 765, 1955, 1955, 1955, 2425, 1955, 1955, 1955, - /* 2770 */ 1955, 1955, 1955, 1955, 1955, 2443, 1955, 1955, 1955, 744, - /* 2780 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2391, 1955, 743, - /* 2790 */ 1955, 1955, 1955, 2425, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2800 */ 1955, 1955, 1955, 1955, 1955, 1955, 744, 2443, 1955, 1955, - /* 2810 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2391, - /* 2820 */ 1955, 743, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2424, - /* 2830 */ 1955, 1955, 2462, 1955, 2443, 1955, 2436, 2426, 747, 2428, - /* 2840 */ 2429, 742, 1955, 765, 1955, 1955, 2391, 1955, 743, 1955, - /* 2850 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2860 */ 1955, 2424, 1955, 2425, 2462, 1955, 1955, 1955, 2435, 2426, - /* 2870 */ 747, 2428, 2429, 742, 1955, 765, 744, 1955, 1955, 2425, - /* 2880 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2424, 1955, - /* 2890 */ 1955, 2462, 744, 1955, 2425, 381, 2426, 747, 2428, 2429, - /* 2900 */ 742, 1955, 765, 1955, 2443, 1955, 1955, 744, 1955, 2425, - /* 2910 */ 1955, 1955, 1955, 1955, 1955, 1955, 2391, 1955, 743, 1955, - /* 2920 */ 2443, 1955, 744, 1955, 1955, 1955, 1955, 1955, 1955, 1955, - /* 2930 */ 1955, 1955, 2391, 1955, 743, 2443, 1955, 1955, 2425, 1955, - /* 2940 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 2391, 1955, 743, - /* 2950 */ 2443, 744, 1955, 1955, 1955, 1955, 1955, 1955, 2424, 1955, - /* 2960 */ 1955, 2462, 2391, 1955, 743, 382, 2426, 747, 2428, 2429, - /* 2970 */ 742, 1955, 765, 1955, 2424, 1955, 1955, 2462, 1955, 2443, - /* 2980 */ 1955, 378, 2426, 747, 2428, 2429, 742, 1955, 765, 2424, - /* 2990 */ 1955, 2391, 2462, 743, 1955, 1955, 383, 2426, 747, 2428, - /* 3000 */ 2429, 742, 1955, 765, 745, 1955, 1955, 2462, 1955, 1955, - /* 3010 */ 1955, 356, 2426, 747, 2428, 2429, 742, 1955, 765, 1955, - /* 3020 */ 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, 1955, - /* 3030 */ 1955, 1955, 1955, 2424, 1955, 1955, 2462, 1955, 1955, 1955, - /* 3040 */ 355, 2426, 747, 2428, 2429, 742, 1955, 765, + /* 230 */ 828, 162, 161, 825, 824, 823, 159, 1778, 1779, 1831, + /* 240 */ 2471, 1833, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, + /* 250 */ 769, 793, 792, 1854, 1856, 1857, 1858, 1859, 2, 47, + /* 260 */ 45, 107, 2471, 790, 388, 2393, 1797, 439, 502, 1774, + /* 270 */ 501, 791, 2206, 554, 2009, 400, 574, 1561, 1562, 651, + /* 280 */ 1891, 573, 1860, 650, 1772, 2105, 2199, 755, 202, 2604, + /* 290 */ 2605, 138, 145, 2609, 791, 2206, 33, 534, 647, 575, + /* 300 */ 500, 1959, 40, 39, 389, 536, 46, 44, 43, 42, + /* 310 */ 41, 175, 1855, 2028, 138, 514, 1960, 1526, 19, 1889, + /* 320 */ 276, 652, 203, 2604, 2605, 1780, 145, 2609, 464, 463, + /* 330 */ 841, 1517, 820, 819, 818, 1521, 817, 1523, 1524, 816, + /* 340 */ 813, 306, 1532, 810, 1534, 1535, 807, 804, 801, 1802, + /* 350 */ 50, 886, 411, 1781, 15, 1633, 1634, 1958, 666, 665, + /* 360 */ 664, 2682, 34, 522, 2677, 656, 144, 660, 306, 239, + /* 370 */ 1831, 659, 1896, 607, 609, 2067, 658, 663, 418, 417, + /* 380 */ 606, 2008, 657, 2681, 1890, 653, 2183, 2678, 2679, 1362, + /* 390 */ 1862, 1863, 1923, 2332, 2311, 843, 562, 561, 560, 559, + /* 400 */ 558, 553, 552, 551, 550, 394, 791, 2206, 1369, 540, + /* 410 */ 539, 538, 537, 531, 530, 529, 2017, 524, 523, 409, + /* 420 */ 2253, 2254, 488, 515, 1621, 1622, 55, 2036, 1834, 1844, + /* 430 */ 1640, 1364, 1367, 1368, 160, 1861, 1864, 128, 416, 415, + /* 440 */ 127, 126, 125, 124, 123, 122, 121, 120, 119, 2184, + /* 450 */ 1775, 128, 1773, 197, 127, 126, 125, 124, 123, 122, + /* 460 */ 121, 120, 119, 1799, 1774, 2246, 36, 437, 1884, 1885, + /* 470 */ 1886, 1887, 1888, 1892, 1893, 1894, 1895, 241, 2035, 1772, + /* 480 */ 2471, 607, 153, 2067, 1778, 1779, 1831, 731, 1833, 1836, + /* 490 */ 1837, 1838, 1839, 1840, 1841, 1842, 1843, 769, 793, 792, + /* 500 */ 1854, 1856, 1857, 1858, 1859, 2, 12, 47, 45, 54, + /* 510 */ 414, 413, 304, 649, 173, 439, 12, 1774, 306, 364, + /* 520 */ 1780, 1784, 828, 162, 161, 825, 824, 823, 159, 2181, + /* 530 */ 1860, 2471, 1772, 565, 620, 651, 362, 75, 160, 650, + /* 540 */ 74, 2682, 314, 315, 520, 2321, 886, 313, 40, 39, + /* 550 */ 391, 492, 46, 44, 43, 42, 41, 12, 1802, 10, + /* 560 */ 1855, 1803, 237, 586, 584, 581, 19, 666, 665, 664, + /* 570 */ 688, 2197, 687, 1780, 656, 144, 660, 1967, 494, 490, + /* 580 */ 659, 737, 732, 725, 721, 658, 663, 418, 417, 753, + /* 590 */ 147, 657, 1938, 220, 653, 229, 643, 642, 1799, 886, + /* 600 */ 40, 39, 15, 62, 46, 44, 43, 42, 41, 2505, + /* 610 */ 40, 39, 1803, 1697, 46, 44, 43, 42, 41, 2481, + /* 620 */ 564, 228, 774, 1388, 1835, 1387, 445, 728, 727, 1965, + /* 630 */ 1966, 1968, 1969, 1970, 2294, 693, 451, 795, 1862, 1863, + /* 640 */ 143, 63, 35, 2485, 1799, 1775, 2002, 1773, 40, 39, + /* 650 */ 2523, 185, 46, 44, 43, 42, 41, 1870, 1389, 1388, + /* 660 */ 160, 1387, 2471, 1799, 773, 828, 162, 161, 825, 824, + /* 670 */ 823, 159, 62, 410, 624, 2325, 1834, 1844, 224, 1778, + /* 680 */ 1779, 830, 1832, 1861, 1864, 43, 42, 41, 2487, 2490, + /* 690 */ 51, 85, 84, 507, 1389, 762, 217, 2568, 1775, 795, + /* 700 */ 1773, 205, 2604, 2605, 2504, 145, 2609, 2542, 2465, 499, + /* 710 */ 497, 177, 2506, 777, 2508, 2509, 772, 2412, 795, 91, + /* 720 */ 387, 304, 90, 486, 526, 2321, 483, 479, 475, 472, + /* 730 */ 500, 62, 1778, 1779, 1831, 1700, 1833, 1836, 1837, 1838, + /* 740 */ 1839, 1840, 1841, 1842, 1843, 769, 793, 792, 1854, 1856, + /* 750 */ 1857, 1858, 1859, 2, 47, 45, 1865, 2505, 2492, 1835, + /* 760 */ 2424, 174, 439, 445, 1774, 743, 2698, 821, 274, 2145, + /* 770 */ 774, 306, 273, 222, 795, 200, 454, 1860, 1780, 1772, + /* 780 */ 1804, 791, 2206, 791, 2206, 171, 2505, 556, 2321, 89, + /* 790 */ 46, 44, 43, 42, 41, 764, 547, 2568, 2523, 756, + /* 800 */ 546, 508, 2425, 509, 1743, 791, 2206, 1855, 545, 1931, + /* 810 */ 2471, 712, 773, 443, 2677, 2259, 2494, 1832, 172, 1803, + /* 820 */ 1780, 172, 434, 185, 1835, 528, 2209, 2523, 696, 2208, + /* 830 */ 2257, 1804, 2683, 204, 450, 449, 227, 2678, 742, 2471, + /* 840 */ 306, 773, 99, 1803, 2278, 397, 886, 2326, 423, 48, + /* 850 */ 686, 844, 2504, 712, 2167, 2542, 2677, 2505, 306, 115, + /* 860 */ 2506, 777, 2508, 2509, 772, 2034, 795, 791, 2206, 149, + /* 870 */ 774, 156, 2567, 2596, 2683, 204, 2195, 435, 2592, 2678, + /* 880 */ 742, 2504, 1832, 2089, 2542, 1862, 1863, 541, 115, 2506, + /* 890 */ 777, 2508, 2509, 772, 96, 795, 791, 2206, 2523, 306, + /* 900 */ 187, 458, 2596, 698, 2384, 667, 435, 2592, 694, 172, + /* 910 */ 2471, 412, 773, 2070, 791, 2206, 542, 2208, 2471, 711, + /* 920 */ 2201, 791, 2206, 1834, 1844, 100, 889, 2611, 2259, 2627, + /* 930 */ 1861, 1864, 40, 39, 543, 444, 46, 44, 43, 42, + /* 940 */ 41, 623, 351, 2257, 1742, 1775, 211, 1773, 349, 14, + /* 950 */ 13, 275, 2504, 2606, 2014, 2542, 1681, 29, 194, 115, + /* 960 */ 2506, 777, 2508, 2509, 772, 879, 795, 877, 873, 869, + /* 970 */ 865, 2571, 348, 2596, 453, 452, 2191, 435, 2592, 1778, + /* 980 */ 1779, 1831, 195, 1833, 1836, 1837, 1838, 1839, 1840, 1841, + /* 990 */ 1842, 1843, 769, 793, 792, 1854, 1856, 1857, 1858, 1859, + /* 1000 */ 2, 47, 45, 2681, 549, 548, 199, 791, 2206, 439, + /* 1010 */ 112, 1774, 719, 114, 1391, 1392, 321, 791, 2206, 109, + /* 1020 */ 791, 2206, 2505, 2033, 1860, 461, 1772, 2203, 113, 2259, + /* 1030 */ 1702, 1703, 1979, 172, 470, 774, 459, 277, 1804, 469, + /* 1040 */ 285, 2208, 2505, 1371, 2257, 150, 791, 2206, 787, 1798, + /* 1050 */ 645, 644, 60, 2198, 1855, 774, 1903, 2069, 791, 2206, + /* 1060 */ 709, 2032, 1804, 2523, 40, 39, 759, 1780, 46, 44, + /* 1070 */ 43, 42, 41, 662, 661, 2471, 2471, 773, 318, 855, + /* 1080 */ 853, 2505, 1930, 2523, 96, 712, 2031, 1954, 2677, 791, + /* 1090 */ 2206, 1799, 309, 886, 774, 2471, 48, 773, 2193, 308, + /* 1100 */ 2505, 791, 2206, 791, 2206, 822, 2683, 204, 2250, 788, + /* 1110 */ 2202, 2678, 742, 774, 2471, 2634, 49, 2504, 279, 2030, + /* 1120 */ 2542, 789, 2523, 345, 116, 2506, 777, 2508, 2509, 772, + /* 1130 */ 2189, 795, 1862, 1863, 2471, 1481, 773, 2504, 2596, 2471, + /* 1140 */ 2542, 2523, 2259, 2593, 115, 2506, 777, 2508, 2509, 772, + /* 1150 */ 1480, 795, 2259, 2471, 745, 773, 2697, 760, 2596, 2027, + /* 1160 */ 791, 2206, 435, 2592, 1978, 2026, 2025, 786, 748, 2024, + /* 1170 */ 1834, 1844, 2471, 2044, 881, 2087, 2504, 1861, 1864, 2542, + /* 1180 */ 462, 2259, 1783, 374, 2506, 777, 2508, 2509, 772, 3, + /* 1190 */ 795, 1964, 1775, 1485, 1773, 2504, 2258, 669, 2542, 2023, + /* 1200 */ 2022, 53, 115, 2506, 777, 2508, 2509, 772, 1484, 795, + /* 1210 */ 691, 767, 2471, 2021, 2697, 2020, 2596, 576, 2471, 2471, + /* 1220 */ 435, 2592, 2471, 2019, 2616, 1923, 1778, 1779, 1831, 738, + /* 1230 */ 1833, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 769, + /* 1240 */ 793, 792, 1854, 1856, 1857, 1858, 1859, 2, 47, 45, + /* 1250 */ 2505, 148, 2471, 2471, 2567, 697, 439, 826, 1774, 827, + /* 1260 */ 2250, 712, 2250, 774, 2677, 2647, 2471, 358, 2471, 2415, + /* 1270 */ 2236, 1860, 140, 1772, 654, 578, 2471, 2304, 77, 286, + /* 1280 */ 2011, 2012, 2683, 204, 87, 2078, 2076, 2678, 742, 2505, + /* 1290 */ 262, 2523, 2146, 260, 2210, 757, 264, 744, 1466, 263, + /* 1300 */ 49, 1855, 774, 2471, 723, 773, 712, 671, 674, 2677, + /* 1310 */ 1832, 655, 266, 198, 1780, 265, 464, 463, 268, 518, + /* 1320 */ 477, 267, 188, 101, 160, 282, 1788, 2683, 204, 64, + /* 1330 */ 2523, 88, 2678, 742, 768, 1464, 49, 14, 13, 1860, + /* 1340 */ 886, 1781, 2471, 15, 773, 2504, 712, 2505, 2542, 2677, + /* 1350 */ 1786, 49, 115, 2506, 777, 2508, 2509, 772, 1782, 795, + /* 1360 */ 774, 2029, 2670, 312, 2697, 76, 2596, 2683, 204, 1855, + /* 1370 */ 435, 2592, 2678, 742, 299, 1963, 2640, 1881, 1424, 1862, + /* 1380 */ 1863, 729, 1780, 158, 2504, 160, 293, 2542, 2523, 142, + /* 1390 */ 2524, 115, 2506, 777, 2508, 2509, 772, 291, 795, 758, + /* 1400 */ 2471, 2143, 773, 2697, 1897, 2596, 324, 323, 766, 435, + /* 1410 */ 2592, 1845, 326, 325, 2142, 673, 2330, 1834, 1844, 1425, + /* 1420 */ 746, 328, 327, 2060, 1861, 1864, 1650, 40, 39, 2630, + /* 1430 */ 685, 46, 44, 43, 42, 41, 749, 73, 316, 1775, + /* 1440 */ 783, 1773, 2504, 330, 329, 2542, 272, 332, 331, 115, + /* 1450 */ 2506, 777, 2508, 2509, 772, 799, 795, 726, 320, 158, + /* 1460 */ 1511, 2697, 676, 2596, 334, 333, 430, 435, 2592, 670, + /* 1470 */ 668, 336, 335, 1778, 1779, 1831, 269, 1833, 1836, 1837, + /* 1480 */ 1838, 1839, 1840, 1841, 1842, 1843, 769, 793, 792, 1854, + /* 1490 */ 1856, 1857, 1858, 1859, 2, 2505, 338, 337, 340, 339, + /* 1500 */ 835, 342, 341, 344, 343, 160, 141, 1789, 774, 1784, + /* 1510 */ 2615, 158, 357, 836, 733, 426, 780, 71, 2331, 468, + /* 1520 */ 70, 2066, 705, 2247, 1443, 2631, 1785, 1950, 2641, 754, + /* 1530 */ 1539, 301, 298, 305, 1543, 2168, 2523, 1441, 5, 471, + /* 1540 */ 406, 1792, 1794, 476, 484, 485, 1807, 496, 2471, 495, + /* 1550 */ 773, 212, 213, 2505, 498, 793, 792, 1854, 1856, 1857, + /* 1560 */ 1858, 1859, 215, 1674, 352, 1797, 774, 512, 1798, 519, + /* 1570 */ 226, 521, 527, 525, 532, 567, 544, 580, 557, 555, + /* 1580 */ 1550, 1548, 2323, 563, 566, 568, 163, 579, 577, 232, + /* 1590 */ 2504, 231, 2505, 2542, 2523, 582, 583, 115, 2506, 777, + /* 1600 */ 2508, 2509, 772, 234, 795, 774, 2471, 585, 773, 2697, + /* 1610 */ 587, 2596, 393, 392, 1805, 435, 2592, 602, 4, 603, + /* 1620 */ 610, 242, 446, 2505, 613, 611, 93, 1800, 245, 615, + /* 1630 */ 1806, 1808, 248, 2523, 616, 1860, 774, 455, 1809, 619, + /* 1640 */ 617, 2339, 250, 94, 625, 2471, 646, 773, 2504, 95, + /* 1650 */ 255, 2542, 2402, 677, 648, 115, 2506, 777, 2508, 2509, + /* 1660 */ 772, 117, 795, 384, 2523, 1855, 678, 2569, 2196, 2596, + /* 1670 */ 690, 259, 2192, 435, 2592, 692, 2471, 261, 773, 165, + /* 1680 */ 166, 2194, 98, 353, 278, 2190, 167, 2504, 168, 1801, + /* 1690 */ 2542, 2385, 154, 281, 115, 2506, 777, 2508, 2509, 772, + /* 1700 */ 701, 795, 283, 700, 2399, 2398, 763, 699, 2596, 704, + /* 1710 */ 716, 2505, 435, 2592, 707, 706, 730, 2646, 2504, 781, + /* 1720 */ 2645, 2542, 8, 739, 774, 116, 2506, 777, 2508, 2509, + /* 1730 */ 772, 2618, 795, 257, 717, 288, 715, 290, 292, 2596, + /* 1740 */ 714, 179, 294, 2595, 2592, 297, 295, 431, 1923, 180, + /* 1750 */ 750, 747, 2523, 146, 1802, 296, 1928, 2612, 641, 637, + /* 1760 */ 633, 629, 191, 256, 2471, 2700, 773, 61, 307, 155, + /* 1770 */ 354, 1926, 355, 779, 2353, 2352, 2351, 441, 784, 785, + /* 1780 */ 356, 157, 106, 2207, 2463, 2462, 2676, 300, 2577, 2458, + /* 1790 */ 2457, 2449, 2448, 1, 207, 2440, 108, 2439, 2455, 2454, + /* 1800 */ 2446, 797, 359, 1765, 97, 1741, 2504, 254, 2505, 2542, + /* 1810 */ 1346, 2445, 2434, 116, 2506, 777, 2508, 2509, 772, 347, + /* 1820 */ 795, 774, 2433, 883, 2452, 2451, 2443, 2596, 2442, 880, + /* 1830 */ 2431, 765, 2592, 2430, 2428, 448, 447, 1766, 164, 2427, + /* 1840 */ 361, 885, 2251, 383, 2423, 2505, 52, 371, 382, 2523, + /* 1850 */ 404, 793, 792, 1854, 1856, 1857, 1858, 1859, 771, 372, + /* 1860 */ 363, 2471, 2422, 773, 2421, 405, 2505, 82, 2416, 473, + /* 1870 */ 474, 1725, 1726, 478, 244, 210, 2414, 480, 481, 774, + /* 1880 */ 482, 2413, 1724, 253, 246, 407, 2523, 2411, 487, 2410, + /* 1890 */ 251, 618, 489, 2409, 491, 2408, 493, 1713, 2471, 2389, + /* 1900 */ 773, 214, 2388, 775, 216, 1677, 2542, 2523, 83, 243, + /* 1910 */ 116, 2506, 777, 2508, 2509, 772, 1676, 795, 2366, 2471, + /* 1920 */ 2365, 773, 505, 506, 2596, 2364, 2363, 2362, 399, 2592, + /* 1930 */ 2313, 510, 1620, 2310, 513, 2309, 2303, 516, 2300, 517, + /* 1940 */ 2504, 219, 2299, 2542, 2298, 2297, 86, 380, 2506, 777, + /* 1950 */ 2508, 2509, 772, 770, 795, 761, 2561, 2302, 221, 2301, + /* 1960 */ 2296, 2504, 2295, 2505, 2542, 2293, 2292, 2291, 176, 2506, + /* 1970 */ 777, 2508, 2509, 772, 223, 795, 774, 533, 2290, 535, + /* 1980 */ 2505, 225, 2271, 2270, 92, 2269, 2268, 2267, 2307, 2305, + /* 1990 */ 2266, 2265, 1626, 774, 2288, 2505, 2287, 2286, 2285, 2308, + /* 2000 */ 2284, 2283, 2282, 2306, 2523, 2289, 2281, 2280, 774, 2279, + /* 2010 */ 713, 2637, 2277, 2276, 2275, 2274, 2471, 2273, 773, 230, + /* 2020 */ 2263, 2523, 2272, 2264, 570, 2262, 572, 2261, 2260, 395, + /* 2030 */ 1482, 2108, 1486, 2471, 396, 773, 2523, 233, 2107, 235, + /* 2040 */ 2106, 1478, 236, 2104, 2101, 2100, 589, 2093, 2471, 2080, + /* 2050 */ 773, 2055, 2054, 588, 186, 428, 2387, 2383, 2504, 2373, + /* 2060 */ 590, 2542, 593, 592, 2505, 176, 2506, 777, 2508, 2509, + /* 2070 */ 772, 594, 795, 596, 598, 2504, 600, 774, 2542, 2505, + /* 2080 */ 238, 597, 381, 2506, 777, 2508, 2509, 772, 79, 795, + /* 2090 */ 2504, 2491, 771, 2542, 1370, 2361, 240, 177, 2506, 777, + /* 2100 */ 2508, 2509, 772, 196, 795, 2523, 80, 249, 2638, 247, + /* 2110 */ 608, 2360, 252, 2337, 2185, 2103, 2099, 2471, 626, 773, + /* 2120 */ 2523, 627, 1417, 2097, 628, 630, 631, 632, 2095, 634, + /* 2130 */ 635, 636, 2471, 2092, 773, 638, 640, 639, 2075, 429, + /* 2140 */ 2073, 2074, 2072, 2051, 2187, 1555, 1554, 258, 72, 2186, + /* 2150 */ 672, 1454, 2699, 2090, 1468, 1467, 1465, 1463, 1462, 2504, + /* 2160 */ 2088, 2079, 2542, 2505, 1461, 852, 381, 2506, 777, 2508, + /* 2170 */ 2509, 772, 854, 795, 2504, 28, 774, 2542, 2505, 118, + /* 2180 */ 1711, 380, 2506, 777, 2508, 2509, 772, 1460, 795, 1453, + /* 2190 */ 2562, 774, 1459, 2505, 1456, 1455, 419, 420, 2077, 421, + /* 2200 */ 422, 2050, 675, 2049, 2523, 2048, 774, 679, 2047, 2505, + /* 2210 */ 681, 2046, 683, 2386, 67, 280, 2471, 1707, 773, 2523, + /* 2220 */ 1709, 1706, 774, 2382, 56, 1683, 1685, 2372, 702, 2359, + /* 2230 */ 170, 2471, 2358, 773, 2523, 20, 2682, 30, 438, 1981, + /* 2240 */ 724, 57, 1955, 703, 17, 1662, 2471, 1687, 773, 718, + /* 2250 */ 2523, 427, 284, 440, 1661, 287, 722, 6, 2504, 708, + /* 2260 */ 23, 2542, 2471, 710, 773, 381, 2506, 777, 2508, 2509, + /* 2270 */ 772, 7, 795, 2504, 720, 21, 2542, 289, 22, 2505, + /* 2280 */ 381, 2506, 777, 2508, 2509, 772, 190, 795, 689, 1962, + /* 2290 */ 1949, 2542, 774, 178, 189, 376, 2506, 777, 2508, 2509, + /* 2300 */ 772, 31, 795, 201, 2504, 2492, 2505, 2542, 32, 65, + /* 2310 */ 24, 366, 2506, 777, 2508, 2509, 772, 2001, 795, 774, + /* 2320 */ 2523, 1996, 81, 1995, 2002, 432, 2000, 1999, 18, 433, + /* 2330 */ 1920, 303, 2471, 1919, 773, 59, 181, 2357, 2505, 2336, + /* 2340 */ 103, 102, 25, 1872, 11, 1871, 13, 2523, 1790, 58, + /* 2350 */ 38, 774, 1847, 182, 1846, 16, 26, 192, 1816, 2471, + /* 2360 */ 1824, 773, 1882, 311, 27, 193, 776, 1957, 317, 69, + /* 2370 */ 2335, 104, 782, 105, 2504, 2547, 2505, 2542, 319, 2523, + /* 2380 */ 109, 365, 2506, 777, 2508, 2509, 772, 1849, 795, 774, + /* 2390 */ 322, 2471, 2546, 773, 798, 796, 457, 802, 794, 805, + /* 2400 */ 68, 2504, 1540, 1537, 2542, 1536, 800, 803, 367, 2506, + /* 2410 */ 777, 2508, 2509, 772, 806, 795, 808, 2523, 1533, 809, + /* 2420 */ 811, 1527, 2505, 812, 814, 1525, 815, 110, 346, 2471, + /* 2430 */ 111, 773, 78, 2504, 1549, 774, 2542, 1545, 1415, 1531, + /* 2440 */ 373, 2506, 777, 2508, 2509, 772, 1530, 795, 2505, 1529, + /* 2450 */ 1528, 829, 1476, 1450, 1447, 1446, 1445, 1444, 1442, 1440, + /* 2460 */ 1439, 774, 1438, 2523, 840, 842, 1475, 208, 1436, 1435, + /* 2470 */ 1434, 2504, 1433, 1421, 2542, 2471, 1432, 773, 377, 2506, + /* 2480 */ 777, 2508, 2509, 772, 1431, 795, 1430, 2098, 1472, 2523, + /* 2490 */ 1470, 1427, 2505, 1426, 1423, 1422, 1420, 862, 2096, 863, + /* 2500 */ 866, 2471, 2094, 773, 864, 774, 867, 868, 870, 872, + /* 2510 */ 2091, 874, 871, 2071, 876, 875, 878, 2504, 1359, 2045, + /* 2520 */ 2542, 2505, 1347, 882, 368, 2506, 777, 2508, 2509, 772, + /* 2530 */ 350, 795, 884, 2523, 774, 887, 2505, 1776, 360, 2015, + /* 2540 */ 888, 2015, 2015, 2504, 2015, 2471, 2542, 773, 2015, 774, + /* 2550 */ 378, 2506, 777, 2508, 2509, 772, 2015, 795, 2015, 2015, + /* 2560 */ 2015, 2015, 2523, 2015, 2015, 2015, 2015, 2505, 2015, 2015, + /* 2570 */ 2015, 2015, 2015, 2015, 2471, 2015, 773, 2523, 2015, 2015, + /* 2580 */ 774, 2015, 2015, 2015, 2015, 2015, 2015, 2504, 2015, 2471, + /* 2590 */ 2542, 773, 2015, 2015, 369, 2506, 777, 2508, 2509, 772, + /* 2600 */ 2015, 795, 2015, 2015, 2015, 2015, 2015, 2015, 2523, 2015, + /* 2610 */ 2015, 2015, 2015, 2015, 2015, 2015, 2504, 2015, 2015, 2542, + /* 2620 */ 2471, 2015, 773, 379, 2506, 777, 2508, 2509, 772, 2015, + /* 2630 */ 795, 2504, 2015, 2015, 2542, 2015, 2015, 2505, 370, 2506, + /* 2640 */ 777, 2508, 2509, 772, 2015, 795, 2015, 2015, 2015, 2015, + /* 2650 */ 774, 2015, 2015, 2505, 2015, 2015, 2015, 2015, 2015, 2015, + /* 2660 */ 2015, 2015, 2504, 2015, 2015, 2542, 774, 2015, 2015, 385, + /* 2670 */ 2506, 777, 2508, 2509, 772, 2015, 795, 2015, 2523, 2015, + /* 2680 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, + /* 2690 */ 2471, 2015, 773, 2015, 2523, 2015, 2015, 2015, 2015, 2015, + /* 2700 */ 2015, 2015, 2015, 2015, 2015, 2015, 2471, 2015, 773, 2015, + /* 2710 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, + /* 2720 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, + /* 2730 */ 2015, 2015, 2504, 2015, 2505, 2542, 2015, 2015, 2015, 386, + /* 2740 */ 2506, 777, 2508, 2509, 772, 2015, 795, 774, 2504, 2015, + /* 2750 */ 2015, 2542, 2015, 2015, 2015, 2517, 2506, 777, 2508, 2509, + /* 2760 */ 772, 2015, 795, 2015, 2015, 2015, 2505, 2015, 2015, 2015, + /* 2770 */ 2015, 2015, 2015, 2015, 2015, 2523, 2015, 2015, 2015, 774, + /* 2780 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2471, 2015, 773, + /* 2790 */ 2015, 2015, 2015, 2505, 2015, 2015, 2015, 2015, 2015, 2015, + /* 2800 */ 2015, 2015, 2015, 2015, 2015, 2015, 774, 2523, 2015, 2015, + /* 2810 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2471, + /* 2820 */ 2015, 773, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2504, + /* 2830 */ 2015, 2015, 2542, 2015, 2523, 2015, 2516, 2506, 777, 2508, + /* 2840 */ 2509, 772, 2015, 795, 2015, 2015, 2471, 2015, 773, 2015, + /* 2850 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, + /* 2860 */ 2015, 2504, 2015, 2505, 2542, 2015, 2015, 2015, 2515, 2506, + /* 2870 */ 777, 2508, 2509, 772, 2015, 795, 774, 2015, 2015, 2505, + /* 2880 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2504, 2015, + /* 2890 */ 2015, 2542, 774, 2015, 2505, 401, 2506, 777, 2508, 2509, + /* 2900 */ 772, 2015, 795, 2015, 2523, 2015, 2015, 774, 2015, 2505, + /* 2910 */ 2015, 2015, 2015, 2015, 2015, 2015, 2471, 2015, 773, 2015, + /* 2920 */ 2523, 2015, 774, 2015, 2015, 2015, 2015, 2015, 2015, 2015, + /* 2930 */ 2015, 2015, 2471, 2015, 773, 2523, 2015, 2015, 2505, 2015, + /* 2940 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2471, 2015, 773, + /* 2950 */ 2523, 774, 2015, 2015, 2015, 2015, 2015, 2015, 2504, 2015, + /* 2960 */ 2015, 2542, 2471, 2015, 773, 402, 2506, 777, 2508, 2509, + /* 2970 */ 772, 2015, 795, 2015, 2504, 2015, 2015, 2542, 2015, 2523, + /* 2980 */ 2015, 398, 2506, 777, 2508, 2509, 772, 2015, 795, 2504, + /* 2990 */ 2015, 2471, 2542, 773, 2015, 2015, 403, 2506, 777, 2508, + /* 3000 */ 2509, 772, 2015, 795, 775, 2015, 2015, 2542, 2015, 2015, + /* 3010 */ 2015, 376, 2506, 777, 2508, 2509, 772, 2015, 795, 2015, + /* 3020 */ 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, + /* 3030 */ 2015, 2015, 2015, 2504, 2015, 2015, 2542, 2015, 2015, 2015, + /* 3040 */ 375, 2506, 777, 2508, 2509, 772, 2015, 795, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 369, 390, 0, 400, 485, 386, 403, 488, 458, 398, @@ -1017,128 +662,128 @@ static const YYCODETYPE yy_lookahead[] = { /* 1300 */ 33, 65, 370, 410, 372, 412, 485, 22, 22, 488, /* 1310 */ 239, 13, 110, 440, 78, 113, 12, 13, 110, 42, /* 1320 */ 51, 113, 33, 109, 33, 399, 22, 506, 507, 33, - /* 1330 */ 398, 170, 511, 512, 37, 37, 33, 1, 2, 35, + /* 1330 */ 398, 170, 511, 512, 399, 37, 33, 1, 2, 35, /* 1340 */ 104, 37, 410, 107, 412, 452, 485, 357, 455, 488, - /* 1350 */ 205, 33, 459, 460, 461, 462, 463, 464, 399, 466, + /* 1350 */ 205, 33, 459, 460, 461, 462, 463, 464, 37, 466, /* 1360 */ 370, 358, 372, 33, 471, 33, 473, 506, 507, 65, - /* 1370 */ 477, 478, 511, 512, 515, 108, 423, 237, 504, 143, - /* 1380 */ 144, 497, 78, 33, 452, 33, 373, 455, 398, 33, - /* 1390 */ 33, 459, 460, 461, 462, 463, 464, 108, 466, 108, + /* 1370 */ 477, 478, 511, 512, 515, 108, 423, 237, 37, 143, + /* 1380 */ 144, 504, 78, 33, 452, 33, 497, 455, 398, 373, + /* 1390 */ 398, 459, 460, 461, 462, 463, 464, 108, 466, 108, /* 1400 */ 410, 386, 412, 471, 108, 473, 12, 13, 104, 477, - /* 1410 */ 478, 108, 398, 13, 386, 4, 423, 181, 182, 13, - /* 1420 */ 299, 33, 33, 33, 188, 189, 108, 8, 9, 33, - /* 1430 */ 19, 12, 13, 14, 15, 16, 301, 37, 108, 203, - /* 1440 */ 108, 205, 452, 37, 368, 455, 35, 423, 503, 459, - /* 1450 */ 460, 461, 462, 463, 464, 503, 466, 503, 108, 37, - /* 1460 */ 108, 471, 51, 473, 108, 108, 433, 477, 478, 58, - /* 1470 */ 59, 503, 373, 237, 238, 239, 65, 241, 242, 243, + /* 1410 */ 478, 108, 12, 13, 386, 4, 423, 181, 182, 78, + /* 1420 */ 299, 12, 13, 368, 188, 189, 108, 8, 9, 423, + /* 1430 */ 19, 12, 13, 14, 15, 16, 301, 33, 108, 203, + /* 1440 */ 108, 205, 452, 12, 13, 455, 35, 12, 13, 459, + /* 1450 */ 460, 461, 462, 463, 464, 33, 466, 503, 108, 33, + /* 1460 */ 108, 471, 51, 473, 12, 13, 503, 477, 478, 58, + /* 1470 */ 59, 12, 13, 237, 238, 239, 65, 241, 242, 243, /* 1480 */ 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - /* 1490 */ 254, 255, 256, 257, 258, 357, 108, 108, 108, 370, - /* 1500 */ 78, 423, 205, 409, 108, 441, 487, 203, 370, 205, - /* 1510 */ 372, 423, 423, 508, 479, 490, 388, 106, 278, 435, - /* 1520 */ 109, 51, 454, 42, 20, 453, 446, 108, 218, 378, - /* 1530 */ 451, 446, 378, 437, 201, 20, 398, 369, 20, 370, - /* 1540 */ 45, 237, 238, 419, 370, 419, 180, 416, 410, 370, - /* 1550 */ 412, 369, 369, 357, 105, 251, 252, 253, 254, 255, - /* 1560 */ 256, 257, 419, 416, 416, 416, 370, 382, 103, 381, - /* 1570 */ 369, 102, 380, 369, 369, 369, 20, 362, 50, 366, - /* 1580 */ 362, 378, 366, 20, 412, 446, 20, 378, 378, 20, - /* 1590 */ 452, 371, 357, 455, 398, 436, 20, 459, 460, 461, - /* 1600 */ 462, 463, 464, 378, 466, 370, 410, 378, 412, 471, - /* 1610 */ 426, 473, 12, 13, 371, 477, 478, 369, 362, 378, - /* 1620 */ 378, 398, 22, 357, 378, 398, 398, 369, 398, 398, - /* 1630 */ 398, 398, 398, 398, 360, 35, 370, 37, 360, 222, - /* 1640 */ 450, 362, 398, 398, 107, 410, 448, 412, 452, 398, - /* 1650 */ 20, 455, 376, 446, 209, 459, 460, 461, 462, 463, - /* 1660 */ 464, 208, 466, 410, 398, 65, 445, 471, 442, 473, - /* 1670 */ 410, 412, 410, 477, 478, 376, 410, 369, 412, 286, - /* 1680 */ 443, 410, 435, 496, 285, 428, 294, 452, 499, 496, - /* 1690 */ 455, 428, 194, 498, 459, 460, 461, 462, 463, 464, - /* 1700 */ 296, 466, 295, 279, 303, 493, 471, 496, 473, 300, - /* 1710 */ 435, 357, 477, 478, 495, 516, 494, 274, 452, 298, - /* 1720 */ 20, 455, 458, 370, 370, 459, 460, 461, 462, 463, - /* 1730 */ 464, 117, 466, 35, 510, 276, 371, 376, 376, 473, - /* 1740 */ 491, 489, 107, 477, 478, 428, 476, 509, 410, 51, - /* 1750 */ 410, 410, 398, 410, 428, 410, 186, 376, 60, 61, - /* 1760 */ 62, 63, 394, 65, 410, 370, 412, 376, 424, 410, - /* 1770 */ 410, 107, 402, 410, 369, 22, 38, 359, 376, 363, - /* 1780 */ 438, 447, 362, 355, 429, 377, 0, 429, 0, 392, - /* 1790 */ 392, 0, 45, 0, 37, 392, 228, 37, 37, 37, - /* 1800 */ 228, 0, 37, 203, 106, 205, 452, 109, 357, 455, - /* 1810 */ 37, 228, 37, 459, 460, 461, 462, 463, 464, 0, - /* 1820 */ 466, 370, 228, 0, 37, 0, 37, 473, 0, 22, - /* 1830 */ 0, 477, 478, 37, 223, 235, 236, 237, 0, 211, - /* 1840 */ 0, 212, 211, 203, 205, 357, 0, 0, 0, 398, - /* 1850 */ 199, 251, 252, 253, 254, 255, 256, 257, 370, 198, - /* 1860 */ 0, 410, 0, 412, 148, 49, 357, 49, 0, 37, - /* 1870 */ 0, 0, 37, 51, 176, 0, 49, 0, 45, 370, - /* 1880 */ 0, 0, 0, 185, 186, 0, 398, 0, 49, 0, - /* 1890 */ 192, 193, 0, 0, 0, 166, 37, 0, 410, 166, - /* 1900 */ 412, 0, 0, 452, 0, 0, 455, 398, 0, 211, - /* 1910 */ 459, 460, 461, 462, 463, 464, 0, 466, 0, 410, - /* 1920 */ 0, 412, 49, 0, 473, 0, 0, 0, 477, 478, - /* 1930 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 1940 */ 452, 45, 0, 455, 0, 0, 0, 459, 460, 461, - /* 1950 */ 462, 463, 464, 465, 466, 467, 468, 0, 0, 0, - /* 1960 */ 148, 452, 22, 357, 455, 0, 0, 147, 459, 460, - /* 1970 */ 461, 462, 463, 464, 0, 466, 370, 146, 0, 50, - /* 1980 */ 357, 14, 22, 22, 0, 37, 65, 0, 0, 65, - /* 1990 */ 0, 50, 0, 370, 51, 357, 42, 0, 42, 37, - /* 2000 */ 37, 51, 0, 51, 398, 37, 42, 0, 370, 37, - /* 2010 */ 501, 502, 65, 0, 45, 42, 410, 0, 412, 33, - /* 2020 */ 49, 398, 43, 0, 49, 49, 0, 42, 0, 0, - /* 2030 */ 0, 42, 49, 410, 0, 412, 398, 194, 0, 0, - /* 2040 */ 0, 37, 72, 42, 51, 0, 37, 51, 410, 0, - /* 2050 */ 412, 37, 42, 42, 51, 432, 0, 37, 452, 51, - /* 2060 */ 42, 455, 0, 0, 357, 459, 460, 461, 462, 463, - /* 2070 */ 464, 0, 466, 0, 0, 452, 0, 370, 455, 357, - /* 2080 */ 37, 22, 459, 460, 461, 462, 463, 464, 0, 466, - /* 2090 */ 452, 37, 370, 455, 37, 115, 0, 459, 460, 461, - /* 2100 */ 462, 463, 464, 37, 466, 398, 37, 113, 502, 37, - /* 2110 */ 0, 22, 37, 33, 37, 37, 33, 410, 37, 412, - /* 2120 */ 398, 37, 37, 22, 22, 0, 22, 0, 22, 37, - /* 2130 */ 0, 0, 410, 0, 412, 53, 37, 0, 0, 432, - /* 2140 */ 37, 22, 20, 108, 37, 37, 37, 0, 107, 107, - /* 2150 */ 0, 37, 514, 0, 49, 0, 22, 0, 22, 452, - /* 2160 */ 183, 210, 455, 357, 3, 183, 459, 460, 461, 462, - /* 2170 */ 463, 464, 33, 466, 452, 280, 370, 455, 357, 37, - /* 2180 */ 37, 459, 460, 461, 462, 463, 464, 108, 466, 183, - /* 2190 */ 468, 370, 33, 357, 107, 190, 50, 206, 186, 183, - /* 2200 */ 107, 50, 108, 105, 398, 183, 370, 107, 33, 357, - /* 2210 */ 33, 190, 49, 33, 103, 49, 410, 3, 412, 398, - /* 2220 */ 108, 108, 370, 107, 107, 107, 33, 37, 108, 108, - /* 2230 */ 107, 410, 108, 412, 398, 280, 37, 37, 432, 37, - /* 2240 */ 37, 37, 33, 49, 49, 0, 410, 0, 412, 108, - /* 2250 */ 398, 33, 108, 432, 42, 107, 2, 105, 452, 260, - /* 2260 */ 22, 455, 410, 105, 412, 459, 460, 461, 462, 463, - /* 2270 */ 464, 273, 466, 452, 237, 280, 455, 108, 107, 357, - /* 2280 */ 459, 460, 461, 462, 463, 464, 108, 466, 452, 49, - /* 2290 */ 107, 455, 370, 107, 22, 459, 460, 461, 462, 463, - /* 2300 */ 464, 49, 466, 107, 452, 108, 357, 455, 240, 108, - /* 2310 */ 0, 459, 460, 461, 462, 463, 464, 42, 466, 370, - /* 2320 */ 398, 108, 107, 107, 107, 49, 107, 187, 107, 107, - /* 2330 */ 185, 108, 410, 107, 412, 107, 116, 108, 357, 37, - /* 2340 */ 37, 117, 107, 37, 108, 108, 107, 398, 37, 107, - /* 2350 */ 37, 370, 108, 107, 37, 37, 108, 107, 107, 410, - /* 2360 */ 128, 412, 128, 108, 107, 33, 107, 37, 107, 128, - /* 2370 */ 22, 128, 72, 37, 452, 71, 357, 455, 37, 398, - /* 2380 */ 37, 459, 460, 461, 462, 463, 464, 37, 466, 370, - /* 2390 */ 37, 410, 37, 412, 37, 37, 37, 78, 101, 78, - /* 2400 */ 101, 452, 33, 37, 455, 37, 22, 37, 459, 460, - /* 2410 */ 461, 462, 463, 464, 22, 466, 37, 398, 37, 37, - /* 2420 */ 78, 0, 357, 37, 37, 37, 37, 37, 37, 410, - /* 2430 */ 37, 412, 0, 452, 51, 370, 455, 42, 37, 42, - /* 2440 */ 459, 460, 461, 462, 463, 464, 0, 466, 357, 51, - /* 2450 */ 37, 51, 42, 0, 37, 51, 42, 0, 0, 37, - /* 2460 */ 37, 370, 22, 398, 33, 22, 21, 517, 517, 22, - /* 2470 */ 22, 452, 21, 517, 455, 410, 20, 412, 459, 460, - /* 2480 */ 461, 462, 463, 464, 517, 466, 517, 517, 517, 398, - /* 2490 */ 517, 517, 357, 517, 517, 517, 517, 517, 517, 517, - /* 2500 */ 517, 410, 517, 412, 517, 370, 517, 517, 517, 517, - /* 2510 */ 517, 517, 517, 517, 517, 517, 517, 452, 517, 517, - /* 2520 */ 455, 357, 517, 517, 459, 460, 461, 462, 463, 464, - /* 2530 */ 517, 466, 517, 398, 370, 517, 357, 517, 517, 517, - /* 2540 */ 517, 517, 517, 452, 517, 410, 455, 412, 517, 370, + /* 1490 */ 254, 255, 256, 257, 258, 357, 12, 13, 12, 13, + /* 1500 */ 13, 12, 13, 12, 13, 33, 33, 203, 370, 205, + /* 1510 */ 372, 33, 108, 13, 503, 433, 503, 106, 423, 373, + /* 1520 */ 109, 370, 441, 409, 37, 423, 205, 108, 423, 487, + /* 1530 */ 108, 508, 479, 490, 108, 388, 398, 37, 278, 435, + /* 1540 */ 454, 237, 238, 51, 42, 453, 20, 446, 410, 218, + /* 1550 */ 412, 451, 378, 357, 446, 251, 252, 253, 254, 255, + /* 1560 */ 256, 257, 378, 201, 437, 20, 370, 369, 20, 370, + /* 1570 */ 45, 419, 419, 370, 416, 180, 369, 382, 419, 370, + /* 1580 */ 108, 108, 369, 416, 416, 416, 108, 105, 103, 369, + /* 1590 */ 452, 381, 357, 455, 398, 102, 380, 459, 460, 461, + /* 1600 */ 462, 463, 464, 369, 466, 370, 410, 369, 412, 471, + /* 1610 */ 369, 473, 12, 13, 20, 477, 478, 362, 50, 366, + /* 1620 */ 362, 378, 22, 357, 446, 366, 378, 20, 378, 412, + /* 1630 */ 20, 20, 378, 398, 371, 35, 370, 37, 20, 371, + /* 1640 */ 436, 426, 378, 378, 369, 410, 362, 412, 452, 378, + /* 1650 */ 378, 455, 410, 360, 398, 459, 460, 461, 462, 463, + /* 1660 */ 464, 369, 466, 362, 398, 65, 360, 471, 398, 473, + /* 1670 */ 222, 398, 398, 477, 478, 450, 410, 398, 412, 398, + /* 1680 */ 398, 398, 107, 446, 376, 398, 398, 452, 398, 20, + /* 1690 */ 455, 445, 448, 442, 459, 460, 461, 462, 463, 464, + /* 1700 */ 443, 466, 376, 209, 410, 410, 471, 208, 473, 412, + /* 1710 */ 410, 357, 477, 478, 369, 435, 286, 496, 452, 285, + /* 1720 */ 496, 455, 294, 194, 370, 459, 460, 461, 462, 463, + /* 1730 */ 464, 499, 466, 35, 296, 428, 295, 428, 498, 473, + /* 1740 */ 279, 496, 495, 477, 478, 435, 494, 303, 274, 51, + /* 1750 */ 300, 298, 398, 370, 20, 493, 117, 458, 60, 61, + /* 1760 */ 62, 63, 371, 65, 410, 516, 412, 107, 376, 376, + /* 1770 */ 428, 276, 428, 410, 410, 410, 410, 410, 186, 424, + /* 1780 */ 394, 376, 376, 370, 410, 410, 510, 509, 476, 410, + /* 1790 */ 410, 410, 410, 491, 489, 410, 107, 410, 410, 410, + /* 1800 */ 410, 402, 369, 203, 106, 205, 452, 109, 357, 455, + /* 1810 */ 22, 410, 410, 459, 460, 461, 462, 463, 464, 376, + /* 1820 */ 466, 370, 410, 359, 410, 410, 410, 473, 410, 38, + /* 1830 */ 410, 477, 478, 410, 410, 235, 236, 237, 363, 410, + /* 1840 */ 377, 362, 410, 447, 0, 357, 438, 392, 392, 398, + /* 1850 */ 429, 251, 252, 253, 254, 255, 256, 257, 370, 392, + /* 1860 */ 355, 410, 0, 412, 0, 429, 357, 45, 0, 37, + /* 1870 */ 228, 37, 37, 228, 176, 37, 0, 37, 37, 370, + /* 1880 */ 228, 0, 37, 185, 186, 228, 398, 0, 37, 0, + /* 1890 */ 192, 193, 37, 0, 22, 0, 37, 223, 410, 0, + /* 1900 */ 412, 211, 0, 452, 211, 205, 455, 398, 212, 211, + /* 1910 */ 459, 460, 461, 462, 463, 464, 203, 466, 0, 410, + /* 1920 */ 0, 412, 199, 198, 473, 0, 0, 0, 477, 478, + /* 1930 */ 148, 49, 49, 0, 37, 0, 0, 37, 0, 51, + /* 1940 */ 452, 49, 0, 455, 0, 0, 45, 459, 460, 461, + /* 1950 */ 462, 463, 464, 465, 466, 467, 468, 0, 49, 0, + /* 1960 */ 0, 452, 0, 357, 455, 0, 0, 0, 459, 460, + /* 1970 */ 461, 462, 463, 464, 166, 466, 370, 37, 0, 166, + /* 1980 */ 357, 49, 0, 0, 45, 0, 0, 0, 0, 0, + /* 1990 */ 0, 0, 22, 370, 0, 357, 0, 0, 0, 0, + /* 2000 */ 0, 0, 0, 0, 398, 0, 0, 0, 370, 0, + /* 2010 */ 501, 502, 0, 0, 0, 0, 410, 0, 412, 148, + /* 2020 */ 0, 398, 0, 0, 147, 0, 146, 0, 0, 50, + /* 2030 */ 22, 0, 22, 410, 50, 412, 398, 65, 0, 65, + /* 2040 */ 0, 37, 65, 0, 0, 0, 51, 0, 410, 0, + /* 2050 */ 412, 0, 0, 37, 33, 432, 0, 0, 452, 0, + /* 2060 */ 42, 455, 51, 37, 357, 459, 460, 461, 462, 463, + /* 2070 */ 464, 42, 466, 37, 42, 452, 37, 370, 455, 357, + /* 2080 */ 45, 51, 459, 460, 461, 462, 463, 464, 42, 466, + /* 2090 */ 452, 49, 370, 455, 14, 0, 43, 459, 460, 461, + /* 2100 */ 462, 463, 464, 49, 466, 398, 42, 194, 502, 42, + /* 2110 */ 49, 0, 49, 0, 0, 0, 0, 410, 37, 412, + /* 2120 */ 398, 51, 72, 0, 42, 37, 51, 42, 0, 37, + /* 2130 */ 51, 42, 410, 0, 412, 37, 42, 51, 0, 432, + /* 2140 */ 0, 0, 0, 0, 0, 37, 22, 113, 115, 0, + /* 2150 */ 53, 22, 514, 0, 37, 37, 37, 37, 37, 452, + /* 2160 */ 0, 0, 455, 357, 37, 33, 459, 460, 461, 462, + /* 2170 */ 463, 464, 33, 466, 452, 107, 370, 455, 357, 20, + /* 2180 */ 108, 459, 460, 461, 462, 463, 464, 37, 466, 37, + /* 2190 */ 468, 370, 37, 357, 37, 37, 22, 22, 0, 22, + /* 2200 */ 22, 0, 37, 0, 398, 0, 370, 37, 0, 357, + /* 2210 */ 37, 0, 22, 0, 107, 49, 410, 37, 412, 398, + /* 2220 */ 37, 37, 370, 0, 183, 37, 22, 0, 22, 0, + /* 2230 */ 206, 410, 0, 412, 398, 33, 3, 107, 432, 108, + /* 2240 */ 103, 183, 108, 183, 280, 183, 410, 210, 412, 37, + /* 2250 */ 398, 37, 186, 432, 183, 107, 105, 50, 452, 190, + /* 2260 */ 280, 455, 410, 190, 412, 459, 460, 461, 462, 463, + /* 2270 */ 464, 50, 466, 452, 107, 33, 455, 108, 33, 357, + /* 2280 */ 459, 460, 461, 462, 463, 464, 33, 466, 452, 108, + /* 2290 */ 108, 455, 370, 107, 107, 459, 460, 461, 462, 463, + /* 2300 */ 464, 107, 466, 49, 452, 49, 357, 455, 33, 3, + /* 2310 */ 33, 459, 460, 461, 462, 463, 464, 108, 466, 370, + /* 2320 */ 398, 37, 107, 37, 108, 37, 37, 37, 280, 37, + /* 2330 */ 108, 49, 410, 108, 412, 33, 49, 0, 357, 0, + /* 2340 */ 42, 107, 33, 105, 260, 105, 2, 398, 22, 273, + /* 2350 */ 107, 370, 108, 49, 108, 107, 107, 49, 108, 410, + /* 2360 */ 22, 412, 237, 108, 107, 107, 240, 108, 107, 107, + /* 2370 */ 0, 42, 187, 107, 452, 107, 357, 455, 185, 398, + /* 2380 */ 116, 459, 460, 461, 462, 463, 464, 108, 466, 370, + /* 2390 */ 49, 410, 107, 412, 37, 117, 37, 37, 107, 37, + /* 2400 */ 107, 452, 108, 108, 455, 108, 107, 107, 459, 460, + /* 2410 */ 461, 462, 463, 464, 107, 466, 37, 398, 108, 107, + /* 2420 */ 37, 108, 357, 107, 37, 108, 107, 107, 33, 410, + /* 2430 */ 107, 412, 107, 452, 37, 370, 455, 22, 72, 128, + /* 2440 */ 459, 460, 461, 462, 463, 464, 128, 466, 357, 128, + /* 2450 */ 128, 71, 78, 37, 37, 37, 37, 37, 37, 37, + /* 2460 */ 37, 370, 37, 398, 101, 101, 78, 33, 37, 37, + /* 2470 */ 37, 452, 22, 22, 455, 410, 37, 412, 459, 460, + /* 2480 */ 461, 462, 463, 464, 37, 466, 37, 0, 78, 398, + /* 2490 */ 37, 37, 357, 37, 37, 37, 37, 37, 0, 51, + /* 2500 */ 37, 410, 0, 412, 42, 370, 51, 42, 37, 42, + /* 2510 */ 0, 37, 51, 0, 42, 51, 37, 452, 37, 0, + /* 2520 */ 455, 357, 22, 33, 459, 460, 461, 462, 463, 464, + /* 2530 */ 22, 466, 21, 398, 370, 21, 357, 22, 22, 517, + /* 2540 */ 20, 517, 517, 452, 517, 410, 455, 412, 517, 370, /* 2550 */ 459, 460, 461, 462, 463, 464, 517, 466, 517, 517, /* 2560 */ 517, 517, 398, 517, 517, 517, 517, 357, 517, 517, /* 2570 */ 517, 517, 517, 517, 410, 517, 412, 398, 517, 517, @@ -1226,9 +871,9 @@ static const YYCODETYPE yy_lookahead[] = { /* 3390 */ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, /* 3400 */ 354, 354, }; -#define YY_SHIFT_COUNT (859) +#define YY_SHIFT_COUNT (889) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2458) +#define YY_SHIFT_MAX (2520) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 496, 0, 247, 0, 495, 495, 495, 495, 495, 495, /* 10 */ 495, 495, 495, 495, 495, 495, 742, 989, 989, 1236, @@ -1250,74 +895,77 @@ static const unsigned short int yy_shift_ofst[] = { /* 170 */ 213, 213, 213, 907, 285, 416, 592, 79, 340, 300, /* 180 */ 603, 578, 643, 316, 316, 799, 145, 823, 279, 279, /* 190 */ 279, 869, 443, 279, 639, 541, 1029, 143, 749, 541, - /* 200 */ 541, 1071, 951, 118, 1000, 951, 1156, 805, 317, 1240, - /* 210 */ 1470, 1481, 1504, 1310, 604, 1504, 604, 1333, 1515, 1518, - /* 220 */ 1495, 1518, 1495, 1366, 1515, 1518, 1515, 1495, 1366, 1366, - /* 230 */ 1366, 1449, 1465, 1515, 1469, 1515, 1515, 1515, 1556, 1528, - /* 240 */ 1556, 1528, 1504, 604, 604, 1563, 604, 1566, 1569, 604, - /* 250 */ 1566, 604, 1576, 604, 604, 1515, 604, 1556, 63, 63, - /* 260 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 1515, - /* 270 */ 914, 914, 1556, 700, 700, 700, 1417, 1537, 1504, 611, - /* 280 */ 1630, 1445, 1453, 1563, 611, 1240, 1515, 700, 1393, 1399, - /* 290 */ 1393, 1399, 1392, 1498, 1393, 1404, 1407, 1424, 1240, 1401, - /* 300 */ 1409, 1421, 1443, 1518, 1700, 1614, 1459, 1566, 611, 611, - /* 310 */ 1635, 1399, 700, 700, 700, 700, 1399, 700, 1570, 611, - /* 320 */ 650, 611, 1518, 700, 700, 1664, 700, 1515, 611, 1753, - /* 330 */ 1738, 1556, 3048, 3048, 3048, 3048, 3048, 3048, 3048, 3048, - /* 340 */ 3048, 36, 1698, 197, 1411, 924, 1056, 1419, 294, 640, - /* 350 */ 602, 386, 529, 540, 540, 540, 540, 540, 540, 540, - /* 360 */ 540, 540, 94, 630, 21, 778, 778, 353, 613, 634, - /* 370 */ 446, 26, 599, 739, 844, 1113, 1171, 814, 671, 948, - /* 380 */ 100, 671, 671, 671, 405, 405, 1269, 717, 401, 1277, - /* 390 */ 1239, 1161, 449, 1180, 1186, 1202, 1208, 1261, 1298, 883, - /* 400 */ 1175, 1285, 1286, 351, 505, 627, 1214, 979, 1083, 1267, - /* 410 */ 1289, 1137, 1121, 1135, 1291, 1336, 1296, 1140, 1303, 709, - /* 420 */ 1318, 1330, 1332, 1350, 1352, 1394, 1356, 1357, 1388, 1389, - /* 430 */ 1390, 1396, 903, 1145, 1297, 1400, 1406, 1422, 913, 1786, - /* 440 */ 1788, 1791, 1747, 1793, 1757, 1568, 1760, 1761, 1762, 1572, - /* 450 */ 1801, 1765, 1773, 1583, 1775, 1819, 1594, 1823, 1787, 1825, - /* 460 */ 1789, 1828, 1807, 1830, 1796, 1611, 1838, 1628, 1840, 1631, - /* 470 */ 1629, 1639, 1640, 1846, 1847, 1848, 1651, 1661, 1860, 1862, - /* 480 */ 1716, 1816, 1818, 1868, 1832, 1870, 1871, 1835, 1822, 1875, - /* 490 */ 1827, 1877, 1833, 1880, 1881, 1882, 1839, 1885, 1887, 1889, - /* 500 */ 1892, 1893, 1894, 1729, 1859, 1897, 1733, 1901, 1902, 1904, - /* 510 */ 1905, 1908, 1916, 1918, 1920, 1925, 1926, 1927, 1930, 1931, - /* 520 */ 1932, 1933, 1934, 1935, 1936, 1937, 1873, 1923, 1896, 1938, - /* 530 */ 1939, 1942, 1944, 1945, 1946, 1957, 1958, 1940, 1959, 1812, - /* 540 */ 1965, 1820, 1966, 1831, 1974, 1978, 1960, 1929, 1961, 1941, - /* 550 */ 1984, 1921, 1948, 1987, 1924, 1988, 1947, 1990, 1992, 1962, - /* 560 */ 1943, 1954, 1997, 1963, 1950, 1956, 2002, 1968, 1952, 1964, - /* 570 */ 2007, 1972, 2013, 1969, 1973, 1986, 1971, 1975, 1967, 1976, - /* 580 */ 2017, 1979, 1985, 2023, 2026, 2028, 2029, 1989, 1843, 2030, - /* 590 */ 1971, 1983, 2034, 2038, 1970, 2039, 2040, 2004, 1993, 2001, - /* 600 */ 2045, 2009, 1996, 2010, 2049, 2014, 2003, 2011, 2056, 2020, - /* 610 */ 2008, 2018, 2062, 2063, 2071, 2073, 2074, 2076, 1980, 1994, - /* 620 */ 2043, 2059, 2088, 2054, 2057, 2066, 2069, 2072, 2075, 2077, - /* 630 */ 2078, 2080, 2083, 2081, 2084, 2089, 2085, 2096, 2101, 2110, - /* 640 */ 2102, 2125, 2104, 2082, 2127, 2106, 2092, 2130, 2131, 2133, - /* 650 */ 2099, 2137, 2103, 2138, 2119, 2122, 2107, 2108, 2109, 2035, - /* 660 */ 2041, 2147, 1977, 2042, 1951, 1971, 2105, 2150, 1982, 2114, - /* 670 */ 2134, 2153, 1991, 2136, 2006, 2012, 2155, 2157, 2016, 2005, - /* 680 */ 2022, 2021, 2161, 2139, 1895, 2087, 2079, 2093, 2094, 2142, - /* 690 */ 2143, 2100, 2146, 2098, 2151, 2111, 2112, 2159, 2175, 2113, - /* 700 */ 2116, 2117, 2118, 2120, 2177, 2163, 2166, 2123, 2180, 1955, - /* 710 */ 2121, 2124, 2214, 2193, 1995, 2190, 2199, 2200, 2202, 2203, - /* 720 */ 2204, 2141, 2144, 2194, 1998, 2209, 2195, 2245, 2247, 2148, - /* 730 */ 2212, 2218, 2152, 1999, 2158, 2254, 2238, 2037, 2169, 2171, - /* 740 */ 2178, 2240, 2183, 2186, 2252, 2197, 2272, 2068, 2196, 2201, - /* 750 */ 2213, 2215, 2216, 2140, 2217, 2310, 2275, 2145, 2219, 2220, - /* 760 */ 1971, 2276, 2221, 2222, 2223, 2226, 2228, 2224, 2229, 2302, - /* 770 */ 2303, 2235, 2236, 2306, 2239, 2237, 2311, 2242, 2244, 2313, - /* 780 */ 2246, 2248, 2317, 2250, 2255, 2318, 2251, 2232, 2234, 2241, - /* 790 */ 2243, 2257, 2332, 2259, 2330, 2261, 2332, 2332, 2348, 2300, - /* 800 */ 2304, 2336, 2341, 2343, 2350, 2353, 2355, 2357, 2358, 2359, - /* 810 */ 2319, 2297, 2321, 2299, 2369, 2366, 2368, 2370, 2384, 2379, - /* 820 */ 2381, 2382, 2342, 2080, 2386, 2083, 2387, 2388, 2389, 2390, - /* 830 */ 2392, 2391, 2421, 2393, 2383, 2395, 2432, 2401, 2398, 2397, - /* 840 */ 2446, 2413, 2400, 2410, 2453, 2417, 2404, 2414, 2457, 2422, - /* 850 */ 2423, 2458, 2440, 2431, 2443, 2445, 2447, 2448, 2451, 2456, + /* 200 */ 541, 1071, 951, 118, 1000, 951, 1156, 805, 317, 1260, + /* 210 */ 1492, 1502, 1526, 1331, 604, 1526, 604, 1362, 1545, 1548, + /* 220 */ 1525, 1548, 1525, 1395, 1545, 1548, 1545, 1525, 1395, 1395, + /* 230 */ 1395, 1482, 1485, 1545, 1493, 1545, 1545, 1545, 1594, 1568, + /* 240 */ 1594, 1568, 1526, 604, 604, 1607, 604, 1610, 1611, 604, + /* 250 */ 1610, 604, 1618, 604, 604, 1545, 604, 1594, 63, 63, + /* 260 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 1545, + /* 270 */ 914, 914, 1594, 700, 700, 700, 1448, 1575, 1526, 611, + /* 280 */ 1669, 1494, 1499, 1607, 611, 1260, 1545, 700, 1430, 1434, + /* 290 */ 1430, 1434, 1428, 1529, 1430, 1438, 1441, 1461, 1260, 1444, + /* 300 */ 1450, 1453, 1474, 1548, 1734, 1639, 1495, 1610, 611, 611, + /* 310 */ 1660, 1434, 700, 700, 700, 700, 1434, 700, 1592, 611, + /* 320 */ 650, 611, 1548, 700, 700, 700, 700, 700, 700, 700, + /* 330 */ 700, 700, 700, 700, 700, 700, 700, 700, 700, 700, + /* 340 */ 700, 700, 700, 700, 700, 1689, 700, 1545, 611, 1788, + /* 350 */ 1791, 1594, 3048, 3048, 3048, 3048, 3048, 3048, 3048, 3048, + /* 360 */ 3048, 36, 1698, 197, 1411, 924, 1056, 1419, 294, 640, + /* 370 */ 602, 386, 529, 540, 540, 540, 540, 540, 540, 540, + /* 380 */ 540, 540, 94, 630, 21, 778, 778, 353, 613, 634, + /* 390 */ 446, 26, 599, 739, 844, 1113, 1171, 814, 671, 948, + /* 400 */ 100, 671, 671, 671, 405, 405, 1269, 717, 401, 1277, + /* 410 */ 1239, 1161, 449, 1180, 1186, 1202, 1208, 1261, 1298, 883, + /* 420 */ 1175, 1285, 1286, 351, 505, 627, 1214, 979, 1083, 1267, + /* 430 */ 1289, 1137, 1121, 1135, 1291, 1336, 1296, 1140, 1303, 709, + /* 440 */ 1318, 1330, 1332, 1350, 1352, 1394, 1400, 1409, 1431, 1435, + /* 450 */ 1452, 1459, 1484, 1486, 1489, 1491, 1404, 1422, 1426, 1472, + /* 460 */ 1473, 1478, 903, 1145, 1321, 1487, 1500, 1341, 913, 1844, + /* 470 */ 1862, 1864, 1822, 1868, 1832, 1642, 1834, 1835, 1838, 1645, + /* 480 */ 1876, 1840, 1841, 1652, 1845, 1881, 1657, 1887, 1851, 1889, + /* 490 */ 1855, 1893, 1872, 1895, 1859, 1674, 1899, 1690, 1902, 1693, + /* 500 */ 1696, 1700, 1713, 1918, 1920, 1925, 1723, 1725, 1926, 1927, + /* 510 */ 1782, 1882, 1883, 1933, 1897, 1935, 1936, 1900, 1888, 1938, + /* 520 */ 1892, 1942, 1901, 1944, 1945, 1957, 1909, 1959, 1960, 1962, + /* 530 */ 1965, 1966, 1967, 1808, 1940, 1978, 1813, 1994, 1996, 1997, + /* 540 */ 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, + /* 550 */ 2012, 2013, 2014, 2015, 2017, 2022, 1932, 1982, 1939, 1983, + /* 560 */ 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1970, 2023, 1871, + /* 570 */ 2020, 1877, 2025, 1880, 2027, 2028, 2008, 1979, 2010, 1984, + /* 580 */ 2031, 1972, 2004, 2038, 1974, 2040, 1977, 2043, 2044, 2016, + /* 590 */ 1995, 2018, 2045, 2026, 2011, 2029, 2047, 2036, 2030, 2032, + /* 600 */ 2049, 2039, 2051, 2035, 2046, 2021, 2042, 2054, 2080, 2061, + /* 610 */ 2052, 2053, 2064, 2056, 2057, 2059, 2095, 2067, 1913, 2111, + /* 620 */ 2042, 2063, 2113, 2114, 2050, 2115, 2116, 2081, 2070, 2082, + /* 630 */ 2123, 2088, 2075, 2085, 2128, 2092, 2079, 2089, 2133, 2098, + /* 640 */ 2086, 2094, 2138, 2140, 2141, 2142, 2143, 2144, 2033, 2034, + /* 650 */ 2108, 2124, 2149, 2117, 2118, 2119, 2120, 2121, 2127, 2150, + /* 660 */ 2155, 2132, 2139, 2157, 2158, 2129, 2152, 2153, 2174, 2160, + /* 670 */ 2175, 2161, 2177, 2097, 2198, 2178, 2165, 2201, 2203, 2205, + /* 680 */ 2170, 2208, 2173, 2211, 2190, 2159, 2180, 2183, 2184, 2072, + /* 690 */ 2068, 2213, 2041, 2107, 2037, 2042, 2166, 2223, 2058, 2188, + /* 700 */ 2204, 2227, 2024, 2206, 2060, 2066, 2229, 2232, 2062, 2069, + /* 710 */ 2071, 2073, 2233, 2202, 1964, 2130, 2131, 2148, 2134, 2212, + /* 720 */ 2214, 2167, 2207, 2151, 2221, 2137, 2169, 2242, 2245, 2181, + /* 730 */ 2186, 2187, 2194, 2182, 2253, 2254, 2256, 2215, 2275, 1980, + /* 740 */ 2209, 2216, 2306, 2277, 2048, 2284, 2286, 2288, 2289, 2290, + /* 750 */ 2292, 2222, 2225, 2282, 2076, 2302, 2287, 2337, 2339, 2234, + /* 760 */ 2298, 2309, 2238, 2084, 2240, 2344, 2326, 2125, 2244, 2243, + /* 770 */ 2246, 2304, 2248, 2249, 2308, 2250, 2338, 2126, 2257, 2255, + /* 780 */ 2259, 2258, 2261, 2185, 2262, 2370, 2329, 2193, 2266, 2264, + /* 790 */ 2042, 2341, 2268, 2285, 2279, 2291, 2293, 2278, 2294, 2357, + /* 800 */ 2359, 2299, 2295, 2360, 2300, 2297, 2362, 2307, 2310, 2379, + /* 810 */ 2312, 2313, 2383, 2316, 2317, 2387, 2319, 2311, 2318, 2321, + /* 820 */ 2322, 2320, 2395, 2323, 2397, 2325, 2395, 2395, 2415, 2366, + /* 830 */ 2380, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2425, + /* 840 */ 2374, 2363, 2388, 2364, 2434, 2431, 2432, 2433, 2450, 2439, + /* 850 */ 2447, 2449, 2410, 2132, 2453, 2139, 2454, 2456, 2457, 2458, + /* 860 */ 2451, 2459, 2487, 2460, 2448, 2462, 2498, 2463, 2455, 2465, + /* 870 */ 2502, 2471, 2461, 2467, 2510, 2474, 2464, 2472, 2513, 2479, + /* 880 */ 2481, 2519, 2500, 2490, 2508, 2511, 2515, 2516, 2514, 2520, }; -#define YY_REDUCE_COUNT (340) +#define YY_REDUCE_COUNT (360) #define YY_REDUCE_MIN (-481) #define YY_REDUCE_MAX (2581) static const short yy_reduce_ofst[] = { @@ -1338,112 +986,117 @@ static const short yy_reduce_ofst[] = { /* 140 */ 425, 9, 222, 676, 690, -450, -435, 469, 225, 325, /* 150 */ -115, 466, 696, 706, -129, 744, 782, 754, 420, 698, /* 160 */ 783, 850, 852, 876, 813, 477, 577, 699, 731, 895, - /* 170 */ 926, 959, 895, 873, 905, 1003, 953, 859, 874, 884, - /* 180 */ 1013, 1014, 1014, 1015, 1028, 993, 1076, 1024, 945, 952, - /* 190 */ 954, 1033, 1014, 968, 1099, 1078, 1129, 1094, 1064, 1088, - /* 200 */ 1089, 1014, 1019, 1019, 1005, 1019, 1035, 1025, 1128, 1084, - /* 210 */ 1068, 1072, 1080, 1079, 1151, 1085, 1154, 1096, 1168, 1169, - /* 220 */ 1124, 1174, 1126, 1131, 1182, 1179, 1183, 1143, 1147, 1148, - /* 230 */ 1149, 1185, 1188, 1201, 1192, 1204, 1205, 1206, 1215, 1213, - /* 240 */ 1218, 1216, 1139, 1203, 1209, 1172, 1210, 1220, 1159, 1225, - /* 250 */ 1243, 1229, 1184, 1241, 1242, 1248, 1246, 1256, 1223, 1227, - /* 260 */ 1228, 1230, 1231, 1232, 1233, 1234, 1244, 1245, 1251, 1258, - /* 270 */ 1274, 1278, 1279, 1253, 1260, 1262, 1190, 1198, 1207, 1276, - /* 280 */ 1221, 1237, 1226, 1259, 1299, 1247, 1308, 1271, 1187, 1257, - /* 290 */ 1193, 1263, 1189, 1195, 1211, 1219, 1222, 1212, 1275, 1199, - /* 300 */ 1224, 1238, 1019, 1353, 1264, 1249, 1252, 1365, 1361, 1362, - /* 310 */ 1270, 1317, 1338, 1340, 1341, 1343, 1326, 1345, 1344, 1381, - /* 320 */ 1368, 1391, 1395, 1359, 1360, 1370, 1363, 1405, 1402, 1418, - /* 330 */ 1416, 1420, 1342, 1334, 1355, 1358, 1397, 1398, 1403, 1408, - /* 340 */ 1428, + /* 170 */ 926, 935, 895, 873, 905, 1003, 953, 859, 877, 889, + /* 180 */ 1016, 992, 992, 1015, 1028, 993, 1055, 1006, 954, 963, + /* 190 */ 1011, 1082, 992, 1013, 1146, 1095, 1151, 1114, 1081, 1102, + /* 200 */ 1105, 992, 1042, 1042, 1023, 1042, 1053, 1043, 1147, 1104, + /* 210 */ 1086, 1092, 1101, 1100, 1174, 1108, 1184, 1127, 1198, 1199, + /* 220 */ 1152, 1203, 1153, 1158, 1207, 1209, 1213, 1159, 1167, 1168, + /* 230 */ 1169, 1195, 1210, 1220, 1216, 1234, 1238, 1241, 1255, 1253, + /* 240 */ 1258, 1259, 1178, 1243, 1248, 1217, 1250, 1263, 1204, 1254, + /* 250 */ 1268, 1264, 1215, 1265, 1271, 1275, 1272, 1284, 1256, 1270, + /* 260 */ 1273, 1274, 1279, 1281, 1282, 1283, 1287, 1288, 1290, 1292, + /* 270 */ 1293, 1306, 1301, 1242, 1294, 1295, 1225, 1244, 1237, 1308, + /* 280 */ 1246, 1257, 1251, 1297, 1326, 1280, 1345, 1300, 1221, 1307, + /* 290 */ 1224, 1309, 1232, 1240, 1245, 1247, 1252, 1262, 1310, 1249, + /* 300 */ 1276, 1278, 1042, 1383, 1299, 1302, 1305, 1391, 1392, 1393, + /* 310 */ 1312, 1342, 1363, 1364, 1365, 1366, 1344, 1367, 1355, 1405, + /* 320 */ 1386, 1406, 1413, 1374, 1375, 1379, 1380, 1381, 1382, 1385, + /* 330 */ 1387, 1388, 1389, 1390, 1401, 1402, 1412, 1414, 1415, 1416, + /* 340 */ 1418, 1420, 1423, 1424, 1429, 1399, 1432, 1433, 1443, 1464, + /* 350 */ 1475, 1479, 1408, 1396, 1421, 1436, 1455, 1456, 1467, 1463, + /* 360 */ 1505, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 10 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 20 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 30 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 40 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 50 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 60 */ 2294, 1953, 1953, 2257, 1953, 1953, 1953, 1953, 1953, 1953, - /* 70 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 2264, 1953, 1953, - /* 80 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 90 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 2052, 1953, 1953, - /* 100 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 110 */ 1953, 1953, 1953, 1953, 2050, 2518, 1953, 1953, 1953, 1953, - /* 120 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 130 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 2530, - /* 140 */ 1953, 1953, 2024, 2024, 1953, 2530, 2530, 2530, 2490, 2490, - /* 150 */ 2050, 1953, 1953, 2052, 2332, 1953, 1953, 1953, 1953, 1953, - /* 160 */ 1953, 1953, 1953, 2175, 1983, 1953, 1953, 1953, 1953, 2199, - /* 170 */ 1953, 1953, 1953, 2320, 1953, 1953, 2559, 2621, 1953, 2562, - /* 180 */ 1953, 1953, 1953, 1953, 1953, 2269, 1953, 2549, 1953, 1953, - /* 190 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 2128, 2314, 1953, - /* 200 */ 1953, 1953, 2522, 2536, 2605, 2523, 2520, 2543, 1953, 2553, - /* 210 */ 1953, 2357, 1953, 2346, 2052, 1953, 2052, 2307, 2252, 1953, - /* 220 */ 2262, 1953, 2262, 2259, 1953, 1953, 1953, 2262, 2259, 2259, - /* 230 */ 2259, 2117, 2113, 1953, 2111, 1953, 1953, 1953, 1953, 2008, - /* 240 */ 1953, 2008, 1953, 2052, 2052, 1953, 2052, 1953, 1953, 2052, - /* 250 */ 1953, 2052, 1953, 2052, 2052, 1953, 2052, 1953, 1953, 1953, - /* 260 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 270 */ 1953, 1953, 1953, 1953, 1953, 1953, 2344, 2330, 1953, 2050, - /* 280 */ 1953, 2318, 2316, 1953, 2050, 2553, 1953, 1953, 2575, 2570, - /* 290 */ 2575, 2570, 2589, 2585, 2575, 2594, 2591, 2555, 2553, 2624, - /* 300 */ 2611, 2607, 2536, 1953, 1953, 2541, 2539, 1953, 2050, 2050, - /* 310 */ 1953, 2570, 1953, 1953, 1953, 1953, 2570, 1953, 1953, 2050, - /* 320 */ 1953, 2050, 1953, 1953, 1953, 2144, 1953, 1953, 2050, 1953, - /* 330 */ 1992, 1953, 2309, 2335, 2290, 2290, 2178, 2178, 2178, 2053, - /* 340 */ 1958, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 350 */ 1953, 1953, 1953, 2588, 2587, 2442, 1953, 2494, 2493, 2492, - /* 360 */ 2483, 2441, 2140, 1953, 1953, 2440, 2439, 1953, 1953, 1953, - /* 370 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 2433, 1953, - /* 380 */ 1953, 2434, 2432, 2431, 2281, 2280, 1953, 1953, 1953, 1953, - /* 390 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 400 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 410 */ 1953, 1953, 2608, 2612, 1953, 2519, 1953, 1953, 1953, 2413, - /* 420 */ 1953, 1953, 1953, 1953, 1953, 2381, 1953, 1953, 1953, 1953, - /* 430 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 440 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 450 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 460 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 470 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 480 */ 2258, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 490 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 500 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 510 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 520 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 530 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 540 */ 1953, 1953, 1953, 2273, 1953, 1953, 1953, 1953, 1953, 1953, - /* 550 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 560 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 570 */ 1953, 1953, 1953, 1953, 1953, 1997, 2420, 1953, 1953, 1953, - /* 580 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 590 */ 2423, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 600 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 610 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 620 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 630 */ 1953, 2092, 2091, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 640 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 650 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 2424, - /* 660 */ 1953, 1953, 1953, 1953, 1953, 2415, 1953, 1953, 1953, 1953, - /* 670 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 680 */ 1953, 1953, 2604, 2556, 1953, 1953, 1953, 1953, 1953, 1953, - /* 690 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 700 */ 1953, 1953, 1953, 1953, 1953, 1953, 2413, 1953, 2586, 1953, - /* 710 */ 1953, 2602, 1953, 2606, 1953, 1953, 1953, 1953, 1953, 1953, - /* 720 */ 1953, 2529, 2525, 1953, 1953, 2521, 1953, 1953, 1953, 1953, - /* 730 */ 1953, 2480, 1953, 1953, 1953, 2514, 1953, 1953, 1953, 1953, - /* 740 */ 1953, 1953, 1953, 1953, 1953, 2424, 1953, 2427, 1953, 1953, - /* 750 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 760 */ 2412, 1953, 2465, 2464, 1953, 1953, 1953, 1953, 1953, 1953, - /* 770 */ 1953, 2172, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 780 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 2156, 2154, 2153, - /* 790 */ 2152, 1953, 2185, 1953, 1953, 1953, 2181, 2180, 1953, 1953, - /* 800 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 810 */ 1953, 1953, 1953, 1953, 2071, 1953, 1953, 1953, 1953, 1953, - /* 820 */ 1953, 1953, 1953, 2063, 1953, 2062, 1953, 1953, 1953, 1953, - /* 830 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 840 */ 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, 1953, - /* 850 */ 1953, 1953, 1953, 1982, 1953, 1953, 1953, 1953, 1953, 1953, + /* 0 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 10 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 20 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 30 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 40 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 50 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 60 */ 2354, 2013, 2013, 2317, 2013, 2013, 2013, 2013, 2013, 2013, + /* 70 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2324, 2013, 2013, + /* 80 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 90 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2112, 2013, 2013, + /* 100 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 110 */ 2013, 2013, 2013, 2013, 2110, 2598, 2013, 2013, 2013, 2013, + /* 120 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 130 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2610, + /* 140 */ 2013, 2013, 2084, 2084, 2013, 2610, 2610, 2610, 2570, 2570, + /* 150 */ 2110, 2013, 2013, 2112, 2392, 2013, 2013, 2013, 2013, 2013, + /* 160 */ 2013, 2013, 2013, 2235, 2043, 2013, 2013, 2013, 2013, 2259, + /* 170 */ 2013, 2013, 2013, 2380, 2013, 2013, 2639, 2701, 2013, 2642, + /* 180 */ 2013, 2013, 2013, 2013, 2013, 2329, 2013, 2629, 2013, 2013, + /* 190 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2188, 2374, 2013, + /* 200 */ 2013, 2013, 2602, 2616, 2685, 2603, 2600, 2623, 2013, 2633, + /* 210 */ 2013, 2417, 2013, 2406, 2112, 2013, 2112, 2367, 2312, 2013, + /* 220 */ 2322, 2013, 2322, 2319, 2013, 2013, 2013, 2322, 2319, 2319, + /* 230 */ 2319, 2177, 2173, 2013, 2171, 2013, 2013, 2013, 2013, 2068, + /* 240 */ 2013, 2068, 2013, 2112, 2112, 2013, 2112, 2013, 2013, 2112, + /* 250 */ 2013, 2112, 2013, 2112, 2112, 2013, 2112, 2013, 2013, 2013, + /* 260 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 270 */ 2013, 2013, 2013, 2013, 2013, 2013, 2404, 2390, 2013, 2110, + /* 280 */ 2013, 2378, 2376, 2013, 2110, 2633, 2013, 2013, 2655, 2650, + /* 290 */ 2655, 2650, 2669, 2665, 2655, 2674, 2671, 2635, 2633, 2704, + /* 300 */ 2691, 2687, 2616, 2013, 2013, 2621, 2619, 2013, 2110, 2110, + /* 310 */ 2013, 2650, 2013, 2013, 2013, 2013, 2650, 2013, 2013, 2110, + /* 320 */ 2013, 2110, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 330 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 340 */ 2013, 2013, 2013, 2013, 2013, 2204, 2013, 2013, 2110, 2013, + /* 350 */ 2052, 2013, 2369, 2395, 2350, 2350, 2238, 2238, 2238, 2113, + /* 360 */ 2018, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 370 */ 2013, 2013, 2013, 2668, 2667, 2522, 2013, 2574, 2573, 2572, + /* 380 */ 2563, 2521, 2200, 2013, 2013, 2520, 2519, 2013, 2013, 2013, + /* 390 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2513, 2013, + /* 400 */ 2013, 2514, 2512, 2511, 2341, 2340, 2013, 2013, 2013, 2013, + /* 410 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 420 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 430 */ 2013, 2013, 2688, 2692, 2013, 2599, 2013, 2013, 2013, 2493, + /* 440 */ 2013, 2013, 2013, 2013, 2013, 2461, 2456, 2447, 2438, 2453, + /* 450 */ 2444, 2432, 2450, 2441, 2429, 2426, 2013, 2013, 2013, 2013, + /* 460 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 470 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 480 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 490 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 500 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 510 */ 2318, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 520 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 530 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 540 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 550 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 560 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 570 */ 2013, 2013, 2013, 2333, 2013, 2013, 2013, 2013, 2013, 2013, + /* 580 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 590 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 600 */ 2013, 2013, 2013, 2013, 2013, 2057, 2500, 2013, 2013, 2013, + /* 610 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 620 */ 2503, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 630 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 640 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 650 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 660 */ 2013, 2152, 2151, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 670 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 680 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2504, + /* 690 */ 2013, 2013, 2013, 2013, 2013, 2495, 2013, 2013, 2013, 2013, + /* 700 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 710 */ 2013, 2013, 2684, 2636, 2013, 2013, 2013, 2013, 2013, 2013, + /* 720 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 730 */ 2013, 2013, 2013, 2013, 2013, 2013, 2493, 2013, 2666, 2013, + /* 740 */ 2013, 2682, 2013, 2686, 2013, 2013, 2013, 2013, 2013, 2013, + /* 750 */ 2013, 2609, 2605, 2013, 2013, 2601, 2013, 2013, 2013, 2013, + /* 760 */ 2013, 2560, 2013, 2013, 2013, 2594, 2013, 2013, 2013, 2013, + /* 770 */ 2013, 2013, 2013, 2013, 2013, 2504, 2013, 2507, 2013, 2013, + /* 780 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 790 */ 2492, 2013, 2545, 2544, 2013, 2013, 2013, 2013, 2013, 2013, + /* 800 */ 2013, 2232, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 810 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2216, 2214, 2213, + /* 820 */ 2212, 2013, 2245, 2013, 2013, 2013, 2241, 2240, 2013, 2013, + /* 830 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 840 */ 2013, 2013, 2013, 2013, 2131, 2013, 2013, 2013, 2013, 2013, + /* 850 */ 2013, 2013, 2013, 2123, 2013, 2122, 2013, 2013, 2013, 2013, + /* 860 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 870 */ 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, + /* 880 */ 2013, 2013, 2013, 2042, 2013, 2013, 2013, 2013, 2013, 2013, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1868,7 +1521,6 @@ struct yyParser { }; typedef struct yyParser yyParser; -#include #ifndef NDEBUG #include static FILE *yyTraceFILE = 0; @@ -2840,266 +2492,286 @@ static const char *const yyRuleName[] = { /* 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 */ "tags_literal ::= NK_INTEGER", - /* 411 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 412 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 413 */ "tags_literal ::= NK_FLOAT", - /* 414 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 415 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 416 */ "tags_literal ::= NK_BIN", - /* 417 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 418 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 419 */ "tags_literal ::= NK_HEX", - /* 420 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 421 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 422 */ "tags_literal ::= NK_STRING", - /* 423 */ "tags_literal ::= NK_BOOL", - /* 424 */ "tags_literal ::= NULL", - /* 425 */ "tags_literal ::= literal_func", - /* 426 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 427 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 428 */ "tags_literal_list ::= tags_literal", - /* 429 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 430 */ "literal ::= NK_INTEGER", - /* 431 */ "literal ::= NK_FLOAT", - /* 432 */ "literal ::= NK_STRING", - /* 433 */ "literal ::= NK_BOOL", - /* 434 */ "literal ::= TIMESTAMP NK_STRING", - /* 435 */ "literal ::= duration_literal", - /* 436 */ "literal ::= NULL", - /* 437 */ "literal ::= NK_QUESTION", - /* 438 */ "duration_literal ::= NK_VARIABLE", - /* 439 */ "signed ::= NK_INTEGER", - /* 440 */ "signed ::= NK_PLUS NK_INTEGER", - /* 441 */ "signed ::= NK_MINUS NK_INTEGER", - /* 442 */ "signed ::= NK_FLOAT", - /* 443 */ "signed ::= NK_PLUS NK_FLOAT", - /* 444 */ "signed ::= NK_MINUS NK_FLOAT", - /* 445 */ "signed_literal ::= signed", - /* 446 */ "signed_literal ::= NK_STRING", - /* 447 */ "signed_literal ::= NK_BOOL", - /* 448 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 449 */ "signed_literal ::= duration_literal", - /* 450 */ "signed_literal ::= NULL", - /* 451 */ "signed_literal ::= literal_func", - /* 452 */ "signed_literal ::= NK_QUESTION", - /* 453 */ "literal_list ::= signed_literal", - /* 454 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 455 */ "db_name ::= NK_ID", - /* 456 */ "table_name ::= NK_ID", - /* 457 */ "column_name ::= NK_ID", - /* 458 */ "function_name ::= NK_ID", - /* 459 */ "view_name ::= NK_ID", - /* 460 */ "table_alias ::= NK_ID", - /* 461 */ "column_alias ::= NK_ID", - /* 462 */ "column_alias ::= NK_ALIAS", - /* 463 */ "user_name ::= NK_ID", - /* 464 */ "topic_name ::= NK_ID", - /* 465 */ "stream_name ::= NK_ID", - /* 466 */ "cgroup_name ::= NK_ID", - /* 467 */ "index_name ::= NK_ID", - /* 468 */ "expr_or_subquery ::= expression", - /* 469 */ "expression ::= literal", - /* 470 */ "expression ::= pseudo_column", - /* 471 */ "expression ::= column_reference", - /* 472 */ "expression ::= function_expression", - /* 473 */ "expression ::= case_when_expression", - /* 474 */ "expression ::= NK_LP expression NK_RP", - /* 475 */ "expression ::= NK_PLUS expr_or_subquery", - /* 476 */ "expression ::= NK_MINUS expr_or_subquery", - /* 477 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 478 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 479 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 480 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 481 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 482 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 483 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 484 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 485 */ "expression_list ::= expr_or_subquery", - /* 486 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 487 */ "column_reference ::= column_name", - /* 488 */ "column_reference ::= table_name NK_DOT column_name", - /* 489 */ "column_reference ::= NK_ALIAS", - /* 490 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 491 */ "pseudo_column ::= ROWTS", - /* 492 */ "pseudo_column ::= TBNAME", - /* 493 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 494 */ "pseudo_column ::= QSTART", - /* 495 */ "pseudo_column ::= QEND", - /* 496 */ "pseudo_column ::= QDURATION", - /* 497 */ "pseudo_column ::= WSTART", - /* 498 */ "pseudo_column ::= WEND", - /* 499 */ "pseudo_column ::= WDURATION", - /* 500 */ "pseudo_column ::= IROWTS", - /* 501 */ "pseudo_column ::= ISFILLED", - /* 502 */ "pseudo_column ::= QTAGS", - /* 503 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 504 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 505 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 506 */ "function_expression ::= literal_func", - /* 507 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 508 */ "literal_func ::= NOW", - /* 509 */ "literal_func ::= TODAY", - /* 510 */ "noarg_func ::= NOW", - /* 511 */ "noarg_func ::= TODAY", - /* 512 */ "noarg_func ::= TIMEZONE", - /* 513 */ "noarg_func ::= DATABASE", - /* 514 */ "noarg_func ::= CLIENT_VERSION", - /* 515 */ "noarg_func ::= SERVER_VERSION", - /* 516 */ "noarg_func ::= SERVER_STATUS", - /* 517 */ "noarg_func ::= CURRENT_USER", - /* 518 */ "noarg_func ::= USER", - /* 519 */ "star_func ::= COUNT", - /* 520 */ "star_func ::= FIRST", - /* 521 */ "star_func ::= LAST", - /* 522 */ "star_func ::= LAST_ROW", - /* 523 */ "star_func_para_list ::= NK_STAR", - /* 524 */ "star_func_para_list ::= other_para_list", - /* 525 */ "other_para_list ::= star_func_para", - /* 526 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 527 */ "star_func_para ::= expr_or_subquery", - /* 528 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 529 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 530 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 531 */ "when_then_list ::= when_then_expr", - /* 532 */ "when_then_list ::= when_then_list when_then_expr", - /* 533 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 534 */ "case_when_else_opt ::=", - /* 535 */ "case_when_else_opt ::= ELSE common_expression", - /* 536 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 537 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 538 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 539 */ "predicate ::= expr_or_subquery IS NULL", - /* 540 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 541 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 542 */ "compare_op ::= NK_LT", - /* 543 */ "compare_op ::= NK_GT", - /* 544 */ "compare_op ::= NK_LE", - /* 545 */ "compare_op ::= NK_GE", - /* 546 */ "compare_op ::= NK_NE", - /* 547 */ "compare_op ::= NK_EQ", - /* 548 */ "compare_op ::= LIKE", - /* 549 */ "compare_op ::= NOT LIKE", - /* 550 */ "compare_op ::= MATCH", - /* 551 */ "compare_op ::= NMATCH", - /* 552 */ "compare_op ::= CONTAINS", - /* 553 */ "in_op ::= IN", - /* 554 */ "in_op ::= NOT IN", - /* 555 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 556 */ "boolean_value_expression ::= boolean_primary", - /* 557 */ "boolean_value_expression ::= NOT boolean_primary", - /* 558 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 559 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 560 */ "boolean_primary ::= predicate", - /* 561 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 562 */ "common_expression ::= expr_or_subquery", - /* 563 */ "common_expression ::= boolean_value_expression", - /* 564 */ "from_clause_opt ::=", - /* 565 */ "from_clause_opt ::= FROM table_reference_list", - /* 566 */ "table_reference_list ::= table_reference", - /* 567 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 568 */ "table_reference ::= table_primary", - /* 569 */ "table_reference ::= joined_table", - /* 570 */ "table_primary ::= table_name alias_opt", - /* 571 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 572 */ "table_primary ::= subquery alias_opt", - /* 573 */ "table_primary ::= parenthesized_joined_table", - /* 574 */ "alias_opt ::=", - /* 575 */ "alias_opt ::= table_alias", - /* 576 */ "alias_opt ::= AS table_alias", - /* 577 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 578 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 579 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 580 */ "join_type ::=", - /* 581 */ "join_type ::= INNER", - /* 582 */ "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", - /* 583 */ "hint_list ::=", - /* 584 */ "hint_list ::= NK_HINT", - /* 585 */ "tag_mode_opt ::=", - /* 586 */ "tag_mode_opt ::= TAGS", - /* 587 */ "set_quantifier_opt ::=", - /* 588 */ "set_quantifier_opt ::= DISTINCT", - /* 589 */ "set_quantifier_opt ::= ALL", - /* 590 */ "select_list ::= select_item", - /* 591 */ "select_list ::= select_list NK_COMMA select_item", - /* 592 */ "select_item ::= NK_STAR", - /* 593 */ "select_item ::= common_expression", - /* 594 */ "select_item ::= common_expression column_alias", - /* 595 */ "select_item ::= common_expression AS column_alias", - /* 596 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 597 */ "where_clause_opt ::=", - /* 598 */ "where_clause_opt ::= WHERE search_condition", - /* 599 */ "partition_by_clause_opt ::=", - /* 600 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 601 */ "partition_list ::= partition_item", - /* 602 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 603 */ "partition_item ::= expr_or_subquery", - /* 604 */ "partition_item ::= expr_or_subquery column_alias", - /* 605 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 606 */ "twindow_clause_opt ::=", - /* 607 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 608 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 609 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 610 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 611 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 612 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 613 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 614 */ "sliding_opt ::=", - /* 615 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 616 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 617 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 618 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 619 */ "fill_opt ::=", - /* 620 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 621 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 622 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 623 */ "fill_mode ::= NONE", - /* 624 */ "fill_mode ::= PREV", - /* 625 */ "fill_mode ::= NULL", - /* 626 */ "fill_mode ::= NULL_F", - /* 627 */ "fill_mode ::= LINEAR", - /* 628 */ "fill_mode ::= NEXT", - /* 629 */ "group_by_clause_opt ::=", - /* 630 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 631 */ "group_by_list ::= expr_or_subquery", - /* 632 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 633 */ "having_clause_opt ::=", - /* 634 */ "having_clause_opt ::= HAVING search_condition", - /* 635 */ "range_opt ::=", - /* 636 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 637 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 638 */ "every_opt ::=", - /* 639 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 640 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 641 */ "query_simple ::= query_specification", - /* 642 */ "query_simple ::= union_query_expression", - /* 643 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 644 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 645 */ "query_simple_or_subquery ::= query_simple", - /* 646 */ "query_simple_or_subquery ::= subquery", - /* 647 */ "query_or_subquery ::= query_expression", - /* 648 */ "query_or_subquery ::= subquery", - /* 649 */ "order_by_clause_opt ::=", - /* 650 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 651 */ "slimit_clause_opt ::=", - /* 652 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 653 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 654 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 655 */ "limit_clause_opt ::=", - /* 656 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 657 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 658 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 659 */ "subquery ::= NK_LP query_expression NK_RP", - /* 660 */ "subquery ::= NK_LP subquery NK_RP", - /* 661 */ "search_condition ::= common_expression", - /* 662 */ "sort_specification_list ::= sort_specification", - /* 663 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 664 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 665 */ "ordering_specification_opt ::=", - /* 666 */ "ordering_specification_opt ::= ASC", - /* 667 */ "ordering_specification_opt ::= DESC", - /* 668 */ "null_ordering_opt ::=", - /* 669 */ "null_ordering_opt ::= NULLS FIRST", - /* 670 */ "null_ordering_opt ::= NULLS LAST", + /* 411 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 412 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 413 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 414 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 415 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 416 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 417 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 418 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 419 */ "tags_literal ::= NK_FLOAT", + /* 420 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 421 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 422 */ "tags_literal ::= NK_BIN", + /* 423 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 424 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 425 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 426 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 427 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 428 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 429 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 430 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 431 */ "tags_literal ::= NK_HEX", + /* 432 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 433 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 434 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 435 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 436 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 437 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 438 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 439 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 440 */ "tags_literal ::= NK_STRING", + /* 441 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 442 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 443 */ "tags_literal ::= NK_BOOL", + /* 444 */ "tags_literal ::= NULL", + /* 445 */ "tags_literal ::= literal_func", + /* 446 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 447 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 448 */ "tags_literal_list ::= tags_literal", + /* 449 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 450 */ "literal ::= NK_INTEGER", + /* 451 */ "literal ::= NK_FLOAT", + /* 452 */ "literal ::= NK_STRING", + /* 453 */ "literal ::= NK_BOOL", + /* 454 */ "literal ::= TIMESTAMP NK_STRING", + /* 455 */ "literal ::= duration_literal", + /* 456 */ "literal ::= NULL", + /* 457 */ "literal ::= NK_QUESTION", + /* 458 */ "duration_literal ::= NK_VARIABLE", + /* 459 */ "signed ::= NK_INTEGER", + /* 460 */ "signed ::= NK_PLUS NK_INTEGER", + /* 461 */ "signed ::= NK_MINUS NK_INTEGER", + /* 462 */ "signed ::= NK_FLOAT", + /* 463 */ "signed ::= NK_PLUS NK_FLOAT", + /* 464 */ "signed ::= NK_MINUS NK_FLOAT", + /* 465 */ "signed_literal ::= signed", + /* 466 */ "signed_literal ::= NK_STRING", + /* 467 */ "signed_literal ::= NK_BOOL", + /* 468 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 469 */ "signed_literal ::= duration_literal", + /* 470 */ "signed_literal ::= NULL", + /* 471 */ "signed_literal ::= literal_func", + /* 472 */ "signed_literal ::= NK_QUESTION", + /* 473 */ "literal_list ::= signed_literal", + /* 474 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 475 */ "db_name ::= NK_ID", + /* 476 */ "table_name ::= NK_ID", + /* 477 */ "column_name ::= NK_ID", + /* 478 */ "function_name ::= NK_ID", + /* 479 */ "view_name ::= NK_ID", + /* 480 */ "table_alias ::= NK_ID", + /* 481 */ "column_alias ::= NK_ID", + /* 482 */ "column_alias ::= NK_ALIAS", + /* 483 */ "user_name ::= NK_ID", + /* 484 */ "topic_name ::= NK_ID", + /* 485 */ "stream_name ::= NK_ID", + /* 486 */ "cgroup_name ::= NK_ID", + /* 487 */ "index_name ::= NK_ID", + /* 488 */ "expr_or_subquery ::= expression", + /* 489 */ "expression ::= literal", + /* 490 */ "expression ::= pseudo_column", + /* 491 */ "expression ::= column_reference", + /* 492 */ "expression ::= function_expression", + /* 493 */ "expression ::= case_when_expression", + /* 494 */ "expression ::= NK_LP expression NK_RP", + /* 495 */ "expression ::= NK_PLUS expr_or_subquery", + /* 496 */ "expression ::= NK_MINUS expr_or_subquery", + /* 497 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 498 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 499 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 500 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 501 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 502 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 503 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 504 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 505 */ "expression_list ::= expr_or_subquery", + /* 506 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 507 */ "column_reference ::= column_name", + /* 508 */ "column_reference ::= table_name NK_DOT column_name", + /* 509 */ "column_reference ::= NK_ALIAS", + /* 510 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 511 */ "pseudo_column ::= ROWTS", + /* 512 */ "pseudo_column ::= TBNAME", + /* 513 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 514 */ "pseudo_column ::= QSTART", + /* 515 */ "pseudo_column ::= QEND", + /* 516 */ "pseudo_column ::= QDURATION", + /* 517 */ "pseudo_column ::= WSTART", + /* 518 */ "pseudo_column ::= WEND", + /* 519 */ "pseudo_column ::= WDURATION", + /* 520 */ "pseudo_column ::= IROWTS", + /* 521 */ "pseudo_column ::= ISFILLED", + /* 522 */ "pseudo_column ::= QTAGS", + /* 523 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 524 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 525 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 526 */ "function_expression ::= literal_func", + /* 527 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 528 */ "literal_func ::= NOW", + /* 529 */ "literal_func ::= TODAY", + /* 530 */ "noarg_func ::= NOW", + /* 531 */ "noarg_func ::= TODAY", + /* 532 */ "noarg_func ::= TIMEZONE", + /* 533 */ "noarg_func ::= DATABASE", + /* 534 */ "noarg_func ::= CLIENT_VERSION", + /* 535 */ "noarg_func ::= SERVER_VERSION", + /* 536 */ "noarg_func ::= SERVER_STATUS", + /* 537 */ "noarg_func ::= CURRENT_USER", + /* 538 */ "noarg_func ::= USER", + /* 539 */ "star_func ::= COUNT", + /* 540 */ "star_func ::= FIRST", + /* 541 */ "star_func ::= LAST", + /* 542 */ "star_func ::= LAST_ROW", + /* 543 */ "star_func_para_list ::= NK_STAR", + /* 544 */ "star_func_para_list ::= other_para_list", + /* 545 */ "other_para_list ::= star_func_para", + /* 546 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 547 */ "star_func_para ::= expr_or_subquery", + /* 548 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 549 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 550 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 551 */ "when_then_list ::= when_then_expr", + /* 552 */ "when_then_list ::= when_then_list when_then_expr", + /* 553 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 554 */ "case_when_else_opt ::=", + /* 555 */ "case_when_else_opt ::= ELSE common_expression", + /* 556 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 557 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 558 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 559 */ "predicate ::= expr_or_subquery IS NULL", + /* 560 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 561 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 562 */ "compare_op ::= NK_LT", + /* 563 */ "compare_op ::= NK_GT", + /* 564 */ "compare_op ::= NK_LE", + /* 565 */ "compare_op ::= NK_GE", + /* 566 */ "compare_op ::= NK_NE", + /* 567 */ "compare_op ::= NK_EQ", + /* 568 */ "compare_op ::= LIKE", + /* 569 */ "compare_op ::= NOT LIKE", + /* 570 */ "compare_op ::= MATCH", + /* 571 */ "compare_op ::= NMATCH", + /* 572 */ "compare_op ::= CONTAINS", + /* 573 */ "in_op ::= IN", + /* 574 */ "in_op ::= NOT IN", + /* 575 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 576 */ "boolean_value_expression ::= boolean_primary", + /* 577 */ "boolean_value_expression ::= NOT boolean_primary", + /* 578 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 579 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 580 */ "boolean_primary ::= predicate", + /* 581 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 582 */ "common_expression ::= expr_or_subquery", + /* 583 */ "common_expression ::= boolean_value_expression", + /* 584 */ "from_clause_opt ::=", + /* 585 */ "from_clause_opt ::= FROM table_reference_list", + /* 586 */ "table_reference_list ::= table_reference", + /* 587 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 588 */ "table_reference ::= table_primary", + /* 589 */ "table_reference ::= joined_table", + /* 590 */ "table_primary ::= table_name alias_opt", + /* 591 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 592 */ "table_primary ::= subquery alias_opt", + /* 593 */ "table_primary ::= parenthesized_joined_table", + /* 594 */ "alias_opt ::=", + /* 595 */ "alias_opt ::= table_alias", + /* 596 */ "alias_opt ::= AS table_alias", + /* 597 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 598 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 599 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 600 */ "join_type ::=", + /* 601 */ "join_type ::= INNER", + /* 602 */ "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", + /* 603 */ "hint_list ::=", + /* 604 */ "hint_list ::= NK_HINT", + /* 605 */ "tag_mode_opt ::=", + /* 606 */ "tag_mode_opt ::= TAGS", + /* 607 */ "set_quantifier_opt ::=", + /* 608 */ "set_quantifier_opt ::= DISTINCT", + /* 609 */ "set_quantifier_opt ::= ALL", + /* 610 */ "select_list ::= select_item", + /* 611 */ "select_list ::= select_list NK_COMMA select_item", + /* 612 */ "select_item ::= NK_STAR", + /* 613 */ "select_item ::= common_expression", + /* 614 */ "select_item ::= common_expression column_alias", + /* 615 */ "select_item ::= common_expression AS column_alias", + /* 616 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 617 */ "where_clause_opt ::=", + /* 618 */ "where_clause_opt ::= WHERE search_condition", + /* 619 */ "partition_by_clause_opt ::=", + /* 620 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 621 */ "partition_list ::= partition_item", + /* 622 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 623 */ "partition_item ::= expr_or_subquery", + /* 624 */ "partition_item ::= expr_or_subquery column_alias", + /* 625 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 626 */ "twindow_clause_opt ::=", + /* 627 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 628 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 629 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 630 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 631 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 632 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 633 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 634 */ "sliding_opt ::=", + /* 635 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 636 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 637 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 638 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 639 */ "fill_opt ::=", + /* 640 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 641 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 642 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 643 */ "fill_mode ::= NONE", + /* 644 */ "fill_mode ::= PREV", + /* 645 */ "fill_mode ::= NULL", + /* 646 */ "fill_mode ::= NULL_F", + /* 647 */ "fill_mode ::= LINEAR", + /* 648 */ "fill_mode ::= NEXT", + /* 649 */ "group_by_clause_opt ::=", + /* 650 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 651 */ "group_by_list ::= expr_or_subquery", + /* 652 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 653 */ "having_clause_opt ::=", + /* 654 */ "having_clause_opt ::= HAVING search_condition", + /* 655 */ "range_opt ::=", + /* 656 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 657 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 658 */ "every_opt ::=", + /* 659 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 660 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 661 */ "query_simple ::= query_specification", + /* 662 */ "query_simple ::= union_query_expression", + /* 663 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 664 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 665 */ "query_simple_or_subquery ::= query_simple", + /* 666 */ "query_simple_or_subquery ::= subquery", + /* 667 */ "query_or_subquery ::= query_expression", + /* 668 */ "query_or_subquery ::= subquery", + /* 669 */ "order_by_clause_opt ::=", + /* 670 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 671 */ "slimit_clause_opt ::=", + /* 672 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 673 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 674 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 675 */ "limit_clause_opt ::=", + /* 676 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 677 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 678 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 679 */ "subquery ::= NK_LP query_expression NK_RP", + /* 680 */ "subquery ::= NK_LP subquery NK_RP", + /* 681 */ "search_condition ::= common_expression", + /* 682 */ "sort_specification_list ::= sort_specification", + /* 683 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 684 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 685 */ "ordering_specification_opt ::=", + /* 686 */ "ordering_specification_opt ::= ASC", + /* 687 */ "ordering_specification_opt ::= DESC", + /* 688 */ "null_ordering_opt ::=", + /* 689 */ "null_ordering_opt ::= NULLS FIRST", + /* 690 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3304,9 +2976,7 @@ static void yy_destructor( case 512: /* query_simple_or_subquery */ case 514: /* sort_specification */ { -#line 7 "sql.y" nodesDestroyNode((yypminor->yy718)); -#line 3309 "sql.c" } break; case 355: /* account_options */ @@ -3316,9 +2986,7 @@ static void yy_destructor( case 433: /* with_meta */ case 442: /* bufsize_opt */ { -#line 54 "sql.y" -#line 3321 "sql.c" } break; case 359: /* ip_range_list */ @@ -3356,9 +3024,7 @@ static void yy_destructor( case 508: /* order_by_clause_opt */ case 513: /* sort_specification_list */ { -#line 85 "sql.y" nodesDestroyList((yypminor->yy552)); -#line 3361 "sql.c" } break; case 362: /* user_name */ @@ -3381,32 +3047,24 @@ static void yy_destructor( case 466: /* noarg_func */ case 484: /* alias_opt */ { -#line 890 "sql.y" -#line 3386 "sql.c" } break; case 363: /* sysinfo_opt */ { -#line 112 "sql.y" -#line 3393 "sql.c" } break; case 364: /* privileges */ case 367: /* priv_type_list */ case 368: /* priv_type */ { -#line 121 "sql.y" -#line 3402 "sql.c" } break; case 365: /* priv_level */ { -#line 138 "sql.y" -#line 3409 "sql.c" } break; case 374: /* force_opt */ @@ -3420,75 +3078,55 @@ static void yy_destructor( case 490: /* set_quantifier_opt */ case 491: /* tag_mode_opt */ { -#line 167 "sql.y" -#line 3425 "sql.c" } break; case 387: /* alter_db_option */ case 409: /* alter_table_option */ { -#line 269 "sql.y" -#line 3433 "sql.c" } break; case 399: /* type_name */ { -#line 392 "sql.y" -#line 3440 "sql.c" } break; case 414: /* db_kind_opt */ case 421: /* table_kind */ { -#line 561 "sql.y" -#line 3448 "sql.c" } break; case 415: /* table_kind_db_name_cond_opt */ { -#line 526 "sql.y" -#line 3455 "sql.c" } break; case 474: /* compare_op */ case 475: /* in_op */ { -#line 1081 "sql.y" -#line 3463 "sql.c" } break; case 487: /* join_type */ { -#line 1157 "sql.y" -#line 3470 "sql.c" } break; case 504: /* fill_mode */ { -#line 1252 "sql.y" -#line 3477 "sql.c" } break; case 515: /* ordering_specification_opt */ { -#line 1337 "sql.y" -#line 3484 "sql.c" } break; case 516: /* null_ordering_opt */ { -#line 1343 "sql.y" -#line 3491 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3655,7 +3293,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); + assert( i>=0 && iyytos; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + yysize = yyRuleInfoNRhs[yyruleno]; + if( yysize ){ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; + } + yymsp = yypParser->yytos; + } +#endif + } switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example @@ -5166,21 +4892,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 5171 "sql.c" yy_destructor(yypParser,355,&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 5177 "sql.c" yy_destructor(yypParser,356,&yymsp[0].minor); break; case 2: /* account_options ::= */ -#line 55 "sql.y" { } -#line 5183 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5192,24 +4912,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,355,&yymsp[-2].minor); -#line 56 "sql.y" { } -#line 5197 "sql.c" yy_destructor(yypParser,357,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ { yy_destructor(yypParser,358,&yymsp[0].minor); -#line 68 "sql.y" { } -#line 5205 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,356,&yymsp[-1].minor); -#line 69 "sql.y" { } -#line 5212 "sql.c" yy_destructor(yypParser,358,&yymsp[0].minor); } break; @@ -5223,27 +4937,19 @@ 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 5228 "sql.c" yy_destructor(yypParser,357,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -#line 86 "sql.y" { yylhsminor.yy552 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5234 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -#line 87 "sql.y" { yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5240 "sql.c" yymsp[-2].minor.yy552 = yylhsminor.yy552; break; case 26: /* white_list ::= HOST ip_range_list */ -#line 91 "sql.y" { yymsp[-1].minor.yy552 = yymsp[0].minor.yy552; } -#line 5246 "sql.c" break; case 27: /* white_list_opt ::= */ case 188: /* specific_cols_opt ::= */ yytestcase(yyruleno==188); @@ -5251,140 +4957,92 @@ static YYACTIONTYPE yy_reduce( 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 599: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==599); - case 629: /* group_by_clause_opt ::= */ yytestcase(yyruleno==629); - case 649: /* order_by_clause_opt ::= */ yytestcase(yyruleno==649); -#line 95 "sql.y" + case 619: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==619); + case 649: /* group_by_clause_opt ::= */ yytestcase(yyruleno==649); + case 669: /* order_by_clause_opt ::= */ yytestcase(yyruleno==669); { yymsp[1].minor.yy552 = NULL; } -#line 5259 "sql.c" break; case 28: /* white_list_opt ::= white_list */ case 220: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==220); case 377: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==377); - case 524: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==524); -#line 96 "sql.y" + case 544: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==544); { yylhsminor.yy552 = yymsp[0].minor.yy552; } -#line 5267 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; 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.yy883); pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy552); } -#line 5276 "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 5281 "sql.c" 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 5286 "sql.c" 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 5291 "sql.c" 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.yy552); } -#line 5296 "sql.c" 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.yy552); } -#line 5301 "sql.c" break; case 35: /* cmd ::= DROP USER user_name */ -#line 109 "sql.y" { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy965); } -#line 5306 "sql.c" break; case 36: /* sysinfo_opt ::= */ -#line 113 "sql.y" { yymsp[1].minor.yy883 = 1; } -#line 5311 "sql.c" break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -#line 114 "sql.y" { yymsp[-1].minor.yy883 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5316 "sql.c" 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.yy525, &yymsp[-3].minor.yy665, &yymsp[0].minor.yy965, yymsp[-2].minor.yy718); } -#line 5321 "sql.c" 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.yy525, &yymsp[-3].minor.yy665, &yymsp[0].minor.yy965, yymsp[-2].minor.yy718); } -#line 5326 "sql.c" break; case 40: /* privileges ::= ALL */ -#line 122 "sql.y" { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_ALL; } -#line 5331 "sql.c" break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); -#line 123 "sql.y" { yylhsminor.yy525 = yymsp[0].minor.yy525; } -#line 5337 "sql.c" yymsp[0].minor.yy525 = yylhsminor.yy525; break; case 42: /* privileges ::= SUBSCRIBE */ -#line 124 "sql.y" { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5343 "sql.c" break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -#line 129 "sql.y" { yylhsminor.yy525 = yymsp[-2].minor.yy525 | yymsp[0].minor.yy525; } -#line 5348 "sql.c" yymsp[-2].minor.yy525 = yylhsminor.yy525; break; case 45: /* priv_type ::= READ */ -#line 133 "sql.y" { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_READ; } -#line 5354 "sql.c" break; case 46: /* priv_type ::= WRITE */ -#line 134 "sql.y" { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_WRITE; } -#line 5359 "sql.c" break; case 47: /* priv_type ::= ALTER */ -#line 135 "sql.y" { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_ALTER; } -#line 5364 "sql.c" break; case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -#line 139 "sql.y" { yylhsminor.yy665.first = yymsp[-2].minor.yy0; yylhsminor.yy665.second = yymsp[0].minor.yy0; } -#line 5369 "sql.c" yymsp[-2].minor.yy665 = yylhsminor.yy665; break; case 49: /* priv_level ::= db_name NK_DOT NK_STAR */ -#line 140 "sql.y" { yylhsminor.yy665.first = yymsp[-2].minor.yy965; yylhsminor.yy665.second = yymsp[0].minor.yy0; } -#line 5375 "sql.c" yymsp[-2].minor.yy665 = yylhsminor.yy665; break; case 50: /* priv_level ::= db_name NK_DOT table_name */ -#line 141 "sql.y" { yylhsminor.yy665.first = yymsp[-2].minor.yy965; yylhsminor.yy665.second = yymsp[0].minor.yy965; } -#line 5381 "sql.c" yymsp[-2].minor.yy665 = yylhsminor.yy665; break; case 51: /* priv_level ::= topic_name */ -#line 142 "sql.y" { yylhsminor.yy665.first = yymsp[0].minor.yy965; yylhsminor.yy665.second = nil_token; } -#line 5387 "sql.c" yymsp[0].minor.yy665 = yylhsminor.yy665; break; case 52: /* with_opt ::= */ @@ -5392,83 +5050,57 @@ static YYACTIONTYPE yy_reduce( case 161: /* end_opt ::= */ yytestcase(yyruleno==161); case 303: /* like_pattern_opt ::= */ yytestcase(yyruleno==303); case 388: /* subtable_opt ::= */ yytestcase(yyruleno==388); - case 534: /* case_when_else_opt ::= */ yytestcase(yyruleno==534); - case 564: /* from_clause_opt ::= */ yytestcase(yyruleno==564); - case 597: /* where_clause_opt ::= */ yytestcase(yyruleno==597); - case 606: /* twindow_clause_opt ::= */ yytestcase(yyruleno==606); - case 614: /* sliding_opt ::= */ yytestcase(yyruleno==614); - case 619: /* fill_opt ::= */ yytestcase(yyruleno==619); - case 633: /* having_clause_opt ::= */ yytestcase(yyruleno==633); - case 635: /* range_opt ::= */ yytestcase(yyruleno==635); - case 638: /* every_opt ::= */ yytestcase(yyruleno==638); - case 651: /* slimit_clause_opt ::= */ yytestcase(yyruleno==651); - case 655: /* limit_clause_opt ::= */ yytestcase(yyruleno==655); -#line 144 "sql.y" + case 554: /* case_when_else_opt ::= */ yytestcase(yyruleno==554); + case 584: /* from_clause_opt ::= */ yytestcase(yyruleno==584); + case 617: /* where_clause_opt ::= */ yytestcase(yyruleno==617); + case 626: /* twindow_clause_opt ::= */ yytestcase(yyruleno==626); + case 634: /* sliding_opt ::= */ yytestcase(yyruleno==634); + case 639: /* fill_opt ::= */ yytestcase(yyruleno==639); + case 653: /* having_clause_opt ::= */ yytestcase(yyruleno==653); + case 655: /* range_opt ::= */ yytestcase(yyruleno==655); + case 658: /* every_opt ::= */ yytestcase(yyruleno==658); + case 671: /* slimit_clause_opt ::= */ yytestcase(yyruleno==671); + case 675: /* limit_clause_opt ::= */ yytestcase(yyruleno==675); { yymsp[1].minor.yy718 = NULL; } -#line 5408 "sql.c" break; case 53: /* with_opt ::= WITH search_condition */ - case 565: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==565); - case 598: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==598); - case 634: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==634); -#line 145 "sql.y" + case 585: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==585); + case 618: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==618); + case 654: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==654); { yymsp[-1].minor.yy718 = yymsp[0].minor.yy718; } -#line 5416 "sql.c" break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint */ -#line 148 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy965, NULL); } -#line 5421 "sql.c" 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 5426 "sql.c" 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.yy559, false); } -#line 5431 "sql.c" 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.yy559, false); } -#line 5436 "sql.c" 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.yy559); } -#line 5441 "sql.c" 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.yy559); } -#line 5446 "sql.c" 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 5451 "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 5456 "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 5461 "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 5466 "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 5471 "sql.c" break; case 65: /* dnode_endpoint ::= NK_STRING */ case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66); @@ -5477,35 +5109,33 @@ 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 455: /* db_name ::= NK_ID */ yytestcase(yyruleno==455); - case 456: /* table_name ::= NK_ID */ yytestcase(yyruleno==456); - case 457: /* column_name ::= NK_ID */ yytestcase(yyruleno==457); - case 458: /* function_name ::= NK_ID */ yytestcase(yyruleno==458); - case 459: /* view_name ::= NK_ID */ yytestcase(yyruleno==459); - case 460: /* table_alias ::= NK_ID */ yytestcase(yyruleno==460); - case 461: /* column_alias ::= NK_ID */ yytestcase(yyruleno==461); - case 462: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==462); - case 463: /* user_name ::= NK_ID */ yytestcase(yyruleno==463); - case 464: /* topic_name ::= NK_ID */ yytestcase(yyruleno==464); - case 465: /* stream_name ::= NK_ID */ yytestcase(yyruleno==465); - case 466: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==466); - case 467: /* index_name ::= NK_ID */ yytestcase(yyruleno==467); - case 510: /* noarg_func ::= NOW */ yytestcase(yyruleno==510); - case 511: /* noarg_func ::= TODAY */ yytestcase(yyruleno==511); - case 512: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==512); - case 513: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==513); - case 514: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==514); - case 515: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==515); - case 516: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==516); - case 517: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==517); - case 518: /* noarg_func ::= USER */ yytestcase(yyruleno==518); - case 519: /* star_func ::= COUNT */ yytestcase(yyruleno==519); - case 520: /* star_func ::= FIRST */ yytestcase(yyruleno==520); - case 521: /* star_func ::= LAST */ yytestcase(yyruleno==521); - case 522: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==522); -#line 162 "sql.y" + case 475: /* db_name ::= NK_ID */ yytestcase(yyruleno==475); + case 476: /* table_name ::= NK_ID */ yytestcase(yyruleno==476); + case 477: /* column_name ::= NK_ID */ yytestcase(yyruleno==477); + case 478: /* function_name ::= NK_ID */ yytestcase(yyruleno==478); + case 479: /* view_name ::= NK_ID */ yytestcase(yyruleno==479); + case 480: /* table_alias ::= NK_ID */ yytestcase(yyruleno==480); + case 481: /* column_alias ::= NK_ID */ yytestcase(yyruleno==481); + case 482: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==482); + case 483: /* user_name ::= NK_ID */ yytestcase(yyruleno==483); + case 484: /* topic_name ::= NK_ID */ yytestcase(yyruleno==484); + case 485: /* stream_name ::= NK_ID */ yytestcase(yyruleno==485); + case 486: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==486); + case 487: /* index_name ::= NK_ID */ yytestcase(yyruleno==487); + case 530: /* noarg_func ::= NOW */ yytestcase(yyruleno==530); + case 531: /* noarg_func ::= TODAY */ yytestcase(yyruleno==531); + case 532: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==532); + case 533: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==533); + case 534: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==534); + case 535: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==535); + case 536: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==536); + case 537: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==537); + case 538: /* noarg_func ::= USER */ yytestcase(yyruleno==538); + case 539: /* star_func ::= COUNT */ yytestcase(yyruleno==539); + case 540: /* star_func ::= FIRST */ yytestcase(yyruleno==540); + case 541: /* star_func ::= LAST */ yytestcase(yyruleno==541); + case 542: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==542); { yylhsminor.yy965 = yymsp[0].minor.yy0; } -#line 5508 "sql.c" yymsp[0].minor.yy965 = yylhsminor.yy965; break; case 68: /* force_opt ::= */ @@ -5515,452 +5145,298 @@ static YYACTIONTYPE yy_reduce( case 358: /* agg_func_opt ::= */ yytestcase(yyruleno==358); case 364: /* or_replace_opt ::= */ yytestcase(yyruleno==364); case 390: /* ignore_opt ::= */ yytestcase(yyruleno==390); - case 585: /* tag_mode_opt ::= */ yytestcase(yyruleno==585); - case 587: /* set_quantifier_opt ::= */ yytestcase(yyruleno==587); -#line 168 "sql.y" + case 605: /* tag_mode_opt ::= */ yytestcase(yyruleno==605); + case 607: /* set_quantifier_opt ::= */ yytestcase(yyruleno==607); { yymsp[1].minor.yy559 = false; } -#line 5522 "sql.c" 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 586: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==586); - case 588: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==588); -#line 169 "sql.y" + case 606: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==606); + case 608: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==608); { yymsp[0].minor.yy559 = true; } -#line 5532 "sql.c" break; case 71: /* cmd ::= ALTER CLUSTER NK_STRING */ -#line 176 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5537 "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 5542 "sql.c" break; case 73: /* cmd ::= ALTER LOCAL NK_STRING */ -#line 180 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5547 "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 5552 "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 5557 "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 5562 "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 5567 "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 5572 "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 5577 "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 5582 "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 5587 "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 5592 "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 5597 "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 5602 "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 5607 "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.yy559, &yymsp[-1].minor.yy965, yymsp[0].minor.yy718); } -#line 5612 "sql.c" break; case 87: /* cmd ::= DROP DATABASE exists_opt db_name */ -#line 206 "sql.y" { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy559, &yymsp[0].minor.yy965); } -#line 5617 "sql.c" break; case 88: /* cmd ::= USE db_name */ -#line 207 "sql.y" { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy965); } -#line 5622 "sql.c" 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.yy718); } -#line 5627 "sql.c" break; case 90: /* cmd ::= FLUSH DATABASE db_name */ -#line 209 "sql.y" { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy965); } -#line 5632 "sql.c" 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.yy134); } -#line 5637 "sql.c" 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.yy718, yymsp[0].minor.yy718); } -#line 5642 "sql.c" break; case 93: /* not_exists_opt ::= IF NOT EXISTS */ -#line 215 "sql.y" { yymsp[-2].minor.yy559 = true; } -#line 5647 "sql.c" 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.yy559 = true; } -#line 5654 "sql.c" break; case 97: /* db_options ::= */ -#line 223 "sql.y" { yymsp[1].minor.yy718 = createDefaultDatabaseOptions(pCxt); } -#line 5659 "sql.c" break; case 98: /* db_options ::= db_options BUFFER NK_INTEGER */ -#line 224 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 5664 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 99: /* db_options ::= db_options CACHEMODEL NK_STRING */ -#line 225 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 5670 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 100: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -#line 226 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 5676 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 101: /* db_options ::= db_options COMP NK_INTEGER */ -#line 227 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 5682 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; 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.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 5689 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 104: /* db_options ::= db_options MAXROWS NK_INTEGER */ -#line 230 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 5695 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 105: /* db_options ::= db_options MINROWS NK_INTEGER */ -#line 231 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 5701 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; 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.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_KEEP, yymsp[0].minor.yy552); } -#line 5708 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 108: /* db_options ::= db_options PAGES NK_INTEGER */ -#line 234 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 5714 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 109: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -#line 235 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5720 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 110: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -#line 236 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5726 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 111: /* db_options ::= db_options PRECISION NK_STRING */ -#line 237 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 5732 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 112: /* db_options ::= db_options REPLICA NK_INTEGER */ -#line 238 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 5738 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 113: /* db_options ::= db_options VGROUPS NK_INTEGER */ -#line 240 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 5744 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 114: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -#line 241 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 5750 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 115: /* db_options ::= db_options RETENTIONS retention_list */ -#line 242 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_RETENTIONS, yymsp[0].minor.yy552); } -#line 5756 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 116: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -#line 243 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 5762 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 117: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -#line 244 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 5768 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 118: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -#line 245 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 5774 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 119: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -#line 246 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 5780 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; 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.yy718 = setDatabaseOption(pCxt, yymsp[-3].minor.yy718, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 5790 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 121: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -#line 252 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 5796 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; 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.yy718 = setDatabaseOption(pCxt, yymsp[-3].minor.yy718, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 5806 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 123: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -#line 258 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 5812 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 124: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -#line 259 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 5818 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 125: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -#line 260 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 5824 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 126: /* db_options ::= db_options TABLE_PREFIX signed */ -#line 261 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy718); } -#line 5830 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 127: /* db_options ::= db_options TABLE_SUFFIX signed */ -#line 262 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy718); } -#line 5836 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 128: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -#line 263 "sql.y" { yylhsminor.yy718 = setDatabaseOption(pCxt, yymsp[-2].minor.yy718, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } -#line 5842 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 129: /* alter_db_options ::= alter_db_option */ -#line 265 "sql.y" { yylhsminor.yy718 = createAlterDatabaseOptions(pCxt); yylhsminor.yy718 = setAlterDatabaseOption(pCxt, yylhsminor.yy718, &yymsp[0].minor.yy959); } -#line 5848 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 130: /* alter_db_options ::= alter_db_options alter_db_option */ -#line 266 "sql.y" { yylhsminor.yy718 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy718, &yymsp[0].minor.yy959); } -#line 5854 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; case 131: /* alter_db_option ::= BUFFER NK_INTEGER */ -#line 270 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5860 "sql.c" break; case 132: /* alter_db_option ::= CACHEMODEL NK_STRING */ -#line 271 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5865 "sql.c" break; case 133: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -#line 272 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5870 "sql.c" break; case 134: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -#line 273 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5875 "sql.c" 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.yy959.type = DB_OPTION_KEEP; yymsp[-1].minor.yy959.pList = yymsp[0].minor.yy552; } -#line 5881 "sql.c" break; case 137: /* alter_db_option ::= PAGES NK_INTEGER */ -#line 276 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_PAGES; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5886 "sql.c" break; case 138: /* alter_db_option ::= REPLICA NK_INTEGER */ -#line 277 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5891 "sql.c" break; case 139: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -#line 279 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_WAL; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5896 "sql.c" break; case 140: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -#line 280 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5901 "sql.c" break; case 141: /* alter_db_option ::= MINROWS NK_INTEGER */ -#line 281 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5906 "sql.c" break; case 142: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -#line 282 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5911 "sql.c" 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.yy959.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy959.val = t; } -#line 5920 "sql.c" break; case 144: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -#line 288 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5925 "sql.c" 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.yy959.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy959.val = t; } -#line 5934 "sql.c" break; case 146: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -#line 294 "sql.y" { yymsp[-1].minor.yy959.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 5939 "sql.c" break; case 147: /* integer_list ::= NK_INTEGER */ -#line 298 "sql.y" { yylhsminor.yy552 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5944 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; 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.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5951 "sql.c" yymsp[-2].minor.yy552 = yylhsminor.yy552; break; case 149: /* variable_list ::= NK_VARIABLE */ -#line 303 "sql.y" { yylhsminor.yy552 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5957 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; break; case 150: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -#line 304 "sql.y" { yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5963 "sql.c" yymsp[-2].minor.yy552 = yylhsminor.yy552; break; case 151: /* retention_list ::= retention */ @@ -5971,16 +5447,14 @@ static YYACTIONTYPE yy_reduce( case 241: /* col_name_list ::= col_name */ yytestcase(yyruleno==241); case 309: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==309); case 326: /* func_list ::= func */ yytestcase(yyruleno==326); - case 428: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==428); - case 453: /* literal_list ::= signed_literal */ yytestcase(yyruleno==453); - case 525: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==525); - case 531: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==531); - case 590: /* select_list ::= select_item */ yytestcase(yyruleno==590); - case 601: /* partition_list ::= partition_item */ yytestcase(yyruleno==601); - case 662: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==662); -#line 308 "sql.y" + case 448: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==448); + case 473: /* literal_list ::= signed_literal */ yytestcase(yyruleno==473); + case 545: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==545); + case 551: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==551); + case 610: /* select_list ::= select_item */ yytestcase(yyruleno==610); + case 621: /* partition_list ::= partition_item */ yytestcase(yyruleno==621); + case 682: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==682); { yylhsminor.yy552 = createNodeList(pCxt, yymsp[0].minor.yy718); } -#line 5983 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; break; case 152: /* retention_list ::= retention_list NK_COMMA retention */ @@ -5990,1745 +5464,1208 @@ static YYACTIONTYPE yy_reduce( case 242: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==242); 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 429: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==429); - case 454: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==454); - case 526: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==526); - case 591: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==591); - case 602: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==602); - case 663: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==663); -#line 309 "sql.y" + case 449: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==449); + case 474: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==474); + case 546: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==546); + case 611: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==611); + case 622: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==622); + case 683: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==683); { yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, yymsp[0].minor.yy718); } -#line 6001 "sql.c" yymsp[-2].minor.yy552 = yylhsminor.yy552; 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.yy718 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6008 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 155: /* speed_opt ::= */ case 360: /* bufsize_opt ::= */ yytestcase(yyruleno==360); -#line 316 "sql.y" { yymsp[1].minor.yy134 = 0; } -#line 6015 "sql.c" 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.yy134 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 6021 "sql.c" 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.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 6027 "sql.c" 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.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6033 "sql.c" 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.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6039 "sql.c" 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.yy559, yymsp[-5].minor.yy718, yymsp[-3].minor.yy552, yymsp[-1].minor.yy552, yymsp[0].minor.yy718); } -#line 6045 "sql.c" break; case 166: /* cmd ::= CREATE TABLE multi_create_clause */ -#line 332 "sql.y" { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy552); } -#line 6050 "sql.c" break; case 168: /* cmd ::= DROP TABLE multi_drop_clause */ -#line 335 "sql.y" { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy552); } -#line 6055 "sql.c" break; case 169: /* cmd ::= DROP STABLE exists_opt full_table_name */ -#line 336 "sql.y" { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy559, yymsp[0].minor.yy718); } -#line 6060 "sql.c" 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.yy718; } -#line 6067 "sql.c" break; case 171: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 339 "sql.y" { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy718); } -#line 6072 "sql.c" break; case 172: /* alter_table_clause ::= full_table_name alter_table_options */ -#line 341 "sql.y" { yylhsminor.yy718 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy718, yymsp[0].minor.yy718); } -#line 6077 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; case 173: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -#line 343 "sql.y" { yylhsminor.yy718 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy718, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy965, yymsp[0].minor.yy224); } -#line 6083 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 174: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 344 "sql.y" { yylhsminor.yy718 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy718, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy965); } -#line 6089 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 175: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -#line 346 "sql.y" { yylhsminor.yy718 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy718, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy965, yymsp[0].minor.yy224); } -#line 6095 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 176: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -#line 348 "sql.y" { yylhsminor.yy718 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy718, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 6101 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 177: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -#line 350 "sql.y" { yylhsminor.yy718 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy718, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy965, yymsp[0].minor.yy224); } -#line 6107 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 178: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 351 "sql.y" { yylhsminor.yy718 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy718, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy965); } -#line 6113 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 179: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -#line 353 "sql.y" { yylhsminor.yy718 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy718, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy965, yymsp[0].minor.yy224); } -#line 6119 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 180: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -#line 355 "sql.y" { yylhsminor.yy718 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy718, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 6125 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 181: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -#line 357 "sql.y" { yylhsminor.yy718 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy718, &yymsp[-2].minor.yy965, yymsp[0].minor.yy718); } -#line 6131 "sql.c" yymsp[-5].minor.yy718 = yylhsminor.yy718; break; case 183: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 532: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==532); -#line 362 "sql.y" + case 552: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==552); { yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-1].minor.yy552, yymsp[0].minor.yy718); } -#line 6138 "sql.c" yymsp[-1].minor.yy552 = yylhsminor.yy552; break; case 184: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -#line 366 "sql.y" { yylhsminor.yy718 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy559, yymsp[-8].minor.yy718, yymsp[-6].minor.yy718, yymsp[-5].minor.yy552, yymsp[-2].minor.yy552, yymsp[0].minor.yy718); } -#line 6144 "sql.c" yymsp[-9].minor.yy718 = yylhsminor.yy718; break; case 187: /* drop_table_clause ::= exists_opt full_table_name */ -#line 373 "sql.y" { yylhsminor.yy718 = createDropTableClause(pCxt, yymsp[-1].minor.yy559, yymsp[0].minor.yy718); } -#line 6150 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; 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.yy552 = yymsp[-1].minor.yy552; } -#line 6157 "sql.c" break; case 190: /* full_table_name ::= table_name */ -#line 380 "sql.y" { yylhsminor.yy718 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy965, NULL); } -#line 6162 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 191: /* full_table_name ::= db_name NK_DOT table_name */ -#line 381 "sql.y" { yylhsminor.yy718 = createRealTableNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965, NULL); } -#line 6168 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 194: /* column_def ::= column_name type_name */ -#line 388 "sql.y" { yylhsminor.yy718 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy965, yymsp[0].minor.yy224, NULL); } -#line 6174 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; case 195: /* type_name ::= BOOL */ -#line 393 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 6180 "sql.c" break; case 196: /* type_name ::= TINYINT */ -#line 394 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 6185 "sql.c" break; case 197: /* type_name ::= SMALLINT */ -#line 395 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 6190 "sql.c" break; case 198: /* type_name ::= INT */ case 199: /* type_name ::= INTEGER */ yytestcase(yyruleno==199); -#line 396 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_INT); } -#line 6196 "sql.c" break; case 200: /* type_name ::= BIGINT */ -#line 398 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 6201 "sql.c" break; case 201: /* type_name ::= FLOAT */ -#line 399 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 6206 "sql.c" break; case 202: /* type_name ::= DOUBLE */ -#line 400 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 6211 "sql.c" break; case 203: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 401 "sql.y" { yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 6216 "sql.c" break; case 204: /* type_name ::= TIMESTAMP */ -#line 402 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 6221 "sql.c" break; case 205: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 403 "sql.y" { yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 6226 "sql.c" break; case 206: /* type_name ::= TINYINT UNSIGNED */ -#line 404 "sql.y" { yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 6231 "sql.c" break; case 207: /* type_name ::= SMALLINT UNSIGNED */ -#line 405 "sql.y" { yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 6236 "sql.c" break; case 208: /* type_name ::= INT UNSIGNED */ -#line 406 "sql.y" { yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 6241 "sql.c" break; case 209: /* type_name ::= BIGINT UNSIGNED */ -#line 407 "sql.y" { yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 6246 "sql.c" break; case 210: /* type_name ::= JSON */ -#line 408 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 6251 "sql.c" break; case 211: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 409 "sql.y" { yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 6256 "sql.c" break; case 212: /* type_name ::= MEDIUMBLOB */ -#line 410 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 6261 "sql.c" break; case 213: /* type_name ::= BLOB */ -#line 411 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 6266 "sql.c" break; case 214: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 412 "sql.y" { yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 6271 "sql.c" break; case 215: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -#line 413 "sql.y" { yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 6276 "sql.c" break; case 216: /* type_name ::= DECIMAL */ -#line 414 "sql.y" { yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6281 "sql.c" break; case 217: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 415 "sql.y" { yymsp[-3].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6286 "sql.c" break; case 218: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 416 "sql.y" { yymsp[-5].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6291 "sql.c" break; case 221: /* 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 425 "sql.y" { yymsp[-3].minor.yy552 = yymsp[-1].minor.yy552; } -#line 6297 "sql.c" break; case 222: /* table_options ::= */ -#line 427 "sql.y" { yymsp[1].minor.yy718 = createDefaultTableOptions(pCxt); } -#line 6302 "sql.c" break; case 223: /* table_options ::= table_options COMMENT NK_STRING */ -#line 428 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-2].minor.yy718, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 6307 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 224: /* table_options ::= table_options MAX_DELAY duration_list */ -#line 429 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-2].minor.yy718, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy552); } -#line 6313 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 225: /* table_options ::= table_options WATERMARK duration_list */ -#line 430 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-2].minor.yy718, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy552); } -#line 6319 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 226: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -#line 431 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-4].minor.yy718, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy552); } -#line 6325 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 227: /* table_options ::= table_options TTL NK_INTEGER */ -#line 432 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-2].minor.yy718, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 6331 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 228: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 433 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-4].minor.yy718, TABLE_OPTION_SMA, yymsp[-1].minor.yy552); } -#line 6337 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; case 229: /* table_options ::= table_options DELETE_MARK duration_list */ -#line 434 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-2].minor.yy718, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy552); } -#line 6343 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 230: /* alter_table_options ::= alter_table_option */ -#line 436 "sql.y" { yylhsminor.yy718 = createAlterTableOptions(pCxt); yylhsminor.yy718 = setTableOption(pCxt, yylhsminor.yy718, yymsp[0].minor.yy959.type, &yymsp[0].minor.yy959.val); } -#line 6349 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 231: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 437 "sql.y" { yylhsminor.yy718 = setTableOption(pCxt, yymsp[-1].minor.yy718, yymsp[0].minor.yy959.type, &yymsp[0].minor.yy959.val); } -#line 6355 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; case 232: /* alter_table_option ::= COMMENT NK_STRING */ -#line 441 "sql.y" { yymsp[-1].minor.yy959.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 6361 "sql.c" break; case 233: /* alter_table_option ::= TTL NK_INTEGER */ -#line 442 "sql.y" { yymsp[-1].minor.yy959.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy959.val = yymsp[0].minor.yy0; } -#line 6366 "sql.c" break; case 234: /* duration_list ::= duration_literal */ - case 485: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==485); -#line 446 "sql.y" + case 505: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==505); { yylhsminor.yy552 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy718)); } -#line 6372 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; break; case 235: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 486: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==486); -#line 447 "sql.y" + case 506: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==506); { yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, releaseRawExprNode(pCxt, yymsp[0].minor.yy718)); } -#line 6379 "sql.c" yymsp[-2].minor.yy552 = yylhsminor.yy552; break; case 238: /* rollup_func_name ::= function_name */ -#line 454 "sql.y" { yylhsminor.yy718 = createFunctionNode(pCxt, &yymsp[0].minor.yy965, NULL); } -#line 6385 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 239: /* rollup_func_name ::= FIRST */ case 240: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==240); case 312: /* tag_item ::= QTAGS */ yytestcase(yyruleno==312); -#line 455 "sql.y" { yylhsminor.yy718 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6393 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 243: /* col_name ::= column_name */ case 313: /* tag_item ::= column_name */ yytestcase(yyruleno==313); -#line 463 "sql.y" { yylhsminor.yy718 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy965); } -#line 6400 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 244: /* cmd ::= SHOW DNODES */ -#line 466 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6406 "sql.c" break; case 245: /* cmd ::= SHOW USERS */ -#line 467 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6411 "sql.c" break; case 246: /* cmd ::= SHOW USER PRIVILEGES */ -#line 468 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6416 "sql.c" break; case 247: /* cmd ::= SHOW db_kind_opt DATABASES */ -#line 469 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy101); } -#line 6424 "sql.c" break; case 248: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -#line 473 "sql.y" { pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy91, yymsp[0].minor.yy718, OP_TYPE_LIKE); } -#line 6431 "sql.c" break; case 249: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 476 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy718, yymsp[0].minor.yy718, OP_TYPE_LIKE); } -#line 6436 "sql.c" break; case 250: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 477 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy718, NULL, OP_TYPE_LIKE); } -#line 6441 "sql.c" break; case 251: /* cmd ::= SHOW MNODES */ -#line 478 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 6446 "sql.c" break; case 252: /* cmd ::= SHOW QNODES */ -#line 480 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 6451 "sql.c" break; case 253: /* cmd ::= SHOW ARBGROUPS */ -#line 481 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } -#line 6456 "sql.c" break; case 254: /* cmd ::= SHOW FUNCTIONS */ -#line 482 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 6461 "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.yy718, yymsp[-1].minor.yy718, OP_TYPE_EQUAL); } -#line 6466 "sql.c" 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 6471 "sql.c" break; case 257: /* cmd ::= SHOW STREAMS */ -#line 485 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 6476 "sql.c" break; case 258: /* cmd ::= SHOW ACCOUNTS */ -#line 486 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6481 "sql.c" break; case 259: /* cmd ::= SHOW APPS */ -#line 487 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 6486 "sql.c" break; case 260: /* cmd ::= SHOW CONNECTIONS */ -#line 488 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 6491 "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 6497 "sql.c" break; case 263: /* cmd ::= SHOW GRANTS FULL */ -#line 491 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } -#line 6502 "sql.c" break; case 264: /* cmd ::= SHOW GRANTS LOGS */ -#line 492 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } -#line 6507 "sql.c" break; case 265: /* cmd ::= SHOW CLUSTER MACHINES */ -#line 493 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } -#line 6512 "sql.c" break; case 266: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 494 "sql.y" { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy965); } -#line 6517 "sql.c" 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.yy718); } -#line 6522 "sql.c" 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.yy718); } -#line 6527 "sql.c" break; case 269: /* cmd ::= SHOW QUERIES */ -#line 497 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 6532 "sql.c" break; case 270: /* cmd ::= SHOW SCORES */ -#line 498 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 6537 "sql.c" break; case 271: /* cmd ::= SHOW TOPICS */ -#line 499 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 6542 "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 6548 "sql.c" break; case 274: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 502 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 6553 "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.yy718); } -#line 6558 "sql.c" break; case 276: /* cmd ::= SHOW BNODES */ -#line 504 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 6563 "sql.c" break; case 277: /* cmd ::= SHOW SNODES */ -#line 505 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 6568 "sql.c" break; case 278: /* cmd ::= SHOW CLUSTER */ -#line 506 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 6573 "sql.c" break; case 279: /* cmd ::= SHOW TRANSACTIONS */ -#line 507 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 6578 "sql.c" break; case 280: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 508 "sql.y" { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy718); } -#line 6583 "sql.c" break; case 281: /* cmd ::= SHOW CONSUMERS */ -#line 509 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 6588 "sql.c" break; case 282: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 510 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 6593 "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.yy718, yymsp[-1].minor.yy718, OP_TYPE_EQUAL); } -#line 6598 "sql.c" 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 6603 "sql.c" 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.yy718, yymsp[0].minor.yy718, yymsp[-3].minor.yy552); } -#line 6608 "sql.c" 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.yy552); } -#line 6613 "sql.c" 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 6618 "sql.c" break; case 288: /* cmd ::= SHOW VNODES */ -#line 516 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 6623 "sql.c" break; case 289: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 518 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy718, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 6628 "sql.c" break; case 290: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 519 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 6633 "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.yy718, yymsp[0].minor.yy718, OP_TYPE_LIKE); } -#line 6638 "sql.c" 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.yy718); } -#line 6643 "sql.c" break; case 293: /* cmd ::= SHOW COMPACTS */ -#line 522 "sql.y" { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } -#line 6648 "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 6653 "sql.c" break; case 295: /* table_kind_db_name_cond_opt ::= */ -#line 527 "sql.y" { yymsp[1].minor.yy91.kind = SHOW_KIND_ALL; yymsp[1].minor.yy91.dbName = nil_token; } -#line 6658 "sql.c" break; case 296: /* table_kind_db_name_cond_opt ::= table_kind */ -#line 528 "sql.y" { yylhsminor.yy91.kind = yymsp[0].minor.yy101; yylhsminor.yy91.dbName = nil_token; } -#line 6663 "sql.c" yymsp[0].minor.yy91 = yylhsminor.yy91; break; case 297: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -#line 529 "sql.y" { yylhsminor.yy91.kind = SHOW_KIND_ALL; yylhsminor.yy91.dbName = yymsp[-1].minor.yy965; } -#line 6669 "sql.c" yymsp[-1].minor.yy91 = yylhsminor.yy91; break; case 298: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -#line 530 "sql.y" { yylhsminor.yy91.kind = yymsp[-2].minor.yy101; yylhsminor.yy91.dbName = yymsp[-1].minor.yy965; } -#line 6675 "sql.c" yymsp[-2].minor.yy91 = yylhsminor.yy91; break; case 299: /* table_kind ::= NORMAL */ -#line 534 "sql.y" { yymsp[0].minor.yy101 = SHOW_KIND_TABLES_NORMAL; } -#line 6681 "sql.c" break; case 300: /* table_kind ::= CHILD */ -#line 535 "sql.y" { yymsp[0].minor.yy101 = SHOW_KIND_TABLES_CHILD; } -#line 6686 "sql.c" break; case 301: /* db_name_cond_opt ::= */ case 306: /* from_db_opt ::= */ yytestcase(yyruleno==306); -#line 537 "sql.y" { yymsp[1].minor.yy718 = createDefaultDatabaseCondValue(pCxt); } -#line 6692 "sql.c" break; case 302: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 538 "sql.y" { yylhsminor.yy718 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy965); } -#line 6697 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; case 304: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 541 "sql.y" { yymsp[-1].minor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 6703 "sql.c" break; case 305: /* table_name_cond ::= table_name */ -#line 543 "sql.y" { yylhsminor.yy718 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy965); } -#line 6708 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 307: /* from_db_opt ::= FROM db_name */ -#line 546 "sql.y" { yymsp[-1].minor.yy718 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy965); } -#line 6714 "sql.c" break; case 311: /* tag_item ::= TBNAME */ -#line 554 "sql.y" { yylhsminor.yy718 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 6719 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 314: /* tag_item ::= column_name column_alias */ -#line 557 "sql.y" { yylhsminor.yy718 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy965), &yymsp[0].minor.yy965); } -#line 6725 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; case 315: /* tag_item ::= column_name AS column_alias */ -#line 558 "sql.y" { yylhsminor.yy718 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy965), &yymsp[0].minor.yy965); } -#line 6731 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 316: /* db_kind_opt ::= */ -#line 562 "sql.y" { yymsp[1].minor.yy101 = SHOW_KIND_ALL; } -#line 6737 "sql.c" break; case 317: /* db_kind_opt ::= USER */ -#line 563 "sql.y" { yymsp[0].minor.yy101 = SHOW_KIND_DATABASES_USER; } -#line 6742 "sql.c" break; case 318: /* db_kind_opt ::= SYSTEM */ -#line 564 "sql.y" { yymsp[0].minor.yy101 = SHOW_KIND_DATABASES_SYSTEM; } -#line 6747 "sql.c" 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.yy559, yymsp[-3].minor.yy718, yymsp[-1].minor.yy718, NULL, yymsp[0].minor.yy718); } -#line 6752 "sql.c" 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.yy559, yymsp[-5].minor.yy718, yymsp[-3].minor.yy718, yymsp[-1].minor.yy552, NULL); } -#line 6757 "sql.c" break; case 321: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 571 "sql.y" { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy559, yymsp[0].minor.yy718); } -#line 6762 "sql.c" break; case 322: /* full_index_name ::= index_name */ -#line 573 "sql.y" { yylhsminor.yy718 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy965); } -#line 6767 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 323: /* full_index_name ::= db_name NK_DOT index_name */ -#line 574 "sql.y" { yylhsminor.yy718 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965); } -#line 6773 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; 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.yy718 = createIndexOption(pCxt, yymsp[-7].minor.yy552, releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), NULL, yymsp[-1].minor.yy718, yymsp[0].minor.yy718); } -#line 6779 "sql.c" 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.yy718 = createIndexOption(pCxt, yymsp[-9].minor.yy552, releaseRawExprNode(pCxt, yymsp[-5].minor.yy718), releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), yymsp[-1].minor.yy718, yymsp[0].minor.yy718); } -#line 6784 "sql.c" break; case 328: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 587 "sql.y" { yylhsminor.yy718 = createFunctionNode(pCxt, &yymsp[-3].minor.yy965, yymsp[-1].minor.yy552); } -#line 6789 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 329: /* sma_func_name ::= function_name */ - case 575: /* alias_opt ::= table_alias */ yytestcase(yyruleno==575); -#line 591 "sql.y" + case 595: /* alias_opt ::= table_alias */ yytestcase(yyruleno==595); { yylhsminor.yy965 = yymsp[0].minor.yy965; } -#line 6796 "sql.c" yymsp[0].minor.yy965 = yylhsminor.yy965; break; case 334: /* sma_stream_opt ::= */ case 379: /* stream_options ::= */ yytestcase(yyruleno==379); -#line 597 "sql.y" { yymsp[1].minor.yy718 = createStreamOptions(pCxt); } -#line 6803 "sql.c" break; case 335: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 598 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy718)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = yymsp[-2].minor.yy718; } -#line 6808 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 336: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 599 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy718)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = yymsp[-2].minor.yy718; } -#line 6814 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 337: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 600 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy718)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = yymsp[-2].minor.yy718; } -#line 6820 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 338: /* with_meta ::= AS */ -#line 605 "sql.y" { yymsp[0].minor.yy134 = 0; } -#line 6826 "sql.c" break; case 339: /* with_meta ::= WITH META AS */ -#line 606 "sql.y" { yymsp[-2].minor.yy134 = 1; } -#line 6831 "sql.c" break; case 340: /* with_meta ::= ONLY META AS */ -#line 607 "sql.y" { yymsp[-2].minor.yy134 = 2; } -#line 6836 "sql.c" 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.yy559, &yymsp[-2].minor.yy965, yymsp[0].minor.yy718); } -#line 6841 "sql.c" 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.yy559, &yymsp[-3].minor.yy965, &yymsp[0].minor.yy965, yymsp[-2].minor.yy134); } -#line 6846 "sql.c" 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.yy559, &yymsp[-4].minor.yy965, yymsp[-1].minor.yy718, yymsp[-3].minor.yy134, yymsp[0].minor.yy718); } -#line 6851 "sql.c" break; case 344: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 615 "sql.y" { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy559, &yymsp[0].minor.yy965); } -#line 6856 "sql.c" 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.yy559, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965); } -#line 6861 "sql.c" 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.yy718); } -#line 6867 "sql.c" break; case 348: /* cmd ::= RESET QUERY CACHE */ -#line 623 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 6872 "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.yy559, yymsp[-1].minor.yy718, yymsp[0].minor.yy718); } -#line 6878 "sql.c" break; case 353: /* explain_options ::= */ -#line 634 "sql.y" { yymsp[1].minor.yy718 = createDefaultExplainOptions(pCxt); } -#line 6883 "sql.c" break; case 354: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 635 "sql.y" { yylhsminor.yy718 = setExplainVerbose(pCxt, yymsp[-2].minor.yy718, &yymsp[0].minor.yy0); } -#line 6888 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 355: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 636 "sql.y" { yylhsminor.yy718 = setExplainRatio(pCxt, yymsp[-2].minor.yy718, &yymsp[0].minor.yy0); } -#line 6894 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; 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.yy559, yymsp[-9].minor.yy559, &yymsp[-6].minor.yy965, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy224, yymsp[-1].minor.yy134, &yymsp[0].minor.yy965, yymsp[-10].minor.yy559); } -#line 6900 "sql.c" break; case 357: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 642 "sql.y" { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy559, &yymsp[0].minor.yy965); } -#line 6905 "sql.c" break; case 362: /* language_opt ::= */ case 401: /* on_vgroup_id ::= */ yytestcase(yyruleno==401); -#line 656 "sql.y" { yymsp[1].minor.yy965 = nil_token; } -#line 6911 "sql.c" 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 6917 "sql.c" 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.yy559, yymsp[-2].minor.yy718, &yymsp[-1].minor.yy0, yymsp[0].minor.yy718); } -#line 6922 "sql.c" break; case 367: /* cmd ::= DROP VIEW exists_opt full_view_name */ -#line 667 "sql.y" { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy559, yymsp[0].minor.yy718); } -#line 6927 "sql.c" break; case 368: /* full_view_name ::= view_name */ -#line 669 "sql.y" { yylhsminor.yy718 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy965); } -#line 6932 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; case 369: /* full_view_name ::= db_name NK_DOT view_name */ -#line 670 "sql.y" { yylhsminor.yy718 = createViewNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965); } -#line 6938 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; 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.yy559, &yymsp[-8].minor.yy965, yymsp[-5].minor.yy718, yymsp[-7].minor.yy718, yymsp[-3].minor.yy552, yymsp[-2].minor.yy718, yymsp[0].minor.yy718, yymsp[-4].minor.yy552); } -#line 6944 "sql.c" break; case 371: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 676 "sql.y" { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy559, &yymsp[0].minor.yy965); } -#line 6949 "sql.c" break; case 372: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 677 "sql.y" { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy559, &yymsp[0].minor.yy965); } -#line 6954 "sql.c" break; case 373: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 678 "sql.y" { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy559, yymsp[-1].minor.yy559, &yymsp[0].minor.yy965); } -#line 6959 "sql.c" 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.yy718 = setStreamOptions(pCxt, yymsp[-2].minor.yy718, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6965 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 382: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 694 "sql.y" { yylhsminor.yy718 = setStreamOptions(pCxt, yymsp[-3].minor.yy718, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy718)); } -#line 6971 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 383: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 695 "sql.y" { yylhsminor.yy718 = setStreamOptions(pCxt, yymsp[-2].minor.yy718, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy718)); } -#line 6977 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 384: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 696 "sql.y" { yylhsminor.yy718 = setStreamOptions(pCxt, yymsp[-3].minor.yy718, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 6983 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 385: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 697 "sql.y" { yylhsminor.yy718 = setStreamOptions(pCxt, yymsp[-2].minor.yy718, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 6989 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 386: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 698 "sql.y" { yylhsminor.yy718 = setStreamOptions(pCxt, yymsp[-2].minor.yy718, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy718)); } -#line 6995 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; case 387: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 699 "sql.y" { yylhsminor.yy718 = setStreamOptions(pCxt, yymsp[-3].minor.yy718, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7001 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; case 389: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 615: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==615); - case 639: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==639); -#line 702 "sql.y" + case 635: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==635); + case 659: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==659); { yymsp[-3].minor.yy718 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy718); } -#line 7009 "sql.c" break; case 392: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 710 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 7014 "sql.c" break; case 393: /* cmd ::= KILL QUERY NK_STRING */ -#line 711 "sql.y" { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7019 "sql.c" break; case 394: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 712 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 7024 "sql.c" break; case 395: /* cmd ::= KILL COMPACT NK_INTEGER */ -#line 713 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } -#line 7029 "sql.c" break; case 396: /* cmd ::= BALANCE VGROUP */ -#line 716 "sql.y" { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 7034 "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 7039 "sql.c" break; case 398: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 718 "sql.y" { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 7044 "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.yy552); } -#line 7049 "sql.c" break; case 400: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 720 "sql.y" { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7054 "sql.c" break; case 403: /* dnode_list ::= DNODE NK_INTEGER */ -#line 729 "sql.y" { yymsp[-1].minor.yy552 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7059 "sql.c" break; case 405: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 736 "sql.y" { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy718, yymsp[0].minor.yy718); } -#line 7064 "sql.c" 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.yy718 = createInsertStmt(pCxt, yymsp[-4].minor.yy718, yymsp[-2].minor.yy552, yymsp[0].minor.yy718); } -#line 7069 "sql.c" break; case 409: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 746 "sql.y" { yymsp[-3].minor.yy718 = createInsertStmt(pCxt, yymsp[-1].minor.yy718, NULL, yymsp[0].minor.yy718); } -#line 7074 "sql.c" break; case 410: /* tags_literal ::= NK_INTEGER */ - case 416: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==416); - case 419: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==419); -#line 749 "sql.y" + case 422: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==422); + case 431: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==431); { yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } -#line 7081 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 411: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 412: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==412); - case 417: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==417); - case 418: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==418); - case 420: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==420); - case 421: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==421); -#line 750 "sql.y" + case 411: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 412: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==412); + case 423: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==423); + case 424: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==424); + case 432: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==432); + case 433: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==433); + case 441: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==441); + case 442: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==442); +{ + SToken l = yymsp[-2].minor.yy0; + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); + l.n = (r.z + r.n) - l.z; + yylhsminor.yy718 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy718); + } + yymsp[-2].minor.yy718 = yylhsminor.yy718; + break; + case 413: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 416: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==416); + case 425: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==425); + case 428: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==428); + case 434: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==434); + case 437: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==437); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } -#line 7096 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 413: /* tags_literal ::= NK_FLOAT */ -#line 760 "sql.y" + case 414: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 415: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==415); + case 417: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==417); + case 418: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==418); + case 426: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==426); + case 427: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==427); + case 429: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==429); + case 430: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==430); + case 435: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==435); + case 436: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==436); + case 438: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==438); + case 439: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==439); +{ + SToken l = yymsp[-3].minor.yy0; + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); + l.n = (r.z + r.n) - l.z; + yylhsminor.yy718 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy718); + } + yymsp[-3].minor.yy718 = yylhsminor.yy718; + break; + case 419: /* tags_literal ::= NK_FLOAT */ { yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } -#line 7102 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 414: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 415: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==415); -#line 761 "sql.y" + case 420: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 421: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==421); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } -#line 7113 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 422: /* tags_literal ::= NK_STRING */ -#line 795 "sql.y" + case 440: /* tags_literal ::= NK_STRING */ { yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } -#line 7119 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 423: /* tags_literal ::= NK_BOOL */ -#line 796 "sql.y" + case 443: /* tags_literal ::= NK_BOOL */ { yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } -#line 7125 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 424: /* tags_literal ::= NULL */ -#line 797 "sql.y" + case 444: /* tags_literal ::= NULL */ { yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } -#line 7131 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 425: /* tags_literal ::= literal_func */ -#line 799 "sql.y" + case 445: /* tags_literal ::= literal_func */ { yylhsminor.yy718 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy718); } -#line 7137 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 426: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 427: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==427); -#line 800 "sql.y" + case 446: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 447: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==447); { SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); l.n = (r.z + r.n) - l.z; yylhsminor.yy718 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy718, yymsp[0].minor.yy718); } -#line 7149 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 430: /* literal ::= NK_INTEGER */ -#line 819 "sql.y" + case 450: /* literal ::= NK_INTEGER */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 7155 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 431: /* literal ::= NK_FLOAT */ -#line 820 "sql.y" + case 451: /* literal ::= NK_FLOAT */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 7161 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 432: /* literal ::= NK_STRING */ -#line 821 "sql.y" + case 452: /* literal ::= NK_STRING */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 7167 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 433: /* literal ::= NK_BOOL */ -#line 822 "sql.y" + case 453: /* literal ::= NK_BOOL */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 7173 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 434: /* literal ::= TIMESTAMP NK_STRING */ -#line 823 "sql.y" + case 454: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 7179 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 435: /* literal ::= duration_literal */ - case 445: /* signed_literal ::= signed */ yytestcase(yyruleno==445); - case 468: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==468); - case 469: /* expression ::= literal */ yytestcase(yyruleno==469); - case 471: /* expression ::= column_reference */ yytestcase(yyruleno==471); - case 472: /* expression ::= function_expression */ yytestcase(yyruleno==472); - case 473: /* expression ::= case_when_expression */ yytestcase(yyruleno==473); - case 506: /* function_expression ::= literal_func */ yytestcase(yyruleno==506); - case 556: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==556); - case 560: /* boolean_primary ::= predicate */ yytestcase(yyruleno==560); - case 562: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==562); - case 563: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==563); - case 566: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==566); - case 568: /* table_reference ::= table_primary */ yytestcase(yyruleno==568); - case 569: /* table_reference ::= joined_table */ yytestcase(yyruleno==569); - case 573: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==573); - case 641: /* query_simple ::= query_specification */ yytestcase(yyruleno==641); - case 642: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==642); - case 645: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==645); - case 647: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==647); -#line 824 "sql.y" + case 455: /* literal ::= duration_literal */ + case 465: /* signed_literal ::= signed */ yytestcase(yyruleno==465); + case 488: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==488); + case 489: /* expression ::= literal */ yytestcase(yyruleno==489); + case 491: /* expression ::= column_reference */ yytestcase(yyruleno==491); + case 492: /* expression ::= function_expression */ yytestcase(yyruleno==492); + case 493: /* expression ::= case_when_expression */ yytestcase(yyruleno==493); + case 526: /* function_expression ::= literal_func */ yytestcase(yyruleno==526); + case 576: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==576); + case 580: /* boolean_primary ::= predicate */ yytestcase(yyruleno==580); + case 582: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==582); + case 583: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==583); + case 586: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==586); + case 588: /* table_reference ::= table_primary */ yytestcase(yyruleno==588); + case 589: /* table_reference ::= joined_table */ yytestcase(yyruleno==589); + case 593: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==593); + case 661: /* query_simple ::= query_specification */ yytestcase(yyruleno==661); + case 662: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==662); + case 665: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==665); + case 667: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==667); { yylhsminor.yy718 = yymsp[0].minor.yy718; } -#line 7204 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 436: /* literal ::= NULL */ -#line 825 "sql.y" + case 456: /* literal ::= NULL */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 7210 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 437: /* literal ::= NK_QUESTION */ -#line 826 "sql.y" + case 457: /* literal ::= NK_QUESTION */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7216 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 438: /* duration_literal ::= NK_VARIABLE */ - case 616: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==616); - case 617: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==617); - case 618: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==618); -#line 828 "sql.y" + case 458: /* duration_literal ::= NK_VARIABLE */ + case 636: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==636); + case 637: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==637); + case 638: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==638); { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7225 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 439: /* signed ::= NK_INTEGER */ -#line 830 "sql.y" + case 459: /* signed ::= NK_INTEGER */ { yylhsminor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7231 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 440: /* signed ::= NK_PLUS NK_INTEGER */ -#line 831 "sql.y" + case 460: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7237 "sql.c" break; - case 441: /* signed ::= NK_MINUS NK_INTEGER */ -#line 832 "sql.y" + case 461: /* 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.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 7246 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 442: /* signed ::= NK_FLOAT */ -#line 837 "sql.y" + case 462: /* signed ::= NK_FLOAT */ { yylhsminor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7252 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 443: /* signed ::= NK_PLUS NK_FLOAT */ -#line 838 "sql.y" + case 463: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7258 "sql.c" break; - case 444: /* signed ::= NK_MINUS NK_FLOAT */ -#line 839 "sql.y" + case 464: /* 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.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 7267 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 446: /* signed_literal ::= NK_STRING */ -#line 846 "sql.y" + case 466: /* signed_literal ::= NK_STRING */ { yylhsminor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7273 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 447: /* signed_literal ::= NK_BOOL */ -#line 847 "sql.y" + case 467: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 7279 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 448: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 848 "sql.y" + case 468: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7285 "sql.c" break; - case 449: /* signed_literal ::= duration_literal */ - case 451: /* signed_literal ::= literal_func */ yytestcase(yyruleno==451); - case 527: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==527); - case 593: /* select_item ::= common_expression */ yytestcase(yyruleno==593); - case 603: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==603); - case 646: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==646); - case 648: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==648); - case 661: /* search_condition ::= common_expression */ yytestcase(yyruleno==661); -#line 849 "sql.y" + case 469: /* signed_literal ::= duration_literal */ + case 471: /* signed_literal ::= literal_func */ yytestcase(yyruleno==471); + case 547: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==547); + case 613: /* select_item ::= common_expression */ yytestcase(yyruleno==613); + case 623: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==623); + case 666: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==666); + case 668: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==668); + case 681: /* search_condition ::= common_expression */ yytestcase(yyruleno==681); { yylhsminor.yy718 = releaseRawExprNode(pCxt, yymsp[0].minor.yy718); } -#line 7297 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 450: /* signed_literal ::= NULL */ -#line 850 "sql.y" + case 470: /* signed_literal ::= NULL */ { yylhsminor.yy718 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 7303 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 452: /* signed_literal ::= NK_QUESTION */ -#line 852 "sql.y" + case 472: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy718 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 7309 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 470: /* expression ::= pseudo_column */ -#line 914 "sql.y" + case 490: /* expression ::= pseudo_column */ { yylhsminor.yy718 = yymsp[0].minor.yy718; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy718, true); } -#line 7315 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 474: /* expression ::= NK_LP expression NK_RP */ - case 561: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==561); - case 660: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==660); -#line 918 "sql.y" + case 494: /* expression ::= NK_LP expression NK_RP */ + case 581: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==581); + case 680: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==680); { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy718)); } -#line 7323 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 475: /* expression ::= NK_PLUS expr_or_subquery */ -#line 919 "sql.y" + case 495: /* expression ::= NK_PLUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy718)); } -#line 7332 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 476: /* expression ::= NK_MINUS expr_or_subquery */ -#line 923 "sql.y" + case 496: /* expression ::= NK_MINUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy718), NULL)); } -#line 7341 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 477: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 927 "sql.y" + case 497: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7351 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 478: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 932 "sql.y" + case 498: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7361 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 479: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 937 "sql.y" + case 499: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7371 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 480: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 942 "sql.y" + case 500: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7381 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 481: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 947 "sql.y" + case 501: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7391 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 482: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 952 "sql.y" + case 502: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 7400 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 483: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 956 "sql.y" + case 503: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7410 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 484: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 961 "sql.y" + case 504: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7420 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 487: /* column_reference ::= column_name */ -#line 972 "sql.y" + case 507: /* column_reference ::= column_name */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy965, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy965)); } -#line 7426 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 488: /* column_reference ::= table_name NK_DOT column_name */ -#line 973 "sql.y" + case 508: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965, createColumnNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy965)); } -#line 7432 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 489: /* column_reference ::= NK_ALIAS */ -#line 974 "sql.y" + case 509: /* column_reference ::= NK_ALIAS */ { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 7438 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 490: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -#line 975 "sql.y" + case 510: /* column_reference ::= table_name NK_DOT NK_ALIAS */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0)); } -#line 7444 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 491: /* pseudo_column ::= ROWTS */ - case 492: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==492); - case 494: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==494); - case 495: /* pseudo_column ::= QEND */ yytestcase(yyruleno==495); - case 496: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==496); - case 497: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==497); - case 498: /* pseudo_column ::= WEND */ yytestcase(yyruleno==498); - case 499: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==499); - case 500: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==500); - case 501: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==501); - case 502: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==502); - case 508: /* literal_func ::= NOW */ yytestcase(yyruleno==508); - case 509: /* literal_func ::= TODAY */ yytestcase(yyruleno==509); -#line 977 "sql.y" + case 511: /* pseudo_column ::= ROWTS */ + case 512: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==512); + case 514: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==514); + case 515: /* pseudo_column ::= QEND */ yytestcase(yyruleno==515); + case 516: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==516); + case 517: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==517); + case 518: /* pseudo_column ::= WEND */ yytestcase(yyruleno==518); + case 519: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==519); + case 520: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==520); + case 521: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==521); + case 522: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==522); + case 528: /* literal_func ::= NOW */ yytestcase(yyruleno==528); + case 529: /* literal_func ::= TODAY */ yytestcase(yyruleno==529); { yylhsminor.yy718 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 7462 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 493: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 979 "sql.y" + case 513: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy718 = 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 7468 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 503: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 504: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==504); -#line 990 "sql.y" + case 523: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 524: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==524); { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy965, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy965, yymsp[-1].minor.yy552)); } -#line 7475 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; - case 505: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -#line 993 "sql.y" + case 525: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), yymsp[-1].minor.yy224)); } -#line 7481 "sql.c" yymsp[-5].minor.yy718 = yylhsminor.yy718; break; - case 507: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 996 "sql.y" + case 527: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy965, NULL)); } -#line 7487 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 523: /* star_func_para_list ::= NK_STAR */ -#line 1021 "sql.y" + case 543: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy552 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 7493 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; break; - case 528: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 596: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==596); -#line 1030 "sql.y" + case 548: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 616: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==616); { yylhsminor.yy718 = createColumnNode(pCxt, &yymsp[-2].minor.yy965, &yymsp[0].minor.yy0); } -#line 7500 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 529: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 1033 "sql.y" + case 549: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy552, yymsp[-1].minor.yy718)); } -#line 7506 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; - case 530: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 1035 "sql.y" + case 550: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), yymsp[-2].minor.yy552, yymsp[-1].minor.yy718)); } -#line 7512 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; - case 533: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 1042 "sql.y" + case 553: /* when_then_expr ::= WHEN common_expression THEN common_expression */ { yymsp[-3].minor.yy718 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718)); } -#line 7518 "sql.c" break; - case 535: /* case_when_else_opt ::= ELSE common_expression */ -#line 1045 "sql.y" + case 555: /* case_when_else_opt ::= ELSE common_expression */ { yymsp[-1].minor.yy718 = releaseRawExprNode(pCxt, yymsp[0].minor.yy718); } -#line 7523 "sql.c" break; - case 536: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 541: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==541); -#line 1048 "sql.y" + case 556: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 561: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==561); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy810, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7533 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 537: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1055 "sql.y" + case 557: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy718), releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7543 "sql.c" yymsp[-4].minor.yy718 = yylhsminor.yy718; break; - case 538: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1061 "sql.y" + case 558: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy718), releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7553 "sql.c" yymsp[-5].minor.yy718 = yylhsminor.yy718; break; - case 539: /* predicate ::= expr_or_subquery IS NULL */ -#line 1066 "sql.y" + case 559: /* predicate ::= expr_or_subquery IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), NULL)); } -#line 7562 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 540: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 1070 "sql.y" + case 560: /* predicate ::= expr_or_subquery IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), NULL)); } -#line 7571 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; - case 542: /* compare_op ::= NK_LT */ -#line 1082 "sql.y" + case 562: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy810 = OP_TYPE_LOWER_THAN; } -#line 7577 "sql.c" break; - case 543: /* compare_op ::= NK_GT */ -#line 1083 "sql.y" + case 563: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy810 = OP_TYPE_GREATER_THAN; } -#line 7582 "sql.c" break; - case 544: /* compare_op ::= NK_LE */ -#line 1084 "sql.y" + case 564: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy810 = OP_TYPE_LOWER_EQUAL; } -#line 7587 "sql.c" break; - case 545: /* compare_op ::= NK_GE */ -#line 1085 "sql.y" + case 565: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy810 = OP_TYPE_GREATER_EQUAL; } -#line 7592 "sql.c" break; - case 546: /* compare_op ::= NK_NE */ -#line 1086 "sql.y" + case 566: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy810 = OP_TYPE_NOT_EQUAL; } -#line 7597 "sql.c" break; - case 547: /* compare_op ::= NK_EQ */ -#line 1087 "sql.y" + case 567: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy810 = OP_TYPE_EQUAL; } -#line 7602 "sql.c" break; - case 548: /* compare_op ::= LIKE */ -#line 1088 "sql.y" + case 568: /* compare_op ::= LIKE */ { yymsp[0].minor.yy810 = OP_TYPE_LIKE; } -#line 7607 "sql.c" break; - case 549: /* compare_op ::= NOT LIKE */ -#line 1089 "sql.y" + case 569: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy810 = OP_TYPE_NOT_LIKE; } -#line 7612 "sql.c" break; - case 550: /* compare_op ::= MATCH */ -#line 1090 "sql.y" + case 570: /* compare_op ::= MATCH */ { yymsp[0].minor.yy810 = OP_TYPE_MATCH; } -#line 7617 "sql.c" break; - case 551: /* compare_op ::= NMATCH */ -#line 1091 "sql.y" + case 571: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy810 = OP_TYPE_NMATCH; } -#line 7622 "sql.c" break; - case 552: /* compare_op ::= CONTAINS */ -#line 1092 "sql.y" + case 572: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy810 = OP_TYPE_JSON_CONTAINS; } -#line 7627 "sql.c" break; - case 553: /* in_op ::= IN */ -#line 1096 "sql.y" + case 573: /* in_op ::= IN */ { yymsp[0].minor.yy810 = OP_TYPE_IN; } -#line 7632 "sql.c" break; - case 554: /* in_op ::= NOT IN */ -#line 1097 "sql.y" + case 574: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy810 = OP_TYPE_NOT_IN; } -#line 7637 "sql.c" break; - case 555: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 1099 "sql.y" + case 575: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy552)); } -#line 7642 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 557: /* boolean_value_expression ::= NOT boolean_primary */ -#line 1103 "sql.y" + case 577: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy718), NULL)); } -#line 7651 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 558: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 1108 "sql.y" + case 578: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7661 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 559: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 1114 "sql.y" + case 579: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy718); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy718); yylhsminor.yy718 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7671 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 567: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1132 "sql.y" + case 587: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy718 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy718, yymsp[0].minor.yy718, NULL); } -#line 7677 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 570: /* table_primary ::= table_name alias_opt */ -#line 1138 "sql.y" + case 590: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy718 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 7683 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 571: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1139 "sql.y" + case 591: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy718 = createRealTableNode(pCxt, &yymsp[-3].minor.yy965, &yymsp[-1].minor.yy965, &yymsp[0].minor.yy965); } -#line 7689 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; - case 572: /* table_primary ::= subquery alias_opt */ -#line 1140 "sql.y" + case 592: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy718 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy718), &yymsp[0].minor.yy965); } -#line 7695 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 574: /* alias_opt ::= */ -#line 1145 "sql.y" + case 594: /* alias_opt ::= */ { yymsp[1].minor.yy965 = nil_token; } -#line 7701 "sql.c" break; - case 576: /* alias_opt ::= AS table_alias */ -#line 1147 "sql.y" + case 596: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy965 = yymsp[0].minor.yy965; } -#line 7706 "sql.c" break; - case 577: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 578: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==578); -#line 1149 "sql.y" + case 597: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 598: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==598); { yymsp[-2].minor.yy718 = yymsp[-1].minor.yy718; } -#line 7712 "sql.c" break; - case 579: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -#line 1154 "sql.y" + case 599: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy718 = createJoinTableNode(pCxt, yymsp[-4].minor.yy992, yymsp[-5].minor.yy718, yymsp[-2].minor.yy718, yymsp[0].minor.yy718); } -#line 7717 "sql.c" yymsp[-5].minor.yy718 = yylhsminor.yy718; break; - case 580: /* join_type ::= */ -#line 1158 "sql.y" + case 600: /* join_type ::= */ { yymsp[1].minor.yy992 = JOIN_TYPE_INNER; } -#line 7723 "sql.c" break; - case 581: /* join_type ::= INNER */ -#line 1159 "sql.y" + case 601: /* join_type ::= INNER */ { yymsp[0].minor.yy992 = JOIN_TYPE_INNER; } -#line 7728 "sql.c" break; - case 582: /* 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 1165 "sql.y" + case 602: /* 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.yy718 = createSelectStmt(pCxt, yymsp[-11].minor.yy559, yymsp[-9].minor.yy552, yymsp[-8].minor.yy718, yymsp[-12].minor.yy552); yymsp[-13].minor.yy718 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy718, yymsp[-10].minor.yy559); @@ -7741,234 +6678,151 @@ static YYACTIONTYPE yy_reduce( yymsp[-13].minor.yy718 = addEveryClause(pCxt, yymsp[-13].minor.yy718, yymsp[-4].minor.yy718); yymsp[-13].minor.yy718 = addFillClause(pCxt, yymsp[-13].minor.yy718, yymsp[-3].minor.yy718); } -#line 7744 "sql.c" break; - case 583: /* hint_list ::= */ -#line 1180 "sql.y" + case 603: /* hint_list ::= */ { yymsp[1].minor.yy552 = createHintNodeList(pCxt, NULL); } -#line 7749 "sql.c" break; - case 584: /* hint_list ::= NK_HINT */ -#line 1181 "sql.y" + case 604: /* hint_list ::= NK_HINT */ { yylhsminor.yy552 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 7754 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; break; - case 589: /* set_quantifier_opt ::= ALL */ -#line 1192 "sql.y" + case 609: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy559 = false; } -#line 7760 "sql.c" break; - case 592: /* select_item ::= NK_STAR */ -#line 1199 "sql.y" + case 612: /* select_item ::= NK_STAR */ { yylhsminor.yy718 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 7765 "sql.c" yymsp[0].minor.yy718 = yylhsminor.yy718; break; - case 594: /* select_item ::= common_expression column_alias */ - case 604: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==604); -#line 1201 "sql.y" + case 614: /* select_item ::= common_expression column_alias */ + case 624: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==624); { yylhsminor.yy718 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy718), &yymsp[0].minor.yy965); } -#line 7772 "sql.c" yymsp[-1].minor.yy718 = yylhsminor.yy718; break; - case 595: /* select_item ::= common_expression AS column_alias */ - case 605: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==605); -#line 1202 "sql.y" + case 615: /* select_item ::= common_expression AS column_alias */ + case 625: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==625); { yylhsminor.yy718 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), &yymsp[0].minor.yy965); } -#line 7779 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 600: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 630: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==630); - case 650: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==650); -#line 1211 "sql.y" + case 620: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 650: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==650); + case 670: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==670); { yymsp[-2].minor.yy552 = yymsp[0].minor.yy552; } -#line 7787 "sql.c" break; - case 607: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -#line 1224 "sql.y" + case 627: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ { yymsp[-5].minor.yy718 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), releaseRawExprNode(pCxt, yymsp[-1].minor.yy718)); } -#line 7792 "sql.c" break; - case 608: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1225 "sql.y" + case 628: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy718 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy718)); } -#line 7797 "sql.c" break; - case 609: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1227 "sql.y" + case 629: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy718 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), NULL, yymsp[-1].minor.yy718, yymsp[0].minor.yy718); } -#line 7802 "sql.c" break; - case 610: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1231 "sql.y" + case 630: /* 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.yy718 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy718), releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), yymsp[-1].minor.yy718, yymsp[0].minor.yy718); } -#line 7807 "sql.c" break; - case 611: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1233 "sql.y" + case 631: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ { yymsp[-6].minor.yy718 = createEventWindowNode(pCxt, yymsp[-3].minor.yy718, yymsp[0].minor.yy718); } -#line 7812 "sql.c" break; - case 612: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -#line 1235 "sql.y" + case 632: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy718 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } -#line 7817 "sql.c" break; - case 613: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 1237 "sql.y" + case 633: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy718 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } -#line 7822 "sql.c" break; - case 620: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1247 "sql.y" + case 640: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy718 = createFillNode(pCxt, yymsp[-1].minor.yy206, NULL); } -#line 7827 "sql.c" break; - case 621: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1248 "sql.y" + case 641: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy718 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy552)); } -#line 7832 "sql.c" break; - case 622: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1249 "sql.y" + case 642: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy718 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy552)); } -#line 7837 "sql.c" break; - case 623: /* fill_mode ::= NONE */ -#line 1253 "sql.y" + case 643: /* fill_mode ::= NONE */ { yymsp[0].minor.yy206 = FILL_MODE_NONE; } -#line 7842 "sql.c" break; - case 624: /* fill_mode ::= PREV */ -#line 1254 "sql.y" + case 644: /* fill_mode ::= PREV */ { yymsp[0].minor.yy206 = FILL_MODE_PREV; } -#line 7847 "sql.c" break; - case 625: /* fill_mode ::= NULL */ -#line 1255 "sql.y" + case 645: /* fill_mode ::= NULL */ { yymsp[0].minor.yy206 = FILL_MODE_NULL; } -#line 7852 "sql.c" break; - case 626: /* fill_mode ::= NULL_F */ -#line 1256 "sql.y" + case 646: /* fill_mode ::= NULL_F */ { yymsp[0].minor.yy206 = FILL_MODE_NULL_F; } -#line 7857 "sql.c" break; - case 627: /* fill_mode ::= LINEAR */ -#line 1257 "sql.y" + case 647: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy206 = FILL_MODE_LINEAR; } -#line 7862 "sql.c" break; - case 628: /* fill_mode ::= NEXT */ -#line 1258 "sql.y" + case 648: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy206 = FILL_MODE_NEXT; } -#line 7867 "sql.c" break; - case 631: /* group_by_list ::= expr_or_subquery */ -#line 1267 "sql.y" + case 651: /* group_by_list ::= expr_or_subquery */ { yylhsminor.yy552 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7872 "sql.c" yymsp[0].minor.yy552 = yylhsminor.yy552; break; - case 632: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1268 "sql.y" + case 652: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ { yylhsminor.yy552 = addNodeToList(pCxt, yymsp[-2].minor.yy552, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy718))); } -#line 7878 "sql.c" yymsp[-2].minor.yy552 = yylhsminor.yy552; break; - case 636: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1275 "sql.y" + case 656: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ { yymsp[-5].minor.yy718 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy718), releaseRawExprNode(pCxt, yymsp[-1].minor.yy718)); } -#line 7884 "sql.c" break; - case 637: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1277 "sql.y" + case 657: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy718 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy718)); } -#line 7889 "sql.c" break; - case 640: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1284 "sql.y" + case 660: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy718 = addOrderByClause(pCxt, yymsp[-3].minor.yy718, yymsp[-2].minor.yy552); yylhsminor.yy718 = addSlimitClause(pCxt, yylhsminor.yy718, yymsp[-1].minor.yy718); yylhsminor.yy718 = addLimitClause(pCxt, yylhsminor.yy718, yymsp[0].minor.yy718); } -#line 7898 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; - case 643: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1294 "sql.y" + case 663: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ { yylhsminor.yy718 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy718, yymsp[0].minor.yy718); } -#line 7904 "sql.c" yymsp[-3].minor.yy718 = yylhsminor.yy718; break; - case 644: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1296 "sql.y" + case 664: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ { yylhsminor.yy718 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy718, yymsp[0].minor.yy718); } -#line 7910 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 652: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 656: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==656); -#line 1310 "sql.y" + case 672: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 676: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==676); { yymsp[-1].minor.yy718 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 7917 "sql.c" break; - case 653: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 657: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==657); -#line 1311 "sql.y" + case 673: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 677: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==677); { yymsp[-3].minor.yy718 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 7923 "sql.c" break; - case 654: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 658: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==658); -#line 1312 "sql.y" + case 674: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 678: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==678); { yymsp[-3].minor.yy718 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 7929 "sql.c" break; - case 659: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1320 "sql.y" + case 679: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy718 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy718); } -#line 7934 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 664: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1334 "sql.y" + case 684: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ { yylhsminor.yy718 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy718), yymsp[-1].minor.yy576, yymsp[0].minor.yy345); } -#line 7940 "sql.c" yymsp[-2].minor.yy718 = yylhsminor.yy718; break; - case 665: /* ordering_specification_opt ::= */ -#line 1338 "sql.y" + case 685: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy576 = ORDER_ASC; } -#line 7946 "sql.c" break; - case 666: /* ordering_specification_opt ::= ASC */ -#line 1339 "sql.y" + case 686: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy576 = ORDER_ASC; } -#line 7951 "sql.c" break; - case 667: /* ordering_specification_opt ::= DESC */ -#line 1340 "sql.y" + case 687: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy576 = ORDER_DESC; } -#line 7956 "sql.c" break; - case 668: /* null_ordering_opt ::= */ -#line 1344 "sql.y" + case 688: /* null_ordering_opt ::= */ { yymsp[1].minor.yy345 = NULL_ORDER_DEFAULT; } -#line 7961 "sql.c" break; - case 669: /* null_ordering_opt ::= NULLS FIRST */ -#line 1345 "sql.y" + case 689: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy345 = NULL_ORDER_FIRST; } -#line 7966 "sql.c" break; - case 670: /* null_ordering_opt ::= NULLS LAST */ -#line 1346 "sql.y" + case 690: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy345 = NULL_ORDER_LAST; } -#line 7971 "sql.c" break; default: break; @@ -8030,7 +6884,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) { @@ -8041,7 +6894,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 8044 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE @@ -8127,56 +6979,12 @@ void Parse( } #endif - while(1){ /* Exit by "break" */ - assert( yypParser->yytos>=yypParser->yystack ); + do{ assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ -#ifndef NDEBUG - assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); - if( yyTraceFILE ){ - int yysize = yyRuleInfoNRhs[yyruleno]; - if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos[yysize].stateno); - }else{ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", - yyTracePrompt, yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == - (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - break; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - break; - } - } -#endif - } - yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM); + yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, + yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY @@ -8232,13 +7040,14 @@ void Parse( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos > yypParser->yystack ){ - yyact = yy_find_reduce_action(yypParser->yytos->stateno, - YYERRORSYMBOL); - if( yyact<=YY_MAX_SHIFTREDUCE ) break; + while( yypParser->yytos >= yypParser->yystack + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, + YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE + ){ yy_pop_parser_stack(yypParser); } - if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY @@ -8288,7 +7097,7 @@ void Parse( break; #endif } - } + }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; diff --git a/tests/script/tsim/parser/columnValue_bool.sim b/tests/script/tsim/parser/columnValue_bool.sim index db89db4256..97d074a6f9 100644 --- a/tests/script/tsim/parser/columnValue_bool.sim +++ b/tests/script/tsim/parser/columnValue_bool.sim @@ -936,6 +936,9 @@ sql_error alter table st_bool_i1 set tag tagname="123abc" sql alter table st_bool_i2 set tag tagname="123" sql_error alter table st_bool_i3 set tag tagname=abc sql_error alter table st_bool_i4 set tag tagname="abc" +sql_error alter table st_bool_i4 set tag tagname=now +sql_error alter table st_bool_i4 set tag tagname=now()+1d +sql_error alter table st_bool_i4 set tag tagname=1+1d sql_error alter table st_bool_i5 set tag tagname=" " sql_error alter table st_bool_i6 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_int.sim b/tests/script/tsim/parser/columnValue_int.sim index f03a576ae3..f022c33363 100644 --- a/tests/script/tsim/parser/columnValue_int.sim +++ b/tests/script/tsim/parser/columnValue_int.sim @@ -913,6 +913,8 @@ sql_error alter table st_int_e19 set tag tagname=123abc sql_error alter table st_int_e20 set tag tagname="123abc" sql_error alter table st_int_e22 set tag tagname=abc sql_error alter table st_int_e23 set tag tagname="abc" +sql_error alter table st_int_e25 set tag tagname=1+1d +sql_error alter table st_int_e25 set tag tagname="1"+1d sql_error alter table st_int_e24 set tag tagname=" " sql_error alter table st_int_e25 set tag tagname='' sql alter table st_int_e26_1 set tag tagname='123' diff --git a/tests/script/tsim/parser/columnValue_timestamp.sim b/tests/script/tsim/parser/columnValue_timestamp.sim index 1f457dbd7c..962dff4a89 100644 --- a/tests/script/tsim/parser/columnValue_timestamp.sim +++ b/tests/script/tsim/parser/columnValue_timestamp.sim @@ -132,6 +132,61 @@ sql show tags from st_timestamp_22 if $data05 != -1 then return -1 endi +sql create table st_timestamp_23 using mt_timestamp tags (1+ 1d ) +sql show tags from st_timestamp_23 +if $data05 != 86400001 then + return -1 +endi +sql create table st_timestamp_24 using mt_timestamp tags (-0 + 1d) +sql show tags from st_timestamp_24 +if $data05 != 86400000 then + return -1 +endi +sql create table st_timestamp_25 using mt_timestamp tags ("-0" -1s) +sql show tags from st_timestamp_25 +if $data05 != -1000 then + return -1 +endi +sql create table st_timestamp_26 using mt_timestamp tags (0b01 -1a) +sql show tags from st_timestamp_26 +if $data05 != 0 then + return -1 +endi +sql create table st_timestamp_27 using mt_timestamp tags (0b01 -1s) +sql show tags from st_timestamp_27 +if $data05 != -999 then + return -1 +endi +sql create table st_timestamp_28 using mt_timestamp tags ("0x01" +1u) +sql show tags from st_timestamp_28 +if $data05 != 1 then + return -1 +endi +sql create table st_timestamp_29 using mt_timestamp tags (0x01 +1b) +sql show tags from st_timestamp_29 +if $data05 != 1 then + return -1 +endi +sql create table st_timestamp_30 using mt_timestamp tags (now +1b) +sql show tags from st_timestamp_30 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_31 using mt_timestamp tags ("now()" +1b) +sql show tags from st_timestamp_31 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_32 using mt_timestamp tags (today() +1d) +sql show tags from st_timestamp_32 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_33 using mt_timestamp tags ("today()" +1d) +sql show tags from st_timestamp_33 +if $data05 < 1711883186000 then + return -1 +endi ## case 01: insert values for test column values sql insert into st_timestamp_0 values(now,NULL) @@ -249,6 +304,61 @@ sql select ts, cast(c as bigint) from st_timestamp_22 if $data01 != -1 then return -1 endi +sql insert into st_timestamp_23 values(now,1+ 1d ) +sql select ts, cast(c as bigint) from st_timestamp_23 +if $data01 != 86400001 then + return -1 +endi +sql insert into st_timestamp_24 values(now,-0 + 1d) +sql select ts, cast(c as bigint) from st_timestamp_24 +if $data01 != 86400000 then + return -1 +endi +sql insert into st_timestamp_25 values(now,"-0" -1s) +sql select ts, cast(c as bigint) from st_timestamp_25 +if $data01 != -1000 then + return -1 +endi +sql insert into st_timestamp_26 values(now,0b01 -1a) +sql select ts, cast(c as bigint) from st_timestamp_26 +if $data01 != 0 then + return -1 +endi +sql insert into st_timestamp_27 values(now,0b01 -1s) +sql select ts, cast(c as bigint) from st_timestamp_27 +if $data01 != -999 then + return -1 +endi +sql insert into st_timestamp_28 values(now,"0x01" +1u) +sql select ts, cast(c as bigint) from st_timestamp_28 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_29 values(now,0x01 +1b) +sql select ts, cast(c as bigint) from st_timestamp_29 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_30 values(now,now +1b) +sql select ts, cast(c as bigint) from st_timestamp_30 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_31 values(now,"now()" +1b) +sql select ts, cast(c as bigint) from st_timestamp_31 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_32 values(now,today() +1d) +sql select ts, cast(c as bigint) from st_timestamp_32 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_33 values(now,"today()" +1d) +sql select ts, cast(c as bigint) from st_timestamp_33 +if $data01 < 1711883186000 then + return -1 +endi ## case 02: dynamic create table for test tag values sql insert into st_timestamp_100 using mt_timestamp tags(NULL) values(now, NULL) @@ -450,6 +560,107 @@ sql select ts, cast(c as bigint) from st_timestamp_1022 if $data01 != -1 then return -1 endi +sql insert into st_timestamp_1023 using mt_timestamp tags(1+1d) values(now,1+ 1d ) +sql show tags from st_timestamp_1023 +if $data05 != 86400001 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1023 +if $data01 != 86400001 then + return -1 +endi +sql insert into st_timestamp_1024 using mt_timestamp tags(-0+1d) values(now,-0 + 1d) +sql show tags from st_timestamp_1024 +if $data05 != 86400000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1024 +if $data01 != 86400000 then + return -1 +endi +sql insert into st_timestamp_1025 using mt_timestamp tags("-0" -1s) values(now,"-0" -1s) +sql show tags from st_timestamp_1025 +if $data05 != -1000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1025 +if $data01 != -1000 then + return -1 +endi +sql insert into st_timestamp_1026 using mt_timestamp tags(0b01-1a) values(now,0b01 -1a) +sql show tags from st_timestamp_1026 +if $data05 != 0 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1026 +if $data01 != 0 then + return -1 +endi +sql insert into st_timestamp_1027 using mt_timestamp tags(0b01-1s) values(now,0b01 -1s) +sql show tags from st_timestamp_1027 +if $data05 != -999 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1027 +if $data01 != -999 then + return -1 +endi +sql insert into st_timestamp_1028 using mt_timestamp tags("0x01" + 1u) values(now,"0x01" +1u) +sql show tags from st_timestamp_1028 +if $data05 != 1 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1028 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_1029 using mt_timestamp tags(0x01 +1b) values(now,0x01 +1b) +sql show tags from st_timestamp_1029 +if $data05 != 1 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1029 +if $data01 != 1 then + return -1 +endi +sql insert into st_timestamp_1030 using mt_timestamp tags(now+1b) values(now,now +1b) +sql show tags from st_timestamp_1030 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1030 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1031 using mt_timestamp tags("now" +1b) values(now,"now()" +1b) +sql show tags from st_timestamp_1031 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1031 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1032 using mt_timestamp tags(today() + 1d) values(now,today() +1d) +sql show tags from st_timestamp_1032 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1032 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1033 using mt_timestamp tags("today" +1d) values(now,"today()" +1d) +sql show tags from st_timestamp_1033 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1033 +if $data01 < 1711883186000 then + return -1 +endi + + ### case 03: alter tag values sql alter table st_timestamp_0 set tag tagname=NULL @@ -567,12 +778,70 @@ sql show tags from st_timestamp_22 if $data05 != -1 then return -1 endi +sql alter table st_timestamp_23 set tag tagname=1+ 1d +sql show tags from st_timestamp_23 +if $data05 != 86400001 then + return -1 +endi +sql alter table st_timestamp_24 set tag tagname=-0 + 1d +sql show tags from st_timestamp_24 +if $data05 != 86400000 then + return -1 +endi +sql alter table st_timestamp_25 set tag tagname="-0" -1s +sql show tags from st_timestamp_25 +if $data05 != -1000 then + return -1 +endi +sql alter table st_timestamp_26 set tag tagname=0b01 -1a +sql show tags from st_timestamp_26 +if $data05 != 0 then + return -1 +endi +sql alter table st_timestamp_27 set tag tagname=0b01 -1s +sql show tags from st_timestamp_27 +if $data05 != -999 then + return -1 +endi +sql alter table st_timestamp_28 set tag tagname="0x01" +1u +sql show tags from st_timestamp_28 +if $data05 != 1 then + return -1 +endi +sql alter table st_timestamp_29 set tag tagname=0x01 +1b +sql show tags from st_timestamp_29 +if $data05 != 1 then + return -1 +endi +sql alter table st_timestamp_30 set tag tagname=now +1b +sql show tags from st_timestamp_30 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_31 set tag tagname="now()" +1b +sql show tags from st_timestamp_31 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_32 set tag tagname=today( ) +1d +sql show tags from st_timestamp_32 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_33 set tag tagname="today()" +1d +sql show tags from st_timestamp_33 +if $data05 < 1711883186000 then + return -1 +endi ## case 04: illegal input sql_error create table st_timestamp_e0 using mt_timestamp tags (123abc) sql_error create table st_timestamp_e0 using mt_timestamp tags ("123abc") sql_error create table st_timestamp_e0 using mt_timestamp tags (abc) sql_error create table st_timestamp_e0 using mt_timestamp tags ("abc") +sql_error create table st_timestamp_e0 using mt_timestamp tags (now()+1d+1s) +sql_error create table st_timestamp_e0 using mt_timestamp tags (1+1y) +sql_error create table st_timestamp_e0 using mt_timestamp tags (0x01+1b+1a) sql_error create table st_timestamp_e0 using mt_timestamp tags (" ") sql_error create table st_timestamp_e0 using mt_timestamp tags ('') sql_error create table st_timestamp_104 using mt_timestamp tags ("-123.1") @@ -590,5 +859,7 @@ sql_error create table st_timestamp_115 using mt_timestamp tags (922337203685477 sql create table st_timestamp_116 using mt_timestamp tags (-9223372036854775808) sql_error create table st_timestamp_117 using mt_timestamp tags (-9223372036854775809) sql_error insert into st_timestamp_118 using mt_timestamp tags(9223372036854775807) values(9223372036854775807, 9223372036854775807) +sql_error insert into st_timestamp_119 using mt_timestamp tags(1+1s-1s) values(now, now) +sql_error insert into st_timestamp_120 using mt_timestamp tags(1-1s) values(now, now-1s+1d) system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_varbinary.sim b/tests/script/tsim/parser/columnValue_varbinary.sim index 1db1054646..eb437f7597 100644 --- a/tests/script/tsim/parser/columnValue_varbinary.sim +++ b/tests/script/tsim/parser/columnValue_varbinary.sim @@ -299,6 +299,8 @@ sql_error create table st_varbinary_1012 using mt_varbinary tags(tRue) sql_error create table st_varbinary_1013 using mt_varbinary tags(FalsE) sql_error create table st_varbinary_1014 using mt_varbinary tags(noW) sql_error create table st_varbinary_1015 using mt_varbinary tags(toDay) +sql_error create table st_varbinary_1016 using mt_varbinary tags(now()+1s) +sql_error create table st_varbinary_1017 using mt_varbinary tags(1+1s) sql_error insert into st_varbinary_106 using mt_varbinary tags(+0123) values(now, NULL); sql_error insert into st_varbinary_107 using mt_varbinary tags(-01.23) values(now, NULL); sql_error insert into st_varbinary_108 using mt_varbinary tags(+0x01) values(now, NULL); @@ -309,6 +311,8 @@ sql_error insert into st_varbinary_1012 using mt_varbinary tags(tRue) values(no sql_error insert into st_varbinary_1013 using mt_varbinary tags(FalsE) values(now, NULL); sql_error insert into st_varbinary_1014 using mt_varbinary tags(noW) values(now, NULL); sql_error insert into st_varbinary_1015 using mt_varbinary tags(toDay) values(now, NULL); +sql_error insert into st_varbinary_1016 using mt_varbinary tags(now()+1s) values(now, NULL); +sql_error insert into st_varbinary_1017 using mt_varbinary tags(1+1s) values(now, NULL); sql_error insert into st_varbinary_106 using mt_varbinary tags(NULL) values(now(), +0123) sql_error insert into st_varbinary_107 using mt_varbinary tags(NULL) values(now(), -01.23) sql_error insert into st_varbinary_108 using mt_varbinary tags(NULL) values(now(), +0x01) @@ -319,5 +323,7 @@ sql_error insert into st_varbinary_1012 using mt_varbinary tags(NULL) values(no sql_error insert into st_varbinary_1013 using mt_varbinary tags(NULL) values(now(), FalsE) sql_error insert into st_varbinary_1014 using mt_varbinary tags(NULL) values(now(), noW) sql_error insert into st_varbinary_1015 using mt_varbinary tags(NULL) values(now(), toDay) +sql_error insert into st_varbinary_1016 using mt_varbinary tags(NULL) values(now(), now()+1s) +sql_error insert into st_varbinary_1017 using mt_varbinary tags(NULL) values(now(), 1+1s) system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_varchar.sim b/tests/script/tsim/parser/columnValue_varchar.sim index 5edfe5ed24..b705f3069a 100644 --- a/tests/script/tsim/parser/columnValue_varchar.sim +++ b/tests/script/tsim/parser/columnValue_varchar.sim @@ -410,6 +410,17 @@ endi # case 04: illegal input +sql_error create table st_varchar_100 using mt_varchar tags(now+1d) +sql_error create table st_varchar_101 using mt_varchar tags(toDay+1d) +sql_error create table st_varchar_102 using mt_varchar tags(1+1b) +sql_error create table st_varchar_103 using mt_varchar tags(0x01+1d) +sql_error create table st_varchar_104 using mt_varchar tags(0b01+1s) +sql_error insert into st_varchar_1100 using mt_varchar tags('now') values(now(),now+1d) +sql_error insert into st_varchar_1101 using mt_varchar tags('now') values(now(),toDay+1d) +sql_error insert into st_varchar_1102 using mt_varchar tags('now') values(now(),1+1b) +sql_error insert into st_varchar_1103 using mt_varchar tags('now') values(now(),0x01+1d) +sql_error insert into st_varchar_1104 using mt_varchar tags('now') values(now(),0b01+1s) +sql_error alter table st_varchar_15 set tag tagname=now()+1d system sh/exec.sh -n dnode1 -s stop -x SIGINT From 0fc8872fc11b893d637c868f37f1f97ae5bd6a7c Mon Sep 17 00:00:00 2001 From: kailixu Date: Sun, 31 Mar 2024 21:34:29 +0800 Subject: [PATCH 043/106] test: more test case for timestamp --- .../tsim/parser/columnValue_timestamp.sim | 155 +++++++++++++----- 1 file changed, 115 insertions(+), 40 deletions(-) diff --git a/tests/script/tsim/parser/columnValue_timestamp.sim b/tests/script/tsim/parser/columnValue_timestamp.sim index 962dff4a89..4334230a05 100644 --- a/tests/script/tsim/parser/columnValue_timestamp.sim +++ b/tests/script/tsim/parser/columnValue_timestamp.sim @@ -167,26 +167,42 @@ sql show tags from st_timestamp_29 if $data05 != 1 then return -1 endi -sql create table st_timestamp_30 using mt_timestamp tags (now +1b) +sql create table st_timestamp_30 using mt_timestamp tags (-0b00 -0a) sql show tags from st_timestamp_30 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi -sql create table st_timestamp_31 using mt_timestamp tags ("now()" +1b) +sql create table st_timestamp_31 using mt_timestamp tags ("-0x00" +1u) sql show tags from st_timestamp_31 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi -sql create table st_timestamp_32 using mt_timestamp tags (today() +1d) +sql create table st_timestamp_32 using mt_timestamp tags (-0x00 +1b) sql show tags from st_timestamp_32 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi -sql create table st_timestamp_33 using mt_timestamp tags ("today()" +1d) +sql create table st_timestamp_33 using mt_timestamp tags (now +1b) sql show tags from st_timestamp_33 if $data05 < 1711883186000 then return -1 endi +sql create table st_timestamp_34 using mt_timestamp tags ("now()" +1b) +sql show tags from st_timestamp_34 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_35 using mt_timestamp tags (today() +1d) +sql show tags from st_timestamp_35 +if $data05 < 1711883186000 then + return -1 +endi +sql create table st_timestamp_36 using mt_timestamp tags ("today()" +1d) +sql show tags from st_timestamp_36 +if $data05 < 1711883186000 then + return -1 +endi + ## case 01: insert values for test column values sql insert into st_timestamp_0 values(now,NULL) @@ -324,12 +340,12 @@ sql select ts, cast(c as bigint) from st_timestamp_26 if $data01 != 0 then return -1 endi -sql insert into st_timestamp_27 values(now,0b01 -1s) +sql insert into st_timestamp_27 values(now,+0b01 -1s) sql select ts, cast(c as bigint) from st_timestamp_27 if $data01 != -999 then return -1 endi -sql insert into st_timestamp_28 values(now,"0x01" +1u) +sql insert into st_timestamp_28 values(now,"+0x01" +1u) sql select ts, cast(c as bigint) from st_timestamp_28 if $data01 != 1 then return -1 @@ -339,26 +355,41 @@ sql select ts, cast(c as bigint) from st_timestamp_29 if $data01 != 1 then return -1 endi -sql insert into st_timestamp_30 values(now,now +1b) -sql select ts, cast(c as bigint) from st_timestamp_30 -if $data01 < 1711883186000 then +sql insert into st_timestamp_30 values(now,-0b00 -0a) +sql show tags from st_timestamp_30 +if $data05 != 0 then return -1 endi -sql insert into st_timestamp_31 values(now,"now()" +1b) -sql select ts, cast(c as bigint) from st_timestamp_31 -if $data01 < 1711883186000 then +sql insert into st_timestamp_31 values(now,"-0x00" +1u) +sql show tags from st_timestamp_31 +if $data05 != 0 then return -1 endi -sql insert into st_timestamp_32 values(now,today() +1d) -sql select ts, cast(c as bigint) from st_timestamp_32 -if $data01 < 1711883186000 then +sql insert into st_timestamp_32 values (now,-0x00 +1b) +sql show tags from st_timestamp_32 +if $data05 != 0 then return -1 endi -sql insert into st_timestamp_33 values(now,"today()" +1d) +sql insert into st_timestamp_33 values(now,now +1b) sql select ts, cast(c as bigint) from st_timestamp_33 if $data01 < 1711883186000 then return -1 endi +sql insert into st_timestamp_34 values(now,"now()" +1b) +sql select ts, cast(c as bigint) from st_timestamp_34 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_35 values(now,today() +1d) +sql select ts, cast(c as bigint) from st_timestamp_35 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_36 values(now,"today()" +1d) +sql select ts, cast(c as bigint) from st_timestamp_36 +if $data01 < 1711883186000 then + return -1 +endi ## case 02: dynamic create table for test tag values sql insert into st_timestamp_100 using mt_timestamp tags(NULL) values(now, NULL) @@ -560,7 +591,7 @@ sql select ts, cast(c as bigint) from st_timestamp_1022 if $data01 != -1 then return -1 endi -sql insert into st_timestamp_1023 using mt_timestamp tags(1+1d) values(now,1+ 1d ) +sql insert into st_timestamp_1023 using mt_timestamp tags(+1+1d) values(now,+1+ 1d ) sql show tags from st_timestamp_1023 if $data05 != 86400001 then return -1 @@ -587,7 +618,7 @@ sql select ts, cast(c as bigint) from st_timestamp_1025 if $data01 != -1000 then return -1 endi -sql insert into st_timestamp_1026 using mt_timestamp tags(0b01-1a) values(now,0b01 -1a) +sql insert into st_timestamp_1026 using mt_timestamp tags(+0b01-1a) values(now,+0b01 -1a) sql show tags from st_timestamp_1026 if $data05 != 0 then return -1 @@ -614,7 +645,7 @@ sql select ts, cast(c as bigint) from st_timestamp_1028 if $data01 != 1 then return -1 endi -sql insert into st_timestamp_1029 using mt_timestamp tags(0x01 +1b) values(now,0x01 +1b) +sql insert into st_timestamp_1029 using mt_timestamp tags(+0x01 +1b) values(now,+0x01 +1b) sql show tags from st_timestamp_1029 if $data05 != 1 then return -1 @@ -623,34 +654,34 @@ sql select ts, cast(c as bigint) from st_timestamp_1029 if $data01 != 1 then return -1 endi -sql insert into st_timestamp_1030 using mt_timestamp tags(now+1b) values(now,now +1b) +sql insert into st_timestamp_1030 using mt_timestamp tags (-0b00 -0a) values(now,-0b00 -0a) sql show tags from st_timestamp_1030 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi sql select ts, cast(c as bigint) from st_timestamp_1030 -if $data01 < 1711883186000 then +if $data01 != 0 then return -1 endi -sql insert into st_timestamp_1031 using mt_timestamp tags("now" +1b) values(now,"now()" +1b) +sql insert into st_timestamp_1031 using mt_timestamp tags ("-0x00" +1u) values(now,"-0x00" +1u) sql show tags from st_timestamp_1031 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi sql select ts, cast(c as bigint) from st_timestamp_1031 -if $data01 < 1711883186000 then +if $data01 != 0 then return -1 endi -sql insert into st_timestamp_1032 using mt_timestamp tags(today() + 1d) values(now,today() +1d) +sql insert into st_timestamp_1032 using mt_timestamp tags (-0x00 +1b) values(now,-0x00 +1b) sql show tags from st_timestamp_1032 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi sql select ts, cast(c as bigint) from st_timestamp_1032 -if $data01 < 1711883186000 then +if $data01 != 0 then return -1 endi -sql insert into st_timestamp_1033 using mt_timestamp tags("today" +1d) values(now,"today()" +1d) +sql insert into st_timestamp_1033 using mt_timestamp tags(now+1b) values(now,now +1b) sql show tags from st_timestamp_1033 if $data05 < 1711883186000 then return -1 @@ -659,6 +690,35 @@ sql select ts, cast(c as bigint) from st_timestamp_1033 if $data01 < 1711883186000 then return -1 endi +sql insert into st_timestamp_1034 using mt_timestamp tags("now" +1b) values(now,"now()" +1b) +sql show tags from st_timestamp_1034 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1034 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1035 using mt_timestamp tags(today() + 1d) values(now,today() +1d) +sql show tags from st_timestamp_1035 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1035 +if $data01 < 1711883186000 then + return -1 +endi +sql insert into st_timestamp_1036 using mt_timestamp tags("today" +1d) values(now,"today()" +1d) +sql show tags from st_timestamp_1036 +if $data05 < 1711883186000 then + return -1 +endi +sql select ts, cast(c as bigint) from st_timestamp_1036 +if $data01 < 1711883186000 then + return -1 +endi + + @@ -793,7 +853,7 @@ sql show tags from st_timestamp_25 if $data05 != -1000 then return -1 endi -sql alter table st_timestamp_26 set tag tagname=0b01 -1a +sql alter table st_timestamp_26 set tag tagname=+0b01 -1a sql show tags from st_timestamp_26 if $data05 != 0 then return -1 @@ -813,23 +873,38 @@ sql show tags from st_timestamp_29 if $data05 != 1 then return -1 endi -sql alter table st_timestamp_30 set tag tagname=now +1b +sql alter table st_timestamp_30 set tag tagname==-0b00 -0a sql show tags from st_timestamp_30 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi -sql alter table st_timestamp_31 set tag tagname="now()" +1b +sql alter table st_timestamp_31 set tag tagname="-0x00" +1u sql show tags from st_timestamp_31 -if $data05 < 1711883186000 then +if $data05 != 0 then return -1 endi -sql alter table st_timestamp_32 set tag tagname=today( ) +1d +sql alter table st_timestamp_32 set tag tagname=-0x00 +1b sql show tags from st_timestamp_32 +if $data05 != 0 then + return -1 +endi +sql alter table st_timestamp_33 set tag tagname=now +1b +sql show tags from st_timestamp_33 if $data05 < 1711883186000 then return -1 endi -sql alter table st_timestamp_33 set tag tagname="today()" +1d -sql show tags from st_timestamp_33 +sql alter table st_timestamp_34 set tag tagname="now()" +1b +sql show tags from st_timestamp_34 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_35 set tag tagname=today( ) +1d +sql show tags from st_timestamp_35 +if $data05 < 1711883186000 then + return -1 +endi +sql alter table st_timestamp_36 set tag tagname="today()" +1d +sql show tags from st_timestamp_36 if $data05 < 1711883186000 then return -1 endi From 503c93585d00eb9935ef1b0c60d14084537d08e6 Mon Sep 17 00:00:00 2001 From: Adam Ji Date: Mon, 1 Apr 2024 14:44:27 +0800 Subject: [PATCH 044/106] enh: update taosws feature to rustls --- tools/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index a1c5405253..518e97a219 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -57,7 +57,7 @@ IF (TD_WEBSOCKET) COMMAND git clean -f -d BUILD_COMMAND COMMAND cargo update - COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored + COMMAND cargo build --release -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include From 9bedb4922aec3af2fd5f28959a85dd1de882038a Mon Sep 17 00:00:00 2001 From: danielclow <106956386+danielclow@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:46:25 +0800 Subject: [PATCH 045/106] docs: adjust titles for seo compliance for 3.0 branch --- docs/en/12-taos-sql/05-insert.md | 2 +- docs/en/12-taos-sql/13-tmq.md | 2 +- docs/en/12-taos-sql/14-stream.md | 2 +- docs/en/12-taos-sql/26-udf.md | 2 +- docs/en/14-reference/07-tdinsight/index.md | 2 +- docs/en/25-application/01-telegraf.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/en/12-taos-sql/05-insert.md b/docs/en/12-taos-sql/05-insert.md index 462e7fc0ae..32227a2214 100644 --- a/docs/en/12-taos-sql/05-insert.md +++ b/docs/en/12-taos-sql/05-insert.md @@ -1,7 +1,7 @@ --- title: Insert sidebar_label: Insert -description: This document describes how to insert data into TDengine. +description: This document describes the SQL commands and syntax for inserting data into TDengine. --- ## Syntax diff --git a/docs/en/12-taos-sql/13-tmq.md b/docs/en/12-taos-sql/13-tmq.md index d14b6da2d3..16dc9efd62 100644 --- a/docs/en/12-taos-sql/13-tmq.md +++ b/docs/en/12-taos-sql/13-tmq.md @@ -1,5 +1,5 @@ --- -title: Data Subscription +title: Data Subscription SQL Reference sidebar_label: Data Subscription description: This document describes the SQL statements related to the data subscription component of TDengine. --- diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md index e1bf18c854..c41839390f 100644 --- a/docs/en/12-taos-sql/14-stream.md +++ b/docs/en/12-taos-sql/14-stream.md @@ -1,5 +1,5 @@ --- -title: Stream Processing +title: Stream Processing SQL Reference sidebar_label: Stream Processing description: This document describes the SQL statements related to the stream processing component of TDengine. --- diff --git a/docs/en/12-taos-sql/26-udf.md b/docs/en/12-taos-sql/26-udf.md index f86b535927..dec9ca217d 100644 --- a/docs/en/12-taos-sql/26-udf.md +++ b/docs/en/12-taos-sql/26-udf.md @@ -1,5 +1,5 @@ --- -title: User-Defined Functions (UDF) +title: User-Defined Functions (UDF) SQL Reference sidebar_label: User-Defined Functions description: This document describes the SQL statements related to user-defined functions (UDF) in TDengine. --- diff --git a/docs/en/14-reference/07-tdinsight/index.md b/docs/en/14-reference/07-tdinsight/index.md index cada05d738..1bc983262e 100644 --- a/docs/en/14-reference/07-tdinsight/index.md +++ b/docs/en/14-reference/07-tdinsight/index.md @@ -1,5 +1,5 @@ --- -title: TDinsight - Grafana-based Zero-Dependency Monitoring Solution for TDengine +title: TDinsight sidebar_label: TDinsight description: This document describes TDinsight, a monitoring solution for TDengine. --- diff --git a/docs/en/25-application/01-telegraf.md b/docs/en/25-application/01-telegraf.md index a6db826fa3..f8784e9ab9 100644 --- a/docs/en/25-application/01-telegraf.md +++ b/docs/en/25-application/01-telegraf.md @@ -1,5 +1,5 @@ --- -title: Quickly Build IT DevOps Visualization System with TDengine + Telegraf + Grafana +title: IT Visualization with TDengine + Telegraf + Grafana sidebar_label: TDengine + Telegraf + Grafana description: This document describes how to create an IT visualization system by integrating TDengine with Telegraf and Grafana. --- From 529eadb921de275e2622129f2fc817b5fb2b6228 Mon Sep 17 00:00:00 2001 From: Adam Ji Date: Mon, 1 Apr 2024 16:15:26 +0800 Subject: [PATCH 046/106] enh: update taosws feature to rustls --- tools/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 518e97a219..188abb4b58 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -18,7 +18,7 @@ IF (TD_WEBSOCKET) COMMAND git clean -f -d BUILD_COMMAND COMMAND cargo update - COMMAND RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release -p taos-ws-sys --features native-tls + COMMAND RUSTFLAGS=-Ctarget-feature=-crt-static cargo build --release -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/${websocket_lib_file} ${CMAKE_BINARY_DIR}/build/lib COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/build/include @@ -37,7 +37,7 @@ IF (TD_WEBSOCKET) COMMAND git clean -f -d BUILD_COMMAND COMMAND cargo update - COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored + COMMAND cargo build --release -p taos-ws-sys --features rustls INSTALL_COMMAND COMMAND cp target/release/taosws.dll ${CMAKE_BINARY_DIR}/build/lib COMMAND cp target/release/taosws.dll.lib ${CMAKE_BINARY_DIR}/build/lib/taosws.lib From a65ce818deeeeb3dcd3e6830668e39e41d1b82c4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 1 Apr 2024 16:20:45 +0800 Subject: [PATCH 047/106] 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 9ca84091dfd6b8bbfa6fbf59f4b053f98a3570ab Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 1 Apr 2024 16:31:10 +0800 Subject: [PATCH 048/106] fix(stream): reset the ready upstream counter after task-reset. --- source/libs/stream/src/streamCheckpoint.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index f58c72eded..7f52c5d2f0 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -278,6 +278,7 @@ void streamTaskClearCheckInfo(SStreamTask* pTask, bool clearChkpReadyMsg) { pTask->chkInfo.numOfNotReady = 0; pTask->chkInfo.transId = 0; pTask->chkInfo.dispatchCheckpointTrigger = false; + pTask->chkInfo.downstreamAlignNum = 0; streamTaskOpenAllUpstreamInput(pTask); // open inputQ for all upstream tasks if (clearChkpReadyMsg) { From 5369448bda920ae6876270fdc05fcf39411d8ca0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 1 Apr 2024 16:43:36 +0800 Subject: [PATCH 049/106] adj log --- source/libs/executor/src/projectoperator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index c6ebb04446..aa2a73f09f 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -387,14 +387,14 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; } - if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { - printDataBlock(p, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); - } - if (pProjectInfo->outputIgnoreGroup) { p->info.id.groupId = 0; } + if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { + printDataBlock(p, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + } + return (p->info.rows > 0) ? p : NULL; } From bc56d1196a9b17177df804b47be4cc3e753731d9 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 1 Apr 2024 18:06:07 +0800 Subject: [PATCH 050/106] more code --- source/common/src/tdataformat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 991c17c5cc..7de685d9b1 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1238,7 +1238,8 @@ int32_t tValueCompare(const SValue *tv1, const SValue *tv2) { T_COMPARE_SCALAR_VALUE(uint64_t, &tv1->val, &tv2->val); case TSDB_DATA_TYPE_GEOMETRY: case TSDB_DATA_TYPE_BINARY: { - return strcmp((const char *)tv1->pData, (const char *)tv2->pData); + int32_t ret = strncmp((const char *)tv1->pData, (const char *)tv2->pData, TMIN(tv1->nData, tv2->nData)); + return ret ? ret : (tv1->nData < tv2->nData ? -1 : (tv1->nData > tv2->nData ? 1 : 0)); } case TSDB_DATA_TYPE_NCHAR: { int32_t ret = tasoUcs4Compare((TdUcs4 *)tv1->pData, (TdUcs4 *)tv2->pData, @@ -1286,7 +1287,7 @@ int32_t tRowKeyCompare(const void *p1, const void *p2) { return 0; } -int32_t tRowKeyAssign(SRowKey *pDst, SRowKey* pSrc) { +int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc) { pDst->ts = pSrc->ts; pDst->numOfPKs = pSrc->numOfPKs; From 1c56c5ab83a78ccec3042ecc5f80e0fd304fe2b1 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 1 Apr 2024 19:16:54 +0800 Subject: [PATCH 051/106] fix:delete the file that testing JSON compression rate --- tests/system-test/buildJson.py | 243 --------------------------------- 1 file changed, 243 deletions(-) delete mode 100644 tests/system-test/buildJson.py diff --git a/tests/system-test/buildJson.py b/tests/system-test/buildJson.py deleted file mode 100644 index 6e9e9f83e1..0000000000 --- a/tests/system-test/buildJson.py +++ /dev/null @@ -1,243 +0,0 @@ -# 写一段python代码,生成一个JSON串,json 串为数组,数组长度为10000,每个元素为包含4000个key-value对的JSON字符串,json 数组里每个元素里的4000个key不相同,元素之间使用相同的key,key值为英文单词,value 为int值,且value 的范围是[0, 256]。把json串紧凑形式写入文件,把json串存入parquet文件中,把json串写入avro文件中,把json串写入到postgre sql表中,表有两列第一列主int类型主键,第二列为json类型,数组的每个元素写入json类型里 -import csv -import json -import os -import random -import string -import time - -from faker import Faker -import pandas as pd -import pyarrow as pa -import pyarrow.parquet as pq -import fastavro -import psycopg2 -from psycopg2.extras import Json - - -def get_dir_size(start_path='.'): - total = 0 - for dirpath, dirs, files in os.walk(start_path): - for f in files: - fp = os.path.join(dirpath, f) - # 获取文件大小并累加到total上 - total += os.path.getsize(fp) - return total - - -def to_avro_record(obj): - return {key: value for key, value in obj.items()} - - -def generate_random_string(length): - return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) - - -def generate_random_values(t): - if t == 0: - return random.randint(-255, 256) - elif t == 1: - return random.randint(-2100000000, 2100000000) - elif t == 2: - return random.uniform(-10000.0, 10000.0) - elif t == 3: - return generate_random_string(10) - elif t == 4: - return random.choice([True, False]) - - -def generate_json_object(key_set, value_set): - values = [generate_random_values(t) for t in value_set] - return dict(zip(key_set, values)) - - -def generate_json_array(keys, values, array_length): - return [generate_json_object(keys, values) for _ in range(array_length)] - - -def write_parquet_file(parquet_file, json_array): - df = pd.DataFrame(json_array) - table = pa.Table.from_pandas(df) - pq.write_table(table, parquet_file + ".parquet") - - -def write_json_file(json_file, json_array): - with open(json_file + ".json", 'w') as f: - json.dump(json_array, f, separators=(',', ':')) - - -def generate_avro_schema(k, t): - if t == 0: - return {"name": k, "type": "int", "logicalType": "int"} - elif t == 1: - return {"name": k, "type": "int", "logicalType": "int"} - elif t == 2: - return {"name": k, "type": "float"} - elif t == 3: - return {"name": k, "type": "string"} - elif t == 4: - return {"name": k, "type": "boolean"} - - -def write_avro_file(avro_file, json_array, keys, values): - k = list(json_array[0].keys()) - - if keys != k: - raise ValueError("keys and values should have the same length") - - avro_schema = { - "type": "record", - "name": "MyRecord", - "fields": [generate_avro_schema(k, v) for k, v in dict(zip(keys, values)).items()] - } - - avro_records = [to_avro_record(obj) for obj in json_array] - with open(avro_file + ".avro", 'wb') as f: - fastavro.writer(f, avro_schema, avro_records) - - -def write_pg_file(json_array): - conn_str = "dbname=mydatabase user=myuser host=localhost" - conn = psycopg2.connect(conn_str) - cur = conn.cursor() - - cur.execute("drop table if exists my_table") - conn.commit() - - # 创建表(如果不存在) - cur.execute(""" - CREATE TABLE IF NOT EXISTS my_table ( - id SERIAL PRIMARY KEY, - json_data JSONB - ); - """) - conn.commit() - - # 执行SQL查询 - cur.execute("SELECT count(*) FROM my_table") - # 获取查询结果 - rows = cur.fetchall() - # 打印查询结果 - for row in rows: - print("rows before:", row[0]) - - # 插入数据 - for idx, json_obj in enumerate(json_array): - # print(json.dumps(json_obj)) - cur.execute("INSERT INTO my_table (json_data) VALUES (%s)", (json.dumps(json_obj),)) - - conn.commit() # 提交事务 - - # 执行SQL查询 - cur.execute("SELECT count(*) FROM my_table") - # 获取查询结果 - rows = cur.fetchall() - # 打印查询结果 - for row in rows: - print("rows after:", row[0]) - - # # 执行SQL查询 - # cur.execute("SELECT pg_relation_size('my_table')") - # # 获取查询结果 - # rows = cur.fetchall() - # # 打印查询结果 - # size = 0 - # for row in rows: - # size = row[0] - # print("table size:", row[0]) - - # 关闭游标和连接 - cur.close() - conn.close() - -def read_parquet_file(parquet_file): - table = pq.read_table(parquet_file + ".parquet") - df = table.to_pandas() - print(df) - - -def read_avro_file(avg_file): - with open(avg_file + ".avro", 'rb') as f: - reader = fastavro.reader(f) - - for record in reader: - print(record) - - -def read_json_file(csv_file): - with open(csv_file + ".json", 'r') as f: - data = json.load(f) - print(data) - - -def main(): - key_length = 7 - key_sizes = 4000 - row_sizes = 10000 - file_name = "output" - - # cases = [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (0, 4)] - cases = [(2, 2), (3, 3), (0, 4)] - - for data in cases: - begin, end = data - print(f"执行类型:{begin}-{end}") - - N = 2 - for _ in range(N): - - t0 = time.time() - - keys = [generate_random_string(key_length) for _ in range(key_sizes)] - values = [random.randint(begin, end) for _ in range(key_sizes)] - # 生成JSON数组 - json_array = generate_json_array(keys, values, row_sizes) - - t1 = time.time() - - write_json_file(file_name, json_array) - - t2 = time.time() - - write_parquet_file(file_name, json_array) - - t3 = time.time() - - write_avro_file(file_name, json_array, keys, values) - - t4 = time.time() - - size = write_pg_file(json_array) - - t5 = time.time() - - print("生成json 速度:", t2 - t0, "文件大小:", os.path.getsize(file_name + ".json")) - print("parquet 速度:", t3 - t2, "文件大小:", os.path.getsize(file_name + ".parquet")) - print("avro 速度:", t4 - t3, "文件大小:", os.path.getsize(file_name + ".avro")) - print("pg json 速度:", t5 - t4, "文件大小:", get_dir_size("/opt/homebrew/var/postgresql@14/base/16385") - 8 * 1024 * 1024) - - # read_json_file(file_name) - # read_parquet_file(file_name) - # read_avro_file(file_name) - print(f"\n---------------\n") - -if __name__ == "__main__": - main() - -# 压缩文件 -# import os -# -# import lz4.frame -# -# -# files =["output.json", "output.parquet", "output.avro"] -# def compress_file(input_path, output_path): -# with open(input_path, 'rb') as f_in: -# compressed_data = lz4.frame.compress(f_in.read()) -# -# with open(output_path, 'wb') as f_out: -# f_out.write(compressed_data) -# -# for file in files: -# compress_file(file, file + ".lz4") -# print(file, "origin size:", os.path.getsize(file), " after lsz size:", os.path.getsize(file + ".lz4")) From 174b0a104e5cab39e3eaa953dc579c9f39cdef54 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 1 Apr 2024 19:59:30 +0800 Subject: [PATCH 052/106] fix:case error --- source/dnode/mnode/impl/src/mndConsumer.c | 8 ++++---- tests/system-test/8-stream/stream_basic.py | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 52671f6b66..ed9333f480 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -292,16 +292,16 @@ static void storeOffsetRows(SMnode *pMnode, SMqHbReq *req, SMqConsumerObj *pCons static int32_t buildMqHbRsp(SRpcMsg *pMsg, SMqHbRsp *rsp){ int32_t tlen = tSerializeSMqHbRsp(NULL, 0, rsp); if (tlen <= 0){ - return TSDB_CODE_OUT_OF_MEMORY; + return TSDB_CODE_TMQ_INVALID_MSG; } void *buf = rpcMallocCont(tlen); if (buf == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - if(tSerializeSMqHbRsp(buf, tlen, rsp) != 0){ + if(tSerializeSMqHbRsp(buf, tlen, rsp) <= 0){ rpcFreeCont(buf); - return TSDB_CODE_OUT_OF_MEMORY; + return TSDB_CODE_TMQ_INVALID_MSG; } pMsg->info.rsp = buf; pMsg->info.rspLen = tlen; @@ -316,7 +316,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) { SMqConsumerObj *pConsumer = NULL; if (tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req) < 0) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = TSDB_CODE_TMQ_INVALID_MSG; goto end; } diff --git a/tests/system-test/8-stream/stream_basic.py b/tests/system-test/8-stream/stream_basic.py index 5167423ea3..ff16bee787 100644 --- a/tests/system-test/8-stream/stream_basic.py +++ b/tests/system-test/8-stream/stream_basic.py @@ -96,9 +96,28 @@ class TDTestCase: time.sleep(2) tdSql.query("select * from sta") tdSql.checkRows(3) + tdSql.query("select tbname from sta order by tbname") + if not tdSql.getData(0, 0).startswith('new-t1_1.d1.sta_'): + tdLog.exit("error1") + + if not tdSql.getData(1, 0).startswith('new-t2_1.d1.sta_'): + tdLog.exit("error2") + + if not tdSql.getData(2, 0).startswith('new-t3_1.d1.sta_'): + tdLog.exit("error3") tdSql.query("select * from stb") tdSql.checkRows(3) + tdSql.query("select tbname from stb order by tbname") + if not tdSql.getData(0, 0).startswith('new-t1_1.d1.stb_'): + tdLog.exit("error4") + + if not tdSql.getData(1, 0).startswith('new-t2_1.d1.stb_'): + tdLog.exit("error5") + + if not tdSql.getData(2, 0).startswith('new-t3_1.d1.stb_'): + tdLog.exit("error6") + # run def run(self): self.case1() From c28ee644776b94f54baafc0d0d82b4a188df1461 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 1 Apr 2024 21:11:35 +0800 Subject: [PATCH 053/106] fix: meta snapshot drop table error --- source/dnode/vnode/src/meta/metaSnapshot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index e86ed3b657..5850e794fa 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -79,6 +79,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { int32_t nKey = 0; int32_t nData = 0; STbDbKey key; + SMetaInfo info; *ppData = NULL; for (;;) { @@ -91,7 +92,8 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { goto _exit; } - if (key.version < pReader->sver) { + if (key.version < pReader->sver // + || metaGetInfo(pReader->pMeta, key.uid, &info, NULL) == TSDB_CODE_NOT_FOUND) { tdbTbcMoveToNext(pReader->pTbc); continue; } From 9125a28061d90e51e7a4fc180909a853af3bcbca Mon Sep 17 00:00:00 2001 From: Adam Ji Date: Tue, 2 Apr 2024 09:13:55 +0800 Subject: [PATCH 054/106] docs: merge example code to 3.0 --- .../rust/nativeexample/examples/query.rs | 66 +++++++ .../rust/nativeexample/examples/schemaless.rs | 80 +++++++++ .../rust/nativeexample/examples/stmt.rs | 37 ++++ .../rust/nativeexample/examples/tmq.rs | 166 ++++++++++++++++++ 4 files changed, 349 insertions(+) create mode 100644 docs/examples/rust/nativeexample/examples/query.rs create mode 100644 docs/examples/rust/nativeexample/examples/schemaless.rs create mode 100644 docs/examples/rust/nativeexample/examples/stmt.rs create mode 100644 docs/examples/rust/nativeexample/examples/tmq.rs diff --git a/docs/examples/rust/nativeexample/examples/query.rs b/docs/examples/rust/nativeexample/examples/query.rs new file mode 100644 index 0000000000..dfe55e8749 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/query.rs @@ -0,0 +1,66 @@ +use taos::*; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + let dsn = "taos://localhost:6030"; + let builder = TaosBuilder::from_dsn(dsn)?; + + let taos = builder.build()?; + + // ANCHOR: create_db_and_table + let db = "power"; + // create database + taos.exec_many([ + format!("DROP DATABASE IF EXISTS `{db}`"), + format!("CREATE DATABASE `{db}`"), + format!("USE `{db}`"), + ]) + .await?; + + // create table + taos.exec_many([ + // create super table + "CREATE TABLE `meters` (`ts` TIMESTAMP, `current` FLOAT, `voltage` INT, `phase` FLOAT) \ + TAGS (`groupid` INT, `location` BINARY(24))", + ]).await?; + // ANCHOR_END: create_db_and_table + + // ANCHOR: insert_data + let inserted = taos.exec("INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "(NOW + 1a, 10.30000, 219, 0.31000) " + + "(NOW + 2a, 12.60000, 218, 0.33000) " + + "(NOW + 3a, 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "(NOW + 1a, 10.30000, 218, 0.25000) ").await?; + + println!("inserted: {} rows", inserted); + // ANCHOR_END: insert_data + + // ANCHOR: query_data + let mut result = taos.query("SELECT * FROM power.meters").await?; + + for field in result.fields() { + println!("got field: {}", field.name()); + } + + let mut rows = result.rows(); + let mut nrows = 0; + while let Some(row) = rows.try_next().await? { + for (col, (name, value)) in row.enumerate() { + println!( + "[{}] got value in col {} (named `{:>8}`): {}", + nrows, col, name, value + ); + } + nrows += 1; + } + // ANCHOR_END: query_data + + // ANCHOR: query_with_req_id + let result = taos.query_with_req_id("SELECT * FROM power.meters", 0).await?; + // ANCHOR_END: query_with_req_id + +} diff --git a/docs/examples/rust/nativeexample/examples/schemaless.rs b/docs/examples/rust/nativeexample/examples/schemaless.rs new file mode 100644 index 0000000000..44ce0fe694 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/schemaless.rs @@ -0,0 +1,80 @@ +use taos_query::common::SchemalessPrecision; +use taos_query::common::SchemalessProtocol; +use taos_query::common::SmlDataBuilder; + +use crate::AsyncQueryable; +use crate::AsyncTBuilder; +use crate::TaosBuilder; + +async fn put() -> anyhow::Result<()> { + std::env::set_var("RUST_LOG", "taos=debug"); + pretty_env_logger::init(); + let dsn = + std::env::var("TDENGINE_ClOUD_DSN").unwrap_or("http://localhost:6041".to_string()); + log::debug!("dsn: {:?}", &dsn); + + let client = TaosBuilder::from_dsn(dsn)?.build().await?; + + let db = "power"; + + client.exec(format!("drop database if exists {db}")).await?; + + client + .exec(format!("create database if not exists {db}")) + .await?; + + // should specify database before insert + client.exec(format!("use {db}")).await?; + + // SchemalessProtocol::Line + let data = [ + "meters,groupid=2,location=California.SanFrancisco current=10.3000002f64,voltage=219i32,phase=0.31f64 1626006833639000000", + ] + .map(String::from) + .to_vec(); + + let sml_data = SmlDataBuilder::default() + .protocol(SchemalessProtocol::Line) + .precision(SchemalessPrecision::Millisecond) + .data(data.clone()) + .ttl(1000) + .req_id(100u64) + .build()?; + assert_eq!(client.put(&sml_data).await?, ()); + + // SchemalessProtocol::Telnet + let data = [ + "meters.current 1648432611249 10.3 location=California.SanFrancisco group=2", + ] + .map(String::from) + .to_vec(); + + let sml_data = SmlDataBuilder::default() + .protocol(SchemalessProtocol::Telnet) + .precision(SchemalessPrecision::Millisecond) + .data(data.clone()) + .ttl(1000) + .req_id(200u64) + .build()?; + assert_eq!(client.put(&sml_data).await?, ()); + + // SchemalessProtocol::Json + let data = [ + r#"[{"metric": "meters.current", "timestamp": 1681345954000, "value": 10.3, "tags": {"location": "California.SanFrancisco", "groupid": 2}}, {"metric": "meters.voltage", "timestamp": 1648432611249, "value": 219, "tags": {"location": "California.LosAngeles", "groupid": 1}}, {"metric": "meters.current", "timestamp": 1648432611250, "value": 12.6, "tags": {"location": "California.SanFrancisco", "groupid": 2}}, {"metric": "meters.voltage", "timestamp": 1648432611250, "value": 221, "tags": {"location": "California.LosAngeles", "groupid": 1}}]"# + ] + .map(String::from) + .to_vec(); + + let sml_data = SmlDataBuilder::default() + .protocol(SchemalessProtocol::Json) + .precision(SchemalessPrecision::Millisecond) + .data(data.clone()) + .ttl(1000) + .req_id(300u64) + .build()?; + assert_eq!(client.put(&sml_data).await?, ()); + + client.exec(format!("drop database if exists {db}")).await?; + + Ok(()) +} diff --git a/docs/examples/rust/nativeexample/examples/stmt.rs b/docs/examples/rust/nativeexample/examples/stmt.rs new file mode 100644 index 0000000000..0194eccdf1 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/stmt.rs @@ -0,0 +1,37 @@ +use taos::*; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + let taos = TaosBuilder::from_dsn("taos://")?.build().await?; + + taos.exec("DROP DATABASE IF EXISTS power").await?; + taos.create_database("power").await?; + taos.use_database("power").await?; + taos.exec("CREATE STABLE IF NOT EXISTS meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)").await?; + + let mut stmt = Stmt::init(&taos).await?; + stmt.prepare("INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)").await?; + + const NUM_TABLES: usize = 10; + const NUM_ROWS: usize = 10; + for i in 0..NUM_TABLES { + let table_name = format!("d{}", i); + let tags = vec![Value::VarChar("California.SanFransico".into()), Value::Int(2)]; + stmt.set_tbname_tags(&table_name, &tags).await?; + for j in 0..NUM_ROWS { + let values = vec![ + ColumnView::from_millis_timestamp(vec![1648432611249 + j as i64]), + ColumnView::from_floats(vec![10.3 + j as f32]), + ColumnView::from_ints(vec![219 + j as i32]), + ColumnView::from_floats(vec![0.31 + j as f32]), + ]; + stmt.bind(&values).await?; + } + stmt.add_batch().await?; + } + + // execute. + let rows = stmt.execute().await?; + assert_eq!(rows, NUM_TABLES * NUM_ROWS); + Ok(()) +} diff --git a/docs/examples/rust/nativeexample/examples/tmq.rs b/docs/examples/rust/nativeexample/examples/tmq.rs new file mode 100644 index 0000000000..764c0c1fc8 --- /dev/null +++ b/docs/examples/rust/nativeexample/examples/tmq.rs @@ -0,0 +1,166 @@ +use std::time::Duration; +use std::str::FromStr; + +use taos::*; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + pretty_env_logger::formatted_timed_builder() + .filter_level(log::LevelFilter::Info) + .init(); + use taos_query::prelude::*; + let dsn = "taos://localhost:6030".to_string(); + log::info!("dsn: {}", dsn); + let mut dsn = Dsn::from_str(&dsn)?; + + let taos = TaosBuilder::from_dsn(&dsn)?.build().await?; + + // prepare database and table + taos.exec_many([ + "drop topic if exists topic_meters", + "drop database if exists power", + "create database if not exists power WAL_RETENTION_PERIOD 86400", + "use power", + + "CREATE STABLE IF NOT EXISTS power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))", + + "create table if not exists power.d001 using power.meters tags(1,'location')", + + ]) + .await?; + + taos.exec_many([ + "drop database if exists db2", + "create database if not exists db2 wal_retention_period 3600", + "use db2", + ]) + .await?; + + // ANCHOR: create_topic + taos.exec_many([ + "CREATE TOPIC IF NOT EXISTS topic_meters AS SELECT ts, current, voltage, phase, groupid, location FROM power.meters", + ]) + .await?; + // ANCHOR_END: create_topic + + // ANCHOR: create_consumer + dsn.params.insert("group.id".to_string(), "abc".to_string()); + dsn.params.insert("auto.offset.reset".to_string(), "earliest".to_string()); + + let builder = TmqBuilder::from_dsn(&dsn)?; + let mut consumer = builder.build().await?; + // ANCHOR_END: create_consumer + + // ANCHOR: subscribe + consumer.subscribe(["topic_meters"]).await?; + // ANCHOR_END: subscribe + + // ANCHOR: consume + { + let mut stream = consumer.stream_with_timeout(Timeout::from_secs(1)); + + while let Some((offset, message)) = stream.try_next().await? { + + let topic: &str = offset.topic(); + let database = offset.database(); + let vgroup_id = offset.vgroup_id(); + log::debug!( + "topic: {}, database: {}, vgroup_id: {}", + topic, + database, + vgroup_id + ); + + match message { + MessageSet::Meta(meta) => { + log::info!("Meta"); + let raw = meta.as_raw_meta().await?; + taos.write_raw_meta(&raw).await?; + + let json = meta.as_json_meta().await?; + let sql = json.to_string(); + if let Err(err) = taos.exec(sql).await { + println!("maybe error: {}", err); + } + } + MessageSet::Data(data) => { + log::info!("Data"); + while let Some(data) = data.fetch_raw_block().await? { + log::debug!("data: {:?}", data); + } + } + MessageSet::MetaData(meta, data) => { + log::info!("MetaData"); + let raw = meta.as_raw_meta().await?; + taos.write_raw_meta(&raw).await?; + + let json = meta.as_json_meta().await?; + let sql = json.to_string(); + if let Err(err) = taos.exec(sql).await { + println!("maybe error: {}", err); + } + + while let Some(data) = data.fetch_raw_block().await? { + log::debug!("data: {:?}", data); + } + } + } + consumer.commit(offset).await?; + } + } + // ANCHOR_END: consume + + // ANCHOR: assignments + let assignments = consumer.assignments().await.unwrap(); + log::info!("assignments: {:?}", assignments); + // ANCHOR_END: assignments + + // seek offset + for topic_vec_assignment in assignments { + let topic = &topic_vec_assignment.0; + let vec_assignment = topic_vec_assignment.1; + for assignment in vec_assignment { + let vgroup_id = assignment.vgroup_id(); + let current = assignment.current_offset(); + let begin = assignment.begin(); + let end = assignment.end(); + log::debug!( + "topic: {}, vgroup_id: {}, current offset: {} begin {}, end: {}", + topic, + vgroup_id, + current, + begin, + end + ); + // ANCHOR: seek_offset + let res = consumer.offset_seek(topic, vgroup_id, end).await; + if res.is_err() { + log::error!("seek offset error: {:?}", res); + let a = consumer.assignments().await.unwrap(); + log::error!("assignments: {:?}", a); + } + // ANCHOR_END: seek_offset + } + + let topic_assignment = consumer.topic_assignment(topic).await; + log::debug!("topic assignment: {:?}", topic_assignment); + } + + // after seek offset + let assignments = consumer.assignments().await.unwrap(); + log::info!("after seek offset assignments: {:?}", assignments); + + // ANCHOR: unsubscribe + consumer.unsubscribe().await; + // ANCHOR_END: unsubscribe + + tokio::time::sleep(Duration::from_secs(1)).await; + + taos.exec_many([ + "drop database db2", + "drop topic topic_meters", + "drop database power", + ]) + .await?; + Ok(()) +} From aff681ac64a948c5f5e2b8f8e5b150724992680f Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 2 Apr 2024 10:43:38 +0800 Subject: [PATCH 055/106] fix(tsdb):set correct varchar type compare function. --- source/dnode/vnode/src/tsdb/tsdbRead2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 5469eae1cd..2e6a0a43e9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -107,7 +107,21 @@ int32_t pkCompEx(__compar_fn_t comparFn, SRowKey* p1, SRowKey* p2) { if (p1->numOfPKs == 0) { return 0; } else { - return comparFn(&p1->pks[0].val, &p2->pks[0].val); + if (IS_VAR_DATA_TYPE(p1->pks[0].type)) { + int32_t len = TMIN(p1->pks[0].nData, p2->pks[0].nData); + int32_t ret = strncmp((char*)p1->pks[0].pData, (char*)p2->pks[0].pData, len); + if (ret == 0) { + if (p1->pks[0].nData == p2->pks[0].nData) { + return 0; + } else { + return p1->pks[0].nData > p2->pks[0].nData?1:-1; + } + } else { + return ret > 0? 1:-1; + } + } else { + return comparFn(&p1->pks[0].val, &p2->pks[0].val); + } } } From 771c6940b1adb300b0809f151d2078244ea6d310 Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 2 Apr 2024 13:39:41 +0800 Subject: [PATCH 056/106] fix: initialize pk type and pk data of output SFirstLastRes when merge --- source/libs/function/src/builtinsimpl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index fafc313afc..70e906c6ec 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2821,11 +2821,13 @@ static int32_t firstLastTransferInfoImpl(SFirstLastRes* pInput, SFirstLastRes* p pOutput->isNull = pInput->isNull; pOutput->ts = pInput->ts; pOutput->bytes = pInput->bytes; + pOutput->pkType = pInput->pkType; memcpy(pOutput->buf, pInput->buf, pOutput->bytes); if (pInput->pkData) { pOutput->pkBytes = pInput->pkBytes; memcpy(pOutput->buf+pOutput->bytes, pInput->pkData, pOutput->pkBytes); + pOutput->pkData = pOutput->buf + pOutput->bytes; } return TSDB_CODE_SUCCESS; } From 8fe7478932388af8d0179afc3c01c6669b64afd5 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 2 Apr 2024 14:24:32 +0800 Subject: [PATCH 057/106] fix: TD-29352 --- source/common/src/tdataformat.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 7de685d9b1..ff25954fc1 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1061,7 +1061,6 @@ _exit: static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag) { int32_t code = 0; - SKVIdx *pKVIdx = (SKVIdx *)pRow->data; uint8_t *pv = NULL; int32_t iColData = 0; SColData *pColData = &aColData[iColData]; @@ -1069,6 +1068,14 @@ static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aCo STColumn *pTColumn = &pTSchema->columns[iTColumn]; int32_t iCol = 0; + // primary keys + uint8_t *data = pRow->data; + SPrimaryKeyIndex index; + for (int32_t i = 0; i < pRow->numOfPKs; i++) { + data += tGetPrimaryKeyIndex(data, &index); + } + + SKVIdx *pKVIdx = (SKVIdx *)data; if (pRow->flag & KV_FLG_LIT) { pv = pKVIdx->idx + pKVIdx->nCol; } else if (pRow->flag & KV_FLG_MID) { From 77d912c2102985df895ca2ed8e0226653b6c33dc Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 2 Apr 2024 14:39:13 +0800 Subject: [PATCH 058/106] fix: primary key should not be null or none --- include/libs/nodes/querynodes.h | 1 + include/libs/qcom/query.h | 1 + source/libs/parser/src/parInsertSql.c | 23 +++++++++++++++++----- source/libs/parser/src/parInsertStmt.c | 12 ++++++++++- source/libs/parser/src/parTranslater.c | 17 ++++++++++++---- source/libs/planner/src/planLogicCreater.c | 1 + source/libs/qcom/src/querymsg.c | 8 ++++++++ 7 files changed, 53 insertions(+), 10 deletions(-) diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index cdbeda0012..22c5e74910 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -85,6 +85,7 @@ typedef struct SColumnNode { char colName[TSDB_COL_NAME_LEN]; int16_t dataBlockId; int16_t slotId; + int16_t numOfPKs; bool tableHasPk; bool isPk; } SColumnNode; diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 0b192d5593..47783953c4 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -76,6 +76,7 @@ typedef struct STableComInfo { uint8_t numOfTags; // the number of tags in schema uint8_t precision; // the number of precision col_id_t numOfColumns; // the number of columns + int16_t numOfPKs; int32_t rowSize; // row size of the schema } STableComInfo; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 1a41ba5fb9..94c0ca99e1 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -183,6 +183,8 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E pBoundInfo->numOfBound = 0; + bool hasPK = pTableMeta->tableInfo.numOfPKs; + int16_t numOfBoundPKs = 0; int16_t lastColIdx = -1; // last column found int32_t code = TSDB_CODE_SUCCESS; while (TSDB_CODE_SUCCESS == code) { @@ -219,14 +221,20 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E pUseCols[index] = true; pBoundInfo->pColIndex[pBoundInfo->numOfBound] = index; ++pBoundInfo->numOfBound; + if (hasPK && (pSchema[index].flags & COL_IS_KEY)) ++numOfBoundPKs; } } - if (TSDB_CODE_SUCCESS == code && (BOUND_TAGS != boundColsType) && !pUseCols[0]) { - code = buildInvalidOperationMsg(&pCxt->msg, "primary timestamp column can not be null"); + if (TSDB_CODE_SUCCESS == code && (BOUND_TAGS != boundColsType)) { + if (!pUseCols[0]) { + code = buildInvalidOperationMsg(&pCxt->msg, "primary timestamp column should not be null"); + } + if (numOfBoundPKs != pTableMeta->tableInfo.numOfPKs) { + code = buildInvalidOperationMsg(&pCxt->msg, "primary key column should not be none"); + } } if (TSDB_CODE_SUCCESS == code && (BOUND_ALL_AND_TBNAME == boundColsType) && !pUseCols[tbnameSchemaIndex]) { - code = buildInvalidOperationMsg(&pCxt->msg, "tbname column can not be null"); + code = buildInvalidOperationMsg(&pCxt->msg, "tbname column should not be null"); } taosMemoryFree(pUseCols); @@ -469,13 +477,15 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, char* endptr = NULL; int32_t code = TSDB_CODE_SUCCESS; +#if 0 if (isNullValue(pSchema->type, pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { - return buildSyntaxErrMsg(pMsgBuf, "primary timestamp should not be null", pToken->z); + return buildSyntaxErrMsg(pMsgBuf, "primary timestamp column can not be null", pToken->z); } return TSDB_CODE_SUCCESS; } +#endif // strcpy(val->colName, pSchema->name); val->cid = pSchema->colId; @@ -1643,7 +1653,10 @@ static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, STo int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pSchema->type); if (TSDB_CODE_SUCCESS == code && isNullValue(pSchema->type, pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { - return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp should not be null", pToken->z); + return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp column should not be null", pToken->z); + } + if (pSchema->flags & COL_IS_KEY) { + return buildSyntaxErrMsg(&pCxt->msg, "primary key column should not be null", pToken->z); } pVal->flag = CV_FLAG_NULL; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index a88aec20b3..fb765dc3de 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -267,6 +267,11 @@ int32_t qBindStmtColsValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, in pBind = bind + c; } + if(pBind->is_null && (pColSchema->flags & COL_IS_KEY)){ + code = buildInvalidOperationMsg(&pBuf, "primary key column should not be null"); + goto _return; + } + code = tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE: -1); if (code) { goto _return; @@ -313,7 +318,12 @@ int32_t qBindStmtSingleColValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBu pBind = bind; } - tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE: -1); + if (pBind->is_null && (pColSchema->flags & COL_IS_KEY)) { + code = buildInvalidOperationMsg(&pBuf, "primary key column should not be null"); + goto _return; + } + + tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1); qDebug("stmt col %d bind %d rows data", colIdx, rowNum); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index b08552fc3d..830b7f7396 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -955,6 +955,7 @@ static void setColumnInfoBySchema(const SRealTableNode* pTable, const SSchema* p } pCol->tableHasPk = hasPkInTable(pTable->pMeta); pCol->isPk = (pCol->tableHasPk) && (pColSchema->flags & COL_IS_KEY); + pCol->numOfPKs = pTable->pMeta->tableInfo.numOfPKs; } static void setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SColumnNode** pColRef) { @@ -5084,9 +5085,11 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); } - SNode* pPrimaryKeyExpr = NULL; - SNode* pBoundCol = NULL; - SNode* pProj = NULL; + SNode* pPrimaryKeyExpr = NULL; + SNode* pBoundCol = NULL; + SNode* pProj = NULL; + int16_t numOfPKs = 0; + int16_t numOfBoundPKs = 0; FORBOTH(pBoundCol, pInsert->pCols, pProj, pProjects) { SColumnNode* pCol = (SColumnNode*)pBoundCol; SExprNode* pExpr = (SExprNode*)pProj; @@ -5102,12 +5105,18 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns snprintf(pExpr->aliasName, sizeof(pExpr->aliasName), "%s", pCol->colName); if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { pPrimaryKeyExpr = (SNode*)pExpr; + numOfPKs = pCol->numOfPKs; } + if (pCol->isPk) ++numOfBoundPKs; } if (NULL == pPrimaryKeyExpr) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, - "Primary timestamp column can not be null"); + "Primary timestamp column should not be null"); + } + + if (numOfBoundPKs != numOfPKs) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Primary key column should not be none"); } return addOrderByPrimaryKeyToQuery(pCxt, pPrimaryKeyExpr, pInsert->pQuery); diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index b5236fee9e..100251b565 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -294,6 +294,7 @@ static SNode* createFirstCol(uint64_t tableId, const SSchema* pSchema, const STa pCol->colType = COLUMN_TYPE_COLUMN; pCol->isPk = pSchema->flags & COL_IS_KEY; pCol->tableHasPk = hasPkInTable(pMeta); + pCol->numOfPKs = pMeta->tableInfo.numOfPKs; strcpy(pCol->colName, pSchema->name); return (SNode*)pCol; } diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index bf87803908..7948bbbceb 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -421,8 +421,16 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta * memcpy(pTableMeta->schema, msg->pSchemas, sizeof(SSchema) * total); + bool hasPK = (msg->numOfColumns > 1) && (pTableMeta->schema[1].flags & COL_IS_KEY); for (int32_t i = 0; i < msg->numOfColumns; ++i) { pTableMeta->tableInfo.rowSize += pTableMeta->schema[i].bytes; + if (hasPK && (i > 0)) { + if ((pTableMeta->schema[i].flags & COL_IS_KEY)) { + ++pTableMeta->tableInfo.numOfPKs; + } else { + hasPK = false; + } + } } qDebug("table %s uid %" PRIx64 " meta returned, type %d vgId:%d db %s stb %s suid %" PRIx64 " sver %d tver %d" From dc608121833321c04f8a1f113601d3caa477bfb4 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 2 Apr 2024 15:04:13 +0800 Subject: [PATCH 059/106] chore: unify the prompt msg --- source/libs/parser/src/parInsertSql.c | 10 +++++----- source/libs/parser/src/parInsertStmt.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 94c0ca99e1..71d832dc1f 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -227,10 +227,10 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E if (TSDB_CODE_SUCCESS == code && (BOUND_TAGS != boundColsType)) { if (!pUseCols[0]) { - code = buildInvalidOperationMsg(&pCxt->msg, "primary timestamp column should not be null"); + code = buildInvalidOperationMsg(&pCxt->msg, "Primary timestamp column should not be null"); } if (numOfBoundPKs != pTableMeta->tableInfo.numOfPKs) { - code = buildInvalidOperationMsg(&pCxt->msg, "primary key column should not be none"); + code = buildInvalidOperationMsg(&pCxt->msg, "Primary key column should not be none"); } } if (TSDB_CODE_SUCCESS == code && (BOUND_ALL_AND_TBNAME == boundColsType) && !pUseCols[tbnameSchemaIndex]) { @@ -480,7 +480,7 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, #if 0 if (isNullValue(pSchema->type, pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { - return buildSyntaxErrMsg(pMsgBuf, "primary timestamp column can not be null", pToken->z); + return buildSyntaxErrMsg(pMsgBuf, "Primary timestamp column can not be null", pToken->z); } return TSDB_CODE_SUCCESS; @@ -1653,10 +1653,10 @@ static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, STo int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pSchema->type); if (TSDB_CODE_SUCCESS == code && isNullValue(pSchema->type, pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { - return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp column should not be null", pToken->z); + return buildSyntaxErrMsg(&pCxt->msg, "Primary timestamp column should not be null", pToken->z); } if (pSchema->flags & COL_IS_KEY) { - return buildSyntaxErrMsg(&pCxt->msg, "primary key column should not be null", pToken->z); + return buildSyntaxErrMsg(&pCxt->msg, "Primary key column should not be null", pToken->z); } pVal->flag = CV_FLAG_NULL; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index fb765dc3de..59c5ce82ad 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -268,7 +268,7 @@ int32_t qBindStmtColsValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, in } if(pBind->is_null && (pColSchema->flags & COL_IS_KEY)){ - code = buildInvalidOperationMsg(&pBuf, "primary key column should not be null"); + code = buildInvalidOperationMsg(&pBuf, "Primary key column should not be null"); goto _return; } @@ -319,7 +319,7 @@ int32_t qBindStmtSingleColValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBu } if (pBind->is_null && (pColSchema->flags & COL_IS_KEY)) { - code = buildInvalidOperationMsg(&pBuf, "primary key column should not be null"); + code = buildInvalidOperationMsg(&pBuf, "Primary key column should not be null"); goto _return; } From 5a546e37d71d7079c1e6d9a857331230cf93aaa6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 2 Apr 2024 16:10:42 +0800 Subject: [PATCH 060/106] fix(query): set correct forward step for twa query. --- source/libs/executor/src/timewindowoperator.c | 20 ++++++-- source/libs/function/src/builtinsimpl.c | 50 +++++++++---------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 51bfe716c8..f24b581ca2 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -359,8 +359,8 @@ static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, i } static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SExprSupp* pSup, int32_t endRowIndex, - SArray* pDataBlock, const TSKEY* tsCols, TSKEY blockEkey, - STimeWindow* win) { + int32_t nextRowIndex, SArray* pDataBlock, const TSKEY* tsCols, + TSKEY blockEkey, STimeWindow* win) { int32_t order = pInfo->binfo.inputTsOrder; TSKEY actualEndKey = tsCols[endRowIndex]; @@ -378,7 +378,6 @@ static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SEx return true; } - int32_t nextRowIndex = endRowIndex + 1; ASSERT(nextRowIndex >= 0); TSKEY nextKey = tsCols[nextRowIndex]; @@ -517,9 +516,22 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB done = isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP); if (!done) { int32_t endRowIndex = startPos + forwardRows - 1; + int32_t nextRowIndex = endRowIndex + 1; + + // duplicated ts row does not involve in the interpolation of end value for current time window + int32_t x = endRowIndex; + while(x >= 0) { + if (tsCols[x] == tsCols[x-1]) { + + x -= 1; + } else { + endRowIndex = x; + break; + } + } TSKEY endKey = (pInfo->binfo.inputTsOrder == TSDB_ORDER_ASC) ? pBlock->info.window.ekey : pBlock->info.window.skey; - bool interp = setTimeWindowInterpolationEndTs(pInfo, pSup, endRowIndex, pBlock->pDataBlock, tsCols, endKey, win); + bool interp = setTimeWindowInterpolationEndTs(pInfo, pSup, endRowIndex, nextRowIndex, pBlock->pDataBlock, tsCols, endKey, win); if (interp) { setResultRowInterpo(pResult, RESULT_ROW_END_INTERP); } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index fafc313afc..36216d5b6f 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -533,6 +533,24 @@ bool funcInputGetNextRowDescPk(SFuncInputRowIter* pIter, SFuncInputRow* pRow) { } } +static void forwardToNextDiffTsRow(SFuncInputRowIter* pIter, int32_t rowIndex) { + int32_t idx = rowIndex + 1; + while (idx <= pIter->inputEndIndex && pIter->tsList[idx] == pIter->tsList[rowIndex]) { + ++idx; + } + pIter->rowIndex = idx; +} + +static void setInputRowInfo(SFuncInputRow* pRow, SFuncInputRowIter* pIter, int32_t rowIndex, bool setPk) { + pRow->ts = pIter->tsList[rowIndex]; + pRow->ts = pIter->tsList[rowIndex]; + pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, rowIndex); + pRow->pData = colDataGetData(pIter->pDataCol, rowIndex); + pRow->pPk = setPk? colDataGetData(pIter->pPkCol, rowIndex):NULL; + pRow->block = pIter->pSrcBlock; + pRow->rowIndex = rowIndex; +} + bool funcInputGetNextRowAscPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { if (pIter->hasPrev) { if (pIter->prevBlockTsEnd == pIter->tsList[pIter->inputEndIndex]) { @@ -543,33 +561,19 @@ bool funcInputGetNextRowAscPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { while (pIter->tsList[idx] == pIter->prevBlockTsEnd) { ++idx; } - pRow->ts = pIter->tsList[idx]; - pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, idx); - pRow->pData = colDataGetData(pIter->pDataCol, idx); - pRow->pPk = colDataGetData(pIter->pPkCol, idx); - pRow->block = pIter->pSrcBlock; - pRow->rowIndex = idx; pIter->hasPrev = false; - pIter->rowIndex = idx + 1; + setInputRowInfo(pRow, pIter, idx, true); + forwardToNextDiffTsRow(pIter, idx); return true; } } else { if (pIter->rowIndex <= pIter->inputEndIndex) { - pRow->ts = pIter->tsList[pIter->rowIndex]; - pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, pIter->rowIndex); - pRow->pData = colDataGetData(pIter->pDataCol, pIter->rowIndex); - pRow->pPk = colDataGetData(pIter->pPkCol, pIter->rowIndex); - pRow->block = pIter->pSrcBlock; - pRow->rowIndex = pIter->rowIndex; + setInputRowInfo(pRow, pIter, pIter->rowIndex, true); TSKEY tsEnd = pIter->tsList[pIter->inputEndIndex]; if (pIter->tsList[pIter->rowIndex] != tsEnd) { - int32_t idx = pIter->rowIndex + 1; - while (idx <= pIter->inputEndIndex && pIter->tsList[idx] == pIter->tsList[pIter->rowIndex]) { - ++idx; - } - pIter->rowIndex = idx; + forwardToNextDiffTsRow(pIter, pIter->rowIndex); } else { pIter->rowIndex = pIter->inputEndIndex + 1; } @@ -585,13 +589,7 @@ bool funcInputGetNextRowAscPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { bool funcInputGetNextRowNoPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { if (pIter->rowIndex <= pIter->inputEndIndex) { - pRow->ts = pIter->tsList[pIter->rowIndex]; - pRow->isDataNull = colDataIsNull_f(pIter->pDataCol->nullbitmap, pIter->rowIndex); - pRow->pData = colDataGetData(pIter->pDataCol, pIter->rowIndex); - pRow->pPk = NULL; - pRow->block = pIter->pSrcBlock; - pRow->rowIndex = pIter->rowIndex; - + setInputRowInfo(pRow, pIter, pIter->rowIndex, false); ++pIter->rowIndex; return true; } else { @@ -5580,8 +5578,6 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pInputCol = pInput->pData[0]; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; - SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); STwaInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); From 588f05c7dda0ced63daba9767e22570f3a638b20 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 2 Apr 2024 08:49:48 +0000 Subject: [PATCH 061/106] 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 adb6de0595d1c59cd9c01cc92523748a45453945 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 2 Apr 2024 17:33:11 +0800 Subject: [PATCH 062/106] fix: null value check for target column with pk --- include/util/taoserror.h | 1 + source/libs/executor/src/dataInserter.c | 12 +++++++++++- source/util/src/terror.c | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index affa1f0345..3dc6e5333d 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -766,6 +766,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_SECOND_COL_PK TAOS_DEF_ERROR_CODE(0, 0x2672) #define TSDB_CODE_PAR_COL_PK_TYPE TAOS_DEF_ERROR_CODE(0, 0x2673) #define TSDB_CODE_PAR_INVALID_PK_OP TAOS_DEF_ERROR_CODE(0, 0x2674) +#define TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x2675) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index 88fb60fc4c..2d481bd273 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -217,6 +217,11 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY ASSERT(pColInfoData->info.type == pCol->type); if (colDataIsNull_s(pColInfoData, j)) { + if ((pCol->flags & COL_IS_KEY)) { + qError("NULL value for primary key, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); + terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _end; + } SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); taosArrayPush(pVals, &cv); } else { @@ -240,10 +245,15 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) { if (colDataIsNull_s(pColInfoData, j)) { if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { - qError("NULL value for primary key"); + qError("NULL value for primary timestamp key"); terrno = TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL; goto _end; } + if ((pCol->flags & COL_IS_KEY)) { + qError("NULL value for primary key, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); + terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _end; + } SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); // should use pCol->type taosArrayPush(pVals, &cv); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index a64c8642db..99666320f1 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -628,6 +628,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY, "tag can not be prim TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SECOND_COL_PK, "primary key must be second column") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COL_PK_TYPE, "primary key column must be of type int, uint, bigint, ubigint, and varchar") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PK_OP, "primary key column can not be added, modified, and dropped") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL, "Primary key column should not be null") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error") //planner From 018d388278abf9ecf3e6ff6c615ebbf84c0cb5f8 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 2 Apr 2024 18:20:26 +0800 Subject: [PATCH 063/106] 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 064/106] 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 6e56e61ad52a56b610df1f4bcc4c6cf8dad59110 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 2 Apr 2024 19:49:30 +0800 Subject: [PATCH 065/106] fix: target table has less primary keys than source --- source/libs/parser/src/parTranslater.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 830b7f7396..b06a685c48 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5088,7 +5088,8 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns SNode* pPrimaryKeyExpr = NULL; SNode* pBoundCol = NULL; SNode* pProj = NULL; - int16_t numOfPKs = 0; + int16_t numOfSourcePKs = 0; + int16_t numOfTargetPKs = 0; int16_t numOfBoundPKs = 0; FORBOTH(pBoundCol, pInsert->pCols, pProj, pProjects) { SColumnNode* pCol = (SColumnNode*)pBoundCol; @@ -5105,7 +5106,8 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns snprintf(pExpr->aliasName, sizeof(pExpr->aliasName), "%s", pCol->colName); if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { pPrimaryKeyExpr = (SNode*)pExpr; - numOfPKs = pCol->numOfPKs; + numOfTargetPKs = pCol->numOfPKs; + numOfSourcePKs = ((SColumnNode*)pProj)->numOfPKs; } if (pCol->isPk) ++numOfBoundPKs; } @@ -5115,10 +5117,16 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns "Primary timestamp column should not be null"); } - if (numOfBoundPKs != numOfPKs) { + if (numOfBoundPKs != numOfTargetPKs) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Primary key column should not be none"); } + if (numOfTargetPKs < numOfSourcePKs) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + "Target table has less primary keys:%" PRIi16 " than source:%" PRIi16, + numOfTargetPKs, numOfSourcePKs); + } + return addOrderByPrimaryKeyToQuery(pCxt, pPrimaryKeyExpr, pInsert->pQuery); } From dcc97472d319535283b96a9b07187c53fb9ae0ad Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 2 Apr 2024 21:53:50 +0800 Subject: [PATCH 066/106] 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 067/106] 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 068/106] 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 cc660de9d0ec8160c69b5e1193c7798c39ec3371 Mon Sep 17 00:00:00 2001 From: kailixu Date: Wed, 3 Apr 2024 08:14:30 +0800 Subject: [PATCH 069/106] chore: error prompt for null primary key column --- source/libs/executor/src/dataInserter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index 2d481bd273..dfe30c9f96 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -218,7 +218,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp ASSERT(pColInfoData->info.type == pCol->type); if (colDataIsNull_s(pColInfoData, j)) { if ((pCol->flags & COL_IS_KEY)) { - qError("NULL value for primary key, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); + qError("Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; goto _end; } @@ -245,12 +245,12 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) { if (colDataIsNull_s(pColInfoData, j)) { if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { - qError("NULL value for primary timestamp key"); + qError("Primary timestamp column should not be null"); terrno = TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL; goto _end; } if ((pCol->flags & COL_IS_KEY)) { - qError("NULL value for primary key, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); + qError("Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type); terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; goto _end; } From 62ab1b1c41a5e2436630ba29f0bfde6ca0a3845f Mon Sep 17 00:00:00 2001 From: kailixu Date: Wed, 3 Apr 2024 09:39:58 +0800 Subject: [PATCH 070/106] chore: allow source table with primary key --- source/libs/parser/src/parTranslater.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index b06a685c48..a45e4de4d8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5088,7 +5088,6 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns SNode* pPrimaryKeyExpr = NULL; SNode* pBoundCol = NULL; SNode* pProj = NULL; - int16_t numOfSourcePKs = 0; int16_t numOfTargetPKs = 0; int16_t numOfBoundPKs = 0; FORBOTH(pBoundCol, pInsert->pCols, pProj, pProjects) { @@ -5107,7 +5106,6 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { pPrimaryKeyExpr = (SNode*)pExpr; numOfTargetPKs = pCol->numOfPKs; - numOfSourcePKs = ((SColumnNode*)pProj)->numOfPKs; } if (pCol->isPk) ++numOfBoundPKs; } @@ -5121,12 +5119,6 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Primary key column should not be none"); } - if (numOfTargetPKs < numOfSourcePKs) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, - "Target table has less primary keys:%" PRIi16 " than source:%" PRIi16, - numOfTargetPKs, numOfSourcePKs); - } - return addOrderByPrimaryKeyToQuery(pCxt, pPrimaryKeyExpr, pInsert->pQuery); } 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 071/106] 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 072/106] 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 d4b8460baaceaa79d362d50c02d60669064b8e0f Mon Sep 17 00:00:00 2001 From: slzhou Date: Wed, 3 Apr 2024 15:48:56 +0800 Subject: [PATCH 073/106] fix: change delete condition error message --- source/libs/parser/src/parUtil.c | 2 +- source/util/src/terror.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 7c82555e63..ce0d719594 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -161,7 +161,7 @@ static char* getSyntaxErrFormat(int32_t errCode) { case TSDB_CODE_PAR_VALUE_TOO_LONG: return "Value too long for column/tag: %s"; case TSDB_CODE_PAR_INVALID_DELETE_WHERE: - return "The DELETE statement must have a definite time window range"; + return "The DELETE statement must only have a definite time window range"; case TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG: return "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes"; case TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC: diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 99666320f1..64edb7faad 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -601,7 +601,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY, "Window query not su TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DROP_COL, "No columns can be dropped") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be json type") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must have a definite time window range") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must only have a definite time window range") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG, "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC, "Fill not allowed") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_WINDOW_PC, "Invalid windows pc") From 1e8aaa273e89bdd6c1d47cdd8f82fe88d69f2302 Mon Sep 17 00:00:00 2001 From: kailixu Date: Wed, 3 Apr 2024 16:32:59 +0800 Subject: [PATCH 074/106] chore: more logic for num of pks --- source/libs/nodes/src/nodesCloneFuncs.c | 1 + source/libs/nodes/src/nodesCodeFuncs.c | 9 ++++++++- source/libs/nodes/src/nodesMsgFuncs.c | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 3e4b3cad31..e07fe07252 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -121,6 +121,7 @@ static int32_t columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) { COPY_SCALAR_FIELD(slotId); COPY_SCALAR_FIELD(tableHasPk); COPY_SCALAR_FIELD(isPk); + COPY_SCALAR_FIELD(numOfPKs); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index f000d87fdc..cdf23e512e 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -3618,6 +3618,7 @@ static const char* jkColumnDataBlockId = "DataBlockId"; static const char* jkColumnSlotId = "SlotId"; static const char* jkColumnTableHasPk = "TableHasPk"; static const char* jkColumnIsPk = "IsPk"; +static const char* jkColumnNumOfPKs = "NumOfPKs"; static int32_t columnNodeToJson(const void* pObj, SJson* pJson) { const SColumnNode* pNode = (const SColumnNode*)pObj; @@ -3662,6 +3663,9 @@ static int32_t columnNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkColumnIsPk, pNode->isPk); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkColumnNumOfPKs, pNode->numOfPKs); + } return code; } @@ -3707,7 +3711,10 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) { } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkColumnIsPk, &pNode->isPk); - } + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetSmallIntValue(pJson, jkColumnNumOfPKs, &pNode->numOfPKs); + } return code; } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 0639a161bd..2cb2995a1d 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -731,6 +731,9 @@ static int32_t columnNodeInlineToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeValueBool(pEncoder, pNode->isPk); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeValueI16(pEncoder, pNode->numOfPKs); + } return code; } @@ -778,6 +781,9 @@ static int32_t msgToColumnNodeInline(STlvDecoder* pDecoder, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tlvDecodeValueBool(pDecoder, &pNode->isPk); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvDecodeValueI16(pDecoder, &pNode->numOfPKs); + } return code; } From a0bf82878d8fe2e5720f2cfbbe3e71a6180c58bf Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 3 Apr 2024 09:11:49 +0000 Subject: [PATCH 075/106] 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 dc954e112e5f89da002ff9b25f4428ad7ed8b846 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 5 Apr 2024 19:47:59 +0800 Subject: [PATCH 076/106] fix(tsdb): add key for lastProcessKey, and remove invalid assign for key --- source/common/src/tdataformat.c | 2 +- source/dnode/vnode/src/inc/tsdb.h | 8 +- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 86 ++++++++---- source/dnode/vnode/src/tsdb/tsdbRead2.c | 142 +++++++++----------- source/dnode/vnode/src/tsdb/tsdbReadUtil.c | 23 ++-- source/dnode/vnode/src/tsdb/tsdbReadUtil.h | 51 ++++--- 6 files changed, 180 insertions(+), 132 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index ff25954fc1..179c1449fe 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1306,8 +1306,8 @@ int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc) { if (IS_NUMERIC_TYPE(pVal->type)) { pVal->val = pSrc->pks[i].val; } else { - memcpy(pVal->pData, pSrc->pks[i].pData, pVal->nData); pVal->nData = pSrc->pks[i].nData; + memcpy(pVal->pData, pSrc->pks[i].pData, pVal->nData); } } } diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 761e74b9cf..a574583561 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -758,9 +758,11 @@ typedef struct SBlockDataInfo { // todo: move away typedef struct { SArray *pUid; + SArray *pFirstTs; + SArray *pLastTs; + SArray *pCount; SArray *pFirstKey; SArray *pLastKey; - SArray *pCount; } SSttTableRowsInfo; typedef struct SSttBlockLoadInfo { @@ -836,7 +838,7 @@ struct SLDataIter { STimeWindow timeWindow; SVersionRange verRange; SSttBlockLoadInfo *pBlockLoadInfo; - SRowKey startRowKey; // current row key + SRowKey* pStartRowKey; // current row key __compar_fn_t comparFn; bool ignoreEarlierTs; struct SSttFileReader *pReader; @@ -870,7 +872,7 @@ typedef struct SMergeTreeConf { } SMergeTreeConf; typedef struct SSttDataInfoForTable { - SArray *pTimeWindowList; + SArray *pKeyRangeList; int64_t numOfRows; } SSttDataInfoForTable; diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index b3dd1dec0e..3af0d40382 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -359,18 +359,51 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl if (i < rows) { if (pBlockLoadInfo->info.pUid == NULL) { pBlockLoadInfo->info.pUid = taosArrayInit(rows, sizeof(int64_t)); - pBlockLoadInfo->info.pFirstKey = taosArrayInit(rows, sizeof(int64_t)); - pBlockLoadInfo->info.pLastKey = taosArrayInit(rows, sizeof(int64_t)); + pBlockLoadInfo->info.pFirstTs = taosArrayInit(rows, sizeof(int64_t)); + pBlockLoadInfo->info.pLastTs = taosArrayInit(rows, sizeof(int64_t)); pBlockLoadInfo->info.pCount = taosArrayInit(rows, sizeof(int64_t)); + + pBlockLoadInfo->info.pFirstKey = taosArrayInit(rows, sizeof(SValue)); + pBlockLoadInfo->info.pLastKey = taosArrayInit(rows, sizeof(SValue)); } if (pStatisBlkArray->data[k].maxTbid.suid == suid) { taosArrayAddBatch(pBlockLoadInfo->info.pUid, tBufferGetDataAt(&block.uids, i * sizeof(int64_t)), rows - i); - taosArrayAddBatch(pBlockLoadInfo->info.pFirstKey, + taosArrayAddBatch(pBlockLoadInfo->info.pFirstTs, tBufferGetDataAt(&block.firstKeyTimestamps, i * sizeof(int64_t)), rows - i); - taosArrayAddBatch(pBlockLoadInfo->info.pLastKey, - tBufferGetDataAt(&block.lastKeyTimestamps, i * sizeof(int64_t)), rows - i); + taosArrayAddBatch(pBlockLoadInfo->info.pLastTs, tBufferGetDataAt(&block.lastKeyTimestamps, i * sizeof(int64_t)), + rows - i); taosArrayAddBatch(pBlockLoadInfo->info.pCount, tBufferGetDataAt(&block.counts, i * sizeof(int64_t)), rows - i); + + SValue vFirst = {0}, vLast = {0}; + for (int32_t f = i; f < rows; ++f) { + int32_t code = tValueColumnGet(&block.firstKeyPKs[0], f, &vFirst); + if (code) { + break; + } + + if (IS_VAR_DATA_TYPE(vFirst.type)) { + char *p = (char *)vFirst.pData; + char *pBuf = taosMemoryMalloc(vFirst.nData); + memcpy(pBuf, p, vFirst.nData); + vFirst.pData = (uint8_t *)pBuf; + } + taosArrayPush(pBlockLoadInfo->info.pFirstKey, &vFirst); + + code = tValueColumnGet(&block.lastKeyPKs[0], f, &vLast); + if (code) { + break; + } + + if (IS_VAR_DATA_TYPE(vLast.type)) { + char *p = (char *)vLast.pData; + char *pBuf = taosMemoryMalloc(vLast.nData); + memcpy(pBuf, p, vLast.nData); + vLast.pData = (uint8_t *)pBuf; + } + taosArrayPush(pBlockLoadInfo->info.pLastKey, &vLast); + } + } else { STbStatisRecord record; while (i < rows) { @@ -380,9 +413,13 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl } taosArrayPush(pBlockLoadInfo->info.pUid, &record.uid); - taosArrayPush(pBlockLoadInfo->info.pFirstKey, &record.firstKey.ts); - taosArrayPush(pBlockLoadInfo->info.pLastKey, &record.lastKey.ts); taosArrayPush(pBlockLoadInfo->info.pCount, &record.count); + + taosArrayPush(pBlockLoadInfo->info.pFirstTs, &record.firstKey.ts); + taosArrayPush(pBlockLoadInfo->info.pLastTs, &record.lastKey.ts); + + taosArrayPush(pBlockLoadInfo->info.pFirstKey, &record.firstKey.pks[0]); + taosArrayPush(pBlockLoadInfo->info.pLastKey, &record.lastKey.pks[0]); i += 1; } } @@ -452,23 +489,26 @@ static int32_t uidComparFn(const void *p1, const void *p2) { } } -static void setSttInfoForCurrentTable(SSttBlockLoadInfo *pLoadInfo, uint64_t uid, STimeWindow *pTimeWindow, +static void setSttInfoForCurrentTable(SSttBlockLoadInfo *pLoadInfo, uint64_t uid, SSttKeyRange *pRange, int64_t *numOfRows) { - if (pTimeWindow == NULL || taosArrayGetSize(pLoadInfo->info.pUid) == 0) { + if (pRange == NULL || taosArrayGetSize(pLoadInfo->info.pUid) == 0) { return; } int32_t index = taosArraySearchIdx(pLoadInfo->info.pUid, &uid, uidComparFn, TD_EQ); if (index >= 0) { - pTimeWindow->skey = *(int64_t *)taosArrayGet(pLoadInfo->info.pFirstKey, index); - pTimeWindow->ekey = *(int64_t *)taosArrayGet(pLoadInfo->info.pLastKey, index); + pRange->skey.ts = *(int64_t *)taosArrayGet(pLoadInfo->info.pFirstTs, index); + pRange->ekey.ts = *(int64_t *)taosArrayGet(pLoadInfo->info.pLastTs, index); *numOfRows += *(int64_t *)taosArrayGet(pLoadInfo->info.pCount, index); + + memcpy(&pRange->skey.pks[0], taosArrayGet(pLoadInfo->info.pFirstKey, index), sizeof(SValue)); + memcpy(&pRange->ekey.pks[0], taosArrayGet(pLoadInfo->info.pLastKey, index), sizeof(SValue)); } } int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32_t cid, int8_t backward, - SMergeTreeConf *pConf, SSttBlockLoadInfo *pBlockLoadInfo, STimeWindow *pTimeWindow, + SMergeTreeConf *pConf, SSttBlockLoadInfo *pBlockLoadInfo, SSttKeyRange *pKeyRange, int64_t *numOfRows, const char *idStr) { int32_t code = TSDB_CODE_SUCCESS; @@ -481,7 +521,7 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32 pIter->timeWindow.ekey = pConf->timewindow.ekey; pIter->comparFn = pConf->comparFn; - tRowKeyAssign(&pIter->startRowKey, pConf->pCurRowKey); + pIter->pStartRowKey = pConf->pCurRowKey; pIter->pReader = pSttFileReader; pIter->pBlockLoadInfo = pBlockLoadInfo; @@ -500,7 +540,7 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32 } } - setSttInfoForCurrentTable(pBlockLoadInfo, pConf->uid, pTimeWindow, numOfRows); + setSttInfoForCurrentTable(pBlockLoadInfo, pConf->uid, pKeyRange, numOfRows); // find the start block, actually we could load the position to avoid repeatly searching for the start position when // the skey is updated. @@ -629,10 +669,10 @@ static void findNextValidRow(SLDataIter *pIter, const char *idStr) { continue; } - if (ts == pIter->timeWindow.skey && pIter->startRowKey.numOfPKs > 0) { + if (ts == pIter->timeWindow.skey && pIter->pStartRowKey->numOfPKs > 0) { SRowKey key; tColRowGetKey(pData, i, &key); - int32_t ret = pkCompEx(pIter->comparFn, &key, &pIter->startRowKey); + int32_t ret = pkCompEx(pIter->comparFn, &key, pIter->pStartRowKey); if (ret < 0) { continue; } @@ -646,10 +686,10 @@ static void findNextValidRow(SLDataIter *pIter, const char *idStr) { continue; } - if (ts == pIter->timeWindow.ekey && pIter->startRowKey.numOfPKs > 0) { + if (ts == pIter->timeWindow.ekey && pIter->pStartRowKey->numOfPKs > 0) { SRowKey key; tColRowGetKey(pData, i, &key); - int32_t ret = pkCompEx(pIter->comparFn, &key, &pIter->startRowKey); + int32_t ret = pkCompEx(pIter->comparFn, &key, pIter->pStartRowKey); if (ret > 0) { continue; } @@ -825,11 +865,11 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF memset(pIter, 0, sizeof(SLDataIter)); - STimeWindow w = {0}; - int64_t numOfRows = 0; - int64_t cid = pSttLevel->fobjArr->data[i]->f->cid; + SSttKeyRange range = {.skey.numOfPKs = pConf->pCurRowKey->numOfPKs, .ekey.numOfPKs = pConf->pCurRowKey->numOfPKs}; + int64_t numOfRows = 0; + int64_t cid = pSttLevel->fobjArr->data[i]->f->cid; - code = tLDataIterOpen2(pIter, pSttFileReader, cid, pMTree->backward, pConf, pLoadInfo, &w, &numOfRows, + code = tLDataIterOpen2(pIter, pSttFileReader, cid, pMTree->backward, pConf, pLoadInfo, &range, &numOfRows, pMTree->idStr); if (code != TSDB_CODE_SUCCESS) { goto _end; @@ -841,7 +881,7 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF // let's record the time window for current table of uid in the stt files if (pSttDataInfo != NULL && numOfRows > 0) { - taosArrayPush(pSttDataInfo->pTimeWindowList, &w); + taosArrayPush(pSttDataInfo->pKeyRangeList, &range); pSttDataInfo->numOfRows += numOfRows; } } else { diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 2e6a0a43e9..a12575f1c6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -49,8 +49,8 @@ static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, i STsdbReader* pReader); static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader); static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey, STsdbReader* pReader); -static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowKey* pRowKey, - SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* id); +static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, + SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* id); static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey* pCurKey, SArray* pDelList, STsdbReader* pReader); static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pTSRow, @@ -265,9 +265,11 @@ static STimeWindow updateQueryTimeWindow(STsdb* pTsdb, STimeWindow* pWindow) { // init file iterator static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetArray, STsdbReader* pReader) { - size_t numOfFileset = TARRAY2_SIZE(pFileSetArray); + SBlockLoadSuppInfo* pInfo = &pReader->suppInfo; + size_t numOfFileset = TARRAY2_SIZE(pFileSetArray); + bool asc = ASCENDING_TRAVERSE(pReader->info.order); - pIter->index = ASCENDING_TRAVERSE(pReader->info.order) ? -1 : numOfFileset; + pIter->index = asc ? -1 : numOfFileset; pIter->order = pReader->info.order; pIter->pFilesetList = pFileSetArray; pIter->numOfFiles = numOfFileset; @@ -281,15 +283,17 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA } } - SSttBlockReader* pLReader = pIter->pSttBlockReader; - pLReader->order = pReader->info.order; - pLReader->window = pReader->info.window; - pLReader->verRange = pReader->info.verRange; - pLReader->numOfPks = pReader->suppInfo.numOfPks; - pLReader->pkComparFn = pReader->pkComparFn; + SSttBlockReader* pSttReader = pIter->pSttBlockReader; + pSttReader->order = pReader->info.order; + pSttReader->window = pReader->info.window; + pSttReader->verRange = pReader->info.verRange; + pSttReader->numOfPks = pReader->suppInfo.numOfPks; + pSttReader->pkComparFn = pReader->pkComparFn; + pSttReader->uid = 0; + + tMergeTreeClose(&pSttReader->mergeTree); + initRowKey(&pSttReader->currentKey, INT64_MIN, pInfo->numOfPks, pInfo->pk.type, pInfo->pk.bytes, asc); - pLReader->uid = 0; - tMergeTreeClose(&pLReader->mergeTree); tsdbDebug("init fileset iterator, total files:%d %s", pIter->numOfFiles, pReader->idStr); return TSDB_CODE_SUCCESS; } @@ -1676,7 +1680,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* SRowKey* pSttKey = &(SRowKey){0}; if (hasDataInSttBlock(pBlockScanInfo) && (!pBlockScanInfo->cleanSttBlocks)) { - tRowKeyAssign(pSttKey, getCurrentKeyInSttBlock(pSttBlockReader)); + pSttKey = getCurrentKeyInSttBlock(pSttBlockReader); } else { pSttKey = NULL; } @@ -1753,8 +1757,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* if (code != TSDB_CODE_SUCCESS) { return code; } - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pSttKey, pMerger, pkSrcSlot, &pReader->info.verRange, - pReader->idStr); + doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); } if (pkCompEx(compFn, &minKey, &k) == 0) { @@ -1851,8 +1854,7 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader* } // pSttKey will be changed when sttBlockReader iterates to the next row, so use pKey instead. - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pKey, pMerger, pkSrcSlot, &pReader->info.verRange, - pReader->idStr); + doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -1966,15 +1968,14 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pfKey, pReader); } - if (pkCompEx(compFn, &minKey, pSttKey) == 0) { + if (pkCompEx(compFn, &minKey, &pBlockScanInfo->lastProcKey) == 0) { TSDBROW* pRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); code = tsdbRowMergerAdd(pMerger, pRow1, NULL); if (code != TSDB_CODE_SUCCESS) { return code; } - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pSttKey, pMerger, pkSrcSlot, &pReader->info.verRange, - pReader->idStr); + doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); } if (pkCompEx(compFn, &minKey, &ik) == 0) { @@ -2155,8 +2156,9 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, int32_t rowIndex, STable } static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, STsdbReader* pReader) { - bool hasData = true; - bool asc = ASCENDING_TRAVERSE(pReader->info.order); + bool hasData = true; + int32_t order = pReader->info.order; + bool asc = ASCENDING_TRAVERSE(order); // the stt block reader has been initialized for this table. if (pSttBlockReader->uid == pScanInfo->uid) { @@ -2206,7 +2208,7 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan .rspRows = (pReader->info.execMode == READER_EXEC_ROWS), }; - SSttDataInfoForTable info = {.pTimeWindowList = taosArrayInit(4, sizeof(STimeWindow))}; + SSttDataInfoForTable info = {.pKeyRangeList = taosArrayInit(4, sizeof(SSttKeyRange))}; int32_t code = tMergeTreeOpen2(&pSttBlockReader->mergeTree, &conf, &info); if (code != TSDB_CODE_SUCCESS) { return false; @@ -2216,44 +2218,41 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan initDelSkylineIterator(pScanInfo, pReader->info.order, &pReader->cost); if (conf.rspRows) { - pScanInfo->cleanSttBlocks = - isCleanSttBlock(info.pTimeWindowList, &pReader->info.window, pScanInfo, pReader->info.order); - + pScanInfo->cleanSttBlocks = isCleanSttBlock(info.pKeyRangeList, &pReader->info.window, pScanInfo, order); if (pScanInfo->cleanSttBlocks) { pScanInfo->numOfRowsInStt = info.numOfRows; - pScanInfo->sttWindow.skey = INT64_MAX; - pScanInfo->sttWindow.ekey = INT64_MIN; // calculate the time window for data in stt files - for (int32_t i = 0; i < taosArrayGetSize(info.pTimeWindowList); ++i) { - STimeWindow* pWindow = taosArrayGet(info.pTimeWindowList, i); - if (pScanInfo->sttWindow.skey > pWindow->skey) { - pScanInfo->sttWindow.skey = pWindow->skey; + for (int32_t i = 0; i < taosArrayGetSize(info.pKeyRangeList); ++i) { + SSttKeyRange* pKeyRange = taosArrayGet(info.pKeyRangeList, i); + if (pkCompEx(pReader->pkComparFn, &pScanInfo->sttRange.skey, &pKeyRange->skey) > 0) { + tRowKeyAssign(&pScanInfo->sttRange.skey, &pKeyRange->skey); } - if (pScanInfo->sttWindow.ekey < pWindow->ekey) { - pScanInfo->sttWindow.ekey = pWindow->ekey; + if (pkCompEx(pReader->pkComparFn, &pScanInfo->sttRange.ekey, &pKeyRange->ekey) < 0) { + tRowKeyAssign(&pScanInfo->sttRange.ekey, &pKeyRange->ekey); } } - pScanInfo->sttKeyInfo.status = taosArrayGetSize(info.pTimeWindowList) ? STT_FILE_HAS_DATA : STT_FILE_NO_DATA; + pScanInfo->sttKeyInfo.status = taosArrayGetSize(info.pKeyRangeList) ? STT_FILE_HAS_DATA : STT_FILE_NO_DATA; + + SRowKey* p = asc? &pScanInfo->sttRange.skey:&pScanInfo->sttRange.ekey; + tRowKeyAssign(&pScanInfo->sttKeyInfo.nextProcKey, p); - // todo set the primary key value - pScanInfo->sttKeyInfo.nextProcKey.ts = asc ? pScanInfo->sttWindow.skey : pScanInfo->sttWindow.ekey; hasData = (pScanInfo->sttKeyInfo.status == STT_FILE_HAS_DATA); } else { // not clean stt blocks - INIT_TIMEWINDOW(&pScanInfo->sttWindow); //reset the time window + INIT_KEYRANGE(&pScanInfo->sttRange); //reset the time window pScanInfo->sttBlockReturned = false; hasData = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pReader->suppInfo.pkSrcSlot, &pReader->info.verRange); } } else { pScanInfo->cleanSttBlocks = false; - INIT_TIMEWINDOW(&pScanInfo->sttWindow); // reset the time window + INIT_KEYRANGE(&pScanInfo->sttRange); // reset the time window pScanInfo->sttBlockReturned = false; hasData = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pReader->suppInfo.pkSrcSlot, &pReader->info.verRange); } - taosArrayDestroy(info.pTimeWindowList); + taosArrayDestroy(info.pKeyRangeList); int64_t el = taosGetTimestampUs() - st; pReader->cost.initSttBlockReader += (el / 1000.0); @@ -2318,29 +2317,26 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc } } -int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pBlockScanInfo, - STsdbReader* pReader) { - bool copied = false; - SRow* pTSRow = NULL; - SRowKey sttKey = {0}; - int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot; - - tRowKeyAssign(&sttKey, getCurrentKeyInSttBlock(pSttBlockReader)); - +int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, STsdbReader* pReader) { + bool copied = false; + SRow* pTSRow = NULL; + int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot; SRowMerger* pMerger = &pReader->status.merger; - TSDBROW* pRow = tMergeTreeGetRow(&pSttBlockReader->mergeTree); - TSDBROW fRow = {.iRow = pRow->iRow, .type = TSDBROW_COL_FMT, .pBlockData = pRow->pBlockData}; + // let's record the last processed key + tRowKeyAssign(&pScanInfo->lastProcKey, getCurrentKeyInSttBlock(pSttBlockReader)); + + TSDBROW* pRow = tMergeTreeGetRow(&pSttBlockReader->mergeTree); + TSDBROW fRow = {.iRow = pRow->iRow, .type = TSDBROW_COL_FMT, .pBlockData = pRow->pBlockData}; tsdbTrace("fRow ptr:%p, %d, uid:%" PRIu64 ", ts:%" PRId64 " %s", pRow->pBlockData, pRow->iRow, pSttBlockReader->uid, fRow.pBlockData->aTSKEY[fRow.iRow], pReader->idStr); - int32_t code = tryCopyDistinctRowFromSttBlock(&fRow, pSttBlockReader, pBlockScanInfo, &sttKey, pReader, &copied); + int32_t code = + tryCopyDistinctRowFromSttBlock(&fRow, pSttBlockReader, pScanInfo, &pScanInfo->lastProcKey, pReader, &copied); if (code) { return code; } - tRowKeyAssign(&pBlockScanInfo->lastProcKey, &sttKey); - if (copied) { return TSDB_CODE_SUCCESS; } else { @@ -2351,14 +2347,13 @@ int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanIn TSDBROW* pRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); tsdbRowMergerAdd(pMerger, pRow1, NULL); - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, &sttKey, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); - + doMergeRowsInSttBlock(pSttBlockReader, pScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { return code; } - code = doAppendRowFromTSRow(pReader->resBlockInfo.pResBlock, pReader, pTSRow, pBlockScanInfo); + code = doAppendRowFromTSRow(pReader->resBlockInfo.pResBlock, pReader, pTSRow, pScanInfo); taosMemoryFree(pTSRow); tsdbRowMergerClear(pMerger); @@ -2796,23 +2791,18 @@ static void buildCleanBlockFromSttFiles(STsdbReader* pReader, STableBlockScanInf pInfo->rows = pScanInfo->numOfRowsInStt; pInfo->id.uid = pScanInfo->uid; pInfo->dataLoad = 1; - pInfo->window = pScanInfo->sttWindow; + pInfo->window.skey = pScanInfo->sttRange.skey.ts; + pInfo->window.ekey = pScanInfo->sttRange.ekey.ts; setComposedBlockFlag(pReader, true); - pScanInfo->sttKeyInfo.nextProcKey.ts = asc ? pScanInfo->sttWindow.ekey + 1 : pScanInfo->sttWindow.skey - 1; + pScanInfo->sttKeyInfo.nextProcKey.ts = asc ? pScanInfo->sttRange.ekey.ts + 1 : pScanInfo->sttRange.skey.ts - 1; pScanInfo->sttKeyInfo.status = STT_FILE_NO_DATA; - pScanInfo->lastProcKey.ts = asc ? pScanInfo->sttWindow.ekey : pScanInfo->sttWindow.skey; - if (pScanInfo->lastProcKey.numOfPKs > 0) { - ASSERT(0); -// if (IS_NUMERIC_TYPE(pKey->pks[0].type)) { -// pKey->pks[0].val = asc ? pBlockInfo->lastPk.val : pBlockInfo->firstPk.val; -// } else { -// uint8_t* p = asc ? pBlockInfo->lastPk.pData : pBlockInfo->firstPk.pData; -// pKey->pks[0].nData = asc ? pBlockInfo->lastPKLen : pBlockInfo->firstPKLen; -// memcpy(pKey->pks[0].pData, p, pKey->pks[0].nData); -// } + if (asc) { + tRowKeyAssign(&pScanInfo->lastProcKey, &pScanInfo->sttRange.ekey); + } else { + tRowKeyAssign(&pScanInfo->lastProcKey, &pScanInfo->sttRange.skey); } pScanInfo->sttBlockReturned = true; @@ -3014,18 +3004,18 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { (!asc && pBlockInfo->firstKey > keyInStt)) { if (pScanInfo->cleanSttBlocks && hasDataInSttBlock(pScanInfo)) { if (asc) { // file block is located before the stt block - ASSERT(pScanInfo->sttWindow.skey > pBlockInfo->lastKey); + ASSERT(pScanInfo->sttRange.skey.ts > pBlockInfo->lastKey); } else { // stt block is before the file block - ASSERT(pScanInfo->sttWindow.ekey < pBlockInfo->firstKey); + ASSERT(pScanInfo->sttRange.ekey.ts < pBlockInfo->firstKey); } } buildCleanBlockFromDataFiles(pReader, pScanInfo, pBlockInfo, pBlockIter->index); } else { // clean stt block if (asc) { - ASSERT(pScanInfo->sttWindow.ekey < pBlockInfo->firstKey); + ASSERT(pScanInfo->sttRange.ekey.ts < pBlockInfo->firstKey); } else { - ASSERT(pScanInfo->sttWindow.skey > pBlockInfo->lastKey); + ASSERT(pScanInfo->sttRange.skey.ts > pBlockInfo->lastKey); } // return the stt file block @@ -3682,8 +3672,10 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc return TSDB_CODE_SUCCESS; } -int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowKey* pRowKey, - SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* idStr) { +int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowMerger* pMerger, + int32_t pkSrcSlot, SVersionRange* pVerRange, const char* idStr) { + SRowKey* pRowKey = &pScanInfo->lastProcKey; + while (nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pkSrcSlot, pVerRange)) { SRowKey* pNextKey = getCurrentKeyInSttBlock(pSttBlockReader); diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 86c6b70c92..48a6b9a7a8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -130,7 +130,7 @@ STableBlockScanInfo* getTableBlockScanInfo(SSHashObj* pTableMap, uint64_t uid, c return *p; } -static int32_t initSRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc) { +int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc) { pKey->numOfPKs = numOfPks; pKey->ts = ts; @@ -169,30 +169,33 @@ static int32_t initSRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t static void initLastProcKey(STableBlockScanInfo *pScanInfo, STsdbReader* pReader) { int32_t numOfPks = pReader->suppInfo.numOfPks; - bool asc = ASCENDING_TRAVERSE(pReader->info.order); + bool asc = ASCENDING_TRAVERSE(pReader->info.order); + int8_t type = pReader->suppInfo.pk.type; + int8_t bytes = pReader->suppInfo.pk.bytes; SRowKey* pRowKey = &pScanInfo->lastProcKey; if (asc) { int64_t skey = pReader->info.window.skey; int64_t ts = (skey > INT64_MIN) ? (skey - 1) : skey; - initSRowKey(pRowKey, ts, numOfPks, pReader->suppInfo.pk.type, pReader->suppInfo.pk.bytes, asc); - initSRowKey(&pScanInfo->sttKeyInfo.nextProcKey, skey, numOfPks, pReader->suppInfo.pk.type, - pReader->suppInfo.pk.bytes, asc); + initRowKey(pRowKey, ts, numOfPks, type, bytes, asc); + initRowKey(&pScanInfo->sttKeyInfo.nextProcKey, skey, numOfPks, type, bytes, asc); } else { int64_t ekey = pReader->info.window.ekey; int64_t ts = (ekey < INT64_MAX) ? (ekey + 1) : ekey; - initSRowKey(pRowKey, ts, numOfPks, pReader->suppInfo.pk.type, pReader->suppInfo.pk.bytes, asc); - initSRowKey(&pScanInfo->sttKeyInfo.nextProcKey, ekey, numOfPks, pReader->suppInfo.pk.type, - pReader->suppInfo.pk.bytes, asc); + initRowKey(pRowKey, ts, numOfPks, type, bytes, asc); + initRowKey(&pScanInfo->sttKeyInfo.nextProcKey, ekey, numOfPks, type, bytes, asc); } + + initRowKey(&pScanInfo->sttRange.skey, INT64_MAX, numOfPks, type, bytes, asc); + initRowKey(&pScanInfo->sttRange.ekey, INT64_MIN, numOfPks, type, bytes, asc); } int32_t initTableBlockScanInfo(STableBlockScanInfo* pScanInfo, uint64_t uid, SSHashObj* pTableMap, STsdbReader* pReader) { pScanInfo->uid = uid; - INIT_TIMEWINDOW(&pScanInfo->sttWindow); + INIT_KEYRANGE(&pScanInfo->sttRange); INIT_TIMEWINDOW(&pScanInfo->filesetWindow); pScanInfo->cleanSttBlocks = false; @@ -311,7 +314,7 @@ static void doCleanupInfoForNextFileset(STableBlockScanInfo* pScanInfo) { pScanInfo->cleanSttBlocks = false; pScanInfo->numOfRowsInStt = 0; pScanInfo->sttBlockReturned = false; - INIT_TIMEWINDOW(&pScanInfo->sttWindow); + INIT_KEYRANGE(&pScanInfo->sttRange); INIT_TIMEWINDOW(&pScanInfo->filesetWindow); pScanInfo->sttKeyInfo.status = STT_FILE_READER_UNINIT; } diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h index c48b7479dc..af7d00e019 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h @@ -32,6 +32,12 @@ extern "C" { (_w)->ekey = INT64_MIN; \ } while (0); +#define INIT_KEYRANGE(_k) \ + do { \ + (_k)->skey.ts = INT64_MAX; \ + (_k)->ekey.ts = INT64_MIN; \ + } while (0); + typedef enum { READER_STATUS_SUSPEND = 0x1, READER_STATUS_NORMAL = 0x2, @@ -78,34 +84,38 @@ typedef enum ESttKeyStatus { typedef struct SSttKeyInfo { ESttKeyStatus status; // this value should be updated when switch to the next fileset SRowKey nextProcKey; - // int64_t nextProcKey; // todo remove this attribute, since it is impossible to set correct nextProcKey - // value } SSttKeyInfo; +typedef struct SSttKeyRange { + SRowKey skey; + SRowKey ekey; +} SSttKeyRange; + // clean stt file blocks: // 1. not overlap with stt blocks in other stt files of the same fileset // 2. not overlap with delete skyline // 3. not overlap with in-memory data (mem/imem) // 4. not overlap with data file blocks typedef struct STableBlockScanInfo { - uint64_t uid; - SRowKey lastProcKey; - SSttKeyInfo sttKeyInfo; - SArray* pBlockList; // block data index list, SArray - SArray* pBlockIdxList; // SArray - SArray* pMemDelData; // SArray - SArray* pFileDelData; // SArray from each file set - SIterInfo iter; // mem buffer skip list iterator - SIterInfo iiter; // imem buffer skip list iterator - SArray* delSkyline; // delete info for this table - int32_t fileDelIndex; // file block delete index - int32_t sttBlockDelIndex; // delete index for last block - bool iterInit; // whether to initialize the in-memory skip list iterator or not - bool cleanSttBlocks; // stt block is clean in current fileset - bool sttBlockReturned; // result block returned alreay - int64_t numOfRowsInStt; - STimeWindow sttWindow; // timestamp window for current stt files - STimeWindow filesetWindow; // timestamp window for current file set + uint64_t uid; + SRowKey lastProcKey; + SSttKeyInfo sttKeyInfo; + SArray* pBlockList; // block data index list, SArray + SArray* pBlockIdxList; // SArray + SArray* pMemDelData; // SArray + SArray* pFileDelData; // SArray from each file set + SIterInfo iter; // mem buffer skip list iterator + SIterInfo iiter; // imem buffer skip list iterator + SArray* delSkyline; // delete info for this table + int32_t fileDelIndex; // file block delete index + int32_t sttBlockDelIndex; // delete index for last block + bool iterInit; // whether to initialize the in-memory skip list iterator or not + bool cleanSttBlocks; // stt block is clean in current fileset + bool sttBlockReturned; // result block returned alreay + int64_t numOfRowsInStt; + SSttKeyRange sttRange; + // STimeWindow sttWindow; // timestamp window for current stt files + STimeWindow filesetWindow; // timestamp window for current file set } STableBlockScanInfo; typedef struct SResultBlockInfo { @@ -336,6 +346,7 @@ int32_t tsdbGetRowsInSttFiles(STFileSet* pFileSet, SArray* pSttFileBlockIterArra bool isCleanSttBlock(SArray* pTimewindowList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo, int32_t order); bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SBrinRecord* pRecord, int32_t order); int32_t pkCompEx(__compar_fn_t comparFn, SRowKey* p1, SRowKey* p2); +int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc); typedef struct { SArray* pTombData; From e7ed8fbaa60daa14c0048cf04f4ed64f0a4ee846 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 6 Apr 2024 00:10:24 +0800 Subject: [PATCH 077/106] fix(tsdb): not copy range key if no pk exists. --- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 3af0d40382..d84d9c2999 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -502,8 +502,10 @@ static void setSttInfoForCurrentTable(SSttBlockLoadInfo *pLoadInfo, uint64_t uid *numOfRows += *(int64_t *)taosArrayGet(pLoadInfo->info.pCount, index); - memcpy(&pRange->skey.pks[0], taosArrayGet(pLoadInfo->info.pFirstKey, index), sizeof(SValue)); - memcpy(&pRange->ekey.pks[0], taosArrayGet(pLoadInfo->info.pLastKey, index), sizeof(SValue)); + if (pRange->skey.numOfPKs > 0) { + memcpy(&pRange->skey.pks[0], taosArrayGet(pLoadInfo->info.pFirstKey, index), sizeof(SValue)); + memcpy(&pRange->ekey.pks[0], taosArrayGet(pLoadInfo->info.pLastKey, index), sizeof(SValue)); + } } } 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 078/106] 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 079/106] 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 080/106] 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 081/106] 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 ead77fe767d9e1140e285939254ceb90332e9de5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 10:23:51 +0800 Subject: [PATCH 082/106] fix(tsdb): fix memory leak. --- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index d84d9c2999..e8b1f870c3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -75,6 +75,8 @@ void *destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { taosArrayDestroy(pLoadInfo->info.pFirstKey); taosArrayDestroy(pLoadInfo->info.pLastKey); taosArrayDestroy(pLoadInfo->info.pCount); + taosArrayDestroy(pLoadInfo->info.pFirstTs); + taosArrayDestroy(pLoadInfo->info.pLastTs); } taosArrayDestroy(pLoadInfo->aSttBlk); From 3fab74f21b4523bc53d887c5b260a8976d6e4100 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sun, 7 Apr 2024 10:48:52 +0800 Subject: [PATCH 083/106] fix: TD-29397 --- source/common/src/tdataformat.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 179c1449fe..5d1694ab90 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1197,11 +1197,16 @@ void tRowGetKey(SRow *row, SRowKey *key) { for (int32_t i = 0; i < row->numOfPKs; i++) { key->pks[i].type = indices[i].type; + uint8_t *tdata = data + indices[i].offset; + if (row->flag >> 4) { + tdata += tGetI16v(tdata, NULL); + } + if (IS_VAR_DATA_TYPE(indices[i].type)) { - key->pks[i].pData = data + indices[i].offset; + key->pks[i].pData = tdata; key->pks[i].pData += tGetU32v(key->pks[i].pData, &key->pks[i].nData); } else { - memcpy(&key->pks[i].val, data + indices[i].offset, tDataTypes[indices[i].type].bytes); + memcpy(&key->pks[i].val, tdata, tDataTypes[indices[i].type].bytes); } } } From f82505ba1661d186394ae75163eab2dabf53a3a5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 14:06:25 +0800 Subject: [PATCH 084/106] 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 16c17bbf726fe092bcf50cfd592452c77d327f9f Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 14:46:22 +0800 Subject: [PATCH 085/106] fix(tsdb): fix error in tsdbread. --- source/dnode/vnode/src/tsdb/tsdbRead2.c | 4 +-- source/dnode/vnode/src/tsdb/tsdbReadUtil.c | 32 +++++++++---------- source/libs/executor/src/timewindowoperator.c | 3 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index a12575f1c6..9fcc10e396 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -114,10 +114,10 @@ int32_t pkCompEx(__compar_fn_t comparFn, SRowKey* p1, SRowKey* p2) { if (p1->pks[0].nData == p2->pks[0].nData) { return 0; } else { - return p1->pks[0].nData > p2->pks[0].nData?1:-1; + return p1->pks[0].nData > p2->pks[0].nData ? 1 : -1; } } else { - return ret > 0? 1:-1; + return ret > 0 ? 1 : -1; } } else { return comparFn(&p1->pks[0].val, &p2->pks[0].val); diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 48a6b9a7a8..2a7b0140df 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -992,39 +992,39 @@ static bool overlapWithTimeWindow(STimeWindow* p1, STimeWindow* pQueryWindow, ST } static int32_t sortUidComparFn(const void* p1, const void* p2) { - const STimeWindow* px1 = p1; - const STimeWindow* px2 = p2; - if (px1->skey == px2->skey) { - return 0; - } else { - return px1->skey < px2->skey ? -1 : 1; - } + const SSttKeyRange* px1 = p1; + const SSttKeyRange* px2 = p2; + + int32_t ret = tRowKeyCompare(&px1, px2); + return ret; } -bool isCleanSttBlock(SArray* pTimewindowList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo, +bool isCleanSttBlock(SArray* pKeyRangeList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo, int32_t order) { // check if it overlap with del skyline - taosArraySort(pTimewindowList, sortUidComparFn); + taosArraySort(pKeyRangeList, sortUidComparFn); - int32_t num = taosArrayGetSize(pTimewindowList); + int32_t num = taosArrayGetSize(pKeyRangeList); if (num == 0) { return false; } - STimeWindow* p = taosArrayGet(pTimewindowList, 0); - if (overlapWithTimeWindow(p, pQueryWindow, pScanInfo, order)) { + SSttKeyRange* pRange = taosArrayGet(pKeyRangeList, 0); + STimeWindow w = {.skey = pRange->skey.ts, .ekey = pRange->ekey.ts}; + if (overlapWithTimeWindow(&w, pQueryWindow, pScanInfo, order)) { return false; } for (int32_t i = 0; i < num - 1; ++i) { - STimeWindow* p1 = taosArrayGet(pTimewindowList, i); - STimeWindow* p2 = taosArrayGet(pTimewindowList, i + 1); + SSttKeyRange* p1 = taosArrayGet(pKeyRangeList, i); + SSttKeyRange* p2 = taosArrayGet(pKeyRangeList, i + 1); - if (p1->ekey >= p2->skey) { + if (p1->ekey.ts >= p2->skey.ts) { return false; } - bool overlap = overlapWithTimeWindow(p2, pQueryWindow, pScanInfo, order); + STimeWindow w2 = {.skey = p2->skey.ts, .ekey = p2->ekey.ts}; + bool overlap = overlapWithTimeWindow(&w2, pQueryWindow, pScanInfo, order); if (overlap) { return false; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index f24b581ca2..8fb8aaa69d 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -520,9 +520,8 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB // duplicated ts row does not involve in the interpolation of end value for current time window int32_t x = endRowIndex; - while(x >= 0) { + while(x > 0) { if (tsCols[x] == tsCols[x-1]) { - x -= 1; } else { endRowIndex = x; From 6174c3bfd38876494eecd299243d0d27247706b7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sun, 7 Apr 2024 14:54:58 +0800 Subject: [PATCH 086/106] fix:disable primary key in schemaless --- include/util/taoserror.h | 1 + source/client/src/clientSml.c | 21 +++++++ source/util/src/terror.c | 1 + utils/test/c/sml_test.c | 104 ++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 3dc6e5333d..2389079fd2 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -806,6 +806,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_SML_INVALID_DB_CONF TAOS_DEF_ERROR_CODE(0, 0x3003) #define TSDB_CODE_SML_NOT_SAME_TYPE TAOS_DEF_ERROR_CODE(0, 0x3004) #define TSDB_CODE_SML_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x3005) +#define TSDB_CODE_SML_NOT_SUPPORT_PK TAOS_DEF_ERROR_CODE(0, 0x3006) //tsma #define TSDB_CODE_TSMA_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x3100) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6bcdb4e973..79c079f871 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -310,6 +310,16 @@ int32_t smlJoinMeasureTag(SSmlLineInfo *elements){ return TSDB_CODE_SUCCESS; } +static bool smlIsPKTable(STableMeta *pTableMeta){ + for(int i = 0; i < pTableMeta->tableInfo.numOfColumns; i++){ + if(pTableMeta->schema[i].flags & COL_IS_KEY){ + return true; + } + } + + return false; +} + int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements) { bool isSameMeasure = IS_SAME_SUPER_TABLE; if(isSameMeasure) { @@ -328,6 +338,11 @@ int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements) { info->currSTableMeta = sMeta->tableMeta; info->maxTagKVs = sMeta->tags; info->maxColKVs = sMeta->cols; + + if(smlIsPKTable(sMeta->tableMeta)){ + terrno = TSDB_CODE_SML_NOT_SUPPORT_PK; + return -1; + } return 0; } @@ -1063,6 +1078,12 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { goto end; } } else if (code == TSDB_CODE_SUCCESS) { + + if(smlIsPKTable(pTableMeta)){ + code = TSDB_CODE_SML_NOT_SUPPORT_PK; + goto end; + } + hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); for (uint16_t i = pTableMeta->tableInfo.numOfColumns; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 64edb7faad..9436ee33f8 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -668,6 +668,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_DATA, "Invalid data format TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_DB_CONF, "Invalid schemaless db config") TAOS_DEFINE_ERROR(TSDB_CODE_SML_NOT_SAME_TYPE, "Not the same type like before") TAOS_DEFINE_ERROR(TSDB_CODE_SML_INTERNAL_ERROR, "Internal error") +TAOS_DEFINE_ERROR(TSDB_CODE_SML_NOT_SUPPORT_PK, "Can not insert data into table with primary key") //tsma TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INIT_FAILED, "Tsma init failed") diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 01619decc5..fa76f829eb 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1841,12 +1841,116 @@ int sml_td18789_Test() { return code; } +int sml_td29373_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists td29373"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists td29373"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use td29373"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create table pktable (ts timestamp, f1 int primary key, f2 binary(10)) tags (t1 int)"); + taos_free_result(pRes); + + // case 1 + const char *sql[] = { + "pktable,t1=1 f1=283i32,f2=b\"hello\" 1632299372000", + "pktable,t1=2 f1=232i32,f2=b\"he3llo\" 1632299373000", + }; + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + int code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + // case 2 + const char *sql1[] = { + "pktable,t1=2 f2=b\"he3llo\",f1=232i32 1632299373000", + "pktable,t1=1 f1=283i32,f2=b\"hello\" 1632299372000" + }; + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + // case 3 + pRes = taos_query(taos, "create table pktablejson (ts timestamp, f1 int primary key, f2 binary(10)) tags (`host` varchar(8), dc varchar(8))"); + taos_free_result(pRes); + const char *sql2[] = { "" + "[\n" + " {\n" + " \"metric\": \"pktablejson\",\n" + " \"timestamp\": 1346846400001,\n" + " \"value\": 18,\n" + " \"tags\": {\n" + " \"host\": \"web01\",\n" + " \"dc\": \"lga\"\n" + " }\n" + " },\n" + " {\n" + " \"metric\": \"pktablejson\",\n" + " \"timestamp\": 1346846400002,\n" + " \"value\": 9,\n" + " \"tags\": {\n" + " \"host\": \"web02\",\n" + " \"dc\": \"lga\"\n" + " }\n" + " }\n" + "]" + }; + char *sql3[1] = {0}; + for (int i = 0; i < 1; i++) { + sql3[i] = taosMemoryCalloc(1, 1024); + strncpy(sql3[i], sql2[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + + // case 4 + const char *sql4[] = { + "pktablejson 1479496100 1.3E0 host=web01 dc=eth0", + "pktablejson 1479496100 1.2E0 dc=web01 host=eth0", + }; + + pRes = taos_schemaless_insert(taos, (char **)sql4, sizeof(sql4) / sizeof(sql4[0]), TSDB_SML_TELNET_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == TSDB_CODE_SML_NOT_SUPPORT_PK); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + int main(int argc, char *argv[]) { if (argc == 2) { taos_options(TSDB_OPTION_CONFIGDIR, argv[1]); } int ret = 0; + ret = sml_td29373_Test(); + ASSERT(!ret); ret = sml_td24559_Test(); ASSERT(!ret); ret = sml_td18789_Test(); From 64280a10ccb7b64bf038f52dec2c605c697401b1 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sun, 7 Apr 2024 15:04:34 +0800 Subject: [PATCH 087/106] fix:disable primary key in schemaless --- utils/test/c/sml_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index fa76f829eb..bf37e7a182 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1950,7 +1950,7 @@ int main(int argc, char *argv[]) { int ret = 0; ret = sml_td29373_Test(); - ASSERT(!ret); + ASSERT(ret); ret = sml_td24559_Test(); ASSERT(!ret); ret = sml_td18789_Test(); From ac6846d76c9d78b691ba1c162f72890626a0df27 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sun, 7 Apr 2024 14:41:00 +0800 Subject: [PATCH 088/106] 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 089/106] 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 090/106] 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 96fc85017b68de17e11b360f44edd7fa384dbe39 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 16:51:40 +0800 Subject: [PATCH 091/106] fix(query): fix error in interp --- source/libs/executor/src/timesliceoperator.c | 21 +++----------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 9b28a203b8..080fd6b914 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -206,28 +206,14 @@ static bool checkDuplicateTimestamps(STimeSliceOperatorInfo* pSliceInfo, SColumn cur.pks[0].type = pPkCol->info.type; } + // let's discard the duplicated ts if ((pSliceInfo->prevTsSet == true) && (currentTs == pSliceInfo->prevKey.ts)) { -// if (pPkCol == NULL) { - return true; - /* } else { - tRowGetKeyFromColData(currentTs, pPkCol, curIndex, &cur); - if (tRowKeyCompare(&cur, &pSliceInfo->prevKey) == 0) { - return true; - } - }*/ + return true; } pSliceInfo->prevTsSet = true; tRowKeyAssign(&pSliceInfo->prevKey, &cur); - // todo handle next - if (currentTs == pSliceInfo->win.ekey && curIndex < rows - 1) { - int64_t nextTs = *(int64_t*)colDataGetData(pTsCol, curIndex + 1); - if (currentTs == nextTs) { - return true; - } - } - return false; } @@ -735,7 +721,6 @@ static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pS // check for duplicate timestamps if (checkDuplicateTimestamps(pSliceInfo, pTsCol, pPkCol, i, pBlock->info.rows)) { continue; -// T_LONG_JMP(pTaskInfo->env, TSDB_CODE_FUNC_DUP_TIMESTAMP); } if (checkNullRow(&pOperator->exprSupp, pBlock, i, ignoreNull)) { @@ -754,6 +739,7 @@ static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pS if (checkWindowBoundReached(pSliceInfo)) { break; } + if (checkThresholdReached(pSliceInfo, pOperator->resultInfo.threshold)) { saveBlockStatus(pSliceInfo, pBlock, i); return; @@ -828,7 +814,6 @@ static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pS // if reached here, meaning block processing finished naturally, // or interpolation reach window upper bound pSliceInfo->pRemainRes = NULL; - } static void genInterpAfterDataBlock(STimeSliceOperatorInfo* pSliceInfo, SOperatorInfo* pOperator, int32_t index) { From b649a73a19d52004866cbe06435cf2956779cac4 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Wed, 3 Apr 2024 09:34:56 +0800 Subject: [PATCH 092/106] feat: pk insert/drop last cache --- source/dnode/vnode/src/inc/tsdb.h | 8 +- source/dnode/vnode/src/inc/vnodeInt.h | 4 +- source/dnode/vnode/src/meta/metaTable.c | 16 +- source/dnode/vnode/src/tsdb/tsdbCache.c | 367 +++++++++++++++------ source/dnode/vnode/src/tsdb/tsdbMemTable.c | 12 +- 5 files changed, 279 insertions(+), 128 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index a574583561..a082d33a02 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -895,11 +895,17 @@ typedef enum { } EExecMode; typedef struct { - TSKEY ts; + SRowKey rowKey; int8_t dirty; SColVal colVal; } SLastCol; +typedef struct { + TSKEY ts; + int8_t dirty; + SColVal colVal; +} SLastColV1; + int32_t tsdbOpenCache(STsdb *pTsdb); void tsdbCloseCache(STsdb *pTsdb); int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *row); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index d564c5a36e..30b7e685a1 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -234,9 +234,9 @@ int32_t tsdbCacheNewTable(STsdb* pTsdb, int64_t uid, tb_uid_t suid, SSchemaWrapp int32_t tsdbCacheDropTable(STsdb* pTsdb, int64_t uid, tb_uid_t suid, SSchemaWrapper* pSchemaRow); int32_t tsdbCacheDropSubTables(STsdb* pTsdb, SArray* uids, tb_uid_t suid); int32_t tsdbCacheNewSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t col_type); -int32_t tsdbCacheDropSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t col_type); +int32_t tsdbCacheDropSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, bool hasPrimayKey); int32_t tsdbCacheNewNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type); -int32_t tsdbCacheDropNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type); +int32_t tsdbCacheDropNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, bool hasPrimayKey); int32_t tsdbCompact(STsdb* pTsdb, SCompactInfo* pInfo); int32_t tsdbRetention(STsdb* tsdb, int64_t now, int32_t sync); int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq2* pMsg); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 3c032f193a..17adf80f06 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -449,18 +449,20 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { tsdbCacheNewSTableColumn(pTsdb, uids, cid, col_type); } else if (deltaCol == -1) { int16_t cid = -1; - int8_t col_type = -1; + bool hasPrimaryKey = false; + if (onCols >= 2) { + hasPrimaryKey = (oStbEntry.stbEntry.schemaRow.pSchema[1].flags & COL_IS_KEY) ? true : false; + } for (int i = 0, j = 0; i < nCols && j < onCols; ++i, ++j) { if (pReq->schemaRow.pSchema[i].colId != oStbEntry.stbEntry.schemaRow.pSchema[j].colId) { cid = oStbEntry.stbEntry.schemaRow.pSchema[j].colId; - col_type = oStbEntry.stbEntry.schemaRow.pSchema[j].type; break; } } if (cid != -1) { metaGetSubtables(pMeta, pReq->suid, uids); - tsdbCacheDropSTableColumn(pTsdb, uids, cid, col_type); + tsdbCacheDropSTableColumn(pTsdb, uids, cid, hasPrimaryKey); } } if (uids) taosArrayDestroy(uids); @@ -1478,6 +1480,11 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl terrno = TSDB_CODE_VND_COL_SUBSCRIBED; goto _err; } + bool hasPrimayKey = false; + if (pSchema->nCols >= 2) { + hasPrimayKey = pSchema->pSchema[1].flags & COL_IS_KEY ? true : false; + } + pSchema->version++; tlen = (pSchema->nCols - iCol - 1) * sizeof(SSchema); if (tlen) { @@ -1489,9 +1496,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl if (!TSDB_CACHE_NO(pMeta->pVnode->config)) { int16_t cid = pColumn->colId; - int8_t col_type = pColumn->type; - (void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type); + (void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, hasPrimayKey); } break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index c293b63f5d..977ef177d2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -127,12 +127,25 @@ static void tsdbClosePgCache(STsdb *pTsdb) { #define ROCKS_KEY_LEN (sizeof(tb_uid_t) + sizeof(int16_t) + sizeof(int8_t)) +enum { + LFLAG_LAST_ROW = 0, + LFLAG_LAST = 1, + LFLAG_PRIMARY_KEY = (1 << 4), +}; + typedef struct { tb_uid_t uid; int16_t cid; - int8_t ltype; + int8_t lflag; } SLastKey; +#define LAST_COL_VERSION_BASE (((int64_t)(0x1)) << 63) +#define LAST_COL_VERSION (LAST_COL_VERSION_BASE + 2) + +#define HAS_PRIMARY_KEY(k) (((k).lflag & LFLAG_PRIMARY_KEY) == LFLAG_PRIMARY_KEY) +#define IS_LAST_ROW_KEY(k) (((k).lflag & LFLAG_LAST) == LFLAG_LAST_ROW) +#define IS_LAST_KEY(k) (((k).lflag & LFLAG_LAST) == LFLAG_LAST) + static void tsdbGetRocksPath(STsdb *pTsdb, char *path) { SVnode *pVnode = pTsdb->pVnode; vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN); @@ -167,9 +180,9 @@ static int myCmp(void *state, const char *a, size_t alen, const char *b, size_t return 1; } - if (lhs->ltype < rhs->ltype) { + if (lhs->lflag < rhs->lflag) { return -1; - } else if (lhs->ltype > rhs->ltype) { + } else if (lhs->lflag > rhs->lflag) { return 1; } @@ -322,16 +335,62 @@ static void rocksMayWrite(STsdb *pTsdb, bool force, bool read, bool lock) { } } -static SLastCol *tsdbCacheDeserialize(char const *value) { +// note: new object do not own colVal's resource, just copy the pointer +static SLastCol *tsdbCacheConvertLastColV1(SLastColV1 *pLastColV1) { + SLastCol *pLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); + if (pLastCol == NULL) return NULL; + pLastCol->rowKey.ts = pLastColV1->ts; + pLastCol->rowKey.numOfPKs = 0; + pLastCol->dirty = pLastColV1->dirty; + pLastCol->colVal = pLastColV1->colVal; + + return pLastCol; +} + +static SLastCol *tsdbCacheDeserializeV1(char const *value) { if (!value) { return NULL; } - SLastCol *pLastCol = (SLastCol *)value; - SColVal *pColVal = &pLastCol->colVal; + SLastColV1 *pLastColV1 = (SLastColV1 *)value; + SColVal *pColVal = &pLastColV1->colVal; if (IS_VAR_DATA_TYPE(pColVal->value.type)) { if (pColVal->value.nData > 0) { - pColVal->value.pData = (char *)value + sizeof(*pLastCol); + pColVal->value.pData = (char *)value + sizeof(*pLastColV1); + } else { + pColVal->value.pData = NULL; + } + } + + return tsdbCacheConvertLastColV1(pLastColV1); +} + +static SLastCol *tsdbCacheDeserializeV2(char const *value) { + if (!value) { + return NULL; + } + + SLastCol *pLastCol = taosMemoryMalloc(sizeof(SLastCol)); + *pLastCol = *(SLastCol *)(value); + + char* currentPos = (char *)value + 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)) { + if (pValue->nData > 0) { + pValue->pData = currentPos; + currentPos += pValue->nData; + } else { + pValue->pData = NULL; + } + } + } + + SColVal *pColVal = &pLastCol->colVal; + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + if (pColVal->value.nData > 0) { + pColVal->value.pData = currentPos; + currentPos += pColVal->value.nData; } else { pColVal->value.pData = NULL; } @@ -340,25 +399,68 @@ static SLastCol *tsdbCacheDeserialize(char const *value) { return pLastCol; } +static SLastCol *tsdbCacheDeserialize(char const *value) { + if (!value) { + return NULL; + } + + bool hasVersion = ((*(int64_t *)value) & LAST_COL_VERSION_BASE) == LAST_COL_VERSION_BASE; + if (!hasVersion) { + return tsdbCacheDeserializeV1(value); + } + return tsdbCacheDeserializeV2(value + sizeof(int64_t)); +} + +static uint32_t tsdbCacheCopyVarData(SValue *from, SValue *to) { + ASSERT(from->nData >= 0); + if (from->nData > 0) { + memcpy(to->pData, from->pData, from->nData); + } + to->type = from->type; + to->nData = from->nData; + return from->nData; +} + static void tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size) { SColVal *pColVal = &pLastCol->colVal; - size_t length = sizeof(*pLastCol); + size_t length = sizeof(int64_t) + 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; + } + } if (IS_VAR_DATA_TYPE(pColVal->value.type)) { length += pColVal->value.nData; } - *value = taosMemoryMalloc(length); - *(SLastCol *)(*value) = *pLastCol; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - uint8_t *pVal = pColVal->value.pData; - SColVal *pDColVal = &((SLastCol *)(*value))->colVal; - pDColVal->value.pData = *value + sizeof(*pLastCol); - if (pColVal->value.nData > 0) { - memcpy(pDColVal->value.pData, pVal, pColVal->value.nData); - } else { - pDColVal->value.pData = NULL; + // 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; + *pToLastCol = *pLastCol; + currentPos += sizeof(*pLastCol); + + // copy var data pks + for (int8_t i = 0; i < pLastCol->rowKey.numOfPKs; i++) { + SValue *pFromValue = &pLastCol->rowKey.pks[i]; + if (IS_VAR_DATA_TYPE(pFromValue->type)) { + SValue *pToValue = &pToLastCol->rowKey.pks[i]; + pToValue->pData = (pFromValue->nData == 0) ? NULL : currentPos; + currentPos += tsdbCacheCopyVarData(pFromValue, pToValue); } } + + // copy var data value + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + SValue *pFromValue = &pColVal->value; + SValue *pToValue = &pToLastCol->colVal.value; + pToValue->pData = (pFromValue->nData == 0) ? NULL : currentPos; + currentPos += tsdbCacheCopyVarData(pFromValue, pToValue); + } *size = length; } @@ -459,13 +561,16 @@ static void tsdbCacheDeleter(const void *key, size_t klen, void *value, void *ud taosMemoryFree(value); } -static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t ltype) { +static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t lflag) { int32_t code = 0; SLRUCache *pCache = pTsdb->lruCache; rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch; - SLastCol noneCol = {.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, col_type), .dirty = 1}; - SLastCol *pLastCol = &noneCol; + SRowKey noneRowKey = {0}; + noneRowKey.ts = TSKEY_MIN; + noneRowKey.numOfPKs = 0; + SLastCol noneCol = {.rowKey = noneRowKey, .colVal = COL_VAL_NONE(cid, col_type), .dirty = 1}; + SLastCol *pLastCol = &noneCol; SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); *pTmpLastCol = *pLastCol; @@ -477,7 +582,7 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i charge += pLastCol->colVal.value.nData; } - SLastKey *pLastKey = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}; + SLastKey *pLastKey = &(SLastKey){.lflag = lflag, .uid = uid, .cid = cid}; LRUStatus status = taosLRUCacheInsert(pCache, pLastKey, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState); if (status != TAOS_LRU_STATUS_OK) { @@ -519,7 +624,7 @@ int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) { return code; } -static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t ltype) { +static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, bool hasPrimaryKey) { int32_t code = 0; // build keys & multi get from rocks @@ -527,9 +632,11 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, size_t *keys_list_sizes = taosMemoryCalloc(2, sizeof(size_t)); const size_t klen = ROCKS_KEY_LEN; + int8_t lflag = hasPrimaryKey ? LFLAG_PRIMARY_KEY : 0; + char *keys = taosMemoryCalloc(2, sizeof(SLastKey)); - ((SLastKey *)keys)[0] = (SLastKey){.ltype = 1, .uid = uid, .cid = cid}; - ((SLastKey *)keys)[1] = (SLastKey){.ltype = 0, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[0] = (SLastKey){.lflag = lflag | LFLAG_LAST, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[1] = (SLastKey){.lflag = lflag | LFLAG_LAST_ROW, .uid = uid, .cid = cid}; keys_list[0] = keys; keys_list[1] = keys + sizeof(SLastKey); @@ -588,6 +695,8 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, if (erase) { taosLRUCacheErase(pTsdb->lruCache, keys_list[1], klen); } + + taosMemoryFree(pLastCol); } taosMemoryFree(keys_list[0]); @@ -606,13 +715,18 @@ int32_t tsdbCacheNewTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWrap taosThreadMutexLock(&pTsdb->lruMutex); if (suid < 0) { - int nCols = pSchemaRow->nCols; + int8_t lflag = 0; + int nCols = pSchemaRow->nCols; + if (nCols >= 2) { + lflag = (pSchemaRow->pSchema[1].flags & COL_IS_KEY) ? LFLAG_PRIMARY_KEY : 0; + } + for (int i = 0; i < nCols; ++i) { int16_t cid = pSchemaRow->pSchema[i].colId; int8_t col_type = pSchemaRow->pSchema[i].type; - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST_ROW); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST); } } else { STSchema *pTSchema = NULL; @@ -622,13 +736,18 @@ int32_t tsdbCacheNewTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWrap return -1; } - int nCols = pTSchema->numOfCols; + int8_t lflag = 0; + int nCols = pTSchema->numOfCols; + if (nCols >= 2) { + lflag = (pTSchema->columns[1].flags & COL_IS_KEY) ? LFLAG_PRIMARY_KEY : 0; + } + for (int i = 0; i < nCols; ++i) { int16_t cid = pTSchema->columns[i].colId; int8_t col_type = pTSchema->columns[i].type; - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST_ROW); + (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, lflag | LFLAG_LAST); } taosMemoryFree(pTSchema); @@ -646,14 +765,17 @@ int32_t tsdbCacheDropTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWra (void)tsdbCacheCommitNoLock(pTsdb); - if (suid < 0) { - int nCols = pSchemaRow->nCols; + if (pSchemaRow != NULL) { + bool hasPrimayKey = false; + int nCols = pSchemaRow->nCols; + if (nCols >= 2) { + hasPrimayKey = (pSchemaRow->pSchema[1].flags & COL_IS_KEY) ? true : false; + } for (int i = 0; i < nCols; ++i) { int16_t cid = pSchemaRow->pSchema[i].colId; int8_t col_type = pSchemaRow->pSchema[i].type; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } } else { STSchema *pTSchema = NULL; @@ -663,13 +785,16 @@ int32_t tsdbCacheDropTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWra return -1; } - int nCols = pTSchema->numOfCols; + bool hasPrimayKey = false; + int nCols = pTSchema->numOfCols; + if (nCols >= 2) { + hasPrimayKey = (pTSchema->columns[1].flags & COL_IS_KEY) ? true : false; + } for (int i = 0; i < nCols; ++i) { int16_t cid = pTSchema->columns[i].colId; int8_t col_type = pTSchema->columns[i].type; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } taosMemoryFree(pTSchema); @@ -698,13 +823,17 @@ int32_t tsdbCacheDropSubTables(STsdb *pTsdb, SArray *uids, tb_uid_t suid) { for (int i = 0; i < TARRAY_SIZE(uids); ++i) { int64_t uid = ((tb_uid_t *)TARRAY_DATA(uids))[i]; - int nCols = pTSchema->numOfCols; + bool hasPrimayKey = false; + int nCols = pTSchema->numOfCols; + if (nCols >= 2) { + hasPrimayKey = (pTSchema->columns[1].flags & COL_IS_KEY) ? true : false; + } + for (int i = 0; i < nCols; ++i) { int16_t cid = pTSchema->columns[i].colId; int8_t col_type = pTSchema->columns[i].type; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } } @@ -732,15 +861,14 @@ int32_t tsdbCacheNewNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t return code; } -int32_t tsdbCacheDropNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type) { +int32_t tsdbCacheDropNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, bool hasPrimayKey) { int32_t code = 0; taosThreadMutexLock(&pTsdb->lruMutex); (void)tsdbCacheCommitNoLock(pTsdb); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); rocksMayWrite(pTsdb, true, false, true); @@ -768,7 +896,7 @@ int32_t tsdbCacheNewSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_t return code; } -int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_t col_type) { +int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, bool hasPrimayKey) { int32_t code = 0; taosThreadMutexLock(&pTsdb->lruMutex); @@ -778,8 +906,7 @@ int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_ for (int i = 0; i < TARRAY_SIZE(uids); ++i) { int64_t uid = ((tb_uid_t *)TARRAY_DATA(uids))[i]; - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0); - (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1); + (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, hasPrimayKey); } rocksMayWrite(pTsdb, true, false, true); @@ -794,6 +921,58 @@ typedef struct { SLastKey key; } SIdxKey; +static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal *pColVal) { + uint8_t *pVal = NULL; + int nData = 0; + + // update rowkey + pLastCol->rowKey.ts = pRowKey->ts; + pLastCol->rowKey.numOfPKs = pRowKey->numOfPKs; + for (int8_t i = 0; i < pRowKey->numOfPKs; i++) { + SValue *pPKValue = &pLastCol->rowKey.pks[i]; + SValue *pNewPKValue = &pRowKey->pks[i]; + + if (IS_VAR_DATA_TYPE(pPKValue->type)) { + pVal = pPKValue->pData; + nData = pPKValue->nData; + } + *pPKValue = *pNewPKValue; + if (IS_VAR_DATA_TYPE(pPKValue->type)) { + if (nData < pPKValue->nData) { + taosMemoryFree(pVal); + pPKValue->pData = taosMemoryCalloc(1, pNewPKValue->nData); + } else { + pPKValue->pData = pVal; + } + if (pNewPKValue->nData) { + memcpy(pPKValue->pData, pNewPKValue->pData, pNewPKValue->nData); + } + } + } + + // update colval + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + nData = pLastCol->colVal.value.nData; + pVal = pLastCol->colVal.value.pData; + } + pLastCol->colVal = *pColVal; + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { + if (nData < pColVal->value.nData) { + taosMemoryFree(pVal); + pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData); + } else { + pLastCol->colVal.value.pData = pVal; + } + if (pColVal->value.nData) { + memcpy(pLastCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); + } + } + + if (!pLastCol->dirty) { + pLastCol->dirty = 1; + } +} + int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow) { int32_t code = 0; @@ -821,46 +1000,28 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow // 3, build keys & multi get from rocks int num_keys = TARRAY_SIZE(aColVal); - TSKEY keyTs = TSDBROW_TS(pRow); SArray *remainCols = NULL; SLRUCache *pCache = pTsdb->lruCache; + STsdbRowKey tsdbRowKey = {0}; + tsdbRowGetKey(pRow, &tsdbRowKey); + SRowKey *pRowKey = &tsdbRowKey.key; + int8_t lflag = (pRowKey->numOfPKs != 0) ? LFLAG_PRIMARY_KEY : 0; + taosThreadMutexLock(&pTsdb->lruMutex); for (int i = 0; i < num_keys; ++i) { SColVal *pColVal = (SColVal *)taosArrayGet(aColVal, i); int16_t cid = pColVal->cid; - SLastKey *key = &(SLastKey){.ltype = 0, .uid = uid, .cid = cid}; + SLastKey *key = &(SLastKey){.lflag = lflag | LFLAG_LAST_ROW, .uid = uid, .cid = cid}; size_t klen = ROCKS_KEY_LEN; LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); - if (pLastCol->ts <= keyTs) { - uint8_t *pVal = NULL; - int nData = pLastCol->colVal.value.nData; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - pVal = pLastCol->colVal.value.pData; - } - pLastCol->ts = keyTs; - pLastCol->colVal = *pColVal; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - if (nData < pColVal->value.nData) { - taosMemoryFree(pVal); - pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData); - } else { - pLastCol->colVal.value.pData = pVal; - } - if (pColVal->value.nData) { - memcpy(pLastCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - } - - if (!pLastCol->dirty) { - pLastCol->dirty = 1; - } + if (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1) { + tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal); } - taosLRUCacheRelease(pCache, h, false); } else { if (!remainCols) { @@ -870,36 +1031,14 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow } if (COL_VAL_IS_VALUE(pColVal)) { - key->ltype = 1; + key->lflag = lflag | LFLAG_LAST; LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); - if (pLastCol->ts <= keyTs) { - uint8_t *pVal = NULL; - int nData = pLastCol->colVal.value.nData; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - pVal = pLastCol->colVal.value.pData; - } - pLastCol->ts = keyTs; - pLastCol->colVal = *pColVal; - if (IS_VAR_DATA_TYPE(pColVal->value.type)) { - if (nData < pColVal->value.nData) { - taosMemoryFree(pVal); - pLastCol->colVal.value.pData = taosMemoryCalloc(1, pColVal->value.nData); - } else { - pLastCol->colVal.value.pData = pVal; - } - if (pColVal->value.nData) { - memcpy(pLastCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - } - - if (!pLastCol->dirty) { - pLastCol->dirty = 1; - } + if (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1) { + tsdbCacheUpdateLastCol(pLastCol, pRowKey, pColVal); } - taosLRUCacheRelease(pCache, h, false); } else { if (!remainCols) { @@ -943,11 +1082,11 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); - if (idxKey->key.ltype == 0) { - if (NULL == pLastCol || pLastCol->ts <= keyTs) { + if (IS_LAST_ROW_KEY(idxKey->key)) { + if (NULL == pLastCol || (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1)) { char *value = NULL; size_t vlen = 0; - tsdbCacheSerialize(&(SLastCol){.ts = keyTs, .colVal = *pColVal}, &value, &vlen); + tsdbCacheSerialize(&(SLastCol){.rowKey = *pRowKey, .colVal = *pColVal}, &value, &vlen); // SLastKey key = (SLastKey){.ltype = 0, .uid = uid, .cid = pColVal->cid}; taosThreadMutexLock(&pTsdb->rCache.rMutex); @@ -976,10 +1115,10 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow } } else { if (COL_VAL_IS_VALUE(pColVal)) { - if (NULL == pLastCol || pLastCol->ts <= keyTs) { + if (NULL == pLastCol || (tRowKeyCompare(&pLastCol->rowKey, pRowKey) != 1)) { char *value = NULL; size_t vlen = 0; - tsdbCacheSerialize(&(SLastCol){.ts = keyTs, .colVal = *pColVal}, &value, &vlen); + tsdbCacheSerialize(&(SLastCol){.rowKey = *pRowKey, .colVal = *pColVal}, &value, &vlen); // SLastKey key = (SLastKey){.ltype = 1, .uid = uid, .cid = pColVal->cid}; taosThreadMutexLock(&pTsdb->rCache.rMutex); @@ -1007,6 +1146,8 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow taosMemoryFree(value); } } + + taosMemoryFree(pLastCol); } rocksdb_free(values_list[i]); @@ -1409,6 +1550,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA taosArraySet(pLastArray, idxKey->idx, &lastCol); taosArrayRemove(remainCols, j); + taosMemoryFree(pLastCol); taosMemoryFree(values_list[i]); } else { ++j; @@ -1517,12 +1659,18 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE char **keys_list = taosMemoryCalloc(num_keys * 2, sizeof(char *)); size_t *keys_list_sizes = taosMemoryCalloc(num_keys * 2, sizeof(size_t)); const size_t klen = ROCKS_KEY_LEN; + + int8_t lflag = 0; + if (num_keys >= 2) { + lflag = (pTSchema->columns[1].flags & COL_IS_KEY) ? LFLAG_PRIMARY_KEY : 0; + } + for (int i = 0; i < num_keys; ++i) { int16_t cid = pTSchema->columns[i].colId; char *keys = taosMemoryCalloc(2, sizeof(SLastKey)); - ((SLastKey *)keys)[0] = (SLastKey){.ltype = 1, .uid = uid, .cid = cid}; - ((SLastKey *)keys)[1] = (SLastKey){.ltype = 0, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[0] = (SLastKey){.lflag = lflag | LFLAG_LAST, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[1] = (SLastKey){.lflag = lflag | LFLAG_LAST_ROW, .uid = uid, .cid = cid}; keys_list[i] = keys; keys_list[num_keys + i] = keys + sizeof(SLastKey); @@ -1554,15 +1702,16 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE for (int i = 0; i < num_keys; ++i) { SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); taosThreadMutexLock(&pTsdb->rCache.rMutex); - if (NULL != pLastCol && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) { + if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) { rocksdb_writebatch_delete(wb, keys_list[i], klen); } pLastCol = tsdbCacheDeserialize(values_list[i + num_keys]); - if (NULL != pLastCol && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) { + if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) { rocksdb_writebatch_delete(wb, keys_list[num_keys + i], klen); } taosThreadMutexUnlock(&pTsdb->rCache.rMutex); + taosMemoryFree(pLastCol); rocksdb_free(values_list[i]); rocksdb_free(values_list[i + num_keys]); @@ -1575,7 +1724,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE if (pLastCol->dirty) { pLastCol->dirty = 0; } - if (pLastCol->ts <= eKey && pLastCol->ts >= sKey) { + if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) { erase = true; } taosLRUCacheRelease(pTsdb->lruCache, h, erase); @@ -1591,7 +1740,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE if (pLastCol->dirty) { pLastCol->dirty = 0; } - if (pLastCol->ts <= eKey && pLastCol->ts >= sKey) { + if (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey) { erase = true; } taosLRUCacheRelease(pTsdb->lruCache, h, erase); diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 8be8fa5bd7..be15a4fecf 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -194,18 +194,8 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid pMemTable->nDel++; pMemTable->minVer = TMIN(pMemTable->minVer, version); pMemTable->maxVer = TMAX(pMemTable->maxVer, version); - /* - if (TSDB_CACHE_LAST_ROW(pMemTable->pTsdb->pVnode->config) && tsdbKeyCmprFn(&lastKey, &pTbData->maxKey) >= 0) { - tsdbCacheDeleteLastrow(pTsdb->lruCache, pTbData->uid, eKey); - } - if (TSDB_CACHE_LAST(pMemTable->pTsdb->pVnode->config)) { - tsdbCacheDeleteLast(pTsdb->lruCache, pTbData->uid, eKey); - } - */ - // if (eKey >= pTbData->maxKey && sKey <= pTbData->maxKey) { tsdbCacheDel(pTsdb, suid, uid, sKey, eKey); - //} tsdbTrace("vgId:%d, delete data from table suid:%" PRId64 " uid:%" PRId64 " skey:%" PRId64 " eKey:%" PRId64 " at version %" PRId64, @@ -838,4 +828,4 @@ TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { pIter->row = pIter->pNode->row; return pIter->pRow; -} \ No newline at end of file +} From bc1c7545a8a9f3e2ea92e48ce8ed78816679dc3c Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Wed, 3 Apr 2024 09:38:04 +0800 Subject: [PATCH 093/106] mock commit for pk last read, need to revert --- source/dnode/vnode/src/tsdb/tsdbCache.c | 24 ++++++++++----------- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 14 ++++++------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 977ef177d2..ffb24fbc0e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1362,7 +1362,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr SIdxKey *idxKey = taosArrayGet(remainCols, 0); if (idxKey->key.cid != PRIMARYKEY_TIMESTAMP_COL_ID) { - SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID}; + SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID}; taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key}); } @@ -1385,7 +1385,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr for (int i = 0; i < num_keys; ++i) { SIdxKey *idxKey = taosArrayGet(remainCols, i); slotIds[i] = pr->pSlotIds[idxKey->idx]; - if (idxKey->key.ltype == CACHESCAN_RETRIEVE_LAST >> 3) { + if (idxKey->key.lflag == CACHESCAN_RETRIEVE_LAST >> 3) { if (NULL == lastTmpIndexArray) { lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t)); } @@ -1431,7 +1431,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr } // still null, then make up a none col value - SLastCol noneCol = {.ts = TSKEY_MIN, + SLastCol noneCol = {.rowKey.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(idxKey->key.cid, pr->pSchema->columns[slotIds[i]].type)}; if (!pLastCol) { pLastCol = &noneCol; @@ -1578,7 +1578,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache for (int i = 0; i < num_keys; ++i) { int16_t cid = ((int16_t *)TARRAY_DATA(pCidList))[i]; - SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}; + SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = cid}; // for select last_row, last case int32_t funcType = FUNCTION_TYPE_CACHE_LAST; if (pr->pFuncTypeList != NULL && taosArrayGetSize(pr->pFuncTypeList) > i) { @@ -1586,7 +1586,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache } if (((pr->type & CACHESCAN_RETRIEVE_LAST) == CACHESCAN_RETRIEVE_LAST) && FUNCTION_TYPE_CACHE_LAST_ROW == funcType) { int8_t tempType = CACHESCAN_RETRIEVE_LAST_ROW | (pr->type ^ CACHESCAN_RETRIEVE_LAST); - key->ltype = (tempType & CACHESCAN_RETRIEVE_LAST) >> 3; + key->lflag = (tempType & CACHESCAN_RETRIEVE_LAST) >> 3; } LRUHandle *h = taosLRUCacheLookup(pCache, key, ROCKS_KEY_LEN); @@ -1599,7 +1599,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache taosLRUCacheRelease(pCache, h, false); } else { - SLastCol noneCol = {.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)}; + SLastCol noneCol = {.rowKey.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)}; taosArrayPush(pLastArray, &noneCol); @@ -3232,7 +3232,7 @@ static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, for (int32_t i = 0; i < nCols; ++i) { int16_t slotId = slotIds[i]; - SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)}; + SLastCol col = {.rowKey.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)}; taosArrayPush(pColArray, &col); } *ppColArray = pColArray; @@ -3337,12 +3337,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){.ts = rowTs, .colVal = *pColVal}); + taosArraySet(pColArray, 0, &(SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}); continue; } tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); - *pCol = (SLastCol){.ts = rowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.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 +3392,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 = {.ts = rowTs, .colVal = *pColVal}; + SLastCol lastCol = {.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 +3516,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){.ts = rowTs, .colVal = *pColVal}); + taosArraySet(pColArray, 0, &(SLastCol){.rowKey.ts = rowTs, .colVal = *pColVal}); continue; } tsdbRowGetColVal(pRow, pTSchema, slotIds[iCol], pColVal); - *pCol = (SLastCol){.ts = rowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.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); diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 195ca59e9a..dd5da28b6b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -92,7 +92,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p p = (SFirstLastRes*)varDataVal(pRes[i]); - p->ts = pColVal->ts; + p->ts = pColVal->rowKey.ts; ts = p->ts; p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal); // allNullRow = p->isNull & allNullRow; @@ -399,12 +399,12 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 for (int32_t i = 0; i < pr->numOfCols; ++i) { int32_t slotId = slotIds[i]; if (slotId == -1) { - SLastCol p = {.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL}; + SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL}; taosArrayPush(pLastCols, &p); continue; } struct STColumn* pCol = &pr->pSchema->columns[slotId]; - SLastCol p = {.ts = INT64_MIN, .colVal.value.type = pCol->type, .colVal.flag = CV_FLAG_NULL}; + SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = pCol->type, .colVal.flag = CV_FLAG_NULL}; if (IS_VAR_DATA_TYPE(pCol->type)) { p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char)); @@ -431,7 +431,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 SLastCol* p = taosArrayGet(pLastCols, k); SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, k); - if (pColVal->ts > p->ts) { + if (pColVal->rowKey.ts > p->rowKey.ts) { if (!COL_VAL_IS_VALUE(&pColVal->colVal) && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { if (!COL_VAL_IS_VALUE(&p->colVal)) { hasNotNullRow = false; @@ -443,7 +443,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } hasRes = true; - p->ts = pColVal->ts; + p->rowKey.ts = pColVal->rowKey.ts; if (k == 0) { if (TARRAY_SIZE(pTableUidList) == 0) { taosArrayPush(pTableUidList, &uid); @@ -452,8 +452,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } } - if (pColVal->ts < singleTableLastTs && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { - singleTableLastTs = pColVal->ts; + if (pColVal->rowKey.ts < singleTableLastTs && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { + singleTableLastTs = pColVal->rowKey.ts; } if (!IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) { From fb58ca8592724b106aa1d322b769b79227fdd385 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 7 Apr 2024 18:53:25 +0800 Subject: [PATCH 094/106] 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 095/106] 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 97f7e672340305e387bdfd80d89b6a01fa63122f Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 8 Apr 2024 10:44:10 +0800 Subject: [PATCH 096/106] fix(tsdb): set correct merge row. --- source/dnode/vnode/src/tsdb/tsdbRead2.c | 7 +--- source/libs/function/src/builtinsimpl.c | 50 +++++++++++-------------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 9fcc10e396..57d4121880 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -1925,10 +1925,8 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } } - SRowKey minKey = {0}; + SRowKey minKey = k; if (ASCENDING_TRAVERSE(pReader->info.order)) { - minKey = k; // let's find the minimum - if (pkCompEx(compFn, &ik, &minKey) < 0) { // minKey > ik.key.ts) { minKey = ik; } @@ -1941,7 +1939,6 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* minKey = *pSttKey; } } else { - minKey = k; // let find the maximum ts value if (pkCompEx(compFn, &ik, &minKey) > 0) { minKey = ik; } @@ -1968,7 +1965,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pfKey, pReader); } - if (pkCompEx(compFn, &minKey, &pBlockScanInfo->lastProcKey) == 0) { + if (pkCompEx(compFn, &minKey, pSttKey) == 0) { TSDBROW* pRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); code = tsdbRowMergerAdd(pMerger, pRow1, NULL); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index f779c1fa25..b88e1474d7 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -138,7 +138,7 @@ typedef struct SElapsedInfo { typedef struct STwaInfo { double dOutput; - bool isNull; + int64_t numOfElems; SPoint1 p; STimeWindow win; } STwaInfo; @@ -600,10 +600,10 @@ bool funcInputGetNextRowNoPk(SFuncInputRowIter *pIter, SFuncInputRow* pRow) { bool funcInputGetNextRow(SqlFunctionCtx* pCtx, SFuncInputRow* pRow) { SFuncInputRowIter* pIter = &pCtx->rowIter; if (pCtx->hasPrimaryKey) { - if (pCtx->order == TSDB_ORDER_DESC) { - return funcInputGetNextRowDescPk(pIter, pRow); - } else { + if (pCtx->order == TSDB_ORDER_ASC) { return funcInputGetNextRowAscPk(pIter, pRow); + } else { + return funcInputGetNextRowDescPk(pIter, pRow); } } else { return funcInputGetNextRowNoPk(pIter, pRow); @@ -5556,7 +5556,7 @@ bool twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { } STwaInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - pInfo->isNull = false; + pInfo->numOfElems = 0; pInfo->p.key = INT64_MIN; pInfo->win = TSWINDOW_INITIALIZER; return true; @@ -5581,13 +5581,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { SColumnInfoData* pInputCol = pInput->pData[0]; SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - - STwaInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); - SPoint1* last = &pInfo->p; - int32_t numOfElems = 0; + STwaInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + SPoint1* last = &pInfo->p; if (IS_NULL_TYPE(pInputCol->info.type)) { - pInfo->isNull = true; + pInfo->numOfElems = 0; goto _twa_over; } @@ -5605,7 +5603,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { pInfo->dOutput += twa_get_area(pCtx->start, *last); pInfo->win.skey = pCtx->start.key; - numOfElems++; + pInfo->numOfElems++; break; } } else if (pInfo->p.key == INT64_MIN) { @@ -5619,7 +5617,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { GET_TYPED_DATA(last->val, double, pInputCol->info.type, row.pData); pInfo->win.skey = last->key; - numOfElems++; + pInfo->numOfElems++; break; } } @@ -5633,7 +5631,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int8_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5651,7 +5649,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int16_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5668,7 +5666,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int32_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5685,7 +5683,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(int64_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5702,7 +5700,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(float_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5719,7 +5717,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(double*)row.pData); if (pInfo->p.key == st.key) { @@ -5736,7 +5734,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint8_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5753,7 +5751,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint16_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5770,7 +5768,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint32_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5787,7 +5785,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (row.isDataNull) { continue; } - numOfElems++; + pInfo->numOfElems++; INIT_INTP_POINT(st, row.ts, *(uint64_t*)row.pData); if (pInfo->p.key == st.key) { @@ -5808,16 +5806,12 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { if (pCtx->end.key != INT64_MIN) { pInfo->dOutput += twa_get_area(pInfo->p, pCtx->end); pInfo->p = pCtx->end; - numOfElems += 1; + pInfo->numOfElems += 1; } pInfo->win.ekey = pInfo->p.key; _twa_over: - if (numOfElems == 0) { - pInfo->isNull = true; - } - SET_VAL(pResInfo, 1, 1); return TSDB_CODE_SUCCESS; } @@ -5838,7 +5832,7 @@ int32_t twaFinalize(struct SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); STwaInfo* pInfo = (STwaInfo*)GET_ROWCELL_INTERBUF(pResInfo); - if (pInfo->isNull == true) { + if (pInfo->numOfElems == 0) { pResInfo->numOfRes = 0; } else { if (pInfo->win.ekey == pInfo->win.skey) { From c0e895a4d315089790c7c3a968f92a50e3e0b319 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 8 Apr 2024 11:18:53 +0800 Subject: [PATCH 097/106] more code --- source/common/src/tdataformat.c | 115 ++++++-------------------- source/libs/parser/src/parInsertSql.c | 2 +- 2 files changed, 27 insertions(+), 90 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 5d1694ab90..b940caa53a 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -2880,8 +2880,12 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt char *data) { int32_t code = 0; if (data == NULL) { - for (int32_t i = 0; i < nRows; ++i) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); + if (pColData->cflag & COL_IS_KEY) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + } else { + for (int32_t i = 0; i < nRows; ++i) { + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0); + } } goto _exit; } @@ -2890,8 +2894,13 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt for (int32_t i = 0; i < nRows; ++i) { int32_t offset = *((int32_t *)lengthOrbitmap + i); if (offset == -1) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); - if (code) goto _exit; + if (pColData->cflag & COL_IS_KEY) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } + if ((code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0))) { + goto _exit; + } } else { if (varDataTLen(data + offset) > bytes) { uError("var data length invalid, varDataTLen(data + offset):%d <= bytes:%d", (int)varDataTLen(data + offset), @@ -2913,6 +2922,10 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt allValue = false; } } + if ((pColData->cflag & COL_IS_KEY) && !allValue) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } if (allValue) { // optimize (todo) @@ -2951,6 +2964,10 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32 if (IS_VAR_DATA_TYPE(pColData->type)) { // var-length data type for (int32_t i = 0; i < pBind->num; ++i) { if (pBind->is_null && pBind->is_null[i]) { + if (pColData->cflag & COL_IS_KEY) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); if (code) goto _exit; } else if (pBind->length[i] > buffMaxLen) { @@ -2973,6 +2990,11 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32 allValue = true; } + if ((pColData->cflag & COL_IS_KEY) && !allValue) { + code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL; + goto _exit; + } + if (allValue) { // optimize (todo) for (int32_t i = 0; i < pBind->num; ++i) { @@ -3002,91 +3024,6 @@ _exit: return code; } -#ifdef BUILD_NO_CALL -static int32_t tColDataSwapValue(SColData *pColData, int32_t i, int32_t j) { - int32_t code = 0; - - if (IS_VAR_DATA_TYPE(pColData->type)) { - int32_t nData1 = pColData->aOffset[i + 1] - pColData->aOffset[i]; - int32_t nData2 = (j < pColData->nVal - 1) ? pColData->aOffset[j + 1] - pColData->aOffset[j] - : pColData->nData - pColData->aOffset[j]; - uint8_t *pData = taosMemoryMalloc(TMAX(nData1, nData2)); - if (pData == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _exit; - } - - if (nData1 > nData2) { - memcpy(pData, pColData->pData + pColData->aOffset[i], nData1); - memcpy(pColData->pData + pColData->aOffset[i], pColData->pData + pColData->aOffset[j], nData2); - // memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i] + nData1, - // pColData->aOffset[j] - pColData->aOffset[i + 1]); - memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i + 1], - pColData->aOffset[j] - pColData->aOffset[i + 1]); - memcpy(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pData, nData1); - } else { - memcpy(pData, pColData->pData + pColData->aOffset[j], nData2); - memcpy(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pColData->pData + pColData->aOffset[i], nData1); - // memmove(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pColData->pData + pColData->aOffset[i] + - // nData1, - // pColData->aOffset[j] - pColData->aOffset[i + 1]); - memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i + 1], - pColData->aOffset[j] - pColData->aOffset[i + 1]); - memcpy(pColData->pData + pColData->aOffset[i], pData, nData2); - } - for (int32_t k = i + 1; k <= j; ++k) { - pColData->aOffset[k] = pColData->aOffset[k] + nData2 - nData1; - } - - taosMemoryFree(pData); - } else { - uint64_t val; - memcpy(&val, &pColData->pData[TYPE_BYTES[pColData->type] * i], TYPE_BYTES[pColData->type]); - memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * i], &pColData->pData[TYPE_BYTES[pColData->type] * j], - TYPE_BYTES[pColData->type]); - memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * j], &val, TYPE_BYTES[pColData->type]); - } - -_exit: - return code; -} - -static void tColDataSwap(SColData *pColData, int32_t i, int32_t j) { - ASSERT(i < j); - ASSERT(j < pColData->nVal); - - switch (pColData->flag) { - case HAS_NONE: - case HAS_NULL: - break; - case (HAS_NULL | HAS_NONE): { - uint8_t bv = GET_BIT1(pColData->pBitMap, i); - SET_BIT1(pColData->pBitMap, i, GET_BIT1(pColData->pBitMap, j)); - SET_BIT1(pColData->pBitMap, j, bv); - } break; - case HAS_VALUE: { - tColDataSwapValue(pColData, i, j); - } break; - case (HAS_VALUE | HAS_NONE): - case (HAS_VALUE | HAS_NULL): { - uint8_t bv = GET_BIT1(pColData->pBitMap, i); - SET_BIT1(pColData->pBitMap, i, GET_BIT1(pColData->pBitMap, j)); - SET_BIT1(pColData->pBitMap, j, bv); - tColDataSwapValue(pColData, i, j); - } break; - case (HAS_VALUE | HAS_NULL | HAS_NONE): { - uint8_t bv = GET_BIT2(pColData->pBitMap, i); - SET_BIT2(pColData->pBitMap, i, GET_BIT2(pColData->pBitMap, j)); - SET_BIT2(pColData->pBitMap, j, bv); - tColDataSwapValue(pColData, i, j); - } break; - default: - ASSERT(0); - break; - } -} -#endif - static int32_t tColDataCopyRowCell(SColData *pFromColData, int32_t iFromRow, SColData *pToColData, int32_t iToRow) { int32_t code = TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 71d832dc1f..bbcd27bd65 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1392,7 +1392,7 @@ int32_t initTableColSubmitData(STableDataCxt* pTableCxt) { if (NULL == pCol) { return TSDB_CODE_OUT_OF_MEMORY; } - tColDataInit(pCol, pSchema->colId, pSchema->type, 0); + tColDataInit(pCol, pSchema->colId, pSchema->type, pSchema->flags); } return TSDB_CODE_SUCCESS; From 33b1391b9aea51537fde9d84dc205a2d35e8c27c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 8 Apr 2024 11:33:26 +0800 Subject: [PATCH 098/106] fix(cache): fix memory leak, and update some test cases. --- source/dnode/vnode/src/tsdb/tsdbCache.c | 14 +++++++------- tests/system-test/2-query/interp.py | 2 -- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index ffb24fbc0e..3a178f7ade 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -664,10 +664,13 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, if (NULL != pLastCol) { rocksdb_writebatch_delete(wb, keys_list[0], klen); } + taosMemoryFreeClear(pLastCol); + pLastCol = tsdbCacheDeserialize(values_list[1]); if (NULL != pLastCol) { rocksdb_writebatch_delete(wb, keys_list[1], klen); } + taosMemoryFreeClear(pLastCol); rocksdb_free(values_list[0]); rocksdb_free(values_list[1]); @@ -675,9 +678,7 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, bool erase = false; LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[0], klen); if (h) { - SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h); erase = true; - taosLRUCacheRelease(pTsdb->lruCache, h, erase); } if (erase) { @@ -687,16 +688,12 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, erase = false; h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[1], klen); if (h) { - SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h); erase = true; - taosLRUCacheRelease(pTsdb->lruCache, h, erase); } if (erase) { taosLRUCacheErase(pTsdb->lruCache, keys_list[1], klen); } - - taosMemoryFree(pLastCol); } taosMemoryFree(keys_list[0]); @@ -1705,13 +1702,16 @@ 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]); if (NULL != pLastCol && (pLastCol->rowKey.ts <= eKey && pLastCol->rowKey.ts >= sKey)) { rocksdb_writebatch_delete(wb, keys_list[num_keys + i], klen); } taosThreadMutexUnlock(&pTsdb->rCache.rMutex); + taosMemoryFreeClear(pLastCol); - taosMemoryFree(pLastCol); rocksdb_free(values_list[i]); rocksdb_free(values_list[i + num_keys]); diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py index 86d010209d..81c5b66185 100644 --- a/tests/system-test/2-query/interp.py +++ b/tests/system-test/2-query/interp.py @@ -3390,8 +3390,6 @@ class TDTestCase: tdSql.execute(f"insert into {dbname}.{ctbname1} values ('2020-02-01 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar')") tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") - tdSql.error(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:15') every(1s) fill(null)") - tdSql.error(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)") tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)") tdLog.printNoPrefix("======step 14: test interp ignore null values") From a990224e96e16347b5f0bbd141e1531ea2d7bf9e Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 8 Apr 2024 14:36:47 +0800 Subject: [PATCH 099/106] more code --- source/common/src/tdataformat.c | 64 +++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index b940caa53a..20e78079ea 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -3107,11 +3107,27 @@ 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) { + SColVal cv; + + key->ts = ((TSKEY *)aColData[0].pData)[iRow]; + key->numOfPKs = 0; + + for (int i = 1; i < nColData; i++) { + if (aColData[i].cflag & COL_IS_KEY) { + ASSERT(aColData->flag == HAS_VALUE); + tColDataGetValue4(&aColData[i], iRow, &cv); + key->pks[key->numOfPKs++] = cv.value; + } else { + break; + } + } +} + static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t mid, int32_t end, int32_t nColData) { SColData *aDstColData = NULL; - TSKEY *aKey = (TSKEY *)aColData[0].pData; - - int32_t i = start, j = mid + 1, k = 0; + int32_t i = start, j = mid + 1, k = 0; + SRowKey keyi, keyj; if (end > start) { aDstColData = taosMemoryCalloc(1, sizeof(SColData) * nColData); @@ -3121,30 +3137,25 @@ static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t if (aDstColData == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - /* - for (int32_t i = 0; i < nColData; i++) { - tColDataCopy(&aColData[i], &aDstColData[i], tColDataDefaultMalloc, NULL); - } - */ } + tColDataArrGetRowKey(aColData, nColData, i, &keyi); + tColDataArrGetRowKey(aColData, nColData, j, &keyj); while (i <= mid && j <= end) { - if (aKey[i] <= aKey[j]) { - // tColDataCopyRow(aColData, i++, aDstColData, k++); + if (tRowKeyCompare(&keyi, &keyj) <= 0) { tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); + tColDataArrGetRowKey(aColData, nColData, i, &keyi); } else { - // tColDataCopyRow(aColData, j++, aDstColData, k++); tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); + tColDataArrGetRowKey(aColData, nColData, j, &keyj); } } while (i <= mid) { - // tColDataCopyRow(aColData, i++, aDstColData, k++); tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); } while (j <= end) { - // tColDataCopyRow(aColData, j++, aDstColData, k++); tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); } @@ -3391,12 +3402,16 @@ static void tColDataMergeImpl(SColData *pColData, int32_t iStart, int32_t iEnd / } static void tColDataMerge(SColData *aColData, int32_t nColData) { int32_t iStart = 0; + SRowKey keyStart, keyEnd; + for (;;) { if (iStart >= aColData[0].nVal - 1) break; + tColDataArrGetRowKey(aColData, nColData, iStart, &keyStart); int32_t iEnd = iStart + 1; while (iEnd < aColData[0].nVal) { - if (((TSKEY *)aColData[0].pData)[iEnd] != ((TSKEY *)aColData[0].pData)[iStart]) break; + tColDataArrGetRowKey(aColData, nColData, iEnd, &keyEnd); + if (tRowKeyCompare(&keyStart, &keyEnd) != 0) break; iEnd++; } @@ -3410,6 +3425,7 @@ static void tColDataMerge(SColData *aColData, int32_t nColData) { iStart++; } } + void tColDataSortMerge(SArray *colDataArr) { int32_t nColData = TARRAY_SIZE(colDataArr); SColData *aColData = (SColData *)TARRAY_DATA(colDataArr); @@ -3423,11 +3439,17 @@ void tColDataSortMerge(SArray *colDataArr) { int8_t doSort = 0; int8_t doMerge = 0; // scan ------- - TSKEY *aKey = (TSKEY *)aColData[0].pData; + SRowKey lastKey; + tColDataArrGetRowKey(aColData, nColData, 0, &lastKey); for (int32_t iVal = 1; iVal < aColData[0].nVal; ++iVal) { - if (aKey[iVal] > aKey[iVal - 1]) { + SRowKey key; + tColDataArrGetRowKey(aColData, nColData, iVal, &key); + + int32_t c = tRowKeyCompare(&lastKey, &key); + if (c < 0) { + lastKey = key; continue; - } else if (aKey[iVal] < aKey[iVal - 1]) { + } else if (c > 0) { doSort = 1; break; } else { @@ -3441,11 +3463,17 @@ void tColDataSortMerge(SArray *colDataArr) { } if (doMerge != 1) { + tColDataArrGetRowKey(aColData, nColData, 0, &lastKey); for (int32_t iVal = 1; iVal < aColData[0].nVal; ++iVal) { - if (aKey[iVal] == aKey[iVal - 1]) { + SRowKey key; + tColDataArrGetRowKey(aColData, nColData, iVal, &key); + + int32_t c = tRowKeyCompare(&lastKey, &key); + if (c == 0) { doMerge = 1; break; } + lastKey = key; } } From ee7d25602e66b4c1af091041cefd1d31386398d0 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 8 Apr 2024 15:40:52 +0800 Subject: [PATCH 100/106] fix(tsdb): fix error in retrieve varchar pk. --- source/dnode/vnode/src/tsdb/tsdbRead2.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 57d4121880..a8a4ced517 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -1678,11 +1678,9 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* __compar_fn_t compFn = pReader->pkComparFn; int32_t pkSrcSlot = pReader->suppInfo.pkSrcSlot; - SRowKey* pSttKey = &(SRowKey){0}; + SRowKey* pSttKey = NULL; if (hasDataInSttBlock(pBlockScanInfo) && (!pBlockScanInfo->cleanSttBlocks)) { pSttKey = getCurrentKeyInSttBlock(pSttBlockReader); - } else { - pSttKey = NULL; } SRowKey k; @@ -1714,10 +1712,8 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* } } - SRowKey minKey; + SRowKey minKey = k; if (pReader->info.order == TSDB_ORDER_ASC) { - minKey = k; // chosen the minimum value - if (pfKey != NULL && pkCompEx(compFn, pfKey, &minKey) < 0) { minKey = *pfKey; } @@ -1726,8 +1722,6 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* minKey = *pSttKey; } } else { - minKey = k; - if (pfKey != NULL && pkCompEx(compFn, pfKey, &minKey) > 0) { minKey = *pfKey; } @@ -1882,11 +1876,9 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader); TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader); - SRowKey* pSttKey = &(SRowKey){0}; + SRowKey* pSttKey = NULL; if (hasDataInSttBlock(pBlockScanInfo) && (!pBlockScanInfo->cleanSttBlocks)) { - tRowKeyAssign(pSttKey, getCurrentKeyInSttBlock(pSttBlockReader)); - } else { - pSttKey = NULL; + pSttKey = getCurrentKeyInSttBlock(pSttBlockReader); } SRowKey* pfKey = &(SRowKey){0}; From 858d61072e79c61261f0eb3aeaa37be2fb418dde Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 8 Apr 2024 17:23:46 +0800 Subject: [PATCH 101/106] 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 5ed81f9cabff6c96577fcf167f232bad4a6cef97 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 8 Apr 2024 18:04:06 +0800 Subject: [PATCH 102/106] fix(tsdb): prepare pk buf --- source/libs/executor/inc/executil.h | 1 + source/libs/executor/src/executil.c | 28 +++++++++++++++++++++++++ source/libs/executor/src/scanoperator.c | 19 +++-------------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index 1c70fd8bb6..55b803f6d4 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -162,6 +162,7 @@ bool hasRemainResults(SGroupResInfo* pGroupResInfo); int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo); SSDataBlock* createDataBlockFromDescNode(SDataBlockDescNode* pNode); +int32_t prepareDataBlockBuf(SSDataBlock* pDataBlock, SColMatchInfo* pMatchInfo); EDealRes doTranslateTagExpr(SNode** pNode, void* pContext); int32_t getGroupIdFromTagsVal(void* pVnode, uint64_t uid, SNodeList* pGroupNode, char* keyBuf, uint64_t* pGroupId, SStorageAPI* pAPI); diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 97b9b00efb..9749dffc13 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -250,6 +250,34 @@ SSDataBlock* createDataBlockFromDescNode(SDataBlockDescNode* pNode) { return pBlock; } +int32_t prepareDataBlockBuf(SSDataBlock* pDataBlock, SColMatchInfo* pMatchInfo) { + SDataBlockInfo* pBlockInfo = &pDataBlock->info; + + for (int32_t i = 0; i < taosArrayGetSize(pMatchInfo->pList); ++i) { + SColMatchItem* pItem = taosArrayGet(pMatchInfo->pList, i); + if (pItem->isPk) { + SColumnInfoData* pInfoData = taosArrayGet(pDataBlock->pDataBlock, pItem->dstSlotId); + pBlockInfo->pks[0].type = pInfoData->info.type; + pBlockInfo->pks[1].type = pInfoData->info.type; + + if (IS_VAR_DATA_TYPE(pItem->dataType.type)) { + pBlockInfo->pks[0].pData = taosMemoryCalloc(1, pInfoData->info.bytes); + if (pBlockInfo->pks[0].pData == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + pBlockInfo->pks[1].pData = taosMemoryCalloc(1, pInfoData->info.bytes); + if (pBlockInfo->pks[1].pData == NULL) { + taosMemoryFreeClear(pBlockInfo->pks[0].pData); + return TSDB_CODE_OUT_OF_MEMORY; + } + } + } + } + + return TSDB_CODE_SUCCESS; +} + EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) { SMetaReader* mr = (SMetaReader*)pContext; if (nodeType(*pNode) == QUERY_NODE_COLUMN) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a51e627272..0d4c536dec 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1196,23 +1196,8 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, pInfo->base.readerAPI = pTaskInfo->storageAPI.tsdReader; initResultSizeInfo(&pOperator->resultInfo, 4096); pInfo->pResBlock = createDataBlockFromDescNode(pDescNode); + prepareDataBlockBuf(pInfo->pResBlock, &pInfo->base.matchInfo); - { // todo :refactor: - SDataBlockInfo* pBlockInfo = &pInfo->pResBlock->info; - for(int32_t i = 0; i < taosArrayGetSize(pInfo->base.matchInfo.pList); ++i) { - SColMatchItem* pItem = taosArrayGet(pInfo->base.matchInfo.pList, i); - if (pItem->isPk) { - SColumnInfoData* pInfoData = taosArrayGet(pInfo->pResBlock->pDataBlock, pItem->dstSlotId); - pBlockInfo->pks[0].type = pInfoData->info.type; - pBlockInfo->pks[1].type = pInfoData->info.type; - - if (IS_VAR_DATA_TYPE(pItem->dataType.type)) { - pBlockInfo->pks[0].pData = taosMemoryCalloc(1, pInfoData->info.bytes); - pBlockInfo->pks[1].pData = taosMemoryCalloc(1, pInfoData->info.bytes); - } - } - } - } code = filterInitFromNode((SNode*)pTableScanNode->scan.node.pConditions, &pOperator->exprSupp.pFilterInfo, 0); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -4418,6 +4403,8 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN pInfo->bSortRowId = false; } + prepareDataBlockBuf(pInfo->pResBlock, &pInfo->base.matchInfo); + pInfo->pSortInfo = generateSortByTsPkInfo(pInfo->base.matchInfo.pList, pInfo->base.cond.order); pInfo->pReaderBlock = createOneDataBlock(pInfo->pResBlock, false); From 95697bcddbb33b01e5b8e8f014ad953e9df572ef Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 8 Apr 2024 18:04:53 +0800 Subject: [PATCH 103/106] fix(tsdb): prepare pk buf --- source/common/src/tdatablock.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index e748cce643..69b2a2e6a3 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -535,8 +535,8 @@ int32_t blockDataUpdatePkRange(SSDataBlock* pDataBlock, int32_t pkColumnIndex, b if (asc) { if (IS_NUMERIC_TYPE(pColInfoData->info.type)) { - pDataBlock->info.pks[0].val = *(int32_t*) skey; - pDataBlock->info.pks[1].val = *(int32_t*) ekey; + GET_TYPED_DATA(pDataBlock->info.pks[0].val, int64_t, pColInfoData->info.type, skey); + GET_TYPED_DATA(pDataBlock->info.pks[1].val, int64_t, pColInfoData->info.type, ekey); } else { // todo refactor memcpy(pDataBlock->info.pks[0].pData, varDataVal(skey), varDataLen(skey)); pDataBlock->info.pks[0].nData = varDataLen(skey); @@ -546,8 +546,8 @@ int32_t blockDataUpdatePkRange(SSDataBlock* pDataBlock, int32_t pkColumnIndex, b } } else { if (IS_NUMERIC_TYPE(pColInfoData->info.type)) { - pDataBlock->info.pks[0].val = *(int32_t*) ekey; - pDataBlock->info.pks[1].val = *(int32_t*) skey; + GET_TYPED_DATA(pDataBlock->info.pks[0].val, int64_t, pColInfoData->info.type, ekey); + GET_TYPED_DATA(pDataBlock->info.pks[1].val, int64_t, pColInfoData->info.type, skey); } else { // todo refactor memcpy(pDataBlock->info.pks[0].pData, varDataVal(ekey), varDataLen(ekey)); pDataBlock->info.pks[0].nData = varDataLen(ekey); @@ -1491,6 +1491,18 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData) { blockDataAppendColInfo(pBlock, &colInfo); } + // prepare the pk buffer if necessary + if (IS_VAR_DATA_TYPE(pDataBlock->info.pks[0].type)) { + SValue* pVal = &pBlock->info.pks[0]; + + pVal->type = pDataBlock->info.pks[0].type; + pVal->pData = taosMemoryCalloc(1, pDataBlock->info.pks[0].nData); + + pVal = &pBlock->info.pks[1]; + pVal->type = pDataBlock->info.pks[1].type; + pVal->pData = taosMemoryCalloc(1, pDataBlock->info.pks[1].nData); + } + if (copyData) { int32_t code = blockDataEnsureCapacity(pBlock, pDataBlock->info.rows); if (code != TSDB_CODE_SUCCESS) { From 7d34c767e906bc24635d554acfeb173a269581d1 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 8 Apr 2024 18:23:16 +0800 Subject: [PATCH 104/106] fix: insert from select and sort merge --- source/common/src/tdataformat.c | 6 +++++- source/libs/executor/src/dataInserter.c | 22 ++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 20e78079ea..1585c12ac1 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -593,12 +593,16 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart, for (int32_t iCol = 0; iCol < pTSchema->numOfCols; iCol++) { SColVal *pColVal = NULL; - for (int32_t iRow = 0; iRow < nRow; iRow++) { + for (int32_t iRow = nRow - 1; iRow >= 0; --iRow) { SColVal *pColValT = tRowIterNext(aIter[iRow]); + while (pColValT->cid < pTSchema->columns[iCol].colId) { + pColValT = tRowIterNext(aIter[iRow]); + } // todo: take strategy according to the flag if (COL_VAL_IS_VALUE(pColValT)) { pColVal = pColValT; + break; } else if (COL_VAL_IS_NULL(pColValT)) { if (pColVal == NULL) { pColVal = pColValT; diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index dfe30c9f96..06f63f5f04 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -189,8 +189,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp } int64_t lastTs = TSKEY_MIN; - bool updateLastRow = false; - bool disorderTs = false; + bool needSortMerge = false; for (int32_t j = 0; j < rows; ++j) { // iterate by row taosArrayClear(pVals); @@ -258,11 +257,9 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); // should use pCol->type taosArrayPush(pVals, &cv); } else { - if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { - if (*(int64_t*)var == lastTs) { - updateLastRow = true; - } else if (*(int64_t*)var < lastTs) { - disorderTs = true; + if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId && !needSortMerge) { + if (*(int64_t*)var <= lastTs) { + needSortMerge = true; } else { lastTs = *(int64_t*)var; } @@ -287,17 +284,10 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp tDestroySubmitTbData(&tbData, TSDB_MSG_FLG_ENCODE); goto _end; } - if (updateLastRow) { - updateLastRow = false; - SRow** lastRow = taosArrayPop(tbData.aRowP); - tRowDestroy(*lastRow); - taosArrayPush(tbData.aRowP, &pRow); - } else { - taosArrayPush(tbData.aRowP, &pRow); - } + taosArrayPush(tbData.aRowP, &pRow); } - if (disorderTs) { + if (needSortMerge) { if ((tRowSort(tbData.aRowP) != TSDB_CODE_SUCCESS) || (terrno = tRowMerge(tbData.aRowP, (STSchema*)pTSchema, 0)) != 0) { goto _end; From 4285f07f766b2a5bff8038cfe9c7c960b9f46cff Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 8 Apr 2024 23:33:58 +0800 Subject: [PATCH 105/106] 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 106/106] 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);