From 860a7bdcace0493c847fcde2ab23172e29c970ef Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 13 Sep 2022 14:51:04 +0800 Subject: [PATCH 01/69] enh: add queryRsmaTolerance conf for rsma query --- docs/en/14-reference/12-config/index.md | 302 ++++++++++++------------ docs/zh/14-reference/12-config/index.md | 301 +++++++++++------------ include/common/tglobal.h | 1 + source/common/src/tglobal.c | 5 + source/dnode/vnode/src/tsdb/tsdbRead.c | 7 +- 5 files changed, 314 insertions(+), 302 deletions(-) diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md index 02921c3f6a..623e7d4e46 100644 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -164,7 +164,7 @@ The parameters described in this document by the effect that they have on the sy | Attribute | Description | | -------- | -------------------- | | Applicable | Client only | -| 含义 | SMA index optimization policy | +| Meaning | SMA index optimization policy | | Unit | None | | Default Value | 0 | | Notes | @@ -697,152 +697,154 @@ To prevent system resource from being exhausted by multiple concurrent streams, | 15 | telemetryPort | No | Yes | | 16 | queryPolicy | No | Yes | | 17 | querySmaOptimize | No | Yes | -| 18 | queryBufferSize | Yes | Yes | -| 19 | maxNumOfDistinctRes | Yes | Yes | -| 20 | minSlidingTime | Yes | Yes | -| 21 | minIntervalTime | Yes | Yes | -| 22 | countAlwaysReturnValue | Yes | Yes | -| 23 | dataDir | Yes | Yes | -| 24 | minimalDataDirGB | Yes | Yes | -| 25 | supportVnodes | No | Yes | -| 26 | tempDir | Yes | Yes | -| 27 | minimalTmpDirGB | Yes | Yes | -| 28 | compressMsgSize | Yes | Yes | -| 29 | compressColData | Yes | Yes | -| 30 | smlChildTableName | Yes | Yes | -| 31 | smlTagName | Yes | Yes | -| 32 | smlDataFormat | No | Yes | -| 33 | statusInterval | Yes | Yes | -| 34 | shellActivityTimer | Yes | Yes | -| 35 | transPullupInterval | No | Yes | -| 36 | mqRebalanceInterval | No | Yes | -| 37 | ttlUnit | No | Yes | -| 38 | ttlPushInterval | No | Yes | -| 39 | numOfTaskQueueThreads | No | Yes | -| 40 | numOfRpcThreads | No | Yes | -| 41 | numOfCommitThreads | Yes | Yes | -| 42 | numOfMnodeReadThreads | No | Yes | -| 43 | numOfVnodeQueryThreads | No | Yes | -| 44 | numOfVnodeStreamThreads | No | Yes | -| 45 | numOfVnodeFetchThreads | No | Yes | -| 46 | numOfVnodeWriteThreads | No | Yes | -| 47 | numOfVnodeSyncThreads | No | Yes | -| 48 | numOfQnodeQueryThreads | No | Yes | -| 49 | numOfQnodeFetchThreads | No | Yes | -| 50 | numOfSnodeSharedThreads | No | Yes | -| 51 | numOfSnodeUniqueThreads | No | Yes | -| 52 | rpcQueueMemoryAllowed | No | Yes | -| 53 | logDir | Yes | Yes | -| 54 | minimalLogDirGB | Yes | Yes | -| 55 | numOfLogLines | Yes | Yes | -| 56 | asyncLog | Yes | Yes | -| 57 | logKeepDays | Yes | Yes | -| 58 | debugFlag | Yes | Yes | -| 59 | tmrDebugFlag | Yes | Yes | -| 60 | uDebugFlag | Yes | Yes | -| 61 | rpcDebugFlag | Yes | Yes | -| 62 | jniDebugFlag | Yes | Yes | -| 63 | qDebugFlag | Yes | Yes | -| 64 | cDebugFlag | Yes | Yes | -| 65 | dDebugFlag | Yes | Yes | -| 66 | vDebugFlag | Yes | Yes | -| 67 | mDebugFlag | Yes | Yes | -| 68 | wDebugFlag | Yes | Yes | -| 69 | sDebugFlag | Yes | Yes | -| 70 | tsdbDebugFlag | Yes | Yes | -| 71 | tqDebugFlag | No | Yes | -| 72 | fsDebugFlag | Yes | Yes | -| 73 | udfDebugFlag | No | Yes | -| 74 | smaDebugFlag | No | Yes | -| 75 | idxDebugFlag | No | Yes | -| 76 | tdbDebugFlag | No | Yes | -| 77 | metaDebugFlag | No | Yes | -| 78 | timezone | Yes | Yes | -| 79 | locale | Yes | Yes | -| 80 | charset | Yes | Yes | -| 81 | udf | Yes | Yes | -| 82 | enableCoreFile | Yes | Yes | -| 83 | arbitrator | Yes | No | -| 84 | numOfThreadsPerCore | Yes | No | -| 85 | numOfMnodes | Yes | No | -| 86 | vnodeBak | Yes | No | -| 87 | balance | Yes | No | -| 88 | balanceInterval | Yes | No | -| 89 | offlineThreshold | Yes | No | -| 90 | role | Yes | No | -| 91 | dnodeNopLoop | Yes | No | -| 92 | keepTimeOffset | Yes | No | -| 93 | rpcTimer | Yes | No | -| 94 | rpcMaxTime | Yes | No | -| 95 | rpcForceTcp | Yes | No | -| 96 | tcpConnTimeout | Yes | No | -| 97 | syncCheckInterval | Yes | No | -| 98 | maxTmrCtrl | Yes | No | -| 99 | monitorReplica | Yes | No | -| 100 | smlTagNullName | Yes | No | -| 101 | keepColumnName | Yes | No | -| 102 | ratioOfQueryCores | Yes | No | -| 103 | maxStreamCompDelay | Yes | No | -| 104 | maxFirstStreamCompDelay | Yes | No | -| 105 | retryStreamCompDelay | Yes | No | -| 106 | streamCompDelayRatio | Yes | No | -| 107 | maxVgroupsPerDb | Yes | No | -| 108 | maxTablesPerVnode | Yes | No | -| 109 | minTablesPerVnode | Yes | No | -| 110 | tableIncStepPerVnode | Yes | No | -| 111 | cache | Yes | No | -| 112 | blocks | Yes | No | -| 113 | days | Yes | No | -| 114 | keep | Yes | No | -| 115 | minRows | Yes | No | -| 116 | maxRows | Yes | No | -| 117 | quorum | Yes | No | -| 118 | comp | Yes | No | -| 119 | walLevel | Yes | No | -| 120 | fsync | Yes | No | -| 121 | replica | Yes | No | -| 122 | partitions | Yes | No | -| 123 | quorum | Yes | No | -| 124 | update | Yes | No | -| 125 | cachelast | Yes | No | -| 126 | maxSQLLength | Yes | No | -| 127 | maxWildCardsLength | Yes | No | -| 128 | maxRegexStringLen | Yes | No | -| 129 | maxNumOfOrderedRes | Yes | No | -| 130 | maxConnections | Yes | No | -| 131 | mnodeEqualVnodeNum | Yes | No | -| 132 | http | Yes | No | -| 133 | httpEnableRecordSql | Yes | No | -| 134 | httpMaxThreads | Yes | No | -| 135 | restfulRowLimit | Yes | No | -| 136 | httpDbNameMandatory | Yes | No | -| 137 | httpKeepAlive | Yes | No | -| 138 | enableRecordSql | Yes | No | -| 139 | maxBinaryDisplayWidth | Yes | No | -| 140 | stream | Yes | No | -| 141 | retrieveBlockingModel | Yes | No | -| 142 | tsdbMetaCompactRatio | Yes | No | -| 143 | defaultJSONStrType | Yes | No | -| 144 | walFlushSize | Yes | No | -| 145 | keepTimeOffset | Yes | No | -| 146 | flowctrl | Yes | No | -| 147 | slaveQuery | Yes | No | -| 148 | adjustMaster | Yes | No | -| 149 | topicBinaryLen | Yes | No | -| 150 | telegrafUseFieldNum | Yes | No | -| 151 | deadLockKillQuery | Yes | No | -| 152 | clientMerge | Yes | No | -| 153 | sdbDebugFlag | Yes | No | -| 154 | odbcDebugFlag | Yes | No | -| 155 | httpDebugFlag | Yes | No | -| 156 | monDebugFlag | Yes | No | -| 157 | cqDebugFlag | Yes | No | -| 158 | shortcutFlag | Yes | No | -| 159 | probeSeconds | Yes | No | -| 160 | probeKillSeconds | Yes | No | -| 161 | probeInterval | Yes | No | -| 162 | lossyColumns | Yes | No | -| 163 | fPrecision | Yes | No | -| 164 | dPrecision | Yes | No | -| 165 | maxRange | Yes | No | -| 166 | range | Yes | No | +| 18 | queryRsmaTolerance | No | Yes | +| 19 | queryBufferSize | Yes | Yes | +| 20 | maxNumOfDistinctRes | Yes | Yes | +| 21 | minSlidingTime | Yes | Yes | +| 22 | minIntervalTime | Yes | Yes | +| 23 | countAlwaysReturnValue | Yes | Yes | +| 24 | dataDir | Yes | Yes | +| 25 | minimalDataDirGB | Yes | Yes | +| 26 | supportVnodes | No | Yes | +| 27 | tempDir | Yes | Yes | +| 28 | minimalTmpDirGB | Yes | Yes | +| 29 | compressMsgSize | Yes | Yes | +| 30 | compressColData | Yes | Yes | +| 31 | smlChildTableName | Yes | Yes | +| 32 | smlTagName | Yes | Yes | +| 33 | smlDataFormat | No | Yes | +| 34 | statusInterval | Yes | Yes | +| 35 | shellActivityTimer | Yes | Yes | +| 36 | transPullupInterval | No | Yes | +| 37 | mqRebalanceInterval | No | Yes | +| 38 | ttlUnit | No | Yes | +| 39 | ttlPushInterval | No | Yes | +| 40 | numOfTaskQueueThreads | No | Yes | +| 41 | numOfRpcThreads | No | Yes | +| 42 | numOfCommitThreads | Yes | Yes | +| 43 | numOfMnodeReadThreads | No | Yes | +| 44 | numOfVnodeQueryThreads | No | Yes | +| 45 | numOfVnodeStreamThreads | No | Yes | +| 46 | numOfVnodeFetchThreads | No | Yes | +| 47 | numOfVnodeWriteThreads | No | Yes | +| 48 | numOfVnodeSyncThreads | No | Yes | +| 49 | numOfVnodeRsmaThreads | No | Yes | +| 50 | numOfQnodeQueryThreads | No | Yes | +| 51 | numOfQnodeFetchThreads | No | Yes | +| 52 | numOfSnodeSharedThreads | No | Yes | +| 53 | numOfSnodeUniqueThreads | No | Yes | +| 54 | rpcQueueMemoryAllowed | No | Yes | +| 55 | logDir | Yes | Yes | +| 56 | minimalLogDirGB | Yes | Yes | +| 57 | numOfLogLines | Yes | Yes | +| 58 | asyncLog | Yes | Yes | +| 59 | logKeepDays | Yes | Yes | +| 60 | debugFlag | Yes | Yes | +| 61 | tmrDebugFlag | Yes | Yes | +| 62 | uDebugFlag | Yes | Yes | +| 63 | rpcDebugFlag | Yes | Yes | +| 64 | jniDebugFlag | Yes | Yes | +| 65 | qDebugFlag | Yes | Yes | +| 66 | cDebugFlag | Yes | Yes | +| 67 | dDebugFlag | Yes | Yes | +| 68 | vDebugFlag | Yes | Yes | +| 69 | mDebugFlag | Yes | Yes | +| 70 | wDebugFlag | Yes | Yes | +| 71 | sDebugFlag | Yes | Yes | +| 72 | tsdbDebugFlag | Yes | Yes | +| 73 | tqDebugFlag | No | Yes | +| 74 | fsDebugFlag | Yes | Yes | +| 75 | udfDebugFlag | No | Yes | +| 76 | smaDebugFlag | No | Yes | +| 77 | idxDebugFlag | No | Yes | +| 78 | tdbDebugFlag | No | Yes | +| 79 | metaDebugFlag | No | Yes | +| 80 | timezone | Yes | Yes | +| 81 | locale | Yes | Yes | +| 82 | charset | Yes | Yes | +| 83 | udf | Yes | Yes | +| 84 | enableCoreFile | Yes | Yes | +| 85 | arbitrator | Yes | No | +| 86 | numOfThreadsPerCore | Yes | No | +| 87 | numOfMnodes | Yes | No | +| 88 | vnodeBak | Yes | No | +| 89 | balance | Yes | No | +| 90 | balanceInterval | Yes | No | +| 91 | offlineThreshold | Yes | No | +| 92 | role | Yes | No | +| 93 | dnodeNopLoop | Yes | No | +| 94 | keepTimeOffset | Yes | No | +| 95 | rpcTimer | Yes | No | +| 96 | rpcMaxTime | Yes | No | +| 97 | rpcForceTcp | Yes | No | +| 98 | tcpConnTimeout | Yes | No | +| 99 | syncCheckInterval | Yes | No | +| 100 | maxTmrCtrl | Yes | No | +| 101 | monitorReplica | Yes | No | +| 102 | smlTagNullName | Yes | No | +| 103 | keepColumnName | Yes | No | +| 104 | ratioOfQueryCores | Yes | No | +| 105 | maxStreamCompDelay | Yes | No | +| 106 | maxFirstStreamCompDelay | Yes | No | +| 107 | retryStreamCompDelay | Yes | No | +| 108 | streamCompDelayRatio | Yes | No | +| 109 | maxVgroupsPerDb | Yes | No | +| 110 | maxTablesPerVnode | Yes | No | +| 111 | minTablesPerVnode | Yes | No | +| 112 | tableIncStepPerVnode | Yes | No | +| 113 | cache | Yes | No | +| 114 | blocks | Yes | No | +| 115 | days | Yes | No | +| 116 | keep | Yes | No | +| 117 | minRows | Yes | No | +| 118 | maxRows | Yes | No | +| 119 | quorum | Yes | No | +| 120 | comp | Yes | No | +| 121 | walLevel | Yes | No | +| 122 | fsync | Yes | No | +| 123 | replica | Yes | No | +| 124 | partitions | Yes | No | +| 125 | quorum | Yes | No | +| 126 | update | Yes | No | +| 127 | cachelast | Yes | No | +| 128 | maxSQLLength | Yes | No | +| 129 | maxWildCardsLength | Yes | No | +| 130 | maxRegexStringLen | Yes | No | +| 131 | maxNumOfOrderedRes | Yes | No | +| 132 | maxConnections | Yes | No | +| 133 | mnodeEqualVnodeNum | Yes | No | +| 134 | http | Yes | No | +| 135 | httpEnableRecordSql | Yes | No | +| 136 | httpMaxThreads | Yes | No | +| 137 | restfulRowLimit | Yes | No | +| 138 | httpDbNameMandatory | Yes | No | +| 139 | httpKeepAlive | Yes | No | +| 140 | enableRecordSql | Yes | No | +| 141 | maxBinaryDisplayWidth | Yes | No | +| 142 | stream | Yes | No | +| 143 | retrieveBlockingModel | Yes | No | +| 144 | tsdbMetaCompactRatio | Yes | No | +| 145 | defaultJSONStrType | Yes | No | +| 146 | walFlushSize | Yes | No | +| 147 | keepTimeOffset | Yes | No | +| 148 | flowctrl | Yes | No | +| 149 | slaveQuery | Yes | No | +| 150 | adjustMaster | Yes | No | +| 151 | topicBinaryLen | Yes | No | +| 152 | telegrafUseFieldNum | Yes | No | +| 153 | deadLockKillQuery | Yes | No | +| 154 | clientMerge | Yes | No | +| 155 | sdbDebugFlag | Yes | No | +| 156 | odbcDebugFlag | Yes | No | +| 157 | httpDebugFlag | Yes | No | +| 158 | monDebugFlag | Yes | No | +| 159 | cqDebugFlag | Yes | No | +| 160 | shortcutFlag | Yes | No | +| 161 | probeSeconds | Yes | No | +| 162 | probeKillSeconds | Yes | No | +| 163 | probeInterval | Yes | No | +| 164 | lossyColumns | Yes | No | +| 165 | fPrecision | Yes | No | +| 166 | dPrecision | Yes | No | +| 167 | maxRange | Yes | No | +| 168 | range | Yes | No | diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index 7b31e10572..f994d0d4cf 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -668,153 +668,154 @@ charset 的有效值是 UTF-8。 | 15 | telemetryPort | 否 | 是 | | 16 | queryPolicy | 否 | 是 | | 17 | querySmaOptimize | 否 | 是 | -| 18 | queryBufferSize | 是 | 是 | -| 19 | maxNumOfDistinctRes | 是 | 是 | -| 20 | minSlidingTime | 是 | 是 | -| 21 | minIntervalTime | 是 | 是 | -| 22 | countAlwaysReturnValue | 是 | 是 | -| 23 | dataDir | 是 | 是 | -| 24 | minimalDataDirGB | 是 | 是 | -| 25 | supportVnodes | 否 | 是 | -| 26 | tempDir | 是 | 是 | -| 27 | minimalTmpDirGB | 是 | 是 | -| 28 | compressMsgSize | 是 | 是 | -| 29 | compressColData | 是 | 是 | -| 30 | smlChildTableName | 是 | 是 | -| 31 | smlTagName | 是 | 是 | -| 32 | smlDataFormat | 否 | 是 | -| 33 | statusInterval | 是 | 是 | -| 34 | shellActivityTimer | 是 | 是 | -| 35 | transPullupInterval | 否 | 是 | -| 36 | mqRebalanceInterval | 否 | 是 | -| 37 | ttlUnit | 否 | 是 | -| 38 | ttlPushInterval | 否 | 是 | -| 39 | numOfTaskQueueThreads | 否 | 是 | -| 40 | numOfRpcThreads | 否 | 是 | -| 41 | numOfCommitThreads | 是 | 是 | -| 42 | numOfMnodeReadThreads | 否 | 是 | -| 43 | numOfVnodeQueryThreads | 否 | 是 | -| 44 | numOfVnodeStreamThreads | 否 | 是 | -| 45 | numOfVnodeFetchThreads | 否 | 是 | -| 46 | numOfVnodeWriteThreads | 否 | 是 | -| 47 | numOfVnodeSyncThreads | 否 | 是 | -| 48 | numOfVnodeRsmaThreads | 否 | 是 | -| 49 | numOfQnodeQueryThreads | 否 | 是 | -| 50 | numOfQnodeFetchThreads | 否 | 是 | -| 51 | numOfSnodeSharedThreads | 否 | 是 | -| 52 | numOfSnodeUniqueThreads | 否 | 是 | -| 53 | rpcQueueMemoryAllowed | 否 | 是 | -| 54 | logDir | 是 | 是 | -| 55 | minimalLogDirGB | 是 | 是 | -| 56 | numOfLogLines | 是 | 是 | -| 57 | asyncLog | 是 | 是 | -| 58 | logKeepDays | 是 | 是 | -| 59 | debugFlag | 是 | 是 | -| 60 | tmrDebugFlag | 是 | 是 | -| 61 | uDebugFlag | 是 | 是 | -| 62 | rpcDebugFlag | 是 | 是 | -| 63 | jniDebugFlag | 是 | 是 | -| 64 | qDebugFlag | 是 | 是 | -| 65 | cDebugFlag | 是 | 是 | -| 66 | dDebugFlag | 是 | 是 | -| 67 | vDebugFlag | 是 | 是 | -| 68 | mDebugFlag | 是 | 是 | -| 69 | wDebugFlag | 是 | 是 | -| 70 | sDebugFlag | 是 | 是 | -| 71 | tsdbDebugFlag | 是 | 是 | -| 72 | tqDebugFlag | 否 | 是 | -| 73 | fsDebugFlag | 是 | 是 | -| 74 | udfDebugFlag | 否 | 是 | -| 75 | smaDebugFlag | 否 | 是 | -| 76 | idxDebugFlag | 否 | 是 | -| 77 | tdbDebugFlag | 否 | 是 | -| 78 | metaDebugFlag | 否 | 是 | -| 79 | timezone | 是 | 是 | -| 80 | locale | 是 | 是 | -| 81 | charset | 是 | 是 | -| 82 | udf | 是 | 是 | -| 83 | enableCoreFile | 是 | 是 | -| 84 | arbitrator | 是 | 否 | -| 85 | numOfThreadsPerCore | 是 | 否 | -| 86 | numOfMnodes | 是 | 否 | -| 87 | vnodeBak | 是 | 否 | -| 88 | balance | 是 | 否 | -| 89 | balanceInterval | 是 | 否 | -| 90 | offlineThreshold | 是 | 否 | -| 91 | role | 是 | 否 | -| 92 | dnodeNopLoop | 是 | 否 | -| 93 | keepTimeOffset | 是 | 否 | -| 94 | rpcTimer | 是 | 否 | -| 95 | rpcMaxTime | 是 | 否 | -| 96 | rpcForceTcp | 是 | 否 | -| 97 | tcpConnTimeout | 是 | 否 | -| 98 | syncCheckInterval | 是 | 否 | -| 99 | maxTmrCtrl | 是 | 否 | -| 100 | monitorReplica | 是 | 否 | -| 101 | smlTagNullName | 是 | 否 | -| 102 | keepColumnName | 是 | 否 | -| 103 | ratioOfQueryCores | 是 | 否 | -| 104 | maxStreamCompDelay | 是 | 否 | -| 105 | maxFirstStreamCompDelay | 是 | 否 | -| 106 | retryStreamCompDelay | 是 | 否 | -| 107 | streamCompDelayRatio | 是 | 否 | -| 108 | maxVgroupsPerDb | 是 | 否 | -| 109 | maxTablesPerVnode | 是 | 否 | -| 110 | minTablesPerVnode | 是 | 否 | -| 111 | tableIncStepPerVnode | 是 | 否 | -| 112 | cache | 是 | 否 | -| 113 | blocks | 是 | 否 | -| 114 | days | 是 | 否 | -| 115 | keep | 是 | 否 | -| 116 | minRows | 是 | 否 | -| 117 | maxRows | 是 | 否 | -| 118 | quorum | 是 | 否 | -| 119 | comp | 是 | 否 | -| 120 | walLevel | 是 | 否 | -| 121 | fsync | 是 | 否 | -| 122 | replica | 是 | 否 | -| 123 | partitions | 是 | 否 | -| 124 | quorum | 是 | 否 | -| 125 | update | 是 | 否 | -| 126 | cachelast | 是 | 否 | -| 127 | maxSQLLength | 是 | 否 | -| 128 | maxWildCardsLength | 是 | 否 | -| 129 | maxRegexStringLen | 是 | 否 | -| 130 | maxNumOfOrderedRes | 是 | 否 | -| 131 | maxConnections | 是 | 否 | -| 132 | mnodeEqualVnodeNum | 是 | 否 | -| 133 | http | 是 | 否 | -| 134 | httpEnableRecordSql | 是 | 否 | -| 135 | httpMaxThreads | 是 | 否 | -| 136 | restfulRowLimit | 是 | 否 | -| 137 | httpDbNameMandatory | 是 | 否 | -| 138 | httpKeepAlive | 是 | 否 | -| 139 | enableRecordSql | 是 | 否 | -| 140 | maxBinaryDisplayWidth | 是 | 否 | -| 141 | stream | 是 | 否 | -| 142 | retrieveBlockingModel | 是 | 否 | -| 143 | tsdbMetaCompactRatio | 是 | 否 | -| 144 | defaultJSONStrType | 是 | 否 | -| 145 | walFlushSize | 是 | 否 | -| 146 | keepTimeOffset | 是 | 否 | -| 147 | flowctrl | 是 | 否 | -| 148 | slaveQuery | 是 | 否 | -| 149 | adjustMaster | 是 | 否 | -| 150 | topicBinaryLen | 是 | 否 | -| 151 | telegrafUseFieldNum | 是 | 否 | -| 152 | deadLockKillQuery | 是 | 否 | -| 153 | clientMerge | 是 | 否 | -| 154 | sdbDebugFlag | 是 | 否 | -| 155 | odbcDebugFlag | 是 | 否 | -| 156 | httpDebugFlag | 是 | 否 | -| 157 | monDebugFlag | 是 | 否 | -| 158 | cqDebugFlag | 是 | 否 | -| 159 | shortcutFlag | 是 | 否 | -| 160 | probeSeconds | 是 | 否 | -| 161 | probeKillSeconds | 是 | 否 | -| 162 | probeInterval | 是 | 否 | -| 163 | lossyColumns | 是 | 否 | -| 164 | fPrecision | 是 | 否 | -| 165 | dPrecision | 是 | 否 | -| 166 | maxRange | 是 | 否 | -| 167 | range | 是 | 否 | +| 18 | queryRsmaTolerance | 否 | 是 | +| 19 | queryBufferSize | 是 | 是 | +| 20 | maxNumOfDistinctRes | 是 | 是 | +| 21 | minSlidingTime | 是 | 是 | +| 22 | minIntervalTime | 是 | 是 | +| 23 | countAlwaysReturnValue | 是 | 是 | +| 24 | dataDir | 是 | 是 | +| 25 | minimalDataDirGB | 是 | 是 | +| 26 | supportVnodes | 否 | 是 | +| 27 | tempDir | 是 | 是 | +| 28 | minimalTmpDirGB | 是 | 是 | +| 29 | compressMsgSize | 是 | 是 | +| 30 | compressColData | 是 | 是 | +| 31 | smlChildTableName | 是 | 是 | +| 32 | smlTagName | 是 | 是 | +| 33 | smlDataFormat | 否 | 是 | +| 34 | statusInterval | 是 | 是 | +| 35 | shellActivityTimer | 是 | 是 | +| 36 | transPullupInterval | 否 | 是 | +| 37 | mqRebalanceInterval | 否 | 是 | +| 38 | ttlUnit | 否 | 是 | +| 39 | ttlPushInterval | 否 | 是 | +| 40 | numOfTaskQueueThreads | 否 | 是 | +| 41 | numOfRpcThreads | 否 | 是 | +| 42 | numOfCommitThreads | 是 | 是 | +| 43 | numOfMnodeReadThreads | 否 | 是 | +| 44 | numOfVnodeQueryThreads | 否 | 是 | +| 45 | numOfVnodeStreamThreads | 否 | 是 | +| 46 | numOfVnodeFetchThreads | 否 | 是 | +| 47 | numOfVnodeWriteThreads | 否 | 是 | +| 48 | numOfVnodeSyncThreads | 否 | 是 | +| 49 | numOfVnodeRsmaThreads | 否 | 是 | +| 50 | numOfQnodeQueryThreads | 否 | 是 | +| 51 | numOfQnodeFetchThreads | 否 | 是 | +| 52 | numOfSnodeSharedThreads | 否 | 是 | +| 53 | numOfSnodeUniqueThreads | 否 | 是 | +| 54 | rpcQueueMemoryAllowed | 否 | 是 | +| 55 | logDir | 是 | 是 | +| 56 | minimalLogDirGB | 是 | 是 | +| 57 | numOfLogLines | 是 | 是 | +| 58 | asyncLog | 是 | 是 | +| 59 | logKeepDays | 是 | 是 | +| 60 | debugFlag | 是 | 是 | +| 61 | tmrDebugFlag | 是 | 是 | +| 62 | uDebugFlag | 是 | 是 | +| 63 | rpcDebugFlag | 是 | 是 | +| 64 | jniDebugFlag | 是 | 是 | +| 65 | qDebugFlag | 是 | 是 | +| 66 | cDebugFlag | 是 | 是 | +| 67 | dDebugFlag | 是 | 是 | +| 68 | vDebugFlag | 是 | 是 | +| 69 | mDebugFlag | 是 | 是 | +| 70 | wDebugFlag | 是 | 是 | +| 71 | sDebugFlag | 是 | 是 | +| 72 | tsdbDebugFlag | 是 | 是 | +| 73 | tqDebugFlag | 否 | 是 | +| 74 | fsDebugFlag | 是 | 是 | +| 75 | udfDebugFlag | 否 | 是 | +| 76 | smaDebugFlag | 否 | 是 | +| 77 | idxDebugFlag | 否 | 是 | +| 78 | tdbDebugFlag | 否 | 是 | +| 79 | metaDebugFlag | 否 | 是 | +| 80 | timezone | 是 | 是 | +| 81 | locale | 是 | 是 | +| 82 | charset | 是 | 是 | +| 83 | udf | 是 | 是 | +| 84 | enableCoreFile | 是 | 是 | +| 85 | arbitrator | 是 | 否 | +| 86 | numOfThreadsPerCore | 是 | 否 | +| 87 | numOfMnodes | 是 | 否 | +| 88 | vnodeBak | 是 | 否 | +| 89 | balance | 是 | 否 | +| 90 | balanceInterval | 是 | 否 | +| 91 | offlineThreshold | 是 | 否 | +| 92 | role | 是 | 否 | +| 93 | dnodeNopLoop | 是 | 否 | +| 94 | keepTimeOffset | 是 | 否 | +| 95 | rpcTimer | 是 | 否 | +| 96 | rpcMaxTime | 是 | 否 | +| 97 | rpcForceTcp | 是 | 否 | +| 98 | tcpConnTimeout | 是 | 否 | +| 99 | syncCheckInterval | 是 | 否 | +| 100 | maxTmrCtrl | 是 | 否 | +| 101 | monitorReplica | 是 | 否 | +| 102 | smlTagNullName | 是 | 否 | +| 103 | keepColumnName | 是 | 否 | +| 104 | ratioOfQueryCores | 是 | 否 | +| 105 | maxStreamCompDelay | 是 | 否 | +| 106 | maxFirstStreamCompDelay | 是 | 否 | +| 107 | retryStreamCompDelay | 是 | 否 | +| 108 | streamCompDelayRatio | 是 | 否 | +| 109 | maxVgroupsPerDb | 是 | 否 | +| 110 | maxTablesPerVnode | 是 | 否 | +| 111 | minTablesPerVnode | 是 | 否 | +| 112 | tableIncStepPerVnode | 是 | 否 | +| 113 | cache | 是 | 否 | +| 114 | blocks | 是 | 否 | +| 115 | days | 是 | 否 | +| 116 | keep | 是 | 否 | +| 117 | minRows | 是 | 否 | +| 118 | maxRows | 是 | 否 | +| 119 | quorum | 是 | 否 | +| 120 | comp | 是 | 否 | +| 121 | walLevel | 是 | 否 | +| 122 | fsync | 是 | 否 | +| 123 | replica | 是 | 否 | +| 124 | partitions | 是 | 否 | +| 125 | quorum | 是 | 否 | +| 126 | update | 是 | 否 | +| 127 | cachelast | 是 | 否 | +| 128 | maxSQLLength | 是 | 否 | +| 129 | maxWildCardsLength | 是 | 否 | +| 130 | maxRegexStringLen | 是 | 否 | +| 131 | maxNumOfOrderedRes | 是 | 否 | +| 132 | maxConnections | 是 | 否 | +| 133 | mnodeEqualVnodeNum | 是 | 否 | +| 134 | http | 是 | 否 | +| 135 | httpEnableRecordSql | 是 | 否 | +| 136 | httpMaxThreads | 是 | 否 | +| 137 | restfulRowLimit | 是 | 否 | +| 138 | httpDbNameMandatory | 是 | 否 | +| 139 | httpKeepAlive | 是 | 否 | +| 140 | enableRecordSql | 是 | 否 | +| 141 | maxBinaryDisplayWidth | 是 | 否 | +| 142 | stream | 是 | 否 | +| 143 | retrieveBlockingModel | 是 | 否 | +| 144 | tsdbMetaCompactRatio | 是 | 否 | +| 145 | defaultJSONStrType | 是 | 否 | +| 146 | walFlushSize | 是 | 否 | +| 147 | keepTimeOffset | 是 | 否 | +| 148 | flowctrl | 是 | 否 | +| 149 | slaveQuery | 是 | 否 | +| 150 | adjustMaster | 是 | 否 | +| 151 | topicBinaryLen | 是 | 否 | +| 152 | telegrafUseFieldNum | 是 | 否 | +| 153 | deadLockKillQuery | 是 | 否 | +| 154 | clientMerge | 是 | 否 | +| 155 | sdbDebugFlag | 是 | 否 | +| 156 | odbcDebugFlag | 是 | 否 | +| 157 | httpDebugFlag | 是 | 否 | +| 158 | monDebugFlag | 是 | 否 | +| 159 | cqDebugFlag | 是 | 否 | +| 160 | shortcutFlag | 是 | 否 | +| 161 | probeSeconds | 是 | 否 | +| 162 | probeKillSeconds | 是 | 否 | +| 163 | probeInterval | 是 | 否 | +| 164 | lossyColumns | 是 | 否 | +| 165 | fPrecision | 是 | 否 | +| 166 | dPrecision | 是 | 否 | +| 167 | maxRange | 是 | 否 | +| 168 | range | 是 | 否 | diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 2de4ffdc17..c5b3f8f9f0 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -94,6 +94,7 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in // query client extern int32_t tsQueryPolicy; extern int32_t tsQuerySmaOptimize; +extern int32_t tsQueryRsmaTolerance; extern bool tsQueryPlannerTrace; // client diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index c436e4ffd2..3d9608ad05 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -91,6 +91,7 @@ bool tsSmlDataFormat = // query int32_t tsQueryPolicy = 1; int32_t tsQuerySmaOptimize = 0; +int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which rsma level to query. bool tsQueryPlannerTrace = false; /* @@ -419,6 +420,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400 * 365, 1) != 0) return -1; if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushInterval, 1, 100000, 1) != 0) return -1; if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1; + if (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, 0) != 0) return -1; if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1; GRANT_CFG_ADD; @@ -713,6 +715,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32; tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32; + tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32; tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; @@ -972,6 +975,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32; } else if (strcasecmp("queryPlannerTrace", name) == 0) { tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval; + } else if (strcasecmp("queryRsmaTolerance", name) == 0) { + tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32; } break; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 60d967681b..e3a5ef414c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -2814,8 +2814,11 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* ret int8_t* pLevel) { if (VND_IS_RSMA(pVnode)) { int8_t level = 0; - int64_t now = taosGetTimestamp(pVnode->config.tsdbCfg.precision); - int64_t offset = TSDB_TICK_PER_SECOND(pVnode->config.tsdbCfg.precision); + int8_t precision = pVnode->config.tsdbCfg.precision; + int64_t now = taosGetTimestamp(precision); + int64_t offset = tsQueryRsmaTolerance * ((precision == TSDB_TIME_PRECISION_MILLI) ? 1 + : (precision == TSDB_TIME_PRECISION_MICRO) ? 1000 + : 1000000); for (int8_t i = 0; i < TSDB_RETENTION_MAX; ++i) { SRetention* pRetention = retentions + level; From c2c86159447eba6e87503a9c6e3b716e78049e8f Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 13 Sep 2022 14:56:49 +0800 Subject: [PATCH 02/69] chore: adjust the description of tsQueryRsmaTolerance --- source/common/src/tglobal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 3d9608ad05..fc4e28f9cd 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -91,7 +91,7 @@ bool tsSmlDataFormat = // query int32_t tsQueryPolicy = 1; int32_t tsQuerySmaOptimize = 0; -int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which rsma level to query. +int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data. bool tsQueryPlannerTrace = false; /* From 11ffbfa70f66c357d74540f7aa36d3cabbe57ed9 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 13 Sep 2022 16:18:37 +0800 Subject: [PATCH 03/69] chore: code optimization for rsma fs build --- source/dnode/vnode/src/sma/smaFS.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/sma/smaFS.c b/source/dnode/vnode/src/sma/smaFS.c index 8e8611f0e8..a5f4e8d2e8 100644 --- a/source/dnode/vnode/src/sma/smaFS.c +++ b/source/dnode/vnode/src/sma/smaFS.c @@ -150,6 +150,8 @@ static int32_t tdFetchQTaskInfoFiles(SSma *pSma, int64_t version, SArray **outpu regex_t regex; int code = 0; + terrno = TSDB_CODE_SUCCESS; + tdGetVndDirName(TD_VID(pVnode), tfsGetPrimaryPath(pVnode->pTfs), VNODE_RSMA_DIR, true, dir); if (!taosCheckExistFile(dir)) { From ce60bd0c202a909699a36981a5d2fe8740ed0fad Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 14 Sep 2022 18:01:59 +0800 Subject: [PATCH 04/69] enh: tsdb retention and fs optimization --- include/libs/tfs/tfs.h | 8 ++++++++ source/dnode/vnode/src/tsdb/tsdbFS.c | 4 ++-- source/dnode/vnode/src/tsdb/tsdbRetention.c | 15 +++++++++++++-- source/libs/tfs/src/tfs.c | 2 ++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/include/libs/tfs/tfs.h b/include/libs/tfs/tfs.h index 1dc154ce48..2edb046492 100644 --- a/include/libs/tfs/tfs.h +++ b/include/libs/tfs/tfs.h @@ -69,6 +69,14 @@ void tfsUpdateSize(STfs *pTfs); */ SDiskSize tfsGetSize(STfs *pTfs); +/** + * @brief Get level of multi-tier storage + * + * @param pTfs + * @return int32_t + */ +int32_t tfsGetLevel(STfs *pTfs); + /** * @brief Allocate an existing available tier level from fs. * diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 31bdb784dd..ab16147337 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -58,7 +58,7 @@ static int32_t tsdbGnrtCurrent(STsdb *pTsdb, STsdbFS *pFS, char *fname) { taosCalcChecksumAppend(0, pData, size); // create and write - pFD = taosOpenFile(fname, TD_FILE_WRITE | TD_FILE_CREATE); + pFD = taosOpenFile(fname, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC); if (pFD == NULL) { code = TAOS_SYSTEM_ERROR(errno); goto _err; @@ -1033,7 +1033,7 @@ int32_t tsdbFSCommit2(STsdb *pTsdb, STsdbFS *pFSNew) { code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - iOld++; + iNew++; continue; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index d99bf2aa5c..eb4151079b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -16,9 +16,19 @@ #include "tsdb.h" static bool tsdbShouldDoRetention(STsdb *pTsdb, int64_t now) { + STsdbKeepCfg *keepCfg = &pTsdb->keepCfg; + + if ((keepCfg->keep0 == keepCfg->keep1) && (keepCfg->keep1 == keepCfg->keep2)) { + return false; + } + + if (tfsGetLevel(pTsdb->pVnode->pTfs) <= 1) { + return false; + } + for (int32_t iSet = 0; iSet < taosArrayGetSize(pTsdb->fs.aDFileSet); iSet++) { SDFileSet *pSet = (SDFileSet *)taosArrayGet(pTsdb->fs.aDFileSet, iSet); - int32_t expLevel = tsdbFidLevel(pSet->fid, &pTsdb->keepCfg, now); + int32_t expLevel = tsdbFidLevel(pSet->fid, keepCfg, now); SDiskID did; if (expLevel == pSet->diskId.level) continue; @@ -53,7 +63,7 @@ int32_t tsdbDoRetention(STsdb *pTsdb, int64_t now) { if (code) goto _err; for (int32_t iSet = 0; iSet < taosArrayGetSize(fs.aDFileSet); iSet++) { - SDFileSet *pSet = (SDFileSet *)taosArrayGet(pTsdb->fs.aDFileSet, iSet); + SDFileSet *pSet = (SDFileSet *)taosArrayGet(fs.aDFileSet, iSet); int32_t expLevel = tsdbFidLevel(pSet->fid, &pTsdb->keepCfg, now); SDiskID did; @@ -65,6 +75,7 @@ int32_t tsdbDoRetention(STsdb *pTsdb, int64_t now) { taosArrayRemove(fs.aDFileSet, iSet); iSet--; } else { + if (expLevel == 0) continue; if (tfsAllocDisk(pTsdb->pVnode->pTfs, expLevel, &did) < 0) { code = terrno; goto _exit; diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c index 62aec219df..4600e5e568 100644 --- a/source/libs/tfs/src/tfs.c +++ b/source/libs/tfs/src/tfs.c @@ -113,6 +113,8 @@ SDiskSize tfsGetSize(STfs *pTfs) { return size; } +int32_t tfsGetLevel(STfs *pTfs) { return pTfs->nlevel; } + int32_t tfsAllocDisk(STfs *pTfs, int32_t expLevel, SDiskID *pDiskId) { pDiskId->level = expLevel; pDiskId->id = -1; From 42a326fbdd17e664088eb42dc283cb96039d13b9 Mon Sep 17 00:00:00 2001 From: tomchon Date: Thu, 15 Sep 2022 10:45:41 +0800 Subject: [PATCH 05/69] test:update jenkins of ci --- Jenkinsfile2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index d7df07f06a..6a4a2156e5 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -218,12 +218,12 @@ def pre_test_win(){ if (env.CHANGE_URL =~ /\/TDengine\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull + git pull ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% git remote prune origin - git pull + git pull ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% @@ -236,7 +236,7 @@ def pre_test_win(){ } else if (env.CHANGE_URL =~ /\/TDinternal\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull + git pull ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_INTERNAL_ROOT% From 999d32cdbda788b254d549d3149340997e11f6eb Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Thu, 15 Sep 2022 17:59:09 +0800 Subject: [PATCH 06/69] chore: revert the code change --- include/libs/tfs/tfs.h | 2 +- source/dnode/vnode/src/tsdb/tsdbFS.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/libs/tfs/tfs.h b/include/libs/tfs/tfs.h index 2edb046492..6f71fd4cd0 100644 --- a/include/libs/tfs/tfs.h +++ b/include/libs/tfs/tfs.h @@ -70,7 +70,7 @@ void tfsUpdateSize(STfs *pTfs); SDiskSize tfsGetSize(STfs *pTfs); /** - * @brief Get level of multi-tier storage + * @brief Get level of multi-tier storage. * * @param pTfs * @return int32_t diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index ab16147337..10926ae6ad 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -1033,7 +1033,7 @@ int32_t tsdbFSCommit2(STsdb *pTsdb, STsdbFS *pFSNew) { code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - + iOld++; iNew++; continue; } From ab49ce6eafc3abc7d56820e8d57d302337d594f6 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 19 Sep 2022 11:16:20 +0800 Subject: [PATCH 07/69] enh: rsma exec logic optimization --- source/dnode/vnode/src/sma/smaCommit.c | 11 ++++++-- source/dnode/vnode/src/sma/smaRollup.c | 39 ++------------------------ 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c index 07ec7d0694..2b44cdcef1 100644 --- a/source/dnode/vnode/src/sma/smaCommit.c +++ b/source/dnode/vnode/src/sma/smaCommit.c @@ -295,12 +295,17 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { } /** - * @brief step 3: consume the SubmitReq in buffer + * @brief step 3: commit should wait for all SubmitReq in buffer be consumed * 1) This is high cost task and should not put in asyncPreCommit originally. * 2) But, if put in asyncCommit, would trigger taskInfo cloning frequently. */ - if (tdRSmaProcessExecImpl(pSma, RSMA_EXEC_COMMIT) < 0) { - return TSDB_CODE_FAILED; + nLoops = 0; + while (atomic_load_64(&pRSmaStat->nBufItems) > 0) { + ++nLoops; + if (nLoops > 1000) { + sched_yield(); + nLoops = 0; + } } smaInfo("vgId:%d, rsma commit, wait for all items to be consumed, TID:%p", SMA_VID(pSma), diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index ec8fcb2932..a9c8f69166 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -1822,7 +1822,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { while (true) { // step 1: rsma exec - consume data in buffer queue for all suids - if (type == RSMA_EXEC_OVERFLOW || type == RSMA_EXEC_COMMIT) { + if (type == RSMA_EXEC_OVERFLOW) { void *pIter = NULL; while ((pIter = taosHashIterate(infoHash, pIter))) { SRSmaInfo *pInfo = *(SRSmaInfo **)pIter; @@ -1878,42 +1878,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0); } } - if (type == RSMA_EXEC_COMMIT) { - if (atomic_load_64(&pRSmaStat->nBufItems) <= 0) { - break; - } else { - // commit should wait for all items be consumed - continue; - } - } - } -#if 0 - else if (type == RSMA_EXEC_COMMIT) { - while (pIter) { - SRSmaInfo *pInfo = *(SRSmaInfo **)pIter; - if (taosQueueItemSize(pInfo->iQueue)) { - if (atomic_val_compare_exchange_8(&pInfo->assigned, 0, 1) == 0) { - taosReadAllQitems(pInfo->iQueue, pInfo->iQall); // queue has mutex lock - int32_t qallItemSize = taosQallItemSize(pInfo->iQall); - if (qallItemSize > 0) { - atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize); - nIdle = 0; - - // batch exec - tdRSmaBatchExec(pSma, pInfo, pInfo->qall, pSubmitArr, type); - } - - // tdRSmaFetchAllResult(pSma, pInfo, pSubmitArr); - atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0); - } - } - ASSERT(taosQueueItemSize(pInfo->iQueue) == 0); - pIter = taosHashIterate(infoHash, pIter); - } - break; - } -#endif - else { + } else { ASSERT(0); } From b32fc5a44fc36ccc331d37adc1e1970ff6a17829 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Mon, 19 Sep 2022 19:46:13 +0800 Subject: [PATCH 08/69] fix config --- source/common/src/tglobal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 64d376d265..f1c1e79a86 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -58,7 +58,7 @@ int32_t tsNumOfMnodeFetchThreads = 1; int32_t tsNumOfMnodeReadThreads = 1; int32_t tsNumOfVnodeQueryThreads = 4; int32_t tsNumOfVnodeStreamThreads = 2; -int32_t tsNumOfVnodeFetchThreads = 1; +int32_t tsNumOfVnodeFetchThreads = 4; int32_t tsNumOfVnodeWriteThreads = 2; int32_t tsNumOfVnodeSyncThreads = 2; int32_t tsNumOfVnodeRsmaThreads = 2; @@ -365,7 +365,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { tsNumOfVnodeStreamThreads = TMAX(tsNumOfVnodeStreamThreads, 4); if (cfgAddInt32(pCfg, "numOfVnodeStreamThreads", tsNumOfVnodeStreamThreads, 4, 1024, 0) != 0) return -1; - tsNumOfVnodeFetchThreads = 1; + tsNumOfVnodeFetchThreads = tsNumOfCores / 4; + tsNumOfVnodeFetchThreads = TMAX(tsNumOfVnodeFetchThreads, 4); if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 4, 1024, 0) != 0) return -1; tsNumOfVnodeWriteThreads = tsNumOfCores; From 50ee0dabbfe149be3730471a68cc5a6517ce5e7d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 20 Sep 2022 10:02:20 +0800 Subject: [PATCH 09/69] refactor(query): do some internal refactor. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 117 +++++++++++------- source/libs/executor/src/timewindowoperator.c | 13 +- 2 files changed, 77 insertions(+), 53 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 14dbfbd63e..95b4afe6d8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -3290,9 +3290,31 @@ void* tsdbGetIvtIdx(SMeta* pMeta) { uint64_t getReaderMaxVersion(STsdbReader* pReader) { return pReader->verRange.maxVer; } + +static int32_t doOpenReaderImpl(STsdbReader* pReader) { + SDataBlockIter* pBlockIter = &pReader->status.blockIter; + + initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader); + resetDataBlockIterator(&pReader->status.blockIter, pReader->order); + + // no data in files, let's try buffer in memory + if (pReader->status.fileIter.numOfFiles == 0) { + pReader->status.loadFromFile = false; + return TSDB_CODE_SUCCESS; + } else { + return initForFirstBlockInFile(pReader, pBlockIter); + } +} + // ====================================== EXPOSED APIs ====================================== int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTableList, STsdbReader** ppReader, const char* idstr) { + STimeWindow window = pCond->twindows; + if (pCond->type == TIMEWINDOW_RANGE_EXTERNAL) { + pCond->twindows.skey += 1; + pCond->twindows.ekey -= 1; + } + int32_t code = tsdbReaderCreate(pVnode, pCond, ppReader, 4096, idstr); if (code != TSDB_CODE_SUCCESS) { goto _err; @@ -3300,21 +3322,20 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl // check for query time window STsdbReader* pReader = *ppReader; - if (isEmptyQueryTimeWindow(&pReader->window)) { + if (isEmptyQueryTimeWindow(&pReader->window) && pCond->type == TIMEWINDOW_RANGE_CONTAINED) { tsdbDebug("%p query window not overlaps with the data set, no result returned, %s", pReader, pReader->idStr); return TSDB_CODE_SUCCESS; } if (pCond->type == TIMEWINDOW_RANGE_EXTERNAL) { // update the SQueryTableDataCond to create inner reader - STimeWindow w = pCond->twindows; int32_t order = pCond->order; if (order == TSDB_ORDER_ASC) { - pCond->twindows.ekey = pCond->twindows.skey; + pCond->twindows.ekey = window.skey; pCond->twindows.skey = INT64_MIN; pCond->order = TSDB_ORDER_DESC; } else { - pCond->twindows.skey = pCond->twindows.ekey; + pCond->twindows.skey = window.ekey; pCond->twindows.ekey = INT64_MAX; pCond->order = TSDB_ORDER_ASC; } @@ -3326,11 +3347,11 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl } if (order == TSDB_ORDER_ASC) { - pCond->twindows.skey = w.ekey; + pCond->twindows.skey = window.ekey; pCond->twindows.ekey = INT64_MAX; } else { pCond->twindows.skey = INT64_MIN; - pCond->twindows.ekey = w.ekey; + pCond->twindows.ekey = window.ekey; } code = tsdbReaderCreate(pVnode, pCond, &pReader->innerReader[1], 1, idstr); if (code != TSDB_CODE_SUCCESS) { @@ -3340,13 +3361,13 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl // NOTE: the endVersion in pCond is the data version not schema version, so pCond->endVersion is not correct here. if (pCond->suid != 0) { - pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, /*pCond->endVersion*/ -1); + pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, -1); if (pReader->pSchema == NULL) { tsdbError("failed to get table schema, suid:%"PRIu64", ver:%"PRId64" , %s", pReader->suid, -1, pReader->idStr); } } else if (taosArrayGetSize(pTableList) > 0) { STableKeyInfo* pKey = taosArrayGet(pTableList, 0); - pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, /*pCond->endVersion*/ -1); + pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1); if (pReader->pSchema == NULL) { tsdbError("failed to get table schema, uid:%"PRIu64", ver:%"PRId64" , %s", pKey->uid, -1, pReader->idStr); } @@ -3368,40 +3389,36 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl } if (pReader->type == TIMEWINDOW_RANGE_CONTAINED) { - SDataBlockIter* pBlockIter = &pReader->status.blockIter; - - initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader); - resetDataBlockIterator(&pReader->status.blockIter, pReader->order); - - // no data in files, let's try buffer in memory - if (pReader->status.fileIter.numOfFiles == 0) { - pReader->status.loadFromFile = false; - } else { - code = initForFirstBlockInFile(pReader, pBlockIter); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + code = doOpenReaderImpl(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; } } else { - STsdbReader* pPrevReader = pReader->innerReader[0]; - SDataBlockIter* pBlockIter = &pPrevReader->status.blockIter; + STsdbReader* pPrevReader = pReader->innerReader[0]; + STsdbReader* pNextReader = pReader->innerReader[1]; - code = tsdbTakeReadSnap(pPrevReader->pTsdb, &pPrevReader->pReadSnap, pReader->idStr); + // we need only one row + pPrevReader->capacity = 1; + pPrevReader->status.pTableMap = pReader->status.pTableMap; + pPrevReader->pReadSnap = pReader->pReadSnap; + + pNextReader->capacity = 1; + pNextReader->status.pTableMap = pReader->status.pTableMap; + pNextReader->pReadSnap = pReader->pReadSnap; + + code = doOpenReaderImpl(pPrevReader); if (code != TSDB_CODE_SUCCESS) { - goto _err; + return code; } - initFilesetIterator(&pPrevReader->status.fileIter, pPrevReader->pReadSnap->fs.aDFileSet, pPrevReader); - resetDataBlockIterator(&pPrevReader->status.blockIter, pPrevReader->order); + code = doOpenReaderImpl(pNextReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } - // no data in files, let's try buffer in memory - if (pPrevReader->status.fileIter.numOfFiles == 0) { - pPrevReader->status.loadFromFile = false; - } else { - code = initForFirstBlockInFile(pPrevReader, pBlockIter); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + code = doOpenReaderImpl(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; } } @@ -3418,6 +3435,19 @@ void tsdbReaderClose(STsdbReader* pReader) { return; } + { + if (pReader->innerReader[0] != NULL) { + pReader->innerReader[0]->status.pTableMap = NULL; + pReader->innerReader[0]->pReadSnap = NULL; + + pReader->innerReader[1]->status.pTableMap = NULL; + pReader->innerReader[1]->pReadSnap = NULL; + + tsdbReaderClose(pReader->innerReader[0]); + tsdbReaderClose(pReader->innerReader[1]); + } + } + SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo; taosMemoryFreeClear(pSupInfo->plist); @@ -3508,32 +3538,31 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { return false; } - if (pReader->innerReader[0] != NULL) { + if (pReader->innerReader[0] != NULL && pReader->step == 0) { bool ret = doTsdbNextDataBlock(pReader->innerReader[0]); + resetDataBlockScanInfo(pReader->innerReader[0]->status.pTableMap, pReader->innerReader[0]->window.ekey); if (ret) { pReader->step = EXTERNAL_ROWS_PREV; return ret; } - - tsdbReaderClose(pReader->innerReader[0]); - pReader->innerReader[0] = NULL; } - pReader->step = EXTERNAL_ROWS_MAIN; + if (pReader->step == EXTERNAL_ROWS_PREV) { + pReader->step = EXTERNAL_ROWS_MAIN; + } + bool ret = doTsdbNextDataBlock(pReader); if (ret) { return ret; } - if (pReader->innerReader[1] != NULL) { + if (pReader->innerReader[1] != NULL && pReader->step == EXTERNAL_ROWS_MAIN) { + resetDataBlockScanInfo(pReader->innerReader[1]->status.pTableMap, pReader->window.ekey); bool ret1 = doTsdbNextDataBlock(pReader->innerReader[1]); if (ret1) { pReader->step = EXTERNAL_ROWS_NEXT; return ret1; } - - tsdbReaderClose(pReader->innerReader[1]); - pReader->innerReader[1] = NULL; } return false; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index c221aaf4fd..0c6cc51efd 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2213,15 +2213,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { SSDataBlock* pResBlock = pSliceInfo->pRes; SExprSupp* pSup = &pOperator->exprSupp; - // if (pOperator->status == OP_RES_TO_RETURN) { - // // doBuildResultDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); - // if (pResBlock->info.rows == 0 || !hasRemainResults(&pSliceInfo->groupResInfo)) { - // doSetOperatorCompleted(pOperator); - // } - // - // return pResBlock; - // } - int32_t order = TSDB_ORDER_ASC; SInterval* pInterval = &pSliceInfo->interval; SOperatorInfo* downstream = pOperator->pDownstream[0]; @@ -2534,6 +2525,10 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode pInfo->interval.interval = pInterpPhyNode->interval; pInfo->current = pInfo->win.skey; + STableScanInfo* pScanInfo = (STableScanInfo*)downstream->info; + pScanInfo->cond.twindows = pInfo->win; + pScanInfo->cond.type = TIMEWINDOW_RANGE_EXTERNAL; + pOperator->name = "TimeSliceOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC; pOperator->blocking = false; From 8a010a58f3e7997c1c68eefb2ec10e5ce5ea5fbf Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 20 Sep 2022 16:13:08 +0800 Subject: [PATCH 10/69] enh: added memory allocators for parser and planner --- include/libs/nodes/nodes.h | 6 ++ source/libs/nodes/src/nodesUtilFuncs.c | 115 +++++++++++++++++++--- source/libs/parser/src/parAstCreater.c | 3 +- source/libs/parser/test/parTestUtil.cpp | 52 +++++----- source/libs/planner/src/planSpliter.c | 1 + source/libs/planner/test/planTestMain.cpp | 8 ++ source/libs/planner/test/planTestUtil.cpp | 49 ++++----- source/libs/planner/test/planTestUtil.h | 11 ++- source/libs/scalar/src/scalar.c | 2 +- 9 files changed, 181 insertions(+), 66 deletions(-) diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 6500d3d183..1e2a53f598 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -275,6 +275,12 @@ typedef struct SNodeList { SListCell* pTail; } SNodeList; +typedef struct SNodeAllocator SNodeAllocator; + +int32_t nodesCreateNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator); +void nodesDestroyNodeAllocator(SNodeAllocator* pAllocator); +void nodesResetThreadLevelAllocator(SNodeAllocator* pAllocator); + SNode* nodesMakeNode(ENodeType type); void nodesDestroyNode(SNode* pNode); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 805ddb9e42..be94495856 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -22,8 +22,98 @@ #include "tdatablock.h" #include "thash.h" -static SNode* makeNode(ENodeType type, size_t size) { - SNode* p = taosMemoryCalloc(1, size); +typedef struct SNodeMemChunk { + int32_t availableSize; + int32_t usedSize; + char* pBuf; + struct SNodeMemChunk* pNext; +} SNodeMemChunk; + +typedef struct SNodeAllocator { + int32_t chunkSize; + int32_t chunkNum; + SNodeMemChunk* pCurrChunk; + SNodeMemChunk* pChunks; +} SNodeAllocator; + +static threadlocal SNodeAllocator* pNodeAllocator; + +static SNodeMemChunk* callocNodeChunk(SNodeAllocator* pAllocator) { + SNodeMemChunk* pNewChunk = taosMemoryCalloc(1, sizeof(SNodeMemChunk) + pAllocator->chunkSize); + if (NULL == pNewChunk) { + return NULL; + } + pNewChunk->pBuf = (char*)(pNewChunk + 1); + pNewChunk->availableSize = pAllocator->chunkSize; + pNewChunk->usedSize = 0; + pNewChunk->pNext = NULL; + if (NULL != pAllocator->pCurrChunk) { + pAllocator->pCurrChunk->pNext = pNewChunk; + } + pAllocator->pCurrChunk = pNewChunk; + if (NULL == pAllocator->pChunks) { + pAllocator->pChunks = pNewChunk; + } + ++(pAllocator->chunkNum); + return pNewChunk; +} + +static void* nodesCalloc(int32_t num, int32_t size) { + if (NULL == pNodeAllocator) { + return taosMemoryCalloc(num, size); + } + + if (pNodeAllocator->pCurrChunk->usedSize + size > pNodeAllocator->pCurrChunk->availableSize) { + if (NULL == callocNodeChunk(pNodeAllocator)) { + return NULL; + } + } + void* p = pNodeAllocator->pCurrChunk->pBuf + pNodeAllocator->pCurrChunk->usedSize; + pNodeAllocator->pCurrChunk->usedSize += size; + return p; +} + +static void nodesFree(void* p) { + if (NULL == pNodeAllocator) { + taosMemoryFree(p); + } + return; +} + +int32_t nodesCreateNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator) { + *pAllocator = taosMemoryCalloc(1, sizeof(SNodeAllocator)); + if (NULL == *pAllocator) { + return TSDB_CODE_OUT_OF_MEMORY; + } + (*pAllocator)->chunkSize = chunkSize; + if (NULL == callocNodeChunk(*pAllocator)) { + taosMemoryFreeClear(*pAllocator); + return TSDB_CODE_OUT_OF_MEMORY; + } + return TSDB_CODE_SUCCESS; +} + +void nodesDestroyNodeAllocator(SNodeAllocator* pAllocator) { + if (NULL == pAllocator) { + return; + } + + nodesDebug("alloc chunkNum: %d, chunkTotakSize: %d", pAllocator->chunkNum, + pAllocator->chunkNum * pAllocator->chunkSize); + + SNodeMemChunk* pChunk = pAllocator->pChunks; + while (NULL != pChunk) { + SNodeMemChunk* pTemp = pChunk->pNext; + taosMemoryFree(pChunk); + pChunk = pTemp; + } + taosMemoryFree(pAllocator); +} + +void nodesResetThreadLevelAllocator(SNodeAllocator* pAllocator) { pNodeAllocator = pAllocator; } + +static SNode* makeNode(ENodeType type, int32_t size) { + SNode* p = nodesCalloc(1, size); if (NULL == p) { return NULL; } @@ -824,6 +914,7 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyNode(pLogicNode->pWStartTs); nodesDestroyNode(pLogicNode->pValues); nodesDestroyList(pLogicNode->pFillExprs); + nodesDestroyList(pLogicNode->pNotFillExprs); break; } case QUERY_NODE_LOGIC_PLAN_SORT: { @@ -1021,12 +1112,12 @@ void nodesDestroyNode(SNode* pNode) { default: break; } - taosMemoryFreeClear(pNode); + nodesFree(pNode); return; } SNodeList* nodesMakeList() { - SNodeList* p = taosMemoryCalloc(1, sizeof(SNodeList)); + SNodeList* p = nodesCalloc(1, sizeof(SNodeList)); if (NULL == p) { return NULL; } @@ -1037,7 +1128,7 @@ int32_t nodesListAppend(SNodeList* pList, SNode* pNode) { if (NULL == pList || NULL == pNode) { return TSDB_CODE_FAILED; } - SListCell* p = taosMemoryCalloc(1, sizeof(SListCell)); + SListCell* p = nodesCalloc(1, sizeof(SListCell)); if (NULL == p) { terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY; @@ -1104,7 +1195,7 @@ int32_t nodesListAppendList(SNodeList* pTarget, SNodeList* pSrc) { } pTarget->pTail = pSrc->pTail; pTarget->length += pSrc->length; - taosMemoryFreeClear(pSrc); + nodesFree(pSrc); return TSDB_CODE_SUCCESS; } @@ -1124,7 +1215,7 @@ int32_t nodesListPushFront(SNodeList* pList, SNode* pNode) { if (NULL == pList || NULL == pNode) { return TSDB_CODE_FAILED; } - SListCell* p = taosMemoryCalloc(1, sizeof(SListCell)); + SListCell* p = nodesCalloc(1, sizeof(SListCell)); if (NULL == p) { terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY; @@ -1152,7 +1243,7 @@ SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) { } SListCell* pNext = pCell->pNext; nodesDestroyNode(pCell->pNode); - taosMemoryFreeClear(pCell); + nodesFree(pCell); --(pList->length); return pNext; } @@ -1172,7 +1263,7 @@ void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) { pPos->pPrev = pSrc->pTail; pTarget->length += pSrc->length; - taosMemoryFreeClear(pSrc); + nodesFree(pSrc); } SNode* nodesListGetNode(SNodeList* pList, int32_t index) { @@ -1204,7 +1295,7 @@ void nodesDestroyList(SNodeList* pList) { while (NULL != pNext) { pNext = nodesListErase(pList, pNext); } - taosMemoryFreeClear(pList); + nodesFree(pList); } void nodesClearList(SNodeList* pList) { @@ -1216,9 +1307,9 @@ void nodesClearList(SNodeList* pList) { while (NULL != pNext) { SListCell* tmp = pNext; pNext = pNext->pNext; - taosMemoryFreeClear(tmp); + nodesFree(tmp); } - taosMemoryFreeClear(pList); + nodesFree(pList); } void* nodesGetValueFromNode(SValueNode* pNode) { diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 6f11c653a4..379bd975b4 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -247,7 +247,8 @@ SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) { pExpr->userAlias[len] = '\0'; } } - taosMemoryFreeClear(pNode); + pRawExpr->pNode = NULL; + nodesDestroyNode(pNode); return pRealizedExpr; } diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp index 360b904c17..14c991917b 100644 --- a/source/libs/parser/test/parTestUtil.cpp +++ b/source/libs/parser/test/parTestUtil.cpp @@ -119,12 +119,18 @@ class ParserTestBaseImpl { TEST_INTERFACE_ASYNC_API }; - static void _destoryParseMetaCache(SParseMetaCache* pMetaCache, bool request) { + static void destoryParseContext(SParseContext* pCxt) { + taosArrayDestroy(pCxt->pTableMetaPos); + taosArrayDestroy(pCxt->pTableVgroupPos); + delete pCxt; + } + + static void destoryParseMetaCacheWarpper(SParseMetaCache* pMetaCache, bool request) { destoryParseMetaCache(pMetaCache, request); delete pMetaCache; } - static void _destroyQuery(SQuery** pQuery) { + static void destroyQuery(SQuery** pQuery) { if (nullptr == pQuery) { return; } @@ -303,10 +309,10 @@ class ParserTestBaseImpl { setParseContext(sql, &cxt); if (qIsInsertValuesSql(cxt.pSql, cxt.sqlLen)) { - unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery); + unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery); doParseInsertSql(&cxt, query.get(), nullptr); } else { - unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery); + unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery); doParse(&cxt, query.get()); SQuery* pQuery = *(query.get()); @@ -335,7 +341,7 @@ class ParserTestBaseImpl { SParseContext cxt = {0}; setParseContext(sql, &cxt); - unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery); + unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery); doParseSql(&cxt, query.get()); SQuery* pQuery = *(query.get()); @@ -354,26 +360,26 @@ class ParserTestBaseImpl { void runAsyncInternalFuncs(const string& sql, int32_t expect, ParserStage checkStage) { reset(expect, checkStage, TEST_INTERFACE_ASYNC_INTERNAL); try { - SParseContext cxt = {0}; - setParseContext(sql, &cxt, true); + unique_ptr > cxt(new SParseContext(), destoryParseContext); + setParseContext(sql, cxt.get(), true); - unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery); + unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery); bool request = true; unique_ptr > metaCache( - new SParseMetaCache(), bind(_destoryParseMetaCache, _1, cref(request))); - bool isInsertValues = qIsInsertValuesSql(cxt.pSql, cxt.sqlLen); + new SParseMetaCache(), bind(destoryParseMetaCacheWarpper, _1, cref(request))); + bool isInsertValues = qIsInsertValuesSql(cxt->pSql, cxt->sqlLen); if (isInsertValues) { - doParseInsertSyntax(&cxt, query.get(), metaCache.get()); + doParseInsertSyntax(cxt.get(), query.get(), metaCache.get()); } else { - doParse(&cxt, query.get()); - doCollectMetaKey(&cxt, *(query.get()), metaCache.get()); + doParse(cxt.get(), query.get()); + doCollectMetaKey(cxt.get(), *(query.get()), metaCache.get()); } SQuery* pQuery = *(query.get()); unique_ptr catalogReq(new SCatalogReq(), MockCatalogService::destoryCatalogReq); - doBuildCatalogReq(&cxt, metaCache.get(), catalogReq.get()); + doBuildCatalogReq(cxt.get(), metaCache.get(), catalogReq.get()); string err; thread t1([&]() { @@ -386,13 +392,13 @@ class ParserTestBaseImpl { doPutMetaDataToCache(catalogReq.get(), metaData.get(), metaCache.get(), isInsertValues); if (isInsertValues) { - doParseInsertSql(&cxt, query.get(), metaCache.get()); + doParseInsertSql(cxt.get(), query.get(), metaCache.get()); } else { - doAuthenticate(&cxt, pQuery, metaCache.get()); + doAuthenticate(cxt.get(), pQuery, metaCache.get()); - doTranslate(&cxt, pQuery, metaCache.get()); + doTranslate(cxt.get(), pQuery, metaCache.get()); - doCalculateConstant(&cxt, pQuery); + doCalculateConstant(cxt.get(), pQuery); } } catch (const TerminateFlag& e) { // success and terminate @@ -423,13 +429,13 @@ class ParserTestBaseImpl { void runAsyncApis(const string& sql, int32_t expect, ParserStage checkStage) { reset(expect, checkStage, TEST_INTERFACE_ASYNC_API); try { - SParseContext cxt = {0}; - setParseContext(sql, &cxt); + unique_ptr > cxt(new SParseContext(), destoryParseContext); + setParseContext(sql, cxt.get()); unique_ptr catalogReq(new SCatalogReq(), MockCatalogService::destoryCatalogReq); - unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery); - doParseSqlSyntax(&cxt, query.get(), catalogReq.get()); + unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery); + doParseSqlSyntax(cxt.get(), query.get(), catalogReq.get()); SQuery* pQuery = *(query.get()); string err; @@ -438,7 +444,7 @@ class ParserTestBaseImpl { unique_ptr metaData(new SMetaData(), MockCatalogService::destoryMetaData); doGetAllMeta(catalogReq.get(), metaData.get()); - doAnalyseSqlSemantic(&cxt, catalogReq.get(), metaData.get(), pQuery); + doAnalyseSqlSemantic(cxt.get(), catalogReq.get(), metaData.get(), pQuery); } catch (const TerminateFlag& e) { // success and terminate } catch (const runtime_error& e) { diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index beb938b161..3af3786363 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -997,6 +997,7 @@ static int32_t stbSplSplitMergeScanNode(SSplitContext* pCxt, SLogicSubplan* pSub code = stbSplCreateMergeNode(pCxt, pSubplan, (SLogicNode*)pScan, pMergeKeys, pMergeScan, groupSort); } if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode((SNode*)pScan); code = nodesListMakeStrictAppend(&pSubplan->pChildren, (SNode*)splCreateScanSubplan(pCxt, pMergeScan, SPLIT_FLAG_STABLE_SPLIT)); } diff --git a/source/libs/planner/test/planTestMain.cpp b/source/libs/planner/test/planTestMain.cpp index 8f6fc832a2..e86bf90f51 100644 --- a/source/libs/planner/test/planTestMain.cpp +++ b/source/libs/planner/test/planTestMain.cpp @@ -22,6 +22,7 @@ #include "mockCatalog.h" #include "parser.h" #include "planTestUtil.h" +#include "tglobal.h" class PlannerEnv : public testing::Environment { public: @@ -30,6 +31,7 @@ class PlannerEnv : public testing::Environment { initMetaDataEnv(); generateMetaData(); initLog(TD_TMP_DIR_PATH "td"); + initCfg(); } virtual void TearDown() { @@ -67,6 +69,8 @@ class PlannerEnv : public testing::Environment { std::cout << "failed to init log file" << std::endl; } } + + void initCfg() { tsQueryPlannerTrace = true; } }; static void parseArg(int argc, char* argv[]) { @@ -79,6 +83,7 @@ static void parseArg(int argc, char* argv[]) { {"limitSql", required_argument, NULL, 'i'}, {"log", required_argument, NULL, 'l'}, {"queryPolicy", required_argument, NULL, 'q'}, + {"useNodeAllocator", required_argument, NULL, 'a'}, {0, 0, 0, 0} }; // clang-format on @@ -99,6 +104,9 @@ static void parseArg(int argc, char* argv[]) { case 'q': setQueryPolicy(optarg); break; + case 'a': + setUseNodeAllocator(optarg); + break; default: break; } diff --git a/source/libs/planner/test/planTestUtil.cpp b/source/libs/planner/test/planTestUtil.cpp index 2b8e3d9864..65aed6cadc 100644 --- a/source/libs/planner/test/planTestUtil.cpp +++ b/source/libs/planner/test/planTestUtil.cpp @@ -41,6 +41,7 @@ using namespace testing; enum DumpModule { DUMP_MODULE_NOTHING = 1, + DUMP_MODULE_SQL, DUMP_MODULE_PARSER, DUMP_MODULE_LOGIC, DUMP_MODULE_OPTIMIZED, @@ -56,10 +57,13 @@ int32_t g_skipSql = 0; int32_t g_limitSql = 0; int32_t g_logLevel = 131; int32_t g_queryPolicy = QUERY_POLICY_VNODE; +bool g_useNodeAllocator = false; void setDumpModule(const char* pModule) { if (NULL == pModule) { g_dumpModule = DUMP_MODULE_ALL; + } else if (0 == strncasecmp(pModule, "sql", strlen(pModule))) { + g_dumpModule = DUMP_MODULE_SQL; } else if (0 == strncasecmp(pModule, "parser", strlen(pModule))) { g_dumpModule = DUMP_MODULE_PARSER; } else if (0 == strncasecmp(pModule, "logic", strlen(pModule))) { @@ -79,10 +83,11 @@ void setDumpModule(const char* pModule) { } } -void setSkipSqlNum(const char* pNum) { g_skipSql = stoi(pNum); } -void setLimitSqlNum(const char* pNum) { g_limitSql = stoi(pNum); } -void setLogLevel(const char* pLogLevel) { g_logLevel = stoi(pLogLevel); } -void setQueryPolicy(const char* pQueryPolicy) { g_queryPolicy = stoi(pQueryPolicy); } +void setSkipSqlNum(const char* pArg) { g_skipSql = stoi(pArg); } +void setLimitSqlNum(const char* pArg) { g_limitSql = stoi(pArg); } +void setLogLevel(const char* pArg) { g_logLevel = stoi(pArg); } +void setQueryPolicy(const char* pArg) { g_queryPolicy = stoi(pArg); } +void setUseNodeAllocator(const char* pArg) { g_useNodeAllocator = stoi(pArg); } int32_t getLogLevel() { return g_logLevel; } @@ -124,6 +129,12 @@ class PlannerTestBaseImpl { } void runImpl(const string& sql, int32_t queryPolicy) { + SNodeAllocator* pAllocator = NULL; + if (g_useNodeAllocator) { + nodesCreateNodeAllocator(32 * 1024, &pAllocator); + nodesResetThreadLevelAllocator(pAllocator); + } + reset(); tsQueryPolicy = queryPolicy; try { @@ -155,8 +166,13 @@ class PlannerTestBaseImpl { dump(g_dumpModule); } catch (...) { dump(DUMP_MODULE_ALL); + nodesDestroyNodeAllocator(pAllocator); + nodesResetThreadLevelAllocator(NULL); throw; } + + nodesDestroyNodeAllocator(pAllocator); + nodesResetThreadLevelAllocator(NULL); } void prepare(const string& sql) { @@ -216,6 +232,8 @@ class PlannerTestBaseImpl { doCreatePhysiPlan(&cxt, pLogicPlan, &pPlan); unique_ptr plan(pPlan, (void (*)(SQueryPlan*))nodesDestroyNode); + checkPlanMsg((SNode*)pPlan); + dump(g_dumpModule); } catch (...) { dump(DUMP_MODULE_ALL); @@ -252,7 +270,6 @@ class PlannerTestBaseImpl { string splitLogicPlan_; string scaledLogicPlan_; string physiPlan_; - string physiPlanMsg_; vector physiSubplans_; }; @@ -276,17 +293,16 @@ class PlannerTestBaseImpl { res_.splitLogicPlan_.clear(); res_.scaledLogicPlan_.clear(); res_.physiPlan_.clear(); - res_.physiPlanMsg_.clear(); res_.physiSubplans_.clear(); } void dump(DumpModule module) { - cout << "========================================== " << sqlNo_ << " sql : [" << stmtEnv_.sql_ << "]" << endl; - if (DUMP_MODULE_NOTHING == module) { return; } + cout << "========================================== " << sqlNo_ << " sql : [" << stmtEnv_.sql_ << "]" << endl; + if (DUMP_MODULE_ALL == module || DUMP_MODULE_PARSER == module) { if (res_.prepareAst_.empty()) { cout << "+++++++++++++++++++++syntax tree : " << endl; @@ -411,8 +427,6 @@ class PlannerTestBaseImpl { SNode* pSubplan; FOREACH(pSubplan, ((SNodeListNode*)pNode)->pNodeList) { res_.physiSubplans_.push_back(toString(pSubplan)); } } - res_.physiPlanMsg_ = toMsg((SNode*)(*pPlan)); - cout << "json len: " << res_.physiPlan_.length() << ", msg len: " << res_.physiPlanMsg_.length() << endl; } void setPlanContext(SQuery* pQuery, SPlanContext* pCxt) { @@ -451,27 +465,16 @@ class PlannerTestBaseImpl { string toString(const SNode* pRoot) { char* pStr = NULL; int32_t len = 0; - - auto start = chrono::steady_clock::now(); DO_WITH_THROW(nodesNodeToString, pRoot, false, &pStr, &len) - if (QUERY_NODE_PHYSICAL_PLAN == nodeType(pRoot)) { - cout << "nodesNodeToString: " - << chrono::duration_cast(chrono::steady_clock::now() - start).count() << "us" << endl; - } - string str(pStr); taosMemoryFreeClear(pStr); return str; } - string toMsg(const SNode* pRoot) { + void checkPlanMsg(const SNode* pRoot) { char* pStr = NULL; int32_t len = 0; - - auto start = chrono::steady_clock::now(); DO_WITH_THROW(nodesNodeToMsg, pRoot, &pStr, &len) - cout << "nodesNodeToMsg: " - << chrono::duration_cast(chrono::steady_clock::now() - start).count() << "us" << endl; string copyStr(pStr, len); SNode* pNode = NULL; @@ -491,9 +494,7 @@ class PlannerTestBaseImpl { nodesDestroyNode(pNode); taosMemoryFreeClear(pNewStr); - string str(pStr, len); taosMemoryFreeClear(pStr); - return str; } caseEnv caseEnv_; diff --git a/source/libs/planner/test/planTestUtil.h b/source/libs/planner/test/planTestUtil.h index b0ddd726a6..be8b51f769 100644 --- a/source/libs/planner/test/planTestUtil.h +++ b/source/libs/planner/test/planTestUtil.h @@ -41,11 +41,12 @@ class PlannerTestBase : public testing::Test { std::unique_ptr impl_; }; -extern void setDumpModule(const char* pModule); -extern void setSkipSqlNum(const char* pNum); -extern void setLimitSqlNum(const char* pNum); -extern void setLogLevel(const char* pLogLevel); -extern void setQueryPolicy(const char* pQueryPolicy); +extern void setDumpModule(const char* pArg); +extern void setSkipSqlNum(const char* pArg); +extern void setLimitSqlNum(const char* pArg); +extern void setLogLevel(const char* pArg); +extern void setQueryPolicy(const char* pArg); +extern void setUseNodeAllocator(const char* pArg); extern int32_t getLogLevel(); #endif // PLAN_TEST_UTIL_H diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cd1f6624bd..05730c62ac 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -847,7 +847,7 @@ EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) { memcpy(res->datum.p, output.columnData->pData, len); } else if (IS_VAR_DATA_TYPE(type)) { //res->datum.p = taosMemoryCalloc(res->node.resType.bytes + VARSTR_HEADER_SIZE + 1, 1); - res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData), 1); + res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData) + 1, 1); res->node.resType.bytes = varDataTLen(output.columnData->pData); memcpy(res->datum.p, output.columnData->pData, varDataTLen(output.columnData->pData)); } else { From 0517996b97f20d87091165004b80dfc7f84c6a2f Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 17:20:04 +0800 Subject: [PATCH 11/69] test:add testcase of data Compatibility --- tests/parallel_test/run_container.sh | 10 +- tests/system-test/0-others/compatibility.py | 138 ++++++++++++++++++++ 2 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 tests/system-test/0-others/compatibility.py diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh index f0ee9be46f..3a7193b39c 100755 --- a/tests/parallel_test/run_container.sh +++ b/tests/parallel_test/run_container.sh @@ -79,9 +79,11 @@ fi ulimit -c unlimited TMP_DIR=$WORKDIR/tmp - +SOURCEDIR=$WORKDIR/src MOUNT_DIR="" +packageName="TDengine-server-3.0.1.0-Linux-x64.tar.gz" rm -rf ${TMP_DIR}/thread_volume/$thread_no/sim +mkdir -p $SOURCEDIR mkdir -p ${TMP_DIR}/thread_volume/$thread_no/sim/tsim mkdir -p ${TMP_DIR}/thread_volume/$thread_no/coredump rm -rf ${TMP_DIR}/thread_volume/$thread_no/coredump/* @@ -90,6 +92,11 @@ if [ ! -d "${TMP_DIR}/thread_volume/$thread_no/$exec_dir" ]; then echo "cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/" cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/ fi + +if [ ! -d "${SOURCEDIR}/${packageName}" ]; then + wget -P ${SOURCEDIR} https://taosdata.com/assets-download/3.0/${packageName} +fi + MOUNT_DIR="$TMP_DIR/thread_volume/$thread_no/$exec_dir:$CONTAINER_TESTDIR/tests/$exec_dir" echo "$thread_no -> ${exec_dir}:$cmd" coredump_dir=`cat /proc/sys/kernel/core_pattern | xargs dirname` @@ -97,6 +104,7 @@ coredump_dir=`cat /proc/sys/kernel/core_pattern | xargs dirname` docker run \ -v $REP_MOUNT_PARAM \ -v $MOUNT_DIR \ + -v ${SOURCEDIR}:/usr/local/src/ \ -v "$TMP_DIR/thread_volume/$thread_no/sim:${SIM_DIR}" \ -v ${TMP_DIR}/thread_volume/$thread_no/coredump:$coredump_dir \ -v $WORKDIR/taos-connector-python/taos:/usr/local/lib/python3.8/site-packages/taos:ro \ diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py new file mode 100644 index 0000000000..8636274ca3 --- /dev/null +++ b/tests/system-test/0-others/compatibility.py @@ -0,0 +1,138 @@ +from urllib.parse import uses_relative +import taos +import sys +import os +import time + + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * + + +class TDTestCase: + def caseDescription(self): + ''' + 3.0 data compatibility test + case1: basedata version is 3.0.1.0 + ''' + return + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files or "taosd.exe" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def getCfgPath(self): + buildPath = self.getBuildPath() + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + cfgPath = buildPath + "/../community/sim/dnode1/cfg/" + else: + cfgPath = buildPath + "/../sim/dnode1/cfg/" + + return cfgPath + + def installTaosd(self,bPath,cPath): + # os.system(f"rmtaos && mkdir -p {self.getBuildPath()}/build/lib/temp && mv {self.getBuildPath()}/build/lib/libtaos.so* {self.getBuildPath()}/build/lib/temp/ ") + # os.system(f" mv {bPath}/build {bPath}/build_bak ") + # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so {self.getBuildPath()}/build/lib/libtaos.so_bak ") + # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so.1 {self.getBuildPath()}/build/lib/libtaos.so.1_bak ") + + packagePath="/usr/local/src/" + packageName="TDengine-server-3.0.1.0-Linux-x64.tar.gz" + os.system(f"cd {packagePath} && tar xvf TDengine-server-3.0.1.0-Linux-x64.tar.gz && cd TDengine-server-3.0.1.0 && ./install.sh -e no " ) + tdDnodes.stop(1) + print(f"start taosd: nohup taosd -c {cPath} & ") + os.system(f" nohup taosd -c {cPath} & " ) + sleep(1) + + + + def buildTaosd(self,bPath): + # os.system(f"mv {bPath}/build_bak {bPath}/build ") + os.system(f" cd {bPath} && make install ") + + + def run(self): + print(f"buildpath:{self.getBuildPath()}") + bPath=self.getBuildPath() + cPath=self.getCfgPath() + dbname = "test" + stb = f"{dbname}.meters" + self.installTaosd(bPath,cPath) + tableNumbers=100 + recordNumbers1=100 + recordNumbers2=1000 + # print(tdSql) + tdsqlF=tdCom.newTdSql() + print(tdsqlF) + tdsqlF.query(f"SELECT SERVER_VERSION();") + print(tdsqlF.query(f"SELECT SERVER_VERSION();")) + oldServerVersion=tdsqlF.queryResult[0][0] + tdLog.info(f"Base server version is {oldServerVersion}") + tdsqlF.query(f"SELECT CLIENT_VERSION();") + # the oldClientVersion can't be updated in the same python process,so the version is new compiled verison + oldClientVersion=tdsqlF.queryResult[0][0] + tdLog.info(f"Base client version is {oldClientVersion}") + + tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{oldServerVersion}") + tdLog.info(f"taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") + os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") + sleep(3) + + # tdsqlF.query(f"select count(*) from {stb}") + # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) + os.system("pkill taosd") + sleep(1) + + tdLog.printNoPrefix("==========step2:update new version ") + self.buildTaosd(bPath) + tdDnodes.start(1) + sleep(1) + tdsql_new=tdCom.newTdSql() + print(tdsql_new) + + + tdsql_new.query(f"SELECT SERVER_VERSION();") + nowServerVersion=tdsql_new.queryResult[0][0] + tdLog.info(f"New server version is {nowServerVersion}") + tdsql_new.query(f"SELECT CLIENT_VERSION();") + nowClientVersion=tdsql_new.queryResult[0][0] + tdLog.info(f"New client version is {nowClientVersion}") + + tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") + tdsql_new.query(f"select count(*) from {stb}") + tdsql_new.checkData(0,0,tableNumbers*recordNumbers1) + os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") + tdsql_new.query(f"select count(*) from {stb}") + tdsql_new.checkData(0,0,tableNumbers*recordNumbers2) + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From 5c7997be4b17a21cb30f887a7c6f33bd88cf31f6 Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 18:17:23 +0800 Subject: [PATCH 12/69] test:verify backticks with atuo creating tables --- tests/system-test/0-others/compatibility.py | 30 ++++++++++++--------- tests/system-test/fulltest.sh | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 8636274ca3..4dae6f06cf 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -76,7 +76,6 @@ class TDTestCase: def run(self): - print(f"buildpath:{self.getBuildPath()}") bPath=self.getBuildPath() cPath=self.getCfgPath() dbname = "test" @@ -85,7 +84,6 @@ class TDTestCase: tableNumbers=100 recordNumbers1=100 recordNumbers2=1000 - # print(tdSql) tdsqlF=tdCom.newTdSql() print(tdsqlF) tdsqlF.query(f"SELECT SERVER_VERSION();") @@ -111,24 +109,32 @@ class TDTestCase: self.buildTaosd(bPath) tdDnodes.start(1) sleep(1) - tdsql_new=tdCom.newTdSql() - print(tdsql_new) + tdsql=tdCom.newTdSql() + print(tdsql) - tdsql_new.query(f"SELECT SERVER_VERSION();") - nowServerVersion=tdsql_new.queryResult[0][0] + tdsql.query(f"SELECT SERVER_VERSION();") + nowServerVersion=tdsql.queryResult[0][0] tdLog.info(f"New server version is {nowServerVersion}") - tdsql_new.query(f"SELECT CLIENT_VERSION();") - nowClientVersion=tdsql_new.queryResult[0][0] + tdsql.query(f"SELECT CLIENT_VERSION();") + nowClientVersion=tdsql.queryResult[0][0] tdLog.info(f"New client version is {nowClientVersion}") tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") - tdsql_new.query(f"select count(*) from {stb}") - tdsql_new.checkData(0,0,tableNumbers*recordNumbers1) + tdsql.query(f"select count(*) from {stb}") + tdsql.checkData(0,0,tableNumbers*recordNumbers1) os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") - tdsql_new.query(f"select count(*) from {stb}") - tdsql_new.checkData(0,0,tableNumbers*recordNumbers2) + tdsql.query(f"select count(*) from {stb}") + tdsql.checkData(0,0,tableNumbers*recordNumbers2) + tdsql=tdCom.newTdSql() + tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") + tdsql.execute("create database db") + tdsql.execute("use db") + tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);") + tdsql.execute("insert into db.ct1 using db.stb1 TAGS(9) values(now(),11);") + tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);") + tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);") def stop(self): tdSql.close() diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index f4a5c22d39..2f5cf5536e 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -17,6 +17,7 @@ python3 ./test.py -f 0-others/udf_cfg2.py python3 ./test.py -f 0-others/sysinfo.py python3 ./test.py -f 0-others/user_control.py python3 ./test.py -f 0-others/fsync.py +python3 ./test.py -f 0-others/compatibility.py python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py From 46b0c2c9c4f597adf0ea811f450e3c8826fcde5b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 20 Sep 2022 18:52:45 +0800 Subject: [PATCH 13/69] enh: added memory allocators for parser and planner --- include/common/tglobal.h | 2 ++ source/client/inc/clientInt.h | 1 + source/client/src/clientEnv.c | 1 + source/client/src/clientImpl.c | 11 +++++++ source/client/src/clientMain.c | 7 ++++ source/common/src/tglobal.c | 44 ++++++++++++++++---------- source/libs/nodes/src/nodesUtilFuncs.c | 18 ++++++++--- 7 files changed, 63 insertions(+), 21 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 2de4ffdc17..234937ea7e 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -95,6 +95,8 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in extern int32_t tsQueryPolicy; extern int32_t tsQuerySmaOptimize; extern bool tsQueryPlannerTrace; +extern int32_t tsQueryNodeChunkSize; +extern bool tsQueryUseNodeAllocator; // client extern int32_t tsMinSlidingTime; diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index b8fa9580e7..f042c3ad7c 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -250,6 +250,7 @@ typedef struct SRequestObj { bool inRetry; uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog uint32_t retry; + SNodeAllocator* pNodeAllocator; } SRequestObj; typedef struct SSyncQueryParam { diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index b739aedca0..8fded03472 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -349,6 +349,7 @@ void doDestroyRequest(void *p) { taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->dbList); taosArrayDestroy(pRequest->targetTableList); + nodesDestroyNodeAllocator(pRequest->pNodeAllocator); destroyQueryExecRes(&pRequest->body.resInfo.execRes); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 0e1d82b273..bc1cdc247e 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -194,6 +194,17 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, return TSDB_CODE_TSC_OUT_OF_MEMORY; } + if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) { + if (TSDB_CODE_SUCCESS != nodesCreateNodeAllocator(tsQueryNodeChunkSize, &((*pRequest)->pNodeAllocator))) { + tscError("%d failed to create node allocator, reqId:0x%" PRIx64 ", conn:%d, %s", (*pRequest)->self, + (*pRequest)->requestId, pTscObj->id, sql); + + destroyRequest(*pRequest); + *pRequest = NULL; + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + } + tscDebugL("0x%" PRIx64 " SQL: %s, reqId:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); return TSDB_CODE_SUCCESS; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 73636e7372..e19d88fcf3 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -700,6 +700,8 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { pRequest->metric.ctgEnd = taosGetTimestampUs(); + nodesResetThreadLevelAllocator(pRequest->pNodeAllocator); + if (code == TSDB_CODE_SUCCESS) { code = qAnalyseSqlSemantic(pWrapper->pCtx, &pWrapper->catalogReq, pResultMeta, pQuery); pRequest->stableQuery = pQuery->stableQuery; @@ -726,9 +728,11 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { pRequest->requestId); launchAsyncQuery(pRequest, pQuery, pResultMeta); qDestroyQuery(pQuery); + nodesResetThreadLevelAllocator(NULL); } else { destorySqlParseWrapper(pWrapper); qDestroyQuery(pQuery); + nodesResetThreadLevelAllocator(NULL); if (NEED_CLIENT_HANDLE_ERROR(code)) { tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); @@ -801,6 +805,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } SQuery *pQuery = NULL; + nodesResetThreadLevelAllocator(pRequest->pNodeAllocator); pRequest->metric.syntaxStart = taosGetTimestampUs(); @@ -844,6 +849,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { &pRequest->body.queryJob); pCxt = NULL; if (code == TSDB_CODE_SUCCESS) { + nodesResetThreadLevelAllocator(NULL); return; } @@ -851,6 +857,7 @@ _error: tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); taosMemoryFree(pCxt); + nodesResetThreadLevelAllocator(NULL); terrno = code; pRequest->code = code; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index ddda8f8c9a..e119dae743 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -92,6 +92,8 @@ bool tsSmlDataFormat = int32_t tsQueryPolicy = 1; int32_t tsQuerySmaOptimize = 0; bool tsQueryPlannerTrace = false; +int32_t tsQueryNodeChunkSize = 32 * 1024; +bool tsQueryUseNodeAllocator = true; /* * denote if the server needs to compress response message at the application layer to client, including query rsp, @@ -284,6 +286,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 1) != 0) return -1; if (cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, 1) != 0) return -1; if (cfgAddBool(pCfg, "queryPlannerTrace", tsQueryPlannerTrace, true) != 0) return -1; + if (cfgAddInt32(pCfg, "queryNodeChunkSize", tsQueryNodeChunkSize, 1024, 128 * 1024, true) != 0) return -1; + if (cfgAddBool(pCfg, "queryUseNodeAllocator", tsQueryUseNodeAllocator, true) != 0) return -1; if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1; if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1; if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1; @@ -385,9 +389,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { tsNumOfQnodeQueryThreads = TMAX(tsNumOfQnodeQueryThreads, 4); if (cfgAddInt32(pCfg, "numOfQnodeQueryThreads", tsNumOfQnodeQueryThreads, 1, 1024, 0) != 0) return -1; -// tsNumOfQnodeFetchThreads = tsNumOfCores / 2; -// tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4); -// if (cfgAddInt32(pCfg, "numOfQnodeFetchThreads", tsNumOfQnodeFetchThreads, 1, 1024, 0) != 0) return -1; + // tsNumOfQnodeFetchThreads = tsNumOfCores / 2; + // tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4); + // if (cfgAddInt32(pCfg, "numOfQnodeFetchThreads", tsNumOfQnodeFetchThreads, 1, 1024, 0) != 0) return -1; tsNumOfSnodeSharedThreads = tsNumOfCores / 4; tsNumOfSnodeSharedThreads = TRANGE(tsNumOfSnodeSharedThreads, 2, 4); @@ -527,15 +531,15 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem->stype = stype; } -/* - pItem = cfgGetItem(tsCfg, "numOfQnodeFetchThreads"); - if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsNumOfQnodeFetchThreads = numOfCores / 2; - tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4); - pItem->i32 = tsNumOfQnodeFetchThreads; - pItem->stype = stype; - } -*/ + /* + pItem = cfgGetItem(tsCfg, "numOfQnodeFetchThreads"); + if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { + tsNumOfQnodeFetchThreads = numOfCores / 2; + tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4); + pItem->i32 = tsNumOfQnodeFetchThreads; + pItem->stype = stype; + } + */ pItem = cfgGetItem(tsCfg, "numOfSnodeSharedThreads"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { @@ -643,6 +647,8 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsQueryPolicy = cfgGetItem(pCfg, "queryPolicy")->i32; tsQuerySmaOptimize = cfgGetItem(pCfg, "querySmaOptimize")->i32; tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval; + tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32; + tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval; return 0; } @@ -693,7 +699,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsNumOfVnodeSyncThreads = cfgGetItem(pCfg, "numOfVnodeSyncThreads")->i32; tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32; tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32; -// tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32; + // tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32; tsNumOfSnodeSharedThreads = cfgGetItem(pCfg, "numOfSnodeSharedThreads")->i32; tsNumOfSnodeUniqueThreads = cfgGetItem(pCfg, "numOfSnodeUniqueThreads")->i32; tsRpcQueueMemoryAllowed = cfgGetItem(pCfg, "rpcQueueMemoryAllowed")->i64; @@ -941,10 +947,10 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32; } else if (strcasecmp("numOfQnodeQueryThreads", name) == 0) { tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32; -/* - } else if (strcasecmp("numOfQnodeFetchThreads", name) == 0) { - tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32; -*/ + /* + } else if (strcasecmp("numOfQnodeFetchThreads", name) == 0) { + tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32; + */ } else if (strcasecmp("numOfSnodeSharedThreads", name) == 0) { tsNumOfSnodeSharedThreads = cfgGetItem(pCfg, "numOfSnodeSharedThreads")->i32; } else if (strcasecmp("numOfSnodeUniqueThreads", name) == 0) { @@ -976,6 +982,10 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32; } else if (strcasecmp("queryPlannerTrace", name) == 0) { tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval; + } else if (strcasecmp("queryNodeChunkSize", name) == 0) { + tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32; + } else if (strcasecmp("queryUseNodeAllocator", name) == 0) { + tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval; } break; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index be94495856..8b9b723a2a 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -58,9 +58,9 @@ static SNodeMemChunk* callocNodeChunk(SNodeAllocator* pAllocator) { return pNewChunk; } -static void* nodesCalloc(int32_t num, int32_t size) { +static void* nodesCallocImpl(int32_t size) { if (NULL == pNodeAllocator) { - return taosMemoryCalloc(num, size); + return taosMemoryCalloc(1, size); } if (pNodeAllocator->pCurrChunk->usedSize + size > pNodeAllocator->pCurrChunk->availableSize) { @@ -73,9 +73,19 @@ static void* nodesCalloc(int32_t num, int32_t size) { return p; } +static void* nodesCalloc(int32_t num, int32_t size) { + void* p = nodesCallocImpl(num * size + 1); + if (NULL == p) { + return NULL; + } + *(char*)p = (NULL != pNodeAllocator) ? 1 : 0; + return (char*)p + 1; +} + static void nodesFree(void* p) { - if (NULL == pNodeAllocator) { - taosMemoryFree(p); + char* ptr = (char*)p - 1; + if (0 == *ptr) { + taosMemoryFree(ptr); } return; } From 9c84d59297a5e5835bdf0ee3e5b90b2e3578dfe5 Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 19:52:10 +0800 Subject: [PATCH 14/69] test:add testcase of data Compatibility --- tests/parallel_test/run_container.sh | 2 +- tests/system-test/0-others/compatibility.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh index 3a7193b39c..bb57f238f0 100755 --- a/tests/parallel_test/run_container.sh +++ b/tests/parallel_test/run_container.sh @@ -93,7 +93,7 @@ if [ ! -d "${TMP_DIR}/thread_volume/$thread_no/$exec_dir" ]; then cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/ fi -if [ ! -d "${SOURCEDIR}/${packageName}" ]; then +if [ ! -f "${SOURCEDIR}/${packageName}" ]; then wget -P ${SOURCEDIR} https://taosdata.com/assets-download/3.0/${packageName} fi diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 4dae6f06cf..2b059615e9 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -129,12 +129,22 @@ class TDTestCase: tdsql=tdCom.newTdSql() tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") + tdsql.execute("drop database if exists db") tdsql.execute("create database db") tdsql.execute("use db") tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);") - tdsql.execute("insert into db.ct1 using db.stb1 TAGS(9) values(now(),11);") + tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);") tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);") tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);") + tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);") + tdsql.query("select * from db.ct3") + tdsql.checkData(0,1,13) + tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);") + tdsql.query("select * from db.ct4") + tdsql.checkData(0,1,14) + tdsql.query("describe information_schema.ins_databases;") + # for i in tdsql.queryResult[i][0]: + # tdsql.checkData(0,1,13) def stop(self): tdSql.close() From 96eec9f47a9b89eb14949a51602ffc1b151bd819 Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 22:24:33 +0800 Subject: [PATCH 15/69] test:update jenkins of ci --- Jenkinsfile2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 6a4a2156e5..b95b3ff86b 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -218,12 +218,12 @@ def pre_test_win(){ if (env.CHANGE_URL =~ /\/TDengine\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull ''' + env.CHANGE_TARGET + ''' + git pull origin ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% git remote prune origin - git pull ''' + env.CHANGE_TARGET + ''' + git pull origin ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% @@ -236,7 +236,7 @@ def pre_test_win(){ } else if (env.CHANGE_URL =~ /\/TDinternal\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull ''' + env.CHANGE_TARGET + ''' + git pull origin ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_INTERNAL_ROOT% From be122addf4dddc76e73aaac73736667dcd70418e Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Wed, 21 Sep 2022 10:10:05 +0800 Subject: [PATCH 16/69] docs: remove case sensitive description of quotes Remove case sensitive description of quotes and other minor content. --- docs/en/12-taos-sql/01-data-type.md | 76 +++++++++++++-------------- docs/zh/12-taos-sql/01-data-type.md | 81 +++++++++++++++-------------- 2 files changed, 79 insertions(+), 78 deletions(-) diff --git a/docs/en/12-taos-sql/01-data-type.md b/docs/en/12-taos-sql/01-data-type.md index 876de50f35..60046629a4 100644 --- a/docs/en/12-taos-sql/01-data-type.md +++ b/docs/en/12-taos-sql/01-data-type.md @@ -1,70 +1,70 @@ --- sidebar_label: Data Types title: Data Types -description: "TDengine supports a variety of data types including timestamp, float, JSON and many others." +description: 'TDengine supports a variety of data types including timestamp, float, JSON and many others.' --- ## Timestamp When using TDengine to store and query data, the most important part of the data is timestamp. Timestamp must be specified when creating and inserting data rows. Timestamp must follow the rules below: -- The format must be `YYYY-MM-DD HH:mm:ss.MS`, the default time precision is millisecond (ms), for example `2017-08-12 18:25:58.128` -- Internal function `now` can be used to get the current timestamp on the client side -- The current timestamp of the client side is applied when `now` is used to insert data +- The format must be `YYYY-MM-DD HH:mm:ss.MS`, the default time precision is millisecond (ms), for example `2017-08-12 18:25:58.128`. +- Internal function `NOW` can be used to get the current timestamp on the client side. +- The current timestamp of the client side is applied when `NOW` is used to insert data. - Epoch Time:timestamp can also be a long integer number, which means the number of seconds, milliseconds or nanoseconds, depending on the time precision, from UTC 1970-01-01 00:00:00. -- Add/subtract operations can be carried out on timestamps. For example `now-2h` means 2 hours prior to the time at which query is executed. The units of time in operations can be b(nanosecond), u(microsecond), a(millisecond), s(second), m(minute), h(hour), d(day), or w(week). So `select * from t1 where ts > now-2w and ts <= now-1w` means the data between two weeks ago and one week ago. The time unit can also be n (calendar month) or y (calendar year) when specifying the time window for down sampling operations. +- Add/subtract operations can be carried out on timestamps. For example `NOW-2h` means 2 hours prior to the time at which query is executed. The units of time in operations can be b(nanosecond), u(microsecond), a(millisecond), s(second), m(minute), h(hour), d(day), or w(week). So `SELECT * FROM t1 WHERE ts > NOW-2w AND ts <= NOW-1w` means the data between two weeks ago and one week ago. The time unit can also be n (calendar month) or y (calendar year) when specifying the time window for down sampling operations. Time precision in TDengine can be set by the `PRECISION` parameter when executing `CREATE DATABASE`. The default time precision is millisecond. In the statement below, the precision is set to nanonseconds. ```sql CREATE DATABASE db_name PRECISION 'ns'; ``` + ## Data Types In TDengine, the data types below can be used when specifying a column or tag. -| # | **type** | **Bytes** | **Description** | -| --- | :-------: | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 1 | TIMESTAMP | 8 | Default precision is millisecond, microsecond and nanosecond are also supported | -| 2 | INT | 4 | Integer, the value range is [-2^31, 2^31-1] | -| 3 | INT UNSIGNED| 4| unsigned integer, the value range is [0, 2^32-1] -| 4 | BIGINT | 8 | Long integer, the value range is [-2^63, 2^63-1] | -| 5 | BIGINT UNSIGNED | 8 | unsigned long integer, the value range is [0, 2^64-1] | -| 6 | FLOAT | 4 | Floating point number, the effective number of digits is 6-7, the value range is [-3.4E38, 3.4E38] | -| 7 | DOUBLE | 8 | Double precision floating point number, the effective number of digits is 15-16, the value range is [-1.7E308, 1.7E308] | -| 8 | BINARY | User Defined | Single-byte string for ASCII visible characters. Length must be specified when defining a column or tag of binary type. | -| 9 | SMALLINT | 2 | Short integer, the value range is [-32768, 32767] | -| 10 | INT UNSIGNED| 2| unsigned integer, the value range is [0, 65535]| -| 11 | TINYINT | 1 | Single-byte integer, the value range is [-128, 127] | -| 12 | TINYINT UNSIGNED | 1 | unsigned single-byte integer, the value range is [0, 255] | -| 13 | BOOL | 1 | Bool, the value range is {true, false} | -| 14 | NCHAR | User Defined| Multi-Byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\’`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. | -| 15 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type | -| 16 | VARCHAR | User-defined | Alias of BINARY | - +| # | **type** | **Bytes** | **Description** | +| --- | :--------------: | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | TIMESTAMP | 8 | Default precision is millisecond, microsecond and nanosecond are also supported. | +| 2 | INT | 4 | Integer, the value range is [-2^31, 2^31-1]. | +| 3 | INT UNSIGNED | 4 | Unsigned integer, the value range is [0, 2^32-1]. | +| 4 | BIGINT | 8 | Long integer, the value range is [-2^63, 2^63-1]. | +| 5 | BIGINT UNSIGNED | 8 | unsigned long integer, the value range is [0, 2^64-1]. | +| 6 | FLOAT | 4 | Floating point number, the effective number of digits is 6-7, the value range is [-3.4E38, 3.4E38]. | +| 7 | DOUBLE | 8 | Double precision floating point number, the effective number of digits is 15-16, the value range is [-1.7E308, 1.7E308]. | +| 8 | BINARY | User Defined | Single-byte string for ASCII visible characters. Length must be specified when defining a column or tag of binary type. | +| 9 | SMALLINT | 2 | Short integer, the value range is [-32768, 32767]. | +| 10 | INT UNSIGNED | 2 | unsigned integer, the value range is [0, 65535]. | +| 11 | TINYINT | 1 | Single-byte integer, the value range is [-128, 127]. | +| 12 | TINYINT UNSIGNED | 1 | unsigned single-byte integer, the value range is [0, 255]. | +| 13 | BOOL | 1 | Bool, the value range is {true, false}. | +| 14 | NCHAR | User Defined | Multi-byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\'`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. | +| 15 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type. | +| 16 | VARCHAR | User-defined | Alias of BINARY | :::note -- TDengine is case insensitive and treats any characters in the sql command as lower case by default, case sensitive strings must be quoted with single quotes. -- Only ASCII visible characters are suggested to be used in a column or tag of BINARY type. Multi-byte characters must be stored in NCHAR type. -- The length of BINARY can be up to 16374 bytes. The string value must be quoted with single quotes. You must specify a length in bytes for a BINARY value, for example binary(20) for up to twenty single-byte characters. If the data exceeds the specified length, an error will occur. The literal single quote inside the string must be preceded with back slash like `\'` + +- Only ASCII visible characters are suggested to be used in a column or tag of BINARY type. Multi-byte characters must be stored in NCHAR type. +- The length of BINARY can be up to 16,374 bytes. The string value must be quoted with single quotes. You must specify a length in bytes for a BINARY value, for example binary(20) for up to twenty single-byte characters. If the data exceeds the specified length, an error will occur. The literal single quote inside the string must be preceded with back slash like `\'` - Numeric values in SQL statements will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used, so attention must be paid to avoid overflow. For example, 9999999999999999999 will be considered as overflow because it exceeds the upper limit of long integer, but 9999999999999999999.0 will be considered as a legal float number. ::: - ## Constants + TDengine supports a variety of constants: -| # | **Syntax** | **Type** | **Description** | -| --- | :-------: | --------- | -------------------------------------- | -| 1 | [{+ \| -}]123 | BIGINT | Integer literals are of type BIGINT. Data that exceeds the length of the BIGINT type is truncated. | -| 2 | 123.45 | DOUBLE | Floating-point literals are of type DOUBLE. Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used. | -| 3 | 1.2E3 | DOUBLE | Literals in scientific notation are of type DOUBLE. | -| 4 | 'abc' | BINARY | Content enclosed in single quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal single quote inside the string must be escaped with a backslash (\'). | -| 5 | 'abc' | BINARY | Content enclosed in double quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal double quote inside the string must be escaped with a backslash (\"). | -| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | The TIMESTAMP keyword indicates that the following string literal is interpreted as a timestamp. The string must be in YYYY-MM-DD HH:mm:ss.MS format. The precision is inherited from the database configuration. | -| 7 | {TRUE \| FALSE} | BOOL | Boolean literals are of type BOOL. | -| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | The preceding characters indicate null literals. These can be used with any data type. | +| # | **Syntax** | **Type** | **Description** | +| --- | :-----------------------------------------------: | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | [{+ \| -}]123 | BIGINT | Integer literals are of type BIGINT. Data that exceeds the length of the BIGINT type is truncated. | +| 2 | 123.45 | DOUBLE | Floating-point literals are of type DOUBLE. Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used. | +| 3 | 1.2E3 | DOUBLE | Literals in scientific notation are of type DOUBLE. | +| 4 | 'abc' | BINARY | Content enclosed in single quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal single quote inside the string must be escaped with a backslash `\'`. | +| 5 | 'abc' | BINARY | Content enclosed in double quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal double quote inside the string must be escaped with a backslash `\"`. | +| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | The TIMESTAMP keyword indicates that the following string literal is interpreted as a timestamp. The string must be in YYYY-MM-DD HH:mm:ss.MS format. The precision is inherited from the database configuration. | +| 7 | {TRUE \| FALSE} | BOOL | Boolean literals are of type BOOL. | +| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | The preceding characters indicate null literals. These can be used with any data type. | :::note Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used, so attention must be paid to avoid overflow. For example, 9999999999999999999 will be considered as overflow because it exceeds the upper limit of long integer, but 9999999999999999999.0 will be considered as a legal float number. diff --git a/docs/zh/12-taos-sql/01-data-type.md b/docs/zh/12-taos-sql/01-data-type.md index ee7b3a4715..128fa20930 100644 --- a/docs/zh/12-taos-sql/01-data-type.md +++ b/docs/zh/12-taos-sql/01-data-type.md @@ -1,7 +1,7 @@ --- sidebar_label: 数据类型 title: 数据类型 -description: "TDengine 支持的数据类型: 时间戳、浮点型、JSON 类型等" +description: 'TDengine 支持的数据类型: 时间戳、浮点型、JSON 类型等' --- ## 时间戳 @@ -9,64 +9,65 @@ description: "TDengine 支持的数据类型: 时间戳、浮点型、JSON 类 使用 TDengine,最重要的是时间戳。创建并插入记录、查询历史记录的时候,均需要指定时间戳。时间戳有如下规则: - 时间格式为 `YYYY-MM-DD HH:mm:ss.MS`,默认时间分辨率为毫秒。比如:`2017-08-12 18:25:58.128` -- 内部函数 now 是客户端的当前时间 -- 插入记录时,如果时间戳为 now,插入数据时使用提交这条记录的客户端的当前时间 -- Epoch Time:时间戳也可以是一个长整数,表示从 UTC 时间 1970-01-01 00:00:00 开始的毫秒数。相应地,如果所在 Database 的时间精度设置为“微秒”,则长整型格式的时间戳含义也就对应于从 UTC 时间 1970-01-01 00:00:00 开始的微秒数;纳秒精度逻辑类似。 -- 时间可以加减,比如 now-2h,表明查询时刻向前推 2 个小时(最近 2 小时)。数字后面的时间单位可以是 b(纳秒)、u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 比如 `select * from t1 where ts > now-2w and ts <= now-1w`,表示查询两周前整整一周的数据。在指定降采样操作(down sampling)的时间窗口(interval)时,时间单位还可以使用 n (自然月) 和 y (自然年)。 +- 内部函数 NOW 是客户端的当前时间 +- 插入记录时,如果时间戳为 NOW,插入数据时使用提交这条记录的客户端的当前时间 +- Epoch Time:时间戳也可以是一个长整数,表示从 UTC 时间 1970-01-01 00:00:00 开始的毫秒数。相应地,如果所在 Database 的时间精度设置为“微秒”,则长整型格式的时间戳含义也就对应于从 UTC 时间 1970-01-01 00:00:00 开始的微秒数;纳秒精度逻辑相同。 +- 时间可以加减,比如 NOW-2h,表明查询时刻向前推 2 个小时(最近 2 小时)。数字后面的时间单位可以是 b(纳秒)、u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 比如 `SELECT * FROM t1 WHERE ts > NOW-2w AND ts <= NOW-1w`,表示查询两周前整整一周的数据。在指定降采样操作(Down Sampling)的时间窗口(Interval)时,时间单位还可以使用 n(自然月)和 y(自然年)。 -TDengine 缺省的时间戳精度是毫秒,但通过在 `CREATE DATABASE` 时传递的 PRECISION 参数也可以支持微秒和纳秒。 +TDengine 缺省的时间戳精度是毫秒,但通过在 `CREATE DATABASE` 时传递的 `PRECISION` 参数也可以支持微秒和纳秒。 ```sql CREATE DATABASE db_name PRECISION 'ns'; ``` + ## 数据类型 在 TDengine 中,普通表的数据模型中可使用以下数据类型。 -| # | **类型** | **Bytes** | **说明** | -| --- | :-------: | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 1 | TIMESTAMP | 8 | 时间戳。缺省精度毫秒,可支持微秒和纳秒,详细说明见上节。 | -| 2 | INT | 4 | 整型,范围 [-2^31, 2^31-1] | -| 3 | INT UNSIGNED| 4| 无符号整数,[0, 2^32-1] -| 4 | BIGINT | 8 | 长整型,范围 [-2^63, 2^63-1] | -| 5 | BIGINT UNSIGNED | 8 | 长整型,范围 [0, 2^64-1] | -| 6 | FLOAT | 4 | 浮点型,有效位数 6-7,范围 [-3.4E38, 3.4E38] | -| 7 | DOUBLE | 8 | 双精度浮点型,有效位数 15-16,范围 [-1.7E308, 1.7E308] | -| 8 | BINARY | 自定义 | 记录单字节字符串,建议只用于处理 ASCII 可见字符,中文等多字节字符需使用 nchar。 | -| 9 | SMALLINT | 2 | 短整型, 范围 [-32768, 32767] | -| 10 | SMALLINT UNSIGNED | 2| 无符号短整型,范围 [0, 65535] | -| 11 | TINYINT | 1 | 单字节整型,范围 [-128, 127] | -| 12 | TINYINT UNSIGNED | 1 | 无符号单字节整型,范围 [0, 255] | -| 13 | BOOL | 1 | 布尔型,{true, false} | -| 14 | NCHAR | 自定义 | 记录包含多字节字符在内的字符串,如中文字符。每个 nchar 字符占用 4 bytes 的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\’`。nchar 使用时须指定字符串大小,类型为 nchar(10) 的列表示此列的字符串最多存储 10 个 nchar 字符,会固定占用 40 bytes 的空间。如果用户字符串长度超出声明长度,将会报错。 | -| 15 | JSON | | json 数据类型, 只有 tag 可以是 json 格式 | -| 16 | VARCHAR | 自定义 | BINARY类型的别名 | - +| # | **类型** | **Bytes** | **说明** | +| --- | :---------------: | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | TIMESTAMP | 8 | 时间戳。缺省精度毫秒,可支持微秒和纳秒,详细说明见上节。 | +| 2 | INT | 4 | 整型,范围 [-2^31, 2^31-1] | +| 3 | INT UNSIGNED | 4 | 无符号整数,[0, 2^32-1] | +| 4 | BIGINT | 8 | 长整型,范围 [-2^63, 2^63-1] | +| 5 | BIGINT UNSIGNED | 8 | 长整型,范围 [0, 2^64-1] | +| 6 | FLOAT | 4 | 浮点型,有效位数 6-7,范围 [-3.4E38, 3.4E38] | +| 7 | DOUBLE | 8 | 双精度浮点型,有效位数 15-16,范围 [-1.7E308, 1.7E308] | +| 8 | BINARY | 自定义 | 记录单字节字符串,建议只用于处理 ASCII 可见字符,中文等多字节字符需使用 NCHAR | +| 9 | SMALLINT | 2 | 短整型, 范围 [-32768, 32767] | +| 10 | SMALLINT UNSIGNED | 2 | 无符号短整型,范围 [0, 65535] | +| 11 | TINYINT | 1 | 单字节整型,范围 [-128, 127] | +| 12 | TINYINT UNSIGNED | 1 | 无符号单字节整型,范围 [0, 255] | +| 13 | BOOL | 1 | 布尔型,{true, false} | +| 14 | NCHAR | 自定义 | 记录包含多字节字符在内的字符串,如中文字符。每个 NCHAR 字符占用 4 字节的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\'`。NCHAR 使用时须指定字符串大小,类型为 NCHAR(10) 的列表示此列的字符串最多存储 10 个 NCHAR 字符,会固定占用 40 字节的空间。如果用户字符串长度超出声明长度,将会报错。 | +| 15 | JSON | | JSON 数据类型, 只有 Tag 可以是 JSON 格式 | +| 16 | VARCHAR | 自定义 | BINARY 类型的别名 | :::note -- TDengine 对 SQL 语句中的英文字符不区分大小写,自动转化为小写执行。因此用户大小写敏感的字符串及密码,需要使用单引号将字符串引起来。 + - 虽然 BINARY 类型在底层存储上支持字节型的二进制字符,但不同编程语言对二进制数据的处理方式并不保证一致,因此建议在 BINARY 类型中只存储 ASCII 可见字符,而避免存储不可见字符。多字节的数据,例如中文字符,则需要使用 NCHAR 类型进行保存。如果强行使用 BINARY 类型保存中文字符,虽然有时也能正常读写,但并不带有字符集信息,很容易出现数据乱码甚至数据损坏等情况。 -- BINARY 类型理论上最长可以有 16374 字节。binary 仅支持字符串输入,字符串两端需使用单引号引用。使用时须指定大小,如 binary(20) 定义了最长为 20 个单字节字符的字符串,每个字符占 1 byte 的存储空间,总共固定占用 20 bytes 的空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\’`。 +- BINARY 类型理论上最长可以有 16,374 字节。BINARY 仅支持字符串输入,字符串两端需使用单引号引用。使用时须指定大小,如 BINARY(20) 定义了最长为 20 个单字节字符的字符串,每个字符占 1 字节的存储空间,总共固定占用 20 字节的空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\'`。 - SQL 语句中的数值类型将依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999 会认为超过长整型的上边界而溢出,而 9999999999999999999.0 会被认为是有效的浮点数。 ::: - ## 常量 -TDengine支持多个类型的常量,细节如下表: -| # | **语法** | **类型** | **说明** | -| --- | :-------: | --------- | -------------------------------------- | -| 1 | [{+ \| -}]123 | BIGINT | 整型数值的字面量的类型均为BIGINT。如果用户输入超过了BIGINT的表示范围,TDengine 按BIGINT对数值进行截断。| -| 2 | 123.45 | DOUBLE | 浮点数值的字面量的类型均为DOUBLE。TDengine依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型。| -| 3 | 1.2E3 | DOUBLE | 科学计数法的字面量的类型为DOUBLE。| -| 4 | 'abc' | BINARY | 单引号括住的内容为字符串字面值,其类型为BINARY,BINARY的size为实际的字符个数。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 \'。| -| 5 | "abc" | BINARY | 双引号括住的内容为字符串字面值,其类型为BINARY,BINARY的size为实际的字符个数。对于字符串内的双引号,可以用转义字符反斜线加单引号来表示,即 \"。 | -| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | TIMESTAMP关键字表示后面的字符串字面量需要被解释为TIMESTAMP类型。字符串需要满足YYYY-MM-DD HH:mm:ss.MS格式,其时间分辨率为当前数据库的时间分辨率。 | -| 7 | {TRUE \| FALSE} | BOOL | 布尔类型字面量。 | -| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | 空值字面量。可以用于任意类型。| +TDengine 支持多个类型的常量,细节如下表: + +| # | **语法** | **类型** | **说明** | +| --- | :-----------------------------------------------: | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | [{+ \| -}]123 | BIGINT | 整型数值的字面量的类型均为 BIGINT。如果用户输入超过了 BIGINT 的表示范围,TDengine 按 BIGINT 对数值进行截断。 | +| 2 | 123.45 | DOUBLE | 浮点数值的字面量的类型均为 DOUBLE。TDengine 依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型。 | +| 3 | 1.2E3 | DOUBLE | 科学计数法的字面量的类型为 DOUBLE。 | +| 4 | 'abc' | BINARY | 单引号括住的内容为字符串字面值,其类型为 BINARY,BINARY 的 Size 为实际的字符个数。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\'`。 | +| 5 | "abc" | BINARY | 双引号括住的内容为字符串字面值,其类型为 BINARY,BINARY 的 Size 为实际的字符个数。对于字符串内的双引号,可以用转义字符反斜线加单引号来表示,即 `\"`。 | +| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | TIMESTAMP 关键字表示后面的字符串字面量需要被解释为 TIMESTAMP 类型。字符串需要满足 YYYY-MM-DD HH:mm:ss.MS 格式,其时间分辨率为当前数据库的时间分辨率。 | +| 7 | {TRUE \| FALSE} | BOOL | 布尔类型字面量。 | +| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | 空值字面量。可以用于任意类型。 | :::note -- TDengine依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999会认为超过长整型的上边界而溢出,而9999999999999999999.0会被认为是有效的浮点数。 + +- TDengine 依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999 会认为超过长整型的上边界而溢出,而 9999999999999999999.0 会被认为是有效的浮点数。 ::: From 33c075542d786756c0b7efd54d8f2bd955dcd9e5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 21 Sep 2022 10:26:55 +0800 Subject: [PATCH 17/69] refactor(query): do some internal refactor. --- include/libs/function/function.h | 12 +- include/libs/scalar/filter.h | 6 +- source/libs/executor/src/executorimpl.c | 48 ++++--- source/libs/function/src/functionMgt.c | 5 - source/libs/scalar/inc/filterInt.h | 2 +- source/libs/scalar/src/filter.c | 172 +++++++++++++----------- source/libs/scalar/src/sclvector.c | 96 +++++++------ 7 files changed, 181 insertions(+), 160 deletions(-) diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 65ddc180d6..60c7b18367 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -78,7 +78,6 @@ enum { MAIN_SCAN = 0x0u, REVERSE_SCAN = 0x1u, // todo remove it REPEAT_SCAN = 0x2u, // repeat scan belongs to the master scan - MERGE_STAGE = 0x20u, }; typedef struct SPoint1 { @@ -156,11 +155,6 @@ typedef struct SqlFunctionCtx { char udfName[TSDB_FUNC_NAME_LEN]; } SqlFunctionCtx; -enum { - TEXPR_BINARYEXPR_NODE = 0x1, - TEXPR_UNARYEXPR_NODE = 0x2, -}; - typedef struct tExprNode { int32_t nodeType; union { @@ -182,8 +176,9 @@ struct SScalarParam { SColumnInfoData *columnData; SHashObj *pHashFilter; int32_t hashValueType; - void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value + void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value int32_t numOfRows; + int32_t numOfQualified; // number of qualified elements in the final results }; void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell); @@ -201,8 +196,6 @@ int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // udf api -struct SUdfInfo; - /** * create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf * @return error code @@ -226,6 +219,7 @@ int32_t udfStartUdfd(int32_t startDnodeId); * @return */ int32_t udfStopUdfd(); + #ifdef __cplusplus } #endif diff --git a/include/libs/scalar/filter.h b/include/libs/scalar/filter.h index 1f1d9dea93..e02b4a6172 100644 --- a/include/libs/scalar/filter.h +++ b/include/libs/scalar/filter.h @@ -31,13 +31,17 @@ enum { FLT_OPTION_NEED_UNIQE = 4, }; +#define FILTER_RESULT_ALL_QUALIFIED 0x1 +#define FILTER_RESULT_NONE_QUALIFIED 0x2 +#define FILTER_RESULT_PARTIAL_QUALIFIED 0x3 + typedef struct SFilterColumnParam { int32_t numOfCols; SArray *pDataBlock; } SFilterColumnParam; extern int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pinfo, uint32_t options); -extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, int8_t **p, SColumnDataAgg *statis, int16_t numOfCols); +extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData** p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* pFilterResStatus); extern int32_t filterSetDataFromSlotId(SFilterInfo *info, void *param); extern int32_t filterSetDataFromColId(SFilterInfo *info, void *param); extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index e0d417093c..055406f423 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -81,11 +81,6 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) { int32_t getMaximumIdleDurationSec() { return tsShellActivityTimer * 2; } -static int32_t getExprFunctionId(SExprInfo* pExprInfo) { - assert(pExprInfo != NULL && pExprInfo->pExpr != NULL && pExprInfo->pExpr->nodeType == TEXPR_UNARYEXPR_NODE); - return 0; -} - static void setBlockSMAInfo(SqlFunctionCtx* pCtx, SExprInfo* pExpr, SSDataBlock* pBlock); static void releaseQueryBuf(size_t numOfTables); @@ -1115,7 +1110,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO } } -static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep); +static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, bool keep, int32_t status); void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColMatchInfo) { if (pFilterNode == NULL || pBlock->info.rows == 0) { @@ -1126,18 +1121,17 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColM // todo move to the initialization function int32_t code = filterInitFromNode((SNode*)pFilterNode, &filter, 0); - - size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); - SFilterColumnParam param1 = {.numOfCols = numOfCols, .pDataBlock = pBlock->pDataBlock}; + SFilterColumnParam param1 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock}; code = filterSetDataFromSlotId(filter, ¶m1); - int8_t* rowRes = NULL; + SColumnInfoData* p = NULL; + int32_t status = 0; // todo the keep seems never to be True?? - bool keep = filterExecute(filter, pBlock, &rowRes, NULL, param1.numOfCols); + bool keep = filterExecute(filter, pBlock, &p, NULL, param1.numOfCols, &status); filterFreeInfo(filter); - extractQualifiedTupleByFilterResult(pBlock, rowRes, keep); + extractQualifiedTupleByFilterResult(pBlock, p, keep, status); if (pColMatchInfo != NULL) { for (int32_t i = 0; i < taosArrayGetSize(pColMatchInfo); ++i) { @@ -1152,16 +1146,22 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColM } } - taosMemoryFree(rowRes); + colDataDestroy(p); + taosMemoryFree(p); } -void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep) { +void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, bool keep, int32_t status) { if (keep) { return; } - if (rowRes != NULL) { - int32_t totalRows = pBlock->info.rows; + int32_t totalRows = pBlock->info.rows; + + if (status == FILTER_RESULT_ALL_QUALIFIED) { + // here nothing needs to be done + } else if (status == FILTER_RESULT_NONE_QUALIFIED) { + pBlock->info.rows = 0; + } else { SSDataBlock* px = createOneDataBlock(pBlock, true); size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); @@ -1177,7 +1177,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR int32_t numOfRows = 0; for (int32_t j = 0; j < totalRows; ++j) { - if (rowRes[j] == 0) { + if (((int8_t*)p->pData)[j] == 0) { continue; } @@ -1189,6 +1189,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR numOfRows += 1; } + // todo this value can be assigned directly if (pBlock->info.rows == totalRows) { pBlock->info.rows = numOfRows; } else { @@ -1197,13 +1198,10 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR } blockDataDestroy(px); // fix memory leak - } else { - // do nothing - pBlock->info.rows = 0; } } -void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) { + void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) { // for simple group by query without interval, all the tables belong to one group result. SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SAggOperatorInfo* pAggInfo = pOperator->info; @@ -4242,10 +4240,10 @@ int32_t buildDataBlockFromGroupRes(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock pCtx[j].resultInfo = getResultEntryInfo(pRow, j, rowEntryOffset); if (pCtx[j].fpSet.finalize) { - int32_t code = pCtx[j].fpSet.finalize(&pCtx[j], pBlock); - if (TAOS_FAILED(code)) { - qError("%s build result data block error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); - T_LONG_JMP(pTaskInfo->env, code); + int32_t code1 = pCtx[j].fpSet.finalize(&pCtx[j], pBlock); + if (TAOS_FAILED(code1)) { + qError("%s build result data block error, code %s", GET_TASKID(pTaskInfo), tstrerror(code1)); + T_LONG_JMP(pTaskInfo->env, code1); } } else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) { // do nothing, todo refactor diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 26735fa263..bc10ce71ae 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -26,11 +26,6 @@ typedef struct SFuncMgtService { SHashObj* pFuncNameHashTable; } SFuncMgtService; -typedef struct SUdfInfo { - SDataType outputDt; - int8_t funcType; -} SUdfInfo; - static SFuncMgtService gFunMgtService; static TdThreadOnce functionHashTableInit = PTHREAD_ONCE_INIT; static int32_t initFunctionCode = 0; diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h index e7695b2f04..5d243d86e8 100644 --- a/source/libs/scalar/inc/filterInt.h +++ b/source/libs/scalar/inc/filterInt.h @@ -99,7 +99,7 @@ typedef struct SFilterRange { typedef bool (*rangeCompFunc) (const void *, const void *, const void *, const void *, __compar_fn_t); typedef int32_t(*filter_desc_compare_func)(const void *, const void *); -typedef bool(*filter_exec_func)(void *, int32_t, int8_t**, SColumnDataAgg *, int16_t); +typedef bool(*filter_exec_func)(void *info, int32_t numOfRows, SColumnInfoData* p, SColumnDataAgg *statis, int16_t numOfCols); typedef int32_t (*filer_get_col_from_name)(void *, int32_t, char*, void **); typedef struct SFilterRangeCompare { diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 9e67635437..dc6b505bb9 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -2976,14 +2976,12 @@ _return: return TSDB_CODE_SUCCESS; } -bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { +bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols) { SFilterInfo *info = (SFilterInfo *)pinfo; bool all = true; uint32_t *unitIdx = NULL; - if (*p == NULL) { - *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); - } + int8_t* p = (int8_t*)pRes->pData; for (int32_t i = 0; i < numOfRows; ++i) { //FILTER_UNIT_CLR_F(info); @@ -3002,35 +3000,35 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, uint8_t optr = cunit->optr; if (colDataIsNull((SColumnInfoData *)(cunit->colData), 0, i, NULL)) { - (*p)[i] = optr == OP_TYPE_IS_NULL ? true : false; + p[i] = (optr == OP_TYPE_IS_NULL) ? true : false; } else { if (optr == OP_TYPE_IS_NOT_NULL) { - (*p)[i] = 1; + p[i] = 1; } else if (optr == OP_TYPE_IS_NULL) { - (*p)[i] = 0; + p[i] = 0; } else if (cunit->rfunc >= 0) { - (*p)[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]); + p[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]); } else { - (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData); + p[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData); } //FILTER_UNIT_SET_R(info, uidx, p[i]); //FILTER_UNIT_SET_F(info, uidx); } - if ((*p)[i] == 0) { + if (p[i] == 0) { break; } } - if ((*p)[i]) { + if (p[i]) { break; } unitIdx += unitNum; } - if ((*p)[i] == 0) { + if (p[i] == 0) { all = false; } } @@ -3040,7 +3038,7 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, -int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols, bool* all) { +int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, SColumnInfoData* p, SColumnDataAgg *statis, int16_t numOfCols, bool* all) { if (statis && numOfRows >= FILTER_RM_UNIT_MIN_ROWS) { info->blkFlag = 0; @@ -3058,7 +3056,6 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t* assert(info->unitNum > 1); *all = filterExecuteBasedOnStatisImpl(info, numOfRows, p, statis, numOfCols); - goto _return; } } @@ -3067,59 +3064,55 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t* _return: info->blkFlag = 0; - return TSDB_CODE_SUCCESS; } - -static FORCE_INLINE bool filterExecuteImplAll(void *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { +static FORCE_INLINE bool filterExecuteImplAll(void *info, int32_t numOfRows, SColumnInfoData* p, SColumnDataAgg *statis, int16_t numOfCols) { return true; } -static FORCE_INLINE bool filterExecuteImplEmpty(void *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { + +static FORCE_INLINE bool filterExecuteImplEmpty(void *info, int32_t numOfRows, SColumnInfoData* p, SColumnDataAgg *statis, int16_t numOfCols) { return false; } -static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { + +static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols) { SFilterInfo *info = (SFilterInfo *)pinfo; bool all = true; - if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) { - return all; - } + int8_t* p = (int8_t*)pRes->pData; - if (*p == NULL) { - *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); + if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) { + return all; } for (int32_t i = 0; i < numOfRows; ++i) { uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i); - (*p)[i] = ((colData == NULL) || colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL)); + p[i] = ((colData == NULL) || colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL)); - if ((*p)[i] == 0) { + if (p[i] == 0) { all = false; } } return all; } -static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { +static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols) { SFilterInfo *info = (SFilterInfo *)pinfo; bool all = true; - if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) { + if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) { return all; } - if (*p == NULL) { - *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); - } + int8_t* p = (int8_t*)pRes->pData; for (int32_t i = 0; i < numOfRows; ++i) { uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i); - (*p)[i] = ((colData != NULL) && !colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL)); - if ((*p)[i] == 0) { + p[i] = ((colData != NULL) && !colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL)); + if (p[i] == 0) { all = false; } } @@ -3127,7 +3120,7 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows return all; } -bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { +bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols) { SFilterInfo *info = (SFilterInfo *)pinfo; bool all = true; uint16_t dataSize = info->cunits[0].dataSize; @@ -3136,13 +3129,11 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnD void *valData2 = info->cunits[0].valData2; __compar_fn_t func = gDataCompare[info->cunits[0].func]; - if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) { + if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) { return all; } - if (*p == NULL) { - *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); - } + int8_t* p = (int8_t*) pRes->pData; for (int32_t i = 0; i < numOfRows; ++i) { void *colData = colDataGetData((SColumnInfoData *)info->cunits[0].colData, i); @@ -3152,9 +3143,9 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnD continue; } - (*p)[i] = (*rfunc)(colData, colData, valData, valData2, func); + p[i] = (*rfunc)(colData, colData, valData, valData2, func); - if ((*p)[i] == 0) { + if (p[i] == 0) { all = false; } } @@ -3162,23 +3153,21 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnD return all; } -bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { +bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols) { SFilterInfo *info = (SFilterInfo *)pinfo; bool all = true; - if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) { + if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) { return all; } - if (*p == NULL) { - *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); - } + int8_t* p = (int8_t*) pRes->pData; for (int32_t i = 0; i < numOfRows; ++i) { uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i); if (colData == NULL || colDataIsNull_s((SColumnInfoData *)info->cunits[uidx].colData, i)) { - (*p)[i] = 0; + p[i] = 0; all = false; continue; } @@ -3191,14 +3180,14 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDa qError("castConvert1 taosUcs4ToMbs error"); }else{ varDataSetLen(newColData, len); - (*p)[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, newColData, info->cunits[uidx].valData); + p[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, newColData, info->cunits[uidx].valData); } taosMemoryFreeClear(newColData); }else{ - (*p)[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, colData, info->cunits[uidx].valData); + p[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, colData, info->cunits[uidx].valData); } - if ((*p)[i] == 0) { + if (p[i] == 0) { all = false; } } @@ -3207,17 +3196,15 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDa } -bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { +bool filterExecuteImpl(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols) { SFilterInfo *info = (SFilterInfo *)pinfo; bool all = true; - if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) { + if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) { return all; } - if (*p == NULL) { - *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); - } + int8_t* p = (int8_t*) pRes->pData; for (int32_t i = 0; i < numOfRows; ++i) { //FILTER_UNIT_CLR_F(info); @@ -3235,14 +3222,14 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg uint8_t optr = cunit->optr; if (colData == NULL || colDataIsNull((SColumnInfoData *)(cunit->colData), 0, i, NULL)) { - (*p)[i] = optr == OP_TYPE_IS_NULL ? true : false; + p[i] = optr == OP_TYPE_IS_NULL ? true : false; } else { if (optr == OP_TYPE_IS_NOT_NULL) { - (*p)[i] = 1; + p[i] = 1; } else if (optr == OP_TYPE_IS_NULL) { - (*p)[i] = 0; + p[i] = 0; } else if (cunit->rfunc >= 0) { - (*p)[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]); + p[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]); } else { if(cunit->dataType == TSDB_DATA_TYPE_NCHAR && (cunit->optr == OP_TYPE_MATCH || cunit->optr == OP_TYPE_NMATCH)){ char *newColData = taosMemoryCalloc(cunit->dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1); @@ -3251,11 +3238,11 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg qError("castConvert1 taosUcs4ToMbs error"); }else{ varDataSetLen(newColData, len); - (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, newColData, cunit->valData); + p[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, newColData, cunit->valData); } taosMemoryFreeClear(newColData); }else{ - (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData); + p[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData); } } @@ -3263,17 +3250,17 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg //FILTER_UNIT_SET_F(info, uidx); } - if ((*p)[i] == 0) { + if (p[i] == 0) { break; } } - if ((*p)[i]) { + if (p[i]) { break; } } - if ((*p)[i] == 0) { + if (p[i] == 0) { all = false; } } @@ -4026,38 +4013,63 @@ _return: FLT_RET(code); } -bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { +bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData** p, SColumnDataAgg *statis, int16_t numOfCols, int32_t *pResultStatus) { if (NULL == info) { + *pResultStatus = FILTER_RESULT_ALL_QUALIFIED; + return false; + } + + SScalarParam output = {0}; + SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)}; + + int32_t code = sclCreateColumnInfoData(&type, pSrc->info.rows, &output); + if (code != TSDB_CODE_SUCCESS) { return false; } if (info->scalarMode) { - SScalarParam output = {0}; - - SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)}; - int32_t code = sclCreateColumnInfoData(&type, pSrc->info.rows, &output); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - SArray *pList = taosArrayInit(1, POINTER_BYTES); taosArrayPush(pList, &pSrc); FLT_ERR_RET(scalarCalculate(info->sclCtx.node, pList, &output)); - *p = taosMemoryMalloc(output.numOfRows * sizeof(bool)); - - memcpy(*p, output.columnData->pData, output.numOfRows); - colDataDestroy(output.columnData); - taosMemoryFree(output.columnData); + *p = output.columnData; taosArrayDestroy(pList); + + if (output.numOfQualified == output.numOfRows) { + *pResultStatus = FILTER_RESULT_ALL_QUALIFIED; + } else if (output.numOfQualified == 0) { + *pResultStatus = FILTER_RESULT_NONE_QUALIFIED; + } else { + *pResultStatus = FILTER_RESULT_PARTIAL_QUALIFIED; + } return false; + } else { + *p = output.columnData; + output.numOfRows = pSrc->info.rows; + + bool keep = (*info->func)(info, pSrc->info.rows, *p, statis, numOfCols); + + // todo this should be return during filter procedure + int32_t num = 0; + for(int32_t i = 0; i < output.numOfRows; ++i) { + if (((int8_t*)((*p)->pData))[i] == 1) { + ++num; + } + } + + if (num == output.numOfRows) { + *pResultStatus = FILTER_RESULT_ALL_QUALIFIED; + } else if (num == 0) { + *pResultStatus = FILTER_RESULT_NONE_QUALIFIED; + } else { + *pResultStatus = FILTER_RESULT_PARTIAL_QUALIFIED; + } + + return keep; } - - return (*info->func)(info, pSrc->info.rows, p, statis, numOfCols); } - typedef struct SClassifyConditionCxt { bool hasPrimaryKey; bool hasTagIndexCol; diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index a003315fca..5d2f1d920c 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1646,38 +1646,60 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, doReleaseVec(pRightCol, rightConvert); } -#define VEC_COM_INNER(pCol, index1, index2) \ - for (; i < pCol->numOfRows && i >= 0; i += step) {\ - if (IS_HELPER_NULL(pLeft->columnData, index1) || IS_HELPER_NULL(pRight->columnData, index2)) {\ - bool res = false;\ - colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);\ - continue;\ - }\ - char *pLeftData = colDataGetData(pLeft->columnData, index1);\ - char *pRightData = colDataGetData(pRight->columnData, index2);\ - int64_t leftOut = 0;\ - int64_t rightOut = 0;\ - bool freeLeft = false;\ - bool freeRight = false;\ - bool isJsonnull = false;\ - bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight),\ - &pLeftData, &pRightData, &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight);\ - if(isJsonnull){\ - ASSERT(0);\ - }\ - if(!pLeftData || !pRightData){\ - result = false;\ - }\ - if(!result){\ - colDataAppendInt8(pOut->columnData, i, (int8_t*)&result);\ - }else{\ - bool res = filterDoCompare(fp, optr, pLeftData, pRightData);\ - colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);\ - }\ - if(freeLeft) taosMemoryFreeClear(pLeftData);\ - if(freeRight) taosMemoryFreeClear(pRightData);\ +int32_t doVectorCompareImpl(int32_t numOfRows, SScalarParam *pOut, int32_t startIndex, int32_t step, __compar_fn_t fp, + SScalarParam *pLeft, SScalarParam *pRight, int32_t optr) { + int32_t num = 0; + + for (int32_t i = startIndex; i < numOfRows && i >= 0; i += step) { + int32_t leftIndex = (i >= pLeft->numOfRows)? 0:i; + int32_t rightIndex = (i >= pRight->numOfRows)? 0:i; + + if (IS_HELPER_NULL(pLeft->columnData, leftIndex) || IS_HELPER_NULL(pRight->columnData, rightIndex)) { + bool res = false; + colDataAppendInt8(pOut->columnData, i, (int8_t *)&res); + continue; + } + + char * pLeftData = colDataGetData(pLeft->columnData, leftIndex); + char * pRightData = colDataGetData(pRight->columnData, rightIndex); + int64_t leftOut = 0; + int64_t rightOut = 0; + bool freeLeft = false; + bool freeRight = false; + bool isJsonnull = false; + + bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, + &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight); + if (isJsonnull) { + ASSERT(0); + } + + if (!pLeftData || !pRightData) { + result = false; + } + + if (!result) { + colDataAppendInt8(pOut->columnData, i, (int8_t *)&result); + } else { + bool res = filterDoCompare(fp, optr, pLeftData, pRightData); + colDataAppendInt8(pOut->columnData, i, (int8_t *)&res); + if (res) { + ++num; + } + } + + if (freeLeft) { + taosMemoryFreeClear(pLeftData); + } + + if (freeRight) { + taosMemoryFreeClear(pRightData); + } } + return num; +} + void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord, int32_t optr) { int32_t i = ((_ord) == TSDB_ORDER_ASC) ? 0 : TMAX(pLeft->numOfRows, pRight->numOfRows) - 1; int32_t step = ((_ord) == TSDB_ORDER_ASC) ? 1 : -1; @@ -1704,16 +1726,12 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam * char *pLeftData = colDataGetData(pLeft->columnData, i); bool res = filterDoCompare(fp, optr, pLeftData, pRight->pHashFilter); colDataAppendInt8(pOut->columnData, i, (int8_t*)&res); + if (res) { + pOut->numOfQualified++; + } } - return; - } - - if (pLeft->numOfRows == pRight->numOfRows) { - VEC_COM_INNER(pLeft, i, i) - } else if (pRight->numOfRows == 1) { - VEC_COM_INNER(pLeft, i, 0) - } else if (pLeft->numOfRows == 1) { - VEC_COM_INNER(pRight, 0, i) + } else { // normal compare + pOut->numOfQualified = doVectorCompareImpl(pOut->numOfRows, pOut, i, step, fp, pLeft, pRight, optr); } } From 2f475399a698301987f90f3ceea3bafddde2417c Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 21 Sep 2022 10:57:41 +0800 Subject: [PATCH 18/69] enh: added memory allocators for parser and planner --- include/libs/nodes/nodes.h | 8 +++- include/libs/scheduler/scheduler.h | 1 + source/client/inc/clientInt.h | 3 +- source/client/src/clientEnv.c | 3 +- source/client/src/clientImpl.c | 4 +- source/client/src/clientMain.c | 12 +++--- source/libs/nodes/src/nodesUtilFuncs.c | 58 +++++++++++++++++++++++++- source/libs/scheduler/inc/schInt.h | 3 +- source/libs/scheduler/src/schJob.c | 2 + 9 files changed, 81 insertions(+), 13 deletions(-) diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 1e2a53f598..3d5b04ddf4 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -278,9 +278,15 @@ typedef struct SNodeList { typedef struct SNodeAllocator SNodeAllocator; int32_t nodesCreateNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator); -void nodesDestroyNodeAllocator(SNodeAllocator* pAllocator); +void nodesDestroyNodeAllocator(void* pAllocator); void nodesResetThreadLevelAllocator(SNodeAllocator* pAllocator); +int32_t nodesAllocatorInit(); +int32_t nodesCreateAllocator(int32_t chunkSize, int64_t* pRefId); +void nodesDestroyAllocator(int64_t refId); +void nodesResetAllocator(int64_t refId); +int64_t nodesIncAllocatorRefCount(int64_t refId); + SNode* nodesMakeNode(ENodeType type); void nodesDestroyNode(SNode* pNode); diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h index e6973cd390..738d057e6a 100644 --- a/include/libs/scheduler/scheduler.h +++ b/include/libs/scheduler/scheduler.h @@ -67,6 +67,7 @@ typedef struct SSchedulerReq { SRequestConnInfo *pConn; SArray *pNodeList; SQueryPlan *pDag; + int64_t allocatorRefId; const char *sql; int64_t startTs; schedulerExecFp execFp; diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index f042c3ad7c..eca1a0ebbe 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -250,7 +250,8 @@ typedef struct SRequestObj { bool inRetry; uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog uint32_t retry; - SNodeAllocator* pNodeAllocator; + // SNodeAllocator* pNodeAllocator; + int64_t allocatorRefId; } SRequestObj; typedef struct SSyncQueryParam { diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 8fded03472..e95a2d2871 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -349,7 +349,7 @@ void doDestroyRequest(void *p) { taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->dbList); taosArrayDestroy(pRequest->targetTableList); - nodesDestroyNodeAllocator(pRequest->pNodeAllocator); + nodesDestroyAllocator(pRequest->allocatorRefId); destroyQueryExecRes(&pRequest->body.resInfo.execRes); @@ -412,6 +412,7 @@ void taos_init_imp(void) { initTaskQueue(); fmFuncMgtInit(); + nodesAllocatorInit(); clientConnRefPool = taosOpenRef(200, destroyTscObj); clientReqRefPool = taosOpenRef(40960, doDestroyRequest); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index bc1cdc247e..75e0966243 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -194,8 +194,9 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, return TSDB_CODE_TSC_OUT_OF_MEMORY; } + (*pRequest)->allocatorRefId = -1; if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) { - if (TSDB_CODE_SUCCESS != nodesCreateNodeAllocator(tsQueryNodeChunkSize, &((*pRequest)->pNodeAllocator))) { + if (TSDB_CODE_SUCCESS != nodesCreateAllocator(tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) { tscError("%d failed to create node allocator, reqId:0x%" PRIx64 ", conn:%d, %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); @@ -1058,6 +1059,7 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM .pConn = &conn, .pNodeList = pNodeList, .pDag = pDag, + .allocatorRefId = pRequest->allocatorRefId, .sql = pRequest->sqlstr, .startTs = pRequest->metric.start, .execFp = schedulerExecCb, diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e19d88fcf3..c3f8ca32b8 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -700,7 +700,7 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { pRequest->metric.ctgEnd = taosGetTimestampUs(); - nodesResetThreadLevelAllocator(pRequest->pNodeAllocator); + nodesResetAllocator(pRequest->allocatorRefId); if (code == TSDB_CODE_SUCCESS) { code = qAnalyseSqlSemantic(pWrapper->pCtx, &pWrapper->catalogReq, pResultMeta, pQuery); @@ -728,11 +728,11 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { pRequest->requestId); launchAsyncQuery(pRequest, pQuery, pResultMeta); qDestroyQuery(pQuery); - nodesResetThreadLevelAllocator(NULL); + nodesResetAllocator(-1); } else { destorySqlParseWrapper(pWrapper); qDestroyQuery(pQuery); - nodesResetThreadLevelAllocator(NULL); + nodesResetAllocator(-1); if (NEED_CLIENT_HANDLE_ERROR(code)) { tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); @@ -805,7 +805,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } SQuery *pQuery = NULL; - nodesResetThreadLevelAllocator(pRequest->pNodeAllocator); + nodesResetAllocator(pRequest->allocatorRefId); pRequest->metric.syntaxStart = taosGetTimestampUs(); @@ -849,7 +849,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { &pRequest->body.queryJob); pCxt = NULL; if (code == TSDB_CODE_SUCCESS) { - nodesResetThreadLevelAllocator(NULL); + nodesResetAllocator(-1); return; } @@ -857,7 +857,7 @@ _error: tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); taosMemoryFree(pCxt); - nodesResetThreadLevelAllocator(NULL); + nodesResetAllocator(-1); terrno = code; pRequest->code = code; diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 8b9b723a2a..b7caead3e5 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -21,6 +21,7 @@ #include "taoserror.h" #include "tdatablock.h" #include "thash.h" +#include "tref.h" typedef struct SNodeMemChunk { int32_t availableSize; @@ -30,6 +31,7 @@ typedef struct SNodeMemChunk { } SNodeMemChunk; typedef struct SNodeAllocator { + int64_t self; int32_t chunkSize; int32_t chunkNum; SNodeMemChunk* pCurrChunk; @@ -37,6 +39,22 @@ typedef struct SNodeAllocator { } SNodeAllocator; static threadlocal SNodeAllocator* pNodeAllocator; +static int32_t allocatorReqRefPool = -1; + +int32_t nodesAllocatorInit() { + if (allocatorReqRefPool >= 0) { + nodesWarn("nodes already initialized"); + return TSDB_CODE_SUCCESS; + } + + allocatorReqRefPool = taosOpenRef(40960, nodesDestroyNodeAllocator); + if (allocatorReqRefPool < 0) { + nodesError("init nodes failed"); + return TSDB_CODE_OUT_OF_MEMORY; + } + + return TSDB_CODE_SUCCESS; +} static SNodeMemChunk* callocNodeChunk(SNodeAllocator* pAllocator) { SNodeMemChunk* pNewChunk = taosMemoryCalloc(1, sizeof(SNodeMemChunk) + pAllocator->chunkSize); @@ -103,11 +121,13 @@ int32_t nodesCreateNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator) return TSDB_CODE_SUCCESS; } -void nodesDestroyNodeAllocator(SNodeAllocator* pAllocator) { - if (NULL == pAllocator) { +void nodesDestroyNodeAllocator(void* p) { + if (NULL == p) { return; } + SNodeAllocator* pAllocator = p; + nodesDebug("alloc chunkNum: %d, chunkTotakSize: %d", pAllocator->chunkNum, pAllocator->chunkNum * pAllocator->chunkSize); @@ -122,6 +142,40 @@ void nodesDestroyNodeAllocator(SNodeAllocator* pAllocator) { void nodesResetThreadLevelAllocator(SNodeAllocator* pAllocator) { pNodeAllocator = pAllocator; } +int32_t nodesCreateAllocator(int32_t chunkSize, int64_t* pRefId) { + SNodeAllocator* pAllocator = NULL; + int32_t code = nodesCreateNodeAllocator(chunkSize, &pAllocator); + if (TSDB_CODE_SUCCESS == code) { + pAllocator->self = taosAddRef(allocatorReqRefPool, pAllocator); + *pRefId = pAllocator->self; + } + return code; +} + +void nodesDestroyAllocator(int64_t refId) { + if (refId < 0) { + return; + } + taosReleaseRef(allocatorReqRefPool, refId); +} + +void nodesResetAllocator(int64_t refId) { + if (refId < 0) { + pNodeAllocator = NULL; + } else { + pNodeAllocator = taosAcquireRef(allocatorReqRefPool, refId); + taosReleaseRef(allocatorReqRefPool, refId); + } +} + +int64_t nodesIncAllocatorRefCount(int64_t refId) { + if (refId < 0) { + return -1; + } + SNodeAllocator* pAllocator = taosAcquireRef(allocatorReqRefPool, refId); + return pAllocator->self; +} + static SNode* makeNode(ENodeType type, int32_t size) { SNode* p = nodesCalloc(1, size); if (NULL == p) { diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 7fea286732..a62531a875 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -254,7 +254,8 @@ typedef struct SSchJob { SRequestConnInfo conn; SArray *nodeList; // qnode/vnode list, SArray SArray *levels; // starting from 0. SArray - SQueryPlan *pDag; + SQueryPlan *pDag; + int64_t allocatorRefId; SArray *dataSrcTasks; // SArray int32_t levelIdx; diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 98501427ab..345f4680b0 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -673,6 +673,7 @@ void schFreeJobImpl(void *job) { destroyQueryExecRes(&pJob->execRes); qDestroyQueryPlan(pJob->pDag); + nodesDestroyAllocator(pJob->allocatorRefId); taosMemoryFreeClear(pJob->userRes.execRes); taosMemoryFreeClear(pJob->fetchRes); @@ -724,6 +725,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { pJob->sql = strdup(pReq->sql); } pJob->pDag = pReq->pDag; + pJob->allocatorRefId = nodesIncAllocatorRefCount(pReq->allocatorRefId); pJob->chkKillFp = pReq->chkKillFp; pJob->chkKillParam = pReq->chkKillParam; pJob->userRes.execFp = pReq->execFp; From a914816ce75111b15d75dbaf4a93255da9dba975 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 21 Sep 2022 11:28:34 +0800 Subject: [PATCH 19/69] enh: added memory allocators for parser and planner --- source/client/inc/clientInt.h | 3 +-- source/client/src/clientEnv.c | 1 + source/libs/nodes/src/nodesUtilFuncs.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index eca1a0ebbe..7a9c665556 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -250,8 +250,7 @@ typedef struct SRequestObj { bool inRetry; uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog uint32_t retry; - // SNodeAllocator* pNodeAllocator; - int64_t allocatorRefId; + int64_t allocatorRefId; } SRequestObj; typedef struct SSyncQueryParam { diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index e95a2d2871..5019314fed 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -288,6 +288,7 @@ void *createRequest(uint64_t connId, int32_t type) { pRequest->body.resInfo.convertUcs4 = true; // convert ucs4 by default pRequest->type = type; + pRequest->allocatorRefId = -1; pRequest->pDb = getDbOfConnection(pTscObj); pRequest->pTscObj = pTscObj; diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index b7caead3e5..480d2cce72 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -153,14 +153,14 @@ int32_t nodesCreateAllocator(int32_t chunkSize, int64_t* pRefId) { } void nodesDestroyAllocator(int64_t refId) { - if (refId < 0) { + if (refId <= 0) { return; } taosReleaseRef(allocatorReqRefPool, refId); } void nodesResetAllocator(int64_t refId) { - if (refId < 0) { + if (refId <= 0) { pNodeAllocator = NULL; } else { pNodeAllocator = taosAcquireRef(allocatorReqRefPool, refId); @@ -169,7 +169,7 @@ void nodesResetAllocator(int64_t refId) { } int64_t nodesIncAllocatorRefCount(int64_t refId) { - if (refId < 0) { + if (refId <= 0) { return -1; } SNodeAllocator* pAllocator = taosAcquireRef(allocatorReqRefPool, refId); From d3a21816ccefd85a616454c18d413b6d5c936708 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Wed, 21 Sep 2022 11:43:36 +0800 Subject: [PATCH 20/69] shell: taos shell websocket reconnect error --- tools/shell/src/shellUtil.c | 2 +- tools/shell/src/shellWebsocket.c | 39 ++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/tools/shell/src/shellUtil.c b/tools/shell/src/shellUtil.c index 0430428c38..8c47d16555 100644 --- a/tools/shell/src/shellUtil.c +++ b/tools/shell/src/shellUtil.c @@ -143,7 +143,7 @@ void shellCheckConnectMode() { shell.args.port = 6041; } shell.args.dsn = taosMemoryCalloc(1, 1024); - snprintf(shell.args.dsn, 1024, "ws://%s:%d/rest/ws", + snprintf(shell.args.dsn, 1024, "ws://%s:%d", shell.args.host, shell.args.port); } shell.args.cloud = false; diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index b8b8392b96..94bb909e29 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -206,26 +206,31 @@ void shellRunSingleCommandWebsocketImp(char *command) { printMode = true; // When output to a file, the switch does not work. } - if (!shell.ws_conn && shell_conn_ws_server(0)) { - return; - } - shell.stop_query = false; - st = taosGetTimestampUs(); + WS_RES* res; - WS_RES* res = ws_query_timeout(shell.ws_conn, command, shell.args.timeout); - int code = ws_errno(res); - if (code != 0) { - et = taosGetTimestampUs(); - fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6); - if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { - fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); - } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) { - fprintf(stderr, "TDengine server is down, will try to reconnect\n"); - shell.ws_conn = NULL; + for (int reconnectNum = 0; reconnectNum < 2; reconnectNum++) { + if (!shell.ws_conn && shell_conn_ws_server(0)) { + return; } - ws_free_result(res); - return; + st = taosGetTimestampUs(); + + res = ws_query_timeout(shell.ws_conn, command, shell.args.timeout); + int code = ws_errno(res); + if (code != 0 && !shell.stop_query) { + et = taosGetTimestampUs(); + fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6); + if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { + fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); + } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) { + fprintf(stderr, "TDengine server is down, will try to reconnect\n"); + shell.ws_conn = NULL; + } + ws_free_result(res); + if (reconnectNum == 0) continue; + return; + } + break; } double execute_time = ws_take_timing(res)/1E6; From 4ca49bf5495081aa80411dc6ac16d4759e1935a7 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 21 Sep 2022 11:47:15 +0800 Subject: [PATCH 21/69] fix(query): assign the result number. --- source/libs/scalar/src/scalar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cd1f6624bd..62f012a75a 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -1242,6 +1242,7 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) { colInfoDataEnsureCapacity(pDst->columnData, res->numOfRows); colDataAssign(pDst->columnData, res->columnData, res->numOfRows, NULL); pDst->numOfRows = res->numOfRows; + pDst->numOfQualified = res->numOfQualified; } sclFreeParam(res); From bc9655745709862990fac16da5757d59e88b1b25 Mon Sep 17 00:00:00 2001 From: Huo Linhe Date: Wed, 21 Sep 2022 11:47:27 +0800 Subject: [PATCH 22/69] fix: core in case of null args with taos -c dir/ -R --- cmake/taosws_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in index 627cd53c09..ca8fff8da5 100644 --- a/cmake/taosws_CMakeLists.txt.in +++ b/cmake/taosws_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosws-rs ExternalProject_Add(taosws-rs GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git - GIT_TAG 76bc64d + GIT_TAG 1bdfca3 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 72fba5a8ce28671f619d9d831a1cc6f73ef3d1da Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 21 Sep 2022 11:54:44 +0800 Subject: [PATCH 23/69] fix(stream): check delete uid --- include/common/tcommon.h | 1 + include/libs/stream/tstream.h | 15 ++++++++-- source/dnode/vnode/src/tq/tq.c | 40 +++++++++++++++++++++++-- source/libs/executor/src/scanoperator.c | 40 +++++++++++++++++++++++++ source/libs/stream/src/stream.c | 2 +- source/libs/stream/src/streamData.c | 10 +++++++ source/libs/stream/src/streamDispatch.c | 21 ++++++++----- source/libs/stream/src/streamExec.c | 3 ++ 8 files changed, 119 insertions(+), 13 deletions(-) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index ba4baa0130..2544cedda7 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -116,6 +116,7 @@ enum { STREAM_INPUT__DATA_RETRIEVE, STREAM_INPUT__GET_RES, STREAM_INPUT__CHECKPOINT, + STREAM_INPUT__REF_DATA_BLOCK, STREAM_INPUT__DESTROY, }; diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 554d66d621..bdc12f7e3f 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -125,6 +125,14 @@ typedef struct { SArray* blocks; // SArray } SStreamDataBlock; +// ref data block, for delete +typedef struct { + int8_t type; + int64_t ver; + int32_t* dataRef; + SSDataBlock* pBlock; +} SStreamRefDataBlock; + typedef struct { int8_t type; } SStreamCheckpoint; @@ -339,7 +347,8 @@ static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem qDebug("task %d %p submit enqueue %p %p %p", pTask->taskId, pTask, pItem, pSubmitClone, pSubmitClone->data); taosWriteQitem(pTask->inputQueue->queue, pSubmitClone); // qStreamInput(pTask->exec.executor, pSubmitClone); - } else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE) { + } else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE || + pItem->type == STREAM_INPUT__REF_DATA_BLOCK) { taosWriteQitem(pTask->inputQueue->queue, pItem); // qStreamInput(pTask->exec.executor, pItem); } else if (pItem->type == STREAM_INPUT__CHECKPOINT) { @@ -492,7 +501,9 @@ typedef struct { int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq); int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq); -void tFreeStreamDispatchReq(SStreamDispatchReq* pReq); +void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq); + +void tDeleteStreamDispatchReq(SStreamDispatchReq* pReq); int32_t streamSetupTrigger(SStreamTask* pTask); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 98b7dd7163..29217e29a4 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -59,7 +59,7 @@ static void destroySTqHandle(void* data) { tqCloseReader(pData->execHandle.pExecReader); walCloseReader(pData->pWalReader); taosHashCleanup(pData->execHandle.execDb.pFilterOutTbUid); - } else if (pData->execHandle.subType == TOPIC_SUB_TYPE__TABLE){ + } else if (pData->execHandle.subType == TOPIC_SUB_TYPE__TABLE) { walCloseReader(pData->pWalReader); tqCloseReader(pData->execHandle.pExecReader); } @@ -664,7 +664,10 @@ int32_t tqProcessVgChangeReq(STQ* pTq, int64_t version, char* msg, int32_t msgLe tqError("vgId:%d, build new consumer handle %s for consumer %d, but old consumerId is %ld", req.vgId, req.subKey, req.newConsumerId, req.oldConsumerId); } - ASSERT(req.newConsumerId != -1); + if (req.newConsumerId == -1) { + tqError("vgId:%d, tq invalid rebalance request, new consumerId %ld", req.vgId, req.newConsumerId); + return 0; + } STqHandle tqHandle = {0}; pHandle = &tqHandle; /*taosInitRWLatch(&pExec->lock);*/ @@ -876,6 +879,9 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) { taosArrayDestroy(pRes->uidList); + int32_t* pRef = taosMemoryMalloc(sizeof(int32_t)); + *pRef = 1; + void* pIter = NULL; while (1) { pIter = taosHashIterate(pTq->pStreamMeta->pTasks, pIter); @@ -885,6 +891,33 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) { qDebug("delete req enqueue stream task: %d, ver: %" PRId64, pTask->taskId, ver); + if (!failed) { + SStreamRefDataBlock* pRefBlock = taosAllocateQitem(sizeof(SStreamRefDataBlock), DEF_QITEM); + pRefBlock->type = STREAM_INPUT__REF_DATA_BLOCK; + pRefBlock->pBlock = pDelBlock; + pRefBlock->dataRef = pRef; + atomic_add_fetch_32(pRefBlock->dataRef, 1); + + if (streamTaskInput(pTask, (SStreamQueueItem*)pRefBlock) < 0) { + qError("stream task input del failed, task id %d", pTask->taskId); + continue; + } + if (streamSchedExec(pTask) < 0) { + qError("stream task launch failed, task id %d", pTask->taskId); + continue; + } + } else { + streamTaskInputFail(pTask); + } + } + int32_t ref = atomic_sub_fetch_32(pRef, 1); + ASSERT(ref >= 0); + if (ref == 0) { + taosMemoryFree(pDelBlock); + taosMemoryFree(pRef); + } + +#if 0 SStreamDataBlock* pStreamBlock = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); pStreamBlock->type = STREAM_INPUT__DATA_BLOCK; pStreamBlock->blocks = taosArrayInit(0, sizeof(SSDataBlock)); @@ -908,6 +941,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) { } } blockDataDestroy(pDelBlock); +#endif return 0; } @@ -1045,6 +1079,7 @@ int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) { SDecoder decoder; tDecoderInit(&decoder, msgBody, msgLen); tDecodeStreamRetrieveReq(&decoder, &req); + tDecoderClear(&decoder); int32_t taskId = req.dstTaskId; SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId); if (pTask) { @@ -1053,6 +1088,7 @@ int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) { .code = 0, }; streamProcessRetrieveReq(pTask, &req, &rsp); + tDeleteStreamRetrieveReq(&req); return 0; } else { return -1; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8f9a78db83..4d16b2e170 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1480,6 +1480,40 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { } } +static int32_t filterDelBlockByUid(SSDataBlock* pDst, const SSDataBlock* pSrc, SStreamScanInfo* pInfo) { + STqReader* pReader = pInfo->tqReader; + int32_t rows = pSrc->info.rows; + blockDataEnsureCapacity(pDst, rows); + + SColumnInfoData* pSrcStartCol = taosArrayGet(pSrc->pDataBlock, START_TS_COLUMN_INDEX); + uint64_t* startCol = (uint64_t*)pSrcStartCol->pData; + SColumnInfoData* pSrcEndCol = taosArrayGet(pSrc->pDataBlock, END_TS_COLUMN_INDEX); + uint64_t* endCol = (uint64_t*)pSrcEndCol->pData; + SColumnInfoData* pSrcUidCol = taosArrayGet(pSrc->pDataBlock, UID_COLUMN_INDEX); + uint64_t* uidCol = (uint64_t*)pSrcUidCol->pData; + + SColumnInfoData* pDstStartCol = taosArrayGet(pDst->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pDstEndCol = taosArrayGet(pDst->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pDstUidCol = taosArrayGet(pDst->pDataBlock, UID_COLUMN_INDEX); + int32_t j = 0; + for (int32_t i = 0; i < rows; i++) { + if (taosHashGet(pReader->tbIdHash, &uidCol[i], sizeof(uint64_t))) { + colDataAppend(pDstStartCol, j, (const char*)&startCol[i], false); + colDataAppend(pDstEndCol, j, (const char*)&endCol[i], false); + colDataAppend(pDstUidCol, j, (const char*)&uidCol[i], false); + + colDataAppendNULL(taosArrayGet(pDst->pDataBlock, GROUPID_COLUMN_INDEX), j); + colDataAppendNULL(taosArrayGet(pDst->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX), j); + colDataAppendNULL(taosArrayGet(pDst->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX), j); + j++; + } + } + pDst->info = pSrc->info; + pDst->info.rows = j; + + return 0; +} + static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { // NOTE: this operator does never check if current status is done or not SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; @@ -1568,6 +1602,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { } break; case STREAM_DELETE_DATA: { printDataBlock(pBlock, "stream scan delete recv"); + if (pInfo->tqReader) { + SSDataBlock* pDelBlock = createSpecialDataBlock(STREAM_DELETE_DATA); + filterDelBlockByUid(pDelBlock, pBlock, pInfo); + pBlock = pDelBlock; + } + printDataBlock(pBlock, "stream scan delete recv filtered"); if (!isIntervalWindow(pInfo) && !isSessionWindow(pInfo) && !isStateWindow(pInfo)) { generateDeleteResultBlock(pInfo, pBlock, pInfo->pDeleteDataRes); pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index d6e87c2736..4a63cd3bb2 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -182,7 +182,7 @@ int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, S pReq->upstreamTaskId); streamTaskEnqueue(pTask, pReq, pRsp); - tFreeStreamDispatchReq(pReq); + tDeleteStreamDispatchReq(pReq); if (exec) { if (streamTryExec(pTask) < 0) { diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index cd5f499c34..e6705a77b2 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -179,5 +179,15 @@ void streamFreeQitem(SStreamQueueItem* data) { taosArrayDestroy(pMerge->reqs); taosArrayDestroy(pMerge->dataRefs); taosFreeQitem(pMerge); + } else if (type == STREAM_INPUT__REF_DATA_BLOCK) { + SStreamRefDataBlock* pRefBlock = (SStreamRefDataBlock*)data; + + int32_t ref = atomic_sub_fetch_32(pRefBlock->dataRef, 1); + ASSERT(ref >= 0); + if (ref == 0) { + blockDataDestroy(pRefBlock->pBlock); + taosMemoryFree(pRefBlock->dataRef); + } + taosFreeQitem(pRefBlock); } } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 7cdb7c0db9..e6960ae350 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -62,7 +62,7 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) { return 0; } -void tFreeStreamDispatchReq(SStreamDispatchReq* pReq) { +void tDeleteStreamDispatchReq(SStreamDispatchReq* pReq) { taosArrayDestroyP(pReq->data, taosMemoryFree); taosArrayDestroy(pReq->dataLen); } @@ -95,7 +95,10 @@ int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq) { return 0; } +void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq) { taosMemoryFree(pReq->pRetrieve); } + int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) { + int32_t code = -1; SRetrieveTableRsp* pRetrieve = NULL; void* buf = NULL; int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); @@ -143,7 +146,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) buf = rpcMallocCont(sizeof(SMsgHead) + len); if (buf == NULL) { - goto FAIL; + goto CLEAR; } ((SMsgHead*)buf)->vgId = htonl(pEpInfo->nodeId); @@ -151,6 +154,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) SEncoder encoder; tEncoderInit(&encoder, abuf, len); tEncodeStreamRetrieveReq(&encoder, &req); + tEncoderClear(&encoder); SRpcMsg rpcMsg = { .code = 0, @@ -161,17 +165,18 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) if (tmsgSendReq(&pEpInfo->epSet, &rpcMsg) < 0) { ASSERT(0); - return -1; + goto CLEAR; } + buf = NULL; qDebug("task %d(child %d) send retrieve req to task %d at node %d, reqId %" PRId64, pTask->taskId, pTask->selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req.reqId); } - return 0; -FAIL: - if (pRetrieve) taosMemoryFree(pRetrieve); - if (buf) taosMemoryFree(buf); - return -1; + code = 0; +CLEAR: + taosMemoryFree(pRetrieve); + rpcFreeCont(buf); + return code; } static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDispatchReq* pReq) { diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 102bad7426..5ad5aa549d 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -38,6 +38,9 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* SArray* blocks = pMerged->reqs; qDebug("task %d %p set submit input (merged), batch num: %d", pTask->taskId, pTask, (int32_t)blocks->size); qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__MERGED_SUBMIT); + } else if (pItem->type == STREAM_INPUT__REF_DATA_BLOCK) { + const SStreamRefDataBlock* pRefBlock = (const SStreamRefDataBlock*)data; + qSetMultiStreamInput(exec, pRefBlock->pBlock, 1, STREAM_INPUT__DATA_BLOCK); } else { ASSERT(0); } From a1eca821765f30bc1364f1b3828affe9230cf207 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 21 Sep 2022 13:23:54 +0800 Subject: [PATCH 24/69] feat: update taos-tools 8207c74 for 3.0 (#16976) --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index b75d4607b8..52e2c0944a 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 285b5e0 + GIT_TAG 8207c74 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 721112140f285484eb78648029ef5bea6daaf6b1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 21 Sep 2022 13:51:36 +0800 Subject: [PATCH 25/69] fix(query): assign qualified value. --- source/libs/scalar/src/sclvector.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 5d2f1d920c..fe2a970aaa 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1475,19 +1475,19 @@ void vectorMathMinus(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pO void vectorAssign(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) { SColumnInfoData *pOutputCol = pOut->columnData; - pOut->numOfRows = pLeft->numOfRows; -// if (IS_HELPER_NULL(pRight->columnData, 0)) { if(colDataIsNull_s(pRight->columnData, 0)){ - for (int32_t i = 0; i < pOut->numOfRows; ++i) { - colDataAppend(pOutputCol, i, NULL, true); - } + colDataAppendNNULL(pOutputCol, 0, pOut->numOfRows); } else { + char* d = colDataGetData(pRight->columnData, 0); for (int32_t i = 0; i < pOut->numOfRows; ++i) { - colDataAppend(pOutputCol, i, colDataGetData(pRight->columnData, 0), false); + colDataAppend(pOutputCol, i, d, false); } } + + ASSERT(pRight->numOfQualified == 1 || pRight->numOfQualified == 0); + pOut->numOfQualified = pRight->numOfQualified * pOut->numOfRows; } void vectorConcat(SScalarParam* pLeft, SScalarParam* pRight, void *out, int32_t _ord) { From 90c300e3202f73d879eb5f66bc2b92769638a371 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 21 Sep 2022 13:53:40 +0800 Subject: [PATCH 26/69] enh: added memory allocators for parser and planner --- source/client/src/clientImpl.c | 2 ++ source/client/src/clientMain.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 75e0966243..b74dca3cfe 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1046,6 +1046,8 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM pRequest->body.subplanNum = pDag->numOfSubplans; } + nodesResetAllocator(-1); + pRequest->metric.planEnd = taosGetTimestampUs(); if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) { diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index c3f8ca32b8..77bd71c756 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -728,7 +728,6 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { pRequest->requestId); launchAsyncQuery(pRequest, pQuery, pResultMeta); qDestroyQuery(pQuery); - nodesResetAllocator(-1); } else { destorySqlParseWrapper(pWrapper); qDestroyQuery(pQuery); @@ -811,6 +810,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)}; code = qParseSqlSyntax(pCxt, &pQuery, &catalogReq); + nodesResetAllocator(-1); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -849,7 +849,6 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { &pRequest->body.queryJob); pCxt = NULL; if (code == TSDB_CODE_SUCCESS) { - nodesResetAllocator(-1); return; } @@ -857,7 +856,6 @@ _error: tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); taosMemoryFree(pCxt); - nodesResetAllocator(-1); terrno = code; pRequest->code = code; From 6c6e20ff1473bc0c042cd2d8a176fa2fe6666ef3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 21 Sep 2022 14:18:27 +0800 Subject: [PATCH 27/69] fix(query): fix value number counting in relational processing. --- source/libs/scalar/src/scalar.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 62f012a75a..ebc8f2665e 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -606,6 +606,8 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o SCL_ERR_JRET(code); } + int32_t numOfQualified = 0; + bool value = false; bool complete = true; for (int32_t i = 0; i < rowNum; ++i) { @@ -631,6 +633,9 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o if (complete) { colDataAppend(output->columnData, i, (char*) &value, false); + if (value) { + numOfQualified++; + } } } @@ -639,8 +644,9 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o output->numOfRows = 0; } -_return: + output->numOfQualified = numOfQualified; +_return: sclFreeParamList(params, paramNum); SCL_RET(code); } @@ -1250,7 +1256,6 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) { } _return: - //nodesDestroyNode(pNode); sclFreeRes(ctx.pRes); return code; } From 5a7ad1344b38c21d1467a84dbbab047987270850 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 21 Sep 2022 14:36:44 +0800 Subject: [PATCH 28/69] fix: remove stream api and use tmq syntax in lua example (#16979) --- examples/lua/lua51/lua_connector51.c | 71 ++++--------------- examples/lua/lua_connector.c | 4 +- examples/lua/test.lua | 100 ++++++++++++++++++--------- 3 files changed, 87 insertions(+), 88 deletions(-) diff --git a/examples/lua/lua51/lua_connector51.c b/examples/lua/lua51/lua_connector51.c index 578622bf1f..ac840913f9 100644 --- a/examples/lua/lua51/lua_connector51.c +++ b/examples/lua/lua51/lua_connector51.c @@ -1,11 +1,11 @@ +#include #include #include -#include #include -#include "../../../../include/client/taos.h" -#include "lauxlib.h" #include "lua.h" +#include "lauxlib.h" #include "lualib.h" +#include struct cb_param{ lua_State* state; @@ -35,7 +35,7 @@ static int l_connect(lua_State *L){ } lua_getfield(L, 1, "port"); - if (lua_isnumber(L,-1)){ + if (lua_isnumber(L, -1)){ port = lua_tonumber(L, -1); //printf("port = %d\n", port); } @@ -102,7 +102,7 @@ static int l_query(lua_State *L){ printf("failed, reason:%s\n", taos_errstr(result)); lua_pushinteger(L, -1); lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); + lua_pushstring(L, taos_errstr(result)); lua_setfield(L, table_index, "error"); return 1; @@ -113,7 +113,6 @@ static int l_query(lua_State *L){ int rows = 0; int num_fields = taos_field_count(result); const TAOS_FIELD *fields = taos_fetch_fields(result); - //char temp[256]; const int affectRows = taos_affected_rows(result); // printf(" affect rows:%d\r\n", affectRows); @@ -122,7 +121,7 @@ static int l_query(lua_State *L){ lua_pushinteger(L, affectRows); lua_setfield(L, table_index, "affected"); lua_newtable(L); - + while ((row = taos_fetch_row(result))) { //printf("row index:%d\n",rows); rows++; @@ -136,17 +135,21 @@ static int l_query(lua_State *L){ } lua_pushstring(L,fields[i].name); - + int32_t* length = taos_fetch_lengths(result); switch (fields[i].type) { + case TSDB_DATA_TYPE_UTINYINT: case TSDB_DATA_TYPE_TINYINT: lua_pushinteger(L,*((char *)row[i])); break; + case TSDB_DATA_TYPE_USMALLINT: case TSDB_DATA_TYPE_SMALLINT: lua_pushinteger(L,*((short *)row[i])); break; + case TSDB_DATA_TYPE_UINT: case TSDB_DATA_TYPE_INT: lua_pushinteger(L,*((int *)row[i])); break; + case TSDB_DATA_TYPE_UBIGINT: case TSDB_DATA_TYPE_BIGINT: lua_pushinteger(L,*((int64_t *)row[i])); break; @@ -156,9 +159,11 @@ static int l_query(lua_State *L){ case TSDB_DATA_TYPE_DOUBLE: lua_pushnumber(L,*((double *)row[i])); break; + case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - lua_pushstring(L,(char *)row[i]); + //printf("type:%d, max len:%d, current len:%d\n",fields[i].type, fields[i].bytes, length[i]); + lua_pushlstring(L,(char *)row[i], length[i]); break; case TSDB_DATA_TYPE_TIMESTAMP: lua_pushinteger(L,*((int64_t *)row[i])); @@ -166,6 +171,7 @@ static int l_query(lua_State *L){ case TSDB_DATA_TYPE_BOOL: lua_pushinteger(L,*((char *)row[i])); break; + case TSDB_DATA_TYPE_NULL: default: lua_pushnil(L); break; @@ -297,51 +303,6 @@ void stream_cb(void *param, TAOS_RES *result, TAOS_ROW row){ // printf("-----------------------------------------------------------------------------------\n\r"); } -static int l_open_stream(lua_State *L){ - int r = luaL_ref(L, LUA_REGISTRYINDEX); - TAOS * taos = (TAOS*)lua_topointer(L,1); - const char * sqlstr = lua_tostring(L,2); - int stime = luaL_checknumber(L,3); - - lua_newtable(L); - int table_index = lua_gettop(L); - - struct cb_param *p = malloc(sizeof(struct cb_param)); - p->state = L; - p->callback=r; - // printf("r:%d, L:%d\n",r,L); - void * s = taos_open_stream(taos,sqlstr,stream_cb,stime,p,NULL); - if (s == NULL) { - printf("failed to open stream, reason:%s\n", taos_errstr(taos)); - free(p); - lua_pushnumber(L, -1); - lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); - lua_setfield(L, table_index, "error"); - lua_pushlightuserdata(L,NULL); - lua_setfield(L, table_index, "stream"); - }else{ - // printf("success to open stream\n"); - lua_pushnumber(L, 0); - lua_setfield(L, table_index, "code"); - lua_pushstring(L, taos_errstr(taos)); - lua_setfield(L, table_index, "error"); - p->stream = s; - lua_pushlightuserdata(L,p); - lua_setfield(L, table_index, "stream");//stream has different content in lua and c. - } - - return 1; -} - -static int l_close_stream(lua_State *L){ - //TODO:get stream and free cb_param - struct cb_param *p = lua_touserdata(L,1); - taos_close_stream(p->stream); - free(p); - return 0; -} - static int l_close(lua_State *L){ TAOS *taos= (TAOS*)lua_topointer(L,1); lua_newtable(L); @@ -367,8 +328,6 @@ static const struct luaL_Reg lib[] = { {"query", l_query}, {"query_a",l_async_query}, {"close", l_close}, - {"open_stream", l_open_stream}, - {"close_stream", l_close_stream}, {NULL, NULL} }; diff --git a/examples/lua/lua_connector.c b/examples/lua/lua_connector.c index 3c13b196b9..ce13ab3829 100644 --- a/examples/lua/lua_connector.c +++ b/examples/lua/lua_connector.c @@ -5,7 +5,7 @@ #include #include #include -#include "taos.h" +#include struct cb_param{ lua_State* state; @@ -60,6 +60,8 @@ static int l_connect(lua_State *L){ lua_settop(L,0); + taos_init(); + lua_newtable(L); int table_index = lua_gettop(L); diff --git a/examples/lua/test.lua b/examples/lua/test.lua index 89c0904c6a..ff49b8408d 100644 --- a/examples/lua/test.lua +++ b/examples/lua/test.lua @@ -9,6 +9,50 @@ local config = { max_packet_size = 1024 * 1024 } +function dump(obj) + local getIndent, quoteStr, wrapKey, wrapVal, dumpObj + getIndent = function(level) + return string.rep("\t", level) + end + quoteStr = function(str) + return '"' .. string.gsub(str, '"', '\\"') .. '"' + end + wrapKey = function(val) + if type(val) == "number" then + return "[" .. val .. "]" + elseif type(val) == "string" then + return "[" .. quoteStr(val) .. "]" + else + return "[" .. tostring(val) .. "]" + end + end + wrapVal = function(val, level) + if type(val) == "table" then + return dumpObj(val, level) + elseif type(val) == "number" then + return val + elseif type(val) == "string" then + return quoteStr(val) + else + return tostring(val) + end + end + dumpObj = function(obj, level) + if type(obj) ~= "table" then + return wrapVal(obj) + end + level = level + 1 + local tokens = {} + tokens[#tokens + 1] = "{" + for k, v in pairs(obj) do + tokens[#tokens + 1] = getIndent(level) .. wrapKey(k) .. " = " .. wrapVal(v, level) .. "," + end + tokens[#tokens + 1] = getIndent(level - 1) .. "}" + return table.concat(tokens, "\n") + end + return dumpObj(obj, 0) +end + local conn local res = driver.connect(config) if res.code ~=0 then @@ -37,7 +81,7 @@ else print("select db--- pass.") end -res = driver.query(conn,"create table m1 (ts timestamp, speed int,owner binary(20))") +res = driver.query(conn,"create table m1 (ts timestamp, speed int, owner binary(20), mark nchar(30))") if res.code ~=0 then print("create table---failed: "..res.error) return @@ -45,7 +89,7 @@ else print("create table--- pass.") end -res = driver.query(conn,"insert into m1 values ('2019-09-01 00:00:00.001',0,'robotspace'), ('2019-09-01 00:00:00.002',1,'Hilink'),('2019-09-01 00:00:00.003',2,'Harmony')") +res = driver.query(conn,"insert into m1 values ('2019-09-01 00:00:00.001', 0, 'robotspace', '世界人民大团结万岁'), ('2019-09-01 00:00:00.002', 1, 'Hilink', '⾾⾿⿀⿁⿂⿃⿄⿅⿆⿇⿈⿉⿊⿋⿌⿍⿎⿏⿐⿑⿒⿓⿔⿕'),('2019-09-01 00:00:00.003', 2, 'Harmony', '₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵')") if res.code ~=0 then print("insert records failed: "..res.error) return @@ -64,21 +108,25 @@ if res.code ~=0 then return else if (#(res.item) == 3) then - print("select--- pass") + print("select--- pass") + print(res.item[1].mark) + print(res.item[2].mark) + print(res.item[3].mark) + else print("select--- failed: expect 3 affected records, actually received "..#(res.item)) end end -res = driver.query(conn,"CREATE TABLE thermometer (ts timestamp, degree double) TAGS(location binary(20), type int)") +res = driver.query(conn,"create table thermometer (ts timestamp, degree double) tags(location binary(20), type int)") if res.code ~=0 then print(res.error) return else print("create super table--- pass") end -res = driver.query(conn,"CREATE TABLE therm1 USING thermometer TAGS ('beijing', 1)") +res = driver.query(conn,"create table therm1 using thermometer tags ('beijing', 1)") if res.code ~=0 then print(res.error) return @@ -86,7 +134,7 @@ else print("create table--- pass") end -res = driver.query(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.001', 20),('2019-09-01 00:00:00.002', 21)") +res = driver.query(conn,"insert into therm1 values ('2019-09-01 00:00:00.001', 20),('2019-09-01 00:00:00.002', 21)") if res.code ~=0 then print(res.error) @@ -99,14 +147,14 @@ else end end -res = driver.query(conn,"SELECT COUNT(*) count, AVG(degree) AS av, MAX(degree), MIN(degree) FROM thermometer WHERE location='beijing' or location='tianjin' GROUP BY location, type") +res = driver.query(conn,"select count(*) as cnt, avg(degree) as av, max(degree), min(degree) from thermometer where location='beijing' or location='tianjin' group by location, type") if res.code ~=0 then print("select from super table--- failed:"..res.error) return else print("select from super table--- pass") for i = 1, #(res.item) do - print("res:"..res.item[i].count) + print("res:"..res.item[i].cnt) end end @@ -125,33 +173,16 @@ function async_query_callback(res) end end -driver.query_a(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.005', 100),('2019-09-01 00:00:00.006', 101),('2019-09-01 00:00:00.007', 102)", async_query_callback) +driver.query_a(conn,"insert into therm1 values ('2019-09-01 00:00:00.005', 100),('2019-09-01 00:00:00.006', 101),('2019-09-01 00:00:00.007', 102)", async_query_callback) +res = driver.query(conn, "create stream stream_avg_degree into avg_degree as select avg(degree) from thermometer interval(5s) sliding(1s)") -function stream_callback(t) - print("------------------------") - print("continuous query result:") - for key, value in pairs(t) do - print("key:"..key..", value:"..value) - end -end - -local stream -res = driver.open_stream(conn,"SELECT COUNT(*) as count, AVG(degree) as avg, MAX(degree) as max, MIN(degree) as min FROM thermometer interval(2s) sliding(2s);)",0, stream_callback) -if res.code ~=0 then - print("open stream--- failed:"..res.error) - return -else - print("open stream--- pass") - stream = res.stream -end - -print("From now on we start continous insert in an definite (infinite if you want) loop.") +print("From now on we start continous insertion in an definite (infinite if you want) loop.") local loop_index = 0 while loop_index < 30 do local t = os.time()*1000 local v = loop_index - res = driver.query(conn,string.format("INSERT INTO therm1 VALUES (%d, %d)",t,v)) + res = driver.query(conn,string.format("insert into therm1 values (%d, %d)",t,v)) if res.code ~=0 then print("continous insertion--- failed:" .. res.error) @@ -159,10 +190,17 @@ while loop_index < 30 do else --print("insert successfully, affected:"..res.affected) end + local res1 = driver.query(conn, string.format("select last(*) from avg_degree")) + if res1.code ~=0 then + print("select failed: "..res1.error) + return + else +-- print(dump(res1)) + if(#res1.item > 0) then print("avg_degree: " .. res1.item[1]["last(avg(degree))"]) end + end + os.execute("sleep " .. 1) loop_index = loop_index + 1 end -driver.close_stream(stream) - driver.close(conn) From ae294b98c2b58bffcdc7550cc579c279f073d57a Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 21 Sep 2022 15:15:01 +0800 Subject: [PATCH 29/69] enh(stream): blocklist do not copy --- source/common/src/tglobal.c | 11 +++++------ source/libs/executor/src/executor.c | 13 ++++++++----- source/libs/executor/src/scanoperator.c | 18 +++++++++++------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index a6e30ae0b5..80be8c6a35 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -58,7 +58,7 @@ int32_t tsNumOfMnodeFetchThreads = 1; int32_t tsNumOfMnodeReadThreads = 1; int32_t tsNumOfVnodeQueryThreads = 4; int32_t tsNumOfVnodeStreamThreads = 2; -int32_t tsNumOfVnodeFetchThreads = 4; +int32_t tsNumOfVnodeFetchThreads = 1; int32_t tsNumOfVnodeWriteThreads = 2; int32_t tsNumOfVnodeSyncThreads = 2; int32_t tsNumOfVnodeRsmaThreads = 2; @@ -162,8 +162,8 @@ int32_t tsMqRebalanceInterval = 2; int32_t tsTtlUnit = 86400; int32_t tsTtlPushInterval = 86400; int32_t tsGrantHBInterval = 60; -int32_t tsUptimeInterval = 300; // seconds -char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits +int32_t tsUptimeInterval = 300; // seconds +char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits #ifndef _STORAGE int32_t taosSetTfsCfg(SConfig *pCfg) { @@ -366,9 +366,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { tsNumOfVnodeStreamThreads = TMAX(tsNumOfVnodeStreamThreads, 4); if (cfgAddInt32(pCfg, "numOfVnodeStreamThreads", tsNumOfVnodeStreamThreads, 4, 1024, 0) != 0) return -1; - tsNumOfVnodeFetchThreads = tsNumOfCores / 4; - tsNumOfVnodeFetchThreads = TMAX(tsNumOfVnodeFetchThreads, 4); - if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 4, 1024, 0) != 0) return -1; + tsNumOfVnodeFetchThreads = 1; + if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 1, 1024, 0) != 0) return -1; tsNumOfVnodeWriteThreads = tsNumOfCores; tsNumOfVnodeWriteThreads = TMAX(tsNumOfVnodeWriteThreads, 1); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 45b88ec6a5..a36307de93 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -52,11 +52,11 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu // TODO: if a block was set but not consumed, // prevent setting a different type of block pInfo->validBlockIndex = 0; - if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) { - taosArrayClearP(pInfo->pBlockLists, taosMemoryFree); - } else { - taosArrayClear(pInfo->pBlockLists); - } + /*if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {*/ + /*taosArrayClearP(pInfo->pBlockLists, taosMemoryFree);*/ + /*} else {*/ + taosArrayClear(pInfo->pBlockLists); + /*}*/ if (type == STREAM_INPUT__MERGED_SUBMIT) { // ASSERT(numOfBlocks > 1); @@ -79,7 +79,9 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu } else if (type == STREAM_INPUT__DATA_BLOCK) { for (int32_t i = 0; i < numOfBlocks; ++i) { SSDataBlock* pDataBlock = &((SSDataBlock*)input)[i]; + taosArrayPush(pInfo->pBlockLists, &pDataBlock); +#if 0 // TODO optimize SSDataBlock* p = createOneDataBlock(pDataBlock, false); p->info = pDataBlock->info; @@ -87,6 +89,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu taosArrayClear(p->pDataBlock); taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock); taosArrayPush(pInfo->pBlockLists, &p); +#endif } pInfo->blockType = STREAM_INPUT__DATA_BLOCK; } else { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 4d16b2e170..8dcc2cd39b 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1602,26 +1602,30 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { } break; case STREAM_DELETE_DATA: { printDataBlock(pBlock, "stream scan delete recv"); + SSDataBlock* pDelBlock = NULL; if (pInfo->tqReader) { - SSDataBlock* pDelBlock = createSpecialDataBlock(STREAM_DELETE_DATA); + pDelBlock = createSpecialDataBlock(STREAM_DELETE_DATA); filterDelBlockByUid(pDelBlock, pBlock, pInfo); - pBlock = pDelBlock; + } else { + pDelBlock = pBlock; } - printDataBlock(pBlock, "stream scan delete recv filtered"); if (!isIntervalWindow(pInfo) && !isSessionWindow(pInfo) && !isStateWindow(pInfo)) { - generateDeleteResultBlock(pInfo, pBlock, pInfo->pDeleteDataRes); + generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes); pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; - printDataBlock(pBlock, "stream scan delete result"); + printDataBlock(pDelBlock, "stream scan delete result"); return pInfo->pDeleteDataRes; } else { pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; pInfo->updateResIndex = 0; - generateScanRange(pInfo, pBlock, pInfo->pUpdateRes); + generateScanRange(pInfo, pDelBlock, pInfo->pUpdateRes); prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex); copyDataBlock(pInfo->pDeleteDataRes, pInfo->pUpdateRes); pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA; pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE; - printDataBlock(pBlock, "stream scan delete data"); + printDataBlock(pDelBlock, "stream scan delete data"); + if (pInfo->tqReader) { + blockDataDestroy(pDelBlock); + } return pInfo->pDeleteDataRes; } } break; From 47b7aeabbc4cff145058c53238aa8c9f2ac119c0 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 21 Sep 2022 15:21:56 +0800 Subject: [PATCH 30/69] enh(tdb): more debug output for page's overflow cells --- source/libs/tdb/src/db/tdbPage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index 1e2eefabf4..f4878ea861 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -80,6 +80,7 @@ int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg) ASSERT(xFree); for (int iOvfl = 0; iOvfl < pPage->nOverflow; iOvfl++) { + tdbDebug("tdbPage/destroy/free ovfl cell: %p/%p", pPage->apOvfl[iOvfl], pPage); tdbOsFree(pPage->apOvfl[iOvfl]); } @@ -152,7 +153,7 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl pNewCell = (SCell *)tdbOsMalloc(szCell); memcpy(pNewCell, pCell, szCell); - tdbDebug("tdbPage/new ovfl cell: %p", pNewCell); + tdbDebug("tdbPage/insert/new ovfl cell: %p/%p", pNewCell, pPage); pPage->apOvfl[iOvfl] = pNewCell; pPage->aiOvfl[iOvfl] = idx; @@ -202,7 +203,7 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { if (pPage->aiOvfl[iOvfl] == idx) { // remove the over flow cell tdbOsFree(pPage->apOvfl[iOvfl]); - tdbDebug("tdbPage/free ovfl cell: %p", pPage->apOvfl[iOvfl]); + tdbDebug("tdbPage/drop/free ovfl cell: %p", pPage->apOvfl[iOvfl]); for (; (++iOvfl) < pPage->nOverflow;) { pPage->aiOvfl[iOvfl - 1] = pPage->aiOvfl[iOvfl] - 1; pPage->apOvfl[iOvfl - 1] = pPage->apOvfl[iOvfl]; @@ -255,6 +256,7 @@ void tdbPageCopy(SPage *pFromPage, SPage *pToPage, int deepCopyOvfl) { int szCell = (*pFromPage->xCellSize)(pFromPage, pFromPage->apOvfl[iOvfl], 0, NULL, NULL); pNewCell = (SCell *)tdbOsMalloc(szCell); memcpy(pNewCell, pFromPage->apOvfl[iOvfl], szCell); + tdbDebug("tdbPage/copy/new ovfl cell: %p/%p/%p", pNewCell, pToPage, pFromPage); } pToPage->apOvfl[iOvfl] = pNewCell; From e7526a081b5ac5139b9d5d33bd34900b2c4da14b Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 21 Sep 2022 16:26:43 +0800 Subject: [PATCH 31/69] test:modify testcase of data Compatibility --- tests/system-test/0-others/compatibility.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 2b059615e9..25b023bb76 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -48,7 +48,7 @@ class TDTestCase: selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): - cfgPath = buildPath + "/../community/sim/dnode1/cfg/" + cfgPath = buildPath + "/../sim/dnode1/cfg/" else: cfgPath = buildPath + "/../sim/dnode1/cfg/" @@ -143,9 +143,12 @@ class TDTestCase: tdsql.query("select * from db.ct4") tdsql.checkData(0,1,14) tdsql.query("describe information_schema.ins_databases;") - # for i in tdsql.queryResult[i][0]: - # tdsql.checkData(0,1,13) - + qRows=tdsql.queryRows + for i in range(qRows) : + if tdsql.queryResult[i][0]=="retentions" : + return True + else: + return False def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") From 5ca1dc10056801ca776e26602aede1b8231a50e7 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 21 Sep 2022 14:24:26 +0800 Subject: [PATCH 32/69] fix(stream): free array --- source/libs/executor/src/scanoperator.c | 1 + source/libs/executor/src/timewindowoperator.c | 40 +++---------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 4d16b2e170..18a75f0d04 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1687,6 +1687,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { while (1) { if (pInfo->tqReader->pMsg == NULL) { if (pInfo->validBlockIndex >= totBlockNum) { + updateInfoDestoryColseWinSBF(pInfo->pUpdateInfo); return NULL; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index aed4ae9b26..971f3618a0 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1695,6 +1695,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { } nodesDestroyNode((SNode*)pInfo->pPhyNode); colDataDestroy(&pInfo->twAggSup.timeWindowData); + cleanupGroupResInfo(&pInfo->groupResInfo); taosMemoryFreeClear(param); } @@ -3073,6 +3074,7 @@ void processPullOver(SSDataBlock* pBlock, SHashObj* pMap) { taosArrayRemove(chArray, index); if (taosArrayGetSize(chArray) == 0) { // pull data is over + taosArrayDestroy(chArray); taosHashRemove(pMap, &winRes, sizeof(SWinKey)); } } @@ -3109,9 +3111,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { SStreamFinalIntervalOperatorInfo* pInfo = pOperator->info; SOperatorInfo* downstream = pOperator->pDownstream[0]; - SArray* pUpdated = taosArrayInit(4, POINTER_BYTES); - _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); - SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK); TSKEY maxTs = INT64_MIN; TSKEY minTs = INT64_MAX; @@ -3175,6 +3174,9 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { } } + SArray* pUpdated = taosArrayInit(4, POINTER_BYTES); + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK); while (1) { SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); if (pBlock == NULL) { @@ -5755,8 +5757,6 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK); - SStreamState* pState = pTaskInfo->streamInfo.pState; - while (1) { SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); if (pBlock == NULL) { @@ -5805,36 +5805,6 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { } pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs); pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, minTs); - -#if 0 - if (pState) { - printf(">>>>>>>> stream read backend\n"); - SWinKey key = { - .ts = 1, - .groupId = 2, - }; - char* val = NULL; - int32_t sz; - if (streamStateGet(pState, &key, (void**)&val, &sz) < 0) { - ASSERT(0); - } - printf("stream read %s %d\n", val, sz); - streamFreeVal(val); - - SStreamStateCur* pCur = streamStateGetCur(pState, &key); - ASSERT(pCur); - while (streamStateCurNext(pState, pCur) == 0) { - SWinKey key1; - const void* val1; - if (streamStateGetKVByCur(pCur, &key1, &val1, &sz) < 0) { - break; - } - printf("stream iter key groupId:%d ts:%d, value %s %d\n", key1.groupId, key1.ts, val1, sz); - } - streamStateFreeCur(pCur); - } -#endif - pOperator->status = OP_RES_TO_RETURN; closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pUpdatedMap, pOperator); From 5116e0a01b5f619e129a92808d6192bea9c1632b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 21 Sep 2022 17:04:12 +0800 Subject: [PATCH 33/69] enh: added memory allocators for parser and planner --- include/libs/nodes/nodes.h | 17 ++- include/libs/parser/parser.h | 1 + include/libs/planner/planner.h | 1 + source/client/src/clientEnv.c | 2 +- source/client/src/clientImpl.c | 8 +- source/client/src/clientMain.c | 8 +- source/libs/nodes/src/nodesUtilFuncs.c | 148 ++++++++++++++-------- source/libs/parser/src/parser.c | 19 ++- source/libs/planner/src/planner.c | 6 +- source/libs/planner/test/planTestMain.cpp | 2 + source/libs/planner/test/planTestUtil.cpp | 14 +- source/libs/scheduler/src/schJob.c | 4 +- 12 files changed, 143 insertions(+), 87 deletions(-) diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 3d5b04ddf4..634dae9ec5 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -277,15 +277,14 @@ typedef struct SNodeList { typedef struct SNodeAllocator SNodeAllocator; -int32_t nodesCreateNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator); -void nodesDestroyNodeAllocator(void* pAllocator); -void nodesResetThreadLevelAllocator(SNodeAllocator* pAllocator); - -int32_t nodesAllocatorInit(); -int32_t nodesCreateAllocator(int32_t chunkSize, int64_t* pRefId); -void nodesDestroyAllocator(int64_t refId); -void nodesResetAllocator(int64_t refId); -int64_t nodesIncAllocatorRefCount(int64_t refId); +int32_t nodesInitAllocatorSet(); +void nodesDestroyAllocatorSet(); +int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId); +int32_t nodesAcquireAllocator(int64_t allocatorId); +int32_t nodesReleaseAllocator(int64_t allocatorId); +int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId); +int64_t nodesReleaseAllocatorWeakRef(int64_t allocatorId); +void nodesDestroyAllocator(int64_t allocatorId); SNode* nodesMakeNode(ENodeType type); void nodesDestroyNode(SNode* pNode); diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 95bde85864..b1a937910d 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -56,6 +56,7 @@ typedef struct SParseContext { bool nodeOffline; SArray* pTableMetaPos; // sql table pos => catalog data pos SArray* pTableVgroupPos; // sql table pos => catalog data pos + int64_t allocatorId; } SParseContext; int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery); diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index e03ac3811a..e52fe39527 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -39,6 +39,7 @@ typedef struct SPlanContext { int32_t msgLen; const char* pUser; bool sysInfo; + int64_t allocatorId; } SPlanContext; // Create the physical plan for the query, according to the AST. diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 5019314fed..2faf268880 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -413,7 +413,7 @@ void taos_init_imp(void) { initTaskQueue(); fmFuncMgtInit(); - nodesAllocatorInit(); + nodesInitAllocatorSet(); clientConnRefPool = taosOpenRef(200, destroyTscObj); clientReqRefPool = taosOpenRef(40960, doDestroyRequest); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c0809ca822..ef19eba7fe 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -197,7 +197,8 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, (*pRequest)->allocatorRefId = -1; if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) { - if (TSDB_CODE_SUCCESS != nodesCreateAllocator(tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) { + if (TSDB_CODE_SUCCESS != + nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) { tscError("%d failed to create node allocator, reqId:0x%" PRIx64 ", conn:%d, %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); @@ -1035,7 +1036,8 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM .pMsg = pRequest->msgBuf, .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, .pUser = pRequest->pTscObj->user, - .sysInfo = pRequest->pTscObj->sysInfo}; + .sysInfo = pRequest->pTscObj->sysInfo, + .allocatorId = pRequest->allocatorRefId}; SAppInstInfo* pAppInfo = getAppInfo(pRequest); SQueryPlan* pDag = NULL; @@ -1047,8 +1049,6 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM pRequest->body.subplanNum = pDag->numOfSubplans; } - nodesResetAllocator(-1); - pRequest->metric.planEnd = taosGetTimestampUs(); if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) { diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index a03b6cd5a5..ae386b819c 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -700,8 +700,6 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { pRequest->metric.ctgEnd = taosGetTimestampUs(); - nodesResetAllocator(pRequest->allocatorRefId); - if (code == TSDB_CODE_SUCCESS) { code = qAnalyseSqlSemantic(pWrapper->pCtx, &pWrapper->catalogReq, pResultMeta, pQuery); pRequest->stableQuery = pQuery->stableQuery; @@ -731,7 +729,6 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { } else { destorySqlParseWrapper(pWrapper); qDestroyQuery(pQuery); - nodesResetAllocator(-1); if (NEED_CLIENT_HANDLE_ERROR(code)) { tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); @@ -778,7 +775,8 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) { .enableSysInfo = pTscObj->sysInfo, .async = true, .svrVer = pTscObj->sVer, - .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes)}; + .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes), + .allocatorId = pRequest->allocatorRefId}; return TSDB_CODE_SUCCESS; } @@ -804,13 +802,11 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } SQuery *pQuery = NULL; - nodesResetAllocator(pRequest->allocatorRefId); pRequest->metric.syntaxStart = taosGetTimestampUs(); SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)}; code = qParseSqlSyntax(pCxt, &pQuery, &catalogReq); - nodesResetAllocator(-1); if (code != TSDB_CODE_SUCCESS) { goto _error; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 480d2cce72..2e5a0d935b 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -32,29 +32,16 @@ typedef struct SNodeMemChunk { typedef struct SNodeAllocator { int64_t self; + int64_t queryId; int32_t chunkSize; int32_t chunkNum; SNodeMemChunk* pCurrChunk; SNodeMemChunk* pChunks; + TdThreadMutex mutex; } SNodeAllocator; -static threadlocal SNodeAllocator* pNodeAllocator; -static int32_t allocatorReqRefPool = -1; - -int32_t nodesAllocatorInit() { - if (allocatorReqRefPool >= 0) { - nodesWarn("nodes already initialized"); - return TSDB_CODE_SUCCESS; - } - - allocatorReqRefPool = taosOpenRef(40960, nodesDestroyNodeAllocator); - if (allocatorReqRefPool < 0) { - nodesError("init nodes failed"); - return TSDB_CODE_OUT_OF_MEMORY; - } - - return TSDB_CODE_SUCCESS; -} +static threadlocal SNodeAllocator* g_pNodeAllocator; +static int32_t g_allocatorReqRefPool = -1; static SNodeMemChunk* callocNodeChunk(SNodeAllocator* pAllocator) { SNodeMemChunk* pNewChunk = taosMemoryCalloc(1, sizeof(SNodeMemChunk) + pAllocator->chunkSize); @@ -77,17 +64,17 @@ static SNodeMemChunk* callocNodeChunk(SNodeAllocator* pAllocator) { } static void* nodesCallocImpl(int32_t size) { - if (NULL == pNodeAllocator) { + if (NULL == g_pNodeAllocator) { return taosMemoryCalloc(1, size); } - if (pNodeAllocator->pCurrChunk->usedSize + size > pNodeAllocator->pCurrChunk->availableSize) { - if (NULL == callocNodeChunk(pNodeAllocator)) { + if (g_pNodeAllocator->pCurrChunk->usedSize + size > g_pNodeAllocator->pCurrChunk->availableSize) { + if (NULL == callocNodeChunk(g_pNodeAllocator)) { return NULL; } } - void* p = pNodeAllocator->pCurrChunk->pBuf + pNodeAllocator->pCurrChunk->usedSize; - pNodeAllocator->pCurrChunk->usedSize += size; + void* p = g_pNodeAllocator->pCurrChunk->pBuf + g_pNodeAllocator->pCurrChunk->usedSize; + g_pNodeAllocator->pCurrChunk->usedSize += size; return p; } @@ -96,7 +83,7 @@ static void* nodesCalloc(int32_t num, int32_t size) { if (NULL == p) { return NULL; } - *(char*)p = (NULL != pNodeAllocator) ? 1 : 0; + *(char*)p = (NULL != g_pNodeAllocator) ? 1 : 0; return (char*)p + 1; } @@ -108,7 +95,7 @@ static void nodesFree(void* p) { return; } -int32_t nodesCreateNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator) { +static int32_t createNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator) { *pAllocator = taosMemoryCalloc(1, sizeof(SNodeAllocator)); if (NULL == *pAllocator) { return TSDB_CODE_OUT_OF_MEMORY; @@ -118,18 +105,19 @@ int32_t nodesCreateNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator) taosMemoryFreeClear(*pAllocator); return TSDB_CODE_OUT_OF_MEMORY; } + taosThreadMutexInit(&(*pAllocator)->mutex, NULL); return TSDB_CODE_SUCCESS; } -void nodesDestroyNodeAllocator(void* p) { +static void destroyNodeAllocator(void* p) { if (NULL == p) { return; } SNodeAllocator* pAllocator = p; - nodesDebug("alloc chunkNum: %d, chunkTotakSize: %d", pAllocator->chunkNum, - pAllocator->chunkNum * pAllocator->chunkSize); + nodesDebug("query id %" PRIx64 " allocator id %" PRIx64 " alloc chunkNum: %d, chunkTotakSize: %d", + pAllocator->queryId, pAllocator->self, pAllocator->chunkNum, pAllocator->chunkNum * pAllocator->chunkSize); SNodeMemChunk* pChunk = pAllocator->pChunks; while (NULL != pChunk) { @@ -137,43 +125,101 @@ void nodesDestroyNodeAllocator(void* p) { taosMemoryFree(pChunk); pChunk = pTemp; } + taosThreadMutexDestroy(&pAllocator->mutex); taosMemoryFree(pAllocator); } -void nodesResetThreadLevelAllocator(SNodeAllocator* pAllocator) { pNodeAllocator = pAllocator; } +int32_t nodesInitAllocatorSet() { + if (g_allocatorReqRefPool >= 0) { + nodesWarn("nodes already initialized"); + return TSDB_CODE_SUCCESS; + } -int32_t nodesCreateAllocator(int32_t chunkSize, int64_t* pRefId) { + g_allocatorReqRefPool = taosOpenRef(1024, destroyNodeAllocator); + if (g_allocatorReqRefPool < 0) { + nodesError("init nodes failed"); + return TSDB_CODE_OUT_OF_MEMORY; + } + + return TSDB_CODE_SUCCESS; +} + +void nodesDestroyAllocatorSet() { + if (g_allocatorReqRefPool >= 0) { + SNodeAllocator* pAllocator = taosIterateRef(g_allocatorReqRefPool, 0); + int64_t refId = 0; + while (NULL != pAllocator) { + refId = pAllocator->self; + taosRemoveRef(g_allocatorReqRefPool, refId); + pAllocator = taosIterateRef(g_allocatorReqRefPool, refId); + } + taosCloseRef(g_allocatorReqRefPool); + } +} + +int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId) { SNodeAllocator* pAllocator = NULL; - int32_t code = nodesCreateNodeAllocator(chunkSize, &pAllocator); + int32_t code = createNodeAllocator(chunkSize, &pAllocator); if (TSDB_CODE_SUCCESS == code) { - pAllocator->self = taosAddRef(allocatorReqRefPool, pAllocator); - *pRefId = pAllocator->self; + pAllocator->self = taosAddRef(g_allocatorReqRefPool, pAllocator); + if (pAllocator->self <= 0) { + return terrno; + } + pAllocator->queryId = queryId; + *pAllocatorId = pAllocator->self; } return code; } -void nodesDestroyAllocator(int64_t refId) { - if (refId <= 0) { +int32_t nodesAcquireAllocator(int64_t allocatorId) { + if (allocatorId <= 0) { + return TSDB_CODE_SUCCESS; + } + + SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId); + if (NULL == pAllocator) { + return terrno; + } + taosThreadMutexLock(&pAllocator->mutex); + g_pNodeAllocator = pAllocator; + return TSDB_CODE_SUCCESS; +} + +int32_t nodesReleaseAllocator(int64_t allocatorId) { + if (allocatorId <= 0) { + return TSDB_CODE_SUCCESS; + } + + if (NULL == g_pNodeAllocator) { + nodesError("allocator id %" PRIx64 + " release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator " + "function is called!", + allocatorId); + return TSDB_CODE_FAILED; + } + SNodeAllocator* pAllocator = g_pNodeAllocator; + g_pNodeAllocator = NULL; + taosThreadMutexUnlock(&pAllocator->mutex); + return taosReleaseRef(g_allocatorReqRefPool, allocatorId); +} + +int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) { + if (allocatorId <= 0) { + return 0; + } + + SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId); + return pAllocator->self; +} + +int64_t nodesReleaseAllocatorWeakRef(int64_t allocatorId) { return taosReleaseRef(g_allocatorReqRefPool, allocatorId); } + +void nodesDestroyAllocator(int64_t allocatorId) { + if (allocatorId <= 0) { return; } - taosReleaseRef(allocatorReqRefPool, refId); -} -void nodesResetAllocator(int64_t refId) { - if (refId <= 0) { - pNodeAllocator = NULL; - } else { - pNodeAllocator = taosAcquireRef(allocatorReqRefPool, refId); - taosReleaseRef(allocatorReqRefPool, refId); - } -} - -int64_t nodesIncAllocatorRefCount(int64_t refId) { - if (refId <= 0) { - return -1; - } - SNodeAllocator* pAllocator = taosAcquireRef(allocatorReqRefPool, refId); - return pAllocator->self; + taosRemoveRef(g_allocatorReqRefPool, allocatorId); } static SNode* makeNode(ENodeType type, int32_t size) { diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index 7ee6a5b223..940c676689 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -177,15 +177,18 @@ int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery) { int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq) { SParseMetaCache metaCache = {0}; - int32_t code = TSDB_CODE_SUCCESS; - if (qIsInsertValuesSql(pCxt->pSql, pCxt->sqlLen)) { - code = parseInsertSyntax(pCxt, pQuery, &metaCache); - } else { - code = parseSqlSyntax(pCxt, pQuery, &metaCache); + int32_t code = nodesAcquireAllocator(pCxt->allocatorId); + if (TSDB_CODE_SUCCESS == code) { + if (qIsInsertValuesSql(pCxt->pSql, pCxt->sqlLen)) { + code = parseInsertSyntax(pCxt, pQuery, &metaCache); + } else { + code = parseSqlSyntax(pCxt, pQuery, &metaCache); + } } if (TSDB_CODE_SUCCESS == code) { code = buildCatalogReq(pCxt, &metaCache, pCatalogReq); } + code = nodesReleaseAllocator(pCxt->allocatorId); destoryParseMetaCache(&metaCache, true); terrno = code; return code; @@ -194,7 +197,10 @@ int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq, const struct SMetaData* pMetaData, SQuery* pQuery) { SParseMetaCache metaCache = {0}; - int32_t code = putMetaDataToCache(pCatalogReq, pMetaData, &metaCache, NULL == pQuery->pRoot); + int32_t code = nodesAcquireAllocator(pCxt->allocatorId); + if (TSDB_CODE_SUCCESS == code) { + code = putMetaDataToCache(pCatalogReq, pMetaData, &metaCache, NULL == pQuery->pRoot); + } if (TSDB_CODE_SUCCESS == code) { if (NULL == pQuery->pRoot) { code = parseInsertSql(pCxt, &pQuery, &metaCache); @@ -202,6 +208,7 @@ int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCata code = analyseSemantic(pCxt, pQuery, &metaCache); } } + code = nodesReleaseAllocator(pCxt->allocatorId); destoryParseMetaCache(&metaCache, false); terrno = code; return code; diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index 35903d45b1..0b6128ddec 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -33,7 +33,10 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo SLogicSubplan* pLogicSubplan = NULL; SQueryLogicPlan* pLogicPlan = NULL; - int32_t code = createLogicPlan(pCxt, &pLogicSubplan); + int32_t code = nodesAcquireAllocator(pCxt->allocatorId); + if (TSDB_CODE_SUCCESS == code) { + code = createLogicPlan(pCxt, &pLogicSubplan); + } if (TSDB_CODE_SUCCESS == code) { code = optimizeLogicPlan(pCxt, pLogicSubplan); } @@ -49,6 +52,7 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo if (TSDB_CODE_SUCCESS == code) { dumpQueryPlan(*pPlan); } + code = nodesReleaseAllocator(pCxt->allocatorId); nodesDestroyNode((SNode*)pLogicSubplan); nodesDestroyNode((SNode*)pLogicPlan); diff --git a/source/libs/planner/test/planTestMain.cpp b/source/libs/planner/test/planTestMain.cpp index e86bf90f51..df6e72ce46 100644 --- a/source/libs/planner/test/planTestMain.cpp +++ b/source/libs/planner/test/planTestMain.cpp @@ -32,6 +32,7 @@ class PlannerEnv : public testing::Environment { generateMetaData(); initLog(TD_TMP_DIR_PATH "td"); initCfg(); + nodesInitAllocatorSet(); } virtual void TearDown() { @@ -39,6 +40,7 @@ class PlannerEnv : public testing::Environment { qCleanupKeywordsTable(); fmFuncMgtDestroy(); taosCloseLog(); + nodesDestroyAllocatorSet(); } PlannerEnv() {} diff --git a/source/libs/planner/test/planTestUtil.cpp b/source/libs/planner/test/planTestUtil.cpp index 65aed6cadc..73d695195c 100644 --- a/source/libs/planner/test/planTestUtil.cpp +++ b/source/libs/planner/test/planTestUtil.cpp @@ -129,10 +129,10 @@ class PlannerTestBaseImpl { } void runImpl(const string& sql, int32_t queryPolicy) { - SNodeAllocator* pAllocator = NULL; + int64_t allocatorId = 0; if (g_useNodeAllocator) { - nodesCreateNodeAllocator(32 * 1024, &pAllocator); - nodesResetThreadLevelAllocator(pAllocator); + nodesCreateAllocator(sqlNo_, 32 * 1024, &allocatorId); + nodesAcquireAllocator(allocatorId); } reset(); @@ -166,13 +166,13 @@ class PlannerTestBaseImpl { dump(g_dumpModule); } catch (...) { dump(DUMP_MODULE_ALL); - nodesDestroyNodeAllocator(pAllocator); - nodesResetThreadLevelAllocator(NULL); + nodesReleaseAllocator(allocatorId); + nodesDestroyAllocator(allocatorId); throw; } - nodesDestroyNodeAllocator(pAllocator); - nodesResetThreadLevelAllocator(NULL); + nodesReleaseAllocator(allocatorId); + nodesDestroyAllocator(allocatorId); } void prepare(const string& sql) { diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 345f4680b0..9880490594 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -673,7 +673,7 @@ void schFreeJobImpl(void *job) { destroyQueryExecRes(&pJob->execRes); qDestroyQueryPlan(pJob->pDag); - nodesDestroyAllocator(pJob->allocatorRefId); + nodesReleaseAllocatorWeakRef(pJob->allocatorRefId); taosMemoryFreeClear(pJob->userRes.execRes); taosMemoryFreeClear(pJob->fetchRes); @@ -725,7 +725,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { pJob->sql = strdup(pReq->sql); } pJob->pDag = pReq->pDag; - pJob->allocatorRefId = nodesIncAllocatorRefCount(pReq->allocatorRefId); + pJob->allocatorRefId = nodesMakeAllocatorWeakRef(pReq->allocatorRefId); pJob->chkKillFp = pReq->chkKillFp; pJob->chkKillParam = pReq->chkKillParam; pJob->userRes.execFp = pReq->execFp; From 5680c03c1783db19eb313e471558972c444f7230 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 21 Sep 2022 17:07:22 +0800 Subject: [PATCH 34/69] enh: added memory allocators for parser and planner --- source/client/src/clientMain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index ae386b819c..6b707bf7a0 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -65,6 +65,7 @@ void taos_cleanup(void) { fmFuncMgtDestroy(); qCleanupKeywordsTable(); + nodesDestroyAllocatorSet(); id = clientConnRefPool; clientConnRefPool = -1; From 62f5c1e465217c7fb8e83f8d1598d0e49326b3a0 Mon Sep 17 00:00:00 2001 From: dingbo Date: Wed, 21 Sep 2022 17:31:19 +0800 Subject: [PATCH 35/69] docs: release 3.0.1.2 --- docs/en/28-releases/01-tdengine.md | 3 +++ docs/en/28-releases/02-tools.md | 4 ++++ docs/zh/28-releases/01-tdengine.md | 3 +++ docs/zh/28-releases/02-tools.md | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index e3901114d3..414986d107 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -6,6 +6,9 @@ description: TDengine release history, Release Notes and download links. import Release from "/components/ReleaseV3"; +## 3.0.1.2 + + ## 3.0.1.1 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 228990df3b..086d3adea2 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -6,6 +6,10 @@ description: taosTools release history, Release Notes, download links. import Release from "/components/ReleaseV3"; +## 2.2.2 + + + ## 2.2.0 diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index 59a241b6c8..b05cf7a942 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -6,6 +6,9 @@ description: TDengine 发布历史、Release Notes 及下载链接 import Release from "/components/ReleaseV3"; +## 3.0.1.2 + + ## 3.0.1.1 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 9ff8f42224..f793981d06 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -6,6 +6,10 @@ description: taosTools 的发布历史、Release Notes 和下载链接 import Release from "/components/ReleaseV3"; +## 2.2.2 + + + ## 2.2.0 From 876303be5621c6b84b41bf5f8c24a851035ece40 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 21 Sep 2022 17:42:03 +0800 Subject: [PATCH 36/69] enh: added memory allocators for parser and planner --- source/libs/parser/src/parser.c | 4 ++-- source/libs/planner/src/planner.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index 940c676689..2fe6ebfb79 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -188,7 +188,7 @@ int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq if (TSDB_CODE_SUCCESS == code) { code = buildCatalogReq(pCxt, &metaCache, pCatalogReq); } - code = nodesReleaseAllocator(pCxt->allocatorId); + nodesReleaseAllocator(pCxt->allocatorId); destoryParseMetaCache(&metaCache, true); terrno = code; return code; @@ -208,7 +208,7 @@ int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCata code = analyseSemantic(pCxt, pQuery, &metaCache); } } - code = nodesReleaseAllocator(pCxt->allocatorId); + nodesReleaseAllocator(pCxt->allocatorId); destoryParseMetaCache(&metaCache, false); terrno = code; return code; diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index 0b6128ddec..e4f02f12e6 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -52,7 +52,7 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo if (TSDB_CODE_SUCCESS == code) { dumpQueryPlan(*pPlan); } - code = nodesReleaseAllocator(pCxt->allocatorId); + nodesReleaseAllocator(pCxt->allocatorId); nodesDestroyNode((SNode*)pLogicSubplan); nodesDestroyNode((SNode*)pLogicPlan); From c5d659286b3fb740d4ca671c02532307e9bed808 Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 21 Sep 2022 18:01:03 +0800 Subject: [PATCH 37/69] test: modify checkpackages scritps --- packaging/testpackage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index 794b3968fe..f604def9c4 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -202,8 +202,8 @@ elif [[ ${packgeName} =~ "tar" ]];then cd ${oriInstallPath}/${originTdpPath} && tar xf ${subFile} fi - cd ${oriInstallPath}/${originTdpPath} && tree > ${installPath}/base_${originversion}_checkfile - cd ${installPath}/${tdPath} && tree > ${installPath}/now_${version}_checkfile + cd ${oriInstallPath}/${originTdpPath} && tree -I "driver" > ${installPath}/base_${originversion}_checkfile + cd ${installPath}/${tdPath} && tree -I "driver" > ${installPath}/now_${version}_checkfile cd ${installPath} diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log From e8a4f50c0a65559f7055b048693cb0754769316e Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 21 Sep 2022 18:50:25 +0800 Subject: [PATCH 38/69] modify checkpackages scritps of muti-platform tes --- packaging/testpackage.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index f604def9c4..20f93ecaec 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -215,6 +215,7 @@ elif [[ ${packgeName} =~ "tar" ]];then exit -1 else echoColor G "The number and names of files are the same as previous installation packages" + rm -rf ${installPath}/diffFile.log fi echoColor YD "===== install Package of tar =====" cd ${installPath}/${tdPath} @@ -251,6 +252,9 @@ if [[ ${packgeName} =~ "server" ]] ;then systemctl restart taosd fi +rm -rf ${installPath}/${packgeName} +rm -rf ${installPath}/${tdPath}/ + # if ([[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "tar" ]]) || [[ ${packgeName} =~ "client" ]] ;then # echoColor G "===== install taos-tools when package is lite or client =====" # cd ${installPath} From 7ade2b3b8d1d29ca73fbd68b2f2de384c2a75749 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 21 Sep 2022 16:00:05 +0800 Subject: [PATCH 39/69] fix double free in sma --- source/dnode/vnode/src/tq/tq.c | 3 ++ source/libs/executor/src/executor.c | 21 ++++++++------ source/libs/executor/src/scanoperator.c | 28 +++++++++++++++++-- source/libs/executor/src/timewindowoperator.c | 1 - 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 29217e29a4..76f3c1b12d 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -479,6 +479,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { tqInitDataRsp(&dataRsp, pReq, pHandle->execHandle.subType); tqScanData(pTq, pHandle, &dataRsp, &fetchOffsetNew); +#if 1 + +#endif if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) { code = -1; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index a36307de93..8d2c66ff90 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -49,14 +49,19 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu SStreamScanInfo* pInfo = pOperator->info; +#if 0 // TODO: if a block was set but not consumed, // prevent setting a different type of block pInfo->validBlockIndex = 0; - /*if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {*/ - /*taosArrayClearP(pInfo->pBlockLists, taosMemoryFree);*/ - /*} else {*/ - taosArrayClear(pInfo->pBlockLists); - /*}*/ + if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) { + taosArrayClearP(pInfo->pBlockLists, taosMemoryFree); + } else { + taosArrayClear(pInfo->pBlockLists); + } +#endif + + ASSERT(pInfo->validBlockIndex == 0); + ASSERT(taosArrayGetSize(pInfo->pBlockLists) == 0); if (type == STREAM_INPUT__MERGED_SUBMIT) { // ASSERT(numOfBlocks > 1); @@ -79,17 +84,15 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu } else if (type == STREAM_INPUT__DATA_BLOCK) { for (int32_t i = 0; i < numOfBlocks; ++i) { SSDataBlock* pDataBlock = &((SSDataBlock*)input)[i]; - taosArrayPush(pInfo->pBlockLists, &pDataBlock); -#if 0 // TODO optimize SSDataBlock* p = createOneDataBlock(pDataBlock, false); + /*qError("alloc p i, %d %p", i, p);*/ p->info = pDataBlock->info; taosArrayClear(p->pDataBlock); taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock); taosArrayPush(pInfo->pBlockLists, &p); -#endif } pInfo->blockType = STREAM_INPUT__DATA_BLOCK; } else { @@ -103,6 +106,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu static FORCE_INLINE void streamInputBlockDataDestory(void* pBlock) { blockDataDestroy((SSDataBlock*)pBlock); } void tdCleanupStreamInputDataBlock(qTaskInfo_t tinfo) { +#if 0 SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; if (!pTaskInfo || !pTaskInfo->pRoot || pTaskInfo->pRoot->numOfDownstream <= 0) { return; @@ -119,6 +123,7 @@ void tdCleanupStreamInputDataBlock(qTaskInfo_t tinfo) { } else { ASSERT(0); } +#endif } int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8dcc2cd39b..dc9e0e8d45 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -920,6 +920,17 @@ _error: } static void doClearBufferedBlocks(SStreamScanInfo* pInfo) { + if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) { + size_t total = taosArrayGetSize(pInfo->pBlockLists); + for (int32_t i = 0; i < total; i++) { + SSDataBlock* p = taosArrayGetP(pInfo->pBlockLists, i); + taosArrayDestroy(p->pDataBlock); + taosMemoryFree(p); + } + } + taosArrayClear(pInfo->pBlockLists); + pInfo->validBlockIndex = 0; +#if 0 size_t total = taosArrayGetSize(pInfo->pBlockLists); pInfo->validBlockIndex = 0; @@ -928,6 +939,7 @@ static void doClearBufferedBlocks(SStreamScanInfo* pInfo) { blockDataDestroy(p); } taosArrayClear(pInfo->pBlockLists); +#endif } static bool isSessionWindow(SStreamScanInfo* pInfo) { @@ -1576,9 +1588,10 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { size_t total = taosArrayGetSize(pInfo->pBlockLists); // TODO: refactor +FETCH_NEXT_BLOCK: if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) { if (pInfo->validBlockIndex >= total) { - /*doClearBufferedBlocks(pInfo);*/ + doClearBufferedBlocks(pInfo); /*pOperator->status = OP_EXEC_DONE;*/ return NULL; } @@ -1613,7 +1626,11 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes); pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; printDataBlock(pDelBlock, "stream scan delete result"); - return pInfo->pDeleteDataRes; + if (pInfo->pDeleteDataRes->info.rows > 0) { + return pInfo->pDeleteDataRes; + } else { + goto FETCH_NEXT_BLOCK; + } } else { pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; pInfo->updateResIndex = 0; @@ -1626,7 +1643,11 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { if (pInfo->tqReader) { blockDataDestroy(pDelBlock); } - return pInfo->pDeleteDataRes; + if (pInfo->pDeleteDataRes->info.rows > 0) { + return pInfo->pDeleteDataRes; + } else { + goto FETCH_NEXT_BLOCK; + } } } break; default: @@ -1691,6 +1712,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { while (1) { if (pInfo->tqReader->pMsg == NULL) { if (pInfo->validBlockIndex >= totBlockNum) { + doClearBufferedBlocks(pInfo); return NULL; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index aed4ae9b26..f10e5e33f1 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -5655,7 +5655,6 @@ static void doStreamIntervalAggImpl2(SOperatorInfo* pOperatorInfo, SSDataBlock* TSKEY* tsCols = NULL; SResultRow* pResult = NULL; int32_t forwardRows = 0; - int32_t aa = 4; ASSERT(pSDataBlock->pDataBlock != NULL); SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); From 16be3ca310777b9159c640b77370af0defba0201 Mon Sep 17 00:00:00 2001 From: robotspace Date: Wed, 21 Sep 2022 23:04:48 +0800 Subject: [PATCH 40/69] Remove error about stream in lua test case. (#16990) --- examples/lua/OpenResty/so/luaconnector51.so | Bin 22472 -> 17672 bytes examples/lua/lua51/lua_connector51.c | 73 +------------------- examples/lua/test.lua | 21 ++---- 3 files changed, 9 insertions(+), 85 deletions(-) diff --git a/examples/lua/OpenResty/so/luaconnector51.so b/examples/lua/OpenResty/so/luaconnector51.so index 442de6e39f909e1aeb869988722b84795c048855..168d3a9d2406680ceec3c12f29a8157d19aca2ff 100755 GIT binary patch literal 17672 zcmeHPeQ;dWb$=_{AdK+}upGw*yf}Oq1B+~8Vm@3}w$@&#O@y(Slq9oS?LJA1SG!{O z3EOl45rbi)D5H{;q?u{sbW&G^HWf4wL5mSzwji`42zV5lx~egZwwOfN1QcSd{?5JU zyuG{LM>?7Qk?H7a_MLlv_ndRjJ@>x*-n;Kz-5uVruFB`LB+an?$SQJ{72<;7)gnRI zD(h4n&$iA|vNMZCC*}6FS1d5?ZazC?Cnse)gxF*0G$>a=lU3E2rnN zo=_DFU^l((Bz~Xz8dPrxpY@Yi=E{ngUQ*B zlj&4=JZr}s+fh!DJs77VCzi=Ya_wO3Hm(9zi+)j| z;R~^;WLvw_m9w*nm=j~CIx}P;tE;%J%g%0hYfEQzR@sCvU1|2D)pp|Th!8@M(;~6f zR`_WrqS?&Woa-AmST#lKr0jH?(_WM?qeUL3lPRT5@lg>mbYYtP$=Y@_Yv;OBjup#o zPsgLm?`S-hO0~q|Ta<-tY%3y}RCy|(%m!$+S{>jracxQ~#xxU8Wpb*6Go5xi3V9BH zCcARER;K`WrQ`5F*+QNLbD1EDk}Yw{U16=?aNU}<(G|fJ!Id;5aoyv;Vonf~etM}X zsZRhxwi@SB*TN(&wN=(Vz$nRmliat|ovHC{e19bP1W%IPWw`LW%JBUGZKuBszmn|_ zl;H&mEnh2UhZeb&jV*^`H?dD!z@2qhEJZ&_OI2H?j6+qtY)oY1E0$n zkr4x@`wmH?25w$g#tghxgh3aCG;=ZtPgx2G7&v#8!j~Gj+~QI}oq^N+l%!Q5og@3y zHc6q7&Jj*ONs*Aw5hgJuq%lNCEi3nG#D6J7M~%M48`YM1FtslB?ew&;GZ+_1qObefd>ryd;?!<;1?Kpoq=Cy;HwOL zse%80%O3Tg^KoRy;p#}wtVb`itjK*sPSw;%WXB8D&#R_Rtvm>L>ik1E`WJ_gBfg!= z3S(19=f6q3kN6SAzeao&@k5G#nRuFV3ImFNj(D1C3cD2l6!A257Wx$b81Xda6uK4v zF!3~83Z07oYvO5&DKsnod&JY!QfO5CgT&7!KBV}s6Hik~p-%B%Bc7&^LO}6%5KmJ_ zp+@mp;%Uk*Sc<=uct7zI#{rz*LOe|!g)zn7LOe|wg%QPXBK{2GhZKK3@icW51{A-B zc$zW_yA*#F@ibKw`V_x{c$y*#-HKmEJWUOSPQ@=Fo~DFCv*H&LPg6mmQSoOGPg6i4 zr1;sy)2UymQ+yTibjlY3ivKtWo=){bjpC0GPp5dnQv81tPp5Wa;uC8BLE;0%k1765 z;?E_1MDec?Pp5EUNbxTdPp58SK=IEJPp52Q7x+l;>L&q2dS^XG7DF+J)fO6x zr%a9c7k5L}dY&od^Gbf@*N9wnJd&S?Jp0RQBhOCGi1_wKUOn#2gMm-*{6_|=r^Z_S ziyMmiG~T;choNhAUECDevHDF&T9N$Q&K#IdFSD%ii_q-x1e&^c*4dEreHC@P^^<;K zD+-&SgA=DQlD~5>vM)SBPDXmdgHO>=-b3d@B)@O`Y1kq((p&o=#+-}4cueDaU}=g3 zUjP7q7b+8E%PpBrCi3A)Hq&UDxvSjFC)&&c5_T>013cotWGEm01ska`ja*r7WR*5j z!I!(J$MWF`HuD-zE4N8Uep}Y0_W@LH(igOuaW>Ount7z$%)_2$Cdl!8cuX~xVn%^{ zgj@5J3ZkHovsIG#J4ociuk?g};r|Jux)H5uf{iY6XRteYR%w^#bK8f`Z5d^wSMGk9ponLkv82}V!p=}d=hx!>)PW%SNdp)*-fr=k2b5ESxou7>CEa9 zt#e(iCZ*LhV)*@BiRdxR$hx)5AUa6r!%NTeIn#`DrXQO9?%3I>DpupFUw0f`Kqwk> zbP4qhmq_yu{ze77pQQGq?tJ(VI+6q@B07?dT6YxCC`pYesn>Vh`MTx5_nSIEs^CHt z=q|k;ZbMXeX^qrS?9zV#)Uy#4h5K2e_b@W^LvZCjvB6kL-PHGybfwlcmPpU4PirbjE={MuGSu_$?*}i z@7=afuaHlx0IGZU8V}JE`{w;$L;N&d)xPnYP){E*d+4r&hVFk+xvy_Wc+v-(SBFRZ z-`GqSDpTfZ$N*4hr;xuvkEIHxN0bV*6hACHV)s-ICCCo!=LY(Yrr1(tinHbf6UZ;JSD80h{>;vT)=DvO7`yi1IAKr22E7tbA zpo=qR-}o9*Q`apUci%wtBzLjs6(_l2Ks_4|Q>8cwE`+q6u9~@GfVU|VYI0jxB7GcF zgqB_b>340Z{a)qLxN3+x)8J8aiRLq|<|N_aaXs$QAXUxfCBl!p!aoI0R&_Km(y3|V zVW55P1&4x+VHO^CV`wXPjwwuZeAGN0^WoBq(EU_L9v;C&Y1F@ZRMkFAb>0XmT!fyX zXM^#1RFFr1QlIuTL4Z!n(VnJbdFsw4fa-<=&3iS{Qyaz&GuikLvDZ_33!3PjS+&6R zfEq^hzl|wU2l-z`zPI*$fE=s)kC@V1TWt-b zTQk{&c-tCFrtCz($pm=CIsmEL?d&B1yj#d+(pR0In{CB23ERRugiIFMblTENB_gtl zZzUbO1IBN|ZOj_{cH<6V6u;TH`?w0fcKmkZw;#XHpqywf(_uS!8_^a><^o%@8N3k5 zY_ZZ^sZ@YpF$Apy-o6A??etPZzif~dc)j>8Ei&oEGrmPLu5JKC3k?f?H8s@?x*VPP z04PlsbX6l?he7w_zH%ItotvB~mntMM(Gb8>Yb%FaU>J#-KJ z61FjRt+_Sp<}SG2f9lriZtL2GS1-H#yd^-D4EgZ`jIqyS2C(Yq*6gfWd)i4eE}H>U zs+>CIaZEOIa9t^upFB&-?gwN3)~C~S1g0Y}9f9cxOh;fk0@D$gj=*#TrXyfRK)#bH|1QRqG4t|0 zjC}ucAfQX-`<6q@%l9jXnV0WVv~=;vk15uz^bCR|Jbmj!2``3p;*TTf#VDn(@XLMq z=0Lvxk#7p*-hZJMx8yq@dgh@d<-a~Yl~Dja+aS>+45d1H@IsPrO_p*w-Z-e#%l^qX zAqyC1G0O^RfW@qBTp-V5Y~GS@EC$(-;H$VI@w1x)gB5<2q&__ADgPI+Jk|~sFL9h; zeh(|+F-(<<-)!y=hD@xk?8+6~|Ld6E%(Rv1?M!zveTeC9rcW^4%XB}}cbI<2^d$b+ zWId3oc!L5$d7wrJ9Zb zv%da3-{rC8RyW%cT1iGerk&4mt0W`mXoAnxN-|Q1%qNv(Zee|)zpsq=y697U7GING zC-p_8MCaE`>;0+nGMb;NFl$M>q}^W@vG#|0pLCiwnhq6S*j#|SjqS;**798)KOLVB2UJo z;Ij}|pM}p`LV{?zh;fO(lwPRtGcEaERPfI$e4bT4f2{^yWnpsWF(>kCftL*hRdh4( zGEs%o{)b9^!LK7=h>PUjbioB5XbBAwTSazu|!&1YRi) z??IBJn&_}D~+qGJ@9oNb~by+w|U@nUscKfogVm~d)V3KAwS@O z|BDCyqKADeo^@KVDIXGEQjC|(1k?Ho38Br?&qRHh}CiYA;)HW!U`ZNr;` zj?R>gZ3e-*$`Z6|BN>flv$5?_JMCaELu)qHVMh~P9Ua@DVsKGNIwhjC`NH_(KNz=C z!Xu~OR-~fFh65_sTLzLX)FeBdpaw;w>o(PI3`fH^G|(QDDDFR^;Ru6~hE108(u%I% z@WnOt8=_xax9+C!=IG}7H5lb`WL1;#MCrs5XbF2Ji-(XvzK`uei9oQFzFd?k5qq z^&TIO{Up?|VsG)jAJQ!DBGQ4SjW*`~8#s!+Igs3-OsE|xN>X0n>1{Y#+1Mo)+3cmXB<1&mhK96W)X(0 zv)u~1P)k=bmAEvSu#`Z1EZ1%Y6Wh};rYUwisS>=(%q27F5+;hWteuLH0_QrhA1Fwt zwH0*iZ8*|wfU=C*?i94KWl7Bj?Fr}#r#19Mpfw~18$)c4xAEb=oY z!?Ye0AIH#TUnk7#DluKktmx4*iJATw3_W9uzN{Yzt!719Z@{gN>%TnL-vo@R5`9^Z z5Gv~r5K)P2nCZ)4Xe~hW<@sOe%`7bbi=5DQl+)UR@Up%jG{E}h{xfXRa|hWLeOb>C z+RYA2{SrTE|2?d~h7HR4h)`KiA$|Hdy;F5kyoHKZM_jjHw@B zJ)zCgFjkOz5TSoorr*ssM?&9p7q+wk(PMMgcgpnTxkad~gNb~(|9{E)uA2dtWJ=!& zm`UO%*xw*SBBC$PQ$ia=kZF1S|5T>mc&-){I`enb|1`ws;wPt_tnbM_{c?YW7y1%( z>6u&fW&Lm4r2vscPIEDdwnme)mw47H-zyBJoadw&iWvul-Y_COy literal 22472 zcmeHPe{@vUoxe!{BOntHs0Dva5nMo=4R}D5ViRD(pb17K9_iLjCdq`%I+=+x69p@p zU6eXTD&p4K{iBENww86fyU{A5v>4DO(b{daT^c=ho4Vkck#3EGY-%a9pYOf*`*PpQ zdwO=y?&Z>Iw~bxg~(m|~=DxsJz4=W0Esq)Vm#c&3H+>laIQ z46RkLV9Itk!cNAi<)214?HhD`UU}K2<7cXyE88|5l~B6Yu5S=O_}-0I{py#GPCvJG z`qA44=3eyNO?zLa7|8qzY-A_ndq9YC;RmPiQxA;n{PCmJ&r87N=P6*iE7+tz2FGnM z1uIaYoBk6X`u8F*H~ol*AF9)DR;c%@pzjvXb`QM9qu!(N=N8XBz}@_x>*4=^hyFAV z{r5fUJ%u>k>ZJqghEMR&KkX6ELmoKX2tPJw`6d9jdUt!&`wt%Yau2*6xLf{@dEl2K z4{rJm9&yg`sQ2HY@8;)5k9uG5z!!SN^EV##e#yhnBE;jz<}9yx=%4T5zXlHGIGuoR z!RB@xZ}5o!b`SlxWIU5ZX11ziqMpCw($6F@RaaiE#6pC_o7 z+!9SiH^Uc5{-56<#N0rQ75^mlS3Ae@)k$CK`sEBt)YQxQK(dOGSTRS8h z-W<)e#-i~Sl7(aGbS4!`Y?e$W88^6CI?>tQ6isQ7!K9;^OtM2{BFS_(mWXAfMsq3} z$wV_UJo1ccET!gTA`xxQD2r$+g<3=hs?D@Y(~iz`8<^;3T^an3Mo2;^ zbTrix$wYK`9ZB+#QdQjE8BJ}qYD*;5uJjphPIe}AB(2d*a~pDnWTcf!q_q`sMq9$E z|Rp!(P( zQ%e^UTpOnBcP5(A{8$s21k%X>M6sr3+FK^p)~;K%I=m#XB(PNXTy$uU^52)RMTtBw zlUv&R7GNHeowH)+(%E~jR^{s@zP{-=Uj?&8Uq>-ssqroc&ioz+K0{yU>~-K#Tg@F$lxNee^<_!EYLx0%77Z~^j^@^c7F-2O%Z{XYuNI2iX`4X7$N(1L> zO~RKOxV(-h5T(k%sm)wM2F`tjWc3D)4ri5H41A)63ejlblMKAgz$Y7chk>7G;9CrQ zih*|-xX-{JFz^Zk-(}!a4g7HfH_z*P3|x0{X|>nD>AIRrkAcr%5OlwRf5yOj4g3NF z?>F$z8u);L&ob~q1J|ckDIGHK3l068fnQ|c!v?O0kd%%X_$7wExKT0GZ~X>dZs2<8 zN@<0G&oT5bFz`za+;8A>4Sc?V&ol5!1OF2PUvA*@4ZO<0&G8sA@P&qcy@6kD;I|k! zU5ou+m6N`UKMrmGO?jw${Oey3B6NRmrnE2++WvC+OR~zs(suwC<{iVY?~*F)5#L6# z{7?a9-dn`e6q6s2{2Rp6)ROO&{Hw&%l#=g}{9)p0D#`DW{0qd>6q4U1`KO7esUzPd z`6r2|?vU@0{I`jxDJ0)0`M)NfrjC5QzR?rxHIP`3=O=kk9u@{yO4msONhm zzlwMo;`u$2zlL}k+WB3QUqU=h{rN7*FC?CZc)mmObBL#*oo|%iUnQP~V7^E4hl!`5m)|4#7l@}Jm)|A%r-`RiT)s>4PZCc< zFW({gZxc^LF5d_~v~%S*0fcsr-%aG|k<1Kq<!xFKr^S z;B4s7*|Jb}ICLoYg;2?n(CcS2)8XJJ+Ch0?sMUALno)ZiFI_9=!B%u$-VoZp@=0il zQ1*CcGF%6)5hAw$S<1EG=g9a!;AvCIt*G0opX~E@Lf8Ns47~bKcH90?UvPke40Q+h zzd%FbAdRO`wlB95hk($~&KVnU%nrh^K={9E+yagPz}TH7U63zJ^4=LT365wt737B9 zf6eKp4k?A33rN}W5CZt2Z&7bH__lU3fc|7TS?6?e3jp_6zN}&y)^2v2Zc3eQrh2;h zjB=CHZt6`p2dGn+(Z8yi)!7l!`7>1srqpc%!gv2ak(=(|0ExO}GmfC&d<)}M zReCqO?>oZB`tJaB*S$uepc_06)$G5J`Clki>1wHTby(_TkCOCJAfr~BEh}mtsaXwr z&*pxOr8oz8{y`P)sP=_6?MasQDWrniwU?^Mn!!x41@jhWE7gR9(yC#=h@0{?8uzo7 z>Z4HIPyP0lm-NtS#L(Fb%e_`l{3*H12B~}PeF3WCAf1OO8^?bqC3Il4gv2B{K@y;} z|EJi`29Mz=lHzbkWiqR52LTO|)|;p$8~pk9Z9f;j`?|@E7WByK>3EhQY;`=p&+bQ$ z=bM1K>re|S-8rKlQ@KjUQ%V)p_T{3|6{Qe?$>aGFkWs5|SXN(wmCQ^2Z*h|C3!ae; z(-9?PsFYqA`HNITHrUU6a)es)GSy;rhZVNy7FzY3PdId&$r}eX#is1Hl;4G8Qd0+k zQ{4qL|2z)K_TZV44}A-RXOyeH+-X<+dZ2y55i-w5VTM5!dOWmq`akO??hln97`kTh z-B+dM2roMjIy5wnWQT@IRX^+}E^DSUBbzfq&GFFp?W?Nx?d#n>GST-zAH6-WJG$ z?Z9-B{%5`QL){g|VO&evC(tyHcux8%#7W;5d--rl{R7_mA3~pXXOr)TJ$216hM;<4 zvquc}h`)Xss-O2z9h>l0Qa_JF3Zb4|#2mz_0Ry5hw}a#*yS4{MO5k%vaKQJ_!|FUT zs?!7=7|DV3F70PAA8+5bACvkbr7J~~;CytP&cubC8r?tp$T@%2WB%$7WjlLA*@pe_ zjD0zEf$z&rS2fT)WbtxpA{9(rhyycJcYQg9bZ~f3wPQUhA;3QF%7N;ML64&|pE8cl zc#MmjHIC3$IV~+hoZT46?&FB`KXDu_z=bf6ql>Vw$B}D%qlc9%fA|#omKsOy7S=do zi(AP;jU!hJ9!IQy1?j7CLR*a^S8Zb)!35V2q_4)2tG*sbQuk-1tHzO= zE{!7&<8cH{BbAlAOlT8H}SdD}u+Y zaiqH>W+ZgpzTC4P!qhsGSILop5ny%XAmmwje(1N(?jHctL!{q+c0Wf+Xt4Ajq+3m@ zVh%uc)k>#YZ2_4Se)NGHC>U~mxvR0C4Gz7CvzN&IP`Oek`|buP$aHl#oXOUgcjMZC zrrA1(oX!0)OVJNJ|8*66f2;5PUaIGMoAN|U`6S}zHhzz4$eOW?x5e@%Zl_fXex$6B zPh13M>yhgQNBl)9=gfG6E1=RRsnAj}#d3*xvxT zOuy9)$NIR3!c+H7Is2UY40%U&p_s&24U zmqFE@Po!&`Or5>iKT>s%NHnx_>8+Qm$Qyub2LhK0`k9jT6p4Cyu@o~<%s?>%#S9cP zP|QFv1H}v!Gf>PxF$2X6{4q1omP}_vM>3TW^qOB&Bpns>a+~Ogq|(&_`<9e z3$L6z2dLD+-`C=iUl$51=+Rj9l!_gttIwNIwyX@Uq?``&_m33{z2i*zfpILq4{$B= zFW;@T?8jU7-+_D?^1qtmu;ka4vi-||H{k)n8c<7qFG*E=$3VA1KAGBV*`HIw_TzxZ zkeh0VE&1Kbo}gkWW}ujXVg`yCC}yCTfno-V87OAp|7!;LyBX(qGG6iW_c8oE41fQ^ z-@EYlE&M$Tf4{=ttMKwop?pdg?{G+plB=L>9K6?9=%CP=;gufwqK+E}CkY_YMNvR9^ z^PURb;>c33h*lGWTEO>H^g=lm{&r$eJ7Rpku88C8(TU-2RJcC8qblPs*ZO#&Nb;OV z+{#J*JK7Mhok^basG|5I{;qegdzn7oHJaY6X{)ApXu3mFdMSa*6PoVR^oXWMHGNmp z)0$48H|J4iYI>Qb%QUUg^kz+4HN8XA9hyF-=@Xjn)AWd@M>Ty{)6<$x&>!c_)buh< zmuXs~>CKw9YI=vJJ2ZVv(*Be_ z&CdpH&-8z)!?Di(gqS(jh^|vb?)_Va*^Ad%Fty4=sWrdY@iM{liX9(k%|CX0yx?(c z$0rCL|91Qw!Sje6FBd%D*l|n}Iv;j?qVT)oldS$>*Pkr-c-wKzI+Z4(_RGW+Yn=&G zS|)sA&tel{{R(ToH>G7_sx{Bs@o9p;|Fq-yEXHO2DZ^7Q{%+E)kGCo7O+@XNiJ7AD zMmL;ice|_%XN$Jm?HJA1j$0gf+PUC!jXZ$Mclo)aH z`JqPQWAjGOM#(>4FR-7jQh#jz9|!Ih|C8Dek7@Y~5ZE&s=j#ah><<{dsz&wl^@Dt- z2kcdiAM#@dMLx>|eG?n$^Yw>(h6n7|*h;XX0e|n?2%d^po{vkJPxLO4YPKJ@cAbPq zDXvbO{rq>*&)EJ(>r#}6vHi^_55(C1PwO<4h#6!0RY2p;ei#B?idAu(<97{kM;DQ8 zTMyi2NQ+G#`nP%L-{GO3^}zoMxL-zK|Do#}w|HLkz<&bVtzCm2_;C+ECq3{p9{6Nj z(7DBV5pcJ77JKNg^uTL8@S8mFW)Hjr_%w_Q=eiVk0e8!P*2B+Z9{6`X@TWcSUf^!| zdBX#L#{)m@;eR}?uicKzY~Yj!=Qv?YQjm z(0|Iqe=qPkW1A)3_R!CJ`2W3!zGzNm(wWZI)Z;jLT^9@o*RP=^S|~0G zIh_o*MG`HvGRvAx>#OV5tpu@ln4MJ-+0Ky_JY`V7ghE>(I;TvjdZVGM;Z>(Nb z8w{(JJ**{F^b#txx<^%&x$Fit$y|hm|GHGmmKf`Ne9{^+P1G3Wn!$AO2Uo>VC*ZGsMTJ^w!&@k6S)G3wL*<^aTse^n$cBN91G{DhB+5)8C}c9 zTDL_h+E$JkyCjUUT8mnKWlSS5`#DU{= zXr!6Bu#G(8t}6p6RbyEiYCicvB54Jnux;g_F|8b3H%L0Nj}UmWRuU3{^wxI#VGo)~ zDN0qyy+kq-4Qx(y2AVo!@s=xMEkbf_k#w5~v}{elQc)}rBqjJCKOIXZY)lxkR5TtT z1HIRQRdxb$+ypYwE!dX>GmuKk6@mg$tnwo#jJ6ioGN&xmT%jy@pRA|~IFR8)+GEWK zAqmI$3CP--(rFREK&%@wH~H*S?IpmEX%>rBPh1#`%{%^z4f5`97EFm$fp-&w5N7Ag5>|Y4^4Z& zwqv@78>Wr;+Jxyn4*OnxvBq?_&#Z0iwatAFd%iDX>U`eljQ>GxZ-rT@>(jK}(P23M z9Mx`zy>tCadMCy#&ieO2NL6tC{M>=*+)t^W?sMs$ocjkqkLGnPo$)fybRTRf#ca>d ztG8eU2P&+mxKW<*!w^u2Y|qa-y0m>48*1uz@IM7leUI&}=OWiC#R1)Z&KuXu{bvwr zX8rv9WB{vuP?@iY^~?55e+h|cZ{6QkDU(KBKRaMMrtd;P`y4+%k7=w{7Ocni4tL@N z1cY(7V?DNC#DJ!3&-4^ #include #include +#include #include -#include "lua.h" +#include "taos.h" #include "lauxlib.h" +#include "lua.h" #include "lualib.h" -#include struct cb_param{ lua_State* state; @@ -60,7 +60,6 @@ static int l_connect(lua_State *L){ lua_settop(L,0); - taos_init(); lua_newtable(L); int table_index = lua_gettop(L); @@ -137,19 +136,15 @@ static int l_query(lua_State *L){ lua_pushstring(L,fields[i].name); int32_t* length = taos_fetch_lengths(result); switch (fields[i].type) { - case TSDB_DATA_TYPE_UTINYINT: case TSDB_DATA_TYPE_TINYINT: lua_pushinteger(L,*((char *)row[i])); break; - case TSDB_DATA_TYPE_USMALLINT: case TSDB_DATA_TYPE_SMALLINT: lua_pushinteger(L,*((short *)row[i])); break; - case TSDB_DATA_TYPE_UINT: case TSDB_DATA_TYPE_INT: lua_pushinteger(L,*((int *)row[i])); break; - case TSDB_DATA_TYPE_UBIGINT: case TSDB_DATA_TYPE_BIGINT: lua_pushinteger(L,*((int64_t *)row[i])); break; @@ -159,7 +154,6 @@ static int l_query(lua_State *L){ case TSDB_DATA_TYPE_DOUBLE: lua_pushnumber(L,*((double *)row[i])); break; - case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: //printf("type:%d, max len:%d, current len:%d\n",fields[i].type, fields[i].bytes, length[i]); @@ -241,67 +235,6 @@ static int l_async_query(lua_State *L){ return 1; } -void stream_cb(void *param, TAOS_RES *result, TAOS_ROW row){ - struct cb_param* p = (struct cb_param*) param; - TAOS_FIELD *fields = taos_fetch_fields(result); - int numFields = taos_num_fields(result); - - // printf("\nnumfields:%d\n", numFields); - //printf("\n\r-----------------------------------------------------------------------------------\n"); - - lua_State *L = p->state; - lua_rawgeti(L, LUA_REGISTRYINDEX, p->callback); - - lua_newtable(L); - - for (int i = 0; i < numFields; ++i) { - if (row[i] == NULL) { - continue; - } - - lua_pushstring(L,fields[i].name); - - switch (fields[i].type) { - case TSDB_DATA_TYPE_TINYINT: - lua_pushinteger(L,*((char *)row[i])); - break; - case TSDB_DATA_TYPE_SMALLINT: - lua_pushinteger(L,*((short *)row[i])); - break; - case TSDB_DATA_TYPE_INT: - lua_pushinteger(L,*((int *)row[i])); - break; - case TSDB_DATA_TYPE_BIGINT: - lua_pushinteger(L,*((int64_t *)row[i])); - break; - case TSDB_DATA_TYPE_FLOAT: - lua_pushnumber(L,*((float *)row[i])); - break; - case TSDB_DATA_TYPE_DOUBLE: - lua_pushnumber(L,*((double *)row[i])); - break; - case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: - lua_pushstring(L,(char *)row[i]); - break; - case TSDB_DATA_TYPE_TIMESTAMP: - lua_pushinteger(L,*((int64_t *)row[i])); - break; - case TSDB_DATA_TYPE_BOOL: - lua_pushinteger(L,*((char *)row[i])); - break; - default: - lua_pushnil(L); - break; - } - - lua_settable(L, -3); - } - - lua_call(L, 1, 0); - - // printf("-----------------------------------------------------------------------------------\n\r"); -} static int l_close(lua_State *L){ TAOS *taos= (TAOS*)lua_topointer(L,1); diff --git a/examples/lua/test.lua b/examples/lua/test.lua index ff49b8408d..3d725cc6a3 100644 --- a/examples/lua/test.lua +++ b/examples/lua/test.lua @@ -173,16 +173,16 @@ function async_query_callback(res) end end -driver.query_a(conn,"insert into therm1 values ('2019-09-01 00:00:00.005', 100),('2019-09-01 00:00:00.006', 101),('2019-09-01 00:00:00.007', 102)", async_query_callback) +driver.query_a(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.005', 100),('2019-09-01 00:00:00.006', 101),('2019-09-01 00:00:00.007', 102)", async_query_callback) res = driver.query(conn, "create stream stream_avg_degree into avg_degree as select avg(degree) from thermometer interval(5s) sliding(1s)") -print("From now on we start continous insertion in an definite (infinite if you want) loop.") +print("From now on we start continous insert in an definite loop, pls wait for about 10 seconds and check stream table for result.") local loop_index = 0 -while loop_index < 30 do +while loop_index < 10 do local t = os.time()*1000 - local v = loop_index - res = driver.query(conn,string.format("insert into therm1 values (%d, %d)",t,v)) + local v = math.random(20) + res = driver.query(conn,string.format("INSERT INTO therm1 VALUES (%d, %d)",t,v)) if res.code ~=0 then print("continous insertion--- failed:" .. res.error) @@ -190,17 +190,8 @@ while loop_index < 30 do else --print("insert successfully, affected:"..res.affected) end - local res1 = driver.query(conn, string.format("select last(*) from avg_degree")) - if res1.code ~=0 then - print("select failed: "..res1.error) - return - else --- print(dump(res1)) - if(#res1.item > 0) then print("avg_degree: " .. res1.item[1]["last(avg(degree))"]) end - end - os.execute("sleep " .. 1) loop_index = loop_index + 1 end - +driver.query(conn,"DROP STREAM IF EXISTS avg_therm_s") driver.close(conn) From a6733dbbd1d68f13d5d64f603ecb4ffc5f75d096 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Wed, 21 Sep 2022 22:53:35 +0800 Subject: [PATCH 41/69] feat(wal): auto fix corrupt file --- source/libs/wal/src/walMeta.c | 96 ++++++++++++++++++++++++++++++++--- source/libs/wal/src/walMgmt.c | 8 ++- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 5284aeff77..a01869fbe0 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -116,7 +116,6 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) { } #endif } - // TODO truncate file if (found == NULL) { // file corrupted, no complete log @@ -125,8 +124,20 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } + + // truncate file SWalCkHead* lastEntry = (SWalCkHead*)found; int64_t retVer = lastEntry->head.version; + int64_t lastEntryBeginOffset = offset + (int64_t)((char*)found - (char*)buf); + int64_t lastEntryEndOffset = lastEntryBeginOffset + sizeof(SWalCkHead) + lastEntry->head.bodyLen; + if (lastEntryEndOffset != fileSize) { + wWarn("vgId:%d repair meta truncate file %s to %ld, orig size %ld", pWal->cfg.vgId, fnameStr, lastEntryEndOffset, + fileSize); + taosFtruncateFile(pFile, lastEntryEndOffset); + ((SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet))->fileSize = lastEntryEndOffset; + pWal->totSize -= (fileSize - lastEntryEndOffset); + } + taosCloseFile(&pFile); taosMemoryFree(buf); @@ -226,16 +237,87 @@ int walCheckAndRepairMeta(SWal* pWal) { } } - // TODO: set fileSize and lastVer if necessary - return 0; } int walCheckAndRepairIdx(SWal* pWal) { - // TODO: iterate all log files - // if idx not found, scan log and write idx - // if found, check complete by first and last entry of each idx file - // if idx incomplete, binary search last valid entry, and then build other part + int32_t sz = taosArrayGetSize(pWal->fileInfoSet); + for (int32_t i = 0; i < sz; i++) { + SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, i); + + char fnameStr[WAL_FILE_LEN]; + walBuildIdxName(pWal, pFileInfo->firstVer, fnameStr); + int64_t fsize; + TdFilePtr pIdxFile = taosOpenFile(fnameStr, TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE); + if (pIdxFile == NULL) { + ASSERT(0); + terrno = TAOS_SYSTEM_ERROR(errno); + wError("vgId:%d, cannot open file %s, since %s", pWal->cfg.vgId, fnameStr, terrstr()); + return -1; + } + + taosFStatFile(pIdxFile, &fsize, NULL); + + int32_t left = fsize % sizeof(SWalIdxEntry); + int64_t offset = taosLSeekFile(pIdxFile, -left, SEEK_END); + if (left != 0) { + taosFtruncateFile(pIdxFile, offset); + wWarn("vgId:%d wal truncate file %s to offset %ld since size invalid, file size %ld", pWal->cfg.vgId, fnameStr, + offset, fsize); + } + offset -= sizeof(SWalIdxEntry); + + SWalIdxEntry idxEntry = {0}; + while (1) { + if (offset < 0) { + taosLSeekFile(pIdxFile, 0, SEEK_SET); + taosWriteFile(pIdxFile, &idxEntry, sizeof(SWalIdxEntry)); + break; + } + taosLSeekFile(pIdxFile, offset, SEEK_SET); + int64_t contLen = taosReadFile(pIdxFile, &idxEntry, sizeof(SWalIdxEntry)); + if (contLen < 0 || contLen != sizeof(SWalIdxEntry)) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + if ((idxEntry.ver - pFileInfo->firstVer) * sizeof(SWalIdxEntry) != offset) { + taosFtruncateFile(pIdxFile, offset); + wWarn("vgId:%d wal truncate file %s to offset %ld since entry invalid, entry ver %ld, entry offset %ld", + pWal->cfg.vgId, fnameStr, offset, idxEntry.ver, idxEntry.offset); + offset -= sizeof(SWalIdxEntry); + } else { + break; + } + } + + if (idxEntry.ver < pFileInfo->lastVer) { + char fLogNameStr[WAL_FILE_LEN]; + walBuildLogName(pWal, pFileInfo->firstVer, fLogNameStr); + TdFilePtr pLogFile = taosOpenFile(fLogNameStr, TD_FILE_READ); + if (pLogFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + wError("vgId:%d, cannot open file %s, since %s", pWal->cfg.vgId, fLogNameStr, terrstr()); + return -1; + } + while (idxEntry.ver < pFileInfo->lastVer) { + taosLSeekFile(pLogFile, idxEntry.offset, SEEK_SET); + SWalCkHead ckHead; + taosReadFile(pLogFile, &ckHead, sizeof(SWalCkHead)); + if (idxEntry.ver != ckHead.head.version) { + // todo truncate this idx also + taosCloseFile(&pLogFile); + wError("vgId:%d, invalid repair case", pWal->cfg.vgId); + return -1; + } + idxEntry.ver = ckHead.head.version + 1; + idxEntry.offset = idxEntry.offset + sizeof(SWalCkHead) + ckHead.head.bodyLen; + wWarn("vgId:%d wal idx append new entry %ld %ld", pWal->cfg.vgId, idxEntry.ver, idxEntry.offset); + taosWriteFile(pIdxFile, &idxEntry, sizeof(SWalIdxEntry)); + } + taosCloseFile(&pLogFile); + } + taosCloseFile(&pIdxFile); + } return 0; } diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index c939c8c436..a55f00d277 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -149,15 +149,21 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) { walLoadMeta(pWal); if (walCheckAndRepairMeta(pWal) < 0) { + wError("vgId:%d cannot open wal since repair meta file failed", pWal->cfg.vgId); taosHashCleanup(pWal->pRefHash); taosRemoveRef(tsWal.refSetId, pWal->refId); taosThreadMutexDestroy(&pWal->mutex); taosArrayDestroy(pWal->fileInfoSet); - taosMemoryFree(pWal); return NULL; } if (walCheckAndRepairIdx(pWal) < 0) { + wError("vgId:%d cannot open wal since repair idx file failed", pWal->cfg.vgId); + taosHashCleanup(pWal->pRefHash); + taosRemoveRef(tsWal.refSetId, pWal->refId); + taosThreadMutexDestroy(&pWal->mutex); + taosArrayDestroy(pWal->fileInfoSet); + return NULL; } wDebug("vgId:%d, wal:%p is opened, level:%d fsyncPeriod:%d", pWal->cfg.vgId, pWal, pWal->cfg.level, From 78b4d1024934d7db380a0d26cf27936700f753dd Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 22 Sep 2022 00:36:04 +0800 Subject: [PATCH 42/69] optimize fix condition --- source/libs/wal/src/walMeta.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index a01869fbe0..c69046f707 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -257,6 +257,10 @@ int walCheckAndRepairIdx(SWal* pWal) { } taosFStatFile(pIdxFile, &fsize, NULL); + if (fsize == (pFileInfo->lastVer - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)) { + taosCloseFile(&pIdxFile); + continue; + } int32_t left = fsize % sizeof(SWalIdxEntry); int64_t offset = taosLSeekFile(pIdxFile, -left, SEEK_END); @@ -267,7 +271,7 @@ int walCheckAndRepairIdx(SWal* pWal) { } offset -= sizeof(SWalIdxEntry); - SWalIdxEntry idxEntry = {0}; + SWalIdxEntry idxEntry = {.ver = pFileInfo->firstVer}; while (1) { if (offset < 0) { taosLSeekFile(pIdxFile, 0, SEEK_SET); @@ -306,7 +310,8 @@ int walCheckAndRepairIdx(SWal* pWal) { if (idxEntry.ver != ckHead.head.version) { // todo truncate this idx also taosCloseFile(&pLogFile); - wError("vgId:%d, invalid repair case", pWal->cfg.vgId); + wError("vgId:%d, invalid repair case, log seek to %ld to find ver %ld, actual ver %ld", pWal->cfg.vgId, + idxEntry.offset, idxEntry.ver, ckHead.head.version); return -1; } idxEntry.ver = ckHead.head.version + 1; From ef68cea88ed8601b65581ee1a40f3ccad2a4655d Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 22 Sep 2022 08:47:08 +0800 Subject: [PATCH 43/69] fix: fix client memory leak --- source/client/src/clientImpl.c | 2 ++ source/libs/scheduler/src/schTask.c | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 0e1d82b273..83714040df 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -681,6 +681,8 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList }; int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob); + + destroyQueryExecRes(&pRequest->body.resInfo.execRes); memcpy(&pRequest->body.resInfo.execRes, &res, sizeof(res)); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index 8b3a2016b8..2cb227d84b 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -20,6 +20,7 @@ #include "tmsg.h" #include "tref.h" #include "trpc.h" +#include "tglobal.h" void schFreeTask(SSchJob *pJob, SSchTask *pTask) { schDeregisterTaskHb(pJob, pTask); @@ -870,8 +871,12 @@ int32_t schLaunchTaskImpl(void *param) { SCH_TASK_ELOG("failed to create physical plan, code:%s, msg:%p, len:%d", tstrerror(code), pTask->msg, pTask->msgLen); SCH_ERR_JRET(code); - } else { - SCH_TASK_DLOGL("physical plan len:%d, %s", pTask->msgLen, pTask->msg); + } else if (tsQueryPlannerTrace) { + char *msg = NULL; + int32_t msgLen = 0; + qSubPlanToString(plan, &msg, &msgLen); + SCH_TASK_DLOGL("physical plan len:%d, %s", msgLen, msg); + taosMemoryFree(msg); } } From 21629cc7074f254c98afe7dff78ac03402a461a9 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Thu, 22 Sep 2022 09:14:36 +0800 Subject: [PATCH 44/69] fix: adjust the destroy order of rsma stat --- source/dnode/vnode/src/sma/smaEnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index b870ea1b62..ccf4ebb39f 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -278,7 +278,6 @@ static void tdDestroyRSmaStat(void *pRSmaStat) { smaDebug("vgId:%d, destroy rsma stat %p", SMA_VID(pSma), pRSmaStat); // step 1: set rsma trigger stat cancelled atomic_store_8(RSMA_TRIGGER_STAT(pStat), TASK_TRIGGER_STAT_CANCELLED); - tsem_destroy(&(pStat->notEmpty)); // step 2: destroy the rsma info and associated fetch tasks taosHashCleanup(RSMA_INFO_HASH(pStat)); @@ -306,6 +305,7 @@ static void tdDestroyRSmaStat(void *pRSmaStat) { tdRSmaFSClose(RSMA_FS(pStat)); // step 6: free pStat + tsem_destroy(&(pStat->notEmpty)); taosMemoryFreeClear(pStat); } } From c577897c1f8c9c17ddaaec886b152dc013ba2174 Mon Sep 17 00:00:00 2001 From: xiaolei li <85657333+xleili@users.noreply.github.com> Date: Thu, 22 Sep 2022 09:58:31 +0800 Subject: [PATCH 45/69] test(docs):change docs-example file structure and update reference (#16987) * test(docs):update docs-example file structure * test(docs):update docs-example references under zh and en --- docs/en/07-develop/01-connect/_connect_cs.mdx | 2 +- .../en/07-develop/03-insert-data/_cs_line.mdx | 2 +- .../03-insert-data/_cs_opts_json.mdx | 2 +- .../03-insert-data/_cs_opts_telnet.mdx | 2 +- docs/en/07-develop/03-insert-data/_cs_sql.mdx | 2 +- .../en/07-develop/03-insert-data/_cs_stmt.mdx | 2 +- docs/en/07-develop/04-query-data/_cs.mdx | 2 +- .../en/07-develop/04-query-data/_cs_async.mdx | 2 +- docs/en/07-develop/_sub_cs.mdx | 2 +- .../14-reference/03-connector/09-csharp.mdx | 2 +- docs/examples/csharp/.gitignore | 31 ++++-- docs/examples/csharp/QueryExample.cs | 82 ---------------- docs/examples/csharp/SQLInsertExample.cs | 70 -------------- .../Program.cs} | 27 +++--- .../csharp/{ => asyncQuery}/asyncquery.csproj | 2 +- .../{ConnectExample.cs => connect/Program.cs} | 2 +- .../csharp/{ => connect}/connect.csproj | 0 docs/examples/csharp/csharp.sln | 94 +++++++++++++++++++ .../Program.cs} | 20 +--- .../{ => influxdbLine}/influxdbline.csproj | 0 .../Program.cs} | 47 ++++------ .../optsJSON.csproj} | 0 .../Program.cs} | 47 ++++------ .../csharp/{ => optsTelnet}/optstelnet.csproj | 0 docs/examples/csharp/query/Program.cs | 80 ++++++++++++++++ docs/examples/csharp/{ => query}/query.csproj | 2 +- docs/examples/csharp/sqlInsert/Program.cs | 69 ++++++++++++++ .../csharp/{ => sqlInsert}/sqlinsert.csproj | 0 .../Program.cs} | 78 +++++++-------- .../csharp/{ => stmtInsert}/stmtinsert.csproj | 0 .../Program.cs} | 12 +-- .../csharp/{ => subscribe}/subscribe.csproj | 2 +- docs/examples/csharp/wsInsert/Program.cs | 2 +- docs/examples/csharp/wsQuery/Program.cs | 2 +- docs/zh/07-develop/01-connect/_connect_cs.mdx | 2 +- .../zh/07-develop/03-insert-data/_cs_line.mdx | 2 +- .../03-insert-data/_cs_opts_json.mdx | 2 +- .../03-insert-data/_cs_opts_telnet.mdx | 2 +- docs/zh/07-develop/03-insert-data/_cs_sql.mdx | 2 +- .../zh/07-develop/03-insert-data/_cs_stmt.mdx | 2 +- docs/zh/07-develop/04-query-data/_cs.mdx | 2 +- .../zh/07-develop/04-query-data/_cs_async.mdx | 2 +- docs/zh/07-develop/_sub_cs.mdx | 2 +- docs/zh/08-connector/40-csharp.mdx | 2 +- tests/docs-examples-test/csharp.sh | 40 ++++---- 45 files changed, 416 insertions(+), 333 deletions(-) delete mode 100644 docs/examples/csharp/QueryExample.cs delete mode 100644 docs/examples/csharp/SQLInsertExample.cs rename docs/examples/csharp/{AsyncQueryExample.cs => asyncQuery/Program.cs} (81%) rename docs/examples/csharp/{ => asyncQuery}/asyncquery.csproj (98%) rename docs/examples/csharp/{ConnectExample.cs => connect/Program.cs} (90%) rename docs/examples/csharp/{ => connect}/connect.csproj (100%) create mode 100644 docs/examples/csharp/csharp.sln rename docs/examples/csharp/{InfluxDBLineExample.cs => influxdbLine/Program.cs} (73%) rename docs/examples/csharp/{ => influxdbLine}/influxdbline.csproj (100%) rename docs/examples/csharp/{OptsJsonExample.cs => optsJSON/Program.cs} (53%) rename docs/examples/csharp/{optsjson.csproj => optsJSON/optsJSON.csproj} (100%) rename docs/examples/csharp/{OptsTelnetExample.cs => optsTelnet/Program.cs} (59%) rename docs/examples/csharp/{ => optsTelnet}/optstelnet.csproj (100%) create mode 100644 docs/examples/csharp/query/Program.cs rename docs/examples/csharp/{ => query}/query.csproj (98%) create mode 100644 docs/examples/csharp/sqlInsert/Program.cs rename docs/examples/csharp/{ => sqlInsert}/sqlinsert.csproj (100%) rename docs/examples/csharp/{StmtInsertExample.cs => stmtInsert/Program.cs} (52%) rename docs/examples/csharp/{ => stmtInsert}/stmtinsert.csproj (100%) rename docs/examples/csharp/{SubscribeDemo.cs => subscribe/Program.cs} (90%) rename docs/examples/csharp/{ => subscribe}/subscribe.csproj (98%) diff --git a/docs/en/07-develop/01-connect/_connect_cs.mdx b/docs/en/07-develop/01-connect/_connect_cs.mdx index f8d8e519fd..77fe269945 100644 --- a/docs/en/07-develop/01-connect/_connect_cs.mdx +++ b/docs/en/07-develop/01-connect/_connect_cs.mdx @@ -1,5 +1,5 @@ ```csharp title="Native Connection" -{{#include docs/examples/csharp/ConnectExample.cs}} +{{#include docs/examples/csharp/connect/Program.cs}} ``` :::info diff --git a/docs/en/07-develop/03-insert-data/_cs_line.mdx b/docs/en/07-develop/03-insert-data/_cs_line.mdx index 71f46c62be..ae49901c3a 100644 --- a/docs/en/07-develop/03-insert-data/_cs_line.mdx +++ b/docs/en/07-develop/03-insert-data/_cs_line.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/InfluxDBLineExample.cs}} +{{#include docs/examples/csharp/influxdbLine/Program.cs}} ``` diff --git a/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx b/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx index 8d80d042c9..2627648616 100644 --- a/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx +++ b/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/OptsJsonExample.cs}} +{{#include docs/examples/csharp/optsJSON/Program.cs}} ``` diff --git a/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx b/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx index cff32abf1f..660db13fd1 100644 --- a/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx +++ b/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/OptsTelnetExample.cs}} +{{#include docs/examples/csharp/optsTelnet/Program.cs}} ``` diff --git a/docs/en/07-develop/03-insert-data/_cs_sql.mdx b/docs/en/07-develop/03-insert-data/_cs_sql.mdx index 1dc7bb3d13..42a6bc4315 100644 --- a/docs/en/07-develop/03-insert-data/_cs_sql.mdx +++ b/docs/en/07-develop/03-insert-data/_cs_sql.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/SQLInsertExample.cs}} +{{#include docs/examples/csharp/sqlInsert/Program.cs}} ``` diff --git a/docs/en/07-develop/03-insert-data/_cs_stmt.mdx b/docs/en/07-develop/03-insert-data/_cs_stmt.mdx index 229c874ab9..d8d73ca15e 100644 --- a/docs/en/07-develop/03-insert-data/_cs_stmt.mdx +++ b/docs/en/07-develop/03-insert-data/_cs_stmt.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/StmtInsertExample.cs}} +{{#include docs/examples/csharp/stmtInsert/Program.cs}} ``` diff --git a/docs/en/07-develop/04-query-data/_cs.mdx b/docs/en/07-develop/04-query-data/_cs.mdx index 4bb582ecbf..745ab36811 100644 --- a/docs/en/07-develop/04-query-data/_cs.mdx +++ b/docs/en/07-develop/04-query-data/_cs.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/QueryExample.cs}} +{{#include docs/examples/csharp/query/Program.cs}} ``` diff --git a/docs/en/07-develop/04-query-data/_cs_async.mdx b/docs/en/07-develop/04-query-data/_cs_async.mdx index 3ecf635fd3..19c8e58f32 100644 --- a/docs/en/07-develop/04-query-data/_cs_async.mdx +++ b/docs/en/07-develop/04-query-data/_cs_async.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/AsyncQueryExample.cs}} +{{#include docs/examples/csharp/asyncQuery/Program.cs}} ``` diff --git a/docs/en/07-develop/_sub_cs.mdx b/docs/en/07-develop/_sub_cs.mdx index a435ea0273..093b617e9b 100644 --- a/docs/en/07-develop/_sub_cs.mdx +++ b/docs/en/07-develop/_sub_cs.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/SubscribeDemo.cs}} +{{#include docs/examples/csharp/subscribe/Program.cs}} ``` \ No newline at end of file diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx index bc16cd086b..c51c542c26 100644 --- a/docs/en/14-reference/03-connector/09-csharp.mdx +++ b/docs/en/14-reference/03-connector/09-csharp.mdx @@ -79,7 +79,7 @@ dotnet add exmaple.csproj reference src/TDengine.csproj ## Establish a Connection -``` C# +``` csharp using TDengineDriver; namespace TDengineExample diff --git a/docs/examples/csharp/.gitignore b/docs/examples/csharp/.gitignore index 694da603b9..c228f1be2a 100644 --- a/docs/examples/csharp/.gitignore +++ b/docs/examples/csharp/.gitignore @@ -1,12 +1,27 @@ -bin -obj .vs -*.sln -wsConnect/obj -wsInsert/obj -wsQuery/obj -wsStmt/obj +asyncQuery/bin +connect/bin +influxdbLine/bin +optsJSON/bin +optsTelnet/bin +query/bin +sqlInsert/bin +stmtInsert/bin +subscribe/bin wsConnect/bin wsInsert/bin wsQuery/bin -wsStmt/bin \ No newline at end of file +wsStmt/bin +asyncQuery/obj +connect/obj +influxdbLine/obj +optsJSON/obj +optsTelnet/obj +query/obj +sqlInsert/obj +stmtInsert/obj +subscribe/obj +wsConnect/obj +wsInsert/obj +wsQuery/obj +wsStmt/obj \ No newline at end of file diff --git a/docs/examples/csharp/QueryExample.cs b/docs/examples/csharp/QueryExample.cs deleted file mode 100644 index d75bb8d661..0000000000 --- a/docs/examples/csharp/QueryExample.cs +++ /dev/null @@ -1,82 +0,0 @@ -using TDengineDriver; -using TDengineDriver.Impl; -using System.Runtime.InteropServices; - -namespace TDengineExample -{ - internal class QueryExample - { - static void Main() - { - IntPtr conn = GetConnection(); - // run query - IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2"); - if (TDengine.ErrorNo(res) != 0) - { - Console.WriteLine("Failed to query since: " + TDengine.Error(res)); - TDengine.Close(conn); - TDengine.Cleanup(); - return; - } - - // get filed count - int fieldCount = TDengine.FieldCount(res); - Console.WriteLine("fieldCount=" + fieldCount); - - // print column names - List metas = LibTaos.GetMeta(res); - for (int i = 0; i < metas.Count; i++) - { - Console.Write(metas[i].name + "\t"); - } - Console.WriteLine(); - - // print values - List resData = LibTaos.GetData(res); - for (int i = 0; i < resData.Count; i++) - { - Console.Write($"|{resData[i].ToString()} \t"); - if (((i + 1) % metas.Count == 0)) - { - Console.WriteLine(""); - } - } - Console.WriteLine(); - - if (TDengine.ErrorNo(res) != 0) - { - Console.WriteLine($"Query is not complete, Error {TDengine.ErrorNo(res)} {TDengine.Error(res)}"); - } - // exit - TDengine.FreeResult(res); - TDengine.Close(conn); - TDengine.Cleanup(); - } - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = "power"; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - Console.WriteLine("Connect to TDengine failed"); - System.Environment.Exit(0); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - } -} - -// output: -// Connect to TDengine success -// fieldCount=6 -// ts current voltage phase location groupid -// 1648432611249 10.3 219 0.31 California.SanFrancisco 2 -// 1648432611749 12.6 218 0.33 California.SanFrancisco 2 \ No newline at end of file diff --git a/docs/examples/csharp/SQLInsertExample.cs b/docs/examples/csharp/SQLInsertExample.cs deleted file mode 100644 index 3ce70fe914..0000000000 --- a/docs/examples/csharp/SQLInsertExample.cs +++ /dev/null @@ -1,70 +0,0 @@ -using TDengineDriver; - - -namespace TDengineExample -{ - internal class SQLInsertExample - { - - static void Main() - { - IntPtr conn = GetConnection(); - IntPtr res = TDengine.Query(conn, "CREATE DATABASE power"); - CheckRes(conn, res, "failed to create database"); - res = TDengine.Query(conn, "USE power"); - CheckRes(conn, res, "failed to change database"); - res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)"); - CheckRes(conn, res, "failed to create stable"); - var sql = "INSERT INTO d1001 USING meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + - "d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + - "d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + - "d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; - res = TDengine.Query(conn, sql); - CheckRes(conn, res, "failed to insert data"); - int affectedRows = TDengine.AffectRows(res); - Console.WriteLine("affectedRows " + affectedRows); - TDengine.FreeResult(res); - ExitProgram(conn, 0); - } - - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - Console.WriteLine("Connect to TDengine failed"); - Environment.Exit(0); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - - static void CheckRes(IntPtr conn, IntPtr res, String errorMsg) - { - if (TDengine.ErrorNo(res) != 0) - { - Console.Write(errorMsg + " since: " + TDengine.Error(res)); - ExitProgram(conn, 1); - } - } - - static void ExitProgram(IntPtr conn, int exitCode) - { - TDengine.Close(conn); - TDengine.Cleanup(); - Environment.Exit(exitCode); - } - } -} - -// output: -// Connect to TDengine success -// affectedRows 8 diff --git a/docs/examples/csharp/AsyncQueryExample.cs b/docs/examples/csharp/asyncQuery/Program.cs similarity index 81% rename from docs/examples/csharp/AsyncQueryExample.cs rename to docs/examples/csharp/asyncQuery/Program.cs index 0d47325932..864f06a15e 100644 --- a/docs/examples/csharp/AsyncQueryExample.cs +++ b/docs/examples/csharp/asyncQuery/Program.cs @@ -11,11 +11,17 @@ namespace TDengineExample static void Main() { IntPtr conn = GetConnection(); - QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback); - TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero); - Thread.Sleep(2000); - TDengine.Close(conn); - TDengine.Cleanup(); + try + { + QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback); + TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero); + Thread.Sleep(2000); + } + finally + { + TDengine.Close(conn); + } + } static void QueryCallback(IntPtr param, IntPtr taosRes, int code) @@ -27,11 +33,11 @@ namespace TDengineExample } else { - Console.WriteLine($"async query data failed, failed code {code}"); + throw new Exception($"async query data failed,code:{code},reason:{TDengine.Error(taosRes)}"); } } - // Iteratively call this interface until "numOfRows" is no greater than 0. + // Iteratively call this interface until "numOfRows" is no greater than 0. static void FetchRawBlockCallback(IntPtr param, IntPtr taosRes, int numOfRows) { if (numOfRows > 0) @@ -43,7 +49,7 @@ namespace TDengineExample for (int i = 0; i < dataList.Count; i++) { - if (i != 0 && (i+1) % metaList.Count == 0) + if (i != 0 && (i + 1) % metaList.Count == 0) { Console.WriteLine("{0}\t|", dataList[i]); } @@ -63,7 +69,7 @@ namespace TDengineExample } else { - Console.WriteLine($"FetchRawBlockCallback callback error, error code {numOfRows}"); + throw new Exception($"FetchRawBlockCallback callback error, error code {numOfRows}"); } TDengine.FreeResult(taosRes); } @@ -79,8 +85,7 @@ namespace TDengineExample var conn = TDengine.Connect(host, username, password, dbname, port); if (conn == IntPtr.Zero) { - Console.WriteLine("Connect to TDengine failed"); - Environment.Exit(0); + throw new Exception("Connect to TDengine failed"); } else { diff --git a/docs/examples/csharp/asyncquery.csproj b/docs/examples/csharp/asyncQuery/asyncquery.csproj similarity index 98% rename from docs/examples/csharp/asyncquery.csproj rename to docs/examples/csharp/asyncQuery/asyncquery.csproj index 045969edd7..23e590cd25 100644 --- a/docs/examples/csharp/asyncquery.csproj +++ b/docs/examples/csharp/asyncQuery/asyncquery.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/ConnectExample.cs b/docs/examples/csharp/connect/Program.cs similarity index 90% rename from docs/examples/csharp/ConnectExample.cs rename to docs/examples/csharp/connect/Program.cs index f3548ee65d..955db40c7c 100644 --- a/docs/examples/csharp/ConnectExample.cs +++ b/docs/examples/csharp/connect/Program.cs @@ -16,7 +16,7 @@ namespace TDengineExample var conn = TDengine.Connect(host, username, password, dbname, port); if (conn == IntPtr.Zero) { - Console.WriteLine("Connect to TDengine failed"); + throw new Exception("Connect to TDengine failed"); } else { diff --git a/docs/examples/csharp/connect.csproj b/docs/examples/csharp/connect/connect.csproj similarity index 100% rename from docs/examples/csharp/connect.csproj rename to docs/examples/csharp/connect/connect.csproj diff --git a/docs/examples/csharp/csharp.sln b/docs/examples/csharp/csharp.sln new file mode 100644 index 0000000000..560dde55cb --- /dev/null +++ b/docs/examples/csharp/csharp.sln @@ -0,0 +1,94 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asyncquery", "asyncQuery\asyncquery.csproj", "{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "connect", "connect\connect.csproj", "{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "influxdbline", "influxdbLine\influxdbline.csproj", "{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optsJSON", "optsJSON\optsJSON.csproj", "{6725A961-0C66-4196-AC98-8D3F3D757D6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optstelnet", "optsTelnet\optstelnet.csproj", "{B3B50D25-688B-44D4-8683-482ABC52FFCA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "query", "query\query.csproj", "{F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stmtinsert", "stmtInsert\stmtinsert.csproj", "{B40D6BED-BE3C-4B44-9B12-28BE441311BA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "subscribe", "subscribe\subscribe.csproj", "{C3D45A8E-AFC0-4547-9F3C-467B0B583DED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsConnect", "wsConnect\wsConnect.csproj", "{51E19494-845E-49ED-97C7-749AE63111BD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsInsert", "wsInsert\wsInsert.csproj", "{13E2233B-4AFF-40D9-AF42-AB3F01617540}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsQuery", "wsQuery\wsQuery.csproj", "{0F394169-C456-442C-929D-C2D43A0EEC7B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsStmt", "wsStmt\wsStmt.csproj", "{27B9C9AB-9055-4BF2-8A14-4E59F09D5985}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqlinsert", "sqlInsert\sqlinsert.csproj", "{CD24BD12-8550-4627-A11D-707B446F48C3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.Build.0 = Release|Any CPU + {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Release|Any CPU.Build.0 = Release|Any CPU + {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Release|Any CPU.Build.0 = Release|Any CPU + {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Release|Any CPU.Build.0 = Release|Any CPU + {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Release|Any CPU.Build.0 = Release|Any CPU + {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Release|Any CPU.Build.0 = Release|Any CPU + {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Release|Any CPU.Build.0 = Release|Any CPU + {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Release|Any CPU.Build.0 = Release|Any CPU + {51E19494-845E-49ED-97C7-749AE63111BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51E19494-845E-49ED-97C7-749AE63111BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51E19494-845E-49ED-97C7-749AE63111BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51E19494-845E-49ED-97C7-749AE63111BD}.Release|Any CPU.Build.0 = Release|Any CPU + {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Release|Any CPU.Build.0 = Release|Any CPU + {0F394169-C456-442C-929D-C2D43A0EEC7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F394169-C456-442C-929D-C2D43A0EEC7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F394169-C456-442C-929D-C2D43A0EEC7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F394169-C456-442C-929D-C2D43A0EEC7B}.Release|Any CPU.Build.0 = Release|Any CPU + {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Release|Any CPU.Build.0 = Release|Any CPU + {CD24BD12-8550-4627-A11D-707B446F48C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD24BD12-8550-4627-A11D-707B446F48C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD24BD12-8550-4627-A11D-707B446F48C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD24BD12-8550-4627-A11D-707B446F48C3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/docs/examples/csharp/InfluxDBLineExample.cs b/docs/examples/csharp/influxdbLine/Program.cs similarity index 73% rename from docs/examples/csharp/InfluxDBLineExample.cs rename to docs/examples/csharp/influxdbLine/Program.cs index 7b4453f4ac..fa3cb21fe0 100644 --- a/docs/examples/csharp/InfluxDBLineExample.cs +++ b/docs/examples/csharp/influxdbLine/Program.cs @@ -17,8 +17,7 @@ namespace TDengineExample IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS); if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res)); - ExitProgram(conn, 1); + throw new Exception("SchemalessInsert failed since " + TDengine.Error(res)); } else { @@ -26,7 +25,6 @@ namespace TDengineExample Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); } TDengine.FreeResult(res); - ExitProgram(conn, 0); } static IntPtr GetConnection() @@ -39,9 +37,7 @@ namespace TDengineExample var conn = TDengine.Connect(host, username, password, dbname, port); if (conn == IntPtr.Zero) { - Console.WriteLine("Connect to TDengine failed"); - TDengine.Cleanup(); - Environment.Exit(1); + throw new Exception("Connect to TDengine failed"); } else { @@ -55,23 +51,15 @@ namespace TDengineExample IntPtr res = TDengine.Query(conn, "CREATE DATABASE test"); if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine("failed to create database, reason: " + TDengine.Error(res)); - ExitProgram(conn, 1); + throw new Exception("failed to create database, reason: " + TDengine.Error(res)); } res = TDengine.Query(conn, "USE test"); if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine("failed to change database, reason: " + TDengine.Error(res)); - ExitProgram(conn, 1); + throw new Exception("failed to change database, reason: " + TDengine.Error(res)); } } - static void ExitProgram(IntPtr conn, int exitCode) - { - TDengine.Close(conn); - TDengine.Cleanup(); - Environment.Exit(exitCode); - } } } diff --git a/docs/examples/csharp/influxdbline.csproj b/docs/examples/csharp/influxdbLine/influxdbline.csproj similarity index 100% rename from docs/examples/csharp/influxdbline.csproj rename to docs/examples/csharp/influxdbLine/influxdbline.csproj diff --git a/docs/examples/csharp/OptsJsonExample.cs b/docs/examples/csharp/optsJSON/Program.cs similarity index 53% rename from docs/examples/csharp/OptsJsonExample.cs rename to docs/examples/csharp/optsJSON/Program.cs index 2c41acc5c9..b67b5af62b 100644 --- a/docs/examples/csharp/OptsJsonExample.cs +++ b/docs/examples/csharp/optsJSON/Program.cs @@ -7,27 +7,31 @@ namespace TDengineExample static void Main() { IntPtr conn = GetConnection(); - PrepareDatabase(conn); - string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," + + try + { + PrepareDatabase(conn); + string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"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}}]" }; - IntPtr res = TDengine.SchemalessInsert(conn, lines, 1, (int)TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); - if (TDengine.ErrorNo(res) != 0) - { - Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res)); - ExitProgram(conn, 1); + IntPtr res = TDengine.SchemalessInsert(conn, lines, 1, (int)TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); + if (TDengine.ErrorNo(res) != 0) + { + throw new Exception("SchemalessInsert failed since " + TDengine.Error(res)); + } + else + { + int affectedRows = TDengine.AffectRows(res); + Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); + } + TDengine.FreeResult(res); } - else + finally { - int affectedRows = TDengine.AffectRows(res); - Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); + TDengine.Close(conn); } - TDengine.FreeResult(res); - ExitProgram(conn, 0); - } static IntPtr GetConnection() { @@ -39,9 +43,7 @@ namespace TDengineExample var conn = TDengine.Connect(host, username, password, dbname, port); if (conn == IntPtr.Zero) { - Console.WriteLine("Connect to TDengine failed"); - TDengine.Cleanup(); - Environment.Exit(1); + throw new Exception("Connect to TDengine failed"); } else { @@ -55,22 +57,13 @@ namespace TDengineExample IntPtr res = TDengine.Query(conn, "CREATE DATABASE test"); if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine("failed to create database, reason: " + TDengine.Error(res)); - ExitProgram(conn, 1); + throw new Exception("failed to create database, reason: " + TDengine.Error(res)); } res = TDengine.Query(conn, "USE test"); if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine("failed to change database, reason: " + TDengine.Error(res)); - ExitProgram(conn, 1); + throw new Exception("failed to change database, reason: " + TDengine.Error(res)); } } - - static void ExitProgram(IntPtr conn, int exitCode) - { - TDengine.Close(conn); - TDengine.Cleanup(); - Environment.Exit(exitCode); - } } } diff --git a/docs/examples/csharp/optsjson.csproj b/docs/examples/csharp/optsJSON/optsJSON.csproj similarity index 100% rename from docs/examples/csharp/optsjson.csproj rename to docs/examples/csharp/optsJSON/optsJSON.csproj diff --git a/docs/examples/csharp/OptsTelnetExample.cs b/docs/examples/csharp/optsTelnet/Program.cs similarity index 59% rename from docs/examples/csharp/OptsTelnetExample.cs rename to docs/examples/csharp/optsTelnet/Program.cs index bb752db1af..e73ceb041a 100644 --- a/docs/examples/csharp/OptsTelnetExample.cs +++ b/docs/examples/csharp/optsTelnet/Program.cs @@ -7,8 +7,10 @@ namespace TDengineExample static void Main() { IntPtr conn = GetConnection(); - PrepareDatabase(conn); - string[] lines = { + try + { + PrepareDatabase(conn); + string[] lines = { "meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2", "meters.current 1648432611250 12.6 location=California.SanFrancisco groupid=2", "meters.current 1648432611249 10.8 location=California.LosAngeles groupid=3", @@ -18,20 +20,22 @@ namespace TDengineExample "meters.voltage 1648432611249 221 location=California.LosAngeles groupid=3", "meters.voltage 1648432611250 217 location=California.LosAngeles groupid=3", }; - IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); - if (TDengine.ErrorNo(res) != 0) - { - Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res)); - ExitProgram(conn, 1); + IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); + if (TDengine.ErrorNo(res) != 0) + { + throw new Exception("SchemalessInsert failed since " + TDengine.Error(res)); + } + else + { + int affectedRows = TDengine.AffectRows(res); + Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); + } + TDengine.FreeResult(res); } - else + catch { - int affectedRows = TDengine.AffectRows(res); - Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); + TDengine.Close(conn); } - TDengine.FreeResult(res); - ExitProgram(conn, 0); - } static IntPtr GetConnection() { @@ -43,9 +47,7 @@ namespace TDengineExample var conn = TDengine.Connect(host, username, password, dbname, port); if (conn == IntPtr.Zero) { - Console.WriteLine("Connect to TDengine failed"); - TDengine.Cleanup(); - Environment.Exit(1); + throw new Exception("Connect to TDengine failed"); } else { @@ -59,22 +61,13 @@ namespace TDengineExample IntPtr res = TDengine.Query(conn, "CREATE DATABASE test"); if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine("failed to create database, reason: " + TDengine.Error(res)); - ExitProgram(conn, 1); + throw new Exception("failed to create database, reason: " + TDengine.Error(res)); } res = TDengine.Query(conn, "USE test"); if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine("failed to change database, reason: " + TDengine.Error(res)); - ExitProgram(conn, 1); + throw new Exception("failed to change database, reason: " + TDengine.Error(res)); } } - - static void ExitProgram(IntPtr conn, int exitCode) - { - TDengine.Close(conn); - TDengine.Cleanup(); - Environment.Exit(exitCode); - } } } diff --git a/docs/examples/csharp/optstelnet.csproj b/docs/examples/csharp/optsTelnet/optstelnet.csproj similarity index 100% rename from docs/examples/csharp/optstelnet.csproj rename to docs/examples/csharp/optsTelnet/optstelnet.csproj diff --git a/docs/examples/csharp/query/Program.cs b/docs/examples/csharp/query/Program.cs new file mode 100644 index 0000000000..84c7f9db1f --- /dev/null +++ b/docs/examples/csharp/query/Program.cs @@ -0,0 +1,80 @@ +using TDengineDriver; +using TDengineDriver.Impl; +using System.Runtime.InteropServices; + +namespace TDengineExample +{ + internal class QueryExample + { + static void Main() + { + IntPtr conn = GetConnection(); + try + { + // run query + IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2"); + if (TDengine.ErrorNo(res) != 0) + { + throw new Exception("Failed to query since: " + TDengine.Error(res)); + } + + // get filed count + int fieldCount = TDengine.FieldCount(res); + Console.WriteLine("fieldCount=" + fieldCount); + + // print column names + List metas = LibTaos.GetMeta(res); + for (int i = 0; i < metas.Count; i++) + { + Console.Write(metas[i].name + "\t"); + } + Console.WriteLine(); + + // print values + List resData = LibTaos.GetData(res); + for (int i = 0; i < resData.Count; i++) + { + Console.Write($"|{resData[i].ToString()} \t"); + if (((i + 1) % metas.Count == 0)) + { + Console.WriteLine(""); + } + } + Console.WriteLine(); + + // Free result after use + TDengine.FreeResult(res); + } + finally + { + TDengine.Close(conn); + } + + } + static IntPtr GetConnection() + { + string host = "localhost"; + short port = 6030; + string username = "root"; + string password = "taosdata"; + string dbname = "power"; + var conn = TDengine.Connect(host, username, password, dbname, port); + if (conn == IntPtr.Zero) + { + throw new Exception("Connect to TDengine failed"); + } + else + { + Console.WriteLine("Connect to TDengine success"); + } + return conn; + } + } +} + +// output: +// Connect to TDengine success +// fieldCount=6 +// ts current voltage phase location groupid +// 1648432611249 10.3 219 0.31 California.SanFrancisco 2 +// 1648432611749 12.6 218 0.33 California.SanFrancisco 2 \ No newline at end of file diff --git a/docs/examples/csharp/query.csproj b/docs/examples/csharp/query/query.csproj similarity index 98% rename from docs/examples/csharp/query.csproj rename to docs/examples/csharp/query/query.csproj index 39fc135d5a..c97dbd3051 100644 --- a/docs/examples/csharp/query.csproj +++ b/docs/examples/csharp/query/query.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/sqlInsert/Program.cs b/docs/examples/csharp/sqlInsert/Program.cs new file mode 100644 index 0000000000..f23a6e1663 --- /dev/null +++ b/docs/examples/csharp/sqlInsert/Program.cs @@ -0,0 +1,69 @@ +using TDengineDriver; + + +namespace TDengineExample +{ + internal class SQLInsertExample + { + + static void Main() + { + IntPtr conn = GetConnection(); + try + { + IntPtr res = TDengine.Query(conn, "CREATE DATABASE power"); + CheckRes(conn, res, "failed to create database"); + res = TDengine.Query(conn, "USE power"); + CheckRes(conn, res, "failed to change database"); + res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)"); + CheckRes(conn, res, "failed to create stable"); + var sql = "INSERT INTO d1001 USING meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + + "d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + + "d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + + "d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; + res = TDengine.Query(conn, sql); + CheckRes(conn, res, "failed to insert data"); + int affectedRows = TDengine.AffectRows(res); + Console.WriteLine("affectedRows " + affectedRows); + TDengine.FreeResult(res); + } + finally + { + TDengine.Close(conn); + } + + } + + static IntPtr GetConnection() + { + string host = "localhost"; + short port = 6030; + string username = "root"; + string password = "taosdata"; + string dbname = ""; + var conn = TDengine.Connect(host, username, password, dbname, port); + if (conn == IntPtr.Zero) + { + throw new Exception("Connect to TDengine failed"); + } + else + { + Console.WriteLine("Connect to TDengine success"); + } + return conn; + } + + static void CheckRes(IntPtr conn, IntPtr res, String errorMsg) + { + if (TDengine.ErrorNo(res) != 0) + { + throw new Exception($"{errorMsg} since: {TDengine.Error(res)}"); + } + } + + } +} + +// output: +// Connect to TDengine success +// affectedRows 8 diff --git a/docs/examples/csharp/sqlinsert.csproj b/docs/examples/csharp/sqlInsert/sqlinsert.csproj similarity index 100% rename from docs/examples/csharp/sqlinsert.csproj rename to docs/examples/csharp/sqlInsert/sqlinsert.csproj diff --git a/docs/examples/csharp/StmtInsertExample.cs b/docs/examples/csharp/stmtInsert/Program.cs similarity index 52% rename from docs/examples/csharp/StmtInsertExample.cs rename to docs/examples/csharp/stmtInsert/Program.cs index 0a4098091f..87e1971feb 100644 --- a/docs/examples/csharp/StmtInsertExample.cs +++ b/docs/examples/csharp/stmtInsert/Program.cs @@ -9,45 +9,50 @@ namespace TDengineExample static void Main() { conn = GetConnection(); - PrepareSTable(); - // 1. init and prepare - stmt = TDengine.StmtInit(conn); - if (stmt == IntPtr.Zero) + try { - Console.WriteLine("failed to init stmt, " + TDengine.Error(stmt)); - ExitProgram(); - } - int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)"); - CheckStmtRes(res, "failed to prepare stmt"); + PrepareSTable(); + // 1. init and prepare + stmt = TDengine.StmtInit(conn); + if (stmt == IntPtr.Zero) + { + throw new Exception("failed to init stmt."); + } + int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)"); + CheckStmtRes(res, "failed to prepare stmt"); - // 2. bind table name and tags - TAOS_MULTI_BIND[] tags = new TAOS_MULTI_BIND[2] { TaosMultiBind.MultiBindBinary(new string[]{"California.SanFrancisco"}), TaosMultiBind.MultiBindInt(new int?[] {2}) }; - res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags); - CheckStmtRes(res, "failed to bind table name and tags"); + // 2. bind table name and tags + TAOS_MULTI_BIND[] tags = new TAOS_MULTI_BIND[2] { TaosMultiBind.MultiBindBinary(new string[] { "California.SanFrancisco" }), TaosMultiBind.MultiBindInt(new int?[] { 2 }) }; + res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags); + CheckStmtRes(res, "failed to bind table name and tags"); - // 3. bind values - TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] { + // 3. bind values + TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] { TaosMultiBind.MultiBindTimestamp(new long[2] { 1648432611249, 1648432611749}), TaosMultiBind.MultiBindFloat(new float?[2] { 10.3f, 12.6f}), TaosMultiBind.MultiBindInt(new int?[2] { 219, 218}), TaosMultiBind.MultiBindFloat(new float?[2]{ 0.31f, 0.33f}) }; - res = TDengine.StmtBindParamBatch(stmt, values); - CheckStmtRes(res, "failed to bind params"); + res = TDengine.StmtBindParamBatch(stmt, values); + CheckStmtRes(res, "failed to bind params"); - // 4. add batch - res = TDengine.StmtAddBatch(stmt); - CheckStmtRes(res, "failed to add batch"); + // 4. add batch + res = TDengine.StmtAddBatch(stmt); + CheckStmtRes(res, "failed to add batch"); - // 5. execute - res = TDengine.StmtExecute(stmt); - CheckStmtRes(res, "faild to execute"); + // 5. execute + res = TDengine.StmtExecute(stmt); + CheckStmtRes(res, "faild to execute"); + + // 6. free + TaosMultiBind.FreeTaosBind(tags); + TaosMultiBind.FreeTaosBind(values); + } + finally + { + TDengine.Close(conn); + } - // 6. free - TaosMultiBind.FreeTaosBind(tags); - TaosMultiBind.FreeTaosBind(values); - TDengine.Close(conn); - TDengine.Cleanup(); } static IntPtr GetConnection() @@ -60,8 +65,7 @@ namespace TDengineExample var conn = TDengine.Connect(host, username, password, dbname, port); if (conn == IntPtr.Zero) { - Console.WriteLine("Connect to TDengine failed"); - Environment.Exit(0); + throw new Exception("Connect to TDengine failed"); } else { @@ -70,8 +74,6 @@ namespace TDengineExample return conn; } - - static void PrepareSTable() { IntPtr res = TDengine.Query(conn, "CREATE DATABASE power"); @@ -90,9 +92,8 @@ namespace TDengineExample int code = TDengine.StmtClose(stmt); if (code != 0) { - Console.WriteLine($"falied to close stmt, {code} reason: {TDengine.StmtErrorStr(stmt)} "); + throw new Exception($"falied to close stmt, {code} reason: {TDengine.StmtErrorStr(stmt)} "); } - ExitProgram(); } } @@ -100,16 +101,9 @@ namespace TDengineExample { if (TDengine.ErrorNo(res) != 0) { - Console.WriteLine(errorMsg + " since:" + TDengine.Error(res)); - ExitProgram(); + throw new Exception(errorMsg + " since:" + TDengine.Error(res)); } } - static void ExitProgram() - { - TDengine.Close(conn); - TDengine.Cleanup(); - Environment.Exit(1); - } } } diff --git a/docs/examples/csharp/stmtinsert.csproj b/docs/examples/csharp/stmtInsert/stmtinsert.csproj similarity index 100% rename from docs/examples/csharp/stmtinsert.csproj rename to docs/examples/csharp/stmtInsert/stmtinsert.csproj diff --git a/docs/examples/csharp/SubscribeDemo.cs b/docs/examples/csharp/subscribe/Program.cs similarity index 90% rename from docs/examples/csharp/SubscribeDemo.cs rename to docs/examples/csharp/subscribe/Program.cs index b62ff12e5e..1fba209f22 100644 --- a/docs/examples/csharp/SubscribeDemo.cs +++ b/docs/examples/csharp/subscribe/Program.cs @@ -11,11 +11,10 @@ namespace TMQExample { IntPtr conn = GetConnection(); string topic = "topic_example"; - Console.WriteLine($"create topic if not exist {topic} as select * from meters"); //create topic IntPtr res = TDengine.Query(conn, $"create topic if not exists {topic} as select * from meters"); - - if (res == IntPtr.Zero) + + if (TDengine.ErrorNo(res) != 0 ) { throw new Exception($"create topic failed, reason:{TDengine.Error(res)}"); } @@ -26,7 +25,7 @@ namespace TMQExample TDConnectUser = "root", TDConnectPasswd = "taosdata", MsgWithTableName = "true", - TDConnectIp = "127.0.0.1", + TDConnectIp = "127.0.0.1", }; // create consumer @@ -65,7 +64,6 @@ namespace TMQExample List topics = consumer.Subscription(); topics.ForEach(t => Console.WriteLine("topic name:{0}", t)); - // unsubscribe consumer.Unsubscribe(); @@ -73,7 +71,6 @@ namespace TMQExample consumer.Close(); TDengine.Close(conn); - } static IntPtr GetConnection() @@ -86,8 +83,7 @@ namespace TMQExample var conn = TDengine.Connect(host, username, password, dbname, port); if (conn == IntPtr.Zero) { - Console.WriteLine("Connect to TDengine failed"); - System.Environment.Exit(0); + throw new Exception("Connect to TDengine failed"); } else { diff --git a/docs/examples/csharp/subscribe.csproj b/docs/examples/csharp/subscribe/subscribe.csproj similarity index 98% rename from docs/examples/csharp/subscribe.csproj rename to docs/examples/csharp/subscribe/subscribe.csproj index eff29b3bf4..8ae1cf6bc6 100644 --- a/docs/examples/csharp/subscribe.csproj +++ b/docs/examples/csharp/subscribe/subscribe.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/wsInsert/Program.cs b/docs/examples/csharp/wsInsert/Program.cs index 4ff830b437..4cd812cda9 100644 --- a/docs/examples/csharp/wsInsert/Program.cs +++ b/docs/examples/csharp/wsInsert/Program.cs @@ -47,7 +47,7 @@ namespace Examples } else { - Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes),LibTaosWS.WSAffectRows(wsRes)); + Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes), LibTaosWS.WSAffectRows(wsRes)); } } } diff --git a/docs/examples/csharp/wsQuery/Program.cs b/docs/examples/csharp/wsQuery/Program.cs index bf3cf2bbe2..de5591aa53 100644 --- a/docs/examples/csharp/wsQuery/Program.cs +++ b/docs/examples/csharp/wsQuery/Program.cs @@ -55,7 +55,7 @@ namespace Examples // Free result after use. LibTaosWS.WSFreeResult(wsRes); - + // close connection. LibTaosWS.WSClose(wsConn); } diff --git a/docs/zh/07-develop/01-connect/_connect_cs.mdx b/docs/zh/07-develop/01-connect/_connect_cs.mdx index 9d0755fc64..169bf37a63 100644 --- a/docs/zh/07-develop/01-connect/_connect_cs.mdx +++ b/docs/zh/07-develop/01-connect/_connect_cs.mdx @@ -1,5 +1,5 @@ ```csharp title="原生连接" -{{#include docs/examples/csharp/ConnectExample.cs}} +{{#include docs/examples/csharp/connect/Program.cs}} ``` ```csharp title="WebSocket 连接" diff --git a/docs/zh/07-develop/03-insert-data/_cs_line.mdx b/docs/zh/07-develop/03-insert-data/_cs_line.mdx index 71f46c62be..ae49901c3a 100644 --- a/docs/zh/07-develop/03-insert-data/_cs_line.mdx +++ b/docs/zh/07-develop/03-insert-data/_cs_line.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/InfluxDBLineExample.cs}} +{{#include docs/examples/csharp/influxdbLine/Program.cs}} ``` diff --git a/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx b/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx index 8d80d042c9..2627648616 100644 --- a/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx +++ b/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/OptsJsonExample.cs}} +{{#include docs/examples/csharp/optsJSON/Program.cs}} ``` diff --git a/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx b/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx index cff32abf1f..660db13fd1 100644 --- a/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx +++ b/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/OptsTelnetExample.cs}} +{{#include docs/examples/csharp/optsTelnet/Program.cs}} ``` diff --git a/docs/zh/07-develop/03-insert-data/_cs_sql.mdx b/docs/zh/07-develop/03-insert-data/_cs_sql.mdx index 1dc7bb3d13..42a6bc4315 100644 --- a/docs/zh/07-develop/03-insert-data/_cs_sql.mdx +++ b/docs/zh/07-develop/03-insert-data/_cs_sql.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/SQLInsertExample.cs}} +{{#include docs/examples/csharp/sqlInsert/Program.cs}} ``` diff --git a/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx b/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx index 229c874ab9..d8d73ca15e 100644 --- a/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx +++ b/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/StmtInsertExample.cs}} +{{#include docs/examples/csharp/stmtInsert/Program.cs}} ``` diff --git a/docs/zh/07-develop/04-query-data/_cs.mdx b/docs/zh/07-develop/04-query-data/_cs.mdx index 4bb582ecbf..745ab36811 100644 --- a/docs/zh/07-develop/04-query-data/_cs.mdx +++ b/docs/zh/07-develop/04-query-data/_cs.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/QueryExample.cs}} +{{#include docs/examples/csharp/query/Program.cs}} ``` diff --git a/docs/zh/07-develop/04-query-data/_cs_async.mdx b/docs/zh/07-develop/04-query-data/_cs_async.mdx index 3ecf635fd3..19c8e58f32 100644 --- a/docs/zh/07-develop/04-query-data/_cs_async.mdx +++ b/docs/zh/07-develop/04-query-data/_cs_async.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/AsyncQueryExample.cs}} +{{#include docs/examples/csharp/asyncQuery/Program.cs}} ``` diff --git a/docs/zh/07-develop/_sub_cs.mdx b/docs/zh/07-develop/_sub_cs.mdx index a435ea0273..093b617e9b 100644 --- a/docs/zh/07-develop/_sub_cs.mdx +++ b/docs/zh/07-develop/_sub_cs.mdx @@ -1,3 +1,3 @@ ```csharp -{{#include docs/examples/csharp/SubscribeDemo.cs}} +{{#include docs/examples/csharp/subscribe/Program.cs}} ``` \ No newline at end of file diff --git a/docs/zh/08-connector/40-csharp.mdx b/docs/zh/08-connector/40-csharp.mdx index 9ba8be2c22..f78fd9e3d9 100644 --- a/docs/zh/08-connector/40-csharp.mdx +++ b/docs/zh/08-connector/40-csharp.mdx @@ -208,7 +208,7 @@ namespace TDengineExample ``` csharp -{{#include docs/examples/csharp/StmtInsertExample.cs}} +{{#include docs/examples/csharp/stmtInsert/Program.cs}} ``` diff --git a/tests/docs-examples-test/csharp.sh b/tests/docs-examples-test/csharp.sh index d7f2670478..8d1031ab8f 100644 --- a/tests/docs-examples-test/csharp.sh +++ b/tests/docs-examples-test/csharp.sh @@ -6,24 +6,32 @@ pgrep taosd || taosd >> /dev/null 2>&1 & pgrep taosadapter || taosadapter >> /dev/null 2>&1 & cd ../../docs/examples/csharp -#dotnet run --project connect.csproj +dotnet run --project connect/connect.csproj -#taos -s "drop database if exists power" -#dotnet run --project sqlinsert.csproj -#dotnet run --project query.csproj -#dotnet run --project asyncquery.csproj -#dotnet run --project subscribe.csproj +taos -s "drop database if exists power" +dotnet run --project sqlInsert/sqlinsert.csproj +dotnet run --project query/query.csproj +dotnet run --project asyncQuery/asyncquery.csproj +dotnet run --project subscribe/subscribe.csproj -#taos -s "drop topic if exists topic_example" -#taos -s "drop database if exists power" -#dotnet run --project stmtinsert.csproj +taos -s "drop topic if exists topic_example" +taos -s "drop database if exists power" +dotnet run --project stmtInsert/stmtinsert.csproj -#taos -s "drop database if exists test" -#dotnet run --project influxdbline.csproj +taos -s "drop database if exists test" +dotnet run --project influxdbLine/influxdbline.csproj -#taos -s "drop database if exists test" -#dotnet run --project optstelnet.csproj +taos -s "drop database if exists test" +dotnet run --project optsTelnet/optstelnet.csproj -#taos -s "drop database if exists test" -#dotnet run --project optsjson.csproji -echo "uncomment temporily" +taos -s "drop database if exists test" +dotnet run --project optsJSON/optsJSON.csproj + +taos -s "create database if exists test" +dotnet run --project wsConnect/wsConnect.csproj +dotnet run --project wsInsert/wsInsert.csproj +dotnet run --project wsStmt/wsStmt.csproj +dotnet run --project wsQuery/wsQuery.csproj + +taos -s "drop database if exists test" +taos -s "drop database if exists power" \ No newline at end of file From 976b36631ee60b877628a0b465ff867a0a52644d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 22 Sep 2022 10:31:17 +0800 Subject: [PATCH 46/69] fix(query): keep last key for interp query. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 13 +++++++++---- source/libs/executor/src/timewindowoperator.c | 8 +++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 95b4afe6d8..07d8a2e6a7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -3329,7 +3329,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl if (pCond->type == TIMEWINDOW_RANGE_EXTERNAL) { // update the SQueryTableDataCond to create inner reader - int32_t order = pCond->order; + int32_t order = pCond->order; if (order == TSDB_ORDER_ASC) { pCond->twindows.ekey = window.skey; pCond->twindows.skey = INT64_MIN; @@ -3353,6 +3353,8 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl pCond->twindows.skey = INT64_MIN; pCond->twindows.ekey = window.ekey; } + pCond->order = order; + code = tsdbReaderCreate(pVnode, pCond, &pReader->innerReader[1], 1, idstr); if (code != TSDB_CODE_SUCCESS) { goto _err; @@ -3373,8 +3375,10 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl } } + STsdbReader* p = pReader->innerReader[0] != NULL? pReader->innerReader[0]:pReader; + int32_t numOfTables = taosArrayGetSize(pTableList); - pReader->status.pTableMap = createDataBlockScanInfo(pReader, pTableList->pData, numOfTables); + pReader->status.pTableMap = createDataBlockScanInfo(p, pTableList->pData, numOfTables); if (pReader->status.pTableMap == NULL) { tsdbReaderClose(pReader); *ppReader = NULL; @@ -3541,8 +3545,9 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { if (pReader->innerReader[0] != NULL && pReader->step == 0) { bool ret = doTsdbNextDataBlock(pReader->innerReader[0]); resetDataBlockScanInfo(pReader->innerReader[0]->status.pTableMap, pReader->innerReader[0]->window.ekey); + pReader->step = EXTERNAL_ROWS_PREV; + if (ret) { - pReader->step = EXTERNAL_ROWS_PREV; return ret; } } @@ -3559,8 +3564,8 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { if (pReader->innerReader[1] != NULL && pReader->step == EXTERNAL_ROWS_MAIN) { resetDataBlockScanInfo(pReader->innerReader[1]->status.pTableMap, pReader->window.ekey); bool ret1 = doTsdbNextDataBlock(pReader->innerReader[1]); + pReader->step = EXTERNAL_ROWS_NEXT; if (ret1) { - pReader->step = EXTERNAL_ROWS_NEXT; return ret1; } } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 0c6cc51efd..8ddaca5b70 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1994,7 +1994,7 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo } } - pSliceInfo->fillLastPoint = isLastRow ? true : false; + pSliceInfo->fillLastPoint = isLastRow; } static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock) { @@ -2342,6 +2342,9 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { break; } } + } else { + // store ts value as start, and calculate interp value when processing next block + doKeepLinearInfo(pSliceInfo, pBlock, i, true); } } else { // non-linear interpolation if (i < pBlock->info.rows - 1) { @@ -2420,6 +2423,9 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { break; } } + } else { // it is the last row of current block + // store ts value as start, and calculate interp value when processing next block + doKeepLinearInfo(pSliceInfo, pBlock, i, true); } } else { // non-linear interpolation pSliceInfo->current = From 22c9f0a82b543e3d84f25861761a96504d411ac7 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 22 Sep 2022 10:32:14 +0800 Subject: [PATCH 47/69] test(query): update the case. --- tests/system-test/2-query/interp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py index 5550519e05..7bf0191ec1 100644 --- a/tests/system-test/2-query/interp.py +++ b/tests/system-test/2-query/interp.py @@ -595,11 +595,11 @@ class TDTestCase: tdSql.checkData(2, i, 15) tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(linear)") - tdSql.checkRows(1) + tdSql.checkRows(3) tdSql.checkCols(4) for i in range (tdSql.queryCols): - tdSql.checkData(0, i, 15) + tdSql.checkData(0, i, 13) tdLog.printNoPrefix("==========step10:test error cases") From 88b4f9d9a81d90fb4b6352ac5aaa0b166a780e47 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 22 Sep 2022 13:23:16 +0800 Subject: [PATCH 48/69] fix: fix nchar compare issue --- source/libs/executor/src/timewindowoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 971f3618a0..660420aebb 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1115,7 +1115,7 @@ static bool compareVal(const char* v, const SStateKeys* pKey) { if (varDataLen(v) != varDataLen(pKey->pData)) { return false; } else { - return strncmp(varDataVal(v), varDataVal(pKey->pData), varDataLen(v)) == 0; + return memcmp(varDataVal(v), varDataVal(pKey->pData), varDataLen(v)) == 0; } } else { return memcmp(pKey->pData, v, pKey->bytes) == 0; From 7ecda770c214b57f5c629ad8670d291907c003bb Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 22 Sep 2022 14:03:11 +0800 Subject: [PATCH 49/69] fix: request free sequence problem --- source/client/inc/clientInt.h | 7 ++++--- source/client/src/clientEnv.c | 1 + source/client/src/clientMain.c | 16 ++++++---------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 44503c6638..535a436c6c 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -59,9 +59,9 @@ enum { #define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE) #define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) -#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) -#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) -#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) +#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) +#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) +#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) #define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA) typedef struct SAppInstInfo SAppInstInfo; @@ -251,6 +251,7 @@ typedef struct SRequestObj { uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog uint32_t retry; int64_t allocatorRefId; + SQuery* pQuery; } SRequestObj; typedef struct SSyncQueryParam { diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 2faf268880..624abe6da5 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -350,6 +350,7 @@ void doDestroyRequest(void *p) { taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->dbList); taosArrayDestroy(pRequest->targetTableList); + qDestroyQuery(pRequest->pQuery); nodesDestroyAllocator(pRequest->allocatorRefId); destroyQueryExecRes(&pRequest->body.resInfo.execRes); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 6b707bf7a0..831212bdee 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -670,7 +670,6 @@ typedef struct SqlParseWrapper { SParseContext *pCtx; SCatalogReq catalogReq; SRequestObj *pRequest; - SQuery *pQuery; } SqlParseWrapper; static void destoryTablesReq(void *p) { @@ -696,8 +695,8 @@ static void destorySqlParseWrapper(SqlParseWrapper *pWrapper) { void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { SqlParseWrapper *pWrapper = (SqlParseWrapper *)param; - SQuery *pQuery = pWrapper->pQuery; SRequestObj *pRequest = pWrapper->pRequest; + SQuery *pQuery = pRequest->pQuery; pRequest->metric.ctgEnd = taosGetTimestampUs(); @@ -726,10 +725,10 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { tscDebug("0x%" PRIx64 " analysis semantics completed, start async query, reqId:0x%" PRIx64, pRequest->self, pRequest->requestId); launchAsyncQuery(pRequest, pQuery, pResultMeta); - qDestroyQuery(pQuery); } else { destorySqlParseWrapper(pWrapper); - qDestroyQuery(pQuery); + qDestroyQuery(pRequest->pQuery); + pRequest->pQuery = NULL; if (NEED_CLIENT_HANDLE_ERROR(code)) { tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); @@ -802,12 +801,10 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { goto _error; } - SQuery *pQuery = NULL; - pRequest->metric.syntaxStart = taosGetTimestampUs(); SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)}; - code = qParseSqlSyntax(pCxt, &pQuery, &catalogReq); + code = qParseSqlSyntax(pCxt, &pRequest->pQuery, &catalogReq); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -817,9 +814,9 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { if (!updateMetaForce) { STscObj *pTscObj = pRequest->pTscObj; SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary; - if (NULL == pQuery->pRoot) { + if (NULL == pRequest->pQuery->pRoot) { atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1); - } else if (QUERY_NODE_SELECT_STMT == pQuery->pRoot->type) { + } else if (QUERY_NODE_SELECT_STMT == pRequest->pQuery->pRoot->type) { atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1); } } @@ -831,7 +828,6 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { } pWrapper->pCtx = pCxt; - pWrapper->pQuery = pQuery; pWrapper->pRequest = pRequest; pWrapper->catalogReq = catalogReq; From ac32abd39bf495fe8d55e41b0b97a9ada3659fa4 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 22 Sep 2022 14:46:54 +0800 Subject: [PATCH 50/69] fix(tsc):avoid invalid code --- source/client/src/clientHb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 75ccd44977..acf87f2aca 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -274,13 +274,13 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { SClientHbBatchRsp pRsp = {0}; if (TSDB_CODE_SUCCESS == code) { tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp); - } - int32_t now = taosGetTimestampSec(); - int32_t delta = abs(now - pRsp.svrTimestamp); - if (delta > timestampDeltaLimit) { - code = TSDB_CODE_TIME_UNSYNCED; - tscError("time diff: %ds is too big", delta); + int32_t now = taosGetTimestampSec(); + int32_t delta = abs(now - pRsp.svrTimestamp); + if (delta > timestampDeltaLimit) { + code = TSDB_CODE_TIME_UNSYNCED; + tscError("time diff: %ds is too big", delta); + } } int32_t rspNum = taosArrayGetSize(pRsp.rsps); From 0321b8c088abfbcf173cbc1e0d1e1ec17ef479df Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 22 Sep 2022 15:08:07 +0800 Subject: [PATCH 51/69] fix: avg function data scan optimization --- source/libs/function/src/builtins.c | 6 ++---- source/libs/nodes/src/nodesCodeFuncs.c | 14 ++++++++++++++ source/libs/parser/src/parInsert.c | 7 +++++-- source/libs/planner/src/planOptimizer.c | 2 +- source/libs/planner/test/planGroupByTest.cpp | 2 ++ 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index f3d3393ac3..0677bd7d63 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -207,7 +207,6 @@ static int32_t countTrailingSpaces(const SValueNode* pVal, bool isLtrim) { } return numOfSpaces; - } void static addTimezoneParam(SNodeList* pList) { @@ -322,7 +321,7 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len } int32_t numOfSpaces = 0; - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0); + SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0); // for select trim functions with constant value from table, // need to set the proper result result schema bytes to avoid // trailing garbage characters @@ -331,7 +330,6 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len numOfSpaces = countTrailingSpaces(pValue, isLtrim); } - int32_t resBytes = pPara1->resType.bytes - numOfSpaces; pFunc->node.resType = (SDataType){.bytes = resBytes, .type = pPara1->resType.type}; return TSDB_CODE_SUCCESS; @@ -2141,7 +2139,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "avg", .type = FUNCTION_TYPE_AVG, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED, .translateFunc = translateInNumOutDou, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getAvgFuncEnv, diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index afd05eff1d..c5851b7875 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -559,6 +559,8 @@ static const char* jkScanLogicPlanStableId = "StableId"; static const char* jkScanLogicPlanScanType = "ScanType"; static const char* jkScanLogicPlanScanCount = "ScanCount"; static const char* jkScanLogicPlanReverseScanCount = "ReverseScanCount"; +static const char* jkScanLogicPlanDynamicScanFuncs = "DynamicScanFuncs"; +static const char* jkScanLogicPlanDataRequired = "DataRequired"; static const char* jkScanLogicPlanTagCond = "TagCond"; static const char* jkScanLogicPlanGroupTags = "GroupTags"; @@ -590,6 +592,12 @@ static int32_t logicScanNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkScanLogicPlanReverseScanCount, pNode->scanSeq[1]); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkScanLogicPlanDynamicScanFuncs, nodeToJson, pNode->pDynamicScanFuncs); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkScanLogicPlanDataRequired, pNode->dataRequired); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddObject(pJson, jkScanLogicPlanTagCond, nodeToJson, pNode->pTagCond); } @@ -629,6 +637,12 @@ static int32_t jsonToLogicScanNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetUTinyIntValue(pJson, jkScanLogicPlanReverseScanCount, &pNode->scanSeq[1]); } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkScanLogicPlanDynamicScanFuncs, &pNode->pDynamicScanFuncs); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetIntValue(pJson, jkScanLogicPlanDataRequired, &pNode->dataRequired); + } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeObject(pJson, jkScanLogicPlanTagCond, &pNode->pTagCond); } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index ca9bb16c05..4fb55ed373 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -1537,6 +1537,9 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { autoCreateTbl = true; } else if (!existedUsing) { CHECK_CODE(getTableMeta(pCxt, tbNum, &name, dbFName)); + if (TSDB_SUPER_TABLE == pCxt->pTableMeta->tableType) { + return buildInvalidOperationMsg(&pCxt->msg, "insert data into super table is not supported"); + } } STableDataBlocks* dataBuf = NULL; @@ -2534,7 +2537,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols if (p) kv = *p; } - if (kv){ + if (kv) { int32_t colLen = kv->length; if (pColSchema->type == TSDB_DATA_TYPE_TIMESTAMP) { // uError("SML:data before:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision); @@ -2547,7 +2550,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols } else { MemRowAppend(&pBuf, &(kv->value), colLen, ¶m); } - }else{ + } else { pBuilder->hasNone = true; } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index b160f45479..a700a21301 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -617,7 +617,7 @@ static bool pushDownCondOptIsPriKey(SNode* pNode, SNodeList* pTableCols) { return false; } SColumnNode* pCol = (SColumnNode*)pNode; - if (PRIMARYKEY_TIMESTAMP_COL_ID != pCol->colId) { + if (PRIMARYKEY_TIMESTAMP_COL_ID != pCol->colId || TSDB_SYSTEM_TABLE == pCol->tableType) { return false; } return pushDownCondOptBelongThisTable(pNode, pTableCols); diff --git a/source/libs/planner/test/planGroupByTest.cpp b/source/libs/planner/test/planGroupByTest.cpp index a553d3addc..8b8f92bd4f 100644 --- a/source/libs/planner/test/planGroupByTest.cpp +++ b/source/libs/planner/test/planGroupByTest.cpp @@ -40,6 +40,8 @@ TEST_F(PlanGroupByTest, basic) { run("SELECT COUNT(*) FROM st1 GROUP BY c1"); run("SELECT SUM(c1) FROM st1 GROUP BY c2 HAVING SUM(c1) IS NOT NULL"); + + run("SELECT AVG(c1) FROM st1"); } TEST_F(PlanGroupByTest, withPartitionBy) { From 6bd5cbbfc3cad31e3bc77b9a9456985f12d521be Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 22 Sep 2022 15:24:33 +0800 Subject: [PATCH 52/69] fix(query): set correct page id list. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 07d8a2e6a7..f65fa1cf27 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -193,6 +193,8 @@ static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader); static int32_t doBuildDataBlock(STsdbReader* pReader); static TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader); +static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo); +static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader); static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); } @@ -1537,7 +1539,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* minKey = k.ts; } - if (minKey > key && pBlockData->nRow > 0) { + if (minKey > key && hasDataInFileBlock(pBlockData, pDumpInfo)) { minKey = key; } } else { @@ -1550,7 +1552,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* minKey = k.ts; } - if (minKey < key && pBlockData->nRow > 0) { + if (minKey < key && hasDataInFileBlock(pBlockData, pDumpInfo)) { minKey = key; } } @@ -1688,7 +1690,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader STableBlockScanInfo* pBlockScanInfo, SBlockData* pBlockData) { SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - if (pBlockData->nRow > 0) { + if (hasDataInFileBlock(pBlockData, pDumpInfo)) { // no last block available, only data block exists if (!hasDataInLastBlock(pLastBlockReader)) { return mergeRowsInFileBlocks(pBlockData, pBlockScanInfo, key, pReader); @@ -1753,7 +1755,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* tsLast = getCurrentKeyInLastBlock(pLastBlockReader); } - int64_t key = pBlockData->aTSKEY[pDumpInfo->rowIndex]; + int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo)? pBlockData->aTSKEY[pDumpInfo->rowIndex]:INT64_MIN; TSDBKEY k = TSDBROW_KEY(pRow); TSDBKEY ik = TSDBROW_KEY(piRow); @@ -1769,7 +1771,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* minKey = ik.ts; } - if (minKey > key && pBlockData->nRow > 0) { + if (minKey > key && hasDataInFileBlock(pBlockData, pDumpInfo)) { minKey = key; } @@ -1786,7 +1788,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* minKey = ik.ts; } - if (minKey < key && pBlockData->nRow > 0) { + if (minKey < key && hasDataInFileBlock(pBlockData, pDumpInfo)) { minKey = key; } @@ -2021,6 +2023,13 @@ static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader) { } static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLastBlockReader->mergeTree.pIter != NULL; } +bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) { + if (pBlockData->nRow > 0) { + ASSERT(pBlockData->nRow == pDumpInfo->totalRows); + } + + return pBlockData->nRow > 0 && (!pDumpInfo->allDumped); +} int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key, STsdbReader* pReader) { @@ -2052,7 +2061,7 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI SBlockData* pBlockData, SLastBlockReader* pLastBlockReader) { SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - int64_t key = (pBlockData->nRow > 0) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN; + int64_t key = (pBlockData->nRow > 0 && (!pDumpInfo->allDumped)) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN; if (pBlockScanInfo->iter.hasVal && pBlockScanInfo->iiter.hasVal) { return doMergeMultiLevelRows(pReader, pBlockScanInfo, pBlockData, pLastBlockReader); } else { From 092805b41f43edf2a4653d6a1fda66a739835a52 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 22 Sep 2022 15:41:58 +0800 Subject: [PATCH 53/69] fix(query): update check condition. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index f65fa1cf27..04dea49e23 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -895,7 +895,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn if (pData->cid < pColData->info.colId) { colIndex += 1; } else if (pData->cid == pColData->info.colId) { - if (pData->flag == HAS_NONE || pData->flag == HAS_NULL) { + if (((pData->flag & HAS_NONE) == HAS_NONE) || ((pData->flag & HAS_NULL) == HAS_NULL)) { colDataAppendNNULL(pColData, 0, remain); } else { if (IS_NUMERIC_TYPE(pColData->info.type) && asc) { From 118305fbdc96047dc8d5052c1b6e861273b13e0d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 22 Sep 2022 15:50:03 +0800 Subject: [PATCH 54/69] fix: let transaction info shows the correct action --- source/dnode/mnode/impl/src/mndTrans.c | 72 +++++++++++--------------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 8d42cdcfd6..91f9e19e9c 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -305,6 +305,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) { if (pTrans->commitActions == NULL) goto _OVER; for (int32_t i = 0; i < redoActionNum; ++i) { + memset(&action, 0, sizeof(action)); SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER) SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER) SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER) @@ -340,6 +341,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) { } for (int32_t i = 0; i < undoActionNum; ++i) { + memset(&action, 0, sizeof(action)); SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER) SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER) SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER) @@ -375,6 +377,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) { } for (int32_t i = 0; i < commitActionNum; ++i) { + memset(&action, 0, sizeof(action)); SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER) SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER) SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER) @@ -455,6 +458,20 @@ static const char *mndTransStr(ETrnStage stage) { } } +static void mndSetTransLastAction(STrans *pTrans, STransAction *pAction) { + if (pAction != NULL) { + pTrans->lastAction = pAction->id; + pTrans->lastMsgType = pAction->msgType; + pTrans->lastEpset = pAction->epSet; + pTrans->lastErrorNo = pAction->errCode; + } else { + pTrans->lastAction = 0; + pTrans->lastMsgType = 0; + memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset)); + pTrans->lastErrorNo = 0; + } +} + static void mndTransTestStartFunc(SMnode *pMnode, void *param, int32_t paramLen) { mInfo("test trans start, param:%s, len:%d", (char *)param, paramLen); } @@ -1037,18 +1054,12 @@ static int32_t mndTransWriteSingleLog(SMnode *pMnode, STrans *pTrans, STransActi mInfo("trans:%d, %s:%d write to sdb, type:%s status:%s", pTrans->id, mndTransStr(pAction->stage), pAction->id, sdbTableName(pAction->pRaw->type), sdbStatusName(pAction->pRaw->status)); - pTrans->lastAction = pAction->id; - pTrans->lastMsgType = pAction->msgType; - pTrans->lastEpset = pAction->epSet; - pTrans->lastErrorNo = 0; + mndSetTransLastAction(pTrans, pAction); } else { pAction->errCode = (terrno != 0) ? terrno : code; mError("trans:%d, %s:%d failed to write sdb since %s, type:%s status:%s", pTrans->id, mndTransStr(pAction->stage), pAction->id, terrstr(), sdbTableName(pAction->pRaw->type), sdbStatusName(pAction->pRaw->status)); - pTrans->lastAction = pAction->id; - pTrans->lastMsgType = pAction->msgType; - pTrans->lastEpset = pAction->epSet; - pTrans->lastErrorNo = pAction->errCode; + mndSetTransLastAction(pTrans, pAction); } return code; @@ -1082,15 +1093,10 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio if (code == 0) { pAction->msgSent = 1; pAction->msgReceived = 0; - pAction->errCode = 0; + pAction->errCode = TSDB_CODE_ACTION_IN_PROGRESS; mInfo("trans:%d, %s:%d is sent, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, detail); - pTrans->lastAction = pAction->id; - pTrans->lastMsgType = pAction->msgType; - pTrans->lastEpset = pAction->epSet; - if (pTrans->lastErrorNo == 0) { - pTrans->lastErrorNo = TSDB_CODE_ACTION_IN_PROGRESS; - } + mndSetTransLastAction(pTrans, pAction); } else { pAction->msgSent = 0; pAction->msgReceived = 0; @@ -1098,10 +1104,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio mError("trans:%d, %s:%d not send since %s, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, terrstr(), detail); - pTrans->lastAction = pAction->id; - pTrans->lastMsgType = pAction->msgType; - pTrans->lastEpset = pAction->epSet; - pTrans->lastErrorNo = pAction->errCode; + mndSetTransLastAction(pTrans, pAction); } return code; @@ -1112,10 +1115,7 @@ static int32_t mndTransExecNullMsg(SMnode *pMnode, STrans *pTrans, STransAction pAction->errCode = 0; mInfo("trans:%d, %s:%d confirm action executed", pTrans->id, mndTransStr(pAction->stage), pAction->id); - pTrans->lastAction = pAction->id; - pTrans->lastMsgType = pAction->msgType; - pTrans->lastEpset = pAction->epSet; - pTrans->lastErrorNo = 0; + mndSetTransLastAction(pTrans, pAction); return 0; } @@ -1161,25 +1161,19 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA errCode = pAction->errCode; pErrAction = pAction; } + } else { + pErrAction = pAction; } } + mndSetTransLastAction(pTrans, pErrAction); + if (numOfExecuted == numOfActions) { if (errCode == 0) { - pTrans->lastAction = 0; - pTrans->lastMsgType = 0; - memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset)); - pTrans->lastErrorNo = 0; mInfo("trans:%d, all %d actions execute successfully", pTrans->id, numOfActions); return 0; } else { mError("trans:%d, all %d actions executed, code:0x%x", pTrans->id, numOfActions, errCode & 0XFFFF); - if (pErrAction != NULL) { - pTrans->lastAction = pErrAction->id; - pTrans->lastMsgType = pErrAction->msgType; - pTrans->lastEpset = pErrAction->epSet; - pTrans->lastErrorNo = pErrAction->errCode; - } mndTransResetActions(pMnode, pTrans, pArray); terrno = errCode; return errCode; @@ -1220,6 +1214,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans) if (numOfActions == 0) return code; if (pTrans->redoActionPos >= numOfActions) return code; + mInfo("trans:%d, execute %d actions serial", pTrans->id, numOfActions); + for (int32_t action = pTrans->redoActionPos; action < numOfActions; ++action) { STransAction *pAction = taosArrayGet(pTrans->redoActions, pTrans->redoActionPos); @@ -1248,16 +1244,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans) if (code == 0) { pTrans->failedTimes = 0; - pTrans->lastAction = action; - pTrans->lastMsgType = 0; - pTrans->lastErrorNo = 0; - memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset)); - } else { - pTrans->lastAction = action; - pTrans->lastMsgType = pAction->msgType; - pTrans->lastErrorNo = code; - pTrans->lastEpset = pAction->epSet; } + mndSetTransLastAction(pTrans, pAction); if (mndCannotExecuteTransAction(pMnode)) break; From 3a21da6e4682430fb74a4e16fa8b93b0df052445 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 22 Sep 2022 11:38:54 +0800 Subject: [PATCH 55/69] fix(stream): data block capacity and function byte --- source/common/src/tdatablock.c | 8 ++++++-- source/libs/executor/src/scanoperator.c | 4 ++++ source/libs/function/src/builtinsimpl.c | 26 +++++++++++++------------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 8a8e6a83a5..23cc868658 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1278,7 +1278,9 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { colDataAssign(pDst, pSrc, src->info.rows, &src->info); } + uint32_t cap = dst->info.capacity; dst->info = src->info; + dst->info.capacity = cap; return 0; } @@ -1302,8 +1304,9 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) { colDataAssign(pDst, pSrc, src->info.rows, &src->info); } - + uint32_t cap = dst->info.capacity; dst->info = src->info; + dst->info.capacity = cap; return TSDB_CODE_SUCCESS; } @@ -1333,6 +1336,8 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) { // group id taosArrayPush(pBlock->pDataBlock, &infoData); + infoData.info.type = TSDB_DATA_TYPE_TIMESTAMP; + infoData.info.bytes = sizeof(TSKEY); // calculate start ts taosArrayPush(pBlock->pDataBlock, &infoData); // calculate end ts @@ -2280,4 +2285,3 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { ASSERT(pStart - pData == dataLen); return pStart; } - diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 18a75f0d04..5293e23fa7 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1303,10 +1303,14 @@ void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* 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); colDataAppend(pStartTsCol, pBlock->info.rows, (const char*)pStartTs, false); colDataAppend(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false); colDataAppend(pUidCol, pBlock->info.rows, (const char*)pUid, false); colDataAppend(pGpCol, pBlock->info.rows, (const char*)pGp, false); + colDataAppendNULL(pCalStartCol, pBlock->info.rows); + colDataAppendNULL(pCalEndCol, pBlock->info.rows); pBlock->info.rows++; } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index a23f58a732..9177d15fae 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -47,6 +47,7 @@ typedef struct SSumRes { uint64_t usum; double dsum; }; + int16_t type; } SSumRes; typedef struct SAvgRes { @@ -73,6 +74,7 @@ typedef struct SMinmaxResInfo { STuplePos nullTuplePos; bool nullTupleSaved; + int16_t type; } SMinmaxResInfo; typedef struct STopBotResItem { @@ -485,8 +487,7 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t firstCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SFirstLastRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; - int32_t bytes = pDestCtx->input.pData[0]->info.bytes; + int32_t bytes = pDBuf->bytes; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SFirstLastRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); @@ -617,6 +618,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { int32_t type = pInput->pData[0]->info.type; SSumRes* pSumRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + pSumRes->type = type; if (IS_NULL_TYPE(type)) { numOfElem = 0; @@ -740,10 +742,10 @@ int32_t sumInvertFunction(SqlFunctionCtx* pCtx) { int32_t sumCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SSumRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SSumRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type; if (IS_SIGNED_NUMERIC_TYPE(type) || type == TSDB_DATA_TYPE_BOOL) { pDBuf->isum += pSBuf->isum; @@ -1072,10 +1074,10 @@ int32_t avgInvertFunction(SqlFunctionCtx* pCtx) { int32_t avgCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SAvgRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SAvgRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type; if (IS_SIGNED_NUMERIC_TYPE(type)) { pDBuf->sum.isum += pSBuf->sum.isum; @@ -1181,6 +1183,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SMinmaxResInfo* pBuf = GET_ROWCELL_INTERBUF(pResInfo); + pBuf->type = type; if (IS_NULL_TYPE(type)) { numOfElems = 0; @@ -1729,10 +1732,10 @@ void replaceTupleData(STuplePos* pDestPos, STuplePos* pSourcePos) { int32_t minMaxCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx, int32_t isMinFunc) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SMinmaxResInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SMinmaxResInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type; if (IS_FLOAT_TYPE(type)) { if (pSBuf->assign && ((((*(double*)&pDBuf->v) < (*(double*)&pSBuf->v)) ^ isMinFunc) || !pDBuf->assign)) { *(double*)&pDBuf->v = *(double*)&pSBuf->v; @@ -2105,10 +2108,10 @@ int32_t stddevPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t stddevCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SStddevRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SStddevRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type; if (IS_SIGNED_NUMERIC_TYPE(type)) { pDBuf->isum += pSBuf->isum; @@ -3069,8 +3072,7 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SFirstLastRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; - int32_t bytes = pDestCtx->input.pData[0]->info.bytes; + int32_t bytes = pDBuf->bytes; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SFirstLastRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); @@ -3746,9 +3748,9 @@ void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type, } int32_t topCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { - int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); STopBotRes* pSBuf = getTopBotOutputInfo(pSourceCtx); + int16_t type = pSBuf->type; for (int32_t i = 0; i < pSResInfo->numOfRes; i++) { addResult(pDestCtx, pSBuf->pItems + i, type, true); } @@ -3756,9 +3758,9 @@ int32_t topCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { } int32_t bottomCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { - int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); STopBotRes* pSBuf = getTopBotOutputInfo(pSourceCtx); + int16_t type = pSBuf->type; for (int32_t i = 0; i < pSResInfo->numOfRes; i++) { addResult(pDestCtx, pSBuf->pItems + i, type, false); } @@ -5414,8 +5416,8 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { int32_t i = pInput->startRowIndex; if (pCtx->start.key != INT64_MIN) { - //ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) || - // (pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC)); + // ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) || + // (pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC)); ASSERT(last->key == INT64_MIN); for (; i < pInput->numOfRows + pInput->startRowIndex; ++i) { From c9bc7c397226c594cd59ec01a4a9a75927add6dc Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 22 Sep 2022 16:16:33 +0800 Subject: [PATCH 56/69] fix(query): update check condition. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 04dea49e23..5c1c145458 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -895,7 +895,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn if (pData->cid < pColData->info.colId) { colIndex += 1; } else if (pData->cid == pColData->info.colId) { - if (((pData->flag & HAS_NONE) == HAS_NONE) || ((pData->flag & HAS_NULL) == HAS_NULL)) { + if (pData->flag == HAS_NONE || pData->flag == HAS_NULL || pData->flag == (HAS_NULL|HAS_NONE)) { colDataAppendNNULL(pColData, 0, remain); } else { if (IS_NUMERIC_TYPE(pColData->info.type) && asc) { From 43ef21f67b997fc9dde326c41e9945ea4be261af Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 22 Sep 2022 16:18:51 +0800 Subject: [PATCH 57/69] enh: add oper name to show transaction --- include/util/tdef.h | 3 ++- source/common/src/systable.c | 1 + source/dnode/mnode/impl/inc/mndDef.h | 1 + source/dnode/mnode/impl/inc/mndTrans.h | 3 ++- source/dnode/mnode/impl/src/mndAcct.c | 2 +- source/dnode/mnode/impl/src/mndBnode.c | 4 ++-- source/dnode/mnode/impl/src/mndCluster.c | 4 ++-- source/dnode/mnode/impl/src/mndConsumer.c | 6 +++--- source/dnode/mnode/impl/src/mndDb.c | 6 +++--- source/dnode/mnode/impl/src/mndDnode.c | 6 +++--- source/dnode/mnode/impl/src/mndFunc.c | 4 ++-- source/dnode/mnode/impl/src/mndMnode.c | 6 +++--- source/dnode/mnode/impl/src/mndOffset.c | 2 +- source/dnode/mnode/impl/src/mndQnode.c | 4 ++-- source/dnode/mnode/impl/src/mndSma.c | 4 ++-- source/dnode/mnode/impl/src/mndSnode.c | 4 ++-- source/dnode/mnode/impl/src/mndStb.c | 6 +++--- source/dnode/mnode/impl/src/mndStream.c | 4 ++-- source/dnode/mnode/impl/src/mndSubscribe.c | 4 ++-- source/dnode/mnode/impl/src/mndTopic.c | 4 ++-- source/dnode/mnode/impl/src/mndTrans.c | 16 ++++++++++++++-- source/dnode/mnode/impl/src/mndUser.c | 8 ++++---- source/dnode/mnode/impl/src/mndVgroup.c | 6 +++--- source/dnode/mnode/impl/test/trans/trans2.cpp | 6 +++--- tests/script/tsim/trans/create_db.sim | 4 ++-- 25 files changed, 67 insertions(+), 51 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 840a2671fa..0c7c2ea3a3 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -225,7 +225,8 @@ typedef enum ELogicConditionType { #define TSDB_APP_NAME_LEN TSDB_UNI_LEN #define TSDB_TB_COMMENT_LEN 1025 -#define TSDB_QUERY_ID_LEN 26 +#define TSDB_QUERY_ID_LEN 26 +#define TSDB_TRANS_OPER_LEN 16 /** * In some scenarios uint16_t (0~65535) is used to store the row len. diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 25abd65b40..a45f7b2913 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -227,6 +227,7 @@ static const SSysDbTableSchema transSchema[] = { {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, {.name = "stage", .bytes = TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "oper", .bytes = TSDB_TRANS_OPER_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "stable", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "failed_times", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 537c9ca834..c3d03a6c5e 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -171,6 +171,7 @@ typedef struct { int32_t stopFunc; int32_t paramLen; void* param; + char opername[TSDB_TRANS_OPER_LEN]; SArray* pRpcArray; } STrans; diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h index 36d056a941..2372fa30e5 100644 --- a/source/dnode/mnode/impl/inc/mndTrans.h +++ b/source/dnode/mnode/impl/inc/mndTrans.h @@ -61,7 +61,8 @@ void mndCleanupTrans(SMnode *pMnode); STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId); void mndReleaseTrans(SMnode *pMnode, STrans *pTrans); -STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq); +STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq, + const char *opername); void mndTransDrop(STrans *pTrans); int32_t mndTransAppendRedolog(STrans *pTrans, SSdbRaw *pRaw); int32_t mndTransAppendUndolog(STrans *pTrans, SSdbRaw *pRaw); diff --git a/source/dnode/mnode/impl/src/mndAcct.c b/source/dnode/mnode/impl/src/mndAcct.c index 33f0bb7a34..e0713e1570 100644 --- a/source/dnode/mnode/impl/src/mndAcct.c +++ b/source/dnode/mnode/impl/src/mndAcct.c @@ -81,7 +81,7 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) { mDebug("acct:%s, will be created when deploying, raw:%p", acctObj.acct, pRaw); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-acct"); if (pTrans == NULL) { mError("acct:%s, failed to create since %s", acctObj.acct, terrstr()); return -1; diff --git a/source/dnode/mnode/impl/src/mndBnode.c b/source/dnode/mnode/impl/src/mndBnode.c index aafcd19992..6cabf6d57a 100644 --- a/source/dnode/mnode/impl/src/mndBnode.c +++ b/source/dnode/mnode/impl/src/mndBnode.c @@ -246,7 +246,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, bnodeObj.createdTime = taosGetTimestampMs(); bnodeObj.updateTime = bnodeObj.createdTime; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-bnode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId); @@ -354,7 +354,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn static int32_t mndDropBnode(SMnode *pMnode, SRpcMsg *pReq, SBnodeObj *pObj) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-bnode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id); diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 7d633f90bd..5ba39b4f1a 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -235,7 +235,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) { mDebug("cluster:%" PRId64 ", will be created when deploying, raw:%p", clusterObj.id, pRaw); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-cluster"); if (pTrans == NULL) { mError("cluster:%" PRId64 ", failed to create since %s", clusterObj.id, terrstr()); return -1; @@ -316,7 +316,7 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) { } mTrace("update cluster uptime to %" PRId64, clusterObj.upTime); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-uptime"); if (pTrans == NULL) return -1; SSdbRaw *pCommitRaw = mndClusterActionEncode(&clusterObj); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index cdfa208665..e0dbc26122 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -109,7 +109,7 @@ static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) { mndReleaseConsumer(pMnode, pConsumer); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "lost-csm"); if (pTrans == NULL) goto FAIL; if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL; if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL; @@ -142,7 +142,7 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) { mndReleaseConsumer(pMnode, pConsumer); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "recover-csm"); if (pTrans == NULL) goto FAIL; if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL; if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL; @@ -465,7 +465,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { int32_t newTopicNum = taosArrayGetSize(newSub); // check topic existance - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "subscribe"); if (pTrans == NULL) goto SUBSCRIBE_OVER; for (int32_t i = 0; i < newTopicNum; i++) { diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index d42ba1f7ff..39ec3484db 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -541,7 +541,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, } int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-db"); if (pTrans == NULL) goto _OVER; // mndTransSetSerial(pTrans); mDebug("trans:%d, used to create db:%s", pTrans->id, pCreate->db); @@ -773,7 +773,7 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * } static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *pNew) { - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "alter-db"); if (pTrans == NULL) return -1; mDebug("trans:%d, used to alter db:%s", pTrans->id, pOld->name); @@ -1027,7 +1027,7 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "drop-db"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop db:%s", pTrans->id, pDb->name); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 26b4080d14..c6fdf23023 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -104,7 +104,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) { memcpy(&dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN); snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port); - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-dnode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create dnode:%s on first deploy", pTrans->id, dnodeObj.ep); @@ -488,7 +488,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN); snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port); - pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep); @@ -667,7 +667,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM SSdbRaw *pRaw = NULL; STrans *pTrans = NULL; - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-dnode"); if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mInfo("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id); diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index e6f4b48524..429d840202 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -219,7 +219,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre } memcpy(func.pCode, pCreate->pCode, func.codeSize); - pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-func"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create func:%s", pTrans->id, pCreate->name); @@ -249,7 +249,7 @@ _OVER: static int32_t mndDropFunc(SMnode *pMnode, SRpcMsg *pReq, SFuncObj *pFunc) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-func"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop user:%s", pTrans->id, pFunc->name); diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 71bda4d4f3..a41f958c0f 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -91,7 +91,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) { mInfo("mnode:%d, will be created when deploying, raw:%p", mnodeObj.id, pRaw); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-mnode"); if (pTrans == NULL) { mError("mnode:%d, failed to create since %s", mnodeObj.id, terrstr()); return -1; @@ -362,7 +362,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, mnodeObj.createdTime = taosGetTimestampMs(); mnodeObj.updateTime = mnodeObj.createdTime; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "create-mnode"); if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mInfo("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId); @@ -571,7 +571,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) { int32_t code = -1; STrans *pTrans = NULL; - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-mnode"); if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id); diff --git a/source/dnode/mnode/impl/src/mndOffset.c b/source/dnode/mnode/impl/src/mndOffset.c index 037a46345f..797aa88670 100644 --- a/source/dnode/mnode/impl/src/mndOffset.c +++ b/source/dnode/mnode/impl/src/mndOffset.c @@ -181,7 +181,7 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) { tDecodeSMqCMCommitOffsetReq(&decoder, &commitOffsetReq); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "commit-offset"); for (int32_t i = 0; i < commitOffsetReq.num; i++) { SMqOffset *pOffset = &commitOffsetReq.offsets[i]; diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index f057f6190d..cd6e91b154 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -248,7 +248,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, qnodeObj.createdTime = taosGetTimestampMs(); qnodeObj.updateTime = qnodeObj.createdTime; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-qnode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId); @@ -364,7 +364,7 @@ int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pO static int32_t mndDropQnode(SMnode *pMnode, SRpcMsg *pReq, SQnodeObj *pObj) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-qnode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id); diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index 8638cc5118..3fdd3995f9 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -587,7 +587,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea nodesDestroyNode((SNode *)pPlan); int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-sma"); if (pTrans == NULL) goto _OVER; mndTransSetDbName(pTrans, pDb->name, NULL); mndTransSetSerial(pTrans); @@ -799,7 +799,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p pStb = mndAcquireStb(pMnode, pSma->stb); if (pStb == NULL) goto _OVER; - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "drop-sma"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop sma:%s", pTrans->id, pSma->name); diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c index d18a233d29..5f4231aa6a 100644 --- a/source/dnode/mnode/impl/src/mndSnode.c +++ b/source/dnode/mnode/impl/src/mndSnode.c @@ -253,7 +253,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, snodeObj.createdTime = taosGetTimestampMs(); snodeObj.updateTime = snodeObj.createdTime; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-snode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId); @@ -375,7 +375,7 @@ int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pO static int32_t mndDropSnode(SMnode *pMnode, SRpcMsg *pReq, SSnodeObj *pObj) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-snode"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 8719f9f8f0..ecb24becba 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -800,7 +800,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea SStbObj stbObj = {0}; int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "create-stb"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name); @@ -1843,7 +1843,7 @@ _OVER: static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp, void *alterOriData, int32_t alterOriDataLen) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "alter-stb"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to alter stb:%s", pTrans->id, pStb->name); @@ -2042,7 +2042,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "drop-stb"); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 515d5987b9..a039b54b80 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -666,7 +666,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { goto _OVER; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "create-stream"); if (pTrans == NULL) { mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); goto _OVER; @@ -759,7 +759,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { return -1; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-stream"); if (pTrans == NULL) { mError("stream:%s, failed to drop since %s", dropReq.name, terrstr()); sdbRelease(pMnode->pSdb, pStream); diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 3a3bf36594..43eae3f60c 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -441,7 +441,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR } static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) { - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "persist-reb"); mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL); if (pTrans == NULL) return -1; @@ -674,7 +674,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) { return -1; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-cgroup"); if (pTrans == NULL) { mError("cgroup: %s on topic:%s, failed to drop since %s", dropReq.cgroup, dropReq.topic, terrstr()); mndReleaseSubscribe(pMnode, pSub); diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index b24d7067bc..8fe2d1af15 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -440,7 +440,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * /*topicObj.withTbName = 1;*/ /*topicObj.withSchema = 1;*/ - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-topic"); if (pTrans == NULL) { mError("topic:%s, failed to create since %s", pCreate->name, terrstr()); taosMemoryFreeClear(topicObj.ast); @@ -663,7 +663,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) { return -1; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "drop-topic"); mndTransSetDbName(pTrans, pTopic->db, NULL); if (pTrans == NULL) { mError("topic:%s, failed to drop since %s", pTopic->name, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 91f9e19e9c..9d918e2abd 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -25,7 +25,7 @@ #define TRANS_VER_NUMBER 1 #define TRANS_ARRAY_SIZE 8 -#define TRANS_RESERVE_SIZE 64 +#define TRANS_RESERVE_SIZE 48 static SSdbRaw *mndTransActionEncode(STrans *pTrans); static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw); @@ -223,6 +223,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) { SDB_SET_BINARY(pRaw, dataPos, pTrans->param, pTrans->paramLen, _OVER) } + SDB_SET_BINARY(pRaw, dataPos, pTrans->opername, TSDB_TRANS_OPER_LEN, _OVER) SDB_SET_RESERVE(pRaw, dataPos, TRANS_RESERVE_SIZE, _OVER) SDB_SET_DATALEN(pRaw, dataPos, _OVER) @@ -420,6 +421,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) { SDB_GET_BINARY(pRaw, dataPos, pTrans->param, pTrans->paramLen, _OVER); } + SDB_GET_BINARY(pRaw, dataPos, pTrans->opername, TSDB_TRANS_OPER_LEN, _OVER); SDB_GET_RESERVE(pRaw, dataPos, TRANS_RESERVE_SIZE, _OVER) terrno = 0; @@ -599,7 +601,8 @@ void mndReleaseTrans(SMnode *pMnode, STrans *pTrans) { sdbRelease(pSdb, pTrans); } -STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq) { +STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq, + const char *opername) { STrans *pTrans = taosMemoryCalloc(1, sizeof(STrans)); if (pTrans == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -607,6 +610,10 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, return NULL; } + if (opername != NULL) { + tstrncpy(pTrans->opername, opername, TSDB_TRANS_OPER_LEN); + } + pTrans->id = sdbGetMaxId(pMnode->pSdb, SDB_TRANS); pTrans->stage = TRN_STAGE_PREPARE; pTrans->policy = policy; @@ -1587,6 +1594,11 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, (const char *)stage, false); + char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)opername, false); + char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 5da119bb30..c4adb03e21 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -81,7 +81,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char mDebug("user:%s, will be created when deploying, raw:%p", userObj.user, pRaw); - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-user"); if (pTrans == NULL) { mError("user:%s, failed to create since %s", userObj.user, terrstr()); return -1; @@ -299,7 +299,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate userObj.sysInfo = pCreate->sysInfo; userObj.enable = pCreate->enable; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-user"); if (pTrans == NULL) { mError("user:%s, failed to create since %s", pCreate->user, terrstr()); return -1; @@ -383,7 +383,7 @@ _OVER: } static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpcMsg *pReq) { - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "alter-user"); if (pTrans == NULL) { mError("user:%s, failed to alter since %s", pOld->user, terrstr()); return -1; @@ -598,7 +598,7 @@ _OVER: } static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) { - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-user"); if (pTrans == NULL) { mError("user:%s, failed to drop since %s", pUser->user, terrstr()); return -1; diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index a95bdef323..cc9ed5f9ba 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -1223,7 +1223,7 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSdbRaw *pRaw = NULL; STrans *pTrans = NULL; - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "red-vgroup"); if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mDebug("trans:%d, used to redistribute vgroup, vgId:%d", pTrans->id, pVgroup->vgId); @@ -1606,7 +1606,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj STrans *pTrans = NULL; SArray *pArray = mndBuildDnodesArray(pMnode, 0); - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "split-vgroup"); if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mDebug("trans:%d, used to split vgroup, vgId:%d", pTrans->id, pVgroup->vgId); @@ -1774,7 +1774,7 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) { pBalancedVgroups = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); if (pBalancedVgroups == NULL) goto _OVER; - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "balance-vgroup"); if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mDebug("trans:%d, used to balance vgroup", pTrans->id); diff --git a/source/dnode/mnode/impl/test/trans/trans2.cpp b/source/dnode/mnode/impl/test/trans/trans2.cpp index aee8aa2748..60be7cfbc0 100644 --- a/source/dnode/mnode/impl/test/trans/trans2.cpp +++ b/source/dnode/mnode/impl/test/trans/trans2.cpp @@ -115,7 +115,7 @@ class MndTestTrans2 : public ::testing::Test { userObj.superUser = 1; SRpcMsg rpcMsg = {0}; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, conflict, &rpcMsg); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, conflict, &rpcMsg, ""); SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj); mndTransAppendRedolog(pTrans, pRedoRaw); sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY); @@ -148,7 +148,7 @@ class MndTestTrans2 : public ::testing::Test { userObj.superUser = 1; SRpcMsg rpcMsg = {0}; - STrans *pTrans = mndTransCreate(pMnode, policy, conflict, &rpcMsg); + STrans *pTrans = mndTransCreate(pMnode, policy, conflict, &rpcMsg, ""); SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj); mndTransAppendRedolog(pTrans, pRedoRaw); sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY); @@ -220,7 +220,7 @@ class MndTestTrans2 : public ::testing::Test { userObj.superUser = 1; SRpcMsg rpcMsg = {0}; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, &rpcMsg); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, &rpcMsg, ""); SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj); mndTransAppendRedolog(pTrans, pRedoRaw); sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY); diff --git a/tests/script/tsim/trans/create_db.sim b/tests/script/tsim/trans/create_db.sim index 8543bec144..f04e505dd5 100644 --- a/tests/script/tsim/trans/create_db.sim +++ b/tests/script/tsim/trans/create_db.sim @@ -56,7 +56,7 @@ if $data[0][2] != redoAction then return -1 endi -if $data[0][3] != d1 then +if $data[0][4] != d1 then return -1 endi @@ -120,7 +120,7 @@ if $system_content != Windows_NT then return -1 endi - if $data[0][3] != d2 then + if $data[0][4] != d2 then return -1 endi From 9f45f81aa0ec22074e26bbcdf83f785217b81dc0 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 22 Sep 2022 16:54:39 +0800 Subject: [PATCH 58/69] fix: join validity check --- include/util/taoserror.h | 2 +- source/libs/parser/src/parTranslater.c | 14 ++++++++++++++ source/libs/parser/test/parSelectTest.cpp | 7 +++++++ source/libs/planner/test/planJoinTest.cpp | 8 ++------ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 840e7309fe..837d0c6303 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -552,7 +552,6 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653) #define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655) #define TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG TAOS_DEF_ERROR_CODE(0, 0x2656) - #define TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2657) #define TSDB_CODE_PAR_INVALID_WINDOW_PC TAOS_DEF_ERROR_CODE(0, 0x2658) #define TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2659) @@ -565,6 +564,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661) #define TSDB_CODE_PAR_GET_META_ERROR TAOS_DEF_ERROR_CODE(0, 0x2662) #define TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS TAOS_DEF_ERROR_CODE(0, 0x2663) +#define TSDB_CODE_PAR_NOT_SUPPORT_JOIN TAOS_DEF_ERROR_CODE(0, 0x2664) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index f0d5e5d67e..7d16758e56 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2213,6 +2213,17 @@ static int32_t setTableCacheLastMode(STranslateContext* pCxt, SSelectStmt* pSele return code; } +static int32_t checkJoinTable(STranslateContext* pCxt, SJoinTableNode* pJoinTable) { + if ((QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pLeft) && + !isTimeLineQuery(((STempTableNode*)pJoinTable->pLeft)->pSubquery)) || + (QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pRight) && + !isTimeLineQuery(((STempTableNode*)pJoinTable->pRight)->pSubquery))) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SUPPORT_JOIN, + "Join requires valid time series input"); + } + return TSDB_CODE_SUCCESS; +} + static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pTable)) { @@ -2259,6 +2270,9 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { if (TSDB_CODE_SUCCESS == code) { code = translateTable(pCxt, pJoinTable->pRight); } + if (TSDB_CODE_SUCCESS == code) { + code = checkJoinTable(pCxt, pJoinTable); + } if (TSDB_CODE_SUCCESS == code) { pJoinTable->table.precision = calcJoinTablePrecision(pJoinTable); pJoinTable->table.singleTable = joinTableIsSingleTable(pJoinTable); diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index 716dd7ffc0..be0ed72e23 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -445,4 +445,11 @@ TEST_F(ParserSelectTest, withoutFromSemanticCheck) { run("SELECT TBNAME", TSDB_CODE_PAR_INVALID_TBNAME); } +TEST_F(ParserSelectTest, joinSemanticCheck) { + useDb("root", "test"); + + run("SELECT * FROM (SELECT tag1, SUM(c1) s FROM st1 GROUP BY tag1) t1, st1 t2 where t1.tag1 = t2.tag1", + TSDB_CODE_PAR_NOT_SUPPORT_JOIN); +} + } // namespace ParserTest diff --git a/source/libs/planner/test/planJoinTest.cpp b/source/libs/planner/test/planJoinTest.cpp index 66ef4d3f19..535bb0b416 100644 --- a/source/libs/planner/test/planJoinTest.cpp +++ b/source/libs/planner/test/planJoinTest.cpp @@ -28,6 +28,8 @@ TEST_F(PlanJoinTest, basic) { run("SELECT t1.*, t2.* FROM st1s1 t1, st1s2 t2 WHERE t1.ts = t2.ts"); run("SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts"); + + run("SELECT t1.c1, t2.c1 FROM st1 t1 JOIN st2 t2 ON t1.ts = t2.ts"); } TEST_F(PlanJoinTest, complex) { @@ -56,9 +58,3 @@ TEST_F(PlanJoinTest, multiJoin) { run("SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts JOIN st1s3 t3 ON t1.ts = t3.ts"); } - -TEST_F(PlanJoinTest, stable) { - useDb("root", "test"); - - run("SELECT t1.c1, t2.c1 FROM st1 t1 JOIN st2 t2 ON t1.ts = t2.ts "); -} From 4d18cb302aa488bfd6575bbd455780ba3ca6f75c Mon Sep 17 00:00:00 2001 From: Xuefeng Tan <1172915550@qq.com> Date: Thu, 22 Sep 2022 16:56:42 +0800 Subject: [PATCH 59/69] enh(taosAdapter): adapt to TMQ_RES_METADATA type messages (#16997) --- cmake/taosadapter_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index 1a2f5d396f..16444c07f2 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG 05fb2ff + GIT_TAG be729ab SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 62b9419351376d7e7f33bbff32ed3c17a28c0453 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 22 Sep 2022 17:27:30 +0800 Subject: [PATCH 60/69] fix: window pseudo column check --- source/libs/parser/src/parTranslater.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 7d16758e56..23bc36e7ee 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1476,6 +1476,10 @@ static int32_t translateWindowPseudoColumnFunc(STranslateContext* pCxt, SFunctio if (!isSelectStmt(pCxt->pCurrStmt) || NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pWindow) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_WINDOW_PC); } + if (beforeHaving(pCxt->currClause)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_WINDOW_PC, "There mustn't be %s", + pFunc->functionName); + } return TSDB_CODE_SUCCESS; } From 33d40ce340d1cb973c78a5c41f2bb45300c42ecf Mon Sep 17 00:00:00 2001 From: xiaolei li <85657333+xleili@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:27:51 +0800 Subject: [PATCH 61/69] docs(driver)supply c# ws for docs en (#17009) --- docs/en/07-develop/01-connect/_connect_cs.mdx | 7 +- .../14-reference/03-connector/09-csharp.mdx | 115 +++++++++++++++++- 2 files changed, 115 insertions(+), 7 deletions(-) diff --git a/docs/en/07-develop/01-connect/_connect_cs.mdx b/docs/en/07-develop/01-connect/_connect_cs.mdx index 77fe269945..b81f49b2f0 100644 --- a/docs/en/07-develop/01-connect/_connect_cs.mdx +++ b/docs/en/07-develop/01-connect/_connect_cs.mdx @@ -2,7 +2,6 @@ {{#include docs/examples/csharp/connect/Program.cs}} ``` -:::info -C# connector supports only native connection for now. - -::: +```csharp title="WebSocket Connection" +{{#include docs/examples/csharp/wsConnect/Program.cs}} +``` diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx index c51c542c26..45bf7fdf82 100644 --- a/docs/en/14-reference/03-connector/09-csharp.mdx +++ b/docs/en/14-reference/03-connector/09-csharp.mdx @@ -17,7 +17,7 @@ import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx" `TDengine.Connector` is a C# language connector provided by TDengine that allows C# developers to develop C# applications that access TDengine cluster data. -The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc. The `TDengine.Connector` currently does not provide a REST connection interface. Developers can write their RESTful application by referring to the [REST API](/reference/rest-api/) documentation. +The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc.The `TDengine.Connector` also supports WebSocket and developers can build connection through DSN, which supports data writing, querying, and parameter binding, etc. This article describes how to install `TDengine.Connector` in a Linux or Windows environment and connect to TDengine clusters via `TDengine.Connector` to perform basic operations such as data writing and querying. @@ -35,6 +35,10 @@ Please refer to [version support list](/reference/connector#version-support) ## Supported features + + + + 1. Connection Management 2. General Query 3. Continuous Query @@ -42,6 +46,18 @@ Please refer to [version support list](/reference/connector#version-support) 5. Subscription 6. Schemaless + + + + +1. Connection Management +2. General Query +3. Continuous Query +4. Parameter Binding + + + + ## Installation Steps ### Pre-installation preparation @@ -74,11 +90,17 @@ cp -r src/ myProject cd myProject dotnet add exmaple.csproj reference src/TDengine.csproj ``` + ## Establish a Connection + + + + + ``` csharp using TDengineDriver; @@ -112,14 +134,62 @@ namespace TDengineExample ``` + + + + +The structure of the DSN description string is as follows: + +```text +[]://[[:@]:][/][?=[&=]] +|------------|---|-----------|-----------|------|------|------------|-----------------------| +| protocol | | username | password | host | port | database | params | +``` + +The parameters are described as follows: + +* **protocol**: Specify which connection method to use (support http/ws). For example, `ws://localhost:6041` uses Websocket to establish connections. +* **username/password**: Username and password used to create connections. +* **host/port**: Specifies the server and port to establish a connection. Websocket connections default to `localhost:6041`. +* **database**: Specify the default database to connect to. +* **params**:Optional parameters. + +A sample DSN description string is as follows: + +```text +ws://localhost:6041/test +``` + +``` csharp +{{#include docs/examples/csharp/wsConnect/Program.cs}} +``` + + + + ## Usage examples ### Write data #### SQL Write + + + + + + + + +```csharp +{{#include docs/examples/csharp/wsInsert/Program.cs}} +``` + + + + #### InfluxDB line protocol write @@ -132,12 +202,48 @@ namespace TDengineExample +#### Parameter Binding + + + + + +``` csharp +{{#include docs/examples/csharp/stmtInsert/Program.cs}} +``` + + + + + +```csharp +{{#include docs/examples/csharp/wsStmt/Program.cs}} +``` + + + + ### Query data #### Synchronous Query + + + + + + + + +```csharp +{{#include docs/examples/csharp/wsQuery/Program.cs}} +``` + + + + #### Asynchronous query @@ -145,18 +251,21 @@ namespace TDengineExample ### More sample programs |Sample program |Sample program description | -|--------------------------------------------------------------------------------------------------------------------|------------ --------------------------------| +|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------| | [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/Query/Query.cs) | Table creation, data insertion, and query examples with TDengine.Connector | | [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/JSONTag) | Writing and querying JSON tag data with TDengine Connector | | [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/Stmt) | Parameter binding with TDengine Connector | | [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/schemaless) | Schemaless writes with TDengine Connector | | [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/AsyncQuery/QueryAsync.cs) | Asynchronous queries with TDengine Connector | -| [TMQ](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | Data subscription with TDengine Connector | +| [Subscription](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | Subscription example with TDengine Connector | +| [Basic WebSocket Usage](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSample.cs) | WebSocket basic data in and out with TDengine connector | +| [WebSocket Parameter Binding](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSTMT.cs) | WebSocket parameter binding example | ## Important update records | TDengine.Connector | Description | |--------------------|--------------------------------| +| 3.0.1 | Support WebSocket and Cloud,With function query, insert, and parameter binding| | 3.0.0 | Supports TDengine 3.0.0.0. TDengine 2.x is not supported. Added `TDengine.Impl.GetData()` interface to deserialize query results. | | 1.0.7 | Fixed TDengine.Query() memory leak. | | 1.0.6 | Fix schemaless bug in 1.0.4 and 1.0.5. | From 3c65b2d81c60abd57e1447ef876236916ca041b5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 22 Sep 2022 17:55:02 +0800 Subject: [PATCH 62/69] docs: update the default value of supportVnodes --- docs/en/14-reference/12-config/index.md | 2 +- docs/zh/14-reference/12-config/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md index 02921c3f6a..462862103b 100644 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -325,7 +325,7 @@ The charset that takes effect is UTF-8. | Applicable | Server Only | | Meaning | Maximum number of vnodes per dnode | | Value Range | 0-4096 | -| Default Value | 256 | +| Default Value | 2x the CPU cores | ## Time Parameters diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index 7b31e10572..63244ed70d 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -325,7 +325,7 @@ charset 的有效值是 UTF-8。 | 适用范围 | 仅服务端适用 | | 含义 | dnode 支持的最大 vnode 数目 | | 取值范围 | 0-4096 | -| 缺省值 | 256 | +| 缺省值 | CPU 核数的 2 倍 | ## 时间相关 From cf39f2e20c0d281e958bf63c33f8fb37904a9273 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 22 Sep 2022 18:15:11 +0800 Subject: [PATCH 63/69] fix: window pseudo column check --- source/libs/parser/src/parTranslater.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 23bc36e7ee..88dd5afe57 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -264,6 +264,8 @@ static bool beforeHaving(ESqlClause clause) { return clause < SQL_CLAUSE_HAVING; static bool afterHaving(ESqlClause clause) { return clause > SQL_CLAUSE_HAVING; } +static bool beforeWindow(ESqlClause clause) { return clause < SQL_CLAUSE_WINDOW; } + static bool hasSameTableAlias(SArray* pTables) { if (taosArrayGetSize(pTables) < 2) { return false; @@ -1476,7 +1478,7 @@ static int32_t translateWindowPseudoColumnFunc(STranslateContext* pCxt, SFunctio if (!isSelectStmt(pCxt->pCurrStmt) || NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pWindow) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_WINDOW_PC); } - if (beforeHaving(pCxt->currClause)) { + if (beforeWindow(pCxt->currClause)) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_WINDOW_PC, "There mustn't be %s", pFunc->functionName); } From 50ebcb5006329f02c8acd95c3a243a21fb896435 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 22 Sep 2022 19:20:21 +0800 Subject: [PATCH 64/69] feat: case when expression --- include/common/ttokendef.h | 184 +- include/libs/nodes/nodes.h | 2 + include/libs/nodes/querynodes.h | 13 + source/libs/nodes/src/nodesCloneFuncs.c | 21 + source/libs/nodes/src/nodesCodeFuncs.c | 81 + source/libs/nodes/src/nodesEqualFuncs.c | 19 +- source/libs/nodes/src/nodesMsgFuncs.c | 103 +- source/libs/nodes/src/nodesTraverseFuncs.c | 38 + source/libs/nodes/src/nodesUtilFuncs.c | 18 + source/libs/parser/inc/parAst.h | 2 + source/libs/parser/inc/sql.y | 76 +- source/libs/parser/src/parAstCreater.c | 19 + source/libs/parser/src/parTokenizer.c | 5 + source/libs/parser/src/parTranslater.c | 78 +- source/libs/parser/src/sql.c | 4894 ++++++++++---------- source/libs/parser/test/parSelectTest.cpp | 5 + source/libs/planner/test/planBasicTest.cpp | 7 + 17 files changed, 3043 insertions(+), 2522 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 3e170d5098..0111b03aac 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -234,96 +234,100 @@ #define TK_CURRENT_USER 216 #define TK_COUNT 217 #define TK_LAST_ROW 218 -#define TK_BETWEEN 219 -#define TK_IS 220 -#define TK_NK_LT 221 -#define TK_NK_GT 222 -#define TK_NK_LE 223 -#define TK_NK_GE 224 -#define TK_NK_NE 225 -#define TK_MATCH 226 -#define TK_NMATCH 227 -#define TK_CONTAINS 228 -#define TK_IN 229 -#define TK_JOIN 230 -#define TK_INNER 231 -#define TK_SELECT 232 -#define TK_DISTINCT 233 -#define TK_WHERE 234 -#define TK_PARTITION 235 -#define TK_BY 236 -#define TK_SESSION 237 -#define TK_STATE_WINDOW 238 -#define TK_SLIDING 239 -#define TK_FILL 240 -#define TK_VALUE 241 -#define TK_NONE 242 -#define TK_PREV 243 -#define TK_LINEAR 244 -#define TK_NEXT 245 -#define TK_HAVING 246 -#define TK_RANGE 247 -#define TK_EVERY 248 -#define TK_ORDER 249 -#define TK_SLIMIT 250 -#define TK_SOFFSET 251 -#define TK_LIMIT 252 -#define TK_OFFSET 253 -#define TK_ASC 254 -#define TK_NULLS 255 -#define TK_ABORT 256 -#define TK_AFTER 257 -#define TK_ATTACH 258 -#define TK_BEFORE 259 -#define TK_BEGIN 260 -#define TK_BITAND 261 -#define TK_BITNOT 262 -#define TK_BITOR 263 -#define TK_BLOCKS 264 -#define TK_CHANGE 265 -#define TK_COMMA 266 -#define TK_COMPACT 267 -#define TK_CONCAT 268 -#define TK_CONFLICT 269 -#define TK_COPY 270 -#define TK_DEFERRED 271 -#define TK_DELIMITERS 272 -#define TK_DETACH 273 -#define TK_DIVIDE 274 -#define TK_DOT 275 -#define TK_EACH 276 -#define TK_END 277 -#define TK_FAIL 278 -#define TK_FILE 279 -#define TK_FOR 280 -#define TK_GLOB 281 -#define TK_ID 282 -#define TK_IMMEDIATE 283 -#define TK_IMPORT 284 -#define TK_INITIALLY 285 -#define TK_INSTEAD 286 -#define TK_ISNULL 287 -#define TK_KEY 288 -#define TK_NK_BITNOT 289 -#define TK_NK_SEMI 290 -#define TK_NOTNULL 291 -#define TK_OF 292 -#define TK_PLUS 293 -#define TK_PRIVILEGE 294 -#define TK_RAISE 295 -#define TK_REPLACE 296 -#define TK_RESTRICT 297 -#define TK_ROW 298 -#define TK_SEMI 299 -#define TK_STAR 300 -#define TK_STATEMENT 301 -#define TK_STRING 302 -#define TK_TIMES 303 -#define TK_UPDATE 304 -#define TK_VALUES 305 -#define TK_VARIABLE 306 -#define TK_VIEW 307 -#define TK_WAL 308 +#define TK_CASE 219 +#define TK_END 220 +#define TK_WHEN 221 +#define TK_THEN 222 +#define TK_ELSE 223 +#define TK_BETWEEN 224 +#define TK_IS 225 +#define TK_NK_LT 226 +#define TK_NK_GT 227 +#define TK_NK_LE 228 +#define TK_NK_GE 229 +#define TK_NK_NE 230 +#define TK_MATCH 231 +#define TK_NMATCH 232 +#define TK_CONTAINS 233 +#define TK_IN 234 +#define TK_JOIN 235 +#define TK_INNER 236 +#define TK_SELECT 237 +#define TK_DISTINCT 238 +#define TK_WHERE 239 +#define TK_PARTITION 240 +#define TK_BY 241 +#define TK_SESSION 242 +#define TK_STATE_WINDOW 243 +#define TK_SLIDING 244 +#define TK_FILL 245 +#define TK_VALUE 246 +#define TK_NONE 247 +#define TK_PREV 248 +#define TK_LINEAR 249 +#define TK_NEXT 250 +#define TK_HAVING 251 +#define TK_RANGE 252 +#define TK_EVERY 253 +#define TK_ORDER 254 +#define TK_SLIMIT 255 +#define TK_SOFFSET 256 +#define TK_LIMIT 257 +#define TK_OFFSET 258 +#define TK_ASC 259 +#define TK_NULLS 260 +#define TK_ABORT 261 +#define TK_AFTER 262 +#define TK_ATTACH 263 +#define TK_BEFORE 264 +#define TK_BEGIN 265 +#define TK_BITAND 266 +#define TK_BITNOT 267 +#define TK_BITOR 268 +#define TK_BLOCKS 269 +#define TK_CHANGE 270 +#define TK_COMMA 271 +#define TK_COMPACT 272 +#define TK_CONCAT 273 +#define TK_CONFLICT 274 +#define TK_COPY 275 +#define TK_DEFERRED 276 +#define TK_DELIMITERS 277 +#define TK_DETACH 278 +#define TK_DIVIDE 279 +#define TK_DOT 280 +#define TK_EACH 281 +#define TK_FAIL 282 +#define TK_FILE 283 +#define TK_FOR 284 +#define TK_GLOB 285 +#define TK_ID 286 +#define TK_IMMEDIATE 287 +#define TK_IMPORT 288 +#define TK_INITIALLY 289 +#define TK_INSTEAD 290 +#define TK_ISNULL 291 +#define TK_KEY 292 +#define TK_NK_BITNOT 293 +#define TK_NK_SEMI 294 +#define TK_NOTNULL 295 +#define TK_OF 296 +#define TK_PLUS 297 +#define TK_PRIVILEGE 298 +#define TK_RAISE 299 +#define TK_REPLACE 300 +#define TK_RESTRICT 301 +#define TK_ROW 302 +#define TK_SEMI 303 +#define TK_STAR 304 +#define TK_STATEMENT 305 +#define TK_STRING 306 +#define TK_TIMES 307 +#define TK_UPDATE 308 +#define TK_VALUES 309 +#define TK_VARIABLE 310 +#define TK_VIEW 311 +#define TK_WAL 312 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 634dae9ec5..301e11fd17 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -103,6 +103,8 @@ typedef enum ENodeType { QUERY_NODE_STREAM_OPTIONS, QUERY_NODE_LEFT_VALUE, QUERY_NODE_COLUMN_REF, + QUERY_NODE_WHEN_THEN, + QUERY_NODE_CASE_WHEN, // Statement nodes are used in parser and planner module. QUERY_NODE_SET_OPERATOR = 100, diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index e90c994e8f..9b150159fd 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -241,6 +241,19 @@ typedef struct SFillNode { STimeWindow timeRange; } SFillNode; +typedef struct SWhenThenNode { + SExprNode node; // QUERY_NODE_WHEN_THEN + SNode* pWhen; + SNode* pThen; +} SWhenThenNode; + +typedef struct SCaseWhenNode { + SExprNode node; // QUERY_NODE_CASE_WHEN + SNode* pCase; + SNode* pElse; + SNodeList* pWhenThenList; +} SCaseWhenNode; + typedef struct SSelectStmt { ENodeType type; // QUERY_NODE_SELECT_STMT bool isDistinct; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 48e21e137f..0db19c8ba9 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -324,6 +324,21 @@ static int32_t fillNodeCopy(const SFillNode* pSrc, SFillNode* pDst) { return TSDB_CODE_SUCCESS; } +static int32_t whenThenNodeCopy(const SWhenThenNode* pSrc, SWhenThenNode* pDst) { + COPY_BASE_OBJECT_FIELD(node, exprNodeCopy); + CLONE_NODE_FIELD(pWhen); + CLONE_NODE_FIELD(pThen); + return TSDB_CODE_SUCCESS; +} + +static int32_t caseWhenNodeCopy(const SCaseWhenNode* pSrc, SCaseWhenNode* pDst) { + COPY_BASE_OBJECT_FIELD(node, exprNodeCopy); + CLONE_NODE_FIELD(pCase); + CLONE_NODE_FIELD(pElse); + CLONE_NODE_LIST_FIELD(pWhenThenList); + return TSDB_CODE_SUCCESS; +} + static int32_t logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) { CLONE_NODE_LIST_FIELD(pTargets); CLONE_NODE_FIELD(pConditions); @@ -711,6 +726,12 @@ SNode* nodesCloneNode(const SNode* pNode) { case QUERY_NODE_LEFT_VALUE: code = TSDB_CODE_SUCCESS; break; + case QUERY_NODE_WHEN_THEN: + code = whenThenNodeCopy((const SWhenThenNode*)pNode, (SWhenThenNode*)pDst); + break; + case QUERY_NODE_CASE_WHEN: + code = caseWhenNodeCopy((const SCaseWhenNode*)pNode, (SCaseWhenNode*)pDst); + break; case QUERY_NODE_SELECT_STMT: code = selectStmtCopy((const SSelectStmt*)pNode, (SSelectStmt*)pDst); break; diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index afd05eff1d..5e520f2e21 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -81,6 +81,10 @@ const char* nodesNodeName(ENodeType type) { return "IndexOptions"; case QUERY_NODE_LEFT_VALUE: return "LeftValue"; + case QUERY_NODE_WHEN_THEN: + return "WhenThen"; + case QUERY_NODE_CASE_WHEN: + return "CaseWhen"; case QUERY_NODE_SET_OPERATOR: return "SetOperator"; case QUERY_NODE_SELECT_STMT: @@ -3903,6 +3907,75 @@ static int32_t jsonToDatabaseOptions(const SJson* pJson, void* pObj) { return code; } +static const char* jkWhenThenWhen = "When"; +static const char* jkWhenThenThen = "Then"; + +static int32_t whenThenNodeToJson(const void* pObj, SJson* pJson) { + const SWhenThenNode* pNode = (const SWhenThenNode*)pObj; + + int32_t code = exprNodeToJson(pObj, pJson); + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkWhenThenWhen, nodeToJson, pNode->pWhen); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkWhenThenThen, nodeToJson, pNode->pThen); + } + + return code; +} + +static int32_t jsonToWhenThenNode(const SJson* pJson, void* pObj) { + SWhenThenNode* pNode = (SWhenThenNode*)pObj; + + int32_t code = jsonToExprNode(pJson, pObj); + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkWhenThenWhen, &pNode->pWhen); + } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkWhenThenThen, &pNode->pThen); + } + + return code; +} + +static const char* jkCaseWhenCase = "Case"; +static const char* jkCaseWhenWhenThenList = "WhenThenList"; +static const char* jkCaseWhenElse = "Else"; + +static int32_t caseWhenNodeToJson(const void* pObj, SJson* pJson) { + const SCaseWhenNode* pNode = (const SCaseWhenNode*)pObj; + + int32_t code = exprNodeToJson(pObj, pJson); + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkCaseWhenCase, nodeToJson, pNode->pCase); + } + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkCaseWhenWhenThenList, pNode->pWhenThenList); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkCaseWhenElse, nodeToJson, pNode->pElse); + } + + return code; +} + +static int32_t jsonToCaseWhenNode(const SJson* pJson, void* pObj) { + SCaseWhenNode* pNode = (SCaseWhenNode*)pObj; + + int32_t code = jsonToExprNode(pJson, pObj); + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkCaseWhenCase, &pNode->pCase); + } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkCaseWhenWhenThenList, &pNode->pWhenThenList); + } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkCaseWhenElse, &pNode->pElse); + } + + return code; +} + static const char* jkDataBlockDescDataBlockId = "DataBlockId"; static const char* jkDataBlockDescSlots = "Slots"; static const char* jkDataBlockTotalRowSize = "TotalRowSize"; @@ -4385,6 +4458,10 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { return databaseOptionsToJson(pObj, pJson); case QUERY_NODE_LEFT_VALUE: return TSDB_CODE_SUCCESS; // SLeftValueNode has no fields to serialize. + case QUERY_NODE_WHEN_THEN: + return whenThenNodeToJson(pObj, pJson); + case QUERY_NODE_CASE_WHEN: + return caseWhenNodeToJson(pObj, pJson); case QUERY_NODE_SET_OPERATOR: return setOperatorToJson(pObj, pJson); case QUERY_NODE_SELECT_STMT: @@ -4548,6 +4625,10 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { return jsonToDatabaseOptions(pJson, pObj); case QUERY_NODE_LEFT_VALUE: return TSDB_CODE_SUCCESS; // SLeftValueNode has no fields to deserialize. + case QUERY_NODE_WHEN_THEN: + return jsonToWhenThenNode(pJson, pObj); + case QUERY_NODE_CASE_WHEN: + return jsonToCaseWhenNode(pJson, pObj); case QUERY_NODE_SET_OPERATOR: return jsonToSetOperator(pJson, pObj); case QUERY_NODE_SELECT_STMT: diff --git a/source/libs/nodes/src/nodesEqualFuncs.c b/source/libs/nodes/src/nodesEqualFuncs.c index 9cb7e8b66d..4e23999ec2 100644 --- a/source/libs/nodes/src/nodesEqualFuncs.c +++ b/source/libs/nodes/src/nodesEqualFuncs.c @@ -140,6 +140,19 @@ static bool functionNodeEqual(const SFunctionNode* a, const SFunctionNode* b) { return true; } +static bool whenThenNodeEqual(const SWhenThenNode* a, const SWhenThenNode* b) { + COMPARE_NODE_FIELD(pWhen); + COMPARE_NODE_FIELD(pThen); + return true; +} + +static bool caseWhenNodeEqual(const SCaseWhenNode* a, const SCaseWhenNode* b) { + COMPARE_NODE_FIELD(pCase); + COMPARE_NODE_FIELD(pElse); + COMPARE_NODE_LIST_FIELD(pWhenThenList); + return true; +} + bool nodesEqualNode(const SNode* a, const SNode* b) { if (a == b) { return true; @@ -164,13 +177,17 @@ bool nodesEqualNode(const SNode* a, const SNode* b) { return logicConditionNodeEqual((const SLogicConditionNode*)a, (const SLogicConditionNode*)b); case QUERY_NODE_FUNCTION: return functionNodeEqual((const SFunctionNode*)a, (const SFunctionNode*)b); + case QUERY_NODE_WHEN_THEN: + return whenThenNodeEqual((const SWhenThenNode*)a, (const SWhenThenNode*)b); + case QUERY_NODE_CASE_WHEN: + return caseWhenNodeEqual((const SCaseWhenNode*)a, (const SCaseWhenNode*)b); case QUERY_NODE_REAL_TABLE: case QUERY_NODE_TEMP_TABLE: case QUERY_NODE_JOIN_TABLE: case QUERY_NODE_GROUPING_SET: case QUERY_NODE_ORDER_BY_EXPR: case QUERY_NODE_LIMIT: - return false; // todo + return false; default: break; } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 2c47ddea8b..2249cfe888 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -1733,6 +1733,92 @@ static int32_t msgToDownstreamSourceNode(STlvDecoder* pDecoder, void* pObj) { return code; } +enum { WHEN_THEN_CODE_EXPR_BASE = 1, WHEN_THEN_CODE_WHEN, WHEN_THEN_CODE_THEN }; + +static int32_t whenThenNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { + const SWhenThenNode* pNode = (const SWhenThenNode*)pObj; + + int32_t code = tlvEncodeObj(pEncoder, WHEN_THEN_CODE_EXPR_BASE, exprNodeToMsg, pNode); + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, WHEN_THEN_CODE_WHEN, nodeToMsg, pNode->pWhen); + } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, WHEN_THEN_CODE_THEN, nodeToMsg, pNode->pThen); + } + + return code; +} + +static int32_t msgToWhenThenNode(STlvDecoder* pDecoder, void* pObj) { + SWhenThenNode* pNode = (SWhenThenNode*)pObj; + + int32_t code = TSDB_CODE_SUCCESS; + STlv* pTlv = NULL; + tlvForEach(pDecoder, pTlv, code) { + switch (pTlv->type) { + case WHEN_THEN_CODE_EXPR_BASE: + code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node); + break; + case WHEN_THEN_CODE_WHEN: + code = msgToNodeFromTlv(pTlv, (void**)&pNode->pWhen); + break; + case WHEN_THEN_CODE_THEN: + code = msgToNodeFromTlv(pTlv, (void**)&pNode->pThen); + break; + default: + break; + } + } + + return code; +} + +enum { CASE_WHEN_CODE_EXPR_BASE = 1, CASE_WHEN_CODE_CASE, CASE_WHEN_CODE_ELSE, CASE_WHEN_CODE_WHEN_THEN_LIST }; + +static int32_t caseWhenNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { + const SCaseWhenNode* pNode = (const SCaseWhenNode*)pObj; + + int32_t code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_EXPR_BASE, exprNodeToMsg, pNode); + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_CASE, nodeToMsg, pNode->pCase); + } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_ELSE, nodeToMsg, pNode->pElse); + } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_WHEN_THEN_LIST, nodeListToMsg, pNode->pWhenThenList); + } + + return code; +} + +static int32_t msgToCaseWhenNode(STlvDecoder* pDecoder, void* pObj) { + SCaseWhenNode* pNode = (SCaseWhenNode*)pObj; + + int32_t code = TSDB_CODE_SUCCESS; + STlv* pTlv = NULL; + tlvForEach(pDecoder, pTlv, code) { + switch (pTlv->type) { + case CASE_WHEN_CODE_EXPR_BASE: + code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node); + break; + case CASE_WHEN_CODE_CASE: + code = msgToNodeFromTlv(pTlv, (void**)&pNode->pCase); + break; + case CASE_WHEN_CODE_ELSE: + code = msgToNodeFromTlv(pTlv, (void**)&pNode->pElse); + break; + case CASE_WHEN_CODE_WHEN_THEN_LIST: + code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pWhenThenList); + break; + default: + break; + } + } + + return code; +} + enum { PHY_NODE_CODE_OUTPUT_DESC = 1, PHY_NODE_CODE_CONDITIONS, @@ -3434,9 +3520,16 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { code = slotDescNodeToMsg(pObj, pEncoder); break; case QUERY_NODE_DOWNSTREAM_SOURCE: - return downstreamSourceNodeToMsg(pObj, pEncoder); + code = downstreamSourceNodeToMsg(pObj, pEncoder); + break; case QUERY_NODE_LEFT_VALUE: break; + case QUERY_NODE_WHEN_THEN: + code = whenThenNodeToMsg(pObj, pEncoder); + break; + case QUERY_NODE_CASE_WHEN: + code = caseWhenNodeToMsg(pObj, pEncoder); + break; case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: code = physiScanNodeToMsg(pObj, pEncoder); @@ -3563,9 +3656,15 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) { code = msgToSlotDescNode(pDecoder, pObj); break; case QUERY_NODE_DOWNSTREAM_SOURCE: - return msgToDownstreamSourceNode(pDecoder, pObj); + code = msgToDownstreamSourceNode(pDecoder, pObj); case QUERY_NODE_LEFT_VALUE: break; + case QUERY_NODE_WHEN_THEN: + code = msgToWhenThenNode(pDecoder, pObj); + break; + case QUERY_NODE_CASE_WHEN: + code = msgToCaseWhenNode(pDecoder, pObj); + break; case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: code = msgToPhysiScanNode(pDecoder, pObj); diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c index 728e173ff8..8ea80344fc 100644 --- a/source/libs/nodes/src/nodesTraverseFuncs.c +++ b/source/libs/nodes/src/nodesTraverseFuncs.c @@ -146,6 +146,25 @@ static EDealRes dispatchExpr(SNode* pNode, ETraversalOrder order, FNodeWalker wa case QUERY_NODE_TARGET: res = walkExpr(((STargetNode*)pNode)->pExpr, order, walker, pContext); break; + case QUERY_NODE_WHEN_THEN: { + SWhenThenNode* pWhenThen = (SWhenThenNode*)pNode; + res = walkExpr(pWhenThen->pWhen, order, walker, pContext); + if (DEAL_RES_ERROR != res && DEAL_RES_END != res) { + res = walkExpr(pWhenThen->pThen, order, walker, pContext); + } + break; + } + case QUERY_NODE_CASE_WHEN: { + SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)pNode; + res = walkExpr(pCaseWhen->pCase, order, walker, pContext); + if (DEAL_RES_ERROR != res && DEAL_RES_END != res) { + res = walkExpr(pCaseWhen->pElse, order, walker, pContext); + } + if (DEAL_RES_ERROR != res && DEAL_RES_END != res) { + res = walkExprs(pCaseWhen->pWhenThenList, order, walker, pContext); + } + break; + } default: break; } @@ -291,6 +310,25 @@ static EDealRes rewriteExpr(SNode** pRawNode, ETraversalOrder order, FNodeRewrit case QUERY_NODE_TARGET: res = rewriteExpr(&(((STargetNode*)pNode)->pExpr), order, rewriter, pContext); break; + case QUERY_NODE_WHEN_THEN: { + SWhenThenNode* pWhenThen = (SWhenThenNode*)pNode; + res = rewriteExpr(&pWhenThen->pWhen, order, rewriter, pContext); + if (DEAL_RES_ERROR != res && DEAL_RES_END != res) { + res = rewriteExpr(&pWhenThen->pThen, order, rewriter, pContext); + } + break; + } + case QUERY_NODE_CASE_WHEN: { + SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)pNode; + res = rewriteExpr(&pCaseWhen->pCase, order, rewriter, pContext); + if (DEAL_RES_ERROR != res && DEAL_RES_END != res) { + res = rewriteExpr(&pCaseWhen->pElse, order, rewriter, pContext); + } + if (DEAL_RES_ERROR != res && DEAL_RES_END != res) { + res = rewriteExprs(pCaseWhen->pWhenThenList, order, rewriter, pContext); + } + break; + } default: break; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 2e5a0d935b..7a04d319ec 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -291,6 +291,10 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SLeftValueNode)); case QUERY_NODE_COLUMN_REF: return makeNode(type, sizeof(SColumnDefNode)); + case QUERY_NODE_WHEN_THEN: + return makeNode(type, sizeof(SWhenThenNode)); + case QUERY_NODE_CASE_WHEN: + return makeNode(type, sizeof(SCaseWhenNode)); case QUERY_NODE_SET_OPERATOR: return makeNode(type, sizeof(SSetOperator)); case QUERY_NODE_SELECT_STMT: @@ -738,7 +742,21 @@ void nodesDestroyNode(SNode* pNode) { break; } case QUERY_NODE_LEFT_VALUE: // no pointer field + case QUERY_NODE_COLUMN_REF: // no pointer field break; + case QUERY_NODE_WHEN_THEN: { + SWhenThenNode* pStmt = (SWhenThenNode*)pNode; + nodesDestroyNode(pStmt->pWhen); + nodesDestroyNode(pStmt->pThen); + break; + } + case QUERY_NODE_CASE_WHEN: { + SCaseWhenNode* pStmt = (SCaseWhenNode*)pNode; + nodesDestroyNode(pStmt->pCase); + nodesDestroyNode(pStmt->pElse); + nodesDestroyList(pStmt->pWhenThenList); + break; + } case QUERY_NODE_SET_OPERATOR: { SSetOperator* pStmt = (SSetOperator*)pNode; nodesDestroyList(pStmt->pProjectionList); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 898e4bf732..dea741cc9b 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -119,6 +119,8 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues); SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode); SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd); +SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen); +SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse); SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere); SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 6e43843cda..3e05583d92 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -625,42 +625,44 @@ stream_name(A) ::= NK_ID(B). cgroup_name(A) ::= NK_ID(B). { A = B; } /************************************************ expression **********************************************************/ +expr_or_subquery(A) ::= expression(B). { A = B; } +expr_or_subquery(A) ::= subquery(B). { A = B; } + expression(A) ::= literal(B). { A = B; } expression(A) ::= pseudo_column(B). { A = B; } expression(A) ::= column_reference(B). { A = B; } expression(A) ::= function_expression(B). { A = B; } -//expression(A) ::= case_expression(B). { A = B; } -expression(A) ::= subquery(B). { A = B; } +expression(A) ::= case_when_expression(B). { A = B; } expression(A) ::= NK_LP(B) expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); } -expression(A) ::= NK_PLUS(B) expression(C). { +expression(A) ::= NK_PLUS(B) expr_or_subquery(C). { SToken t = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &B, &t, releaseRawExprNode(pCxt, C)); } -expression(A) ::= NK_MINUS(B) expression(C). { +expression(A) ::= NK_MINUS(B) expr_or_subquery(C). { SToken t = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, C), NULL)); } -expression(A) ::= expression(B) NK_PLUS expression(C). { +expression(A) ::= expr_or_subquery(B) NK_PLUS expr_or_subquery(C). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } -expression(A) ::= expression(B) NK_MINUS expression(C). { +expression(A) ::= expr_or_subquery(B) NK_MINUS expr_or_subquery(C). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } -expression(A) ::= expression(B) NK_STAR expression(C). { +expression(A) ::= expr_or_subquery(B) NK_STAR expr_or_subquery(C). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } -expression(A) ::= expression(B) NK_SLASH expression(C). { +expression(A) ::= expr_or_subquery(B) NK_SLASH expr_or_subquery(C). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } -expression(A) ::= expression(B) NK_REM expression(C). { +expression(A) ::= expr_or_subquery(B) NK_REM expr_or_subquery(C). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); @@ -669,12 +671,12 @@ expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). SToken s = getTokenFromRawExprNode(pCxt, B); A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, B), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C))); } -expression(A) ::= expression(B) NK_BITAND expression(C). { +expression(A) ::= expr_or_subquery(B) NK_BITAND expr_or_subquery(C). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } -expression(A) ::= expression(B) NK_BITOR expression(C). { +expression(A) ::= expr_or_subquery(B) NK_BITOR expr_or_subquery(C). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); @@ -682,8 +684,8 @@ expression(A) ::= expression(B) NK_BITOR expression(C). %type expression_list { SNodeList* } %destructor expression_list { nodesDestroyList($$); } -expression_list(A) ::= expression(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); } -expression_list(A) ::= expression_list(B) NK_COMMA expression(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); } +expression_list(A) ::= expr_or_subquery(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); } +expression_list(A) ::= expression_list(B) NK_COMMA expr_or_subquery(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); } column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); } column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } @@ -700,7 +702,8 @@ pseudo_column(A) ::= WDURATION(B). function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } -function_expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } +function_expression(A) ::= + CAST(B) NK_LP expr_or_subquery(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } function_expression(A) ::= literal_func(B). { A = B; } literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); } @@ -735,35 +738,52 @@ star_func_para_list(A) ::= other_para_list(B). other_para_list(A) ::= star_func_para(B). { A = createNodeList(pCxt, B); } other_para_list(A) ::= other_para_list(B) NK_COMMA star_func_para(C). { A = addNodeToList(pCxt, B, C); } -star_func_para(A) ::= expression(B). { A = releaseRawExprNode(pCxt, B); } +star_func_para(A) ::= expr_or_subquery(B). { A = releaseRawExprNode(pCxt, B); } star_func_para(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); } +case_when_expression(A) ::= + CASE(E) when_then_list(C) case_when_else_opt(D) END(F). { A = createRawExprNodeExt(pCxt, &E, &F, createCaseWhenNode(pCxt, NULL, C, D)); } +case_when_expression(A) ::= + CASE(E) common_expression(B) when_then_list(C) case_when_else_opt(D) END(F). { A = createRawExprNodeExt(pCxt, &E, &F, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, B), C, D)); } + +%type when_then_list { SNodeList* } +%destructor when_then_list { nodesDestroyList($$); } +when_then_list(A) ::= when_then_expr(B). { A = createNodeList(pCxt, B); } +when_then_list(A) ::= when_then_list(B) when_then_expr(C). { A = addNodeToList(pCxt, B, C); } + +when_then_expr(A) ::= WHEN common_expression(B) THEN common_expression(C). { A = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); } + +case_when_else_opt(A) ::= . { A = NULL; } +case_when_else_opt(A) ::= ELSE common_expression(B). { A = releaseRawExprNode(pCxt, B); } + /************************************************ predicate ***********************************************************/ -predicate(A) ::= expression(B) compare_op(C) expression(D). { +predicate(A) ::= expr_or_subquery(B) compare_op(C) expr_or_subquery(D). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, D); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D))); } //predicate(A) ::= expression(B) compare_op sub_type expression(B). -predicate(A) ::= expression(B) BETWEEN expression(C) AND expression(D). { +predicate(A) ::= + expr_or_subquery(B) BETWEEN expr_or_subquery(C) AND expr_or_subquery(D). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, D); A = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D))); } -predicate(A) ::= expression(B) NOT BETWEEN expression(C) AND expression(D). { +predicate(A) ::= + expr_or_subquery(B) NOT BETWEEN expr_or_subquery(C) AND expr_or_subquery(D). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, D); A = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D))); } -predicate(A) ::= expression(B) IS NULL(C). { +predicate(A) ::= expr_or_subquery(B) IS NULL(C). { SToken s = getTokenFromRawExprNode(pCxt, B); A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, B), NULL)); } -predicate(A) ::= expression(B) IS NOT NULL(C). { +predicate(A) ::= expr_or_subquery(B) IS NOT NULL(C). { SToken s = getTokenFromRawExprNode(pCxt, B); A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, B), NULL)); } -predicate(A) ::= expression(B) in_op(C) in_predicate_value(D). { +predicate(A) ::= expr_or_subquery(B) in_op(C) in_predicate_value(D). { SToken s = getTokenFromRawExprNode(pCxt, B); SToken e = getTokenFromRawExprNode(pCxt, D); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D))); @@ -813,7 +833,7 @@ boolean_primary(A) ::= predicate(B). boolean_primary(A) ::= NK_LP(C) boolean_value_expression(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, releaseRawExprNode(pCxt, B)); } /************************************************ common_expression ********************************************/ -common_expression(A) ::= expression(B). { A = B; } +common_expression(A) ::= expr_or_subquery(B). { A = B; } common_expression(A) ::= boolean_value_expression(B). { A = B; } /************************************************ from_clause_opt *********************************************************/ @@ -894,7 +914,7 @@ partition_by_clause_opt(A) ::= PARTITION BY expression_list(B). twindow_clause_opt(A) ::= . { A = NULL; } twindow_clause_opt(A) ::= SESSION NK_LP column_reference(B) NK_COMMA duration_literal(C) NK_RP. { A = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); } -twindow_clause_opt(A) ::= STATE_WINDOW NK_LP expression(B) NK_RP. { A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B)); } +twindow_clause_opt(A) ::= STATE_WINDOW NK_LP expr_or_subquery(B) NK_RP. { A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B)); } twindow_clause_opt(A) ::= INTERVAL NK_LP duration_literal(B) NK_RP sliding_opt(C) fill_opt(D). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), NULL, C, D); } twindow_clause_opt(A) ::= @@ -923,14 +943,15 @@ group_by_clause_opt(A) ::= GROUP BY group_by_list(B). %type group_by_list { SNodeList* } %destructor group_by_list { nodesDestroyList($$); } -group_by_list(A) ::= expression(B). { A = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, B))); } -group_by_list(A) ::= group_by_list(B) NK_COMMA expression(C). { A = addNodeToList(pCxt, B, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, C))); } +group_by_list(A) ::= expr_or_subquery(B). { A = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, B))); } +group_by_list(A) ::= group_by_list(B) NK_COMMA expr_or_subquery(C). { A = addNodeToList(pCxt, B, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, C))); } having_clause_opt(A) ::= . { A = NULL; } having_clause_opt(A) ::= HAVING search_condition(B). { A = B; } range_opt(A) ::= . { A = NULL; } -range_opt(A) ::= RANGE NK_LP expression(B) NK_COMMA expression(C) NK_RP. { A = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); } +range_opt(A) ::= + RANGE NK_LP expr_or_subquery(B) NK_COMMA expr_or_subquery(C) NK_RP. { A = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); } every_opt(A) ::= . { A = NULL; } every_opt(A) ::= EVERY NK_LP duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); } @@ -974,6 +995,7 @@ limit_clause_opt(A) ::= LIMIT NK_INTEGER(C) NK_COMMA NK_INTEGER(B). /************************************************ subquery ************************************************************/ subquery(A) ::= NK_LP(B) query_expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, C); } +subquery(A) ::= NK_LP(B) subquery(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); } /************************************************ search_condition ****************************************************/ search_condition(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); } @@ -986,7 +1008,7 @@ sort_specification_list(A) ::= sort_specification_list(B) NK_COMMA sort_specification(C). { A = addNodeToList(pCxt, B, C); } sort_specification(A) ::= - expression(B) ordering_specification_opt(C) null_ordering_opt(D). { A = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, B), C, D); } + expr_or_subquery(B) ordering_specification_opt(C) null_ordering_opt(D). { A = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, B), C, D); } %type ordering_specification_opt EOrder %destructor ordering_specification_opt { } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 379bd975b4..65afc84c9d 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -647,6 +647,25 @@ SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd return createBetweenAnd(pCxt, createPrimaryKeyCol(pCxt, NULL), pStart, pEnd); } +SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen) { + CHECK_PARSER_STATUS(pCxt); + SWhenThenNode* pWhenThen = (SWhenThenNode*)nodesMakeNode(QUERY_NODE_WHEN_THEN); + CHECK_OUT_OF_MEM(pWhenThen); + pWhenThen->pWhen = pWhen; + pWhenThen->pThen = pThen; + return (SNode*)pWhenThen; +} + +SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse) { + CHECK_PARSER_STATUS(pCxt); + SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)nodesMakeNode(QUERY_NODE_CASE_WHEN); + CHECK_OUT_OF_MEM(pCaseWhen); + pCaseWhen->pCase = pCase; + pCaseWhen->pWhenThenList = pWhenThenList; + pCaseWhen->pElse = pElse; + return (SNode*)pCaseWhen; +} + SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias) { CHECK_PARSER_STATUS(pCxt); trimEscape(pAlias); diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 68eb3e6fb1..c51553f7a1 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -54,6 +54,7 @@ static SKeyword keywordTable[] = { {"CACHE", TK_CACHE}, {"CACHEMODEL", TK_CACHEMODEL}, {"CACHESIZE", TK_CACHESIZE}, + {"CASE", TK_CASE}, {"CAST", TK_CAST}, {"CLIENT_VERSION", TK_CLIENT_VERSION}, {"CLUSTER", TK_CLUSTER}, @@ -82,7 +83,9 @@ static SKeyword keywordTable[] = { {"DOUBLE", TK_DOUBLE}, {"DROP", TK_DROP}, {"DURATION", TK_DURATION}, + {"ELSE", TK_ELSE}, {"ENABLE", TK_ENABLE}, + {"END", TK_END}, {"EXISTS", TK_EXISTS}, {"EXPIRED", TK_EXPIRED}, {"EXPLAIN", TK_EXPLAIN}, @@ -205,6 +208,7 @@ static SKeyword keywordTable[] = { {"TAG", TK_TAG}, {"TAGS", TK_TAGS}, {"TBNAME", TK_TBNAME}, + {"THEN", TK_THEN}, {"TIMESTAMP", TK_TIMESTAMP}, {"TIMEZONE", TK_TIMEZONE}, {"TINYINT", TK_TINYINT}, @@ -240,6 +244,7 @@ static SKeyword keywordTable[] = { {"WAL_ROLL_PERIOD", TK_WAL_ROLL_PERIOD}, {"WAL_SEGMENT_SIZE", TK_WAL_SEGMENT_SIZE}, {"WATERMARK", TK_WATERMARK}, + {"WHEN", TK_WHEN}, {"WHERE", TK_WHERE}, {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, {"WITH", TK_WITH}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index f0d5e5d67e..a90d6707bd 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1807,6 +1807,59 @@ static EDealRes translateLogicCond(STranslateContext* pCxt, SLogicConditionNode* return DEAL_RES_CONTINUE; } +static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "cast"); + pFunc->node.resType = dt; + if (TSDB_CODE_SUCCESS != nodesListMakeAppend(&pFunc->pParameterList, pExpr)) { + nodesDestroyNode((SNode*)pFunc); + return TSDB_CODE_OUT_OF_MEMORY; + } + if (TSDB_CODE_SUCCESS != getFuncInfo(pCxt, pFunc)) { + nodesClearList(pFunc->pParameterList); + pFunc->pParameterList = NULL; + nodesDestroyNode((SNode*)pFunc); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pExpr)->aliasName); + } + *pCast = (SNode*)pFunc; + return TSDB_CODE_SUCCESS; +} + +static EDealRes translateWhenThen(STranslateContext* pCxt, SWhenThenNode* pWhenThen) { + pWhenThen->node.resType = ((SExprNode*)pWhenThen->pThen)->resType; + return DEAL_RES_CONTINUE; +} + +static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseWhen) { + bool first = true; + SNode* pNode = NULL; + FOREACH(pNode, pCaseWhen->pWhenThenList) { + if (first) { + pCaseWhen->node.resType = ((SExprNode*)pNode)->resType; + } else if (!dataTypeEqual(&pCaseWhen->node.resType, &((SExprNode*)pNode)->resType)) { + SWhenThenNode* pWhenThen = (SWhenThenNode*)pNode; + SNode* pCastFunc = NULL; + if (TSDB_CODE_SUCCESS != createCastFunc(pCxt, pWhenThen->pThen, pCaseWhen->node.resType, &pCastFunc)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "CASE WHEN data type mismatch"); + } + pWhenThen->pThen = pCastFunc; + pWhenThen->node.resType = pCaseWhen->node.resType; + } + } + if (NULL != pCaseWhen->pElse && !dataTypeEqual(&pCaseWhen->node.resType, &((SExprNode*)pCaseWhen->pElse)->resType)) { + SNode* pCastFunc = NULL; + if (TSDB_CODE_SUCCESS != createCastFunc(pCxt, pCaseWhen->pElse, pCaseWhen->node.resType, &pCastFunc)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "CASE WHEN data type mismatch"); + } + pCaseWhen->pElse = pCastFunc; + ((SExprNode*)pCaseWhen->pElse)->resType = pCaseWhen->node.resType; + } + return DEAL_RES_CONTINUE; +} + static EDealRes doTranslateExpr(SNode** pNode, void* pContext) { STranslateContext* pCxt = (STranslateContext*)pContext; switch (nodeType(*pNode)) { @@ -1822,6 +1875,10 @@ static EDealRes doTranslateExpr(SNode** pNode, void* pContext) { return translateLogicCond(pCxt, (SLogicConditionNode*)*pNode); case QUERY_NODE_TEMP_TABLE: return translateExprSubquery(pCxt, ((STempTableNode*)*pNode)->pSubquery); + case QUERY_NODE_WHEN_THEN: + return translateWhenThen(pCxt, (SWhenThenNode*)*pNode); + case QUERY_NODE_CASE_WHEN: + return translateCaseWhen(pCxt, (SCaseWhenNode*)*pNode); default: break; } @@ -3208,27 +3265,6 @@ static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) { return (SNode*)pCol; } -static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) { - SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); - if (NULL == pFunc) { - return TSDB_CODE_OUT_OF_MEMORY; - } - strcpy(pFunc->functionName, "cast"); - pFunc->node.resType = dt; - if (TSDB_CODE_SUCCESS != nodesListMakeAppend(&pFunc->pParameterList, pExpr)) { - nodesDestroyNode((SNode*)pFunc); - return TSDB_CODE_OUT_OF_MEMORY; - } - if (TSDB_CODE_SUCCESS != getFuncInfo(pCxt, pFunc)) { - nodesClearList(pFunc->pParameterList); - pFunc->pParameterList = NULL; - nodesDestroyNode((SNode*)pFunc); - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pExpr)->aliasName); - } - *pCast = (SNode*)pFunc; - return TSDB_CODE_SUCCESS; -} - static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pSetOperator) { SNodeList* pLeftProjections = getProjectList(pSetOperator->pLeft); SNodeList* pRightProjections = getProjectList(pSetOperator->pRight); diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index c24eef0016..f4ced2799a 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 432 +#define YYNOCODE 441 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOrder yy2; - int32_t yy100; - SNodeList* yy280; - bool yy281; - SDataType yy304; - EJoinType yy468; - int64_t yy477; - int8_t yy503; - SAlterOption yy605; - SToken yy641; - ENullOrder yy649; - EOperatorType yy668; - EFillMode yy774; - SNode* yy776; + EFillMode yy18; + EOperatorType yy128; + bool yy173; + SNodeList* yy334; + int8_t yy341; + int64_t yy459; + ENullOrder yy487; + SAlterOption yy515; + EJoinType yy540; + SNode* yy560; + SDataType yy574; + EOrder yy596; + SToken yy659; + int32_t yy676; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 668 -#define YYNRULE 499 -#define YYNTOKEN 309 -#define YY_MAX_SHIFT 667 -#define YY_MIN_SHIFTREDUCE 980 -#define YY_MAX_SHIFTREDUCE 1478 -#define YY_ERROR_ACTION 1479 -#define YY_ACCEPT_ACTION 1480 -#define YY_NO_ACTION 1481 -#define YY_MIN_REDUCE 1482 -#define YY_MAX_REDUCE 1980 +#define YYNSTATE 679 +#define YYNRULE 509 +#define YYNTOKEN 313 +#define YY_MAX_SHIFT 678 +#define YY_MIN_SHIFTREDUCE 1000 +#define YY_MAX_SHIFTREDUCE 1508 +#define YY_ERROR_ACTION 1509 +#define YY_ACCEPT_ACTION 1510 +#define YY_NO_ACTION 1511 +#define YY_MIN_REDUCE 1512 +#define YY_MAX_REDUCE 2020 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,646 +216,720 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2196) +#define YY_ACTTAB_COUNT (2662) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 428, 1730, 429, 1517, 1811, 436, 1799, 429, 1517, 510, - /* 10 */ 28, 252, 37, 35, 1957, 1616, 318, 1795, 1013, 1727, - /* 20 */ 332, 146, 1276, 1494, 1811, 38, 36, 34, 33, 32, - /* 30 */ 549, 319, 1829, 1352, 337, 1274, 1952, 1672, 1674, 144, - /* 40 */ 574, 1791, 1797, 321, 71, 1781, 377, 573, 1629, 551, - /* 50 */ 162, 1957, 1829, 567, 1953, 552, 1347, 120, 1017, 1018, - /* 60 */ 574, 12, 1673, 1674, 81, 1781, 1622, 573, 1282, 1544, - /* 70 */ 1843, 1302, 1829, 1952, 91, 1812, 577, 1814, 575, 572, - /* 80 */ 539, 567, 148, 295, 1889, 1620, 1586, 1956, 298, 1885, - /* 90 */ 1843, 1953, 1955, 1, 93, 1812, 577, 1814, 1815, 572, - /* 100 */ 1952, 567, 510, 40, 1889, 1419, 414, 1904, 1888, 1885, - /* 110 */ 549, 1301, 1728, 551, 162, 664, 538, 104, 1953, 552, - /* 120 */ 103, 102, 101, 100, 99, 98, 97, 96, 95, 1354, - /* 130 */ 1355, 1901, 641, 640, 639, 638, 342, 1303, 637, 636, - /* 140 */ 126, 631, 630, 629, 628, 627, 626, 625, 624, 137, - /* 150 */ 620, 619, 618, 341, 340, 615, 614, 613, 612, 611, - /* 160 */ 24, 173, 172, 156, 192, 1482, 31, 30, 475, 474, - /* 170 */ 38, 36, 34, 33, 32, 1277, 1666, 1275, 150, 427, - /* 180 */ 1173, 1174, 431, 462, 458, 454, 450, 191, 52, 113, - /* 190 */ 112, 111, 110, 109, 108, 107, 106, 105, 1280, 1281, - /* 200 */ 52, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, 569, - /* 210 */ 565, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, 37, - /* 220 */ 35, 1415, 41, 72, 635, 633, 189, 332, 523, 1276, - /* 230 */ 31, 30, 163, 1505, 38, 36, 34, 33, 32, 46, - /* 240 */ 1352, 445, 1274, 218, 1811, 1131, 599, 598, 597, 1135, - /* 250 */ 596, 1137, 1138, 595, 1140, 592, 1627, 1146, 589, 1148, - /* 260 */ 1149, 586, 583, 1347, 6, 20, 1679, 523, 12, 370, - /* 270 */ 523, 369, 1829, 320, 1781, 1282, 37, 35, 165, 248, - /* 280 */ 550, 114, 1677, 1302, 332, 1781, 1276, 573, 466, 188, - /* 290 */ 182, 71, 187, 1331, 56, 1627, 441, 1352, 1627, 1274, - /* 300 */ 1, 31, 30, 1256, 1257, 38, 36, 34, 33, 32, - /* 310 */ 1843, 1605, 180, 1623, 92, 1812, 577, 1814, 1815, 572, - /* 320 */ 1347, 567, 664, 1301, 1889, 12, 608, 163, 323, 1885, - /* 330 */ 157, 88, 1282, 329, 328, 610, 1354, 1355, 1483, 163, - /* 340 */ 1618, 206, 161, 1290, 122, 135, 134, 605, 604, 603, - /* 350 */ 1915, 1795, 1619, 1304, 1352, 549, 1283, 1, 602, 104, - /* 360 */ 1811, 163, 103, 102, 101, 100, 99, 98, 97, 96, - /* 370 */ 95, 445, 144, 478, 477, 1791, 1797, 1347, 335, 664, - /* 380 */ 121, 1630, 1277, 52, 1275, 1376, 144, 567, 1829, 1282, - /* 390 */ 213, 473, 476, 1354, 1355, 1629, 574, 472, 73, 297, - /* 400 */ 540, 1781, 513, 573, 1300, 1280, 1281, 1436, 1329, 1330, - /* 410 */ 1332, 1333, 1334, 1335, 1336, 1337, 569, 565, 1345, 1346, - /* 420 */ 1348, 1349, 1350, 1351, 1353, 1356, 1843, 52, 40, 75, - /* 430 */ 92, 1812, 577, 1814, 1815, 572, 562, 567, 1523, 1277, - /* 440 */ 1889, 1275, 1679, 1679, 323, 1885, 1971, 25, 1504, 304, - /* 450 */ 532, 1434, 1435, 1437, 1438, 1923, 1408, 1381, 1677, 1678, - /* 460 */ 1475, 1503, 1280, 1281, 169, 1329, 1330, 1332, 1333, 1334, - /* 470 */ 1335, 1336, 1337, 569, 565, 1345, 1346, 1348, 1349, 1350, - /* 480 */ 1351, 1353, 1356, 37, 35, 294, 659, 1299, 1957, 1781, - /* 490 */ 371, 332, 1301, 1276, 407, 228, 1291, 419, 1286, 1412, - /* 500 */ 68, 535, 1781, 67, 1352, 1502, 1274, 1362, 506, 435, - /* 510 */ 1952, 1282, 431, 1301, 392, 1799, 420, 1811, 394, 1294, - /* 520 */ 1296, 1480, 163, 551, 162, 378, 1795, 1347, 1953, 552, - /* 530 */ 1952, 565, 1345, 1346, 1348, 1349, 1350, 1351, 379, 1282, - /* 540 */ 1604, 1957, 1301, 1958, 162, 1829, 1781, 1474, 1953, 552, - /* 550 */ 1791, 1797, 327, 571, 1030, 1030, 1029, 1029, 1781, 385, - /* 560 */ 573, 1612, 567, 1952, 7, 52, 163, 163, 31, 30, - /* 570 */ 464, 381, 38, 36, 34, 33, 32, 1956, 541, 536, - /* 580 */ 347, 1953, 1954, 1843, 1031, 1031, 664, 285, 1812, 577, - /* 590 */ 1814, 1815, 572, 570, 567, 564, 1861, 622, 506, 418, - /* 600 */ 1354, 1355, 413, 412, 411, 410, 409, 406, 405, 404, - /* 610 */ 403, 402, 398, 397, 396, 395, 389, 388, 387, 386, - /* 620 */ 1952, 383, 382, 306, 31, 30, 1614, 546, 38, 36, - /* 630 */ 34, 33, 32, 1958, 162, 546, 31, 30, 1953, 552, - /* 640 */ 38, 36, 34, 33, 32, 608, 1277, 1904, 1275, 34, - /* 650 */ 33, 32, 31, 30, 1446, 125, 38, 36, 34, 33, - /* 660 */ 32, 9, 8, 125, 135, 134, 605, 604, 603, 1280, - /* 670 */ 1281, 1900, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, - /* 680 */ 569, 565, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, - /* 690 */ 37, 35, 1357, 123, 1093, 1331, 433, 1768, 332, 1501, - /* 700 */ 1276, 116, 1299, 163, 163, 133, 483, 548, 158, 1897, - /* 710 */ 1898, 1352, 1902, 1274, 219, 220, 246, 1897, 545, 26, - /* 720 */ 544, 493, 1426, 1952, 1331, 31, 30, 1095, 1411, 38, - /* 730 */ 36, 34, 33, 32, 1347, 205, 551, 162, 1314, 1811, - /* 740 */ 1781, 1953, 552, 1679, 354, 366, 1282, 37, 35, 486, - /* 750 */ 336, 523, 1800, 480, 1388, 332, 45, 1276, 204, 1677, - /* 760 */ 1603, 523, 114, 1795, 368, 364, 1956, 1829, 1352, 471, - /* 770 */ 1274, 7, 375, 297, 523, 574, 513, 509, 143, 1627, - /* 780 */ 1781, 1500, 573, 555, 338, 376, 345, 1791, 1797, 1627, - /* 790 */ 546, 1347, 144, 664, 58, 506, 1602, 57, 1610, 567, - /* 800 */ 1499, 1629, 1627, 1282, 506, 1843, 1498, 1354, 1355, 92, - /* 810 */ 1812, 577, 1814, 1815, 572, 1957, 567, 1952, 125, 1889, - /* 820 */ 610, 209, 1781, 323, 1885, 1971, 1952, 1904, 7, 1495, - /* 830 */ 1958, 162, 1303, 1497, 1946, 1953, 552, 1720, 1720, 1958, - /* 840 */ 162, 1781, 1017, 1018, 1953, 552, 492, 1781, 168, 171, - /* 850 */ 664, 1899, 568, 1277, 606, 1275, 123, 1670, 601, 490, - /* 860 */ 344, 488, 31, 30, 1354, 1355, 38, 36, 34, 33, - /* 870 */ 32, 159, 1897, 1898, 1781, 1902, 1280, 1281, 506, 1329, - /* 880 */ 1330, 1332, 1333, 1334, 1335, 1336, 1337, 569, 565, 1345, - /* 890 */ 1346, 1348, 1349, 1350, 1351, 1353, 1356, 546, 31, 30, - /* 900 */ 1952, 608, 38, 36, 34, 33, 32, 44, 505, 1726, - /* 910 */ 1277, 292, 1275, 1958, 162, 299, 501, 1496, 1953, 552, - /* 920 */ 135, 134, 605, 604, 603, 125, 309, 249, 607, 1811, - /* 930 */ 1493, 1670, 1492, 1280, 1281, 1491, 1329, 1330, 1332, 1333, - /* 940 */ 1334, 1335, 1336, 1337, 569, 565, 1345, 1346, 1348, 1349, - /* 950 */ 1350, 1351, 1353, 1356, 37, 35, 1374, 1829, 1781, 1725, - /* 960 */ 1285, 292, 332, 123, 1276, 574, 1490, 623, 494, 1599, - /* 970 */ 1781, 1781, 573, 1781, 248, 1352, 1781, 1274, 160, 1897, - /* 980 */ 1898, 264, 1902, 470, 1657, 310, 506, 308, 307, 1811, - /* 990 */ 468, 556, 1489, 563, 470, 1843, 1488, 1284, 1347, 92, - /* 1000 */ 1812, 577, 1814, 1815, 572, 469, 567, 1781, 1952, 1889, - /* 1010 */ 1282, 1375, 554, 323, 1885, 1971, 469, 1829, 1909, 1408, - /* 1020 */ 197, 1958, 162, 195, 1908, 574, 1953, 552, 1547, 145, - /* 1030 */ 1781, 558, 573, 1781, 270, 1, 1534, 1781, 31, 30, - /* 1040 */ 1276, 1587, 38, 36, 34, 33, 32, 463, 268, 60, - /* 1050 */ 42, 3, 59, 1274, 1830, 1843, 523, 664, 479, 147, - /* 1060 */ 1812, 577, 1814, 1815, 572, 1529, 567, 384, 176, 424, - /* 1070 */ 422, 1354, 1355, 27, 330, 1369, 1370, 1371, 1372, 1373, - /* 1080 */ 1377, 1378, 1379, 1380, 1627, 1527, 1282, 481, 1487, 1057, - /* 1090 */ 523, 299, 478, 477, 1486, 1811, 240, 523, 523, 121, - /* 1100 */ 199, 399, 1288, 198, 52, 553, 1972, 484, 400, 443, - /* 1110 */ 473, 476, 201, 9, 8, 200, 472, 1277, 1627, 1275, - /* 1120 */ 533, 1485, 1058, 1829, 1314, 1627, 1627, 343, 316, 1781, - /* 1130 */ 1366, 574, 1374, 664, 212, 1781, 1781, 39, 573, 1287, - /* 1140 */ 1280, 1281, 90, 1329, 1330, 1332, 1333, 1334, 1335, 1336, - /* 1150 */ 1337, 569, 565, 1345, 1346, 1348, 1349, 1350, 1351, 1353, - /* 1160 */ 1356, 1843, 1781, 1477, 1478, 286, 1812, 577, 1814, 1815, - /* 1170 */ 572, 203, 567, 74, 202, 217, 129, 1802, 65, 64, - /* 1180 */ 374, 523, 132, 167, 1667, 523, 523, 1375, 1227, 1919, - /* 1190 */ 523, 133, 444, 1277, 1811, 1275, 1624, 495, 1518, 293, - /* 1200 */ 523, 502, 362, 547, 360, 356, 352, 349, 346, 1627, - /* 1210 */ 616, 507, 523, 1627, 1627, 245, 1280, 1281, 1627, 87, - /* 1220 */ 523, 4, 1829, 223, 1804, 54, 221, 516, 1627, 84, - /* 1230 */ 550, 519, 1077, 225, 523, 1781, 232, 573, 251, 2, - /* 1240 */ 1627, 559, 1124, 163, 54, 521, 353, 1811, 1627, 27, - /* 1250 */ 330, 1369, 1370, 1371, 1372, 1373, 1377, 1378, 1379, 1380, - /* 1260 */ 1843, 1811, 1627, 348, 92, 1812, 577, 1814, 1815, 572, - /* 1270 */ 523, 567, 39, 523, 1889, 1829, 1433, 39, 323, 1885, - /* 1280 */ 157, 522, 305, 574, 253, 617, 1243, 235, 1781, 1829, - /* 1290 */ 573, 581, 260, 132, 380, 1382, 170, 574, 1627, 133, - /* 1300 */ 1916, 1627, 1781, 1299, 573, 401, 1722, 1075, 117, 132, - /* 1310 */ 416, 1811, 408, 1843, 415, 417, 421, 277, 1812, 577, - /* 1320 */ 1814, 575, 572, 1338, 567, 423, 425, 1843, 263, 1305, - /* 1330 */ 426, 93, 1812, 577, 1814, 1815, 572, 1811, 567, 1829, - /* 1340 */ 434, 1889, 1152, 1952, 1156, 561, 1885, 574, 1307, 437, - /* 1350 */ 1163, 1811, 1781, 179, 573, 438, 551, 162, 439, 1161, - /* 1360 */ 136, 1953, 552, 1306, 181, 1829, 1308, 440, 184, 442, - /* 1370 */ 524, 186, 69, 574, 70, 446, 190, 1843, 1781, 1829, - /* 1380 */ 573, 93, 1812, 577, 1814, 1815, 572, 574, 567, 465, - /* 1390 */ 523, 1889, 1781, 467, 573, 296, 1886, 1617, 194, 1613, - /* 1400 */ 196, 339, 138, 1843, 1811, 261, 139, 286, 1812, 577, - /* 1410 */ 1814, 1815, 572, 1615, 567, 115, 1611, 1843, 1627, 140, - /* 1420 */ 141, 281, 1812, 577, 1814, 1815, 572, 207, 567, 496, - /* 1430 */ 1811, 210, 1829, 214, 497, 1761, 503, 508, 500, 315, - /* 1440 */ 574, 531, 511, 1760, 1732, 1781, 514, 573, 517, 130, - /* 1450 */ 131, 317, 78, 1304, 1811, 262, 80, 518, 1829, 542, - /* 1460 */ 527, 534, 1628, 1930, 230, 1920, 571, 234, 529, 5, - /* 1470 */ 1843, 1781, 543, 573, 147, 1812, 577, 1814, 1815, 572, - /* 1480 */ 530, 567, 1829, 1929, 1911, 151, 528, 331, 322, 537, - /* 1490 */ 574, 526, 525, 239, 1408, 1781, 1843, 573, 244, 243, - /* 1500 */ 285, 1812, 577, 1814, 1815, 572, 124, 567, 1303, 1862, - /* 1510 */ 241, 242, 1811, 324, 51, 1870, 560, 1905, 557, 82, - /* 1520 */ 1843, 1973, 579, 667, 286, 1812, 577, 1814, 1815, 572, - /* 1530 */ 250, 567, 1671, 1974, 1600, 1951, 265, 259, 660, 256, - /* 1540 */ 1829, 661, 663, 43, 278, 333, 291, 288, 574, 287, - /* 1550 */ 267, 154, 269, 1781, 1775, 573, 657, 653, 649, 645, - /* 1560 */ 257, 1774, 62, 1773, 1811, 1772, 63, 1769, 350, 351, - /* 1570 */ 1268, 1269, 166, 355, 1811, 1767, 357, 358, 1843, 359, - /* 1580 */ 1766, 361, 286, 1812, 577, 1814, 1815, 572, 1765, 567, - /* 1590 */ 363, 1764, 1829, 365, 1763, 367, 89, 1246, 1245, 226, - /* 1600 */ 574, 1743, 1829, 1742, 373, 1781, 372, 573, 1741, 1740, - /* 1610 */ 574, 1715, 1215, 1714, 1713, 1781, 127, 573, 1712, 1711, - /* 1620 */ 1710, 66, 1709, 1708, 1707, 1706, 1811, 1705, 390, 1704, - /* 1630 */ 1843, 391, 520, 393, 271, 1812, 577, 1814, 1815, 572, - /* 1640 */ 1843, 567, 1703, 1702, 272, 1812, 577, 1814, 1815, 572, - /* 1650 */ 1811, 567, 1701, 1700, 1829, 1699, 1698, 1697, 1696, 1695, - /* 1660 */ 1694, 1693, 574, 1692, 1691, 215, 1690, 1781, 128, 573, - /* 1670 */ 1689, 1688, 1687, 1686, 1811, 1685, 1684, 1683, 1829, 1682, - /* 1680 */ 1681, 1680, 1549, 1250, 1217, 208, 574, 174, 1548, 175, - /* 1690 */ 1811, 1781, 1843, 573, 1546, 1514, 273, 1812, 577, 1814, - /* 1700 */ 1815, 572, 1829, 567, 1020, 1019, 118, 177, 1513, 178, - /* 1710 */ 574, 155, 1756, 119, 1750, 1781, 1843, 573, 1829, 1739, - /* 1720 */ 280, 1812, 577, 1814, 1815, 572, 574, 567, 183, 430, - /* 1730 */ 1811, 1781, 432, 573, 185, 1738, 1724, 1606, 1545, 1543, - /* 1740 */ 1843, 447, 449, 448, 282, 1812, 577, 1814, 1815, 572, - /* 1750 */ 1541, 567, 451, 1539, 452, 1050, 1843, 453, 1829, 455, - /* 1760 */ 274, 1812, 577, 1814, 1815, 572, 574, 567, 456, 457, - /* 1770 */ 1537, 1781, 460, 573, 1526, 459, 1525, 1510, 1608, 1167, - /* 1780 */ 461, 1166, 1607, 1811, 1092, 193, 53, 1091, 632, 634, - /* 1790 */ 1088, 1087, 1535, 1086, 311, 1811, 1843, 1530, 1528, 485, - /* 1800 */ 283, 1812, 577, 1814, 1815, 572, 482, 567, 312, 1811, - /* 1810 */ 313, 1829, 1509, 1508, 487, 489, 1507, 491, 1755, 574, - /* 1820 */ 94, 1749, 1252, 1829, 1781, 142, 573, 498, 1737, 1735, - /* 1830 */ 1957, 574, 1736, 1734, 1733, 13, 1781, 1829, 573, 1260, - /* 1840 */ 47, 216, 1731, 1723, 222, 574, 211, 76, 77, 1843, - /* 1850 */ 1781, 79, 573, 275, 1812, 577, 1814, 1815, 572, 499, - /* 1860 */ 567, 1843, 314, 504, 1811, 284, 1812, 577, 1814, 1815, - /* 1870 */ 572, 515, 567, 224, 14, 1843, 84, 227, 39, 276, - /* 1880 */ 1812, 577, 1814, 1815, 572, 512, 567, 21, 50, 237, - /* 1890 */ 238, 23, 1829, 1448, 229, 1802, 231, 1430, 247, 49, - /* 1900 */ 574, 233, 55, 1801, 1432, 1781, 152, 573, 149, 16, - /* 1910 */ 236, 1463, 1811, 22, 1462, 325, 1425, 83, 1467, 1405, - /* 1920 */ 1404, 1466, 326, 8, 1468, 1292, 1367, 17, 1811, 1846, - /* 1930 */ 1843, 48, 1342, 566, 289, 1812, 577, 1814, 1815, 572, - /* 1940 */ 1829, 567, 153, 164, 1340, 15, 11, 29, 574, 1339, - /* 1950 */ 1322, 10, 1811, 1781, 18, 573, 1829, 19, 580, 1153, - /* 1960 */ 576, 334, 582, 578, 574, 1150, 584, 585, 587, 1781, - /* 1970 */ 588, 573, 1147, 590, 593, 1141, 1139, 1130, 1843, 1145, - /* 1980 */ 1829, 591, 290, 1812, 577, 1814, 1815, 572, 574, 567, - /* 1990 */ 1144, 594, 1143, 1781, 1843, 573, 600, 85, 1823, 1812, - /* 2000 */ 577, 1814, 1815, 572, 1811, 567, 1142, 86, 1162, 61, - /* 2010 */ 254, 1158, 1048, 609, 1811, 1083, 1082, 1081, 1843, 1080, - /* 2020 */ 1079, 1078, 1822, 1812, 577, 1814, 1815, 572, 1811, 567, - /* 2030 */ 1076, 1074, 1829, 1073, 1072, 621, 1099, 255, 1070, 1069, - /* 2040 */ 574, 1068, 1829, 1067, 1066, 1781, 1065, 573, 1064, 1063, - /* 2050 */ 574, 1096, 1094, 1060, 1054, 1781, 1829, 573, 1059, 1056, - /* 2060 */ 1055, 1053, 1542, 642, 574, 1540, 644, 643, 646, 1781, - /* 2070 */ 1843, 573, 1538, 648, 1821, 1812, 577, 1814, 1815, 572, - /* 2080 */ 1843, 567, 647, 650, 302, 1812, 577, 1814, 1815, 572, - /* 2090 */ 651, 567, 652, 1536, 1843, 654, 1811, 655, 301, 1812, - /* 2100 */ 577, 1814, 1815, 572, 1524, 567, 656, 1506, 1811, 658, - /* 2110 */ 1010, 258, 662, 1481, 1278, 666, 266, 665, 1811, 1481, - /* 2120 */ 1481, 1481, 1481, 1481, 1829, 1481, 1481, 1481, 1481, 1481, - /* 2130 */ 1481, 1481, 574, 1481, 1481, 1481, 1829, 1781, 1481, 573, - /* 2140 */ 1481, 1481, 1481, 1481, 574, 1481, 1829, 1481, 1481, 1781, - /* 2150 */ 1481, 573, 1481, 1481, 574, 1481, 1481, 1481, 1481, 1781, - /* 2160 */ 1481, 573, 1843, 1481, 1481, 1481, 303, 1812, 577, 1814, - /* 2170 */ 1815, 572, 1481, 567, 1843, 1481, 1481, 1481, 300, 1812, - /* 2180 */ 577, 1814, 1815, 572, 1843, 567, 1481, 1481, 279, 1812, - /* 2190 */ 577, 1814, 1815, 572, 1481, 567, + /* 0 */ 530, 556, 1760, 530, 435, 1829, 436, 1547, 32, 258, + /* 10 */ 1843, 117, 42, 40, 117, 1996, 1825, 1033, 473, 1646, + /* 20 */ 339, 478, 1296, 41, 39, 38, 37, 36, 1657, 1323, + /* 30 */ 1991, 1657, 1323, 1374, 1577, 1294, 571, 571, 1861, 1648, + /* 40 */ 1821, 1827, 327, 555, 166, 1510, 572, 325, 1992, 557, + /* 50 */ 1825, 1811, 1642, 584, 578, 150, 1369, 1037, 1038, 571, + /* 60 */ 443, 16, 436, 1547, 1659, 1861, 60, 1843, 1302, 42, + /* 70 */ 40, 1444, 440, 550, 1821, 1827, 1875, 339, 1319, 1296, + /* 80 */ 95, 1841, 1842, 1844, 588, 1846, 1847, 583, 578, 578, + /* 90 */ 1374, 530, 1294, 1, 163, 1861, 1928, 384, 485, 484, + /* 100 */ 332, 1924, 50, 572, 354, 124, 1498, 56, 1811, 44, + /* 110 */ 584, 549, 152, 1369, 1524, 675, 480, 483, 16, 1657, + /* 120 */ 513, 1955, 479, 344, 1829, 1302, 1702, 1704, 452, 1376, + /* 130 */ 1377, 212, 44, 1875, 301, 1825, 1996, 95, 1841, 1842, + /* 140 */ 1844, 588, 1846, 1847, 583, 1830, 578, 1703, 1704, 1991, + /* 150 */ 1, 163, 45, 1928, 1843, 56, 1825, 332, 1924, 1821, + /* 160 */ 1827, 333, 1997, 166, 532, 1991, 1900, 1992, 557, 1709, + /* 170 */ 168, 257, 675, 578, 257, 1297, 326, 1295, 1954, 1995, + /* 180 */ 1821, 1827, 1861, 1992, 1994, 1707, 1376, 1377, 77, 303, + /* 190 */ 585, 1322, 520, 568, 578, 1811, 154, 584, 1300, 1301, + /* 200 */ 1616, 1351, 1352, 1354, 1355, 1356, 1357, 1358, 1359, 580, + /* 210 */ 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, 1378, 3, + /* 220 */ 1875, 130, 162, 621, 95, 1841, 1842, 1844, 588, 1846, + /* 230 */ 1847, 583, 1297, 578, 1295, 1696, 127, 169, 137, 1899, + /* 240 */ 1928, 1465, 35, 34, 332, 1924, 41, 39, 38, 37, + /* 250 */ 36, 169, 1050, 169, 1049, 1300, 1301, 128, 1351, 1352, + /* 260 */ 1354, 1355, 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, + /* 270 */ 1370, 1371, 1372, 1373, 1375, 1378, 3, 42, 40, 165, + /* 280 */ 1936, 1937, 1051, 1941, 11, 339, 1321, 1296, 1322, 543, + /* 290 */ 1463, 1464, 1466, 1467, 434, 1843, 169, 438, 1374, 169, + /* 300 */ 1294, 56, 1151, 610, 609, 608, 1155, 607, 1157, 1158, + /* 310 */ 606, 1160, 603, 568, 1166, 600, 1168, 1169, 597, 594, + /* 320 */ 421, 1369, 11, 1861, 9, 219, 16, 1635, 1475, 225, + /* 330 */ 226, 585, 530, 1302, 42, 40, 1811, 613, 584, 546, + /* 340 */ 1709, 130, 339, 171, 1296, 35, 34, 343, 1535, 41, + /* 350 */ 39, 38, 37, 36, 1324, 1374, 1707, 1294, 1, 56, + /* 360 */ 1657, 1875, 56, 1113, 79, 95, 1841, 1842, 1844, 588, + /* 370 */ 1846, 1847, 583, 373, 578, 179, 178, 119, 1369, 1903, + /* 380 */ 675, 1928, 377, 16, 376, 332, 1924, 452, 303, 1811, + /* 390 */ 1302, 520, 375, 371, 1376, 1377, 1115, 1193, 1194, 255, + /* 400 */ 1936, 567, 1513, 566, 35, 34, 1991, 530, 41, 39, + /* 410 */ 38, 37, 36, 442, 617, 1, 438, 1700, 382, 555, + /* 420 */ 166, 552, 547, 107, 1992, 557, 106, 105, 104, 103, + /* 430 */ 102, 101, 100, 99, 98, 1657, 517, 675, 1633, 24, + /* 440 */ 1297, 1448, 1295, 324, 85, 169, 1757, 1321, 1534, 1302, + /* 450 */ 107, 1376, 1377, 106, 105, 104, 103, 102, 101, 100, + /* 460 */ 99, 98, 1321, 1300, 1301, 1650, 1351, 1352, 1354, 1355, + /* 470 */ 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, 1370, 1371, + /* 480 */ 1372, 1373, 1375, 1378, 3, 1512, 11, 35, 34, 1811, + /* 490 */ 530, 41, 39, 38, 37, 36, 234, 1297, 621, 1295, + /* 500 */ 1995, 383, 126, 169, 1505, 1899, 169, 315, 633, 116, + /* 510 */ 115, 114, 113, 112, 111, 110, 109, 108, 1657, 1943, + /* 520 */ 1300, 1301, 551, 1351, 1352, 1354, 1355, 1356, 1357, 1358, + /* 530 */ 1359, 580, 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, + /* 540 */ 1378, 3, 42, 40, 1709, 224, 1296, 342, 1940, 1644, + /* 550 */ 339, 310, 1296, 482, 481, 150, 563, 75, 75, 1294, + /* 560 */ 1707, 568, 198, 1374, 1659, 1294, 316, 530, 314, 313, + /* 570 */ 123, 475, 1050, 1455, 1049, 477, 156, 1533, 391, 1652, + /* 580 */ 1653, 469, 465, 461, 457, 197, 1369, 471, 556, 130, + /* 590 */ 92, 1843, 1302, 619, 1320, 1657, 1504, 476, 1302, 42, + /* 600 */ 40, 1379, 1051, 125, 1943, 1276, 1277, 339, 1640, 1296, + /* 610 */ 568, 1649, 141, 140, 616, 615, 614, 1991, 1811, 1861, + /* 620 */ 1374, 76, 1294, 8, 195, 128, 530, 585, 215, 1353, + /* 630 */ 555, 166, 1811, 1939, 584, 1992, 557, 406, 130, 675, + /* 640 */ 175, 530, 1532, 1369, 1384, 675, 570, 164, 1936, 1937, + /* 650 */ 1321, 1941, 407, 579, 1657, 1302, 1709, 1875, 499, 1376, + /* 660 */ 1377, 95, 1841, 1842, 1844, 588, 1846, 1847, 583, 1657, + /* 670 */ 578, 497, 1708, 495, 128, 2011, 72, 1928, 530, 71, + /* 680 */ 8, 332, 1924, 1811, 1843, 485, 484, 194, 188, 450, + /* 690 */ 193, 1962, 124, 534, 448, 1900, 167, 1936, 1937, 1297, + /* 700 */ 1941, 1295, 675, 480, 483, 1297, 1657, 1295, 1750, 479, + /* 710 */ 186, 1531, 1861, 38, 37, 36, 1376, 1377, 1634, 174, + /* 720 */ 585, 150, 1300, 1301, 1530, 1811, 508, 584, 1300, 1301, + /* 730 */ 1660, 1351, 1352, 1354, 1355, 1356, 1357, 1358, 1359, 580, + /* 740 */ 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, 1378, 3, + /* 750 */ 1875, 559, 1811, 1943, 95, 1841, 1842, 1844, 588, 1846, + /* 760 */ 1847, 583, 1297, 578, 1295, 1811, 28, 169, 1901, 1529, + /* 770 */ 1928, 564, 35, 34, 332, 1924, 41, 39, 38, 37, + /* 780 */ 36, 1528, 1938, 1843, 1527, 1300, 1301, 7, 1351, 1352, + /* 790 */ 1354, 1355, 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, + /* 800 */ 1370, 1371, 1372, 1373, 1375, 1378, 3, 42, 40, 1526, + /* 810 */ 1811, 1861, 345, 646, 644, 339, 322, 1296, 618, 585, + /* 820 */ 150, 1700, 1811, 619, 1811, 1811, 584, 30, 1374, 1659, + /* 830 */ 1294, 378, 1353, 35, 34, 1037, 1038, 41, 39, 38, + /* 840 */ 37, 36, 141, 140, 616, 615, 614, 513, 1321, 1875, + /* 850 */ 1811, 1369, 1523, 292, 1841, 1842, 1844, 588, 1846, 1847, + /* 860 */ 583, 218, 578, 1302, 42, 40, 1750, 612, 1756, 517, + /* 870 */ 298, 530, 339, 1755, 1296, 298, 1991, 177, 678, 1758, + /* 880 */ 1522, 634, 451, 1629, 1525, 1374, 1405, 1294, 8, 1997, + /* 890 */ 166, 252, 265, 1811, 1992, 557, 1617, 35, 34, 1657, + /* 900 */ 78, 41, 39, 38, 37, 36, 160, 530, 1369, 477, + /* 910 */ 675, 668, 664, 660, 656, 263, 516, 1521, 1654, 1077, + /* 920 */ 1302, 1811, 35, 34, 1376, 1377, 41, 39, 38, 37, + /* 930 */ 36, 476, 513, 35, 34, 1657, 91, 41, 39, 38, + /* 940 */ 37, 36, 13, 12, 270, 1, 88, 1687, 530, 530, + /* 950 */ 306, 93, 1078, 29, 232, 530, 1305, 530, 1811, 502, + /* 960 */ 509, 1991, 530, 1410, 46, 4, 514, 675, 229, 1441, + /* 970 */ 1297, 139, 1295, 526, 1997, 166, 1657, 1657, 1520, 1992, + /* 980 */ 557, 1376, 1377, 1657, 1437, 1657, 544, 527, 1948, 1437, + /* 990 */ 1657, 1403, 1519, 1300, 1301, 1564, 1351, 1352, 1354, 1355, + /* 1000 */ 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, 1370, 1371, + /* 1010 */ 1372, 1373, 1375, 1378, 3, 530, 300, 486, 1319, 1811, + /* 1020 */ 221, 385, 49, 48, 512, 414, 528, 1297, 426, 1295, + /* 1030 */ 1353, 1518, 1798, 1811, 386, 1417, 352, 1517, 1270, 1516, + /* 1040 */ 214, 203, 1515, 1657, 201, 399, 1404, 427, 1862, 401, + /* 1050 */ 1300, 1301, 513, 1351, 1352, 1354, 1355, 1356, 1357, 1358, + /* 1060 */ 1359, 580, 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, + /* 1070 */ 1378, 3, 1811, 530, 205, 1559, 149, 204, 1811, 361, + /* 1080 */ 1811, 1991, 530, 1811, 529, 207, 151, 560, 206, 1557, + /* 1090 */ 392, 276, 1632, 259, 1997, 166, 575, 488, 1308, 1992, + /* 1100 */ 557, 1657, 388, 1574, 209, 274, 64, 208, 43, 63, + /* 1110 */ 1657, 491, 223, 31, 336, 1398, 1399, 1400, 1401, 1402, + /* 1120 */ 1406, 1407, 1408, 1409, 470, 182, 431, 429, 13, 12, + /* 1130 */ 425, 1507, 1508, 420, 419, 418, 417, 416, 413, 412, + /* 1140 */ 411, 410, 409, 405, 404, 403, 402, 396, 395, 394, + /* 1150 */ 393, 246, 390, 389, 312, 134, 1996, 350, 138, 1247, + /* 1160 */ 139, 56, 1548, 227, 58, 1996, 652, 651, 650, 649, + /* 1170 */ 349, 238, 648, 647, 131, 642, 641, 640, 639, 638, + /* 1180 */ 637, 636, 635, 143, 631, 630, 629, 348, 347, 626, + /* 1190 */ 625, 624, 623, 622, 1991, 1304, 530, 619, 58, 94, + /* 1200 */ 1697, 1958, 1843, 1440, 43, 1832, 523, 346, 1995, 231, + /* 1210 */ 627, 1144, 1992, 1993, 254, 1462, 141, 140, 616, 615, + /* 1220 */ 614, 1553, 241, 569, 1657, 251, 628, 2, 5, 43, + /* 1230 */ 1861, 592, 1097, 1395, 355, 69, 68, 381, 585, 138, + /* 1240 */ 173, 360, 490, 1811, 311, 584, 139, 1498, 1095, 1411, + /* 1250 */ 120, 351, 1834, 138, 1263, 1360, 299, 500, 176, 369, + /* 1260 */ 387, 367, 363, 359, 356, 353, 266, 513, 1875, 670, + /* 1270 */ 1319, 211, 96, 586, 338, 1844, 588, 1846, 1847, 583, + /* 1280 */ 269, 578, 1172, 501, 1843, 493, 408, 1752, 1928, 487, + /* 1290 */ 1176, 415, 305, 1924, 210, 423, 1991, 1183, 422, 513, + /* 1300 */ 561, 1181, 424, 1991, 142, 169, 428, 430, 432, 1997, + /* 1310 */ 166, 1325, 1861, 1327, 1992, 557, 555, 166, 433, 441, + /* 1320 */ 585, 1992, 557, 444, 185, 1811, 445, 584, 1991, 1326, + /* 1330 */ 62, 187, 446, 61, 1328, 449, 190, 1307, 192, 447, + /* 1340 */ 73, 1997, 166, 74, 1843, 453, 1992, 557, 196, 472, + /* 1350 */ 1875, 1791, 267, 474, 95, 1841, 1842, 1844, 588, 1846, + /* 1360 */ 1847, 583, 1647, 578, 118, 302, 1843, 200, 2011, 1643, + /* 1370 */ 1928, 202, 1861, 144, 332, 1924, 507, 145, 1645, 213, + /* 1380 */ 585, 1641, 146, 147, 1985, 1811, 503, 584, 504, 216, + /* 1390 */ 510, 515, 542, 321, 1861, 524, 220, 135, 518, 1790, + /* 1400 */ 1762, 525, 585, 521, 82, 323, 84, 1811, 1658, 584, + /* 1410 */ 1875, 268, 136, 1324, 95, 1841, 1842, 1844, 588, 1846, + /* 1420 */ 1847, 583, 1843, 578, 545, 236, 240, 1969, 2011, 538, + /* 1430 */ 1928, 540, 1875, 541, 332, 1924, 285, 586, 338, 1844, + /* 1440 */ 588, 1846, 1847, 583, 1947, 578, 1959, 335, 334, 1968, + /* 1450 */ 1861, 328, 548, 6, 554, 536, 537, 1310, 585, 250, + /* 1460 */ 329, 539, 565, 1811, 2014, 584, 562, 1991, 1374, 1437, + /* 1470 */ 1303, 129, 1323, 55, 247, 1950, 245, 157, 248, 86, + /* 1480 */ 555, 166, 249, 1843, 1944, 1992, 557, 1909, 1875, 1990, + /* 1490 */ 590, 1369, 95, 1841, 1842, 1844, 588, 1846, 1847, 583, + /* 1500 */ 1701, 578, 1630, 1302, 271, 1843, 533, 262, 1928, 671, + /* 1510 */ 253, 1861, 332, 1924, 672, 47, 674, 297, 273, 585, + /* 1520 */ 283, 294, 293, 275, 1811, 1805, 584, 66, 1803, 1802, + /* 1530 */ 67, 1799, 357, 1861, 1804, 358, 1288, 1289, 172, 362, + /* 1540 */ 1797, 585, 364, 365, 366, 1796, 1811, 368, 584, 1875, + /* 1550 */ 574, 1795, 370, 96, 1841, 1842, 1844, 588, 1846, 1847, + /* 1560 */ 583, 1794, 578, 372, 1793, 374, 1266, 1265, 1773, 1928, + /* 1570 */ 1772, 1875, 379, 1927, 1924, 96, 1841, 1842, 1844, 588, + /* 1580 */ 1846, 1847, 583, 380, 578, 1771, 1770, 1745, 1235, 1843, + /* 1590 */ 1744, 1928, 1743, 1742, 132, 573, 1924, 1741, 1740, 70, + /* 1600 */ 1739, 1738, 1737, 1736, 1735, 397, 398, 1734, 400, 1733, + /* 1610 */ 1311, 1732, 1306, 1731, 1730, 1729, 1728, 1861, 1727, 1726, + /* 1620 */ 1725, 1724, 1723, 1722, 1721, 582, 1720, 1719, 1718, 1717, + /* 1630 */ 1811, 133, 584, 1314, 1316, 1716, 1715, 1714, 1713, 1237, + /* 1640 */ 1712, 1711, 1710, 1579, 1843, 576, 1367, 1368, 1370, 1371, + /* 1650 */ 1372, 1373, 1578, 1576, 1544, 1875, 437, 1543, 1040, 291, + /* 1660 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 581, 578, 531, + /* 1670 */ 1893, 121, 1861, 183, 184, 1039, 161, 1786, 122, 1780, + /* 1680 */ 585, 180, 1769, 1768, 191, 1811, 181, 584, 189, 1754, + /* 1690 */ 1636, 439, 1575, 1573, 454, 455, 1571, 1843, 458, 1569, + /* 1700 */ 462, 456, 459, 460, 1567, 463, 464, 466, 468, 1070, + /* 1710 */ 1875, 1556, 1555, 467, 153, 1841, 1842, 1844, 588, 1846, + /* 1720 */ 1847, 583, 1540, 578, 1638, 1861, 1187, 1186, 1637, 1112, + /* 1730 */ 1111, 643, 1108, 585, 1565, 1107, 1106, 1560, 1811, 317, + /* 1740 */ 584, 645, 318, 1558, 492, 319, 1539, 1538, 494, 1843, + /* 1750 */ 489, 199, 57, 496, 1537, 498, 97, 1785, 1779, 148, + /* 1760 */ 1272, 1843, 505, 1875, 217, 558, 2012, 96, 1841, 1842, + /* 1770 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1861, 1767, 1765, + /* 1780 */ 1996, 1766, 1764, 1928, 1763, 582, 1280, 1761, 1925, 1861, + /* 1790 */ 1811, 1753, 584, 519, 535, 81, 17, 585, 233, 1386, + /* 1800 */ 10, 222, 1811, 1861, 584, 18, 43, 19, 1385, 228, + /* 1810 */ 244, 585, 80, 88, 230, 1875, 1811, 54, 584, 291, + /* 1820 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1875, 578, 1843, + /* 1830 */ 1894, 292, 1841, 1842, 1844, 588, 1846, 1847, 583, 511, + /* 1840 */ 578, 1875, 51, 1843, 522, 287, 1841, 1842, 1844, 588, + /* 1850 */ 1846, 1847, 583, 83, 578, 1477, 243, 1861, 25, 235, + /* 1860 */ 1832, 27, 237, 1459, 506, 585, 239, 59, 320, 1461, + /* 1870 */ 1811, 1861, 584, 155, 21, 1492, 337, 1454, 242, 585, + /* 1880 */ 1497, 26, 87, 1491, 1811, 330, 584, 1496, 553, 1498, + /* 1890 */ 1495, 331, 1434, 1843, 1433, 1875, 53, 256, 12, 153, + /* 1900 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1831, 578, 1875, + /* 1910 */ 1312, 20, 1843, 292, 1841, 1842, 1844, 588, 1846, 1847, + /* 1920 */ 583, 1861, 578, 158, 1396, 1878, 340, 15, 1364, 585, + /* 1930 */ 577, 159, 1362, 1361, 1811, 33, 584, 14, 22, 170, + /* 1940 */ 1861, 1336, 1344, 52, 587, 589, 591, 23, 585, 341, + /* 1950 */ 593, 2013, 1173, 1811, 1170, 584, 595, 1167, 596, 1875, + /* 1960 */ 598, 599, 1843, 292, 1841, 1842, 1844, 588, 1846, 1847, + /* 1970 */ 583, 601, 578, 1161, 602, 604, 1843, 1159, 1875, 605, + /* 1980 */ 1150, 1182, 277, 1841, 1842, 1844, 588, 1846, 1847, 583, + /* 1990 */ 1861, 578, 1165, 1164, 611, 1163, 89, 1162, 585, 90, + /* 2000 */ 65, 1178, 260, 1811, 1861, 584, 1068, 1103, 620, 1102, + /* 2010 */ 1101, 1100, 585, 1099, 632, 1098, 1096, 1811, 1094, 584, + /* 2020 */ 1093, 1092, 1119, 1090, 1089, 261, 1088, 1087, 1875, 1086, + /* 2030 */ 1085, 1843, 278, 1841, 1842, 1844, 588, 1846, 1847, 583, + /* 2040 */ 1084, 578, 1875, 1083, 1114, 1116, 279, 1841, 1842, 1844, + /* 2050 */ 588, 1846, 1847, 583, 1080, 578, 1079, 1843, 1076, 1861, + /* 2060 */ 1075, 1074, 1073, 1572, 653, 655, 1570, 585, 657, 654, + /* 2070 */ 659, 658, 1811, 1568, 584, 661, 663, 662, 1566, 665, + /* 2080 */ 667, 666, 1554, 1843, 669, 1861, 1030, 1536, 677, 264, + /* 2090 */ 673, 1511, 1298, 585, 272, 676, 1511, 1875, 1811, 1511, + /* 2100 */ 584, 286, 1841, 1842, 1844, 588, 1846, 1847, 583, 1843, + /* 2110 */ 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, + /* 2120 */ 1511, 1511, 1511, 1875, 1811, 1511, 584, 288, 1841, 1842, + /* 2130 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1861, 1511, 1511, + /* 2140 */ 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, 1875, + /* 2150 */ 1811, 1511, 584, 280, 1841, 1842, 1844, 588, 1846, 1847, + /* 2160 */ 583, 1511, 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2170 */ 1511, 585, 1511, 1511, 1511, 1875, 1811, 1511, 584, 289, + /* 2180 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1843, 578, 1511, + /* 2190 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2200 */ 1511, 1875, 1511, 1843, 1511, 281, 1841, 1842, 1844, 588, + /* 2210 */ 1846, 1847, 583, 1511, 578, 1861, 1511, 1511, 1511, 1511, + /* 2220 */ 1511, 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, 1511, + /* 2230 */ 584, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, + /* 2240 */ 1511, 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, + /* 2250 */ 1511, 1511, 1511, 1875, 1511, 1511, 1511, 290, 1841, 1842, + /* 2260 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1511, 1511, 1875, + /* 2270 */ 1511, 1511, 1511, 282, 1841, 1842, 1844, 588, 1846, 1847, + /* 2280 */ 583, 1843, 578, 1511, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2290 */ 1511, 1511, 1511, 1861, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2300 */ 1511, 585, 1511, 1511, 1511, 1511, 1811, 1511, 584, 1861, + /* 2310 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, + /* 2320 */ 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, 1511, + /* 2330 */ 1511, 1875, 1511, 1511, 1843, 295, 1841, 1842, 1844, 588, + /* 2340 */ 1846, 1847, 583, 1511, 578, 1511, 1511, 1875, 1843, 1511, + /* 2350 */ 1511, 296, 1841, 1842, 1844, 588, 1846, 1847, 583, 1511, + /* 2360 */ 578, 1511, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2370 */ 585, 1511, 1511, 1511, 1511, 1811, 1861, 584, 1511, 1511, + /* 2380 */ 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, + /* 2390 */ 1511, 584, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2400 */ 1875, 1511, 1843, 1511, 1855, 1841, 1842, 1844, 588, 1846, + /* 2410 */ 1847, 583, 1511, 578, 1875, 1511, 1511, 1511, 1854, 1841, + /* 2420 */ 1842, 1844, 588, 1846, 1847, 583, 1843, 578, 1511, 1511, + /* 2430 */ 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, + /* 2440 */ 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, + /* 2450 */ 1511, 1511, 1843, 1511, 1861, 1511, 1511, 1511, 1511, 1511, + /* 2460 */ 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, 1875, 584, + /* 2470 */ 1511, 1511, 1853, 1841, 1842, 1844, 588, 1846, 1847, 583, + /* 2480 */ 1861, 578, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, + /* 2490 */ 1511, 1511, 1875, 1811, 1511, 584, 307, 1841, 1842, 1844, + /* 2500 */ 588, 1846, 1847, 583, 1843, 578, 1511, 1511, 1511, 1511, + /* 2510 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1875, 1511, + /* 2520 */ 1843, 1511, 308, 1841, 1842, 1844, 588, 1846, 1847, 583, + /* 2530 */ 1511, 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2540 */ 585, 1511, 1511, 1511, 1511, 1811, 1511, 584, 1861, 1511, + /* 2550 */ 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, + /* 2560 */ 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2570 */ 1875, 1511, 1511, 1511, 304, 1841, 1842, 1844, 588, 1846, + /* 2580 */ 1847, 583, 1843, 578, 1511, 1511, 1875, 1511, 1511, 1511, + /* 2590 */ 309, 1841, 1842, 1844, 588, 1846, 1847, 583, 1511, 578, + /* 2600 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2610 */ 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, + /* 2620 */ 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, + /* 2630 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, + /* 2640 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1875, 1511, + /* 2650 */ 1511, 1511, 284, 1841, 1842, 1844, 588, 1846, 1847, 583, + /* 2660 */ 1511, 578, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 316, 0, 318, 319, 312, 316, 342, 318, 319, 355, - /* 10 */ 393, 394, 12, 13, 386, 341, 362, 353, 4, 365, - /* 20 */ 20, 311, 22, 313, 312, 12, 13, 14, 15, 16, - /* 30 */ 20, 332, 340, 33, 351, 35, 408, 354, 355, 340, - /* 40 */ 348, 377, 378, 379, 324, 353, 320, 355, 349, 421, - /* 50 */ 422, 386, 340, 389, 426, 427, 56, 337, 44, 45, - /* 60 */ 348, 61, 354, 355, 322, 353, 346, 355, 68, 0, - /* 70 */ 378, 20, 340, 408, 382, 383, 384, 385, 386, 387, - /* 80 */ 348, 389, 325, 357, 392, 343, 329, 422, 396, 397, - /* 90 */ 378, 426, 427, 93, 382, 383, 384, 385, 386, 387, - /* 100 */ 408, 389, 355, 93, 392, 14, 78, 380, 396, 397, - /* 110 */ 20, 20, 365, 421, 422, 115, 384, 21, 426, 427, - /* 120 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 129, - /* 130 */ 130, 404, 63, 64, 65, 66, 67, 20, 69, 70, - /* 140 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - /* 150 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - /* 160 */ 2, 133, 134, 339, 33, 0, 8, 9, 326, 327, - /* 170 */ 12, 13, 14, 15, 16, 175, 352, 177, 47, 317, - /* 180 */ 129, 130, 320, 52, 53, 54, 55, 56, 93, 24, - /* 190 */ 25, 26, 27, 28, 29, 30, 31, 32, 198, 199, - /* 200 */ 93, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 12, - /* 220 */ 13, 14, 93, 92, 326, 327, 95, 20, 320, 22, - /* 230 */ 8, 9, 232, 312, 12, 13, 14, 15, 16, 331, - /* 240 */ 33, 60, 35, 124, 312, 106, 107, 108, 109, 110, - /* 250 */ 111, 112, 113, 114, 115, 116, 348, 118, 119, 120, - /* 260 */ 121, 122, 123, 56, 39, 43, 340, 320, 61, 174, - /* 270 */ 320, 176, 340, 347, 353, 68, 12, 13, 331, 162, - /* 280 */ 348, 331, 356, 20, 20, 353, 22, 355, 338, 158, - /* 290 */ 159, 324, 161, 202, 4, 348, 165, 33, 348, 35, - /* 300 */ 93, 8, 9, 184, 185, 12, 13, 14, 15, 16, - /* 310 */ 378, 0, 181, 346, 382, 383, 384, 385, 386, 387, - /* 320 */ 56, 389, 115, 20, 392, 61, 105, 232, 396, 397, - /* 330 */ 398, 322, 68, 12, 13, 60, 129, 130, 0, 232, - /* 340 */ 342, 125, 410, 22, 335, 124, 125, 126, 127, 128, - /* 350 */ 418, 353, 343, 20, 33, 20, 35, 93, 104, 21, - /* 360 */ 312, 232, 24, 25, 26, 27, 28, 29, 30, 31, - /* 370 */ 32, 60, 340, 64, 65, 377, 378, 56, 332, 115, - /* 380 */ 71, 349, 175, 93, 177, 157, 340, 389, 340, 68, - /* 390 */ 56, 82, 83, 129, 130, 349, 348, 88, 182, 183, - /* 400 */ 20, 353, 186, 355, 20, 198, 199, 198, 201, 202, - /* 410 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - /* 420 */ 213, 214, 215, 216, 217, 218, 378, 93, 93, 95, - /* 430 */ 382, 383, 384, 385, 386, 387, 115, 389, 0, 175, - /* 440 */ 392, 177, 340, 340, 396, 397, 398, 219, 312, 347, - /* 450 */ 241, 242, 243, 244, 245, 407, 231, 229, 356, 356, - /* 460 */ 167, 312, 198, 199, 56, 201, 202, 203, 204, 205, - /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - /* 480 */ 216, 217, 218, 12, 13, 18, 48, 20, 386, 353, - /* 490 */ 368, 20, 20, 22, 27, 162, 175, 30, 177, 4, - /* 500 */ 92, 160, 353, 95, 33, 312, 35, 14, 386, 317, - /* 510 */ 408, 68, 320, 20, 47, 342, 49, 312, 51, 198, - /* 520 */ 199, 309, 232, 421, 422, 22, 353, 56, 426, 427, - /* 530 */ 408, 210, 211, 212, 213, 214, 215, 216, 35, 68, - /* 540 */ 0, 386, 20, 421, 422, 340, 353, 254, 426, 427, - /* 550 */ 377, 378, 379, 348, 20, 20, 22, 22, 353, 92, - /* 560 */ 355, 341, 389, 408, 93, 93, 232, 232, 8, 9, - /* 570 */ 35, 104, 12, 13, 14, 15, 16, 422, 237, 238, - /* 580 */ 368, 426, 427, 378, 50, 50, 115, 382, 383, 384, - /* 590 */ 385, 386, 387, 388, 389, 390, 391, 68, 386, 132, - /* 600 */ 129, 130, 135, 136, 137, 138, 139, 140, 141, 142, - /* 610 */ 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - /* 620 */ 408, 154, 155, 156, 8, 9, 341, 320, 12, 13, - /* 630 */ 14, 15, 16, 421, 422, 320, 8, 9, 426, 427, - /* 640 */ 12, 13, 14, 15, 16, 105, 175, 380, 177, 14, - /* 650 */ 15, 16, 8, 9, 94, 348, 12, 13, 14, 15, - /* 660 */ 16, 1, 2, 348, 124, 125, 126, 127, 128, 198, - /* 670 */ 199, 404, 201, 202, 203, 204, 205, 206, 207, 208, - /* 680 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - /* 690 */ 12, 13, 14, 386, 35, 202, 14, 0, 20, 312, - /* 700 */ 22, 386, 20, 232, 232, 43, 4, 400, 401, 402, - /* 710 */ 403, 33, 405, 35, 124, 125, 401, 402, 403, 2, - /* 720 */ 405, 19, 94, 408, 202, 8, 9, 68, 233, 12, - /* 730 */ 13, 14, 15, 16, 56, 33, 421, 422, 94, 312, - /* 740 */ 353, 426, 427, 340, 47, 170, 68, 12, 13, 47, - /* 750 */ 347, 320, 342, 51, 94, 20, 94, 22, 56, 356, - /* 760 */ 0, 320, 331, 353, 189, 190, 3, 340, 33, 338, - /* 770 */ 35, 93, 331, 183, 320, 348, 186, 368, 162, 348, - /* 780 */ 353, 312, 355, 43, 332, 331, 368, 377, 378, 348, - /* 790 */ 320, 56, 340, 115, 92, 386, 0, 95, 341, 389, - /* 800 */ 312, 349, 348, 68, 386, 378, 312, 129, 130, 382, - /* 810 */ 383, 384, 385, 386, 387, 3, 389, 408, 348, 392, - /* 820 */ 60, 341, 353, 396, 397, 398, 408, 380, 93, 313, - /* 830 */ 421, 422, 20, 312, 407, 426, 427, 348, 348, 421, - /* 840 */ 422, 353, 44, 45, 426, 427, 21, 353, 359, 359, - /* 850 */ 115, 404, 341, 175, 350, 177, 386, 353, 341, 34, - /* 860 */ 368, 36, 8, 9, 129, 130, 12, 13, 14, 15, - /* 870 */ 16, 401, 402, 403, 353, 405, 198, 199, 386, 201, - /* 880 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - /* 890 */ 212, 213, 214, 215, 216, 217, 218, 320, 8, 9, - /* 900 */ 408, 105, 12, 13, 14, 15, 16, 162, 163, 364, - /* 910 */ 175, 366, 177, 421, 422, 61, 372, 312, 426, 427, - /* 920 */ 124, 125, 126, 127, 128, 348, 37, 430, 350, 312, - /* 930 */ 312, 353, 312, 198, 199, 312, 201, 202, 203, 204, - /* 940 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - /* 950 */ 215, 216, 217, 218, 12, 13, 102, 340, 353, 364, - /* 960 */ 35, 366, 20, 386, 22, 348, 312, 328, 368, 330, - /* 970 */ 353, 353, 355, 353, 162, 33, 353, 35, 401, 402, - /* 980 */ 403, 333, 405, 105, 336, 96, 386, 98, 99, 312, - /* 990 */ 101, 251, 312, 61, 105, 378, 312, 35, 56, 382, - /* 1000 */ 383, 384, 385, 386, 387, 127, 389, 353, 408, 392, - /* 1010 */ 68, 157, 249, 396, 397, 398, 127, 340, 230, 231, - /* 1020 */ 97, 421, 422, 100, 407, 348, 426, 427, 0, 18, - /* 1030 */ 353, 43, 355, 353, 23, 93, 0, 353, 8, 9, - /* 1040 */ 22, 329, 12, 13, 14, 15, 16, 321, 37, 38, - /* 1050 */ 42, 43, 41, 35, 340, 378, 320, 115, 22, 382, - /* 1060 */ 383, 384, 385, 386, 387, 0, 389, 331, 57, 58, - /* 1070 */ 59, 129, 130, 219, 220, 221, 222, 223, 224, 225, - /* 1080 */ 226, 227, 228, 229, 348, 0, 68, 22, 312, 35, - /* 1090 */ 320, 61, 64, 65, 312, 312, 415, 320, 320, 71, - /* 1100 */ 97, 331, 177, 100, 93, 428, 429, 22, 331, 331, - /* 1110 */ 82, 83, 97, 1, 2, 100, 88, 175, 348, 177, - /* 1120 */ 419, 312, 68, 340, 94, 348, 348, 321, 345, 353, - /* 1130 */ 198, 348, 102, 115, 56, 353, 353, 43, 355, 177, - /* 1140 */ 198, 199, 131, 201, 202, 203, 204, 205, 206, 207, - /* 1150 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - /* 1160 */ 218, 378, 353, 129, 130, 382, 383, 384, 385, 386, - /* 1170 */ 387, 97, 389, 95, 100, 43, 43, 46, 167, 168, - /* 1180 */ 169, 320, 43, 172, 352, 320, 320, 157, 94, 381, - /* 1190 */ 320, 43, 331, 175, 312, 177, 331, 331, 319, 188, - /* 1200 */ 320, 331, 191, 406, 193, 194, 195, 196, 197, 348, - /* 1210 */ 13, 331, 320, 348, 348, 399, 198, 199, 348, 93, - /* 1220 */ 320, 234, 340, 331, 93, 43, 94, 94, 348, 103, - /* 1230 */ 348, 331, 35, 94, 320, 353, 43, 355, 423, 409, - /* 1240 */ 348, 253, 94, 232, 43, 331, 47, 312, 348, 219, - /* 1250 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - /* 1260 */ 378, 312, 348, 376, 382, 383, 384, 385, 386, 387, - /* 1270 */ 320, 389, 43, 320, 392, 340, 94, 43, 396, 397, - /* 1280 */ 398, 331, 375, 348, 331, 13, 173, 94, 353, 340, - /* 1290 */ 355, 43, 370, 43, 360, 94, 42, 348, 348, 43, - /* 1300 */ 418, 348, 353, 20, 355, 320, 320, 35, 43, 43, - /* 1310 */ 157, 312, 360, 378, 358, 358, 320, 382, 383, 384, - /* 1320 */ 385, 386, 387, 94, 389, 320, 320, 378, 94, 20, - /* 1330 */ 314, 382, 383, 384, 385, 386, 387, 312, 389, 340, - /* 1340 */ 314, 392, 94, 408, 94, 396, 397, 348, 20, 374, - /* 1350 */ 94, 312, 353, 324, 355, 355, 421, 422, 367, 94, - /* 1360 */ 94, 426, 427, 20, 324, 340, 20, 369, 324, 367, - /* 1370 */ 345, 324, 324, 348, 324, 320, 324, 378, 353, 340, - /* 1380 */ 355, 382, 383, 384, 385, 386, 387, 348, 389, 314, - /* 1390 */ 320, 392, 353, 340, 355, 314, 397, 340, 340, 340, - /* 1400 */ 340, 331, 340, 378, 312, 374, 340, 382, 383, 384, - /* 1410 */ 385, 386, 387, 340, 389, 320, 340, 378, 348, 340, - /* 1420 */ 340, 382, 383, 384, 385, 386, 387, 322, 389, 180, - /* 1430 */ 312, 322, 340, 322, 373, 353, 320, 320, 355, 367, - /* 1440 */ 348, 239, 353, 353, 353, 353, 353, 355, 159, 363, - /* 1450 */ 363, 353, 322, 20, 312, 336, 322, 361, 340, 420, - /* 1460 */ 353, 240, 348, 414, 363, 381, 348, 363, 353, 246, - /* 1470 */ 378, 353, 166, 355, 382, 383, 384, 385, 386, 387, - /* 1480 */ 353, 389, 340, 414, 417, 414, 248, 345, 353, 353, - /* 1490 */ 348, 247, 235, 416, 231, 353, 378, 355, 376, 411, - /* 1500 */ 382, 383, 384, 385, 386, 387, 348, 389, 20, 391, - /* 1510 */ 413, 412, 312, 255, 93, 395, 252, 380, 250, 93, - /* 1520 */ 378, 429, 344, 19, 382, 383, 384, 385, 386, 387, - /* 1530 */ 424, 389, 353, 431, 330, 425, 320, 33, 36, 322, - /* 1540 */ 340, 315, 314, 371, 334, 345, 366, 334, 348, 334, - /* 1550 */ 323, 47, 310, 353, 0, 355, 52, 53, 54, 55, - /* 1560 */ 56, 0, 182, 0, 312, 0, 42, 0, 35, 192, - /* 1570 */ 35, 35, 35, 192, 312, 0, 35, 35, 378, 192, - /* 1580 */ 0, 192, 382, 383, 384, 385, 386, 387, 0, 389, - /* 1590 */ 35, 0, 340, 22, 0, 35, 92, 177, 175, 95, - /* 1600 */ 348, 0, 340, 0, 170, 353, 171, 355, 0, 0, - /* 1610 */ 348, 0, 46, 0, 0, 353, 42, 355, 0, 0, - /* 1620 */ 0, 153, 0, 0, 0, 0, 312, 0, 148, 0, - /* 1630 */ 378, 35, 128, 148, 382, 383, 384, 385, 386, 387, - /* 1640 */ 378, 389, 0, 0, 382, 383, 384, 385, 386, 387, - /* 1650 */ 312, 389, 0, 0, 340, 0, 0, 0, 0, 0, - /* 1660 */ 0, 0, 348, 0, 0, 161, 0, 353, 42, 355, - /* 1670 */ 0, 0, 0, 0, 312, 0, 0, 0, 340, 0, - /* 1680 */ 0, 0, 0, 179, 22, 181, 348, 56, 0, 56, - /* 1690 */ 312, 353, 378, 355, 0, 0, 382, 383, 384, 385, - /* 1700 */ 386, 387, 340, 389, 14, 14, 39, 42, 0, 40, - /* 1710 */ 348, 43, 0, 39, 0, 353, 378, 355, 340, 0, - /* 1720 */ 382, 383, 384, 385, 386, 387, 348, 389, 39, 46, - /* 1730 */ 312, 353, 46, 355, 166, 0, 0, 0, 0, 0, - /* 1740 */ 378, 35, 39, 47, 382, 383, 384, 385, 386, 387, - /* 1750 */ 0, 389, 35, 0, 47, 62, 378, 39, 340, 35, - /* 1760 */ 382, 383, 384, 385, 386, 387, 348, 389, 47, 39, - /* 1770 */ 0, 353, 47, 355, 0, 35, 0, 0, 0, 35, - /* 1780 */ 39, 22, 0, 312, 35, 100, 102, 35, 43, 43, - /* 1790 */ 35, 35, 0, 22, 22, 312, 378, 0, 0, 35, - /* 1800 */ 382, 383, 384, 385, 386, 387, 49, 389, 22, 312, - /* 1810 */ 22, 340, 0, 0, 35, 35, 0, 22, 0, 348, - /* 1820 */ 20, 0, 35, 340, 353, 178, 355, 22, 0, 0, - /* 1830 */ 3, 348, 0, 0, 0, 93, 353, 340, 355, 35, - /* 1840 */ 162, 94, 0, 0, 93, 348, 159, 93, 39, 378, - /* 1850 */ 353, 93, 355, 382, 383, 384, 385, 386, 387, 162, - /* 1860 */ 389, 378, 162, 164, 312, 382, 383, 384, 385, 386, - /* 1870 */ 387, 160, 389, 158, 236, 378, 103, 46, 43, 382, - /* 1880 */ 383, 384, 385, 386, 387, 187, 389, 93, 43, 43, - /* 1890 */ 46, 43, 340, 94, 93, 46, 94, 94, 46, 43, - /* 1900 */ 348, 93, 3, 46, 94, 353, 46, 355, 93, 43, - /* 1910 */ 93, 35, 312, 93, 35, 35, 94, 93, 35, 94, - /* 1920 */ 94, 35, 35, 2, 94, 22, 198, 43, 312, 93, - /* 1930 */ 378, 230, 94, 93, 382, 383, 384, 385, 386, 387, - /* 1940 */ 340, 389, 46, 46, 94, 236, 236, 93, 348, 94, - /* 1950 */ 22, 93, 312, 353, 93, 355, 340, 93, 35, 94, - /* 1960 */ 200, 35, 93, 104, 348, 94, 35, 93, 35, 353, - /* 1970 */ 93, 355, 94, 35, 35, 94, 94, 22, 378, 117, - /* 1980 */ 340, 93, 382, 383, 384, 385, 386, 387, 348, 389, - /* 1990 */ 117, 93, 117, 353, 378, 355, 105, 93, 382, 383, - /* 2000 */ 384, 385, 386, 387, 312, 389, 117, 93, 35, 93, - /* 2010 */ 43, 22, 62, 61, 312, 35, 35, 35, 378, 35, - /* 2020 */ 35, 35, 382, 383, 384, 385, 386, 387, 312, 389, - /* 2030 */ 35, 35, 340, 35, 35, 91, 68, 43, 35, 35, - /* 2040 */ 348, 22, 340, 35, 22, 353, 35, 355, 35, 35, - /* 2050 */ 348, 68, 35, 35, 22, 353, 340, 355, 35, 35, - /* 2060 */ 35, 35, 0, 35, 348, 0, 39, 47, 35, 353, - /* 2070 */ 378, 355, 0, 39, 382, 383, 384, 385, 386, 387, - /* 2080 */ 378, 389, 47, 35, 382, 383, 384, 385, 386, 387, - /* 2090 */ 47, 389, 39, 0, 378, 35, 312, 47, 382, 383, - /* 2100 */ 384, 385, 386, 387, 0, 389, 39, 0, 312, 35, - /* 2110 */ 35, 22, 21, 432, 22, 20, 22, 21, 312, 432, - /* 2120 */ 432, 432, 432, 432, 340, 432, 432, 432, 432, 432, - /* 2130 */ 432, 432, 348, 432, 432, 432, 340, 353, 432, 355, - /* 2140 */ 432, 432, 432, 432, 348, 432, 340, 432, 432, 353, - /* 2150 */ 432, 355, 432, 432, 348, 432, 432, 432, 432, 353, - /* 2160 */ 432, 355, 378, 432, 432, 432, 382, 383, 384, 385, - /* 2170 */ 386, 387, 432, 389, 378, 432, 432, 432, 382, 383, - /* 2180 */ 384, 385, 386, 387, 378, 389, 432, 432, 382, 383, - /* 2190 */ 384, 385, 386, 387, 432, 389, 432, 432, 432, 432, - /* 2200 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2210 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2220 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2230 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2240 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2250 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2260 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2270 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2280 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2290 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2300 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2310 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2320 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2330 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2340 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2350 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2360 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2370 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2380 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2390 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2400 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2410 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, - /* 2420 */ 432, 432, 432, 432, 432, 432, 432, + /* 0 */ 324, 388, 0, 324, 320, 346, 322, 323, 403, 404, + /* 10 */ 316, 335, 12, 13, 335, 3, 357, 4, 342, 345, + /* 20 */ 20, 342, 22, 12, 13, 14, 15, 16, 352, 20, + /* 30 */ 417, 352, 20, 33, 0, 35, 20, 20, 344, 346, + /* 40 */ 381, 382, 383, 430, 431, 313, 352, 336, 435, 436, + /* 50 */ 357, 357, 345, 359, 395, 344, 56, 44, 45, 20, + /* 60 */ 320, 61, 322, 323, 353, 344, 4, 316, 68, 12, + /* 70 */ 13, 14, 14, 352, 381, 382, 382, 20, 20, 22, + /* 80 */ 386, 387, 388, 389, 390, 391, 392, 393, 395, 395, + /* 90 */ 33, 324, 35, 93, 400, 344, 402, 324, 64, 65, + /* 100 */ 406, 407, 335, 352, 372, 71, 94, 93, 357, 93, + /* 110 */ 359, 390, 315, 56, 317, 115, 82, 83, 61, 352, + /* 120 */ 388, 427, 88, 355, 346, 68, 358, 359, 60, 129, + /* 130 */ 130, 125, 93, 382, 361, 357, 388, 386, 387, 388, + /* 140 */ 389, 390, 391, 392, 393, 346, 395, 358, 359, 417, + /* 150 */ 93, 400, 93, 402, 316, 93, 357, 406, 407, 381, + /* 160 */ 382, 383, 430, 431, 399, 417, 401, 435, 436, 344, + /* 170 */ 419, 162, 115, 395, 162, 175, 351, 177, 427, 431, + /* 180 */ 381, 382, 344, 435, 436, 360, 129, 130, 182, 183, + /* 190 */ 352, 20, 186, 324, 395, 357, 329, 359, 198, 199, + /* 200 */ 333, 201, 202, 203, 204, 205, 206, 207, 208, 209, + /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + /* 220 */ 382, 352, 343, 60, 386, 387, 388, 389, 390, 391, + /* 230 */ 392, 393, 175, 395, 177, 356, 398, 237, 400, 401, + /* 240 */ 402, 198, 8, 9, 406, 407, 12, 13, 14, 15, + /* 250 */ 16, 237, 20, 237, 22, 198, 199, 388, 201, 202, + /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + /* 270 */ 213, 214, 215, 216, 217, 218, 219, 12, 13, 410, + /* 280 */ 411, 412, 50, 414, 221, 20, 20, 22, 20, 246, + /* 290 */ 247, 248, 249, 250, 321, 316, 237, 324, 33, 237, + /* 300 */ 35, 93, 106, 107, 108, 109, 110, 111, 112, 113, + /* 310 */ 114, 115, 116, 324, 118, 119, 120, 121, 122, 123, + /* 320 */ 78, 56, 221, 344, 223, 56, 61, 0, 94, 124, + /* 330 */ 125, 352, 324, 68, 12, 13, 357, 104, 359, 160, + /* 340 */ 344, 352, 20, 335, 22, 8, 9, 351, 316, 12, + /* 350 */ 13, 14, 15, 16, 20, 33, 360, 35, 93, 93, + /* 360 */ 352, 382, 93, 35, 95, 386, 387, 388, 389, 390, + /* 370 */ 391, 392, 393, 170, 395, 133, 134, 388, 56, 400, + /* 380 */ 115, 402, 174, 61, 176, 406, 407, 60, 183, 357, + /* 390 */ 68, 186, 189, 190, 129, 130, 68, 129, 130, 410, + /* 400 */ 411, 412, 0, 414, 8, 9, 417, 324, 12, 13, + /* 410 */ 14, 15, 16, 321, 354, 93, 324, 357, 335, 430, + /* 420 */ 431, 242, 243, 21, 435, 436, 24, 25, 26, 27, + /* 430 */ 28, 29, 30, 31, 32, 352, 359, 115, 0, 43, + /* 440 */ 175, 14, 177, 366, 326, 237, 369, 20, 316, 68, + /* 450 */ 21, 129, 130, 24, 25, 26, 27, 28, 29, 30, + /* 460 */ 31, 32, 20, 198, 199, 347, 201, 202, 203, 204, + /* 470 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + /* 480 */ 215, 216, 217, 218, 219, 0, 221, 8, 9, 357, + /* 490 */ 324, 12, 13, 14, 15, 16, 162, 175, 60, 177, + /* 500 */ 3, 335, 398, 237, 167, 401, 237, 37, 68, 24, + /* 510 */ 25, 26, 27, 28, 29, 30, 31, 32, 352, 384, + /* 520 */ 198, 199, 20, 201, 202, 203, 204, 205, 206, 207, + /* 530 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + /* 540 */ 218, 219, 12, 13, 344, 124, 22, 336, 413, 345, + /* 550 */ 20, 351, 22, 330, 331, 344, 43, 328, 328, 35, + /* 560 */ 360, 324, 33, 33, 353, 35, 96, 324, 98, 99, + /* 570 */ 341, 101, 20, 94, 22, 105, 47, 316, 335, 350, + /* 580 */ 350, 52, 53, 54, 55, 56, 56, 35, 388, 352, + /* 590 */ 326, 316, 68, 105, 20, 352, 259, 127, 68, 12, + /* 600 */ 13, 14, 50, 339, 384, 184, 185, 20, 345, 22, + /* 610 */ 324, 347, 124, 125, 126, 127, 128, 417, 357, 344, + /* 620 */ 33, 92, 35, 93, 95, 388, 324, 352, 345, 202, + /* 630 */ 430, 431, 357, 413, 359, 435, 436, 335, 352, 115, + /* 640 */ 56, 324, 316, 56, 14, 115, 409, 410, 411, 412, + /* 650 */ 20, 414, 335, 345, 352, 68, 344, 382, 21, 129, + /* 660 */ 130, 386, 387, 388, 389, 390, 391, 392, 393, 352, + /* 670 */ 395, 34, 360, 36, 388, 400, 92, 402, 324, 95, + /* 680 */ 93, 406, 407, 357, 316, 64, 65, 158, 159, 335, + /* 690 */ 161, 416, 71, 399, 165, 401, 410, 411, 412, 175, + /* 700 */ 414, 177, 115, 82, 83, 175, 352, 177, 352, 88, + /* 710 */ 181, 316, 344, 14, 15, 16, 129, 130, 0, 363, + /* 720 */ 352, 344, 198, 199, 316, 357, 376, 359, 198, 199, + /* 730 */ 353, 201, 202, 203, 204, 205, 206, 207, 208, 209, + /* 740 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + /* 750 */ 382, 254, 357, 384, 386, 387, 388, 389, 390, 391, + /* 760 */ 392, 393, 175, 395, 177, 357, 2, 237, 400, 316, + /* 770 */ 402, 258, 8, 9, 406, 407, 12, 13, 14, 15, + /* 780 */ 16, 316, 413, 316, 316, 198, 199, 39, 201, 202, + /* 790 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + /* 800 */ 213, 214, 215, 216, 217, 218, 219, 12, 13, 316, + /* 810 */ 357, 344, 336, 330, 331, 20, 349, 22, 354, 352, + /* 820 */ 344, 357, 357, 105, 357, 357, 359, 2, 33, 353, + /* 830 */ 35, 372, 202, 8, 9, 44, 45, 12, 13, 14, + /* 840 */ 15, 16, 124, 125, 126, 127, 128, 388, 20, 382, + /* 850 */ 357, 56, 316, 386, 387, 388, 389, 390, 391, 392, + /* 860 */ 393, 56, 395, 68, 12, 13, 352, 345, 368, 359, + /* 870 */ 370, 324, 20, 368, 22, 370, 417, 363, 19, 369, + /* 880 */ 316, 332, 335, 334, 317, 33, 157, 35, 93, 430, + /* 890 */ 431, 439, 33, 357, 435, 436, 333, 8, 9, 352, + /* 900 */ 95, 12, 13, 14, 15, 16, 47, 324, 56, 105, + /* 910 */ 115, 52, 53, 54, 55, 56, 372, 316, 335, 35, + /* 920 */ 68, 357, 8, 9, 129, 130, 12, 13, 14, 15, + /* 930 */ 16, 127, 388, 8, 9, 352, 93, 12, 13, 14, + /* 940 */ 15, 16, 1, 2, 337, 93, 103, 340, 324, 324, + /* 950 */ 61, 92, 68, 224, 95, 324, 35, 324, 357, 335, + /* 960 */ 335, 417, 324, 234, 42, 43, 335, 115, 335, 4, + /* 970 */ 175, 43, 177, 335, 430, 431, 352, 352, 316, 435, + /* 980 */ 436, 129, 130, 352, 236, 352, 428, 128, 235, 236, + /* 990 */ 352, 102, 316, 198, 199, 0, 201, 202, 203, 204, + /* 1000 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + /* 1010 */ 215, 216, 217, 218, 219, 324, 18, 22, 20, 357, + /* 1020 */ 161, 22, 94, 162, 163, 27, 335, 175, 30, 177, + /* 1030 */ 202, 316, 0, 357, 35, 94, 372, 316, 179, 316, + /* 1040 */ 181, 97, 316, 352, 100, 47, 157, 49, 344, 51, + /* 1050 */ 198, 199, 388, 201, 202, 203, 204, 205, 206, 207, + /* 1060 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + /* 1070 */ 218, 219, 357, 324, 97, 0, 162, 100, 357, 47, + /* 1080 */ 357, 417, 324, 357, 335, 97, 18, 43, 100, 0, + /* 1090 */ 92, 23, 0, 335, 430, 431, 61, 22, 177, 435, + /* 1100 */ 436, 352, 104, 0, 97, 37, 38, 100, 43, 41, + /* 1110 */ 352, 22, 43, 224, 225, 226, 227, 228, 229, 230, + /* 1120 */ 231, 232, 233, 234, 325, 57, 58, 59, 1, 2, + /* 1130 */ 132, 129, 130, 135, 136, 137, 138, 139, 140, 141, + /* 1140 */ 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + /* 1150 */ 152, 424, 154, 155, 156, 43, 3, 325, 43, 94, + /* 1160 */ 43, 93, 323, 94, 43, 388, 63, 64, 65, 66, + /* 1170 */ 67, 43, 69, 70, 71, 72, 73, 74, 75, 76, + /* 1180 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + /* 1190 */ 87, 88, 89, 90, 417, 35, 324, 105, 43, 131, + /* 1200 */ 356, 385, 316, 238, 43, 46, 94, 335, 431, 94, + /* 1210 */ 13, 94, 435, 436, 432, 94, 124, 125, 126, 127, + /* 1220 */ 128, 0, 94, 415, 352, 408, 13, 418, 239, 43, + /* 1230 */ 344, 43, 35, 198, 380, 167, 168, 169, 352, 43, + /* 1240 */ 172, 47, 4, 357, 379, 359, 43, 94, 35, 94, + /* 1250 */ 43, 372, 93, 43, 173, 94, 188, 19, 42, 191, + /* 1260 */ 364, 193, 194, 195, 196, 197, 374, 388, 382, 48, + /* 1270 */ 20, 33, 386, 387, 388, 389, 390, 391, 392, 393, + /* 1280 */ 94, 395, 94, 372, 316, 47, 324, 324, 402, 51, + /* 1290 */ 94, 364, 406, 407, 56, 157, 417, 94, 362, 388, + /* 1300 */ 256, 94, 362, 417, 94, 237, 324, 324, 324, 430, + /* 1310 */ 431, 20, 344, 20, 435, 436, 430, 431, 318, 318, + /* 1320 */ 352, 435, 436, 378, 328, 357, 359, 359, 417, 20, + /* 1330 */ 92, 328, 371, 95, 20, 371, 328, 177, 328, 373, + /* 1340 */ 328, 430, 431, 328, 316, 324, 435, 436, 328, 318, + /* 1350 */ 382, 357, 378, 344, 386, 387, 388, 389, 390, 391, + /* 1360 */ 392, 393, 344, 395, 324, 318, 316, 344, 400, 344, + /* 1370 */ 402, 344, 344, 344, 406, 407, 359, 344, 344, 326, + /* 1380 */ 352, 344, 344, 344, 416, 357, 180, 359, 377, 326, + /* 1390 */ 324, 324, 244, 371, 344, 159, 326, 367, 357, 357, + /* 1400 */ 357, 365, 352, 357, 326, 357, 326, 357, 352, 359, + /* 1410 */ 382, 340, 367, 20, 386, 387, 388, 389, 390, 391, + /* 1420 */ 392, 393, 316, 395, 245, 367, 367, 423, 400, 357, + /* 1430 */ 402, 357, 382, 357, 406, 407, 386, 387, 388, 389, + /* 1440 */ 390, 391, 392, 393, 416, 395, 385, 12, 13, 423, + /* 1450 */ 344, 357, 357, 251, 166, 240, 252, 22, 352, 380, + /* 1460 */ 260, 253, 257, 357, 440, 359, 255, 417, 33, 236, + /* 1470 */ 35, 352, 20, 93, 422, 426, 425, 423, 421, 93, + /* 1480 */ 430, 431, 420, 316, 384, 435, 436, 405, 382, 434, + /* 1490 */ 348, 56, 386, 387, 388, 389, 390, 391, 392, 393, + /* 1500 */ 357, 395, 334, 68, 324, 316, 400, 326, 402, 36, + /* 1510 */ 433, 344, 406, 407, 319, 375, 318, 370, 327, 352, + /* 1520 */ 338, 338, 338, 314, 357, 0, 359, 182, 0, 0, + /* 1530 */ 42, 0, 35, 344, 0, 192, 35, 35, 35, 192, + /* 1540 */ 0, 352, 35, 35, 192, 0, 357, 192, 359, 382, + /* 1550 */ 115, 0, 35, 386, 387, 388, 389, 390, 391, 392, + /* 1560 */ 393, 0, 395, 22, 0, 35, 177, 175, 0, 402, + /* 1570 */ 0, 382, 171, 406, 407, 386, 387, 388, 389, 390, + /* 1580 */ 391, 392, 393, 170, 395, 0, 0, 0, 46, 316, + /* 1590 */ 0, 402, 0, 0, 42, 406, 407, 0, 0, 153, + /* 1600 */ 0, 0, 0, 0, 0, 148, 35, 0, 148, 0, + /* 1610 */ 175, 0, 177, 0, 0, 0, 0, 344, 0, 0, + /* 1620 */ 0, 0, 0, 0, 0, 352, 0, 0, 0, 0, + /* 1630 */ 357, 42, 359, 198, 199, 0, 0, 0, 0, 22, + /* 1640 */ 0, 0, 0, 0, 316, 210, 211, 212, 213, 214, + /* 1650 */ 215, 216, 0, 0, 0, 382, 46, 0, 14, 386, + /* 1660 */ 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, + /* 1670 */ 397, 39, 344, 42, 40, 14, 43, 0, 39, 0, + /* 1680 */ 352, 56, 0, 0, 166, 357, 56, 359, 39, 0, + /* 1690 */ 0, 46, 0, 0, 35, 47, 0, 316, 35, 0, + /* 1700 */ 35, 39, 47, 39, 0, 47, 39, 35, 39, 62, + /* 1710 */ 382, 0, 0, 47, 386, 387, 388, 389, 390, 391, + /* 1720 */ 392, 393, 0, 395, 0, 344, 35, 22, 0, 35, + /* 1730 */ 35, 43, 35, 352, 0, 35, 22, 0, 357, 22, + /* 1740 */ 359, 43, 22, 0, 35, 22, 0, 0, 35, 316, + /* 1750 */ 49, 100, 102, 35, 0, 22, 20, 0, 0, 178, + /* 1760 */ 35, 316, 22, 382, 159, 437, 438, 386, 387, 388, + /* 1770 */ 389, 390, 391, 392, 393, 316, 395, 344, 0, 0, + /* 1780 */ 3, 0, 0, 402, 0, 352, 35, 0, 407, 344, + /* 1790 */ 357, 0, 359, 187, 349, 39, 93, 352, 46, 220, + /* 1800 */ 222, 94, 357, 344, 359, 43, 43, 241, 220, 93, + /* 1810 */ 46, 352, 93, 103, 158, 382, 357, 43, 359, 386, + /* 1820 */ 387, 388, 389, 390, 391, 392, 393, 382, 395, 316, + /* 1830 */ 397, 386, 387, 388, 389, 390, 391, 392, 393, 164, + /* 1840 */ 395, 382, 162, 316, 160, 386, 387, 388, 389, 390, + /* 1850 */ 391, 392, 393, 93, 395, 94, 43, 344, 93, 93, + /* 1860 */ 46, 43, 94, 94, 162, 352, 93, 3, 162, 94, + /* 1870 */ 357, 344, 359, 93, 43, 35, 349, 94, 93, 352, + /* 1880 */ 94, 93, 93, 35, 357, 35, 359, 35, 429, 94, + /* 1890 */ 35, 35, 94, 316, 94, 382, 43, 46, 2, 386, + /* 1900 */ 387, 388, 389, 390, 391, 392, 393, 46, 395, 382, + /* 1910 */ 22, 241, 316, 386, 387, 388, 389, 390, 391, 392, + /* 1920 */ 393, 344, 395, 46, 198, 93, 349, 241, 94, 352, + /* 1930 */ 93, 46, 94, 94, 357, 93, 359, 93, 93, 46, + /* 1940 */ 344, 94, 22, 235, 200, 104, 35, 93, 352, 35, + /* 1950 */ 93, 438, 94, 357, 94, 359, 35, 94, 93, 382, + /* 1960 */ 35, 93, 316, 386, 387, 388, 389, 390, 391, 392, + /* 1970 */ 393, 35, 395, 94, 93, 35, 316, 94, 382, 93, + /* 1980 */ 22, 35, 386, 387, 388, 389, 390, 391, 392, 393, + /* 1990 */ 344, 395, 117, 117, 105, 117, 93, 117, 352, 93, + /* 2000 */ 93, 22, 43, 357, 344, 359, 62, 35, 61, 35, + /* 2010 */ 35, 35, 352, 35, 91, 35, 35, 357, 35, 359, + /* 2020 */ 35, 35, 68, 35, 35, 43, 22, 35, 382, 22, + /* 2030 */ 35, 316, 386, 387, 388, 389, 390, 391, 392, 393, + /* 2040 */ 35, 395, 382, 35, 35, 68, 386, 387, 388, 389, + /* 2050 */ 390, 391, 392, 393, 35, 395, 35, 316, 35, 344, + /* 2060 */ 35, 22, 35, 0, 35, 39, 0, 352, 35, 47, + /* 2070 */ 39, 47, 357, 0, 359, 35, 39, 47, 0, 35, + /* 2080 */ 39, 47, 0, 316, 35, 344, 35, 0, 20, 22, + /* 2090 */ 21, 441, 22, 352, 22, 21, 441, 382, 357, 441, + /* 2100 */ 359, 386, 387, 388, 389, 390, 391, 392, 393, 316, + /* 2110 */ 395, 344, 441, 441, 441, 441, 441, 441, 441, 352, + /* 2120 */ 441, 441, 441, 382, 357, 441, 359, 386, 387, 388, + /* 2130 */ 389, 390, 391, 392, 393, 316, 395, 344, 441, 441, + /* 2140 */ 441, 441, 441, 441, 441, 352, 441, 441, 441, 382, + /* 2150 */ 357, 441, 359, 386, 387, 388, 389, 390, 391, 392, + /* 2160 */ 393, 441, 395, 344, 441, 441, 441, 441, 441, 441, + /* 2170 */ 441, 352, 441, 441, 441, 382, 357, 441, 359, 386, + /* 2180 */ 387, 388, 389, 390, 391, 392, 393, 316, 395, 441, + /* 2190 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + /* 2200 */ 441, 382, 441, 316, 441, 386, 387, 388, 389, 390, + /* 2210 */ 391, 392, 393, 441, 395, 344, 441, 441, 441, 441, + /* 2220 */ 441, 441, 441, 352, 441, 441, 441, 441, 357, 441, + /* 2230 */ 359, 344, 441, 441, 441, 441, 441, 441, 441, 352, + /* 2240 */ 441, 441, 441, 441, 357, 441, 359, 441, 441, 441, + /* 2250 */ 441, 441, 441, 382, 441, 441, 441, 386, 387, 388, + /* 2260 */ 389, 390, 391, 392, 393, 316, 395, 441, 441, 382, + /* 2270 */ 441, 441, 441, 386, 387, 388, 389, 390, 391, 392, + /* 2280 */ 393, 316, 395, 441, 441, 441, 441, 441, 441, 441, + /* 2290 */ 441, 441, 441, 344, 441, 441, 441, 441, 441, 441, + /* 2300 */ 441, 352, 441, 441, 441, 441, 357, 441, 359, 344, + /* 2310 */ 441, 441, 441, 441, 441, 441, 441, 352, 441, 441, + /* 2320 */ 441, 441, 357, 441, 359, 441, 441, 441, 441, 441, + /* 2330 */ 441, 382, 441, 441, 316, 386, 387, 388, 389, 390, + /* 2340 */ 391, 392, 393, 441, 395, 441, 441, 382, 316, 441, + /* 2350 */ 441, 386, 387, 388, 389, 390, 391, 392, 393, 441, + /* 2360 */ 395, 441, 344, 441, 441, 441, 441, 441, 441, 441, + /* 2370 */ 352, 441, 441, 441, 441, 357, 344, 359, 441, 441, + /* 2380 */ 441, 441, 441, 441, 352, 441, 441, 441, 441, 357, + /* 2390 */ 441, 359, 441, 441, 441, 441, 441, 441, 441, 441, + /* 2400 */ 382, 441, 316, 441, 386, 387, 388, 389, 390, 391, + /* 2410 */ 392, 393, 441, 395, 382, 441, 441, 441, 386, 387, + /* 2420 */ 388, 389, 390, 391, 392, 393, 316, 395, 441, 441, + /* 2430 */ 344, 441, 441, 441, 441, 441, 441, 441, 352, 441, + /* 2440 */ 441, 441, 441, 357, 441, 359, 441, 441, 441, 441, + /* 2450 */ 441, 441, 316, 441, 344, 441, 441, 441, 441, 441, + /* 2460 */ 441, 441, 352, 441, 441, 441, 441, 357, 382, 359, + /* 2470 */ 441, 441, 386, 387, 388, 389, 390, 391, 392, 393, + /* 2480 */ 344, 395, 441, 441, 441, 441, 441, 441, 352, 441, + /* 2490 */ 441, 441, 382, 357, 441, 359, 386, 387, 388, 389, + /* 2500 */ 390, 391, 392, 393, 316, 395, 441, 441, 441, 441, + /* 2510 */ 441, 441, 441, 441, 441, 441, 441, 441, 382, 441, + /* 2520 */ 316, 441, 386, 387, 388, 389, 390, 391, 392, 393, + /* 2530 */ 441, 395, 344, 441, 441, 441, 441, 441, 441, 441, + /* 2540 */ 352, 441, 441, 441, 441, 357, 441, 359, 344, 441, + /* 2550 */ 441, 441, 441, 441, 441, 441, 352, 441, 441, 441, + /* 2560 */ 441, 357, 441, 359, 441, 441, 441, 441, 441, 441, + /* 2570 */ 382, 441, 441, 441, 386, 387, 388, 389, 390, 391, + /* 2580 */ 392, 393, 316, 395, 441, 441, 382, 441, 441, 441, + /* 2590 */ 386, 387, 388, 389, 390, 391, 392, 393, 441, 395, + /* 2600 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + /* 2610 */ 344, 441, 441, 441, 441, 441, 441, 441, 352, 441, + /* 2620 */ 441, 441, 441, 357, 441, 359, 441, 441, 441, 441, + /* 2630 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, + /* 2640 */ 441, 441, 441, 441, 441, 441, 441, 441, 382, 441, + /* 2650 */ 441, 441, 386, 387, 388, 389, 390, 391, 392, 393, + /* 2660 */ 441, 395, }; -#define YY_SHIFT_COUNT (667) +#define YY_SHIFT_COUNT (678) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2107) +#define YY_SHIFT_MAX (2087) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1011, 0, 207, 207, 264, 264, 264, 471, 264, 264, - /* 10 */ 678, 735, 942, 735, 735, 735, 735, 735, 735, 735, - /* 20 */ 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, - /* 30 */ 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, - /* 40 */ 335, 472, 10, 95, 334, 107, 129, 107, 10, 10, - /* 50 */ 321, 321, 107, 321, 321, 290, 107, 90, 90, 14, - /* 60 */ 14, 51, 90, 90, 90, 90, 90, 90, 90, 90, - /* 70 */ 90, 90, 181, 90, 90, 90, 263, 90, 90, 303, - /* 80 */ 90, 90, 303, 380, 90, 303, 303, 303, 90, 275, - /* 90 */ 467, 1030, 854, 854, 96, 1018, 1018, 1018, 1018, 1018, - /* 100 */ 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, - /* 110 */ 1018, 1018, 1018, 1018, 889, 309, 812, 51, 682, 682, - /* 120 */ 311, 659, 760, 117, 117, 117, 659, 384, 384, 263, - /* 130 */ 1, 1, 303, 303, 443, 443, 254, 529, 139, 139, - /* 140 */ 139, 139, 139, 139, 139, 1504, 338, 293, 1028, 209, - /* 150 */ 535, 341, 91, 493, 534, 798, 878, 333, 788, 225, - /* 160 */ 788, 1008, 763, 495, 522, 987, 1199, 1113, 1254, 1283, - /* 170 */ 1283, 1254, 1153, 1153, 1283, 1283, 1283, 1309, 1309, 1328, - /* 180 */ 181, 263, 181, 1343, 1346, 181, 1343, 181, 181, 181, - /* 190 */ 1283, 181, 1309, 303, 303, 303, 303, 303, 303, 303, - /* 200 */ 303, 303, 303, 303, 1283, 1309, 443, 1328, 275, 1249, - /* 210 */ 263, 275, 1283, 1283, 1343, 275, 1202, 443, 443, 443, - /* 220 */ 443, 1202, 443, 1289, 275, 254, 275, 384, 1433, 443, - /* 230 */ 1221, 1202, 443, 443, 1221, 1202, 443, 443, 303, 1223, - /* 240 */ 1306, 1221, 1238, 1244, 1257, 987, 1263, 384, 1488, 1258, - /* 250 */ 1264, 1268, 1421, 1426, 443, 529, 1283, 275, 1502, 1309, - /* 260 */ 2196, 2196, 2196, 2196, 2196, 2196, 2196, 69, 131, 165, - /* 270 */ 702, 560, 222, 628, 158, 717, 616, 644, 540, 890, - /* 280 */ 890, 890, 890, 890, 890, 890, 890, 796, 221, 13, - /* 290 */ 13, 216, 590, 575, 408, 28, 825, 119, 660, 228, - /* 300 */ 635, 635, 635, 635, 662, 697, 503, 923, 1003, 1015, - /* 310 */ 1074, 1036, 1065, 1085, 1078, 745, 1094, 1132, 1133, 1139, - /* 320 */ 1148, 1182, 1193, 1112, 1034, 740, 988, 1201, 925, 962, - /* 330 */ 932, 1229, 1131, 1234, 1248, 1250, 1256, 1265, 1266, 1126, - /* 340 */ 1197, 1272, 1054, 438, 1554, 1561, 1380, 1563, 1565, 1524, - /* 350 */ 1567, 1533, 1377, 1535, 1536, 1537, 1381, 1575, 1541, 1542, - /* 360 */ 1387, 1580, 1389, 1588, 1555, 1591, 1571, 1594, 1560, 1420, - /* 370 */ 1423, 1601, 1603, 1435, 1434, 1608, 1609, 1566, 1611, 1613, - /* 380 */ 1614, 1574, 1618, 1619, 1620, 1468, 1622, 1623, 1624, 1625, - /* 390 */ 1627, 1480, 1596, 1629, 1485, 1642, 1643, 1652, 1653, 1655, - /* 400 */ 1656, 1657, 1658, 1659, 1660, 1661, 1663, 1664, 1666, 1626, - /* 410 */ 1670, 1671, 1672, 1673, 1675, 1676, 1662, 1677, 1679, 1680, - /* 420 */ 1681, 1682, 1631, 1688, 1633, 1694, 1695, 1665, 1667, 1668, - /* 430 */ 1690, 1683, 1691, 1686, 1708, 1669, 1674, 1712, 1714, 1719, - /* 440 */ 1689, 1568, 1735, 1736, 1737, 1693, 1738, 1739, 1706, 1696, - /* 450 */ 1703, 1750, 1717, 1707, 1718, 1753, 1724, 1721, 1730, 1770, - /* 460 */ 1740, 1725, 1741, 1774, 1776, 1777, 1778, 1684, 1685, 1744, - /* 470 */ 1759, 1782, 1749, 1752, 1745, 1746, 1755, 1756, 1771, 1792, - /* 480 */ 1772, 1797, 1786, 1757, 1798, 1788, 1764, 1812, 1779, 1813, - /* 490 */ 1780, 1816, 1795, 1800, 1818, 1678, 1787, 1821, 1647, 1805, - /* 500 */ 1697, 1687, 1828, 1829, 1700, 1699, 1827, 1832, 1833, 1834, - /* 510 */ 1742, 1747, 1804, 1698, 1842, 1751, 1711, 1754, 1843, 1809, - /* 520 */ 1715, 1758, 1773, 1831, 1835, 1638, 1794, 1799, 1801, 1802, - /* 530 */ 1803, 1808, 1845, 1810, 1815, 1817, 1820, 1822, 1846, 1844, - /* 540 */ 1849, 1824, 1848, 1709, 1825, 1826, 1852, 1701, 1856, 1857, - /* 550 */ 1860, 1830, 1899, 1866, 1710, 1876, 1879, 1880, 1883, 1886, - /* 560 */ 1887, 1921, 1903, 1728, 1884, 1836, 1838, 1840, 1850, 1854, - /* 570 */ 1855, 1896, 1858, 1861, 1897, 1827, 1928, 1760, 1864, 1859, - /* 580 */ 1865, 1923, 1926, 1869, 1871, 1931, 1874, 1878, 1933, 1877, - /* 590 */ 1881, 1938, 1888, 1882, 1939, 1898, 1862, 1873, 1875, 1889, - /* 600 */ 1955, 1891, 1904, 1914, 1973, 1916, 1967, 1967, 1989, 1950, - /* 610 */ 1952, 1980, 1981, 1982, 1984, 1985, 1986, 1995, 1996, 1998, - /* 620 */ 1999, 1968, 1944, 1994, 2003, 2004, 2019, 2008, 2022, 2011, - /* 630 */ 2013, 2014, 1983, 1745, 2017, 1746, 2018, 2023, 2024, 2025, - /* 640 */ 2032, 2026, 2062, 2028, 2020, 2027, 2065, 2033, 2035, 2034, - /* 650 */ 2072, 2048, 2043, 2053, 2093, 2060, 2050, 2067, 2104, 2074, - /* 660 */ 2075, 2107, 2089, 2091, 2092, 2094, 2096, 2095, + /* 0 */ 1068, 0, 57, 265, 57, 322, 322, 322, 530, 322, + /* 10 */ 322, 322, 322, 322, 587, 795, 852, 795, 795, 795, + /* 20 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, + /* 30 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, + /* 40 */ 795, 795, 795, 795, 16, 266, 39, 208, 269, 14, + /* 50 */ 59, 14, 39, 39, 1435, 1435, 14, 1435, 1435, 62, + /* 60 */ 14, 17, 17, 13, 13, 268, 17, 17, 17, 17, + /* 70 */ 17, 17, 17, 17, 17, 17, 68, 17, 17, 17, + /* 80 */ 171, 17, 17, 442, 17, 17, 442, 502, 17, 442, + /* 90 */ 442, 442, 17, 163, 998, 889, 889, 429, 524, 524, + /* 100 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + /* 110 */ 524, 524, 524, 524, 524, 524, 524, 470, 621, 12, + /* 120 */ 268, 58, 58, 327, 328, 438, 101, 101, 9, 9, + /* 130 */ 9, 328, 574, 574, 171, 2, 2, 63, 442, 442, + /* 140 */ 381, 381, 233, 440, 196, 196, 196, 196, 196, 196, + /* 150 */ 196, 859, 402, 337, 34, 43, 552, 179, 427, 630, + /* 160 */ 232, 791, 804, 334, 753, 748, 497, 753, 922, 965, + /* 170 */ 828, 989, 1194, 1081, 1216, 1250, 1250, 1216, 1138, 1138, + /* 180 */ 1250, 1250, 1250, 1291, 1291, 1293, 68, 171, 68, 1309, + /* 190 */ 1314, 68, 1309, 68, 68, 68, 1250, 68, 1291, 442, + /* 200 */ 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, + /* 210 */ 1250, 1291, 381, 1293, 163, 1206, 171, 163, 1250, 1250, + /* 220 */ 1309, 163, 1148, 381, 381, 381, 381, 1148, 381, 1236, + /* 230 */ 163, 233, 163, 574, 1393, 381, 1179, 1148, 381, 381, + /* 240 */ 1179, 1148, 381, 381, 442, 1202, 1288, 1179, 1208, 1204, + /* 250 */ 1215, 989, 1200, 1205, 1211, 1233, 574, 1452, 1380, 1386, + /* 260 */ 381, 440, 1250, 163, 1473, 1291, 2662, 2662, 2662, 2662, + /* 270 */ 2662, 2662, 2662, 1103, 529, 485, 1238, 234, 396, 479, + /* 280 */ 764, 825, 914, 718, 925, 925, 925, 925, 925, 925, + /* 290 */ 925, 925, 925, 1092, 488, 11, 11, 6, 205, 203, + /* 300 */ 584, 242, 637, 421, 699, 941, 729, 699, 699, 699, + /* 310 */ 928, 1032, 999, 944, 977, 988, 1007, 995, 1075, 1089, + /* 320 */ 805, 861, 1065, 1069, 1112, 1115, 1117, 1121, 1128, 1002, + /* 330 */ 1044, 513, 1127, 1155, 921, 1160, 1035, 1161, 1153, 1159, + /* 340 */ 1186, 1188, 1196, 1203, 1207, 1210, 843, 1197, 1213, 884, + /* 350 */ 1221, 1525, 1534, 1345, 1528, 1529, 1488, 1531, 1497, 1343, + /* 360 */ 1501, 1502, 1503, 1347, 1540, 1507, 1508, 1352, 1545, 1355, + /* 370 */ 1551, 1517, 1561, 1541, 1564, 1530, 1389, 1392, 1568, 1570, + /* 380 */ 1401, 1413, 1585, 1586, 1542, 1587, 1590, 1592, 1552, 1593, + /* 390 */ 1597, 1598, 1446, 1600, 1601, 1602, 1603, 1604, 1457, 1571, + /* 400 */ 1607, 1460, 1609, 1611, 1613, 1614, 1615, 1616, 1618, 1619, + /* 410 */ 1620, 1621, 1622, 1623, 1624, 1626, 1589, 1627, 1628, 1629, + /* 420 */ 1635, 1636, 1637, 1617, 1638, 1640, 1641, 1642, 1643, 1625, + /* 430 */ 1652, 1630, 1653, 1654, 1631, 1632, 1633, 1644, 1610, 1661, + /* 440 */ 1645, 1657, 1634, 1639, 1677, 1679, 1682, 1649, 1518, 1683, + /* 450 */ 1689, 1690, 1647, 1692, 1693, 1659, 1648, 1662, 1696, 1663, + /* 460 */ 1655, 1664, 1699, 1665, 1658, 1667, 1704, 1672, 1666, 1669, + /* 470 */ 1711, 1712, 1722, 1724, 1650, 1651, 1691, 1705, 1728, 1694, + /* 480 */ 1695, 1688, 1698, 1697, 1700, 1714, 1734, 1717, 1737, 1720, + /* 490 */ 1701, 1743, 1723, 1709, 1746, 1713, 1747, 1718, 1754, 1733, + /* 500 */ 1736, 1757, 1680, 1725, 1758, 1581, 1740, 1702, 1605, 1778, + /* 510 */ 1779, 1706, 1675, 1777, 1781, 1782, 1784, 1703, 1707, 1751, + /* 520 */ 1606, 1787, 1716, 1684, 1719, 1791, 1756, 1656, 1760, 1710, + /* 530 */ 1752, 1762, 1579, 1578, 1588, 1763, 1566, 1765, 1761, 1766, + /* 540 */ 1768, 1769, 1773, 1774, 1775, 1780, 1785, 1788, 1783, 1813, + /* 550 */ 1764, 1814, 1789, 1818, 1670, 1786, 1795, 1864, 1831, 1686, + /* 560 */ 1840, 1848, 1850, 1852, 1855, 1856, 1798, 1800, 1851, 1708, + /* 570 */ 1853, 1861, 1877, 1896, 1888, 1726, 1832, 1834, 1837, 1838, + /* 580 */ 1842, 1839, 1885, 1844, 1845, 1893, 1847, 1920, 1744, 1854, + /* 590 */ 1841, 1858, 1911, 1914, 1857, 1860, 1921, 1865, 1863, 1925, + /* 600 */ 1868, 1879, 1936, 1881, 1883, 1940, 1886, 1875, 1876, 1878, + /* 610 */ 1880, 1958, 1889, 1903, 1906, 1946, 1907, 1959, 1959, 1979, + /* 620 */ 1944, 1947, 1972, 1974, 1975, 1976, 1978, 1980, 1981, 1983, + /* 630 */ 1985, 1986, 1954, 1923, 1982, 1988, 1989, 2004, 1992, 2007, + /* 640 */ 1995, 2005, 2008, 1977, 1688, 2009, 1698, 2019, 2021, 2023, + /* 650 */ 2025, 2039, 2027, 2063, 2029, 2022, 2026, 2066, 2033, 2024, + /* 660 */ 2031, 2073, 2040, 2030, 2037, 2078, 2044, 2034, 2041, 2082, + /* 670 */ 2049, 2051, 2087, 2067, 2069, 2070, 2072, 2074, 2068, }; -#define YY_REDUCE_COUNT (266) -#define YY_REDUCE_MIN (-383) -#define YY_REDUCE_MAX (1806) +#define YY_REDUCE_COUNT (272) +#define YY_REDUCE_MIN (-395) +#define YY_REDUCE_MAX (2266) static const short yy_reduce_ofst[] = { - /* 0 */ 212, -308, -68, 882, 48, 427, 617, 935, -288, 949, - /* 10 */ 205, 677, 999, 783, 1025, 1039, 1092, 1118, 1142, 1200, - /* 20 */ 1252, 1262, 1314, 1338, 1362, 1378, 1418, 1471, 1483, 1497, - /* 30 */ 1552, 1600, 1616, 1640, 1692, 1702, 1716, 1784, 1796, 1806, - /* 40 */ 315, 102, 307, 122, 409, 418, 492, 600, 470, 577, - /* 50 */ -336, 173, -372, -2, 410, -335, 155, -50, 431, -316, - /* 60 */ -311, -317, -92, -53, 441, 454, 736, 770, 777, 778, - /* 70 */ 861, 865, -280, 866, 870, 880, -346, 892, 900, -301, - /* 80 */ 914, 950, -74, -268, 953, 46, 403, 452, 1070, 9, - /* 90 */ -274, -383, -383, -383, -290, -79, 136, 149, 193, 387, - /* 100 */ 469, 488, 494, 521, 605, 618, 620, 623, 654, 680, - /* 110 */ 684, 776, 782, 809, -176, -243, -273, -292, -138, 192, - /* 120 */ -33, -158, -258, -273, 267, 447, -102, 489, 490, -253, - /* 130 */ 545, 595, 32, 103, 504, 578, 648, 639, -326, 220, - /* 140 */ 285, 457, 480, 511, 517, 544, 516, 497, 712, 701, - /* 150 */ 726, 681, 714, 714, 806, 879, 832, 808, 797, 797, - /* 160 */ 797, 816, 815, 830, 714, 887, 907, 922, 934, 985, - /* 170 */ 986, 952, 956, 957, 996, 1005, 1006, 1016, 1026, 975, - /* 180 */ 1029, 1000, 1040, 991, 998, 1044, 1002, 1047, 1048, 1050, - /* 190 */ 1055, 1052, 1075, 1053, 1057, 1058, 1059, 1060, 1062, 1066, - /* 200 */ 1073, 1076, 1079, 1080, 1095, 1081, 1082, 1031, 1105, 1061, - /* 210 */ 1083, 1109, 1116, 1117, 1072, 1111, 1086, 1089, 1090, 1091, - /* 220 */ 1093, 1087, 1098, 1096, 1130, 1119, 1134, 1114, 1084, 1107, - /* 230 */ 1049, 1101, 1115, 1127, 1069, 1104, 1135, 1136, 714, 1067, - /* 240 */ 1077, 1071, 1097, 1099, 1088, 1122, 797, 1158, 1137, 1102, - /* 250 */ 1110, 1106, 1120, 1178, 1179, 1204, 1216, 1217, 1226, 1228, - /* 260 */ 1172, 1180, 1210, 1213, 1215, 1227, 1242, + /* 0 */ -268, 886, -249, -162, -306, 275, 968, 1028, 1050, -21, + /* 10 */ 368, 1106, 1167, 1189, 1273, 1328, 1381, 467, 1433, 1445, + /* 20 */ 1459, 1513, 1527, 1577, 1596, 1646, 1660, 1715, 1741, 1767, + /* 30 */ 1793, 1819, 1871, 1887, 1949, 1965, 2018, 2032, 2086, 2110, + /* 40 */ 2136, 2188, 2204, 2266, -11, 200, 237, 459, 544, 664, + /* 50 */ 879, 911, -131, 286, -341, -222, -387, -307, -201, -252, + /* 60 */ 777, -324, -321, -316, -260, -232, -233, 8, 83, 166, + /* 70 */ 243, 302, 317, 354, 547, 583, 229, 624, 625, 631, + /* 80 */ 77, 633, 638, -289, 691, 749, -175, -279, 758, 211, + /* 90 */ -4, 476, 872, 264, -227, -395, -395, -203, 32, 132, + /* 100 */ 261, 326, 395, 408, 453, 465, 468, 493, 536, 564, + /* 110 */ 601, 662, 676, 715, 721, 723, 726, -121, -133, 135, + /* 120 */ -211, -27, 92, 230, 223, 118, -235, 294, 135, 220, + /* 130 */ 369, 483, 356, 514, 510, 500, 505, 104, 377, 312, + /* 140 */ 60, 464, 607, 549, -326, -293, 204, 263, 283, 308, + /* 150 */ 522, 350, 567, 452, 563, 558, 799, 727, 704, 704, + /* 160 */ 832, 839, 844, 816, 808, 808, 782, 808, 817, 809, + /* 170 */ 704, 854, 865, 892, 896, 962, 963, 927, 936, 940, + /* 180 */ 982, 983, 984, 1000, 1001, 945, 996, 967, 1003, 961, + /* 190 */ 966, 1008, 964, 1010, 1012, 1015, 1021, 1020, 1031, 1009, + /* 200 */ 1018, 1023, 1025, 1027, 1029, 1033, 1034, 1037, 1038, 1039, + /* 210 */ 1040, 1047, 994, 974, 1053, 1011, 1017, 1063, 1066, 1067, + /* 220 */ 1022, 1070, 1030, 1041, 1042, 1043, 1046, 1045, 1048, 1036, + /* 230 */ 1078, 1071, 1080, 1056, 1061, 1072, 1004, 1058, 1074, 1076, + /* 240 */ 1026, 1059, 1094, 1095, 704, 1049, 1051, 1054, 1052, 1057, + /* 250 */ 1062, 1079, 1024, 1055, 1077, 808, 1119, 1100, 1082, 1142, + /* 260 */ 1143, 1168, 1180, 1181, 1195, 1198, 1140, 1147, 1182, 1183, + /* 270 */ 1184, 1191, 1209, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 10 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 20 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 30 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 40 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 50 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 60 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 70 */ 1479, 1479, 1553, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 80 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1551, - /* 90 */ 1716, 1479, 1891, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 100 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 110 */ 1479, 1479, 1479, 1479, 1479, 1479, 1903, 1479, 1479, 1479, - /* 120 */ 1553, 1479, 1551, 1903, 1903, 1903, 1479, 1479, 1479, 1479, - /* 130 */ 1757, 1757, 1479, 1479, 1479, 1479, 1656, 1479, 1479, 1479, - /* 140 */ 1479, 1479, 1479, 1479, 1479, 1751, 1479, 1975, 1479, 1479, - /* 150 */ 1479, 1926, 1479, 1479, 1479, 1479, 1609, 1918, 1895, 1909, - /* 160 */ 1896, 1893, 1960, 1912, 1479, 1922, 1479, 1744, 1721, 1479, - /* 170 */ 1479, 1721, 1718, 1718, 1479, 1479, 1479, 1479, 1479, 1479, - /* 180 */ 1553, 1479, 1553, 1479, 1479, 1553, 1479, 1553, 1553, 1553, - /* 190 */ 1479, 1553, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 200 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1551, 1753, - /* 210 */ 1479, 1551, 1479, 1479, 1479, 1551, 1931, 1479, 1479, 1479, - /* 220 */ 1479, 1931, 1479, 1479, 1551, 1479, 1551, 1479, 1479, 1479, - /* 230 */ 1933, 1931, 1479, 1479, 1933, 1931, 1479, 1479, 1479, 1945, - /* 240 */ 1941, 1933, 1949, 1947, 1924, 1922, 1909, 1479, 1479, 1978, - /* 250 */ 1966, 1962, 1479, 1625, 1479, 1479, 1479, 1551, 1511, 1479, - /* 260 */ 1746, 1757, 1659, 1659, 1659, 1554, 1484, 1479, 1479, 1479, - /* 270 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1828, - /* 280 */ 1944, 1943, 1867, 1866, 1865, 1863, 1827, 1479, 1621, 1826, - /* 290 */ 1825, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 300 */ 1819, 1820, 1818, 1817, 1479, 1479, 1479, 1479, 1479, 1479, - /* 310 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 320 */ 1479, 1479, 1479, 1892, 1479, 1963, 1967, 1479, 1479, 1479, - /* 330 */ 1479, 1479, 1803, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 340 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 350 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 360 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 370 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 380 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 390 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 400 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 410 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 420 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1516, - /* 430 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 440 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 450 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 460 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 470 */ 1479, 1479, 1479, 1479, 1592, 1591, 1479, 1479, 1479, 1479, - /* 480 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 490 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 500 */ 1479, 1479, 1479, 1479, 1479, 1479, 1959, 1479, 1479, 1479, - /* 510 */ 1479, 1479, 1479, 1479, 1761, 1479, 1479, 1479, 1479, 1479, - /* 520 */ 1479, 1479, 1479, 1479, 1925, 1479, 1479, 1479, 1479, 1479, - /* 530 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 540 */ 1803, 1479, 1942, 1479, 1902, 1898, 1479, 1479, 1894, 1802, - /* 550 */ 1479, 1479, 1479, 1961, 1479, 1479, 1479, 1479, 1479, 1479, - /* 560 */ 1479, 1887, 1479, 1479, 1860, 1845, 1479, 1479, 1479, 1479, - /* 570 */ 1479, 1479, 1479, 1479, 1479, 1815, 1479, 1813, 1479, 1479, - /* 580 */ 1479, 1479, 1479, 1653, 1479, 1479, 1479, 1479, 1479, 1479, - /* 590 */ 1479, 1479, 1479, 1479, 1479, 1479, 1638, 1636, 1635, 1634, - /* 600 */ 1479, 1631, 1479, 1479, 1479, 1479, 1662, 1661, 1479, 1479, - /* 610 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 620 */ 1479, 1479, 1479, 1573, 1479, 1479, 1479, 1479, 1479, 1479, - /* 630 */ 1479, 1479, 1479, 1564, 1479, 1563, 1479, 1479, 1479, 1479, - /* 640 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 650 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, - /* 660 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, + /* 0 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 10 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 20 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 30 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 40 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 50 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 60 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 70 */ 1509, 1509, 1509, 1509, 1509, 1509, 1583, 1509, 1509, 1509, + /* 80 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 90 */ 1509, 1509, 1509, 1581, 1746, 1930, 1509, 1509, 1509, 1509, + /* 100 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 110 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1942, + /* 120 */ 1509, 1509, 1509, 1583, 1509, 1581, 1902, 1902, 1942, 1942, + /* 130 */ 1942, 1509, 1509, 1509, 1509, 1787, 1787, 1509, 1509, 1509, + /* 140 */ 1509, 1509, 1686, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 150 */ 1509, 1781, 1509, 2015, 1509, 1509, 1509, 1965, 1509, 1509, + /* 160 */ 1509, 1509, 1639, 1957, 1934, 1948, 1999, 1935, 1932, 1951, + /* 170 */ 1509, 1961, 1509, 1774, 1751, 1509, 1509, 1751, 1748, 1748, + /* 180 */ 1509, 1509, 1509, 1509, 1509, 1509, 1583, 1509, 1583, 1509, + /* 190 */ 1509, 1583, 1509, 1583, 1583, 1583, 1509, 1583, 1509, 1509, + /* 200 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 210 */ 1509, 1509, 1509, 1509, 1581, 1783, 1509, 1581, 1509, 1509, + /* 220 */ 1509, 1581, 1970, 1509, 1509, 1509, 1509, 1970, 1509, 1509, + /* 230 */ 1581, 1509, 1581, 1509, 1509, 1509, 1972, 1970, 1509, 1509, + /* 240 */ 1972, 1970, 1509, 1509, 1509, 1984, 1980, 1972, 1988, 1986, + /* 250 */ 1963, 1961, 2018, 2005, 2001, 1948, 1509, 1509, 1509, 1655, + /* 260 */ 1509, 1509, 1509, 1581, 1541, 1509, 1776, 1787, 1689, 1689, + /* 270 */ 1689, 1584, 1514, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 280 */ 1509, 1509, 1509, 1509, 1860, 1509, 1983, 1982, 1906, 1905, + /* 290 */ 1904, 1895, 1859, 1509, 1651, 1858, 1857, 1509, 1509, 1509, + /* 300 */ 1509, 1509, 1509, 1509, 1851, 1509, 1509, 1852, 1850, 1849, + /* 310 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 320 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 330 */ 2002, 2006, 1931, 1509, 1509, 1509, 1509, 1509, 1842, 1833, + /* 340 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 350 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 360 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 370 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 380 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 390 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 400 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 410 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 420 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 430 */ 1509, 1509, 1509, 1509, 1509, 1509, 1546, 1509, 1509, 1509, + /* 440 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 450 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 460 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 470 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 480 */ 1509, 1622, 1621, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 490 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 500 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 510 */ 1509, 1509, 1509, 1998, 1509, 1509, 1509, 1509, 1509, 1509, + /* 520 */ 1509, 1791, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 530 */ 1509, 1892, 1509, 1509, 1509, 1964, 1509, 1509, 1509, 1509, + /* 540 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 550 */ 1509, 1833, 1509, 1981, 1509, 1509, 1996, 1509, 2000, 1509, + /* 560 */ 1509, 1509, 1509, 1509, 1509, 1509, 1941, 1937, 1509, 1509, + /* 570 */ 1933, 1832, 1509, 1926, 1509, 1509, 1877, 1509, 1509, 1509, + /* 580 */ 1509, 1509, 1509, 1509, 1509, 1509, 1841, 1509, 1845, 1509, + /* 590 */ 1509, 1509, 1509, 1509, 1683, 1509, 1509, 1509, 1509, 1509, + /* 600 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1668, 1666, 1665, + /* 610 */ 1664, 1509, 1661, 1509, 1509, 1509, 1509, 1692, 1691, 1509, + /* 620 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 630 */ 1509, 1509, 1509, 1509, 1603, 1509, 1509, 1509, 1509, 1509, + /* 640 */ 1509, 1509, 1509, 1509, 1594, 1509, 1593, 1509, 1509, 1509, + /* 650 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 660 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 670 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1094,6 +1168,11 @@ static const YYCODETYPE yyFallback[] = { 0, /* CURRENT_USER => nothing */ 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ + 0, /* CASE => nothing */ + 261, /* END => ABORT */ + 0, /* WHEN => nothing */ + 0, /* THEN => nothing */ + 0, /* ELSE => nothing */ 0, /* BETWEEN => nothing */ 0, /* IS => nothing */ 0, /* NK_LT => nothing */ @@ -1132,58 +1211,57 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 256, /* AFTER => ABORT */ - 256, /* ATTACH => ABORT */ - 256, /* BEFORE => ABORT */ - 256, /* BEGIN => ABORT */ - 256, /* BITAND => ABORT */ - 256, /* BITNOT => ABORT */ - 256, /* BITOR => ABORT */ - 256, /* BLOCKS => ABORT */ - 256, /* CHANGE => ABORT */ - 256, /* COMMA => ABORT */ - 256, /* COMPACT => ABORT */ - 256, /* CONCAT => ABORT */ - 256, /* CONFLICT => ABORT */ - 256, /* COPY => ABORT */ - 256, /* DEFERRED => ABORT */ - 256, /* DELIMITERS => ABORT */ - 256, /* DETACH => ABORT */ - 256, /* DIVIDE => ABORT */ - 256, /* DOT => ABORT */ - 256, /* EACH => ABORT */ - 256, /* END => ABORT */ - 256, /* FAIL => ABORT */ - 256, /* FILE => ABORT */ - 256, /* FOR => ABORT */ - 256, /* GLOB => ABORT */ - 256, /* ID => ABORT */ - 256, /* IMMEDIATE => ABORT */ - 256, /* IMPORT => ABORT */ - 256, /* INITIALLY => ABORT */ - 256, /* INSTEAD => ABORT */ - 256, /* ISNULL => ABORT */ - 256, /* KEY => ABORT */ - 256, /* NK_BITNOT => ABORT */ - 256, /* NK_SEMI => ABORT */ - 256, /* NOTNULL => ABORT */ - 256, /* OF => ABORT */ - 256, /* PLUS => ABORT */ - 256, /* PRIVILEGE => ABORT */ - 256, /* RAISE => ABORT */ - 256, /* REPLACE => ABORT */ - 256, /* RESTRICT => ABORT */ - 256, /* ROW => ABORT */ - 256, /* SEMI => ABORT */ - 256, /* STAR => ABORT */ - 256, /* STATEMENT => ABORT */ - 256, /* STRING => ABORT */ - 256, /* TIMES => ABORT */ - 256, /* UPDATE => ABORT */ - 256, /* VALUES => ABORT */ - 256, /* VARIABLE => ABORT */ - 256, /* VIEW => ABORT */ - 256, /* WAL => ABORT */ + 261, /* AFTER => ABORT */ + 261, /* ATTACH => ABORT */ + 261, /* BEFORE => ABORT */ + 261, /* BEGIN => ABORT */ + 261, /* BITAND => ABORT */ + 261, /* BITNOT => ABORT */ + 261, /* BITOR => ABORT */ + 261, /* BLOCKS => ABORT */ + 261, /* CHANGE => ABORT */ + 261, /* COMMA => ABORT */ + 261, /* COMPACT => ABORT */ + 261, /* CONCAT => ABORT */ + 261, /* CONFLICT => ABORT */ + 261, /* COPY => ABORT */ + 261, /* DEFERRED => ABORT */ + 261, /* DELIMITERS => ABORT */ + 261, /* DETACH => ABORT */ + 261, /* DIVIDE => ABORT */ + 261, /* DOT => ABORT */ + 261, /* EACH => ABORT */ + 261, /* FAIL => ABORT */ + 261, /* FILE => ABORT */ + 261, /* FOR => ABORT */ + 261, /* GLOB => ABORT */ + 261, /* ID => ABORT */ + 261, /* IMMEDIATE => ABORT */ + 261, /* IMPORT => ABORT */ + 261, /* INITIALLY => ABORT */ + 261, /* INSTEAD => ABORT */ + 261, /* ISNULL => ABORT */ + 261, /* KEY => ABORT */ + 261, /* NK_BITNOT => ABORT */ + 261, /* NK_SEMI => ABORT */ + 261, /* NOTNULL => ABORT */ + 261, /* OF => ABORT */ + 261, /* PLUS => ABORT */ + 261, /* PRIVILEGE => ABORT */ + 261, /* RAISE => ABORT */ + 261, /* REPLACE => ABORT */ + 261, /* RESTRICT => ABORT */ + 261, /* ROW => ABORT */ + 261, /* SEMI => ABORT */ + 261, /* STAR => ABORT */ + 261, /* STATEMENT => ABORT */ + 261, /* STRING => ABORT */ + 261, /* TIMES => ABORT */ + 261, /* UPDATE => ABORT */ + 261, /* VALUES => ABORT */ + 261, /* VARIABLE => ABORT */ + 261, /* VIEW => ABORT */ + 261, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1490,219 +1568,228 @@ static const char *const yyTokenName[] = { /* 216 */ "CURRENT_USER", /* 217 */ "COUNT", /* 218 */ "LAST_ROW", - /* 219 */ "BETWEEN", - /* 220 */ "IS", - /* 221 */ "NK_LT", - /* 222 */ "NK_GT", - /* 223 */ "NK_LE", - /* 224 */ "NK_GE", - /* 225 */ "NK_NE", - /* 226 */ "MATCH", - /* 227 */ "NMATCH", - /* 228 */ "CONTAINS", - /* 229 */ "IN", - /* 230 */ "JOIN", - /* 231 */ "INNER", - /* 232 */ "SELECT", - /* 233 */ "DISTINCT", - /* 234 */ "WHERE", - /* 235 */ "PARTITION", - /* 236 */ "BY", - /* 237 */ "SESSION", - /* 238 */ "STATE_WINDOW", - /* 239 */ "SLIDING", - /* 240 */ "FILL", - /* 241 */ "VALUE", - /* 242 */ "NONE", - /* 243 */ "PREV", - /* 244 */ "LINEAR", - /* 245 */ "NEXT", - /* 246 */ "HAVING", - /* 247 */ "RANGE", - /* 248 */ "EVERY", - /* 249 */ "ORDER", - /* 250 */ "SLIMIT", - /* 251 */ "SOFFSET", - /* 252 */ "LIMIT", - /* 253 */ "OFFSET", - /* 254 */ "ASC", - /* 255 */ "NULLS", - /* 256 */ "ABORT", - /* 257 */ "AFTER", - /* 258 */ "ATTACH", - /* 259 */ "BEFORE", - /* 260 */ "BEGIN", - /* 261 */ "BITAND", - /* 262 */ "BITNOT", - /* 263 */ "BITOR", - /* 264 */ "BLOCKS", - /* 265 */ "CHANGE", - /* 266 */ "COMMA", - /* 267 */ "COMPACT", - /* 268 */ "CONCAT", - /* 269 */ "CONFLICT", - /* 270 */ "COPY", - /* 271 */ "DEFERRED", - /* 272 */ "DELIMITERS", - /* 273 */ "DETACH", - /* 274 */ "DIVIDE", - /* 275 */ "DOT", - /* 276 */ "EACH", - /* 277 */ "END", - /* 278 */ "FAIL", - /* 279 */ "FILE", - /* 280 */ "FOR", - /* 281 */ "GLOB", - /* 282 */ "ID", - /* 283 */ "IMMEDIATE", - /* 284 */ "IMPORT", - /* 285 */ "INITIALLY", - /* 286 */ "INSTEAD", - /* 287 */ "ISNULL", - /* 288 */ "KEY", - /* 289 */ "NK_BITNOT", - /* 290 */ "NK_SEMI", - /* 291 */ "NOTNULL", - /* 292 */ "OF", - /* 293 */ "PLUS", - /* 294 */ "PRIVILEGE", - /* 295 */ "RAISE", - /* 296 */ "REPLACE", - /* 297 */ "RESTRICT", - /* 298 */ "ROW", - /* 299 */ "SEMI", - /* 300 */ "STAR", - /* 301 */ "STATEMENT", - /* 302 */ "STRING", - /* 303 */ "TIMES", - /* 304 */ "UPDATE", - /* 305 */ "VALUES", - /* 306 */ "VARIABLE", - /* 307 */ "VIEW", - /* 308 */ "WAL", - /* 309 */ "cmd", - /* 310 */ "account_options", - /* 311 */ "alter_account_options", - /* 312 */ "literal", - /* 313 */ "alter_account_option", - /* 314 */ "user_name", - /* 315 */ "sysinfo_opt", - /* 316 */ "privileges", - /* 317 */ "priv_level", - /* 318 */ "priv_type_list", - /* 319 */ "priv_type", - /* 320 */ "db_name", - /* 321 */ "dnode_endpoint", - /* 322 */ "not_exists_opt", - /* 323 */ "db_options", - /* 324 */ "exists_opt", - /* 325 */ "alter_db_options", - /* 326 */ "integer_list", - /* 327 */ "variable_list", - /* 328 */ "retention_list", - /* 329 */ "alter_db_option", - /* 330 */ "retention", - /* 331 */ "full_table_name", - /* 332 */ "column_def_list", - /* 333 */ "tags_def_opt", - /* 334 */ "table_options", - /* 335 */ "multi_create_clause", - /* 336 */ "tags_def", - /* 337 */ "multi_drop_clause", - /* 338 */ "alter_table_clause", - /* 339 */ "alter_table_options", - /* 340 */ "column_name", - /* 341 */ "type_name", - /* 342 */ "signed_literal", - /* 343 */ "create_subtable_clause", - /* 344 */ "specific_cols_opt", - /* 345 */ "expression_list", - /* 346 */ "drop_table_clause", - /* 347 */ "col_name_list", - /* 348 */ "table_name", - /* 349 */ "column_def", - /* 350 */ "duration_list", - /* 351 */ "rollup_func_list", - /* 352 */ "alter_table_option", - /* 353 */ "duration_literal", - /* 354 */ "rollup_func_name", - /* 355 */ "function_name", - /* 356 */ "col_name", - /* 357 */ "db_name_cond_opt", - /* 358 */ "like_pattern_opt", - /* 359 */ "table_name_cond", - /* 360 */ "from_db_opt", - /* 361 */ "index_options", - /* 362 */ "func_list", - /* 363 */ "sliding_opt", - /* 364 */ "sma_stream_opt", - /* 365 */ "func", - /* 366 */ "stream_options", - /* 367 */ "topic_name", - /* 368 */ "query_or_subquery", - /* 369 */ "cgroup_name", - /* 370 */ "analyze_opt", - /* 371 */ "explain_options", - /* 372 */ "agg_func_opt", - /* 373 */ "bufsize_opt", - /* 374 */ "stream_name", - /* 375 */ "dnode_list", - /* 376 */ "where_clause_opt", - /* 377 */ "signed", - /* 378 */ "literal_func", - /* 379 */ "literal_list", - /* 380 */ "table_alias", - /* 381 */ "column_alias", - /* 382 */ "expression", - /* 383 */ "pseudo_column", - /* 384 */ "column_reference", - /* 385 */ "function_expression", - /* 386 */ "subquery", - /* 387 */ "star_func", - /* 388 */ "star_func_para_list", - /* 389 */ "noarg_func", - /* 390 */ "other_para_list", - /* 391 */ "star_func_para", - /* 392 */ "predicate", - /* 393 */ "compare_op", - /* 394 */ "in_op", - /* 395 */ "in_predicate_value", - /* 396 */ "boolean_value_expression", - /* 397 */ "boolean_primary", - /* 398 */ "common_expression", - /* 399 */ "from_clause_opt", - /* 400 */ "table_reference_list", - /* 401 */ "table_reference", - /* 402 */ "table_primary", - /* 403 */ "joined_table", - /* 404 */ "alias_opt", - /* 405 */ "parenthesized_joined_table", - /* 406 */ "join_type", - /* 407 */ "search_condition", - /* 408 */ "query_specification", - /* 409 */ "set_quantifier_opt", - /* 410 */ "select_list", - /* 411 */ "partition_by_clause_opt", - /* 412 */ "range_opt", - /* 413 */ "every_opt", - /* 414 */ "fill_opt", - /* 415 */ "twindow_clause_opt", - /* 416 */ "group_by_clause_opt", - /* 417 */ "having_clause_opt", - /* 418 */ "select_item", - /* 419 */ "fill_mode", - /* 420 */ "group_by_list", - /* 421 */ "query_expression", - /* 422 */ "query_simple", - /* 423 */ "order_by_clause_opt", - /* 424 */ "slimit_clause_opt", - /* 425 */ "limit_clause_opt", - /* 426 */ "union_query_expression", - /* 427 */ "query_simple_or_subquery", - /* 428 */ "sort_specification_list", - /* 429 */ "sort_specification", - /* 430 */ "ordering_specification_opt", - /* 431 */ "null_ordering_opt", + /* 219 */ "CASE", + /* 220 */ "END", + /* 221 */ "WHEN", + /* 222 */ "THEN", + /* 223 */ "ELSE", + /* 224 */ "BETWEEN", + /* 225 */ "IS", + /* 226 */ "NK_LT", + /* 227 */ "NK_GT", + /* 228 */ "NK_LE", + /* 229 */ "NK_GE", + /* 230 */ "NK_NE", + /* 231 */ "MATCH", + /* 232 */ "NMATCH", + /* 233 */ "CONTAINS", + /* 234 */ "IN", + /* 235 */ "JOIN", + /* 236 */ "INNER", + /* 237 */ "SELECT", + /* 238 */ "DISTINCT", + /* 239 */ "WHERE", + /* 240 */ "PARTITION", + /* 241 */ "BY", + /* 242 */ "SESSION", + /* 243 */ "STATE_WINDOW", + /* 244 */ "SLIDING", + /* 245 */ "FILL", + /* 246 */ "VALUE", + /* 247 */ "NONE", + /* 248 */ "PREV", + /* 249 */ "LINEAR", + /* 250 */ "NEXT", + /* 251 */ "HAVING", + /* 252 */ "RANGE", + /* 253 */ "EVERY", + /* 254 */ "ORDER", + /* 255 */ "SLIMIT", + /* 256 */ "SOFFSET", + /* 257 */ "LIMIT", + /* 258 */ "OFFSET", + /* 259 */ "ASC", + /* 260 */ "NULLS", + /* 261 */ "ABORT", + /* 262 */ "AFTER", + /* 263 */ "ATTACH", + /* 264 */ "BEFORE", + /* 265 */ "BEGIN", + /* 266 */ "BITAND", + /* 267 */ "BITNOT", + /* 268 */ "BITOR", + /* 269 */ "BLOCKS", + /* 270 */ "CHANGE", + /* 271 */ "COMMA", + /* 272 */ "COMPACT", + /* 273 */ "CONCAT", + /* 274 */ "CONFLICT", + /* 275 */ "COPY", + /* 276 */ "DEFERRED", + /* 277 */ "DELIMITERS", + /* 278 */ "DETACH", + /* 279 */ "DIVIDE", + /* 280 */ "DOT", + /* 281 */ "EACH", + /* 282 */ "FAIL", + /* 283 */ "FILE", + /* 284 */ "FOR", + /* 285 */ "GLOB", + /* 286 */ "ID", + /* 287 */ "IMMEDIATE", + /* 288 */ "IMPORT", + /* 289 */ "INITIALLY", + /* 290 */ "INSTEAD", + /* 291 */ "ISNULL", + /* 292 */ "KEY", + /* 293 */ "NK_BITNOT", + /* 294 */ "NK_SEMI", + /* 295 */ "NOTNULL", + /* 296 */ "OF", + /* 297 */ "PLUS", + /* 298 */ "PRIVILEGE", + /* 299 */ "RAISE", + /* 300 */ "REPLACE", + /* 301 */ "RESTRICT", + /* 302 */ "ROW", + /* 303 */ "SEMI", + /* 304 */ "STAR", + /* 305 */ "STATEMENT", + /* 306 */ "STRING", + /* 307 */ "TIMES", + /* 308 */ "UPDATE", + /* 309 */ "VALUES", + /* 310 */ "VARIABLE", + /* 311 */ "VIEW", + /* 312 */ "WAL", + /* 313 */ "cmd", + /* 314 */ "account_options", + /* 315 */ "alter_account_options", + /* 316 */ "literal", + /* 317 */ "alter_account_option", + /* 318 */ "user_name", + /* 319 */ "sysinfo_opt", + /* 320 */ "privileges", + /* 321 */ "priv_level", + /* 322 */ "priv_type_list", + /* 323 */ "priv_type", + /* 324 */ "db_name", + /* 325 */ "dnode_endpoint", + /* 326 */ "not_exists_opt", + /* 327 */ "db_options", + /* 328 */ "exists_opt", + /* 329 */ "alter_db_options", + /* 330 */ "integer_list", + /* 331 */ "variable_list", + /* 332 */ "retention_list", + /* 333 */ "alter_db_option", + /* 334 */ "retention", + /* 335 */ "full_table_name", + /* 336 */ "column_def_list", + /* 337 */ "tags_def_opt", + /* 338 */ "table_options", + /* 339 */ "multi_create_clause", + /* 340 */ "tags_def", + /* 341 */ "multi_drop_clause", + /* 342 */ "alter_table_clause", + /* 343 */ "alter_table_options", + /* 344 */ "column_name", + /* 345 */ "type_name", + /* 346 */ "signed_literal", + /* 347 */ "create_subtable_clause", + /* 348 */ "specific_cols_opt", + /* 349 */ "expression_list", + /* 350 */ "drop_table_clause", + /* 351 */ "col_name_list", + /* 352 */ "table_name", + /* 353 */ "column_def", + /* 354 */ "duration_list", + /* 355 */ "rollup_func_list", + /* 356 */ "alter_table_option", + /* 357 */ "duration_literal", + /* 358 */ "rollup_func_name", + /* 359 */ "function_name", + /* 360 */ "col_name", + /* 361 */ "db_name_cond_opt", + /* 362 */ "like_pattern_opt", + /* 363 */ "table_name_cond", + /* 364 */ "from_db_opt", + /* 365 */ "index_options", + /* 366 */ "func_list", + /* 367 */ "sliding_opt", + /* 368 */ "sma_stream_opt", + /* 369 */ "func", + /* 370 */ "stream_options", + /* 371 */ "topic_name", + /* 372 */ "query_or_subquery", + /* 373 */ "cgroup_name", + /* 374 */ "analyze_opt", + /* 375 */ "explain_options", + /* 376 */ "agg_func_opt", + /* 377 */ "bufsize_opt", + /* 378 */ "stream_name", + /* 379 */ "dnode_list", + /* 380 */ "where_clause_opt", + /* 381 */ "signed", + /* 382 */ "literal_func", + /* 383 */ "literal_list", + /* 384 */ "table_alias", + /* 385 */ "column_alias", + /* 386 */ "expr_or_subquery", + /* 387 */ "expression", + /* 388 */ "subquery", + /* 389 */ "pseudo_column", + /* 390 */ "column_reference", + /* 391 */ "function_expression", + /* 392 */ "case_when_expression", + /* 393 */ "star_func", + /* 394 */ "star_func_para_list", + /* 395 */ "noarg_func", + /* 396 */ "other_para_list", + /* 397 */ "star_func_para", + /* 398 */ "when_then_list", + /* 399 */ "case_when_else_opt", + /* 400 */ "common_expression", + /* 401 */ "when_then_expr", + /* 402 */ "predicate", + /* 403 */ "compare_op", + /* 404 */ "in_op", + /* 405 */ "in_predicate_value", + /* 406 */ "boolean_value_expression", + /* 407 */ "boolean_primary", + /* 408 */ "from_clause_opt", + /* 409 */ "table_reference_list", + /* 410 */ "table_reference", + /* 411 */ "table_primary", + /* 412 */ "joined_table", + /* 413 */ "alias_opt", + /* 414 */ "parenthesized_joined_table", + /* 415 */ "join_type", + /* 416 */ "search_condition", + /* 417 */ "query_specification", + /* 418 */ "set_quantifier_opt", + /* 419 */ "select_list", + /* 420 */ "partition_by_clause_opt", + /* 421 */ "range_opt", + /* 422 */ "every_opt", + /* 423 */ "fill_opt", + /* 424 */ "twindow_clause_opt", + /* 425 */ "group_by_clause_opt", + /* 426 */ "having_clause_opt", + /* 427 */ "select_item", + /* 428 */ "fill_mode", + /* 429 */ "group_by_list", + /* 430 */ "query_expression", + /* 431 */ "query_simple", + /* 432 */ "order_by_clause_opt", + /* 433 */ "slimit_clause_opt", + /* 434 */ "limit_clause_opt", + /* 435 */ "union_query_expression", + /* 436 */ "query_simple_or_subquery", + /* 437 */ "sort_specification_list", + /* 438 */ "sort_specification", + /* 439 */ "ordering_specification_opt", + /* 440 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2039,176 +2126,186 @@ static const char *const yyRuleName[] = { /* 326 */ "topic_name ::= NK_ID", /* 327 */ "stream_name ::= NK_ID", /* 328 */ "cgroup_name ::= NK_ID", - /* 329 */ "expression ::= literal", - /* 330 */ "expression ::= pseudo_column", - /* 331 */ "expression ::= column_reference", - /* 332 */ "expression ::= function_expression", - /* 333 */ "expression ::= subquery", - /* 334 */ "expression ::= NK_LP expression NK_RP", - /* 335 */ "expression ::= NK_PLUS expression", - /* 336 */ "expression ::= NK_MINUS expression", - /* 337 */ "expression ::= expression NK_PLUS expression", - /* 338 */ "expression ::= expression NK_MINUS expression", - /* 339 */ "expression ::= expression NK_STAR expression", - /* 340 */ "expression ::= expression NK_SLASH expression", - /* 341 */ "expression ::= expression NK_REM expression", - /* 342 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 343 */ "expression ::= expression NK_BITAND expression", - /* 344 */ "expression ::= expression NK_BITOR expression", - /* 345 */ "expression_list ::= expression", - /* 346 */ "expression_list ::= expression_list NK_COMMA expression", - /* 347 */ "column_reference ::= column_name", - /* 348 */ "column_reference ::= table_name NK_DOT column_name", - /* 349 */ "pseudo_column ::= ROWTS", - /* 350 */ "pseudo_column ::= TBNAME", - /* 351 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 352 */ "pseudo_column ::= QSTART", - /* 353 */ "pseudo_column ::= QEND", - /* 354 */ "pseudo_column ::= QDURATION", - /* 355 */ "pseudo_column ::= WSTART", - /* 356 */ "pseudo_column ::= WEND", - /* 357 */ "pseudo_column ::= WDURATION", - /* 358 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 359 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 360 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 361 */ "function_expression ::= literal_func", - /* 362 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 363 */ "literal_func ::= NOW", - /* 364 */ "noarg_func ::= NOW", - /* 365 */ "noarg_func ::= TODAY", - /* 366 */ "noarg_func ::= TIMEZONE", - /* 367 */ "noarg_func ::= DATABASE", - /* 368 */ "noarg_func ::= CLIENT_VERSION", - /* 369 */ "noarg_func ::= SERVER_VERSION", - /* 370 */ "noarg_func ::= SERVER_STATUS", - /* 371 */ "noarg_func ::= CURRENT_USER", - /* 372 */ "noarg_func ::= USER", - /* 373 */ "star_func ::= COUNT", - /* 374 */ "star_func ::= FIRST", - /* 375 */ "star_func ::= LAST", - /* 376 */ "star_func ::= LAST_ROW", - /* 377 */ "star_func_para_list ::= NK_STAR", - /* 378 */ "star_func_para_list ::= other_para_list", - /* 379 */ "other_para_list ::= star_func_para", - /* 380 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 381 */ "star_func_para ::= expression", - /* 382 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 383 */ "predicate ::= expression compare_op expression", - /* 384 */ "predicate ::= expression BETWEEN expression AND expression", - /* 385 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 386 */ "predicate ::= expression IS NULL", - /* 387 */ "predicate ::= expression IS NOT NULL", - /* 388 */ "predicate ::= expression in_op in_predicate_value", - /* 389 */ "compare_op ::= NK_LT", - /* 390 */ "compare_op ::= NK_GT", - /* 391 */ "compare_op ::= NK_LE", - /* 392 */ "compare_op ::= NK_GE", - /* 393 */ "compare_op ::= NK_NE", - /* 394 */ "compare_op ::= NK_EQ", - /* 395 */ "compare_op ::= LIKE", - /* 396 */ "compare_op ::= NOT LIKE", - /* 397 */ "compare_op ::= MATCH", - /* 398 */ "compare_op ::= NMATCH", - /* 399 */ "compare_op ::= CONTAINS", - /* 400 */ "in_op ::= IN", - /* 401 */ "in_op ::= NOT IN", - /* 402 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 403 */ "boolean_value_expression ::= boolean_primary", - /* 404 */ "boolean_value_expression ::= NOT boolean_primary", - /* 405 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 406 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 407 */ "boolean_primary ::= predicate", - /* 408 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 409 */ "common_expression ::= expression", - /* 410 */ "common_expression ::= boolean_value_expression", - /* 411 */ "from_clause_opt ::=", - /* 412 */ "from_clause_opt ::= FROM table_reference_list", - /* 413 */ "table_reference_list ::= table_reference", - /* 414 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 415 */ "table_reference ::= table_primary", - /* 416 */ "table_reference ::= joined_table", - /* 417 */ "table_primary ::= table_name alias_opt", - /* 418 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 419 */ "table_primary ::= subquery alias_opt", - /* 420 */ "table_primary ::= parenthesized_joined_table", - /* 421 */ "alias_opt ::=", - /* 422 */ "alias_opt ::= table_alias", - /* 423 */ "alias_opt ::= AS table_alias", - /* 424 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 425 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 426 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 427 */ "join_type ::=", - /* 428 */ "join_type ::= INNER", - /* 429 */ "query_specification ::= SELECT set_quantifier_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", - /* 430 */ "set_quantifier_opt ::=", - /* 431 */ "set_quantifier_opt ::= DISTINCT", - /* 432 */ "set_quantifier_opt ::= ALL", - /* 433 */ "select_list ::= select_item", - /* 434 */ "select_list ::= select_list NK_COMMA select_item", - /* 435 */ "select_item ::= NK_STAR", - /* 436 */ "select_item ::= common_expression", - /* 437 */ "select_item ::= common_expression column_alias", - /* 438 */ "select_item ::= common_expression AS column_alias", - /* 439 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 440 */ "where_clause_opt ::=", - /* 441 */ "where_clause_opt ::= WHERE search_condition", - /* 442 */ "partition_by_clause_opt ::=", - /* 443 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 444 */ "twindow_clause_opt ::=", - /* 445 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 446 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 447 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 448 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 449 */ "sliding_opt ::=", - /* 450 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 451 */ "fill_opt ::=", - /* 452 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 453 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 454 */ "fill_mode ::= NONE", - /* 455 */ "fill_mode ::= PREV", - /* 456 */ "fill_mode ::= NULL", - /* 457 */ "fill_mode ::= LINEAR", - /* 458 */ "fill_mode ::= NEXT", - /* 459 */ "group_by_clause_opt ::=", - /* 460 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 461 */ "group_by_list ::= expression", - /* 462 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 463 */ "having_clause_opt ::=", - /* 464 */ "having_clause_opt ::= HAVING search_condition", - /* 465 */ "range_opt ::=", - /* 466 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 467 */ "every_opt ::=", - /* 468 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 469 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 470 */ "query_simple ::= query_specification", - /* 471 */ "query_simple ::= union_query_expression", - /* 472 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 473 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 474 */ "query_simple_or_subquery ::= query_simple", - /* 475 */ "query_simple_or_subquery ::= subquery", - /* 476 */ "query_or_subquery ::= query_expression", - /* 477 */ "query_or_subquery ::= subquery", - /* 478 */ "order_by_clause_opt ::=", - /* 479 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 480 */ "slimit_clause_opt ::=", - /* 481 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 482 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 483 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 484 */ "limit_clause_opt ::=", - /* 485 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 486 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 487 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 488 */ "subquery ::= NK_LP query_expression NK_RP", - /* 489 */ "search_condition ::= common_expression", - /* 490 */ "sort_specification_list ::= sort_specification", - /* 491 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 492 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 493 */ "ordering_specification_opt ::=", - /* 494 */ "ordering_specification_opt ::= ASC", - /* 495 */ "ordering_specification_opt ::= DESC", - /* 496 */ "null_ordering_opt ::=", - /* 497 */ "null_ordering_opt ::= NULLS FIRST", - /* 498 */ "null_ordering_opt ::= NULLS LAST", + /* 329 */ "expr_or_subquery ::= expression", + /* 330 */ "expr_or_subquery ::= subquery", + /* 331 */ "expression ::= literal", + /* 332 */ "expression ::= pseudo_column", + /* 333 */ "expression ::= column_reference", + /* 334 */ "expression ::= function_expression", + /* 335 */ "expression ::= case_when_expression", + /* 336 */ "expression ::= NK_LP expression NK_RP", + /* 337 */ "expression ::= NK_PLUS expr_or_subquery", + /* 338 */ "expression ::= NK_MINUS expr_or_subquery", + /* 339 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 340 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 341 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 342 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 343 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 344 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 345 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 346 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 347 */ "expression_list ::= expr_or_subquery", + /* 348 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 349 */ "column_reference ::= column_name", + /* 350 */ "column_reference ::= table_name NK_DOT column_name", + /* 351 */ "pseudo_column ::= ROWTS", + /* 352 */ "pseudo_column ::= TBNAME", + /* 353 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 354 */ "pseudo_column ::= QSTART", + /* 355 */ "pseudo_column ::= QEND", + /* 356 */ "pseudo_column ::= QDURATION", + /* 357 */ "pseudo_column ::= WSTART", + /* 358 */ "pseudo_column ::= WEND", + /* 359 */ "pseudo_column ::= WDURATION", + /* 360 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 361 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 362 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 363 */ "function_expression ::= literal_func", + /* 364 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 365 */ "literal_func ::= NOW", + /* 366 */ "noarg_func ::= NOW", + /* 367 */ "noarg_func ::= TODAY", + /* 368 */ "noarg_func ::= TIMEZONE", + /* 369 */ "noarg_func ::= DATABASE", + /* 370 */ "noarg_func ::= CLIENT_VERSION", + /* 371 */ "noarg_func ::= SERVER_VERSION", + /* 372 */ "noarg_func ::= SERVER_STATUS", + /* 373 */ "noarg_func ::= CURRENT_USER", + /* 374 */ "noarg_func ::= USER", + /* 375 */ "star_func ::= COUNT", + /* 376 */ "star_func ::= FIRST", + /* 377 */ "star_func ::= LAST", + /* 378 */ "star_func ::= LAST_ROW", + /* 379 */ "star_func_para_list ::= NK_STAR", + /* 380 */ "star_func_para_list ::= other_para_list", + /* 381 */ "other_para_list ::= star_func_para", + /* 382 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 383 */ "star_func_para ::= expr_or_subquery", + /* 384 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 385 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 386 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 387 */ "when_then_list ::= when_then_expr", + /* 388 */ "when_then_list ::= when_then_list when_then_expr", + /* 389 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 390 */ "case_when_else_opt ::=", + /* 391 */ "case_when_else_opt ::= ELSE common_expression", + /* 392 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 393 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 394 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 395 */ "predicate ::= expr_or_subquery IS NULL", + /* 396 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 397 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 398 */ "compare_op ::= NK_LT", + /* 399 */ "compare_op ::= NK_GT", + /* 400 */ "compare_op ::= NK_LE", + /* 401 */ "compare_op ::= NK_GE", + /* 402 */ "compare_op ::= NK_NE", + /* 403 */ "compare_op ::= NK_EQ", + /* 404 */ "compare_op ::= LIKE", + /* 405 */ "compare_op ::= NOT LIKE", + /* 406 */ "compare_op ::= MATCH", + /* 407 */ "compare_op ::= NMATCH", + /* 408 */ "compare_op ::= CONTAINS", + /* 409 */ "in_op ::= IN", + /* 410 */ "in_op ::= NOT IN", + /* 411 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 412 */ "boolean_value_expression ::= boolean_primary", + /* 413 */ "boolean_value_expression ::= NOT boolean_primary", + /* 414 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 415 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 416 */ "boolean_primary ::= predicate", + /* 417 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 418 */ "common_expression ::= expr_or_subquery", + /* 419 */ "common_expression ::= boolean_value_expression", + /* 420 */ "from_clause_opt ::=", + /* 421 */ "from_clause_opt ::= FROM table_reference_list", + /* 422 */ "table_reference_list ::= table_reference", + /* 423 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 424 */ "table_reference ::= table_primary", + /* 425 */ "table_reference ::= joined_table", + /* 426 */ "table_primary ::= table_name alias_opt", + /* 427 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 428 */ "table_primary ::= subquery alias_opt", + /* 429 */ "table_primary ::= parenthesized_joined_table", + /* 430 */ "alias_opt ::=", + /* 431 */ "alias_opt ::= table_alias", + /* 432 */ "alias_opt ::= AS table_alias", + /* 433 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 434 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 435 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 436 */ "join_type ::=", + /* 437 */ "join_type ::= INNER", + /* 438 */ "query_specification ::= SELECT set_quantifier_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", + /* 439 */ "set_quantifier_opt ::=", + /* 440 */ "set_quantifier_opt ::= DISTINCT", + /* 441 */ "set_quantifier_opt ::= ALL", + /* 442 */ "select_list ::= select_item", + /* 443 */ "select_list ::= select_list NK_COMMA select_item", + /* 444 */ "select_item ::= NK_STAR", + /* 445 */ "select_item ::= common_expression", + /* 446 */ "select_item ::= common_expression column_alias", + /* 447 */ "select_item ::= common_expression AS column_alias", + /* 448 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 449 */ "where_clause_opt ::=", + /* 450 */ "where_clause_opt ::= WHERE search_condition", + /* 451 */ "partition_by_clause_opt ::=", + /* 452 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 453 */ "twindow_clause_opt ::=", + /* 454 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 455 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 456 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 457 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 458 */ "sliding_opt ::=", + /* 459 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 460 */ "fill_opt ::=", + /* 461 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 462 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 463 */ "fill_mode ::= NONE", + /* 464 */ "fill_mode ::= PREV", + /* 465 */ "fill_mode ::= NULL", + /* 466 */ "fill_mode ::= LINEAR", + /* 467 */ "fill_mode ::= NEXT", + /* 468 */ "group_by_clause_opt ::=", + /* 469 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 470 */ "group_by_list ::= expr_or_subquery", + /* 471 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 472 */ "having_clause_opt ::=", + /* 473 */ "having_clause_opt ::= HAVING search_condition", + /* 474 */ "range_opt ::=", + /* 475 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 476 */ "every_opt ::=", + /* 477 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 478 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 479 */ "query_simple ::= query_specification", + /* 480 */ "query_simple ::= union_query_expression", + /* 481 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 482 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 483 */ "query_simple_or_subquery ::= query_simple", + /* 484 */ "query_simple_or_subquery ::= subquery", + /* 485 */ "query_or_subquery ::= query_expression", + /* 486 */ "query_or_subquery ::= subquery", + /* 487 */ "order_by_clause_opt ::=", + /* 488 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 489 */ "slimit_clause_opt ::=", + /* 490 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 491 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 492 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 493 */ "limit_clause_opt ::=", + /* 494 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 495 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 496 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 497 */ "subquery ::= NK_LP query_expression NK_RP", + /* 498 */ "subquery ::= NK_LP subquery NK_RP", + /* 499 */ "search_condition ::= common_expression", + /* 500 */ "sort_specification_list ::= sort_specification", + /* 501 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 502 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 503 */ "ordering_specification_opt ::=", + /* 504 */ "ordering_specification_opt ::= ASC", + /* 505 */ "ordering_specification_opt ::= DESC", + /* 506 */ "null_ordering_opt ::=", + /* 507 */ "null_ordering_opt ::= NULLS FIRST", + /* 508 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2335,181 +2432,186 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 309: /* cmd */ - case 312: /* literal */ - case 323: /* db_options */ - case 325: /* alter_db_options */ - case 330: /* retention */ - case 331: /* full_table_name */ - case 334: /* table_options */ - case 338: /* alter_table_clause */ - case 339: /* alter_table_options */ - case 342: /* signed_literal */ - case 343: /* create_subtable_clause */ - case 346: /* drop_table_clause */ - case 349: /* column_def */ - case 353: /* duration_literal */ - case 354: /* rollup_func_name */ - case 356: /* col_name */ - case 357: /* db_name_cond_opt */ - case 358: /* like_pattern_opt */ - case 359: /* table_name_cond */ - case 360: /* from_db_opt */ - case 361: /* index_options */ - case 363: /* sliding_opt */ - case 364: /* sma_stream_opt */ - case 365: /* func */ - case 366: /* stream_options */ - case 368: /* query_or_subquery */ - case 371: /* explain_options */ - case 376: /* where_clause_opt */ - case 377: /* signed */ - case 378: /* literal_func */ - case 382: /* expression */ - case 383: /* pseudo_column */ - case 384: /* column_reference */ - case 385: /* function_expression */ - case 386: /* subquery */ - case 391: /* star_func_para */ - case 392: /* predicate */ - case 395: /* in_predicate_value */ - case 396: /* boolean_value_expression */ - case 397: /* boolean_primary */ - case 398: /* common_expression */ - case 399: /* from_clause_opt */ - case 400: /* table_reference_list */ - case 401: /* table_reference */ - case 402: /* table_primary */ - case 403: /* joined_table */ - case 405: /* parenthesized_joined_table */ - case 407: /* search_condition */ - case 408: /* query_specification */ - case 412: /* range_opt */ - case 413: /* every_opt */ - case 414: /* fill_opt */ - case 415: /* twindow_clause_opt */ - case 417: /* having_clause_opt */ - case 418: /* select_item */ - case 421: /* query_expression */ - case 422: /* query_simple */ - case 424: /* slimit_clause_opt */ - case 425: /* limit_clause_opt */ - case 426: /* union_query_expression */ - case 427: /* query_simple_or_subquery */ - case 429: /* sort_specification */ + case 313: /* cmd */ + case 316: /* literal */ + case 327: /* db_options */ + case 329: /* alter_db_options */ + case 334: /* retention */ + case 335: /* full_table_name */ + case 338: /* table_options */ + case 342: /* alter_table_clause */ + case 343: /* alter_table_options */ + case 346: /* signed_literal */ + case 347: /* create_subtable_clause */ + case 350: /* drop_table_clause */ + case 353: /* column_def */ + case 357: /* duration_literal */ + case 358: /* rollup_func_name */ + case 360: /* col_name */ + case 361: /* db_name_cond_opt */ + case 362: /* like_pattern_opt */ + case 363: /* table_name_cond */ + case 364: /* from_db_opt */ + case 365: /* index_options */ + case 367: /* sliding_opt */ + case 368: /* sma_stream_opt */ + case 369: /* func */ + case 370: /* stream_options */ + case 372: /* query_or_subquery */ + case 375: /* explain_options */ + case 380: /* where_clause_opt */ + case 381: /* signed */ + case 382: /* literal_func */ + case 386: /* expr_or_subquery */ + case 387: /* expression */ + case 388: /* subquery */ + case 389: /* pseudo_column */ + case 390: /* column_reference */ + case 391: /* function_expression */ + case 392: /* case_when_expression */ + case 397: /* star_func_para */ + case 399: /* case_when_else_opt */ + case 400: /* common_expression */ + case 401: /* when_then_expr */ + case 402: /* predicate */ + case 405: /* in_predicate_value */ + case 406: /* boolean_value_expression */ + case 407: /* boolean_primary */ + case 408: /* from_clause_opt */ + case 409: /* table_reference_list */ + case 410: /* table_reference */ + case 411: /* table_primary */ + case 412: /* joined_table */ + case 414: /* parenthesized_joined_table */ + case 416: /* search_condition */ + case 417: /* query_specification */ + case 421: /* range_opt */ + case 422: /* every_opt */ + case 423: /* fill_opt */ + case 424: /* twindow_clause_opt */ + case 426: /* having_clause_opt */ + case 427: /* select_item */ + case 430: /* query_expression */ + case 431: /* query_simple */ + case 433: /* slimit_clause_opt */ + case 434: /* limit_clause_opt */ + case 435: /* union_query_expression */ + case 436: /* query_simple_or_subquery */ + case 438: /* sort_specification */ { - nodesDestroyNode((yypminor->yy776)); + nodesDestroyNode((yypminor->yy560)); } break; - case 310: /* account_options */ - case 311: /* alter_account_options */ - case 313: /* alter_account_option */ - case 373: /* bufsize_opt */ + case 314: /* account_options */ + case 315: /* alter_account_options */ + case 317: /* alter_account_option */ + case 377: /* bufsize_opt */ { } break; - case 314: /* user_name */ - case 317: /* priv_level */ - case 320: /* db_name */ - case 321: /* dnode_endpoint */ - case 340: /* column_name */ - case 348: /* table_name */ - case 355: /* function_name */ - case 367: /* topic_name */ - case 369: /* cgroup_name */ - case 374: /* stream_name */ - case 380: /* table_alias */ - case 381: /* column_alias */ - case 387: /* star_func */ - case 389: /* noarg_func */ - case 404: /* alias_opt */ + case 318: /* user_name */ + case 321: /* priv_level */ + case 324: /* db_name */ + case 325: /* dnode_endpoint */ + case 344: /* column_name */ + case 352: /* table_name */ + case 359: /* function_name */ + case 371: /* topic_name */ + case 373: /* cgroup_name */ + case 378: /* stream_name */ + case 384: /* table_alias */ + case 385: /* column_alias */ + case 393: /* star_func */ + case 395: /* noarg_func */ + case 413: /* alias_opt */ { } break; - case 315: /* sysinfo_opt */ + case 319: /* sysinfo_opt */ { } break; - case 316: /* privileges */ - case 318: /* priv_type_list */ - case 319: /* priv_type */ + case 320: /* privileges */ + case 322: /* priv_type_list */ + case 323: /* priv_type */ { } break; - case 322: /* not_exists_opt */ - case 324: /* exists_opt */ - case 370: /* analyze_opt */ - case 372: /* agg_func_opt */ - case 409: /* set_quantifier_opt */ + case 326: /* not_exists_opt */ + case 328: /* exists_opt */ + case 374: /* analyze_opt */ + case 376: /* agg_func_opt */ + case 418: /* set_quantifier_opt */ { } break; - case 326: /* integer_list */ - case 327: /* variable_list */ - case 328: /* retention_list */ - case 332: /* column_def_list */ - case 333: /* tags_def_opt */ - case 335: /* multi_create_clause */ - case 336: /* tags_def */ - case 337: /* multi_drop_clause */ - case 344: /* specific_cols_opt */ - case 345: /* expression_list */ - case 347: /* col_name_list */ - case 350: /* duration_list */ - case 351: /* rollup_func_list */ - case 362: /* func_list */ - case 375: /* dnode_list */ - case 379: /* literal_list */ - case 388: /* star_func_para_list */ - case 390: /* other_para_list */ - case 410: /* select_list */ - case 411: /* partition_by_clause_opt */ - case 416: /* group_by_clause_opt */ - case 420: /* group_by_list */ - case 423: /* order_by_clause_opt */ - case 428: /* sort_specification_list */ + case 330: /* integer_list */ + case 331: /* variable_list */ + case 332: /* retention_list */ + case 336: /* column_def_list */ + case 337: /* tags_def_opt */ + case 339: /* multi_create_clause */ + case 340: /* tags_def */ + case 341: /* multi_drop_clause */ + case 348: /* specific_cols_opt */ + case 349: /* expression_list */ + case 351: /* col_name_list */ + case 354: /* duration_list */ + case 355: /* rollup_func_list */ + case 366: /* func_list */ + case 379: /* dnode_list */ + case 383: /* literal_list */ + case 394: /* star_func_para_list */ + case 396: /* other_para_list */ + case 398: /* when_then_list */ + case 419: /* select_list */ + case 420: /* partition_by_clause_opt */ + case 425: /* group_by_clause_opt */ + case 429: /* group_by_list */ + case 432: /* order_by_clause_opt */ + case 437: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy280)); + nodesDestroyList((yypminor->yy334)); } break; - case 329: /* alter_db_option */ - case 352: /* alter_table_option */ + case 333: /* alter_db_option */ + case 356: /* alter_table_option */ { } break; - case 341: /* type_name */ + case 345: /* type_name */ { } break; - case 393: /* compare_op */ - case 394: /* in_op */ + case 403: /* compare_op */ + case 404: /* in_op */ { } break; - case 406: /* join_type */ + case 415: /* join_type */ { } break; - case 419: /* fill_mode */ + case 428: /* fill_mode */ { } break; - case 430: /* ordering_specification_opt */ + case 439: /* ordering_specification_opt */ { } break; - case 431: /* null_ordering_opt */ + case 440: /* null_ordering_opt */ { } @@ -2808,505 +2910,515 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 309, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 309, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 310, 0 }, /* (2) account_options ::= */ - { 310, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 310, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 310, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 310, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 310, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 310, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 310, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 310, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 310, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 311, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 311, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 313, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 313, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 313, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 313, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 313, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 313, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 313, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 313, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 313, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 313, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 309, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 309, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 309, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 309, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 309, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 315, 0 }, /* (29) sysinfo_opt ::= */ - { 315, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 309, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 309, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 316, -1 }, /* (33) privileges ::= ALL */ - { 316, -1 }, /* (34) privileges ::= priv_type_list */ - { 318, -1 }, /* (35) priv_type_list ::= priv_type */ - { 318, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 319, -1 }, /* (37) priv_type ::= READ */ - { 319, -1 }, /* (38) priv_type ::= WRITE */ - { 317, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 317, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 309, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 309, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 309, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 309, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 309, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 309, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 309, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 309, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 321, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 321, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 321, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 309, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 309, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 309, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 309, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 309, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 309, -2 }, /* (64) cmd ::= USE db_name */ - { 309, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 309, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ - { 309, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ - { 322, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ - { 322, 0 }, /* (69) not_exists_opt ::= */ - { 324, -2 }, /* (70) exists_opt ::= IF EXISTS */ - { 324, 0 }, /* (71) exists_opt ::= */ - { 323, 0 }, /* (72) db_options ::= */ - { 323, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ - { 323, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ - { 323, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ - { 323, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ - { 323, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ - { 323, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ - { 323, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */ - { 323, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */ - { 323, -3 }, /* (81) db_options ::= db_options KEEP integer_list */ - { 323, -3 }, /* (82) db_options ::= db_options KEEP variable_list */ - { 323, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */ - { 323, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 323, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - { 323, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ - { 323, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ - { 323, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ - { 323, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */ - { 323, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 323, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */ - { 323, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 323, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - { 323, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - { 323, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { 323, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - { 323, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { 323, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - { 323, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { 323, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { 323, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - { 323, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ - { 323, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ - { 325, -1 }, /* (104) alter_db_options ::= alter_db_option */ - { 325, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */ - { 329, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */ - { 329, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 329, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 329, -2 }, /* (109) alter_db_option ::= KEEP integer_list */ - { 329, -2 }, /* (110) alter_db_option ::= KEEP variable_list */ - { 329, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 329, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 326, -1 }, /* (113) integer_list ::= NK_INTEGER */ - { 326, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 327, -1 }, /* (115) variable_list ::= NK_VARIABLE */ - { 327, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 328, -1 }, /* (117) retention_list ::= retention */ - { 328, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */ - { 330, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 309, -9 }, /* (120) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 309, -3 }, /* (121) cmd ::= CREATE TABLE multi_create_clause */ - { 309, -9 }, /* (122) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 309, -3 }, /* (123) cmd ::= DROP TABLE multi_drop_clause */ - { 309, -4 }, /* (124) cmd ::= DROP STABLE exists_opt full_table_name */ - { 309, -3 }, /* (125) cmd ::= ALTER TABLE alter_table_clause */ - { 309, -3 }, /* (126) cmd ::= ALTER STABLE alter_table_clause */ - { 338, -2 }, /* (127) alter_table_clause ::= full_table_name alter_table_options */ - { 338, -5 }, /* (128) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 338, -4 }, /* (129) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 338, -5 }, /* (130) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 338, -5 }, /* (131) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 338, -5 }, /* (132) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 338, -4 }, /* (133) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 338, -5 }, /* (134) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 338, -5 }, /* (135) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 338, -6 }, /* (136) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 335, -1 }, /* (137) multi_create_clause ::= create_subtable_clause */ - { 335, -2 }, /* (138) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 343, -10 }, /* (139) 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 */ - { 337, -1 }, /* (140) multi_drop_clause ::= drop_table_clause */ - { 337, -2 }, /* (141) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 346, -2 }, /* (142) drop_table_clause ::= exists_opt full_table_name */ - { 344, 0 }, /* (143) specific_cols_opt ::= */ - { 344, -3 }, /* (144) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 331, -1 }, /* (145) full_table_name ::= table_name */ - { 331, -3 }, /* (146) full_table_name ::= db_name NK_DOT table_name */ - { 332, -1 }, /* (147) column_def_list ::= column_def */ - { 332, -3 }, /* (148) column_def_list ::= column_def_list NK_COMMA column_def */ - { 349, -2 }, /* (149) column_def ::= column_name type_name */ - { 349, -4 }, /* (150) column_def ::= column_name type_name COMMENT NK_STRING */ - { 341, -1 }, /* (151) type_name ::= BOOL */ - { 341, -1 }, /* (152) type_name ::= TINYINT */ - { 341, -1 }, /* (153) type_name ::= SMALLINT */ - { 341, -1 }, /* (154) type_name ::= INT */ - { 341, -1 }, /* (155) type_name ::= INTEGER */ - { 341, -1 }, /* (156) type_name ::= BIGINT */ - { 341, -1 }, /* (157) type_name ::= FLOAT */ - { 341, -1 }, /* (158) type_name ::= DOUBLE */ - { 341, -4 }, /* (159) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 341, -1 }, /* (160) type_name ::= TIMESTAMP */ - { 341, -4 }, /* (161) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 341, -2 }, /* (162) type_name ::= TINYINT UNSIGNED */ - { 341, -2 }, /* (163) type_name ::= SMALLINT UNSIGNED */ - { 341, -2 }, /* (164) type_name ::= INT UNSIGNED */ - { 341, -2 }, /* (165) type_name ::= BIGINT UNSIGNED */ - { 341, -1 }, /* (166) type_name ::= JSON */ - { 341, -4 }, /* (167) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 341, -1 }, /* (168) type_name ::= MEDIUMBLOB */ - { 341, -1 }, /* (169) type_name ::= BLOB */ - { 341, -4 }, /* (170) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 341, -1 }, /* (171) type_name ::= DECIMAL */ - { 341, -4 }, /* (172) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 341, -6 }, /* (173) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 333, 0 }, /* (174) tags_def_opt ::= */ - { 333, -1 }, /* (175) tags_def_opt ::= tags_def */ - { 336, -4 }, /* (176) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 334, 0 }, /* (177) table_options ::= */ - { 334, -3 }, /* (178) table_options ::= table_options COMMENT NK_STRING */ - { 334, -3 }, /* (179) table_options ::= table_options MAX_DELAY duration_list */ - { 334, -3 }, /* (180) table_options ::= table_options WATERMARK duration_list */ - { 334, -5 }, /* (181) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 334, -3 }, /* (182) table_options ::= table_options TTL NK_INTEGER */ - { 334, -5 }, /* (183) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 339, -1 }, /* (184) alter_table_options ::= alter_table_option */ - { 339, -2 }, /* (185) alter_table_options ::= alter_table_options alter_table_option */ - { 352, -2 }, /* (186) alter_table_option ::= COMMENT NK_STRING */ - { 352, -2 }, /* (187) alter_table_option ::= TTL NK_INTEGER */ - { 350, -1 }, /* (188) duration_list ::= duration_literal */ - { 350, -3 }, /* (189) duration_list ::= duration_list NK_COMMA duration_literal */ - { 351, -1 }, /* (190) rollup_func_list ::= rollup_func_name */ - { 351, -3 }, /* (191) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 354, -1 }, /* (192) rollup_func_name ::= function_name */ - { 354, -1 }, /* (193) rollup_func_name ::= FIRST */ - { 354, -1 }, /* (194) rollup_func_name ::= LAST */ - { 347, -1 }, /* (195) col_name_list ::= col_name */ - { 347, -3 }, /* (196) col_name_list ::= col_name_list NK_COMMA col_name */ - { 356, -1 }, /* (197) col_name ::= column_name */ - { 309, -2 }, /* (198) cmd ::= SHOW DNODES */ - { 309, -2 }, /* (199) cmd ::= SHOW USERS */ - { 309, -2 }, /* (200) cmd ::= SHOW DATABASES */ - { 309, -4 }, /* (201) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 309, -4 }, /* (202) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 309, -3 }, /* (203) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 309, -2 }, /* (204) cmd ::= SHOW MNODES */ - { 309, -2 }, /* (205) cmd ::= SHOW MODULES */ - { 309, -2 }, /* (206) cmd ::= SHOW QNODES */ - { 309, -2 }, /* (207) cmd ::= SHOW FUNCTIONS */ - { 309, -5 }, /* (208) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 309, -2 }, /* (209) cmd ::= SHOW STREAMS */ - { 309, -2 }, /* (210) cmd ::= SHOW ACCOUNTS */ - { 309, -2 }, /* (211) cmd ::= SHOW APPS */ - { 309, -2 }, /* (212) cmd ::= SHOW CONNECTIONS */ - { 309, -2 }, /* (213) cmd ::= SHOW LICENCES */ - { 309, -2 }, /* (214) cmd ::= SHOW GRANTS */ - { 309, -4 }, /* (215) cmd ::= SHOW CREATE DATABASE db_name */ - { 309, -4 }, /* (216) cmd ::= SHOW CREATE TABLE full_table_name */ - { 309, -4 }, /* (217) cmd ::= SHOW CREATE STABLE full_table_name */ - { 309, -2 }, /* (218) cmd ::= SHOW QUERIES */ - { 309, -2 }, /* (219) cmd ::= SHOW SCORES */ - { 309, -2 }, /* (220) cmd ::= SHOW TOPICS */ - { 309, -2 }, /* (221) cmd ::= SHOW VARIABLES */ - { 309, -3 }, /* (222) cmd ::= SHOW LOCAL VARIABLES */ - { 309, -4 }, /* (223) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 309, -2 }, /* (224) cmd ::= SHOW BNODES */ - { 309, -2 }, /* (225) cmd ::= SHOW SNODES */ - { 309, -2 }, /* (226) cmd ::= SHOW CLUSTER */ - { 309, -2 }, /* (227) cmd ::= SHOW TRANSACTIONS */ - { 309, -4 }, /* (228) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 309, -2 }, /* (229) cmd ::= SHOW CONSUMERS */ - { 309, -2 }, /* (230) cmd ::= SHOW SUBSCRIPTIONS */ - { 309, -5 }, /* (231) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 309, -3 }, /* (232) cmd ::= SHOW VNODES NK_INTEGER */ - { 309, -3 }, /* (233) cmd ::= SHOW VNODES NK_STRING */ - { 357, 0 }, /* (234) db_name_cond_opt ::= */ - { 357, -2 }, /* (235) db_name_cond_opt ::= db_name NK_DOT */ - { 358, 0 }, /* (236) like_pattern_opt ::= */ - { 358, -2 }, /* (237) like_pattern_opt ::= LIKE NK_STRING */ - { 359, -1 }, /* (238) table_name_cond ::= table_name */ - { 360, 0 }, /* (239) from_db_opt ::= */ - { 360, -2 }, /* (240) from_db_opt ::= FROM db_name */ - { 309, -8 }, /* (241) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ - { 309, -4 }, /* (242) cmd ::= DROP INDEX exists_opt full_table_name */ - { 361, -10 }, /* (243) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 361, -12 }, /* (244) 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 */ - { 362, -1 }, /* (245) func_list ::= func */ - { 362, -3 }, /* (246) func_list ::= func_list NK_COMMA func */ - { 365, -4 }, /* (247) func ::= function_name NK_LP expression_list NK_RP */ - { 364, 0 }, /* (248) sma_stream_opt ::= */ - { 364, -3 }, /* (249) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 364, -3 }, /* (250) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 309, -6 }, /* (251) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 309, -7 }, /* (252) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 309, -9 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 309, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 309, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 309, -4 }, /* (256) cmd ::= DROP TOPIC exists_opt topic_name */ - { 309, -7 }, /* (257) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 309, -2 }, /* (258) cmd ::= DESC full_table_name */ - { 309, -2 }, /* (259) cmd ::= DESCRIBE full_table_name */ - { 309, -3 }, /* (260) cmd ::= RESET QUERY CACHE */ - { 309, -4 }, /* (261) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 370, 0 }, /* (262) analyze_opt ::= */ - { 370, -1 }, /* (263) analyze_opt ::= ANALYZE */ - { 371, 0 }, /* (264) explain_options ::= */ - { 371, -3 }, /* (265) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 371, -3 }, /* (266) explain_options ::= explain_options RATIO NK_FLOAT */ - { 309, -10 }, /* (267) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 309, -4 }, /* (268) cmd ::= DROP FUNCTION exists_opt function_name */ - { 372, 0 }, /* (269) agg_func_opt ::= */ - { 372, -1 }, /* (270) agg_func_opt ::= AGGREGATE */ - { 373, 0 }, /* (271) bufsize_opt ::= */ - { 373, -2 }, /* (272) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 309, -9 }, /* (273) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery */ - { 309, -4 }, /* (274) cmd ::= DROP STREAM exists_opt stream_name */ - { 366, 0 }, /* (275) stream_options ::= */ - { 366, -3 }, /* (276) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 366, -3 }, /* (277) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 366, -4 }, /* (278) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 366, -3 }, /* (279) stream_options ::= stream_options WATERMARK duration_literal */ - { 366, -4 }, /* (280) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 309, -3 }, /* (281) cmd ::= KILL CONNECTION NK_INTEGER */ - { 309, -3 }, /* (282) cmd ::= KILL QUERY NK_STRING */ - { 309, -3 }, /* (283) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 309, -2 }, /* (284) cmd ::= BALANCE VGROUP */ - { 309, -4 }, /* (285) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 309, -4 }, /* (286) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 309, -3 }, /* (287) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 375, -2 }, /* (288) dnode_list ::= DNODE NK_INTEGER */ - { 375, -3 }, /* (289) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 309, -4 }, /* (290) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 309, -1 }, /* (291) cmd ::= query_or_subquery */ - { 309, -7 }, /* (292) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 309, -4 }, /* (293) cmd ::= INSERT INTO full_table_name query_or_subquery */ - { 312, -1 }, /* (294) literal ::= NK_INTEGER */ - { 312, -1 }, /* (295) literal ::= NK_FLOAT */ - { 312, -1 }, /* (296) literal ::= NK_STRING */ - { 312, -1 }, /* (297) literal ::= NK_BOOL */ - { 312, -2 }, /* (298) literal ::= TIMESTAMP NK_STRING */ - { 312, -1 }, /* (299) literal ::= duration_literal */ - { 312, -1 }, /* (300) literal ::= NULL */ - { 312, -1 }, /* (301) literal ::= NK_QUESTION */ - { 353, -1 }, /* (302) duration_literal ::= NK_VARIABLE */ - { 377, -1 }, /* (303) signed ::= NK_INTEGER */ - { 377, -2 }, /* (304) signed ::= NK_PLUS NK_INTEGER */ - { 377, -2 }, /* (305) signed ::= NK_MINUS NK_INTEGER */ - { 377, -1 }, /* (306) signed ::= NK_FLOAT */ - { 377, -2 }, /* (307) signed ::= NK_PLUS NK_FLOAT */ - { 377, -2 }, /* (308) signed ::= NK_MINUS NK_FLOAT */ - { 342, -1 }, /* (309) signed_literal ::= signed */ - { 342, -1 }, /* (310) signed_literal ::= NK_STRING */ - { 342, -1 }, /* (311) signed_literal ::= NK_BOOL */ - { 342, -2 }, /* (312) signed_literal ::= TIMESTAMP NK_STRING */ - { 342, -1 }, /* (313) signed_literal ::= duration_literal */ - { 342, -1 }, /* (314) signed_literal ::= NULL */ - { 342, -1 }, /* (315) signed_literal ::= literal_func */ - { 342, -1 }, /* (316) signed_literal ::= NK_QUESTION */ - { 379, -1 }, /* (317) literal_list ::= signed_literal */ - { 379, -3 }, /* (318) literal_list ::= literal_list NK_COMMA signed_literal */ - { 320, -1 }, /* (319) db_name ::= NK_ID */ - { 348, -1 }, /* (320) table_name ::= NK_ID */ - { 340, -1 }, /* (321) column_name ::= NK_ID */ - { 355, -1 }, /* (322) function_name ::= NK_ID */ - { 380, -1 }, /* (323) table_alias ::= NK_ID */ - { 381, -1 }, /* (324) column_alias ::= NK_ID */ - { 314, -1 }, /* (325) user_name ::= NK_ID */ - { 367, -1 }, /* (326) topic_name ::= NK_ID */ - { 374, -1 }, /* (327) stream_name ::= NK_ID */ - { 369, -1 }, /* (328) cgroup_name ::= NK_ID */ - { 382, -1 }, /* (329) expression ::= literal */ - { 382, -1 }, /* (330) expression ::= pseudo_column */ - { 382, -1 }, /* (331) expression ::= column_reference */ - { 382, -1 }, /* (332) expression ::= function_expression */ - { 382, -1 }, /* (333) expression ::= subquery */ - { 382, -3 }, /* (334) expression ::= NK_LP expression NK_RP */ - { 382, -2 }, /* (335) expression ::= NK_PLUS expression */ - { 382, -2 }, /* (336) expression ::= NK_MINUS expression */ - { 382, -3 }, /* (337) expression ::= expression NK_PLUS expression */ - { 382, -3 }, /* (338) expression ::= expression NK_MINUS expression */ - { 382, -3 }, /* (339) expression ::= expression NK_STAR expression */ - { 382, -3 }, /* (340) expression ::= expression NK_SLASH expression */ - { 382, -3 }, /* (341) expression ::= expression NK_REM expression */ - { 382, -3 }, /* (342) expression ::= column_reference NK_ARROW NK_STRING */ - { 382, -3 }, /* (343) expression ::= expression NK_BITAND expression */ - { 382, -3 }, /* (344) expression ::= expression NK_BITOR expression */ - { 345, -1 }, /* (345) expression_list ::= expression */ - { 345, -3 }, /* (346) expression_list ::= expression_list NK_COMMA expression */ - { 384, -1 }, /* (347) column_reference ::= column_name */ - { 384, -3 }, /* (348) column_reference ::= table_name NK_DOT column_name */ - { 383, -1 }, /* (349) pseudo_column ::= ROWTS */ - { 383, -1 }, /* (350) pseudo_column ::= TBNAME */ - { 383, -3 }, /* (351) pseudo_column ::= table_name NK_DOT TBNAME */ - { 383, -1 }, /* (352) pseudo_column ::= QSTART */ - { 383, -1 }, /* (353) pseudo_column ::= QEND */ - { 383, -1 }, /* (354) pseudo_column ::= QDURATION */ - { 383, -1 }, /* (355) pseudo_column ::= WSTART */ - { 383, -1 }, /* (356) pseudo_column ::= WEND */ - { 383, -1 }, /* (357) pseudo_column ::= WDURATION */ - { 385, -4 }, /* (358) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 385, -4 }, /* (359) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 385, -6 }, /* (360) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 385, -1 }, /* (361) function_expression ::= literal_func */ - { 378, -3 }, /* (362) literal_func ::= noarg_func NK_LP NK_RP */ - { 378, -1 }, /* (363) literal_func ::= NOW */ - { 389, -1 }, /* (364) noarg_func ::= NOW */ - { 389, -1 }, /* (365) noarg_func ::= TODAY */ - { 389, -1 }, /* (366) noarg_func ::= TIMEZONE */ - { 389, -1 }, /* (367) noarg_func ::= DATABASE */ - { 389, -1 }, /* (368) noarg_func ::= CLIENT_VERSION */ - { 389, -1 }, /* (369) noarg_func ::= SERVER_VERSION */ - { 389, -1 }, /* (370) noarg_func ::= SERVER_STATUS */ - { 389, -1 }, /* (371) noarg_func ::= CURRENT_USER */ - { 389, -1 }, /* (372) noarg_func ::= USER */ - { 387, -1 }, /* (373) star_func ::= COUNT */ - { 387, -1 }, /* (374) star_func ::= FIRST */ - { 387, -1 }, /* (375) star_func ::= LAST */ - { 387, -1 }, /* (376) star_func ::= LAST_ROW */ - { 388, -1 }, /* (377) star_func_para_list ::= NK_STAR */ - { 388, -1 }, /* (378) star_func_para_list ::= other_para_list */ - { 390, -1 }, /* (379) other_para_list ::= star_func_para */ - { 390, -3 }, /* (380) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 391, -1 }, /* (381) star_func_para ::= expression */ - { 391, -3 }, /* (382) star_func_para ::= table_name NK_DOT NK_STAR */ - { 392, -3 }, /* (383) predicate ::= expression compare_op expression */ - { 392, -5 }, /* (384) predicate ::= expression BETWEEN expression AND expression */ - { 392, -6 }, /* (385) predicate ::= expression NOT BETWEEN expression AND expression */ - { 392, -3 }, /* (386) predicate ::= expression IS NULL */ - { 392, -4 }, /* (387) predicate ::= expression IS NOT NULL */ - { 392, -3 }, /* (388) predicate ::= expression in_op in_predicate_value */ - { 393, -1 }, /* (389) compare_op ::= NK_LT */ - { 393, -1 }, /* (390) compare_op ::= NK_GT */ - { 393, -1 }, /* (391) compare_op ::= NK_LE */ - { 393, -1 }, /* (392) compare_op ::= NK_GE */ - { 393, -1 }, /* (393) compare_op ::= NK_NE */ - { 393, -1 }, /* (394) compare_op ::= NK_EQ */ - { 393, -1 }, /* (395) compare_op ::= LIKE */ - { 393, -2 }, /* (396) compare_op ::= NOT LIKE */ - { 393, -1 }, /* (397) compare_op ::= MATCH */ - { 393, -1 }, /* (398) compare_op ::= NMATCH */ - { 393, -1 }, /* (399) compare_op ::= CONTAINS */ - { 394, -1 }, /* (400) in_op ::= IN */ - { 394, -2 }, /* (401) in_op ::= NOT IN */ - { 395, -3 }, /* (402) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 396, -1 }, /* (403) boolean_value_expression ::= boolean_primary */ - { 396, -2 }, /* (404) boolean_value_expression ::= NOT boolean_primary */ - { 396, -3 }, /* (405) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 396, -3 }, /* (406) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 397, -1 }, /* (407) boolean_primary ::= predicate */ - { 397, -3 }, /* (408) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 398, -1 }, /* (409) common_expression ::= expression */ - { 398, -1 }, /* (410) common_expression ::= boolean_value_expression */ - { 399, 0 }, /* (411) from_clause_opt ::= */ - { 399, -2 }, /* (412) from_clause_opt ::= FROM table_reference_list */ - { 400, -1 }, /* (413) table_reference_list ::= table_reference */ - { 400, -3 }, /* (414) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 401, -1 }, /* (415) table_reference ::= table_primary */ - { 401, -1 }, /* (416) table_reference ::= joined_table */ - { 402, -2 }, /* (417) table_primary ::= table_name alias_opt */ - { 402, -4 }, /* (418) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 402, -2 }, /* (419) table_primary ::= subquery alias_opt */ - { 402, -1 }, /* (420) table_primary ::= parenthesized_joined_table */ - { 404, 0 }, /* (421) alias_opt ::= */ - { 404, -1 }, /* (422) alias_opt ::= table_alias */ - { 404, -2 }, /* (423) alias_opt ::= AS table_alias */ - { 405, -3 }, /* (424) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 405, -3 }, /* (425) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 403, -6 }, /* (426) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 406, 0 }, /* (427) join_type ::= */ - { 406, -1 }, /* (428) join_type ::= INNER */ - { 408, -12 }, /* (429) query_specification ::= SELECT set_quantifier_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 */ - { 409, 0 }, /* (430) set_quantifier_opt ::= */ - { 409, -1 }, /* (431) set_quantifier_opt ::= DISTINCT */ - { 409, -1 }, /* (432) set_quantifier_opt ::= ALL */ - { 410, -1 }, /* (433) select_list ::= select_item */ - { 410, -3 }, /* (434) select_list ::= select_list NK_COMMA select_item */ - { 418, -1 }, /* (435) select_item ::= NK_STAR */ - { 418, -1 }, /* (436) select_item ::= common_expression */ - { 418, -2 }, /* (437) select_item ::= common_expression column_alias */ - { 418, -3 }, /* (438) select_item ::= common_expression AS column_alias */ - { 418, -3 }, /* (439) select_item ::= table_name NK_DOT NK_STAR */ - { 376, 0 }, /* (440) where_clause_opt ::= */ - { 376, -2 }, /* (441) where_clause_opt ::= WHERE search_condition */ - { 411, 0 }, /* (442) partition_by_clause_opt ::= */ - { 411, -3 }, /* (443) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 415, 0 }, /* (444) twindow_clause_opt ::= */ - { 415, -6 }, /* (445) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 415, -4 }, /* (446) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 415, -6 }, /* (447) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 415, -8 }, /* (448) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 363, 0 }, /* (449) sliding_opt ::= */ - { 363, -4 }, /* (450) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 414, 0 }, /* (451) fill_opt ::= */ - { 414, -4 }, /* (452) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 414, -6 }, /* (453) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 419, -1 }, /* (454) fill_mode ::= NONE */ - { 419, -1 }, /* (455) fill_mode ::= PREV */ - { 419, -1 }, /* (456) fill_mode ::= NULL */ - { 419, -1 }, /* (457) fill_mode ::= LINEAR */ - { 419, -1 }, /* (458) fill_mode ::= NEXT */ - { 416, 0 }, /* (459) group_by_clause_opt ::= */ - { 416, -3 }, /* (460) group_by_clause_opt ::= GROUP BY group_by_list */ - { 420, -1 }, /* (461) group_by_list ::= expression */ - { 420, -3 }, /* (462) group_by_list ::= group_by_list NK_COMMA expression */ - { 417, 0 }, /* (463) having_clause_opt ::= */ - { 417, -2 }, /* (464) having_clause_opt ::= HAVING search_condition */ - { 412, 0 }, /* (465) range_opt ::= */ - { 412, -6 }, /* (466) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 413, 0 }, /* (467) every_opt ::= */ - { 413, -4 }, /* (468) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 421, -4 }, /* (469) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 422, -1 }, /* (470) query_simple ::= query_specification */ - { 422, -1 }, /* (471) query_simple ::= union_query_expression */ - { 426, -4 }, /* (472) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 426, -3 }, /* (473) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 427, -1 }, /* (474) query_simple_or_subquery ::= query_simple */ - { 427, -1 }, /* (475) query_simple_or_subquery ::= subquery */ - { 368, -1 }, /* (476) query_or_subquery ::= query_expression */ - { 368, -1 }, /* (477) query_or_subquery ::= subquery */ - { 423, 0 }, /* (478) order_by_clause_opt ::= */ - { 423, -3 }, /* (479) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 424, 0 }, /* (480) slimit_clause_opt ::= */ - { 424, -2 }, /* (481) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 424, -4 }, /* (482) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 424, -4 }, /* (483) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 425, 0 }, /* (484) limit_clause_opt ::= */ - { 425, -2 }, /* (485) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 425, -4 }, /* (486) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 425, -4 }, /* (487) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 386, -3 }, /* (488) subquery ::= NK_LP query_expression NK_RP */ - { 407, -1 }, /* (489) search_condition ::= common_expression */ - { 428, -1 }, /* (490) sort_specification_list ::= sort_specification */ - { 428, -3 }, /* (491) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 429, -3 }, /* (492) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 430, 0 }, /* (493) ordering_specification_opt ::= */ - { 430, -1 }, /* (494) ordering_specification_opt ::= ASC */ - { 430, -1 }, /* (495) ordering_specification_opt ::= DESC */ - { 431, 0 }, /* (496) null_ordering_opt ::= */ - { 431, -2 }, /* (497) null_ordering_opt ::= NULLS FIRST */ - { 431, -2 }, /* (498) null_ordering_opt ::= NULLS LAST */ + { 313, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 313, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 314, 0 }, /* (2) account_options ::= */ + { 314, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 314, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 314, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 314, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 314, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 314, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 314, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 314, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 314, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 315, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 315, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 317, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 317, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 317, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 317, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 317, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 317, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 317, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 317, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 317, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 317, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 313, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 313, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 313, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 313, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 313, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 319, 0 }, /* (29) sysinfo_opt ::= */ + { 319, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 313, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 313, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 320, -1 }, /* (33) privileges ::= ALL */ + { 320, -1 }, /* (34) privileges ::= priv_type_list */ + { 322, -1 }, /* (35) priv_type_list ::= priv_type */ + { 322, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 323, -1 }, /* (37) priv_type ::= READ */ + { 323, -1 }, /* (38) priv_type ::= WRITE */ + { 321, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 321, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 313, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 313, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 313, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 313, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 313, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 313, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 313, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 313, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 325, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 325, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 325, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 313, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 313, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 313, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 313, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 313, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 313, -2 }, /* (64) cmd ::= USE db_name */ + { 313, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 313, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ + { 313, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ + { 326, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ + { 326, 0 }, /* (69) not_exists_opt ::= */ + { 328, -2 }, /* (70) exists_opt ::= IF EXISTS */ + { 328, 0 }, /* (71) exists_opt ::= */ + { 327, 0 }, /* (72) db_options ::= */ + { 327, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ + { 327, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ + { 327, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ + { 327, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ + { 327, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ + { 327, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ + { 327, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */ + { 327, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */ + { 327, -3 }, /* (81) db_options ::= db_options KEEP integer_list */ + { 327, -3 }, /* (82) db_options ::= db_options KEEP variable_list */ + { 327, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */ + { 327, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 327, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + { 327, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ + { 327, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ + { 327, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ + { 327, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */ + { 327, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 327, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */ + { 327, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 327, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + { 327, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + { 327, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 327, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 327, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 327, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 327, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 327, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 327, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + { 327, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + { 327, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + { 329, -1 }, /* (104) alter_db_options ::= alter_db_option */ + { 329, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */ + { 333, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */ + { 333, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 333, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 333, -2 }, /* (109) alter_db_option ::= KEEP integer_list */ + { 333, -2 }, /* (110) alter_db_option ::= KEEP variable_list */ + { 333, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 333, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 330, -1 }, /* (113) integer_list ::= NK_INTEGER */ + { 330, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 331, -1 }, /* (115) variable_list ::= NK_VARIABLE */ + { 331, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 332, -1 }, /* (117) retention_list ::= retention */ + { 332, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */ + { 334, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 313, -9 }, /* (120) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 313, -3 }, /* (121) cmd ::= CREATE TABLE multi_create_clause */ + { 313, -9 }, /* (122) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 313, -3 }, /* (123) cmd ::= DROP TABLE multi_drop_clause */ + { 313, -4 }, /* (124) cmd ::= DROP STABLE exists_opt full_table_name */ + { 313, -3 }, /* (125) cmd ::= ALTER TABLE alter_table_clause */ + { 313, -3 }, /* (126) cmd ::= ALTER STABLE alter_table_clause */ + { 342, -2 }, /* (127) alter_table_clause ::= full_table_name alter_table_options */ + { 342, -5 }, /* (128) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 342, -4 }, /* (129) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 342, -5 }, /* (130) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 342, -5 }, /* (131) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 342, -5 }, /* (132) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 342, -4 }, /* (133) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 342, -5 }, /* (134) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 342, -5 }, /* (135) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 342, -6 }, /* (136) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 339, -1 }, /* (137) multi_create_clause ::= create_subtable_clause */ + { 339, -2 }, /* (138) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 347, -10 }, /* (139) 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 */ + { 341, -1 }, /* (140) multi_drop_clause ::= drop_table_clause */ + { 341, -2 }, /* (141) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 350, -2 }, /* (142) drop_table_clause ::= exists_opt full_table_name */ + { 348, 0 }, /* (143) specific_cols_opt ::= */ + { 348, -3 }, /* (144) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 335, -1 }, /* (145) full_table_name ::= table_name */ + { 335, -3 }, /* (146) full_table_name ::= db_name NK_DOT table_name */ + { 336, -1 }, /* (147) column_def_list ::= column_def */ + { 336, -3 }, /* (148) column_def_list ::= column_def_list NK_COMMA column_def */ + { 353, -2 }, /* (149) column_def ::= column_name type_name */ + { 353, -4 }, /* (150) column_def ::= column_name type_name COMMENT NK_STRING */ + { 345, -1 }, /* (151) type_name ::= BOOL */ + { 345, -1 }, /* (152) type_name ::= TINYINT */ + { 345, -1 }, /* (153) type_name ::= SMALLINT */ + { 345, -1 }, /* (154) type_name ::= INT */ + { 345, -1 }, /* (155) type_name ::= INTEGER */ + { 345, -1 }, /* (156) type_name ::= BIGINT */ + { 345, -1 }, /* (157) type_name ::= FLOAT */ + { 345, -1 }, /* (158) type_name ::= DOUBLE */ + { 345, -4 }, /* (159) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 345, -1 }, /* (160) type_name ::= TIMESTAMP */ + { 345, -4 }, /* (161) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 345, -2 }, /* (162) type_name ::= TINYINT UNSIGNED */ + { 345, -2 }, /* (163) type_name ::= SMALLINT UNSIGNED */ + { 345, -2 }, /* (164) type_name ::= INT UNSIGNED */ + { 345, -2 }, /* (165) type_name ::= BIGINT UNSIGNED */ + { 345, -1 }, /* (166) type_name ::= JSON */ + { 345, -4 }, /* (167) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 345, -1 }, /* (168) type_name ::= MEDIUMBLOB */ + { 345, -1 }, /* (169) type_name ::= BLOB */ + { 345, -4 }, /* (170) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 345, -1 }, /* (171) type_name ::= DECIMAL */ + { 345, -4 }, /* (172) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 345, -6 }, /* (173) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 337, 0 }, /* (174) tags_def_opt ::= */ + { 337, -1 }, /* (175) tags_def_opt ::= tags_def */ + { 340, -4 }, /* (176) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 338, 0 }, /* (177) table_options ::= */ + { 338, -3 }, /* (178) table_options ::= table_options COMMENT NK_STRING */ + { 338, -3 }, /* (179) table_options ::= table_options MAX_DELAY duration_list */ + { 338, -3 }, /* (180) table_options ::= table_options WATERMARK duration_list */ + { 338, -5 }, /* (181) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 338, -3 }, /* (182) table_options ::= table_options TTL NK_INTEGER */ + { 338, -5 }, /* (183) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 343, -1 }, /* (184) alter_table_options ::= alter_table_option */ + { 343, -2 }, /* (185) alter_table_options ::= alter_table_options alter_table_option */ + { 356, -2 }, /* (186) alter_table_option ::= COMMENT NK_STRING */ + { 356, -2 }, /* (187) alter_table_option ::= TTL NK_INTEGER */ + { 354, -1 }, /* (188) duration_list ::= duration_literal */ + { 354, -3 }, /* (189) duration_list ::= duration_list NK_COMMA duration_literal */ + { 355, -1 }, /* (190) rollup_func_list ::= rollup_func_name */ + { 355, -3 }, /* (191) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 358, -1 }, /* (192) rollup_func_name ::= function_name */ + { 358, -1 }, /* (193) rollup_func_name ::= FIRST */ + { 358, -1 }, /* (194) rollup_func_name ::= LAST */ + { 351, -1 }, /* (195) col_name_list ::= col_name */ + { 351, -3 }, /* (196) col_name_list ::= col_name_list NK_COMMA col_name */ + { 360, -1 }, /* (197) col_name ::= column_name */ + { 313, -2 }, /* (198) cmd ::= SHOW DNODES */ + { 313, -2 }, /* (199) cmd ::= SHOW USERS */ + { 313, -2 }, /* (200) cmd ::= SHOW DATABASES */ + { 313, -4 }, /* (201) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 313, -4 }, /* (202) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 313, -3 }, /* (203) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 313, -2 }, /* (204) cmd ::= SHOW MNODES */ + { 313, -2 }, /* (205) cmd ::= SHOW MODULES */ + { 313, -2 }, /* (206) cmd ::= SHOW QNODES */ + { 313, -2 }, /* (207) cmd ::= SHOW FUNCTIONS */ + { 313, -5 }, /* (208) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 313, -2 }, /* (209) cmd ::= SHOW STREAMS */ + { 313, -2 }, /* (210) cmd ::= SHOW ACCOUNTS */ + { 313, -2 }, /* (211) cmd ::= SHOW APPS */ + { 313, -2 }, /* (212) cmd ::= SHOW CONNECTIONS */ + { 313, -2 }, /* (213) cmd ::= SHOW LICENCES */ + { 313, -2 }, /* (214) cmd ::= SHOW GRANTS */ + { 313, -4 }, /* (215) cmd ::= SHOW CREATE DATABASE db_name */ + { 313, -4 }, /* (216) cmd ::= SHOW CREATE TABLE full_table_name */ + { 313, -4 }, /* (217) cmd ::= SHOW CREATE STABLE full_table_name */ + { 313, -2 }, /* (218) cmd ::= SHOW QUERIES */ + { 313, -2 }, /* (219) cmd ::= SHOW SCORES */ + { 313, -2 }, /* (220) cmd ::= SHOW TOPICS */ + { 313, -2 }, /* (221) cmd ::= SHOW VARIABLES */ + { 313, -3 }, /* (222) cmd ::= SHOW LOCAL VARIABLES */ + { 313, -4 }, /* (223) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 313, -2 }, /* (224) cmd ::= SHOW BNODES */ + { 313, -2 }, /* (225) cmd ::= SHOW SNODES */ + { 313, -2 }, /* (226) cmd ::= SHOW CLUSTER */ + { 313, -2 }, /* (227) cmd ::= SHOW TRANSACTIONS */ + { 313, -4 }, /* (228) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 313, -2 }, /* (229) cmd ::= SHOW CONSUMERS */ + { 313, -2 }, /* (230) cmd ::= SHOW SUBSCRIPTIONS */ + { 313, -5 }, /* (231) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 313, -3 }, /* (232) cmd ::= SHOW VNODES NK_INTEGER */ + { 313, -3 }, /* (233) cmd ::= SHOW VNODES NK_STRING */ + { 361, 0 }, /* (234) db_name_cond_opt ::= */ + { 361, -2 }, /* (235) db_name_cond_opt ::= db_name NK_DOT */ + { 362, 0 }, /* (236) like_pattern_opt ::= */ + { 362, -2 }, /* (237) like_pattern_opt ::= LIKE NK_STRING */ + { 363, -1 }, /* (238) table_name_cond ::= table_name */ + { 364, 0 }, /* (239) from_db_opt ::= */ + { 364, -2 }, /* (240) from_db_opt ::= FROM db_name */ + { 313, -8 }, /* (241) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + { 313, -4 }, /* (242) cmd ::= DROP INDEX exists_opt full_table_name */ + { 365, -10 }, /* (243) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 365, -12 }, /* (244) 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 */ + { 366, -1 }, /* (245) func_list ::= func */ + { 366, -3 }, /* (246) func_list ::= func_list NK_COMMA func */ + { 369, -4 }, /* (247) func ::= function_name NK_LP expression_list NK_RP */ + { 368, 0 }, /* (248) sma_stream_opt ::= */ + { 368, -3 }, /* (249) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 368, -3 }, /* (250) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 313, -6 }, /* (251) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 313, -7 }, /* (252) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 313, -9 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 313, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 313, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 313, -4 }, /* (256) cmd ::= DROP TOPIC exists_opt topic_name */ + { 313, -7 }, /* (257) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 313, -2 }, /* (258) cmd ::= DESC full_table_name */ + { 313, -2 }, /* (259) cmd ::= DESCRIBE full_table_name */ + { 313, -3 }, /* (260) cmd ::= RESET QUERY CACHE */ + { 313, -4 }, /* (261) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 374, 0 }, /* (262) analyze_opt ::= */ + { 374, -1 }, /* (263) analyze_opt ::= ANALYZE */ + { 375, 0 }, /* (264) explain_options ::= */ + { 375, -3 }, /* (265) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 375, -3 }, /* (266) explain_options ::= explain_options RATIO NK_FLOAT */ + { 313, -10 }, /* (267) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 313, -4 }, /* (268) cmd ::= DROP FUNCTION exists_opt function_name */ + { 376, 0 }, /* (269) agg_func_opt ::= */ + { 376, -1 }, /* (270) agg_func_opt ::= AGGREGATE */ + { 377, 0 }, /* (271) bufsize_opt ::= */ + { 377, -2 }, /* (272) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 313, -9 }, /* (273) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery */ + { 313, -4 }, /* (274) cmd ::= DROP STREAM exists_opt stream_name */ + { 370, 0 }, /* (275) stream_options ::= */ + { 370, -3 }, /* (276) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 370, -3 }, /* (277) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 370, -4 }, /* (278) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 370, -3 }, /* (279) stream_options ::= stream_options WATERMARK duration_literal */ + { 370, -4 }, /* (280) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 313, -3 }, /* (281) cmd ::= KILL CONNECTION NK_INTEGER */ + { 313, -3 }, /* (282) cmd ::= KILL QUERY NK_STRING */ + { 313, -3 }, /* (283) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 313, -2 }, /* (284) cmd ::= BALANCE VGROUP */ + { 313, -4 }, /* (285) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 313, -4 }, /* (286) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 313, -3 }, /* (287) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 379, -2 }, /* (288) dnode_list ::= DNODE NK_INTEGER */ + { 379, -3 }, /* (289) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 313, -4 }, /* (290) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 313, -1 }, /* (291) cmd ::= query_or_subquery */ + { 313, -7 }, /* (292) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 313, -4 }, /* (293) cmd ::= INSERT INTO full_table_name query_or_subquery */ + { 316, -1 }, /* (294) literal ::= NK_INTEGER */ + { 316, -1 }, /* (295) literal ::= NK_FLOAT */ + { 316, -1 }, /* (296) literal ::= NK_STRING */ + { 316, -1 }, /* (297) literal ::= NK_BOOL */ + { 316, -2 }, /* (298) literal ::= TIMESTAMP NK_STRING */ + { 316, -1 }, /* (299) literal ::= duration_literal */ + { 316, -1 }, /* (300) literal ::= NULL */ + { 316, -1 }, /* (301) literal ::= NK_QUESTION */ + { 357, -1 }, /* (302) duration_literal ::= NK_VARIABLE */ + { 381, -1 }, /* (303) signed ::= NK_INTEGER */ + { 381, -2 }, /* (304) signed ::= NK_PLUS NK_INTEGER */ + { 381, -2 }, /* (305) signed ::= NK_MINUS NK_INTEGER */ + { 381, -1 }, /* (306) signed ::= NK_FLOAT */ + { 381, -2 }, /* (307) signed ::= NK_PLUS NK_FLOAT */ + { 381, -2 }, /* (308) signed ::= NK_MINUS NK_FLOAT */ + { 346, -1 }, /* (309) signed_literal ::= signed */ + { 346, -1 }, /* (310) signed_literal ::= NK_STRING */ + { 346, -1 }, /* (311) signed_literal ::= NK_BOOL */ + { 346, -2 }, /* (312) signed_literal ::= TIMESTAMP NK_STRING */ + { 346, -1 }, /* (313) signed_literal ::= duration_literal */ + { 346, -1 }, /* (314) signed_literal ::= NULL */ + { 346, -1 }, /* (315) signed_literal ::= literal_func */ + { 346, -1 }, /* (316) signed_literal ::= NK_QUESTION */ + { 383, -1 }, /* (317) literal_list ::= signed_literal */ + { 383, -3 }, /* (318) literal_list ::= literal_list NK_COMMA signed_literal */ + { 324, -1 }, /* (319) db_name ::= NK_ID */ + { 352, -1 }, /* (320) table_name ::= NK_ID */ + { 344, -1 }, /* (321) column_name ::= NK_ID */ + { 359, -1 }, /* (322) function_name ::= NK_ID */ + { 384, -1 }, /* (323) table_alias ::= NK_ID */ + { 385, -1 }, /* (324) column_alias ::= NK_ID */ + { 318, -1 }, /* (325) user_name ::= NK_ID */ + { 371, -1 }, /* (326) topic_name ::= NK_ID */ + { 378, -1 }, /* (327) stream_name ::= NK_ID */ + { 373, -1 }, /* (328) cgroup_name ::= NK_ID */ + { 386, -1 }, /* (329) expr_or_subquery ::= expression */ + { 386, -1 }, /* (330) expr_or_subquery ::= subquery */ + { 387, -1 }, /* (331) expression ::= literal */ + { 387, -1 }, /* (332) expression ::= pseudo_column */ + { 387, -1 }, /* (333) expression ::= column_reference */ + { 387, -1 }, /* (334) expression ::= function_expression */ + { 387, -1 }, /* (335) expression ::= case_when_expression */ + { 387, -3 }, /* (336) expression ::= NK_LP expression NK_RP */ + { 387, -2 }, /* (337) expression ::= NK_PLUS expr_or_subquery */ + { 387, -2 }, /* (338) expression ::= NK_MINUS expr_or_subquery */ + { 387, -3 }, /* (339) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 387, -3 }, /* (340) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 387, -3 }, /* (341) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 387, -3 }, /* (342) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 387, -3 }, /* (343) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 387, -3 }, /* (344) expression ::= column_reference NK_ARROW NK_STRING */ + { 387, -3 }, /* (345) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 387, -3 }, /* (346) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 349, -1 }, /* (347) expression_list ::= expr_or_subquery */ + { 349, -3 }, /* (348) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 390, -1 }, /* (349) column_reference ::= column_name */ + { 390, -3 }, /* (350) column_reference ::= table_name NK_DOT column_name */ + { 389, -1 }, /* (351) pseudo_column ::= ROWTS */ + { 389, -1 }, /* (352) pseudo_column ::= TBNAME */ + { 389, -3 }, /* (353) pseudo_column ::= table_name NK_DOT TBNAME */ + { 389, -1 }, /* (354) pseudo_column ::= QSTART */ + { 389, -1 }, /* (355) pseudo_column ::= QEND */ + { 389, -1 }, /* (356) pseudo_column ::= QDURATION */ + { 389, -1 }, /* (357) pseudo_column ::= WSTART */ + { 389, -1 }, /* (358) pseudo_column ::= WEND */ + { 389, -1 }, /* (359) pseudo_column ::= WDURATION */ + { 391, -4 }, /* (360) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 391, -4 }, /* (361) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 391, -6 }, /* (362) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 391, -1 }, /* (363) function_expression ::= literal_func */ + { 382, -3 }, /* (364) literal_func ::= noarg_func NK_LP NK_RP */ + { 382, -1 }, /* (365) literal_func ::= NOW */ + { 395, -1 }, /* (366) noarg_func ::= NOW */ + { 395, -1 }, /* (367) noarg_func ::= TODAY */ + { 395, -1 }, /* (368) noarg_func ::= TIMEZONE */ + { 395, -1 }, /* (369) noarg_func ::= DATABASE */ + { 395, -1 }, /* (370) noarg_func ::= CLIENT_VERSION */ + { 395, -1 }, /* (371) noarg_func ::= SERVER_VERSION */ + { 395, -1 }, /* (372) noarg_func ::= SERVER_STATUS */ + { 395, -1 }, /* (373) noarg_func ::= CURRENT_USER */ + { 395, -1 }, /* (374) noarg_func ::= USER */ + { 393, -1 }, /* (375) star_func ::= COUNT */ + { 393, -1 }, /* (376) star_func ::= FIRST */ + { 393, -1 }, /* (377) star_func ::= LAST */ + { 393, -1 }, /* (378) star_func ::= LAST_ROW */ + { 394, -1 }, /* (379) star_func_para_list ::= NK_STAR */ + { 394, -1 }, /* (380) star_func_para_list ::= other_para_list */ + { 396, -1 }, /* (381) other_para_list ::= star_func_para */ + { 396, -3 }, /* (382) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 397, -1 }, /* (383) star_func_para ::= expr_or_subquery */ + { 397, -3 }, /* (384) star_func_para ::= table_name NK_DOT NK_STAR */ + { 392, -4 }, /* (385) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 392, -5 }, /* (386) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 398, -1 }, /* (387) when_then_list ::= when_then_expr */ + { 398, -2 }, /* (388) when_then_list ::= when_then_list when_then_expr */ + { 401, -4 }, /* (389) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 399, 0 }, /* (390) case_when_else_opt ::= */ + { 399, -2 }, /* (391) case_when_else_opt ::= ELSE common_expression */ + { 402, -3 }, /* (392) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 402, -5 }, /* (393) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 402, -6 }, /* (394) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 402, -3 }, /* (395) predicate ::= expr_or_subquery IS NULL */ + { 402, -4 }, /* (396) predicate ::= expr_or_subquery IS NOT NULL */ + { 402, -3 }, /* (397) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 403, -1 }, /* (398) compare_op ::= NK_LT */ + { 403, -1 }, /* (399) compare_op ::= NK_GT */ + { 403, -1 }, /* (400) compare_op ::= NK_LE */ + { 403, -1 }, /* (401) compare_op ::= NK_GE */ + { 403, -1 }, /* (402) compare_op ::= NK_NE */ + { 403, -1 }, /* (403) compare_op ::= NK_EQ */ + { 403, -1 }, /* (404) compare_op ::= LIKE */ + { 403, -2 }, /* (405) compare_op ::= NOT LIKE */ + { 403, -1 }, /* (406) compare_op ::= MATCH */ + { 403, -1 }, /* (407) compare_op ::= NMATCH */ + { 403, -1 }, /* (408) compare_op ::= CONTAINS */ + { 404, -1 }, /* (409) in_op ::= IN */ + { 404, -2 }, /* (410) in_op ::= NOT IN */ + { 405, -3 }, /* (411) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 406, -1 }, /* (412) boolean_value_expression ::= boolean_primary */ + { 406, -2 }, /* (413) boolean_value_expression ::= NOT boolean_primary */ + { 406, -3 }, /* (414) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 406, -3 }, /* (415) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 407, -1 }, /* (416) boolean_primary ::= predicate */ + { 407, -3 }, /* (417) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 400, -1 }, /* (418) common_expression ::= expr_or_subquery */ + { 400, -1 }, /* (419) common_expression ::= boolean_value_expression */ + { 408, 0 }, /* (420) from_clause_opt ::= */ + { 408, -2 }, /* (421) from_clause_opt ::= FROM table_reference_list */ + { 409, -1 }, /* (422) table_reference_list ::= table_reference */ + { 409, -3 }, /* (423) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 410, -1 }, /* (424) table_reference ::= table_primary */ + { 410, -1 }, /* (425) table_reference ::= joined_table */ + { 411, -2 }, /* (426) table_primary ::= table_name alias_opt */ + { 411, -4 }, /* (427) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 411, -2 }, /* (428) table_primary ::= subquery alias_opt */ + { 411, -1 }, /* (429) table_primary ::= parenthesized_joined_table */ + { 413, 0 }, /* (430) alias_opt ::= */ + { 413, -1 }, /* (431) alias_opt ::= table_alias */ + { 413, -2 }, /* (432) alias_opt ::= AS table_alias */ + { 414, -3 }, /* (433) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 414, -3 }, /* (434) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 412, -6 }, /* (435) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 415, 0 }, /* (436) join_type ::= */ + { 415, -1 }, /* (437) join_type ::= INNER */ + { 417, -12 }, /* (438) query_specification ::= SELECT set_quantifier_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 */ + { 418, 0 }, /* (439) set_quantifier_opt ::= */ + { 418, -1 }, /* (440) set_quantifier_opt ::= DISTINCT */ + { 418, -1 }, /* (441) set_quantifier_opt ::= ALL */ + { 419, -1 }, /* (442) select_list ::= select_item */ + { 419, -3 }, /* (443) select_list ::= select_list NK_COMMA select_item */ + { 427, -1 }, /* (444) select_item ::= NK_STAR */ + { 427, -1 }, /* (445) select_item ::= common_expression */ + { 427, -2 }, /* (446) select_item ::= common_expression column_alias */ + { 427, -3 }, /* (447) select_item ::= common_expression AS column_alias */ + { 427, -3 }, /* (448) select_item ::= table_name NK_DOT NK_STAR */ + { 380, 0 }, /* (449) where_clause_opt ::= */ + { 380, -2 }, /* (450) where_clause_opt ::= WHERE search_condition */ + { 420, 0 }, /* (451) partition_by_clause_opt ::= */ + { 420, -3 }, /* (452) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 424, 0 }, /* (453) twindow_clause_opt ::= */ + { 424, -6 }, /* (454) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 424, -4 }, /* (455) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 424, -6 }, /* (456) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 424, -8 }, /* (457) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 367, 0 }, /* (458) sliding_opt ::= */ + { 367, -4 }, /* (459) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 423, 0 }, /* (460) fill_opt ::= */ + { 423, -4 }, /* (461) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 423, -6 }, /* (462) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 428, -1 }, /* (463) fill_mode ::= NONE */ + { 428, -1 }, /* (464) fill_mode ::= PREV */ + { 428, -1 }, /* (465) fill_mode ::= NULL */ + { 428, -1 }, /* (466) fill_mode ::= LINEAR */ + { 428, -1 }, /* (467) fill_mode ::= NEXT */ + { 425, 0 }, /* (468) group_by_clause_opt ::= */ + { 425, -3 }, /* (469) group_by_clause_opt ::= GROUP BY group_by_list */ + { 429, -1 }, /* (470) group_by_list ::= expr_or_subquery */ + { 429, -3 }, /* (471) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 426, 0 }, /* (472) having_clause_opt ::= */ + { 426, -2 }, /* (473) having_clause_opt ::= HAVING search_condition */ + { 421, 0 }, /* (474) range_opt ::= */ + { 421, -6 }, /* (475) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 422, 0 }, /* (476) every_opt ::= */ + { 422, -4 }, /* (477) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 430, -4 }, /* (478) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 431, -1 }, /* (479) query_simple ::= query_specification */ + { 431, -1 }, /* (480) query_simple ::= union_query_expression */ + { 435, -4 }, /* (481) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 435, -3 }, /* (482) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 436, -1 }, /* (483) query_simple_or_subquery ::= query_simple */ + { 436, -1 }, /* (484) query_simple_or_subquery ::= subquery */ + { 372, -1 }, /* (485) query_or_subquery ::= query_expression */ + { 372, -1 }, /* (486) query_or_subquery ::= subquery */ + { 432, 0 }, /* (487) order_by_clause_opt ::= */ + { 432, -3 }, /* (488) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 433, 0 }, /* (489) slimit_clause_opt ::= */ + { 433, -2 }, /* (490) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 433, -4 }, /* (491) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 433, -4 }, /* (492) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 434, 0 }, /* (493) limit_clause_opt ::= */ + { 434, -2 }, /* (494) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 434, -4 }, /* (495) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 434, -4 }, /* (496) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 388, -3 }, /* (497) subquery ::= NK_LP query_expression NK_RP */ + { 388, -3 }, /* (498) subquery ::= NK_LP subquery NK_RP */ + { 416, -1 }, /* (499) search_condition ::= common_expression */ + { 437, -1 }, /* (500) sort_specification_list ::= sort_specification */ + { 437, -3 }, /* (501) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 438, -3 }, /* (502) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 439, 0 }, /* (503) ordering_specification_opt ::= */ + { 439, -1 }, /* (504) ordering_specification_opt ::= ASC */ + { 439, -1 }, /* (505) ordering_specification_opt ::= DESC */ + { 440, 0 }, /* (506) null_ordering_opt ::= */ + { 440, -2 }, /* (507) null_ordering_opt ::= NULLS FIRST */ + { 440, -2 }, /* (508) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3395,11 +3507,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,310,&yymsp[0].minor); + yy_destructor(yypParser,314,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,311,&yymsp[0].minor); + yy_destructor(yypParser,315,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3413,20 +3525,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); 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,310,&yymsp[-2].minor); +{ yy_destructor(yypParser,314,&yymsp[-2].minor); { } - yy_destructor(yypParser,312,&yymsp[0].minor); + yy_destructor(yypParser,316,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,313,&yymsp[0].minor); +{ yy_destructor(yypParser,317,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,311,&yymsp[-1].minor); +{ yy_destructor(yypParser,315,&yymsp[-1].minor); { } - yy_destructor(yypParser,313,&yymsp[0].minor); + yy_destructor(yypParser,317,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3440,72 +3552,72 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,312,&yymsp[0].minor); + yy_destructor(yypParser,316,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy641, &yymsp[-1].minor.yy0, yymsp[0].minor.yy503); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy659, &yymsp[-1].minor.yy0, yymsp[0].minor.yy341); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy641, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy659, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy641, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy659, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy641, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy659, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy659); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy503 = 1; } +{ yymsp[1].minor.yy341 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy503 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy341 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy477, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy459, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy477, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy459, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy477 = yymsp[0].minor.yy477; } - yymsp[0].minor.yy477 = yylhsminor.yy477; +{ yylhsminor.yy459 = yymsp[0].minor.yy459; } + yymsp[0].minor.yy459 = yylhsminor.yy459; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy477 = yymsp[-2].minor.yy477 | yymsp[0].minor.yy477; } - yymsp[-2].minor.yy477 = yylhsminor.yy477; +{ yylhsminor.yy459 = yymsp[-2].minor.yy459 | yymsp[0].minor.yy459; } + yymsp[-2].minor.yy459 = yylhsminor.yy459; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy641 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy641 = yylhsminor.yy641; +{ yylhsminor.yy659 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy659 = yylhsminor.yy659; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy641 = yymsp[-2].minor.yy641; } - yymsp[-2].minor.yy641 = yylhsminor.yy641; +{ yylhsminor.yy659 = yymsp[-2].minor.yy659; } + yymsp[-2].minor.yy659 = yylhsminor.yy659; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy641, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy659, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy659); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3532,21 +3644,21 @@ static YYACTIONTYPE yy_reduce( case 326: /* topic_name ::= NK_ID */ yytestcase(yyruleno==326); case 327: /* stream_name ::= NK_ID */ yytestcase(yyruleno==327); case 328: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==328); - case 364: /* noarg_func ::= NOW */ yytestcase(yyruleno==364); - case 365: /* noarg_func ::= TODAY */ yytestcase(yyruleno==365); - case 366: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==366); - case 367: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==367); - case 368: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==368); - case 369: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==369); - case 370: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==370); - case 371: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==371); - case 372: /* noarg_func ::= USER */ yytestcase(yyruleno==372); - case 373: /* star_func ::= COUNT */ yytestcase(yyruleno==373); - case 374: /* star_func ::= FIRST */ yytestcase(yyruleno==374); - case 375: /* star_func ::= LAST */ yytestcase(yyruleno==375); - case 376: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==376); -{ yylhsminor.yy641 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy641 = yylhsminor.yy641; + case 366: /* noarg_func ::= NOW */ yytestcase(yyruleno==366); + case 367: /* noarg_func ::= TODAY */ yytestcase(yyruleno==367); + case 368: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==368); + case 369: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==369); + case 370: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==370); + case 371: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==371); + case 372: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==372); + case 373: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==373); + case 374: /* noarg_func ::= USER */ yytestcase(yyruleno==374); + case 375: /* star_func ::= COUNT */ yytestcase(yyruleno==375); + case 376: /* star_func ::= FIRST */ yytestcase(yyruleno==376); + case 377: /* star_func ::= LAST */ yytestcase(yyruleno==377); + case 378: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==378); +{ yylhsminor.yy659 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy659 = yylhsminor.yy659; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3579,208 +3691,208 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy281, &yymsp[-1].minor.yy641, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy659, yymsp[0].minor.yy560); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy659); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy641, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy659, yymsp[0].minor.yy560); } break; case 66: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy659); } break; case 67: /* cmd ::= TRIM DATABASE db_name */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy659); } break; case 68: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy281 = true; } +{ yymsp[-2].minor.yy173 = true; } break; case 69: /* not_exists_opt ::= */ case 71: /* exists_opt ::= */ yytestcase(yyruleno==71); case 262: /* analyze_opt ::= */ yytestcase(yyruleno==262); case 269: /* agg_func_opt ::= */ yytestcase(yyruleno==269); - case 430: /* set_quantifier_opt ::= */ yytestcase(yyruleno==430); -{ yymsp[1].minor.yy281 = false; } + case 439: /* set_quantifier_opt ::= */ yytestcase(yyruleno==439); +{ yymsp[1].minor.yy173 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy281 = true; } +{ yymsp[-1].minor.yy173 = true; } break; case 72: /* db_options ::= */ -{ yymsp[1].minor.yy776 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); } break; case 73: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 76: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 77: /* db_options ::= db_options DURATION NK_INTEGER */ case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78); -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 80: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 81: /* db_options ::= db_options KEEP integer_list */ case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82); -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_KEEP, yymsp[0].minor.yy280); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy334); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 83: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 85: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 86: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 87: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 88: /* db_options ::= db_options STRICT NK_STRING */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 89: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 90: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 91: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_RETENTIONS, yymsp[0].minor.yy280); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy334); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 92: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 93: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 94: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 96: /* db_options ::= db_options WAL_RETENTION_PERIOD 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.yy776 = setDatabaseOption(pCxt, yymsp[-3].minor.yy776, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 98: /* db_options ::= db_options WAL_RETENTION_SIZE 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.yy776 = setDatabaseOption(pCxt, yymsp[-3].minor.yy776, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 99: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 100: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 101: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 102: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 103: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 104: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy776 = createAlterDatabaseOptions(pCxt); yylhsminor.yy776 = setAlterDatabaseOption(pCxt, yylhsminor.yy776, &yymsp[0].minor.yy605); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy515); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 105: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy776 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy776, &yymsp[0].minor.yy605); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy515); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 106: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy605.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy515.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } break; case 107: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy605.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy515.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } break; case 108: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy605.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy515.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } break; case 109: /* alter_db_option ::= KEEP integer_list */ case 110: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==110); -{ yymsp[-1].minor.yy605.type = DB_OPTION_KEEP; yymsp[-1].minor.yy605.pList = yymsp[0].minor.yy280; } +{ yymsp[-1].minor.yy515.type = DB_OPTION_KEEP; yymsp[-1].minor.yy515.pList = yymsp[0].minor.yy334; } break; case 111: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy605.type = DB_OPTION_WAL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy515.type = DB_OPTION_WAL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } break; case 112: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy605.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy515.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } break; case 113: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy280 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy280 = yylhsminor.yy280; +{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy334 = yylhsminor.yy334; break; case 114: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 289: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==289); -{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy280 = yylhsminor.yy280; +{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; break; case 115: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy280 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy280 = yylhsminor.yy280; +{ yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy334 = yylhsminor.yy334; break; case 116: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy280 = yylhsminor.yy280; +{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; break; case 117: /* retention_list ::= retention */ case 137: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==137); @@ -3790,11 +3902,12 @@ static YYACTIONTYPE yy_reduce( case 195: /* col_name_list ::= col_name */ yytestcase(yyruleno==195); case 245: /* func_list ::= func */ yytestcase(yyruleno==245); case 317: /* literal_list ::= signed_literal */ yytestcase(yyruleno==317); - case 379: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==379); - case 433: /* select_list ::= select_item */ yytestcase(yyruleno==433); - case 490: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==490); -{ yylhsminor.yy280 = createNodeList(pCxt, yymsp[0].minor.yy776); } - yymsp[0].minor.yy280 = yylhsminor.yy280; + case 381: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==381); + case 387: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==387); + case 442: /* select_list ::= select_item */ yytestcase(yyruleno==442); + case 500: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==500); +{ yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy560); } + yymsp[0].minor.yy334 = yylhsminor.yy334; break; case 118: /* retention_list ::= retention_list NK_COMMA retention */ case 148: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==148); @@ -3802,253 +3915,254 @@ static YYACTIONTYPE yy_reduce( case 196: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==196); case 246: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==246); case 318: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==318); - case 380: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==380); - case 434: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==434); - case 491: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==491); -{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, yymsp[0].minor.yy776); } - yymsp[-2].minor.yy280 = yylhsminor.yy280; + case 382: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==382); + case 443: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==443); + case 501: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==501); +{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; break; case 119: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy776 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 120: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 122: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==122); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy281, yymsp[-5].minor.yy776, yymsp[-3].minor.yy280, yymsp[-1].minor.yy280, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } break; case 121: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy280); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); } break; case 123: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy280); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy334); } break; case 124: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } break; case 125: /* cmd ::= ALTER TABLE alter_table_clause */ case 291: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==291); -{ pCxt->pRootNode = yymsp[0].minor.yy776; } +{ pCxt->pRootNode = yymsp[0].minor.yy560; } break; case 126: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy776); } +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); } break; case 127: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy776 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 128: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 129: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy776 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy776, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy641); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy659); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 130: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 131: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy776 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 132: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 133: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy776 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy776, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy641); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy659); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 134: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 135: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy776 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 136: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy776 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy776, &yymsp[-2].minor.yy641, yymsp[0].minor.yy776); } - yymsp[-5].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy659, yymsp[0].minor.yy560); } + yymsp[-5].minor.yy560 = yylhsminor.yy560; break; case 138: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 141: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==141); -{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-1].minor.yy280, yymsp[0].minor.yy776); } - yymsp[-1].minor.yy280 = yylhsminor.yy280; + case 388: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==388); +{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } + yymsp[-1].minor.yy334 = yylhsminor.yy334; break; case 139: /* 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 */ -{ yylhsminor.yy776 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy281, yymsp[-8].minor.yy776, yymsp[-6].minor.yy776, yymsp[-5].minor.yy280, yymsp[-2].minor.yy280, yymsp[0].minor.yy776); } - yymsp[-9].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy334, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } + yymsp[-9].minor.yy560 = yylhsminor.yy560; break; case 142: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy776 = createDropTableClause(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 143: /* specific_cols_opt ::= */ case 174: /* tags_def_opt ::= */ yytestcase(yyruleno==174); - case 442: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==442); - case 459: /* group_by_clause_opt ::= */ yytestcase(yyruleno==459); - case 478: /* order_by_clause_opt ::= */ yytestcase(yyruleno==478); -{ yymsp[1].minor.yy280 = NULL; } + case 451: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==451); + case 468: /* group_by_clause_opt ::= */ yytestcase(yyruleno==468); + case 487: /* order_by_clause_opt ::= */ yytestcase(yyruleno==487); +{ yymsp[1].minor.yy334 = NULL; } break; case 144: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy280 = yymsp[-1].minor.yy280; } +{ yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; } break; case 145: /* full_table_name ::= table_name */ -{ yylhsminor.yy776 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy641, NULL); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy659, NULL); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 146: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy776 = createRealTableNode(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641, NULL); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659, NULL); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 149: /* column_def ::= column_name type_name */ -{ yylhsminor.yy776 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304, NULL); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574, NULL); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 150: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy776 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy641, yymsp[-2].minor.yy304, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-2].minor.yy574, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 151: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 152: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 153: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 154: /* type_name ::= INT */ case 155: /* type_name ::= INTEGER */ yytestcase(yyruleno==155); -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_INT); } break; case 156: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 157: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 158: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 159: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 160: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 161: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 162: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 163: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 164: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 165: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 166: /* type_name ::= JSON */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 167: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 168: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 169: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 170: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 171: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 172: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 173: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 175: /* tags_def_opt ::= tags_def */ - case 378: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==378); -{ yylhsminor.yy280 = yymsp[0].minor.yy280; } - yymsp[0].minor.yy280 = yylhsminor.yy280; + case 380: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==380); +{ yylhsminor.yy334 = yymsp[0].minor.yy334; } + yymsp[0].minor.yy334 = yylhsminor.yy334; break; case 176: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy280 = yymsp[-1].minor.yy280; } +{ yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; } break; case 177: /* table_options ::= */ -{ yymsp[1].minor.yy776 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); } break; case 178: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 179: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy280); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy334); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 180: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy280); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy334); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 181: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-4].minor.yy776, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy280); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy334); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 182: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 183: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-4].minor.yy776, TABLE_OPTION_SMA, yymsp[-1].minor.yy280); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy334); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; case 184: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy776 = createAlterTableOptions(pCxt); yylhsminor.yy776 = setTableOption(pCxt, yylhsminor.yy776, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy515.type, &yymsp[0].minor.yy515.val); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 185: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy515.type, &yymsp[0].minor.yy515.val); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 186: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy605.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy515.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } break; case 187: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy605.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy515.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } break; case 188: /* duration_list ::= duration_literal */ - case 345: /* expression_list ::= expression */ yytestcase(yyruleno==345); -{ yylhsminor.yy280 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy776)); } - yymsp[0].minor.yy280 = yylhsminor.yy280; + case 347: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==347); +{ yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } + yymsp[0].minor.yy334 = yylhsminor.yy334; break; case 189: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 346: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==346); -{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, releaseRawExprNode(pCxt, yymsp[0].minor.yy776)); } - yymsp[-2].minor.yy280 = yylhsminor.yy280; + case 348: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==348); +{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; break; case 192: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy776 = createFunctionNode(pCxt, &yymsp[0].minor.yy641, NULL); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy659, NULL); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 193: /* rollup_func_name ::= FIRST */ case 194: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==194); -{ yylhsminor.yy776 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 197: /* col_name ::= column_name */ -{ yylhsminor.yy776 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy641); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy659); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 198: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -4060,13 +4174,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 201: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy776, yymsp[0].minor.yy776, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } break; case 202: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy776, yymsp[0].minor.yy776, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } break; case 203: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy776, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); } break; case 204: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -4081,7 +4195,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 208: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy776, yymsp[-1].minor.yy776, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } break; case 209: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -4100,13 +4214,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; case 215: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy659); } break; case 216: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); } break; case 217: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy560); } break; case 218: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -4139,7 +4253,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 228: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); } break; case 229: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -4148,7 +4262,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; case 231: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy776, yymsp[-1].minor.yy776, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } break; case 232: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } @@ -4158,144 +4272,145 @@ static YYACTIONTYPE yy_reduce( break; case 234: /* db_name_cond_opt ::= */ case 239: /* from_db_opt ::= */ yytestcase(yyruleno==239); -{ yymsp[1].minor.yy776 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); } break; case 235: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy641); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy659); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 236: /* like_pattern_opt ::= */ - case 411: /* from_clause_opt ::= */ yytestcase(yyruleno==411); - case 440: /* where_clause_opt ::= */ yytestcase(yyruleno==440); - case 444: /* twindow_clause_opt ::= */ yytestcase(yyruleno==444); - case 449: /* sliding_opt ::= */ yytestcase(yyruleno==449); - case 451: /* fill_opt ::= */ yytestcase(yyruleno==451); - case 463: /* having_clause_opt ::= */ yytestcase(yyruleno==463); - case 465: /* range_opt ::= */ yytestcase(yyruleno==465); - case 467: /* every_opt ::= */ yytestcase(yyruleno==467); - case 480: /* slimit_clause_opt ::= */ yytestcase(yyruleno==480); - case 484: /* limit_clause_opt ::= */ yytestcase(yyruleno==484); -{ yymsp[1].minor.yy776 = NULL; } + case 390: /* case_when_else_opt ::= */ yytestcase(yyruleno==390); + case 420: /* from_clause_opt ::= */ yytestcase(yyruleno==420); + case 449: /* where_clause_opt ::= */ yytestcase(yyruleno==449); + case 453: /* twindow_clause_opt ::= */ yytestcase(yyruleno==453); + case 458: /* sliding_opt ::= */ yytestcase(yyruleno==458); + case 460: /* fill_opt ::= */ yytestcase(yyruleno==460); + case 472: /* having_clause_opt ::= */ yytestcase(yyruleno==472); + case 474: /* range_opt ::= */ yytestcase(yyruleno==474); + case 476: /* every_opt ::= */ yytestcase(yyruleno==476); + case 489: /* slimit_clause_opt ::= */ yytestcase(yyruleno==489); + case 493: /* limit_clause_opt ::= */ yytestcase(yyruleno==493); +{ yymsp[1].minor.yy560 = NULL; } break; case 237: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 238: /* table_name_cond ::= table_name */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy641); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy659); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 240: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy641); } +{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy659); } break; case 241: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy281, yymsp[-3].minor.yy776, yymsp[-1].minor.yy776, NULL, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } break; case 242: /* cmd ::= DROP INDEX exists_opt full_table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } break; case 243: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy776 = createIndexOption(pCxt, yymsp[-7].minor.yy280, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), NULL, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } +{ yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy334, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } break; case 244: /* 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 */ -{ yymsp[-11].minor.yy776 = createIndexOption(pCxt, yymsp[-9].minor.yy280, releaseRawExprNode(pCxt, yymsp[-5].minor.yy776), releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } +{ yymsp[-11].minor.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy334, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } break; case 247: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy776 = createFunctionNode(pCxt, &yymsp[-3].minor.yy641, yymsp[-1].minor.yy280); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-1].minor.yy334); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 248: /* sma_stream_opt ::= */ case 275: /* stream_options ::= */ yytestcase(yyruleno==275); -{ yymsp[1].minor.yy776 = createStreamOptions(pCxt); } +{ yymsp[1].minor.yy560 = createStreamOptions(pCxt); } break; case 249: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ case 279: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==279); -{ ((SStreamOptions*)yymsp[-2].minor.yy776)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); yylhsminor.yy776 = yymsp[-2].minor.yy776; } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 250: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy776)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); yylhsminor.yy776 = yymsp[-2].minor.yy776; } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 251: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy281, &yymsp[-2].minor.yy641, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy659, yymsp[0].minor.yy560); } break; case 252: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy281, &yymsp[-3].minor.yy641, &yymsp[0].minor.yy641, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy659, &yymsp[0].minor.yy659, false); } break; case 253: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy281, &yymsp[-5].minor.yy641, &yymsp[0].minor.yy641, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy659, &yymsp[0].minor.yy659, true); } break; case 254: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy281, &yymsp[-3].minor.yy641, yymsp[0].minor.yy776, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy659, yymsp[0].minor.yy560, false); } break; case 255: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy281, &yymsp[-5].minor.yy641, yymsp[0].minor.yy776, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy659, yymsp[0].minor.yy560, true); } break; case 256: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } break; case 257: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy281, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); } break; case 258: /* cmd ::= DESC full_table_name */ case 259: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==259); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); } break; case 260: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 261: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy281, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } break; case 263: /* analyze_opt ::= ANALYZE */ case 270: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==270); - case 431: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==431); -{ yymsp[0].minor.yy281 = true; } + case 440: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==440); +{ yymsp[0].minor.yy173 = true; } break; case 264: /* explain_options ::= */ -{ yymsp[1].minor.yy776 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); } break; case 265: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy776 = setExplainVerbose(pCxt, yymsp[-2].minor.yy776, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 266: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy776 = setExplainRatio(pCxt, yymsp[-2].minor.yy776, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 267: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy281, yymsp[-8].minor.yy281, &yymsp[-5].minor.yy641, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy304, yymsp[0].minor.yy100); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-8].minor.yy173, &yymsp[-5].minor.yy659, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy574, yymsp[0].minor.yy676); } break; case 268: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } break; case 271: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy100 = 0; } +{ yymsp[1].minor.yy676 = 0; } break; case 272: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy100 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy676 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 273: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-6].minor.yy281, &yymsp[-5].minor.yy641, yymsp[-2].minor.yy776, yymsp[-4].minor.yy776, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy659, yymsp[-2].minor.yy560, yymsp[-4].minor.yy560, yymsp[0].minor.yy560); } break; case 274: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } break; case 276: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy776)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy776 = yymsp[-2].minor.yy776; } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy560 = yymsp[-2].minor.yy560; } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 277: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy776)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy776 = yymsp[-2].minor.yy776; } - yymsp[-2].minor.yy776 = yylhsminor.yy776; +{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy560 = yymsp[-2].minor.yy560; } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; case 278: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy776)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy776)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); yylhsminor.yy776 = yymsp[-3].minor.yy776; } - yymsp[-3].minor.yy776 = yylhsminor.yy776; +{ ((SStreamOptions*)yymsp[-3].minor.yy560)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-3].minor.yy560; } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 280: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy776)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy776 = yymsp[-3].minor.yy776; } - yymsp[-3].minor.yy776 = yylhsminor.yy776; +{ ((SStreamOptions*)yymsp[-3].minor.yy560)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy560 = yymsp[-3].minor.yy560; } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; case 281: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } @@ -4313,549 +4428,566 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 286: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy280); } +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy334); } break; case 287: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; case 288: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy280 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +{ yymsp[-1].minor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 290: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } break; case 292: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy776, yymsp[-2].minor.yy280, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy560, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } break; case 293: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy776, NULL, yymsp[0].minor.yy776); } +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } break; case 294: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 295: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 296: /* literal ::= NK_STRING */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 297: /* literal ::= NK_BOOL */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 298: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 299: /* literal ::= duration_literal */ case 309: /* signed_literal ::= signed */ yytestcase(yyruleno==309); - case 329: /* expression ::= literal */ yytestcase(yyruleno==329); - case 330: /* expression ::= pseudo_column */ yytestcase(yyruleno==330); - case 331: /* expression ::= column_reference */ yytestcase(yyruleno==331); - case 332: /* expression ::= function_expression */ yytestcase(yyruleno==332); - case 333: /* expression ::= subquery */ yytestcase(yyruleno==333); - case 361: /* function_expression ::= literal_func */ yytestcase(yyruleno==361); - case 403: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==403); - case 407: /* boolean_primary ::= predicate */ yytestcase(yyruleno==407); - case 409: /* common_expression ::= expression */ yytestcase(yyruleno==409); - case 410: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==410); - case 413: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==413); - case 415: /* table_reference ::= table_primary */ yytestcase(yyruleno==415); - case 416: /* table_reference ::= joined_table */ yytestcase(yyruleno==416); - case 420: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==420); - case 470: /* query_simple ::= query_specification */ yytestcase(yyruleno==470); - case 471: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==471); - case 474: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==474); - case 476: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==476); -{ yylhsminor.yy776 = yymsp[0].minor.yy776; } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 329: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==329); + case 330: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==330); + case 331: /* expression ::= literal */ yytestcase(yyruleno==331); + case 332: /* expression ::= pseudo_column */ yytestcase(yyruleno==332); + case 333: /* expression ::= column_reference */ yytestcase(yyruleno==333); + case 334: /* expression ::= function_expression */ yytestcase(yyruleno==334); + case 335: /* expression ::= case_when_expression */ yytestcase(yyruleno==335); + case 363: /* function_expression ::= literal_func */ yytestcase(yyruleno==363); + case 412: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==412); + case 416: /* boolean_primary ::= predicate */ yytestcase(yyruleno==416); + case 418: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==418); + case 419: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==419); + case 422: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==422); + case 424: /* table_reference ::= table_primary */ yytestcase(yyruleno==424); + case 425: /* table_reference ::= joined_table */ yytestcase(yyruleno==425); + case 429: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==429); + case 479: /* query_simple ::= query_specification */ yytestcase(yyruleno==479); + case 480: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==480); + case 483: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==483); + case 485: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==485); +{ yylhsminor.yy560 = yymsp[0].minor.yy560; } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 300: /* literal ::= NULL */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 301: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 302: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 303: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 304: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; case 305: /* 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.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 306: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 307: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; case 308: /* 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.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; case 310: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 311: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 312: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 313: /* signed_literal ::= duration_literal */ case 315: /* signed_literal ::= literal_func */ yytestcase(yyruleno==315); - case 381: /* star_func_para ::= expression */ yytestcase(yyruleno==381); - case 436: /* select_item ::= common_expression */ yytestcase(yyruleno==436); - case 475: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==475); - case 477: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==477); - case 489: /* search_condition ::= common_expression */ yytestcase(yyruleno==489); -{ yylhsminor.yy776 = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 383: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==383); + case 445: /* select_item ::= common_expression */ yytestcase(yyruleno==445); + case 484: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==484); + case 486: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==486); + case 499: /* search_condition ::= common_expression */ yytestcase(yyruleno==499); +{ yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 314: /* signed_literal ::= NULL */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; case 316: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy776 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; +{ yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; - case 334: /* expression ::= NK_LP expression NK_RP */ - case 408: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==408); -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 336: /* expression ::= NK_LP expression NK_RP */ + case 417: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==417); + case 498: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==498); +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 335: /* expression ::= NK_PLUS expression */ + case 337: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy776)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); + yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; - case 336: /* expression ::= NK_MINUS expression */ + case 338: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy776), NULL)); + 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)); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; - case 337: /* expression ::= expression NK_PLUS expression */ + case 339: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 338: /* expression ::= expression NK_MINUS expression */ + case 340: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 339: /* expression ::= expression NK_STAR expression */ + case 341: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 340: /* expression ::= expression NK_SLASH expression */ + case 342: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 341: /* expression ::= expression NK_REM expression */ + case 343: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 342: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 344: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 343: /* expression ::= expression NK_BITAND expression */ + case 345: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 344: /* expression ::= expression NK_BITOR expression */ + case 346: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 347: /* column_reference ::= column_name */ -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy641, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy641)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 349: /* column_reference ::= column_name */ +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy659, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy659)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; - case 348: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641, createColumnNode(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641)); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 350: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659, createColumnNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659)); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 349: /* pseudo_column ::= ROWTS */ - case 350: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==350); - case 352: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==352); - case 353: /* pseudo_column ::= QEND */ yytestcase(yyruleno==353); - case 354: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==354); - case 355: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==355); - case 356: /* pseudo_column ::= WEND */ yytestcase(yyruleno==356); - case 357: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==357); - case 363: /* literal_func ::= NOW */ yytestcase(yyruleno==363); -{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 351: /* pseudo_column ::= ROWTS */ + case 352: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==352); + case 354: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==354); + case 355: /* pseudo_column ::= QEND */ yytestcase(yyruleno==355); + case 356: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==356); + case 357: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==357); + case 358: /* pseudo_column ::= WEND */ yytestcase(yyruleno==358); + case 359: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==359); + case 365: /* literal_func ::= NOW */ yytestcase(yyruleno==365); +{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; - case 351: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy641)))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 353: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy659)))); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 358: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 359: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==359); -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy641, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy641, yymsp[-1].minor.yy280)); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + case 360: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 361: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==361); +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-1].minor.yy334)); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; - case 360: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), yymsp[-1].minor.yy304)); } - yymsp[-5].minor.yy776 = yylhsminor.yy776; + case 362: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy574)); } + yymsp[-5].minor.yy560 = yylhsminor.yy560; break; - case 362: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy641, NULL)); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 364: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy659, NULL)); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 377: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy280 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy280 = yylhsminor.yy280; + case 379: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy334 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy334 = yylhsminor.yy334; break; - case 382: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 439: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==439); -{ yylhsminor.yy776 = createColumnNode(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 384: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 448: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==448); +{ yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 383: /* predicate ::= expression compare_op expression */ - case 388: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==388); + case 385: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; + break; + case 386: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } + yymsp[-4].minor.yy560 = yylhsminor.yy560; + break; + case 389: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } + break; + case 391: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } + break; + case 392: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 397: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==397); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy668, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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.yy128, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 384: /* predicate ::= expression BETWEEN expression AND expression */ + case 393: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy776), releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; + yymsp[-4].minor.yy560 = yylhsminor.yy560; break; - case 385: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 394: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy776), releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-5].minor.yy776 = yylhsminor.yy776; + yymsp[-5].minor.yy560 = yylhsminor.yy560; break; - case 386: /* predicate ::= expression IS NULL */ + case 395: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), 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)); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 387: /* predicate ::= expression IS NOT NULL */ + case 396: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), 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)); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; - case 389: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_THAN; } + case 398: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_THAN; } break; - case 390: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_THAN; } + case 399: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_THAN; } break; - case 391: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_EQUAL; } + case 400: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_EQUAL; } break; - case 392: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_EQUAL; } + case 401: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_EQUAL; } break; - case 393: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy668 = OP_TYPE_NOT_EQUAL; } + case 402: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy128 = OP_TYPE_NOT_EQUAL; } break; - case 394: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy668 = OP_TYPE_EQUAL; } + case 403: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy128 = OP_TYPE_EQUAL; } break; - case 395: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy668 = OP_TYPE_LIKE; } + case 404: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy128 = OP_TYPE_LIKE; } break; - case 396: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_LIKE; } + case 405: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_LIKE; } break; - case 397: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy668 = OP_TYPE_MATCH; } + case 406: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy128 = OP_TYPE_MATCH; } break; - case 398: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy668 = OP_TYPE_NMATCH; } + case 407: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy128 = OP_TYPE_NMATCH; } break; - case 399: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy668 = OP_TYPE_JSON_CONTAINS; } + case 408: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy128 = OP_TYPE_JSON_CONTAINS; } break; - case 400: /* in_op ::= IN */ -{ yymsp[0].minor.yy668 = OP_TYPE_IN; } + case 409: /* in_op ::= IN */ +{ yymsp[0].minor.yy128 = OP_TYPE_IN; } break; - case 401: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_IN; } + case 410: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_IN; } break; - case 402: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy280)); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 411: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 404: /* boolean_value_expression ::= NOT boolean_primary */ + case 413: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy776), NULL)); + 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)); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; - case 405: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 414: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 406: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 415: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776); - yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); + 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))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 412: /* from_clause_opt ::= FROM table_reference_list */ - case 441: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==441); - case 464: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==464); -{ yymsp[-1].minor.yy776 = yymsp[0].minor.yy776; } + case 421: /* from_clause_opt ::= FROM table_reference_list */ + case 450: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==450); + case 473: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==473); +{ yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; } break; - case 414: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy776 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy776, yymsp[0].minor.yy776, NULL); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 423: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 417: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy776 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + case 426: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; - case 418: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy776 = createRealTableNode(pCxt, &yymsp[-3].minor.yy641, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + case 427: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy659, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; - case 419: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy776 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776), &yymsp[0].minor.yy641); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + case 428: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy659); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; - case 421: /* alias_opt ::= */ -{ yymsp[1].minor.yy641 = nil_token; } + case 430: /* alias_opt ::= */ +{ yymsp[1].minor.yy659 = nil_token; } break; - case 422: /* alias_opt ::= table_alias */ -{ yylhsminor.yy641 = yymsp[0].minor.yy641; } - yymsp[0].minor.yy641 = yylhsminor.yy641; + case 431: /* alias_opt ::= table_alias */ +{ yylhsminor.yy659 = yymsp[0].minor.yy659; } + yymsp[0].minor.yy659 = yylhsminor.yy659; break; - case 423: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy641 = yymsp[0].minor.yy641; } + case 432: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy659 = yymsp[0].minor.yy659; } break; - case 424: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 425: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==425); -{ yymsp[-2].minor.yy776 = yymsp[-1].minor.yy776; } + case 433: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 434: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==434); +{ yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; } break; - case 426: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy776 = createJoinTableNode(pCxt, yymsp[-4].minor.yy468, yymsp[-5].minor.yy776, yymsp[-2].minor.yy776, yymsp[0].minor.yy776); } - yymsp[-5].minor.yy776 = yylhsminor.yy776; + case 435: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-4].minor.yy540, yymsp[-5].minor.yy560, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } + yymsp[-5].minor.yy560 = yylhsminor.yy560; break; - case 427: /* join_type ::= */ -{ yymsp[1].minor.yy468 = JOIN_TYPE_INNER; } + case 436: /* join_type ::= */ +{ yymsp[1].minor.yy540 = JOIN_TYPE_INNER; } break; - case 428: /* join_type ::= INNER */ -{ yymsp[0].minor.yy468 = JOIN_TYPE_INNER; } + case 437: /* join_type ::= INNER */ +{ yymsp[0].minor.yy540 = JOIN_TYPE_INNER; } break; - case 429: /* query_specification ::= SELECT set_quantifier_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 */ + case 438: /* query_specification ::= SELECT set_quantifier_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[-11].minor.yy776 = createSelectStmt(pCxt, yymsp[-10].minor.yy281, yymsp[-9].minor.yy280, yymsp[-8].minor.yy776); - yymsp[-11].minor.yy776 = addWhereClause(pCxt, yymsp[-11].minor.yy776, yymsp[-7].minor.yy776); - yymsp[-11].minor.yy776 = addPartitionByClause(pCxt, yymsp[-11].minor.yy776, yymsp[-6].minor.yy280); - yymsp[-11].minor.yy776 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy776, yymsp[-2].minor.yy776); - yymsp[-11].minor.yy776 = addGroupByClause(pCxt, yymsp[-11].minor.yy776, yymsp[-1].minor.yy280); - yymsp[-11].minor.yy776 = addHavingClause(pCxt, yymsp[-11].minor.yy776, yymsp[0].minor.yy776); - yymsp[-11].minor.yy776 = addRangeClause(pCxt, yymsp[-11].minor.yy776, yymsp[-5].minor.yy776); - yymsp[-11].minor.yy776 = addEveryClause(pCxt, yymsp[-11].minor.yy776, yymsp[-4].minor.yy776); - yymsp[-11].minor.yy776 = addFillClause(pCxt, yymsp[-11].minor.yy776, yymsp[-3].minor.yy776); + yymsp[-11].minor.yy560 = createSelectStmt(pCxt, yymsp[-10].minor.yy173, yymsp[-9].minor.yy334, yymsp[-8].minor.yy560); + yymsp[-11].minor.yy560 = addWhereClause(pCxt, yymsp[-11].minor.yy560, yymsp[-7].minor.yy560); + yymsp[-11].minor.yy560 = addPartitionByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-6].minor.yy334); + yymsp[-11].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy560, yymsp[-2].minor.yy560); + yymsp[-11].minor.yy560 = addGroupByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-1].minor.yy334); + yymsp[-11].minor.yy560 = addHavingClause(pCxt, yymsp[-11].minor.yy560, yymsp[0].minor.yy560); + yymsp[-11].minor.yy560 = addRangeClause(pCxt, yymsp[-11].minor.yy560, yymsp[-5].minor.yy560); + yymsp[-11].minor.yy560 = addEveryClause(pCxt, yymsp[-11].minor.yy560, yymsp[-4].minor.yy560); + yymsp[-11].minor.yy560 = addFillClause(pCxt, yymsp[-11].minor.yy560, yymsp[-3].minor.yy560); } break; - case 432: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy281 = false; } + case 441: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy173 = false; } break; - case 435: /* select_item ::= NK_STAR */ -{ yylhsminor.yy776 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 444: /* select_item ::= NK_STAR */ +{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy560 = yylhsminor.yy560; break; - case 437: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy776 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776), &yymsp[0].minor.yy641); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + case 446: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy659); } + yymsp[-1].minor.yy560 = yylhsminor.yy560; break; - case 438: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy776 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), &yymsp[0].minor.yy641); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 447: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy659); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 443: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 460: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==460); - case 479: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==479); -{ yymsp[-2].minor.yy280 = yymsp[0].minor.yy280; } + case 452: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 469: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==469); + case 488: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==488); +{ yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; } break; - case 445: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy776 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); } + case 454: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } break; - case 446: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy776 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); } + case 455: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } break; - case 447: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy776 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), NULL, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } + case 456: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } break; - case 448: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy776 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy776), releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } + case 457: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ 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); } break; - case 450: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 468: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==468); -{ yymsp[-3].minor.yy776 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy776); } + case 459: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 477: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==477); +{ yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); } break; - case 452: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy776 = createFillNode(pCxt, yymsp[-1].minor.yy774, NULL); } + case 461: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); } break; - case 453: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy776 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy280)); } + case 462: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } break; - case 454: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy774 = FILL_MODE_NONE; } + case 463: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy18 = FILL_MODE_NONE; } break; - case 455: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy774 = FILL_MODE_PREV; } + case 464: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy18 = FILL_MODE_PREV; } break; - case 456: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy774 = FILL_MODE_NULL; } + case 465: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy18 = FILL_MODE_NULL; } break; - case 457: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy774 = FILL_MODE_LINEAR; } + case 466: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; } break; - case 458: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy774 = FILL_MODE_NEXT; } + case 467: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; } break; - case 461: /* group_by_list ::= expression */ -{ yylhsminor.yy280 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); } - yymsp[0].minor.yy280 = yylhsminor.yy280; + case 470: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } + yymsp[0].minor.yy334 = yylhsminor.yy334; break; - case 462: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); } - yymsp[-2].minor.yy280 = yylhsminor.yy280; + case 471: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; break; - case 466: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy776 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); } + case 475: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } break; - case 469: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 478: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy776 = addOrderByClause(pCxt, yymsp[-3].minor.yy776, yymsp[-2].minor.yy280); - yylhsminor.yy776 = addSlimitClause(pCxt, yylhsminor.yy776, yymsp[-1].minor.yy776); - yylhsminor.yy776 = addLimitClause(pCxt, yylhsminor.yy776, yymsp[0].minor.yy776); + yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy334); + yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); + yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; - case 472: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy776 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy776, yymsp[0].minor.yy776); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + case 481: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } + yymsp[-3].minor.yy560 = yylhsminor.yy560; break; - case 473: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy776 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy776, yymsp[0].minor.yy776); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 482: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 481: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 485: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==485); -{ yymsp[-1].minor.yy776 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 490: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 494: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==494); +{ yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 482: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 486: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==486); -{ yymsp[-3].minor.yy776 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 491: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 495: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==495); +{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 483: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 487: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==487); -{ yymsp[-3].minor.yy776 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 492: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 496: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==496); +{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 488: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy776); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 497: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 492: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy776 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), yymsp[-1].minor.yy2, yymsp[0].minor.yy649); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + case 502: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy596, yymsp[0].minor.yy487); } + yymsp[-2].minor.yy560 = yylhsminor.yy560; break; - case 493: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy2 = ORDER_ASC; } + case 503: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy596 = ORDER_ASC; } break; - case 494: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy2 = ORDER_ASC; } + case 504: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy596 = ORDER_ASC; } break; - case 495: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy2 = ORDER_DESC; } + case 505: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy596 = ORDER_DESC; } break; - case 496: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy649 = NULL_ORDER_DEFAULT; } + case 506: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy487 = NULL_ORDER_DEFAULT; } break; - case 497: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy649 = NULL_ORDER_FIRST; } + case 507: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy487 = NULL_ORDER_FIRST; } break; - case 498: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy649 = NULL_ORDER_LAST; } + case 508: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy487 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index 716dd7ffc0..ba96a8c35a 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -60,6 +60,9 @@ TEST_F(ParserSelectTest, expression) { run("SELECT ts > 0, c1 between 10 and 20 and c2 = 'qaz' FROM t1"); run("SELECT c1 | 10, c2 & 20, c4 | c5 FROM t1"); + + run("SELECT CASE WHEN ts > '2020-1-1 10:10:10' THEN c1 + 10 ELSE c1 - 10 END FROM t1 " + "WHERE CASE c1 WHEN c3 + 20 THEN c3 - 1 WHEN c3 + 10 THEN c3 - 2 ELSE 10 END > 0"); } TEST_F(ParserSelectTest, condition) { @@ -312,6 +315,8 @@ TEST_F(ParserSelectTest, subquery) { run("SELECT _C0 FROM (SELECT _ROWTS, ts FROM st1s1)"); run("SELECT ts FROM (SELECT t1.ts FROM st1s1 t1)"); + + run("(((SELECT t1.ts FROM st1s1 t1)))"); } TEST_F(ParserSelectTest, subquerySemanticCheck) { diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 27ec409d52..c7769b15b1 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -40,6 +40,13 @@ TEST_F(PlanBasicTest, whereClause) { run("SELECT ts, c1 FROM t1 WHERE ts > NOW AND ts IS NULL AND (c1 > 0 OR c3 < 20)"); } +TEST_F(PlanBasicTest, caseWhen) { + useDb("root", "test"); + + run("SELECT CASE WHEN ts > '2020-1-1 10:10:10' THEN c1 + 10 ELSE c1 - 10 END FROM t1 " + "WHERE CASE c1 WHEN c2 + 20 THEN c4 - 1 WHEN c2 + 10 THEN c4 - 2 ELSE 10 END > 0"); +} + TEST_F(PlanBasicTest, func) { useDb("root", "test"); From ce79f915e463ca537a96c8f62696d25af34bb203 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 22 Sep 2022 20:28:38 +0800 Subject: [PATCH 65/69] fix: restore vnodes in multi-threads --- source/dnode/mgmt/mgmt_vnode/inc/vmInt.h | 1 + source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 98 ++++++++++++++++++++---- 2 files changed, 85 insertions(+), 14 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index ebbb9fa5d4..30f5483198 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -74,6 +74,7 @@ typedef struct { TdThread thread; SVnodeMgmt *pMgmt; SWrapperCfg *pCfgs; + SVnodeObj **ppVnodes; } SVnodeThread; // vmInt.c diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 1f981cc9e0..3940543e74 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -218,14 +218,14 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) { dInfo("start to close all vnodes"); int32_t numOfVnodes = 0; - SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); + SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); for (int32_t i = 0; i < numOfVnodes; ++i) { - vmCloseVnode(pMgmt, pVnodes[i]); + vmCloseVnode(pMgmt, ppVnodes[i]); } - if (pVnodes != NULL) { - taosMemoryFree(pVnodes); + if (ppVnodes != NULL) { + taosMemoryFree(ppVnodes); } if (pMgmt->hash != NULL) { @@ -331,22 +331,92 @@ static int32_t vmRequire(const SMgmtInputOpt *pInput, bool *required) { return 0; } -static int32_t vmStart(SVnodeMgmt *pMgmt) { - int32_t numOfVnodes = 0; - SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); +static void *vmRestoreVnodeInThread(void *param) { + SVnodeThread *pThread = param; + SVnodeMgmt *pMgmt = pThread->pMgmt; - for (int32_t i = 0; i < numOfVnodes; ++i) { - SVnodeObj *pVnode = pVnodes[i]; - vnodeStart(pVnode->pImpl); + dInfo("thread:%d, start to restore %d vnodes", pThread->threadIndex, pThread->vnodeNum); + setThreadName("restore-vnodes"); + + for (int32_t v = 0; v < pThread->vnodeNum; ++v) { + SVnodeObj *pVnode = pThread->ppVnodes[v]; + + char stepDesc[TSDB_STEP_DESC_LEN] = {0}; + snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been restored", pVnode->vgId, + pMgmt->state.openVnodes, pMgmt->state.totalVnodes); + tmsgReportStartup("vnode-restore", stepDesc); + + int32_t code = vnodeStart(pVnode->pImpl); + if (code != 0) { + dError("vgId:%d, failed to restore vnode by thread:%d", pVnode->vgId, pThread->threadIndex); + pThread->failed++; + } else { + dDebug("vgId:%d, is restored by thread:%d", pVnode->vgId, pThread->threadIndex); + pThread->opened++; + atomic_add_fetch_32(&pMgmt->state.openVnodes, 1); + } } + dInfo("thread:%d, numOfVnodes:%d, restored:%d failed:%d", pThread->threadIndex, pThread->vnodeNum, pThread->opened, + pThread->failed); + return NULL; +} + +static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { + int32_t numOfVnodes = 0; + SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); + + int32_t threadNum = tsNumOfCores / 2; + if (threadNum < 1) threadNum = 1; + int32_t vnodesPerThread = numOfVnodes / threadNum + 1; + + SVnodeThread *threads = taosMemoryCalloc(threadNum, sizeof(SVnodeThread)); + for (int32_t t = 0; t < threadNum; ++t) { + threads[t].threadIndex = t; + threads[t].pMgmt = pMgmt; + threads[t].ppVnodes = taosMemoryCalloc(vnodesPerThread, sizeof(SVnode *)); + } + + for (int32_t v = 0; v < numOfVnodes; ++v) { + int32_t t = v % threadNum; + SVnodeThread *pThread = &threads[t]; + pThread->ppVnodes[pThread->vnodeNum++] = ppVnodes[v]; + } + + pMgmt->state.openVnodes = 0; + dInfo("restore %d vnodes with %d threads", numOfVnodes, threadNum); + + for (int32_t t = 0; t < threadNum; ++t) { + SVnodeThread *pThread = &threads[t]; + if (pThread->vnodeNum == 0) continue; + + TdThreadAttr thAttr; + taosThreadAttrInit(&thAttr); + taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); + if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) { + dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno)); + } + + taosThreadAttrDestroy(&thAttr); + } + + for (int32_t t = 0; t < threadNum; ++t) { + SVnodeThread *pThread = &threads[t]; + if (pThread->vnodeNum > 0 && taosCheckPthreadValid(pThread->thread)) { + taosThreadJoin(pThread->thread, NULL); + taosThreadClear(&pThread->thread); + } + taosMemoryFree(pThread->pCfgs); + } + taosMemoryFree(threads); + for (int32_t i = 0; i < numOfVnodes; ++i) { - SVnodeObj *pVnode = pVnodes[i]; + SVnodeObj *pVnode = ppVnodes[i]; vmReleaseVnode(pMgmt, pVnode); } - if (pVnodes != NULL) { - taosMemoryFree(pVnodes); + if (ppVnodes != NULL) { + taosMemoryFree(ppVnodes); } return 0; @@ -360,7 +430,7 @@ SMgmtFunc vmGetMgmtFunc() { SMgmtFunc mgmtFunc = {0}; mgmtFunc.openFp = vmInit; mgmtFunc.closeFp = (NodeCloseFp)vmCleanup; - mgmtFunc.startFp = (NodeStartFp)vmStart; + mgmtFunc.startFp = (NodeStartFp)vmStartVnodes; mgmtFunc.stopFp = (NodeStopFp)vmStop; mgmtFunc.requiredFp = vmRequire; mgmtFunc.getHandlesFp = vmGetMsgHandles; From ef859f7fe1ae959ed550cab33b5713100b3dfeba Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 22 Sep 2022 20:49:33 +0800 Subject: [PATCH 66/69] fix: definite lost --- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 2 +- tests/script/tsim/insert/basic.sim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 3940543e74..f0c43d8b36 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -406,7 +406,7 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { taosThreadJoin(pThread->thread, NULL); taosThreadClear(&pThread->thread); } - taosMemoryFree(pThread->pCfgs); + taosMemoryFree(pThread->ppVnodes); } taosMemoryFree(threads); diff --git a/tests/script/tsim/insert/basic.sim b/tests/script/tsim/insert/basic.sim index c4ef3e39da..c926cbc8b0 100644 --- a/tests/script/tsim/insert/basic.sim +++ b/tests/script/tsim/insert/basic.sim @@ -12,7 +12,7 @@ $tb = $tbPrefix . $i print =============== step1 sql drop database -x step1 step1: -sql create database $db +sql create database $db vgroups 2 sql use $db sql create table $tb (ts timestamp, speed int) From d5a5e7535a0bda249dbf5d67f7fe56fb8a092397 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 23 Sep 2022 10:20:26 +0800 Subject: [PATCH 67/69] feat: case when expression --- tests/system-test/1-insert/database_pre_suf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system-test/1-insert/database_pre_suf.py b/tests/system-test/1-insert/database_pre_suf.py index fe788af0db..fc4bf7f5de 100755 --- a/tests/system-test/1-insert/database_pre_suf.py +++ b/tests/system-test/1-insert/database_pre_suf.py @@ -107,7 +107,7 @@ class TDTestCase: # create stream - tdSql.execute('''create stream current_stream into stream_max_stable_1 as select _wstart as start, _wend as end, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') + tdSql.execute('''create stream current_stream into stream_max_stable_1 as select _wstart as start, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') # insert data for i in range(num_random*n): @@ -185,20 +185,20 @@ class TDTestCase: tdSql.checkData(0,0,num_random*n) # stream data check - tdSql.query("select start,end,max_int from stream_max_stable_1 ;") + tdSql.query("select start,wend,max_int from stream_max_stable_1 ;") tdSql.checkRows(20) tdSql.query("select sum(max_int) from stream_max_stable_1 ;") stream_data_1 = tdSql.queryResult[0][0] tdSql.query("select sum(min_int) from stream_max_stable_1 ;") stream_data_2 = tdSql.queryResult[0][0] - tdSql.query("select sum(max_int),sum(min_int) from (select _wstart as start, _wend as end, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s));") + tdSql.query("select sum(max_int),sum(min_int) from (select _wstart as start, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s));") sql_data_1 = tdSql.queryResult[0][0] sql_data_2 = tdSql.queryResult[0][1] self.stream_value_check(stream_data_1,sql_data_1) self.stream_value_check(stream_data_2,sql_data_2) - tdSql.query("select sum(max_int),sum(min_int) from (select _wstart as start, _wend as end, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 interval (5s));") + tdSql.query("select sum(max_int),sum(min_int) from (select _wstart as start, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 interval (5s));") sql_data_1 = tdSql.queryResult[0][0] sql_data_2 = tdSql.queryResult[0][1] From ab94dafed407e88309cd6d3edffbde5a8e0cc133 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Fri, 23 Sep 2022 11:37:50 +0800 Subject: [PATCH 68/69] optimize block cache --- source/libs/executor/src/executor.c | 4 +++- source/libs/executor/src/scanoperator.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 8d2c66ff90..be8bdf7308 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -84,15 +84,17 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu } else if (type == STREAM_INPUT__DATA_BLOCK) { for (int32_t i = 0; i < numOfBlocks; ++i) { SSDataBlock* pDataBlock = &((SSDataBlock*)input)[i]; + taosArrayPush(pInfo->pBlockLists, &pDataBlock); +#if 0 // TODO optimize SSDataBlock* p = createOneDataBlock(pDataBlock, false); - /*qError("alloc p i, %d %p", i, p);*/ p->info = pDataBlock->info; taosArrayClear(p->pDataBlock); taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock); taosArrayPush(pInfo->pBlockLists, &p); +#endif } pInfo->blockType = STREAM_INPUT__DATA_BLOCK; } else { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 56fbb21309..6c5c33ae29 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -920,6 +920,7 @@ _error: } static void doClearBufferedBlocks(SStreamScanInfo* pInfo) { +#if 0 if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) { size_t total = taosArrayGetSize(pInfo->pBlockLists); for (int32_t i = 0; i < total; i++) { @@ -928,6 +929,7 @@ static void doClearBufferedBlocks(SStreamScanInfo* pInfo) { taosMemoryFree(p); } } +#endif taosArrayClear(pInfo->pBlockLists); pInfo->validBlockIndex = 0; #if 0 From cfd7036661474ef7abe1c522ce065e0d15670601 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 23 Sep 2022 11:55:55 +0800 Subject: [PATCH 69/69] docs: update connector doc for3.0 (#17020) * docs: update csharp connector status * docs: fix csharp ws bulk pulling * docs: clarify database param is optional to websocket dsn --- docs/en/14-reference/03-connector/06-rust.mdx | 2 +- docs/en/14-reference/03-connector/09-csharp.mdx | 2 +- docs/zh/08-connector/26-rust.mdx | 2 +- docs/zh/08-connector/40-csharp.mdx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/14-reference/03-connector/06-rust.mdx b/docs/en/14-reference/03-connector/06-rust.mdx index 530287e2a4..edc3016cde 100644 --- a/docs/en/14-reference/03-connector/06-rust.mdx +++ b/docs/en/14-reference/03-connector/06-rust.mdx @@ -116,7 +116,7 @@ The parameters are described as follows: - **protocol**: Specify which connection method to use. For example, `taos+ws://localhost:6041` uses Websocket to establish connections. - **username/password**: Username and password used to create connections. - **host/port**: Specifies the server and port to establish a connection. If you do not specify a hostname or port, native connections default to `localhost:6030` and Websocket connections default to `localhost:6041`. -- **database**: Specify the default database to connect to. +- **database**: Specify the default database to connect to. It's optional. - **params**:Optional parameters. A sample DSN description string is as follows: diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx index 45bf7fdf82..87a10e17ca 100644 --- a/docs/en/14-reference/03-connector/09-csharp.mdx +++ b/docs/en/14-reference/03-connector/09-csharp.mdx @@ -151,7 +151,7 @@ The parameters are described as follows: * **protocol**: Specify which connection method to use (support http/ws). For example, `ws://localhost:6041` uses Websocket to establish connections. * **username/password**: Username and password used to create connections. * **host/port**: Specifies the server and port to establish a connection. Websocket connections default to `localhost:6041`. -* **database**: Specify the default database to connect to. +* **database**: Specify the default database to connect to. It's optional. * **params**:Optional parameters. A sample DSN description string is as follows: diff --git a/docs/zh/08-connector/26-rust.mdx b/docs/zh/08-connector/26-rust.mdx index b838e5c5a2..f6b99beed3 100644 --- a/docs/zh/08-connector/26-rust.mdx +++ b/docs/zh/08-connector/26-rust.mdx @@ -116,7 +116,7 @@ DSN 描述字符串基本结构如下: - **protocol**: 显示指定以何种方式建立连接,例如:`taos+ws://localhost:6041` 指定以 Websocket 方式建立连接。 - **username/password**: 用于创建连接的用户名及密码。 - **host/port**: 指定创建连接的服务器及端口,当不指定服务器地址及端口时(`taos://`),原生连接默认为 `localhost:6030`,Websocket 连接默认为 `localhost:6041` 。 -- **database**: 指定默认连接的数据库名。 +- **database**: 指定默认连接的数据库名,可选参数。 - **params**:其他可选参数。 一个完整的 DSN 描述字符串示例如下: diff --git a/docs/zh/08-connector/40-csharp.mdx b/docs/zh/08-connector/40-csharp.mdx index f78fd9e3d9..e99f41ae9c 100644 --- a/docs/zh/08-connector/40-csharp.mdx +++ b/docs/zh/08-connector/40-csharp.mdx @@ -154,7 +154,7 @@ namespace TDengineExample * **host/port**: 指定创建连接的服务器及端口,WebSocket 连接默认为 `localhost:6041` 。 -* **database**: 指定默认连接的数据库名。 +* **database**: 指定默认连接的数据库名,可选参数。 * **params**:其他可选参数。