diff --git a/deps/arm/dm_static/libdmodule.a b/deps/arm/dm_static/libdmodule.a index 072e9f857d..989676d14d 100644 Binary files a/deps/arm/dm_static/libdmodule.a and b/deps/arm/dm_static/libdmodule.a differ diff --git a/deps/mips/dm_static/libdmodule.a b/deps/mips/dm_static/libdmodule.a index 868ac62d3e..167b932121 100644 Binary files a/deps/mips/dm_static/libdmodule.a and b/deps/mips/dm_static/libdmodule.a differ diff --git a/deps/x86/dm_static/libdmodule.a b/deps/x86/dm_static/libdmodule.a index 658bb95c27..9f17b4c118 100644 Binary files a/deps/x86/dm_static/libdmodule.a and b/deps/x86/dm_static/libdmodule.a differ diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index 27dbbfcc08..4bd701f713 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -398,7 +398,7 @@ Conversion functions change the data type of a value. CAST(expr AS type_name) ``` -**Description**: Convert the input data `expr` into the type specified by `type_name`. This function can be used only in SELECT statements. +**Description**: Convert the input data `expr` into the type specified by `type_name`. **Return value type**: The type specified by parameter `type_name` @@ -435,8 +435,7 @@ TO_ISO8601(expr [, timezone]) **More explanations**: - You can specify a time zone in the following format: [z/Z, +/-hhmm, +/-hh, +/-hh:mm]. For example, TO_ISO8601(1, "+00:00"). -- If the input is a UNIX timestamp, the precision of the returned value is determined by the digits of the input timestamp -- If the input is a column of TIMESTAMP type, the precision of the returned value is same as the precision set for the current data base in use +- The precision of the input timestamp will be recognized automatically according to the precision of the table used, milliseconds will be used if no table is specified. #### TO_JSON @@ -650,6 +649,7 @@ use_current_timezone: { - Time unit specified by `time_unit` can be: 1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks) - The precision of the returned timestamp is same as the precision set for the current data base in use +- The precision of the input timestamp will be recognized automatically according to the precision of the table used, milliseconds will be used if no table is specified. - If the input data is not formatted as a timestamp, the returned value is null. - When using 1d/1w as the time unit to truncate timestamp, you can specify whether to truncate based on the current time zone by setting the use_current_timezone parameter. Value 0 indicates truncation using the UTC time zone, value 1 indicates truncation using the current time zone. diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 6f4f9b3d84..26996a39fd 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -398,7 +398,7 @@ UPPER(expr) CAST(expr AS type_name) ``` -**功能说明**:数据类型转换函数,返回 expr 转换为 type_name 指定的类型后的结果。只适用于 select 子句中。 +**功能说明**:数据类型转换函数,返回 expr 转换为 type_name 指定的类型后的结果。 **返回结果类型**:CAST 中指定的类型(type_name)。 @@ -435,8 +435,7 @@ TO_ISO8601(expr [, timezone]) **使用说明**: - timezone 参数允许输入的时区格式为: [z/Z, +/-hhmm, +/-hh, +/-hh:mm]。例如,TO_ISO8601(1, "+00:00")。 -- 如果输入是表示 UNIX 时间戳的整形,返回格式精度由时间戳的位数决定; -- 如果输入是 TIMESTAMP 类型的列,返回格式的时间戳精度与当前 DATABASE 设置的时间精度一致。 +- 输入时间戳的精度由所查询表的精度确定, 若未指定表, 则精度为毫秒. #### TO_JSON @@ -650,6 +649,7 @@ use_current_timezone: { - 支持的时间单位 time_unit 如下: 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 - 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 +- 输入时间戳的精度由所查询表的精度确定, 若未指定表, 则精度为毫秒. - 输入包含不符合时间日期格式的字符串则返回 NULL。 - 当使用 1d/1w 作为时间单位对时间戳进行截断时, 可通过设置 use_current_timezone 参数指定是否根据当前时区进行截断处理。 值 0 表示使用 UTC 时区进行截断,值 1 表示使用当前时区进行截断。 diff --git a/include/common/tglobal.h b/include/common/tglobal.h index e7035fe297..96b9617fc4 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -24,10 +24,11 @@ extern "C" { #endif +#define SLOW_LOG_TYPE_NULL 0x0 #define SLOW_LOG_TYPE_QUERY 0x1 #define SLOW_LOG_TYPE_INSERT 0x2 #define SLOW_LOG_TYPE_OTHERS 0x4 -#define SLOW_LOG_TYPE_ALL 0xFFFFFFFF +#define SLOW_LOG_TYPE_ALL 0x7 typedef enum { DND_CA_SM4 = 1, @@ -177,7 +178,10 @@ extern int32_t tsMaxRetryWaitTime; extern bool tsUseAdapter; extern int32_t tsMetaCacheMaxSize; extern int32_t tsSlowLogThreshold; +extern int32_t tsSlowLogThresholdTest; +extern char tsSlowLogExceptDb[]; extern int32_t tsSlowLogScope; +extern int32_t tsSlowLogMaxLen; extern int32_t tsTimeSeriesThreshold; extern bool tsMultiResultFunctionStarReturnTags; @@ -273,6 +277,7 @@ void taosSetGlobalDebugFlag(int32_t flag); void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal); void taosLocalCfgForbiddenToChange(char *name, bool *forbidden); int8_t taosGranted(int8_t type); +int32_t taosSetSlowLogScope(char *pScope); #ifdef __cplusplus } diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 2aa9957ce8..eecfc3fe9a 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -344,6 +344,7 @@ typedef enum ENodeType { QUERY_NODE_RESUME_STREAM_STMT, QUERY_NODE_CREATE_VIEW_STMT, QUERY_NODE_DROP_VIEW_STMT, + QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE, // show statement nodes // see 'sysTableShowAdapter', 'SYSTABLE_SHOW_TYPE_OFFSET' @@ -654,6 +655,16 @@ void tFreeSSubmitRsp(SSubmitRsp* pRsp); #define SSCHMEA_BYTES(s) ((s)->bytes) #define SSCHMEA_NAME(s) ((s)->name) +typedef struct { + bool tsEnableMonitor; + int32_t tsMonitorInterval; + int32_t tsSlowLogThreshold; + int32_t tsSlowLogMaxLen; + int32_t tsSlowLogScope; + int32_t tsSlowLogThresholdTest; + char tsSlowLogExceptDb[TSDB_DB_NAME_LEN]; +} SMonitorParas; + typedef struct { int32_t nCols; int32_t version; @@ -968,6 +979,7 @@ typedef struct { char sVer[TSDB_VERSION_LEN]; char sDetailVer[128]; int64_t whiteListVer; + SMonitorParas monitorParas; } SConnectRsp; int32_t tSerializeSConnectRsp(void* buf, int32_t bufLen, SConnectRsp* pRsp); @@ -1635,6 +1647,7 @@ typedef struct { int8_t enableWhiteList; int8_t encryptionKeyStat; uint32_t encryptionKeyChksum; + SMonitorParas monitorParas; } SClusterCfg; typedef struct { @@ -1726,9 +1739,15 @@ int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq); int32_t tDeserializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq); void tFreeSStatusReq(SStatusReq* pReq); +typedef enum { + MONITOR_TYPE_COUNTER = 0, + MONITOR_TYPE_SLOW_LOG = 1, +} MONITOR_TYPE; + typedef struct { - int32_t contLen; - char* pCont; + int32_t contLen; + char* pCont; + MONITOR_TYPE type; } SStatisReq; int32_t tSerializeSStatisReq(void* buf, int32_t bufLen, SStatisReq* pReq); @@ -3260,6 +3279,7 @@ typedef struct { int64_t rspId; int32_t svrTimestamp; SArray* rsps; // SArray + SMonitorParas monitorParas; } SClientHbBatchRsp; static FORCE_INLINE uint32_t hbKeyHashFunc(const char* key, uint32_t keyLen) { return taosIntHash_64(key, keyLen); } diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index a276329c42..81c494223c 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -141,229 +141,229 @@ #define TK_NK_EQ 123 #define TK_USING 124 #define TK_TAGS 125 -#define TK_BOOL 126 -#define TK_TINYINT 127 -#define TK_SMALLINT 128 -#define TK_INT 129 -#define TK_INTEGER 130 -#define TK_BIGINT 131 -#define TK_FLOAT 132 -#define TK_DOUBLE 133 -#define TK_BINARY 134 -#define TK_NCHAR 135 -#define TK_UNSIGNED 136 -#define TK_JSON 137 -#define TK_VARCHAR 138 -#define TK_MEDIUMBLOB 139 -#define TK_BLOB 140 -#define TK_VARBINARY 141 -#define TK_GEOMETRY 142 -#define TK_DECIMAL 143 -#define TK_COMMENT 144 -#define TK_MAX_DELAY 145 -#define TK_WATERMARK 146 -#define TK_ROLLUP 147 -#define TK_TTL 148 -#define TK_SMA 149 -#define TK_DELETE_MARK 150 -#define TK_FIRST 151 -#define TK_LAST 152 -#define TK_SHOW 153 -#define TK_FULL 154 -#define TK_PRIVILEGES 155 -#define TK_DATABASES 156 -#define TK_TABLES 157 -#define TK_STABLES 158 -#define TK_MNODES 159 -#define TK_QNODES 160 -#define TK_ARBGROUPS 161 -#define TK_FUNCTIONS 162 -#define TK_INDEXES 163 -#define TK_ACCOUNTS 164 -#define TK_APPS 165 -#define TK_CONNECTIONS 166 -#define TK_LICENCES 167 -#define TK_GRANTS 168 -#define TK_LOGS 169 -#define TK_MACHINES 170 -#define TK_ENCRYPTIONS 171 -#define TK_QUERIES 172 -#define TK_SCORES 173 -#define TK_TOPICS 174 -#define TK_VARIABLES 175 -#define TK_BNODES 176 -#define TK_SNODES 177 -#define TK_TRANSACTIONS 178 -#define TK_DISTRIBUTED 179 -#define TK_CONSUMERS 180 -#define TK_SUBSCRIPTIONS 181 -#define TK_VNODES 182 -#define TK_ALIVE 183 -#define TK_VIEWS 184 -#define TK_VIEW 185 -#define TK_COMPACTS 186 -#define TK_NORMAL 187 -#define TK_CHILD 188 -#define TK_LIKE 189 -#define TK_TBNAME 190 -#define TK_QTAGS 191 -#define TK_AS 192 -#define TK_SYSTEM 193 -#define TK_TSMA 194 -#define TK_INTERVAL 195 -#define TK_RECURSIVE 196 -#define TK_TSMAS 197 -#define TK_FUNCTION 198 -#define TK_INDEX 199 -#define TK_COUNT 200 -#define TK_LAST_ROW 201 -#define TK_META 202 -#define TK_ONLY 203 -#define TK_TOPIC 204 -#define TK_CONSUMER 205 -#define TK_GROUP 206 -#define TK_DESC 207 -#define TK_DESCRIBE 208 -#define TK_RESET 209 -#define TK_QUERY 210 -#define TK_CACHE 211 -#define TK_EXPLAIN 212 -#define TK_ANALYZE 213 -#define TK_VERBOSE 214 -#define TK_NK_BOOL 215 -#define TK_RATIO 216 -#define TK_NK_FLOAT 217 -#define TK_OUTPUTTYPE 218 -#define TK_AGGREGATE 219 -#define TK_BUFSIZE 220 -#define TK_LANGUAGE 221 -#define TK_REPLACE 222 -#define TK_STREAM 223 -#define TK_INTO 224 -#define TK_PAUSE 225 -#define TK_RESUME 226 -#define TK_PRIMARY 227 -#define TK_KEY 228 -#define TK_TRIGGER 229 -#define TK_AT_ONCE 230 -#define TK_WINDOW_CLOSE 231 -#define TK_IGNORE 232 -#define TK_EXPIRED 233 -#define TK_FILL_HISTORY 234 -#define TK_UPDATE 235 -#define TK_SUBTABLE 236 -#define TK_UNTREATED 237 -#define TK_KILL 238 -#define TK_CONNECTION 239 -#define TK_TRANSACTION 240 -#define TK_BALANCE 241 -#define TK_VGROUP 242 -#define TK_LEADER 243 -#define TK_MERGE 244 -#define TK_REDISTRIBUTE 245 -#define TK_SPLIT 246 -#define TK_DELETE 247 -#define TK_INSERT 248 -#define TK_NK_BIN 249 -#define TK_NK_HEX 250 -#define TK_NULL 251 -#define TK_NK_QUESTION 252 -#define TK_NK_ALIAS 253 -#define TK_NK_ARROW 254 -#define TK_ROWTS 255 -#define TK_QSTART 256 -#define TK_QEND 257 -#define TK_QDURATION 258 -#define TK_WSTART 259 -#define TK_WEND 260 -#define TK_WDURATION 261 -#define TK_IROWTS 262 -#define TK_ISFILLED 263 -#define TK_CAST 264 -#define TK_NOW 265 -#define TK_TODAY 266 -#define TK_TIMEZONE 267 -#define TK_CLIENT_VERSION 268 -#define TK_SERVER_VERSION 269 -#define TK_SERVER_STATUS 270 -#define TK_CURRENT_USER 271 -#define TK_CASE 272 -#define TK_WHEN 273 -#define TK_THEN 274 -#define TK_ELSE 275 -#define TK_BETWEEN 276 -#define TK_IS 277 -#define TK_NK_LT 278 -#define TK_NK_GT 279 -#define TK_NK_LE 280 -#define TK_NK_GE 281 -#define TK_NK_NE 282 -#define TK_MATCH 283 -#define TK_NMATCH 284 -#define TK_CONTAINS 285 -#define TK_IN 286 -#define TK_JOIN 287 -#define TK_INNER 288 -#define TK_LEFT 289 -#define TK_RIGHT 290 -#define TK_OUTER 291 -#define TK_SEMI 292 -#define TK_ANTI 293 -#define TK_ASOF 294 -#define TK_WINDOW 295 -#define TK_WINDOW_OFFSET 296 -#define TK_JLIMIT 297 -#define TK_SELECT 298 -#define TK_NK_HINT 299 -#define TK_DISTINCT 300 -#define TK_WHERE 301 -#define TK_PARTITION 302 -#define TK_BY 303 -#define TK_SESSION 304 -#define TK_STATE_WINDOW 305 -#define TK_EVENT_WINDOW 306 -#define TK_COUNT_WINDOW 307 -#define TK_SLIDING 308 -#define TK_FILL 309 -#define TK_VALUE 310 -#define TK_VALUE_F 311 -#define TK_NONE 312 -#define TK_PREV 313 -#define TK_NULL_F 314 -#define TK_LINEAR 315 -#define TK_NEXT 316 -#define TK_HAVING 317 -#define TK_RANGE 318 -#define TK_EVERY 319 -#define TK_ORDER 320 -#define TK_SLIMIT 321 -#define TK_SOFFSET 322 -#define TK_LIMIT 323 -#define TK_OFFSET 324 -#define TK_ASC 325 -#define TK_NULLS 326 -#define TK_ABORT 327 -#define TK_AFTER 328 -#define TK_ATTACH 329 -#define TK_BEFORE 330 -#define TK_BEGIN 331 -#define TK_BITAND 332 -#define TK_BITNOT 333 -#define TK_BITOR 334 -#define TK_BLOCKS 335 -#define TK_CHANGE 336 -#define TK_COMMA 337 -#define TK_CONCAT 338 -#define TK_CONFLICT 339 -#define TK_COPY 340 -#define TK_DEFERRED 341 -#define TK_DELIMITERS 342 -#define TK_DETACH 343 -#define TK_DIVIDE 344 -#define TK_DOT 345 -#define TK_EACH 346 -#define TK_FAIL 347 -#define TK_FILE 348 +#define TK_FILE 126 +#define TK_BOOL 127 +#define TK_TINYINT 128 +#define TK_SMALLINT 129 +#define TK_INT 130 +#define TK_INTEGER 131 +#define TK_BIGINT 132 +#define TK_FLOAT 133 +#define TK_DOUBLE 134 +#define TK_BINARY 135 +#define TK_NCHAR 136 +#define TK_UNSIGNED 137 +#define TK_JSON 138 +#define TK_VARCHAR 139 +#define TK_MEDIUMBLOB 140 +#define TK_BLOB 141 +#define TK_VARBINARY 142 +#define TK_GEOMETRY 143 +#define TK_DECIMAL 144 +#define TK_COMMENT 145 +#define TK_MAX_DELAY 146 +#define TK_WATERMARK 147 +#define TK_ROLLUP 148 +#define TK_TTL 149 +#define TK_SMA 150 +#define TK_DELETE_MARK 151 +#define TK_FIRST 152 +#define TK_LAST 153 +#define TK_SHOW 154 +#define TK_FULL 155 +#define TK_PRIVILEGES 156 +#define TK_DATABASES 157 +#define TK_TABLES 158 +#define TK_STABLES 159 +#define TK_MNODES 160 +#define TK_QNODES 161 +#define TK_ARBGROUPS 162 +#define TK_FUNCTIONS 163 +#define TK_INDEXES 164 +#define TK_ACCOUNTS 165 +#define TK_APPS 166 +#define TK_CONNECTIONS 167 +#define TK_LICENCES 168 +#define TK_GRANTS 169 +#define TK_LOGS 170 +#define TK_MACHINES 171 +#define TK_ENCRYPTIONS 172 +#define TK_QUERIES 173 +#define TK_SCORES 174 +#define TK_TOPICS 175 +#define TK_VARIABLES 176 +#define TK_BNODES 177 +#define TK_SNODES 178 +#define TK_TRANSACTIONS 179 +#define TK_DISTRIBUTED 180 +#define TK_CONSUMERS 181 +#define TK_SUBSCRIPTIONS 182 +#define TK_VNODES 183 +#define TK_ALIVE 184 +#define TK_VIEWS 185 +#define TK_VIEW 186 +#define TK_COMPACTS 187 +#define TK_NORMAL 188 +#define TK_CHILD 189 +#define TK_LIKE 190 +#define TK_TBNAME 191 +#define TK_QTAGS 192 +#define TK_AS 193 +#define TK_SYSTEM 194 +#define TK_TSMA 195 +#define TK_INTERVAL 196 +#define TK_RECURSIVE 197 +#define TK_TSMAS 198 +#define TK_FUNCTION 199 +#define TK_INDEX 200 +#define TK_COUNT 201 +#define TK_LAST_ROW 202 +#define TK_META 203 +#define TK_ONLY 204 +#define TK_TOPIC 205 +#define TK_CONSUMER 206 +#define TK_GROUP 207 +#define TK_DESC 208 +#define TK_DESCRIBE 209 +#define TK_RESET 210 +#define TK_QUERY 211 +#define TK_CACHE 212 +#define TK_EXPLAIN 213 +#define TK_ANALYZE 214 +#define TK_VERBOSE 215 +#define TK_NK_BOOL 216 +#define TK_RATIO 217 +#define TK_NK_FLOAT 218 +#define TK_OUTPUTTYPE 219 +#define TK_AGGREGATE 220 +#define TK_BUFSIZE 221 +#define TK_LANGUAGE 222 +#define TK_REPLACE 223 +#define TK_STREAM 224 +#define TK_INTO 225 +#define TK_PAUSE 226 +#define TK_RESUME 227 +#define TK_PRIMARY 228 +#define TK_KEY 229 +#define TK_TRIGGER 230 +#define TK_AT_ONCE 231 +#define TK_WINDOW_CLOSE 232 +#define TK_IGNORE 233 +#define TK_EXPIRED 234 +#define TK_FILL_HISTORY 235 +#define TK_UPDATE 236 +#define TK_SUBTABLE 237 +#define TK_UNTREATED 238 +#define TK_KILL 239 +#define TK_CONNECTION 240 +#define TK_TRANSACTION 241 +#define TK_BALANCE 242 +#define TK_VGROUP 243 +#define TK_LEADER 244 +#define TK_MERGE 245 +#define TK_REDISTRIBUTE 246 +#define TK_SPLIT 247 +#define TK_DELETE 248 +#define TK_INSERT 249 +#define TK_NK_BIN 250 +#define TK_NK_HEX 251 +#define TK_NULL 252 +#define TK_NK_QUESTION 253 +#define TK_NK_ALIAS 254 +#define TK_NK_ARROW 255 +#define TK_ROWTS 256 +#define TK_QSTART 257 +#define TK_QEND 258 +#define TK_QDURATION 259 +#define TK_WSTART 260 +#define TK_WEND 261 +#define TK_WDURATION 262 +#define TK_IROWTS 263 +#define TK_ISFILLED 264 +#define TK_CAST 265 +#define TK_NOW 266 +#define TK_TODAY 267 +#define TK_TIMEZONE 268 +#define TK_CLIENT_VERSION 269 +#define TK_SERVER_VERSION 270 +#define TK_SERVER_STATUS 271 +#define TK_CURRENT_USER 272 +#define TK_CASE 273 +#define TK_WHEN 274 +#define TK_THEN 275 +#define TK_ELSE 276 +#define TK_BETWEEN 277 +#define TK_IS 278 +#define TK_NK_LT 279 +#define TK_NK_GT 280 +#define TK_NK_LE 281 +#define TK_NK_GE 282 +#define TK_NK_NE 283 +#define TK_MATCH 284 +#define TK_NMATCH 285 +#define TK_CONTAINS 286 +#define TK_IN 287 +#define TK_JOIN 288 +#define TK_INNER 289 +#define TK_LEFT 290 +#define TK_RIGHT 291 +#define TK_OUTER 292 +#define TK_SEMI 293 +#define TK_ANTI 294 +#define TK_ASOF 295 +#define TK_WINDOW 296 +#define TK_WINDOW_OFFSET 297 +#define TK_JLIMIT 298 +#define TK_SELECT 299 +#define TK_NK_HINT 300 +#define TK_DISTINCT 301 +#define TK_WHERE 302 +#define TK_PARTITION 303 +#define TK_BY 304 +#define TK_SESSION 305 +#define TK_STATE_WINDOW 306 +#define TK_EVENT_WINDOW 307 +#define TK_COUNT_WINDOW 308 +#define TK_SLIDING 309 +#define TK_FILL 310 +#define TK_VALUE 311 +#define TK_VALUE_F 312 +#define TK_NONE 313 +#define TK_PREV 314 +#define TK_NULL_F 315 +#define TK_LINEAR 316 +#define TK_NEXT 317 +#define TK_HAVING 318 +#define TK_RANGE 319 +#define TK_EVERY 320 +#define TK_ORDER 321 +#define TK_SLIMIT 322 +#define TK_SOFFSET 323 +#define TK_LIMIT 324 +#define TK_OFFSET 325 +#define TK_ASC 326 +#define TK_NULLS 327 +#define TK_ABORT 328 +#define TK_AFTER 329 +#define TK_ATTACH 330 +#define TK_BEFORE 331 +#define TK_BEGIN 332 +#define TK_BITAND 333 +#define TK_BITNOT 334 +#define TK_BITOR 335 +#define TK_BLOCKS 336 +#define TK_CHANGE 337 +#define TK_COMMA 338 +#define TK_CONCAT 339 +#define TK_CONFLICT 340 +#define TK_COPY 341 +#define TK_DEFERRED 342 +#define TK_DELIMITERS 343 +#define TK_DETACH 344 +#define TK_DIVIDE 345 +#define TK_DOT 346 +#define TK_EACH 347 +#define TK_FAIL 348 #define TK_FOR 349 #define TK_GLOB 350 #define TK_ID 351 diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index 90cc4ac157..3f1cf74cfa 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -206,7 +206,7 @@ int32_t catalogInit(SCatalogCfg* cfg); * @param catalogHandle (output, NO need to free it) * @return error code */ -int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle); +int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle); int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum, int64_t* stateTs); diff --git a/include/libs/monitor/clientMonitor.h b/include/libs/monitor/clientMonitor.h index 9c0302a15f..68b55e71a9 100644 --- a/include/libs/monitor/clientMonitor.h +++ b/include/libs/monitor/clientMonitor.h @@ -23,6 +23,7 @@ extern "C" { #include "taos_monitor.h" #include "thash.h" #include "query.h" +#include "tqueue.h" typedef enum SQL_RESULT_CODE { SQL_RESULT_SUCCESS = 0, @@ -30,24 +31,36 @@ typedef enum SQL_RESULT_CODE { SQL_RESULT_CANCEL = 2, } SQL_RESULT_CODE; -const char* resultStr(SQL_RESULT_CODE code); +#define SLOW_LOG_SEND_SIZE 32*1024 typedef struct { - char clusterKey[512]; - SEpSet epSet; - void* pTransporter; + int64_t clusterId; taos_collector_registry_t* registry; taos_collector_t* colector; SHashObj* counters; -} ClientMonitor; + void* timer; +} MonitorClient; -void clusterMonitorInit(const char* clusterKey, SEpSet epSet, void* pTransporter); -void clusterMonitorClose(const char* clusterKey); -taos_counter_t* createClusterCounter(const char* clusterKey, const char* name, const char* help, size_t label_key_count, - const char** label_keys); -int taosClusterCounterInc(const char* clusterKey, const char* counterName, const char** label_values); -void cluster_monitor_stop(); +typedef struct { + TdFilePtr pFile; + void* timer; +} SlowLogClient; +typedef struct { + int64_t clusterId; + char *value; +} MonitorSlowLogData; + +void monitorClose(); +void monitorInit(); + +void monitorClientSQLReqInit(int64_t clusterKey); +void monitorClientSlowQueryInit(int64_t clusterId); +void monitorCreateClient(int64_t clusterId); +void monitorCreateClientCounter(int64_t clusterId, const char* name, const char* help, size_t label_key_count, const char** label_keys); +void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values); +const char* monitorResultStr(SQL_RESULT_CODE code); +int32_t monitorPutData2MonitorQueue(int64_t clusterId, char* value); #ifdef __cplusplus } #endif diff --git a/include/libs/monitor/monitor.h b/include/libs/monitor/monitor.h index 256be26999..9d7878ecf7 100644 --- a/include/libs/monitor/monitor.h +++ b/include/libs/monitor/monitor.h @@ -227,7 +227,7 @@ void monSetSmInfo(SMonSmInfo *pInfo); void monSetBmInfo(SMonBmInfo *pInfo); void monGenAndSendReport(); void monGenAndSendReportBasic(); -void monSendContent(char *pCont); +void monSendContent(char *pCont, const char* uri); void tFreeSMonMmInfo(SMonMmInfo *pInfo); void tFreeSMonVmInfo(SMonVmInfo *pInfo); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e2337dc6da..f97240a167 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -214,6 +214,18 @@ typedef struct SCreateSubTableClause { STableOptions* pOptions; } SCreateSubTableClause; +typedef struct SCreateSubTableFromFileClause { + ENodeType type; + char useDbName[TSDB_DB_NAME_LEN]; + char useTableName[TSDB_TABLE_NAME_LEN]; + bool ignoreExists; + SNodeList* pSpecificTags; + char filePath[PATH_MAX]; + TdFilePtr fp; + SArray* aCreateTbData; + SArray* aTagIndexs; +} SCreateSubTableFromFileClause; + typedef struct SCreateMultiTablesStmt { ENodeType type; SNodeList* pSubTables; diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 4c4505544b..ad41b9a542 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -101,6 +101,7 @@ typedef struct SParseContext { int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery); bool qIsInsertValuesSql(const char* pStr, size_t length); +bool qParseDbName(const char* pStr, size_t length, char** pDbName); // for async mode int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq); diff --git a/include/libs/stream/streammsg.h b/include/libs/stream/streammsg.h index 723c9fd099..5f6f93a4ff 100644 --- a/include/libs/stream/streammsg.h +++ b/include/libs/stream/streammsg.h @@ -182,12 +182,12 @@ typedef struct SRetrieveChkptTriggerReq { } SRetrieveChkptTriggerReq; typedef struct SCheckpointTriggerRsp { - int64_t streamId; - int64_t checkpointId; - int32_t upstreamTaskId; - int32_t taskId; - int32_t transId; - int32_t rspCode; + int64_t streamId; + int64_t checkpointId; + int32_t upstreamTaskId; + int32_t taskId; + int32_t transId; + int32_t rspCode; } SCheckpointTriggerRsp; typedef struct SCheckpointReport { diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index bf223e8c28..d35b17126d 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -18,13 +18,13 @@ #include "os.h" #include "streamState.h" +#include "streammsg.h" #include "tdatablock.h" #include "tdbInt.h" #include "tmsg.h" #include "tmsgcb.h" #include "tqueue.h" #include "ttimer.h" -#include "streammsg.h" #ifdef __cplusplus extern "C" { @@ -265,14 +265,14 @@ typedef struct SStreamTaskId { } SStreamTaskId; typedef struct SCheckpointInfo { - int64_t startTs; - int64_t checkpointId; // latest checkpoint id - int64_t checkpointVer; // latest checkpoint offset in wal - int64_t checkpointTime; // latest checkpoint time - int64_t processedVer; - int64_t nextProcessVer; // current offset in WAL, not serialize it + int64_t startTs; + int64_t checkpointId; // latest checkpoint id + int64_t checkpointVer; // latest checkpoint offset in wal + int64_t checkpointTime; // latest checkpoint time + int64_t processedVer; + int64_t nextProcessVer; // current offset in WAL, not serialize it SActiveCheckpointInfo* pActiveInfo; - int64_t msgVer; + int64_t msgVer; } SCheckpointInfo; typedef struct SStreamStatus { @@ -301,7 +301,7 @@ typedef struct SSTaskBasicInfo { int32_t selfChildId; int32_t totalLevel; int8_t taskLevel; - int8_t fillHistory; // is fill history task or not + int8_t fillHistory; // is fill history task or not int64_t delaySchedParam; // in msec } SSTaskBasicInfo; @@ -323,7 +323,7 @@ typedef struct SDispatchMsgInfo { void* pRetryTmr; // used to dispatch data after a given time duration TdThreadMutex lock; int8_t inMonitor; - SArray* pSendInfo; // SArray + SArray* pSendInfo; // SArray } SDispatchMsgInfo; typedef struct STaskQueue { @@ -345,11 +345,11 @@ typedef struct SSinkRecorder { } SSinkRecorder; typedef struct STaskExecStatisInfo { - int64_t created; - int64_t checkTs; - int64_t readyTs; - int64_t startCheckpointId; - int64_t startCheckpointVer; + int64_t created; + int64_t checkTs; + int64_t readyTs; + int64_t startCheckpointId; + int64_t startCheckpointVer; int64_t step1Start; double step1El; @@ -432,25 +432,25 @@ struct SStreamTask { SCheckpointInfo chkInfo; STaskExec exec; SDataRange dataRange; - SVersionRange step2Range; // version range used to scan wal, information in dataRange should not modified. + SVersionRange step2Range; // version range used to scan wal, information in dataRange should not modified. SHistoryTaskInfo hTaskInfo; STaskId streamTaskId; STaskExecStatisInfo execInfo; - TdThreadMutex lock; // secure the operation of set task status and puting data into inputQ - SMsgCb* pMsgCb; // msg handle - SStreamState* pState; // state backend + TdThreadMutex lock; // secure the operation of set task status and puting data into inputQ + SMsgCb* pMsgCb; // msg handle + SStreamState* pState; // state backend SUpstreamInfo upstreamInfo; STaskCheckInfo taskCheckInfo; // the followings attributes don't be serialized SScanhistorySchedInfo schedHistoryInfo; - int32_t refCnt; - int32_t transferStateAlignCnt; - struct SStreamMeta* pMeta; - SSHashObj* pNameMap; - void* pBackend; - int8_t subtableWithoutMd5; - char reserve[256]; + int32_t refCnt; + int32_t transferStateAlignCnt; + struct SStreamMeta* pMeta; + SSHashObj* pNameMap; + void* pBackend; + int8_t subtableWithoutMd5; + char reserve[256]; }; typedef int32_t (*startComplete_fn_t)(struct SStreamMeta*); @@ -459,7 +459,7 @@ typedef struct STaskStartInfo { int64_t startTs; int64_t readyTs; int32_t tasksWillRestart; - int32_t startAllTasks; // restart flag, sentinel to guard the restart procedure. + int32_t startAllTasks; // restart flag, sentinel to guard the restart procedure. SHashObj* pReadyTaskSet; // tasks that are all ready for running stream processing SHashObj* pFailedTaskSet; // tasks that are done the check downstream process, may be successful or failed int64_t elapsedTime; @@ -512,7 +512,7 @@ typedef struct SStreamMeta { SArray* chkpSaved; SArray* chkpInUse; SRWLatch chkpDirLock; - void* qHandle; // todo remove it + void* qHandle; // todo remove it void* bkdChkptMgt; } SStreamMeta; @@ -567,14 +567,14 @@ typedef struct { } SStreamScanHistoryReq; typedef struct STaskCkptInfo { - int64_t latestId; // saved checkpoint id - int64_t latestVer; // saved checkpoint ver - int64_t latestTime; // latest checkpoint time - int64_t latestSize; // latest checkpoint size - int8_t remoteBackup; // latest checkpoint backup done - int64_t activeId; // current active checkpoint id - int32_t activeTransId; // checkpoint trans id - int8_t failed; // denote if the checkpoint is failed or not + int64_t latestId; // saved checkpoint id + int64_t latestVer; // saved checkpoint ver + int64_t latestTime; // latest checkpoint time + int64_t latestSize; // latest checkpoint size + int8_t remoteBackup; // latest checkpoint backup done + int64_t activeId; // current active checkpoint id + int32_t activeTransId; // checkpoint trans id + int8_t failed; // denote if the checkpoint is failed or not } STaskCkptInfo; typedef struct STaskStatusEntry { @@ -589,12 +589,12 @@ typedef struct STaskStatusEntry { int64_t inputQUnchangeCounter; double inputQUsed; // in MiB double inputRate; - double procsThroughput; // duration between one element put into input queue and being processed. - double procsTotal; // duration between one element put into input queue and being processed. - double outputThroughput; // the size of dispatched result blocks in bytes - double outputTotal; // the size of dispatched result blocks in bytes - double sinkQuota; // existed quota size for sink task - double sinkDataSize; // sink to dst data size + double procsThroughput; // duration between one element put into input queue and being processed. + double procsTotal; // duration between one element put into input queue and being processed. + double outputThroughput; // the size of dispatched result blocks in bytes + double outputTotal; // the size of dispatched result blocks in bytes + double sinkQuota; // existed quota size for sink task + double sinkDataSize; // sink to dst data size int64_t startTime; int64_t startCheckpointId; int64_t startCheckpointVer; @@ -622,12 +622,12 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i SStreamUpstreamEpInfo* streamTaskGetUpstreamTaskEpInfo(SStreamTask* pTask, int32_t taskId); SEpSet* streamTaskGetDownstreamEpInfo(SStreamTask* pTask, int32_t taskId); -void streamTaskInputFail(SStreamTask* pTask); +void streamTaskInputFail(SStreamTask* pTask); -bool streamTaskShouldStop(const SStreamTask* pStatus); -bool streamTaskShouldPause(const SStreamTask* pStatus); -bool streamTaskIsIdle(const SStreamTask* pTask); -bool streamTaskReadyToRun(const SStreamTask* pTask, char** pStatus); +bool streamTaskShouldStop(const SStreamTask* pStatus); +bool streamTaskShouldPause(const SStreamTask* pStatus); +bool streamTaskIsIdle(const SStreamTask* pTask); +bool streamTaskReadyToRun(const SStreamTask* pTask, char** pStatus); char* createStreamTaskIdStr(int64_t streamId, int32_t taskId); SStreamTaskState* streamTaskGetStatus(const SStreamTask* pTask); @@ -636,8 +636,8 @@ void streamTaskResetStatus(SStreamTask* pTask); void streamTaskSetStatusReady(SStreamTask* pTask); ETaskStatus streamTaskGetPrevStatus(const SStreamTask* pTask); -bool streamTaskUpdateEpsetInfo(SStreamTask* pTask, SArray* pNodeList); -void streamTaskResetUpstreamStageInfo(SStreamTask* pTask); +bool streamTaskUpdateEpsetInfo(SStreamTask* pTask, SArray* pNodeList); +void streamTaskResetUpstreamStageInfo(SStreamTask* pTask); // stream task sched bool streamTaskIsAllUpstreamClosed(SStreamTask* pTask); @@ -737,10 +737,10 @@ int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int32_t streamMetaResetTaskStatus(SStreamMeta* pMeta); int32_t streamMetaAddFailedTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId); void streamMetaAddFailedTaskSelf(SStreamTask* pTask, int64_t failedTs); -void streamMetaAddIntoUpdateTaskList(SStreamMeta* pMeta, SStreamTask* pTask, SStreamTask* pHTask, int32_t transId, - int64_t startTs); -void streamMetaClearUpdateTaskList(SStreamMeta* pMeta); -void streamMetaInitUpdateTaskList(SStreamMeta* pMeta, int32_t transId); +void streamMetaAddIntoUpdateTaskList(SStreamMeta* pMeta, SStreamTask* pTask, SStreamTask* pHTask, int32_t transId, + int64_t startTs); +void streamMetaClearUpdateTaskList(SStreamMeta* pMeta); +void streamMetaInitUpdateTaskList(SStreamMeta* pMeta, int32_t transId); void streamMetaRLock(SStreamMeta* pMeta); void streamMetaRUnLock(SStreamMeta* pMeta); @@ -756,12 +756,13 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas bool streamMetaAllTasksReady(const SStreamMeta* pMeta); // timer -tmr_h streamTimerGetInstance(); +tmr_h streamTimerGetInstance(); // checkpoint int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSourceReq* pReq); int32_t streamTaskProcessCheckpointTriggerRsp(SStreamTask* pTask, SCheckpointTriggerRsp* pRsp); -int32_t streamProcessCheckpointReadyMsg(SStreamTask* pTask, int64_t checkpointId, int32_t downstreamNodeId, int32_t downstreamTaskId); +int32_t streamProcessCheckpointReadyMsg(SStreamTask* pTask, int64_t checkpointId, int32_t downstreamNodeId, + int32_t downstreamTaskId); int32_t streamTaskProcessCheckpointReadyRsp(SStreamTask* pTask, int32_t upstreamTaskId, int64_t checkpointId); int32_t streamTaskBuildCheckpoint(SStreamTask* pTask); void streamTaskClearCheckInfo(SStreamTask* pTask, bool clearChkpReadyMsg); @@ -786,8 +787,8 @@ int32_t streamTaskRestoreStatus(SStreamTask* pTask); // stream task retrieve related API int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq); -int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq *req); -void streamTaskSendRetrieveRsp(SStreamRetrieveReq *pReq, SRpcMsg* pRsp); +int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* req); +void streamTaskSendRetrieveRsp(SStreamRetrieveReq* pReq, SRpcMsg* pRsp); #ifdef __cplusplus } diff --git a/include/os/osFile.h b/include/os/osFile.h index 9c9027e931..4c56244278 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -72,6 +72,9 @@ TdFilePtr taosCreateFile(const char *path, int32_t tdFileOptions); #define TD_FILE_ACCESS_EXIST_OK 0x1 #define TD_FILE_ACCESS_READ_OK 0x2 #define TD_FILE_ACCESS_WRITE_OK 0x4 + +#define TD_TMP_FILE_PREFIX "tdengine-" + bool taosCheckAccessFile(const char *pathname, int mode); int32_t taosLockFile(TdFilePtr pFile); diff --git a/include/util/taoserror.h b/include/util/taoserror.h index cd78d9308d..ba49ef929e 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -388,6 +388,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED TAOS_DEF_ERROR_CODE(0, 0x03D6) //internal #define TSDB_CODE_MND_TRANS_SYNC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x03D7) #define TSDB_CODE_MND_TRANS_CTX_SWITCH TAOS_DEF_ERROR_CODE(0, 0x03D8) +#define TSDB_CODE_MND_TRANS_CONFLICT_COMPACT TAOS_DEF_ERROR_CODE(0, 0x03D9) #define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03DF) // mnode-mq @@ -457,6 +458,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_DNODE_INVALID_LOCALE TAOS_DEF_ERROR_CODE(0, 0x0426) #define TSDB_CODE_DNODE_INVALID_TTL_CHG_ON_WR TAOS_DEF_ERROR_CODE(0, 0x0427) #define TSDB_CODE_DNODE_INVALID_EN_WHITELIST TAOS_DEF_ERROR_CODE(0, 0x0428) +#define TSDB_CODE_DNODE_INVALID_MONITOR_PARAS TAOS_DEF_ERROR_CODE(0, 0x0429) // mnode-sma #define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480) @@ -827,6 +829,9 @@ int32_t taosGetErrSize(); #define TSDB_CODE_PAR_INVALID_PK_OP TAOS_DEF_ERROR_CODE(0, 0x267A) #define TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x267B) #define TSDB_CODE_PAR_PRIMARY_KEY_IS_NONE TAOS_DEF_ERROR_CODE(0, 0x267C) +#define TSDB_CODE_PAR_TBNAME_ERROR TAOS_DEF_ERROR_CODE(0, 0x267D) +#define TSDB_CODE_PAR_TBNAME_DUPLICATED TAOS_DEF_ERROR_CODE(0, 0x267E) +#define TSDB_CODE_PAR_TAG_NAME_DUPLICATED TAOS_DEF_ERROR_CODE(0, 0x267F) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/include/util/tdef.h b/include/util/tdef.h index 9e61ec8fe6..9c2858ed30 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -573,7 +573,7 @@ enum { #define TSDB_CONFIG_OPTION_LEN 32 #define TSDB_CONFIG_VALUE_LEN 64 #define TSDB_CONFIG_SCOPE_LEN 8 -#define TSDB_CONFIG_NUMBER 8 +#define TSDB_CONFIG_NUMBER 16 #define QUERY_ID_SIZE 20 #define QUERY_OBJ_ID_SIZE 18 diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 2fbf4eeabb..7a84215e12 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -115,10 +115,11 @@ struct SAppInstInfo { SArray* pQnodeList; SAppClusterSummary summary; SList* pConnList; // STscObj linked list - uint64_t clusterId; + int64_t clusterId; void* pTransporter; SAppHbMgr* pAppHbMgr; char* instKey; + SMonitorParas monitorParas; }; typedef struct SAppInfo { @@ -127,6 +128,7 @@ typedef struct SAppInfo { int32_t pid; int32_t numOfThreads; SHashObj* pInstMap; + SHashObj* pInstMapByClusterId; TdThreadMutex mutex; } SAppInfo; @@ -350,7 +352,7 @@ void* createTscObj(const char* user, const char* auth, const char* db, int32_ void destroyTscObj(void* pObj); STscObj* acquireTscObj(int64_t rid); int32_t releaseTscObj(int64_t rid); -void destroyAppInst(SAppInstInfo* pAppInfo); +void destroyAppInst(void* pAppInfo); uint64_t generateRequestId(); @@ -403,7 +405,7 @@ void hbRemoveAppHbMrg(SAppHbMgr** pAppHbMgr); void destroyAllRequests(SHashObj* pRequests); void stopAllRequests(SHashObj* pRequests); -SAppInstInfo* getAppInstInfo(const char* clusterKey); +//SAppInstInfo* getAppInstInfo(const char* clusterKey); // conn level int hbRegisterConn(SAppHbMgr* pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType); @@ -441,10 +443,8 @@ void freeQueryParam(SSyncQueryParam* param); int32_t clientParseSqlImpl(void* param, const char* dbName, const char* sql, bool parseOnly, const char* effeciveUser, SParseSqlRes* pRes); #endif -void clientSlowQueryMonitorInit(const char* clusterKey); -void SlowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost); -void clientSQLReqMonitorInit(const char* clusterKey); +void slowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost); enum { MONITORSQLTYPESELECT = 0, @@ -454,8 +454,6 @@ enum { void sqlReqLog(int64_t rid, bool killed, int32_t code, int8_t type); -void clientMonitorClose(const char* clusterKey); - #ifdef __cplusplus } #endif diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h index 64b2acf732..68765ee47a 100644 --- a/source/client/inc/clientStmt.h +++ b/source/client/inc/clientStmt.h @@ -219,6 +219,7 @@ const char *stmtErrstr(TAOS_STMT *stmt); int stmtAffectedRows(TAOS_STMT *stmt); int stmtAffectedRowsOnce(TAOS_STMT *stmt); int stmtPrepare(TAOS_STMT *stmt, const char *sql, unsigned long length); +int stmtSetDbName(TAOS_STMT* stmt, const char* dbName); int stmtSetTbName(TAOS_STMT *stmt, const char *tbName); int stmtSetTbTags(TAOS_STMT *stmt, TAOS_MULTI_BIND *tags); int stmtGetTagFields(TAOS_STMT *stmt, int *nums, TAOS_FIELD_E **fields); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 23b9649c6b..af396876bb 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -13,9 +13,12 @@ * along with this program. If not, see . */ +#include +#include "cJSON.h" #include "catalog.h" #include "clientInt.h" #include "clientLog.h" +#include "clientMonitor.h" #include "functionMgt.h" #include "os.h" #include "osSleep.h" @@ -26,6 +29,7 @@ #include "tglobal.h" #include "thttp.h" #include "tmsg.h" +#include "tqueue.h" #include "tref.h" #include "trpc.h" #include "tsched.h" @@ -70,6 +74,114 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) { return TSDB_CODE_SUCCESS; } +static void concatStrings(SArray *list, char* buf, int size){ + int len = 0; + for(int i = 0; i < taosArrayGetSize(list); i++){ + char* db = taosArrayGet(list, i); + char* dot = strchr(db, '.'); + if (dot != NULL) { + db = dot + 1; + } + if (i != 0){ + strcat(buf, ","); + len += 1; + } + int ret = snprintf(buf + len, size - len, "%s", db); + if (ret < 0) { + tscError("snprintf failed, buf:%s, ret:%d", buf, ret); + break; + } + len += ret; + if (len >= size){ + tscInfo("dbList is truncated, buf:%s, len:%d", buf, len); + break; + } + } +} + +static void generateWriteSlowLog(STscObj *pTscObj, SRequestObj *pRequest, int32_t reqType, int64_t duration){ + cJSON* json = cJSON_CreateObject(); + if (json == NULL) { + tscError("[monitor] cJSON_CreateObject failed"); + return; + } + char clusterId[32] = {0}; + if (snprintf(clusterId, sizeof(clusterId), "%" PRId64, pTscObj->pAppInfo->clusterId) < 0){ + tscError("failed to generate clusterId:%" PRId64, pTscObj->pAppInfo->clusterId); + } + + char startTs[32] = {0}; + if (snprintf(startTs, sizeof(startTs), "%" PRId64, pRequest->metric.start/1000) < 0){ + tscError("failed to generate startTs:%" PRId64, pRequest->metric.start/1000); + } + + char requestId[32] = {0}; + if (snprintf(requestId, sizeof(requestId), "%" PRIu64, pRequest->requestId) < 0){ + tscError("failed to generate requestId:%" PRIu64, pRequest->requestId); + } + cJSON_AddItemToObject(json, "cluster_id", cJSON_CreateString(clusterId)); + cJSON_AddItemToObject(json, "start_ts", cJSON_CreateString(startTs)); + cJSON_AddItemToObject(json, "request_id", cJSON_CreateString(requestId)); + cJSON_AddItemToObject(json, "query_time", cJSON_CreateNumber(duration/1000)); + cJSON_AddItemToObject(json, "code", cJSON_CreateNumber(pRequest->code)); + cJSON_AddItemToObject(json, "error_info", cJSON_CreateString(tstrerror(pRequest->code))); + cJSON_AddItemToObject(json, "type", cJSON_CreateNumber(reqType)); + cJSON_AddItemToObject(json, "rows_num", cJSON_CreateNumber(pRequest->body.resInfo.numOfRows + pRequest->body.resInfo.totalRows)); + if(strlen(pRequest->sqlstr) > pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen){ + char tmp = pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen]; + pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen] = '\0'; + cJSON_AddItemToObject(json, "sql", cJSON_CreateString(pRequest->sqlstr)); + pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen] = tmp; + }else{ + cJSON_AddItemToObject(json, "sql", cJSON_CreateString(pRequest->sqlstr)); + } + + cJSON_AddItemToObject(json, "user", cJSON_CreateString(pTscObj->user)); + cJSON_AddItemToObject(json, "process_name", cJSON_CreateString(appInfo.appName)); + cJSON_AddItemToObject(json, "ip", cJSON_CreateString(tsLocalFqdn)); + + char pid[32] = {0}; + if (snprintf(pid, sizeof(pid), "%d", appInfo.pid) < 0){ + tscError("failed to generate pid:%d", appInfo.pid); + } + + cJSON_AddItemToObject(json, "process_id", cJSON_CreateString(pid)); + if(pRequest->dbList != NULL){ + char dbList[1024] = {0}; + concatStrings(pRequest->dbList, dbList, sizeof(dbList) - 1); + cJSON_AddItemToObject(json, "db", cJSON_CreateString(dbList)); + }else if(pRequest->pDb != NULL){ + cJSON_AddItemToObject(json, "db", cJSON_CreateString(pRequest->pDb)); + }else{ + cJSON_AddItemToObject(json, "db", cJSON_CreateString("")); + } + + char* value = cJSON_PrintUnformatted(json); + if(monitorPutData2MonitorQueue(pTscObj->pAppInfo->clusterId, value) < 0){ + taosMemoryFree(value); + } + + cJSON_Delete(json); +} + +static bool checkSlowLogExceptDb(SRequestObj *pRequest, char* exceptDb) { + if (pRequest->pDb != NULL) { + return strcmp(pRequest->pDb, exceptDb) != 0; + } + + for (int i = 0; i < taosArrayGetSize(pRequest->dbList); i++) { + char *db = taosArrayGet(pRequest->dbList, i); + char *dot = strchr(db, '.'); + if (dot != NULL) { + db = dot + 1; + } + if(strcmp(db, exceptDb) == 0){ + return false; + } + } + return true; +} + static void deregisterRequest(SRequestObj *pRequest) { if (pRequest == NULL) { tscError("pRequest == NULL"); @@ -113,21 +225,27 @@ static void deregisterRequest(SRequestObj *pRequest) { nodesSimReleaseAllocator(pRequest->allocatorRefId); } - if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->stmtType || QUERY_NODE_INSERT_STMT == pRequest->stmtType) { - sqlReqLog(pTscObj->id, pRequest->killed, pRequest->code, MONITORSQLTYPEINSERT); - } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { - sqlReqLog(pTscObj->id, pRequest->killed, pRequest->code, MONITORSQLTYPESELECT); - } else if (QUERY_NODE_DELETE_STMT == pRequest->stmtType) { - sqlReqLog(pTscObj->id, pRequest->killed, pRequest->code, MONITORSQLTYPEDELETE); + if(pTscObj->pAppInfo->monitorParas.tsEnableMonitor){ + if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->stmtType || QUERY_NODE_INSERT_STMT == pRequest->stmtType) { + sqlReqLog(pTscObj->id, pRequest->killed, pRequest->code, MONITORSQLTYPEINSERT); + } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { + sqlReqLog(pTscObj->id, pRequest->killed, pRequest->code, MONITORSQLTYPESELECT); + } else if (QUERY_NODE_DELETE_STMT == pRequest->stmtType) { + sqlReqLog(pTscObj->id, pRequest->killed, pRequest->code, MONITORSQLTYPEDELETE); + } } - if (duration >= (tsSlowLogThreshold * 1000000UL)) { + if ((duration >= pTscObj->pAppInfo->monitorParas.tsSlowLogThreshold * 1000000UL || duration >= pTscObj->pAppInfo->monitorParas.tsSlowLogThresholdTest * 1000000UL) && + checkSlowLogExceptDb(pRequest, pTscObj->pAppInfo->monitorParas.tsSlowLogExceptDb)) { atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1); - if (tsSlowLogScope & reqType) { - taosPrintSlowLog("PID:%d, Conn:%u, QID:0x%" PRIx64 ", Start:%" PRId64 ", Duration:%" PRId64 "us, SQL:%s", + if (pTscObj->pAppInfo->monitorParas.tsSlowLogScope & reqType) { + taosPrintSlowLog("PID:%d, Conn:%u, QID:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s", taosGetPId(), pTscObj->connId, pRequest->requestId, pRequest->metric.start, duration, pRequest->sqlstr); - SlowQueryLog(pTscObj->id, pRequest->killed, pRequest->code, duration); + if(pTscObj->pAppInfo->monitorParas.tsEnableMonitor){ + slowQueryLog(pTscObj->id, pRequest->killed, pRequest->code, duration); + generateWriteSlowLog(pTscObj, pRequest, reqType, duration); + } } } @@ -233,14 +351,13 @@ void stopAllRequests(SHashObj *pRequests) { } } -void destroyAppInst(SAppInstInfo *pAppInfo) { +void destroyAppInst(void *info) { + SAppInstInfo* pAppInfo = *(SAppInstInfo**)info; tscDebug("destroy app inst mgr %p", pAppInfo); taosThreadMutexLock(&appInfo.mutex); - clientMonitorClose(pAppInfo->instKey); hbRemoveAppHbMrg(&pAppInfo->pAppHbMgr); - taosHashRemove(appInfo.pInstMap, pAppInfo->instKey, strlen(pAppInfo->instKey)); taosThreadMutexUnlock(&appInfo.mutex); @@ -477,13 +594,11 @@ void doDestroyRequest(void *p) { destorySqlCallbackWrapper(pRequest->pWrapper); taosMemoryFreeClear(pRequest->msgBuf); - taosMemoryFreeClear(pRequest->pDb); doFreeReqResultInfo(&pRequest->body.resInfo); tsem_destroy(&pRequest->body.rspSem); taosArrayDestroy(pRequest->tableList); - taosArrayDestroy(pRequest->dbList); taosArrayDestroy(pRequest->targetTableList); destroyQueryExecRes(&pRequest->body.resInfo.execRes); @@ -492,6 +607,8 @@ void doDestroyRequest(void *p) { deregisterRequest(pRequest); } + taosMemoryFreeClear(pRequest->pDb); + taosArrayDestroy(pRequest->dbList); if (pRequest->body.interParam) { tsem_destroy(&((SSyncQueryParam *)pRequest->body.interParam)->sem); } @@ -670,7 +787,7 @@ void tscStopCrashReport() { } if (atomic_val_compare_exchange_32(&clientStop, 0, 1)) { - tscDebug("hb thread already stopped"); + tscDebug("crash report thread already stopped"); return; } @@ -719,7 +836,8 @@ void taos_init_imp(void) { appInfo.pid = taosGetPId(); appInfo.startTime = taosGetTimestampMs(); appInfo.pInstMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - + appInfo.pInstMapByClusterId = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_ENTRY_LOCK); + taosHashSetFreeFp(appInfo.pInstMap, destroyAppInst); deltaToUtcInitOnce(); char logDirName[64] = {0}; @@ -769,6 +887,7 @@ void taos_init_imp(void) { taosThreadMutexInit(&appInfo.mutex, NULL); tscCrashReportInit(); + monitorInit(); tscDebug("client is initialized successfully"); } diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 483edcf3f0..19b6655af1 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -18,6 +18,7 @@ #include "clientLog.h" #include "scheduler.h" #include "trpc.h" +#include "tglobal.h" typedef struct { union { @@ -67,7 +68,7 @@ static int32_t hbProcessUserAuthInfoRsp(void *value, int32_t valueLen, struct SC } static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *batchRsp) { - uint64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId; + int64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId; for (int i = 0; i < TARRAY_SIZE(clientHbMgr.appHbMgrs); ++i) { SAppHbMgr *hbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, i); if (!hbMgr || hbMgr->pAppInstInfo->clusterId != clusterId) { @@ -545,6 +546,9 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { } SAppInstInfo *pInst = pAppHbMgr->pAppInstInfo; + pInst->monitorParas = pRsp.monitorParas; + tscDebug("[monitor] paras from hb, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", + pInst->clusterId, pRsp.monitorParas.tsSlowLogThreshold, pRsp.monitorParas.tsSlowLogScope); if (code != 0) { pInst->onlineDnodes = pInst->totalDnodes ? 0 : -1; @@ -1129,7 +1133,7 @@ int32_t hbGatherAppInfo(void) { SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, i); if (pAppHbMgr == NULL) continue; - uint64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId; + int64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId; SAppHbReq *pApp = taosHashGet(clientHbMgr.appSummary, &clusterId, sizeof(clusterId)); if (NULL == pApp) { memcpy(&req.summary, &pAppHbMgr->pAppInstInfo->summary, sizeof(req.summary)); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 1057a00725..11d3797157 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -147,7 +147,7 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas } p->pAppHbMgr = appHbMgrInit(p, key); if (NULL == p->pAppHbMgr) { - destroyAppInst(p); + destroyAppInst(&p); taosThreadMutexUnlock(&appInfo.mutex); taosMemoryFreeClear(key); return NULL; @@ -158,9 +158,6 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas tscDebug("new app inst mgr %p, user:%s, ip:%s, port:%d", p, user, epSet.epSet.eps[0].fqdn, epSet.epSet.eps[0].port); pInst = &p; - - clientSlowQueryMonitorInit(p->instKey); - clientSQLReqMonitorInit(p->instKey); } else { ASSERTS((*pInst) && (*pInst)->pAppHbMgr, "*pInst:%p, pAppHgMgr:%p", *pInst, (*pInst) ? (*pInst)->pAppHbMgr : NULL); // reset to 0 in case of conn with duplicated user key but its user has ever been dropped. @@ -174,14 +171,14 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas return taosConnectImpl(user, &secretEncrypt[0], localDb, NULL, NULL, *pInst, connType); } -SAppInstInfo* getAppInstInfo(const char* clusterKey) { - SAppInstInfo** ppAppInstInfo = taosHashGet(appInfo.pInstMap, clusterKey, strlen(clusterKey)); - if (ppAppInstInfo != NULL && *ppAppInstInfo != NULL) { - return *ppAppInstInfo; - } else { - return NULL; - } -} +//SAppInstInfo* getAppInstInfo(const char* clusterKey) { +// SAppInstInfo** ppAppInstInfo = taosHashGet(appInfo.pInstMap, clusterKey, strlen(clusterKey)); +// if (ppAppInstInfo != NULL && *ppAppInstInfo != NULL) { +// return *ppAppInstInfo; +// } else { +// return NULL; +// } +//} void freeQueryParam(SSyncQueryParam* param) { if (param == NULL) return; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 9cbdbfbd25..56f89ffba6 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -17,6 +17,7 @@ #include "clientInt.h" #include "clientLog.h" #include "clientStmt.h" +#include "clientMonitor.h" #include "functionMgt.h" #include "os.h" #include "query.h" @@ -55,6 +56,9 @@ void taos_cleanup(void) { return; } + monitorClose(); + taosHashCleanup(appInfo.pInstMap); + taosHashCleanup(appInfo.pInstMapByClusterId); tscStopCrashReport(); hbMgrCleanUp(); @@ -191,6 +195,7 @@ int32_t fetchWhiteListCallbackFn(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pEpSet); taosMemoryFree(pInfo); tFreeSGetUserWhiteListRsp(&wlRsp); + return TSDB_CODE_OUT_OF_MEMORY; } for (int i = 0; i < wlRsp.numWhiteLists; ++i) { @@ -279,7 +284,6 @@ void taos_close_internal(void *taos) { STscObj *pTscObj = (STscObj *)taos; tscDebug("0x%" PRIx64 " try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs); - // clientMonitorClose(pTscObj->pAppInfo->instKey); taosRemoveRef(clientConnRefPool, pTscObj->id); } diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c new file mode 100644 index 0000000000..9e990dd545 --- /dev/null +++ b/source/client/src/clientMonitor.c @@ -0,0 +1,679 @@ +#include "clientMonitor.h" +#include "os.h" +#include "tmisce.h" +#include "ttime.h" +#include "ttimer.h" +#include "tglobal.h" +#include "tqueue.h" +#include "cJSON.h" +#include "clientInt.h" + +SRWLatch monitorLock; +void* monitorTimer; +SHashObj* monitorCounterHash; +int32_t slowLogFlag = -1; +int32_t monitorFlag = -1; +tsem2_t monitorSem; +STaosQueue* monitorQueue; +SHashObj* monitorSlowLogHash; + +static int32_t getSlowLogTmpDir(char* tmpPath, int32_t size){ + if (tsTempDir == NULL) { + return -1; + } + int ret = snprintf(tmpPath, size, "%s/tdengine_slow_log/", tsTempDir); + if (ret < 0){ + uError("failed to get tmp path ret:%d", ret); + return ret; + } + return 0; +} + +//static void destroyCounter(void* data){ +// if (data == NULL) { +// return; +// } +// taos_counter_t* conuter = *(taos_counter_t**)data; +// if(conuter == NULL){ +// return; +// } +// taos_counter_destroy(conuter); +//} + +static void destroySlowLogClient(void* data){ + if (data == NULL) { + return; + } + SlowLogClient* slowLogClient = *(SlowLogClient**)data; + if(slowLogClient == NULL){ + return; + } + taosTmrStopA(&(*(SlowLogClient**)data)->timer); + + TdFilePtr pFile = slowLogClient->pFile; + if(pFile == NULL){ + taosMemoryFree(slowLogClient); + return; + } + + taosUnLockFile(pFile); + taosCloseFile(&pFile); + taosMemoryFree(slowLogClient); +} + +static void destroyMonitorClient(void* data){ + if (data == NULL) { + return; + } + MonitorClient* pMonitor = *(MonitorClient**)data; + if(pMonitor == NULL){ + return; + } + taosTmrStopA(&pMonitor->timer); + taosHashCleanup(pMonitor->counters); + taos_collector_registry_destroy(pMonitor->registry); +// taos_collector_destroy(pMonitor->colector); + taosMemoryFree(pMonitor); +} + +static SAppInstInfo* getAppInstByClusterId(int64_t clusterId) { + void *p = taosHashGet(appInfo.pInstMapByClusterId, &clusterId, LONG_BYTES); + if(p == NULL){ + uError("failed to get app inst, clusterId:%" PRIx64, clusterId); + return NULL; + } + return *(SAppInstInfo**)p; +} + +static int32_t monitorReportAsyncCB(void* param, SDataBuf* pMsg, int32_t code) { + if (TSDB_CODE_SUCCESS != code) { + uError("found error in monitorReport send callback, code:%d, please check the network.", code); + } + if (pMsg) { + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); + } + return code; +} + +static int32_t sendReport(void* pTransporter, SEpSet *epSet, char* pCont, MONITOR_TYPE type) { + SStatisReq sStatisReq; + sStatisReq.pCont = pCont; + sStatisReq.contLen = strlen(pCont); + sStatisReq.type = type; + + int tlen = tSerializeSStatisReq(NULL, 0, &sStatisReq); + if (tlen < 0) return 0; + void* buf = taosMemoryMalloc(tlen); + if (buf == NULL) { + uError("sendReport failed, out of memory, len:%d", tlen); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + tSerializeSStatisReq(buf, tlen, &sStatisReq); + + SMsgSendInfo* pInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); + if (pInfo == NULL) { + uError("sendReport failed, out of memory send info"); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + pInfo->fp = monitorReportAsyncCB; + pInfo->msgInfo.pData = buf; + pInfo->msgInfo.len = tlen; + pInfo->msgType = TDMT_MND_STATIS; + // pInfo->param = taosMemoryMalloc(sizeof(int32_t)); + // *(int32_t*)pInfo->param = i; + pInfo->paramFreeFp = taosMemoryFree; + pInfo->requestId = tGenIdPI64(); + pInfo->requestObjRefId = 0; + + int64_t transporterId = 0; + int32_t code = asyncSendMsgToServer(pTransporter, epSet, &transporterId, pInfo); + if (code != TSDB_CODE_SUCCESS) { + uError("sendReport failed, code:%d", code); + } + return code; +} + +static void monitorReadSendSlowLog(TdFilePtr pFile, void* pTransporter, SEpSet *epSet){ + char buf[SLOW_LOG_SEND_SIZE + 1] = {0}; // +1 for \0, for print log + char pCont[SLOW_LOG_SEND_SIZE + 1] = {0}; // +1 for \0, for print log + int32_t offset = 0; + if(taosLSeekFile(pFile, 0, SEEK_SET) < 0){ + uError("failed to seek file:%p code: %d", pFile, errno); + return; + } + while(1){ + int64_t readSize = taosReadFile(pFile, buf + offset, SLOW_LOG_SEND_SIZE - offset); + if (readSize <= 0) { + uError("failed to read len from file:%p since %s", pFile, terrstr()); + return; + } + + memset(pCont, 0, sizeof(pCont)); + strcat(pCont, "["); + char* string = buf; + for(int i = 0; i < readSize + offset; i++){ + if (buf[i] == '\0') { + if (string != buf) strcat(pCont, ","); + strcat(pCont, string); + uDebug("[monitor] monitorReadSendSlowLog slow log:%s", string); + string = buf + i + 1; + } + } + strcat(pCont, "]"); + if (pTransporter && pCont != NULL) { + if(sendReport(pTransporter, epSet, pCont, MONITOR_TYPE_SLOW_LOG) != 0){ + if(taosLSeekFile(pFile, -readSize, SEEK_CUR) < 0){ + uError("failed to seek file:%p code: %d", pFile, errno); + } + uError("failed to send report:%s", pCont); + return; + } + uDebug("[monitor] monitorReadSendSlowLog send slow log to mnode:%s", pCont) + } + + if (readSize + offset < SLOW_LOG_SEND_SIZE) { + break; + } + offset = SLOW_LOG_SEND_SIZE - (string - buf); + if(buf != string && offset != 0){ + memmove(buf, string, offset); + uDebug("[monitor] monitorReadSendSlowLog left slow log:%s", buf) + } + } + if(taosFtruncateFile(pFile, 0) < 0){ + uError("failed to truncate file:%p code: %d", pFile, errno); + } + uDebug("[monitor] monitorReadSendSlowLog send slow log file:%p", pFile); +} + +static void generateClusterReport(taos_collector_registry_t* registry, void* pTransporter, SEpSet *epSet) { + char ts[50] = {0}; + sprintf(ts, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI)); + char* pCont = (char*)taos_collector_registry_bridge_new(registry, ts, "%" PRId64, NULL); + if(NULL == pCont) { + uError("generateClusterReport failed, get null content."); + return; + } + + if (strlen(pCont) != 0 && sendReport(pTransporter, epSet, pCont, MONITOR_TYPE_COUNTER) == 0) { + taos_collector_registry_clear_batch(registry); + } + taosMemoryFreeClear(pCont); +} + +static void reportSendProcess(void* param, void* tmrId) { + taosRLockLatch(&monitorLock); + if (atomic_load_32(&monitorFlag) == 1) { + taosRUnLockLatch(&monitorLock); + return; + } + + MonitorClient* pMonitor = (MonitorClient*)param; + SAppInstInfo* pInst = getAppInstByClusterId(pMonitor->clusterId); + if(pInst == NULL){ + taosRUnLockLatch(&monitorLock); + return; + } + + SEpSet ep = getEpSet_s(&pInst->mgmtEp); + generateClusterReport(pMonitor->registry, pInst->pTransporter, &ep); + taosRUnLockLatch(&monitorLock); + taosTmrReset(reportSendProcess, pInst->monitorParas.tsMonitorInterval * 1000, param, monitorTimer, &tmrId); +} + +static void sendAllSlowLog(){ + void* data = taosHashIterate(monitorSlowLogHash, NULL); + while (data != NULL) { + TdFilePtr pFile = (*(SlowLogClient**)data)->pFile; + if (pFile != NULL){ + int64_t clusterId = *(int64_t*)taosHashGetKey(data, NULL); + SAppInstInfo* pInst = getAppInstByClusterId(clusterId); + if(pInst == NULL){ + taosHashCancelIterate(monitorSlowLogHash, data); + break; + } + SEpSet ep = getEpSet_s(&pInst->mgmtEp); + monitorReadSendSlowLog(pFile, pInst->pTransporter, &ep); + } + data = taosHashIterate(monitorSlowLogHash, data); + } + uDebug("[monitor] sendAllSlowLog when client close"); +} + +static void monitorSendAllSlowLogFromTempDir(int64_t clusterId){ + SAppInstInfo* pInst = getAppInstByClusterId((int64_t)clusterId); + + if(pInst == NULL || !pInst->monitorParas.tsEnableMonitor){ + uInfo("[monitor] monitor is disabled, skip send slow log"); + return; + } + char namePrefix[PATH_MAX] = {0}; + if (snprintf(namePrefix, sizeof(namePrefix), "%s%"PRIx64, TD_TMP_FILE_PREFIX, pInst->clusterId) < 0) { + uError("failed to generate slow log file name prefix"); + return; + } + + taosRLockLatch(&monitorLock); + + char tmpPath[PATH_MAX] = {0}; + if (getSlowLogTmpDir(tmpPath, sizeof(tmpPath)) < 0) { + goto END; + } + + TdDirPtr pDir = taosOpenDir(tmpPath); + if (pDir == NULL) { + goto END; + } + + TdDirEntryPtr de = NULL; + while ((de = taosReadDir(pDir)) != NULL) { + if (taosDirEntryIsDir(de)) { + continue; + } + + char *name = taosGetDirEntryName(de); + if (strcmp(name, ".") == 0 || + strcmp(name, "..") == 0 || + strstr(name, namePrefix) == NULL) { + uInfo("skip file:%s, for cluster id:%"PRIx64, name, pInst->clusterId); + continue; + } + + char filename[PATH_MAX] = {0}; + snprintf(filename, sizeof(filename), "%s%s", tmpPath, name); + TdFilePtr pFile = taosOpenFile(filename, TD_FILE_READ); + if (pFile == NULL) { + uError("failed to open file:%s since %s", filename, terrstr()); + continue; + } + if (taosLockFile(pFile) < 0) { + uError("failed to lock file:%s since %s, maybe used by other process", filename, terrstr()); + taosCloseFile(&pFile); + continue; + } + SEpSet ep = getEpSet_s(&pInst->mgmtEp); + monitorReadSendSlowLog(pFile, pInst->pTransporter, &ep); + taosUnLockFile(pFile); + taosCloseFile(&pFile); + taosRemoveFile(filename); + uDebug("[monitor] send and delete slow log file when reveive connect rsp:%s", filename); + + } + + taosCloseDir(&pDir); + +END: + taosRUnLockLatch(&monitorLock); +} + +static void sendAllCounter(){ + MonitorClient** ppMonitor = (MonitorClient**)taosHashIterate(monitorCounterHash, NULL); + while (ppMonitor != NULL) { + MonitorClient* pMonitor = *ppMonitor; + if (pMonitor != NULL){ + SAppInstInfo* pInst = getAppInstByClusterId(pMonitor->clusterId); + if(pInst == NULL){ + taosHashCancelIterate(monitorCounterHash, ppMonitor); + break; + } + SEpSet ep = getEpSet_s(&pInst->mgmtEp); + generateClusterReport(pMonitor->registry, pInst->pTransporter, &ep); + } + ppMonitor = taosHashIterate(monitorCounterHash, ppMonitor); + } +} + +void monitorCreateClient(int64_t clusterId) { + MonitorClient* pMonitor = NULL; + taosWLockLatch(&monitorLock); + if (taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES) == NULL) { + uInfo("[monitor] monitorCreateClient for %" PRIx64, clusterId); + pMonitor = taosMemoryCalloc(1, sizeof(MonitorClient)); + if (pMonitor == NULL) { + uError("failed to create monitor client"); + goto fail; + } + pMonitor->clusterId = clusterId; + char clusterKey[32] = {0}; + if(snprintf(clusterKey, sizeof(clusterKey), "%"PRId64, clusterId) < 0){ + uError("failed to create cluster key"); + goto fail; + } + pMonitor->registry = taos_collector_registry_new(clusterKey); + if(pMonitor->registry == NULL){ + uError("failed to create registry"); + goto fail; + } + pMonitor->colector = taos_collector_new(clusterKey); + if(pMonitor->colector == NULL){ + uError("failed to create collector"); + goto fail; + } + + taos_collector_registry_register_collector(pMonitor->registry, pMonitor->colector); + pMonitor->counters = (SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + if (pMonitor->counters == NULL) { + uError("failed to create monitor counters"); + goto fail; + } +// taosHashSetFreeFp(pMonitor->counters, destroyCounter); + + if(taosHashPut(monitorCounterHash, &clusterId, LONG_BYTES, &pMonitor, POINTER_BYTES) != 0){ + uError("failed to put monitor client to hash"); + goto fail; + } + + SAppInstInfo* pInst = getAppInstByClusterId(clusterId); + if(pInst == NULL){ + uError("failed to get app instance by cluster id"); + pMonitor = NULL; + goto fail; + } + pMonitor->timer = taosTmrStart(reportSendProcess, pInst->monitorParas.tsMonitorInterval * 1000, (void*)pMonitor, monitorTimer); + if(pMonitor->timer == NULL){ + uError("failed to start timer"); + goto fail; + } + uInfo("[monitor] monitorCreateClient for %"PRIx64 "finished %p.", clusterId, pMonitor); + } + taosWUnLockLatch(&monitorLock); + if (-1 != atomic_val_compare_exchange_32(&monitorFlag, -1, 0)) { + uDebug("[monitor] monitorFlag already is 0"); + } + return; + +fail: + destroyMonitorClient(&pMonitor); + taosWUnLockLatch(&monitorLock); +} + +void monitorCreateClientCounter(int64_t clusterId, const char* name, const char* help, size_t label_key_count, const char** label_keys) { + taosWLockLatch(&monitorLock); + MonitorClient** ppMonitor = (MonitorClient**)taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES); + if (ppMonitor == NULL || *ppMonitor == NULL) { + uError("failed to get monitor client"); + goto end; + } + taos_counter_t* newCounter = taos_counter_new(name, help, label_key_count, label_keys); + if (newCounter == NULL) + return; + MonitorClient* pMonitor = *ppMonitor; + taos_collector_add_metric(pMonitor->colector, newCounter); + if(taosHashPut(pMonitor->counters, name, strlen(name), &newCounter, POINTER_BYTES) != 0){ + uError("failed to put counter to monitor"); + taos_counter_destroy(newCounter); + goto end; + } + uInfo("[monitor] monitorCreateClientCounter %"PRIx64"(%p):%s : %p.", pMonitor->clusterId, pMonitor, name, newCounter); + +end: + taosWUnLockLatch(&monitorLock); +} + +void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values) { + taosWLockLatch(&monitorLock); + MonitorClient** ppMonitor = (MonitorClient**)taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES); + if (ppMonitor == NULL || *ppMonitor == NULL) { + uError("monitorCounterInc not found pMonitor %"PRId64, clusterId); + goto end; + } + + MonitorClient* pMonitor = *ppMonitor; + taos_counter_t** ppCounter = (taos_counter_t**)taosHashGet(pMonitor->counters, counterName, strlen(counterName)); + if (ppCounter == NULL || *ppCounter != NULL) { + uError("monitorCounterInc not found pCounter %"PRIx64":%s.", clusterId, counterName); + goto end; + } + taos_counter_inc(*ppCounter, label_values); + uInfo("[monitor] monitorCounterInc %"PRIx64"(%p):%s", pMonitor->clusterId, pMonitor, counterName); + +end: + taosWUnLockLatch(&monitorLock); +} + +const char* monitorResultStr(SQL_RESULT_CODE code) { + static const char* result_state[] = {"Success", "Failed", "Cancel"}; + return result_state[code]; +} + +static void monitorFreeSlowLogData(MonitorSlowLogData* pData) { + if (pData == NULL) { + return; + } + taosMemoryFree(pData->value); +} + +static void monitorThreadFuncUnexpectedStopped(void) { atomic_store_32(&slowLogFlag, -1); } + +static void reportSlowLog(void* param, void* tmrId) { + taosRLockLatch(&monitorLock); + if (atomic_load_32(&monitorFlag) == 1) { + taosRUnLockLatch(&monitorLock); + return; + } + SAppInstInfo* pInst = getAppInstByClusterId((int64_t)param); + if(pInst == NULL){ + uError("failed to get app inst, clusterId:%"PRIx64, (int64_t)param); + taosRUnLockLatch(&monitorLock); + return; + } + + void* tmp = taosHashGet(monitorSlowLogHash, ¶m, LONG_BYTES); + if(tmp == NULL){ + uError("failed to get file inst, clusterId:%"PRIx64, (int64_t)param); + taosRUnLockLatch(&monitorLock); + return; + } + + SEpSet ep = getEpSet_s(&pInst->mgmtEp); + monitorReadSendSlowLog((*(SlowLogClient**)tmp)->pFile, pInst->pTransporter, &ep); + taosRUnLockLatch(&monitorLock); + + taosTmrReset(reportSlowLog, pInst->monitorParas.tsMonitorInterval * 1000, param, monitorTimer, &tmrId); +} + +static void monitorWriteSlowLog2File(MonitorSlowLogData* slowLogData, char *tmpPath){ + taosWLockLatch(&monitorLock); + TdFilePtr pFile = NULL; + void* tmp = taosHashGet(monitorSlowLogHash, &slowLogData->clusterId, LONG_BYTES); + if (tmp == NULL){ + char path[PATH_MAX] = {0}; + char clusterId[32] = {0}; + if (snprintf(clusterId, sizeof(clusterId), "%" PRIx64, slowLogData->clusterId) < 0){ + uError("failed to generate clusterId:%" PRIx64, slowLogData->clusterId); + goto FAILED; + } + taosGetTmpfilePath(tmpPath, clusterId, path); + uInfo("[monitor] create slow log file:%s", path); + pFile = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_READ | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + uError("failed to open file:%s since %s", path, terrstr()); + goto FAILED; + } + + SlowLogClient *pClient = taosMemoryCalloc(1, sizeof(SlowLogClient)); + if (pClient == NULL){ + uError("failed to allocate memory for slow log client"); + taosCloseFile(&pFile); + goto FAILED; + } + pClient->pFile = pFile; + if (taosHashPut(monitorSlowLogHash, &slowLogData->clusterId, LONG_BYTES, &pClient, POINTER_BYTES) != 0){ + uError("failed to put clusterId:%" PRId64 " to hash table", slowLogData->clusterId); + taosCloseFile(&pFile); + taosMemoryFree(pClient); + goto FAILED; + } + + if(taosLockFile(pFile) < 0){ + uError("failed to lock file:%p since %s", pFile, terrstr()); + goto FAILED; + } + + SAppInstInfo* pInst = getAppInstByClusterId(slowLogData->clusterId); + if(pInst == NULL){ + uError("failed to get app instance by clusterId:%" PRId64, slowLogData->clusterId); + goto FAILED; + } + + pClient->timer = taosTmrStart(reportSlowLog, pInst->monitorParas.tsMonitorInterval * 1000, (void*)slowLogData->clusterId, monitorTimer); + }else{ + pFile = (*(SlowLogClient**)tmp)->pFile; + } + + if (taosWriteFile(pFile, slowLogData->value, strlen(slowLogData->value) + 1) < 0){ + uError("failed to write len to file:%p since %s", pFile, terrstr()); + } + uDebug("[monitor] write slow log to file:%p, clusterId:%"PRIx64, pFile, slowLogData->clusterId); + +FAILED: + taosWUnLockLatch(&monitorLock); +} + +static void* monitorThreadFunc(void *param){ + setThreadName("client-monitor-slowlog"); + +#ifdef WINDOWS + if (taosCheckCurrentInDll()) { + atexit(monitorThreadFuncUnexpectedStopped); + } +#endif + + if (-1 != atomic_val_compare_exchange_32(&slowLogFlag, -1, 0)) { + return NULL; + } + + char tmpPath[PATH_MAX] = {0}; + if (getSlowLogTmpDir(tmpPath, sizeof(tmpPath)) < 0){ + return NULL; + } + + if (taosMulModeMkDir(tmpPath, 0777, true) != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + printf("failed to create dir:%s since %s", tmpPath, terrstr()); + return NULL; + } + + if (tsem2_init(&monitorSem, 0, 0) != 0) { + uError("sem init error since %s", terrstr()); + return NULL; + } + + monitorQueue = taosOpenQueue(); + if(monitorQueue == NULL){ + uError("open queue error since %s", terrstr()); + return NULL; + } + uDebug("monitorThreadFunc start"); + while (1) { + if (slowLogFlag > 0) break; + + MonitorSlowLogData* slowLogData = NULL; + taosReadQitem(monitorQueue, (void**)&slowLogData); + if (slowLogData != NULL) { + uDebug("[monitor] read slow log data from queue, clusterId:%" PRIx64 " value:%s", slowLogData->clusterId, slowLogData->value); + if (slowLogData->value == NULL){ + monitorSendAllSlowLogFromTempDir(slowLogData->clusterId); + }else{ + monitorWriteSlowLog2File(slowLogData, tmpPath); + } + } + monitorFreeSlowLogData(slowLogData); + taosFreeQitem(slowLogData); + tsem2_timewait(&monitorSem, 500); + } + + taosCloseQueue(monitorQueue); + tsem2_destroy(&monitorSem); + slowLogFlag = -2; + return NULL; +} + +static int32_t tscMonitortInit() { + TdThreadAttr thAttr; + taosThreadAttrInit(&thAttr); + taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); + TdThread monitorThread; + if (taosThreadCreate(&monitorThread, &thAttr, monitorThreadFunc, NULL) != 0) { + uError("failed to create monitor thread since %s", strerror(errno)); + return -1; + } + + taosThreadAttrDestroy(&thAttr); + return 0; +} + +static void tscMonitorStop() { + if (atomic_val_compare_exchange_32(&slowLogFlag, 0, 1)) { + uDebug("monitor thread already stopped"); + return; + } + + while (atomic_load_32(&slowLogFlag) > 0) { + taosMsleep(100); + } +} + +void monitorInit() { + uInfo("[monitor] tscMonitor init"); + monitorCounterHash = (SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); + if (monitorCounterHash == NULL) { + uError("failed to create monitorCounterHash"); + } + taosHashSetFreeFp(monitorCounterHash, destroyMonitorClient); + + monitorSlowLogHash = (SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); + if (monitorSlowLogHash == NULL) { + uError("failed to create monitorSlowLogHash"); + } + taosHashSetFreeFp(monitorSlowLogHash, destroySlowLogClient); + + monitorTimer = taosTmrInit(0, 0, 0, "MONITOR"); + if (monitorTimer == NULL) { + uError("failed to create monitor timer"); + } + + taosInitRWLatch(&monitorLock); + tscMonitortInit(); +} + +void monitorClose() { + uInfo("[monitor] tscMonitor close"); + taosWLockLatch(&monitorLock); + + if (atomic_val_compare_exchange_32(&monitorFlag, 0, 1)) { + uDebug("[monitor] monitorFlag is not 0"); + } + tscMonitorStop(); + sendAllSlowLog(); + sendAllCounter(); + taosHashCleanup(monitorCounterHash); + taosHashCleanup(monitorSlowLogHash); + taosTmrCleanUp(monitorTimer); + taosWUnLockLatch(&monitorLock); +} + +int32_t monitorPutData2MonitorQueue(int64_t clusterId, char* value){ + MonitorSlowLogData* slowLogData = taosAllocateQitem(sizeof(MonitorSlowLogData), DEF_QITEM, 0); + if (slowLogData == NULL) { + uError("[monitor] failed to allocate slow log data"); + return -1; + } + slowLogData->clusterId = clusterId; + slowLogData->value = value; + uDebug("[monitor] write slow log to queue, clusterId:%"PRIx64 " value:%s", slowLogData->clusterId, slowLogData->value); + while (monitorQueue == NULL) { + taosMsleep(100); + } + if (taosWriteQitem(monitorQueue, slowLogData) == 0){ + tsem2_post(&monitorSem); + }else{ + monitorFreeSlowLogData(slowLogData); + taosFreeQitem(slowLogData); + } + return 0; +} \ No newline at end of file diff --git a/source/client/src/slowQueryMonitor.c b/source/client/src/clientMonitorSlow.c similarity index 64% rename from source/client/src/slowQueryMonitor.c rename to source/client/src/clientMonitorSlow.c index b41343443d..192792f43e 100644 --- a/source/client/src/slowQueryMonitor.c +++ b/source/client/src/clientMonitorSlow.c @@ -21,7 +21,6 @@ const char* slowQueryName = "taos_slow_sql:count"; const char* slowQueryHelp = "slow query log when cost over than config duration"; const int slowQueryLabelCount = 4; const char* slowQueryLabels[] = {"cluster_id", "username", "result", "duration"}; -static const char* defaultClusterID = ""; const int64_t usInSeconds = 1000 * 1000; const int64_t msInMinutes = 60 * 1000; @@ -39,21 +38,21 @@ static const char* getSlowQueryLableCostDesc(int64_t cost) { return "0-3s"; } -void clientSlowQueryMonitorInit(const char* clusterKey) { - if (!tsEnableMonitor) return; - SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey); - SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); - clusterMonitorInit(clusterKey, epSet, pAppInstInfo->pTransporter); - createClusterCounter(clusterKey, slowQueryName, slowQueryHelp, slowQueryLabelCount, slowQueryLabels); +void monitorClientSlowQueryInit(int64_t clusterid) { + monitorCreateClient(clusterid); + monitorCreateClientCounter(clusterid, slowQueryName, slowQueryHelp, slowQueryLabelCount, slowQueryLabels); } -void clientSlowQueryLog(const char* clusterKey, const char* user, SQL_RESULT_CODE result, int32_t cost) { - const char* slowQueryLabelValues[] = {defaultClusterID, user, resultStr(result), getSlowQueryLableCostDesc(cost)}; - taosClusterCounterInc(clusterKey, slowQueryName, slowQueryLabelValues); +void clientSlowQueryLog(int64_t clusterId, const char* user, SQL_RESULT_CODE result, int32_t cost) { + char clusterIdStr[32] = {0}; + if (snprintf(clusterIdStr, sizeof(clusterIdStr), "%" PRId64, clusterId) < 0){ + uError("failed to generate clusterId:%" PRId64, clusterId); + } + const char* slowQueryLabelValues[] = {clusterIdStr, user, monitorResultStr(result), getSlowQueryLableCostDesc(cost)}; + monitorCounterInc(clusterId, slowQueryName, slowQueryLabelValues); } -void SlowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost) { - if (!tsEnableMonitor) return; +void slowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost) { SQL_RESULT_CODE result = SQL_RESULT_SUCCESS; if (TSDB_CODE_SUCCESS != code) { result = SQL_RESULT_FAILED; @@ -66,12 +65,12 @@ void SlowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost) { STscObj* pTscObj = acquireTscObj(rid); if (pTscObj != NULL) { if(pTscObj->pAppInfo == NULL) { - tscLog("SlowQueryLog, not found pAppInfo"); + tscLog("slowQueryLog, not found pAppInfo"); } else { - clientSlowQueryLog(pTscObj->pAppInfo->instKey, pTscObj->user, result, cost); + clientSlowQueryLog(pTscObj->pAppInfo->clusterId, pTscObj->user, result, cost); } releaseTscObj(rid); } else { - tscLog("SlowQueryLog, not found rid"); + tscLog("slowQueryLog, not found rid"); } } diff --git a/source/client/src/clientSqlMonitor.c b/source/client/src/clientMonitorSql.c similarity index 64% rename from source/client/src/clientSqlMonitor.c rename to source/client/src/clientMonitorSql.c index 572af7ff55..19d5b7506e 100644 --- a/source/client/src/clientSqlMonitor.c +++ b/source/client/src/clientMonitorSql.c @@ -22,17 +22,12 @@ const char* selectMonitorHelp = "count for select sql"; const int selectMonitorLabelCount = 4; const char* selectMonitorLabels[] = {"cluster_id", "sql_type", "username", "result"}; -static const char* defaultClusterID = ""; - -void clientSQLReqMonitorInit(const char* clusterKey) { - if (!tsEnableMonitor) return; - SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey); - SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); - clusterMonitorInit(clusterKey, epSet, pAppInstInfo->pTransporter); - createClusterCounter(clusterKey, selectMonitorName, selectMonitorHelp, selectMonitorLabelCount, selectMonitorLabels); +void monitorClientSQLReqInit(int64_t clusterId) { + monitorCreateClient(clusterId); + monitorCreateClientCounter(clusterId, selectMonitorName, selectMonitorHelp, selectMonitorLabelCount, selectMonitorLabels); } -void clientSQLReqLog(const char* clusterKey, const char* user, SQL_RESULT_CODE result, int8_t type) { +void clientSQLReqLog(int64_t clusterId, const char* user, SQL_RESULT_CODE result, int8_t type) { const char* typeStr; switch (type) { case MONITORSQLTYPEDELETE: @@ -45,12 +40,15 @@ void clientSQLReqLog(const char* clusterKey, const char* user, SQL_RESULT_CODE r typeStr = "select"; break; } - const char* selectMonitorLabelValues[] = {defaultClusterID, typeStr, user, resultStr(result)}; - taosClusterCounterInc(clusterKey, selectMonitorName, selectMonitorLabelValues); + char clusterIdStr[32] = {0}; + if (snprintf(clusterIdStr, sizeof(clusterIdStr), "%" PRId64, clusterId) < 0){ + uError("failed to generate clusterId:%" PRId64, clusterId); + } + const char* selectMonitorLabelValues[] = {clusterIdStr, typeStr, user, monitorResultStr(result)}; + monitorCounterInc(clusterId, selectMonitorName, selectMonitorLabelValues); } void sqlReqLog(int64_t rid, bool killed, int32_t code, int8_t type) { - if (!tsEnableMonitor) return; SQL_RESULT_CODE result = SQL_RESULT_SUCCESS; if (TSDB_CODE_SUCCESS != code) { result = SQL_RESULT_FAILED; @@ -65,15 +63,10 @@ void sqlReqLog(int64_t rid, bool killed, int32_t code, int8_t type) { if (pTscObj->pAppInfo == NULL) { tscLog("sqlReqLog, not found pAppInfo"); } else { - clientSQLReqLog(pTscObj->pAppInfo->instKey, pTscObj->user, result, type); + clientSQLReqLog(pTscObj->pAppInfo->clusterId, pTscObj->user, result, type); } releaseTscObj(rid); } else { tscLog("sqlReqLog, not found rid"); } } - -void clientMonitorClose(const char* clusterKey) { - tscLog("clientMonitorClose, key:%s", clusterKey); - clusterMonitorClose(clusterKey); -} diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index f04e5e53c6..417cb8b562 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -15,6 +15,7 @@ #include "catalog.h" #include "clientInt.h" +#include "clientMonitor.h" #include "clientLog.h" #include "cmdnodes.h" #include "os.h" @@ -140,6 +141,9 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { // update the appInstInfo pTscObj->pAppInfo->clusterId = connectRsp.clusterId; + pTscObj->pAppInfo->monitorParas = connectRsp.monitorParas; + tscDebug("[monitor] paras from connect rsp, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", + connectRsp.clusterId, connectRsp.monitorParas.tsSlowLogThreshold, connectRsp.monitorParas.tsSlowLogScope); lastClusterId = connectRsp.clusterId; pTscObj->connType = connectRsp.connType; @@ -147,6 +151,15 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { pTscObj->authVer = connectRsp.authVer; pTscObj->whiteListInfo.ver = connectRsp.whiteListVer; + if(taosHashGet(appInfo.pInstMapByClusterId, &connectRsp.clusterId, LONG_BYTES) == NULL){ + if(taosHashPut(appInfo.pInstMapByClusterId, &connectRsp.clusterId, LONG_BYTES, &pTscObj->pAppInfo, POINTER_BYTES) != 0){ + tscError("failed to put appInfo into appInfo.pInstMapByClusterId"); + } + monitorPutData2MonitorQueue(pTscObj->pAppInfo->clusterId, NULL); + monitorClientSlowQueryInit(connectRsp.clusterId); + monitorClientSQLReqInit(connectRsp.clusterId); + } + taosThreadMutexLock(&clientHbMgr.lock); SAppHbMgr* pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, pTscObj->appHbMgrIdx); if (pAppHbMgr) { @@ -233,7 +246,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { struct SCatalog* pCatalog = NULL; if (usedbRsp.vgVersion >= 0) { // cached in local - uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId; + int64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId; int32_t code1 = catalogGetHandle(clusterId, &pCatalog); if (code1 != TSDB_CODE_SUCCESS) { tscWarn("0x%" PRIx64 "catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->requestId, clusterId, diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6eb7abe0eb..a771fc1635 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1851,7 +1851,7 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL } void smlSetReqSQL(SRequestObj *request, char *lines[], char *rawLine, char *rawLineEnd) { - if (tsSlowLogScope & SLOW_LOG_TYPE_INSERT) { + if (request->pTscObj->pAppInfo->monitorParas.tsSlowLogScope & SLOW_LOG_TYPE_INSERT) { int32_t len = 0; int32_t rlen = 0; char *p = NULL; diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 0b907b8661..e8b76d34c2 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -17,11 +17,11 @@ static FORCE_INLINE int32_t stmtAllocQNodeFromBuf(STableBufInfo* pTblBuf, void** *pBuf = pTblBuf->pCurBuff; pTblBuf->buffOffset = pTblBuf->buffUnit; } else { - void *buff = taosMemoryMalloc(pTblBuf->buffSize); + void* buff = taosMemoryMalloc(pTblBuf->buffSize); if (NULL == buff) { return TSDB_CODE_OUT_OF_MEMORY; } - + taosArrayPush(pTblBuf->pBufList, &buff); pTblBuf->buffIdx++; @@ -33,18 +33,18 @@ static FORCE_INLINE int32_t stmtAllocQNodeFromBuf(STableBufInfo* pTblBuf, void** return TSDB_CODE_SUCCESS; } -bool stmtDequeue(STscStmt* pStmt, SStmtQNode **param) { +bool stmtDequeue(STscStmt* pStmt, SStmtQNode** param) { while (0 == atomic_load_64(&pStmt->queue.qRemainNum)) { taosUsleep(1); return false; } - SStmtQNode *orig = pStmt->queue.head; + SStmtQNode* orig = pStmt->queue.head; - SStmtQNode *node = pStmt->queue.head->next; + SStmtQNode* node = pStmt->queue.head->next; pStmt->queue.head = pStmt->queue.head->next; - //taosMemoryFreeClear(orig); + // taosMemoryFreeClear(orig); *param = node; @@ -61,7 +61,6 @@ void stmtEnqueue(STscStmt* pStmt, SStmtQNode* param) { atomic_add_fetch_64(&pStmt->queue.qRemainNum, 1); } - static int32_t stmtCreateRequest(STscStmt* pStmt) { int32_t code = 0; @@ -93,7 +92,7 @@ int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) { switch (newStatus) { case STMT_PREPARE: - pStmt->errCode = 0; + pStmt->errCode = 0; break; case STMT_SETTBNAME: if (STMT_STATUS_EQ(INIT)) { @@ -265,7 +264,7 @@ int32_t stmtGetExecInfo(TAOS_STMT* stmt, SHashObj** pVgHash, SHashObj** pBlockHa *pVgHash = pStmt->sql.pVgHash; pStmt->sql.pVgHash = NULL; - + *pBlockHash = pStmt->exec.pBlockHash; pStmt->exec.pBlockHash = NULL; @@ -325,7 +324,7 @@ int32_t stmtParseSql(STscStmt* pStmt) { pStmt->stat.parseSqlNum++; STMT_ERR_RET(parseSql(pStmt->exec.pRequest, false, &pStmt->sql.pQuery, &stmtCb)); pStmt->sql.siInfo.pQuery = pStmt->sql.pQuery; - + pStmt->bInfo.needParse = false; if (pStmt->sql.pQuery->pRoot && 0 == pStmt->sql.type) { @@ -338,15 +337,16 @@ int32_t stmtParseSql(STscStmt* pStmt) { return TSDB_CODE_SUCCESS; } - STableDataCxt** pSrc = (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)); + STableDataCxt** pSrc = + (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)); if (NULL == pSrc || NULL == *pSrc) { return TSDB_CODE_OUT_OF_MEMORY; } STableDataCxt* pTableCtx = *pSrc; if (pStmt->sql.stbInterlaceMode) { - int16_t lastIdx = -1; - + int16_t lastIdx = -1; + for (int32_t i = 0; i < pTableCtx->boundColsInfo.numOfBound; ++i) { if (pTableCtx->boundColsInfo.pColIndex[i] < lastIdx) { pStmt->sql.stbInterlaceMode = false; @@ -381,7 +381,8 @@ int32_t stmtCleanBindInfo(STscStmt* pStmt) { qDestroyBoundColInfo(pStmt->bInfo.boundTags); taosMemoryFreeClear(pStmt->bInfo.boundTags); } - pStmt->bInfo.stbFName[0] = 0;; + pStmt->bInfo.stbFName[0] = 0; + ; return TSDB_CODE_SUCCESS; } @@ -457,12 +458,12 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) { return TSDB_CODE_SUCCESS; } -void stmtFreeTbBuf(void *buf) { +void stmtFreeTbBuf(void* buf) { void* pBuf = *(void**)buf; taosMemoryFree(pBuf); } -void stmtFreeTbCols(void *buf) { +void stmtFreeTbCols(void* buf) { SArray* pCols = *(SArray**)buf; taosArrayDestroy(pCols); } @@ -505,19 +506,17 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) { memset(&pStmt->sql, 0, sizeof(pStmt->sql)); pStmt->sql.siInfo.tableColsReady = true; - STMT_DLOG_E("end to free SQL info"); return TSDB_CODE_SUCCESS; } - int32_t stmtTryAddTableVgroupInfo(STscStmt* pStmt, int32_t* vgId) { if (*vgId >= 0 && taosHashGet(pStmt->sql.pVgHash, (const char*)vgId, sizeof(*vgId))) { return TSDB_CODE_SUCCESS; } - + SVgroupInfo vgInfo = {0}; SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter, .requestId = pStmt->exec.pRequest->requestId, @@ -528,17 +527,17 @@ int32_t stmtTryAddTableVgroupInfo(STscStmt* pStmt, int32_t* vgId) { if (TSDB_CODE_SUCCESS != code) { return code; } - - code = taosHashPut(pStmt->sql.pVgHash, (const char*)&vgInfo.vgId, sizeof(vgInfo.vgId), (char*)&vgInfo, sizeof(vgInfo)); + + code = + taosHashPut(pStmt->sql.pVgHash, (const char*)&vgInfo.vgId, sizeof(vgInfo.vgId), (char*)&vgInfo, sizeof(vgInfo)); if (TSDB_CODE_SUCCESS != code) { return code; } *vgId = vgInfo.vgId; - - return TSDB_CODE_SUCCESS; -} + return TSDB_CODE_SUCCESS; +} int32_t stmtRebuildDataBlock(STscStmt* pStmt, STableDataCxt* pDataBlock, STableDataCxt** newBlock, uint64_t uid, uint64_t suid, int32_t vgId) { @@ -554,7 +553,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) { if (pStmt->sql.stbInterlaceMode && pStmt->sql.siInfo.pDataCtx) { pStmt->bInfo.needParse = false; pStmt->bInfo.inExecCache = false; - return TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } pStmt->bInfo.needParse = true; @@ -589,7 +588,6 @@ int32_t stmtGetFromCache(STscStmt* pStmt) { return TSDB_CODE_SUCCESS; } - if (pStmt->sql.autoCreateTbl) { SStmtTableCache* pCache = taosHashGet(pStmt->sql.pTableCache, &pStmt->bInfo.tbSuid, sizeof(pStmt->bInfo.tbSuid)); if (pCache) { @@ -615,8 +613,8 @@ int32_t stmtGetFromCache(STscStmt* pStmt) { } uint64_t uid, suid; - int32_t vgId; - int8_t tableType; + int32_t vgId; + int8_t tableType; STableMeta* pTableMeta = NULL; SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter, @@ -638,12 +636,12 @@ int32_t stmtGetFromCache(STscStmt* pStmt) { uid = pTableMeta->uid; suid = pTableMeta->suid; - tableType = pTableMeta->tableType; + tableType = pTableMeta->tableType; pStmt->bInfo.tbVgId = pTableMeta->vgId; vgId = pTableMeta->vgId; - + taosMemoryFree(pTableMeta); - + uint64_t cacheUid = (TSDB_CHILD_TABLE == tableType) ? suid : uid; if (uid == pStmt->bInfo.tbUid) { @@ -675,7 +673,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) { return TSDB_CODE_SUCCESS; } - + SStmtTableCache* pCache = taosHashGet(pStmt->sql.pTableCache, &cacheUid, sizeof(cacheUid)); if (pCache) { pStmt->bInfo.needParse = false; @@ -720,7 +718,6 @@ int32_t stmtResetStmt(STscStmt* pStmt) { return TSDB_CODE_SUCCESS; } - int32_t stmtAsyncOutput(STscStmt* pStmt, void* param) { SStmtQNode* pParam = (SStmtQNode*)param; @@ -729,20 +726,20 @@ int32_t stmtAsyncOutput(STscStmt* pStmt, void* param) { SArray** p = (SArray**)TARRAY_GET_ELEM(pStmt->sql.siInfo.pTableCols, i); *p = taosArrayInit(20, POINTER_BYTES); } - + atomic_store_8((int8_t*)&pStmt->sql.siInfo.tableColsReady, true); } else { - STMT_ERR_RET(qAppendStmtTableOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, &pParam->tblData, pStmt->exec.pCurrBlock, &pStmt->sql.siInfo)); + STMT_ERR_RET(qAppendStmtTableOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, &pParam->tblData, pStmt->exec.pCurrBlock, + &pStmt->sql.siInfo)); - //taosMemoryFree(pParam->pTbData); + // taosMemoryFree(pParam->pTbData); atomic_sub_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1); } return TSDB_CODE_SUCCESS; } - -void *stmtBindThreadFunc(void *param) { +void* stmtBindThreadFunc(void* param) { setThreadName("stmtBind"); qInfo("stmt bind thread started"); @@ -750,15 +747,15 @@ void *stmtBindThreadFunc(void *param) { STscStmt* pStmt = (STscStmt*)param; while (true) { - if (atomic_load_8((int8_t *)&pStmt->queue.stopQueue)) { + if (atomic_load_8((int8_t*)&pStmt->queue.stopQueue)) { break; } - SStmtQNode *asyncParam = NULL; + SStmtQNode* asyncParam = NULL; if (!stmtDequeue(pStmt, &asyncParam)) { continue; } - + stmtAsyncOutput(pStmt, asyncParam); } @@ -767,7 +764,6 @@ void *stmtBindThreadFunc(void *param) { return NULL; } - int32_t stmtStartBindThread(STscStmt* pStmt) { TdThreadAttr thAttr; taosThreadAttrInit(&thAttr); @@ -798,7 +794,7 @@ int32_t stmtInitTableBuf(STableBufInfo* pTblBuf) { if (NULL == pTblBuf->pBufList) { return TSDB_CODE_OUT_OF_MEMORY; } - void *buff = taosMemoryMalloc(pTblBuf->buffSize); + void* buff = taosMemoryMalloc(pTblBuf->buffSize); if (NULL == buff) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -815,7 +811,7 @@ int32_t stmtInitTableBuf(STableBufInfo* pTblBuf) { TAOS_STMT* stmtInit(STscObj* taos, int64_t reqid, TAOS_STMT_OPTIONS* pOptions) { STscObj* pObj = (STscObj*)taos; STscStmt* pStmt = NULL; - int32_t code = 0; + int32_t code = 0; pStmt = taosMemoryCalloc(1, sizeof(STscStmt)); if (NULL == pStmt) { @@ -900,6 +896,12 @@ int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { pStmt->sql.sqlLen = length; pStmt->sql.stbInterlaceMode = pStmt->stbInterlaceMode; + char* dbName = NULL; + if (qParseDbName(sql, length, &dbName)) { + stmtSetDbName(stmt, dbName); + taosMemoryFreeClear(dbName); + } + return TSDB_CODE_SUCCESS; } @@ -909,23 +911,38 @@ int32_t stmtInitStbInterlaceTableInfo(STscStmt* pStmt) { return TSDB_CODE_OUT_OF_MEMORY; } STableDataCxt* pDst = NULL; - + STMT_ERR_RET(qCloneStmtDataBlock(&pDst, *pSrc, true)); pStmt->sql.siInfo.pDataCtx = pDst; - + SArray* pTblCols = NULL; for (int32_t i = 0; i < STMT_TABLE_COLS_NUM; i++) { pTblCols = taosArrayInit(20, POINTER_BYTES); if (NULL == pTblCols) { return TSDB_CODE_OUT_OF_MEMORY; } - + taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols); } - + pStmt->sql.siInfo.boundTags = pStmt->bInfo.boundTags; + return TSDB_CODE_SUCCESS; +} +int stmtSetDbName(TAOS_STMT* stmt, const char* dbName) { + STscStmt *pStmt = (STscStmt *) stmt; + + STMT_DLOG("start to set dbName: %s", dbName); + + STMT_ERR_RET(stmtCreateRequest(pStmt)); + + // The SQL statement specifies a database name, overriding the previously specified database + taosMemoryFreeClear(pStmt->exec.pRequest->pDb); + pStmt->exec.pRequest->pDb = taosStrdup(dbName); + if (pStmt->exec.pRequest->pDb == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } return TSDB_CODE_SUCCESS; } @@ -951,13 +968,13 @@ int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) { STMT_ERR_RET(qCreateSName(&pStmt->bInfo.sname, tbName, pStmt->taos->acctId, pStmt->exec.pRequest->pDb, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen)); tNameExtractFullName(&pStmt->bInfo.sname, pStmt->bInfo.tbFName); - + STMT_ERR_RET(stmtGetFromCache(pStmt)); if (pStmt->bInfo.needParse) { strncpy(pStmt->bInfo.tbName, tbName, sizeof(pStmt->bInfo.tbName) - 1); pStmt->bInfo.tbName[sizeof(pStmt->bInfo.tbName) - 1] = 0; - + STMT_ERR_RET(stmtParseSql(pStmt)); } } else { @@ -1032,7 +1049,8 @@ int stmtFetchColFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields if (pStmt->sql.stbInterlaceMode) { pDataBlock = &pStmt->sql.siInfo.pDataCtx; } else { - pDataBlock = (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)); + pDataBlock = + (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)); if (NULL == pDataBlock) { tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName); STMT_ERR_RET(TSDB_CODE_APP_ERROR); @@ -1050,7 +1068,7 @@ SArray* stmtGetFreeCol(STscStmt* pStmt, int32_t* idx) { if (pStmt->exec.smInfo.pColIdx >= STMT_COL_BUF_SIZE) { pStmt->exec.smInfo.pColIdx = 0; } - + if ((pStmt->exec.smInfo.pColIdx + 1) == atomic_load_32(&pStmt->exec.smInfo.pColFreeIdx)) { taosUsleep(1); continue; @@ -1064,38 +1082,40 @@ SArray* stmtGetFreeCol(STscStmt* pStmt, int32_t* idx) { int32_t stmtAppendTablePostHandle(STscStmt* pStmt, SStmtQNode* param) { if (NULL == pStmt->sql.siInfo.pVgroupHash) { - pStmt->sql.siInfo.pVgroupHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); + pStmt->sql.siInfo.pVgroupHash = + taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); } if (NULL == pStmt->sql.siInfo.pVgroupList) { pStmt->sql.siInfo.pVgroupList = taosArrayInit(64, POINTER_BYTES); } - + if (NULL == pStmt->sql.siInfo.pRequest) { - STMT_ERR_RET(buildRequest(pStmt->taos->id, pStmt->sql.sqlStr, pStmt->sql.sqlLen, NULL, false, (SRequestObj**)&pStmt->sql.siInfo.pRequest, - pStmt->reqid)); - + STMT_ERR_RET(buildRequest(pStmt->taos->id, pStmt->sql.sqlStr, pStmt->sql.sqlLen, NULL, false, + (SRequestObj**)&pStmt->sql.siInfo.pRequest, pStmt->reqid)); + if (pStmt->reqid != 0) { pStmt->reqid++; } pStmt->exec.pRequest->syncQuery = true; - + pStmt->sql.siInfo.requestId = ((SRequestObj*)pStmt->sql.siInfo.pRequest)->requestId; pStmt->sql.siInfo.requestSelf = ((SRequestObj*)pStmt->sql.siInfo.pRequest)->self; } - - if (!pStmt->sql.siInfo.tbFromHash && pStmt->sql.siInfo.firstName[0] && 0 == strcmp(pStmt->sql.siInfo.firstName, pStmt->bInfo.tbName)) { + + if (!pStmt->sql.siInfo.tbFromHash && pStmt->sql.siInfo.firstName[0] && + 0 == strcmp(pStmt->sql.siInfo.firstName, pStmt->bInfo.tbName)) { pStmt->sql.siInfo.tbFromHash = true; } - + if (0 == pStmt->sql.siInfo.firstName[0]) { strcpy(pStmt->sql.siInfo.firstName, pStmt->bInfo.tbName); } - + param->tblData.getFromHash = pStmt->sql.siInfo.tbFromHash; param->next = NULL; - + atomic_add_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1); - + stmtEnqueue(pStmt, param); return TSDB_CODE_SUCCESS; @@ -1113,7 +1133,7 @@ static FORCE_INLINE int32_t stmtGetTableColsFromCache(STscStmt* pStmt, SArray** if (NULL == pTblCols) { return TSDB_CODE_OUT_OF_MEMORY; } - + taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols); } } @@ -1124,10 +1144,10 @@ static FORCE_INLINE int32_t stmtGetTableColsFromCache(STscStmt* pStmt, SArray** int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) { STscStmt* pStmt = (STscStmt*)stmt; - int32_t code = 0; + int32_t code = 0; int64_t startUs = taosGetTimestampUs(); - + STMT_DLOG("start to bind stmt data, colIdx: %d", colIdx); STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_BIND)); @@ -1210,7 +1230,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) { } int64_t startUs2 = taosGetTimestampUs(); - pStmt->stat.bindDataUs1 += startUs2 - startUs; + pStmt->stat.bindDataUs1 += startUs2 - startUs; SStmtQNode* param = NULL; if (pStmt->sql.stbInterlaceMode) { @@ -1218,25 +1238,27 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) { STMT_ERR_RET(stmtGetTableColsFromCache(pStmt, ¶m->tblData.aCol)); taosArrayClear(param->tblData.aCol); - //param->tblData.aCol = taosArrayInit(20, POINTER_BYTES); + // param->tblData.aCol = taosArrayInit(20, POINTER_BYTES); param->restoreTbCols = false; strcpy(param->tblData.tbName, pStmt->bInfo.tbName); } int64_t startUs3 = taosGetTimestampUs(); - pStmt->stat.bindDataUs2 += startUs3 - startUs2; + pStmt->stat.bindDataUs2 += startUs3 - startUs2; SArray* pCols = pStmt->sql.stbInterlaceMode ? param->tblData.aCol : (*pDataBlock)->pData->aCol; if (colIdx < 0) { if (pStmt->sql.stbInterlaceMode) { (*pDataBlock)->pData->flags = 0; - code = qBindStmtStbColsValue(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen, &pStmt->sql.siInfo.pTSchema, pStmt->sql.pBindInfo); + code = qBindStmtStbColsValue(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf, + pStmt->exec.pRequest->msgBufLen, &pStmt->sql.siInfo.pTSchema, pStmt->sql.pBindInfo); } else { - code = qBindStmtColsValue(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen); + code = + qBindStmtColsValue(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen); } - + if (code) { tscError("qBindStmtColsValue failed, error:%s", tstrerror(code)); STMT_ERR_RET(code); @@ -1246,7 +1268,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) { tscError("bind single column not allowed in stb insert mode"); STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR); } - + if (colIdx != (pStmt->bInfo.sBindLastIdx + 1) && colIdx != 0) { tscError("bind column index not in sequence"); STMT_ERR_RET(TSDB_CODE_APP_ERROR); @@ -1267,13 +1289,13 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) { } int64_t startUs4 = taosGetTimestampUs(); - pStmt->stat.bindDataUs3 += startUs4 - startUs3; + pStmt->stat.bindDataUs3 += startUs4 - startUs3; if (pStmt->sql.stbInterlaceMode) { STMT_ERR_RET(stmtAppendTablePostHandle(pStmt, param)); } - pStmt->stat.bindDataUs4 += taosGetTimestampUs() - startUs4; + pStmt->stat.bindDataUs4 += taosGetTimestampUs() - startUs4; return TSDB_CODE_SUCCESS; } @@ -1292,12 +1314,12 @@ int stmtAddBatch(TAOS_STMT* stmt) { pStmt->stat.addBatchUs += startUs2 - startUs; pStmt->sql.siInfo.tableColsReady = false; - + SStmtQNode* param = NULL; STMT_ERR_RET(stmtAllocQNodeFromBuf(&pStmt->sql.siInfo.tbBuf, (void**)¶m)); param->restoreTbCols = true; param->next = NULL; - + stmtEnqueue(pStmt, param); return TSDB_CODE_SUCCESS; @@ -1372,7 +1394,7 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) { int32_t code = catalogGetTableMeta(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &pTableMeta); pStmt->stat.ctgGetTbMetaNum++; - + taos_free_result(pStmt->exec.pRequest); pStmt->exec.pRequest = NULL; @@ -1402,13 +1424,14 @@ int stmtStaticModeExec(TAOS_STMT* stmt) { if (pStmt->sql.staticMode) { return TSDB_CODE_TSC_STMT_API_ERROR; } - + STMT_DLOG_E("start to exec"); STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_EXECUTE)); - STMT_ERR_RET(qBuildStmtOutputFromTbList(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->exec.pTbBlkList, pStmt->exec.pCurrBlock, pStmt->exec.tbBlkNum)); - + STMT_ERR_RET(qBuildStmtOutputFromTbList(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->exec.pTbBlkList, +pStmt->exec.pCurrBlock, pStmt->exec.tbBlkNum)); + launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL); if (pStmt->exec.pRequest->code && NEED_CLIENT_HANDLE_ERROR(pStmt->exec.pRequest->code)) { @@ -1430,7 +1453,7 @@ int stmtStaticModeExec(TAOS_STMT* stmt) { _return: stmtCleanExecInfo(pStmt, (code ? false : true), false); - + tFreeSSubmitRsp(pRsp); ++pStmt->sql.runTimes; @@ -1459,7 +1482,7 @@ int stmtExec(TAOS_STMT* stmt) { taosUsleep(1); } pStmt->stat.execWaitUs += taosGetTimestampUs() - startTs; - + STMT_ERR_RET(qBuildStmtFinOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->sql.siInfo.pVgroupList)); taosHashCleanup(pStmt->sql.siInfo.pVgroupHash); pStmt->sql.siInfo.pVgroupHash = NULL; @@ -1472,7 +1495,7 @@ int stmtExec(TAOS_STMT* stmt) { STMT_ERR_RET(qBuildStmtOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->exec.pBlockHash)); } - + launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL); } @@ -1499,7 +1522,7 @@ _return: } stmtCleanExecInfo(pStmt, (code ? false : true), false); - + tFreeSSubmitRsp(pRsp); ++pStmt->sql.runTimes; @@ -1522,13 +1545,16 @@ int stmtClose(TAOS_STMT* stmt) { pStmt->bindThreadInUse = false; } - STMT_DLOG("stmt %p closed, stbInterlaceMode: %d, statInfo: ctgGetTbMetaNum=>%" PRId64 ", getCacheTbInfo=>%" PRId64 ", parseSqlNum=>%" PRId64 - ", pStmt->stat.bindDataNum=>%" PRId64 ", settbnameAPI:%u, bindAPI:%u, addbatchAPI:%u, execAPI:%u" - ", setTbNameUs:%" PRId64 ", bindDataUs:%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 " addBatchUs:%" PRId64 ", execWaitUs:%" PRId64 ", execUseUs:%" PRId64, - pStmt, pStmt->sql.stbInterlaceMode, pStmt->stat.ctgGetTbMetaNum, pStmt->stat.getCacheTbInfo, pStmt->stat.parseSqlNum, pStmt->stat.bindDataNum, - pStmt->seqIds[STMT_SETTBNAME], pStmt->seqIds[STMT_BIND], pStmt->seqIds[STMT_ADD_BATCH], pStmt->seqIds[STMT_EXECUTE], - pStmt->stat.setTbNameUs, pStmt->stat.bindDataUs1, pStmt->stat.bindDataUs2, pStmt->stat.bindDataUs3, pStmt->stat.bindDataUs4, - pStmt->stat.addBatchUs, pStmt->stat.execWaitUs, pStmt->stat.execUseUs); + STMT_DLOG("stmt %p closed, stbInterlaceMode: %d, statInfo: ctgGetTbMetaNum=>%" PRId64 ", getCacheTbInfo=>%" PRId64 + ", parseSqlNum=>%" PRId64 ", pStmt->stat.bindDataNum=>%" PRId64 + ", settbnameAPI:%u, bindAPI:%u, addbatchAPI:%u, execAPI:%u" + ", setTbNameUs:%" PRId64 ", bindDataUs:%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 " addBatchUs:%" PRId64 + ", execWaitUs:%" PRId64 ", execUseUs:%" PRId64, + pStmt, pStmt->sql.stbInterlaceMode, pStmt->stat.ctgGetTbMetaNum, pStmt->stat.getCacheTbInfo, + pStmt->stat.parseSqlNum, pStmt->stat.bindDataNum, pStmt->seqIds[STMT_SETTBNAME], pStmt->seqIds[STMT_BIND], + pStmt->seqIds[STMT_ADD_BATCH], pStmt->seqIds[STMT_EXECUTE], pStmt->stat.setTbNameUs, + pStmt->stat.bindDataUs1, pStmt->stat.bindDataUs2, pStmt->stat.bindDataUs3, pStmt->stat.bindDataUs4, + pStmt->stat.addBatchUs, pStmt->stat.execWaitUs, pStmt->stat.execUseUs); stmtCleanSQLInfo(pStmt); taosMemoryFree(stmt); @@ -1567,9 +1593,9 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) { } int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { - int32_t code = 0; + int32_t code = 0; STscStmt* pStmt = (STscStmt*)stmt; - int32_t preCode = pStmt->errCode; + int32_t preCode = pStmt->errCode; STMT_DLOG_E("start to get tag fields"); @@ -1600,14 +1626,14 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { _return: pStmt->errCode = preCode; - + return code; } int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { - int32_t code = 0; + int32_t code = 0; STscStmt* pStmt = (STscStmt*)stmt; - int32_t preCode = pStmt->errCode; + int32_t preCode = pStmt->errCode; STMT_DLOG_E("start to get col fields"); @@ -1661,7 +1687,7 @@ int stmtGetParamNum(TAOS_STMT* stmt, int* nums) { } STMT_ERR_RET(stmtCreateRequest(pStmt)); - + if (pStmt->bInfo.needParse) { STMT_ERR_RET(stmtParseSql(pStmt)); } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index f5f083e5d8..becb8285b6 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -107,7 +107,7 @@ struct tmq_t { STaosQueue* mqueue; // queue of rsp STaosQall* qall; STaosQueue* delayedTask; // delayed task queue for heartbeat and auto commit - tsem2_t rspSem; + tsem2_t rspSem; }; typedef struct SAskEpInfo { @@ -681,7 +681,7 @@ static void asyncCommitAllOffsets(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* us int32_t numOfVgroups = taosArrayGetSize(pTopic->vgs); tscDebug("consumer:0x%" PRIx64 " commit offset for topics:%s, numOfVgs:%d", tmq->consumerId, pTopic->topicName, - numOfVgroups); + numOfVgroups); for (int32_t j = 0; j < numOfVgroups; j++) { SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); @@ -703,19 +703,19 @@ static void asyncCommitAllOffsets(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* us } tscDebug("consumer:0x%" PRIx64 - " topic:%s on vgId:%d send commit msg success, send offset:%s committed:%s, ordinal:%d/%d", - tmq->consumerId, pTopic->topicName, pVg->vgId, offsetBuf, commitBuf, j + 1, numOfVgroups); + " topic:%s on vgId:%d send commit msg success, send offset:%s committed:%s, ordinal:%d/%d", + tmq->consumerId, pTopic->topicName, pVg->vgId, offsetBuf, commitBuf, j + 1, numOfVgroups); tOffsetCopy(&pVg->offsetInfo.committedOffset, &pVg->offsetInfo.endOffset); } else { tscDebug("consumer:0x%" PRIx64 " topic:%s vgId:%d, no commit, current:%" PRId64 ", ordinal:%d/%d", - tmq->consumerId, pTopic->topicName, pVg->vgId, pVg->offsetInfo.endOffset.version, j + 1, numOfVgroups); + tmq->consumerId, pTopic->topicName, pVg->vgId, pVg->offsetInfo.endOffset.version, j + 1, numOfVgroups); } } } taosRUnLockLatch(&tmq->lock); tscDebug("consumer:0x%" PRIx64 " total commit:%d for %d topics", tmq->consumerId, pParamSet->waitingRspNum - 1, - numOfTopics); + numOfTopics); // request is sent if (pParamSet->waitingRspNum != 1) { @@ -769,34 +769,35 @@ void tmqAssignDelayedCommitTask(void* param, void* tmrId) { } int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) { - if (pMsg) { - SMqHbRsp rsp = {0}; - tDeserializeSMqHbRsp(pMsg->pData, pMsg->len, &rsp); + if (pMsg == NULL) { + return code; + } + SMqHbRsp rsp = {0}; + tDeserializeSMqHbRsp(pMsg->pData, pMsg->len, &rsp); - int64_t refId = *(int64_t*)param; - tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId); - if (tmq != NULL) { - taosWLockLatch(&tmq->lock); - for (int32_t i = 0; i < taosArrayGetSize(rsp.topicPrivileges); i++) { - STopicPrivilege* privilege = taosArrayGet(rsp.topicPrivileges, i); - if (privilege->noPrivilege == 1) { - int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics); - for (int32_t j = 0; j < topicNumCur; j++) { - SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, j); - if (strcmp(pTopicCur->topicName, privilege->topic) == 0) { - tscInfo("consumer:0x%" PRIx64 ", has no privilege, topic:%s", tmq->consumerId, privilege->topic); - pTopicCur->noPrivilege = 1; - } + int64_t refId = *(int64_t*)param; + tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId); + if (tmq != NULL) { + taosWLockLatch(&tmq->lock); + for (int32_t i = 0; i < taosArrayGetSize(rsp.topicPrivileges); i++) { + STopicPrivilege* privilege = taosArrayGet(rsp.topicPrivileges, i); + if (privilege->noPrivilege == 1) { + int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics); + for (int32_t j = 0; j < topicNumCur; j++) { + SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, j); + if (strcmp(pTopicCur->topicName, privilege->topic) == 0) { + tscInfo("consumer:0x%" PRIx64 ", has no privilege, topic:%s", tmq->consumerId, privilege->topic); + pTopicCur->noPrivilege = 1; } } } - taosWUnLockLatch(&tmq->lock); - taosReleaseRef(tmqMgmt.rsetId, refId); } - tDestroySMqHbRsp(&rsp); - taosMemoryFree(pMsg->pData); - taosMemoryFree(pMsg->pEpSet); + taosWUnLockLatch(&tmq->lock); + taosReleaseRef(tmqMgmt.rsetId, refId); } + tDestroySMqHbRsp(&rsp); + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); return 0; } @@ -830,7 +831,7 @@ void tmqSendHbReq(void* param, void* tmrId) { char buf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(buf, TSDB_OFFSET_LEN, &offRows->offset); tscDebug("consumer:0x%" PRIx64 ",report offset, group:%s vgId:%d, offset:%s/%" PRId64 ", rows:%" PRId64, - tmq->consumerId, tmq->groupId, offRows->vgId, buf, offRows->ever, offRows->rows); + tmq->consumerId, tmq->groupId, offRows->vgId, buf, offRows->ever, offRows->rows); } } taosRUnLockLatch(&tmq->lock); @@ -955,7 +956,7 @@ static void tmqFreeRspWrapper(SMqRspWrapper* rspWrapper) { SMqPollRspWrapper* pRsp = (SMqPollRspWrapper*)rspWrapper; taosMemoryFreeClear(pRsp->pEpset); tDeleteMqBatchMetaRsp(&pRsp->batchMetaRsp); - } + } } void tmqClearUnhandleMsg(tmq_t* tmq) { @@ -984,10 +985,16 @@ void tmqClearUnhandleMsg(tmq_t* tmq) { } int32_t tmqSubscribeCb(void* param, SDataBuf* pMsg, int32_t code) { + if(param == NULL) { + return code; + } + SMqSubscribeCbParam* pParam = (SMqSubscribeCbParam*)param; pParam->rspErr = code; - taosMemoryFree(pMsg->pEpSet); + if(pMsg){ + taosMemoryFree(pMsg->pEpSet); + } tsem_post(&pParam->rspSem); return 0; } @@ -1021,17 +1028,16 @@ int32_t tmq_unsubscribe(tmq_t* tmq) { taosSsleep(2); // sleep 2s for hb to send offset and rows to server tmq_list_t* lst = tmq_list_new(); - int32_t rsp = tmq_subscribe(tmq, lst); + int32_t rsp = tmq_subscribe(tmq, lst); tmq_list_destroy(lst); return rsp; } -static void freeClientVg(void* param){ +static void freeClientVg(void* param) { SMqClientVg* pVg = param; tOffsetDestroy(&pVg->offsetInfo.endOffset); tOffsetDestroy(&pVg->offsetInfo.beginOffset); tOffsetDestroy(&pVg->offsetInfo.committedOffset); - } static void freeClientVgImpl(void* param) { SMqClientTopic* pTopic = param; @@ -1282,8 +1288,9 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { int32_t retryCnt = 0; while ((code = syncAskEp(tmq)) != 0) { if (retryCnt++ > MAX_RETRY_COUNT || code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) { - tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry more than 2 minutes, code:%s", tmq->consumerId, strerror(code)); - if(code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) { + tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry more than 2 minutes, code:%s", + tmq->consumerId, strerror(code)); + if (code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) { code = 0; } goto FAIL; @@ -1379,7 +1386,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { goto END; } - if(pMsg->pData == NULL){ + if (pMsg->pData == NULL) { tscError("consumer:0x%" PRIx64 " msg discard from vgId:%d, since msg is NULL", tmq->consumerId, vgId); code = TSDB_CODE_TSC_INTERNAL_ERROR; goto END; @@ -1407,7 +1414,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { if (rspType == TMQ_MSG_TYPE__POLL_DATA_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); - if(tDecodeMqDataRsp(&decoder, &pRspWrapper->dataRsp) < 0){ + if (tDecodeMqDataRsp(&decoder, &pRspWrapper->dataRsp) < 0) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; @@ -1423,7 +1430,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); - if(tDecodeMqMetaRsp(&decoder, &pRspWrapper->metaRsp) < 0){ + if (tDecodeMqMetaRsp(&decoder, &pRspWrapper->metaRsp) < 0) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; @@ -1434,7 +1441,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } else if (rspType == TMQ_MSG_TYPE__POLL_DATA_META_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); - if(tDecodeSTaosxRsp(&decoder, &pRspWrapper->taosxRsp) < 0){ + if (tDecodeSTaosxRsp(&decoder, &pRspWrapper->taosxRsp) < 0) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; @@ -1445,7 +1452,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } else if (rspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); - if(tSemiDecodeMqBatchMetaRsp(&decoder, &pRspWrapper->batchMetaRsp) < 0){ + if (tSemiDecodeMqBatchMetaRsp(&decoder, &pRspWrapper->batchMetaRsp) < 0) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; @@ -1529,11 +1536,11 @@ static void initClientTopicFromRsp(SMqClientTopic* pTopic, SMqSubTopicEp* pTopic clientVg.offsetInfo.walVerBegin = -1; clientVg.offsetInfo.walVerEnd = -1; clientVg.seekUpdated = false; - if(pInfo) { + if (pInfo) { tOffsetCopy(&clientVg.offsetInfo.endOffset, &pInfo->currentOffset); tOffsetCopy(&clientVg.offsetInfo.committedOffset, &pInfo->commitOffset); tOffsetCopy(&clientVg.offsetInfo.beginOffset, &pInfo->seekOffset); - }else{ + } else { clientVg.offsetInfo.endOffset = offsetNew; clientVg.offsetInfo.committedOffset = offsetNew; clientVg.offsetInfo.beginOffset = offsetNew; @@ -1548,7 +1555,7 @@ static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) int32_t topicNumGet = taosArrayGetSize(pRsp->topics); if (epoch < tmq->epoch || (epoch == tmq->epoch && topicNumGet == 0)) { tscDebug("consumer:0x%" PRIx64 " no update ep epoch from %d to epoch %d, incoming topics:%d", tmq->consumerId, - tmq->epoch, epoch, topicNumGet); + tmq->epoch, epoch, topicNumGet); if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER) { atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__READY); } @@ -1642,7 +1649,7 @@ void tmqBuildConsumeReqImpl(SMqPollReq* pReq, tmq_t* tmq, int64_t timeout, SMqCl SMqMetaRspObj* tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { SMqMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqMetaRspObj)); - if(pRspObj == NULL) { + if (pRspObj == NULL) { return NULL; } pRspObj->resType = RES_TYPE__TMQ_META; @@ -1656,7 +1663,7 @@ SMqMetaRspObj* tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { SMqBatchMetaRspObj* tmqBuildBatchMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { SMqBatchMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqBatchMetaRspObj)); - if(pRspObj == NULL) { + if (pRspObj == NULL) { return NULL; } pRspObj->common.resType = RES_TYPE__TMQ_BATCH_META; @@ -1669,10 +1676,11 @@ SMqBatchMetaRspObj* tmqBuildBatchMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) return pRspObj; } -void changeByteEndian(char* pData){ +void changeByteEndian(char* pData) { char* p = pData; - // | version | total length | total rows | total columns | flag seg| block group id | column schema | each column length | version: + // | version | total length | total rows | total columns | flag seg| block group id | column schema | each column + // length | version: int32_t blockVersion = *(int32_t*)p; ASSERT(blockVersion == BLOCK_VERSION_1); *(int32_t*)p = BLOCK_VERSION_2; @@ -1693,23 +1701,24 @@ void changeByteEndian(char* pData){ } } -static void tmqGetRawDataRowsPrecisionFromRes(void *pRetrieve, void** rawData, int64_t *rows, int32_t *precision){ - if(*(int64_t*)pRetrieve == 0){ +static void tmqGetRawDataRowsPrecisionFromRes(void* pRetrieve, void** rawData, int64_t* rows, int32_t* precision) { + if (*(int64_t*)pRetrieve == 0) { *rawData = ((SRetrieveTableRsp*)pRetrieve)->data; *rows = htobe64(((SRetrieveTableRsp*)pRetrieve)->numOfRows); - if(precision != NULL){ + if (precision != NULL) { *precision = ((SRetrieveTableRsp*)pRetrieve)->precision; } - }else if(*(int64_t*)pRetrieve == 1){ + } else if (*(int64_t*)pRetrieve == 1) { *rawData = ((SRetrieveTableRspForTmq*)pRetrieve)->data; *rows = htobe64(((SRetrieveTableRspForTmq*)pRetrieve)->numOfRows); - if(precision != NULL){ + if (precision != NULL) { *precision = ((SRetrieveTableRspForTmq*)pRetrieve)->precision; } } } -static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows, SMqRspObjCommon* pRspObj, SMqDataRspCommon* pDataRsp) { +static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows, + SMqRspObjCommon* pRspObj, SMqDataRspCommon* pDataRsp) { (*numOfRows) = 0; tstrncpy(pRspObj->topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN); tstrncpy(pRspObj->db, pWrapper->topicHandle->db, TSDB_DB_FNAME_LEN); @@ -1727,8 +1736,8 @@ static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg } // extract the rows in this data packet for (int32_t i = 0; i < pDataRsp->blockNum; ++i) { - void* pRetrieve = taosArrayGetP(pDataRsp->blockData, i); - void* rawData = NULL; + void* pRetrieve = taosArrayGetP(pDataRsp->blockData, i); + void* rawData = NULL; int64_t rows = 0; // deal with compatibility tmqGetRawDataRowsPrecisionFromRes(pRetrieve, &rawData, &rows, NULL); @@ -1736,9 +1745,9 @@ static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg pVg->numOfRows += rows; (*numOfRows) += rows; changeByteEndian(rawData); - if (needTransformSchema) { //withSchema is false if subscribe subquery, true if subscribe db or stable - SSchemaWrapper *schema = tCloneSSchemaWrapper(&pWrapper->topicHandle->schema); - if(schema){ + if (needTransformSchema) { // withSchema is false if subscribe subquery, true if subscribe db or stable + SSchemaWrapper* schema = tCloneSSchemaWrapper(&pWrapper->topicHandle->schema); + if (schema) { taosArrayPush(pDataRsp->blockSchema, &schema); } } @@ -1747,7 +1756,7 @@ static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows) { SMqRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqRspObj)); - if(pRspObj == NULL){ + if (pRspObj == NULL) { return NULL; } pRspObj->common.resType = RES_TYPE__TMQ; @@ -1758,7 +1767,7 @@ SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows) { SMqTaosxRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqTaosxRspObj)); - if(pRspObj == NULL){ + if (pRspObj == NULL) { return NULL; } pRspObj->common.resType = RES_TYPE__TMQ_METADATA; @@ -1790,6 +1799,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p if (tSerializeSMqPollReq(msg, msgSize, &req) < 0) { code = TSDB_CODE_INVALID_MSG; + taosMemoryFreeClear(msg); goto FAIL; } @@ -1858,7 +1868,7 @@ static int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { } for (int j = 0; j < numOfVg; j++) { SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); - int64_t elapsed = taosGetTimestampMs() - pVg->emptyBlockReceiveTs; + int64_t elapsed = taosGetTimestampMs() - pVg->emptyBlockReceiveTs; if (elapsed < EMPTY_BLOCK_POLL_IDLE_DURATION && elapsed >= 0) { // less than 10ms tscDebug("consumer:0x%" PRIx64 " epoch %d, vgId:%d idle for 10ms before start next poll", tmq->consumerId, tmq->epoch, pVg->vgId); @@ -1956,7 +1966,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_DATA_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; - int32_t consumerEpoch = atomic_load_32(&tmq->epoch); + int32_t consumerEpoch = atomic_load_32(&tmq->epoch); SMqDataRspCommon* pDataRsp = (SMqDataRspCommon*)&pollRspWrapper->dataRsp; if (pDataRsp->head.epoch == consumerEpoch) { @@ -2096,7 +2106,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_DATA_META_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; int32_t consumerEpoch = atomic_load_32(&tmq->epoch); - SMqDataRspCommon* pDataRsp = (SMqDataRspCommon*)&pollRspWrapper->taosxRsp; + SMqDataRspCommon* pDataRsp = (SMqDataRspCommon*)&pollRspWrapper->taosxRsp; if (pDataRsp->head.epoch == consumerEpoch) { taosWLockLatch(&tmq->lock); @@ -2112,9 +2122,8 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { return NULL; } - updateVgInfo(pVg, &pDataRsp->reqOffset, &pDataRsp->rspOffset, - pDataRsp->head.walsver, pDataRsp->head.walever, tmq->consumerId, - pDataRsp->blockNum != 0); + updateVgInfo(pVg, &pDataRsp->reqOffset, &pDataRsp->rspOffset, pDataRsp->head.walsver, pDataRsp->head.walever, + tmq->consumerId, pDataRsp->blockNum != 0); if (pDataRsp->blockNum == 0) { tscDebug("consumer:0x%" PRIx64 " taosx empty block received, vgId:%d, vg total:%" PRId64 ", reqId:0x%" PRIx64, @@ -2130,15 +2139,15 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { // build rsp int64_t numOfRows = 0; - void* pRsp = tmqBuildTaosxRspFromWrapper(pollRspWrapper, pVg, &numOfRows); + void* pRsp = tmqBuildTaosxRspFromWrapper(pollRspWrapper, pVg, &numOfRows); tmq->totalRows += numOfRows; char buf[TSDB_OFFSET_LEN] = {0}; tFormatOffset(buf, TSDB_OFFSET_LEN, &pVg->offsetInfo.endOffset); tscDebug("consumer:0x%" PRIx64 " process taosx poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64 ", vg total:%" PRId64 ", total:%" PRId64 ", reqId:0x%" PRIx64, - tmq->consumerId, pVg->vgId, buf, pDataRsp->blockNum, numOfRows, pVg->numOfRows, - tmq->totalRows, pollRspWrapper->reqId); + tmq->consumerId, pVg->vgId, buf, pDataRsp->blockNum, numOfRows, pVg->numOfRows, tmq->totalRows, + pollRspWrapper->reqId); taosFreeQitem(pRspWrapper); taosWUnLockLatch(&tmq->lock); @@ -2266,7 +2275,7 @@ int32_t tmq_consumer_close(tmq_t* tmq) { taosSsleep(2); // sleep 2s for hb to send offset and rows to server tmq_list_t* lst = tmq_list_new(); - int32_t code = tmq_subscribe(tmq, lst); + int32_t code = tmq_subscribe(tmq, lst); tmq_list_destroy(lst); if (code != 0) { return code; @@ -2285,9 +2294,9 @@ const char* tmq_err2str(int32_t err) { } else if (err == -1) { return "fail"; } else { - if(*(taosGetErrMsg()) == 0){ + if (*(taosGetErrMsg()) == 0) { return tstrerror(err); - } else{ + } else { snprintf(taosGetErrMsgReturn(), ERR_MSG_LEN, "%s,detail:%s", tstrerror(err), taosGetErrMsg()); return (const char*)taosGetErrMsgReturn(); } @@ -2359,8 +2368,8 @@ int64_t tmq_get_vgroup_offset(TAOS_RES* res) { return TSDB_CODE_INVALID_PARA; } if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { - SMqDataRspCommon* common = (SMqDataRspCommon*)POINTER_SHIFT(res, sizeof(SMqRspObjCommon)); - STqOffsetVal* pOffset = &common->reqOffset; + SMqDataRspCommon* common = (SMqDataRspCommon*)POINTER_SHIFT(res, sizeof(SMqRspObjCommon)); + STqOffsetVal* pOffset = &common->reqOffset; if (common->reqOffset.type == TMQ_OFFSET__LOG) { return common->reqOffset.version; } else { @@ -2389,7 +2398,7 @@ const char* tmq_get_table_name(TAOS_RES* res) { return NULL; } if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { - SMqDataRspCommon* common = (SMqDataRspCommon*)POINTER_SHIFT(res, sizeof(SMqRspObjCommon)); + SMqDataRspCommon* common = (SMqDataRspCommon*)POINTER_SHIFT(res, sizeof(SMqRspObjCommon)); SMqRspObjCommon* pRspObj = (SMqRspObjCommon*)res; if (!common->withTbName || common->blockTbName == NULL || pRspObj->resIter < 0 || @@ -2563,6 +2572,7 @@ end: } int32_t askEpCb(void* param, SDataBuf* pMsg, int32_t code) { + if(param == NULL) return code; SMqAskEpCbParam* pParam = (SMqAskEpCbParam*)param; tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, pParam->refId); if (tmq == NULL) { @@ -2575,6 +2585,9 @@ int32_t askEpCb(void* param, SDataBuf* pMsg, int32_t code) { goto END; } + if (pMsg == NULL) { + goto END; + } SMqRspHead* head = pMsg->pData; int32_t epoch = atomic_load_32(&tmq->epoch); tscDebug("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d", tmq->consumerId, head->epoch, epoch); @@ -2604,18 +2617,24 @@ END: FAIL: if (pParam->sync) { SAskEpInfo* pInfo = pParam->pParam; - pInfo->code = code; - tsem_post(&pInfo->sem); + if(pInfo) { + pInfo->code = code; + tsem_post(&pInfo->sem); + } + } + + if(pMsg){ + taosMemoryFree(pMsg->pEpSet); + taosMemoryFree(pMsg->pData); } - taosMemoryFree(pMsg->pEpSet); - taosMemoryFree(pMsg->pData); taosMemoryFree(pParam); return code; } int32_t syncAskEp(tmq_t* pTmq) { SAskEpInfo* pInfo = taosMemoryMalloc(sizeof(SAskEpInfo)); + if(pInfo == NULL) return TSDB_CODE_OUT_OF_MEMORY; tsem_init(&pInfo->sem, 0, 0); askEp(pTmq, pInfo, true, false); @@ -2734,8 +2753,8 @@ void commitRspCountDown(SMqCommitCbParamSet* pParamSet, int64_t consumerId, cons } SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) { - SMqDataRspCommon* common = (SMqDataRspCommon*)POINTER_SHIFT(res, sizeof(SMqRspObjCommon)); - SMqRspObjCommon* pRspObj = (SMqRspObjCommon*)res; + SMqDataRspCommon* common = (SMqDataRspCommon*)POINTER_SHIFT(res, sizeof(SMqRspObjCommon)); + SMqRspObjCommon* pRspObj = (SMqRspObjCommon*)res; pRspObj->resIter++; if (pRspObj->resIter < common->blockNum) { if (common->withSchema) { @@ -2744,8 +2763,8 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) { setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols); } - void* pRetrieve = taosArrayGetP(common->blockData, pRspObj->resIter); - void* rawData = NULL; + void* pRetrieve = taosArrayGetP(common->blockData, pRspObj->resIter); + void* rawData = NULL; int64_t rows = 0; int32_t precision = 0; tmqGetRawDataRowsPrecisionFromRes(pRetrieve, &rawData, &rows, &precision); @@ -2767,6 +2786,9 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) { } static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) { + if(param == NULL) { + return code; + } SMqVgWalInfoParam* pParam = param; SMqVgCommon* pCommon = pParam->pCommon; @@ -2798,8 +2820,11 @@ static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) { tsem_post(&pCommon->rsp); } - taosMemoryFree(pMsg->pData); - taosMemoryFree(pMsg->pEpSet); + if(pMsg){ + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); + } + return 0; } @@ -3231,6 +3256,9 @@ static int32_t tmqSeekCb(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); } + if(param == NULL) { + return code; + } SMqSeekParam* pParam = param; pParam->code = code; tsem_post(&pParam->sem); diff --git a/source/client/test/clientMonitorTests.cpp b/source/client/test/clientMonitorTests.cpp index f7ddc1a5cd..2d3ce87f38 100644 --- a/source/client/test/clientMonitorTests.cpp +++ b/source/client/test/clientMonitorTests.cpp @@ -35,34 +35,34 @@ int main(int argc, char** argv) { return RUN_ALL_TESTS(); } -TEST(clientMonitorTest, monitorTest) { - const char* cluster1 = "cluster1"; - const char* cluster2 = "cluster2"; - SEpSet epSet; - clusterMonitorInit(cluster1, epSet, NULL); - const char* counterName1 = "slow_query"; - const char* counterName2 = "select_count"; - const char* help1 = "test for slowQuery"; - const char* help2 = "test for selectSQL"; - const char* lables[] = {"lable1"}; - taos_counter_t* c1 = createClusterCounter(cluster1, counterName1, help1, 1, lables); - ASSERT_TRUE(c1 != NULL); - taos_counter_t* c2 = createClusterCounter(cluster1, counterName2, help2, 1, lables); - ASSERT_TRUE(c2 != NULL); - ASSERT_TRUE(c1 != c2); - taos_counter_t* c21 = createClusterCounter(cluster2, counterName1, help2, 1, lables); - ASSERT_TRUE(c21 == NULL); - clusterMonitorInit(cluster2, epSet, NULL); - c21 = createClusterCounter(cluster2, counterName1, help2, 1, lables); - ASSERT_TRUE(c21 != NULL); - int i = 0; - while (i < 12) { - taosMsleep(10); - ++i; - } - clusterMonitorClose(cluster1); - clusterMonitorClose(cluster2); -} +//TEST(clientMonitorTest, monitorTest) { +// const char* cluster1 = "cluster1"; +// const char* cluster2 = "cluster2"; +// SEpSet epSet; +// clientMonitorInit(cluster1, epSet, NULL); +// const char* counterName1 = "slow_query"; +// const char* counterName2 = "select_count"; +// const char* help1 = "test for slowQuery"; +// const char* help2 = "test for selectSQL"; +// const char* lables[] = {"lable1"}; +// taos_counter_t* c1 = createClusterCounter(cluster1, counterName1, help1, 1, lables); +// ASSERT_TRUE(c1 != NULL); +// taos_counter_t* c2 = createClusterCounter(cluster1, counterName2, help2, 1, lables); +// ASSERT_TRUE(c2 != NULL); +// ASSERT_TRUE(c1 != c2); +// taos_counter_t* c21 = createClusterCounter(cluster2, counterName1, help2, 1, lables); +// ASSERT_TRUE(c21 == NULL); +// clientMonitorInit(cluster2, epSet, NULL); +// c21 = createClusterCounter(cluster2, counterName1, help2, 1, lables); +// ASSERT_TRUE(c21 != NULL); +// int i = 0; +// while (i < 12) { +// taosMsleep(10); +// ++i; +// } +// clusterMonitorClose(cluster1); +// clusterMonitorClose(cluster2); +//} TEST(clientMonitorTest, sendTest) { TAOS* taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); @@ -70,13 +70,100 @@ TEST(clientMonitorTest, sendTest) { printf("connect taosd sucessfully.\n"); int64_t rid = *(int64_t *)taos; - SlowQueryLog(rid, false, -1, 1000); + slowQueryLog(rid, false, -1, 1000); int i = 0; while (i < 20) { - SlowQueryLog(rid, false, 0, i * 1000); + slowQueryLog(rid, false, 0, i * 1000); taosMsleep(10); ++i; } taos_close(taos); } + +TEST(clientMonitorTest, ReadOneFile) { + // Create a TdFilePtr object and set it up for testing + + TdFilePtr pFile = taosOpenFile("./tdengine-1-wewe", TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_READ | TD_FILE_TRUNC); + if (pFile == NULL) { + uError("failed to open file:./test.txt since %s", terrstr()); + return; + } + + const int batch = 10; + const int size = SLOW_LOG_SEND_SIZE/batch; + for(int i = 0; i < batch + 1; i++){ + char value[size] = {0}; + memset(value, '0' + i, size - 1); + if (taosWriteFile(pFile, value, strlen(value) + 1) < 0){ + uError("failed to write len to file:%p since %s", pFile, terrstr()); + } + } + + // Create a void pointer and set it up for testing + void* pTransporter = NULL; + + // Create an SEpSet object and set it up for testing + SEpSet* epSet = NULL; + + // Call the function to be tested +// monitorReadSendSlowLog(pFile, (int64_t)pTransporter, epSet); + + char value[size] = {0}; + memset(value, '0', size - 1); + if (taosWriteFile(pFile, value, strlen(value) + 1) < 0){ + uError("failed to write len to file:%p since %s", pFile, terrstr()); + } + +// monitorReadSendSlowLog(pFile, (int64_t)pTransporter, epSet); + + // Clean up any resources created for testing + taosCloseFile(&pFile); +} + +TEST(clientMonitorTest, ReadTwoFile) { + // Create a TdFilePtr object and set it up for testing + + TdFilePtr pFile = taosOpenFile("/tmp/tdengine_slow_log/tdengine-1-wewe", TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_READ | TD_FILE_TRUNC); + if (pFile == NULL) { + uError("failed to open file:./test.txt since %s", terrstr()); + return; + } + + const int batch = 10; + const int size = SLOW_LOG_SEND_SIZE/batch; + for(int i = 0; i < batch + 1; i++){ + char value[size] = {0}; + memset(value, '0' + i, size - 1); + if (taosWriteFile(pFile, value, strlen(value) + 1) < 0){ + uError("failed to write len to file:%p since %s", pFile, terrstr()); + } + } + + taosFsyncFile(pFile); + taosCloseFile(&pFile); + + pFile = taosOpenFile("/tmp/tdengine_slow_log/tdengine-2-wewe", TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND | TD_FILE_READ | TD_FILE_TRUNC); + if (pFile == NULL) { + uError("failed to open file:./test.txt since %s", terrstr()); + return; + } + + for(int i = 0; i < batch + 1; i++){ + char value[size] = {0}; + memset(value, '0' + i, size - 1); + if (taosWriteFile(pFile, value, strlen(value) + 1) < 0){ + uError("failed to write len to file:%p since %s", pFile, terrstr()); + } + } + + taosFsyncFile(pFile); + taosCloseFile(&pFile); + + SAppInstInfo pAppInfo = {0}; + pAppInfo.clusterId = 2; + pAppInfo.monitorParas.tsEnableMonitor = 1; + strcpy(tsTempDir,"/tmp"); +// monitorSendAllSlowLogFromTempDir(&pAppInfo); + +} \ No newline at end of file diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index bbd759b3d1..611891e298 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -1520,6 +1520,13 @@ TEST(clientCase, sub_tb_test) { } TEST(clientCase, sub_tb_mt_test) { + char *user = NULL; + char *auth = NULL; + char *ip = NULL; + int port = 0; + char key[512] = {0}; + snprintf(key, sizeof(key), "%s:%s:%s:%d", user, auth, ip, port); + taos_options(TSDB_OPTION_CONFIGDIR, "~/first/cfg"); TdThread qid[20] = {0}; @@ -1532,4 +1539,38 @@ TEST(clientCase, sub_tb_mt_test) { } } +//static void concatStrings(SArray *list, char* buf, int size){ +// int len = 0; +// for(int i = 0; i < taosArrayGetSize(list); i++){ +// char* db = (char*)taosArrayGet(list, i); +// char* dot = strchr(db, '.'); +// if (dot != NULL) { +// db = dot + 1; +// } +// if (i != 0){ +// strcat(buf, ","); +// len += 1; +// } +// int ret = snprintf(buf + len, size - len, "%s", db); +// if (ret < 0) { +// printf("snprintf failed, buf:%s, ret:%d", buf, ret); +// break; +// } +// len += ret; +// if (len >= size){ +// printf("dbList is truncated, buf:%s, len:%d", buf, len); +// break; +// } +// } +//} +// +//TEST(clientCase, concat_string_test) { +// SArray* list = taosArrayInit(10, TSDB_DB_FNAME_LEN); +// taosArrayPush(list, "1.db1"); +// taosArrayPush(list, "2.db2"); +// +// char buf[32] = {0}; +// concatStrings(list, buf, sizeof(buf) - 1); +//} + #pragma GCC diagnostic pop diff --git a/source/common/src/cos.c b/source/common/src/cos.c index 6c46f4ff42..fe6e20c47f 100644 --- a/source/common/src/cos.c +++ b/source/common/src/cos.c @@ -83,10 +83,10 @@ int32_t s3CheckCfg() { snprintf(path, PATH_MAX, "%s", tsTempDir); if (strncmp(tsTempDir + tmp_len - ds_len, TD_DIRSEP, ds_len) != 0) { - snprintf(path + tmp_len, PATH_MAX, "%s", TD_DIRSEP); - snprintf(path + tmp_len + ds_len, PATH_MAX, "%s", objectname[0]); + snprintf(path + tmp_len, PATH_MAX - tmp_len, "%s", TD_DIRSEP); + snprintf(path + tmp_len + ds_len, PATH_MAX - tmp_len - ds_len, "%s", objectname[0]); } else { - snprintf(path + tmp_len, PATH_MAX, "%s", objectname[0]); + snprintf(path + tmp_len, PATH_MAX - tmp_len, "%s", objectname[0]); } TdFilePtr fp = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC); @@ -1075,32 +1075,32 @@ static SArray *getListByPrefix(const char *prefix) { S3ListBucketHandler listBucketHandler = {{&responsePropertiesCallbackNull, &responseCompleteCallback}, &listBucketCallback}; - const char *marker = 0, *delimiter = 0; - int maxkeys = 0, allDetails = 0; - list_bucket_callback_data data = {0}; + const char /**marker = 0,*/ *delimiter = 0; + int /*maxkeys = 0, */ allDetails = 0; + list_bucket_callback_data data = {0}; data.objectArray = taosArrayInit(32, sizeof(void *)); if (!data.objectArray) { uError("%s: %s", __func__, "out of memoty"); return NULL; } - if (marker) { + /*if (marker) { snprintf(data.nextMarker, sizeof(data.nextMarker), "%s", marker); - } else { - data.nextMarker[0] = 0; - } + } else {*/ + data.nextMarker[0] = 0; + //} data.keyCount = 0; data.allDetails = allDetails; do { data.isTruncated = 0; do { - S3_list_bucket(&bucketContext, prefix, data.nextMarker, delimiter, maxkeys, 0, timeoutMsG, &listBucketHandler, - &data); + S3_list_bucket(&bucketContext, prefix, data.nextMarker, delimiter, 0 /*maxkeys*/, 0, timeoutMsG, + &listBucketHandler, &data); } while (S3_status_is_retryable(data.status) && should_retry()); if (data.status != S3StatusOK) { break; } - } while (data.isTruncated && (!maxkeys || (data.keyCount < maxkeys))); + } while (data.isTruncated /* && (!maxkeys || (data.keyCount < maxkeys))*/); if (data.status == S3StatusOK) { if (data.keyCount > 0) { diff --git a/source/common/src/cos_cp.c b/source/common/src/cos_cp.c index 6d37b4d4dc..509f0a3a1c 100644 --- a/source/common/src/cos_cp.c +++ b/source/common/src/cos_cp.c @@ -20,7 +20,7 @@ int32_t cos_cp_open(char const* cp_path, SCheckpoint* checkpoint) { } void cos_cp_close(TdFilePtr fd) { taosCloseFile(&fd); } -void cos_cp_remove(char const* filepath) { taosRemoveFile(filepath); } +void cos_cp_remove(char const* filepath) { (void)taosRemoveFile(filepath); } static int32_t cos_cp_parse_body(char* cp_body, SCheckpoint* cp) { int32_t code = 0; @@ -380,7 +380,7 @@ void cos_cp_get_undo_parts(SCheckpoint* checkpoint, int* part_num, SCheckpointPa void cos_cp_update(SCheckpoint* checkpoint, int32_t part_index, char const* etag, uint64_t crc64) { checkpoint->parts[part_index].completed = 1; - strncpy(checkpoint->parts[part_index].etag, etag, 128); + strncpy(checkpoint->parts[part_index].etag, etag, 127); checkpoint->parts[part_index].crc64 = crc64; } @@ -389,11 +389,12 @@ void cos_cp_build_upload(SCheckpoint* checkpoint, char const* filepath, int64_t int i = 0; checkpoint->cp_type = COS_CP_TYPE_UPLOAD; - strncpy(checkpoint->file_path, filepath, TSDB_FILENAME_LEN); + memset(checkpoint->file_path, 0, TSDB_FILENAME_LEN); + strncpy(checkpoint->file_path, filepath, TSDB_FILENAME_LEN - 1); checkpoint->file_size = size; checkpoint->file_last_modified = mtime; - strncpy(checkpoint->upload_id, upload_id, 128); + strncpy(checkpoint->upload_id, upload_id, 127); checkpoint->part_size = part_size; for (; i * part_size < size; i++) { diff --git a/source/common/src/rsync.c b/source/common/src/rsync.c index 84e9615ddd..ac94625f8e 100644 --- a/source/common/src/rsync.c +++ b/source/common/src/rsync.c @@ -5,8 +5,8 @@ #include #include "tglobal.h" -#define ERRNO_ERR_FORMAT "errno:%d,msg:%s" -#define ERRNO_ERR_DATA errno,strerror(errno) +#define ERRNO_ERR_FORMAT "errno:%d,msg:%s" +#define ERRNO_ERR_DATA errno, strerror(errno) // deleteRsync function produce empty directories, traverse base directory to remove them static void removeEmptyDir() { @@ -24,14 +24,14 @@ static void removeEmptyDir() { char filename[PATH_MAX] = {0}; snprintf(filename, sizeof(filename), "%s%s", tsCheckpointBackupDir, taosGetDirEntryName(de)); - TdDirPtr pDirTmp = taosOpenDir(filename); + TdDirPtr pDirTmp = taosOpenDir(filename); TdDirEntryPtr deTmp = NULL; - bool empty = true; - while ((deTmp = taosReadDir(pDirTmp)) != NULL){ + bool empty = true; + while ((deTmp = taosReadDir(pDirTmp)) != NULL) { if (strcmp(taosGetDirEntryName(deTmp), ".") == 0 || strcmp(taosGetDirEntryName(deTmp), "..") == 0) continue; empty = false; } - if(empty) taosRemoveDir(filename); + if (empty) taosRemoveDir(filename); taosCloseDir(&pDirTmp); } @@ -40,10 +40,10 @@ static void removeEmptyDir() { #ifdef WINDOWS // C:\TDengine\data\backup\checkpoint\ -> /c/TDengine/data/backup/checkpoint/ -static void changeDirFromWindowsToLinux(char* from, char* to){ +static void changeDirFromWindowsToLinux(char* from, char* to) { to[0] = '/'; to[1] = from[0]; - for(int32_t i = 2; i < strlen(from); i++) { + for (int32_t i = 2; i < strlen(from); i++) { if (from[i] == '\\') { to[i] = '/'; } else { @@ -56,7 +56,7 @@ static void changeDirFromWindowsToLinux(char* from, char* to){ static int32_t generateConfigFile(char* confDir) { TdFilePtr pFile = taosOpenFile(confDir, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { - uError("[rsync] open conf file error, dir:%s,"ERRNO_ERR_FORMAT, confDir, ERRNO_ERR_DATA); + uError("[rsync] open conf file error, dir:%s," ERRNO_ERR_FORMAT, confDir, ERRNO_ERR_DATA); return -1; } @@ -65,8 +65,8 @@ static int32_t generateConfigFile(char* confDir) { changeDirFromWindowsToLinux(tsCheckpointBackupDir, path); #endif - char confContent[PATH_MAX*4] = {0}; - snprintf(confContent, PATH_MAX*4, + char confContent[PATH_MAX * 4] = {0}; + snprintf(confContent, PATH_MAX * 4, #ifndef WINDOWS "uid = root\n" "gid = root\n" @@ -80,16 +80,17 @@ static int32_t generateConfigFile(char* confDir) { "read only = false\n" "list = false\n" "[checkpoint]\n" - "path = %s", tsCheckpointBackupDir, tsCheckpointBackupDir, + "path = %s", + tsCheckpointBackupDir, tsCheckpointBackupDir, #ifdef WINDOWS path #else tsCheckpointBackupDir #endif - ); + ); uDebug("[rsync] conf:%s", confContent); - if (taosWriteFile(pFile, confContent, strlen(confContent)) <= 0){ - uError("[rsync] write conf file error,"ERRNO_ERR_FORMAT, ERRNO_ERR_DATA); + if (taosWriteFile(pFile, confContent, strlen(confContent)) <= 0) { + uError("[rsync] write conf file error," ERRNO_ERR_FORMAT, ERRNO_ERR_DATA); taosCloseFile(&pFile); return -1; } @@ -98,10 +99,10 @@ static int32_t generateConfigFile(char* confDir) { return 0; } -static int32_t execCommand(char* command){ +static int32_t execCommand(char* command) { int32_t try = 3; int32_t code = 0; - while(try-- > 0) { + while (try-- > 0) { code = system(command); if (code == 0) { break; @@ -125,7 +126,7 @@ void stopRsync() { uDebug("[rsync] stop rsync server successful"); } - taosMsleep(500); // sleep 500 ms to wait for the completion of kill operation. + taosMsleep(500); // sleep 500 ms to wait for the completion of kill operation. } void startRsync() { @@ -154,7 +155,6 @@ void startRsync() { } else { uDebug("[rsync] start server successful"); } - } int32_t uploadByRsync(const char* id, const char* path) { @@ -165,12 +165,12 @@ int32_t uploadByRsync(const char* id, const char* path) { char pathTransform[PATH_MAX] = {0}; changeDirFromWindowsToLinux(path, pathTransform); - if(pathTransform[strlen(pathTransform) - 1] != '/') { + if (pathTransform[strlen(pathTransform) - 1] != '/') { #else if (path[strlen(path) - 1] != '/') { #endif snprintf(command, PATH_MAX, - "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 %s/ " + "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 --exclude=\"*\" %s/ " "rsync://%s/checkpoint/%s/", tsLogDir, #ifdef WINDOWS @@ -182,7 +182,7 @@ int32_t uploadByRsync(const char* id, const char* path) { tsSnodeAddress, id); } else { snprintf(command, PATH_MAX, - "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 %s " + "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 --exclude=\"*\" %s " "rsync://%s/checkpoint/%s/", tsLogDir, #ifdef WINDOWS @@ -194,7 +194,51 @@ int32_t uploadByRsync(const char* id, const char* path) { tsSnodeAddress, id); } + // prepare the data directory int32_t code = execCommand(command); + if (code != 0) { + uError("[rsync] s-task:%s prepare checkpoint data in %s to %s failed, code:%d," ERRNO_ERR_FORMAT, id, path, + tsSnodeAddress, code, ERRNO_ERR_DATA); + } else { + int64_t el = (taosGetTimestampMs() - st); + uDebug("[rsync] s-task:%s prepare checkpoint data in:%s to %s successfully, elapsed time:%" PRId64 "ms", id, path, + tsSnodeAddress, el); + } + +#ifdef WINDOWS + memset(pathTransform, 0, PATH_MAX); + changeDirFromWindowsToLinux(path, pathTransform); + + if (pathTransform[strlen(pathTransform) - 1] != '/') { +#else + if (path[strlen(path) - 1] != '/') { +#endif + snprintf(command, PATH_MAX, + "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 %s/ " + "rsync://%s/checkpoint/%s/data/", + tsLogDir, +#ifdef WINDOWS + pathTransform +#else + path +#endif + , + tsSnodeAddress, id); + } else { + snprintf(command, PATH_MAX, + "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 --bwlimit=100000 %s " + "rsync://%s/checkpoint/%s/data/", + tsLogDir, +#ifdef WINDOWS + pathTransform +#else + path +#endif + , + tsSnodeAddress, id); + } + + code = execCommand(command); if (code != 0) { uError("[rsync] s-task:%s upload checkpoint data in %s to %s failed, code:%d," ERRNO_ERR_FORMAT, id, path, tsSnodeAddress, code, ERRNO_ERR_DATA); @@ -210,7 +254,7 @@ int32_t uploadByRsync(const char* id, const char* path) { // abort from retry if quit int32_t downloadRsync(const char* id, const char* path) { int64_t st = taosGetTimestampMs(); - int32_t MAX_RETRY = 60; + int32_t MAX_RETRY = 10; int32_t times = 0; int32_t code = 0; @@ -220,19 +264,20 @@ int32_t downloadRsync(const char* id, const char* path) { #endif char command[PATH_MAX] = {0}; - snprintf(command, PATH_MAX, - "rsync -av --debug=all --log-file=%s/rsynclog --timeout=10 --bwlimit=100000 rsync://%s/checkpoint/%s/ %s", - tsLogDir, tsSnodeAddress, id, + snprintf( + command, PATH_MAX, + "rsync -av --debug=all --log-file=%s/rsynclog --timeout=10 --bwlimit=100000 rsync://%s/checkpoint/%s/data/ %s", + tsLogDir, tsSnodeAddress, id, #ifdef WINDOWS - pathTransform + pathTransform #else - path + path #endif ); uDebug("[rsync] %s start to sync data from remote to:%s, %s", id, path, command); - while(times++ < MAX_RETRY) { + while (times++ < MAX_RETRY) { code = execCommand(command); if (code != TSDB_CODE_SUCCESS) { uError("[rsync] %s download checkpoint data:%s failed, retry after 1sec, times:%d, code:%d," ERRNO_ERR_FORMAT, id, @@ -258,8 +303,8 @@ int32_t deleteRsync(const char* id) { char command[PATH_MAX] = {0}; snprintf(command, PATH_MAX, - "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 %s rsync://%s/checkpoint/%s/", tsLogDir, - tmp, tsSnodeAddress, id); + "rsync -av --debug=all --log-file=%s/rsynclog --delete --timeout=10 %s rsync://%s/checkpoint/%s/data/", + tsLogDir, tmp, tsSnodeAddress, id); code = execCommand(command); taosRemoveDir(tmp); diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 65c58abdda..0c0073b4a7 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -275,7 +275,7 @@ static const SSysDbTableSchema userUsersFullSchema[] = { {.name = "enable", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, {.name = "sysinfo", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, {.name = "createdb", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, - {.name = "encrypted_pass", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, + {.name = "encrypted_pass", .bytes = TSDB_PASSWORD_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "allowed_host", .bytes = TSDB_PRIVILEDGE_HOST_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 698714da86..61af2f6aae 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -2983,7 +2983,7 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt } } else { if (varDataTLen(data + offset) > bytes) { - uError("var data length invalid, varDataTLen(data + offset):%d >= bytes:%d", (int)varDataTLen(data + offset), + uError("var data length invalid, varDataTLen(data + offset):%d > bytes:%d", (int)varDataTLen(data + offset), bytes); code = TSDB_CODE_PAR_VALUE_TOO_LONG; goto _exit; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index db5edba6bf..110fb23b87 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -182,8 +182,12 @@ int32_t tsRedirectMaxPeriod = 1000; int32_t tsMaxRetryWaitTime = 10000; bool tsUseAdapter = false; int32_t tsMetaCacheMaxSize = -1; // MB -int32_t tsSlowLogThreshold = 3; // seconds -int32_t tsSlowLogScope = SLOW_LOG_TYPE_ALL; +int32_t tsSlowLogThreshold = 10; // seconds +int32_t tsSlowLogThresholdTest = INT32_MAX; // seconds +char tsSlowLogExceptDb[TSDB_DB_NAME_LEN] = ""; // seconds +int32_t tsSlowLogScope = SLOW_LOG_TYPE_QUERY; +char* tsSlowLogScopeString = "query"; +int32_t tsSlowLogMaxLen = 4096; int32_t tsTimeSeriesThreshold = 50; bool tsMultiResultFunctionStarReturnTags = false; @@ -391,9 +395,7 @@ int32_t taosSetS3Cfg(SConfig *pCfg) { return 0; } -struct SConfig *taosGetCfg() { - return tsCfg; -} +struct SConfig *taosGetCfg() { return tsCfg; } static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile, char *apolloUrl) { @@ -546,9 +548,6 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { return -1; if (cfgAddInt32(pCfg, "metaCacheMaxSize", tsMetaCacheMaxSize, -1, INT32_MAX, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1; - if (cfgAddInt32(pCfg, "slowLogThreshold", tsSlowLogThreshold, 0, INT32_MAX, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) - return -1; - if (cfgAddString(pCfg, "slowLogScope", "", CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1; tsNumOfRpcThreads = tsNumOfCores / 2; tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS); @@ -573,9 +572,6 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { return -1; if (cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1; - if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1; - if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1; - if (cfgAddBool(pCfg, "multiResultFunctionStarReturnTags", tsMultiResultFunctionStarReturnTags, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1; @@ -706,6 +702,15 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt64(pCfg, "mndLogRetention", tsMndLogRetention, 500, 10000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddBool(pCfg, "skipGrant", tsMndSkipGrant, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; + if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 86400, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + + if (cfgAddInt32(pCfg, "slowLogThresholdTest", tsSlowLogThresholdTest, 0, INT32_MAX, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "slowLogThreshold", tsSlowLogThreshold, 1, INT32_MAX, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "slowLogMaxLen", tsSlowLogMaxLen, 1, 16384, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddString(pCfg, "slowLogScope", tsSlowLogScopeString, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddString(pCfg, "slowLogExceptDb", tsSlowLogExceptDb, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddInt32(pCfg, "monitorPort", tsMonitorPort, 1, 65056, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddInt32(pCfg, "monitorMaxLogs", tsMonitorMaxLogs, 1, 1000000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; @@ -970,40 +975,52 @@ static void taosSetServerLogCfg(SConfig *pCfg) { sndDebugFlag = cfgGetItem(pCfg, "sndDebugFlag")->i32; } -static int32_t taosSetSlowLogScope(const char *pScope) { +int32_t taosSetSlowLogScope(char *pScope) { if (NULL == pScope || 0 == strlen(pScope)) { - tsSlowLogScope = SLOW_LOG_TYPE_ALL; - return 0; + return SLOW_LOG_TYPE_QUERY; } - if (0 == strcasecmp(pScope, "all")) { - tsSlowLogScope = SLOW_LOG_TYPE_ALL; - return 0; + int32_t slowScope = 0; + + char* scope = NULL; + char *tmp = NULL; + while((scope = strsep(&pScope, "|")) != NULL){ + taosMemoryFreeClear(tmp); + tmp = taosStrdup(scope); + strtrim(tmp); + if (0 == strcasecmp(tmp, "all")) { + slowScope |= SLOW_LOG_TYPE_ALL; + continue; + } + + if (0 == strcasecmp(tmp, "query")) { + slowScope |= SLOW_LOG_TYPE_QUERY; + continue; + } + + if (0 == strcasecmp(tmp, "insert")) { + slowScope |= SLOW_LOG_TYPE_INSERT; + continue; + } + + if (0 == strcasecmp(tmp, "others")) { + slowScope |= SLOW_LOG_TYPE_OTHERS; + continue; + } + + if (0 == strcasecmp(tmp, "none")) { + slowScope |= SLOW_LOG_TYPE_NULL; + continue; + } + + taosMemoryFreeClear(tmp); + uError("Invalid slowLog scope value:%s", pScope); + terrno = TSDB_CODE_INVALID_CFG_VALUE; + return -1; } - if (0 == strcasecmp(pScope, "query")) { - tsSlowLogScope = SLOW_LOG_TYPE_QUERY; - return 0; - } - - if (0 == strcasecmp(pScope, "insert")) { - tsSlowLogScope = SLOW_LOG_TYPE_INSERT; - return 0; - } - - if (0 == strcasecmp(pScope, "others")) { - tsSlowLogScope = SLOW_LOG_TYPE_OTHERS; - return 0; - } - - if (0 == strcasecmp(pScope, "none")) { - tsSlowLogScope = 0; - return 0; - } - - uError("Invalid slowLog scope value:%s", pScope); - terrno = TSDB_CODE_INVALID_CFG_VALUE; - return -1; + taosMemoryFreeClear(tmp); + return slowScope; } // for common configs @@ -1061,12 +1078,6 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval; tsQueryMaxConcurrentTables = cfgGetItem(pCfg, "queryMaxConcurrentTables")->i64; tsMetaCacheMaxSize = cfgGetItem(pCfg, "metaCacheMaxSize")->i32; - tsSlowLogThreshold = cfgGetItem(pCfg, "slowLogThreshold")->i32; - tsEnableMonitor = cfgGetItem(pCfg, "monitor")->bval; - tsMonitorInterval = cfgGetItem(pCfg, "monitorInterval")->i32; - if (taosSetSlowLogScope(cfgGetItem(pCfg, "slowLogScope")->str)) { - return -1; - } tsCountAlwaysReturnValue = cfgGetItem(pCfg, "countAlwaysReturnValue")->i32; tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; @@ -1142,6 +1153,16 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsSIMDEnable = (bool)cfgGetItem(pCfg, "simdEnable")->bval; tsTagFilterCache = (bool)cfgGetItem(pCfg, "tagFilterCache")->bval; + tstrncpy(tsSlowLogExceptDb, cfgGetItem(pCfg, "slowLogExceptDb")->str, TSDB_DB_NAME_LEN); + tsSlowLogThresholdTest = cfgGetItem(pCfg, "slowLogThresholdTest")->i32; + tsSlowLogThreshold = cfgGetItem(pCfg, "slowLogThreshold")->i32; + tsSlowLogMaxLen = cfgGetItem(pCfg, "slowLogMaxLen")->i32; + int32_t scope = taosSetSlowLogScope(cfgGetItem(pCfg, "slowLogScope")->str); + if(scope < 0){ + return -1; + } + tsSlowLogScope = scope; + tsEnableMonitor = cfgGetItem(pCfg, "monitor")->bval; tsMonitorInterval = cfgGetItem(pCfg, "monitorInterval")->i32; tstrncpy(tsMonitorFqdn, cfgGetItem(pCfg, "monitorFqdn")->str, TSDB_FQDN_LEN); @@ -1429,8 +1450,7 @@ static int32_t taosCfgSetOption(OptionNameAndVar *pOptions, int32_t optionSize, char *name = pItem->name; for (int32_t d = 0; d < optionSize; ++d) { const char *optName = pOptions[d].optionName; - int32_t optLen = strlen(optName); - if (strncasecmp(name, optName, optLen) != 0) continue; + if (strcasecmp(name, optName) != 0) continue; switch (pItem->dtype) { case CFG_DTYPE_BOOL: { int32_t flag = pItem->i32; @@ -1503,6 +1523,23 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { return 0; } + if (strcasecmp("slowLogScope", name) == 0) { + int32_t scope = taosSetSlowLogScope(pItem->str); + if(scope < 0){ + cfgUnLock(pCfg); + return -1; + } + tsSlowLogScope = scope; + cfgUnLock(pCfg); + return 0; + } + + if (strcasecmp("slowLogExceptDb", name) == 0) { + tstrncpy(tsSlowLogExceptDb, pItem->str, TSDB_DB_NAME_LEN); + cfgUnLock(pCfg); + return 0; + } + { // 'bool/int32_t/int64_t/float/double' variables with general modification function static OptionNameAndVar debugOptions[] = { {"dDebugFlag", &dDebugFlag}, {"vDebugFlag", &vDebugFlag}, {"mDebugFlag", &mDebugFlag}, @@ -1520,6 +1557,10 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { {"enableWhiteList", &tsEnableWhiteList}, {"telemetryReporting", &tsEnableTelem}, {"monitor", &tsEnableMonitor}, + {"monitorInterval", &tsMonitorInterval}, + {"slowLogThreshold", &tsSlowLogThreshold}, + {"slowLogThresholdTest", &tsSlowLogThresholdTest}, + {"slowLogMaxLen", &tsSlowLogMaxLen}, {"mndSdbWriteDelta", &tsMndSdbWriteDelta}, {"minDiskFreeSize", &tsMinDiskFreeSize}, @@ -1662,10 +1703,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { tsLogSpace.reserved = (int64_t)(((double)pItem->fval) * 1024 * 1024 * 1024); uInfo("%s set to %" PRId64, name, tsLogSpace.reserved); matched = true; - } else if (strcasecmp("monitor", name) == 0) { - tsEnableMonitor = pItem->bval; - uInfo("%s set to %d", name, tsEnableMonitor); - matched = true; } break; } @@ -1709,13 +1746,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { cfgSetItem(pCfg, "firstEp", tsFirst, pFirstEpItem->stype, false); uInfo("localEp set to '%s', tsFirst set to '%s'", tsLocalEp, tsFirst); matched = true; - } else if (strcasecmp("slowLogScope", name) == 0) { - if (taosSetSlowLogScope(pItem->str)) { - cfgUnLock(pCfg); - return -1; - } - uInfo("%s set to %s", name, pItem->str); - matched = true; } break; } @@ -1776,7 +1806,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { {"queryUseNodeAllocator", &tsQueryUseNodeAllocator}, {"smlDot2Underline", &tsSmlDot2Underline}, {"shellActivityTimer", &tsShellActivityTimer}, - {"slowLogThreshold", &tsSlowLogThreshold}, {"useAdapter", &tsUseAdapter}, {"experimental", &tsExperimental}, {"multiResultFunctionStarReturnTags", &tsMultiResultFunctionStarReturnTags}, diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index fa1ff00757..1d66a8c323 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -69,6 +69,28 @@ pReq->sql = NULL; \ } while (0) +static int32_t tSerializeSMonitorParas(SEncoder *encoder, const SMonitorParas* pMonitorParas) { + if (tEncodeI8(encoder, pMonitorParas->tsEnableMonitor) < 0) return -1; + if (tEncodeI32(encoder, pMonitorParas->tsMonitorInterval) < 0) return -1; + if (tEncodeI32(encoder, pMonitorParas->tsSlowLogScope) < 0) return -1; + if (tEncodeI32(encoder, pMonitorParas->tsSlowLogMaxLen) < 0) return -1; + if (tEncodeI32(encoder, pMonitorParas->tsSlowLogThreshold) < 0) return -1; + if (tEncodeI32(encoder, pMonitorParas->tsSlowLogThresholdTest) < 0) return -1; + if (tEncodeCStr(encoder, pMonitorParas->tsSlowLogExceptDb) < 0) return -1; + return 0; +} + +static int32_t tDeserializeSMonitorParas(SDecoder *decoder, SMonitorParas* pMonitorParas){ + if (tDecodeI8(decoder, (int8_t *)&pMonitorParas->tsEnableMonitor) < 0) return -1; + if (tDecodeI32(decoder, &pMonitorParas->tsMonitorInterval) < 0) return -1; + if (tDecodeI32(decoder, &pMonitorParas->tsSlowLogScope) < 0) return -1; + if (tDecodeI32(decoder, &pMonitorParas->tsSlowLogMaxLen) < 0) return -1; + if (tDecodeI32(decoder, &pMonitorParas->tsSlowLogThreshold) < 0) return -1; + if (tDecodeI32(decoder, &pMonitorParas->tsSlowLogThresholdTest) < 0) return -1; + if (tDecodeCStrTo(decoder, pMonitorParas->tsSlowLogExceptDb) < 0) return -1; + return 0; +} + static int32_t tDecodeSVAlterTbReqCommon(SDecoder *pDecoder, SVAlterTbReq *pReq); static int32_t tDecodeSBatchDeleteReqCommon(SDecoder *pDecoder, SBatchDeleteReq *pReq); static int32_t tEncodeTableTSMAInfoRsp(SEncoder *pEncoder, const STableTSMAInfoRsp *pRsp); @@ -519,6 +541,7 @@ int32_t tSerializeSClientHbBatchRsp(void *buf, int32_t bufLen, const SClientHbBa SClientHbRsp *pRsp = taosArrayGet(pBatchRsp->rsps, i); if (tSerializeSClientHbRsp(&encoder, pRsp) < 0) return -1; } + if (tSerializeSMonitorParas(&encoder, &pBatchRsp->monitorParas) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -546,6 +569,10 @@ int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchR taosArrayPush(pBatchRsp->rsps, &rsp); } + if (!tDecodeIsEnd(&decoder)) { + if (tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas) < 0) return -1; + } + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; @@ -1308,6 +1335,9 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { } if (tEncodeI64(&encoder, pReq->ipWhiteVer) < 0) return -1; + + if (tSerializeSMonitorParas(&encoder, &pReq->clusterCfg.monitorParas) < 0) return -1; + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -1426,6 +1456,10 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeI64(&decoder, &pReq->ipWhiteVer) < 0) return -1; } + if (!tDecodeIsEnd(&decoder)) { + if (tDeserializeSMonitorParas(&decoder, &pReq->clusterCfg.monitorParas) < 0) return -1; + } + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; @@ -1521,6 +1555,7 @@ int32_t tSerializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) { if (tEncodeI32(&encoder, pReq->contLen) < 0) return -1; if (tEncodeCStr(&encoder, pReq->pCont) < 0) return -1; + if (tEncodeI8(&encoder, pReq->type) < 0) return -1; tEndEncode(&encoder); @@ -1541,7 +1576,9 @@ int32_t tDeserializeSStatisReq(void *buf, int32_t bufLen, SStatisReq *pReq) { if (pReq->pCont == NULL) return -1; if (tDecodeCStrTo(&decoder, pReq->pCont) < 0) return -1; } - + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, (int8_t*)&pReq->type) < 0) return -1; + } tEndDecode(&decoder); tDecoderClear(&decoder); return 0; @@ -5153,6 +5190,7 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { if (tEncodeI32(&encoder, pRsp->passVer) < 0) return -1; if (tEncodeI32(&encoder, pRsp->authVer) < 0) return -1; if (tEncodeI64(&encoder, pRsp->whiteListVer) < 0) return -1; + if (tSerializeSMonitorParas(&encoder, &pRsp->monitorParas) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -5194,6 +5232,9 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { } else { pRsp->whiteListVer = 0; } + if (!tDecodeIsEnd(&decoder)) { + if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) return -1; + } tEndDecode(&decoder); tDecoderClear(&decoder); @@ -10481,7 +10522,10 @@ int32_t tCloneTbTSMAInfo(STableTSMAInfo *pInfo, STableTSMAInfo **pRes) { pRet->ast = taosStrdup(pInfo->ast); if (!pRet->ast) code = TSDB_CODE_OUT_OF_MEMORY; } - if (code) tFreeTableTSMAInfo(pRet); + if (code) { + tFreeTableTSMAInfo(pRet); + pRet = NULL; + } *pRes = pRet; return code; } diff --git a/source/common/src/tvariant.c b/source/common/src/tvariant.c index aad877312b..d8e7b83c37 100644 --- a/source/common/src/tvariant.c +++ b/source/common/src/tvariant.c @@ -161,8 +161,7 @@ int32_t toIntegerPure(const char *z, int32_t n, int32_t base, int64_t *value) { int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { errno = 0; char *endPtr = NULL; - switch (type) - { + switch (type) { case TK_NK_INTEGER: { *value = taosStr2Int64(z, &endPtr, 10); if (errno == ERANGE || errno == EINVAL || endPtr - z != n) { @@ -172,7 +171,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { } break; case TK_NK_FLOAT: { double val = round(taosStr2Double(z, &endPtr)); - if(val < (double)INT64_MIN || val > (double)INT64_MAX){ + if (val < (double)INT64_MIN || val > (double)INT64_MAX) { return TSDB_CODE_FAILED; } if (errno == ERANGE || errno == EINVAL || endPtr - z != n) { @@ -181,8 +180,8 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { *value = val; return TSDB_CODE_SUCCESS; } break; - default: - break; + default: + break; } if (n == 0) { @@ -201,7 +200,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { // pure decimal part const char *s = endPtr + 1; const char *end = z + n; - bool pure = true; + bool pure = true; while (s < end) { if (*s < '0' || *s > '9') { pure = false; @@ -210,17 +209,17 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { s++; } if (pure) { - if (endPtr+1 < end && endPtr[1] > '4') { + if (endPtr + 1 < end && endPtr[1] > '4') { const char *p = z; while (*p == ' ') { p++; } if (*p == '-') { - if ( *value > INT64_MIN) { + if (*value > INT64_MIN) { (*value)--; } } else { - if ( *value < INT64_MAX) { + if (*value < INT64_MAX) { (*value)++; } } @@ -229,7 +228,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { } } - // 2. parse as other + // 2. parse as other bool is_neg = false; uint64_t uv = 0; int32_t code = parseSignAndUInteger(z, n, &is_neg, &uv, true); @@ -256,7 +255,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { int32_t toUIntegerEx(const char *z, int32_t n, uint32_t type, uint64_t *value) { errno = 0; - char *endPtr = NULL; + char *endPtr = NULL; const char *p = z; switch (type) { case TK_NK_INTEGER: { diff --git a/source/common/test/commonTests.cpp b/source/common/test/commonTests.cpp index d30b26e564..360d1ed31a 100644 --- a/source/common/test/commonTests.cpp +++ b/source/common/test/commonTests.cpp @@ -726,4 +726,118 @@ TEST(AlreadyAddGroupIdTest, GroupIdAddedWithDifferentLength) { EXPECT_FALSE(result); } +#define SLOW_LOG_TYPE_NULL 0x0 +#define SLOW_LOG_TYPE_QUERY 0x1 +#define SLOW_LOG_TYPE_INSERT 0x2 +#define SLOW_LOG_TYPE_OTHERS 0x4 +#define SLOW_LOG_TYPE_ALL 0x7 + +static int32_t taosSetSlowLogScope(char *pScope) { + if (NULL == pScope || 0 == strlen(pScope)) { + return SLOW_LOG_TYPE_QUERY; + } + + int32_t slowScope = 0; + + char* scope = NULL; + char *tmp = NULL; + while((scope = strsep(&pScope, "|")) != NULL){ + taosMemoryFreeClear(tmp); + tmp = taosStrdup(scope); + strtrim(tmp); + if (0 == strcasecmp(tmp, "all")) { + slowScope |= SLOW_LOG_TYPE_ALL; + continue; + } + + if (0 == strcasecmp(tmp, "query")) { + slowScope |= SLOW_LOG_TYPE_QUERY; + continue; + } + + if (0 == strcasecmp(tmp, "insert")) { + slowScope |= SLOW_LOG_TYPE_INSERT; + continue; + } + + if (0 == strcasecmp(tmp, "others")) { + slowScope |= SLOW_LOG_TYPE_OTHERS; + continue; + } + + if (0 == strcasecmp(tmp, "none")) { + slowScope |= SLOW_LOG_TYPE_NULL; + continue; + } + + taosMemoryFreeClear(tmp); + uError("Invalid slowLog scope value:%s", pScope); + terrno = TSDB_CODE_INVALID_CFG_VALUE; + return -1; + } + + taosMemoryFreeClear(tmp); + return slowScope; +} + +TEST(TaosSetSlowLogScopeTest, NullPointerInput) { + char *pScope = NULL; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, SLOW_LOG_TYPE_QUERY); +} + +TEST(TaosSetSlowLogScopeTest, EmptyStringInput) { + char pScope[1] = ""; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, SLOW_LOG_TYPE_QUERY); +} + +TEST(TaosSetSlowLogScopeTest, AllScopeInput) { + char pScope[] = "all"; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, SLOW_LOG_TYPE_ALL); +} + +TEST(TaosSetSlowLogScopeTest, QueryScopeInput) { + char pScope[] = " query"; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, SLOW_LOG_TYPE_QUERY); +} + +TEST(TaosSetSlowLogScopeTest, InsertScopeInput) { + char pScope[] = "insert"; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, SLOW_LOG_TYPE_INSERT); +} + +TEST(TaosSetSlowLogScopeTest, OthersScopeInput) { + char pScope[] = "others"; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, SLOW_LOG_TYPE_OTHERS); +} + +TEST(TaosSetSlowLogScopeTest, NoneScopeInput) { + char pScope[] = "none"; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, SLOW_LOG_TYPE_NULL); +} + +TEST(TaosSetSlowLogScopeTest, InvalidScopeInput) { + char pScope[] = "invalid"; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, -1); +} + +TEST(TaosSetSlowLogScopeTest, MixedScopesInput) { + char pScope[] = "query|insert|others|none"; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, (SLOW_LOG_TYPE_QUERY | SLOW_LOG_TYPE_INSERT | SLOW_LOG_TYPE_OTHERS)); +} + +TEST(TaosSetSlowLogScopeTest, MixedScopesInputWithSpaces) { + char pScope[] = "query | insert | others "; + int32_t result = taosSetSlowLogScope(pScope); + EXPECT_EQ(result, (SLOW_LOG_TYPE_QUERY | SLOW_LOG_TYPE_INSERT | SLOW_LOG_TYPE_OTHERS)); +} + #pragma GCC diagnostic pop diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 800f7f7864..0360b54d6f 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -53,7 +53,8 @@ static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) { .msgType = TDMT_MND_RETRIEVE_IP_WHITE, .info.ahandle = (void *)0x9527, .info.refId = 0, - .info.noResp = 0}; + .info.noResp = 0, + .info.handle = 0}; SEpSet epset = {0}; dmGetMnodeEpSet(pMgmt->pData, &epset); @@ -116,6 +117,13 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { req.clusterCfg.enableWhiteList = tsEnableWhiteList ? 1 : 0; req.clusterCfg.encryptionKeyStat = tsEncryptionKeyStat; req.clusterCfg.encryptionKeyChksum = tsEncryptionKeyChksum; + req.clusterCfg.monitorParas.tsEnableMonitor = tsEnableMonitor; + req.clusterCfg.monitorParas.tsMonitorInterval = tsMonitorInterval; + req.clusterCfg.monitorParas.tsSlowLogScope = tsSlowLogScope; + req.clusterCfg.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen; + req.clusterCfg.monitorParas.tsSlowLogThreshold = tsSlowLogThreshold; + req.clusterCfg.monitorParas.tsSlowLogThresholdTest = tsSlowLogThresholdTest; + tstrncpy(req.clusterCfg.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN); char timestr[32] = "1970-01-01 00:00:00.00"; (void)taosParseTime(timestr, &req.clusterCfg.checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0); memcpy(req.clusterCfg.timezone, tsTimezoneStr, TD_TIMEZONE_LEN); @@ -147,7 +155,8 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527, .info.refId = 0, - .info.noResp = 0}; + .info.noResp = 0, + .info.handle = 0}; SRpcMsg rpcRsp = {0}; dTrace("send status req to mnode, dnodeVer:%" PRId64 " statusSeq:%d", req.dnodeVer, req.statusSeq); @@ -179,7 +188,8 @@ void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) { .msgType = TDMT_MND_NOTIFY, .info.ahandle = (void *)0x9527, .info.refId = 0, - .info.noResp = 1}; + .info.noResp = 1, + .info.handle = 0}; SEpSet epSet = {0}; dmGetMnodeEpSet(pMgmt->pData, &epSet); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 6649d164a5..74bf1f964c 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -290,6 +290,7 @@ static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) { dError("failed to send rpc msg:%s since %s, handle:%p", TMSG_INFO(pMsg->msgType), terrstr(), pMsg->info.handle); return -1; } else { + pMsg->info.handle = 0; rpcSendRequest(pDnode->trans.clientRpc, pEpSet, pMsg, NULL); return 0; } diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 46e606d3ea..089c4a10b3 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -143,6 +143,12 @@ typedef enum { DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH, DND_REASON_ENABLE_WHITELIST_NOT_MATCH, DND_REASON_ENCRYPTION_KEY_NOT_MATCH, + DND_REASON_STATUS_MONITOR_NOT_MATCH, + DND_REASON_STATUS_MONITOR_SWITCH_NOT_MATCH, + DND_REASON_STATUS_MONITOR_INTERVAL_NOT_MATCH, + DND_REASON_STATUS_MONITOR_SLOW_LOG_THRESHOLD_NOT_MATCH, + DND_REASON_STATUS_MONITOR_SLOW_LOG_SQL_MAX_LEN_NOT_MATCH, + DND_REASON_STATUS_MONITOR_SLOW_LOG_SCOPE_NOT_MATCH, DND_REASON_OTHERS } EDndReason; diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h index 8008eb76e7..7f039bc21f 100644 --- a/source/dnode/mnode/impl/inc/mndTrans.h +++ b/source/dnode/mnode/impl/inc/mndTrans.h @@ -84,6 +84,7 @@ void mndTransSetParallel(STrans *pTrans); void mndTransSetChangeless(STrans *pTrans); void mndTransSetOper(STrans *pTrans, EOperType oper); int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans); +int32_t mndTransCheckConflictWithCompact(SMnode *pMnode, STrans *pTrans); #ifndef BUILD_NO_CALL static int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) { return mndTransCheckConflict(pMnode, pTrans); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 8847158c11..73addea6fe 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -49,6 +49,12 @@ static const char *offlineReason[] = { "ttlChangeOnWrite not match", "enableWhiteList not match", "encryptionKey not match", + "monitor not match", + "monitor switch not match", + "monitor interval not match", + "monitor slow log threshold not match", + "monitor slow log sql max len not match", + "monitor slow log scope not match", "unknown", }; @@ -438,7 +444,27 @@ void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeInfo) { } } +#define CHECK_MONITOR_PARA(para,err) \ +if (pCfg->monitorParas.para != para) { \ + mError("dnode:%d, para:%d inconsistent with cluster:%d", pDnode->id, pCfg->monitorParas.para, para); \ + terrno = err; \ + return err;\ +} + static int32_t mndCheckClusterCfgPara(SMnode *pMnode, SDnodeObj *pDnode, const SClusterCfg *pCfg) { + CHECK_MONITOR_PARA(tsEnableMonitor, DND_REASON_STATUS_MONITOR_SWITCH_NOT_MATCH); + CHECK_MONITOR_PARA(tsMonitorInterval, DND_REASON_STATUS_MONITOR_INTERVAL_NOT_MATCH); + CHECK_MONITOR_PARA(tsSlowLogThreshold, DND_REASON_STATUS_MONITOR_SLOW_LOG_THRESHOLD_NOT_MATCH); + CHECK_MONITOR_PARA(tsSlowLogThresholdTest, DND_REASON_STATUS_MONITOR_NOT_MATCH); + CHECK_MONITOR_PARA(tsSlowLogMaxLen, DND_REASON_STATUS_MONITOR_SLOW_LOG_SQL_MAX_LEN_NOT_MATCH); + CHECK_MONITOR_PARA(tsSlowLogScope, DND_REASON_STATUS_MONITOR_SLOW_LOG_SCOPE_NOT_MATCH); + + if (0 != strcasecmp(pCfg->monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb)) { + mError("dnode:%d, tsSlowLogExceptDb:%s inconsistent with cluster:%s", pDnode->id, pCfg->monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb); + terrno = TSDB_CODE_DNODE_INVALID_MONITOR_PARAS; + return DND_REASON_STATUS_MONITOR_NOT_MATCH; + } + if (pCfg->statusInterval != tsStatusInterval) { mError("dnode:%d, statusInterval:%d inconsistent with cluster:%d", pDnode->id, pCfg->statusInterval, tsStatusInterval); @@ -530,14 +556,13 @@ static bool mndUpdateMnodeState(SMnodeObj *pObj, SMnodeLoad *pMload) { return stateChanged; } +extern char* tsMonFwUri; +extern char* tsMonSlowLogUri; static int32_t mndProcessStatisReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; SStatisReq statisReq = {0}; int32_t code = -1; - char strClusterId[TSDB_CLUSTER_ID_LEN] = {0}; - sprintf(strClusterId, "%" PRId64, pMnode->clusterId); - if (tDeserializeSStatisReq(pReq->pCont, pReq->contLen, &statisReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return code; @@ -547,188 +572,14 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) { mInfo("process statis req,\n %s", statisReq.pCont); } - SJson *pJson = tjsonParse(statisReq.pCont); - - int32_t ts_size = tjsonGetArraySize(pJson); - - for (int32_t i = 0; i < ts_size; i++) { - SJson *item = tjsonGetArrayItem(pJson, i); - - SJson *tables = tjsonGetObjectItem(item, "tables"); - - int32_t tableSize = tjsonGetArraySize(tables); - for (int32_t i = 0; i < tableSize; i++) { - SJson *table = tjsonGetArrayItem(tables, i); - - char tableName[MONITOR_TABLENAME_LEN] = {0}; - tjsonGetStringValue(table, "name", tableName); - - SJson *metricGroups = tjsonGetObjectItem(table, "metric_groups"); - - int32_t size = tjsonGetArraySize(metricGroups); - for (int32_t i = 0; i < size; i++) { - SJson *item = tjsonGetArrayItem(metricGroups, i); - - SJson *arrayTag = tjsonGetObjectItem(item, "tags"); - - int32_t tagSize = tjsonGetArraySize(arrayTag); - for (int32_t j = 0; j < tagSize; j++) { - SJson *item = tjsonGetArrayItem(arrayTag, j); - - char tagName[MONITOR_TAG_NAME_LEN] = {0}; - tjsonGetStringValue(item, "name", tagName); - - if (strncmp(tagName, "cluster_id", MONITOR_TAG_NAME_LEN) == 0) { - tjsonDeleteItemFromObject(item, "value"); - tjsonAddStringToObject(item, "value", strClusterId); - } - } - } - } - } - - char *pCont = tjsonToString(pJson); - monSendContent(pCont); - - if (pJson != NULL) { - tjsonDelete(pJson); - pJson = NULL; - } - - if (pCont != NULL) { - taosMemoryFree(pCont); - pCont = NULL; + if (statisReq.type == MONITOR_TYPE_COUNTER){ + monSendContent(statisReq.pCont, tsMonFwUri); + }else if(statisReq.type == MONITOR_TYPE_SLOW_LOG){ + monSendContent(statisReq.pCont, tsMonSlowLogUri); } tFreeSStatisReq(&statisReq); return 0; - - /* - SJson* pJson = tjsonParse(statisReq.pCont); - - int32_t ts_size = tjsonGetArraySize(pJson); - - for(int32_t i = 0; i < ts_size; i++){ - SJson* item = tjsonGetArrayItem(pJson, i); - - SJson* tables = tjsonGetObjectItem(item, "tables"); - - int32_t tableSize = tjsonGetArraySize(tables); - for(int32_t i = 0; i < tableSize; i++){ - SJson* table = tjsonGetArrayItem(tables, i); - - char tableName[MONITOR_TABLENAME_LEN] = {0}; - tjsonGetStringValue(table, "name", tableName); - - SJson* metricGroups = tjsonGetObjectItem(table, "metric_groups"); - - int32_t size = tjsonGetArraySize(metricGroups); - for(int32_t i = 0; i < size; i++){ - SJson* item = tjsonGetArrayItem(metricGroups, i); - - SJson* arrayTag = tjsonGetObjectItem(item, "tags"); - - int32_t tagSize = tjsonGetArraySize(arrayTag); - - char** labels = taosMemoryMalloc(sizeof(char*) * tagSize); - char** sample_labels = taosMemoryMalloc(sizeof(char*) * tagSize); - - for(int32_t j = 0; j < tagSize; j++){ - SJson* item = tjsonGetArrayItem(arrayTag, j); - - *(labels + j) = taosMemoryMalloc(MONITOR_TAG_NAME_LEN); - tjsonGetStringValue(item, "name", *(labels + j)); - - *(sample_labels + j) = taosMemoryMalloc(MONITOR_TAG_VALUE_LEN); - tjsonGetStringValue(item, "value", *(sample_labels + j)); - if(strncmp(*(labels + j), "cluster_id", MONITOR_TAG_NAME_LEN) == 0) { - strncpy(*(sample_labels + j), strClusterId, MONITOR_TAG_VALUE_LEN); - } - } - - SJson* metrics = tjsonGetObjectItem(item, "metrics"); - - int32_t metricLen = tjsonGetArraySize(metrics); - for(int32_t j = 0; j < metricLen; j++){ - SJson *item = tjsonGetArrayItem(metrics, j); - - char name[MONITOR_METRIC_NAME_LEN] = {0}; - tjsonGetStringValue(item, "name", name); - - double value = 0; - tjsonGetDoubleValue(item, "value", &value); - - double type = 0; - tjsonGetDoubleValue(item, "type", &type); - - int32_t metricNameLen = strlen(name) + strlen(tableName) + 2; - char* metricName = taosMemoryMalloc(metricNameLen); - memset(metricName, 0, metricNameLen); - sprintf(metricName, "%s:%s", tableName, name); - - taos_metric_t* metric = taos_collector_registry_get_metric(metricName); - if(metric == NULL){ - if(type == 0){ - metric = taos_counter_new(metricName, "", tagSize, (const char**)labels); - } - if(type == 1){ - metric = taos_gauge_new(metricName, "", tagSize, (const char**)labels); - } - mTrace("fail to get metric from registry, new one metric:%p", metric); - - if(taos_collector_registry_register_metric(metric) == 1){ - if(type == 0){ - taos_counter_destroy(metric); - } - if(type == 1){ - taos_gauge_destroy(metric); - } - - metric = taos_collector_registry_get_metric(metricName); - - mTrace("fail to register metric, get metric from registry:%p", metric); - } - else{ - mTrace("succeed to register metric:%p", metric); - } - } - else{ - mTrace("get metric from registry:%p", metric); - } - - if(type == 0){ - taos_counter_add(metric, value, (const char**)sample_labels); - } - if(type == 1){ - taos_gauge_set(metric, value, (const char**)sample_labels); - } - - taosMemoryFreeClear(metricName); - } - - for(int32_t j = 0; j < tagSize; j++){ - taosMemoryFreeClear(*(labels + j)); - taosMemoryFreeClear(*(sample_labels + j)); - } - - taosMemoryFreeClear(sample_labels); - taosMemoryFreeClear(labels); - } - } - - } - - code = 0; - - _OVER: - if(pJson != NULL){ - tjsonDelete(pJson); - pJson = NULL; - } - - tFreeSStatisReq(&statisReq); - return code; - */ } static int32_t mndUpdateDnodeObj(SMnode *pMnode, SDnodeObj *pDnode) { @@ -1092,6 +943,32 @@ _OVER: return code; } +static void getSlowLogScopeString(int32_t scope, char* result){ + if(scope == SLOW_LOG_TYPE_NULL) { + strcat(result, "NONE"); + return; + } + while(scope > 0){ + if(scope & SLOW_LOG_TYPE_QUERY) { + strcat(result, "QUERY"); + scope &= ~SLOW_LOG_TYPE_QUERY; + } else if(scope & SLOW_LOG_TYPE_INSERT) { + strcat(result, "INSERT"); + scope &= ~SLOW_LOG_TYPE_INSERT; + } else if(scope & SLOW_LOG_TYPE_OTHERS) { + strcat(result, "OTHERS"); + scope &= ~SLOW_LOG_TYPE_OTHERS; + } else{ + printf("invalid slow log scope:%d", scope); + return; + } + + if(scope > 0) { + strcat(result, "|"); + } + } +} + static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) { SShowVariablesRsp rsp = {0}; int32_t code = -1; @@ -1100,7 +977,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) { goto _OVER; } - rsp.variables = taosArrayInit(4, sizeof(SVariablesInfo)); + rsp.variables = taosArrayInit(16, sizeof(SVariablesInfo)); if (NULL == rsp.variables) { mError("failed to alloc SVariablesInfo array while process show variables req"); terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -1129,6 +1006,33 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) { strcpy(info.scope, "both"); taosArrayPush(rsp.variables, &info); + strcpy(info.name, "monitor"); + snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsEnableMonitor); + strcpy(info.scope, "server"); + taosArrayPush(rsp.variables, &info); + + strcpy(info.name, "monitorInterval"); + snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsMonitorInterval); + strcpy(info.scope, "server"); + taosArrayPush(rsp.variables, &info); + + strcpy(info.name, "slowLogThreshold"); + snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogThreshold); + strcpy(info.scope, "server"); + taosArrayPush(rsp.variables, &info); + + strcpy(info.name, "slowLogMaxLen"); + snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogMaxLen); + strcpy(info.scope, "server"); + taosArrayPush(rsp.variables, &info); + + char scopeStr[64] = {0}; + getSlowLogScopeString(tsSlowLogScope, scopeStr); + strcpy(info.name, "slowLogScope"); + snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", scopeStr); + strcpy(info.scope, "server"); + taosArrayPush(rsp.variables, &info); + int32_t rspLen = tSerializeSShowVariablesRsp(NULL, 0, &rsp); void *pRsp = rpcMallocCont(rspLen); if (pRsp == NULL) { @@ -1679,6 +1583,28 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%s", tsCharset); totalRows++; + cfgOpts[totalRows] = "monitor"; + snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsEnableMonitor); + totalRows++; + + cfgOpts[totalRows] = "monitorInterval"; + snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsMonitorInterval); + totalRows++; + + cfgOpts[totalRows] = "slowLogThreshold"; + snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogThreshold); + totalRows++; + + cfgOpts[totalRows] = "slowLogMaxLen"; + snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogMaxLen); + totalRows++; + + char scopeStr[64] = {0}; + getSlowLogScopeString(tsSlowLogScope, scopeStr); + cfgOpts[totalRows] = "slowLogScope"; + snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%s", scopeStr); + totalRows++; + char buf[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0}; char bufVal[TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0}; diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 15ad292bf5..4224d79391 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -282,7 +282,6 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { } } -_CONNECT: pConn = mndCreateConn(pMnode, pReq->info.conn.user, connReq.connType, pReq->info.conn.clientIp, pReq->info.conn.clientPort, connReq.pid, connReq.app, connReq.startTime); if (pConn == NULL) { @@ -301,6 +300,13 @@ _CONNECT: connectRsp.svrTimestamp = taosGetTimestampSec(); connectRsp.passVer = pUser->passVersion; connectRsp.authVer = pUser->authVersion; + connectRsp.monitorParas.tsEnableMonitor = tsEnableMonitor; + connectRsp.monitorParas.tsMonitorInterval = tsMonitorInterval; + connectRsp.monitorParas.tsSlowLogScope = tsSlowLogScope; + connectRsp.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen; + connectRsp.monitorParas.tsSlowLogThreshold = tsSlowLogThreshold; + connectRsp.monitorParas.tsSlowLogThresholdTest = tsSlowLogThresholdTest; + tstrncpy(connectRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN); connectRsp.whiteListVer = pUser->ipWhiteListVer; strcpy(connectRsp.sVer, version); @@ -660,6 +666,13 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) { SClientHbBatchRsp batchRsp = {0}; batchRsp.svrTimestamp = taosGetTimestampSec(); batchRsp.rsps = taosArrayInit(0, sizeof(SClientHbRsp)); + batchRsp.monitorParas.tsEnableMonitor = tsEnableMonitor; + batchRsp.monitorParas.tsMonitorInterval = tsMonitorInterval; + batchRsp.monitorParas.tsSlowLogThreshold = tsSlowLogThreshold; + batchRsp.monitorParas.tsSlowLogThresholdTest = tsSlowLogThresholdTest; + tstrncpy(batchRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN); + batchRsp.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen; + batchRsp.monitorParas.tsSlowLogScope = tsSlowLogScope; int32_t sz = taosArrayGetSize(batchReq.reqs); for (int i = 0; i < sz; i++) { diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index af20617457..3291f6e3ed 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -56,7 +56,7 @@ static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int int64_t streamId, int32_t taskId, int32_t transId, int8_t mndTrigger); static int32_t mndProcessNodeCheck(SRpcMsg *pReq); static int32_t mndProcessNodeCheckReq(SRpcMsg *pMsg); -static int32_t extractNodeListFromStream(SMnode *pMnode, SArray* pNodeList); +static int32_t extractNodeListFromStream(SMnode *pMnode, SArray *pNodeList); static int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq); static int32_t mndProcessCheckpointReport(SRpcMsg *pReq); @@ -301,17 +301,17 @@ static int32_t mndCheckCreateStreamReq(SCMCreateStreamReq *pCreate) { return 0; } -static int32_t createSchemaByFields(const SArray* pFields, SSchemaWrapper* pWrapper) { +static int32_t createSchemaByFields(const SArray *pFields, SSchemaWrapper *pWrapper) { pWrapper->nCols = taosArrayGetSize(pFields); pWrapper->pSchema = taosMemoryCalloc(pWrapper->nCols, sizeof(SSchema)); if (NULL == pWrapper->pSchema) { return TSDB_CODE_OUT_OF_MEMORY; } - SNode* pNode; + SNode *pNode; int32_t index = 0; - for(int32_t i = 0; i < pWrapper->nCols; i++) { - SField* pField = (SField*)taosArrayGet(pFields, i); + for (int32_t i = 0; i < pWrapper->nCols; i++) { + SField *pField = (SField *)taosArrayGet(pFields, i); if (TSDB_DATA_TYPE_NULL == pField->type) { pWrapper->pSchema[index].type = TSDB_DATA_TYPE_VARCHAR; pWrapper->pSchema[index].bytes = VARSTR_HEADER_SIZE; @@ -328,14 +328,14 @@ static int32_t createSchemaByFields(const SArray* pFields, SSchemaWrapper* pWrap return TSDB_CODE_SUCCESS; } -static bool hasDestPrimaryKey(SSchemaWrapper* pWrapper) { +static bool hasDestPrimaryKey(SSchemaWrapper *pWrapper) { if (pWrapper->nCols < 2) { return false; } for (int32_t i = 1; i < pWrapper->nCols; i++) { - if(pWrapper->pSchema[i].flags & COL_IS_KEY) { + if (pWrapper->pSchema[i].flags & COL_IS_KEY) { return true; - } + } } return false; } @@ -445,7 +445,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, pObj->outputSchema.pSchema = pFullSchema; } - bool hasKey = hasDestPrimaryKey(&pObj->outputSchema); + bool hasKey = hasDestPrimaryKey(&pObj->outputSchema); SPlanContext cxt = { .pAstRoot = pAst, .topicQuery = false, @@ -492,7 +492,7 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) { SEncoder encoder; tEncoderInit(&encoder, NULL, 0); - if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER) { pTask->ver = SSTREAM_TASK_VER; } tEncodeStreamTask(&encoder, pTask); @@ -700,7 +700,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { SStreamObj streamObj = {0}; char *sql = NULL; int32_t sqlLen = 0; - const char* pMsg = "create stream tasks on dnodes"; + const char *pMsg = "create stream tasks on dnodes"; terrno = TSDB_CODE_SUCCESS; @@ -959,7 +959,8 @@ static int32_t doSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask return -1; } - code = setTransAction(pTrans, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, TSDB_CODE_SYN_PROPOSE_NOT_READY, 0); + code = + setTransAction(pTrans, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, TSDB_CODE_SYN_PROPOSE_NOT_READY, 0); if (code != 0) { taosMemoryFree(buf); } @@ -1106,7 +1107,7 @@ static int32_t mndCheckTaskAndNodeStatus(SMnode *pMnode) { ASSERT(taosArrayGetSize(execInfo.pTaskList) == 0); } - SArray* pInvalidList = taosArrayInit(4, sizeof(STaskId)); + SArray *pInvalidList = taosArrayInit(4, sizeof(STaskId)); for (int32_t i = 0; i < taosArrayGetSize(execInfo.pTaskList); ++i) { STaskId *p = taosArrayGet(execInfo.pTaskList, i); @@ -1116,8 +1117,8 @@ static int32_t mndCheckTaskAndNodeStatus(SMnode *pMnode) { } if (pEntry->status == TASK_STATUS__STOP) { - for(int32_t j = 0; j < taosArrayGetSize(pInvalidList); ++j) { - STaskId* pId = taosArrayGet(pInvalidList, j); + for (int32_t j = 0; j < taosArrayGetSize(pInvalidList); ++j) { + STaskId *pId = taosArrayGet(pInvalidList, j); if (pEntry->id.streamId == pId->streamId) { taosArrayPush(pInvalidList, &pEntry->id); break; @@ -1126,8 +1127,8 @@ static int32_t mndCheckTaskAndNodeStatus(SMnode *pMnode) { } if (pEntry->status != TASK_STATUS__READY) { - mDebug("s-task:0x%" PRIx64 "-0x%x (nodeId:%d) status:%s, checkpoint not issued", - pEntry->id.streamId, (int32_t)pEntry->id.taskId, pEntry->nodeId, streamTaskGetStatusStr(pEntry->status)); + mDebug("s-task:0x%" PRIx64 "-0x%x (nodeId:%d) status:%s, checkpoint not issued", pEntry->id.streamId, + (int32_t)pEntry->id.taskId, pEntry->nodeId, streamTaskGetStatusStr(pEntry->status)); ready = false; } @@ -1153,14 +1154,14 @@ typedef struct { int64_t duration; } SCheckpointInterval; -static int32_t streamWaitComparFn(const void* p1, const void* p2) { - const SCheckpointInterval* pInt1 = p1; - const SCheckpointInterval* pInt2 = p2; +static int32_t streamWaitComparFn(const void *p1, const void *p2) { + const SCheckpointInterval *pInt1 = p1; + const SCheckpointInterval *pInt2 = p2; if (pInt1->duration == pInt2->duration) { return 0; } - return pInt1->duration > pInt2->duration? -1:1; + return pInt1->duration > pInt2->duration ? -1 : 1; } static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { @@ -1176,7 +1177,7 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { return -1; } - SArray* pList = taosArrayInit(4, sizeof(SCheckpointInterval)); + SArray *pList = taosArrayInit(4, sizeof(SCheckpointInterval)); int64_t now = taosGetTimestampMs(); while ((pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream)) != NULL) { @@ -1190,8 +1191,7 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { taosArrayPush(pList, &in); int32_t currentSize = taosArrayGetSize(pList); - mDebug("stream:%s (uid:0x%" PRIx64 ") checkpoint interval beyond threshold: %ds(%" PRId64 - "s) beyond threshold:%d", + mDebug("stream:%s (uid:0x%" PRIx64 ") checkpoint interval beyond threshold: %ds(%" PRId64 "s) beyond threshold:%d", pStream->name, pStream->uid, tsStreamCheckpointInterval, duration / 1000, currentSize); sdbRelease(pSdb, pStream); @@ -1278,11 +1278,11 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { } if (pStream->smaId != 0) { - mDebug("stream:%s, uid:0x%"PRIx64" try to drop sma related stream", dropReq.name, pStream->uid); + mDebug("stream:%s, uid:0x%" PRIx64 " try to drop sma related stream", dropReq.name, pStream->uid); void *pIter = NULL; SSmaObj *pSma = NULL; - pIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter, (void**)&pSma); + pIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter, (void **)&pSma); while (pIter) { if (pSma && pSma->uid == pStream->smaId) { sdbRelease(pMnode->pSdb, pSma); @@ -1321,7 +1321,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { STrans *pTrans = doCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_DROP_NAME, "drop stream"); if (pTrans == NULL) { - mError("stream:%s uid:0x%"PRIx64" failed to drop since %s", dropReq.name, pStream->uid, terrstr()); + mError("stream:%s uid:0x%" PRIx64 " failed to drop since %s", dropReq.name, pStream->uid, terrstr()); sdbRelease(pMnode->pSdb, pStream); tFreeMDropStreamReq(&dropReq); return -1; @@ -1674,8 +1674,8 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS colDataSetVal(pColInfo, numOfRows, (const char *)vbuf, false); // input total - const char* formatTotalMb = "%7.2f MiB"; - const char* formatTotalGb = "%7.2f GiB"; + const char *formatTotalMb = "%7.2f MiB"; + const char *formatTotalGb = "%7.2f GiB"; if (pe->procsTotal < 1024) { snprintf(buf, tListLen(buf), formatTotalMb, pe->procsTotal); } else { @@ -1689,8 +1689,8 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS colDataSetVal(pColInfo, numOfRows, (const char *)vbuf, false); // process throughput - const char* formatKb = "%7.2f KiB/s"; - const char* formatMb = "%7.2f MiB/s"; + const char *formatKb = "%7.2f KiB/s"; + const char *formatMb = "%7.2f MiB/s"; if (pe->procsThroughput < 1024) { snprintf(buf, tListLen(buf), formatKb, pe->procsThroughput); } else { @@ -1760,15 +1760,15 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS // start_time pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char*)&pe->startTime, false); + colDataSetVal(pColInfo, numOfRows, (const char *)&pe->startTime, false); // start id pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char*)&pe->startCheckpointId, false); + colDataSetVal(pColInfo, numOfRows, (const char *)&pe->startCheckpointId, false); // start ver pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char*)&pe->startCheckpointVer, false); + colDataSetVal(pColInfo, numOfRows, (const char *)&pe->startCheckpointVer, false); // checkpoint time pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); @@ -1780,11 +1780,11 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS // checkpoint_id pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char*)&pe->checkpointInfo.latestId, false); + colDataSetVal(pColInfo, numOfRows, (const char *)&pe->checkpointInfo.latestId, false); // checkpoint version pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char*)&pe->checkpointInfo.latestVer, false); + colDataSetVal(pColInfo, numOfRows, (const char *)&pe->checkpointInfo.latestVer, false); // checkpoint size pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); @@ -1915,13 +1915,12 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) { return -1; } - - { // check for tasks, if tasks are not ready, not allowed to pause + { // check for tasks, if tasks are not ready, not allowed to pause bool found = false; bool readyToPause = true; taosThreadMutexLock(&execInfo.lock); - for(int32_t i = 0; i < taosArrayGetSize(execInfo.pTaskList); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(execInfo.pTaskList); ++i) { STaskId *p = taosArrayGet(execInfo.pTaskList, i); STaskStatusEntry *pEntry = taosHashGet(execInfo.pTaskMap, p, sizeof(*p)); @@ -2237,7 +2236,7 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange return 0; } -static int32_t extractNodeListFromStream(SMnode *pMnode, SArray* pNodeList) { +static int32_t extractNodeListFromStream(SMnode *pMnode, SArray *pNodeList) { SSdb *pSdb = pMnode->pSdb; SStreamObj *pStream = NULL; void *pIter = NULL; @@ -2359,7 +2358,7 @@ static int32_t mndProcessNodeCheck(SRpcMsg *pReq) { return 0; } - int32_t size = sizeof(SMStreamNodeCheckMsg); + int32_t size = sizeof(SMStreamNodeCheckMsg); SMStreamNodeCheckMsg *pMsg = rpcMallocCont(size); SRpcMsg rpcMsg = {.msgType = TDMT_MND_STREAM_NODECHANGE_CHECK, .pCont = pMsg, .contLen = size}; @@ -2386,8 +2385,8 @@ void saveTaskAndNodeInfoIntoBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode) // add the new vgroups if not added yet bool exist = false; - for(int32_t j = 0; j < taosArrayGetSize(pExecNode->pNodeList); ++j) { - SNodeEntry* pEntry = taosArrayGet(pExecNode->pNodeList, j); + for (int32_t j = 0; j < taosArrayGetSize(pExecNode->pNodeList); ++j) { + SNodeEntry *pEntry = taosArrayGet(pExecNode->pNodeList, j); if (pEntry->nodeId == pTask->info.nodeId) { exist = true; break; @@ -2514,10 +2513,10 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { return 0; } -static void doAddTaskInfo(SArray* pList, SCheckpointReport* pReport) { +static void doAddTaskInfo(SArray *pList, SCheckpointReport *pReport) { bool existed = false; - for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) { - STaskChkptInfo* p = taosArrayGet(pList ,i); + for (int32_t i = 0; i < taosArrayGetSize(pList); ++i) { + STaskChkptInfo *p = taosArrayGet(pList, i); if (p->taskId == pReport->taskId) { existed = true; break; @@ -2563,8 +2562,7 @@ int32_t mndProcessCheckpointReport(SRpcMsg *pReq) { SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId); if (pStream == NULL) { - mWarn("failed to find the stream:0x%" PRIx64 ", not handle checkpoint-report, try to acquire in buf", - req.streamId); + mWarn("failed to find the stream:0x%" PRIx64 ", not handle checkpoint-report, try to acquire in buf", req.streamId); // not in meta-store yet, try to acquire the task in exec buffer // the checkpoint req arrives too soon before the completion of the create stream trans. @@ -2671,7 +2669,7 @@ void mndInitStreamExecInfo(SMnode *pMnode, SStreamExecInfo *pExecInfo) { pExecInfo->initTaskList = true; } -void addAllStreamTasksIntoBuf(SMnode *pMnode, SStreamExecInfo* pExecInfo) { +void addAllStreamTasksIntoBuf(SMnode *pMnode, SStreamExecInfo *pExecInfo) { SSdb *pSdb = pMnode->pSdb; SStreamObj *pStream = NULL; void *pIter = NULL; @@ -2687,13 +2685,14 @@ void addAllStreamTasksIntoBuf(SMnode *pMnode, SStreamExecInfo* pExecInfo) { } } -int32_t mndCreateStreamChkptInfoUpdateTrans(SMnode *pMnode, SStreamObj *pStream, SArray* pChkptInfoList) { - STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_CHKPT_UPDATE_NAME, "update checkpoint-info"); +int32_t mndCreateStreamChkptInfoUpdateTrans(SMnode *pMnode, SStreamObj *pStream, SArray *pChkptInfoList) { + STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_CHKPT_UPDATE_NAME, + "update checkpoint-info"); if (pTrans == NULL) { return terrno; } - /*int32_t code = */mndStreamRegisterTrans(pTrans, MND_STREAM_CHKPT_UPDATE_NAME, pStream->uid); + /*int32_t code = */ mndStreamRegisterTrans(pTrans, MND_STREAM_CHKPT_UPDATE_NAME, pStream->uid); int32_t code = mndStreamSetUpdateChkptAction(pMnode, pTrans, pStream); if (code != 0) { sdbRelease(pMnode->pSdb, pStream); diff --git a/source/dnode/mnode/impl/src/mndStreamHb.c b/source/dnode/mnode/impl/src/mndStreamHb.c index a79fe0cf0a..5c1dd3ab7a 100644 --- a/source/dnode/mnode/impl/src/mndStreamHb.c +++ b/source/dnode/mnode/impl/src/mndStreamHb.c @@ -39,10 +39,10 @@ static void updateStageInfo(STaskStatusEntry *pTaskEntry, int64_t stage) { } } -static void addIntoCheckpointList(SArray* pList, const SFailedCheckpointInfo* pInfo) { +static void addIntoCheckpointList(SArray *pList, const SFailedCheckpointInfo *pInfo) { int32_t num = taosArrayGetSize(pList); - for(int32_t i = 0; i < num; ++i) { - SFailedCheckpointInfo* p = taosArrayGet(pList, i); + for (int32_t i = 0; i < num; ++i) { + SFailedCheckpointInfo *p = taosArrayGet(pList, i); if (p->transId == pInfo->transId) { return; } @@ -52,12 +52,13 @@ static void addIntoCheckpointList(SArray* pList, const SFailedCheckpointInfo* pI } int32_t mndCreateStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream) { - STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_TASK_RESET_NAME, " reset from failed checkpoint"); + STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_TASK_RESET_NAME, + " reset from failed checkpoint"); if (pTrans == NULL) { return terrno; } - /*int32_t code = */mndStreamRegisterTrans(pTrans, MND_STREAM_TASK_RESET_NAME, pStream->uid); + /*int32_t code = */ mndStreamRegisterTrans(pTrans, MND_STREAM_TASK_RESET_NAME, pStream->uid); int32_t code = mndStreamSetResetTaskAction(pMnode, pTrans, pStream); if (code != 0) { sdbRelease(pMnode->pSdb, pStream); @@ -140,8 +141,8 @@ static int32_t setNodeEpsetExpiredFlag(const SArray *pNodeList) { return TSDB_CODE_SUCCESS; } -static int32_t mndDropOrphanTasks(SMnode* pMnode, SArray* pList) { - SOrphanTask* pTask = taosArrayGet(pList, 0); +static int32_t mndDropOrphanTasks(SMnode *pMnode, SArray *pList) { + SOrphanTask *pTask = taosArrayGet(pList, 0); // check if it is conflict with other trans in both sourceDb and targetDb. bool conflict = mndStreamTransConflictCheck(pMnode, pTask->streamId, MND_STREAM_DROP_NAME, false); @@ -150,7 +151,7 @@ static int32_t mndDropOrphanTasks(SMnode* pMnode, SArray* pList) { } SStreamObj dummyObj = {.uid = pTask->streamId, .sourceDb = "", .targetSTbName = ""}; - STrans* pTrans = doCreateTrans(pMnode, &dummyObj, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_DROP_NAME, "drop stream"); + STrans *pTrans = doCreateTrans(pMnode, &dummyObj, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_DROP_NAME, "drop stream"); if (pTrans == NULL) { mError("failed to create trans to drop orphan tasks since %s", terrstr()); return -1; @@ -180,21 +181,21 @@ static int32_t mndDropOrphanTasks(SMnode* pMnode, SArray* pList) { return 0; } -int32_t suspendAllStreams(SMnode *pMnode, SRpcHandleInfo* info){ +int32_t suspendAllStreams(SMnode *pMnode, SRpcHandleInfo *info) { SSdb *pSdb = pMnode->pSdb; SStreamObj *pStream = NULL; - void* pIter = NULL; - while(1) { + void *pIter = NULL; + while (1) { pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream); if (pIter == NULL) break; - if(pStream->status != STREAM_STATUS__PAUSE){ + if (pStream->status != STREAM_STATUS__PAUSE) { SMPauseStreamReq reqPause = {0}; strcpy(reqPause.name, pStream->name); reqPause.igNotExists = 1; int32_t contLen = tSerializeSMPauseStreamReq(NULL, 0, &reqPause); - void * pHead = rpcMallocCont(contLen); + void *pHead = rpcMallocCont(contLen); tSerializeSMPauseStreamReq(pHead, contLen, &reqPause); SRpcMsg rpcMsg = { @@ -205,7 +206,8 @@ int32_t suspendAllStreams(SMnode *pMnode, SRpcHandleInfo* info){ }; tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); - mInfo("receive pause stream:%s, %s, %"PRId64 ", because grant expired", pStream->name, reqPause.name, pStream->uid); + mInfo("receive pause stream:%s, %s, %" PRId64 ", because grant expired", pStream->name, reqPause.name, + pStream->uid); } sdbRelease(pSdb, pStream); @@ -311,7 +313,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) { if (allReady || snodeChanged) { // if the execInfo.activeCheckpoint == 0, the checkpoint is restoring from wal - for(int32_t i = 0; i < taosArrayGetSize(pFailedChkpt); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pFailedChkpt); ++i) { SFailedCheckpointInfo *pInfo = taosArrayGet(pFailedChkpt, i); mInfo("checkpointId:%" PRId64 " transId:%d failed, issue task-reset trans to reset all tasks status", pInfo->checkpointId, pInfo->transId); @@ -341,11 +343,11 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) { { SRpcMsg rsp = {.code = 0, .info = pReq->info, .contLen = sizeof(SMStreamHbRspMsg)}; rsp.pCont = rpcMallocCont(rsp.contLen); - SMsgHead* pHead = rsp.pCont; + SMsgHead *pHead = rsp.pCont; pHead->vgId = htonl(req.vgId); tmsgSendRsp(&rsp); - pReq->info.handle = NULL; // disable auto rsp + pReq->info.handle = NULL; // disable auto rsp } return TSDB_CODE_SUCCESS; diff --git a/source/dnode/mnode/impl/src/mndStreamTrans.c b/source/dnode/mnode/impl/src/mndStreamTrans.c index 0daa383d3e..f252791618 100644 --- a/source/dnode/mnode/impl/src/mndStreamTrans.c +++ b/source/dnode/mnode/impl/src/mndStreamTrans.c @@ -17,21 +17,21 @@ #include "mndTrans.h" typedef struct SKeyInfo { - void* pKey; + void *pKey; int32_t keyLen; } SKeyInfo; -int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamId) { +int32_t mndStreamRegisterTrans(STrans *pTrans, const char *pTransName, int64_t streamId) { SStreamTransInfo info = { .transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pTransName, .streamId = streamId}; taosHashPut(execInfo.transMgmt.pDBTrans, &streamId, sizeof(streamId), &info, sizeof(SStreamTransInfo)); return 0; } -int32_t mndStreamClearFinishedTrans(SMnode* pMnode, int32_t* pNumOfActiveChkpt) { +int32_t mndStreamClearFinishedTrans(SMnode *pMnode, int32_t *pNumOfActiveChkpt) { size_t keyLen = 0; - void* pIter = NULL; - SArray* pList = taosArrayInit(4, sizeof(SKeyInfo)); + void *pIter = NULL; + SArray *pList = taosArrayInit(4, sizeof(SKeyInfo)); int32_t num = 0; while ((pIter = taosHashIterate(execInfo.transMgmt.pDBTrans, pIter)) != NULL) { @@ -43,7 +43,8 @@ int32_t mndStreamClearFinishedTrans(SMnode* pMnode, int32_t* pNumOfActiveChkpt) void *pKey = taosHashGetKey(pEntry, &keyLen); // key is the name of src/dst db name SKeyInfo info = {.pKey = pKey, .keyLen = keyLen}; - mDebug("transId:%d %s startTs:%" PRId64 " cleared since finished", pEntry->transId, pEntry->name, pEntry->startTime); + mDebug("transId:%d %s startTs:%" PRId64 " cleared since finished", pEntry->transId, pEntry->name, + pEntry->startTime); taosArrayPush(pList, &info); } else { if (strcmp(pEntry->name, MND_STREAM_CHECKPOINT_NAME) == 0) { @@ -55,7 +56,7 @@ int32_t mndStreamClearFinishedTrans(SMnode* pMnode, int32_t* pNumOfActiveChkpt) int32_t size = taosArrayGetSize(pList); for (int32_t i = 0; i < size; ++i) { - SKeyInfo* pKey = taosArrayGet(pList, i); + SKeyInfo *pKey = taosArrayGet(pList, i); taosHashRemove(execInfo.transMgmt.pDBTrans, pKey->pKey, pKey->keyLen); } @@ -76,7 +77,7 @@ int32_t mndStreamClearFinishedTrans(SMnode* pMnode, int32_t* pNumOfActiveChkpt) // For a given stream: // 1. checkpoint trans is conflict with any other trans except for the drop and reset trans. // 2. create/drop/reset/update trans are conflict with any other trans. -bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamId, const char* pTransName, bool lock) { +bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *pTransName, bool lock) { if (lock) { taosThreadMutexLock(&execInfo.lock); } @@ -127,7 +128,7 @@ bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamId, const char* p return false; } -int32_t mndStreamGetRelTrans(SMnode* pMnode, int64_t streamId) { +int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamId) { taosThreadMutexLock(&execInfo.lock); int32_t num = taosHashGetSize(execInfo.transMgmt.pDBTrans); if (num <= 0) { @@ -136,7 +137,7 @@ int32_t mndStreamGetRelTrans(SMnode* pMnode, int64_t streamId) { } mndStreamClearFinishedTrans(pMnode, NULL); - SStreamTransInfo* pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, &streamId, sizeof(streamId)); + SStreamTransInfo *pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, &streamId, sizeof(streamId)); if (pEntry != NULL) { SStreamTransInfo tInfo = *pEntry; taosThreadMutexUnlock(&execInfo.lock); @@ -152,7 +153,8 @@ int32_t mndStreamGetRelTrans(SMnode* pMnode, int64_t streamId) { return 0; } -STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, ETrnConflct conflict, const char *name, const char *pMsg) { +STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, ETrnConflct conflict, const char *name, + const char *pMsg) { STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, conflict, pReq, name); if (pTrans == NULL) { mError("failed to build trans:%s, reason: %s", name, tstrerror(TSDB_CODE_OUT_OF_MEMORY)); @@ -208,7 +210,7 @@ SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) { terrno = TSDB_CODE_SUCCESS; - STREAM_ENCODE_OVER: +STREAM_ENCODE_OVER: taosMemoryFreeClear(buf); if (terrno != TSDB_CODE_SUCCESS) { mError("stream:%s, failed to encode to raw:%p since %s", pStream->name, pRaw, terrstr()); @@ -248,12 +250,16 @@ int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans, int32_t status) int32_t setTransAction(STrans *pTrans, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset, int32_t retryCode, int32_t acceptCode) { - STransAction action = {.epSet = *pEpset, .contLen = contLen, .pCont = pCont, .msgType = msgType, .retryCode = retryCode, + STransAction action = {.epSet = *pEpset, + .contLen = contLen, + .pCont = pCont, + .msgType = msgType, + .retryCode = retryCode, .acceptableCode = acceptCode}; return mndTransAppendRedoAction(pTrans, &action); } -static bool identicalName(const char* pDb, const char* pParam, int32_t len) { +static bool identicalName(const char *pDb, const char *pParam, int32_t len) { return (strlen(pDb) == len) && (strncmp(pDb, pParam, len) == 0); } @@ -300,5 +306,3 @@ void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo) { mDebug("complete clear checkpoints in Dbs"); } - - diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 5f019d07f5..e2bedc258a 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -41,7 +41,7 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg); static int32_t mndProcessDropCgroupReq(SRpcMsg *pMsg); static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextSubscribe(SMnode *pMnode, void *pIter); -static void mndCheckConsumer(SRpcMsg *pMsg, SHashObj* hash); +static void mndCheckConsumer(SRpcMsg *pMsg, SHashObj *hash); static int32_t mndSetSubCommitLogs(STrans *pTrans, SMqSubscribeObj *pSub) { SSdbRaw *pCommitRaw = mndSubActionEncode(pSub); @@ -95,13 +95,13 @@ static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj return pSub; } -static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, SMqSubscribeObj *pSub, - const SMqRebOutputVg *pRebVg, SSubplan* pPlan) { +static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, SMqSubscribeObj *pSub, const SMqRebOutputVg *pRebVg, + SSubplan *pPlan) { SMqRebVgReq req = {0}; req.oldConsumerId = pRebVg->oldConsumerId; req.newConsumerId = pRebVg->newConsumerId; req.vgId = pRebVg->pVgEp->vgId; - if(pPlan){ + if (pPlan) { pPlan->execNode.epSet = pRebVg->pVgEp->epSet; pPlan->execNode.nodeId = pRebVg->pVgEp->vgId; int32_t msgLen; @@ -109,7 +109,7 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, SMqSubscribeObj terrno = TSDB_CODE_QRY_INVALID_INPUT; return -1; } - }else{ + } else { req.qmsg = taosStrdup(""); } req.subType = pSub->subType; @@ -126,7 +126,7 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, SMqSubscribeObj } tlen += sizeof(SMsgHead); - void *buf = taosMemoryMalloc(tlen); + void *buf = taosMemoryMalloc(tlen); if (buf == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; taosMemoryFree(req.qmsg); @@ -155,9 +155,9 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, SMqSubscribeObj } static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj *pSub, - const SMqRebOutputVg *pRebVg, SSubplan* pPlan) { + const SMqRebOutputVg *pRebVg, SSubplan *pPlan) { if (pRebVg->oldConsumerId == pRebVg->newConsumerId) { - if(pRebVg->oldConsumerId == -1) return 0; //drop stream, no consumer, while split vnode,all consumerId is -1 + if (pRebVg->oldConsumerId == -1) return 0; // drop stream, no consumer, while split vnode,all consumerId is -1 terrno = TSDB_CODE_MND_INVALID_SUB_OPTION; return -1; } @@ -223,19 +223,18 @@ static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) { return pRebInfo; } -static void pushVgDataToHash(SArray *vgs, SHashObj *pHash, int64_t consumerId, char* key){ +static void pushVgDataToHash(SArray *vgs, SHashObj *pHash, int64_t consumerId, char *key) { SMqVgEp *pVgEp = *(SMqVgEp **)taosArrayPop(vgs); SMqRebOutputVg outputVg = {consumerId, -1, pVgEp}; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("[rebalance] sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64, - key, pVgEp->vgId, consumerId); + mInfo("[rebalance] sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64, key, pVgEp->vgId, consumerId); } static void processRemovedConsumers(SMqRebOutputObj *pOutput, SHashObj *pHash, const SMqRebInputObj *pInput) { int32_t numOfRemoved = taosArrayGetSize(pInput->pRebInfo->removedConsumers); int32_t actualRemoved = 0; for (int32_t i = 0; i < numOfRemoved; i++) { - uint64_t consumerId = *(uint64_t *)taosArrayGet(pInput->pRebInfo->removedConsumers, i); + uint64_t consumerId = *(uint64_t *)taosArrayGet(pInput->pRebInfo->removedConsumers, i); SMqConsumerEp *pConsumerEp = taosHashGet(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); if (pConsumerEp == NULL) { continue; @@ -253,14 +252,15 @@ static void processRemovedConsumers(SMqRebOutputObj *pOutput, SHashObj *pHash, c } if (numOfRemoved != actualRemoved) { - mError("[rebalance] sub:%s mq rebalance removedNum:%d not matched with actual:%d", pOutput->pSub->key, numOfRemoved, actualRemoved); + mError("[rebalance] sub:%s mq rebalance removedNum:%d not matched with actual:%d", pOutput->pSub->key, numOfRemoved, + actualRemoved); } else { mInfo("[rebalance] sub:%s removed %d consumers", pOutput->pSub->key, numOfRemoved); } } static void processNewConsumers(SMqRebOutputObj *pOutput, const SMqRebInputObj *pInput) { - int32_t numOfNewConsumers = taosArrayGetSize(pInput->pRebInfo->newConsumers); + int32_t numOfNewConsumers = taosArrayGetSize(pInput->pRebInfo->newConsumers); for (int32_t i = 0; i < numOfNewConsumers; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pInput->pRebInfo->newConsumers, i); @@ -276,26 +276,26 @@ static void processNewConsumers(SMqRebOutputObj *pOutput, const SMqRebInputObj * } static void processUnassignedVgroups(SMqRebOutputObj *pOutput, SHashObj *pHash) { - int32_t numOfVgroups = taosArrayGetSize(pOutput->pSub->unassignedVgs); + int32_t numOfVgroups = taosArrayGetSize(pOutput->pSub->unassignedVgs); for (int32_t i = 0; i < numOfVgroups; i++) { pushVgDataToHash(pOutput->pSub->unassignedVgs, pHash, -1, pOutput->pSub->key); } } -//static void putNoTransferToOutput(SMqRebOutputObj *pOutput, SMqConsumerEp *pConsumerEp){ -// for(int i = 0; i < taosArrayGetSize(pConsumerEp->vgs); i++){ -// SMqVgEp *pVgEp = (SMqVgEp *)taosArrayGetP(pConsumerEp->vgs, i); -// SMqRebOutputVg outputVg = { -// .oldConsumerId = pConsumerEp->consumerId, -// .newConsumerId = pConsumerEp->consumerId, -// .pVgEp = pVgEp, -// }; -// taosArrayPush(pOutput->rebVgs, &outputVg); -// } -//} +// static void putNoTransferToOutput(SMqRebOutputObj *pOutput, SMqConsumerEp *pConsumerEp){ +// for(int i = 0; i < taosArrayGetSize(pConsumerEp->vgs); i++){ +// SMqVgEp *pVgEp = (SMqVgEp *)taosArrayGetP(pConsumerEp->vgs, i); +// SMqRebOutputVg outputVg = { +// .oldConsumerId = pConsumerEp->consumerId, +// .newConsumerId = pConsumerEp->consumerId, +// .pVgEp = pVgEp, +// }; +// taosArrayPush(pOutput->rebVgs, &outputVg); +// } +// } static void processModifiedConsumers(SMqRebOutputObj *pOutput, SHashObj *pHash, int32_t minVgCnt, - int32_t remainderVgCnt) { + int32_t remainderVgCnt) { int32_t cnt = 0; void *pIter = NULL; @@ -311,7 +311,7 @@ static void processModifiedConsumers(SMqRebOutputObj *pOutput, SHashObj *pHash, taosArrayPush(pOutput->modifyConsumers, &pConsumerEp->consumerId); if (consumerVgNum > minVgCnt) { if (cnt < remainderVgCnt) { - while (taosArrayGetSize(pConsumerEp->vgs) > minVgCnt + 1) { // pop until equal minVg + 1 + while (taosArrayGetSize(pConsumerEp->vgs) > minVgCnt + 1) { // pop until equal minVg + 1 pushVgDataToHash(pConsumerEp->vgs, pHash, pConsumerEp->consumerId, pOutput->pSub->key); } cnt++; @@ -321,17 +321,17 @@ static void processModifiedConsumers(SMqRebOutputObj *pOutput, SHashObj *pHash, } } } -// putNoTransferToOutput(pOutput, pConsumerEp); + // putNoTransferToOutput(pOutput, pConsumerEp); } } -static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput){ +static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput) { int32_t totalVgNum = 0; - SVgObj* pVgroup = NULL; - void* pIter = NULL; - SArray* newVgs = taosArrayInit(0, POINTER_BYTES); + SVgObj *pVgroup = NULL; + void *pIter = NULL; + SArray *newVgs = taosArrayInit(0, POINTER_BYTES); while (1) { - pIter = sdbFetch(pMnode->pSdb, SDB_VGROUP, pIter, (void**)&pVgroup); + pIter = sdbFetch(pMnode->pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); if (pIter == NULL) { break; } @@ -342,7 +342,7 @@ static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput){ } totalVgNum++; - SMqVgEp* pVgEp = taosMemoryMalloc(sizeof(SMqVgEp)); + SMqVgEp *pVgEp = taosMemoryMalloc(sizeof(SMqVgEp)); pVgEp->epSet = mndGetVgroupEpset(pMnode, pVgroup); pVgEp->vgId = pVgroup->vgId; taosArrayPush(newVgs, &pVgEp); @@ -358,17 +358,17 @@ static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput){ int32_t j = 0; while (j < taosArrayGetSize(pConsumerEp->vgs)) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, j); - bool find = false; - for(int32_t k = 0; k < taosArrayGetSize(newVgs); k++){ + bool find = false; + for (int32_t k = 0; k < taosArrayGetSize(newVgs); k++) { SMqVgEp *pnewVgEp = taosArrayGetP(newVgs, k); - if(pVgEp->vgId == pnewVgEp->vgId){ + if (pVgEp->vgId == pnewVgEp->vgId) { tDeleteSMqVgEp(pnewVgEp); taosArrayRemove(newVgs, k); find = true; break; } } - if(!find){ + if (!find) { mInfo("[rebalance] processRemoveAddVgs old vgId:%d", pVgEp->vgId); tDeleteSMqVgEp(pVgEp); taosArrayRemove(pConsumerEp->vgs, j); @@ -378,17 +378,17 @@ static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput){ } } - if(taosArrayGetSize(pOutput->pSub->unassignedVgs) == 0 && taosArrayGetSize(newVgs) != 0){ + if (taosArrayGetSize(pOutput->pSub->unassignedVgs) == 0 && taosArrayGetSize(newVgs) != 0) { taosArrayAddAll(pOutput->pSub->unassignedVgs, newVgs); mInfo("[rebalance] processRemoveAddVgs add new vg num:%d", (int)taosArrayGetSize(newVgs)); taosArrayDestroy(newVgs); - }else{ + } else { taosArrayDestroyP(newVgs, (FDelete)tDeleteSMqVgEp); } return totalVgNum; } -static void processSubOffsetRows(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebOutputObj *pOutput){ +static void processSubOffsetRows(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebOutputObj *pOutput) { SMqSubscribeObj *pSub = mndAcquireSubscribeByKey(pMnode, pInput->pRebInfo->key); // put all offset rows if (pSub == NULL) { return; @@ -406,16 +406,17 @@ static void processSubOffsetRows(SMnode *pMnode, const SMqRebInputObj *pInput, S for (int j = 0; j < taosArrayGetSize(pConsumerEp->offsetRows); j++) { OffsetRows *d1 = taosArrayGet(pConsumerEp->offsetRows, j); - bool jump = false; - for (int i = 0; pConsumerEpNew && i < taosArrayGetSize(pConsumerEpNew->vgs); i++){ + bool jump = false; + for (int i = 0; pConsumerEpNew && i < taosArrayGetSize(pConsumerEpNew->vgs); i++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEpNew->vgs, i); - if(pVgEp->vgId == d1->vgId){ + if (pVgEp->vgId == d1->vgId) { jump = true; - mInfo("pSub->offsetRows jump, because consumer id:0x%"PRIx64 " and vgId:%d not change", pConsumerEp->consumerId, pVgEp->vgId); + mInfo("pSub->offsetRows jump, because consumer id:0x%" PRIx64 " and vgId:%d not change", + pConsumerEp->consumerId, pVgEp->vgId); break; } } - if(jump) continue; + if (jump) continue; bool find = false; for (int i = 0; i < taosArrayGetSize(pOutput->pSub->offsetRows); i++) { OffsetRows *d2 = taosArrayGet(pOutput->pSub->offsetRows, i); @@ -424,11 +425,11 @@ static void processSubOffsetRows(SMnode *pMnode, const SMqRebInputObj *pInput, S d2->offset = d1->offset; d2->ever = d1->ever; find = true; - mInfo("pSub->offsetRows add vgId:%d, after:%"PRId64", before:%"PRId64, d2->vgId, d2->rows, d1->rows); + mInfo("pSub->offsetRows add vgId:%d, after:%" PRId64 ", before:%" PRId64, d2->vgId, d2->rows, d1->rows); break; } } - if(!find){ + if (!find) { taosArrayPush(pOutput->pSub->offsetRows, d1); } } @@ -437,7 +438,7 @@ static void processSubOffsetRows(SMnode *pMnode, const SMqRebInputObj *pInput, S mndReleaseSubscribe(pMnode, pSub); } -static void printRebalanceLog(SMqRebOutputObj *pOutput){ +static void printRebalanceLog(SMqRebOutputObj *pOutput) { mInfo("sub:%s mq rebalance calculation completed, re-balanced vg", pOutput->pSub->key); for (int32_t i = 0; i < taosArrayGetSize(pOutput->rebVgs); i++) { SMqRebOutputVg *pOutputRebVg = taosArrayGet(pOutput->rebVgs, i); @@ -451,7 +452,8 @@ static void printRebalanceLog(SMqRebOutputObj *pOutput){ if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; int32_t sz = taosArrayGetSize(pConsumerEp->vgs); - mInfo("sub:%s mq rebalance final cfg: consumer:0x%" PRIx64 " has %d vg", pOutput->pSub->key, pConsumerEp->consumerId, sz); + mInfo("sub:%s mq rebalance final cfg: consumer:0x%" PRIx64 " has %d vg", pOutput->pSub->key, + pConsumerEp->consumerId, sz); for (int32_t i = 0; i < sz; i++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i); mInfo("sub:%s mq rebalance final cfg: vg %d to consumer:0x%" PRIx64, pOutput->pSub->key, pVgEp->vgId, @@ -460,8 +462,8 @@ static void printRebalanceLog(SMqRebOutputObj *pOutput){ } } -static void calcVgroupsCnt(const SMqRebInputObj *pInput, int32_t totalVgNum, const char *pSubKey, - int32_t *minVgCnt, int32_t *remainderVgCnt){ +static void calcVgroupsCnt(const SMqRebInputObj *pInput, int32_t totalVgNum, const char *pSubKey, int32_t *minVgCnt, + int32_t *remainderVgCnt) { int32_t numOfRemoved = taosArrayGetSize(pInput->pRebInfo->removedConsumers); int32_t numOfAdded = taosArrayGetSize(pInput->pRebInfo->newConsumers); int32_t numOfFinal = pInput->oldConsumerNum + numOfAdded - numOfRemoved; @@ -473,11 +475,12 @@ static void calcVgroupsCnt(const SMqRebInputObj *pInput, int32_t totalVgNum, con } else { mInfo("[rebalance] sub:%s no consumer subscribe this topic", pSubKey); } - mInfo("[rebalance] sub:%s mq rebalance %d vgroups, existed consumers:%d, added:%d, removed:%d, minVg:%d remainderVg:%d", - pSubKey, totalVgNum, pInput->oldConsumerNum, numOfAdded, numOfRemoved, *minVgCnt, *remainderVgCnt); + mInfo( + "[rebalance] sub:%s mq rebalance %d vgroups, existed consumers:%d, added:%d, removed:%d, minVg:%d remainderVg:%d", + pSubKey, totalVgNum, pInput->oldConsumerNum, numOfAdded, numOfRemoved, *minVgCnt, *remainderVgCnt); } -static void assignVgroups(SMqRebOutputObj *pOutput, SHashObj *pHash, int32_t minVgCnt){ +static void assignVgroups(SMqRebOutputObj *pOutput, SHashObj *pHash, int32_t minVgCnt) { SMqRebOutputVg *pRebVg = NULL; void *pAssignIter = NULL; void *pIter = NULL; @@ -498,8 +501,8 @@ static void assignVgroups(SMqRebOutputObj *pOutput, SHashObj *pHash, int32_t min pRebVg = (SMqRebOutputVg *)pAssignIter; pRebVg->newConsumerId = pConsumerEp->consumerId; taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); - mInfo("[rebalance] mq rebalance: add vgId:%d to consumer:0x%" PRIx64 " for average", - pRebVg->pVgEp->vgId, pConsumerEp->consumerId); + mInfo("[rebalance] mq rebalance: add vgId:%d to consumer:0x%" PRIx64 " for average", pRebVg->pVgEp->vgId, + pConsumerEp->consumerId); } } @@ -519,13 +522,13 @@ static void assignVgroups(SMqRebOutputObj *pOutput, SHashObj *pHash, int32_t min pRebVg = (SMqRebOutputVg *)pAssignIter; pRebVg->newConsumerId = pConsumerEp->consumerId; taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); - mInfo("[rebalance] mq rebalance: add vgId:%d to consumer:0x%" PRIx64 " for average + 1", - pRebVg->pVgEp->vgId, pConsumerEp->consumerId); + mInfo("[rebalance] mq rebalance: add vgId:%d to consumer:0x%" PRIx64 " for average + 1", pRebVg->pVgEp->vgId, + pConsumerEp->consumerId); } } taosHashCancelIterate(pOutput->pSub->consumerHash, pIter); - if(pAssignIter != NULL){ + if (pAssignIter != NULL) { mError("[rebalance]sub:%s assign iter is not NULL, never should reach here", pOutput->pSub->key); } while (1) { @@ -534,19 +537,19 @@ static void assignVgroups(SMqRebOutputObj *pOutput, SHashObj *pHash, int32_t min break; } - SMqRebOutputVg* pRebOutput = (SMqRebOutputVg *)pAssignIter; + SMqRebOutputVg *pRebOutput = (SMqRebOutputVg *)pAssignIter; taosArrayPush(pOutput->rebVgs, pRebOutput); - if(taosHashGetSize(pOutput->pSub->consumerHash) == 0){ // if all consumer is removed + if (taosHashGetSize(pOutput->pSub->consumerHash) == 0) { // if all consumer is removed taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp); // put all vg into unassigned } } } static void mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebOutputObj *pOutput) { - int32_t totalVgNum = processRemoveAddVgs(pMnode, pOutput); + int32_t totalVgNum = processRemoveAddVgs(pMnode, pOutput); const char *pSubKey = pOutput->pSub->key; - int32_t minVgCnt = 0; - int32_t remainderVgCnt = 0; + int32_t minVgCnt = 0; + int32_t remainderVgCnt = 0; SHashObj *pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); @@ -561,14 +564,14 @@ static void mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebO taosHashCleanup(pHash); } -static int32_t presistConsumerByType(STrans *pTrans, SArray* consumers, int8_t type, char *cgroup, char *topic){ - int32_t code = 0; - SMqConsumerObj *pConsumerNew = NULL; - int32_t consumerNum = taosArrayGetSize(consumers); +static int32_t presistConsumerByType(STrans *pTrans, SArray *consumers, int8_t type, char *cgroup, char *topic) { + int32_t code = 0; + SMqConsumerObj *pConsumerNew = NULL; + int32_t consumerNum = taosArrayGetSize(consumers); for (int32_t i = 0; i < consumerNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(consumers, i); pConsumerNew = tNewSMqConsumerObj(consumerId, cgroup, type, topic, NULL); - if (pConsumerNew == NULL){ + if (pConsumerNew == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto END; } @@ -587,7 +590,7 @@ END: return code; } -static int32_t mndPresistConsumer(STrans *pTrans, const SMqRebOutputObj *pOutput, char *cgroup, char *topic){ +static int32_t mndPresistConsumer(STrans *pTrans, const SMqRebOutputObj *pOutput, char *cgroup, char *topic) { int32_t code = presistConsumerByType(pTrans, pOutput->modifyConsumers, CONSUMER_UPDATE_REB, cgroup, NULL); if (code != 0) { return code; @@ -603,10 +606,10 @@ static int32_t mndPresistConsumer(STrans *pTrans, const SMqRebOutputObj *pOutput static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) { struct SSubplan *pPlan = NULL; - int32_t code = 0; + int32_t code = 0; STrans *pTrans = NULL; - if(strcmp(pOutput->pSub->qmsg, "") != 0){ + if (strcmp(pOutput->pSub->qmsg, "") != 0) { code = qStringToSubplan(pOutput->pSub->qmsg, &pPlan); if (code != 0) { terrno = code; @@ -660,7 +663,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu code = mndTransPrepare(pMnode, pTrans); END: - nodesDestroyNode((SNode*)pPlan); + nodesDestroyNode((SNode *)pPlan); mndTransDrop(pTrans); return code; } @@ -672,24 +675,24 @@ static void freeRebalanceItem(void *param) { } // type = 0 remove type = 1 add -static void buildRebInfo(SHashObj* rebSubHash, SArray* topicList, int8_t type, char *group, int64_t consumerId){ +static void buildRebInfo(SHashObj *rebSubHash, SArray *topicList, int8_t type, char *group, int64_t consumerId) { int32_t topicNum = taosArrayGetSize(topicList); for (int32_t i = 0; i < topicNum; i++) { char key[TSDB_SUBSCRIBE_KEY_LEN]; char *removedTopic = taosArrayGetP(topicList, i); mndMakeSubscribeKey(key, group, removedTopic); SMqRebInfo *pRebSub = mndGetOrCreateRebSub(rebSubHash, key); - if(type == 0) + if (type == 0) taosArrayPush(pRebSub->removedConsumers, &consumerId); - else if(type == 1) + else if (type == 1) taosArrayPush(pRebSub->newConsumers, &consumerId); } } -static void checkForVgroupSplit(SMnode *pMnode, SMqConsumerObj *pConsumer, SHashObj* rebSubHash){ +static void checkForVgroupSplit(SMnode *pMnode, SMqConsumerObj *pConsumer, SHashObj *rebSubHash) { int32_t newTopicNum = taosArrayGetSize(pConsumer->currentTopics); for (int32_t i = 0; i < newTopicNum; i++) { - char * topic = taosArrayGetP(pConsumer->currentTopics, i); + char *topic = taosArrayGetP(pConsumer->currentTopics, i); SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic); if (pSub == NULL) { continue; @@ -702,7 +705,7 @@ static void checkForVgroupSplit(SMnode *pMnode, SMqConsumerObj *pConsumer, SHash for (int32_t j = 0; j < vgNum; j++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, j); - SVgObj * pVgroup = mndAcquireVgroup(pMnode, pVgEp->vgId); + SVgObj *pVgroup = mndAcquireVgroup(pMnode, pVgEp->vgId); if (!pVgroup) { char key[TSDB_SUBSCRIBE_KEY_LEN]; mndMakeSubscribeKey(key, pConsumer->cgroup, topic); @@ -716,7 +719,7 @@ static void checkForVgroupSplit(SMnode *pMnode, SMqConsumerObj *pConsumer, SHash } } -static void mndCheckConsumer(SRpcMsg *pMsg, SHashObj* rebSubHash) { +static void mndCheckConsumer(SRpcMsg *pMsg, SHashObj *rebSubHash) { SMnode *pMnode = pMsg->info.node; SSdb *pSdb = pMnode->pSdb; SMqConsumerObj *pConsumer = NULL; @@ -732,17 +735,19 @@ static void mndCheckConsumer(SRpcMsg *pMsg, SHashObj* rebSubHash) { int32_t hbStatus = atomic_add_fetch_32(&pConsumer->hbStatus, 1); int32_t status = atomic_load_32(&pConsumer->status); - mDebug("[rebalance] check for consumer:0x%" PRIx64 " status:%d(%s), sub-time:%" PRId64 ", createTime:%" PRId64 ", hbstatus:%d", - pConsumer->consumerId, status, mndConsumerStatusName(status), pConsumer->subscribeTime, pConsumer->createTime, hbStatus); + mDebug("[rebalance] check for consumer:0x%" PRIx64 " status:%d(%s), sub-time:%" PRId64 ", createTime:%" PRId64 + ", hbstatus:%d", + pConsumer->consumerId, status, mndConsumerStatusName(status), pConsumer->subscribeTime, + pConsumer->createTime, hbStatus); if (status == MQ_CONSUMER_STATUS_READY) { - if (taosArrayGetSize(pConsumer->assignedTopics) == 0) {// unsubscribe or close + if (taosArrayGetSize(pConsumer->assignedTopics) == 0) { // unsubscribe or close mndSendConsumerMsg(pMnode, pConsumer->consumerId, TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, &pMsg->info); } else if (hbStatus > MND_CONSUMER_LOST_HB_CNT) { taosRLockLatch(&pConsumer->lock); buildRebInfo(rebSubHash, pConsumer->currentTopics, 0, pConsumer->cgroup, pConsumer->consumerId); taosRUnLockLatch(&pConsumer->lock); - }else{ + } else { checkForVgroupSplit(pMnode, pConsumer, rebSubHash); } } else if (status == MQ_CONSUMER_STATUS_LOST) { @@ -762,8 +767,7 @@ static void mndCheckConsumer(SRpcMsg *pMsg, SHashObj* rebSubHash) { bool mndRebTryStart() { int32_t old = atomic_val_compare_exchange_32(&mqRebInExecCnt, 0, 1); - if (old > 0) mInfo("[rebalance] counter old val:%d", old) - return old == 0; + if (old > 0) mInfo("[rebalance] counter old val:%d", old) return old == 0; } void mndRebCntInc() { @@ -776,7 +780,7 @@ void mndRebCntDec() { if (val > 0) mInfo("[rebalance] cnt sub, value:%d", val) } -static void clearRebOutput(SMqRebOutputObj *rebOutput){ +static void clearRebOutput(SMqRebOutputObj *rebOutput) { taosArrayDestroy(rebOutput->newConsumers); taosArrayDestroy(rebOutput->modifyConsumers); taosArrayDestroy(rebOutput->removedConsumers); @@ -800,15 +804,15 @@ static int32_t initRebOutput(SMqRebOutputObj *rebOutput) { } // This function only works when there are dirty consumers -static void checkConsumer(SMnode *pMnode, SMqSubscribeObj* pSub){ - void *pIter = NULL; +static void checkConsumer(SMnode *pMnode, SMqSubscribeObj *pSub) { + void *pIter = NULL; while (1) { pIter = taosHashIterate(pSub->consumerHash, pIter); if (pIter == NULL) { break; } - SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; + SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pConsumerEp->consumerId); if (pConsumer != NULL) { mndReleaseConsumer(pMnode, pConsumer); @@ -822,8 +826,8 @@ static void checkConsumer(SMnode *pMnode, SMqSubscribeObj* pSub){ } } -static int32_t buildRebOutput(SMnode *pMnode, SMqRebInputObj *rebInput, SMqRebOutputObj *rebOutput){ - const char *key = rebInput->pRebInfo->key; +static int32_t buildRebOutput(SMnode *pMnode, SMqRebInputObj *rebInput, SMqRebOutputObj *rebOutput) { + const char *key = rebInput->pRebInfo->key; SMqSubscribeObj *pSub = mndAcquireSubscribeByKey(pMnode, key); if (pSub == NULL) { @@ -869,14 +873,13 @@ static int32_t buildRebOutput(SMnode *pMnode, SMqRebInputObj *rebInput, SMqRebOu } static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { - int code = 0; - void *pIter = NULL; - SMnode *pMnode = pMsg->info.node; + int code = 0; + void *pIter = NULL; + SMnode *pMnode = pMsg->info.node; mDebug("[rebalance] start to process mq timer") - if (!mndRebTryStart()) { - mInfo("[rebalance] mq rebalance already in progress, do nothing") - return code; + if (!mndRebTryStart()) { + mInfo("[rebalance] mq rebalance already in progress, do nothing") return code; } SHashObj *rebSubHash = taosHashInit(64, MurmurHash3_32, true, HASH_NO_LOCK); @@ -900,13 +903,13 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { SMqRebInputObj rebInput = {0}; SMqRebOutputObj rebOutput = {0}; code = initRebOutput(&rebOutput); - if (code != 0){ + if (code != 0) { goto END; } - rebInput.pRebInfo = (SMqRebInfo*)pIter; + rebInput.pRebInfo = (SMqRebInfo *)pIter; - if (buildRebOutput(pMnode, &rebInput, &rebOutput) != 0){ + if (buildRebOutput(pMnode, &rebInput, &rebOutput) != 0) { continue; } @@ -931,12 +934,12 @@ END: return code; } -static int32_t sendDeleteSubToVnode(SMnode *pMnode, SMqSubscribeObj *pSub, STrans *pTrans){ - void* pIter = NULL; - SVgObj* pVgObj = NULL; +static int32_t sendDeleteSubToVnode(SMnode *pMnode, SMqSubscribeObj *pSub, STrans *pTrans) { + void *pIter = NULL; + SVgObj *pVgObj = NULL; int32_t ret = 0; while (1) { - pIter = sdbFetch(pMnode->pSdb, SDB_VGROUP, pIter, (void**)&pVgObj); + pIter = sdbFetch(pMnode->pSdb, SDB_VGROUP, pIter, (void **)&pVgObj); if (pIter == NULL) { break; } @@ -946,7 +949,7 @@ static int32_t sendDeleteSubToVnode(SMnode *pMnode, SMqSubscribeObj *pSub, STran continue; } SMqVDeleteReq *pReq = taosMemoryCalloc(1, sizeof(SMqVDeleteReq)); - if(pReq == NULL){ + if (pReq == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; ret = -1; goto END; @@ -957,7 +960,8 @@ static int32_t sendDeleteSubToVnode(SMnode *pMnode, SMqSubscribeObj *pSub, STran memcpy(pReq->subKey, pSub->key, TSDB_SUBSCRIBE_KEY_LEN); STransAction action = {0}; - action.epSet = mndGetVgroupEpset(pMnode, pVgObj);; + action.epSet = mndGetVgroupEpset(pMnode, pVgObj); + ; action.pCont = pReq; action.contLen = sizeof(SMqVDeleteReq); action.msgType = TDMT_VND_TMQ_DELETE_SUB; @@ -969,13 +973,13 @@ static int32_t sendDeleteSubToVnode(SMnode *pMnode, SMqSubscribeObj *pSub, STran goto END; } } - END: +END: sdbRelease(pMnode->pSdb, pVgObj); sdbCancelFetch(pMnode->pSdb, pIter); return ret; } -static int32_t mndDropConsumerByGroup(SMnode *pMnode, STrans *pTrans, char *cgroup, char *topic){ +static int32_t mndDropConsumerByGroup(SMnode *pMnode, STrans *pTrans, char *cgroup, char *topic) { void *pIter = NULL; SMqConsumerObj *pConsumer = NULL; int ret = 0; @@ -1012,10 +1016,10 @@ END: } static int32_t mndProcessDropCgroupReq(SRpcMsg *pMsg) { - SMnode *pMnode = pMsg->info.node; - SMDropCgroupReq dropReq = {0}; - STrans *pTrans = NULL; - int32_t code = TSDB_CODE_ACTION_IN_PROGRESS; + SMnode *pMnode = pMsg->info.node; + SMDropCgroupReq dropReq = {0}; + STrans *pTrans = NULL; + int32_t code = TSDB_CODE_ACTION_IN_PROGRESS; if (tDeserializeSMDropCgroupReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; @@ -1262,7 +1266,6 @@ int32_t mndGetGroupNumByTopic(SMnode *pMnode, const char *topicName) { pIter = sdbFetch(pSdb, SDB_SUBSCRIBE, pIter, (void **)&pSub); if (pIter == NULL) break; - char topic[TSDB_TOPIC_FNAME_LEN] = {0}; char cgroup[TSDB_CGROUP_LEN] = {0}; mndSplitSubscribeKey(pSub->key, topic, cgroup, true); @@ -1340,7 +1343,8 @@ END: return code; } -static int32_t buildResult(SSDataBlock *pBlock, int32_t* numOfRows, int64_t consumerId, const char* topic, const char* cgroup, SArray* vgs, SArray *offsetRows){ +static int32_t buildResult(SSDataBlock *pBlock, int32_t *numOfRows, int64_t consumerId, const char *topic, + const char *cgroup, SArray *vgs, SArray *offsetRows) { int32_t sz = taosArrayGetSize(vgs); for (int32_t j = 0; j < sz; j++) { SMqVgEp *pVgEp = taosArrayGetP(vgs, j); @@ -1359,37 +1363,37 @@ static int32_t buildResult(SSDataBlock *pBlock, int32_t* numOfRows, int64_t cons colDataSetVal(pColInfo, *numOfRows, (const char *)&pVgEp->vgId, false); // consumer id - char consumerIdHex[32] = {0}; - sprintf(varDataVal(consumerIdHex), "0x%"PRIx64, consumerId); + char consumerIdHex[32] = {0}; + sprintf(varDataVal(consumerIdHex), "0x%" PRIx64, consumerId); varDataSetLen(consumerIdHex, strlen(varDataVal(consumerIdHex))); - + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)consumerIdHex, consumerId == -1); - - mInfo("mnd show subscriptions: topic %s, consumer:0x%" PRIx64 " cgroup %s vgid %d", varDataVal(topic), - consumerId, varDataVal(cgroup), pVgEp->vgId); + + mInfo("mnd show subscriptions: topic %s, consumer:0x%" PRIx64 " cgroup %s vgid %d", varDataVal(topic), consumerId, + varDataVal(cgroup), pVgEp->vgId); // offset OffsetRows *data = NULL; - for(int i = 0; i < taosArrayGetSize(offsetRows); i++){ + for (int i = 0; i < taosArrayGetSize(offsetRows); i++) { OffsetRows *tmp = taosArrayGet(offsetRows, i); - if(tmp->vgId != pVgEp->vgId){ + if (tmp->vgId != pVgEp->vgId) { mError("mnd show subscriptions: do not find vgId:%d, %d in offsetRows", tmp->vgId, pVgEp->vgId); continue; } data = tmp; } - if(data){ + if (data) { // vg id - char buf[TSDB_OFFSET_LEN*2 + VARSTR_HEADER_SIZE] = {0}; + char buf[TSDB_OFFSET_LEN * 2 + VARSTR_HEADER_SIZE] = {0}; tFormatOffset(varDataVal(buf), TSDB_OFFSET_LEN, &data->offset); - sprintf(varDataVal(buf) + strlen(varDataVal(buf)), "/%"PRId64, data->ever); + sprintf(varDataVal(buf) + strlen(varDataVal(buf)), "/%" PRId64, data->ever); varDataSetLen(buf, strlen(varDataVal(buf))); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)buf, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)&data->rows, false); - }else{ + } else { pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetNULL(pColInfo, *numOfRows); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); @@ -1435,7 +1439,8 @@ int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock if (pIter == NULL) break; pConsumerEp = (SMqConsumerEp *)pIter; - buildResult(pBlock, &numOfRows, pConsumerEp->consumerId, topic, cgroup, pConsumerEp->vgs, pConsumerEp->offsetRows); + buildResult(pBlock, &numOfRows, pConsumerEp->consumerId, topic, cgroup, pConsumerEp->vgs, + pConsumerEp->offsetRows); } buildResult(pBlock, &numOfRows, -1, topic, cgroup, pSub->unassignedVgs, pSub->offsetRows); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 2176cf4e39..39b9e9c14b 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -900,6 +900,41 @@ int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) { return 0; } +int32_t mndTransCheckConflictWithCompact(SMnode *pMnode, STrans *pTrans) { + void *pIter = NULL; + bool conflict = false; + SCompactObj *pCompact = NULL; + + while (1) { + bool thisConflict = false; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT, pIter, (void **)&pCompact); + if (pIter == NULL) break; + + if (pTrans->conflict == TRN_CONFLICT_GLOBAL || pTrans->conflict == TRN_CONFLICT_DB || + pTrans->conflict == TRN_CONFLICT_DB_INSIDE) { + if (strcasecmp(pTrans->dbname, pCompact->dbname) == 0) thisConflict = true; + } + + if (thisConflict) { + mError("trans:%d, db:%s stb:%s type:%d, can't execute since conflict with compact:%d db:%s", pTrans->id, + pTrans->dbname, pTrans->stbname, pTrans->conflict, pCompact->compactId, pCompact->dbname); + conflict = true; + } else { + mInfo("trans:%d, db:%s stb:%s type:%d, not conflict with compact:%d db:%s", pTrans->id, pTrans->dbname, + pTrans->stbname, pTrans->conflict, pCompact->compactId, pCompact->dbname); + } + sdbRelease(pMnode->pSdb, pCompact); + } + + if (conflict) { + terrno = TSDB_CODE_MND_TRANS_CONFLICT_COMPACT; + mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); + return terrno; + } + + return 0; +} + static bool mndTransActionsOfSameType(SArray *pActions) { int32_t size = taosArrayGetSize(pActions); ETrnAct lastActType = TRANS_ACTION_NULL; diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 5322540670..0422bfabff 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -1952,6 +1952,10 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "red-vgroup"); if (pTrans == NULL) goto _OVER; + + mndTransSetDbName(pTrans, pVgroup->dbName, NULL); + if (mndTransCheckConflictWithCompact(pMnode, pTrans) != 0) goto _OVER; + mndTransSetSerial(pTrans); mInfo("trans:%d, used to redistribute vgroup, vgId:%d", pTrans->id, pVgroup->vgId); diff --git a/source/dnode/mnode/impl/test/CMakeLists.txt b/source/dnode/mnode/impl/test/CMakeLists.txt index 471f0535b8..c21cc4385b 100644 --- a/source/dnode/mnode/impl/test/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/CMakeLists.txt @@ -16,3 +16,4 @@ add_subdirectory(stb) add_subdirectory(topic) add_subdirectory(trans) #add_subdirectory(user) +#add_subdirectory(mnode) diff --git a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt index 2a436e1d59..a5f014e779 100644 --- a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt @@ -1,11 +1,11 @@ -# aux_source_directory(. MNODE_MNODE_TEST_SRC) -# add_executable(mmnodeTest ${MNODE_MNODE_TEST_SRC}) -# target_link_libraries( -# mmnodeTest -# PUBLIC sut -# ) + aux_source_directory(. MNODE_MNODE_TEST_SRC) + add_executable(mmnodeTest ${MNODE_MNODE_TEST_SRC}) + target_link_libraries( + mmnodeTest + PUBLIC sut + ) -# add_test( -# NAME mmnodeTest -# COMMAND mmnodeTest -# ) + add_test( + NAME mmnodeTest + COMMAND mmnodeTest + ) diff --git a/source/dnode/mnode/impl/test/mnode/mnode.cpp b/source/dnode/mnode/impl/test/mnode/mnode.cpp index 1f6dbd6dca..9195b9303b 100644 --- a/source/dnode/mnode/impl/test/mnode/mnode.cpp +++ b/source/dnode/mnode/impl/test/mnode/mnode.cpp @@ -280,4 +280,114 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) { ASSERT_NE(retry, retryMax); } +} + +#define SLOW_LOG_TYPE_NULL 0x0 +#define SLOW_LOG_TYPE_QUERY 0x1 +#define SLOW_LOG_TYPE_INSERT 0x2 +#define SLOW_LOG_TYPE_OTHERS 0x4 +#define SLOW_LOG_TYPE_ALL 0x7 +void getSlowLogScopeString(int32_t scope, char* result){ + if(scope == SLOW_LOG_TYPE_NULL) { + strcat(result, "NONE"); + return; + } + while(scope > 0){ + if(scope & SLOW_LOG_TYPE_QUERY) { + strcat(result, "QUERY"); + scope &= ~SLOW_LOG_TYPE_QUERY; + } else if(scope & SLOW_LOG_TYPE_INSERT) { + strcat(result, "INSERT"); + scope &= ~SLOW_LOG_TYPE_INSERT; + } else if(scope & SLOW_LOG_TYPE_OTHERS) { + strcat(result, "OTHERS"); + scope &= ~SLOW_LOG_TYPE_OTHERS; + } else{ + printf("invalid slow log scope:%d", scope); + return; + } + + if(scope > 0) { + strcat(result, "|"); + } + } +} + +// Define test cases +TEST_F(MndTestMnode, ScopeIsNull) { + // Arrange + char result[256] = {0}; + + // Act + getSlowLogScopeString(SLOW_LOG_TYPE_NULL, result); + + // Assert + EXPECT_STREQ(result, "NONE"); +} + +TEST_F(MndTestMnode, ScopeIsQuery) { + // Arrange + char result[256] = {0}; + + // Act + getSlowLogScopeString(SLOW_LOG_TYPE_QUERY, result); + + // Assert + EXPECT_STREQ(result, "QUERY"); +} + +TEST_F(MndTestMnode, ScopeIsInsert) { + // Arrange + char result[256] = {0}; + + // Act + getSlowLogScopeString(SLOW_LOG_TYPE_INSERT, result); + + // Assert + EXPECT_STREQ(result, "INSERT"); +} + +TEST_F(MndTestMnode, ScopeIsOthers) { + // Arrange + char result[256] = {0}; + + // Act + getSlowLogScopeString(SLOW_LOG_TYPE_OTHERS, result); + + // Assert + EXPECT_STREQ(result, "OTHERS"); +} + +TEST_F(MndTestMnode, ScopeIsMixed) { + // Arrange + char result[256] = {0}; + + // Act + getSlowLogScopeString(SLOW_LOG_TYPE_OTHERS|SLOW_LOG_TYPE_INSERT, result); + + // Assert + EXPECT_STREQ(result, "INSERT|OTHERS"); +} + +TEST_F(MndTestMnode, ScopeIsMixed1) { + // Arrange + char result[256] = {0}; + + // Act + getSlowLogScopeString(SLOW_LOG_TYPE_ALL, result); + + // Assert + EXPECT_STREQ(result, "QUERY|INSERT|OTHERS"); +} + +TEST_F(MndTestMnode, ScopeIsInvalid) { + // Arrange + char result[256] = {0}; + + // Act + getSlowLogScopeString(0xF000, result); + + // Assert + EXPECT_STREQ(result, ""); // Expect an empty string since the scope is invalid + // You may also want to check if the error message is correctly logged } \ No newline at end of file diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index 0eb0db002f..3f7d3d3e8c 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -41,7 +41,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProcessVer SCheckpointInfo *pChkInfo = &pTask->chkInfo; tqSetRestoreVersionInfo(pTask); - char* p = streamTaskGetStatus(pTask)->name; + char *p = streamTaskGetStatus(pTask)->name; if (pTask->info.fillHistory) { sndInfo("vgId:%d expand stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64 " nextProcessVer:%" PRId64 @@ -71,7 +71,8 @@ SSnode *sndOpen(const char *path, const SSnodeOpt *pOption) { startRsync(); pSnode->msgCb = pOption->msgCb; - pSnode->pMeta = streamMetaOpen(path, pSnode, (FTaskBuild *)sndExpandTask, tqExpandStreamTask, SNODE_HANDLE, taosGetTimestampMs(), tqStartTaskCompleteCallback); + pSnode->pMeta = streamMetaOpen(path, pSnode, (FTaskBuild *)sndExpandTask, tqExpandStreamTask, SNODE_HANDLE, + taosGetTimestampMs(), tqStartTaskCompleteCallback); if (pSnode->pMeta == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; goto FAIL; @@ -138,9 +139,10 @@ int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg) { int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp) { switch (pMsg->msgType) { case TDMT_STREAM_TASK_DEPLOY: { - void * pReq = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); + void *pReq = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); int32_t len = pMsg->contLen - sizeof(SMsgHead); - return tqStreamTaskProcessDeployReq(pSnode->pMeta, &pSnode->msgCb,pMsg->info.conn.applyIndex, pReq, len, true, true); + return tqStreamTaskProcessDeployReq(pSnode->pMeta, &pSnode->msgCb, pMsg->info.conn.applyIndex, pReq, len, true, + true); } case TDMT_STREAM_TASK_DROP: @@ -159,4 +161,4 @@ int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp) { ASSERT(0); } return 0; -} \ No newline at end of file +} diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index ceb72aa14d..64cee3513c 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -686,8 +686,8 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int } // add to cache. - taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeUidCachePayload, NULL, - TAOS_LRU_PRIORITY_LOW, NULL); + (void)taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeUidCachePayload, NULL, + TAOS_LRU_PRIORITY_LOW, NULL); _end: taosThreadMutexUnlock(pLock); metaDebug("vgId:%d, suid:%" PRIu64 " list cache added into cache, total:%d, tables:%d", vgId, suid, @@ -909,7 +909,7 @@ int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid) { return TSDB_CODE_SUCCESS; } -bool metaTbInFilterCache(SMeta *pMeta, const void* key, int8_t type) { +bool metaTbInFilterCache(SMeta* pMeta, const void* key, int8_t type) { if (type == 0 && taosHashGet(pMeta->pCache->STbFilterCache.pStb, key, sizeof(tb_uid_t))) { return true; } @@ -921,7 +921,7 @@ bool metaTbInFilterCache(SMeta *pMeta, const void* key, int8_t type) { return false; } -int32_t metaPutTbToFilterCache(SMeta *pMeta, const void* key, int8_t type) { +int32_t metaPutTbToFilterCache(SMeta* pMeta, const void* key, int8_t type) { if (type == 0) { return taosHashPut(pMeta->pCache->STbFilterCache.pStb, key, sizeof(tb_uid_t), NULL, 0); } @@ -933,7 +933,7 @@ int32_t metaPutTbToFilterCache(SMeta *pMeta, const void* key, int8_t type) { return 0; } -int32_t metaSizeOfTbFilterCache(SMeta *pMeta, int8_t type) { +int32_t metaSizeOfTbFilterCache(SMeta* pMeta, int8_t type) { if (type == 0) { return taosHashGetSize(pMeta->pCache->STbFilterCache.pStb); } diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 58eef3caa6..e40478eec2 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -647,13 +647,18 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { SCtbIdxKey *table = (SCtbIdxKey *)pKey; STagVal tagVal = {.cid = pCol->colId}; - tTagGet((const STag *)pVal, &tagVal); - if (IS_VAR_DATA_TYPE(pCol->type)) { - pTagData = tagVal.pData; - nTagData = (int32_t)tagVal.nData; + if (tTagGet((const STag *)pVal, &tagVal)) { + if (IS_VAR_DATA_TYPE(pCol->type)) { + pTagData = tagVal.pData; + nTagData = (int32_t)tagVal.nData; + } else { + pTagData = &(tagVal.i64); + nTagData = tDataTypes[pCol->type].bytes; + } } else { - pTagData = &(tagVal.i64); - nTagData = tDataTypes[pCol->type].bytes; + if (!IS_VAR_DATA_TYPE(pCol->type)) { + nTagData = tDataTypes[pCol->type].bytes; + } } rc = metaCreateTagIdxKey(suid, pCol->colId, pTagData, nTagData, pCol->type, table->uid, &pTagIdxKey, &nTagIdxKey); tdbFree(pKey); @@ -779,13 +784,18 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq) SCtbIdxKey *table = (SCtbIdxKey *)pKey; STagVal tagVal = {.cid = pCol->colId}; - tTagGet((const STag *)pVal, &tagVal); - if (IS_VAR_DATA_TYPE(pCol->type)) { - pTagData = tagVal.pData; - nTagData = (int32_t)tagVal.nData; + if (tTagGet((const STag *)pVal, &tagVal)) { + if (IS_VAR_DATA_TYPE(pCol->type)) { + pTagData = tagVal.pData; + nTagData = (int32_t)tagVal.nData; + } else { + pTagData = &(tagVal.i64); + nTagData = tDataTypes[pCol->type].bytes; + } } else { - pTagData = &(tagVal.i64); - nTagData = tDataTypes[pCol->type].bytes; + if (!IS_VAR_DATA_TYPE(pCol->type)) { + nTagData = tDataTypes[pCol->type].bytes; + } } rc = metaCreateTagIdxKey(suid, pCol->colId, pTagData, nTagData, pCol->type, table->uid, &pTagIdxKey, &nTagIdxKey); tdbFree(pKey); @@ -1272,13 +1282,18 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p int32_t nTagData = 0; STagVal tagVal = {.cid = pTagColumn->colId}; - tTagGet((const STag *)e.ctbEntry.pTags, &tagVal); - if (IS_VAR_DATA_TYPE(pTagColumn->type)) { - pTagData = tagVal.pData; - nTagData = (int32_t)tagVal.nData; + if (tTagGet((const STag *)e.ctbEntry.pTags, &tagVal)) { + if (IS_VAR_DATA_TYPE(pTagColumn->type)) { + pTagData = tagVal.pData; + nTagData = (int32_t)tagVal.nData; + } else { + pTagData = &(tagVal.i64); + nTagData = tDataTypes[pTagColumn->type].bytes; + } } else { - pTagData = &(tagVal.i64); - nTagData = tDataTypes[pTagColumn->type].bytes; + if (!IS_VAR_DATA_TYPE(pTagColumn->type)) { + nTagData = tDataTypes[pTagColumn->type].bytes; + } } if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid, @@ -2036,13 +2051,18 @@ static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTb int32_t nTagData = 0; STagVal tagVal = {.cid = pCol->colId}; - tTagGet((const STag *)pVal, &tagVal); - if (IS_VAR_DATA_TYPE(pCol->type)) { - pTagData = tagVal.pData; - nTagData = (int32_t)tagVal.nData; + if (tTagGet((const STag *)pVal, &tagVal)) { + if (IS_VAR_DATA_TYPE(pCol->type)) { + pTagData = tagVal.pData; + nTagData = (int32_t)tagVal.nData; + } else { + pTagData = &(tagVal.i64); + nTagData = tDataTypes[pCol->type].bytes; + } } else { - pTagData = &(tagVal.i64); - nTagData = tDataTypes[pCol->type].bytes; + if (!IS_VAR_DATA_TYPE(pCol->type)) { + nTagData = tDataTypes[pCol->type].bytes; + } } if (metaCreateTagIdxKey(suid, pCol->colId, pTagData, nTagData, pCol->type, uid, &pTagIdxKey, &nTagIdxKey) < 0) { tdbFree(pKey); @@ -2497,19 +2517,25 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) { goto end; } else { for (int i = 0; i < pTagSchema->nCols; i++) { + pTagData = NULL; + nTagData = 0; pTagColumn = &pTagSchema->pSchema[i]; if (!IS_IDX_ON(pTagColumn)) continue; STagVal tagVal = {.cid = pTagColumn->colId}; - tTagGet((const STag *)pCtbEntry->ctbEntry.pTags, &tagVal); - if (IS_VAR_DATA_TYPE(pTagColumn->type)) { - pTagData = tagVal.pData; - nTagData = (int32_t)tagVal.nData; + if (tTagGet((const STag *)pCtbEntry->ctbEntry.pTags, &tagVal)) { + if (IS_VAR_DATA_TYPE(pTagColumn->type)) { + pTagData = tagVal.pData; + nTagData = (int32_t)tagVal.nData; + } else { + pTagData = &(tagVal.i64); + nTagData = tDataTypes[pTagColumn->type].bytes; + } } else { - pTagData = &(tagVal.i64); - nTagData = tDataTypes[pTagColumn->type].bytes; + if (!IS_VAR_DATA_TYPE(pTagColumn->type)) { + nTagData = tDataTypes[pTagColumn->type].bytes; + } } - if (metaCreateTagIdxKey(pCtbEntry->ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, pCtbEntry->uid, &pTagIdxKey, &nTagIdxKey) < 0) { ret = -1; diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 07d77905cb..4be5983be8 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -697,6 +697,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg } else { tqInfo("vgId:%d switch consumer from Id:0x%" PRIx64 " to Id:0x%" PRIx64, req.vgId, pHandle->consumerId, req.newConsumerId); + atomic_store_64(&pHandle->consumerId, req.newConsumerId); atomic_store_32(&pHandle->epoch, 0); tqUnregisterPushHandle(pTq, pHandle); @@ -963,8 +964,8 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) { tqError("failed to find s-task:0x%" PRIx64 ", it may have been destroyed, drop related fill-history task:%s", pTask->streamTaskId.taskId, pTask->id.idStr); - tqDebug("s-task:%s fill-history task set status to be dropping and drop it", id); - streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0); + tqDebug("s-task:%s fill-history task set status to be dropping", id); + streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0); atomic_store_32(&pTask->status.inScanHistorySentinel, 0); streamMetaReleaseTask(pMeta, pTask); diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 3ea7ad0718..40da0f0320 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -19,13 +19,13 @@ typedef struct SMStreamCheckpointReadyRspMsg { SMsgHead head; - int64_t streamId; - int32_t upstreamTaskId; - int32_t upstreamNodeId; - int32_t downstreamTaskId; - int32_t downstreamNodeId; - int64_t checkpointId; - int32_t transId; + int64_t streamId; + int32_t upstreamTaskId; + int32_t upstreamNodeId; + int32_t downstreamTaskId; + int32_t downstreamNodeId; + int64_t checkpointId; + int32_t transId; } SMStreamCheckpointReadyRspMsg; static int32_t doProcessDummyRspMsg(SStreamMeta* pMeta, SRpcMsg* pMsg); @@ -160,7 +160,8 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); if (ppTask == NULL || *ppTask == NULL) { - tqError("vgId:%d failed to acquire task:0x%x when handling update task epset, it may have been dropped", vgId, req.taskId); + tqError("vgId:%d failed to acquire task:0x%x when handling update task epset, it may have been dropped", vgId, + req.taskId); rsp.code = TSDB_CODE_SUCCESS; streamMetaWUnLock(pMeta); taosArrayDestroy(req.pNodeList); @@ -170,7 +171,11 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM SStreamTask* pTask = *ppTask; const char* idstr = pTask->id.idStr; - if ((pMeta->updateInfo.transId != req.transId) && (pMeta->updateInfo.transId != -1)) { + if (pMeta->updateInfo.transId == -1) { // info needs to be kept till the new trans to update the nodeEp arrived. + streamMetaInitUpdateTaskList(pMeta, req.transId); + } + + if (pMeta->updateInfo.transId != req.transId) { if (req.transId < pMeta->updateInfo.transId) { tqError("s-task:%s vgId:%d disorder update nodeEp msg recv, discarded, newest transId:%d, recv:%d", idstr, vgId, pMeta->updateInfo.transId, req.transId); @@ -194,7 +199,8 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM void* pReqTask = taosHashGet(pMeta->updateInfo.pTasks, &entry, sizeof(STaskUpdateEntry)); if (pReqTask != NULL) { - tqDebug("s-task:%s (vgId:%d) already update in transId:%d, discard the nodeEp update msg", idstr, vgId, req.transId); + tqDebug("s-task:%s (vgId:%d) already update in transId:%d, discard the nodeEp update msg", idstr, vgId, + req.transId); rsp.code = TSDB_CODE_SUCCESS; streamMetaWUnLock(pMeta); taosArrayDestroy(req.pNodeList); @@ -838,10 +844,11 @@ int32_t tqStreamTaskProcessTaskResetReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { tqDebug("s-task:%s receive task-reset msg from mnode, reset status and ready for data processing", pTask->id.idStr); taosThreadMutexLock(&pTask->lock); + streamTaskClearCheckInfo(pTask, true); // clear flag set during do checkpoint, and open inputQ for all upstream tasks - SStreamTaskState *pState = streamTaskGetStatus(pTask); + SStreamTaskState* pState = streamTaskGetStatus(pTask); if (pState->state == TASK_STATUS__CK) { int32_t tranId = 0; int64_t activeChkId = 0; @@ -866,7 +873,7 @@ int32_t tqStreamTaskProcessTaskResetReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { } int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { - SRetrieveChkptTriggerReq* pReq = (SRetrieveChkptTriggerReq*) pMsg->pCont; + SRetrieveChkptTriggerReq* pReq = (SRetrieveChkptTriggerReq*)pMsg->pCont; SStreamTask* pTask = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->upstreamTaskId); if (pTask == NULL) { @@ -883,7 +890,8 @@ int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg) tqError("s-task:%s not ready for checkpoint-trigger retrieve from 0x%x, since downstream not ready", pTask->id.idStr, (int32_t)pReq->downstreamTaskId); - streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, TSDB_CODE_STREAM_TASK_IVLD_STATUS); + streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, + TSDB_CODE_STREAM_TASK_IVLD_STATUS); streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_SUCCESS; @@ -895,14 +903,15 @@ int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg) int64_t checkpointId = 0; streamTaskGetActiveCheckpointInfo(pTask, &transId, &checkpointId); - ASSERT (checkpointId == pReq->checkpointId); + ASSERT(checkpointId == pReq->checkpointId); if (streamTaskAlreadySendTrigger(pTask, pReq->downstreamNodeId)) { // re-send the lost checkpoint-trigger msg to downstream task tqDebug("s-task:%s re-send checkpoint-trigger to:0x%x, checkpointId:%" PRId64 ", transId:%d", pTask->id.idStr, (int32_t)pReq->downstreamTaskId, checkpointId, transId); - streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, TSDB_CODE_SUCCESS); - } else { // not send checkpoint-trigger yet, wait + streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, + TSDB_CODE_SUCCESS); + } else { // not send checkpoint-trigger yet, wait int32_t recv = 0, total = 0; streamTaskGetTriggerRecvStatus(pTask, &recv, &total); @@ -914,7 +923,8 @@ int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg) "sending checkpoint-source/trigger", pTask->id.idStr, recv, total); } - streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, TSDB_CODE_ACTION_IN_PROGRESS); + streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, + TSDB_CODE_ACTION_IN_PROGRESS); } } else { // upstream not recv the checkpoint-source/trigger till now ASSERT(pState->state == TASK_STATUS__READY || pState->state == TASK_STATUS__HALT); @@ -922,7 +932,8 @@ int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg) "s-task:%s not recv checkpoint-source from mnode or checkpoint-trigger from upstream yet, wait for all " "upstream sending checkpoint-source/trigger", pTask->id.idStr); - streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, TSDB_CODE_ACTION_IN_PROGRESS); + streamTaskSendCheckpointTriggerMsg(pTask, pReq->downstreamTaskId, pReq->downstreamNodeId, &pMsg->info, + TSDB_CODE_ACTION_IN_PROGRESS); } streamMetaReleaseTask(pMeta, pTask); @@ -930,7 +941,7 @@ int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg) } int32_t tqStreamTaskProcessRetrieveTriggerRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) { - SCheckpointTriggerRsp* pRsp = pMsg->pCont; + SCheckpointTriggerRsp* pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); SStreamTask* pTask = streamMetaAcquireTask(pMeta, pRsp->streamId, pRsp->taskId); if (pTask == NULL) { @@ -940,8 +951,8 @@ int32_t tqStreamTaskProcessRetrieveTriggerRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) return TSDB_CODE_STREAM_TASK_NOT_EXIST; } - tqDebug("s-task:%s recv re-send checkpoint-trigger msg from upstream:0x%x, checkpointId:%"PRId64", transId:%d", - pTask->id.idStr, pRsp->upstreamTaskId, pRsp->checkpointId, pRsp->transId); + tqDebug("s-task:%s recv re-send checkpoint-trigger msg from upstream:0x%x, checkpointId:%" PRId64 ", transId:%d", + pTask->id.idStr, pRsp->upstreamTaskId, pRsp->checkpointId, pRsp->transId); streamTaskProcessCheckpointTriggerRsp(pTask, pRsp); streamMetaReleaseTask(pMeta, pTask); @@ -998,7 +1009,7 @@ static int32_t tqProcessTaskResumeImpl(void* handle, SStreamTask* pTask, int64_t int32_t level = pTask->info.taskLevel; if (level == TASK_LEVEL__SINK) { - ASSERT (status != TASK_STATUS__UNINIT); + ASSERT(status != TASK_STATUS__UNINIT); streamMetaReleaseTask(pMeta, pTask); return 0; } @@ -1025,7 +1036,7 @@ static int32_t tqProcessTaskResumeImpl(void* handle, SStreamTask* pTask, int64_t streamTrySchedExec(pTask); } } else { - ASSERT (status != TASK_STATUS__UNINIT); + ASSERT(status != TASK_STATUS__UNINIT); } streamMetaReleaseTask(pMeta, pTask); @@ -1063,7 +1074,7 @@ int32_t tqStreamProcessStreamHbRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) { return d int32_t tqStreamProcessReqCheckpointRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) { return doProcessDummyRspMsg(pMeta, pMsg); } -int32_t tqStreamProcessChkptReportRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) {return doProcessDummyRspMsg(pMeta, pMsg);} +int32_t tqStreamProcessChkptReportRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) { return doProcessDummyRspMsg(pMeta, pMsg); } int32_t tqStreamProcessCheckpointReadyRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) { SMStreamCheckpointReadyRspMsg* pRsp = pMsg->pCont; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 62b29db76e..bee5a1d990 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -771,6 +771,7 @@ int32_t tsdbCacheNewTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWrap STSchema *pTSchema = NULL; code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTSchema); if (code != TSDB_CODE_SUCCESS) { + taosThreadMutexUnlock(&pTsdb->lruMutex); terrno = code; return -1; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index c6f13bc0a8..37da1a9d53 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -49,7 +49,8 @@ static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter); static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity, STsdbReader* pReader); static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader); -static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey, STsdbReader* pReader); +static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey, + STsdbReader* pReader); static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* id); static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey* pCurKey, SArray* pDelList, @@ -68,7 +69,8 @@ static int32_t doMergeMemIMemRows(TSDBROW* pRow, SRowKey* pRowKey, TSDBROW* piRo STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, SRow** pTSRow); static int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, SRowKey* pKey, STsdbReader* pReader); -static int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, STsdbReader* pReader); +static int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, + STsdbReader* pReader); static int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t order, SReadCostSummary* pCost); static STsdb* getTsdbByRetentions(SVnode* pVnode, SQueryTableDataCond* pCond, SRetention* retentions, const char* idstr, @@ -126,7 +128,7 @@ static void tColRowGetPriamyKeyDeepCopy(SBlockData* pBlock, int32_t irow, int32_ } // for test purpose, todo remove it -static int32_t tGetPrimaryKeyIndex(uint8_t *p, SPrimaryKeyIndex *index) { +static int32_t tGetPrimaryKeyIndex(uint8_t* p, SPrimaryKeyIndex* index) { int32_t n = 0; n += tGetI8(p + n, &index->type); n += tGetU32v(p + n, &index->offset); @@ -137,7 +139,7 @@ static void tRowGetPrimaryKeyDeepCopy(SRow* pRow, SRowKey* pKey) { SPrimaryKeyIndex indices[TD_MAX_PK_COLS]; ASSERT(pKey->numOfPKs <= TD_MAX_PK_COLS); - uint8_t *data = pRow->data; + uint8_t* data = pRow->data; for (int32_t i = 0; i < pRow->numOfPKs; i++) { data += tGetPrimaryKeyIndex(data, &indices[i]); } @@ -146,7 +148,7 @@ static void tRowGetPrimaryKeyDeepCopy(SRow* pRow, SRowKey* pKey) { for (int32_t i = 0; i < pRow->numOfPKs; i++) { pKey->pks[i].type = indices[i].type; - uint8_t *tdata = data + indices[i].offset; + uint8_t* tdata = data + indices[i].offset; if (pRow->flag >> 4) { tdata += tGetI16v(tdata, NULL); } @@ -363,9 +365,7 @@ _err: return code; } -bool shouldFreePkBuf(SBlockLoadSuppInfo *pSupp) { - return (pSupp->numOfPks > 0) && IS_VAR_DATA_TYPE(pSupp->pk.type); -} +bool shouldFreePkBuf(SBlockLoadSuppInfo* pSupp) { return (pSupp->numOfPks > 0) && IS_VAR_DATA_TYPE(pSupp->pk.type); } void resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool needFree) { pIter->order = order; @@ -927,6 +927,10 @@ static int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData } else { int64_t key = asc ? pReader->info.window.ekey : pReader->info.window.skey; endPos = doBinarySearchKey(pBlockData->aTSKEY, pRecord->numRow, pos, key, pReader->info.order); + if (endPos == -1) { + return endPos; + } + endPos = findFirstPos(pBlockData->aTSKEY, pRecord->numRow, endPos, asc); } @@ -1077,10 +1081,10 @@ static void blockInfoToRecord(SBrinRecord* record, SFileDataBlockInfo* pBlockInf pLast->type = pSupp->pk.type; if (IS_VAR_DATA_TYPE(pFirst->type)) { - pFirst->pData = (uint8_t*) varDataVal(pBlockInfo->firstPk.pData); + pFirst->pData = (uint8_t*)varDataVal(pBlockInfo->firstPk.pData); pFirst->nData = varDataLen(pBlockInfo->firstPk.pData); - pLast->pData = (uint8_t*) varDataVal(pBlockInfo->lastPk.pData); + pLast->pData = (uint8_t*)varDataVal(pBlockInfo->lastPk.pData); pLast->nData = varDataLen(pBlockInfo->lastPk.pData); } else { pFirst->val = pBlockInfo->firstPk.val; @@ -1417,7 +1421,8 @@ static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIte } // todo: this attribute could be acquired during extractin the global ordered block list. -static bool overlapWithNeighborBlock2(SFileDataBlockInfo* pBlock, SBrinRecord* pRec, int32_t order, int32_t pkType, int32_t numOfPk) { +static bool overlapWithNeighborBlock2(SFileDataBlockInfo* pBlock, SBrinRecord* pRec, int32_t order, int32_t pkType, + int32_t numOfPk) { // it is the last block in current file, no chance to overlap with neighbor blocks. if (ASCENDING_TRAVERSE(order)) { if (pBlock->lastKey == pRec->firstKey.key.ts) { @@ -1429,7 +1434,7 @@ static bool overlapWithNeighborBlock2(SFileDataBlockInfo* pBlock, SBrinRecord* p v1.val = pBlock->lastPk.val; } return (tValueCompare(&v1, &pRec->firstKey.key.pks[0]) == 0); - } else { // no pk + } else { // no pk return true; } } else { @@ -1445,7 +1450,7 @@ static bool overlapWithNeighborBlock2(SFileDataBlockInfo* pBlock, SBrinRecord* p v1.val = pBlock->firstPk.val; } return (tValueCompare(&v1, &pRec->lastKey.key.pks[0]) == 0); - } else { // no pk + } else { // no pk return true; } } else { @@ -1585,7 +1590,7 @@ static bool tryCopyDistinctRowFromFileBlock(STsdbReader* pReader, SBlockData* pB *copied = false; bool asc = (pReader->info.order == TSDB_ORDER_ASC); if ((pDumpInfo->rowIndex < pDumpInfo->totalRows - 1 && asc) || (pDumpInfo->rowIndex > 0 && (!asc))) { - int32_t step = ASCENDING_TRAVERSE(pReader->info.order)? 1 : -1; + int32_t step = ASCENDING_TRAVERSE(pReader->info.order) ? 1 : -1; SRowKey nextRowKey; tColRowGetKey(pBlockData, pDumpInfo->rowIndex + step, &nextRowKey); @@ -2077,7 +2082,8 @@ int32_t doInitMemDataIter(STsdbReader* pReader, STbData** pData, STableBlockScan return code; } -static void doForwardDataIter(SRowKey* pKey, SIterInfo* pIter, STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) { +static void doForwardDataIter(SRowKey* pKey, SIterInfo* pIter, STableBlockScanInfo* pBlockScanInfo, + STsdbReader* pReader) { SRowKey rowKey = {0}; while (1) { @@ -2119,7 +2125,7 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea startKey.key = pBlockScanInfo->lastProcKey; startKey.version = asc ? pReader->info.verRange.minVer : pReader->info.verRange.maxVer; if ((asc && (startKey.key.ts < pWindow->skey)) || ((!asc) && startKey.key.ts > pWindow->ekey)) { - startKey.key.ts = asc? pWindow->skey:pWindow->ekey; + startKey.key.ts = asc ? pWindow->skey : pWindow->ekey; forward = false; } @@ -2168,8 +2174,8 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, int32_t rowIndex, STable return false; } - if (ts == pBlockScanInfo->lastProcKey.ts) { // todo opt perf - SRowKey nextRowKey; // lazy eval + if (ts == pBlockScanInfo->lastProcKey.ts) { // todo opt perf + SRowKey nextRowKey; // lazy eval tColRowGetKey(pBlockData, rowIndex, &nextRowKey); if (pkCompEx(&pBlockScanInfo->lastProcKey, &nextRowKey) == 0) { return false; @@ -2268,12 +2274,12 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan pScanInfo->sttKeyInfo.status = taosArrayGetSize(info.pKeyRangeList) ? STT_FILE_HAS_DATA : STT_FILE_NO_DATA; - SRowKey* p = asc? &pScanInfo->sttRange.skey:&pScanInfo->sttRange.ekey; + SRowKey* p = asc ? &pScanInfo->sttRange.skey : &pScanInfo->sttRange.ekey; tRowKeyAssign(&pScanInfo->sttKeyInfo.nextProcKey, p); hasData = (pScanInfo->sttKeyInfo.status == STT_FILE_HAS_DATA); - } else { // not clean stt blocks - INIT_KEYRANGE(&pScanInfo->sttRange); //reset the time window + } else { // not clean stt blocks + INIT_KEYRANGE(&pScanInfo->sttRange); // reset the time window pScanInfo->sttBlockReturned = false; hasData = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pReader->suppInfo.pkSrcSlot, &pReader->info.verRange); } @@ -2362,8 +2368,9 @@ int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanIn TSDBROW fRow = {.iRow = pRow->iRow, .type = TSDBROW_COL_FMT, .pBlockData = pRow->pBlockData}; if (IS_VAR_DATA_TYPE(pScanInfo->lastProcKey.pks[0].type)) { - tsdbTrace("fRow ptr:%p, %d, uid:%" PRIu64 ", ts:%" PRId64 " pk:%s %s", pRow->pBlockData, pRow->iRow, pSttBlockReader->uid, - fRow.pBlockData->aTSKEY[fRow.iRow], pScanInfo->lastProcKey.pks[0].pData, pReader->idStr); + tsdbTrace("fRow ptr:%p, %d, uid:%" PRIu64 ", ts:%" PRId64 " pk:%s %s", pRow->pBlockData, pRow->iRow, + pSttBlockReader->uid, fRow.pBlockData->aTSKEY[fRow.iRow], pScanInfo->lastProcKey.pks[0].pData, + pReader->idStr); } int32_t code = @@ -2513,7 +2520,8 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { return code; } - STableBlockScanInfo* pBlockScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); + STableBlockScanInfo* pBlockScanInfo = + getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); if (pBlockScanInfo == NULL) { goto _end; } @@ -3560,7 +3568,7 @@ FORCE_INLINE TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, S int32_t order = pReader->info.order; TSDBROW* pRow = tsdbTbDataIterGet(pIter->iter); - TSDBKEY key; + TSDBKEY key; TSDBROW_INIT_KEY(pRow, key); if (outOfTimeWindow(key.ts, &pReader->info.window)) { pIter->hasVal = false; @@ -3572,7 +3580,8 @@ FORCE_INLINE TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, S if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) { return pRow; } else { - bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange, pReader->suppInfo.numOfPks > 0); + bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange, + pReader->suppInfo.numOfPks > 0); if (!dropped) { return pRow; } @@ -3597,7 +3606,8 @@ FORCE_INLINE TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, S if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) { return pRow; } else { - bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange, pReader->suppInfo.numOfPks > 0); + bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange, + pReader->suppInfo.numOfPks > 0); if (!dropped) { return pRow; } @@ -3606,7 +3616,7 @@ FORCE_INLINE TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, S } } -int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey *pCurKey, SArray* pDelList, STsdbReader* pReader) { +int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey* pCurKey, SArray* pDelList, STsdbReader* pReader) { SRowMerger* pMerger = &pReader->status.merger; while (1) { @@ -3698,7 +3708,8 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn return code; } -int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey, STsdbReader* pReader) { +int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey, + STsdbReader* pReader) { SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SRowMerger* pMerger = &pReader->status.merger; bool asc = ASCENDING_TRAVERSE(pReader->info.order); @@ -3707,8 +3718,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc pDumpInfo->rowIndex += step; if ((pDumpInfo->rowIndex <= pBlockData->nRow - 1 && asc) || (pDumpInfo->rowIndex >= 0 && !asc)) { - pDumpInfo->rowIndex = - doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, pKey, pMerger, pRange, step); + pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, pKey, pMerger, pRange, step); } // all rows are consumed, let's try next file block @@ -3912,8 +3922,8 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, SRowKey* pRowKey, TSDBROW* piRow, SRow static int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, TSDBROW* pResRow, int64_t endKey, bool* freeTSRow) { - TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader); - TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader); + TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader); + TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader); SArray* pDelList = pBlockScanInfo->delSkyline; uint64_t uid = pBlockScanInfo->uid; @@ -4484,8 +4494,8 @@ static int32_t doSuspendCurrentReader(STsdbReader* pCurrentReader) { while ((p = tSimpleHashIterate(pStatus->pTableMap, p, &iter)) != NULL) { STableBlockScanInfo* pInfo = *(STableBlockScanInfo**)p; clearBlockScanInfo(pInfo); -// pInfo->sttKeyInfo.nextProcKey = pInfo->lastProcKey.ts + step; -// pInfo->sttKeyInfo.nextProcKey = pInfo->lastProcKey + step; + // pInfo->sttKeyInfo.nextProcKey = pInfo->lastProcKey.ts + step; + // pInfo->sttKeyInfo.nextProcKey = pInfo->lastProcKey + step; } pStatus->uidList.currentIndex = 0; @@ -4815,7 +4825,6 @@ int32_t tsdbNextDataBlock2(STsdbReader* pReader, bool* hasNext) { return code; } - if (pReader->step == EXTERNAL_ROWS_MAIN && pReader->innerReader[1] != NULL) { // prepare for the next row scan int32_t step = -1; @@ -4956,7 +4965,7 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock, if (pResBlock->pBlockAgg == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - for(int i = 0; i < num; ++i) { + for (int i = 0; i < num; ++i) { pResBlock->pBlockAgg[i].colId = -1; } } @@ -4976,6 +4985,7 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock, } else if (pAgg->colId < pSup->colId[j]) { i += 1; } else if (pSup->colId[j] < pAgg->colId) { + pResBlock->pBlockAgg[pSup->slotId[j]].colId = -1; *allHave = false; j += 1; } @@ -5034,9 +5044,8 @@ SSDataBlock* tsdbRetrieveDataBlock2(STsdbReader* pReader, SArray* pIdList) { SReaderStatus* pStatus = &pTReader->status; if (pStatus->composedDataBlock || pReader->info.execMode == READER_EXEC_ROWS) { - -// tsdbReaderSuspend2(pReader); -// tsdbReaderResume2(pReader); + // tsdbReaderSuspend2(pReader); + // tsdbReaderResume2(pReader); return pTReader->resBlockInfo.pResBlock; } @@ -5046,8 +5055,8 @@ SSDataBlock* tsdbRetrieveDataBlock2(STsdbReader* pReader, SArray* pIdList) { qTrace("tsdb/read-retrieve: %p, unlock read mutex", pReader); tsdbReleaseReader(pReader); -// tsdbReaderSuspend2(pReader); -// tsdbReaderResume2(pReader); + // tsdbReaderSuspend2(pReader); + // tsdbReaderResume2(pReader); return ret; } @@ -5466,8 +5475,7 @@ void tsdbReaderSetId2(STsdbReader* pReader, const char* idstr) { pReader->status.fileIter.pSttBlockReader->mergeTree.idStr = pReader->idStr; } -void tsdbReaderSetCloseFlag(STsdbReader* pReader) { /*pReader->code = TSDB_CODE_TSC_QUERY_CANCELLED;*/ -} +void tsdbReaderSetCloseFlag(STsdbReader* pReader) { /*pReader->code = TSDB_CODE_TSC_QUERY_CANCELLED;*/ } void tsdbSetFilesetDelimited(STsdbReader* pReader) { pReader->bFilesetDelimited = true; } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index f9bb636be3..2264e2779b 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1103,6 +1103,7 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, if (vnodeValidateTableHash(pVnode, tbName) < 0) { cRsp.code = TSDB_CODE_VND_HASH_MISMATCH; taosArrayPush(rsp.pArray, &cRsp); + vError("vgId:%d create-table:%s failed due to hash value mismatch", TD_VID(pVnode), tbName); continue; } diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index c5c14950b2..6aaa79bb31 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -363,7 +363,7 @@ typedef struct SCtgUserAuth { } SCtgUserAuth; typedef struct SCatalog { - uint64_t clusterId; + int64_t clusterId; bool stopUpdate; SDynViewVersion dynViewVer; SHashObj* userCache; // key:user, value:SCtgUserAuth diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index e7d5a89d6f..4048c8841b 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -834,7 +834,7 @@ int32_t catalogInit(SCatalogCfg* cfg) { return TSDB_CODE_SUCCESS; } -int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { +int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) { if (NULL == catalogHandle) { CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); } diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index 8590080fad..a95df06307 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -426,6 +426,7 @@ int32_t ctgdGetClusterCacheNum(SCatalog *pCtg, int32_t type) { break; case CTG_DBG_VIEW_NUM: num += ctgdGetViewNum(dbCache); + break; default: ctgError("invalid type:%d", type); break; diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 6da1da2b52..eac716339b 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -410,7 +410,7 @@ void ctgFreeHandle(SCatalog* pCtg) { return; } - uint64_t clusterId = pCtg->clusterId; + int64_t clusterId = pCtg->clusterId; ctgFreeMetaRent(&pCtg->dbRent); ctgFreeMetaRent(&pCtg->stbRent); @@ -498,7 +498,7 @@ void ctgClearHandle(SCatalog* pCtg) { return; } - uint64_t clusterId = pCtg->clusterId; + int64_t clusterId = pCtg->clusterId; ctgFreeMetaRent(&pCtg->dbRent); ctgFreeMetaRent(&pCtg->stbRent); diff --git a/source/libs/executor/src/hashjoinoperator.c b/source/libs/executor/src/hashjoinoperator.c index 31d3385676..2fe2ccc56f 100755 --- a/source/libs/executor/src/hashjoinoperator.c +++ b/source/libs/executor/src/hashjoinoperator.c @@ -116,7 +116,7 @@ int32_t hJoinLaunchPrimExpr(SSDataBlock* pBlock, SHJoinTableCtx* pTable, int32_t SColumnInfoData* pPrimOut = taosArrayGet(pBlock->pDataBlock, pTable->primCtx.targetSlotId); if (0 != pCtx->timezoneUnit) { for (int32_t i = startIdx; i <= endIdx; ++i) { - ((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] / pCtx->truncateUnit * pCtx->truncateUnit - pCtx->timezoneUnit; + ((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] - (((int64_t*)pPrimIn->pData)[i] - pCtx->timezoneUnit) % pCtx->truncateUnit; } } else { for (int32_t i = startIdx; i <= endIdx; ++i) { diff --git a/source/libs/executor/src/mergejoin.c b/source/libs/executor/src/mergejoin.c index df8c6e2faf..5f0a2eadfb 100755 --- a/source/libs/executor/src/mergejoin.c +++ b/source/libs/executor/src/mergejoin.c @@ -99,7 +99,7 @@ int32_t mWinJoinDumpGrpCache(SMJoinWindowCtx* pCtx) { int32_t buildEndIdx = buildGrp->endIdx; buildGrp->endIdx = buildGrp->readIdx + rowsLeft - 1; - mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, buildGrp); + MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, buildGrp)); buildGrp->readIdx += rowsLeft; buildGrp->endIdx = buildEndIdx; rowsLeft = 0; @@ -225,7 +225,7 @@ static int32_t mOuterJoinMergeFullCart(SMJoinMergeCtx* pCtx) { int32_t buildEndIdx = buildGrp->endIdx; buildGrp->endIdx = buildGrp->readIdx + rowsLeft - 1; - mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, buildGrp); + MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, buildGrp)); buildGrp->readIdx += rowsLeft; buildGrp->endIdx = buildEndIdx; rowsLeft = 0; @@ -291,7 +291,6 @@ static int32_t mOuterJoinMergeSeqCart(SMJoinMergeCtx* pCtx) { MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->midBlk, true, probeGrp, buildGrp)); buildGrp->readIdx += rowsLeft; buildGrp->endIdx = buildEndIdx; - rowsLeft = 0; break; } @@ -682,7 +681,7 @@ static int32_t mInnerJoinMergeCart(SMJoinMergeCtx* pCtx) { int32_t buildEndIdx = buildGrp->endIdx; buildGrp->endIdx = buildGrp->readIdx + rowsLeft - 1; - mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, buildGrp); + MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, buildGrp)); buildGrp->readIdx += rowsLeft; buildGrp->endIdx = buildEndIdx; rowsLeft = 0; @@ -1402,7 +1401,6 @@ static int32_t mSemiJoinMergeSeqCart(SMJoinMergeCtx* pCtx) { MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->midBlk, true, probeGrp, buildGrp)); buildGrp->readIdx += rowsLeft; buildGrp->endIdx = buildEndIdx; - rowsLeft = 0; break; } @@ -1712,7 +1710,6 @@ static int32_t mAntiJoinMergeSeqCart(SMJoinMergeCtx* pCtx) { MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->midBlk, true, probeGrp, buildGrp)); buildGrp->readIdx += rowsLeft; buildGrp->endIdx = buildEndIdx; - rowsLeft = 0; break; } @@ -2004,7 +2001,7 @@ int32_t mAsofBackwardDumpGrpCache(SMJoinWindowCtx* pCtx) { } buildGrp.endIdx = buildGrp.readIdx + rowsLeft - 1; - mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, &buildGrp); + MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, &buildGrp)); pCtx->cache.outRowIdx += rowsLeft; break; } diff --git a/source/libs/executor/src/mergejoinoperator.c b/source/libs/executor/src/mergejoinoperator.c index faaebc1cd8..2e2101231b 100644 --- a/source/libs/executor/src/mergejoinoperator.c +++ b/source/libs/executor/src/mergejoinoperator.c @@ -948,7 +948,7 @@ int32_t mJoinLaunchPrimExpr(SSDataBlock* pBlock, SMJoinTableCtx* pTable) { SColumnInfoData* pPrimOut = taosArrayGet(pBlock->pDataBlock, pTable->primCtx.targetSlotId); if (0 != pCtx->timezoneUnit) { for (int32_t i = 0; i < pBlock->info.rows; ++i) { - ((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] / pCtx->truncateUnit * pCtx->truncateUnit - pCtx->timezoneUnit; + ((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] - (((int64_t*)pPrimIn->pData)[i] + pCtx->timezoneUnit) % pCtx->truncateUnit; } } else { for (int32_t i = 0; i < pBlock->info.rows; ++i) { diff --git a/source/libs/executor/src/mergeoperator.c b/source/libs/executor/src/mergeoperator.c index b1fba588ab..993e8c72fd 100755 --- a/source/libs/executor/src/mergeoperator.c +++ b/source/libs/executor/src/mergeoperator.c @@ -182,7 +182,7 @@ SSDataBlock* doSortMerge(SOperatorInfo* pOperator) { resetLimitInfoForNextGroup(&pInfo->limitInfo); } - applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo); + (void)applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo); if (p->info.rows > 0) { break; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index cda4b67f97..6c512d4859 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2265,13 +2265,16 @@ static void processPrimaryKey(SSDataBlock* pBlock, bool hasPrimaryKey, STqOffset doBlockDataPrimaryKeyFilter(pBlock, offset); SColumnInfoData* pColPk = taosArrayGet(pBlock->pDataBlock, 1); + if (pBlock->info.rows < 1) { + return ; + } void* tmp = colDataGetData(pColPk, pBlock->info.rows - 1); val.type = pColPk->info.type; - if(IS_VAR_DATA_TYPE(pColPk->info.type)) { + if (IS_VAR_DATA_TYPE(pColPk->info.type)) { val.pData = taosMemoryMalloc(varDataLen(tmp)); val.nData = varDataLen(tmp); memcpy(val.pData, varDataVal(tmp), varDataLen(tmp)); - }else{ + } else { memcpy(&val.val, tmp, pColPk->info.bytes); } } @@ -2292,13 +2295,19 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { } if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) { - SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp); + while (1) { + SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp); - if (pResult && pResult->info.rows > 0) { - bool hasPrimaryKey = pAPI->tqReaderFn.tqGetTablePrimaryKey(pInfo->tqReader); - processPrimaryKey(pResult, hasPrimaryKey, &pTaskInfo->streamInfo.currentOffset); - qDebug("tmqsnap doQueueScan get data uid:%" PRId64 "", pResult->info.id.uid); - return pResult; + if (pResult && pResult->info.rows > 0) { + bool hasPrimaryKey = pAPI->tqReaderFn.tqGetTablePrimaryKey(pInfo->tqReader); + processPrimaryKey(pResult, hasPrimaryKey, &pTaskInfo->streamInfo.currentOffset); + qDebug("tmqsnap doQueueScan get data uid:%" PRId64 "", pResult->info.id.uid); + if (pResult->info.rows > 0) { + return pResult; + } + } else { + break; + } } STableScanInfo* pTSInfo = pInfo->pTableScanOp->info; @@ -3902,17 +3911,19 @@ static int32_t openSubTablesMergeSort(STmsSubTablesMergeInfo* pSubTblsInfo) { if (pInput->rowIdx == -1) { continue; } + if (pInput->type == SUB_TABLE_MEM_BLOCK) { pInput->rowIdx = 0; pInput->pageIdx = -1; } + pInput->pInputBlock = (pInput->type == SUB_TABLE_MEM_BLOCK) ? pInput->pReaderBlock : pInput->pPageBlock; SColumnInfoData* col = taosArrayGet(pInput->pInputBlock->pDataBlock, pSubTblsInfo->pTsOrderInfo->slotId); pInput->aTs = (int64_t*)col->pData; } + __merge_compare_fn_t mergeCompareFn = (!pSubTblsInfo->pPkOrderInfo) ? subTblRowCompareTsFn : subTblRowCompareTsPkFn; - tMergeTreeCreate(&pSubTblsInfo->pTree, pSubTblsInfo->numSubTables, pSubTblsInfo, mergeCompareFn); - return TSDB_CODE_SUCCESS; + return tMergeTreeCreate(&pSubTblsInfo->pTree, pSubTblsInfo->numSubTables, pSubTblsInfo, mergeCompareFn); } static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) { diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 1cdd7d2d87..c1a38b66ba 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -172,10 +172,17 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SWinKey key = {.ts = ts, .groupId = groupId}; void* curVal = NULL; int32_t curVLen = 0; + bool hasCurKey = true; int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); - ASSERT(code == TSDB_CODE_SUCCESS); - pFillSup->cur.key = key.ts; - pFillSup->cur.pRowVal = curVal; + if (code == TSDB_CODE_SUCCESS) { + pFillSup->cur.key = key.ts; + pFillSup->cur.pRowVal = curVal; + } else { + qDebug("streamStateFillGet key failed, Data may be deleted. ts:%" PRId64 ", groupId:%" PRId64, ts, groupId); + pFillSup->cur.key = ts; + pFillSup->cur.pRowVal = NULL; + hasCurKey = false; + } SStreamStateCur* pCur = pAPI->stateStore.streamStateFillSeekKeyPrev(pState, &key); SWinKey preKey = {.ts = INT64_MIN, .groupId = groupId}; @@ -187,8 +194,10 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, pFillSup->prev.key = preKey.ts; pFillSup->prev.pRowVal = preVal; - code = pAPI->stateStore.streamStateCurNext(pState, pCur); - ASSERT(code == TSDB_CODE_SUCCESS); + if (hasCurKey) { + code = pAPI->stateStore.streamStateCurNext(pState, pCur); + ASSERT(code == TSDB_CODE_SUCCESS); + } code = pAPI->stateStore.streamStateCurNext(pState, pCur); if (code != TSDB_CODE_SUCCESS) { @@ -741,8 +750,8 @@ static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKE getWindowFromDiscBuf(pOperator, startTs, groupId, pInfo->pFillSup); setDeleteFillValueInfo(startTs, endTs, pInfo->pFillSup, pInfo->pFillInfo); SWinKey key = {.ts = startTs, .groupId = groupId}; + pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key); if (!pInfo->pFillInfo->needFill) { - pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key); buildDeleteResult(pOperator, startTs, endTs, groupId, pInfo->pDelRes); } else { STimeRange tw = { @@ -751,11 +760,27 @@ static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKE .groupId = groupId, }; taosArrayPush(pInfo->pFillInfo->delRanges, &tw); - while (key.ts <= endTs) { - key.ts = taosTimeAdd(key.ts, pInfo->pFillSup->interval.sliding, pInfo->pFillSup->interval.slidingUnit, - pInfo->pFillSup->interval.precision); - tSimpleHashPut(pInfo->pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0); - } + } +} + +static void getWindowInfoByKey(SStorageAPI* pAPI, void* pState, TSKEY ts, int64_t groupId, SResultRowData* pWinData) { + SWinKey key = {.ts = ts, .groupId = groupId}; + void* val = NULL; + int32_t len = 0; + int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&val, &len); + if (code != TSDB_CODE_SUCCESS) { + qDebug("get window info by key failed, Data may be deleted, try next window. ts:%" PRId64 ", groupId:%" PRId64, ts, + groupId); + SStreamStateCur* pCur = pAPI->stateStore.streamStateFillSeekKeyNext(pState, &key); + code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &key, (const void**)&val, &len); + pAPI->stateStore.streamStateFreeCur(pCur); + qDebug("get window info by key ts:%" PRId64 ", groupId:%" PRId64 ", res%d", ts, groupId, code); + } + + if (code == TSDB_CODE_SUCCESS) { + resetFillWindow(pWinData); + pWinData->key = key.ts; + pWinData->pRowVal = val; } } @@ -765,20 +790,22 @@ static void doDeleteFillFinalize(SOperatorInfo* pOperator) { SStreamFillOperatorInfo* pInfo = pOperator->info; SStreamFillInfo* pFillInfo = pInfo->pFillInfo; int32_t size = taosArrayGetSize(pFillInfo->delRanges); - tSimpleHashClear(pInfo->pFillSup->pResMap); - for (; pFillInfo->delIndex < size; pFillInfo->delIndex++) { + while (pFillInfo->delIndex < size) { STimeRange* range = taosArrayGet(pFillInfo->delRanges, pFillInfo->delIndex); if (pInfo->pRes->info.id.groupId != 0 && pInfo->pRes->info.id.groupId != range->groupId) { return; } getWindowFromDiscBuf(pOperator, range->skey, range->groupId, pInfo->pFillSup); + TSKEY realEnd = range->ekey + 1; + if (pInfo->pFillInfo->type == TSDB_FILL_NEXT && pInfo->pFillSup->next.key != realEnd) { + getWindowInfoByKey(pAPI, pOperator->pTaskInfo->streamInfo.pState, realEnd, range->groupId, &pInfo->pFillSup->next); + } setDeleteFillValueInfo(range->skey, range->ekey, pInfo->pFillSup, pInfo->pFillInfo); + pFillInfo->delIndex++; if (pInfo->pFillInfo->needFill) { doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes); pInfo->pRes->info.id.groupId = range->groupId; } - SWinKey key = {.ts = range->skey, .groupId = range->groupId}; - pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key); } } diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 4d567f729e..5b9c018bba 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -2632,7 +2632,7 @@ int32_t doStreamSessionEncodeOpState(void** buf, int32_t len, SOperatorInfo* pOp } // 4.dataVersion - tlen += taosEncodeFixedI32(buf, pInfo->dataVersion); + tlen += taosEncodeFixedI64(buf, pInfo->dataVersion); // 5.checksum if (isParent) { @@ -3086,15 +3086,17 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true, OP_NOT_OPENED, pInfo, pTaskInfo); - // for stream - void* buff = NULL; - int32_t len = 0; - int32_t res = - pInfo->streamAggSup.stateStore.streamStateGetInfo(pInfo->streamAggSup.pState, STREAM_SESSION_OP_CHECKPOINT_NAME, - strlen(STREAM_SESSION_OP_CHECKPOINT_NAME), &buff, &len); - if (res == TSDB_CODE_SUCCESS) { - doStreamSessionDecodeOpState(buff, len, pOperator, true); - taosMemoryFree(buff); + if (pPhyNode->type != QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { + // for stream + void* buff = NULL; + int32_t len = 0; + int32_t res = + pInfo->streamAggSup.stateStore.streamStateGetInfo(pInfo->streamAggSup.pState, STREAM_SESSION_OP_CHECKPOINT_NAME, + strlen(STREAM_SESSION_OP_CHECKPOINT_NAME), &buff, &len); + if (res == TSDB_CODE_SUCCESS) { + doStreamSessionDecodeOpState(buff, len, pOperator, true); + taosMemoryFree(buff); + } } pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamSessionAgg, NULL, destroyStreamSessionAggOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); @@ -3279,6 +3281,16 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream pAPI->stateStore.streamStateSetNumber(pChInfo->streamAggSup.pState, i, pInfo->primaryTsIndex); taosArrayPush(pInfo->pChildren, &pChildOp); } + + void* buff = NULL; + int32_t len = 0; + int32_t res = + pInfo->streamAggSup.stateStore.streamStateGetInfo(pInfo->streamAggSup.pState, STREAM_SESSION_OP_CHECKPOINT_NAME, + strlen(STREAM_SESSION_OP_CHECKPOINT_NAME), &buff, &len); + if (res == TSDB_CODE_SUCCESS) { + doStreamSessionDecodeOpState(buff, len, pOperator, true); + taosMemoryFree(buff); + } } if (!IS_FINAL_SESSION_OP(pOperator) || numOfChild == 0) { @@ -3621,7 +3633,7 @@ int32_t doStreamStateEncodeOpState(void** buf, int32_t len, SOperatorInfo* pOper } // 4.dataVersion - tlen += taosEncodeFixedI32(buf, pInfo->dataVersion); + tlen += taosEncodeFixedI64(buf, pInfo->dataVersion); // 5.checksum if (isParent) { diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 498b46dcfe..e3e84ac20b 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2166,15 +2166,6 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } - if (QUERY_NODE_VALUE == nodeType(nodesListGetNode(pFunc->pParameterList, 0))) { - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 0); - - if (!validateTimestampDigits(pValue)) { - pFunc->node.resType = (SDataType){.bytes = 0, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; - } - } - // param1 if (numOfParams == 2) { SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); diff --git a/source/libs/index/src/indexFilter.c b/source/libs/index/src/indexFilter.c index cb42e60c01..323f855601 100644 --- a/source/libs/index/src/indexFilter.c +++ b/source/libs/index/src/indexFilter.c @@ -624,6 +624,23 @@ static int32_t sifSetFltParam(SIFParam *left, SIFParam *right, SDataTypeBuf *typ } return 0; } + +static int8_t sifShouldUseIndexBasedOnType(SIFParam *left, SIFParam *right) { + // not compress + if (left->colValType == TSDB_DATA_TYPE_FLOAT) return 0; + + if (left->colValType == TSDB_DATA_TYPE_GEOMETRY || right->colValType == TSDB_DATA_TYPE_GEOMETRY || + left->colValType == TSDB_DATA_TYPE_JSON || right->colValType == TSDB_DATA_TYPE_JSON) { + return 0; + } + + if (IS_VAR_DATA_TYPE(left->colValType)) { + if (!IS_VAR_DATA_TYPE(right->colValType)) return 0; + } else if (IS_NUMERIC_TYPE(left->colValType)) { + if (left->colValType != right->colValType) return 0; + } + return 1; +} static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFParam *output) { int ret = 0; SIndexMetaArg *arg = &output->arg; @@ -641,8 +658,10 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP ret = indexJsonSearch(arg->ivtIdx, mtm, output->result); indexMultiTermQueryDestroy(mtm); } else { - if (left->colValType == TSDB_DATA_TYPE_GEOMETRY || right->colValType == TSDB_DATA_TYPE_GEOMETRY) { - return TSDB_CODE_QRY_GEO_NOT_SUPPORT_ERROR; + int8_t useIndex = sifShouldUseIndexBasedOnType(left, right); + if (!useIndex) { + output->status = SFLT_NOT_INDEX; + return -1; } bool reverse = false, equal = false; @@ -660,15 +679,12 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP SDataTypeBuf typedata; memset(&typedata, 0, sizeof(typedata)); - if (IS_VAR_DATA_TYPE(left->colValType)) { - if (!IS_VAR_DATA_TYPE(right->colValType)) { - NUM_TO_STRING(right->colValType, right->condValue, sizeof(buf) - 2, buf + VARSTR_HEADER_SIZE); - varDataSetLen(buf, strlen(buf + VARSTR_HEADER_SIZE)); - param.val = buf; - } - } else { - if (sifSetFltParam(left, right, &typedata, ¶m) != 0) return -1; + + if (sifSetFltParam(left, right, &typedata, ¶m) != 0) { + output->status = SFLT_NOT_INDEX; + return -1; } + ret = left->api.metaFilterTableIds(arg->metaEx, ¶m, output->result); if (ret == 0) { taosArraySort(output->result, uidCompare); diff --git a/source/libs/monitor/src/clientMonitor.c b/source/libs/monitor/src/clientMonitor.c deleted file mode 100644 index 0891932583..0000000000 --- a/source/libs/monitor/src/clientMonitor.c +++ /dev/null @@ -1,210 +0,0 @@ -#include "clientMonitor.h" -#include "os.h" -#include "tmisce.h" -#include "ttime.h" -#include "ttimer.h" -#include "tglobal.h" - -SRWLatch monitorLock; -void* tmrClientMonitor; -tmr_h tmrStartHandle; -SHashObj* clusterMonitorInfoTable; - -static int interval = 30 * 1000; -static int sendBathchSize = 1; - -int32_t sendReport(ClientMonitor* pMonitor, char* pCont); -void generateClusterReport(ClientMonitor* pMonitor, bool send) { - char ts[50]; - sprintf(ts, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI)); - char* pCont = (char*)taos_collector_registry_bridge_new(pMonitor->registry, ts, "%" PRId64, NULL); - if(NULL == pCont) { - uError("generateClusterReport failed, get null content."); - return; - } - if (send && strlen(pCont) != 0) { - if (sendReport(pMonitor, pCont) == 0) { - taos_collector_registry_clear_batch(pMonitor->registry); - } - } - taosMemoryFreeClear(pCont); -} - -void reportSendProcess(void* param, void* tmrId) { - taosTmrReset(reportSendProcess, tsMonitorInterval * 1000, NULL, tmrClientMonitor, &tmrStartHandle); - taosRLockLatch(&monitorLock); - - static int index = 0; - index++; - ClientMonitor** ppMonitor = (ClientMonitor**)taosHashIterate(clusterMonitorInfoTable, NULL); - while (ppMonitor != NULL && *ppMonitor != NULL) { - ClientMonitor* pMonitor = *ppMonitor; - generateClusterReport(*ppMonitor, index == sendBathchSize); - ppMonitor = taosHashIterate(clusterMonitorInfoTable, ppMonitor); - } - - if (index == sendBathchSize) index = 0; - taosRUnLockLatch(&monitorLock); -} - -void monitorClientInitOnce() { - static int8_t init = 0; - if (atomic_exchange_8(&init, 1) == 0) { - uInfo("tscMonitorInit once."); - clusterMonitorInfoTable = - (SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); - - tmrClientMonitor = taosTmrInit(0, 0, 0, "MONITOR"); - tmrStartHandle = taosTmrStart(reportSendProcess, tsMonitorInterval * 1000, NULL, tmrClientMonitor); - if(tsMonitorInterval < 1){ - interval = 30 * 1000; - } else { - interval = tsMonitorInterval * 1000; - } - if (tsMonitorInterval < 10) { - sendBathchSize = (10 / sendBathchSize) + 1; - } - taosInitRWLatch(&monitorLock); - } -} - -void createMonitorClient(const char* clusterKey, SEpSet epSet, void* pTransporter) { - if (clusterKey == NULL || strlen(clusterKey) == 0) { - uError("createMonitorClient failed, clusterKey is NULL"); - return; - } - taosWLockLatch(&monitorLock); - if (taosHashGet(clusterMonitorInfoTable, clusterKey, strlen(clusterKey)) == NULL) { - uInfo("createMonitorClient for %s.", clusterKey); - ClientMonitor* pMonitor = taosMemoryCalloc(1, sizeof(ClientMonitor)); - snprintf(pMonitor->clusterKey, sizeof(pMonitor->clusterKey), "%s", clusterKey); - pMonitor->registry = taos_collector_registry_new(clusterKey); - pMonitor->colector = taos_collector_new(clusterKey); - epsetAssign(&pMonitor->epSet, &epSet); - pMonitor->pTransporter = pTransporter; - - taos_collector_registry_register_collector(pMonitor->registry, pMonitor->colector); - pMonitor->counters = - (SHashObj*)taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); - - taosHashPut(clusterMonitorInfoTable, clusterKey, strlen(clusterKey), &pMonitor, sizeof(ClientMonitor*)); - uInfo("createMonitorClient for %s finished %p.", clusterKey, pMonitor); - } - taosWUnLockLatch(&monitorLock); -} - -static int32_t monitorReportAsyncCB(void* param, SDataBuf* pMsg, int32_t code) { - static int32_t emptyRspNum = 0; - if (TSDB_CODE_SUCCESS != code) { - uError("found error in monitorReport send callback, code:%d, please check the network.", code); - } - if (pMsg) { - taosMemoryFree(pMsg->pData); - taosMemoryFree(pMsg->pEpSet); - } - return code; -} - -int32_t sendReport(ClientMonitor* pMonitor, char* pCont) { - SStatisReq sStatisReq; - sStatisReq.pCont = pCont; - sStatisReq.contLen = strlen(pCont); - - int tlen = tSerializeSStatisReq(NULL, 0, &sStatisReq); - if (tlen < 0) return 0; - void* buf = taosMemoryMalloc(tlen); - if (buf == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - tSerializeSStatisReq(buf, tlen, &sStatisReq); - - SMsgSendInfo* pInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); - if (pInfo == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - pInfo->fp = monitorReportAsyncCB; - pInfo->msgInfo.pData = buf; - pInfo->msgInfo.len = tlen; - pInfo->msgType = TDMT_MND_STATIS; - // pInfo->param = taosMemoryMalloc(sizeof(int32_t)); - // *(int32_t*)pInfo->param = i; - pInfo->paramFreeFp = taosMemoryFree; - pInfo->requestId = tGenIdPI64(); - pInfo->requestObjRefId = 0; - - int64_t transporterId = 0; - return asyncSendMsgToServer(pMonitor->pTransporter, &pMonitor->epSet, &transporterId, pInfo); -} - -void clusterMonitorInit(const char* clusterKey, SEpSet epSet, void* pTransporter) { - monitorClientInitOnce(); - createMonitorClient(clusterKey, epSet, pTransporter); -} - -taos_counter_t* createClusterCounter(const char* clusterKey, const char* name, const char* help, size_t label_key_count, - const char** label_keys) { - ClientMonitor** ppMonitor = (ClientMonitor**)taosHashGet(clusterMonitorInfoTable, clusterKey, strlen(clusterKey)); - - if (ppMonitor != NULL && *ppMonitor != NULL) { - ClientMonitor* pMonitor = *ppMonitor; - taos_counter_t** ppCounter = (taos_counter_t**)taosHashGet(pMonitor->counters, name, strlen(name)); - if (ppCounter != NULL && *ppCounter != NULL) { - taosHashRemove(pMonitor->counters, name, strlen(name)); - uInfo("createClusterCounter remove old counter: %s.", name); - } - - taos_counter_t* newCounter = taos_counter_new(name, help, label_key_count, label_keys); - if (newCounter != NULL) { - taos_collector_add_metric(pMonitor->colector, newCounter); - taosHashPut(pMonitor->counters, name, strlen(name), &newCounter, sizeof(taos_counter_t*)); - uInfo("createClusterCounter %s(%p):%s : %p.", pMonitor->clusterKey, pMonitor, name, newCounter); - return newCounter; - } else { - return NULL; - } - } else { - return NULL; - } - return NULL; -} - -int taosClusterCounterInc(const char* clusterKey, const char* counterName, const char** label_values) { - taosRLockLatch(&monitorLock); - ClientMonitor** ppMonitor = (ClientMonitor**)taosHashGet(clusterMonitorInfoTable, clusterKey, strlen(clusterKey)); - - if (ppMonitor != NULL && *ppMonitor != NULL) { - ClientMonitor* pMonitor = *ppMonitor; - taos_counter_t** ppCounter = (taos_counter_t**)taosHashGet(pMonitor->counters, counterName, strlen(counterName)); - if (ppCounter != NULL && *ppCounter != NULL) { - taos_counter_inc(*ppCounter, label_values); - } else { - uError("taosClusterCounterInc not found pCounter %s:%s.", clusterKey, counterName); - } - } else { - uError("taosClusterCounterInc not found pMonitor %s.", clusterKey); - } - taosRUnLockLatch(&monitorLock); - return 0; -} - -void clusterMonitorClose(const char* clusterKey) { - taosWLockLatch(&monitorLock); - ClientMonitor** ppMonitor = (ClientMonitor**)taosHashGet(clusterMonitorInfoTable, clusterKey, strlen(clusterKey)); - - if (ppMonitor != NULL && *ppMonitor != NULL) { - ClientMonitor* pMonitor = *ppMonitor; - uInfo("clusterMonitorClose valule:%p clusterKey:%s.", pMonitor, pMonitor->clusterKey); - taosHashCleanup(pMonitor->counters); - taos_collector_registry_destroy(pMonitor->registry); - taosMemoryFree(pMonitor); - taosHashRemove(clusterMonitorInfoTable, clusterKey, strlen(clusterKey)); - } - taosWUnLockLatch(&monitorLock); -} - -const char* resultStr(SQL_RESULT_CODE code) { - static const char* result_state[] = {"Success", "Failed", "Cancel"}; - return result_state[code]; -} diff --git a/source/libs/monitor/src/monMain.c b/source/libs/monitor/src/monMain.c index 4ecc6f1261..21c196872c 100644 --- a/source/libs/monitor/src/monMain.c +++ b/source/libs/monitor/src/monMain.c @@ -24,6 +24,7 @@ SMonitor tsMonitor = {0}; char* tsMonUri = "/report"; char* tsMonFwUri = "/general-metric"; +char* tsMonSlowLogUri = "/slow-sql-detail-batch"; char* tsMonFwBasicUri = "/taosd-cluster-basic"; void monRecordLog(int64_t ts, ELogLevel level, const char *content) { @@ -631,7 +632,7 @@ void monGenAndSendReportBasic() { monCleanupMonitorInfo(pMonitor); } -void monSendContent(char *pCont) { +void monSendContent(char *pCont, const char* uri) { if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return; if(tsMonitorLogProtocol){ if (pCont != NULL){ @@ -640,7 +641,7 @@ void monSendContent(char *pCont) { } if (pCont != NULL) { EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT; - if (taosSendHttpReport(tsMonitor.cfg.server, tsMonFwUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) { + if (taosSendHttpReport(tsMonitor.cfg.server, uri, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) { uError("failed to send monitor msg"); } } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 79a6fcd5d8..f118c15b7a 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -60,7 +60,7 @@ char* getFullJoinTypeString(EJoinType type, EJoinSubType stype) { {"LEFT", "LEFT", "LEFT OUTER", "LEFT SEMI", "LEFT ANTI", "LEFT ANY", "LEFT ASOF", "LEFT WINDOW"}, {"RIGHT", "RIGHT", "RIGHT OUTER", "RIGHT SEMI", "RIGHT ANTI", "RIGHT ANY", "RIGHT ASOF", "RIGHT WINDOW"}, {"FULL", "FULL", "FULL OUTER", "FULL", "FULL", "FULL ANY", "FULL", "FULL"} - }; + }; return joinFullType[type][stype]; } @@ -89,7 +89,7 @@ int32_t mergeJoinConds(SNode** ppDst, SNode** ppSrc) { } nodesDestroyNode(*ppSrc); *ppSrc = NULL; - + return TSDB_CODE_SUCCESS; } } @@ -422,6 +422,8 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SCreateTableStmt)); case QUERY_NODE_CREATE_SUBTABLE_CLAUSE: return makeNode(type, sizeof(SCreateSubTableClause)); + case QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE: + return makeNode(type, sizeof(SCreateSubTableFromFileClause)); case QUERY_NODE_CREATE_MULTI_TABLES_STMT: return makeNode(type, sizeof(SCreateMultiTablesStmt)); case QUERY_NODE_DROP_TABLE_CLAUSE: @@ -1006,7 +1008,7 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyNode(pWin->pStartOffset); nodesDestroyNode(pWin->pEndOffset); break; - } + } case QUERY_NODE_SET_OPERATOR: { SSetOperator* pStmt = (SSetOperator*)pNode; nodesDestroyList(pStmt->pProjectionList); @@ -1089,6 +1091,20 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyNode((SNode*)pStmt->pOptions); break; } + case QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE: { + SCreateSubTableFromFileClause* pStmt = (SCreateSubTableFromFileClause*)pNode; + if (pStmt->aCreateTbData) { + taosArrayDestroy(pStmt->aCreateTbData); + } + if (pStmt->aTagIndexs) { + taosArrayDestroy(pStmt->aTagIndexs); + } + if (pStmt->fp) { + taosCloseFile(&pStmt->fp); + } + nodesDestroyList(pStmt->pSpecificTags); + break; + } case QUERY_NODE_CREATE_MULTI_TABLES_STMT: nodesDestroyList(((SCreateMultiTablesStmt*)pNode)->pSubTables); break; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 6c1fff05da..dc42245d93 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -201,6 +201,8 @@ SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, SNode* SNodeList* pTags, SNode* pOptions); SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNode* pUseRealTable, SNodeList* pSpecificTags, SNodeList* pValsOfTags, SNode* pOptions); +SNode* createCreateSubTableFromFileClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pUseRealTable, + SNodeList* pSpecificTags, const SToken* pFilePath); SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables); SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable); SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables); diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h index be670b2708..f550840f41 100644 --- a/source/libs/parser/inc/parUtil.h +++ b/source/libs/parser/inc/parUtil.h @@ -135,6 +135,7 @@ int32_t getVnodeSysTableTargetName(int32_t acctId, SNode* pWhere, SName* pName); int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type); int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SSchema* pTagSchema, SToken* pToken, SArray* pTagName, SArray* pTagVals, STag** pTag); +int32_t parseTbnameToken(SMsgBuf* pMsgBuf, char* tname, SToken* pToken, bool* pFoundCtbName); int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalogReq); int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMetaData, SParseMetaCache* pMetaCache); @@ -150,7 +151,7 @@ int32_t reserveDbCfgInCache(int32_t acctId, const char* pDb, SParseMetaCache* pM int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type, SParseMetaCache* pMetaCache); int32_t reserveViewUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type, - SParseMetaCache* pMetaCache); + SParseMetaCache* pMetaCache); int32_t reserveUdfInCache(const char* pFunc, SParseMetaCache* pMetaCache); int32_t reserveTableIndexInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache); int32_t reserveTableCfgInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 8a18a84fae..f9bf9b8bb1 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -385,11 +385,15 @@ alter_table_clause(A) ::= %destructor multi_create_clause { nodesDestroyList($$); } multi_create_clause(A) ::= create_subtable_clause(B). { A = createNodeList(pCxt, B); } multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C). { A = addNodeToList(pCxt, B, C); } +multi_create_clause(A) ::= create_from_file_clause(B). { A = createNodeList(pCxt, B); } create_subtable_clause(A) ::= not_exists_opt(B) full_table_name(C) USING full_table_name(D) specific_cols_opt(E) TAGS NK_LP tags_literal_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); } +create_from_file_clause(A) ::= not_exists_opt(B) USING full_table_name(C) + NK_LP tag_list_opt(D) NK_RP FILE NK_STRING(E). { A = createCreateSubTableFromFileClause(pCxt, B, C, D, &E); } + %type multi_drop_clause { SNodeList* } %destructor multi_drop_clause { nodesDestroyList($$); } multi_drop_clause(A) ::= drop_table_clause(B). { A = createNodeList(pCxt, B); } @@ -532,7 +536,7 @@ cmd ::= SHOW GRANTS LOGS. cmd ::= SHOW CLUSTER MACHINES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } cmd ::= SHOW CREATE DATABASE db_name(A). { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &A); } cmd ::= SHOW CREATE TABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, A); } -cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, +cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, A); } cmd ::= SHOW ENCRYPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } cmd ::= SHOW QUERIES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -820,13 +824,13 @@ tags_literal(A) ::= NK_INTEGER(B). tags_literal(A) ::= NK_INTEGER(B) NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_INTEGER(B) NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_PLUS(B) NK_INTEGER(C). { @@ -837,13 +841,13 @@ tags_literal(A) ::= NK_PLUS(B) NK_INTEGER(C). tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_MINUS(B) NK_INTEGER(C). { @@ -854,13 +858,13 @@ tags_literal(A) ::= NK_MINUS(B) NK_INTEGER(C). tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_FLOAT(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B, NULL); } @@ -879,13 +883,13 @@ tags_literal(A) ::= NK_BIN(B). tags_literal(A) ::= NK_BIN(B) NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_BIN(B) NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_PLUS(B) NK_BIN(C). { @@ -896,13 +900,13 @@ tags_literal(A) ::= NK_PLUS(B) NK_BIN(C). tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_MINUS(B) NK_BIN(C). { @@ -913,26 +917,26 @@ tags_literal(A) ::= NK_MINUS(B) NK_BIN(C). tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_HEX(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); } tags_literal(A) ::= NK_HEX(B) NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_HEX(B) NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_PLUS(B) NK_HEX(C). { @@ -943,13 +947,13 @@ tags_literal(A) ::= NK_PLUS(B) NK_HEX(C). tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_MINUS(B) NK_HEX(C). { @@ -960,13 +964,13 @@ tags_literal(A) ::= NK_MINUS(B) NK_HEX(C). tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } @@ -974,13 +978,13 @@ tags_literal(A) ::= NK_STRING(B). tags_literal(A) ::= NK_STRING(B) NK_PLUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_STRING(B) NK_MINUS duration_literal(C). { SToken l = B; SToken r = getTokenFromRawExprNode(pCxt, C); - l.n = (r.z + r.n) - l.z; + l.n = (r.z + r.n) - l.z; A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C); } tags_literal(A) ::= NK_BOOL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B, NULL); } @@ -1348,9 +1352,9 @@ parenthesized_joined_table(A) ::= NK_LP parenthesized_joined_table(B) NK_RP. /************************************************ joined_table ********************************************************/ joined_table(A) ::= - table_reference(B) join_type(C) join_subtype(D) JOIN table_reference(E) join_on_clause_opt(F) - window_offset_clause_opt(G) jlimit_clause_opt(H). { - A = createJoinTableNode(pCxt, C, D, B, E, F); + table_reference(B) join_type(C) join_subtype(D) JOIN table_reference(E) join_on_clause_opt(F) + window_offset_clause_opt(G) jlimit_clause_opt(H). { + A = createJoinTableNode(pCxt, C, D, B, E, F); A = addWindowOffsetClause(pCxt, A, G); A = addJLimitClause(pCxt, A, H); } @@ -1376,16 +1380,16 @@ join_on_clause_opt(A) ::= . join_on_clause_opt(A) ::= ON search_condition(B). { A = B; } window_offset_clause_opt(A) ::= . { A = NULL; } -window_offset_clause_opt(A) ::= WINDOW_OFFSET NK_LP window_offset_literal(B) +window_offset_clause_opt(A) ::= WINDOW_OFFSET NK_LP window_offset_literal(B) NK_COMMA window_offset_literal(C) NK_RP. { A = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); } window_offset_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createTimeOffsetValueNode(pCxt, &B)); } window_offset_literal(A) ::= NK_MINUS(B) NK_VARIABLE(C). { SToken t = B; t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + A = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } - + jlimit_clause_opt(A) ::= . { A = NULL; } jlimit_clause_opt(A) ::= JLIMIT NK_INTEGER(B). { A = createLimitNode(pCxt, &B, NULL); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 2c41572488..0497e7a0e2 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1828,6 +1828,26 @@ SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SN return (SNode*)pStmt; } +SNode* createCreateSubTableFromFileClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pUseRealTable, + SNodeList* pSpecificTags, const SToken* pFilePath) { + CHECK_PARSER_STATUS(pCxt); + SCreateSubTableFromFileClause* pStmt = + (SCreateSubTableFromFileClause*)nodesMakeNode(QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE); + CHECK_OUT_OF_MEM(pStmt); + strcpy(pStmt->useDbName, ((SRealTableNode*)pUseRealTable)->table.dbName); + strcpy(pStmt->useTableName, ((SRealTableNode*)pUseRealTable)->table.tableName); + pStmt->ignoreExists = ignoreExists; + pStmt->pSpecificTags = pSpecificTags; + if (TK_NK_STRING == pFilePath->type) { + trimString(pFilePath->z, pFilePath->n, pStmt->filePath, PATH_MAX); + } else { + strncpy(pStmt->filePath, pFilePath->z, pFilePath->n); + } + + nodesDestroyNode(pUseRealTable); + return (SNode*)pStmt; +} + SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables) { CHECK_PARSER_STATUS(pCxt); SCreateMultiTablesStmt* pStmt = (SCreateMultiTablesStmt*)nodesMakeNode(QUERY_NODE_CREATE_MULTI_TABLES_STMT); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index fe9804baef..02f262cfb1 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -275,19 +275,34 @@ static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCre int32_t code = TSDB_CODE_SUCCESS; SNode* pNode = NULL; FOREACH(pNode, pStmt->pSubTables) { - SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; - code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pClause->dbName, pCxt->pMetaCache); - if (TSDB_CODE_SUCCESS == code) { - code = - reserveTableMetaInCache(pCxt->pParseCxt->acctId, pClause->useDbName, pClause->useTableName, pCxt->pMetaCache); - } - if (TSDB_CODE_SUCCESS == code) { - code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache); - } - if (TSDB_CODE_SUCCESS == code) { - code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName, NULL, - AUTH_TYPE_WRITE, pCxt->pMetaCache); + if (pNode->type == QUERY_NODE_CREATE_SUBTABLE_CLAUSE) { + SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; + code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pClause->dbName, pCxt->pMetaCache); + if (TSDB_CODE_SUCCESS == code) { + code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pClause->useDbName, pClause->useTableName, + pCxt->pMetaCache); + } + if (TSDB_CODE_SUCCESS == code) { + code = + reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache); + } + if (TSDB_CODE_SUCCESS == code) { + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName, NULL, + AUTH_TYPE_WRITE, pCxt->pMetaCache); + } + } else { + SCreateSubTableFromFileClause* pClause = (SCreateSubTableFromFileClause*)pNode; + code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pClause->useDbName, pCxt->pMetaCache); + if (TSDB_CODE_SUCCESS == code) { + code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pClause->useDbName, pClause->useTableName, + pCxt->pMetaCache); + } + if (TSDB_CODE_SUCCESS == code) { + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->useDbName, NULL, + AUTH_TYPE_WRITE, pCxt->pMetaCache); + } } + if (TSDB_CODE_SUCCESS != code) { break; } diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index 5490d0dc49..03fda3681f 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -265,10 +265,18 @@ static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStm int32_t code = TSDB_CODE_SUCCESS; SNode* pNode = NULL; FOREACH(pNode, pStmt->pSubTables) { - SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; - code = checkAuth(pCxt, pClause->dbName, NULL, AUTH_TYPE_WRITE, NULL); - if (TSDB_CODE_SUCCESS != code) { - break; + if (pNode->type == QUERY_NODE_CREATE_SUBTABLE_CLAUSE) { + SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; + code = checkAuth(pCxt, pClause->dbName, NULL, AUTH_TYPE_WRITE, NULL); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } else { + SCreateSubTableFromFileClause* pClause = (SCreateSubTableFromFileClause*)pNode; + code = checkAuth(pCxt, pClause->useDbName, NULL, AUTH_TYPE_WRITE, NULL); + if (TSDB_CODE_SUCCESS != code) { + break; + } } } return code; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 53b9805267..9393a62e26 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1708,37 +1708,31 @@ typedef union SRowsDataContext { SStbRowsDataContext* pStbRowsCxt; } SRowsDataContext; -static int32_t parseTbnameToken(SInsertParseContext* pCxt, SStbRowsDataContext* pStbRowsCxt, SToken* pToken, - bool* pFoundCtbName) { +int32_t parseTbnameToken(SMsgBuf* pMsgBuf, char* tname, SToken* pToken, bool* pFoundCtbName) { *pFoundCtbName = false; - int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, TSDB_DATA_TYPE_BINARY); - if (TK_NK_VARIABLE == pToken->type) { - code = buildInvalidOperationMsg(&pCxt->msg, "not expected tbname"); - } - if (code == TSDB_CODE_SUCCESS) { - if (isNullValue(TSDB_DATA_TYPE_BINARY, pToken)) { - return buildInvalidOperationMsg(&pCxt->msg, "tbname can not be null value"); - } - if (pToken->n > 0) { - if (pToken->n <= TSDB_TABLE_NAME_LEN - 1) { - for (int i = 0; i < pToken->n; ++i) { - if (pToken->z[i] == '.') { - return buildInvalidOperationMsg(&pCxt->msg, "tbname can not contain '.'"); - } else { - pStbRowsCxt->ctbName.tname[i] = pToken->z[i]; - } - } - pStbRowsCxt->ctbName.tname[pToken->n] = '\0'; - *pFoundCtbName = true; - } else { - return buildInvalidOperationMsg(&pCxt->msg, "tbname is too long"); - } - } else { - return buildInvalidOperationMsg(&pCxt->msg, "tbname can not be empty"); - } + if (isNullValue(TSDB_DATA_TYPE_BINARY, pToken)) { + return buildInvalidOperationMsg(pMsgBuf, "tbname can not be null value"); } - return code; + + if (pToken->n > 0) { + if (pToken->n <= TSDB_TABLE_NAME_LEN - 1) { + for (int i = 0; i < pToken->n; ++i) { + if (pToken->z[i] == '.') { + return buildInvalidOperationMsg(pMsgBuf, "tbname can not contain '.'"); + } else { + tname[i] = pToken->z[i]; + } + } + tname[pToken->n] = '\0'; + *pFoundCtbName = true; + } else { + return buildInvalidOperationMsg(pMsgBuf, "tbname is too long"); + } + } else { + return buildInvalidOperationMsg(pMsgBuf, "tbname can not be empty"); + } + return TSDB_CODE_SUCCESS; } static int32_t processCtbTagsAfterCtbName(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, @@ -1821,7 +1815,14 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* } } } else if (pCols->pColIndex[i] == tbnameIdx) { - code = parseTbnameToken(pCxt, pStbRowsCxt, pToken, bFoundTbName); + code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, TSDB_DATA_TYPE_BINARY); + if (TK_NK_VARIABLE == pToken->type) { + code = buildInvalidOperationMsg(&pCxt->msg, "not expected tbname"); + } + + if (code == TSDB_CODE_SUCCESS) { + code = parseTbnameToken(&pCxt->msg, pStbRowsCxt->ctbName.tname, pToken, bFoundTbName); + } } if (code == TSDB_CODE_SUCCESS && i < pCols->numOfBound - 1) { @@ -2427,6 +2428,20 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif return buildSyntaxErrMsg(&pCxt->msg, "table_name is expected", pTbName->z); } + // db.? situation,ensure that the only thing following the '.' mark is '?' + char *tbNameAfterDbName = strchr(pTbName->z, '.'); + if ((tbNameAfterDbName != NULL) && (tbNameAfterDbName + 1 - pTbName->z == pTbName->n - 1) && + (*(tbNameAfterDbName + 1) == '?')) { + char *tbName = NULL; + int32_t code = (*pCxt->pComCxt->pStmtCb->getTbNameFn)(pCxt->pComCxt->pStmtCb->pStmt, &tbName); + if (TSDB_CODE_SUCCESS == code) { + pTbName->z = tbName; + pTbName->n = strlen(tbName); + } else { + return code; + } + } + *pHasData = true; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index 44f8bd90b0..2bcc7501fb 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -51,7 +51,8 @@ int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData** pData) { return TSDB_CODE_SUCCESS; } -int32_t qAppendStmtTableOutput(SQuery* pQuery, SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx, SStbInterlaceInfo* pBuildInfo) { +int32_t qAppendStmtTableOutput(SQuery* pQuery, SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx, + SStbInterlaceInfo* pBuildInfo) { // merge according to vgId return insAppendStmtTableDataCxt(pAllVgHash, pTbData, pTbCtx, pBuildInfo); } @@ -70,18 +71,16 @@ int32_t qBuildStmtFinOutput(SQuery* pQuery, SHashObj* pAllVgHash, SArray* pVgDat return code; } - /* -int32_t qBuildStmtOutputFromTbList(SQuery* pQuery, SHashObj* pVgHash, SArray* pBlockList, STableDataCxt* pTbCtx, int32_t tbNum) { - int32_t code = TSDB_CODE_SUCCESS; - SArray* pVgDataBlocks = NULL; - SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; +int32_t qBuildStmtOutputFromTbList(SQuery* pQuery, SHashObj* pVgHash, SArray* pBlockList, STableDataCxt* pTbCtx, int32_t +tbNum) { int32_t code = TSDB_CODE_SUCCESS; SArray* pVgDataBlocks = NULL; SVnodeModifyOpStmt* +pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; // merge according to vgId if (tbNum > 0) { code = insMergeStmtTableDataCxt(pTbCtx, pBlockList, &pVgDataBlocks, true, tbNum); } - + if (TSDB_CODE_SUCCESS == code) { code = insBuildVgDataBlocks(pVgHash, pVgDataBlocks, &pStmt->pDataBlocks); } @@ -102,7 +101,7 @@ int32_t qBuildStmtOutput(SQuery* pQuery, SHashObj* pVgHash, SHashObj* pBlockHash if (taosHashGetSize(pBlockHash) > 0) { code = insMergeTableDataCxt(pBlockHash, &pVgDataBlocks, true); } - + if (TSDB_CODE_SUCCESS == code) { code = insBuildVgDataBlocks(pVgHash, pVgDataBlocks, &pStmt->pDataBlocks, false); } @@ -217,6 +216,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName, pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pTag = NULL; end: for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { @@ -227,6 +227,7 @@ end: } taosArrayDestroy(pTagArray); taosArrayDestroy(tagName); + taosMemoryFree(pTag); return code; } @@ -243,7 +244,7 @@ int32_t convertStmtNcharCol(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_MULTI_BIND* if (NULL == dst->length) { dst->length = taosMemoryRealloc(dst->length, sizeof(int32_t) * src->num); - if (NULL == dst->buffer) { + if (NULL == dst->length) { taosMemoryFreeClear(dst->buffer); return TSDB_CODE_OUT_OF_MEMORY; } @@ -276,7 +277,8 @@ int32_t convertStmtNcharCol(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_MULTI_BIND* return TSDB_CODE_SUCCESS; } -int32_t qBindStmtStbColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, STSchema** pTSchema, SBindInfo* pBindInfos) { +int32_t qBindStmtStbColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, + STSchema** pTSchema, SBindInfo* pBindInfos) { STableDataCxt* pDataBlock = (STableDataCxt*)pBlock; SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta); SBoundColInfo* boundInfo = &pDataBlock->boundColsInfo; @@ -293,20 +295,21 @@ int32_t qBindStmtStbColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind } for (int c = 0; c < boundInfo->numOfBound; ++c) { - SSchema* pColSchema = &pSchema[boundInfo->pColIndex[c]]; + SSchema* pColSchema = &pSchema[boundInfo->pColIndex[c]]; if (pColSchema->colId <= lastColId) { colInOrder = false; } else { lastColId = pColSchema->colId; } - //SColData* pCol = taosArrayGet(pCols, c); + // SColData* pCol = taosArrayGet(pCols, c); if (bind[c].num != rowNum) { code = buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same"); goto _return; } - if ((!(rowNum == 1 && bind[c].is_null && *bind[c].is_null)) && bind[c].buffer_type != pColSchema->type) { // for rowNum ==1 , connector may not set buffer_type + if ((!(rowNum == 1 && bind[c].is_null && *bind[c].is_null)) && + bind[c].buffer_type != pColSchema->type) { // for rowNum ==1 , connector may not set buffer_type code = buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type"); goto _return; } @@ -325,10 +328,10 @@ int32_t qBindStmtStbColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind pBindInfos[c].bind = pBind; pBindInfos[c].type = pColSchema->type; - //code = tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE: -1); - //if (code) { - // goto _return; - //} + // code = tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - + // VARSTR_HEADER_SIZE: -1); if (code) { + // goto _return; + // } } code = tRowBuildFromBind(pBindInfos, boundInfo->numOfBound, colInOrder, *pTSchema, pCols); @@ -362,7 +365,8 @@ int32_t qBindStmtColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, c goto _return; } - if ((!(rowNum == 1 && bind[c].is_null && *bind[c].is_null)) && bind[c].buffer_type != pColSchema->type) { // for rowNum ==1 , connector may not set buffer_type + if ((!(rowNum == 1 && bind[c].is_null && *bind[c].is_null)) && + bind[c].buffer_type != pColSchema->type) { // for rowNum ==1 , connector may not set buffer_type code = buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type"); goto _return; } @@ -377,7 +381,8 @@ int32_t qBindStmtColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, c pBind = bind + c; } - code = tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE: -1); + code = tColDataAddValueByBind(pCol, pBind, + IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1); if (code) { goto _return; } @@ -393,9 +398,8 @@ _return: return code; } - -int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, int32_t colIdx, - int32_t rowNum) { +int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, + int32_t colIdx, int32_t rowNum) { STableDataCxt* pDataBlock = (STableDataCxt*)pBlock; SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta); SBoundColInfo* boundInfo = &pDataBlock->boundColsInfo; @@ -510,7 +514,7 @@ int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fiel } int32_t qResetStmtColumns(SArray* pCols, bool deepClear) { - int32_t colNum = taosArrayGetSize(pCols); + int32_t colNum = taosArrayGetSize(pCols); for (int32_t i = 0; i < colNum; ++i) { SColData* pCol = (SColData*)taosArrayGet(pCols, i); @@ -524,7 +528,6 @@ int32_t qResetStmtColumns(SArray* pCols, bool deepClear) { return TSDB_CODE_SUCCESS; } - int32_t qResetStmtDataBlock(STableDataCxt* block, bool deepClear) { STableDataCxt* pBlock = (STableDataCxt*)block; int32_t colNum = taosArrayGetSize(pBlock->pData->aCol); @@ -589,7 +592,7 @@ int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool rese pNewTb->pCreateTbReq = NULL; pNewTb->aCol = taosArrayDup(pCxt->pData->aCol, NULL); - if (NULL == pNewTb) { + if (NULL == pNewTb->aCol) { insDestroyTableDataCxt(*pDst); return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 028866064d..17b5733ff7 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -115,8 +115,7 @@ int32_t insCreateSName(SName* pName, SToken* pTableName, int32_t acctId, const c if (dbName == NULL) { return buildInvalidOperationMsg(pMsgBuf, msg3); } - if (name[0] == '\0') - return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, msg4); + if (name[0] == '\0') return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, msg4); code = tNameSetDbName(pName, acctId, dbName, strlen(dbName)); if (code != TSDB_CODE_SUCCESS) { @@ -487,12 +486,12 @@ int insColDataComp(const void* lp, const void* rp) { return 0; } - -int32_t insTryAddTableVgroupInfo(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo, int32_t* vgId, STableColsData* pTbData, SName* sname) { +int32_t insTryAddTableVgroupInfo(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo, int32_t* vgId, + STableColsData* pTbData, SName* sname) { if (*vgId >= 0 && taosHashGet(pAllVgHash, (const char*)vgId, sizeof(*vgId))) { return TSDB_CODE_SUCCESS; } - + SVgroupInfo vgInfo = {0}; SRequestConnInfo conn = {.pTrans = pBuildInfo->transport, .requestId = pBuildInfo->requestId, @@ -503,23 +502,23 @@ int32_t insTryAddTableVgroupInfo(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuild if (TSDB_CODE_SUCCESS != code) { return code; } - + code = taosHashPut(pAllVgHash, (const char*)&vgInfo.vgId, sizeof(vgInfo.vgId), (char*)&vgInfo, sizeof(vgInfo)); if (TSDB_CODE_SUCCESS != code) { return code; } - - return TSDB_CODE_SUCCESS; + + return TSDB_CODE_SUCCESS; } - -int32_t insGetStmtTableVgUid(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo, STableColsData* pTbData, uint64_t* uid, int32_t* vgId) { +int32_t insGetStmtTableVgUid(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo, STableColsData* pTbData, + uint64_t* uid, int32_t* vgId) { STableVgUid* pTbInfo = NULL; - int32_t code = 0; + int32_t code = 0; if (pTbData->getFromHash) { pTbInfo = (STableVgUid*)tSimpleHashGet(pBuildInfo->pTableHash, pTbData->tbName, strlen(pTbData->tbName)); - } + } if (NULL == pTbInfo) { SName sname; @@ -540,7 +539,7 @@ int32_t insGetStmtTableVgUid(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo if (TSDB_CODE_SUCCESS != code) { return code; } - + *uid = pTableMeta->uid; *vgId = pTableMeta->vgId; @@ -548,7 +547,7 @@ int32_t insGetStmtTableVgUid(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo tSimpleHashPut(pBuildInfo->pTableHash, pTbData->tbName, strlen(pTbData->tbName), &tbInfo, sizeof(tbInfo)); code = insTryAddTableVgroupInfo(pAllVgHash, pBuildInfo, vgId, pTbData, &sname); - + taosMemoryFree(pTableMeta); } else { *uid = pTbInfo->uid; @@ -558,7 +557,6 @@ int32_t insGetStmtTableVgUid(SHashObj* pAllVgHash, SStbInterlaceInfo* pBuildInfo return code; } - int32_t qBuildStmtFinOutput1(SQuery* pQuery, SHashObj* pAllVgHash, SArray* pVgDataBlocks) { int32_t code = TSDB_CODE_SUCCESS; SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; @@ -570,20 +568,19 @@ int32_t qBuildStmtFinOutput1(SQuery* pQuery, SHashObj* pAllVgHash, SArray* pVgDa return code; } - - -int32_t insAppendStmtTableDataCxt(SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx, SStbInterlaceInfo* pBuildInfo) { - int32_t code = TSDB_CODE_SUCCESS; +int32_t insAppendStmtTableDataCxt(SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx, + SStbInterlaceInfo* pBuildInfo) { + int32_t code = TSDB_CODE_SUCCESS; uint64_t uid; int32_t vgId; - + pTbCtx->pData->aRowP = pTbData->aCol; - + code = insGetStmtTableVgUid(pAllVgHash, pBuildInfo, pTbData, &uid, &vgId); if (TSDB_CODE_SUCCESS != code) { return code; } - + pTbCtx->pMeta->vgId = vgId; pTbCtx->pMeta->uid = uid; pTbCtx->pData->uid = uid; @@ -611,24 +608,24 @@ int32_t insAppendStmtTableDataCxt(SHashObj* pAllVgHash, STableColsData* pTbData, } else { pVgCxt = *(SVgroupDataCxt**)pp; } - + if (TSDB_CODE_SUCCESS == code) { code = fillVgroupDataCxt(pTbCtx, pVgCxt, false, false); } if (taosArrayGetSize(pVgCxt->pData->aSubmitTbData) >= 20000) { code = qBuildStmtFinOutput1((SQuery*)pBuildInfo->pQuery, pAllVgHash, pBuildInfo->pVgroupList); - //taosArrayClear(pVgCxt->pData->aSubmitTbData); + // taosArrayClear(pVgCxt->pData->aSubmitTbData); tDestroySubmitReq(pVgCxt->pData, TSDB_MSG_FLG_ENCODE); - //insDestroyVgroupDataCxt(pVgCxt); + // insDestroyVgroupDataCxt(pVgCxt); } return code; } /* -int32_t insMergeStmtTableDataCxt(STableDataCxt* pTableCxt, SArray* pTableList, SArray** pVgDataBlocks, bool isRebuild, int32_t tbNum) { - SHashObj* pVgroupHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false); +int32_t insMergeStmtTableDataCxt(STableDataCxt* pTableCxt, SArray* pTableList, SArray** pVgDataBlocks, bool isRebuild, +int32_t tbNum) { SHashObj* pVgroupHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false); SArray* pVgroupList = taosArrayInit(8, POINTER_BYTES); if (NULL == pVgroupHash || NULL == pVgroupList) { taosHashCleanup(pVgroupHash); @@ -644,7 +641,7 @@ int32_t insMergeStmtTableDataCxt(STableDataCxt* pTableCxt, SArray* pTableList, S pTableCxt->pMeta->uid = pTableCols->uid; pTableCxt->pData->uid = pTableCols->uid; pTableCxt->pData->aCol = pTableCols->aCol; - + SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, 0); if (pCol->nVal <= 0) { continue; @@ -810,7 +807,7 @@ int32_t insBuildVgDataBlocks(SHashObj* pVgroupsHashObj, SArray* pVgDataCxtList, if (taosArrayGetSize(src->pData->aSubmitTbData) <= 0) { continue; } - SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); + SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); if (NULL == dst) { code = TSDB_CODE_OUT_OF_MEMORY; } @@ -875,7 +872,8 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate } char* p = (char*)data; - // | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each column length | + // | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each + // column length | int32_t version = *(int32_t*)data; p += sizeof(int32_t); p += sizeof(int32_t); @@ -890,7 +888,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate p += sizeof(uint64_t); int8_t* fields = p; - if(*fields >= TSDB_DATA_TYPE_MAX || *fields < 0){ + if (*fields >= TSDB_DATA_TYPE_MAX || *fields < 0) { uError("fields type error:%d", *fields); ret = TSDB_CODE_INVALID_PARA; goto end; @@ -911,7 +909,8 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate goto end; } if (tFields != NULL && numFields > boundInfo->numOfBound) { - if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d bigger than num of bound cols:%d", numFields, boundInfo->numOfBound); + if (errstr != NULL) + snprintf(errstr, errstrLen, "numFields:%d bigger than num of bound cols:%d", numFields, boundInfo->numOfBound); ret = TSDB_CODE_INVALID_PARA; goto end; } @@ -920,8 +919,11 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate SSchema* pColSchema = &pSchema[j]; SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, j); if (*fields != pColSchema->type && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { - if (errstr != NULL) snprintf(errstr, errstrLen, "column type or bytes not equal, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", - pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, *(int32_t*)(fields + sizeof(int8_t))); + if (errstr != NULL) + snprintf(errstr, errstrLen, + "column type or bytes not equal, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", + pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, + *(int32_t*)(fields + sizeof(int8_t))); ret = TSDB_CODE_INVALID_PARA; goto end; } @@ -951,8 +953,11 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate SSchema* pColSchema = &pSchema[j]; if (strcmp(pColSchema->name, tFields[i].name) == 0) { if (*fields != pColSchema->type && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { - if (errstr != NULL) snprintf(errstr, errstrLen, "column type or bytes not equal, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", - pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, *(int32_t*)(fields + sizeof(int8_t))); + if (errstr != NULL) + snprintf(errstr, errstrLen, + "column type or bytes not equal, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", + pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, + *(int32_t*)(fields + sizeof(int8_t))); ret = TSDB_CODE_INVALID_PARA; goto end; } @@ -986,7 +991,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate } } - if(!hasTs){ + if (!hasTs) { if (errstr != NULL) snprintf(errstr, errstrLen, "timestamp column(primary key) not found in raw data"); ret = TSDB_CODE_INVALID_PARA; goto end; diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index ff48f81fc1..53ea19f416 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -781,8 +781,9 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr, bool* pIgnoreC if ('.' == str[*i + t0.n]) { len = tGetToken(&str[*i + t0.n + 1], &type); - // only id and string are valid - if (((TK_NK_STRING != t0.type) && (TK_NK_ID != t0.type)) || ((TK_NK_STRING != type) && (TK_NK_ID != type))) { + // only id、string and ? are valid + if (((TK_NK_STRING != t0.type) && (TK_NK_ID != t0.type)) || + ((TK_NK_STRING != type) && (TK_NK_ID != type) && (TK_NK_QUESTION != type))) { t0.type = TK_NK_ILLEGAL; t0.n = 0; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2d5edcb01b..b01377010a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -7254,6 +7254,7 @@ static int32_t buildCmdMsg(STranslateContext* pCxt, int16_t msgType, FSerializeF pCxt->pCmdMsg->msgLen = func(NULL, 0, pReq); pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen); if (NULL == pCxt->pCmdMsg->pMsg) { + taosMemoryFreeClear(pCxt->pCmdMsg); return TSDB_CODE_OUT_OF_MEMORY; } func(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, pReq); @@ -8111,9 +8112,11 @@ static int32_t buildRollupAst(STranslateContext* pCxt, SCreateTableStmt* pStmt, for (int32_t i = 1; i < num; ++i) { SRetention* pRetension = taosArrayGet(dbCfg.pRetensions, i); STranslateContext cxt = {0}; - initTranslateContext(pCxt->pParseCxt, pCxt->pMetaCache, &cxt); - code = getRollupAst(&cxt, pStmt, pRetension, dbCfg.precision, 1 == i ? &pReq->pAst1 : &pReq->pAst2, - 1 == i ? &pReq->ast1Len : &pReq->ast2Len); + code = initTranslateContext(pCxt->pParseCxt, pCxt->pMetaCache, &cxt); + if (TSDB_CODE_SUCCESS == code) { + code = getRollupAst(&cxt, pStmt, pRetension, dbCfg.precision, 1 == i ? &pReq->pAst1 : &pReq->pAst2, + 1 == i ? &pReq->ast1Len : &pReq->ast2Len); + } destroyTranslateContext(&cxt); if (TSDB_CODE_SUCCESS != code) { break; @@ -12413,38 +12416,39 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { return code; } -static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, SCreateSubTableClause* pStmt, - const STag* pTag, uint64_t suid, const char* sTableNmae, SVgroupInfo* pVgInfo, - SArray* tagName, uint8_t tagNum) { - // char dbFName[TSDB_DB_FNAME_LEN] = {0}; - // SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId}; - // strcpy(name.dbname, pStmt->dbName); - // tNameGetFullDbName(&name, dbFName); - +static int32_t addCreateTbReqIntoVgroup(SHashObj* pVgroupHashmap, const char* dbName, uint64_t suid, + const char* sTableName, const char* tableName, SArray* tagName, uint8_t tagNum, + const STag* pTag, int32_t ttl, const char* comment, bool ignoreExists, + SVgroupInfo* pVgInfo) { struct SVCreateTbReq req = {0}; req.type = TD_CHILD_TABLE; - req.name = taosStrdup(pStmt->tableName); - req.ttl = pStmt->pOptions->ttl; - if (pStmt->pOptions->commentNull == false) { - req.comment = taosStrdup(pStmt->pOptions->comment); - req.commentLen = strlen(pStmt->pOptions->comment); + req.name = taosStrdup(tableName); + req.ttl = ttl; + if (comment != NULL) { + req.comment = taosStrdup(comment); + req.commentLen = strlen(comment); } else { req.commentLen = -1; } req.ctb.suid = suid; req.ctb.tagNum = tagNum; - req.ctb.stbName = taosStrdup(sTableNmae); + req.ctb.stbName = taosStrdup(sTableName); req.ctb.pTag = (uint8_t*)pTag; req.ctb.tagName = taosArrayDup(tagName, NULL); - if (pStmt->ignoreExists) { + if (ignoreExists) { req.flags |= TD_CREATE_IF_NOT_EXISTS; } + if (!req.name || !req.ctb.stbName || !req.ctb.tagName || (comment && !req.comment)) { + tdDestroySVCreateTbReq(&req); + return TSDB_CODE_OUT_OF_MEMORY; + } + SVgroupCreateTableBatch* pTableBatch = taosHashGet(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId)); if (pTableBatch == NULL) { SVgroupCreateTableBatch tBatch = {0}; tBatch.info = *pVgInfo; - strcpy(tBatch.dbName, pStmt->dbName); + strcpy(tBatch.dbName, dbName); tBatch.req.pArray = taosArrayInit(4, sizeof(struct SVCreateTbReq)); taosArrayPush(tBatch.req.pArray, &req); @@ -12453,11 +12457,8 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S } else { // add to the correct vgroup taosArrayPush(pTableBatch->req.pArray, &req); } -} -static SDataType schemaToDataType(uint8_t precision, SSchema* pSchema) { - SDataType dt = {.type = pSchema->type, .bytes = pSchema->bytes, .precision = precision, .scale = 0}; - return dt; + return TSDB_CODE_SUCCESS; } static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SDataType dt, SNode** pCast) { @@ -12646,8 +12647,10 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla code = getTableHashVgroup(pCxt, pStmt->dbName, pStmt->tableName, &info); } if (TSDB_CODE_SUCCESS == code) { - addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid, - pStmt->useTableName, &info, tagName, pSuperTableMeta->tableInfo.numOfTags); + const char* comment = pStmt->pOptions->commentNull ? NULL : pStmt->pOptions->comment; + code = addCreateTbReqIntoVgroup(pVgroupHashmap, pStmt->dbName, pSuperTableMeta->uid, pStmt->useTableName, + pStmt->tableName, tagName, pSuperTableMeta->tableInfo.numOfTags, pTag, + pStmt->pOptions->ttl, comment, pStmt->ignoreExists, &info); } else { taosMemoryFree(pTag); } @@ -12657,6 +12660,355 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla return code; } +static int32_t buildTagIndexForBindTags(SMsgBuf* pMsgBuf, SCreateSubTableFromFileClause* pStmt, + STableMeta* pSuperTableMeta) { + int32_t code = TSDB_CODE_SUCCESS; + + int32_t numOfTags = getNumOfTags(pSuperTableMeta); + SSchema* pSchema = getTableTagSchema(pSuperTableMeta); + + SHashObj* pIdxHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (NULL == pIdxHash) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + bool tbnameFound = false; + + SNode* pTagNode; + FOREACH(pTagNode, pStmt->pSpecificTags) { + int32_t idx = -1; + + do { + if (QUERY_NODE_COLUMN == nodeType(pTagNode)) { + SColumnNode* pColNode = (SColumnNode*)pTagNode; + for (int32_t index = 0; index < numOfTags; index++) { + if (strlen(pSchema[index].name) == strlen(pColNode->colName) && + strcmp(pColNode->colName, pSchema[index].name) == 0) { + idx = index; + break; + } + } + + if (idx < 0) { + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, pColNode->colName); + break; + } + + if (NULL != taosHashGet(pIdxHash, &idx, sizeof(idx))) { + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TAG_NAME_DUPLICATED, pColNode->colName); + break; + } + } else if (QUERY_NODE_FUNCTION == nodeType(pTagNode)) { + SFunctionNode* funcNode = (SFunctionNode*)pTagNode; + if (strlen("tbname") != strlen(funcNode->functionName) || strcmp("tbname", funcNode->functionName) != 0) { + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, funcNode->functionName); + } + + idx = numOfTags + 1; + tbnameFound = true; + + if (NULL != taosHashGet(pIdxHash, &idx, sizeof(idx))) { + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TAG_NAME_DUPLICATED, funcNode->functionName); + break; + } + } else { + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, "invalid node type"); + break; + } + } while (0); + + if (code) break; + + if (taosHashPut(pIdxHash, &idx, sizeof(idx), NULL, 0) < 0) { + code = terrno; + goto _OUT; + } + + if (NULL == taosArrayPush(pStmt->aTagIndexs, &idx)) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _OUT; + } + } + + if (!tbnameFound) { + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TBNAME_ERROR); + } + +_OUT: + taosHashCleanup(pIdxHash); + return code; +} + +typedef struct { + // refer + STableMeta* pSuperTableMeta; + SArray* pTagIndexs; + TdFilePtr fp; + + // containers + SHashObj* pTbNameHash; + SArray* aTagNames; + bool tagNameFilled; + SArray* aTagVals; + char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW]; + + // per line + const char* pSql; + STag* pTag; + SName ctbName; + SVgroupInfo vg; +} SParseFileContext; + +static int32_t fillVgroupInfo(SParseContext* pParseCxt, const SName* pName, SVgroupInfo* pVgInfo) { + SVgroupInfo vg; + SRequestConnInfo conn = {.pTrans = pParseCxt->pTransporter, + .requestId = pParseCxt->requestId, + .requestObjRefId = pParseCxt->requestRid, + .mgmtEps = pParseCxt->mgmtEpSet}; + + int32_t code = catalogGetTableHashVgroup(pParseCxt->pCatalog, &conn, pName, &vg); + if (code == TSDB_CODE_SUCCESS) { + *pVgInfo = vg; + } else { + parserError("0x%" PRIx64 " catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s", pParseCxt->requestId, + tstrerror(code), pName->dbname, pName->tname); + } + + return code; +} + +static int32_t parseOneStbRow(SMsgBuf* pMsgBuf, SParseFileContext* pParFileCtx) { + int32_t code = TSDB_CODE_SUCCESS; + int sz = taosArrayGetSize(pParFileCtx->pTagIndexs); + int32_t numOfTags = getNumOfTags(pParFileCtx->pSuperTableMeta); + uint8_t precision = getTableInfo(pParFileCtx->pSuperTableMeta).precision; + SSchema* pSchemas = getTableTagSchema(pParFileCtx->pSuperTableMeta); + for (int i = 0; i < sz; i++) { + const char* pSql = pParFileCtx->pSql; + + int32_t pos = 0; + SToken token = tStrGetToken(pSql, &pos, true, NULL); + pParFileCtx->pSql += pos; + + if (TK_NK_RP == token.type) { + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); + break; + } + + int16_t index = *(int16_t*)taosArrayGet(pParFileCtx->pTagIndexs, i); + if (index < numOfTags) { + // parse tag + const SSchema* pTagSchema = &pSchemas[index]; + + code = checkAndTrimValue(&token, pParFileCtx->tmpTokenBuf, pMsgBuf, pTagSchema->type); + if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) { + code = buildInvalidOperationMsg(pMsgBuf, "not expected row value"); + } + if (TSDB_CODE_SUCCESS == code) { + SArray* aTagNames = pParFileCtx->tagNameFilled ? NULL : pParFileCtx->aTagNames; + code = parseTagValue(pMsgBuf, &pParFileCtx->pSql, precision, (SSchema*)pTagSchema, &token, + aTagNames, pParFileCtx->aTagVals, &pParFileCtx->pTag); + } + } else { + // parse tbname + code = checkAndTrimValue(&token, pParFileCtx->tmpTokenBuf, pMsgBuf, TSDB_DATA_TYPE_BINARY); + if (TK_NK_VARIABLE == token.type) { + code = buildInvalidOperationMsg(pMsgBuf, "not expected tbname"); + } + + if (TSDB_CODE_SUCCESS == code) { + bool bFoundTbName = false; + code = parseTbnameToken(pMsgBuf, pParFileCtx->ctbName.tname, &token, &bFoundTbName); + } + } + + if (TSDB_CODE_SUCCESS != code) break; + } + + if (TSDB_CODE_SUCCESS == code) { + pParFileCtx->tagNameFilled = true; + code = tTagNew(pParFileCtx->aTagVals, 1, false, &pParFileCtx->pTag); + } + + return code; +} + +typedef struct { + SName ctbName; + SArray* aTagNames; + STag* pTag; + SVgroupInfo vg; +} SCreateTableData; + +static void clearTagValArrayFp(void *data) { + STagVal* p = (STagVal*)data; + if (IS_VAR_DATA_TYPE(p->type)) { + taosMemoryFreeClear(p->pData); + } +} + +static void clearCreateTbArrayFp(void *data) { + SCreateTableData* p = (SCreateTableData*)data; + taosMemoryFreeClear(p->pTag); +} + +static int32_t parseCsvFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SParseFileContext* pParseFileCtx, + SArray* aCreateTbData) { + int32_t code = TSDB_CODE_SUCCESS; + + char* pLine = NULL; + int64_t readLen = 0; + while (TSDB_CODE_SUCCESS == code && (readLen = taosGetLineFile(pParseFileCtx->fp, &pLine)) != -1) { + if (('\r' == pLine[readLen - 1]) || ('\n' == pLine[readLen - 1])) { + pLine[--readLen] = '\0'; + } + + if (readLen == 0) continue; + + if (pLine[0] == '#') continue; + + strtolower(pLine, pLine); + pParseFileCtx->pSql = pLine; + + code = parseOneStbRow(pMsgBuf, pParseFileCtx); + + if (TSDB_CODE_SUCCESS == code) { + if (taosHashGet(pParseFileCtx->pTbNameHash, pParseFileCtx->ctbName.tname, + strlen(pParseFileCtx->ctbName.tname) + 1) != NULL) { + taosMemoryFreeClear(pParseFileCtx->pTag); + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TBNAME_DUPLICATED, pParseFileCtx->ctbName.tname); + break; + } + + code = taosHashPut(pParseFileCtx->pTbNameHash, pParseFileCtx->ctbName.tname, + strlen(pParseFileCtx->ctbName.tname) + 1, NULL, 0); + } + + if (TSDB_CODE_SUCCESS == code) { + code = fillVgroupInfo(pParseCxt, &pParseFileCtx->ctbName, &pParseFileCtx->vg); + } + + if (TSDB_CODE_SUCCESS == code) { + SCreateTableData data = {.ctbName = pParseFileCtx->ctbName, + .aTagNames = pParseFileCtx->aTagNames, + .pTag = pParseFileCtx->pTag, + .vg = pParseFileCtx->vg}; + + taosArrayPush(aCreateTbData, &data); + } else { + taosMemoryFreeClear(pParseFileCtx->pTag); + } + + pParseFileCtx->pTag = NULL; + taosArrayClearEx(pParseFileCtx->aTagVals, clearTagValArrayFp); + } + + if (TSDB_CODE_SUCCESS != code) { + taosArrayClearEx(aCreateTbData, clearCreateTbArrayFp); + } + + taosMemoryFree(pLine); + return code; +} + +static int32_t prepareReadFromFile(SCreateSubTableFromFileClause* pStmt) { + int32_t code = TSDB_CODE_SUCCESS; + if (NULL == pStmt->fp) { + pStmt->fp = taosOpenFile(pStmt->filePath, TD_FILE_READ | TD_FILE_STREAM); + if (NULL == pStmt->fp) { + code = TAOS_SYSTEM_ERROR(errno); + goto _ERR; + } + } + + if (NULL == pStmt->aCreateTbData) { + pStmt->aCreateTbData = taosArrayInit(16, sizeof(SCreateTableData)); + if (NULL == pStmt->aCreateTbData) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERR; + } + } + + if (NULL == pStmt->aTagIndexs) { + pStmt->aTagIndexs = taosArrayInit(pStmt->pSpecificTags->length, sizeof(int16_t)); + if (!pStmt->aTagIndexs) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERR; + } + } + + return code; + +_ERR: + taosCloseFile(&pStmt->fp); + taosArrayDestroy(pStmt->aCreateTbData); + taosArrayDestroy(pStmt->aTagIndexs); + + return code; +} + +static int32_t rewriteCreateSubTableFromFile(STranslateContext* pCxt, SCreateSubTableFromFileClause* pStmt, + SHashObj* pVgroupHashmap) { + int32_t code = 0; + + STableMeta* pSuperTableMeta = NULL; + if (TSDB_CODE_SUCCESS == code) { + code = getTableMeta(pCxt, pStmt->useDbName, pStmt->useTableName, &pSuperTableMeta); + } + + if (TSDB_CODE_SUCCESS == code) { + code = prepareReadFromFile(pStmt); + } + + if (TSDB_CODE_SUCCESS == code) { + code = buildTagIndexForBindTags(&pCxt->msgBuf, pStmt, pSuperTableMeta); + } + + SParseFileContext parseFileCtx = { + .pSuperTableMeta = pSuperTableMeta, .fp = pStmt->fp, .pTagIndexs = pStmt->aTagIndexs}; + parseFileCtx.pTbNameHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK); + parseFileCtx.aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN); + parseFileCtx.tagNameFilled = false; + parseFileCtx.aTagVals = taosArrayInit(8, sizeof(STagVal)); + parseFileCtx.pTag = NULL; + parseFileCtx.ctbName.type = TSDB_TABLE_NAME_T; + parseFileCtx.ctbName.acctId = pCxt->pParseCxt->acctId; + strcpy(parseFileCtx.ctbName.dbname, pStmt->useDbName); + + if (NULL == parseFileCtx.aTagNames || NULL == parseFileCtx.aTagVals || NULL == parseFileCtx.pTbNameHash) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _OUT; + } + + if (TSDB_CODE_SUCCESS == code) { + code = parseCsvFile(&pCxt->msgBuf, pCxt->pParseCxt, &parseFileCtx, pStmt->aCreateTbData); + } + + if (TSDB_CODE_SUCCESS == code) { + int sz = taosArrayGetSize(pStmt->aCreateTbData); + for (int i = 0; i < sz; i++) { + SCreateTableData* pData = taosArrayGet(pStmt->aCreateTbData, i); + + code = collectUseTable(&pData->ctbName, pCxt->pTargetTables); + if (TSDB_CODE_SUCCESS != code) { + taosMemoryFree(pData->pTag); + } + + code = addCreateTbReqIntoVgroup(pVgroupHashmap, pStmt->useDbName, pSuperTableMeta->uid, pStmt->useTableName, + pData->ctbName.tname, pData->aTagNames, pSuperTableMeta->tableInfo.numOfTags, + pData->pTag, TSDB_DEFAULT_TABLE_TTL, NULL, pStmt->ignoreExists, &pData->vg); + } + } + +_OUT: + taosMemoryFreeClear(pSuperTableMeta); + taosHashCleanup(parseFileCtx.pTbNameHash); + taosArrayDestroy(parseFileCtx.aTagNames); + taosArrayDestroy(parseFileCtx.aTagVals); + + return code; +} + SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap) { SArray* pBufArray = taosArrayInit(taosHashGetSize(pVgroupHashmap), sizeof(void*)); if (NULL == pBufArray) { @@ -12689,8 +13041,13 @@ static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery) int32_t code = TSDB_CODE_SUCCESS; SNode* pNode; FOREACH(pNode, pStmt->pSubTables) { - SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; - code = rewriteCreateSubTable(pCxt, pClause, pVgroupHashmap); + if (pNode->type == QUERY_NODE_CREATE_SUBTABLE_CLAUSE) { + SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; + code = rewriteCreateSubTable(pCxt, pClause, pVgroupHashmap); + } else { + SCreateSubTableFromFileClause* pClause = (SCreateSubTableFromFileClause*)pNode; + code = rewriteCreateSubTableFromFile(pCxt, pClause, pVgroupHashmap); + } if (TSDB_CODE_SUCCESS != code) { taosHashCleanup(pVgroupHashmap); return code; diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 8f55850448..416faafe35 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -212,10 +212,16 @@ static char* getSyntaxErrFormat(int32_t errCode) { case TSDB_CODE_PAR_COL_PK_TYPE: return "primary key column must be of type int, uint, bigint, ubigint, and varchar"; case TSDB_CODE_PAR_INVALID_PK_OP: - return "primary key column can not be added, modified, and dropped"; + return "primary key column can not be added, modified, and dropped"; case TSDB_CODE_TSMA_NAME_TOO_LONG: return "Tsma name too long"; - default: + case TSDB_CODE_PAR_TBNAME_ERROR: + return "Pseudo tag tbname not set"; + case TSDB_CODE_PAR_TBNAME_DUPLICATED: + return "Table name:%s duplicated"; + case TSDB_CODE_PAR_TAG_NAME_DUPLICATED: + return "Tag name:%s duplicated"; + default: return "Unknown error"; } } diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index bdeccafa36..a5cbe90598 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -48,6 +48,47 @@ bool qIsInsertValuesSql(const char* pStr, size_t length) { return false; } +bool qParseDbName(const char* pStr, size_t length, char** pDbName) { + (void) length; + int32_t index = 0; + SToken t; + + if (NULL == pStr) { + *pDbName = NULL; + return false; + } + + t = tStrGetToken((char *) pStr, &index, false, NULL); + if (TK_INSERT != t.type && TK_IMPORT != t.type) { + *pDbName = NULL; + return false; + } + + t = tStrGetToken((char *) pStr, &index, false, NULL); + if (TK_INTO != t.type) { + *pDbName = NULL; + return false; + } + + t = tStrGetToken((char *) pStr, &index, false, NULL); + if (t.n == 0 || t.z == NULL) { + *pDbName = NULL; + return false; + } + char *dotPos = strnchr(t.z, '.', t.n, true); + if (dotPos != NULL) { + int dbNameLen = dotPos - t.z; + *pDbName = taosMemoryMalloc(dbNameLen + 1); + if (*pDbName == NULL) { + return false; + } + strncpy(*pDbName, t.z, dbNameLen); + (*pDbName)[dbNameLen] = '\0'; + return true; + } + return false; +} + static int32_t analyseSemantic(SParseContext* pCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { int32_t code = authenticate(pCxt, pQuery, pMetaCache); diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index ade8c2d94a..2af9c1dadd 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -25,6 +25,8 @@ ** input grammar file: */ /************ Begin %include sections from the grammar ************************/ +#line 11 "sql.y" + #include #include #include @@ -40,6 +42,7 @@ #include "parAst.h" #define YYSTACKDEPTH 0 +#line 46 "sql.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ @@ -169,229 +172,229 @@ #define TK_NK_EQ 123 #define TK_USING 124 #define TK_TAGS 125 -#define TK_BOOL 126 -#define TK_TINYINT 127 -#define TK_SMALLINT 128 -#define TK_INT 129 -#define TK_INTEGER 130 -#define TK_BIGINT 131 -#define TK_FLOAT 132 -#define TK_DOUBLE 133 -#define TK_BINARY 134 -#define TK_NCHAR 135 -#define TK_UNSIGNED 136 -#define TK_JSON 137 -#define TK_VARCHAR 138 -#define TK_MEDIUMBLOB 139 -#define TK_BLOB 140 -#define TK_VARBINARY 141 -#define TK_GEOMETRY 142 -#define TK_DECIMAL 143 -#define TK_COMMENT 144 -#define TK_MAX_DELAY 145 -#define TK_WATERMARK 146 -#define TK_ROLLUP 147 -#define TK_TTL 148 -#define TK_SMA 149 -#define TK_DELETE_MARK 150 -#define TK_FIRST 151 -#define TK_LAST 152 -#define TK_SHOW 153 -#define TK_FULL 154 -#define TK_PRIVILEGES 155 -#define TK_DATABASES 156 -#define TK_TABLES 157 -#define TK_STABLES 158 -#define TK_MNODES 159 -#define TK_QNODES 160 -#define TK_ARBGROUPS 161 -#define TK_FUNCTIONS 162 -#define TK_INDEXES 163 -#define TK_ACCOUNTS 164 -#define TK_APPS 165 -#define TK_CONNECTIONS 166 -#define TK_LICENCES 167 -#define TK_GRANTS 168 -#define TK_LOGS 169 -#define TK_MACHINES 170 -#define TK_ENCRYPTIONS 171 -#define TK_QUERIES 172 -#define TK_SCORES 173 -#define TK_TOPICS 174 -#define TK_VARIABLES 175 -#define TK_BNODES 176 -#define TK_SNODES 177 -#define TK_TRANSACTIONS 178 -#define TK_DISTRIBUTED 179 -#define TK_CONSUMERS 180 -#define TK_SUBSCRIPTIONS 181 -#define TK_VNODES 182 -#define TK_ALIVE 183 -#define TK_VIEWS 184 -#define TK_VIEW 185 -#define TK_COMPACTS 186 -#define TK_NORMAL 187 -#define TK_CHILD 188 -#define TK_LIKE 189 -#define TK_TBNAME 190 -#define TK_QTAGS 191 -#define TK_AS 192 -#define TK_SYSTEM 193 -#define TK_TSMA 194 -#define TK_INTERVAL 195 -#define TK_RECURSIVE 196 -#define TK_TSMAS 197 -#define TK_FUNCTION 198 -#define TK_INDEX 199 -#define TK_COUNT 200 -#define TK_LAST_ROW 201 -#define TK_META 202 -#define TK_ONLY 203 -#define TK_TOPIC 204 -#define TK_CONSUMER 205 -#define TK_GROUP 206 -#define TK_DESC 207 -#define TK_DESCRIBE 208 -#define TK_RESET 209 -#define TK_QUERY 210 -#define TK_CACHE 211 -#define TK_EXPLAIN 212 -#define TK_ANALYZE 213 -#define TK_VERBOSE 214 -#define TK_NK_BOOL 215 -#define TK_RATIO 216 -#define TK_NK_FLOAT 217 -#define TK_OUTPUTTYPE 218 -#define TK_AGGREGATE 219 -#define TK_BUFSIZE 220 -#define TK_LANGUAGE 221 -#define TK_REPLACE 222 -#define TK_STREAM 223 -#define TK_INTO 224 -#define TK_PAUSE 225 -#define TK_RESUME 226 -#define TK_PRIMARY 227 -#define TK_KEY 228 -#define TK_TRIGGER 229 -#define TK_AT_ONCE 230 -#define TK_WINDOW_CLOSE 231 -#define TK_IGNORE 232 -#define TK_EXPIRED 233 -#define TK_FILL_HISTORY 234 -#define TK_UPDATE 235 -#define TK_SUBTABLE 236 -#define TK_UNTREATED 237 -#define TK_KILL 238 -#define TK_CONNECTION 239 -#define TK_TRANSACTION 240 -#define TK_BALANCE 241 -#define TK_VGROUP 242 -#define TK_LEADER 243 -#define TK_MERGE 244 -#define TK_REDISTRIBUTE 245 -#define TK_SPLIT 246 -#define TK_DELETE 247 -#define TK_INSERT 248 -#define TK_NK_BIN 249 -#define TK_NK_HEX 250 -#define TK_NULL 251 -#define TK_NK_QUESTION 252 -#define TK_NK_ALIAS 253 -#define TK_NK_ARROW 254 -#define TK_ROWTS 255 -#define TK_QSTART 256 -#define TK_QEND 257 -#define TK_QDURATION 258 -#define TK_WSTART 259 -#define TK_WEND 260 -#define TK_WDURATION 261 -#define TK_IROWTS 262 -#define TK_ISFILLED 263 -#define TK_CAST 264 -#define TK_NOW 265 -#define TK_TODAY 266 -#define TK_TIMEZONE 267 -#define TK_CLIENT_VERSION 268 -#define TK_SERVER_VERSION 269 -#define TK_SERVER_STATUS 270 -#define TK_CURRENT_USER 271 -#define TK_CASE 272 -#define TK_WHEN 273 -#define TK_THEN 274 -#define TK_ELSE 275 -#define TK_BETWEEN 276 -#define TK_IS 277 -#define TK_NK_LT 278 -#define TK_NK_GT 279 -#define TK_NK_LE 280 -#define TK_NK_GE 281 -#define TK_NK_NE 282 -#define TK_MATCH 283 -#define TK_NMATCH 284 -#define TK_CONTAINS 285 -#define TK_IN 286 -#define TK_JOIN 287 -#define TK_INNER 288 -#define TK_LEFT 289 -#define TK_RIGHT 290 -#define TK_OUTER 291 -#define TK_SEMI 292 -#define TK_ANTI 293 -#define TK_ASOF 294 -#define TK_WINDOW 295 -#define TK_WINDOW_OFFSET 296 -#define TK_JLIMIT 297 -#define TK_SELECT 298 -#define TK_NK_HINT 299 -#define TK_DISTINCT 300 -#define TK_WHERE 301 -#define TK_PARTITION 302 -#define TK_BY 303 -#define TK_SESSION 304 -#define TK_STATE_WINDOW 305 -#define TK_EVENT_WINDOW 306 -#define TK_COUNT_WINDOW 307 -#define TK_SLIDING 308 -#define TK_FILL 309 -#define TK_VALUE 310 -#define TK_VALUE_F 311 -#define TK_NONE 312 -#define TK_PREV 313 -#define TK_NULL_F 314 -#define TK_LINEAR 315 -#define TK_NEXT 316 -#define TK_HAVING 317 -#define TK_RANGE 318 -#define TK_EVERY 319 -#define TK_ORDER 320 -#define TK_SLIMIT 321 -#define TK_SOFFSET 322 -#define TK_LIMIT 323 -#define TK_OFFSET 324 -#define TK_ASC 325 -#define TK_NULLS 326 -#define TK_ABORT 327 -#define TK_AFTER 328 -#define TK_ATTACH 329 -#define TK_BEFORE 330 -#define TK_BEGIN 331 -#define TK_BITAND 332 -#define TK_BITNOT 333 -#define TK_BITOR 334 -#define TK_BLOCKS 335 -#define TK_CHANGE 336 -#define TK_COMMA 337 -#define TK_CONCAT 338 -#define TK_CONFLICT 339 -#define TK_COPY 340 -#define TK_DEFERRED 341 -#define TK_DELIMITERS 342 -#define TK_DETACH 343 -#define TK_DIVIDE 344 -#define TK_DOT 345 -#define TK_EACH 346 -#define TK_FAIL 347 -#define TK_FILE 348 +#define TK_FILE 126 +#define TK_BOOL 127 +#define TK_TINYINT 128 +#define TK_SMALLINT 129 +#define TK_INT 130 +#define TK_INTEGER 131 +#define TK_BIGINT 132 +#define TK_FLOAT 133 +#define TK_DOUBLE 134 +#define TK_BINARY 135 +#define TK_NCHAR 136 +#define TK_UNSIGNED 137 +#define TK_JSON 138 +#define TK_VARCHAR 139 +#define TK_MEDIUMBLOB 140 +#define TK_BLOB 141 +#define TK_VARBINARY 142 +#define TK_GEOMETRY 143 +#define TK_DECIMAL 144 +#define TK_COMMENT 145 +#define TK_MAX_DELAY 146 +#define TK_WATERMARK 147 +#define TK_ROLLUP 148 +#define TK_TTL 149 +#define TK_SMA 150 +#define TK_DELETE_MARK 151 +#define TK_FIRST 152 +#define TK_LAST 153 +#define TK_SHOW 154 +#define TK_FULL 155 +#define TK_PRIVILEGES 156 +#define TK_DATABASES 157 +#define TK_TABLES 158 +#define TK_STABLES 159 +#define TK_MNODES 160 +#define TK_QNODES 161 +#define TK_ARBGROUPS 162 +#define TK_FUNCTIONS 163 +#define TK_INDEXES 164 +#define TK_ACCOUNTS 165 +#define TK_APPS 166 +#define TK_CONNECTIONS 167 +#define TK_LICENCES 168 +#define TK_GRANTS 169 +#define TK_LOGS 170 +#define TK_MACHINES 171 +#define TK_ENCRYPTIONS 172 +#define TK_QUERIES 173 +#define TK_SCORES 174 +#define TK_TOPICS 175 +#define TK_VARIABLES 176 +#define TK_BNODES 177 +#define TK_SNODES 178 +#define TK_TRANSACTIONS 179 +#define TK_DISTRIBUTED 180 +#define TK_CONSUMERS 181 +#define TK_SUBSCRIPTIONS 182 +#define TK_VNODES 183 +#define TK_ALIVE 184 +#define TK_VIEWS 185 +#define TK_VIEW 186 +#define TK_COMPACTS 187 +#define TK_NORMAL 188 +#define TK_CHILD 189 +#define TK_LIKE 190 +#define TK_TBNAME 191 +#define TK_QTAGS 192 +#define TK_AS 193 +#define TK_SYSTEM 194 +#define TK_TSMA 195 +#define TK_INTERVAL 196 +#define TK_RECURSIVE 197 +#define TK_TSMAS 198 +#define TK_FUNCTION 199 +#define TK_INDEX 200 +#define TK_COUNT 201 +#define TK_LAST_ROW 202 +#define TK_META 203 +#define TK_ONLY 204 +#define TK_TOPIC 205 +#define TK_CONSUMER 206 +#define TK_GROUP 207 +#define TK_DESC 208 +#define TK_DESCRIBE 209 +#define TK_RESET 210 +#define TK_QUERY 211 +#define TK_CACHE 212 +#define TK_EXPLAIN 213 +#define TK_ANALYZE 214 +#define TK_VERBOSE 215 +#define TK_NK_BOOL 216 +#define TK_RATIO 217 +#define TK_NK_FLOAT 218 +#define TK_OUTPUTTYPE 219 +#define TK_AGGREGATE 220 +#define TK_BUFSIZE 221 +#define TK_LANGUAGE 222 +#define TK_REPLACE 223 +#define TK_STREAM 224 +#define TK_INTO 225 +#define TK_PAUSE 226 +#define TK_RESUME 227 +#define TK_PRIMARY 228 +#define TK_KEY 229 +#define TK_TRIGGER 230 +#define TK_AT_ONCE 231 +#define TK_WINDOW_CLOSE 232 +#define TK_IGNORE 233 +#define TK_EXPIRED 234 +#define TK_FILL_HISTORY 235 +#define TK_UPDATE 236 +#define TK_SUBTABLE 237 +#define TK_UNTREATED 238 +#define TK_KILL 239 +#define TK_CONNECTION 240 +#define TK_TRANSACTION 241 +#define TK_BALANCE 242 +#define TK_VGROUP 243 +#define TK_LEADER 244 +#define TK_MERGE 245 +#define TK_REDISTRIBUTE 246 +#define TK_SPLIT 247 +#define TK_DELETE 248 +#define TK_INSERT 249 +#define TK_NK_BIN 250 +#define TK_NK_HEX 251 +#define TK_NULL 252 +#define TK_NK_QUESTION 253 +#define TK_NK_ALIAS 254 +#define TK_NK_ARROW 255 +#define TK_ROWTS 256 +#define TK_QSTART 257 +#define TK_QEND 258 +#define TK_QDURATION 259 +#define TK_WSTART 260 +#define TK_WEND 261 +#define TK_WDURATION 262 +#define TK_IROWTS 263 +#define TK_ISFILLED 264 +#define TK_CAST 265 +#define TK_NOW 266 +#define TK_TODAY 267 +#define TK_TIMEZONE 268 +#define TK_CLIENT_VERSION 269 +#define TK_SERVER_VERSION 270 +#define TK_SERVER_STATUS 271 +#define TK_CURRENT_USER 272 +#define TK_CASE 273 +#define TK_WHEN 274 +#define TK_THEN 275 +#define TK_ELSE 276 +#define TK_BETWEEN 277 +#define TK_IS 278 +#define TK_NK_LT 279 +#define TK_NK_GT 280 +#define TK_NK_LE 281 +#define TK_NK_GE 282 +#define TK_NK_NE 283 +#define TK_MATCH 284 +#define TK_NMATCH 285 +#define TK_CONTAINS 286 +#define TK_IN 287 +#define TK_JOIN 288 +#define TK_INNER 289 +#define TK_LEFT 290 +#define TK_RIGHT 291 +#define TK_OUTER 292 +#define TK_SEMI 293 +#define TK_ANTI 294 +#define TK_ASOF 295 +#define TK_WINDOW 296 +#define TK_WINDOW_OFFSET 297 +#define TK_JLIMIT 298 +#define TK_SELECT 299 +#define TK_NK_HINT 300 +#define TK_DISTINCT 301 +#define TK_WHERE 302 +#define TK_PARTITION 303 +#define TK_BY 304 +#define TK_SESSION 305 +#define TK_STATE_WINDOW 306 +#define TK_EVENT_WINDOW 307 +#define TK_COUNT_WINDOW 308 +#define TK_SLIDING 309 +#define TK_FILL 310 +#define TK_VALUE 311 +#define TK_VALUE_F 312 +#define TK_NONE 313 +#define TK_PREV 314 +#define TK_NULL_F 315 +#define TK_LINEAR 316 +#define TK_NEXT 317 +#define TK_HAVING 318 +#define TK_RANGE 319 +#define TK_EVERY 320 +#define TK_ORDER 321 +#define TK_SLIMIT 322 +#define TK_SOFFSET 323 +#define TK_LIMIT 324 +#define TK_OFFSET 325 +#define TK_ASC 326 +#define TK_NULLS 327 +#define TK_ABORT 328 +#define TK_AFTER 329 +#define TK_ATTACH 330 +#define TK_BEFORE 331 +#define TK_BEGIN 332 +#define TK_BITAND 333 +#define TK_BITNOT 334 +#define TK_BITOR 335 +#define TK_BLOCKS 336 +#define TK_CHANGE 337 +#define TK_COMMA 338 +#define TK_CONCAT 339 +#define TK_CONFLICT 340 +#define TK_COPY 341 +#define TK_DEFERRED 342 +#define TK_DELIMITERS 343 +#define TK_DETACH 344 +#define TK_DIVIDE 345 +#define TK_DOT 346 +#define TK_EACH 347 +#define TK_FAIL 348 #define TK_FOR 349 #define TK_GLOB 350 #define TK_ID 351 @@ -480,30 +483,30 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 558 +#define YYNOCODE 559 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SAlterOption yy101; - bool yy209; - SNodeList* yy316; - SNode* yy416; - EOrder yy506; - EJoinSubType yy630; - EShowKind yy681; - int32_t yy820; - EOperatorType yy848; - STokenPair yy849; - EFillMode yy882; - SShowTablesOption yy925; - SDataType yy952; - EJoinType yy972; - int8_t yy1043; - ENullOrder yy1045; - int64_t yy1089; - SToken yy1109; + SNode* yy54; + SDataType yy84; + EJoinType yy230; + bool yy325; + int32_t yy332; + EFillMode yy478; + STokenPair yy495; + ENullOrder yy503; + int8_t yy535; + SShowTablesOption yy579; + SNodeList* yy652; + SAlterOption yy663; + EShowKind yy719; + EOrder yy760; + SToken yy837; + int64_t yy909; + EOperatorType yy922; + EJoinSubType yy948; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -519,18 +522,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 972 -#define YYNRULE 754 -#define YYNRULE_WITH_ACTION 754 +#define YYNSTATE 978 +#define YYNRULE 756 +#define YYNRULE_WITH_ACTION 756 #define YYNTOKEN 378 -#define YY_MAX_SHIFT 971 -#define YY_MIN_SHIFTREDUCE 1441 -#define YY_MAX_SHIFTREDUCE 2194 -#define YY_ERROR_ACTION 2195 -#define YY_ACCEPT_ACTION 2196 -#define YY_NO_ACTION 2197 -#define YY_MIN_REDUCE 2198 -#define YY_MAX_REDUCE 2951 +#define YY_MAX_SHIFT 977 +#define YY_MIN_SHIFTREDUCE 1449 +#define YY_MAX_SHIFTREDUCE 2204 +#define YY_ERROR_ACTION 2205 +#define YY_ACCEPT_ACTION 2206 +#define YY_NO_ACTION 2207 +#define YY_MIN_REDUCE 2208 +#define YY_MAX_REDUCE 2963 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -597,637 +600,643 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3045) +#define YY_ACTTAB_COUNT (3105) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 644, 2409, 652, 645, 2246, 645, 2246, 494, 37, 338, - /* 10 */ 2458, 2460, 47, 45, 2111, 2394, 2685, 862, 2405, 490, - /* 20 */ 474, 2199, 1932, 40, 39, 2645, 861, 46, 44, 43, - /* 30 */ 42, 41, 2632, 795, 862, 2405, 1930, 146, 2020, 2290, - /* 40 */ 1957, 2917, 136, 2727, 690, 135, 134, 133, 132, 131, - /* 50 */ 130, 129, 128, 127, 221, 807, 155, 9, 810, 794, - /* 60 */ 217, 807, 155, 741, 2918, 796, 40, 39, 2015, 2465, - /* 70 */ 46, 44, 43, 42, 41, 19, 2922, 439, 1961, 761, - /* 80 */ 479, 182, 1938, 111, 2917, 861, 2745, 2917, 2463, 2339, - /* 90 */ 136, 866, 2560, 135, 134, 133, 132, 131, 130, 129, - /* 100 */ 128, 127, 2692, 2921, 847, 2923, 217, 2918, 2920, 2398, - /* 110 */ 2918, 796, 968, 2558, 852, 15, 939, 938, 937, 936, - /* 120 */ 502, 50, 935, 934, 160, 929, 928, 927, 926, 925, - /* 130 */ 924, 923, 159, 917, 916, 915, 501, 500, 912, 911, - /* 140 */ 910, 196, 195, 909, 497, 908, 907, 906, 2389, 420, - /* 150 */ 2726, 2022, 2023, 2765, 661, 2485, 2136, 119, 2728, 851, - /* 160 */ 2730, 2731, 846, 190, 866, 315, 795, 2086, 197, 199, - /* 170 */ 2137, 2819, 98, 2396, 2917, 470, 2815, 192, 2827, 806, - /* 180 */ 50, 147, 805, 125, 2827, 2828, 210, 153, 2832, 2917, - /* 190 */ 1993, 2003, 794, 217, 441, 218, 2533, 2918, 796, 2401, - /* 200 */ 2021, 2024, 2452, 2866, 807, 155, 98, 794, 217, 66, - /* 210 */ 1778, 1779, 2918, 796, 2198, 1933, 2135, 1931, 662, 2553, - /* 220 */ 1957, 2834, 2186, 444, 40, 39, 556, 2529, 46, 44, - /* 230 */ 43, 42, 41, 2400, 2727, 861, 547, 479, 145, 144, - /* 240 */ 143, 142, 141, 140, 139, 138, 137, 2831, 866, 848, - /* 250 */ 213, 1936, 1937, 1990, 2086, 1992, 1995, 1996, 1997, 1998, - /* 260 */ 1999, 2000, 2001, 2002, 843, 864, 863, 2014, 2016, 2017, - /* 270 */ 2018, 2019, 2, 47, 45, 207, 649, 2745, 417, 232, - /* 280 */ 1955, 474, 646, 1932, 540, 609, 607, 591, 413, 539, - /* 290 */ 443, 433, 230, 2692, 1513, 847, 1512, 1930, 611, 2020, - /* 300 */ 2839, 2083, 2084, 2085, 2839, 2839, 2839, 2839, 2839, 586, - /* 310 */ 151, 1962, 2196, 1958, 570, 183, 613, 2210, 2144, 197, - /* 320 */ 62, 418, 572, 62, 585, 809, 185, 2827, 2828, 2015, - /* 330 */ 153, 2832, 1514, 550, 485, 1957, 19, 2465, 761, 2049, - /* 340 */ 2185, 2726, 117, 1938, 2765, 467, 2917, 2534, 119, 2728, - /* 350 */ 851, 2730, 2731, 846, 744, 866, 2463, 1958, 157, 158, - /* 360 */ 166, 2790, 2819, 322, 2923, 217, 470, 2815, 2397, 2918, - /* 370 */ 796, 289, 1960, 968, 442, 288, 15, 777, 776, 2142, - /* 380 */ 2143, 2145, 2146, 2147, 745, 558, 2380, 2839, 2083, 2084, - /* 390 */ 2085, 2839, 2839, 2839, 2839, 2839, 2088, 2089, 2090, 2091, - /* 400 */ 2092, 505, 660, 40, 39, 2050, 504, 46, 44, 43, - /* 410 */ 42, 41, 2022, 2023, 2502, 1932, 2540, 2519, 2086, 599, - /* 420 */ 598, 597, 596, 595, 590, 589, 588, 587, 425, 1930, - /* 430 */ 62, 577, 576, 575, 574, 573, 567, 566, 565, 663, - /* 440 */ 560, 559, 440, 785, 1704, 1705, 551, 1766, 1767, 101, - /* 450 */ 51, 1993, 2003, 1785, 428, 761, 760, 456, 33, 733, - /* 460 */ 905, 2021, 2024, 2917, 40, 39, 654, 2599, 46, 44, - /* 470 */ 43, 42, 41, 838, 667, 1938, 1933, 2922, 1931, 448, - /* 480 */ 447, 2923, 217, 780, 837, 2917, 2918, 796, 1805, 1806, - /* 490 */ 862, 2405, 36, 472, 2044, 2045, 2046, 2047, 2048, 2052, - /* 500 */ 2053, 2054, 2055, 322, 2921, 968, 322, 2921, 2918, 2919, - /* 510 */ 55, 2155, 1936, 1937, 1990, 1901, 1992, 1995, 1996, 1997, - /* 520 */ 1998, 1999, 2000, 2001, 2002, 843, 864, 863, 2014, 2016, - /* 530 */ 2017, 2018, 2019, 2, 12, 47, 45, 1804, 1807, 1604, - /* 540 */ 2727, 122, 2108, 474, 320, 1932, 180, 484, 483, 1665, - /* 550 */ 492, 2407, 2083, 2084, 2085, 810, 2408, 446, 445, 1930, - /* 560 */ 692, 2020, 2465, 1656, 895, 894, 893, 1660, 892, 1662, - /* 570 */ 1663, 891, 888, 2727, 1671, 885, 1673, 1674, 882, 879, - /* 580 */ 876, 814, 694, 2745, 584, 1606, 693, 488, 848, 583, - /* 590 */ 2256, 2015, 786, 781, 774, 770, 60, 582, 19, 2692, - /* 600 */ 2381, 847, 458, 2607, 12, 1938, 10, 758, 1933, 922, - /* 610 */ 1931, 2379, 2365, 322, 40, 39, 2745, 379, 46, 44, - /* 620 */ 43, 42, 41, 40, 39, 745, 2922, 46, 44, 43, - /* 630 */ 42, 41, 2692, 322, 847, 968, 62, 116, 15, 29, - /* 640 */ 2686, 1961, 1957, 1960, 1936, 1937, 113, 2726, 2560, 831, - /* 650 */ 2765, 2791, 718, 2702, 119, 2728, 851, 2730, 2731, 846, - /* 660 */ 603, 866, 2221, 469, 905, 2115, 199, 732, 2819, 2557, - /* 670 */ 852, 1957, 470, 2815, 2022, 2023, 1990, 731, 252, 2608, - /* 680 */ 2726, 2706, 647, 2765, 2254, 742, 287, 119, 2728, 851, - /* 690 */ 2730, 2731, 846, 725, 866, 729, 727, 286, 285, 2937, - /* 700 */ 2867, 2819, 721, 12, 479, 470, 2815, 747, 2599, 715, - /* 710 */ 713, 2727, 519, 1993, 2003, 866, 284, 524, 499, 498, - /* 720 */ 180, 2692, 2156, 2021, 2024, 2834, 848, 241, 2874, 492, - /* 730 */ 2407, 2127, 2708, 2710, 471, 538, 223, 537, 1933, 2179, - /* 740 */ 1931, 379, 1939, 866, 903, 172, 171, 900, 899, 898, - /* 750 */ 169, 2830, 602, 240, 2745, 903, 172, 171, 900, 899, - /* 760 */ 898, 169, 72, 2459, 2460, 71, 600, 254, 1900, 536, - /* 770 */ 2692, 647, 847, 2254, 1936, 1937, 1990, 2702, 1992, 1995, - /* 780 */ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 843, 864, 863, - /* 790 */ 2014, 2016, 2017, 2018, 2019, 2, 47, 45, 2025, 2727, - /* 800 */ 487, 486, 457, 2607, 474, 2706, 1932, 46, 44, 43, - /* 810 */ 42, 41, 1994, 208, 848, 320, 2887, 2646, 2726, 322, - /* 820 */ 1930, 2765, 2020, 784, 798, 119, 2728, 851, 2730, 2731, - /* 830 */ 846, 1961, 866, 2727, 664, 1516, 1517, 2937, 2107, 2819, - /* 840 */ 2560, 1994, 2745, 470, 2815, 862, 2405, 872, 848, 1938, - /* 850 */ 772, 2745, 2015, 2220, 528, 476, 2708, 2711, 2692, 236, - /* 860 */ 847, 2557, 852, 499, 498, 146, 1938, 866, 833, 641, - /* 870 */ 2791, 761, 695, 1946, 1962, 1991, 2745, 896, 639, 2917, - /* 880 */ 2219, 635, 631, 530, 526, 2392, 2051, 1939, 2465, 2020, - /* 890 */ 862, 2405, 2692, 2547, 847, 665, 968, 2923, 217, 48, - /* 900 */ 562, 2529, 2918, 796, 1991, 92, 2726, 822, 91, 2765, - /* 910 */ 544, 1486, 2692, 119, 2728, 851, 2730, 2731, 846, 2015, - /* 920 */ 866, 862, 2405, 1942, 783, 2937, 738, 2819, 593, 2529, - /* 930 */ 1493, 470, 2815, 1938, 156, 2022, 2023, 2790, 746, 2692, - /* 940 */ 2726, 545, 1493, 2765, 862, 2405, 2218, 119, 2728, 851, - /* 950 */ 2730, 2731, 846, 234, 866, 1488, 1491, 1492, 2217, 2937, - /* 960 */ 2834, 2819, 2216, 835, 564, 470, 2815, 1961, 1491, 1492, - /* 970 */ 862, 2405, 2727, 34, 1993, 2003, 90, 290, 862, 2405, - /* 980 */ 761, 239, 2277, 2056, 2021, 2024, 2829, 848, 2917, 2910, - /* 990 */ 578, 372, 761, 862, 2405, 871, 870, 869, 579, 1933, - /* 1000 */ 2917, 1931, 2030, 212, 712, 2692, 2923, 217, 1957, 862, - /* 1010 */ 2405, 2918, 796, 580, 1495, 2745, 919, 2692, 2923, 217, - /* 1020 */ 1956, 2692, 378, 2918, 796, 807, 155, 329, 330, 666, - /* 1030 */ 2613, 2692, 328, 847, 694, 1936, 1937, 1990, 693, 1992, - /* 1040 */ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 843, 864, - /* 1050 */ 863, 2014, 2016, 2017, 2018, 2019, 2, 47, 45, 686, - /* 1060 */ 685, 477, 1859, 1860, 1962, 474, 1947, 1932, 1942, 179, - /* 1070 */ 903, 172, 171, 900, 899, 898, 169, 862, 2405, 2726, - /* 1080 */ 2410, 1930, 2765, 2020, 2293, 921, 119, 2728, 851, 2730, - /* 1090 */ 2731, 846, 291, 866, 297, 2727, 2215, 2402, 2937, 385, - /* 1100 */ 2819, 3, 1950, 1952, 470, 2815, 862, 2405, 688, 687, - /* 1110 */ 848, 2409, 2851, 2015, 1665, 53, 864, 863, 2014, 2016, - /* 1120 */ 2017, 2018, 2019, 170, 2214, 102, 292, 1938, 1656, 895, - /* 1130 */ 894, 893, 1660, 892, 1662, 1663, 842, 841, 2745, 1671, - /* 1140 */ 840, 1673, 1674, 839, 879, 876, 789, 186, 2827, 2828, - /* 1150 */ 386, 153, 2832, 2442, 2692, 2692, 847, 968, 2727, 1833, - /* 1160 */ 48, 711, 710, 709, 862, 2405, 862, 2405, 701, 152, - /* 1170 */ 705, 707, 706, 848, 704, 862, 2405, 1957, 1994, 703, - /* 1180 */ 708, 451, 450, 2692, 300, 702, 813, 862, 2405, 449, - /* 1190 */ 698, 697, 696, 2226, 961, 333, 2022, 2023, 862, 2405, - /* 1200 */ 1962, 2745, 2726, 933, 931, 2765, 54, 827, 2213, 119, - /* 1210 */ 2728, 851, 2730, 2731, 846, 2097, 866, 2692, 340, 847, - /* 1220 */ 735, 2937, 734, 2819, 2212, 40, 39, 470, 2815, 46, - /* 1230 */ 44, 43, 42, 41, 2465, 1993, 2003, 862, 2405, 862, - /* 1240 */ 2405, 1991, 478, 862, 2405, 2021, 2024, 2465, 14, 13, - /* 1250 */ 495, 862, 2405, 2463, 1513, 493, 1512, 859, 179, 860, - /* 1260 */ 1933, 2209, 1931, 368, 2208, 2726, 2463, 2692, 2765, 2410, - /* 1270 */ 2636, 496, 119, 2728, 851, 2730, 2731, 846, 211, 866, - /* 1280 */ 1616, 1620, 2207, 2692, 2794, 148, 2819, 43, 42, 41, - /* 1290 */ 470, 2815, 1514, 78, 1615, 1619, 1936, 1937, 1990, 88, - /* 1300 */ 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 843, - /* 1310 */ 864, 863, 2014, 2016, 2017, 2018, 2019, 2, 47, 45, - /* 1320 */ 2692, 179, 2727, 2692, 512, 181, 474, 2206, 1932, 2465, - /* 1330 */ 392, 897, 2411, 2205, 2456, 2204, 2203, 848, 2340, 811, - /* 1340 */ 2202, 2692, 1930, 2201, 2020, 35, 2467, 89, 2464, 390, - /* 1350 */ 76, 40, 39, 75, 2727, 46, 44, 43, 42, 41, - /* 1360 */ 2512, 1599, 799, 2063, 419, 2745, 699, 802, 162, 848, - /* 1370 */ 614, 616, 901, 2382, 2015, 2456, 250, 626, 624, 621, - /* 1380 */ 619, 2692, 902, 847, 277, 2456, 2692, 275, 1938, 1597, - /* 1390 */ 423, 422, 2692, 761, 2692, 2692, 170, 2745, 162, 2692, - /* 1400 */ 480, 2917, 2692, 836, 554, 279, 161, 1600, 278, 123, - /* 1410 */ 1991, 700, 768, 2692, 489, 847, 2020, 2211, 968, 2923, - /* 1420 */ 217, 15, 62, 281, 2918, 796, 280, 283, 2258, 2726, - /* 1430 */ 282, 2275, 2765, 2880, 1595, 301, 119, 2728, 851, 2730, - /* 1440 */ 2731, 846, 49, 866, 2266, 2264, 2015, 49, 2792, 1941, - /* 1450 */ 2819, 1849, 200, 714, 470, 2815, 2713, 2022, 2023, 327, - /* 1460 */ 63, 2726, 2188, 2189, 2765, 913, 716, 719, 119, 2728, - /* 1470 */ 851, 2730, 2731, 846, 743, 866, 14, 13, 1940, 812, - /* 1480 */ 832, 1857, 2819, 957, 103, 1577, 470, 2815, 1569, 347, - /* 1490 */ 346, 190, 971, 349, 348, 2131, 1993, 2003, 77, 914, - /* 1500 */ 612, 64, 49, 49, 316, 77, 2021, 2024, 778, 167, - /* 1510 */ 1550, 376, 308, 808, 86, 85, 543, 150, 2746, 229, - /* 1520 */ 2715, 1933, 1567, 1931, 74, 2141, 959, 206, 2332, 170, - /* 1530 */ 2140, 1578, 535, 533, 2331, 306, 955, 951, 947, 943, - /* 1540 */ 874, 371, 331, 351, 350, 416, 353, 352, 522, 168, - /* 1550 */ 170, 518, 514, 510, 507, 536, 1551, 1936, 1937, 1990, - /* 1560 */ 2538, 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - /* 1570 */ 843, 864, 863, 2014, 2016, 2017, 2018, 2019, 2, 2041, - /* 1580 */ 149, 819, 355, 354, 2057, 2004, 1802, 118, 1792, 2247, - /* 1590 */ 344, 2727, 343, 1923, 2870, 1899, 40, 39, 357, 356, - /* 1600 */ 46, 44, 43, 42, 41, 322, 848, 384, 359, 358, - /* 1610 */ 361, 360, 1647, 363, 362, 365, 364, 367, 366, 775, - /* 1620 */ 167, 463, 823, 1678, 782, 459, 816, 482, 481, 1924, - /* 1630 */ 1944, 503, 1686, 1693, 2745, 521, 2539, 2253, 2453, 754, - /* 1640 */ 2871, 2881, 790, 864, 863, 2014, 2016, 2017, 2018, 2019, - /* 1650 */ 2692, 800, 847, 791, 318, 313, 2727, 321, 803, 1943, - /* 1660 */ 2366, 506, 5, 1691, 511, 437, 1955, 342, 1965, 829, - /* 1670 */ 532, 848, 325, 520, 224, 531, 225, 324, 227, 534, - /* 1680 */ 1826, 377, 1956, 548, 238, 2727, 555, 557, 561, 563, - /* 1690 */ 605, 568, 581, 594, 592, 2531, 294, 601, 2726, 2745, - /* 1700 */ 848, 2765, 604, 173, 617, 120, 2728, 851, 2730, 2731, - /* 1710 */ 846, 606, 866, 615, 244, 2692, 618, 847, 620, 2819, - /* 1720 */ 243, 622, 623, 2818, 2815, 247, 2727, 625, 2745, 1963, - /* 1730 */ 711, 710, 709, 627, 4, 642, 643, 701, 152, 705, - /* 1740 */ 650, 845, 651, 704, 2692, 255, 847, 653, 703, 708, - /* 1750 */ 451, 450, 94, 258, 702, 1958, 655, 1964, 449, 698, - /* 1760 */ 697, 696, 1966, 2726, 657, 2727, 2765, 656, 261, 2745, - /* 1770 */ 120, 2728, 851, 2730, 2731, 846, 263, 866, 659, 1967, - /* 1780 */ 848, 2554, 1968, 668, 2819, 2692, 95, 847, 834, 2815, - /* 1790 */ 2548, 96, 849, 97, 270, 2765, 2727, 124, 689, 120, - /* 1800 */ 2728, 851, 2730, 2731, 846, 722, 866, 691, 2745, 2395, - /* 1810 */ 274, 848, 411, 2819, 723, 2391, 276, 432, 2815, 175, - /* 1820 */ 121, 2393, 739, 2388, 2692, 176, 847, 177, 737, 100, - /* 1830 */ 1959, 293, 163, 2726, 2622, 380, 2765, 2600, 749, 2745, - /* 1840 */ 408, 2728, 851, 2730, 2731, 846, 844, 866, 830, 2784, - /* 1850 */ 750, 2619, 2618, 748, 756, 2692, 298, 847, 753, 779, - /* 1860 */ 765, 2886, 817, 2885, 788, 303, 8, 2858, 296, 305, - /* 1870 */ 307, 766, 2726, 309, 755, 2765, 764, 189, 2727, 184, - /* 1880 */ 2728, 851, 2730, 2731, 846, 763, 866, 793, 314, 310, - /* 1890 */ 312, 311, 464, 848, 804, 2838, 792, 801, 154, 2940, - /* 1900 */ 1960, 2835, 2105, 2726, 815, 317, 2765, 1, 2103, 2916, - /* 1910 */ 187, 2728, 851, 2730, 2731, 846, 203, 866, 2727, 381, - /* 1920 */ 323, 2745, 272, 164, 2568, 2567, 762, 2877, 2566, 468, - /* 1930 */ 219, 165, 382, 848, 820, 825, 821, 2692, 191, 847, - /* 1940 */ 336, 828, 61, 2727, 2800, 855, 853, 684, 680, 676, - /* 1950 */ 672, 2684, 271, 857, 858, 341, 383, 110, 848, 2406, - /* 1960 */ 2683, 2745, 2679, 2678, 2670, 2669, 2661, 2660, 2676, 797, - /* 1970 */ 2938, 112, 2675, 2667, 868, 2666, 387, 2692, 1465, 847, - /* 1980 */ 2655, 2654, 2673, 2672, 2664, 2726, 2745, 370, 2765, 963, - /* 1990 */ 964, 2663, 120, 2728, 851, 2730, 2731, 846, 99, 866, - /* 2000 */ 2652, 269, 2692, 965, 847, 2651, 2819, 2649, 2648, 2727, - /* 2010 */ 174, 2816, 2457, 373, 960, 421, 374, 967, 429, 52, - /* 2020 */ 424, 430, 399, 391, 848, 2726, 741, 461, 2765, 2644, - /* 2030 */ 410, 2727, 184, 2728, 851, 2730, 2731, 846, 400, 866, - /* 2040 */ 2643, 412, 389, 2642, 83, 2637, 848, 508, 509, 1883, - /* 2050 */ 2726, 2727, 2745, 2765, 1884, 222, 513, 409, 2728, 851, - /* 2060 */ 2730, 2731, 846, 2635, 866, 517, 848, 515, 2692, 257, - /* 2070 */ 847, 516, 1882, 2634, 2745, 438, 2631, 523, 268, 2633, - /* 2080 */ 2878, 2630, 259, 266, 525, 2629, 527, 2628, 264, 658, - /* 2090 */ 2692, 529, 847, 462, 2745, 1870, 2604, 226, 2603, 228, - /* 2100 */ 2581, 84, 1829, 1828, 2580, 2579, 541, 256, 542, 2578, - /* 2110 */ 2692, 2577, 847, 546, 2727, 2521, 2726, 1765, 2518, 2765, - /* 2120 */ 549, 2517, 2511, 409, 2728, 851, 2730, 2731, 846, 845, - /* 2130 */ 866, 552, 553, 2508, 231, 2507, 2727, 87, 2726, 2506, - /* 2140 */ 2505, 2765, 2510, 233, 2509, 402, 2728, 851, 2730, 2731, - /* 2150 */ 846, 848, 866, 2504, 2503, 2501, 2727, 2745, 2726, 2500, - /* 2160 */ 2499, 2765, 235, 569, 2498, 187, 2728, 851, 2730, 2731, - /* 2170 */ 846, 848, 866, 2692, 571, 847, 2496, 2495, 2494, 2745, - /* 2180 */ 237, 2478, 2477, 2727, 2493, 2492, 2516, 2491, 2490, 2489, - /* 2190 */ 2514, 2497, 2488, 2487, 2486, 2692, 787, 847, 848, 2745, - /* 2200 */ 2484, 2483, 2482, 2481, 2480, 2479, 2476, 2475, 93, 2474, - /* 2210 */ 2546, 2515, 2513, 2473, 2472, 2692, 2471, 847, 1771, 2470, - /* 2220 */ 473, 2726, 242, 608, 2765, 2939, 2745, 2469, 408, 2728, - /* 2230 */ 851, 2730, 2731, 846, 2468, 866, 2466, 2785, 2297, 1617, - /* 2240 */ 475, 610, 2692, 2726, 847, 1621, 2765, 426, 2296, 2295, - /* 2250 */ 409, 2728, 851, 2730, 2731, 846, 1613, 866, 2294, 2292, - /* 2260 */ 427, 2289, 628, 2726, 2727, 2288, 2765, 245, 632, 630, - /* 2270 */ 409, 2728, 851, 2730, 2731, 846, 629, 866, 2281, 848, - /* 2280 */ 636, 634, 633, 246, 637, 638, 248, 2268, 2727, 640, - /* 2290 */ 736, 80, 249, 2765, 2242, 198, 2712, 404, 2728, 851, - /* 2300 */ 2730, 2731, 846, 848, 866, 209, 1494, 2745, 648, 2727, - /* 2310 */ 251, 2241, 253, 81, 2602, 2598, 2588, 2576, 260, 262, - /* 2320 */ 2575, 265, 2552, 2692, 848, 847, 267, 2545, 2383, 2727, - /* 2330 */ 670, 2745, 1543, 2291, 2287, 669, 2285, 671, 673, 674, - /* 2340 */ 675, 2283, 677, 678, 848, 679, 2280, 2692, 681, 847, - /* 2350 */ 2263, 2727, 2745, 683, 682, 2261, 2262, 2260, 2238, 2385, - /* 2360 */ 1698, 273, 73, 2384, 1697, 1603, 848, 1602, 2692, 1585, - /* 2370 */ 847, 2726, 2745, 1601, 2765, 1598, 1596, 930, 394, 2728, - /* 2380 */ 851, 2730, 2731, 846, 1594, 866, 2278, 1593, 2692, 1592, - /* 2390 */ 847, 452, 2276, 2267, 2745, 2726, 1591, 1590, 2765, 932, - /* 2400 */ 1587, 1586, 393, 2728, 851, 2730, 2731, 846, 1584, 866, - /* 2410 */ 2692, 453, 847, 454, 2727, 2265, 2726, 455, 717, 2765, - /* 2420 */ 720, 2237, 2236, 395, 2728, 851, 2730, 2731, 846, 848, - /* 2430 */ 866, 2235, 2234, 724, 2727, 726, 2726, 2233, 728, 2765, - /* 2440 */ 2232, 730, 1864, 401, 2728, 851, 2730, 2731, 846, 848, - /* 2450 */ 866, 1868, 1866, 126, 1863, 2601, 2727, 2745, 2726, 1854, - /* 2460 */ 28, 2765, 740, 56, 67, 405, 2728, 851, 2730, 2731, - /* 2470 */ 846, 848, 866, 2692, 1839, 847, 295, 2745, 2597, 1835, - /* 2480 */ 57, 1837, 2587, 751, 178, 2574, 2573, 752, 299, 1814, - /* 2490 */ 2922, 20, 30, 2692, 2158, 847, 1813, 302, 767, 2745, - /* 2500 */ 757, 17, 460, 2132, 6, 759, 7, 21, 22, 769, - /* 2510 */ 202, 771, 773, 32, 214, 2692, 304, 847, 2713, 2139, - /* 2520 */ 188, 2726, 201, 31, 2765, 2126, 82, 2098, 396, 2728, - /* 2530 */ 851, 2730, 2731, 846, 215, 866, 23, 65, 216, 2727, - /* 2540 */ 2096, 2726, 2100, 2178, 2765, 2179, 24, 2173, 406, 2728, - /* 2550 */ 851, 2730, 2731, 846, 848, 866, 2172, 465, 18, 2177, - /* 2560 */ 2176, 2727, 466, 2726, 2080, 2079, 2765, 319, 58, 59, - /* 2570 */ 397, 2728, 851, 2730, 2731, 846, 848, 866, 2727, 193, - /* 2580 */ 2572, 2551, 2745, 104, 105, 326, 2134, 204, 332, 2550, - /* 2590 */ 106, 2544, 107, 848, 69, 25, 2032, 824, 2692, 818, - /* 2600 */ 847, 13, 2727, 335, 2745, 2031, 11, 826, 337, 334, - /* 2610 */ 1948, 2007, 2006, 881, 884, 887, 194, 848, 2042, 890, - /* 2620 */ 2692, 2745, 847, 38, 205, 2005, 1975, 16, 1983, 26, - /* 2630 */ 850, 2543, 27, 856, 70, 345, 108, 2692, 854, 847, - /* 2640 */ 339, 2194, 109, 2193, 2770, 2745, 2726, 2769, 865, 2765, - /* 2650 */ 2192, 873, 68, 407, 2728, 851, 2730, 2731, 846, 113, - /* 2660 */ 866, 2692, 2191, 847, 867, 2009, 1679, 875, 2726, 491, - /* 2670 */ 1676, 2765, 2727, 877, 878, 398, 2728, 851, 2730, 2731, - /* 2680 */ 846, 880, 866, 1675, 1672, 2726, 883, 848, 2765, 2727, - /* 2690 */ 1666, 886, 414, 2728, 851, 2730, 2731, 846, 1664, 866, - /* 2700 */ 889, 114, 1670, 369, 848, 1669, 1668, 1667, 115, 2726, - /* 2710 */ 1692, 2727, 2765, 79, 1688, 2745, 415, 2728, 851, 2730, - /* 2720 */ 2731, 846, 1541, 866, 904, 1581, 848, 1580, 220, 1579, - /* 2730 */ 1576, 2692, 2745, 847, 1573, 1572, 1571, 1570, 1568, 1611, - /* 2740 */ 1566, 1565, 1564, 918, 1610, 920, 1562, 1561, 2692, 1560, - /* 2750 */ 847, 1559, 2727, 1558, 2745, 1557, 1556, 1607, 1605, 1553, - /* 2760 */ 1552, 1549, 1548, 1547, 1546, 2286, 940, 848, 941, 2284, - /* 2770 */ 2692, 942, 847, 944, 2282, 945, 946, 2727, 948, 2726, - /* 2780 */ 950, 2279, 2765, 952, 954, 949, 2739, 2728, 851, 2730, - /* 2790 */ 2731, 846, 848, 866, 2727, 2745, 2726, 953, 2259, 2765, - /* 2800 */ 956, 2257, 958, 2738, 2728, 851, 2730, 2731, 846, 848, - /* 2810 */ 866, 2692, 1483, 847, 2231, 1466, 962, 375, 2726, 1934, - /* 2820 */ 2745, 2765, 1471, 1473, 966, 2737, 2728, 851, 2730, 2731, - /* 2830 */ 846, 388, 866, 969, 2197, 970, 2692, 2745, 847, 2197, - /* 2840 */ 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, - /* 2850 */ 2197, 2197, 2197, 2692, 2197, 847, 2197, 2727, 2197, 2726, - /* 2860 */ 2197, 2197, 2765, 2197, 2197, 2197, 434, 2728, 851, 2730, - /* 2870 */ 2731, 846, 848, 866, 2197, 2197, 2197, 2197, 2197, 2197, - /* 2880 */ 2197, 2197, 2197, 2197, 2726, 2197, 2197, 2765, 2197, 2197, - /* 2890 */ 2197, 435, 2728, 851, 2730, 2731, 846, 2197, 866, 2727, - /* 2900 */ 2745, 2726, 2197, 2197, 2765, 2197, 2197, 2197, 431, 2728, - /* 2910 */ 851, 2730, 2731, 846, 848, 866, 2692, 2197, 847, 2197, - /* 2920 */ 2197, 2197, 2197, 2727, 2197, 2197, 2197, 2197, 2197, 2197, - /* 2930 */ 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 848, 2197, - /* 2940 */ 2197, 2197, 2745, 2197, 2197, 2197, 2197, 2197, 2197, 2197, - /* 2950 */ 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2692, 2197, - /* 2960 */ 847, 2197, 2197, 2197, 2726, 2197, 2745, 2765, 2197, 2197, - /* 2970 */ 2197, 436, 2728, 851, 2730, 2731, 846, 2197, 866, 2197, - /* 2980 */ 2197, 2197, 2692, 2197, 847, 2197, 2197, 2197, 2197, 2197, - /* 2990 */ 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, - /* 3000 */ 2197, 2197, 2197, 2197, 2197, 2197, 849, 2197, 2197, 2765, - /* 3010 */ 2197, 2197, 2197, 404, 2728, 851, 2730, 2731, 846, 2197, - /* 3020 */ 866, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, 2197, - /* 3030 */ 2726, 2197, 2197, 2765, 2197, 2197, 2197, 403, 2728, 851, - /* 3040 */ 2730, 2731, 846, 2197, 866, + /* 0 */ 2404, 2697, 101, 2572, 2406, 493, 647, 2572, 798, 648, + /* 10 */ 2256, 2402, 47, 45, 2121, 2739, 2929, 471, 2934, 446, + /* 20 */ 476, 478, 1942, 2569, 855, 1967, 2929, 2569, 855, 2714, + /* 30 */ 813, 2412, 810, 157, 797, 218, 1940, 2714, 2030, 2930, + /* 40 */ 799, 502, 501, 2231, 787, 2933, 172, 40, 39, 2930, + /* 50 */ 2932, 46, 44, 43, 42, 41, 2934, 655, 2757, 2718, + /* 60 */ 648, 2256, 450, 449, 2739, 1949, 482, 2718, 2025, 482, + /* 70 */ 734, 1967, 2757, 1970, 2698, 19, 2704, 872, 850, 848, + /* 80 */ 872, 788, 1948, 66, 810, 157, 728, 33, 732, 730, + /* 90 */ 288, 287, 2477, 40, 39, 47, 45, 46, 44, 43, + /* 100 */ 42, 41, 469, 476, 2704, 1942, 606, 2757, 867, 2720, + /* 110 */ 2722, 473, 974, 2475, 435, 15, 207, 2720, 2723, 1940, + /* 120 */ 872, 2030, 867, 2738, 443, 2704, 2777, 850, 872, 54, + /* 130 */ 121, 2740, 854, 2742, 2743, 849, 867, 872, 2206, 482, + /* 140 */ 448, 447, 200, 695, 2831, 2545, 786, 2421, 472, 2827, + /* 150 */ 872, 2025, 2032, 2033, 812, 187, 2839, 2840, 19, 155, + /* 160 */ 2844, 911, 2059, 550, 841, 1948, 697, 254, 219, 2189, + /* 170 */ 696, 650, 2738, 2264, 243, 2777, 2878, 840, 2739, 410, + /* 180 */ 2740, 854, 2742, 2743, 849, 847, 872, 833, 2796, 559, + /* 190 */ 2541, 2003, 2013, 851, 62, 974, 1788, 1789, 15, 605, + /* 200 */ 242, 2031, 2034, 50, 810, 157, 867, 194, 2839, 809, + /* 210 */ 744, 149, 808, 603, 612, 610, 1943, 415, 1941, 2929, + /* 220 */ 232, 2757, 46, 44, 43, 42, 41, 211, 508, 2060, + /* 230 */ 2572, 50, 79, 507, 652, 2032, 2033, 797, 218, 2704, + /* 240 */ 649, 850, 2930, 799, 234, 2464, 322, 1952, 810, 157, + /* 250 */ 2570, 855, 1946, 1947, 2000, 62, 2002, 2005, 2006, 2007, + /* 260 */ 2008, 2009, 2010, 2011, 2012, 846, 870, 869, 2024, 2026, + /* 270 */ 2027, 2028, 2029, 2, 2003, 2013, 192, 256, 317, 644, + /* 280 */ 9, 650, 764, 2264, 2031, 2034, 2738, 92, 642, 2777, + /* 290 */ 2929, 638, 634, 121, 2740, 854, 2742, 2743, 849, 1943, + /* 300 */ 872, 1941, 2303, 159, 2497, 168, 2802, 2831, 2935, 218, + /* 310 */ 115, 472, 2827, 2930, 799, 2000, 36, 474, 2054, 2055, + /* 320 */ 2056, 2057, 2058, 2062, 2063, 2064, 2065, 127, 2839, 2840, + /* 330 */ 497, 155, 2844, 2470, 2472, 1946, 1947, 2000, 381, 2002, + /* 340 */ 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 846, 870, + /* 350 */ 869, 2024, 2026, 2027, 2028, 2029, 2, 12, 47, 45, + /* 360 */ 747, 1968, 2739, 1971, 667, 183, 476, 185, 1942, 2220, + /* 370 */ 394, 188, 2839, 2840, 2390, 155, 2844, 813, 324, 714, + /* 380 */ 713, 712, 1940, 124, 2030, 85, 704, 154, 708, 392, + /* 390 */ 77, 2096, 707, 76, 495, 2419, 2846, 706, 711, 453, + /* 400 */ 452, 2620, 160, 705, 421, 2757, 2209, 451, 701, 700, + /* 410 */ 699, 2407, 2409, 381, 2025, 324, 252, 629, 627, 624, + /* 420 */ 622, 19, 2843, 2704, 2559, 850, 668, 138, 1948, 748, + /* 430 */ 137, 136, 135, 134, 133, 132, 131, 130, 129, 324, + /* 440 */ 783, 47, 45, 2035, 2154, 460, 2619, 2477, 911, 476, + /* 450 */ 2477, 1942, 868, 2417, 292, 1968, 2934, 441, 974, 589, + /* 460 */ 481, 15, 62, 928, 2929, 1940, 2375, 2030, 2475, 663, + /* 470 */ 2738, 2475, 499, 2777, 588, 459, 2619, 121, 2740, 854, + /* 480 */ 2742, 2743, 849, 2933, 872, 1967, 802, 2930, 2931, 200, + /* 490 */ 2208, 2831, 2391, 1815, 1816, 472, 2827, 2025, 2032, 2033, + /* 500 */ 51, 63, 184, 780, 779, 2152, 2153, 2155, 2156, 2157, + /* 510 */ 2349, 1948, 657, 2611, 147, 146, 145, 144, 143, 142, + /* 520 */ 141, 140, 139, 2879, 2851, 2093, 2094, 2095, 2851, 2851, + /* 530 */ 2851, 2851, 2851, 1612, 868, 2417, 213, 2003, 2013, 1869, + /* 540 */ 1870, 974, 1814, 1817, 48, 798, 207, 2031, 2034, 789, + /* 550 */ 784, 777, 773, 2929, 148, 89, 88, 546, 868, 2417, + /* 560 */ 231, 693, 1943, 666, 1941, 2098, 2099, 2100, 2101, 2102, + /* 570 */ 670, 797, 218, 538, 536, 2546, 2930, 799, 148, 1614, + /* 580 */ 62, 2032, 2033, 2096, 664, 698, 418, 1714, 1715, 525, + /* 590 */ 527, 2514, 521, 517, 513, 510, 539, 1972, 1946, 1947, + /* 600 */ 2000, 2477, 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + /* 610 */ 2012, 846, 870, 869, 2024, 2026, 2027, 2028, 2029, 2, + /* 620 */ 2003, 2013, 817, 909, 174, 173, 906, 905, 904, 171, + /* 630 */ 2031, 2034, 1521, 1521, 1520, 1520, 1675, 909, 174, 173, + /* 640 */ 906, 905, 904, 171, 2118, 1943, 324, 1941, 153, 665, + /* 650 */ 2565, 1666, 901, 900, 899, 1670, 898, 1672, 1673, 897, + /* 660 */ 894, 238, 1681, 891, 1683, 1684, 888, 885, 882, 138, + /* 670 */ 1522, 1522, 137, 136, 135, 134, 133, 132, 131, 130, + /* 680 */ 129, 1946, 1947, 2000, 324, 2002, 2005, 2006, 2007, 2008, + /* 690 */ 2009, 2010, 2011, 2012, 846, 870, 869, 2024, 2026, 2027, + /* 700 */ 2028, 2029, 2, 47, 45, 2739, 1494, 95, 181, 1942, + /* 710 */ 94, 476, 697, 1942, 1970, 1675, 696, 2093, 2094, 2095, + /* 720 */ 851, 2423, 2266, 1940, 12, 1501, 10, 1940, 531, 2030, + /* 730 */ 1666, 901, 900, 899, 1670, 898, 1672, 1673, 845, 844, + /* 740 */ 721, 1681, 843, 1683, 1684, 842, 885, 882, 2757, 745, + /* 750 */ 1496, 1499, 1500, 37, 340, 735, 1624, 533, 529, 2025, + /* 760 */ 158, 2096, 587, 2802, 324, 2125, 2704, 586, 850, 1948, + /* 770 */ 1623, 1967, 207, 1948, 289, 585, 803, 40, 39, 93, + /* 780 */ 480, 46, 44, 43, 42, 41, 47, 45, 868, 2417, + /* 790 */ 724, 868, 2417, 1948, 476, 543, 1942, 718, 716, 974, + /* 800 */ 542, 2545, 2739, 974, 286, 2477, 48, 2846, 223, 12, + /* 810 */ 1940, 55, 2030, 2738, 2846, 496, 2777, 851, 902, 2886, + /* 820 */ 121, 2740, 854, 2742, 2743, 849, 2475, 872, 748, 565, + /* 830 */ 2541, 1607, 2949, 2842, 2831, 878, 596, 2541, 472, 2827, + /* 840 */ 2841, 2061, 2025, 2032, 2033, 2757, 617, 2230, 35, 764, + /* 850 */ 72, 2389, 1501, 71, 40, 39, 1948, 2929, 46, 44, + /* 860 */ 43, 42, 41, 2704, 114, 850, 40, 39, 868, 2417, + /* 870 */ 46, 44, 43, 42, 41, 2935, 218, 1608, 1499, 1500, + /* 880 */ 2930, 799, 2003, 2013, 236, 2165, 974, 322, 547, 15, + /* 890 */ 2408, 241, 2031, 2034, 2851, 2093, 2094, 2095, 2851, 2851, + /* 900 */ 2851, 2851, 2851, 1943, 2644, 1941, 2229, 1943, 2704, 1941, + /* 910 */ 2738, 750, 2611, 2777, 868, 2417, 925, 121, 2740, 854, + /* 920 */ 2742, 2743, 849, 3, 872, 479, 2032, 2033, 34, 2949, + /* 930 */ 834, 2831, 2803, 181, 548, 472, 2827, 53, 2066, 1946, + /* 940 */ 1947, 2117, 2004, 1946, 1947, 2000, 2422, 2002, 2005, 2006, + /* 950 */ 2007, 2008, 2009, 2010, 2011, 2012, 846, 870, 869, 2024, + /* 960 */ 2026, 2027, 2028, 2029, 2, 2003, 2013, 2704, 419, 1967, + /* 970 */ 1965, 522, 2040, 498, 2137, 2031, 2034, 594, 1967, 380, + /* 980 */ 445, 181, 877, 876, 875, 927, 331, 332, 614, 1971, + /* 990 */ 1943, 330, 1941, 2300, 2422, 225, 909, 174, 173, 906, + /* 1000 */ 905, 904, 171, 299, 573, 2001, 616, 2399, 422, 868, + /* 1010 */ 2417, 420, 575, 40, 39, 763, 374, 46, 44, 43, + /* 1020 */ 42, 41, 387, 553, 2471, 2472, 1946, 1947, 2000, 567, + /* 1030 */ 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 846, + /* 1040 */ 870, 869, 2024, 2026, 2027, 2028, 2029, 2, 40, 39, + /* 1050 */ 689, 688, 46, 44, 43, 42, 41, 836, 488, 2803, + /* 1060 */ 1971, 40, 39, 1585, 444, 46, 44, 43, 42, 41, + /* 1070 */ 945, 944, 943, 942, 505, 561, 941, 940, 162, 935, + /* 1080 */ 934, 933, 932, 931, 930, 929, 161, 923, 922, 921, + /* 1090 */ 504, 503, 918, 917, 916, 198, 197, 915, 500, 914, + /* 1100 */ 913, 912, 43, 42, 41, 2933, 2146, 2552, 2531, 1586, + /* 1110 */ 602, 601, 600, 599, 598, 593, 592, 591, 590, 427, + /* 1120 */ 2147, 2625, 580, 579, 578, 577, 576, 570, 569, 568, + /* 1130 */ 2739, 563, 562, 442, 2657, 868, 2417, 554, 1776, 1777, + /* 1140 */ 2004, 868, 2417, 2228, 1795, 851, 2725, 2899, 209, 2004, + /* 1150 */ 2421, 714, 713, 712, 491, 581, 60, 2227, 704, 154, + /* 1160 */ 708, 582, 221, 212, 707, 62, 2145, 761, 2739, 706, + /* 1170 */ 711, 453, 452, 2757, 2350, 705, 1628, 868, 2417, 451, + /* 1180 */ 701, 700, 699, 851, 293, 775, 868, 2417, 764, 182, + /* 1190 */ 1627, 2704, 2739, 850, 1524, 1525, 2929, 583, 502, 501, + /* 1200 */ 495, 2419, 792, 2001, 2704, 101, 669, 851, 1956, 2922, + /* 1210 */ 2727, 2757, 2001, 2196, 2935, 218, 868, 2417, 2704, 2930, + /* 1220 */ 799, 2477, 1949, 1972, 2030, 691, 690, 710, 709, 2704, + /* 1230 */ 2221, 850, 1971, 214, 2413, 2757, 2414, 2477, 2738, 182, + /* 1240 */ 1911, 2777, 825, 2226, 2225, 121, 2740, 854, 2742, 2743, + /* 1250 */ 849, 2420, 872, 2704, 2025, 850, 291, 2949, 2476, 2831, + /* 1260 */ 290, 868, 2417, 472, 2827, 541, 619, 540, 1948, 14, + /* 1270 */ 13, 2107, 487, 486, 2739, 903, 2738, 2224, 2468, 2777, + /* 1280 */ 1967, 294, 2223, 121, 2740, 854, 2742, 2743, 849, 851, + /* 1290 */ 872, 2863, 2222, 2219, 1972, 2949, 805, 2831, 838, 539, + /* 1300 */ 2738, 472, 2827, 2777, 2704, 2704, 2892, 121, 2740, 854, + /* 1310 */ 2742, 2743, 849, 2739, 872, 907, 2218, 2757, 2468, 2949, + /* 1320 */ 2217, 2831, 425, 424, 303, 472, 2827, 2216, 851, 939, + /* 1330 */ 937, 2195, 483, 150, 104, 2704, 1910, 850, 2704, 430, + /* 1340 */ 868, 2417, 458, 2704, 736, 2479, 492, 91, 2030, 324, + /* 1350 */ 868, 2417, 2739, 2704, 2704, 2215, 2757, 40, 39, 2214, + /* 1360 */ 302, 46, 44, 43, 42, 41, 2213, 851, 490, 489, + /* 1370 */ 816, 2236, 967, 106, 2704, 2212, 850, 2704, 2025, 868, + /* 1380 */ 2417, 2704, 2738, 2648, 2073, 2777, 868, 2417, 2704, 121, + /* 1390 */ 2740, 854, 2742, 2743, 849, 2757, 872, 868, 2417, 335, + /* 1400 */ 2211, 2949, 1957, 2831, 1952, 192, 830, 472, 2827, 908, + /* 1410 */ 105, 279, 2468, 2704, 277, 850, 2704, 342, 1951, 2739, + /* 1420 */ 2704, 2738, 318, 801, 2777, 868, 2417, 2704, 121, 2740, + /* 1430 */ 854, 2742, 2743, 849, 851, 872, 2704, 515, 1960, 1962, + /* 1440 */ 2806, 746, 2831, 1503, 1843, 862, 472, 2827, 388, 1966, + /* 1450 */ 2392, 2454, 870, 869, 2024, 2026, 2027, 2028, 2029, 977, + /* 1460 */ 2738, 2704, 2757, 2777, 868, 2417, 1972, 121, 2740, 854, + /* 1470 */ 2742, 2743, 849, 2524, 872, 738, 164, 737, 378, 2804, + /* 1480 */ 2704, 2831, 850, 163, 863, 472, 2827, 868, 2417, 2658, + /* 1490 */ 164, 40, 39, 965, 208, 46, 44, 43, 42, 41, + /* 1500 */ 615, 702, 703, 961, 957, 953, 949, 866, 373, 771, + /* 1510 */ 281, 868, 2417, 280, 2001, 283, 29, 557, 282, 285, + /* 1520 */ 49, 839, 284, 2287, 1605, 1603, 1933, 2738, 1909, 741, + /* 1530 */ 2777, 370, 781, 49, 121, 2740, 854, 2742, 2743, 849, + /* 1540 */ 749, 872, 125, 764, 2285, 715, 835, 1950, 2831, 2276, + /* 1550 */ 2739, 2929, 472, 2827, 73, 2198, 2199, 346, 201, 1859, + /* 1560 */ 485, 484, 1934, 2274, 310, 851, 717, 811, 814, 2935, + /* 1570 */ 218, 719, 172, 1867, 2930, 799, 870, 869, 2024, 2026, + /* 1580 */ 2027, 2028, 2029, 764, 152, 722, 2758, 120, 806, 2739, + /* 1590 */ 826, 2929, 2141, 2757, 764, 329, 117, 78, 2257, 2166, + /* 1600 */ 1954, 2882, 2929, 2151, 851, 14, 13, 64, 2342, 2935, + /* 1610 */ 218, 2704, 49, 850, 2930, 799, 2150, 349, 348, 49, + /* 1620 */ 2935, 218, 764, 351, 350, 2930, 799, 2341, 2739, 78, + /* 1630 */ 2929, 169, 2757, 150, 778, 344, 172, 832, 353, 352, + /* 1640 */ 327, 308, 1558, 851, 465, 326, 355, 354, 2935, 218, + /* 1650 */ 2704, 75, 850, 2930, 799, 815, 357, 356, 2738, 359, + /* 1660 */ 358, 2777, 361, 360, 296, 122, 2740, 854, 2742, 2743, + /* 1670 */ 849, 2757, 872, 363, 362, 365, 364, 2739, 333, 2831, + /* 1680 */ 822, 367, 366, 2830, 2827, 369, 368, 880, 1559, 2704, + /* 1690 */ 2067, 850, 851, 170, 919, 2014, 2268, 2738, 2051, 172, + /* 1700 */ 2777, 151, 1812, 169, 122, 2740, 854, 2742, 2743, 849, + /* 1710 */ 2739, 872, 1802, 785, 345, 461, 865, 1577, 2831, 1657, + /* 1720 */ 2757, 819, 837, 2827, 2550, 851, 920, 506, 524, 1953, + /* 1730 */ 2263, 2465, 757, 2883, 386, 2893, 852, 320, 2704, 2777, + /* 1740 */ 850, 315, 793, 122, 2740, 854, 2742, 2743, 849, 1575, + /* 1750 */ 872, 963, 794, 2757, 323, 2551, 2376, 2831, 5, 514, + /* 1760 */ 509, 434, 2827, 439, 1965, 523, 1975, 535, 534, 226, + /* 1770 */ 1688, 2704, 2739, 850, 537, 274, 1696, 227, 229, 1836, + /* 1780 */ 379, 551, 1703, 1966, 1701, 2738, 175, 851, 2777, 558, + /* 1790 */ 240, 193, 186, 2740, 854, 2742, 2743, 849, 560, 872, + /* 1800 */ 687, 683, 679, 675, 564, 273, 566, 608, 571, 584, + /* 1810 */ 597, 595, 2543, 604, 607, 2757, 609, 620, 2738, 621, + /* 1820 */ 618, 2777, 246, 245, 625, 189, 2740, 854, 2742, 2743, + /* 1830 */ 849, 623, 872, 2704, 626, 850, 249, 628, 1973, 765, + /* 1840 */ 2889, 645, 630, 4, 646, 1968, 653, 654, 257, 656, + /* 1850 */ 658, 102, 2739, 97, 271, 260, 1974, 659, 1976, 660, + /* 1860 */ 662, 1977, 1978, 263, 2560, 265, 2566, 851, 98, 99, + /* 1870 */ 100, 272, 671, 692, 725, 726, 2634, 126, 694, 2631, + /* 1880 */ 2738, 413, 740, 2777, 800, 2950, 2405, 122, 2740, 854, + /* 1890 */ 2742, 2743, 849, 276, 872, 2757, 742, 103, 2401, 278, + /* 1900 */ 165, 2831, 177, 123, 2403, 2398, 2828, 295, 178, 1969, + /* 1910 */ 179, 382, 2739, 2704, 2612, 850, 752, 300, 751, 759, + /* 1920 */ 782, 820, 753, 259, 298, 2898, 2897, 851, 791, 769, + /* 1930 */ 305, 8, 270, 191, 2630, 2870, 261, 268, 756, 2739, + /* 1940 */ 768, 767, 266, 661, 309, 766, 796, 311, 2850, 312, + /* 1950 */ 795, 316, 466, 804, 851, 2757, 313, 2952, 307, 807, + /* 1960 */ 2738, 258, 156, 2777, 758, 1970, 314, 186, 2740, 854, + /* 1970 */ 2742, 2743, 849, 2704, 872, 850, 2115, 2928, 2113, 204, + /* 1980 */ 325, 319, 2757, 166, 383, 818, 823, 2580, 2579, 2578, + /* 1990 */ 384, 824, 470, 167, 2847, 828, 831, 463, 61, 338, + /* 2000 */ 2704, 858, 850, 1, 856, 385, 116, 860, 1473, 861, + /* 2010 */ 2739, 2696, 2418, 2695, 2812, 2890, 343, 113, 2691, 2690, + /* 2020 */ 2738, 372, 2682, 2777, 464, 851, 2681, 411, 2740, 854, + /* 2030 */ 2742, 2743, 849, 220, 872, 2673, 2672, 2688, 874, 969, + /* 2040 */ 970, 2687, 375, 2679, 2678, 176, 389, 2738, 2739, 2667, + /* 2050 */ 2777, 971, 966, 2757, 411, 2740, 854, 2742, 2743, 849, + /* 2060 */ 376, 872, 2666, 851, 973, 2685, 2684, 423, 414, 2676, + /* 2070 */ 2675, 2704, 2664, 850, 2739, 2663, 744, 391, 2661, 2660, + /* 2080 */ 2469, 393, 401, 412, 426, 2656, 2655, 2654, 86, 848, + /* 2090 */ 402, 2757, 2649, 52, 511, 431, 512, 1893, 1894, 224, + /* 2100 */ 516, 2647, 432, 518, 519, 520, 1892, 2646, 2645, 2704, + /* 2110 */ 440, 850, 2643, 526, 2642, 528, 2641, 2757, 2738, 530, + /* 2120 */ 2640, 2777, 1880, 2616, 532, 404, 2740, 854, 2742, 2743, + /* 2130 */ 849, 228, 872, 2615, 230, 2704, 87, 850, 1839, 1838, + /* 2140 */ 2593, 2592, 2591, 2739, 544, 545, 2590, 2589, 2533, 549, + /* 2150 */ 1775, 2530, 2529, 552, 2523, 555, 2738, 556, 851, 2777, + /* 2160 */ 2520, 233, 2519, 189, 2740, 854, 2742, 2743, 849, 90, + /* 2170 */ 872, 2518, 2517, 2522, 2521, 235, 790, 2516, 2515, 2513, + /* 2180 */ 2512, 2511, 2738, 237, 2739, 2777, 2757, 239, 2490, 410, + /* 2190 */ 2740, 854, 2742, 2743, 849, 572, 872, 2510, 2797, 851, + /* 2200 */ 574, 2508, 2507, 2739, 2704, 2506, 850, 2505, 2504, 2528, + /* 2210 */ 2503, 2502, 2501, 2526, 2509, 2500, 2499, 2498, 851, 428, + /* 2220 */ 1781, 2483, 96, 2951, 2496, 2495, 2494, 2757, 475, 2493, + /* 2230 */ 2492, 2491, 2489, 2739, 2488, 2487, 2486, 2558, 2527, 2525, + /* 2240 */ 2485, 2484, 244, 2482, 2481, 2704, 2757, 850, 851, 2480, + /* 2250 */ 611, 2738, 613, 2478, 2777, 1625, 429, 2307, 411, 2740, + /* 2260 */ 854, 2742, 2743, 849, 2704, 872, 850, 2739, 1629, 477, + /* 2270 */ 253, 247, 2306, 2305, 248, 2304, 2757, 2302, 1621, 2299, + /* 2280 */ 2298, 631, 851, 2291, 635, 2278, 250, 2252, 251, 199, + /* 2290 */ 2251, 633, 2738, 2614, 2704, 2777, 850, 2739, 639, 411, + /* 2300 */ 2740, 854, 2742, 2743, 849, 632, 872, 637, 636, 640, + /* 2310 */ 2757, 739, 851, 641, 2777, 82, 2724, 643, 406, 2740, + /* 2320 */ 854, 2742, 2743, 849, 1502, 872, 83, 210, 2704, 651, + /* 2330 */ 850, 255, 2610, 2600, 2588, 262, 264, 2587, 2564, 267, + /* 2340 */ 2757, 2738, 2557, 269, 2777, 2393, 2301, 2297, 396, 2740, + /* 2350 */ 854, 2742, 2743, 849, 672, 872, 673, 2739, 2704, 674, + /* 2360 */ 850, 2295, 676, 677, 678, 1551, 2293, 680, 681, 682, + /* 2370 */ 2290, 684, 851, 685, 686, 2738, 2273, 2271, 2777, 2739, + /* 2380 */ 275, 74, 395, 2740, 854, 2742, 2743, 849, 2272, 872, + /* 2390 */ 2270, 2248, 2739, 2395, 851, 1707, 1708, 2394, 1610, 1609, + /* 2400 */ 2757, 1611, 936, 1606, 1604, 2738, 1593, 851, 2777, 2288, + /* 2410 */ 1602, 1601, 397, 2740, 854, 2742, 2743, 849, 2704, 872, + /* 2420 */ 850, 1600, 2757, 1599, 454, 1598, 2286, 938, 1595, 455, + /* 2430 */ 2277, 1594, 1592, 456, 720, 2757, 2275, 457, 2247, 723, + /* 2440 */ 2704, 2739, 850, 2246, 2245, 2244, 727, 2243, 729, 731, + /* 2450 */ 2242, 733, 128, 2704, 1874, 850, 851, 1878, 1876, 1873, + /* 2460 */ 2613, 56, 2609, 28, 67, 2738, 2599, 297, 2777, 1845, + /* 2470 */ 1847, 754, 403, 2740, 854, 2742, 2743, 849, 743, 872, + /* 2480 */ 180, 1864, 2586, 1849, 2757, 2585, 2934, 2738, 57, 755, + /* 2490 */ 2777, 1824, 1823, 301, 407, 2740, 854, 2742, 2743, 849, + /* 2500 */ 2738, 872, 2704, 2777, 850, 20, 760, 398, 2740, 854, + /* 2510 */ 2742, 2743, 849, 30, 872, 762, 2168, 2142, 215, 2739, + /* 2520 */ 304, 772, 770, 462, 306, 6, 17, 774, 7, 21, + /* 2530 */ 776, 22, 203, 2149, 851, 190, 32, 2108, 2739, 202, + /* 2540 */ 31, 2725, 216, 2136, 2106, 65, 84, 2110, 24, 2738, + /* 2550 */ 217, 321, 2777, 851, 2183, 2188, 408, 2740, 854, 2742, + /* 2560 */ 2743, 849, 2757, 872, 2182, 467, 2187, 2189, 2739, 2186, + /* 2570 */ 23, 18, 468, 2090, 2089, 195, 59, 2584, 2563, 107, + /* 2580 */ 2704, 2757, 850, 851, 108, 328, 2144, 2562, 58, 205, + /* 2590 */ 334, 109, 69, 2556, 827, 821, 337, 110, 25, 2704, + /* 2600 */ 2739, 850, 2042, 11, 336, 2041, 13, 1958, 2052, 2017, + /* 2610 */ 2016, 2757, 887, 196, 206, 851, 890, 893, 1993, 853, + /* 2620 */ 896, 38, 2555, 2015, 1985, 16, 347, 2738, 26, 2704, + /* 2630 */ 2777, 850, 27, 829, 399, 2740, 854, 2742, 2743, 849, + /* 2640 */ 70, 872, 857, 2757, 111, 117, 2738, 339, 1652, 2777, + /* 2650 */ 341, 2739, 859, 409, 2740, 854, 2742, 2743, 849, 112, + /* 2660 */ 872, 2704, 2019, 850, 864, 80, 851, 2782, 2204, 2781, + /* 2670 */ 871, 68, 2203, 873, 2202, 2201, 2738, 1689, 2739, 2777, + /* 2680 */ 879, 494, 881, 400, 2740, 854, 2742, 2743, 849, 1686, + /* 2690 */ 872, 883, 1685, 851, 2757, 884, 886, 1682, 889, 1676, + /* 2700 */ 892, 895, 1674, 1680, 118, 1679, 1678, 1677, 2738, 371, + /* 2710 */ 119, 2777, 2704, 1702, 850, 416, 2740, 854, 2742, 2743, + /* 2720 */ 849, 2757, 872, 81, 1698, 1549, 910, 1589, 1588, 1587, + /* 2730 */ 1584, 1581, 1580, 1579, 1578, 1576, 1574, 1573, 1619, 2704, + /* 2740 */ 2739, 850, 1572, 924, 926, 1618, 222, 1570, 1569, 1567, + /* 2750 */ 1568, 1566, 1565, 1564, 1615, 851, 1613, 1561, 1560, 2738, + /* 2760 */ 1557, 2739, 2777, 1555, 1556, 1554, 417, 2740, 854, 2742, + /* 2770 */ 2743, 849, 2296, 872, 946, 948, 851, 947, 2294, 950, + /* 2780 */ 951, 952, 2292, 2757, 954, 2289, 2738, 955, 956, 2777, + /* 2790 */ 958, 960, 2269, 2751, 2740, 854, 2742, 2743, 849, 959, + /* 2800 */ 872, 2704, 2739, 850, 2757, 962, 2267, 1491, 964, 2241, + /* 2810 */ 1474, 1479, 968, 1481, 976, 377, 972, 851, 1944, 390, + /* 2820 */ 975, 2207, 2704, 2739, 850, 2207, 2207, 2207, 2207, 2207, + /* 2830 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 851, 2207, + /* 2840 */ 2207, 2207, 2207, 2207, 2207, 2757, 2207, 2207, 2738, 2207, + /* 2850 */ 2207, 2777, 2207, 2207, 2207, 2750, 2740, 854, 2742, 2743, + /* 2860 */ 849, 2207, 872, 2704, 2207, 850, 2757, 2207, 2207, 2738, + /* 2870 */ 2207, 2207, 2777, 2207, 2207, 2207, 2749, 2740, 854, 2742, + /* 2880 */ 2743, 849, 2207, 872, 2704, 2739, 850, 2207, 2207, 2207, + /* 2890 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2900 */ 851, 2739, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2910 */ 2738, 2207, 2207, 2777, 2207, 2207, 851, 436, 2740, 854, + /* 2920 */ 2742, 2743, 849, 2207, 872, 2207, 2207, 2207, 2757, 2207, + /* 2930 */ 2207, 2738, 2207, 2207, 2777, 2207, 2207, 2207, 437, 2740, + /* 2940 */ 854, 2742, 2743, 849, 2757, 872, 2704, 2207, 850, 2207, + /* 2950 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2960 */ 2207, 2207, 2704, 2739, 850, 2207, 2207, 2207, 2207, 2207, + /* 2970 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 851, 2207, + /* 2980 */ 2207, 2207, 2739, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2990 */ 2207, 2207, 2207, 2738, 2207, 2207, 2777, 851, 2207, 2207, + /* 3000 */ 433, 2740, 854, 2742, 2743, 849, 2757, 872, 2207, 2738, + /* 3010 */ 2207, 2207, 2777, 2207, 2207, 2207, 438, 2740, 854, 2742, + /* 3020 */ 2743, 849, 2207, 872, 2704, 2757, 850, 2207, 2207, 2207, + /* 3030 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3040 */ 2207, 2207, 2207, 2704, 2207, 850, 2207, 2207, 2207, 2207, + /* 3050 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3060 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3070 */ 2207, 852, 2207, 2207, 2777, 2207, 2207, 2207, 406, 2740, + /* 3080 */ 854, 2742, 2743, 849, 2207, 872, 2207, 2207, 2207, 2207, + /* 3090 */ 2738, 2207, 2207, 2777, 2207, 2207, 2207, 405, 2740, 854, + /* 3100 */ 2742, 2743, 849, 2207, 872, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 390, 425, 390, 393, 394, 393, 394, 438, 510, 511, - /* 10 */ 441, 442, 12, 13, 14, 425, 427, 395, 396, 430, - /* 20 */ 20, 0, 22, 8, 9, 467, 20, 12, 13, 14, - /* 30 */ 15, 16, 0, 521, 395, 396, 36, 415, 38, 0, - /* 40 */ 20, 529, 21, 381, 422, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 415, 395, 396, 44, 396, 547, - /* 60 */ 548, 395, 396, 487, 552, 553, 8, 9, 68, 424, - /* 70 */ 12, 13, 14, 15, 16, 75, 521, 432, 20, 521, - /* 80 */ 491, 405, 82, 402, 529, 20, 424, 529, 443, 413, - /* 90 */ 21, 502, 442, 24, 25, 26, 27, 28, 29, 30, - /* 100 */ 31, 32, 440, 548, 442, 547, 548, 552, 553, 428, - /* 110 */ 552, 553, 112, 463, 464, 115, 77, 78, 79, 80, - /* 120 */ 81, 115, 83, 84, 85, 86, 87, 88, 89, 90, - /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 425, 426, - /* 150 */ 488, 151, 152, 491, 395, 0, 22, 495, 496, 497, - /* 160 */ 498, 499, 500, 523, 502, 525, 521, 154, 424, 507, - /* 170 */ 36, 509, 404, 427, 529, 513, 514, 517, 518, 519, - /* 180 */ 115, 521, 522, 517, 518, 519, 423, 521, 522, 529, - /* 190 */ 190, 191, 547, 548, 450, 533, 452, 552, 553, 431, - /* 200 */ 200, 201, 439, 541, 395, 396, 404, 547, 548, 4, - /* 210 */ 190, 191, 552, 553, 0, 215, 82, 217, 459, 460, - /* 220 */ 20, 494, 207, 421, 8, 9, 395, 396, 12, 13, - /* 230 */ 14, 15, 16, 431, 381, 20, 395, 491, 24, 25, - /* 240 */ 26, 27, 28, 29, 30, 31, 32, 520, 502, 396, - /* 250 */ 192, 251, 252, 253, 154, 255, 256, 257, 258, 259, + /* 0 */ 425, 427, 404, 444, 427, 431, 390, 444, 522, 393, + /* 10 */ 394, 425, 12, 13, 14, 381, 530, 458, 522, 421, + /* 20 */ 20, 458, 22, 464, 465, 20, 530, 464, 465, 412, + /* 30 */ 396, 433, 395, 396, 548, 549, 36, 412, 38, 553, + /* 40 */ 554, 12, 13, 381, 396, 549, 33, 8, 9, 553, + /* 50 */ 554, 12, 13, 14, 15, 16, 3, 390, 424, 442, + /* 60 */ 393, 394, 41, 42, 381, 36, 492, 442, 68, 492, + /* 70 */ 21, 20, 424, 20, 427, 75, 442, 503, 444, 396, + /* 80 */ 503, 20, 82, 4, 395, 396, 37, 2, 39, 40, + /* 90 */ 41, 42, 424, 8, 9, 12, 13, 12, 13, 14, + /* 100 */ 15, 16, 434, 20, 442, 22, 91, 424, 20, 492, + /* 110 */ 493, 494, 112, 445, 75, 115, 424, 492, 493, 36, + /* 120 */ 503, 38, 20, 489, 432, 442, 492, 444, 503, 116, + /* 130 */ 496, 497, 498, 499, 500, 501, 20, 503, 378, 492, + /* 140 */ 119, 120, 508, 122, 510, 453, 498, 425, 514, 515, + /* 150 */ 503, 68, 152, 153, 517, 518, 519, 520, 75, 522, + /* 160 */ 523, 74, 123, 395, 425, 82, 145, 391, 534, 116, + /* 170 */ 149, 395, 489, 397, 159, 492, 542, 438, 381, 496, + /* 180 */ 497, 498, 499, 500, 501, 502, 503, 504, 505, 395, + /* 190 */ 396, 191, 192, 396, 115, 112, 191, 192, 115, 184, + /* 200 */ 185, 201, 202, 115, 395, 396, 20, 518, 519, 520, + /* 210 */ 488, 522, 523, 198, 446, 447, 216, 449, 218, 530, + /* 220 */ 452, 424, 12, 13, 14, 15, 16, 423, 468, 190, + /* 230 */ 444, 115, 125, 473, 14, 152, 153, 548, 549, 442, + /* 240 */ 20, 444, 553, 554, 450, 441, 193, 218, 395, 396, + /* 250 */ 464, 465, 252, 253, 254, 115, 256, 257, 258, 259, /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 270 */ 270, 271, 272, 12, 13, 243, 14, 424, 18, 448, - /* 280 */ 20, 20, 20, 22, 467, 444, 445, 27, 447, 472, - /* 290 */ 30, 75, 451, 440, 20, 442, 22, 36, 38, 38, - /* 300 */ 287, 288, 289, 290, 291, 292, 293, 294, 295, 154, - /* 310 */ 36, 253, 378, 20, 54, 380, 56, 382, 251, 424, - /* 320 */ 115, 61, 62, 115, 169, 516, 517, 518, 519, 68, - /* 330 */ 521, 522, 58, 73, 36, 20, 75, 424, 521, 123, - /* 340 */ 325, 488, 402, 82, 491, 432, 529, 452, 495, 496, - /* 350 */ 497, 498, 499, 500, 20, 502, 443, 20, 505, 419, - /* 360 */ 507, 508, 509, 298, 547, 548, 513, 514, 428, 552, - /* 370 */ 553, 146, 20, 112, 114, 150, 115, 310, 311, 312, - /* 380 */ 313, 314, 315, 316, 395, 125, 0, 287, 288, 289, - /* 390 */ 290, 291, 292, 293, 294, 295, 291, 292, 293, 294, - /* 400 */ 295, 467, 20, 8, 9, 189, 472, 12, 13, 14, - /* 410 */ 15, 16, 151, 152, 0, 22, 156, 157, 154, 159, - /* 420 */ 160, 161, 162, 163, 164, 165, 166, 167, 168, 36, - /* 430 */ 115, 171, 172, 173, 174, 175, 176, 177, 178, 20, - /* 440 */ 180, 181, 182, 20, 151, 152, 186, 187, 188, 224, - /* 450 */ 115, 190, 191, 193, 229, 521, 52, 232, 2, 234, - /* 460 */ 74, 200, 201, 529, 8, 9, 477, 478, 12, 13, - /* 470 */ 14, 15, 16, 425, 74, 82, 215, 521, 217, 41, - /* 480 */ 42, 547, 548, 195, 436, 529, 552, 553, 151, 152, - /* 490 */ 395, 396, 276, 277, 278, 279, 280, 281, 282, 283, - /* 500 */ 284, 285, 286, 298, 548, 112, 298, 3, 552, 553, - /* 510 */ 415, 116, 251, 252, 253, 217, 255, 256, 257, 258, - /* 520 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - /* 530 */ 269, 270, 271, 272, 273, 12, 13, 200, 201, 36, - /* 540 */ 381, 424, 4, 20, 192, 22, 424, 249, 250, 112, - /* 550 */ 433, 434, 288, 289, 290, 396, 434, 119, 120, 36, - /* 560 */ 122, 38, 424, 126, 127, 128, 129, 130, 131, 132, - /* 570 */ 133, 134, 135, 381, 137, 138, 139, 140, 141, 142, - /* 580 */ 143, 443, 144, 424, 170, 82, 148, 36, 396, 175, - /* 590 */ 398, 68, 304, 305, 306, 307, 192, 183, 75, 440, - /* 600 */ 0, 442, 485, 486, 273, 82, 275, 203, 215, 411, - /* 610 */ 217, 0, 414, 298, 8, 9, 424, 424, 12, 13, - /* 620 */ 14, 15, 16, 8, 9, 395, 3, 12, 13, 14, - /* 630 */ 15, 16, 440, 298, 442, 112, 115, 115, 115, 33, - /* 640 */ 427, 20, 20, 20, 251, 252, 124, 488, 442, 506, - /* 650 */ 491, 508, 4, 412, 495, 496, 497, 498, 499, 500, - /* 660 */ 91, 502, 381, 457, 74, 14, 507, 19, 509, 463, - /* 670 */ 464, 20, 513, 514, 151, 152, 253, 21, 391, 486, - /* 680 */ 488, 440, 395, 491, 397, 125, 38, 495, 496, 497, - /* 690 */ 498, 499, 500, 37, 502, 39, 40, 41, 42, 507, - /* 700 */ 541, 509, 54, 273, 491, 513, 514, 477, 478, 61, - /* 710 */ 62, 381, 44, 190, 191, 502, 68, 73, 12, 13, - /* 720 */ 424, 440, 116, 200, 201, 494, 396, 158, 398, 433, - /* 730 */ 434, 116, 491, 492, 493, 214, 68, 216, 215, 116, - /* 740 */ 217, 424, 36, 502, 144, 145, 146, 147, 148, 149, - /* 750 */ 150, 520, 183, 184, 424, 144, 145, 146, 147, 148, - /* 760 */ 149, 150, 114, 441, 442, 117, 197, 391, 217, 248, - /* 770 */ 440, 395, 442, 397, 251, 252, 253, 412, 255, 256, - /* 780 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 790 */ 267, 268, 269, 270, 271, 272, 12, 13, 14, 381, - /* 800 */ 249, 250, 485, 486, 20, 440, 22, 12, 13, 14, - /* 810 */ 15, 16, 190, 192, 396, 192, 398, 467, 488, 298, - /* 820 */ 36, 491, 38, 396, 320, 495, 496, 497, 498, 499, - /* 830 */ 500, 20, 502, 381, 395, 59, 60, 507, 300, 509, - /* 840 */ 442, 190, 424, 513, 514, 395, 396, 227, 396, 82, - /* 850 */ 398, 424, 68, 381, 210, 457, 491, 492, 440, 68, - /* 860 */ 442, 463, 464, 12, 13, 415, 82, 502, 506, 54, - /* 870 */ 508, 521, 422, 22, 253, 253, 424, 125, 63, 529, - /* 880 */ 381, 66, 67, 239, 240, 425, 189, 36, 424, 38, - /* 890 */ 395, 396, 440, 454, 442, 456, 112, 547, 548, 115, - /* 900 */ 395, 396, 552, 553, 253, 114, 488, 443, 117, 491, - /* 910 */ 415, 4, 440, 495, 496, 497, 498, 499, 500, 68, - /* 920 */ 502, 395, 396, 217, 497, 507, 467, 509, 395, 396, - /* 930 */ 23, 513, 514, 82, 505, 151, 152, 508, 467, 440, - /* 940 */ 488, 415, 23, 491, 395, 396, 381, 495, 496, 497, - /* 950 */ 498, 499, 500, 448, 502, 48, 49, 50, 381, 507, - /* 960 */ 494, 509, 381, 112, 415, 513, 514, 20, 49, 50, - /* 970 */ 395, 396, 381, 276, 190, 191, 185, 145, 395, 396, - /* 980 */ 521, 448, 0, 286, 200, 201, 520, 396, 529, 398, - /* 990 */ 415, 34, 521, 395, 396, 375, 376, 377, 415, 215, - /* 1000 */ 529, 217, 14, 192, 22, 440, 547, 548, 20, 395, - /* 1010 */ 396, 552, 553, 415, 14, 424, 13, 440, 547, 548, - /* 1020 */ 20, 440, 425, 552, 553, 395, 396, 145, 146, 415, - /* 1030 */ 420, 440, 150, 442, 144, 251, 252, 253, 148, 255, - /* 1040 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 1050 */ 266, 267, 268, 269, 270, 271, 272, 12, 13, 400, - /* 1060 */ 401, 416, 230, 231, 253, 20, 215, 22, 217, 424, - /* 1070 */ 144, 145, 146, 147, 148, 149, 150, 395, 396, 488, - /* 1080 */ 435, 36, 491, 38, 0, 82, 495, 496, 497, 498, - /* 1090 */ 499, 500, 482, 502, 425, 381, 381, 415, 507, 425, - /* 1100 */ 509, 33, 251, 252, 513, 514, 395, 396, 400, 401, - /* 1110 */ 396, 425, 398, 68, 112, 47, 265, 266, 267, 268, - /* 1120 */ 269, 270, 271, 33, 381, 185, 415, 82, 126, 127, - /* 1130 */ 128, 129, 130, 131, 132, 133, 134, 135, 424, 137, - /* 1140 */ 138, 139, 140, 141, 142, 143, 13, 517, 518, 519, - /* 1150 */ 417, 521, 522, 420, 440, 440, 442, 112, 381, 219, - /* 1160 */ 115, 77, 78, 79, 395, 396, 395, 396, 84, 85, - /* 1170 */ 86, 409, 410, 396, 90, 395, 396, 20, 190, 95, - /* 1180 */ 96, 97, 98, 440, 415, 101, 415, 395, 396, 105, - /* 1190 */ 106, 107, 108, 384, 385, 415, 151, 152, 395, 396, - /* 1200 */ 253, 424, 488, 409, 410, 491, 116, 415, 381, 495, - /* 1210 */ 496, 497, 498, 499, 500, 82, 502, 440, 415, 442, - /* 1220 */ 233, 507, 235, 509, 381, 8, 9, 513, 514, 12, - /* 1230 */ 13, 14, 15, 16, 424, 190, 191, 395, 396, 395, - /* 1240 */ 396, 253, 432, 395, 396, 200, 201, 424, 1, 2, - /* 1250 */ 416, 395, 396, 443, 20, 432, 22, 415, 424, 415, - /* 1260 */ 215, 381, 217, 415, 381, 488, 443, 440, 491, 435, - /* 1270 */ 0, 415, 495, 496, 497, 498, 499, 500, 473, 502, - /* 1280 */ 22, 22, 381, 440, 507, 33, 509, 14, 15, 16, - /* 1290 */ 513, 514, 58, 125, 36, 36, 251, 252, 253, 47, - /* 1300 */ 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - /* 1310 */ 265, 266, 267, 268, 269, 270, 271, 272, 12, 13, - /* 1320 */ 440, 424, 381, 440, 54, 18, 20, 381, 22, 424, - /* 1330 */ 23, 437, 435, 381, 440, 381, 381, 396, 413, 467, - /* 1340 */ 381, 440, 36, 381, 38, 2, 0, 179, 443, 42, - /* 1350 */ 43, 8, 9, 46, 381, 12, 13, 14, 15, 16, - /* 1360 */ 0, 36, 33, 116, 57, 424, 13, 33, 33, 396, - /* 1370 */ 112, 112, 437, 0, 68, 440, 69, 70, 71, 72, - /* 1380 */ 73, 440, 437, 442, 118, 440, 440, 121, 82, 36, - /* 1390 */ 12, 13, 440, 521, 440, 440, 33, 424, 33, 440, - /* 1400 */ 22, 529, 440, 75, 44, 118, 33, 82, 121, 192, - /* 1410 */ 253, 13, 33, 440, 36, 442, 38, 382, 112, 547, - /* 1420 */ 548, 115, 115, 118, 552, 553, 121, 118, 0, 488, - /* 1430 */ 121, 0, 491, 453, 36, 68, 495, 496, 497, 498, - /* 1440 */ 499, 500, 33, 502, 0, 0, 68, 33, 507, 36, - /* 1450 */ 509, 116, 33, 22, 513, 514, 51, 151, 152, 33, - /* 1460 */ 153, 488, 151, 152, 491, 13, 22, 22, 495, 496, - /* 1470 */ 497, 498, 499, 500, 1, 502, 1, 2, 36, 116, - /* 1480 */ 507, 116, 509, 55, 117, 36, 513, 514, 36, 12, - /* 1490 */ 13, 523, 19, 12, 13, 116, 190, 191, 33, 13, - /* 1500 */ 154, 33, 33, 33, 556, 33, 200, 201, 545, 33, - /* 1510 */ 36, 38, 538, 524, 207, 208, 209, 399, 424, 212, - /* 1520 */ 115, 215, 36, 217, 33, 116, 53, 54, 412, 33, - /* 1530 */ 116, 82, 225, 226, 412, 116, 63, 64, 65, 66, - /* 1540 */ 33, 68, 116, 12, 13, 238, 12, 13, 241, 33, - /* 1550 */ 33, 244, 245, 246, 247, 248, 82, 251, 252, 253, - /* 1560 */ 453, 255, 256, 257, 258, 259, 260, 261, 262, 263, - /* 1570 */ 264, 265, 266, 267, 268, 269, 270, 271, 272, 251, - /* 1580 */ 33, 116, 12, 13, 116, 116, 116, 114, 116, 394, - /* 1590 */ 117, 381, 116, 215, 453, 217, 8, 9, 12, 13, - /* 1600 */ 12, 13, 14, 15, 16, 298, 396, 116, 12, 13, - /* 1610 */ 12, 13, 116, 12, 13, 12, 13, 12, 13, 544, - /* 1620 */ 33, 544, 149, 116, 544, 466, 544, 249, 250, 251, - /* 1630 */ 217, 399, 116, 116, 424, 489, 453, 396, 439, 474, - /* 1640 */ 453, 453, 528, 265, 266, 267, 268, 269, 270, 271, - /* 1650 */ 440, 322, 442, 528, 549, 515, 381, 531, 324, 217, - /* 1660 */ 414, 468, 301, 116, 54, 490, 20, 194, 20, 196, - /* 1670 */ 479, 396, 199, 395, 484, 232, 404, 204, 404, 479, - /* 1680 */ 213, 470, 20, 395, 47, 381, 396, 449, 396, 449, - /* 1690 */ 189, 446, 395, 449, 396, 395, 223, 446, 488, 424, - /* 1700 */ 396, 491, 446, 116, 113, 495, 496, 497, 498, 499, - /* 1710 */ 500, 446, 502, 111, 395, 440, 408, 442, 395, 509, - /* 1720 */ 407, 110, 406, 513, 514, 395, 381, 395, 424, 20, - /* 1730 */ 77, 78, 79, 395, 52, 388, 392, 84, 85, 86, - /* 1740 */ 388, 396, 392, 90, 440, 404, 442, 479, 95, 96, - /* 1750 */ 97, 98, 404, 404, 101, 20, 442, 20, 105, 106, - /* 1760 */ 107, 108, 20, 488, 469, 381, 491, 397, 404, 424, - /* 1770 */ 495, 496, 497, 498, 499, 500, 404, 502, 397, 20, - /* 1780 */ 396, 460, 20, 395, 509, 440, 404, 442, 513, 514, - /* 1790 */ 454, 404, 488, 404, 404, 491, 381, 395, 388, 495, - /* 1800 */ 496, 497, 498, 499, 500, 384, 502, 424, 424, 424, - /* 1810 */ 424, 396, 388, 509, 384, 424, 424, 513, 514, 424, - /* 1820 */ 424, 424, 483, 424, 440, 424, 442, 424, 236, 115, - /* 1830 */ 20, 402, 481, 488, 440, 479, 491, 478, 221, 424, - /* 1840 */ 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - /* 1850 */ 476, 440, 440, 220, 395, 440, 402, 442, 442, 309, - /* 1860 */ 440, 537, 308, 537, 206, 461, 317, 540, 475, 461, - /* 1870 */ 539, 319, 488, 536, 468, 491, 318, 537, 381, 495, - /* 1880 */ 496, 497, 498, 499, 500, 302, 502, 297, 526, 535, - /* 1890 */ 468, 534, 326, 396, 323, 527, 296, 321, 396, 557, - /* 1900 */ 20, 494, 125, 488, 440, 550, 491, 532, 299, 551, - /* 1910 */ 495, 496, 497, 498, 499, 500, 397, 502, 381, 461, - /* 1920 */ 402, 424, 38, 402, 440, 440, 542, 543, 440, 440, - /* 1930 */ 530, 402, 461, 396, 198, 440, 458, 440, 54, 442, - /* 1940 */ 402, 454, 115, 381, 512, 440, 198, 63, 64, 65, - /* 1950 */ 66, 440, 68, 455, 454, 402, 420, 402, 396, 396, - /* 1960 */ 440, 424, 440, 440, 440, 440, 440, 440, 440, 554, - /* 1970 */ 555, 115, 440, 440, 429, 440, 395, 440, 22, 442, - /* 1980 */ 440, 440, 440, 440, 440, 488, 424, 402, 491, 383, - /* 1990 */ 35, 440, 495, 496, 497, 498, 499, 500, 114, 502, - /* 2000 */ 440, 117, 440, 37, 442, 440, 509, 440, 440, 381, - /* 2010 */ 386, 514, 440, 387, 40, 426, 389, 388, 462, 471, - /* 2020 */ 426, 462, 418, 379, 396, 488, 487, 465, 491, 0, - /* 2030 */ 418, 381, 495, 496, 497, 498, 499, 500, 418, 502, - /* 2040 */ 0, 480, 403, 0, 47, 0, 396, 36, 242, 36, - /* 2050 */ 488, 381, 424, 491, 36, 36, 242, 495, 496, 497, - /* 2060 */ 498, 499, 500, 0, 502, 242, 396, 36, 440, 185, - /* 2070 */ 442, 36, 36, 0, 424, 242, 0, 36, 194, 0, - /* 2080 */ 543, 0, 198, 199, 36, 0, 22, 0, 204, 205, - /* 2090 */ 440, 36, 442, 465, 424, 237, 0, 223, 0, 223, - /* 2100 */ 0, 224, 217, 215, 0, 0, 211, 223, 210, 0, - /* 2110 */ 440, 0, 442, 51, 381, 157, 488, 51, 0, 491, - /* 2120 */ 36, 0, 0, 495, 496, 497, 498, 499, 500, 396, - /* 2130 */ 502, 36, 54, 0, 51, 0, 381, 47, 488, 0, - /* 2140 */ 0, 491, 0, 51, 0, 495, 496, 497, 498, 499, - /* 2150 */ 500, 396, 502, 0, 0, 0, 381, 424, 488, 0, - /* 2160 */ 0, 491, 175, 36, 0, 495, 496, 497, 498, 499, - /* 2170 */ 500, 396, 502, 440, 175, 442, 0, 0, 0, 424, - /* 2180 */ 51, 0, 0, 381, 0, 0, 0, 0, 0, 0, - /* 2190 */ 0, 0, 0, 0, 0, 440, 546, 442, 396, 424, - /* 2200 */ 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, - /* 2210 */ 0, 0, 0, 0, 0, 440, 0, 442, 22, 0, - /* 2220 */ 465, 488, 157, 156, 491, 555, 424, 0, 495, 496, - /* 2230 */ 497, 498, 499, 500, 0, 502, 0, 504, 0, 22, - /* 2240 */ 465, 155, 440, 488, 442, 22, 491, 52, 0, 0, - /* 2250 */ 495, 496, 497, 498, 499, 500, 36, 502, 0, 0, - /* 2260 */ 52, 0, 36, 488, 381, 0, 491, 68, 36, 44, - /* 2270 */ 495, 496, 497, 498, 499, 500, 54, 502, 0, 396, - /* 2280 */ 36, 44, 54, 68, 54, 44, 68, 0, 381, 36, - /* 2290 */ 488, 44, 68, 491, 0, 33, 51, 495, 496, 497, - /* 2300 */ 498, 499, 500, 396, 502, 51, 14, 424, 51, 381, - /* 2310 */ 47, 0, 45, 44, 0, 0, 0, 0, 44, 206, - /* 2320 */ 0, 51, 0, 440, 396, 442, 51, 0, 0, 381, - /* 2330 */ 54, 424, 76, 0, 0, 36, 0, 44, 36, 54, - /* 2340 */ 44, 0, 36, 54, 396, 44, 0, 440, 36, 442, - /* 2350 */ 0, 381, 424, 44, 54, 0, 0, 0, 0, 0, - /* 2360 */ 36, 121, 123, 0, 22, 22, 396, 36, 440, 22, - /* 2370 */ 442, 488, 424, 36, 491, 36, 36, 33, 495, 496, - /* 2380 */ 497, 498, 499, 500, 36, 502, 0, 36, 440, 36, - /* 2390 */ 442, 22, 0, 0, 424, 488, 36, 36, 491, 33, - /* 2400 */ 36, 36, 495, 496, 497, 498, 499, 500, 36, 502, - /* 2410 */ 440, 22, 442, 22, 381, 0, 488, 22, 56, 491, - /* 2420 */ 36, 0, 0, 495, 496, 497, 498, 499, 500, 396, - /* 2430 */ 502, 0, 0, 36, 381, 36, 488, 0, 36, 491, - /* 2440 */ 0, 22, 36, 495, 496, 497, 498, 499, 500, 396, - /* 2450 */ 502, 116, 36, 20, 36, 0, 381, 424, 488, 228, - /* 2460 */ 115, 491, 227, 192, 115, 495, 496, 497, 498, 499, - /* 2470 */ 500, 396, 502, 440, 222, 442, 51, 424, 0, 36, - /* 2480 */ 192, 22, 0, 22, 218, 0, 0, 192, 198, 192, - /* 2490 */ 3, 33, 115, 440, 116, 442, 192, 115, 36, 424, - /* 2500 */ 202, 303, 36, 116, 52, 202, 52, 33, 33, 115, - /* 2510 */ 33, 113, 111, 33, 51, 440, 116, 442, 51, 116, - /* 2520 */ 115, 488, 115, 115, 491, 116, 115, 82, 495, 496, - /* 2530 */ 497, 498, 499, 500, 33, 502, 303, 3, 115, 381, - /* 2540 */ 116, 488, 36, 116, 491, 116, 33, 36, 495, 496, - /* 2550 */ 497, 498, 499, 500, 396, 502, 36, 36, 303, 36, - /* 2560 */ 36, 381, 36, 488, 116, 116, 491, 51, 287, 33, - /* 2570 */ 495, 496, 497, 498, 499, 500, 396, 502, 381, 51, - /* 2580 */ 0, 0, 424, 115, 44, 116, 116, 115, 115, 0, - /* 2590 */ 44, 0, 44, 396, 115, 33, 113, 116, 440, 195, - /* 2600 */ 442, 2, 381, 115, 424, 113, 274, 195, 194, 199, - /* 2610 */ 22, 116, 116, 115, 115, 115, 51, 396, 251, 115, - /* 2620 */ 440, 424, 442, 115, 51, 116, 116, 115, 22, 115, - /* 2630 */ 254, 0, 115, 195, 115, 51, 44, 440, 116, 442, - /* 2640 */ 115, 22, 115, 22, 115, 424, 488, 115, 115, 491, - /* 2650 */ 22, 36, 115, 495, 496, 497, 498, 499, 500, 124, - /* 2660 */ 502, 440, 228, 442, 125, 116, 116, 115, 488, 36, - /* 2670 */ 116, 491, 381, 36, 115, 495, 496, 497, 498, 499, - /* 2680 */ 500, 36, 502, 116, 116, 488, 36, 396, 491, 381, - /* 2690 */ 116, 36, 495, 496, 497, 498, 499, 500, 116, 502, - /* 2700 */ 36, 115, 136, 33, 396, 136, 136, 136, 115, 488, - /* 2710 */ 36, 381, 491, 115, 22, 424, 495, 496, 497, 498, - /* 2720 */ 499, 500, 76, 502, 75, 22, 396, 36, 33, 36, - /* 2730 */ 36, 440, 424, 442, 36, 36, 36, 36, 36, 82, - /* 2740 */ 36, 36, 36, 109, 82, 109, 36, 36, 440, 36, - /* 2750 */ 442, 22, 381, 36, 424, 36, 36, 82, 36, 36, - /* 2760 */ 36, 36, 36, 22, 36, 0, 36, 396, 54, 0, - /* 2770 */ 440, 44, 442, 36, 0, 54, 44, 381, 36, 488, - /* 2780 */ 44, 0, 491, 36, 44, 54, 495, 496, 497, 498, - /* 2790 */ 499, 500, 396, 502, 381, 424, 488, 54, 0, 491, - /* 2800 */ 36, 0, 22, 495, 496, 497, 498, 499, 500, 396, - /* 2810 */ 502, 440, 36, 442, 0, 22, 33, 22, 488, 22, - /* 2820 */ 424, 491, 36, 36, 21, 495, 496, 497, 498, 499, - /* 2830 */ 500, 22, 502, 21, 558, 20, 440, 424, 442, 558, - /* 2840 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 2850 */ 558, 558, 558, 440, 558, 442, 558, 381, 558, 488, - /* 2860 */ 558, 558, 491, 558, 558, 558, 495, 496, 497, 498, - /* 2870 */ 499, 500, 396, 502, 558, 558, 558, 558, 558, 558, - /* 2880 */ 558, 558, 558, 558, 488, 558, 558, 491, 558, 558, - /* 2890 */ 558, 495, 496, 497, 498, 499, 500, 558, 502, 381, - /* 2900 */ 424, 488, 558, 558, 491, 558, 558, 558, 495, 496, - /* 2910 */ 497, 498, 499, 500, 396, 502, 440, 558, 442, 558, - /* 2920 */ 558, 558, 558, 381, 558, 558, 558, 558, 558, 558, - /* 2930 */ 558, 558, 558, 558, 558, 558, 558, 558, 396, 558, - /* 2940 */ 558, 558, 424, 558, 558, 558, 558, 558, 558, 558, - /* 2950 */ 558, 558, 558, 558, 558, 558, 558, 558, 440, 558, - /* 2960 */ 442, 558, 558, 558, 488, 558, 424, 491, 558, 558, - /* 2970 */ 558, 495, 496, 497, 498, 499, 500, 558, 502, 558, - /* 2980 */ 558, 558, 440, 558, 442, 558, 558, 558, 558, 558, - /* 2990 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3000 */ 558, 558, 558, 558, 558, 558, 488, 558, 558, 491, - /* 3010 */ 558, 558, 558, 495, 496, 497, 498, 499, 500, 558, - /* 3020 */ 502, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3030 */ 488, 558, 558, 491, 558, 558, 558, 495, 496, 497, - /* 3040 */ 498, 499, 500, 558, 502, 558, 558, 558, 558, 558, - /* 3050 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3060 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3070 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3080 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3090 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3100 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3110 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3120 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3130 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3140 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3150 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3160 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3170 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3180 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3190 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3200 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3210 */ 558, 558, 558, 558, 378, 378, 378, 378, 378, 378, + /* 270 */ 270, 271, 272, 273, 191, 192, 524, 391, 526, 54, + /* 280 */ 44, 395, 522, 397, 201, 202, 489, 180, 63, 492, + /* 290 */ 530, 66, 67, 496, 497, 498, 499, 500, 501, 216, + /* 300 */ 503, 218, 0, 506, 0, 508, 509, 510, 548, 549, + /* 310 */ 124, 514, 515, 553, 554, 254, 277, 278, 279, 280, + /* 320 */ 281, 282, 283, 284, 285, 286, 287, 518, 519, 520, + /* 330 */ 440, 522, 523, 443, 444, 252, 253, 254, 424, 256, + /* 340 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + /* 350 */ 267, 268, 269, 270, 271, 272, 273, 274, 12, 13, + /* 360 */ 20, 20, 381, 20, 395, 18, 20, 380, 22, 382, + /* 370 */ 23, 518, 519, 520, 0, 522, 523, 396, 299, 77, + /* 380 */ 78, 79, 36, 424, 38, 402, 84, 85, 86, 42, + /* 390 */ 43, 155, 90, 46, 435, 436, 495, 95, 96, 97, + /* 400 */ 98, 487, 419, 101, 57, 424, 0, 105, 106, 107, + /* 410 */ 108, 428, 429, 424, 68, 299, 69, 70, 71, 72, + /* 420 */ 73, 75, 521, 442, 455, 444, 457, 21, 82, 395, + /* 430 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 299, + /* 440 */ 196, 12, 13, 14, 252, 486, 487, 424, 74, 20, + /* 450 */ 424, 22, 395, 396, 146, 20, 522, 434, 112, 155, + /* 460 */ 434, 115, 115, 411, 530, 36, 414, 38, 445, 20, + /* 470 */ 489, 445, 415, 492, 170, 486, 487, 496, 497, 498, + /* 480 */ 499, 500, 501, 549, 503, 20, 33, 553, 554, 508, + /* 490 */ 0, 510, 0, 152, 153, 514, 515, 68, 152, 153, + /* 500 */ 115, 154, 405, 311, 312, 313, 314, 315, 316, 317, + /* 510 */ 413, 82, 478, 479, 24, 25, 26, 27, 28, 29, + /* 520 */ 30, 31, 32, 542, 288, 289, 290, 291, 292, 293, + /* 530 */ 294, 295, 296, 36, 395, 396, 193, 191, 192, 231, + /* 540 */ 232, 112, 201, 202, 115, 522, 424, 201, 202, 305, + /* 550 */ 306, 307, 308, 530, 415, 208, 209, 210, 395, 396, + /* 560 */ 213, 422, 216, 20, 218, 292, 293, 294, 295, 296, + /* 570 */ 74, 548, 549, 226, 227, 453, 553, 554, 415, 82, + /* 580 */ 115, 152, 153, 155, 395, 422, 239, 152, 153, 242, + /* 590 */ 73, 0, 245, 246, 247, 248, 249, 254, 252, 253, + /* 600 */ 254, 424, 256, 257, 258, 259, 260, 261, 262, 263, + /* 610 */ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + /* 620 */ 191, 192, 445, 145, 146, 147, 148, 149, 150, 151, + /* 630 */ 201, 202, 20, 20, 22, 22, 112, 145, 146, 147, + /* 640 */ 148, 149, 150, 151, 4, 216, 299, 218, 36, 460, + /* 650 */ 461, 127, 128, 129, 130, 131, 132, 133, 134, 135, + /* 660 */ 136, 68, 138, 139, 140, 141, 142, 143, 144, 21, + /* 670 */ 58, 58, 24, 25, 26, 27, 28, 29, 30, 31, + /* 680 */ 32, 252, 253, 254, 299, 256, 257, 258, 259, 260, + /* 690 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + /* 700 */ 271, 272, 273, 12, 13, 381, 4, 114, 424, 22, + /* 710 */ 117, 20, 145, 22, 20, 112, 149, 289, 290, 291, + /* 720 */ 396, 437, 398, 36, 274, 23, 276, 36, 211, 38, + /* 730 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + /* 740 */ 4, 138, 139, 140, 141, 142, 143, 144, 424, 125, + /* 750 */ 48, 49, 50, 511, 512, 19, 22, 240, 241, 68, + /* 760 */ 506, 155, 171, 509, 299, 14, 442, 176, 444, 82, + /* 770 */ 36, 20, 424, 82, 38, 184, 323, 8, 9, 186, + /* 780 */ 432, 12, 13, 14, 15, 16, 12, 13, 395, 396, + /* 790 */ 54, 395, 396, 82, 20, 468, 22, 61, 62, 112, + /* 800 */ 473, 453, 381, 112, 68, 424, 115, 495, 415, 274, + /* 810 */ 36, 415, 38, 489, 495, 434, 492, 396, 125, 398, + /* 820 */ 496, 497, 498, 499, 500, 501, 445, 503, 395, 395, + /* 830 */ 396, 36, 508, 521, 510, 228, 395, 396, 514, 515, + /* 840 */ 521, 190, 68, 152, 153, 424, 112, 381, 2, 522, + /* 850 */ 114, 0, 23, 117, 8, 9, 82, 530, 12, 13, + /* 860 */ 14, 15, 16, 442, 402, 444, 8, 9, 395, 396, + /* 870 */ 12, 13, 14, 15, 16, 548, 549, 82, 49, 50, + /* 880 */ 553, 554, 191, 192, 450, 116, 112, 193, 415, 115, + /* 890 */ 428, 450, 201, 202, 288, 289, 290, 291, 292, 293, + /* 900 */ 294, 295, 296, 216, 0, 218, 381, 216, 442, 218, + /* 910 */ 489, 478, 479, 492, 395, 396, 13, 496, 497, 498, + /* 920 */ 499, 500, 501, 33, 503, 416, 152, 153, 277, 508, + /* 930 */ 507, 510, 509, 424, 415, 514, 515, 47, 287, 252, + /* 940 */ 253, 301, 191, 252, 253, 254, 437, 256, 257, 258, + /* 950 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + /* 960 */ 269, 270, 271, 272, 273, 191, 192, 442, 18, 20, + /* 970 */ 20, 44, 14, 416, 116, 201, 202, 27, 20, 425, + /* 980 */ 30, 424, 375, 376, 377, 82, 146, 147, 38, 20, + /* 990 */ 216, 151, 218, 0, 437, 68, 145, 146, 147, 148, + /* 1000 */ 149, 150, 151, 425, 54, 254, 56, 425, 426, 395, + /* 1010 */ 396, 61, 62, 8, 9, 52, 34, 12, 13, 14, + /* 1020 */ 15, 16, 425, 73, 443, 444, 252, 253, 254, 415, + /* 1030 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + /* 1040 */ 266, 267, 268, 269, 270, 271, 272, 273, 8, 9, + /* 1050 */ 400, 401, 12, 13, 14, 15, 16, 507, 36, 509, + /* 1060 */ 20, 8, 9, 36, 114, 12, 13, 14, 15, 16, + /* 1070 */ 77, 78, 79, 80, 81, 125, 83, 84, 85, 86, + /* 1080 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + /* 1090 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + /* 1100 */ 107, 108, 14, 15, 16, 3, 22, 157, 158, 82, + /* 1110 */ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + /* 1120 */ 36, 420, 172, 173, 174, 175, 176, 177, 178, 179, + /* 1130 */ 381, 181, 182, 183, 468, 395, 396, 187, 188, 189, + /* 1140 */ 191, 395, 396, 381, 194, 396, 51, 398, 244, 191, + /* 1150 */ 425, 77, 78, 79, 36, 415, 193, 381, 84, 85, + /* 1160 */ 86, 415, 193, 474, 90, 115, 82, 204, 381, 95, + /* 1170 */ 96, 97, 98, 424, 413, 101, 22, 395, 396, 105, + /* 1180 */ 106, 107, 108, 396, 483, 398, 395, 396, 522, 424, + /* 1190 */ 36, 442, 381, 444, 59, 60, 530, 415, 12, 13, + /* 1200 */ 435, 436, 13, 254, 442, 404, 415, 396, 22, 398, + /* 1210 */ 115, 424, 254, 208, 548, 549, 395, 396, 442, 553, + /* 1220 */ 554, 424, 36, 254, 38, 400, 401, 409, 410, 442, + /* 1230 */ 382, 444, 20, 193, 433, 424, 415, 424, 489, 424, + /* 1240 */ 218, 492, 445, 381, 381, 496, 497, 498, 499, 500, + /* 1250 */ 501, 436, 503, 442, 68, 444, 147, 508, 445, 510, + /* 1260 */ 151, 395, 396, 514, 515, 215, 112, 217, 82, 1, + /* 1270 */ 2, 82, 250, 251, 381, 439, 489, 381, 442, 492, + /* 1280 */ 20, 415, 381, 496, 497, 498, 499, 500, 501, 396, + /* 1290 */ 503, 398, 381, 381, 254, 508, 33, 510, 112, 249, + /* 1300 */ 489, 514, 515, 492, 442, 442, 454, 496, 497, 498, + /* 1310 */ 499, 500, 501, 381, 503, 439, 381, 424, 442, 508, + /* 1320 */ 381, 510, 12, 13, 68, 514, 515, 381, 396, 409, + /* 1330 */ 410, 326, 22, 33, 225, 442, 218, 444, 442, 230, + /* 1340 */ 395, 396, 233, 442, 235, 0, 36, 47, 38, 299, + /* 1350 */ 395, 396, 381, 442, 442, 381, 424, 8, 9, 381, + /* 1360 */ 415, 12, 13, 14, 15, 16, 381, 396, 250, 251, + /* 1370 */ 415, 384, 385, 117, 442, 381, 444, 442, 68, 395, + /* 1380 */ 396, 442, 489, 0, 116, 492, 395, 396, 442, 496, + /* 1390 */ 497, 498, 499, 500, 501, 424, 503, 395, 396, 415, + /* 1400 */ 381, 508, 216, 510, 218, 524, 415, 514, 515, 439, + /* 1410 */ 186, 118, 442, 442, 121, 444, 442, 415, 36, 381, + /* 1420 */ 442, 489, 557, 321, 492, 395, 396, 442, 496, 497, + /* 1430 */ 498, 499, 500, 501, 396, 503, 442, 54, 252, 253, + /* 1440 */ 508, 1, 510, 14, 220, 415, 514, 515, 417, 20, + /* 1450 */ 0, 420, 266, 267, 268, 269, 270, 271, 272, 19, + /* 1460 */ 489, 442, 424, 492, 395, 396, 254, 496, 497, 498, + /* 1470 */ 499, 500, 501, 0, 503, 234, 33, 236, 38, 508, + /* 1480 */ 442, 510, 444, 33, 415, 514, 515, 395, 396, 468, + /* 1490 */ 33, 8, 9, 53, 54, 12, 13, 14, 15, 16, + /* 1500 */ 155, 13, 13, 63, 64, 65, 66, 415, 68, 33, + /* 1510 */ 118, 395, 396, 121, 254, 118, 33, 44, 121, 118, + /* 1520 */ 33, 75, 121, 0, 36, 36, 216, 489, 218, 468, + /* 1530 */ 492, 415, 546, 33, 496, 497, 498, 499, 500, 501, + /* 1540 */ 468, 503, 193, 522, 0, 22, 508, 36, 510, 0, + /* 1550 */ 381, 530, 514, 515, 114, 152, 153, 117, 33, 116, + /* 1560 */ 250, 251, 252, 0, 539, 396, 22, 525, 468, 548, + /* 1570 */ 549, 22, 33, 116, 553, 554, 266, 267, 268, 269, + /* 1580 */ 270, 271, 272, 522, 399, 22, 424, 115, 325, 381, + /* 1590 */ 150, 530, 116, 424, 522, 33, 124, 33, 394, 116, + /* 1600 */ 218, 454, 530, 116, 396, 1, 2, 33, 412, 548, + /* 1610 */ 549, 442, 33, 444, 553, 554, 116, 12, 13, 33, + /* 1620 */ 548, 549, 522, 12, 13, 553, 554, 412, 381, 33, + /* 1630 */ 530, 33, 424, 33, 545, 195, 33, 197, 12, 13, + /* 1640 */ 200, 116, 36, 396, 545, 205, 12, 13, 548, 549, + /* 1650 */ 442, 33, 444, 553, 554, 116, 12, 13, 489, 12, + /* 1660 */ 13, 492, 12, 13, 224, 496, 497, 498, 499, 500, + /* 1670 */ 501, 424, 503, 12, 13, 12, 13, 381, 116, 510, + /* 1680 */ 116, 12, 13, 514, 515, 12, 13, 33, 82, 442, + /* 1690 */ 116, 444, 396, 33, 13, 116, 0, 489, 252, 33, + /* 1700 */ 492, 33, 116, 33, 496, 497, 498, 499, 500, 501, + /* 1710 */ 381, 503, 116, 545, 116, 467, 116, 36, 510, 116, + /* 1720 */ 424, 545, 514, 515, 454, 396, 13, 399, 490, 218, + /* 1730 */ 396, 441, 475, 454, 116, 454, 489, 550, 442, 492, + /* 1740 */ 444, 516, 529, 496, 497, 498, 499, 500, 501, 36, + /* 1750 */ 503, 55, 529, 424, 532, 454, 414, 510, 302, 54, + /* 1760 */ 469, 514, 515, 491, 20, 395, 20, 480, 233, 485, + /* 1770 */ 116, 442, 381, 444, 480, 38, 116, 404, 404, 214, + /* 1780 */ 471, 395, 116, 20, 116, 489, 116, 396, 492, 396, + /* 1790 */ 47, 54, 496, 497, 498, 499, 500, 501, 451, 503, + /* 1800 */ 63, 64, 65, 66, 396, 68, 451, 190, 448, 395, + /* 1810 */ 451, 396, 395, 448, 448, 424, 448, 113, 489, 408, + /* 1820 */ 111, 492, 395, 407, 110, 496, 497, 498, 499, 500, + /* 1830 */ 501, 395, 503, 442, 406, 444, 395, 395, 20, 543, + /* 1840 */ 544, 388, 395, 52, 392, 20, 388, 392, 404, 480, + /* 1850 */ 444, 114, 381, 404, 117, 404, 20, 397, 20, 470, + /* 1860 */ 397, 20, 20, 404, 455, 404, 461, 396, 404, 404, + /* 1870 */ 404, 404, 395, 388, 384, 384, 442, 395, 424, 442, + /* 1880 */ 489, 388, 237, 492, 555, 556, 424, 496, 497, 498, + /* 1890 */ 499, 500, 501, 424, 503, 424, 484, 115, 424, 424, + /* 1900 */ 482, 510, 424, 424, 424, 424, 515, 402, 424, 20, + /* 1910 */ 424, 480, 381, 442, 479, 444, 222, 402, 221, 395, + /* 1920 */ 310, 309, 477, 186, 476, 538, 538, 396, 207, 320, + /* 1930 */ 462, 318, 195, 538, 442, 541, 199, 200, 444, 381, + /* 1940 */ 442, 319, 205, 206, 540, 303, 298, 537, 528, 536, + /* 1950 */ 297, 527, 327, 322, 396, 424, 535, 558, 462, 324, + /* 1960 */ 489, 224, 396, 492, 469, 20, 469, 496, 497, 498, + /* 1970 */ 499, 500, 501, 442, 503, 444, 125, 552, 300, 397, + /* 1980 */ 402, 551, 424, 402, 462, 442, 199, 442, 442, 442, + /* 1990 */ 462, 459, 442, 402, 495, 442, 455, 466, 115, 402, + /* 2000 */ 442, 442, 444, 533, 199, 420, 115, 456, 22, 455, + /* 2010 */ 381, 442, 396, 442, 513, 544, 402, 402, 442, 442, + /* 2020 */ 489, 402, 442, 492, 466, 396, 442, 496, 497, 498, + /* 2030 */ 499, 500, 501, 531, 503, 442, 442, 442, 430, 383, + /* 2040 */ 35, 442, 387, 442, 442, 386, 395, 489, 381, 442, + /* 2050 */ 492, 37, 40, 424, 496, 497, 498, 499, 500, 501, + /* 2060 */ 389, 503, 442, 396, 388, 442, 442, 426, 481, 442, + /* 2070 */ 442, 442, 442, 444, 381, 442, 488, 403, 442, 442, + /* 2080 */ 442, 379, 418, 418, 426, 0, 0, 0, 47, 396, + /* 2090 */ 418, 424, 0, 472, 36, 463, 243, 36, 36, 36, + /* 2100 */ 243, 0, 463, 36, 36, 243, 36, 0, 0, 442, + /* 2110 */ 243, 444, 0, 36, 0, 36, 0, 424, 489, 22, + /* 2120 */ 0, 492, 238, 0, 36, 496, 497, 498, 499, 500, + /* 2130 */ 501, 224, 503, 0, 224, 442, 225, 444, 218, 216, + /* 2140 */ 0, 0, 0, 381, 212, 211, 0, 0, 158, 51, + /* 2150 */ 51, 0, 0, 36, 0, 36, 489, 54, 396, 492, + /* 2160 */ 0, 51, 0, 496, 497, 498, 499, 500, 501, 47, + /* 2170 */ 503, 0, 0, 0, 0, 51, 547, 0, 0, 0, + /* 2180 */ 0, 0, 489, 176, 381, 492, 424, 51, 0, 496, + /* 2190 */ 497, 498, 499, 500, 501, 36, 503, 0, 505, 396, + /* 2200 */ 176, 0, 0, 381, 442, 0, 444, 0, 0, 0, + /* 2210 */ 0, 0, 0, 0, 0, 0, 0, 0, 396, 52, + /* 2220 */ 22, 0, 47, 556, 0, 0, 0, 424, 466, 0, + /* 2230 */ 0, 0, 0, 381, 0, 0, 0, 0, 0, 0, + /* 2240 */ 0, 0, 158, 0, 0, 442, 424, 444, 396, 0, + /* 2250 */ 157, 489, 156, 0, 492, 22, 52, 0, 496, 497, + /* 2260 */ 498, 499, 500, 501, 442, 503, 444, 381, 22, 466, + /* 2270 */ 47, 68, 0, 0, 68, 0, 424, 0, 36, 0, + /* 2280 */ 0, 36, 396, 0, 36, 0, 68, 0, 68, 33, + /* 2290 */ 0, 44, 489, 0, 442, 492, 444, 381, 36, 496, + /* 2300 */ 497, 498, 499, 500, 501, 54, 503, 44, 54, 54, + /* 2310 */ 424, 489, 396, 44, 492, 44, 51, 36, 496, 497, + /* 2320 */ 498, 499, 500, 501, 14, 503, 44, 51, 442, 51, + /* 2330 */ 444, 45, 0, 0, 0, 44, 207, 0, 0, 51, + /* 2340 */ 424, 489, 0, 51, 492, 0, 0, 0, 496, 497, + /* 2350 */ 498, 499, 500, 501, 36, 503, 54, 381, 442, 44, + /* 2360 */ 444, 0, 36, 54, 44, 76, 0, 36, 54, 44, + /* 2370 */ 0, 36, 396, 54, 44, 489, 0, 0, 492, 381, + /* 2380 */ 121, 123, 496, 497, 498, 499, 500, 501, 0, 503, + /* 2390 */ 0, 0, 381, 0, 396, 22, 36, 0, 36, 36, + /* 2400 */ 424, 22, 33, 36, 36, 489, 22, 396, 492, 0, + /* 2410 */ 36, 36, 496, 497, 498, 499, 500, 501, 442, 503, + /* 2420 */ 444, 36, 424, 36, 22, 36, 0, 33, 36, 22, + /* 2430 */ 0, 36, 36, 22, 56, 424, 0, 22, 0, 36, + /* 2440 */ 442, 381, 444, 0, 0, 0, 36, 0, 36, 36, + /* 2450 */ 0, 22, 20, 442, 36, 444, 396, 116, 36, 36, + /* 2460 */ 0, 193, 0, 115, 115, 489, 0, 51, 492, 36, + /* 2470 */ 22, 22, 496, 497, 498, 499, 500, 501, 228, 503, + /* 2480 */ 219, 229, 0, 223, 424, 0, 3, 489, 193, 193, + /* 2490 */ 492, 193, 193, 199, 496, 497, 498, 499, 500, 501, + /* 2500 */ 489, 503, 442, 492, 444, 33, 203, 496, 497, 498, + /* 2510 */ 499, 500, 501, 115, 503, 203, 116, 116, 51, 381, + /* 2520 */ 115, 115, 36, 36, 116, 52, 304, 113, 52, 33, + /* 2530 */ 111, 33, 33, 116, 396, 115, 33, 82, 381, 115, + /* 2540 */ 115, 51, 33, 116, 116, 3, 115, 36, 33, 489, + /* 2550 */ 115, 51, 492, 396, 36, 116, 496, 497, 498, 499, + /* 2560 */ 500, 501, 424, 503, 36, 36, 36, 116, 381, 36, + /* 2570 */ 304, 304, 36, 116, 116, 51, 33, 0, 0, 115, + /* 2580 */ 442, 424, 444, 396, 44, 116, 116, 0, 288, 115, + /* 2590 */ 115, 44, 115, 0, 116, 196, 115, 44, 33, 442, + /* 2600 */ 381, 444, 113, 275, 200, 113, 2, 22, 252, 116, + /* 2610 */ 116, 424, 115, 51, 51, 396, 115, 115, 22, 255, + /* 2620 */ 115, 115, 0, 116, 116, 115, 51, 489, 115, 442, + /* 2630 */ 492, 444, 115, 196, 496, 497, 498, 499, 500, 501, + /* 2640 */ 115, 503, 116, 424, 44, 124, 489, 195, 22, 492, + /* 2650 */ 115, 381, 196, 496, 497, 498, 499, 500, 501, 115, + /* 2660 */ 503, 442, 116, 444, 126, 115, 396, 115, 22, 115, + /* 2670 */ 115, 115, 22, 125, 22, 229, 489, 116, 381, 492, + /* 2680 */ 36, 36, 115, 496, 497, 498, 499, 500, 501, 116, + /* 2690 */ 503, 36, 116, 396, 424, 115, 36, 116, 36, 116, + /* 2700 */ 36, 36, 116, 137, 115, 137, 137, 137, 489, 33, + /* 2710 */ 115, 492, 442, 36, 444, 496, 497, 498, 499, 500, + /* 2720 */ 501, 424, 503, 115, 22, 76, 75, 22, 36, 36, + /* 2730 */ 36, 36, 36, 36, 36, 36, 36, 36, 82, 442, + /* 2740 */ 381, 444, 36, 109, 109, 82, 33, 36, 36, 22, + /* 2750 */ 36, 36, 36, 36, 82, 396, 36, 36, 36, 489, + /* 2760 */ 36, 381, 492, 22, 36, 36, 496, 497, 498, 499, + /* 2770 */ 500, 501, 0, 503, 36, 44, 396, 54, 0, 36, + /* 2780 */ 54, 44, 0, 424, 36, 0, 489, 54, 44, 492, + /* 2790 */ 36, 44, 0, 496, 497, 498, 499, 500, 501, 54, + /* 2800 */ 503, 442, 381, 444, 424, 36, 0, 36, 22, 0, + /* 2810 */ 22, 36, 33, 36, 20, 22, 21, 396, 22, 22, + /* 2820 */ 21, 559, 442, 381, 444, 559, 559, 559, 559, 559, + /* 2830 */ 559, 559, 559, 559, 559, 559, 559, 559, 396, 559, + /* 2840 */ 559, 559, 559, 559, 559, 424, 559, 559, 489, 559, + /* 2850 */ 559, 492, 559, 559, 559, 496, 497, 498, 499, 500, + /* 2860 */ 501, 559, 503, 442, 559, 444, 424, 559, 559, 489, + /* 2870 */ 559, 559, 492, 559, 559, 559, 496, 497, 498, 499, + /* 2880 */ 500, 501, 559, 503, 442, 381, 444, 559, 559, 559, + /* 2890 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 2900 */ 396, 381, 559, 559, 559, 559, 559, 559, 559, 559, + /* 2910 */ 489, 559, 559, 492, 559, 559, 396, 496, 497, 498, + /* 2920 */ 499, 500, 501, 559, 503, 559, 559, 559, 424, 559, + /* 2930 */ 559, 489, 559, 559, 492, 559, 559, 559, 496, 497, + /* 2940 */ 498, 499, 500, 501, 424, 503, 442, 559, 444, 559, + /* 2950 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 2960 */ 559, 559, 442, 381, 444, 559, 559, 559, 559, 559, + /* 2970 */ 559, 559, 559, 559, 559, 559, 559, 559, 396, 559, + /* 2980 */ 559, 559, 381, 559, 559, 559, 559, 559, 559, 559, + /* 2990 */ 559, 559, 559, 489, 559, 559, 492, 396, 559, 559, + /* 3000 */ 496, 497, 498, 499, 500, 501, 424, 503, 559, 489, + /* 3010 */ 559, 559, 492, 559, 559, 559, 496, 497, 498, 499, + /* 3020 */ 500, 501, 559, 503, 442, 424, 444, 559, 559, 559, + /* 3030 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3040 */ 559, 559, 559, 442, 559, 444, 559, 559, 559, 559, + /* 3050 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3060 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3070 */ 559, 489, 559, 559, 492, 559, 559, 559, 496, 497, + /* 3080 */ 498, 499, 500, 501, 559, 503, 559, 559, 559, 559, + /* 3090 */ 489, 559, 559, 492, 559, 559, 559, 496, 497, 498, + /* 3100 */ 499, 500, 501, 559, 503, 559, 559, 559, 559, 559, + /* 3110 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3120 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3130 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3140 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3150 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3160 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3170 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3180 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3190 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 378, + /* 3200 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 3210 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3220 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3230 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3240 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, @@ -1248,254 +1257,261 @@ static const YYCODETYPE yy_lookahead[] = { /* 3390 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3400 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3410 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3420 */ 378, 378, 378, + /* 3420 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 3430 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 3440 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 3450 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 3460 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 3470 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 3480 */ 378, 378, 378, }; -#define YY_SHIFT_COUNT (971) +#define YY_SHIFT_COUNT (977) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2815) +#define YY_SHIFT_MAX (2809) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1307, 0, 261, 0, 523, 523, 523, 523, 523, 523, - /* 10 */ 523, 523, 523, 523, 523, 523, 784, 1045, 1045, 1306, - /* 20 */ 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - /* 30 */ 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - /* 40 */ 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - /* 50 */ 65, 315, 521, 6, 208, 335, 208, 208, 6, 6, - /* 60 */ 208, 851, 208, 260, 851, 205, 208, 200, 1378, 337, - /* 70 */ 337, 215, 215, 1378, 1378, 907, 907, 337, 20, 293, - /* 80 */ 262, 262, 423, 215, 215, 215, 215, 215, 215, 215, - /* 90 */ 215, 215, 215, 215, 334, 382, 419, 215, 215, 400, - /* 100 */ 200, 215, 334, 215, 200, 215, 215, 215, 215, 200, - /* 110 */ 215, 215, 200, 215, 200, 200, 200, 215, 590, 216, - /* 120 */ 216, 437, 437, 1002, 1653, 13, 69, 393, 393, 393, - /* 130 */ 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - /* 140 */ 393, 393, 393, 393, 393, 393, 438, 623, 20, 293, - /* 150 */ 776, 776, 503, 352, 352, 352, 331, 331, 386, 1003, - /* 160 */ 503, 400, 200, 560, 200, 200, 430, 200, 200, 767, - /* 170 */ 200, 767, 767, 752, 957, 437, 437, 437, 437, 437, - /* 180 */ 437, 1473, 1084, 21, 58, 100, 100, 15, 67, 288, - /* 190 */ 105, 274, 264, 651, 988, 706, 706, 621, 919, 811, - /* 200 */ 134, 134, 134, 404, 134, 622, 1234, 668, 947, 1000, - /* 210 */ 890, 940, 947, 947, 1157, 1133, 1133, 504, 1068, 538, - /* 220 */ 1003, 1361, 1610, 1646, 1648, 1443, 400, 1648, 400, 1467, - /* 230 */ 1646, 1662, 1637, 1662, 1637, 1501, 1646, 1662, 1646, 1637, - /* 240 */ 1501, 1501, 1501, 1591, 1602, 1646, 1646, 1611, 1646, 1646, - /* 250 */ 1646, 1709, 1682, 1709, 1682, 1648, 400, 400, 1735, 400, - /* 260 */ 1737, 1742, 400, 1737, 400, 1759, 400, 1762, 400, 400, - /* 270 */ 1646, 400, 1709, 200, 200, 200, 200, 200, 200, 200, - /* 280 */ 200, 200, 200, 200, 1646, 957, 957, 1709, 767, 767, - /* 290 */ 767, 1592, 1714, 1648, 590, 1810, 1617, 1633, 1735, 590, - /* 300 */ 1361, 1646, 767, 1550, 1554, 1550, 1554, 1549, 1658, 1550, - /* 310 */ 1552, 1558, 1583, 1361, 1590, 1600, 1566, 1571, 1576, 1662, - /* 320 */ 1880, 1777, 1609, 1737, 590, 590, 1554, 767, 767, 767, - /* 330 */ 767, 1554, 767, 1736, 590, 767, 1762, 590, 1827, 767, - /* 340 */ 1748, 1762, 590, 752, 590, 1662, 767, 767, 767, 767, - /* 350 */ 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, - /* 360 */ 767, 767, 767, 767, 767, 767, 767, 767, 1856, 767, - /* 370 */ 1646, 590, 1956, 1955, 1966, 1974, 1709, 3045, 3045, 3045, - /* 380 */ 3045, 3045, 3045, 3045, 3045, 3045, 3045, 3045, 3045, 39, - /* 390 */ 1884, 214, 648, 606, 395, 615, 456, 1343, 1217, 600, - /* 400 */ 611, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, - /* 410 */ 926, 656, 225, 569, 795, 795, 644, 791, 414, 815, - /* 420 */ 620, 620, 298, 551, 620, 155, 1258, 1259, 832, 882, - /* 430 */ 882, 1273, 1247, 697, 1273, 1273, 1273, 1270, 32, 1090, - /* 440 */ 1360, 1252, 1168, 1346, 1373, 1266, 1287, 1305, 1309, 1325, - /* 450 */ 1353, 1398, 982, 1431, 1444, 1445, 987, 1335, 1365, 1367, - /* 460 */ 1379, 1409, 1414, 1419, 1311, 1329, 1334, 1363, 1426, 1465, - /* 470 */ 1475, 1468, 1328, 1469, 1405, 1470, 1472, 1476, 1496, 1477, - /* 480 */ 1481, 1531, 1534, 1570, 1586, 1596, 1598, 1601, 1603, 1605, - /* 490 */ 1491, 1507, 1516, 1517, 1547, 1587, 522, 1449, 1413, 1442, - /* 500 */ 1452, 1486, 1474, 1428, 2029, 2040, 2043, 1997, 2045, 2011, - /* 510 */ 1806, 2013, 2018, 2019, 1814, 2063, 2031, 2035, 1823, 2036, - /* 520 */ 2073, 2079, 1833, 2076, 2041, 2081, 2048, 2085, 2064, 2087, - /* 530 */ 2055, 1858, 2096, 1874, 2098, 1876, 1877, 1885, 1888, 2100, - /* 540 */ 2104, 2105, 1895, 1898, 2109, 2111, 1958, 2062, 2066, 2118, - /* 550 */ 2084, 2121, 2122, 2095, 2078, 2133, 2083, 2135, 2090, 2139, - /* 560 */ 2140, 2142, 2092, 2144, 2153, 2154, 2155, 2159, 2160, 1987, - /* 570 */ 2127, 2164, 1999, 2176, 2177, 2178, 2184, 2185, 2186, 2187, - /* 580 */ 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2200, 2201, 2202, - /* 590 */ 2203, 2204, 2205, 2129, 2181, 2161, 2182, 2206, 2207, 2209, - /* 600 */ 2210, 2211, 2212, 2213, 2214, 2196, 2216, 2065, 2219, 2067, - /* 610 */ 2227, 2086, 2234, 2236, 2217, 2195, 2223, 2208, 2238, 2199, - /* 620 */ 2248, 2215, 2220, 2249, 2218, 2258, 2224, 2259, 2261, 2226, - /* 630 */ 2222, 2225, 2265, 2232, 2228, 2237, 2278, 2244, 2230, 2241, - /* 640 */ 2287, 2253, 2294, 2263, 2247, 2262, 2245, 2254, 2292, 2257, - /* 650 */ 2311, 2267, 2269, 2314, 2315, 2316, 2317, 2274, 2113, 2320, - /* 660 */ 2245, 2270, 2322, 2245, 2275, 2327, 2328, 2256, 2333, 2334, - /* 670 */ 2299, 2276, 2293, 2336, 2302, 2285, 2296, 2341, 2306, 2289, - /* 680 */ 2301, 2346, 2312, 2300, 2309, 2350, 2355, 2356, 2357, 2358, - /* 690 */ 2359, 2239, 2240, 2324, 2342, 2363, 2343, 2331, 2337, 2339, - /* 700 */ 2340, 2348, 2351, 2353, 2360, 2361, 2344, 2366, 2364, 2365, - /* 710 */ 2347, 2372, 2386, 2369, 2392, 2389, 2393, 2391, 2362, 2415, - /* 720 */ 2395, 2384, 2421, 2422, 2431, 2397, 2432, 2399, 2437, 2402, - /* 730 */ 2440, 2419, 2433, 2406, 2416, 2418, 2335, 2345, 2455, 2271, - /* 740 */ 2231, 2235, 2349, 2252, 2245, 2425, 2478, 2288, 2443, 2459, - /* 750 */ 2482, 2266, 2461, 2295, 2290, 2485, 2486, 2297, 2298, 2304, - /* 760 */ 2303, 2487, 2458, 2198, 2377, 2378, 2382, 2387, 2462, 2466, - /* 770 */ 2394, 2452, 2398, 2454, 2401, 2400, 2474, 2475, 2403, 2405, - /* 780 */ 2407, 2408, 2409, 2477, 2463, 2467, 2411, 2480, 2233, 2445, - /* 790 */ 2424, 2501, 2423, 2506, 2427, 2429, 2534, 2513, 2255, 2511, - /* 800 */ 2520, 2521, 2523, 2524, 2526, 2448, 2449, 2516, 2281, 2536, - /* 810 */ 2528, 2580, 2581, 2468, 2540, 2469, 2470, 2472, 2473, 2404, - /* 820 */ 2479, 2589, 2546, 2410, 2591, 2481, 2488, 2412, 2548, 2414, - /* 830 */ 2562, 2483, 2332, 2492, 2599, 2588, 2367, 2495, 2496, 2498, - /* 840 */ 2499, 2500, 2504, 2508, 2509, 2565, 2512, 2514, 2573, 2510, - /* 850 */ 2606, 2376, 2517, 2519, 2631, 2522, 2525, 2438, 2592, 2527, - /* 860 */ 2535, 2245, 2584, 2529, 2532, 2549, 2533, 2537, 2539, 2619, - /* 870 */ 2621, 2628, 2434, 2550, 2615, 2633, 2552, 2554, 2637, 2559, - /* 880 */ 2567, 2645, 2498, 2568, 2650, 2499, 2574, 2655, 2500, 2582, - /* 890 */ 2664, 2504, 2566, 2569, 2570, 2571, 2586, 2670, 2593, 2674, - /* 900 */ 2598, 2670, 2670, 2692, 2646, 2649, 2703, 2691, 2693, 2694, - /* 910 */ 2698, 2699, 2700, 2701, 2702, 2704, 2705, 2706, 2657, 2634, - /* 920 */ 2662, 2636, 2695, 2710, 2711, 2713, 2729, 2717, 2719, 2720, - /* 930 */ 2675, 2344, 2722, 2366, 2723, 2724, 2725, 2726, 2741, 2728, - /* 940 */ 2765, 2730, 2714, 2727, 2769, 2737, 2721, 2732, 2774, 2742, - /* 950 */ 2731, 2736, 2781, 2747, 2743, 2740, 2798, 2764, 2801, 2780, - /* 960 */ 2776, 2814, 2793, 2783, 2786, 2787, 2795, 2803, 2797, 2809, - /* 970 */ 2812, 2815, + /* 0 */ 347, 0, 83, 0, 346, 346, 346, 346, 346, 346, + /* 10 */ 346, 346, 346, 346, 346, 346, 429, 691, 691, 774, + /* 20 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, + /* 30 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, + /* 40 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, + /* 50 */ 116, 465, 1050, 88, 140, 385, 140, 140, 88, 88, + /* 60 */ 140, 1186, 140, 950, 1186, 79, 140, 51, 1310, 341, + /* 70 */ 341, 102, 102, 87, 1310, 1310, 702, 702, 341, 5, + /* 80 */ 5, 435, 220, 220, 61, 186, 102, 102, 102, 102, + /* 90 */ 102, 102, 102, 102, 102, 102, 102, 340, 449, 543, + /* 100 */ 102, 102, 496, 51, 102, 340, 102, 51, 102, 102, + /* 110 */ 102, 102, 51, 102, 102, 102, 51, 102, 51, 51, + /* 120 */ 51, 39, 39, 524, 524, 603, 1074, 236, 648, 687, + /* 130 */ 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + /* 140 */ 687, 687, 687, 687, 687, 687, 687, 687, 21, 53, + /* 150 */ 5, 435, 1135, 1135, 497, 694, 694, 694, 450, 450, + /* 160 */ 374, 903, 497, 496, 51, 624, 51, 51, 535, 51, + /* 170 */ 51, 711, 51, 711, 711, 693, 982, 524, 524, 524, + /* 180 */ 524, 524, 524, 1440, 302, 406, 1040, 606, 606, 1005, + /* 190 */ 192, 244, 273, 612, 428, 751, 958, 29, 29, 829, + /* 200 */ 343, 1084, 1084, 1084, 963, 1084, 949, 969, 613, 927, + /* 210 */ 1429, 567, 1224, 1212, 1212, 1260, 1189, 1189, 1102, 890, + /* 220 */ 640, 1212, 903, 1456, 1705, 1744, 1746, 1535, 496, 1746, + /* 230 */ 496, 1565, 1744, 1763, 1743, 1763, 1743, 1617, 1744, 1763, + /* 240 */ 1744, 1743, 1617, 1617, 1617, 1704, 1709, 1744, 1744, 1714, + /* 250 */ 1744, 1744, 1744, 1818, 1791, 1818, 1791, 1746, 496, 496, + /* 260 */ 1825, 496, 1836, 1838, 496, 1836, 496, 1841, 496, 1842, + /* 270 */ 496, 496, 1744, 496, 1818, 51, 51, 51, 51, 51, + /* 280 */ 51, 51, 51, 51, 51, 51, 1744, 982, 982, 1818, + /* 290 */ 711, 711, 711, 1645, 1782, 1746, 87, 1889, 1694, 1697, + /* 300 */ 1825, 87, 1456, 1744, 711, 1610, 1612, 1610, 1612, 1613, + /* 310 */ 1721, 1610, 1609, 1622, 1642, 1456, 1648, 1653, 1625, 1635, + /* 320 */ 1631, 1763, 1945, 1851, 1678, 1836, 87, 87, 1612, 711, + /* 330 */ 711, 711, 711, 1612, 711, 1787, 87, 711, 1842, 87, + /* 340 */ 1883, 711, 1805, 1842, 87, 693, 87, 1763, 711, 711, + /* 350 */ 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, + /* 360 */ 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, + /* 370 */ 1891, 711, 1744, 87, 1986, 2005, 2014, 2012, 1818, 3105, + /* 380 */ 3105, 3105, 3105, 3105, 3105, 3105, 3105, 3105, 3105, 3105, + /* 390 */ 3105, 993, 1737, 490, 736, 1483, 769, 858, 85, 846, + /* 400 */ 1349, 492, 851, 1053, 1053, 1053, 1053, 1053, 1053, 1053, + /* 410 */ 1053, 1053, 478, 49, 1109, 15, 210, 210, 517, 593, + /* 420 */ 591, 225, 607, 607, 1022, 1118, 607, 304, 734, 1154, + /* 430 */ 308, 840, 840, 1088, 1268, 651, 1088, 1088, 1088, 1383, + /* 440 */ 904, 13, 1473, 1300, 107, 1345, 1450, 1293, 1392, 1397, + /* 450 */ 1401, 795, 1488, 1489, 1523, 1544, 1549, 1563, 1241, 1443, + /* 460 */ 1457, 1256, 1476, 1487, 1500, 1525, 1403, 453, 1263, 1539, + /* 470 */ 1562, 1564, 1604, 1574, 1446, 1579, 1095, 1586, 1596, 1598, + /* 480 */ 1600, 1603, 1605, 1611, 1626, 1634, 1644, 1647, 1650, 1661, + /* 490 */ 1663, 1669, 1673, 1618, 1654, 1660, 1666, 1668, 1670, 1472, + /* 500 */ 1027, 1382, 1511, 1681, 1713, 1606, 1696, 2085, 2086, 2087, + /* 510 */ 2041, 2092, 2058, 1853, 2061, 2062, 2063, 1857, 2101, 2067, + /* 520 */ 2068, 1862, 2070, 2107, 2108, 1867, 2112, 2077, 2114, 2079, + /* 530 */ 2116, 2097, 2120, 2088, 1884, 2123, 1907, 2133, 1910, 1911, + /* 540 */ 1920, 1923, 2140, 2141, 2142, 1932, 1934, 2146, 2147, 1990, + /* 550 */ 2098, 2099, 2151, 2117, 2152, 2154, 2119, 2103, 2160, 2110, + /* 560 */ 2162, 2122, 2171, 2172, 2173, 2124, 2174, 2177, 2178, 2179, + /* 570 */ 2180, 2181, 2007, 2159, 2197, 2024, 2201, 2202, 2205, 2207, + /* 580 */ 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, + /* 590 */ 2224, 2225, 2226, 2229, 2230, 2231, 2136, 2188, 2175, 2232, + /* 600 */ 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2198, 2221, + /* 610 */ 2084, 2243, 2093, 2244, 2096, 2249, 2253, 2233, 2167, 2246, + /* 620 */ 2204, 2257, 2203, 2272, 2206, 2242, 2273, 2218, 2275, 2220, + /* 630 */ 2277, 2279, 2245, 2251, 2247, 2280, 2248, 2254, 2263, 2283, + /* 640 */ 2262, 2255, 2269, 2285, 2281, 2287, 2223, 2271, 2256, 2265, + /* 650 */ 2276, 2310, 2278, 2290, 2286, 2282, 2293, 2332, 2333, 2334, + /* 660 */ 2291, 2129, 2337, 2265, 2288, 2338, 2265, 2292, 2342, 2345, + /* 670 */ 2289, 2346, 2347, 2318, 2302, 2315, 2361, 2326, 2309, 2320, + /* 680 */ 2366, 2331, 2314, 2325, 2370, 2335, 2319, 2330, 2376, 2377, + /* 690 */ 2388, 2390, 2391, 2393, 2258, 2259, 2360, 2373, 2397, 2379, + /* 700 */ 2362, 2363, 2367, 2368, 2374, 2375, 2385, 2387, 2389, 2369, + /* 710 */ 2394, 2392, 2395, 2384, 2396, 2409, 2402, 2426, 2407, 2430, + /* 720 */ 2411, 2378, 2436, 2415, 2403, 2438, 2443, 2444, 2410, 2445, + /* 730 */ 2412, 2447, 2413, 2450, 2429, 2432, 2418, 2422, 2423, 2341, + /* 740 */ 2348, 2460, 2268, 2252, 2250, 2349, 2260, 2265, 2416, 2462, + /* 750 */ 2295, 2433, 2448, 2466, 2261, 2449, 2296, 2294, 2482, 2485, + /* 760 */ 2298, 2303, 2299, 2312, 2483, 2472, 2222, 2398, 2400, 2405, + /* 770 */ 2401, 2486, 2487, 2406, 2473, 2414, 2476, 2419, 2408, 2496, + /* 780 */ 2498, 2417, 2420, 2424, 2425, 2427, 2499, 2467, 2490, 2431, + /* 790 */ 2503, 2266, 2455, 2428, 2509, 2435, 2511, 2439, 2451, 2542, + /* 800 */ 2515, 2267, 2518, 2528, 2529, 2530, 2533, 2536, 2457, 2458, + /* 810 */ 2500, 2300, 2543, 2524, 2577, 2578, 2464, 2540, 2469, 2470, + /* 820 */ 2474, 2475, 2399, 2477, 2587, 2547, 2404, 2593, 2478, 2481, + /* 830 */ 2437, 2553, 2452, 2565, 2489, 2328, 2492, 2604, 2585, 2356, + /* 840 */ 2493, 2494, 2497, 2501, 2502, 2505, 2506, 2507, 2562, 2510, + /* 850 */ 2513, 2563, 2508, 2596, 2364, 2517, 2525, 2622, 2526, 2535, + /* 860 */ 2456, 2600, 2544, 2521, 2626, 2538, 2550, 2265, 2575, 2552, + /* 870 */ 2554, 2546, 2555, 2556, 2548, 2646, 2650, 2652, 2446, 2561, + /* 880 */ 2644, 2645, 2567, 2573, 2655, 2580, 2576, 2660, 2497, 2581, + /* 890 */ 2662, 2501, 2583, 2664, 2502, 2586, 2665, 2505, 2566, 2568, + /* 900 */ 2569, 2570, 2589, 2676, 2595, 2677, 2608, 2676, 2676, 2702, + /* 910 */ 2649, 2651, 2705, 2692, 2693, 2694, 2695, 2696, 2697, 2698, + /* 920 */ 2699, 2700, 2701, 2706, 2656, 2634, 2663, 2635, 2713, 2711, + /* 930 */ 2712, 2714, 2727, 2715, 2716, 2717, 2672, 2369, 2720, 2394, + /* 940 */ 2721, 2722, 2724, 2728, 2741, 2729, 2772, 2738, 2723, 2731, + /* 950 */ 2778, 2743, 2726, 2737, 2782, 2748, 2733, 2744, 2785, 2754, + /* 960 */ 2745, 2747, 2792, 2769, 2806, 2786, 2771, 2809, 2788, 2779, + /* 970 */ 2775, 2777, 2793, 2795, 2796, 2797, 2799, 2794, }; -#define YY_REDUCE_COUNT (388) -#define YY_REDUCE_MIN (-502) -#define YY_REDUCE_MAX (2542) +#define YY_REDUCE_COUNT (390) +#define YY_REDUCE_MIN (-514) +#define YY_REDUCE_MAX (2601) static const short yy_reduce_ofst[] = { - /* 0 */ -66, -338, -147, 159, 192, 330, 418, 452, 591, 714, - /* 10 */ 777, 941, 973, 1210, 1275, 1304, 1345, 1384, 1415, 1497, - /* 20 */ 1537, 1562, 1628, 1650, 1670, 1733, 1755, 1775, 1802, 1883, - /* 30 */ 1907, 1928, 1948, 1970, 2033, 2053, 2075, 2158, 2180, 2197, - /* 40 */ 2221, 2291, 2308, 2330, 2371, 2396, 2413, 2476, 2518, 2542, - /* 50 */ -340, -355, -183, -191, -442, 350, 459, 471, -334, 630, - /* 60 */ 872, 241, -488, -159, 365, -445, -44, 117, -411, 206, - /* 70 */ 398, -378, 450, -254, 213, -390, -388, -350, -256, -431, - /* 80 */ 287, 376, 427, -361, 95, 495, 526, -169, 505, 549, - /* 90 */ 575, 583, 598, 533, -11, -241, 439, 614, 682, -198, - /* 100 */ 317, 711, 230, 769, -87, 771, 780, 792, 803, 645, - /* 110 */ 842, 844, 810, 848, 296, 823, 834, 856, -60, -502, - /* 120 */ -502, -277, -424, 48, -324, -360, -65, 281, 472, 499, - /* 130 */ 565, 577, 581, 715, 743, 827, 843, 880, 883, 901, - /* 140 */ 946, 952, 954, 955, 959, 962, -237, -273, -105, 322, - /* 150 */ 659, 708, 762, -273, 231, 466, 143, 362, -319, 198, - /* 160 */ 794, -232, 193, 610, 138, 464, 429, 897, 122, 894, - /* 170 */ 905, 935, 945, 733, 809, -410, 460, 597, 669, 674, - /* 180 */ 686, 805, 925, 1035, 980, 968, 968, 948, 963, 974, - /* 190 */ 989, 1118, 968, 1094, 1094, 1116, 1122, 1107, 1195, 1141, - /* 200 */ 1075, 1077, 1080, 1159, 1082, 1094, 1232, 1146, 1183, 1241, - /* 210 */ 1199, 1165, 1187, 1188, 1094, 1114, 1125, 1105, 1140, 1126, - /* 220 */ 1246, 1193, 1175, 1278, 1191, 1190, 1272, 1200, 1274, 1211, - /* 230 */ 1288, 1290, 1238, 1292, 1240, 1245, 1297, 1298, 1300, 1244, - /* 240 */ 1251, 1256, 1265, 1308, 1313, 1319, 1323, 1316, 1330, 1332, - /* 250 */ 1338, 1347, 1344, 1352, 1350, 1268, 1341, 1348, 1314, 1349, - /* 260 */ 1370, 1295, 1364, 1381, 1372, 1321, 1382, 1336, 1387, 1389, - /* 270 */ 1388, 1390, 1410, 1383, 1385, 1386, 1391, 1392, 1395, 1396, - /* 280 */ 1397, 1399, 1401, 1403, 1402, 1421, 1430, 1424, 1394, 1411, - /* 290 */ 1412, 1339, 1351, 1356, 1429, 1359, 1374, 1393, 1416, 1454, - /* 300 */ 1406, 1459, 1420, 1324, 1404, 1326, 1408, 1327, 1331, 1340, - /* 310 */ 1337, 1354, 1357, 1422, 1368, 1362, 1342, 1358, 1355, 1502, - /* 320 */ 1407, 1375, 1400, 1519, 1518, 1521, 1458, 1464, 1484, 1485, - /* 330 */ 1488, 1471, 1489, 1478, 1529, 1495, 1487, 1538, 1432, 1505, - /* 340 */ 1498, 1500, 1553, 1536, 1555, 1563, 1511, 1520, 1522, 1523, - /* 350 */ 1524, 1525, 1526, 1527, 1528, 1532, 1533, 1535, 1540, 1541, - /* 360 */ 1542, 1543, 1544, 1551, 1560, 1565, 1567, 1568, 1545, 1572, - /* 370 */ 1581, 1585, 1606, 1624, 1626, 1627, 1629, 1548, 1589, 1539, - /* 380 */ 1561, 1556, 1559, 1604, 1612, 1594, 1620, 1639, 1644, + /* 0 */ -240, -366, -203, -19, 324, 421, 749, 787, 811, 893, + /* 10 */ 932, 971, 1038, 1169, 1208, 1247, -317, 1296, 1329, 1391, + /* 20 */ 1471, 1531, 1558, 1629, 1667, 1693, 1762, 1803, 1822, 1852, + /* 30 */ 1886, 1916, 1976, 1998, 2011, 2060, 2138, 2157, 2187, 2219, + /* 40 */ 2270, 2297, 2359, 2380, 2421, 2442, 2504, 2520, 2582, 2601, + /* 50 */ -311, 23, 327, -363, 666, 1021, 1061, 1072, -191, -147, + /* 60 */ 1100, -383, -514, -232, -375, -504, -66, -41, -426, -441, + /* 70 */ -437, 139, 163, -17, -423, -353, -384, -333, -214, -308, + /* 80 */ 348, -110, -224, -114, -352, 57, 393, 396, 473, 519, + /* 90 */ -206, 434, 614, 740, 746, 782, 441, 34, 189, -31, + /* 100 */ 791, 821, -402, -11, 866, 433, 945, -332, 955, 984, + /* 110 */ 991, 1002, 509, 1030, 1069, 1092, 26, 1116, 765, 381, + /* 120 */ 557, 242, 242, 582, -278, -261, 97, -248, -13, -338, + /* 130 */ 466, 525, 762, 776, 862, 863, 896, 901, 911, 912, + /* 140 */ 935, 939, 946, 974, 978, 985, 994, 1019, -196, -99, + /* 150 */ 122, 581, 650, 825, 818, -99, 312, 319, 423, 550, + /* 160 */ 462, 52, 920, 801, -86, 701, 177, 797, 254, 284, + /* 170 */ 815, 836, 813, 876, 970, 1031, 987, -425, -414, 554, + /* 180 */ 578, 597, 725, 689, 761, 848, 852, 881, 881, 865, + /* 190 */ 986, 1025, 1042, 1185, 881, 1162, 1162, 1196, 1215, 1204, + /* 200 */ 1147, 1089, 1099, 1168, 1248, 1176, 1162, 1270, 1328, 1238, + /* 210 */ 1334, 1290, 1257, 1279, 1281, 1162, 1213, 1223, 1187, 1225, + /* 220 */ 1222, 1301, 1342, 1291, 1272, 1370, 1287, 1284, 1373, 1294, + /* 230 */ 1374, 1309, 1386, 1393, 1347, 1408, 1355, 1360, 1414, 1415, + /* 240 */ 1417, 1359, 1365, 1366, 1368, 1411, 1416, 1427, 1436, 1428, + /* 250 */ 1441, 1442, 1447, 1453, 1452, 1458, 1455, 1369, 1444, 1449, + /* 260 */ 1406, 1451, 1460, 1389, 1459, 1463, 1461, 1405, 1464, 1409, + /* 270 */ 1465, 1466, 1477, 1467, 1485, 1454, 1462, 1469, 1474, 1475, + /* 280 */ 1478, 1479, 1480, 1481, 1484, 1486, 1482, 1490, 1491, 1493, + /* 290 */ 1434, 1437, 1492, 1412, 1418, 1431, 1505, 1435, 1445, 1448, + /* 300 */ 1494, 1515, 1495, 1524, 1498, 1387, 1468, 1388, 1496, 1394, + /* 310 */ 1404, 1395, 1410, 1413, 1421, 1497, 1420, 1424, 1399, 1425, + /* 320 */ 1430, 1566, 1499, 1470, 1502, 1582, 1578, 1581, 1522, 1543, + /* 330 */ 1545, 1546, 1547, 1528, 1550, 1532, 1591, 1553, 1541, 1597, + /* 340 */ 1501, 1559, 1551, 1554, 1614, 1585, 1615, 1616, 1569, 1571, + /* 350 */ 1576, 1577, 1580, 1584, 1593, 1594, 1595, 1599, 1601, 1602, + /* 360 */ 1607, 1620, 1623, 1624, 1627, 1628, 1630, 1633, 1636, 1637, + /* 370 */ 1608, 1638, 1651, 1619, 1656, 1659, 1655, 1671, 1676, 1621, + /* 380 */ 1641, 1588, 1587, 1632, 1639, 1664, 1665, 1658, 1672, 1674, + /* 390 */ 1702, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 10 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 20 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 30 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 40 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 50 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 60 */ 2569, 2195, 2195, 2525, 2195, 2195, 2195, 2195, 2195, 2195, - /* 70 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2532, 2195, - /* 80 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 90 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2301, - /* 100 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 110 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2299, 2821, - /* 120 */ 2195, 2947, 2610, 2195, 2195, 2850, 2195, 2195, 2195, 2195, - /* 130 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 140 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2833, 2195, 2195, - /* 150 */ 2272, 2272, 2195, 2833, 2833, 2833, 2793, 2793, 2299, 2195, - /* 160 */ 2195, 2301, 2195, 2612, 2195, 2195, 2195, 2195, 2195, 2195, - /* 170 */ 2195, 2195, 2195, 2441, 2225, 2195, 2195, 2195, 2195, 2195, - /* 180 */ 2195, 2595, 2195, 2195, 2879, 2825, 2826, 2941, 2195, 2882, - /* 190 */ 2844, 2195, 2839, 2195, 2195, 2195, 2195, 2537, 2195, 2869, - /* 200 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2638, 2195, 2195, - /* 210 */ 2386, 2589, 2195, 2195, 2195, 2195, 2195, 2925, 2823, 2863, - /* 220 */ 2195, 2873, 2195, 2195, 2195, 2626, 2301, 2195, 2301, 2582, - /* 230 */ 2520, 2195, 2530, 2195, 2530, 2527, 2195, 2195, 2195, 2530, - /* 240 */ 2527, 2527, 2527, 2375, 2371, 2195, 2195, 2369, 2195, 2195, - /* 250 */ 2195, 2195, 2255, 2195, 2255, 2195, 2301, 2301, 2195, 2301, - /* 260 */ 2195, 2195, 2301, 2195, 2301, 2195, 2301, 2195, 2301, 2301, - /* 270 */ 2195, 2301, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 280 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 290 */ 2195, 2624, 2605, 2195, 2299, 2195, 2593, 2591, 2195, 2299, - /* 300 */ 2873, 2195, 2195, 2895, 2890, 2895, 2890, 2909, 2905, 2895, - /* 310 */ 2914, 2911, 2875, 2873, 2856, 2852, 2944, 2931, 2927, 2195, - /* 320 */ 2195, 2861, 2859, 2195, 2299, 2299, 2890, 2195, 2195, 2195, - /* 330 */ 2195, 2890, 2195, 2195, 2299, 2195, 2195, 2299, 2195, 2195, - /* 340 */ 2195, 2195, 2299, 2195, 2299, 2195, 2195, 2195, 2195, 2195, - /* 350 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 360 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2403, 2195, - /* 370 */ 2195, 2299, 2195, 2227, 2229, 2239, 2195, 2584, 2947, 2610, - /* 380 */ 2615, 2565, 2565, 2444, 2444, 2947, 2444, 2302, 2200, 2195, - /* 390 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 400 */ 2195, 2908, 2907, 2744, 2195, 2797, 2796, 2795, 2786, 2743, - /* 410 */ 2399, 2195, 2195, 2195, 2742, 2741, 2195, 2195, 2195, 2195, - /* 420 */ 2390, 2387, 2195, 2195, 2412, 2195, 2195, 2195, 2195, 2556, - /* 430 */ 2555, 2735, 2195, 2195, 2736, 2734, 2733, 2195, 2195, 2195, - /* 440 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 450 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 460 */ 2195, 2195, 2195, 2195, 2195, 2928, 2932, 2195, 2195, 2195, - /* 470 */ 2822, 2195, 2195, 2195, 2714, 2195, 2195, 2195, 2195, 2682, - /* 480 */ 2677, 2668, 2659, 2674, 2665, 2653, 2671, 2662, 2650, 2647, - /* 490 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 500 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 510 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 520 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 530 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 540 */ 2195, 2195, 2195, 2195, 2195, 2195, 2526, 2195, 2195, 2195, - /* 550 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 560 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 570 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 580 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 590 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 600 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 610 */ 2195, 2541, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 620 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 630 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 640 */ 2195, 2195, 2195, 2195, 2195, 2244, 2721, 2195, 2195, 2195, - /* 650 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 660 */ 2724, 2195, 2195, 2725, 2195, 2195, 2195, 2195, 2195, 2195, - /* 670 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 680 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 690 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 700 */ 2195, 2195, 2195, 2195, 2195, 2195, 2346, 2345, 2195, 2195, - /* 710 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 720 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 730 */ 2195, 2195, 2195, 2195, 2195, 2195, 2726, 2195, 2195, 2195, - /* 740 */ 2195, 2609, 2195, 2195, 2716, 2195, 2195, 2195, 2195, 2195, - /* 750 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 760 */ 2195, 2924, 2876, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 770 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 780 */ 2195, 2195, 2195, 2195, 2195, 2714, 2195, 2906, 2195, 2195, - /* 790 */ 2195, 2195, 2195, 2195, 2195, 2922, 2195, 2926, 2195, 2195, - /* 800 */ 2195, 2195, 2195, 2195, 2195, 2832, 2828, 2195, 2195, 2824, - /* 810 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 820 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 830 */ 2783, 2195, 2195, 2195, 2817, 2195, 2195, 2195, 2195, 2440, - /* 840 */ 2439, 2438, 2437, 2195, 2195, 2195, 2195, 2195, 2195, 2726, - /* 850 */ 2195, 2729, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 860 */ 2195, 2713, 2195, 2768, 2767, 2195, 2195, 2195, 2195, 2195, - /* 870 */ 2195, 2195, 2195, 2195, 2195, 2195, 2434, 2195, 2195, 2195, - /* 880 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 890 */ 2195, 2195, 2418, 2416, 2415, 2414, 2195, 2451, 2195, 2195, - /* 900 */ 2195, 2447, 2446, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 910 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 920 */ 2195, 2195, 2320, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 930 */ 2195, 2312, 2195, 2311, 2195, 2195, 2195, 2195, 2195, 2195, - /* 940 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 950 */ 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, - /* 960 */ 2195, 2195, 2195, 2224, 2195, 2195, 2195, 2195, 2195, 2195, - /* 970 */ 2195, 2195, + /* 0 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 10 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 20 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 30 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 40 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 50 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 60 */ 2581, 2205, 2205, 2537, 2205, 2205, 2205, 2205, 2205, 2205, + /* 70 */ 2205, 2205, 2205, 2309, 2205, 2205, 2205, 2205, 2205, 2544, + /* 80 */ 2544, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 90 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 100 */ 2205, 2205, 2311, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 110 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 120 */ 2205, 2833, 2205, 2959, 2622, 2205, 2205, 2862, 2205, 2205, + /* 130 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 140 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2845, + /* 150 */ 2205, 2205, 2282, 2282, 2205, 2845, 2845, 2845, 2805, 2805, + /* 160 */ 2309, 2205, 2205, 2311, 2205, 2624, 2205, 2205, 2205, 2205, + /* 170 */ 2205, 2205, 2205, 2205, 2205, 2453, 2235, 2205, 2205, 2205, + /* 180 */ 2205, 2205, 2205, 2607, 2205, 2205, 2891, 2837, 2838, 2953, + /* 190 */ 2205, 2894, 2856, 2205, 2851, 2205, 2205, 2205, 2205, 2205, + /* 200 */ 2881, 2205, 2205, 2205, 2205, 2205, 2205, 2549, 2205, 2650, + /* 210 */ 2205, 2396, 2601, 2205, 2205, 2205, 2205, 2205, 2937, 2835, + /* 220 */ 2875, 2205, 2205, 2885, 2205, 2205, 2205, 2638, 2311, 2205, + /* 230 */ 2311, 2594, 2532, 2205, 2542, 2205, 2542, 2539, 2205, 2205, + /* 240 */ 2205, 2542, 2539, 2539, 2539, 2385, 2381, 2205, 2205, 2379, + /* 250 */ 2205, 2205, 2205, 2205, 2265, 2205, 2265, 2205, 2311, 2311, + /* 260 */ 2205, 2311, 2205, 2205, 2311, 2205, 2311, 2205, 2311, 2205, + /* 270 */ 2311, 2311, 2205, 2311, 2205, 2205, 2205, 2205, 2205, 2205, + /* 280 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 290 */ 2205, 2205, 2205, 2636, 2617, 2205, 2309, 2205, 2605, 2603, + /* 300 */ 2205, 2309, 2885, 2205, 2205, 2907, 2902, 2907, 2902, 2921, + /* 310 */ 2917, 2907, 2926, 2923, 2887, 2885, 2868, 2864, 2956, 2943, + /* 320 */ 2939, 2205, 2205, 2873, 2871, 2205, 2309, 2309, 2902, 2205, + /* 330 */ 2205, 2205, 2205, 2902, 2205, 2205, 2309, 2205, 2205, 2309, + /* 340 */ 2205, 2205, 2205, 2205, 2309, 2205, 2309, 2205, 2205, 2205, + /* 350 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 360 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 370 */ 2415, 2205, 2205, 2309, 2205, 2237, 2239, 2249, 2205, 2596, + /* 380 */ 2959, 2622, 2627, 2577, 2577, 2456, 2456, 2959, 2456, 2312, + /* 390 */ 2210, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 400 */ 2205, 2205, 2205, 2920, 2919, 2756, 2205, 2809, 2808, 2807, + /* 410 */ 2798, 2755, 2410, 2205, 2205, 2205, 2754, 2753, 2205, 2205, + /* 420 */ 2205, 2205, 2400, 2397, 2205, 2205, 2424, 2205, 2205, 2205, + /* 430 */ 2205, 2568, 2567, 2747, 2205, 2205, 2748, 2746, 2745, 2205, + /* 440 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 450 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 460 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2940, 2944, 2205, + /* 470 */ 2205, 2205, 2834, 2205, 2205, 2205, 2726, 2205, 2205, 2205, + /* 480 */ 2205, 2205, 2694, 2689, 2680, 2671, 2686, 2677, 2665, 2683, + /* 490 */ 2674, 2662, 2659, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 500 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 510 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 520 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 530 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 540 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2538, + /* 550 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 560 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 570 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 580 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 590 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 600 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 610 */ 2205, 2205, 2205, 2205, 2553, 2205, 2205, 2205, 2205, 2205, + /* 620 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 630 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 640 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2254, 2733, + /* 650 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 660 */ 2205, 2205, 2205, 2736, 2205, 2205, 2737, 2205, 2205, 2205, + /* 670 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 680 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 690 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 700 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2356, + /* 710 */ 2355, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 720 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 730 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2738, + /* 740 */ 2205, 2205, 2205, 2205, 2621, 2205, 2205, 2728, 2205, 2205, + /* 750 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 760 */ 2205, 2205, 2205, 2205, 2936, 2888, 2205, 2205, 2205, 2205, + /* 770 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 780 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2726, 2205, + /* 790 */ 2918, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2934, 2205, + /* 800 */ 2938, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2844, 2840, + /* 810 */ 2205, 2205, 2836, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 820 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 830 */ 2205, 2205, 2205, 2795, 2205, 2205, 2205, 2829, 2205, 2205, + /* 840 */ 2205, 2205, 2452, 2451, 2450, 2449, 2205, 2205, 2205, 2205, + /* 850 */ 2205, 2205, 2738, 2205, 2741, 2205, 2205, 2205, 2205, 2205, + /* 860 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2725, 2205, 2780, + /* 870 */ 2779, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 880 */ 2205, 2205, 2446, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 890 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2430, 2428, + /* 900 */ 2427, 2426, 2205, 2463, 2205, 2205, 2205, 2459, 2458, 2205, + /* 910 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 920 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2330, 2205, + /* 930 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2322, 2205, 2321, + /* 940 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 950 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 960 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2234, + /* 970 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1628,7 +1644,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 327, /* END => ABORT */ + 328, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1641,6 +1657,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_EQ => nothing */ 0, /* USING => nothing */ 0, /* TAGS => nothing */ + 328, /* FILE => ABORT */ 0, /* BOOL => nothing */ 0, /* TINYINT => nothing */ 0, /* SMALLINT => nothing */ @@ -1700,7 +1717,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* VNODES => nothing */ 0, /* ALIVE => nothing */ 0, /* VIEWS => nothing */ - 327, /* VIEW => ABORT */ + 328, /* VIEW => ABORT */ 0, /* COMPACTS => nothing */ 0, /* NORMAL => nothing */ 0, /* CHILD => nothing */ @@ -1743,7 +1760,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* PAUSE => nothing */ 0, /* RESUME => nothing */ 0, /* PRIMARY => nothing */ - 327, /* KEY => ABORT */ + 328, /* KEY => ABORT */ 0, /* TRIGGER => nothing */ 0, /* AT_ONCE => nothing */ 0, /* WINDOW_CLOSE => nothing */ @@ -1807,7 +1824,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* LEFT => nothing */ 0, /* RIGHT => nothing */ 0, /* OUTER => nothing */ - 327, /* SEMI => ABORT */ + 328, /* SEMI => ABORT */ 0, /* ANTI => nothing */ 0, /* ASOF => nothing */ 0, /* WINDOW => nothing */ @@ -1843,53 +1860,52 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 327, /* AFTER => ABORT */ - 327, /* ATTACH => ABORT */ - 327, /* BEFORE => ABORT */ - 327, /* BEGIN => ABORT */ - 327, /* BITAND => ABORT */ - 327, /* BITNOT => ABORT */ - 327, /* BITOR => ABORT */ - 327, /* BLOCKS => ABORT */ - 327, /* CHANGE => ABORT */ - 327, /* COMMA => ABORT */ - 327, /* CONCAT => ABORT */ - 327, /* CONFLICT => ABORT */ - 327, /* COPY => ABORT */ - 327, /* DEFERRED => ABORT */ - 327, /* DELIMITERS => ABORT */ - 327, /* DETACH => ABORT */ - 327, /* DIVIDE => ABORT */ - 327, /* DOT => ABORT */ - 327, /* EACH => ABORT */ - 327, /* FAIL => ABORT */ - 327, /* FILE => ABORT */ - 327, /* FOR => ABORT */ - 327, /* GLOB => ABORT */ - 327, /* ID => ABORT */ - 327, /* IMMEDIATE => ABORT */ - 327, /* IMPORT => ABORT */ - 327, /* INITIALLY => ABORT */ - 327, /* INSTEAD => ABORT */ - 327, /* ISNULL => ABORT */ - 327, /* MODULES => ABORT */ - 327, /* NK_BITNOT => ABORT */ - 327, /* NK_SEMI => ABORT */ - 327, /* NOTNULL => ABORT */ - 327, /* OF => ABORT */ - 327, /* PLUS => ABORT */ - 327, /* PRIVILEGE => ABORT */ - 327, /* RAISE => ABORT */ - 327, /* RESTRICT => ABORT */ - 327, /* ROW => ABORT */ - 327, /* STAR => ABORT */ - 327, /* STATEMENT => ABORT */ - 327, /* STRICT => ABORT */ - 327, /* STRING => ABORT */ - 327, /* TIMES => ABORT */ - 327, /* VALUES => ABORT */ - 327, /* VARIABLE => ABORT */ - 327, /* WAL => ABORT */ + 328, /* AFTER => ABORT */ + 328, /* ATTACH => ABORT */ + 328, /* BEFORE => ABORT */ + 328, /* BEGIN => ABORT */ + 328, /* BITAND => ABORT */ + 328, /* BITNOT => ABORT */ + 328, /* BITOR => ABORT */ + 328, /* BLOCKS => ABORT */ + 328, /* CHANGE => ABORT */ + 328, /* COMMA => ABORT */ + 328, /* CONCAT => ABORT */ + 328, /* CONFLICT => ABORT */ + 328, /* COPY => ABORT */ + 328, /* DEFERRED => ABORT */ + 328, /* DELIMITERS => ABORT */ + 328, /* DETACH => ABORT */ + 328, /* DIVIDE => ABORT */ + 328, /* DOT => ABORT */ + 328, /* EACH => ABORT */ + 328, /* FAIL => ABORT */ + 328, /* FOR => ABORT */ + 328, /* GLOB => ABORT */ + 328, /* ID => ABORT */ + 328, /* IMMEDIATE => ABORT */ + 328, /* IMPORT => ABORT */ + 328, /* INITIALLY => ABORT */ + 328, /* INSTEAD => ABORT */ + 328, /* ISNULL => ABORT */ + 328, /* MODULES => ABORT */ + 328, /* NK_BITNOT => ABORT */ + 328, /* NK_SEMI => ABORT */ + 328, /* NOTNULL => ABORT */ + 328, /* OF => ABORT */ + 328, /* PLUS => ABORT */ + 328, /* PRIVILEGE => ABORT */ + 328, /* RAISE => ABORT */ + 328, /* RESTRICT => ABORT */ + 328, /* ROW => ABORT */ + 328, /* STAR => ABORT */ + 328, /* STATEMENT => ABORT */ + 328, /* STRICT => ABORT */ + 328, /* STRING => ABORT */ + 328, /* TIMES => ABORT */ + 328, /* VALUES => ABORT */ + 328, /* VARIABLE => ABORT */ + 328, /* WAL => ABORT */ 0, /* ENCODE => nothing */ 0, /* COMPRESS => nothing */ 0, /* LEVEL => nothing */ @@ -2107,229 +2123,229 @@ static const char *const yyTokenName[] = { /* 123 */ "NK_EQ", /* 124 */ "USING", /* 125 */ "TAGS", - /* 126 */ "BOOL", - /* 127 */ "TINYINT", - /* 128 */ "SMALLINT", - /* 129 */ "INT", - /* 130 */ "INTEGER", - /* 131 */ "BIGINT", - /* 132 */ "FLOAT", - /* 133 */ "DOUBLE", - /* 134 */ "BINARY", - /* 135 */ "NCHAR", - /* 136 */ "UNSIGNED", - /* 137 */ "JSON", - /* 138 */ "VARCHAR", - /* 139 */ "MEDIUMBLOB", - /* 140 */ "BLOB", - /* 141 */ "VARBINARY", - /* 142 */ "GEOMETRY", - /* 143 */ "DECIMAL", - /* 144 */ "COMMENT", - /* 145 */ "MAX_DELAY", - /* 146 */ "WATERMARK", - /* 147 */ "ROLLUP", - /* 148 */ "TTL", - /* 149 */ "SMA", - /* 150 */ "DELETE_MARK", - /* 151 */ "FIRST", - /* 152 */ "LAST", - /* 153 */ "SHOW", - /* 154 */ "FULL", - /* 155 */ "PRIVILEGES", - /* 156 */ "DATABASES", - /* 157 */ "TABLES", - /* 158 */ "STABLES", - /* 159 */ "MNODES", - /* 160 */ "QNODES", - /* 161 */ "ARBGROUPS", - /* 162 */ "FUNCTIONS", - /* 163 */ "INDEXES", - /* 164 */ "ACCOUNTS", - /* 165 */ "APPS", - /* 166 */ "CONNECTIONS", - /* 167 */ "LICENCES", - /* 168 */ "GRANTS", - /* 169 */ "LOGS", - /* 170 */ "MACHINES", - /* 171 */ "ENCRYPTIONS", - /* 172 */ "QUERIES", - /* 173 */ "SCORES", - /* 174 */ "TOPICS", - /* 175 */ "VARIABLES", - /* 176 */ "BNODES", - /* 177 */ "SNODES", - /* 178 */ "TRANSACTIONS", - /* 179 */ "DISTRIBUTED", - /* 180 */ "CONSUMERS", - /* 181 */ "SUBSCRIPTIONS", - /* 182 */ "VNODES", - /* 183 */ "ALIVE", - /* 184 */ "VIEWS", - /* 185 */ "VIEW", - /* 186 */ "COMPACTS", - /* 187 */ "NORMAL", - /* 188 */ "CHILD", - /* 189 */ "LIKE", - /* 190 */ "TBNAME", - /* 191 */ "QTAGS", - /* 192 */ "AS", - /* 193 */ "SYSTEM", - /* 194 */ "TSMA", - /* 195 */ "INTERVAL", - /* 196 */ "RECURSIVE", - /* 197 */ "TSMAS", - /* 198 */ "FUNCTION", - /* 199 */ "INDEX", - /* 200 */ "COUNT", - /* 201 */ "LAST_ROW", - /* 202 */ "META", - /* 203 */ "ONLY", - /* 204 */ "TOPIC", - /* 205 */ "CONSUMER", - /* 206 */ "GROUP", - /* 207 */ "DESC", - /* 208 */ "DESCRIBE", - /* 209 */ "RESET", - /* 210 */ "QUERY", - /* 211 */ "CACHE", - /* 212 */ "EXPLAIN", - /* 213 */ "ANALYZE", - /* 214 */ "VERBOSE", - /* 215 */ "NK_BOOL", - /* 216 */ "RATIO", - /* 217 */ "NK_FLOAT", - /* 218 */ "OUTPUTTYPE", - /* 219 */ "AGGREGATE", - /* 220 */ "BUFSIZE", - /* 221 */ "LANGUAGE", - /* 222 */ "REPLACE", - /* 223 */ "STREAM", - /* 224 */ "INTO", - /* 225 */ "PAUSE", - /* 226 */ "RESUME", - /* 227 */ "PRIMARY", - /* 228 */ "KEY", - /* 229 */ "TRIGGER", - /* 230 */ "AT_ONCE", - /* 231 */ "WINDOW_CLOSE", - /* 232 */ "IGNORE", - /* 233 */ "EXPIRED", - /* 234 */ "FILL_HISTORY", - /* 235 */ "UPDATE", - /* 236 */ "SUBTABLE", - /* 237 */ "UNTREATED", - /* 238 */ "KILL", - /* 239 */ "CONNECTION", - /* 240 */ "TRANSACTION", - /* 241 */ "BALANCE", - /* 242 */ "VGROUP", - /* 243 */ "LEADER", - /* 244 */ "MERGE", - /* 245 */ "REDISTRIBUTE", - /* 246 */ "SPLIT", - /* 247 */ "DELETE", - /* 248 */ "INSERT", - /* 249 */ "NK_BIN", - /* 250 */ "NK_HEX", - /* 251 */ "NULL", - /* 252 */ "NK_QUESTION", - /* 253 */ "NK_ALIAS", - /* 254 */ "NK_ARROW", - /* 255 */ "ROWTS", - /* 256 */ "QSTART", - /* 257 */ "QEND", - /* 258 */ "QDURATION", - /* 259 */ "WSTART", - /* 260 */ "WEND", - /* 261 */ "WDURATION", - /* 262 */ "IROWTS", - /* 263 */ "ISFILLED", - /* 264 */ "CAST", - /* 265 */ "NOW", - /* 266 */ "TODAY", - /* 267 */ "TIMEZONE", - /* 268 */ "CLIENT_VERSION", - /* 269 */ "SERVER_VERSION", - /* 270 */ "SERVER_STATUS", - /* 271 */ "CURRENT_USER", - /* 272 */ "CASE", - /* 273 */ "WHEN", - /* 274 */ "THEN", - /* 275 */ "ELSE", - /* 276 */ "BETWEEN", - /* 277 */ "IS", - /* 278 */ "NK_LT", - /* 279 */ "NK_GT", - /* 280 */ "NK_LE", - /* 281 */ "NK_GE", - /* 282 */ "NK_NE", - /* 283 */ "MATCH", - /* 284 */ "NMATCH", - /* 285 */ "CONTAINS", - /* 286 */ "IN", - /* 287 */ "JOIN", - /* 288 */ "INNER", - /* 289 */ "LEFT", - /* 290 */ "RIGHT", - /* 291 */ "OUTER", - /* 292 */ "SEMI", - /* 293 */ "ANTI", - /* 294 */ "ASOF", - /* 295 */ "WINDOW", - /* 296 */ "WINDOW_OFFSET", - /* 297 */ "JLIMIT", - /* 298 */ "SELECT", - /* 299 */ "NK_HINT", - /* 300 */ "DISTINCT", - /* 301 */ "WHERE", - /* 302 */ "PARTITION", - /* 303 */ "BY", - /* 304 */ "SESSION", - /* 305 */ "STATE_WINDOW", - /* 306 */ "EVENT_WINDOW", - /* 307 */ "COUNT_WINDOW", - /* 308 */ "SLIDING", - /* 309 */ "FILL", - /* 310 */ "VALUE", - /* 311 */ "VALUE_F", - /* 312 */ "NONE", - /* 313 */ "PREV", - /* 314 */ "NULL_F", - /* 315 */ "LINEAR", - /* 316 */ "NEXT", - /* 317 */ "HAVING", - /* 318 */ "RANGE", - /* 319 */ "EVERY", - /* 320 */ "ORDER", - /* 321 */ "SLIMIT", - /* 322 */ "SOFFSET", - /* 323 */ "LIMIT", - /* 324 */ "OFFSET", - /* 325 */ "ASC", - /* 326 */ "NULLS", - /* 327 */ "ABORT", - /* 328 */ "AFTER", - /* 329 */ "ATTACH", - /* 330 */ "BEFORE", - /* 331 */ "BEGIN", - /* 332 */ "BITAND", - /* 333 */ "BITNOT", - /* 334 */ "BITOR", - /* 335 */ "BLOCKS", - /* 336 */ "CHANGE", - /* 337 */ "COMMA", - /* 338 */ "CONCAT", - /* 339 */ "CONFLICT", - /* 340 */ "COPY", - /* 341 */ "DEFERRED", - /* 342 */ "DELIMITERS", - /* 343 */ "DETACH", - /* 344 */ "DIVIDE", - /* 345 */ "DOT", - /* 346 */ "EACH", - /* 347 */ "FAIL", - /* 348 */ "FILE", + /* 126 */ "FILE", + /* 127 */ "BOOL", + /* 128 */ "TINYINT", + /* 129 */ "SMALLINT", + /* 130 */ "INT", + /* 131 */ "INTEGER", + /* 132 */ "BIGINT", + /* 133 */ "FLOAT", + /* 134 */ "DOUBLE", + /* 135 */ "BINARY", + /* 136 */ "NCHAR", + /* 137 */ "UNSIGNED", + /* 138 */ "JSON", + /* 139 */ "VARCHAR", + /* 140 */ "MEDIUMBLOB", + /* 141 */ "BLOB", + /* 142 */ "VARBINARY", + /* 143 */ "GEOMETRY", + /* 144 */ "DECIMAL", + /* 145 */ "COMMENT", + /* 146 */ "MAX_DELAY", + /* 147 */ "WATERMARK", + /* 148 */ "ROLLUP", + /* 149 */ "TTL", + /* 150 */ "SMA", + /* 151 */ "DELETE_MARK", + /* 152 */ "FIRST", + /* 153 */ "LAST", + /* 154 */ "SHOW", + /* 155 */ "FULL", + /* 156 */ "PRIVILEGES", + /* 157 */ "DATABASES", + /* 158 */ "TABLES", + /* 159 */ "STABLES", + /* 160 */ "MNODES", + /* 161 */ "QNODES", + /* 162 */ "ARBGROUPS", + /* 163 */ "FUNCTIONS", + /* 164 */ "INDEXES", + /* 165 */ "ACCOUNTS", + /* 166 */ "APPS", + /* 167 */ "CONNECTIONS", + /* 168 */ "LICENCES", + /* 169 */ "GRANTS", + /* 170 */ "LOGS", + /* 171 */ "MACHINES", + /* 172 */ "ENCRYPTIONS", + /* 173 */ "QUERIES", + /* 174 */ "SCORES", + /* 175 */ "TOPICS", + /* 176 */ "VARIABLES", + /* 177 */ "BNODES", + /* 178 */ "SNODES", + /* 179 */ "TRANSACTIONS", + /* 180 */ "DISTRIBUTED", + /* 181 */ "CONSUMERS", + /* 182 */ "SUBSCRIPTIONS", + /* 183 */ "VNODES", + /* 184 */ "ALIVE", + /* 185 */ "VIEWS", + /* 186 */ "VIEW", + /* 187 */ "COMPACTS", + /* 188 */ "NORMAL", + /* 189 */ "CHILD", + /* 190 */ "LIKE", + /* 191 */ "TBNAME", + /* 192 */ "QTAGS", + /* 193 */ "AS", + /* 194 */ "SYSTEM", + /* 195 */ "TSMA", + /* 196 */ "INTERVAL", + /* 197 */ "RECURSIVE", + /* 198 */ "TSMAS", + /* 199 */ "FUNCTION", + /* 200 */ "INDEX", + /* 201 */ "COUNT", + /* 202 */ "LAST_ROW", + /* 203 */ "META", + /* 204 */ "ONLY", + /* 205 */ "TOPIC", + /* 206 */ "CONSUMER", + /* 207 */ "GROUP", + /* 208 */ "DESC", + /* 209 */ "DESCRIBE", + /* 210 */ "RESET", + /* 211 */ "QUERY", + /* 212 */ "CACHE", + /* 213 */ "EXPLAIN", + /* 214 */ "ANALYZE", + /* 215 */ "VERBOSE", + /* 216 */ "NK_BOOL", + /* 217 */ "RATIO", + /* 218 */ "NK_FLOAT", + /* 219 */ "OUTPUTTYPE", + /* 220 */ "AGGREGATE", + /* 221 */ "BUFSIZE", + /* 222 */ "LANGUAGE", + /* 223 */ "REPLACE", + /* 224 */ "STREAM", + /* 225 */ "INTO", + /* 226 */ "PAUSE", + /* 227 */ "RESUME", + /* 228 */ "PRIMARY", + /* 229 */ "KEY", + /* 230 */ "TRIGGER", + /* 231 */ "AT_ONCE", + /* 232 */ "WINDOW_CLOSE", + /* 233 */ "IGNORE", + /* 234 */ "EXPIRED", + /* 235 */ "FILL_HISTORY", + /* 236 */ "UPDATE", + /* 237 */ "SUBTABLE", + /* 238 */ "UNTREATED", + /* 239 */ "KILL", + /* 240 */ "CONNECTION", + /* 241 */ "TRANSACTION", + /* 242 */ "BALANCE", + /* 243 */ "VGROUP", + /* 244 */ "LEADER", + /* 245 */ "MERGE", + /* 246 */ "REDISTRIBUTE", + /* 247 */ "SPLIT", + /* 248 */ "DELETE", + /* 249 */ "INSERT", + /* 250 */ "NK_BIN", + /* 251 */ "NK_HEX", + /* 252 */ "NULL", + /* 253 */ "NK_QUESTION", + /* 254 */ "NK_ALIAS", + /* 255 */ "NK_ARROW", + /* 256 */ "ROWTS", + /* 257 */ "QSTART", + /* 258 */ "QEND", + /* 259 */ "QDURATION", + /* 260 */ "WSTART", + /* 261 */ "WEND", + /* 262 */ "WDURATION", + /* 263 */ "IROWTS", + /* 264 */ "ISFILLED", + /* 265 */ "CAST", + /* 266 */ "NOW", + /* 267 */ "TODAY", + /* 268 */ "TIMEZONE", + /* 269 */ "CLIENT_VERSION", + /* 270 */ "SERVER_VERSION", + /* 271 */ "SERVER_STATUS", + /* 272 */ "CURRENT_USER", + /* 273 */ "CASE", + /* 274 */ "WHEN", + /* 275 */ "THEN", + /* 276 */ "ELSE", + /* 277 */ "BETWEEN", + /* 278 */ "IS", + /* 279 */ "NK_LT", + /* 280 */ "NK_GT", + /* 281 */ "NK_LE", + /* 282 */ "NK_GE", + /* 283 */ "NK_NE", + /* 284 */ "MATCH", + /* 285 */ "NMATCH", + /* 286 */ "CONTAINS", + /* 287 */ "IN", + /* 288 */ "JOIN", + /* 289 */ "INNER", + /* 290 */ "LEFT", + /* 291 */ "RIGHT", + /* 292 */ "OUTER", + /* 293 */ "SEMI", + /* 294 */ "ANTI", + /* 295 */ "ASOF", + /* 296 */ "WINDOW", + /* 297 */ "WINDOW_OFFSET", + /* 298 */ "JLIMIT", + /* 299 */ "SELECT", + /* 300 */ "NK_HINT", + /* 301 */ "DISTINCT", + /* 302 */ "WHERE", + /* 303 */ "PARTITION", + /* 304 */ "BY", + /* 305 */ "SESSION", + /* 306 */ "STATE_WINDOW", + /* 307 */ "EVENT_WINDOW", + /* 308 */ "COUNT_WINDOW", + /* 309 */ "SLIDING", + /* 310 */ "FILL", + /* 311 */ "VALUE", + /* 312 */ "VALUE_F", + /* 313 */ "NONE", + /* 314 */ "PREV", + /* 315 */ "NULL_F", + /* 316 */ "LINEAR", + /* 317 */ "NEXT", + /* 318 */ "HAVING", + /* 319 */ "RANGE", + /* 320 */ "EVERY", + /* 321 */ "ORDER", + /* 322 */ "SLIMIT", + /* 323 */ "SOFFSET", + /* 324 */ "LIMIT", + /* 325 */ "OFFSET", + /* 326 */ "ASC", + /* 327 */ "NULLS", + /* 328 */ "ABORT", + /* 329 */ "AFTER", + /* 330 */ "ATTACH", + /* 331 */ "BEFORE", + /* 332 */ "BEGIN", + /* 333 */ "BITAND", + /* 334 */ "BITNOT", + /* 335 */ "BITOR", + /* 336 */ "BLOCKS", + /* 337 */ "CHANGE", + /* 338 */ "COMMA", + /* 339 */ "CONCAT", + /* 340 */ "CONFLICT", + /* 341 */ "COPY", + /* 342 */ "DEFERRED", + /* 343 */ "DELIMITERS", + /* 344 */ "DETACH", + /* 345 */ "DIVIDE", + /* 346 */ "DOT", + /* 347 */ "EACH", + /* 348 */ "FAIL", /* 349 */ "FOR", /* 350 */ "GLOB", /* 351 */ "ID", @@ -2410,135 +2426,136 @@ static const char *const yyTokenName[] = { /* 426 */ "column_options", /* 427 */ "tags_literal", /* 428 */ "create_subtable_clause", - /* 429 */ "specific_cols_opt", - /* 430 */ "tags_literal_list", - /* 431 */ "drop_table_clause", - /* 432 */ "col_name_list", - /* 433 */ "tag_def_list", - /* 434 */ "tag_def", - /* 435 */ "column_def", - /* 436 */ "type_name_default_len", - /* 437 */ "duration_list", - /* 438 */ "rollup_func_list", - /* 439 */ "alter_table_option", - /* 440 */ "duration_literal", - /* 441 */ "rollup_func_name", - /* 442 */ "function_name", - /* 443 */ "col_name", - /* 444 */ "db_kind_opt", - /* 445 */ "table_kind_db_name_cond_opt", - /* 446 */ "like_pattern_opt", - /* 447 */ "db_name_cond_opt", - /* 448 */ "table_name_cond", - /* 449 */ "from_db_opt", - /* 450 */ "tag_list_opt", - /* 451 */ "table_kind", - /* 452 */ "tag_item", - /* 453 */ "column_alias", - /* 454 */ "tsma_name", - /* 455 */ "tsma_func_list", - /* 456 */ "full_tsma_name", - /* 457 */ "func_list", - /* 458 */ "index_options", - /* 459 */ "full_index_name", - /* 460 */ "index_name", - /* 461 */ "sliding_opt", - /* 462 */ "sma_stream_opt", - /* 463 */ "func", - /* 464 */ "sma_func_name", - /* 465 */ "expression_list", - /* 466 */ "with_meta", - /* 467 */ "query_or_subquery", - /* 468 */ "where_clause_opt", - /* 469 */ "cgroup_name", - /* 470 */ "analyze_opt", - /* 471 */ "explain_options", - /* 472 */ "insert_query", - /* 473 */ "or_replace_opt", - /* 474 */ "agg_func_opt", - /* 475 */ "bufsize_opt", - /* 476 */ "language_opt", - /* 477 */ "full_view_name", - /* 478 */ "view_name", - /* 479 */ "stream_name", - /* 480 */ "stream_options", - /* 481 */ "col_list_opt", - /* 482 */ "tag_def_or_ref_opt", - /* 483 */ "subtable_opt", - /* 484 */ "ignore_opt", - /* 485 */ "column_stream_def_list", - /* 486 */ "column_stream_def", - /* 487 */ "stream_col_options", - /* 488 */ "expression", - /* 489 */ "on_vgroup_id", - /* 490 */ "dnode_list", - /* 491 */ "literal_func", - /* 492 */ "signed_literal", - /* 493 */ "literal_list", - /* 494 */ "table_alias", - /* 495 */ "expr_or_subquery", - /* 496 */ "pseudo_column", - /* 497 */ "column_reference", - /* 498 */ "function_expression", - /* 499 */ "case_when_expression", - /* 500 */ "star_func", - /* 501 */ "star_func_para_list", - /* 502 */ "noarg_func", - /* 503 */ "other_para_list", - /* 504 */ "star_func_para", - /* 505 */ "when_then_list", - /* 506 */ "case_when_else_opt", - /* 507 */ "common_expression", - /* 508 */ "when_then_expr", - /* 509 */ "predicate", - /* 510 */ "compare_op", - /* 511 */ "in_op", - /* 512 */ "in_predicate_value", - /* 513 */ "boolean_value_expression", - /* 514 */ "boolean_primary", - /* 515 */ "from_clause_opt", - /* 516 */ "table_reference_list", - /* 517 */ "table_reference", - /* 518 */ "table_primary", - /* 519 */ "joined_table", - /* 520 */ "alias_opt", - /* 521 */ "subquery", - /* 522 */ "parenthesized_joined_table", - /* 523 */ "join_type", - /* 524 */ "join_subtype", - /* 525 */ "join_on_clause_opt", - /* 526 */ "window_offset_clause_opt", - /* 527 */ "jlimit_clause_opt", - /* 528 */ "window_offset_literal", - /* 529 */ "query_specification", - /* 530 */ "hint_list", - /* 531 */ "set_quantifier_opt", - /* 532 */ "tag_mode_opt", - /* 533 */ "select_list", - /* 534 */ "partition_by_clause_opt", - /* 535 */ "range_opt", - /* 536 */ "every_opt", - /* 537 */ "fill_opt", - /* 538 */ "twindow_clause_opt", - /* 539 */ "group_by_clause_opt", - /* 540 */ "having_clause_opt", - /* 541 */ "select_item", - /* 542 */ "partition_list", - /* 543 */ "partition_item", - /* 544 */ "interval_sliding_duration_literal", - /* 545 */ "fill_mode", - /* 546 */ "group_by_list", - /* 547 */ "query_expression", - /* 548 */ "query_simple", - /* 549 */ "order_by_clause_opt", - /* 550 */ "slimit_clause_opt", - /* 551 */ "limit_clause_opt", - /* 552 */ "union_query_expression", - /* 553 */ "query_simple_or_subquery", - /* 554 */ "sort_specification_list", - /* 555 */ "sort_specification", - /* 556 */ "ordering_specification_opt", - /* 557 */ "null_ordering_opt", + /* 429 */ "create_from_file_clause", + /* 430 */ "specific_cols_opt", + /* 431 */ "tags_literal_list", + /* 432 */ "tag_list_opt", + /* 433 */ "drop_table_clause", + /* 434 */ "col_name_list", + /* 435 */ "tag_def_list", + /* 436 */ "tag_def", + /* 437 */ "column_def", + /* 438 */ "type_name_default_len", + /* 439 */ "duration_list", + /* 440 */ "rollup_func_list", + /* 441 */ "alter_table_option", + /* 442 */ "duration_literal", + /* 443 */ "rollup_func_name", + /* 444 */ "function_name", + /* 445 */ "col_name", + /* 446 */ "db_kind_opt", + /* 447 */ "table_kind_db_name_cond_opt", + /* 448 */ "like_pattern_opt", + /* 449 */ "db_name_cond_opt", + /* 450 */ "table_name_cond", + /* 451 */ "from_db_opt", + /* 452 */ "table_kind", + /* 453 */ "tag_item", + /* 454 */ "column_alias", + /* 455 */ "tsma_name", + /* 456 */ "tsma_func_list", + /* 457 */ "full_tsma_name", + /* 458 */ "func_list", + /* 459 */ "index_options", + /* 460 */ "full_index_name", + /* 461 */ "index_name", + /* 462 */ "sliding_opt", + /* 463 */ "sma_stream_opt", + /* 464 */ "func", + /* 465 */ "sma_func_name", + /* 466 */ "expression_list", + /* 467 */ "with_meta", + /* 468 */ "query_or_subquery", + /* 469 */ "where_clause_opt", + /* 470 */ "cgroup_name", + /* 471 */ "analyze_opt", + /* 472 */ "explain_options", + /* 473 */ "insert_query", + /* 474 */ "or_replace_opt", + /* 475 */ "agg_func_opt", + /* 476 */ "bufsize_opt", + /* 477 */ "language_opt", + /* 478 */ "full_view_name", + /* 479 */ "view_name", + /* 480 */ "stream_name", + /* 481 */ "stream_options", + /* 482 */ "col_list_opt", + /* 483 */ "tag_def_or_ref_opt", + /* 484 */ "subtable_opt", + /* 485 */ "ignore_opt", + /* 486 */ "column_stream_def_list", + /* 487 */ "column_stream_def", + /* 488 */ "stream_col_options", + /* 489 */ "expression", + /* 490 */ "on_vgroup_id", + /* 491 */ "dnode_list", + /* 492 */ "literal_func", + /* 493 */ "signed_literal", + /* 494 */ "literal_list", + /* 495 */ "table_alias", + /* 496 */ "expr_or_subquery", + /* 497 */ "pseudo_column", + /* 498 */ "column_reference", + /* 499 */ "function_expression", + /* 500 */ "case_when_expression", + /* 501 */ "star_func", + /* 502 */ "star_func_para_list", + /* 503 */ "noarg_func", + /* 504 */ "other_para_list", + /* 505 */ "star_func_para", + /* 506 */ "when_then_list", + /* 507 */ "case_when_else_opt", + /* 508 */ "common_expression", + /* 509 */ "when_then_expr", + /* 510 */ "predicate", + /* 511 */ "compare_op", + /* 512 */ "in_op", + /* 513 */ "in_predicate_value", + /* 514 */ "boolean_value_expression", + /* 515 */ "boolean_primary", + /* 516 */ "from_clause_opt", + /* 517 */ "table_reference_list", + /* 518 */ "table_reference", + /* 519 */ "table_primary", + /* 520 */ "joined_table", + /* 521 */ "alias_opt", + /* 522 */ "subquery", + /* 523 */ "parenthesized_joined_table", + /* 524 */ "join_type", + /* 525 */ "join_subtype", + /* 526 */ "join_on_clause_opt", + /* 527 */ "window_offset_clause_opt", + /* 528 */ "jlimit_clause_opt", + /* 529 */ "window_offset_literal", + /* 530 */ "query_specification", + /* 531 */ "hint_list", + /* 532 */ "set_quantifier_opt", + /* 533 */ "tag_mode_opt", + /* 534 */ "select_list", + /* 535 */ "partition_by_clause_opt", + /* 536 */ "range_opt", + /* 537 */ "every_opt", + /* 538 */ "fill_opt", + /* 539 */ "twindow_clause_opt", + /* 540 */ "group_by_clause_opt", + /* 541 */ "having_clause_opt", + /* 542 */ "select_item", + /* 543 */ "partition_list", + /* 544 */ "partition_item", + /* 545 */ "interval_sliding_duration_literal", + /* 546 */ "fill_mode", + /* 547 */ "group_by_list", + /* 548 */ "query_expression", + /* 549 */ "query_simple", + /* 550 */ "order_by_clause_opt", + /* 551 */ "slimit_clause_opt", + /* 552 */ "limit_clause_opt", + /* 553 */ "union_query_expression", + /* 554 */ "query_simple_or_subquery", + /* 555 */ "sort_specification_list", + /* 556 */ "sort_specification", + /* 557 */ "ordering_specification_opt", + /* 558 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2747,559 +2764,561 @@ static const char *const yyRuleName[] = { /* 198 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", /* 199 */ "multi_create_clause ::= create_subtable_clause", /* 200 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 201 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", - /* 202 */ "multi_drop_clause ::= drop_table_clause", - /* 203 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 204 */ "drop_table_clause ::= exists_opt full_table_name", - /* 205 */ "specific_cols_opt ::=", - /* 206 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 207 */ "full_table_name ::= table_name", - /* 208 */ "full_table_name ::= db_name NK_DOT table_name", - /* 209 */ "tag_def_list ::= tag_def", - /* 210 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", - /* 211 */ "tag_def ::= column_name type_name", - /* 212 */ "column_def_list ::= column_def", - /* 213 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 214 */ "column_def ::= column_name type_name column_options", - /* 215 */ "type_name ::= BOOL", - /* 216 */ "type_name ::= TINYINT", - /* 217 */ "type_name ::= SMALLINT", - /* 218 */ "type_name ::= INT", - /* 219 */ "type_name ::= INTEGER", - /* 220 */ "type_name ::= BIGINT", - /* 221 */ "type_name ::= FLOAT", - /* 222 */ "type_name ::= DOUBLE", - /* 223 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 224 */ "type_name ::= TIMESTAMP", - /* 225 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 226 */ "type_name ::= TINYINT UNSIGNED", - /* 227 */ "type_name ::= SMALLINT UNSIGNED", - /* 228 */ "type_name ::= INT UNSIGNED", - /* 229 */ "type_name ::= BIGINT UNSIGNED", - /* 230 */ "type_name ::= JSON", - /* 231 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 232 */ "type_name ::= MEDIUMBLOB", - /* 233 */ "type_name ::= BLOB", - /* 234 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 235 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 236 */ "type_name ::= DECIMAL", - /* 237 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 238 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 239 */ "type_name_default_len ::= BINARY", - /* 240 */ "type_name_default_len ::= NCHAR", - /* 241 */ "type_name_default_len ::= VARCHAR", - /* 242 */ "type_name_default_len ::= VARBINARY", - /* 243 */ "tags_def_opt ::=", - /* 244 */ "tags_def_opt ::= tags_def", - /* 245 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", - /* 246 */ "table_options ::=", - /* 247 */ "table_options ::= table_options COMMENT NK_STRING", - /* 248 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 249 */ "table_options ::= table_options WATERMARK duration_list", - /* 250 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 251 */ "table_options ::= table_options TTL NK_INTEGER", - /* 252 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 253 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 254 */ "alter_table_options ::= alter_table_option", - /* 255 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 256 */ "alter_table_option ::= COMMENT NK_STRING", - /* 257 */ "alter_table_option ::= TTL NK_INTEGER", - /* 258 */ "duration_list ::= duration_literal", - /* 259 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 260 */ "rollup_func_list ::= rollup_func_name", - /* 261 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 262 */ "rollup_func_name ::= function_name", - /* 263 */ "rollup_func_name ::= FIRST", - /* 264 */ "rollup_func_name ::= LAST", - /* 265 */ "col_name_list ::= col_name", - /* 266 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 267 */ "col_name ::= column_name", - /* 268 */ "cmd ::= SHOW DNODES", - /* 269 */ "cmd ::= SHOW USERS", - /* 270 */ "cmd ::= SHOW USERS FULL", - /* 271 */ "cmd ::= SHOW USER PRIVILEGES", - /* 272 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 273 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 274 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 275 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 276 */ "cmd ::= SHOW MNODES", - /* 277 */ "cmd ::= SHOW QNODES", - /* 278 */ "cmd ::= SHOW ARBGROUPS", - /* 279 */ "cmd ::= SHOW FUNCTIONS", - /* 280 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 281 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 282 */ "cmd ::= SHOW STREAMS", - /* 283 */ "cmd ::= SHOW ACCOUNTS", - /* 284 */ "cmd ::= SHOW APPS", - /* 285 */ "cmd ::= SHOW CONNECTIONS", - /* 286 */ "cmd ::= SHOW LICENCES", - /* 287 */ "cmd ::= SHOW GRANTS", - /* 288 */ "cmd ::= SHOW GRANTS FULL", - /* 289 */ "cmd ::= SHOW GRANTS LOGS", - /* 290 */ "cmd ::= SHOW CLUSTER MACHINES", - /* 291 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 292 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 293 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 294 */ "cmd ::= SHOW ENCRYPTIONS", - /* 295 */ "cmd ::= SHOW QUERIES", - /* 296 */ "cmd ::= SHOW SCORES", - /* 297 */ "cmd ::= SHOW TOPICS", - /* 298 */ "cmd ::= SHOW VARIABLES", - /* 299 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 300 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 301 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 302 */ "cmd ::= SHOW BNODES", - /* 303 */ "cmd ::= SHOW SNODES", - /* 304 */ "cmd ::= SHOW CLUSTER", - /* 305 */ "cmd ::= SHOW TRANSACTIONS", - /* 306 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 307 */ "cmd ::= SHOW CONSUMERS", - /* 308 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 309 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 310 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 311 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 312 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 313 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 314 */ "cmd ::= SHOW VNODES", - /* 315 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 316 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 317 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", - /* 318 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 319 */ "cmd ::= SHOW COMPACTS", - /* 320 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 321 */ "table_kind_db_name_cond_opt ::=", - /* 322 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 323 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 324 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 325 */ "table_kind ::= NORMAL", - /* 326 */ "table_kind ::= CHILD", - /* 327 */ "db_name_cond_opt ::=", - /* 328 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 329 */ "like_pattern_opt ::=", - /* 330 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 331 */ "table_name_cond ::= table_name", - /* 332 */ "from_db_opt ::=", - /* 333 */ "from_db_opt ::= FROM db_name", - /* 334 */ "tag_list_opt ::=", - /* 335 */ "tag_list_opt ::= tag_item", - /* 336 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 337 */ "tag_item ::= TBNAME", - /* 338 */ "tag_item ::= QTAGS", - /* 339 */ "tag_item ::= column_name", - /* 340 */ "tag_item ::= column_name column_alias", - /* 341 */ "tag_item ::= column_name AS column_alias", - /* 342 */ "db_kind_opt ::=", - /* 343 */ "db_kind_opt ::= USER", - /* 344 */ "db_kind_opt ::= SYSTEM", - /* 345 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", - /* 346 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", - /* 347 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", - /* 348 */ "cmd ::= SHOW db_name_cond_opt TSMAS", - /* 349 */ "full_tsma_name ::= tsma_name", - /* 350 */ "full_tsma_name ::= db_name NK_DOT tsma_name", - /* 351 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", - /* 352 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 353 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 354 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 355 */ "full_index_name ::= index_name", - /* 356 */ "full_index_name ::= db_name NK_DOT index_name", - /* 357 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 358 */ "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", - /* 359 */ "func_list ::= func", - /* 360 */ "func_list ::= func_list NK_COMMA func", - /* 361 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 362 */ "sma_func_name ::= function_name", - /* 363 */ "sma_func_name ::= COUNT", - /* 364 */ "sma_func_name ::= FIRST", - /* 365 */ "sma_func_name ::= LAST", - /* 366 */ "sma_func_name ::= LAST_ROW", - /* 367 */ "sma_stream_opt ::=", - /* 368 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 369 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 370 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 371 */ "with_meta ::= AS", - /* 372 */ "with_meta ::= WITH META AS", - /* 373 */ "with_meta ::= ONLY META AS", - /* 374 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 375 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 376 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 377 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 378 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 379 */ "cmd ::= DESC full_table_name", - /* 380 */ "cmd ::= DESCRIBE full_table_name", - /* 381 */ "cmd ::= RESET QUERY CACHE", - /* 382 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 383 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 384 */ "analyze_opt ::=", - /* 385 */ "analyze_opt ::= ANALYZE", - /* 386 */ "explain_options ::=", - /* 387 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 388 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 389 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 390 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 391 */ "agg_func_opt ::=", - /* 392 */ "agg_func_opt ::= AGGREGATE", - /* 393 */ "bufsize_opt ::=", - /* 394 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 395 */ "language_opt ::=", - /* 396 */ "language_opt ::= LANGUAGE NK_STRING", - /* 397 */ "or_replace_opt ::=", - /* 398 */ "or_replace_opt ::= OR REPLACE", - /* 399 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 400 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 401 */ "full_view_name ::= view_name", - /* 402 */ "full_view_name ::= db_name NK_DOT view_name", - /* 403 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 404 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 405 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 406 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 407 */ "col_list_opt ::=", - /* 408 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", - /* 409 */ "column_stream_def_list ::= column_stream_def", - /* 410 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", - /* 411 */ "column_stream_def ::= column_name stream_col_options", - /* 412 */ "stream_col_options ::=", - /* 413 */ "stream_col_options ::= stream_col_options PRIMARY KEY", - /* 414 */ "tag_def_or_ref_opt ::=", - /* 415 */ "tag_def_or_ref_opt ::= tags_def", - /* 416 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", - /* 417 */ "stream_options ::=", - /* 418 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 419 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 420 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 421 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 422 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 423 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 424 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 425 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 426 */ "subtable_opt ::=", - /* 427 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 428 */ "ignore_opt ::=", - /* 429 */ "ignore_opt ::= IGNORE UNTREATED", - /* 430 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 431 */ "cmd ::= KILL QUERY NK_STRING", - /* 432 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 433 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 434 */ "cmd ::= BALANCE VGROUP", - /* 435 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 436 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 437 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 438 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 439 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 440 */ "on_vgroup_id ::=", - /* 441 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 442 */ "dnode_list ::= DNODE NK_INTEGER", - /* 443 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 444 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 445 */ "cmd ::= query_or_subquery", - /* 446 */ "cmd ::= insert_query", - /* 447 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 448 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 449 */ "tags_literal ::= NK_INTEGER", - /* 450 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 451 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 452 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 453 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 455 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 456 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 458 */ "tags_literal ::= NK_FLOAT", - /* 459 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 460 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 461 */ "tags_literal ::= NK_BIN", - /* 462 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 463 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 464 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 465 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 466 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 467 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 468 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 469 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 470 */ "tags_literal ::= NK_HEX", - /* 471 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 472 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 473 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 474 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 475 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 476 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 477 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 478 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 479 */ "tags_literal ::= NK_STRING", - /* 480 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 481 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 482 */ "tags_literal ::= NK_BOOL", - /* 483 */ "tags_literal ::= NULL", - /* 484 */ "tags_literal ::= literal_func", - /* 485 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 486 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 487 */ "tags_literal_list ::= tags_literal", - /* 488 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 489 */ "literal ::= NK_INTEGER", - /* 490 */ "literal ::= NK_FLOAT", - /* 491 */ "literal ::= NK_STRING", - /* 492 */ "literal ::= NK_BOOL", - /* 493 */ "literal ::= TIMESTAMP NK_STRING", - /* 494 */ "literal ::= duration_literal", - /* 495 */ "literal ::= NULL", - /* 496 */ "literal ::= NK_QUESTION", - /* 497 */ "duration_literal ::= NK_VARIABLE", - /* 498 */ "signed ::= NK_INTEGER", - /* 499 */ "signed ::= NK_PLUS NK_INTEGER", - /* 500 */ "signed ::= NK_MINUS NK_INTEGER", - /* 501 */ "signed ::= NK_FLOAT", - /* 502 */ "signed ::= NK_PLUS NK_FLOAT", - /* 503 */ "signed ::= NK_MINUS NK_FLOAT", - /* 504 */ "signed_literal ::= signed", - /* 505 */ "signed_literal ::= NK_STRING", - /* 506 */ "signed_literal ::= NK_BOOL", - /* 507 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 508 */ "signed_literal ::= duration_literal", - /* 509 */ "signed_literal ::= NULL", - /* 510 */ "signed_literal ::= literal_func", - /* 511 */ "signed_literal ::= NK_QUESTION", - /* 512 */ "literal_list ::= signed_literal", - /* 513 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 514 */ "db_name ::= NK_ID", - /* 515 */ "table_name ::= NK_ID", - /* 516 */ "column_name ::= NK_ID", - /* 517 */ "function_name ::= NK_ID", - /* 518 */ "view_name ::= NK_ID", - /* 519 */ "table_alias ::= NK_ID", - /* 520 */ "column_alias ::= NK_ID", - /* 521 */ "column_alias ::= NK_ALIAS", - /* 522 */ "user_name ::= NK_ID", - /* 523 */ "topic_name ::= NK_ID", - /* 524 */ "stream_name ::= NK_ID", - /* 525 */ "cgroup_name ::= NK_ID", - /* 526 */ "index_name ::= NK_ID", - /* 527 */ "tsma_name ::= NK_ID", - /* 528 */ "expr_or_subquery ::= expression", - /* 529 */ "expression ::= literal", - /* 530 */ "expression ::= pseudo_column", - /* 531 */ "expression ::= column_reference", - /* 532 */ "expression ::= function_expression", - /* 533 */ "expression ::= case_when_expression", - /* 534 */ "expression ::= NK_LP expression NK_RP", - /* 535 */ "expression ::= NK_PLUS expr_or_subquery", - /* 536 */ "expression ::= NK_MINUS expr_or_subquery", - /* 537 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 538 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 539 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 540 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 541 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 542 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 543 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 544 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 545 */ "expression_list ::= expr_or_subquery", - /* 546 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 547 */ "column_reference ::= column_name", - /* 548 */ "column_reference ::= table_name NK_DOT column_name", - /* 549 */ "column_reference ::= NK_ALIAS", - /* 550 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 551 */ "pseudo_column ::= ROWTS", - /* 552 */ "pseudo_column ::= TBNAME", - /* 553 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 554 */ "pseudo_column ::= QSTART", - /* 555 */ "pseudo_column ::= QEND", - /* 556 */ "pseudo_column ::= QDURATION", - /* 557 */ "pseudo_column ::= WSTART", - /* 558 */ "pseudo_column ::= WEND", - /* 559 */ "pseudo_column ::= WDURATION", - /* 560 */ "pseudo_column ::= IROWTS", - /* 561 */ "pseudo_column ::= ISFILLED", - /* 562 */ "pseudo_column ::= QTAGS", - /* 563 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 564 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 565 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 566 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 567 */ "function_expression ::= literal_func", - /* 568 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 569 */ "literal_func ::= NOW", - /* 570 */ "literal_func ::= TODAY", - /* 571 */ "noarg_func ::= NOW", - /* 572 */ "noarg_func ::= TODAY", - /* 573 */ "noarg_func ::= TIMEZONE", - /* 574 */ "noarg_func ::= DATABASE", - /* 575 */ "noarg_func ::= CLIENT_VERSION", - /* 576 */ "noarg_func ::= SERVER_VERSION", - /* 577 */ "noarg_func ::= SERVER_STATUS", - /* 578 */ "noarg_func ::= CURRENT_USER", - /* 579 */ "noarg_func ::= USER", - /* 580 */ "star_func ::= COUNT", - /* 581 */ "star_func ::= FIRST", - /* 582 */ "star_func ::= LAST", - /* 583 */ "star_func ::= LAST_ROW", - /* 584 */ "star_func_para_list ::= NK_STAR", - /* 585 */ "star_func_para_list ::= other_para_list", - /* 586 */ "other_para_list ::= star_func_para", - /* 587 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 588 */ "star_func_para ::= expr_or_subquery", - /* 589 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 590 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 591 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 592 */ "when_then_list ::= when_then_expr", - /* 593 */ "when_then_list ::= when_then_list when_then_expr", - /* 594 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 595 */ "case_when_else_opt ::=", - /* 596 */ "case_when_else_opt ::= ELSE common_expression", - /* 597 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 598 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 599 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 600 */ "predicate ::= expr_or_subquery IS NULL", - /* 601 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 602 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 603 */ "compare_op ::= NK_LT", - /* 604 */ "compare_op ::= NK_GT", - /* 605 */ "compare_op ::= NK_LE", - /* 606 */ "compare_op ::= NK_GE", - /* 607 */ "compare_op ::= NK_NE", - /* 608 */ "compare_op ::= NK_EQ", - /* 609 */ "compare_op ::= LIKE", - /* 610 */ "compare_op ::= NOT LIKE", - /* 611 */ "compare_op ::= MATCH", - /* 612 */ "compare_op ::= NMATCH", - /* 613 */ "compare_op ::= CONTAINS", - /* 614 */ "in_op ::= IN", - /* 615 */ "in_op ::= NOT IN", - /* 616 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 617 */ "boolean_value_expression ::= boolean_primary", - /* 618 */ "boolean_value_expression ::= NOT boolean_primary", - /* 619 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 620 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 621 */ "boolean_primary ::= predicate", - /* 622 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 623 */ "common_expression ::= expr_or_subquery", - /* 624 */ "common_expression ::= boolean_value_expression", - /* 625 */ "from_clause_opt ::=", - /* 626 */ "from_clause_opt ::= FROM table_reference_list", - /* 627 */ "table_reference_list ::= table_reference", - /* 628 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 629 */ "table_reference ::= table_primary", - /* 630 */ "table_reference ::= joined_table", - /* 631 */ "table_primary ::= table_name alias_opt", - /* 632 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 633 */ "table_primary ::= subquery alias_opt", - /* 634 */ "table_primary ::= parenthesized_joined_table", - /* 635 */ "alias_opt ::=", - /* 636 */ "alias_opt ::= table_alias", - /* 637 */ "alias_opt ::= AS table_alias", - /* 638 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 639 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 640 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 641 */ "join_type ::=", - /* 642 */ "join_type ::= INNER", - /* 643 */ "join_type ::= LEFT", - /* 644 */ "join_type ::= RIGHT", - /* 645 */ "join_type ::= FULL", - /* 646 */ "join_subtype ::=", - /* 647 */ "join_subtype ::= OUTER", - /* 648 */ "join_subtype ::= SEMI", - /* 649 */ "join_subtype ::= ANTI", - /* 650 */ "join_subtype ::= ASOF", - /* 651 */ "join_subtype ::= WINDOW", - /* 652 */ "join_on_clause_opt ::=", - /* 653 */ "join_on_clause_opt ::= ON search_condition", - /* 654 */ "window_offset_clause_opt ::=", - /* 655 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 656 */ "window_offset_literal ::= NK_VARIABLE", - /* 657 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 658 */ "jlimit_clause_opt ::=", - /* 659 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 660 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 661 */ "hint_list ::=", - /* 662 */ "hint_list ::= NK_HINT", - /* 663 */ "tag_mode_opt ::=", - /* 664 */ "tag_mode_opt ::= TAGS", - /* 665 */ "set_quantifier_opt ::=", - /* 666 */ "set_quantifier_opt ::= DISTINCT", - /* 667 */ "set_quantifier_opt ::= ALL", - /* 668 */ "select_list ::= select_item", - /* 669 */ "select_list ::= select_list NK_COMMA select_item", - /* 670 */ "select_item ::= NK_STAR", - /* 671 */ "select_item ::= common_expression", - /* 672 */ "select_item ::= common_expression column_alias", - /* 673 */ "select_item ::= common_expression AS column_alias", - /* 674 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 675 */ "where_clause_opt ::=", - /* 676 */ "where_clause_opt ::= WHERE search_condition", - /* 677 */ "partition_by_clause_opt ::=", - /* 678 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 679 */ "partition_list ::= partition_item", - /* 680 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 681 */ "partition_item ::= expr_or_subquery", - /* 682 */ "partition_item ::= expr_or_subquery column_alias", - /* 683 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 684 */ "twindow_clause_opt ::=", - /* 685 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 686 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 687 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 688 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 689 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 690 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 691 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 692 */ "sliding_opt ::=", - /* 693 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 694 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 695 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 696 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 697 */ "fill_opt ::=", - /* 698 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 699 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 700 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 701 */ "fill_mode ::= NONE", - /* 702 */ "fill_mode ::= PREV", - /* 703 */ "fill_mode ::= NULL", - /* 704 */ "fill_mode ::= NULL_F", - /* 705 */ "fill_mode ::= LINEAR", - /* 706 */ "fill_mode ::= NEXT", - /* 707 */ "group_by_clause_opt ::=", - /* 708 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 709 */ "group_by_list ::= expr_or_subquery", - /* 710 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 711 */ "having_clause_opt ::=", - /* 712 */ "having_clause_opt ::= HAVING search_condition", - /* 713 */ "range_opt ::=", - /* 714 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 715 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 716 */ "every_opt ::=", - /* 717 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 718 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 719 */ "query_simple ::= query_specification", - /* 720 */ "query_simple ::= union_query_expression", - /* 721 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 722 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 723 */ "query_simple_or_subquery ::= query_simple", - /* 724 */ "query_simple_or_subquery ::= subquery", - /* 725 */ "query_or_subquery ::= query_expression", - /* 726 */ "query_or_subquery ::= subquery", - /* 727 */ "order_by_clause_opt ::=", - /* 728 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 729 */ "slimit_clause_opt ::=", - /* 730 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 731 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 732 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 733 */ "limit_clause_opt ::=", - /* 734 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 735 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 736 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 737 */ "subquery ::= NK_LP query_expression NK_RP", - /* 738 */ "subquery ::= NK_LP subquery NK_RP", - /* 739 */ "search_condition ::= common_expression", - /* 740 */ "sort_specification_list ::= sort_specification", - /* 741 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 742 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 743 */ "ordering_specification_opt ::=", - /* 744 */ "ordering_specification_opt ::= ASC", - /* 745 */ "ordering_specification_opt ::= DESC", - /* 746 */ "null_ordering_opt ::=", - /* 747 */ "null_ordering_opt ::= NULLS FIRST", - /* 748 */ "null_ordering_opt ::= NULLS LAST", - /* 749 */ "column_options ::=", - /* 750 */ "column_options ::= column_options PRIMARY KEY", - /* 751 */ "column_options ::= column_options ENCODE NK_STRING", - /* 752 */ "column_options ::= column_options COMPRESS NK_STRING", - /* 753 */ "column_options ::= column_options LEVEL NK_STRING", + /* 201 */ "multi_create_clause ::= create_from_file_clause", + /* 202 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", + /* 203 */ "create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", + /* 204 */ "multi_drop_clause ::= drop_table_clause", + /* 205 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 206 */ "drop_table_clause ::= exists_opt full_table_name", + /* 207 */ "specific_cols_opt ::=", + /* 208 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 209 */ "full_table_name ::= table_name", + /* 210 */ "full_table_name ::= db_name NK_DOT table_name", + /* 211 */ "tag_def_list ::= tag_def", + /* 212 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", + /* 213 */ "tag_def ::= column_name type_name", + /* 214 */ "column_def_list ::= column_def", + /* 215 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 216 */ "column_def ::= column_name type_name column_options", + /* 217 */ "type_name ::= BOOL", + /* 218 */ "type_name ::= TINYINT", + /* 219 */ "type_name ::= SMALLINT", + /* 220 */ "type_name ::= INT", + /* 221 */ "type_name ::= INTEGER", + /* 222 */ "type_name ::= BIGINT", + /* 223 */ "type_name ::= FLOAT", + /* 224 */ "type_name ::= DOUBLE", + /* 225 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 226 */ "type_name ::= TIMESTAMP", + /* 227 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 228 */ "type_name ::= TINYINT UNSIGNED", + /* 229 */ "type_name ::= SMALLINT UNSIGNED", + /* 230 */ "type_name ::= INT UNSIGNED", + /* 231 */ "type_name ::= BIGINT UNSIGNED", + /* 232 */ "type_name ::= JSON", + /* 233 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 234 */ "type_name ::= MEDIUMBLOB", + /* 235 */ "type_name ::= BLOB", + /* 236 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 237 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 238 */ "type_name ::= DECIMAL", + /* 239 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 240 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 241 */ "type_name_default_len ::= BINARY", + /* 242 */ "type_name_default_len ::= NCHAR", + /* 243 */ "type_name_default_len ::= VARCHAR", + /* 244 */ "type_name_default_len ::= VARBINARY", + /* 245 */ "tags_def_opt ::=", + /* 246 */ "tags_def_opt ::= tags_def", + /* 247 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", + /* 248 */ "table_options ::=", + /* 249 */ "table_options ::= table_options COMMENT NK_STRING", + /* 250 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 251 */ "table_options ::= table_options WATERMARK duration_list", + /* 252 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 253 */ "table_options ::= table_options TTL NK_INTEGER", + /* 254 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 255 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 256 */ "alter_table_options ::= alter_table_option", + /* 257 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 258 */ "alter_table_option ::= COMMENT NK_STRING", + /* 259 */ "alter_table_option ::= TTL NK_INTEGER", + /* 260 */ "duration_list ::= duration_literal", + /* 261 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 262 */ "rollup_func_list ::= rollup_func_name", + /* 263 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 264 */ "rollup_func_name ::= function_name", + /* 265 */ "rollup_func_name ::= FIRST", + /* 266 */ "rollup_func_name ::= LAST", + /* 267 */ "col_name_list ::= col_name", + /* 268 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 269 */ "col_name ::= column_name", + /* 270 */ "cmd ::= SHOW DNODES", + /* 271 */ "cmd ::= SHOW USERS", + /* 272 */ "cmd ::= SHOW USERS FULL", + /* 273 */ "cmd ::= SHOW USER PRIVILEGES", + /* 274 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 275 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", + /* 276 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 277 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 278 */ "cmd ::= SHOW MNODES", + /* 279 */ "cmd ::= SHOW QNODES", + /* 280 */ "cmd ::= SHOW ARBGROUPS", + /* 281 */ "cmd ::= SHOW FUNCTIONS", + /* 282 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 283 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 284 */ "cmd ::= SHOW STREAMS", + /* 285 */ "cmd ::= SHOW ACCOUNTS", + /* 286 */ "cmd ::= SHOW APPS", + /* 287 */ "cmd ::= SHOW CONNECTIONS", + /* 288 */ "cmd ::= SHOW LICENCES", + /* 289 */ "cmd ::= SHOW GRANTS", + /* 290 */ "cmd ::= SHOW GRANTS FULL", + /* 291 */ "cmd ::= SHOW GRANTS LOGS", + /* 292 */ "cmd ::= SHOW CLUSTER MACHINES", + /* 293 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 294 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 295 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 296 */ "cmd ::= SHOW ENCRYPTIONS", + /* 297 */ "cmd ::= SHOW QUERIES", + /* 298 */ "cmd ::= SHOW SCORES", + /* 299 */ "cmd ::= SHOW TOPICS", + /* 300 */ "cmd ::= SHOW VARIABLES", + /* 301 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 302 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 303 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 304 */ "cmd ::= SHOW BNODES", + /* 305 */ "cmd ::= SHOW SNODES", + /* 306 */ "cmd ::= SHOW CLUSTER", + /* 307 */ "cmd ::= SHOW TRANSACTIONS", + /* 308 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 309 */ "cmd ::= SHOW CONSUMERS", + /* 310 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 311 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 312 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 313 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 314 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 315 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 316 */ "cmd ::= SHOW VNODES", + /* 317 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 318 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 319 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", + /* 320 */ "cmd ::= SHOW CREATE VIEW full_table_name", + /* 321 */ "cmd ::= SHOW COMPACTS", + /* 322 */ "cmd ::= SHOW COMPACT NK_INTEGER", + /* 323 */ "table_kind_db_name_cond_opt ::=", + /* 324 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 325 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 326 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 327 */ "table_kind ::= NORMAL", + /* 328 */ "table_kind ::= CHILD", + /* 329 */ "db_name_cond_opt ::=", + /* 330 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 331 */ "like_pattern_opt ::=", + /* 332 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 333 */ "table_name_cond ::= table_name", + /* 334 */ "from_db_opt ::=", + /* 335 */ "from_db_opt ::= FROM db_name", + /* 336 */ "tag_list_opt ::=", + /* 337 */ "tag_list_opt ::= tag_item", + /* 338 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 339 */ "tag_item ::= TBNAME", + /* 340 */ "tag_item ::= QTAGS", + /* 341 */ "tag_item ::= column_name", + /* 342 */ "tag_item ::= column_name column_alias", + /* 343 */ "tag_item ::= column_name AS column_alias", + /* 344 */ "db_kind_opt ::=", + /* 345 */ "db_kind_opt ::= USER", + /* 346 */ "db_kind_opt ::= SYSTEM", + /* 347 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", + /* 348 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", + /* 349 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", + /* 350 */ "cmd ::= SHOW db_name_cond_opt TSMAS", + /* 351 */ "full_tsma_name ::= tsma_name", + /* 352 */ "full_tsma_name ::= db_name NK_DOT tsma_name", + /* 353 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", + /* 354 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 355 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 356 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 357 */ "full_index_name ::= index_name", + /* 358 */ "full_index_name ::= db_name NK_DOT index_name", + /* 359 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 360 */ "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", + /* 361 */ "func_list ::= func", + /* 362 */ "func_list ::= func_list NK_COMMA func", + /* 363 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 364 */ "sma_func_name ::= function_name", + /* 365 */ "sma_func_name ::= COUNT", + /* 366 */ "sma_func_name ::= FIRST", + /* 367 */ "sma_func_name ::= LAST", + /* 368 */ "sma_func_name ::= LAST_ROW", + /* 369 */ "sma_stream_opt ::=", + /* 370 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 371 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 372 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 373 */ "with_meta ::= AS", + /* 374 */ "with_meta ::= WITH META AS", + /* 375 */ "with_meta ::= ONLY META AS", + /* 376 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 377 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 378 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 379 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 380 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 381 */ "cmd ::= DESC full_table_name", + /* 382 */ "cmd ::= DESCRIBE full_table_name", + /* 383 */ "cmd ::= RESET QUERY CACHE", + /* 384 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 385 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 386 */ "analyze_opt ::=", + /* 387 */ "analyze_opt ::= ANALYZE", + /* 388 */ "explain_options ::=", + /* 389 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 390 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 391 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 392 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 393 */ "agg_func_opt ::=", + /* 394 */ "agg_func_opt ::= AGGREGATE", + /* 395 */ "bufsize_opt ::=", + /* 396 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 397 */ "language_opt ::=", + /* 398 */ "language_opt ::= LANGUAGE NK_STRING", + /* 399 */ "or_replace_opt ::=", + /* 400 */ "or_replace_opt ::= OR REPLACE", + /* 401 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 402 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 403 */ "full_view_name ::= view_name", + /* 404 */ "full_view_name ::= db_name NK_DOT view_name", + /* 405 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 406 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 407 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 408 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 409 */ "col_list_opt ::=", + /* 410 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", + /* 411 */ "column_stream_def_list ::= column_stream_def", + /* 412 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", + /* 413 */ "column_stream_def ::= column_name stream_col_options", + /* 414 */ "stream_col_options ::=", + /* 415 */ "stream_col_options ::= stream_col_options PRIMARY KEY", + /* 416 */ "tag_def_or_ref_opt ::=", + /* 417 */ "tag_def_or_ref_opt ::= tags_def", + /* 418 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", + /* 419 */ "stream_options ::=", + /* 420 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 421 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 422 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 423 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 424 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 425 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 426 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 427 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 428 */ "subtable_opt ::=", + /* 429 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 430 */ "ignore_opt ::=", + /* 431 */ "ignore_opt ::= IGNORE UNTREATED", + /* 432 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 433 */ "cmd ::= KILL QUERY NK_STRING", + /* 434 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 435 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 436 */ "cmd ::= BALANCE VGROUP", + /* 437 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 438 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", + /* 439 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 440 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 441 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 442 */ "on_vgroup_id ::=", + /* 443 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 444 */ "dnode_list ::= DNODE NK_INTEGER", + /* 445 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 446 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 447 */ "cmd ::= query_or_subquery", + /* 448 */ "cmd ::= insert_query", + /* 449 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 450 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 451 */ "tags_literal ::= NK_INTEGER", + /* 452 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 453 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 456 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 459 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 460 */ "tags_literal ::= NK_FLOAT", + /* 461 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 462 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 463 */ "tags_literal ::= NK_BIN", + /* 464 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 465 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 466 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 468 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 469 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 471 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 472 */ "tags_literal ::= NK_HEX", + /* 473 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 474 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 475 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 477 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 478 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 480 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 481 */ "tags_literal ::= NK_STRING", + /* 482 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 483 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 484 */ "tags_literal ::= NK_BOOL", + /* 485 */ "tags_literal ::= NULL", + /* 486 */ "tags_literal ::= literal_func", + /* 487 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 488 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 489 */ "tags_literal_list ::= tags_literal", + /* 490 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 491 */ "literal ::= NK_INTEGER", + /* 492 */ "literal ::= NK_FLOAT", + /* 493 */ "literal ::= NK_STRING", + /* 494 */ "literal ::= NK_BOOL", + /* 495 */ "literal ::= TIMESTAMP NK_STRING", + /* 496 */ "literal ::= duration_literal", + /* 497 */ "literal ::= NULL", + /* 498 */ "literal ::= NK_QUESTION", + /* 499 */ "duration_literal ::= NK_VARIABLE", + /* 500 */ "signed ::= NK_INTEGER", + /* 501 */ "signed ::= NK_PLUS NK_INTEGER", + /* 502 */ "signed ::= NK_MINUS NK_INTEGER", + /* 503 */ "signed ::= NK_FLOAT", + /* 504 */ "signed ::= NK_PLUS NK_FLOAT", + /* 505 */ "signed ::= NK_MINUS NK_FLOAT", + /* 506 */ "signed_literal ::= signed", + /* 507 */ "signed_literal ::= NK_STRING", + /* 508 */ "signed_literal ::= NK_BOOL", + /* 509 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 510 */ "signed_literal ::= duration_literal", + /* 511 */ "signed_literal ::= NULL", + /* 512 */ "signed_literal ::= literal_func", + /* 513 */ "signed_literal ::= NK_QUESTION", + /* 514 */ "literal_list ::= signed_literal", + /* 515 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 516 */ "db_name ::= NK_ID", + /* 517 */ "table_name ::= NK_ID", + /* 518 */ "column_name ::= NK_ID", + /* 519 */ "function_name ::= NK_ID", + /* 520 */ "view_name ::= NK_ID", + /* 521 */ "table_alias ::= NK_ID", + /* 522 */ "column_alias ::= NK_ID", + /* 523 */ "column_alias ::= NK_ALIAS", + /* 524 */ "user_name ::= NK_ID", + /* 525 */ "topic_name ::= NK_ID", + /* 526 */ "stream_name ::= NK_ID", + /* 527 */ "cgroup_name ::= NK_ID", + /* 528 */ "index_name ::= NK_ID", + /* 529 */ "tsma_name ::= NK_ID", + /* 530 */ "expr_or_subquery ::= expression", + /* 531 */ "expression ::= literal", + /* 532 */ "expression ::= pseudo_column", + /* 533 */ "expression ::= column_reference", + /* 534 */ "expression ::= function_expression", + /* 535 */ "expression ::= case_when_expression", + /* 536 */ "expression ::= NK_LP expression NK_RP", + /* 537 */ "expression ::= NK_PLUS expr_or_subquery", + /* 538 */ "expression ::= NK_MINUS expr_or_subquery", + /* 539 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 540 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 541 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 542 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 543 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 544 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 545 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 546 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 547 */ "expression_list ::= expr_or_subquery", + /* 548 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 549 */ "column_reference ::= column_name", + /* 550 */ "column_reference ::= table_name NK_DOT column_name", + /* 551 */ "column_reference ::= NK_ALIAS", + /* 552 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 553 */ "pseudo_column ::= ROWTS", + /* 554 */ "pseudo_column ::= TBNAME", + /* 555 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 556 */ "pseudo_column ::= QSTART", + /* 557 */ "pseudo_column ::= QEND", + /* 558 */ "pseudo_column ::= QDURATION", + /* 559 */ "pseudo_column ::= WSTART", + /* 560 */ "pseudo_column ::= WEND", + /* 561 */ "pseudo_column ::= WDURATION", + /* 562 */ "pseudo_column ::= IROWTS", + /* 563 */ "pseudo_column ::= ISFILLED", + /* 564 */ "pseudo_column ::= QTAGS", + /* 565 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 566 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 568 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", + /* 569 */ "function_expression ::= literal_func", + /* 570 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 571 */ "literal_func ::= NOW", + /* 572 */ "literal_func ::= TODAY", + /* 573 */ "noarg_func ::= NOW", + /* 574 */ "noarg_func ::= TODAY", + /* 575 */ "noarg_func ::= TIMEZONE", + /* 576 */ "noarg_func ::= DATABASE", + /* 577 */ "noarg_func ::= CLIENT_VERSION", + /* 578 */ "noarg_func ::= SERVER_VERSION", + /* 579 */ "noarg_func ::= SERVER_STATUS", + /* 580 */ "noarg_func ::= CURRENT_USER", + /* 581 */ "noarg_func ::= USER", + /* 582 */ "star_func ::= COUNT", + /* 583 */ "star_func ::= FIRST", + /* 584 */ "star_func ::= LAST", + /* 585 */ "star_func ::= LAST_ROW", + /* 586 */ "star_func_para_list ::= NK_STAR", + /* 587 */ "star_func_para_list ::= other_para_list", + /* 588 */ "other_para_list ::= star_func_para", + /* 589 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 590 */ "star_func_para ::= expr_or_subquery", + /* 591 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 592 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 593 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 594 */ "when_then_list ::= when_then_expr", + /* 595 */ "when_then_list ::= when_then_list when_then_expr", + /* 596 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 597 */ "case_when_else_opt ::=", + /* 598 */ "case_when_else_opt ::= ELSE common_expression", + /* 599 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 600 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 601 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 602 */ "predicate ::= expr_or_subquery IS NULL", + /* 603 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 604 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 605 */ "compare_op ::= NK_LT", + /* 606 */ "compare_op ::= NK_GT", + /* 607 */ "compare_op ::= NK_LE", + /* 608 */ "compare_op ::= NK_GE", + /* 609 */ "compare_op ::= NK_NE", + /* 610 */ "compare_op ::= NK_EQ", + /* 611 */ "compare_op ::= LIKE", + /* 612 */ "compare_op ::= NOT LIKE", + /* 613 */ "compare_op ::= MATCH", + /* 614 */ "compare_op ::= NMATCH", + /* 615 */ "compare_op ::= CONTAINS", + /* 616 */ "in_op ::= IN", + /* 617 */ "in_op ::= NOT IN", + /* 618 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 619 */ "boolean_value_expression ::= boolean_primary", + /* 620 */ "boolean_value_expression ::= NOT boolean_primary", + /* 621 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 622 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 623 */ "boolean_primary ::= predicate", + /* 624 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 625 */ "common_expression ::= expr_or_subquery", + /* 626 */ "common_expression ::= boolean_value_expression", + /* 627 */ "from_clause_opt ::=", + /* 628 */ "from_clause_opt ::= FROM table_reference_list", + /* 629 */ "table_reference_list ::= table_reference", + /* 630 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 631 */ "table_reference ::= table_primary", + /* 632 */ "table_reference ::= joined_table", + /* 633 */ "table_primary ::= table_name alias_opt", + /* 634 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 635 */ "table_primary ::= subquery alias_opt", + /* 636 */ "table_primary ::= parenthesized_joined_table", + /* 637 */ "alias_opt ::=", + /* 638 */ "alias_opt ::= table_alias", + /* 639 */ "alias_opt ::= AS table_alias", + /* 640 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 641 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 642 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 643 */ "join_type ::=", + /* 644 */ "join_type ::= INNER", + /* 645 */ "join_type ::= LEFT", + /* 646 */ "join_type ::= RIGHT", + /* 647 */ "join_type ::= FULL", + /* 648 */ "join_subtype ::=", + /* 649 */ "join_subtype ::= OUTER", + /* 650 */ "join_subtype ::= SEMI", + /* 651 */ "join_subtype ::= ANTI", + /* 652 */ "join_subtype ::= ASOF", + /* 653 */ "join_subtype ::= WINDOW", + /* 654 */ "join_on_clause_opt ::=", + /* 655 */ "join_on_clause_opt ::= ON search_condition", + /* 656 */ "window_offset_clause_opt ::=", + /* 657 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 658 */ "window_offset_literal ::= NK_VARIABLE", + /* 659 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 660 */ "jlimit_clause_opt ::=", + /* 661 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 662 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 663 */ "hint_list ::=", + /* 664 */ "hint_list ::= NK_HINT", + /* 665 */ "tag_mode_opt ::=", + /* 666 */ "tag_mode_opt ::= TAGS", + /* 667 */ "set_quantifier_opt ::=", + /* 668 */ "set_quantifier_opt ::= DISTINCT", + /* 669 */ "set_quantifier_opt ::= ALL", + /* 670 */ "select_list ::= select_item", + /* 671 */ "select_list ::= select_list NK_COMMA select_item", + /* 672 */ "select_item ::= NK_STAR", + /* 673 */ "select_item ::= common_expression", + /* 674 */ "select_item ::= common_expression column_alias", + /* 675 */ "select_item ::= common_expression AS column_alias", + /* 676 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 677 */ "where_clause_opt ::=", + /* 678 */ "where_clause_opt ::= WHERE search_condition", + /* 679 */ "partition_by_clause_opt ::=", + /* 680 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 681 */ "partition_list ::= partition_item", + /* 682 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 683 */ "partition_item ::= expr_or_subquery", + /* 684 */ "partition_item ::= expr_or_subquery column_alias", + /* 685 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 686 */ "twindow_clause_opt ::=", + /* 687 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 688 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 689 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 690 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 691 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 692 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 693 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 694 */ "sliding_opt ::=", + /* 695 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 696 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 697 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 698 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 699 */ "fill_opt ::=", + /* 700 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 701 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 702 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 703 */ "fill_mode ::= NONE", + /* 704 */ "fill_mode ::= PREV", + /* 705 */ "fill_mode ::= NULL", + /* 706 */ "fill_mode ::= NULL_F", + /* 707 */ "fill_mode ::= LINEAR", + /* 708 */ "fill_mode ::= NEXT", + /* 709 */ "group_by_clause_opt ::=", + /* 710 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 711 */ "group_by_list ::= expr_or_subquery", + /* 712 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 713 */ "having_clause_opt ::=", + /* 714 */ "having_clause_opt ::= HAVING search_condition", + /* 715 */ "range_opt ::=", + /* 716 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 717 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 718 */ "every_opt ::=", + /* 719 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 720 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 721 */ "query_simple ::= query_specification", + /* 722 */ "query_simple ::= union_query_expression", + /* 723 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 724 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 725 */ "query_simple_or_subquery ::= query_simple", + /* 726 */ "query_simple_or_subquery ::= subquery", + /* 727 */ "query_or_subquery ::= query_expression", + /* 728 */ "query_or_subquery ::= subquery", + /* 729 */ "order_by_clause_opt ::=", + /* 730 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 731 */ "slimit_clause_opt ::=", + /* 732 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 733 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 734 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 735 */ "limit_clause_opt ::=", + /* 736 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 737 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 738 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 739 */ "subquery ::= NK_LP query_expression NK_RP", + /* 740 */ "subquery ::= NK_LP subquery NK_RP", + /* 741 */ "search_condition ::= common_expression", + /* 742 */ "sort_specification_list ::= sort_specification", + /* 743 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 744 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 745 */ "ordering_specification_opt ::=", + /* 746 */ "ordering_specification_opt ::= ASC", + /* 747 */ "ordering_specification_opt ::= DESC", + /* 748 */ "null_ordering_opt ::=", + /* 749 */ "null_ordering_opt ::= NULLS FIRST", + /* 750 */ "null_ordering_opt ::= NULLS LAST", + /* 751 */ "column_options ::=", + /* 752 */ "column_options ::= column_options PRIMARY KEY", + /* 753 */ "column_options ::= column_options ENCODE NK_STRING", + /* 754 */ "column_options ::= column_options COMPRESS NK_STRING", + /* 755 */ "column_options ::= column_options LEVEL NK_STRING", }; #endif /* NDEBUG */ @@ -3443,87 +3462,92 @@ static void yy_destructor( case 426: /* column_options */ case 427: /* tags_literal */ case 428: /* create_subtable_clause */ - case 431: /* drop_table_clause */ - case 434: /* tag_def */ - case 435: /* column_def */ - case 440: /* duration_literal */ - case 441: /* rollup_func_name */ - case 443: /* col_name */ - case 446: /* like_pattern_opt */ - case 447: /* db_name_cond_opt */ - case 448: /* table_name_cond */ - case 449: /* from_db_opt */ - case 452: /* tag_item */ - case 456: /* full_tsma_name */ - case 458: /* index_options */ - case 459: /* full_index_name */ - case 461: /* sliding_opt */ - case 462: /* sma_stream_opt */ - case 463: /* func */ - case 467: /* query_or_subquery */ - case 468: /* where_clause_opt */ - case 471: /* explain_options */ - case 472: /* insert_query */ - case 477: /* full_view_name */ - case 480: /* stream_options */ - case 483: /* subtable_opt */ - case 486: /* column_stream_def */ - case 487: /* stream_col_options */ - case 488: /* expression */ - case 491: /* literal_func */ - case 492: /* signed_literal */ - case 495: /* expr_or_subquery */ - case 496: /* pseudo_column */ - case 497: /* column_reference */ - case 498: /* function_expression */ - case 499: /* case_when_expression */ - case 504: /* star_func_para */ - case 506: /* case_when_else_opt */ - case 507: /* common_expression */ - case 508: /* when_then_expr */ - case 509: /* predicate */ - case 512: /* in_predicate_value */ - case 513: /* boolean_value_expression */ - case 514: /* boolean_primary */ - case 515: /* from_clause_opt */ - case 516: /* table_reference_list */ - case 517: /* table_reference */ - case 518: /* table_primary */ - case 519: /* joined_table */ - case 521: /* subquery */ - case 522: /* parenthesized_joined_table */ - case 525: /* join_on_clause_opt */ - case 526: /* window_offset_clause_opt */ - case 527: /* jlimit_clause_opt */ - case 528: /* window_offset_literal */ - case 529: /* query_specification */ - case 535: /* range_opt */ - case 536: /* every_opt */ - case 537: /* fill_opt */ - case 538: /* twindow_clause_opt */ - case 540: /* having_clause_opt */ - case 541: /* select_item */ - case 543: /* partition_item */ - case 544: /* interval_sliding_duration_literal */ - case 547: /* query_expression */ - case 548: /* query_simple */ - case 550: /* slimit_clause_opt */ - case 551: /* limit_clause_opt */ - case 552: /* union_query_expression */ - case 553: /* query_simple_or_subquery */ - case 555: /* sort_specification */ + case 429: /* create_from_file_clause */ + case 433: /* drop_table_clause */ + case 436: /* tag_def */ + case 437: /* column_def */ + case 442: /* duration_literal */ + case 443: /* rollup_func_name */ + case 445: /* col_name */ + case 448: /* like_pattern_opt */ + case 449: /* db_name_cond_opt */ + case 450: /* table_name_cond */ + case 451: /* from_db_opt */ + case 453: /* tag_item */ + case 457: /* full_tsma_name */ + case 459: /* index_options */ + case 460: /* full_index_name */ + case 462: /* sliding_opt */ + case 463: /* sma_stream_opt */ + case 464: /* func */ + case 468: /* query_or_subquery */ + case 469: /* where_clause_opt */ + case 472: /* explain_options */ + case 473: /* insert_query */ + case 478: /* full_view_name */ + case 481: /* stream_options */ + case 484: /* subtable_opt */ + case 487: /* column_stream_def */ + case 488: /* stream_col_options */ + case 489: /* expression */ + case 492: /* literal_func */ + case 493: /* signed_literal */ + case 496: /* expr_or_subquery */ + case 497: /* pseudo_column */ + case 498: /* column_reference */ + case 499: /* function_expression */ + case 500: /* case_when_expression */ + case 505: /* star_func_para */ + case 507: /* case_when_else_opt */ + case 508: /* common_expression */ + case 509: /* when_then_expr */ + case 510: /* predicate */ + case 513: /* in_predicate_value */ + case 514: /* boolean_value_expression */ + case 515: /* boolean_primary */ + case 516: /* from_clause_opt */ + case 517: /* table_reference_list */ + case 518: /* table_reference */ + case 519: /* table_primary */ + case 520: /* joined_table */ + case 522: /* subquery */ + case 523: /* parenthesized_joined_table */ + case 526: /* join_on_clause_opt */ + case 527: /* window_offset_clause_opt */ + case 528: /* jlimit_clause_opt */ + case 529: /* window_offset_literal */ + case 530: /* query_specification */ + case 536: /* range_opt */ + case 537: /* every_opt */ + case 538: /* fill_opt */ + case 539: /* twindow_clause_opt */ + case 541: /* having_clause_opt */ + case 542: /* select_item */ + case 544: /* partition_item */ + case 545: /* interval_sliding_duration_literal */ + case 548: /* query_expression */ + case 549: /* query_simple */ + case 551: /* slimit_clause_opt */ + case 552: /* limit_clause_opt */ + case 553: /* union_query_expression */ + case 554: /* query_simple_or_subquery */ + case 556: /* sort_specification */ { - nodesDestroyNode((yypminor->yy416)); +#line 7 "sql.y" + nodesDestroyNode((yypminor->yy54)); +#line 3538 "sql.c" } break; case 379: /* account_options */ case 380: /* alter_account_options */ case 382: /* alter_account_option */ case 406: /* speed_opt */ - case 466: /* with_meta */ - case 475: /* bufsize_opt */ + case 467: /* with_meta */ + case 476: /* bufsize_opt */ { +#line 54 "sql.y" +#line 3550 "sql.c" } break; case 383: /* ip_range_list */ @@ -3537,40 +3561,44 @@ static void yy_destructor( case 419: /* multi_create_clause */ case 420: /* tags_def */ case 421: /* multi_drop_clause */ - case 429: /* specific_cols_opt */ - case 430: /* tags_literal_list */ - case 432: /* col_name_list */ - case 433: /* tag_def_list */ - case 437: /* duration_list */ - case 438: /* rollup_func_list */ - case 450: /* tag_list_opt */ - case 457: /* func_list */ - case 465: /* expression_list */ - case 481: /* col_list_opt */ - case 482: /* tag_def_or_ref_opt */ - case 485: /* column_stream_def_list */ - case 490: /* dnode_list */ - case 493: /* literal_list */ - case 501: /* star_func_para_list */ - case 503: /* other_para_list */ - case 505: /* when_then_list */ - case 530: /* hint_list */ - case 533: /* select_list */ - case 534: /* partition_by_clause_opt */ - case 539: /* group_by_clause_opt */ - case 542: /* partition_list */ - case 546: /* group_by_list */ - case 549: /* order_by_clause_opt */ - case 554: /* sort_specification_list */ + case 430: /* specific_cols_opt */ + case 431: /* tags_literal_list */ + case 432: /* tag_list_opt */ + case 434: /* col_name_list */ + case 435: /* tag_def_list */ + case 439: /* duration_list */ + case 440: /* rollup_func_list */ + case 458: /* func_list */ + case 466: /* expression_list */ + case 482: /* col_list_opt */ + case 483: /* tag_def_or_ref_opt */ + case 486: /* column_stream_def_list */ + case 491: /* dnode_list */ + case 494: /* literal_list */ + case 502: /* star_func_para_list */ + case 504: /* other_para_list */ + case 506: /* when_then_list */ + case 531: /* hint_list */ + case 534: /* select_list */ + case 535: /* partition_by_clause_opt */ + case 540: /* group_by_clause_opt */ + case 543: /* partition_list */ + case 547: /* group_by_list */ + case 550: /* order_by_clause_opt */ + case 555: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy316)); +#line 85 "sql.y" + nodesDestroyList((yypminor->yy652)); +#line 3592 "sql.c" } break; case 386: /* is_import_opt */ case 387: /* is_createdb_opt */ case 389: /* sysinfo_opt */ { +#line 99 "sql.y" +#line 3601 "sql.c" } break; case 388: /* user_name */ @@ -3579,107 +3607,137 @@ static void yy_destructor( case 397: /* topic_name */ case 399: /* dnode_endpoint */ case 424: /* column_name */ - case 442: /* function_name */ - case 453: /* column_alias */ - case 454: /* tsma_name */ - case 460: /* index_name */ - case 464: /* sma_func_name */ - case 469: /* cgroup_name */ - case 476: /* language_opt */ - case 478: /* view_name */ - case 479: /* stream_name */ - case 489: /* on_vgroup_id */ - case 494: /* table_alias */ - case 500: /* star_func */ - case 502: /* noarg_func */ - case 520: /* alias_opt */ + case 444: /* function_name */ + case 454: /* column_alias */ + case 455: /* tsma_name */ + case 461: /* index_name */ + case 465: /* sma_func_name */ + case 470: /* cgroup_name */ + case 477: /* language_opt */ + case 479: /* view_name */ + case 480: /* stream_name */ + case 490: /* on_vgroup_id */ + case 495: /* table_alias */ + case 501: /* star_func */ + case 503: /* noarg_func */ + case 521: /* alias_opt */ { +#line 1084 "sql.y" +#line 3627 "sql.c" } break; case 390: /* privileges */ case 393: /* priv_type_list */ case 394: /* priv_type */ { +#line 131 "sql.y" +#line 3636 "sql.c" } break; case 391: /* priv_level */ { +#line 148 "sql.y" +#line 3643 "sql.c" } break; case 400: /* force_opt */ case 401: /* unsafe_opt */ case 402: /* not_exists_opt */ case 404: /* exists_opt */ - case 470: /* analyze_opt */ - case 473: /* or_replace_opt */ - case 474: /* agg_func_opt */ - case 484: /* ignore_opt */ - case 531: /* set_quantifier_opt */ - case 532: /* tag_mode_opt */ + case 471: /* analyze_opt */ + case 474: /* or_replace_opt */ + case 475: /* agg_func_opt */ + case 485: /* ignore_opt */ + case 532: /* set_quantifier_opt */ + case 533: /* tag_mode_opt */ { +#line 180 "sql.y" +#line 3659 "sql.c" } break; case 413: /* alter_db_option */ - case 439: /* alter_table_option */ + case 441: /* alter_table_option */ { +#line 288 "sql.y" +#line 3667 "sql.c" } break; case 425: /* type_name */ - case 436: /* type_name_default_len */ + case 438: /* type_name_default_len */ { +#line 427 "sql.y" +#line 3675 "sql.c" } break; - case 444: /* db_kind_opt */ - case 451: /* table_kind */ + case 446: /* db_kind_opt */ + case 452: /* table_kind */ { +#line 606 "sql.y" +#line 3683 "sql.c" } break; - case 445: /* table_kind_db_name_cond_opt */ + case 447: /* table_kind_db_name_cond_opt */ { +#line 571 "sql.y" +#line 3690 "sql.c" } break; - case 455: /* tsma_func_list */ + case 456: /* tsma_func_list */ { - nodesDestroyNode((yypminor->yy416)); +#line 625 "sql.y" + nodesDestroyNode((yypminor->yy54)); +#line 3697 "sql.c" } break; - case 510: /* compare_op */ - case 511: /* in_op */ + case 511: /* compare_op */ + case 512: /* in_op */ { +#line 1282 "sql.y" +#line 3705 "sql.c" } break; - case 523: /* join_type */ + case 524: /* join_type */ { +#line 1363 "sql.y" +#line 3712 "sql.c" } break; - case 524: /* join_subtype */ + case 525: /* join_subtype */ { +#line 1371 "sql.y" +#line 3719 "sql.c" } break; - case 545: /* fill_mode */ + case 546: /* fill_mode */ { +#line 1487 "sql.y" +#line 3726 "sql.c" } break; - case 556: /* ordering_specification_opt */ + case 557: /* ordering_specification_opt */ { +#line 1572 "sql.y" +#line 3733 "sql.c" } break; - case 557: /* null_ordering_opt */ + case 558: /* null_ordering_opt */ { +#line 1578 "sql.y" +#line 3740 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -4169,559 +4227,561 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 422, /* (198) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ 419, /* (199) multi_create_clause ::= create_subtable_clause */ 419, /* (200) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 428, /* (201) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 421, /* (202) multi_drop_clause ::= drop_table_clause */ - 421, /* (203) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 431, /* (204) drop_table_clause ::= exists_opt full_table_name */ - 429, /* (205) specific_cols_opt ::= */ - 429, /* (206) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 415, /* (207) full_table_name ::= table_name */ - 415, /* (208) full_table_name ::= db_name NK_DOT table_name */ - 433, /* (209) tag_def_list ::= tag_def */ - 433, /* (210) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 434, /* (211) tag_def ::= column_name type_name */ - 416, /* (212) column_def_list ::= column_def */ - 416, /* (213) column_def_list ::= column_def_list NK_COMMA column_def */ - 435, /* (214) column_def ::= column_name type_name column_options */ - 425, /* (215) type_name ::= BOOL */ - 425, /* (216) type_name ::= TINYINT */ - 425, /* (217) type_name ::= SMALLINT */ - 425, /* (218) type_name ::= INT */ - 425, /* (219) type_name ::= INTEGER */ - 425, /* (220) type_name ::= BIGINT */ - 425, /* (221) type_name ::= FLOAT */ - 425, /* (222) type_name ::= DOUBLE */ - 425, /* (223) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 425, /* (224) type_name ::= TIMESTAMP */ - 425, /* (225) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 425, /* (226) type_name ::= TINYINT UNSIGNED */ - 425, /* (227) type_name ::= SMALLINT UNSIGNED */ - 425, /* (228) type_name ::= INT UNSIGNED */ - 425, /* (229) type_name ::= BIGINT UNSIGNED */ - 425, /* (230) type_name ::= JSON */ - 425, /* (231) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 425, /* (232) type_name ::= MEDIUMBLOB */ - 425, /* (233) type_name ::= BLOB */ - 425, /* (234) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 425, /* (235) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 425, /* (236) type_name ::= DECIMAL */ - 425, /* (237) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 425, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 436, /* (239) type_name_default_len ::= BINARY */ - 436, /* (240) type_name_default_len ::= NCHAR */ - 436, /* (241) type_name_default_len ::= VARCHAR */ - 436, /* (242) type_name_default_len ::= VARBINARY */ - 417, /* (243) tags_def_opt ::= */ - 417, /* (244) tags_def_opt ::= tags_def */ - 420, /* (245) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 418, /* (246) table_options ::= */ - 418, /* (247) table_options ::= table_options COMMENT NK_STRING */ - 418, /* (248) table_options ::= table_options MAX_DELAY duration_list */ - 418, /* (249) table_options ::= table_options WATERMARK duration_list */ - 418, /* (250) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 418, /* (251) table_options ::= table_options TTL NK_INTEGER */ - 418, /* (252) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 418, /* (253) table_options ::= table_options DELETE_MARK duration_list */ - 423, /* (254) alter_table_options ::= alter_table_option */ - 423, /* (255) alter_table_options ::= alter_table_options alter_table_option */ - 439, /* (256) alter_table_option ::= COMMENT NK_STRING */ - 439, /* (257) alter_table_option ::= TTL NK_INTEGER */ - 437, /* (258) duration_list ::= duration_literal */ - 437, /* (259) duration_list ::= duration_list NK_COMMA duration_literal */ - 438, /* (260) rollup_func_list ::= rollup_func_name */ - 438, /* (261) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 441, /* (262) rollup_func_name ::= function_name */ - 441, /* (263) rollup_func_name ::= FIRST */ - 441, /* (264) rollup_func_name ::= LAST */ - 432, /* (265) col_name_list ::= col_name */ - 432, /* (266) col_name_list ::= col_name_list NK_COMMA col_name */ - 443, /* (267) col_name ::= column_name */ - 378, /* (268) cmd ::= SHOW DNODES */ - 378, /* (269) cmd ::= SHOW USERS */ - 378, /* (270) cmd ::= SHOW USERS FULL */ - 378, /* (271) cmd ::= SHOW USER PRIVILEGES */ - 378, /* (272) cmd ::= SHOW db_kind_opt DATABASES */ - 378, /* (273) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 378, /* (274) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 378, /* (275) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 378, /* (276) cmd ::= SHOW MNODES */ - 378, /* (277) cmd ::= SHOW QNODES */ - 378, /* (278) cmd ::= SHOW ARBGROUPS */ - 378, /* (279) cmd ::= SHOW FUNCTIONS */ - 378, /* (280) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 378, /* (281) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 378, /* (282) cmd ::= SHOW STREAMS */ - 378, /* (283) cmd ::= SHOW ACCOUNTS */ - 378, /* (284) cmd ::= SHOW APPS */ - 378, /* (285) cmd ::= SHOW CONNECTIONS */ - 378, /* (286) cmd ::= SHOW LICENCES */ - 378, /* (287) cmd ::= SHOW GRANTS */ - 378, /* (288) cmd ::= SHOW GRANTS FULL */ - 378, /* (289) cmd ::= SHOW GRANTS LOGS */ - 378, /* (290) cmd ::= SHOW CLUSTER MACHINES */ - 378, /* (291) cmd ::= SHOW CREATE DATABASE db_name */ - 378, /* (292) cmd ::= SHOW CREATE TABLE full_table_name */ - 378, /* (293) cmd ::= SHOW CREATE STABLE full_table_name */ - 378, /* (294) cmd ::= SHOW ENCRYPTIONS */ - 378, /* (295) cmd ::= SHOW QUERIES */ - 378, /* (296) cmd ::= SHOW SCORES */ - 378, /* (297) cmd ::= SHOW TOPICS */ - 378, /* (298) cmd ::= SHOW VARIABLES */ - 378, /* (299) cmd ::= SHOW CLUSTER VARIABLES */ - 378, /* (300) cmd ::= SHOW LOCAL VARIABLES */ - 378, /* (301) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 378, /* (302) cmd ::= SHOW BNODES */ - 378, /* (303) cmd ::= SHOW SNODES */ - 378, /* (304) cmd ::= SHOW CLUSTER */ - 378, /* (305) cmd ::= SHOW TRANSACTIONS */ - 378, /* (306) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 378, /* (307) cmd ::= SHOW CONSUMERS */ - 378, /* (308) cmd ::= SHOW SUBSCRIPTIONS */ - 378, /* (309) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 378, /* (310) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 378, /* (311) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 378, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 378, /* (313) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 378, /* (314) cmd ::= SHOW VNODES */ - 378, /* (315) cmd ::= SHOW db_name_cond_opt ALIVE */ - 378, /* (316) cmd ::= SHOW CLUSTER ALIVE */ - 378, /* (317) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 378, /* (318) cmd ::= SHOW CREATE VIEW full_table_name */ - 378, /* (319) cmd ::= SHOW COMPACTS */ - 378, /* (320) cmd ::= SHOW COMPACT NK_INTEGER */ - 445, /* (321) table_kind_db_name_cond_opt ::= */ - 445, /* (322) table_kind_db_name_cond_opt ::= table_kind */ - 445, /* (323) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 445, /* (324) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 451, /* (325) table_kind ::= NORMAL */ - 451, /* (326) table_kind ::= CHILD */ - 447, /* (327) db_name_cond_opt ::= */ - 447, /* (328) db_name_cond_opt ::= db_name NK_DOT */ - 446, /* (329) like_pattern_opt ::= */ - 446, /* (330) like_pattern_opt ::= LIKE NK_STRING */ - 448, /* (331) table_name_cond ::= table_name */ - 449, /* (332) from_db_opt ::= */ - 449, /* (333) from_db_opt ::= FROM db_name */ - 450, /* (334) tag_list_opt ::= */ - 450, /* (335) tag_list_opt ::= tag_item */ - 450, /* (336) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 452, /* (337) tag_item ::= TBNAME */ - 452, /* (338) tag_item ::= QTAGS */ - 452, /* (339) tag_item ::= column_name */ - 452, /* (340) tag_item ::= column_name column_alias */ - 452, /* (341) tag_item ::= column_name AS column_alias */ - 444, /* (342) db_kind_opt ::= */ - 444, /* (343) db_kind_opt ::= USER */ - 444, /* (344) db_kind_opt ::= SYSTEM */ - 378, /* (345) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (346) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (347) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 378, /* (348) cmd ::= SHOW db_name_cond_opt TSMAS */ - 456, /* (349) full_tsma_name ::= tsma_name */ - 456, /* (350) full_tsma_name ::= db_name NK_DOT tsma_name */ - 455, /* (351) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 378, /* (352) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 378, /* (353) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 378, /* (354) cmd ::= DROP INDEX exists_opt full_index_name */ - 459, /* (355) full_index_name ::= index_name */ - 459, /* (356) full_index_name ::= db_name NK_DOT index_name */ - 458, /* (357) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 458, /* (358) 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 */ - 457, /* (359) func_list ::= func */ - 457, /* (360) func_list ::= func_list NK_COMMA func */ - 463, /* (361) func ::= sma_func_name NK_LP expression_list NK_RP */ - 464, /* (362) sma_func_name ::= function_name */ - 464, /* (363) sma_func_name ::= COUNT */ - 464, /* (364) sma_func_name ::= FIRST */ - 464, /* (365) sma_func_name ::= LAST */ - 464, /* (366) sma_func_name ::= LAST_ROW */ - 462, /* (367) sma_stream_opt ::= */ - 462, /* (368) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 462, /* (369) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 462, /* (370) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 466, /* (371) with_meta ::= AS */ - 466, /* (372) with_meta ::= WITH META AS */ - 466, /* (373) with_meta ::= ONLY META AS */ - 378, /* (374) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 378, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 378, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 378, /* (377) cmd ::= DROP TOPIC exists_opt topic_name */ - 378, /* (378) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 378, /* (379) cmd ::= DESC full_table_name */ - 378, /* (380) cmd ::= DESCRIBE full_table_name */ - 378, /* (381) cmd ::= RESET QUERY CACHE */ - 378, /* (382) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 378, /* (383) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 470, /* (384) analyze_opt ::= */ - 470, /* (385) analyze_opt ::= ANALYZE */ - 471, /* (386) explain_options ::= */ - 471, /* (387) explain_options ::= explain_options VERBOSE NK_BOOL */ - 471, /* (388) explain_options ::= explain_options RATIO NK_FLOAT */ - 378, /* (389) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 378, /* (390) cmd ::= DROP FUNCTION exists_opt function_name */ - 474, /* (391) agg_func_opt ::= */ - 474, /* (392) agg_func_opt ::= AGGREGATE */ - 475, /* (393) bufsize_opt ::= */ - 475, /* (394) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 476, /* (395) language_opt ::= */ - 476, /* (396) language_opt ::= LANGUAGE NK_STRING */ - 473, /* (397) or_replace_opt ::= */ - 473, /* (398) or_replace_opt ::= OR REPLACE */ - 378, /* (399) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 378, /* (400) cmd ::= DROP VIEW exists_opt full_view_name */ - 477, /* (401) full_view_name ::= view_name */ - 477, /* (402) full_view_name ::= db_name NK_DOT view_name */ - 378, /* (403) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 378, /* (404) cmd ::= DROP STREAM exists_opt stream_name */ - 378, /* (405) cmd ::= PAUSE STREAM exists_opt stream_name */ - 378, /* (406) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 481, /* (407) col_list_opt ::= */ - 481, /* (408) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 485, /* (409) column_stream_def_list ::= column_stream_def */ - 485, /* (410) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 486, /* (411) column_stream_def ::= column_name stream_col_options */ - 487, /* (412) stream_col_options ::= */ - 487, /* (413) stream_col_options ::= stream_col_options PRIMARY KEY */ - 482, /* (414) tag_def_or_ref_opt ::= */ - 482, /* (415) tag_def_or_ref_opt ::= tags_def */ - 482, /* (416) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 480, /* (417) stream_options ::= */ - 480, /* (418) stream_options ::= stream_options TRIGGER AT_ONCE */ - 480, /* (419) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 480, /* (420) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 480, /* (421) stream_options ::= stream_options WATERMARK duration_literal */ - 480, /* (422) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 480, /* (423) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 480, /* (424) stream_options ::= stream_options DELETE_MARK duration_literal */ - 480, /* (425) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 483, /* (426) subtable_opt ::= */ - 483, /* (427) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 484, /* (428) ignore_opt ::= */ - 484, /* (429) ignore_opt ::= IGNORE UNTREATED */ - 378, /* (430) cmd ::= KILL CONNECTION NK_INTEGER */ - 378, /* (431) cmd ::= KILL QUERY NK_STRING */ - 378, /* (432) cmd ::= KILL TRANSACTION NK_INTEGER */ - 378, /* (433) cmd ::= KILL COMPACT NK_INTEGER */ - 378, /* (434) cmd ::= BALANCE VGROUP */ - 378, /* (435) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 378, /* (436) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 378, /* (437) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 378, /* (438) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 378, /* (439) cmd ::= SPLIT VGROUP NK_INTEGER */ - 489, /* (440) on_vgroup_id ::= */ - 489, /* (441) on_vgroup_id ::= ON NK_INTEGER */ - 490, /* (442) dnode_list ::= DNODE NK_INTEGER */ - 490, /* (443) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 378, /* (444) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 378, /* (445) cmd ::= query_or_subquery */ - 378, /* (446) cmd ::= insert_query */ - 472, /* (447) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 472, /* (448) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 427, /* (449) tags_literal ::= NK_INTEGER */ - 427, /* (450) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 427, /* (451) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 427, /* (452) tags_literal ::= NK_PLUS NK_INTEGER */ - 427, /* (453) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 427, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 427, /* (455) tags_literal ::= NK_MINUS NK_INTEGER */ - 427, /* (456) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 427, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 427, /* (458) tags_literal ::= NK_FLOAT */ - 427, /* (459) tags_literal ::= NK_PLUS NK_FLOAT */ - 427, /* (460) tags_literal ::= NK_MINUS NK_FLOAT */ - 427, /* (461) tags_literal ::= NK_BIN */ - 427, /* (462) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 427, /* (463) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 427, /* (464) tags_literal ::= NK_PLUS NK_BIN */ - 427, /* (465) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 427, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 427, /* (467) tags_literal ::= NK_MINUS NK_BIN */ - 427, /* (468) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 427, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 427, /* (470) tags_literal ::= NK_HEX */ - 427, /* (471) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 427, /* (472) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 427, /* (473) tags_literal ::= NK_PLUS NK_HEX */ - 427, /* (474) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 427, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 427, /* (476) tags_literal ::= NK_MINUS NK_HEX */ - 427, /* (477) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 427, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 427, /* (479) tags_literal ::= NK_STRING */ - 427, /* (480) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 427, /* (481) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 427, /* (482) tags_literal ::= NK_BOOL */ - 427, /* (483) tags_literal ::= NULL */ - 427, /* (484) tags_literal ::= literal_func */ - 427, /* (485) tags_literal ::= literal_func NK_PLUS duration_literal */ - 427, /* (486) tags_literal ::= literal_func NK_MINUS duration_literal */ - 430, /* (487) tags_literal_list ::= tags_literal */ - 430, /* (488) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 381, /* (489) literal ::= NK_INTEGER */ - 381, /* (490) literal ::= NK_FLOAT */ - 381, /* (491) literal ::= NK_STRING */ - 381, /* (492) literal ::= NK_BOOL */ - 381, /* (493) literal ::= TIMESTAMP NK_STRING */ - 381, /* (494) literal ::= duration_literal */ - 381, /* (495) literal ::= NULL */ - 381, /* (496) literal ::= NK_QUESTION */ - 440, /* (497) duration_literal ::= NK_VARIABLE */ - 412, /* (498) signed ::= NK_INTEGER */ - 412, /* (499) signed ::= NK_PLUS NK_INTEGER */ - 412, /* (500) signed ::= NK_MINUS NK_INTEGER */ - 412, /* (501) signed ::= NK_FLOAT */ - 412, /* (502) signed ::= NK_PLUS NK_FLOAT */ - 412, /* (503) signed ::= NK_MINUS NK_FLOAT */ - 492, /* (504) signed_literal ::= signed */ - 492, /* (505) signed_literal ::= NK_STRING */ - 492, /* (506) signed_literal ::= NK_BOOL */ - 492, /* (507) signed_literal ::= TIMESTAMP NK_STRING */ - 492, /* (508) signed_literal ::= duration_literal */ - 492, /* (509) signed_literal ::= NULL */ - 492, /* (510) signed_literal ::= literal_func */ - 492, /* (511) signed_literal ::= NK_QUESTION */ - 493, /* (512) literal_list ::= signed_literal */ - 493, /* (513) literal_list ::= literal_list NK_COMMA signed_literal */ - 395, /* (514) db_name ::= NK_ID */ - 396, /* (515) table_name ::= NK_ID */ - 424, /* (516) column_name ::= NK_ID */ - 442, /* (517) function_name ::= NK_ID */ - 478, /* (518) view_name ::= NK_ID */ - 494, /* (519) table_alias ::= NK_ID */ - 453, /* (520) column_alias ::= NK_ID */ - 453, /* (521) column_alias ::= NK_ALIAS */ - 388, /* (522) user_name ::= NK_ID */ - 397, /* (523) topic_name ::= NK_ID */ - 479, /* (524) stream_name ::= NK_ID */ - 469, /* (525) cgroup_name ::= NK_ID */ - 460, /* (526) index_name ::= NK_ID */ - 454, /* (527) tsma_name ::= NK_ID */ - 495, /* (528) expr_or_subquery ::= expression */ - 488, /* (529) expression ::= literal */ - 488, /* (530) expression ::= pseudo_column */ - 488, /* (531) expression ::= column_reference */ - 488, /* (532) expression ::= function_expression */ - 488, /* (533) expression ::= case_when_expression */ - 488, /* (534) expression ::= NK_LP expression NK_RP */ - 488, /* (535) expression ::= NK_PLUS expr_or_subquery */ - 488, /* (536) expression ::= NK_MINUS expr_or_subquery */ - 488, /* (537) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 488, /* (538) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 488, /* (539) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 488, /* (540) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 488, /* (541) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 488, /* (542) expression ::= column_reference NK_ARROW NK_STRING */ - 488, /* (543) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 488, /* (544) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 465, /* (545) expression_list ::= expr_or_subquery */ - 465, /* (546) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 497, /* (547) column_reference ::= column_name */ - 497, /* (548) column_reference ::= table_name NK_DOT column_name */ - 497, /* (549) column_reference ::= NK_ALIAS */ - 497, /* (550) column_reference ::= table_name NK_DOT NK_ALIAS */ - 496, /* (551) pseudo_column ::= ROWTS */ - 496, /* (552) pseudo_column ::= TBNAME */ - 496, /* (553) pseudo_column ::= table_name NK_DOT TBNAME */ - 496, /* (554) pseudo_column ::= QSTART */ - 496, /* (555) pseudo_column ::= QEND */ - 496, /* (556) pseudo_column ::= QDURATION */ - 496, /* (557) pseudo_column ::= WSTART */ - 496, /* (558) pseudo_column ::= WEND */ - 496, /* (559) pseudo_column ::= WDURATION */ - 496, /* (560) pseudo_column ::= IROWTS */ - 496, /* (561) pseudo_column ::= ISFILLED */ - 496, /* (562) pseudo_column ::= QTAGS */ - 498, /* (563) function_expression ::= function_name NK_LP expression_list NK_RP */ - 498, /* (564) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 498, /* (565) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 498, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 498, /* (567) function_expression ::= literal_func */ - 491, /* (568) literal_func ::= noarg_func NK_LP NK_RP */ - 491, /* (569) literal_func ::= NOW */ - 491, /* (570) literal_func ::= TODAY */ - 502, /* (571) noarg_func ::= NOW */ - 502, /* (572) noarg_func ::= TODAY */ - 502, /* (573) noarg_func ::= TIMEZONE */ - 502, /* (574) noarg_func ::= DATABASE */ - 502, /* (575) noarg_func ::= CLIENT_VERSION */ - 502, /* (576) noarg_func ::= SERVER_VERSION */ - 502, /* (577) noarg_func ::= SERVER_STATUS */ - 502, /* (578) noarg_func ::= CURRENT_USER */ - 502, /* (579) noarg_func ::= USER */ - 500, /* (580) star_func ::= COUNT */ - 500, /* (581) star_func ::= FIRST */ - 500, /* (582) star_func ::= LAST */ - 500, /* (583) star_func ::= LAST_ROW */ - 501, /* (584) star_func_para_list ::= NK_STAR */ - 501, /* (585) star_func_para_list ::= other_para_list */ - 503, /* (586) other_para_list ::= star_func_para */ - 503, /* (587) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 504, /* (588) star_func_para ::= expr_or_subquery */ - 504, /* (589) star_func_para ::= table_name NK_DOT NK_STAR */ - 499, /* (590) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 499, /* (591) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 505, /* (592) when_then_list ::= when_then_expr */ - 505, /* (593) when_then_list ::= when_then_list when_then_expr */ - 508, /* (594) when_then_expr ::= WHEN common_expression THEN common_expression */ - 506, /* (595) case_when_else_opt ::= */ - 506, /* (596) case_when_else_opt ::= ELSE common_expression */ - 509, /* (597) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 509, /* (598) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 509, /* (599) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 509, /* (600) predicate ::= expr_or_subquery IS NULL */ - 509, /* (601) predicate ::= expr_or_subquery IS NOT NULL */ - 509, /* (602) predicate ::= expr_or_subquery in_op in_predicate_value */ - 510, /* (603) compare_op ::= NK_LT */ - 510, /* (604) compare_op ::= NK_GT */ - 510, /* (605) compare_op ::= NK_LE */ - 510, /* (606) compare_op ::= NK_GE */ - 510, /* (607) compare_op ::= NK_NE */ - 510, /* (608) compare_op ::= NK_EQ */ - 510, /* (609) compare_op ::= LIKE */ - 510, /* (610) compare_op ::= NOT LIKE */ - 510, /* (611) compare_op ::= MATCH */ - 510, /* (612) compare_op ::= NMATCH */ - 510, /* (613) compare_op ::= CONTAINS */ - 511, /* (614) in_op ::= IN */ - 511, /* (615) in_op ::= NOT IN */ - 512, /* (616) in_predicate_value ::= NK_LP literal_list NK_RP */ - 513, /* (617) boolean_value_expression ::= boolean_primary */ - 513, /* (618) boolean_value_expression ::= NOT boolean_primary */ - 513, /* (619) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 513, /* (620) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 514, /* (621) boolean_primary ::= predicate */ - 514, /* (622) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 507, /* (623) common_expression ::= expr_or_subquery */ - 507, /* (624) common_expression ::= boolean_value_expression */ - 515, /* (625) from_clause_opt ::= */ - 515, /* (626) from_clause_opt ::= FROM table_reference_list */ - 516, /* (627) table_reference_list ::= table_reference */ - 516, /* (628) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 517, /* (629) table_reference ::= table_primary */ - 517, /* (630) table_reference ::= joined_table */ - 518, /* (631) table_primary ::= table_name alias_opt */ - 518, /* (632) table_primary ::= db_name NK_DOT table_name alias_opt */ - 518, /* (633) table_primary ::= subquery alias_opt */ - 518, /* (634) table_primary ::= parenthesized_joined_table */ - 520, /* (635) alias_opt ::= */ - 520, /* (636) alias_opt ::= table_alias */ - 520, /* (637) alias_opt ::= AS table_alias */ - 522, /* (638) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 522, /* (639) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 519, /* (640) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 523, /* (641) join_type ::= */ - 523, /* (642) join_type ::= INNER */ - 523, /* (643) join_type ::= LEFT */ - 523, /* (644) join_type ::= RIGHT */ - 523, /* (645) join_type ::= FULL */ - 524, /* (646) join_subtype ::= */ - 524, /* (647) join_subtype ::= OUTER */ - 524, /* (648) join_subtype ::= SEMI */ - 524, /* (649) join_subtype ::= ANTI */ - 524, /* (650) join_subtype ::= ASOF */ - 524, /* (651) join_subtype ::= WINDOW */ - 525, /* (652) join_on_clause_opt ::= */ - 525, /* (653) join_on_clause_opt ::= ON search_condition */ - 526, /* (654) window_offset_clause_opt ::= */ - 526, /* (655) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 528, /* (656) window_offset_literal ::= NK_VARIABLE */ - 528, /* (657) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 527, /* (658) jlimit_clause_opt ::= */ - 527, /* (659) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 529, /* (660) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 530, /* (661) hint_list ::= */ - 530, /* (662) hint_list ::= NK_HINT */ - 532, /* (663) tag_mode_opt ::= */ - 532, /* (664) tag_mode_opt ::= TAGS */ - 531, /* (665) set_quantifier_opt ::= */ - 531, /* (666) set_quantifier_opt ::= DISTINCT */ - 531, /* (667) set_quantifier_opt ::= ALL */ - 533, /* (668) select_list ::= select_item */ - 533, /* (669) select_list ::= select_list NK_COMMA select_item */ - 541, /* (670) select_item ::= NK_STAR */ - 541, /* (671) select_item ::= common_expression */ - 541, /* (672) select_item ::= common_expression column_alias */ - 541, /* (673) select_item ::= common_expression AS column_alias */ - 541, /* (674) select_item ::= table_name NK_DOT NK_STAR */ - 468, /* (675) where_clause_opt ::= */ - 468, /* (676) where_clause_opt ::= WHERE search_condition */ - 534, /* (677) partition_by_clause_opt ::= */ - 534, /* (678) partition_by_clause_opt ::= PARTITION BY partition_list */ - 542, /* (679) partition_list ::= partition_item */ - 542, /* (680) partition_list ::= partition_list NK_COMMA partition_item */ - 543, /* (681) partition_item ::= expr_or_subquery */ - 543, /* (682) partition_item ::= expr_or_subquery column_alias */ - 543, /* (683) partition_item ::= expr_or_subquery AS column_alias */ - 538, /* (684) twindow_clause_opt ::= */ - 538, /* (685) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 538, /* (686) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 538, /* (687) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 538, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 538, /* (689) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 538, /* (690) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 538, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 461, /* (692) sliding_opt ::= */ - 461, /* (693) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 544, /* (694) interval_sliding_duration_literal ::= NK_VARIABLE */ - 544, /* (695) interval_sliding_duration_literal ::= NK_STRING */ - 544, /* (696) interval_sliding_duration_literal ::= NK_INTEGER */ - 537, /* (697) fill_opt ::= */ - 537, /* (698) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 537, /* (699) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 537, /* (700) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 545, /* (701) fill_mode ::= NONE */ - 545, /* (702) fill_mode ::= PREV */ - 545, /* (703) fill_mode ::= NULL */ - 545, /* (704) fill_mode ::= NULL_F */ - 545, /* (705) fill_mode ::= LINEAR */ - 545, /* (706) fill_mode ::= NEXT */ - 539, /* (707) group_by_clause_opt ::= */ - 539, /* (708) group_by_clause_opt ::= GROUP BY group_by_list */ - 546, /* (709) group_by_list ::= expr_or_subquery */ - 546, /* (710) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 540, /* (711) having_clause_opt ::= */ - 540, /* (712) having_clause_opt ::= HAVING search_condition */ - 535, /* (713) range_opt ::= */ - 535, /* (714) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 535, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 536, /* (716) every_opt ::= */ - 536, /* (717) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 547, /* (718) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 548, /* (719) query_simple ::= query_specification */ - 548, /* (720) query_simple ::= union_query_expression */ - 552, /* (721) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 552, /* (722) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 553, /* (723) query_simple_or_subquery ::= query_simple */ - 553, /* (724) query_simple_or_subquery ::= subquery */ - 467, /* (725) query_or_subquery ::= query_expression */ - 467, /* (726) query_or_subquery ::= subquery */ - 549, /* (727) order_by_clause_opt ::= */ - 549, /* (728) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 550, /* (729) slimit_clause_opt ::= */ - 550, /* (730) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 550, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 550, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 551, /* (733) limit_clause_opt ::= */ - 551, /* (734) limit_clause_opt ::= LIMIT NK_INTEGER */ - 551, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 551, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 521, /* (737) subquery ::= NK_LP query_expression NK_RP */ - 521, /* (738) subquery ::= NK_LP subquery NK_RP */ - 398, /* (739) search_condition ::= common_expression */ - 554, /* (740) sort_specification_list ::= sort_specification */ - 554, /* (741) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 555, /* (742) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 556, /* (743) ordering_specification_opt ::= */ - 556, /* (744) ordering_specification_opt ::= ASC */ - 556, /* (745) ordering_specification_opt ::= DESC */ - 557, /* (746) null_ordering_opt ::= */ - 557, /* (747) null_ordering_opt ::= NULLS FIRST */ - 557, /* (748) null_ordering_opt ::= NULLS LAST */ - 426, /* (749) column_options ::= */ - 426, /* (750) column_options ::= column_options PRIMARY KEY */ - 426, /* (751) column_options ::= column_options ENCODE NK_STRING */ - 426, /* (752) column_options ::= column_options COMPRESS NK_STRING */ - 426, /* (753) column_options ::= column_options LEVEL NK_STRING */ + 419, /* (201) multi_create_clause ::= create_from_file_clause */ + 428, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + 429, /* (203) create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + 421, /* (204) multi_drop_clause ::= drop_table_clause */ + 421, /* (205) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 433, /* (206) drop_table_clause ::= exists_opt full_table_name */ + 430, /* (207) specific_cols_opt ::= */ + 430, /* (208) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 415, /* (209) full_table_name ::= table_name */ + 415, /* (210) full_table_name ::= db_name NK_DOT table_name */ + 435, /* (211) tag_def_list ::= tag_def */ + 435, /* (212) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + 436, /* (213) tag_def ::= column_name type_name */ + 416, /* (214) column_def_list ::= column_def */ + 416, /* (215) column_def_list ::= column_def_list NK_COMMA column_def */ + 437, /* (216) column_def ::= column_name type_name column_options */ + 425, /* (217) type_name ::= BOOL */ + 425, /* (218) type_name ::= TINYINT */ + 425, /* (219) type_name ::= SMALLINT */ + 425, /* (220) type_name ::= INT */ + 425, /* (221) type_name ::= INTEGER */ + 425, /* (222) type_name ::= BIGINT */ + 425, /* (223) type_name ::= FLOAT */ + 425, /* (224) type_name ::= DOUBLE */ + 425, /* (225) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 425, /* (226) type_name ::= TIMESTAMP */ + 425, /* (227) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 425, /* (228) type_name ::= TINYINT UNSIGNED */ + 425, /* (229) type_name ::= SMALLINT UNSIGNED */ + 425, /* (230) type_name ::= INT UNSIGNED */ + 425, /* (231) type_name ::= BIGINT UNSIGNED */ + 425, /* (232) type_name ::= JSON */ + 425, /* (233) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 425, /* (234) type_name ::= MEDIUMBLOB */ + 425, /* (235) type_name ::= BLOB */ + 425, /* (236) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 425, /* (237) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 425, /* (238) type_name ::= DECIMAL */ + 425, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 425, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 438, /* (241) type_name_default_len ::= BINARY */ + 438, /* (242) type_name_default_len ::= NCHAR */ + 438, /* (243) type_name_default_len ::= VARCHAR */ + 438, /* (244) type_name_default_len ::= VARBINARY */ + 417, /* (245) tags_def_opt ::= */ + 417, /* (246) tags_def_opt ::= tags_def */ + 420, /* (247) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 418, /* (248) table_options ::= */ + 418, /* (249) table_options ::= table_options COMMENT NK_STRING */ + 418, /* (250) table_options ::= table_options MAX_DELAY duration_list */ + 418, /* (251) table_options ::= table_options WATERMARK duration_list */ + 418, /* (252) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 418, /* (253) table_options ::= table_options TTL NK_INTEGER */ + 418, /* (254) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 418, /* (255) table_options ::= table_options DELETE_MARK duration_list */ + 423, /* (256) alter_table_options ::= alter_table_option */ + 423, /* (257) alter_table_options ::= alter_table_options alter_table_option */ + 441, /* (258) alter_table_option ::= COMMENT NK_STRING */ + 441, /* (259) alter_table_option ::= TTL NK_INTEGER */ + 439, /* (260) duration_list ::= duration_literal */ + 439, /* (261) duration_list ::= duration_list NK_COMMA duration_literal */ + 440, /* (262) rollup_func_list ::= rollup_func_name */ + 440, /* (263) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 443, /* (264) rollup_func_name ::= function_name */ + 443, /* (265) rollup_func_name ::= FIRST */ + 443, /* (266) rollup_func_name ::= LAST */ + 434, /* (267) col_name_list ::= col_name */ + 434, /* (268) col_name_list ::= col_name_list NK_COMMA col_name */ + 445, /* (269) col_name ::= column_name */ + 378, /* (270) cmd ::= SHOW DNODES */ + 378, /* (271) cmd ::= SHOW USERS */ + 378, /* (272) cmd ::= SHOW USERS FULL */ + 378, /* (273) cmd ::= SHOW USER PRIVILEGES */ + 378, /* (274) cmd ::= SHOW db_kind_opt DATABASES */ + 378, /* (275) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 378, /* (276) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 378, /* (277) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 378, /* (278) cmd ::= SHOW MNODES */ + 378, /* (279) cmd ::= SHOW QNODES */ + 378, /* (280) cmd ::= SHOW ARBGROUPS */ + 378, /* (281) cmd ::= SHOW FUNCTIONS */ + 378, /* (282) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 378, /* (283) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 378, /* (284) cmd ::= SHOW STREAMS */ + 378, /* (285) cmd ::= SHOW ACCOUNTS */ + 378, /* (286) cmd ::= SHOW APPS */ + 378, /* (287) cmd ::= SHOW CONNECTIONS */ + 378, /* (288) cmd ::= SHOW LICENCES */ + 378, /* (289) cmd ::= SHOW GRANTS */ + 378, /* (290) cmd ::= SHOW GRANTS FULL */ + 378, /* (291) cmd ::= SHOW GRANTS LOGS */ + 378, /* (292) cmd ::= SHOW CLUSTER MACHINES */ + 378, /* (293) cmd ::= SHOW CREATE DATABASE db_name */ + 378, /* (294) cmd ::= SHOW CREATE TABLE full_table_name */ + 378, /* (295) cmd ::= SHOW CREATE STABLE full_table_name */ + 378, /* (296) cmd ::= SHOW ENCRYPTIONS */ + 378, /* (297) cmd ::= SHOW QUERIES */ + 378, /* (298) cmd ::= SHOW SCORES */ + 378, /* (299) cmd ::= SHOW TOPICS */ + 378, /* (300) cmd ::= SHOW VARIABLES */ + 378, /* (301) cmd ::= SHOW CLUSTER VARIABLES */ + 378, /* (302) cmd ::= SHOW LOCAL VARIABLES */ + 378, /* (303) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 378, /* (304) cmd ::= SHOW BNODES */ + 378, /* (305) cmd ::= SHOW SNODES */ + 378, /* (306) cmd ::= SHOW CLUSTER */ + 378, /* (307) cmd ::= SHOW TRANSACTIONS */ + 378, /* (308) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 378, /* (309) cmd ::= SHOW CONSUMERS */ + 378, /* (310) cmd ::= SHOW SUBSCRIPTIONS */ + 378, /* (311) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 378, /* (312) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 378, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 378, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 378, /* (315) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 378, /* (316) cmd ::= SHOW VNODES */ + 378, /* (317) cmd ::= SHOW db_name_cond_opt ALIVE */ + 378, /* (318) cmd ::= SHOW CLUSTER ALIVE */ + 378, /* (319) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + 378, /* (320) cmd ::= SHOW CREATE VIEW full_table_name */ + 378, /* (321) cmd ::= SHOW COMPACTS */ + 378, /* (322) cmd ::= SHOW COMPACT NK_INTEGER */ + 447, /* (323) table_kind_db_name_cond_opt ::= */ + 447, /* (324) table_kind_db_name_cond_opt ::= table_kind */ + 447, /* (325) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 447, /* (326) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 452, /* (327) table_kind ::= NORMAL */ + 452, /* (328) table_kind ::= CHILD */ + 449, /* (329) db_name_cond_opt ::= */ + 449, /* (330) db_name_cond_opt ::= db_name NK_DOT */ + 448, /* (331) like_pattern_opt ::= */ + 448, /* (332) like_pattern_opt ::= LIKE NK_STRING */ + 450, /* (333) table_name_cond ::= table_name */ + 451, /* (334) from_db_opt ::= */ + 451, /* (335) from_db_opt ::= FROM db_name */ + 432, /* (336) tag_list_opt ::= */ + 432, /* (337) tag_list_opt ::= tag_item */ + 432, /* (338) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 453, /* (339) tag_item ::= TBNAME */ + 453, /* (340) tag_item ::= QTAGS */ + 453, /* (341) tag_item ::= column_name */ + 453, /* (342) tag_item ::= column_name column_alias */ + 453, /* (343) tag_item ::= column_name AS column_alias */ + 446, /* (344) db_kind_opt ::= */ + 446, /* (345) db_kind_opt ::= USER */ + 446, /* (346) db_kind_opt ::= SYSTEM */ + 378, /* (347) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + 378, /* (348) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + 378, /* (349) cmd ::= DROP TSMA exists_opt full_tsma_name */ + 378, /* (350) cmd ::= SHOW db_name_cond_opt TSMAS */ + 457, /* (351) full_tsma_name ::= tsma_name */ + 457, /* (352) full_tsma_name ::= db_name NK_DOT tsma_name */ + 456, /* (353) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + 378, /* (354) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 378, /* (355) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 378, /* (356) cmd ::= DROP INDEX exists_opt full_index_name */ + 460, /* (357) full_index_name ::= index_name */ + 460, /* (358) full_index_name ::= db_name NK_DOT index_name */ + 459, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 459, /* (360) 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 */ + 458, /* (361) func_list ::= func */ + 458, /* (362) func_list ::= func_list NK_COMMA func */ + 464, /* (363) func ::= sma_func_name NK_LP expression_list NK_RP */ + 465, /* (364) sma_func_name ::= function_name */ + 465, /* (365) sma_func_name ::= COUNT */ + 465, /* (366) sma_func_name ::= FIRST */ + 465, /* (367) sma_func_name ::= LAST */ + 465, /* (368) sma_func_name ::= LAST_ROW */ + 463, /* (369) sma_stream_opt ::= */ + 463, /* (370) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 463, /* (371) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 463, /* (372) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 467, /* (373) with_meta ::= AS */ + 467, /* (374) with_meta ::= WITH META AS */ + 467, /* (375) with_meta ::= ONLY META AS */ + 378, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 378, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 378, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 378, /* (379) cmd ::= DROP TOPIC exists_opt topic_name */ + 378, /* (380) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 378, /* (381) cmd ::= DESC full_table_name */ + 378, /* (382) cmd ::= DESCRIBE full_table_name */ + 378, /* (383) cmd ::= RESET QUERY CACHE */ + 378, /* (384) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 378, /* (385) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 471, /* (386) analyze_opt ::= */ + 471, /* (387) analyze_opt ::= ANALYZE */ + 472, /* (388) explain_options ::= */ + 472, /* (389) explain_options ::= explain_options VERBOSE NK_BOOL */ + 472, /* (390) explain_options ::= explain_options RATIO NK_FLOAT */ + 378, /* (391) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 378, /* (392) cmd ::= DROP FUNCTION exists_opt function_name */ + 475, /* (393) agg_func_opt ::= */ + 475, /* (394) agg_func_opt ::= AGGREGATE */ + 476, /* (395) bufsize_opt ::= */ + 476, /* (396) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 477, /* (397) language_opt ::= */ + 477, /* (398) language_opt ::= LANGUAGE NK_STRING */ + 474, /* (399) or_replace_opt ::= */ + 474, /* (400) or_replace_opt ::= OR REPLACE */ + 378, /* (401) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 378, /* (402) cmd ::= DROP VIEW exists_opt full_view_name */ + 478, /* (403) full_view_name ::= view_name */ + 478, /* (404) full_view_name ::= db_name NK_DOT view_name */ + 378, /* (405) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + 378, /* (406) cmd ::= DROP STREAM exists_opt stream_name */ + 378, /* (407) cmd ::= PAUSE STREAM exists_opt stream_name */ + 378, /* (408) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 482, /* (409) col_list_opt ::= */ + 482, /* (410) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 486, /* (411) column_stream_def_list ::= column_stream_def */ + 486, /* (412) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 487, /* (413) column_stream_def ::= column_name stream_col_options */ + 488, /* (414) stream_col_options ::= */ + 488, /* (415) stream_col_options ::= stream_col_options PRIMARY KEY */ + 483, /* (416) tag_def_or_ref_opt ::= */ + 483, /* (417) tag_def_or_ref_opt ::= tags_def */ + 483, /* (418) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 481, /* (419) stream_options ::= */ + 481, /* (420) stream_options ::= stream_options TRIGGER AT_ONCE */ + 481, /* (421) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 481, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 481, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ + 481, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 481, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 481, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ + 481, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 484, /* (428) subtable_opt ::= */ + 484, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 485, /* (430) ignore_opt ::= */ + 485, /* (431) ignore_opt ::= IGNORE UNTREATED */ + 378, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ + 378, /* (433) cmd ::= KILL QUERY NK_STRING */ + 378, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ + 378, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ + 378, /* (436) cmd ::= BALANCE VGROUP */ + 378, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 378, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + 378, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 378, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 378, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ + 490, /* (442) on_vgroup_id ::= */ + 490, /* (443) on_vgroup_id ::= ON NK_INTEGER */ + 491, /* (444) dnode_list ::= DNODE NK_INTEGER */ + 491, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 378, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 378, /* (447) cmd ::= query_or_subquery */ + 378, /* (448) cmd ::= insert_query */ + 473, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 473, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 427, /* (451) tags_literal ::= NK_INTEGER */ + 427, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + 427, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + 427, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ + 427, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + 427, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + 427, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ + 427, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + 427, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + 427, /* (460) tags_literal ::= NK_FLOAT */ + 427, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ + 427, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ + 427, /* (463) tags_literal ::= NK_BIN */ + 427, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + 427, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + 427, /* (466) tags_literal ::= NK_PLUS NK_BIN */ + 427, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + 427, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + 427, /* (469) tags_literal ::= NK_MINUS NK_BIN */ + 427, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + 427, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + 427, /* (472) tags_literal ::= NK_HEX */ + 427, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + 427, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + 427, /* (475) tags_literal ::= NK_PLUS NK_HEX */ + 427, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + 427, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + 427, /* (478) tags_literal ::= NK_MINUS NK_HEX */ + 427, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + 427, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + 427, /* (481) tags_literal ::= NK_STRING */ + 427, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + 427, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + 427, /* (484) tags_literal ::= NK_BOOL */ + 427, /* (485) tags_literal ::= NULL */ + 427, /* (486) tags_literal ::= literal_func */ + 427, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ + 427, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ + 431, /* (489) tags_literal_list ::= tags_literal */ + 431, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + 381, /* (491) literal ::= NK_INTEGER */ + 381, /* (492) literal ::= NK_FLOAT */ + 381, /* (493) literal ::= NK_STRING */ + 381, /* (494) literal ::= NK_BOOL */ + 381, /* (495) literal ::= TIMESTAMP NK_STRING */ + 381, /* (496) literal ::= duration_literal */ + 381, /* (497) literal ::= NULL */ + 381, /* (498) literal ::= NK_QUESTION */ + 442, /* (499) duration_literal ::= NK_VARIABLE */ + 412, /* (500) signed ::= NK_INTEGER */ + 412, /* (501) signed ::= NK_PLUS NK_INTEGER */ + 412, /* (502) signed ::= NK_MINUS NK_INTEGER */ + 412, /* (503) signed ::= NK_FLOAT */ + 412, /* (504) signed ::= NK_PLUS NK_FLOAT */ + 412, /* (505) signed ::= NK_MINUS NK_FLOAT */ + 493, /* (506) signed_literal ::= signed */ + 493, /* (507) signed_literal ::= NK_STRING */ + 493, /* (508) signed_literal ::= NK_BOOL */ + 493, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ + 493, /* (510) signed_literal ::= duration_literal */ + 493, /* (511) signed_literal ::= NULL */ + 493, /* (512) signed_literal ::= literal_func */ + 493, /* (513) signed_literal ::= NK_QUESTION */ + 494, /* (514) literal_list ::= signed_literal */ + 494, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ + 395, /* (516) db_name ::= NK_ID */ + 396, /* (517) table_name ::= NK_ID */ + 424, /* (518) column_name ::= NK_ID */ + 444, /* (519) function_name ::= NK_ID */ + 479, /* (520) view_name ::= NK_ID */ + 495, /* (521) table_alias ::= NK_ID */ + 454, /* (522) column_alias ::= NK_ID */ + 454, /* (523) column_alias ::= NK_ALIAS */ + 388, /* (524) user_name ::= NK_ID */ + 397, /* (525) topic_name ::= NK_ID */ + 480, /* (526) stream_name ::= NK_ID */ + 470, /* (527) cgroup_name ::= NK_ID */ + 461, /* (528) index_name ::= NK_ID */ + 455, /* (529) tsma_name ::= NK_ID */ + 496, /* (530) expr_or_subquery ::= expression */ + 489, /* (531) expression ::= literal */ + 489, /* (532) expression ::= pseudo_column */ + 489, /* (533) expression ::= column_reference */ + 489, /* (534) expression ::= function_expression */ + 489, /* (535) expression ::= case_when_expression */ + 489, /* (536) expression ::= NK_LP expression NK_RP */ + 489, /* (537) expression ::= NK_PLUS expr_or_subquery */ + 489, /* (538) expression ::= NK_MINUS expr_or_subquery */ + 489, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 489, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 489, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 489, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 489, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 489, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ + 489, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 489, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 466, /* (547) expression_list ::= expr_or_subquery */ + 466, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 498, /* (549) column_reference ::= column_name */ + 498, /* (550) column_reference ::= table_name NK_DOT column_name */ + 498, /* (551) column_reference ::= NK_ALIAS */ + 498, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ + 497, /* (553) pseudo_column ::= ROWTS */ + 497, /* (554) pseudo_column ::= TBNAME */ + 497, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ + 497, /* (556) pseudo_column ::= QSTART */ + 497, /* (557) pseudo_column ::= QEND */ + 497, /* (558) pseudo_column ::= QDURATION */ + 497, /* (559) pseudo_column ::= WSTART */ + 497, /* (560) pseudo_column ::= WEND */ + 497, /* (561) pseudo_column ::= WDURATION */ + 497, /* (562) pseudo_column ::= IROWTS */ + 497, /* (563) pseudo_column ::= ISFILLED */ + 497, /* (564) pseudo_column ::= QTAGS */ + 499, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ + 499, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 499, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 499, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + 499, /* (569) function_expression ::= literal_func */ + 492, /* (570) literal_func ::= noarg_func NK_LP NK_RP */ + 492, /* (571) literal_func ::= NOW */ + 492, /* (572) literal_func ::= TODAY */ + 503, /* (573) noarg_func ::= NOW */ + 503, /* (574) noarg_func ::= TODAY */ + 503, /* (575) noarg_func ::= TIMEZONE */ + 503, /* (576) noarg_func ::= DATABASE */ + 503, /* (577) noarg_func ::= CLIENT_VERSION */ + 503, /* (578) noarg_func ::= SERVER_VERSION */ + 503, /* (579) noarg_func ::= SERVER_STATUS */ + 503, /* (580) noarg_func ::= CURRENT_USER */ + 503, /* (581) noarg_func ::= USER */ + 501, /* (582) star_func ::= COUNT */ + 501, /* (583) star_func ::= FIRST */ + 501, /* (584) star_func ::= LAST */ + 501, /* (585) star_func ::= LAST_ROW */ + 502, /* (586) star_func_para_list ::= NK_STAR */ + 502, /* (587) star_func_para_list ::= other_para_list */ + 504, /* (588) other_para_list ::= star_func_para */ + 504, /* (589) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 505, /* (590) star_func_para ::= expr_or_subquery */ + 505, /* (591) star_func_para ::= table_name NK_DOT NK_STAR */ + 500, /* (592) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 500, /* (593) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 506, /* (594) when_then_list ::= when_then_expr */ + 506, /* (595) when_then_list ::= when_then_list when_then_expr */ + 509, /* (596) when_then_expr ::= WHEN common_expression THEN common_expression */ + 507, /* (597) case_when_else_opt ::= */ + 507, /* (598) case_when_else_opt ::= ELSE common_expression */ + 510, /* (599) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 510, /* (600) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 510, /* (601) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 510, /* (602) predicate ::= expr_or_subquery IS NULL */ + 510, /* (603) predicate ::= expr_or_subquery IS NOT NULL */ + 510, /* (604) predicate ::= expr_or_subquery in_op in_predicate_value */ + 511, /* (605) compare_op ::= NK_LT */ + 511, /* (606) compare_op ::= NK_GT */ + 511, /* (607) compare_op ::= NK_LE */ + 511, /* (608) compare_op ::= NK_GE */ + 511, /* (609) compare_op ::= NK_NE */ + 511, /* (610) compare_op ::= NK_EQ */ + 511, /* (611) compare_op ::= LIKE */ + 511, /* (612) compare_op ::= NOT LIKE */ + 511, /* (613) compare_op ::= MATCH */ + 511, /* (614) compare_op ::= NMATCH */ + 511, /* (615) compare_op ::= CONTAINS */ + 512, /* (616) in_op ::= IN */ + 512, /* (617) in_op ::= NOT IN */ + 513, /* (618) in_predicate_value ::= NK_LP literal_list NK_RP */ + 514, /* (619) boolean_value_expression ::= boolean_primary */ + 514, /* (620) boolean_value_expression ::= NOT boolean_primary */ + 514, /* (621) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 514, /* (622) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 515, /* (623) boolean_primary ::= predicate */ + 515, /* (624) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 508, /* (625) common_expression ::= expr_or_subquery */ + 508, /* (626) common_expression ::= boolean_value_expression */ + 516, /* (627) from_clause_opt ::= */ + 516, /* (628) from_clause_opt ::= FROM table_reference_list */ + 517, /* (629) table_reference_list ::= table_reference */ + 517, /* (630) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 518, /* (631) table_reference ::= table_primary */ + 518, /* (632) table_reference ::= joined_table */ + 519, /* (633) table_primary ::= table_name alias_opt */ + 519, /* (634) table_primary ::= db_name NK_DOT table_name alias_opt */ + 519, /* (635) table_primary ::= subquery alias_opt */ + 519, /* (636) table_primary ::= parenthesized_joined_table */ + 521, /* (637) alias_opt ::= */ + 521, /* (638) alias_opt ::= table_alias */ + 521, /* (639) alias_opt ::= AS table_alias */ + 523, /* (640) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 523, /* (641) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 520, /* (642) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 524, /* (643) join_type ::= */ + 524, /* (644) join_type ::= INNER */ + 524, /* (645) join_type ::= LEFT */ + 524, /* (646) join_type ::= RIGHT */ + 524, /* (647) join_type ::= FULL */ + 525, /* (648) join_subtype ::= */ + 525, /* (649) join_subtype ::= OUTER */ + 525, /* (650) join_subtype ::= SEMI */ + 525, /* (651) join_subtype ::= ANTI */ + 525, /* (652) join_subtype ::= ASOF */ + 525, /* (653) join_subtype ::= WINDOW */ + 526, /* (654) join_on_clause_opt ::= */ + 526, /* (655) join_on_clause_opt ::= ON search_condition */ + 527, /* (656) window_offset_clause_opt ::= */ + 527, /* (657) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + 529, /* (658) window_offset_literal ::= NK_VARIABLE */ + 529, /* (659) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 528, /* (660) jlimit_clause_opt ::= */ + 528, /* (661) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + 530, /* (662) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 531, /* (663) hint_list ::= */ + 531, /* (664) hint_list ::= NK_HINT */ + 533, /* (665) tag_mode_opt ::= */ + 533, /* (666) tag_mode_opt ::= TAGS */ + 532, /* (667) set_quantifier_opt ::= */ + 532, /* (668) set_quantifier_opt ::= DISTINCT */ + 532, /* (669) set_quantifier_opt ::= ALL */ + 534, /* (670) select_list ::= select_item */ + 534, /* (671) select_list ::= select_list NK_COMMA select_item */ + 542, /* (672) select_item ::= NK_STAR */ + 542, /* (673) select_item ::= common_expression */ + 542, /* (674) select_item ::= common_expression column_alias */ + 542, /* (675) select_item ::= common_expression AS column_alias */ + 542, /* (676) select_item ::= table_name NK_DOT NK_STAR */ + 469, /* (677) where_clause_opt ::= */ + 469, /* (678) where_clause_opt ::= WHERE search_condition */ + 535, /* (679) partition_by_clause_opt ::= */ + 535, /* (680) partition_by_clause_opt ::= PARTITION BY partition_list */ + 543, /* (681) partition_list ::= partition_item */ + 543, /* (682) partition_list ::= partition_list NK_COMMA partition_item */ + 544, /* (683) partition_item ::= expr_or_subquery */ + 544, /* (684) partition_item ::= expr_or_subquery column_alias */ + 544, /* (685) partition_item ::= expr_or_subquery AS column_alias */ + 539, /* (686) twindow_clause_opt ::= */ + 539, /* (687) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 539, /* (688) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 539, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 539, /* (690) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 539, /* (691) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 539, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 539, /* (693) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 462, /* (694) sliding_opt ::= */ + 462, /* (695) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 545, /* (696) interval_sliding_duration_literal ::= NK_VARIABLE */ + 545, /* (697) interval_sliding_duration_literal ::= NK_STRING */ + 545, /* (698) interval_sliding_duration_literal ::= NK_INTEGER */ + 538, /* (699) fill_opt ::= */ + 538, /* (700) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 538, /* (701) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 538, /* (702) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 546, /* (703) fill_mode ::= NONE */ + 546, /* (704) fill_mode ::= PREV */ + 546, /* (705) fill_mode ::= NULL */ + 546, /* (706) fill_mode ::= NULL_F */ + 546, /* (707) fill_mode ::= LINEAR */ + 546, /* (708) fill_mode ::= NEXT */ + 540, /* (709) group_by_clause_opt ::= */ + 540, /* (710) group_by_clause_opt ::= GROUP BY group_by_list */ + 547, /* (711) group_by_list ::= expr_or_subquery */ + 547, /* (712) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 541, /* (713) having_clause_opt ::= */ + 541, /* (714) having_clause_opt ::= HAVING search_condition */ + 536, /* (715) range_opt ::= */ + 536, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 536, /* (717) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 537, /* (718) every_opt ::= */ + 537, /* (719) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 548, /* (720) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 549, /* (721) query_simple ::= query_specification */ + 549, /* (722) query_simple ::= union_query_expression */ + 553, /* (723) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 553, /* (724) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 554, /* (725) query_simple_or_subquery ::= query_simple */ + 554, /* (726) query_simple_or_subquery ::= subquery */ + 468, /* (727) query_or_subquery ::= query_expression */ + 468, /* (728) query_or_subquery ::= subquery */ + 550, /* (729) order_by_clause_opt ::= */ + 550, /* (730) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 551, /* (731) slimit_clause_opt ::= */ + 551, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 551, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 551, /* (734) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 552, /* (735) limit_clause_opt ::= */ + 552, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER */ + 552, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 552, /* (738) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 522, /* (739) subquery ::= NK_LP query_expression NK_RP */ + 522, /* (740) subquery ::= NK_LP subquery NK_RP */ + 398, /* (741) search_condition ::= common_expression */ + 555, /* (742) sort_specification_list ::= sort_specification */ + 555, /* (743) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 556, /* (744) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 557, /* (745) ordering_specification_opt ::= */ + 557, /* (746) ordering_specification_opt ::= ASC */ + 557, /* (747) ordering_specification_opt ::= DESC */ + 558, /* (748) null_ordering_opt ::= */ + 558, /* (749) null_ordering_opt ::= NULLS FIRST */ + 558, /* (750) null_ordering_opt ::= NULLS LAST */ + 426, /* (751) column_options ::= */ + 426, /* (752) column_options ::= column_options PRIMARY KEY */ + 426, /* (753) column_options ::= column_options ENCODE NK_STRING */ + 426, /* (754) column_options ::= column_options COMPRESS NK_STRING */ + 426, /* (755) column_options ::= column_options LEVEL NK_STRING */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4928,559 +4988,561 @@ static const signed char yyRuleInfoNRhs[] = { -6, /* (198) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -1, /* (199) multi_create_clause ::= create_subtable_clause */ -2, /* (200) multi_create_clause ::= multi_create_clause create_subtable_clause */ - -10, /* (201) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - -1, /* (202) multi_drop_clause ::= drop_table_clause */ - -3, /* (203) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - -2, /* (204) drop_table_clause ::= exists_opt full_table_name */ - 0, /* (205) specific_cols_opt ::= */ - -3, /* (206) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (207) full_table_name ::= table_name */ - -3, /* (208) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (209) tag_def_list ::= tag_def */ - -3, /* (210) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - -2, /* (211) tag_def ::= column_name type_name */ - -1, /* (212) column_def_list ::= column_def */ - -3, /* (213) column_def_list ::= column_def_list NK_COMMA column_def */ - -3, /* (214) column_def ::= column_name type_name column_options */ - -1, /* (215) type_name ::= BOOL */ - -1, /* (216) type_name ::= TINYINT */ - -1, /* (217) type_name ::= SMALLINT */ - -1, /* (218) type_name ::= INT */ - -1, /* (219) type_name ::= INTEGER */ - -1, /* (220) type_name ::= BIGINT */ - -1, /* (221) type_name ::= FLOAT */ - -1, /* (222) type_name ::= DOUBLE */ - -4, /* (223) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (224) type_name ::= TIMESTAMP */ - -4, /* (225) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (226) type_name ::= TINYINT UNSIGNED */ - -2, /* (227) type_name ::= SMALLINT UNSIGNED */ - -2, /* (228) type_name ::= INT UNSIGNED */ - -2, /* (229) type_name ::= BIGINT UNSIGNED */ - -1, /* (230) type_name ::= JSON */ - -4, /* (231) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (232) type_name ::= MEDIUMBLOB */ - -1, /* (233) type_name ::= BLOB */ - -4, /* (234) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (235) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (236) type_name ::= DECIMAL */ - -4, /* (237) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - -1, /* (239) type_name_default_len ::= BINARY */ - -1, /* (240) type_name_default_len ::= NCHAR */ - -1, /* (241) type_name_default_len ::= VARCHAR */ - -1, /* (242) type_name_default_len ::= VARBINARY */ - 0, /* (243) tags_def_opt ::= */ - -1, /* (244) tags_def_opt ::= tags_def */ - -4, /* (245) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 0, /* (246) table_options ::= */ - -3, /* (247) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (248) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (249) table_options ::= table_options WATERMARK duration_list */ - -5, /* (250) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (251) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (252) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (253) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (254) alter_table_options ::= alter_table_option */ - -2, /* (255) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (256) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (257) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (258) duration_list ::= duration_literal */ - -3, /* (259) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (260) rollup_func_list ::= rollup_func_name */ - -3, /* (261) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (262) rollup_func_name ::= function_name */ - -1, /* (263) rollup_func_name ::= FIRST */ - -1, /* (264) rollup_func_name ::= LAST */ - -1, /* (265) col_name_list ::= col_name */ - -3, /* (266) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (267) col_name ::= column_name */ - -2, /* (268) cmd ::= SHOW DNODES */ - -2, /* (269) cmd ::= SHOW USERS */ - -3, /* (270) cmd ::= SHOW USERS FULL */ - -3, /* (271) cmd ::= SHOW USER PRIVILEGES */ - -3, /* (272) cmd ::= SHOW db_kind_opt DATABASES */ - -4, /* (273) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (274) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (275) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (276) cmd ::= SHOW MNODES */ - -2, /* (277) cmd ::= SHOW QNODES */ - -2, /* (278) cmd ::= SHOW ARBGROUPS */ - -2, /* (279) cmd ::= SHOW FUNCTIONS */ - -5, /* (280) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (281) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (282) cmd ::= SHOW STREAMS */ - -2, /* (283) cmd ::= SHOW ACCOUNTS */ - -2, /* (284) cmd ::= SHOW APPS */ - -2, /* (285) cmd ::= SHOW CONNECTIONS */ - -2, /* (286) cmd ::= SHOW LICENCES */ - -2, /* (287) cmd ::= SHOW GRANTS */ - -3, /* (288) cmd ::= SHOW GRANTS FULL */ - -3, /* (289) cmd ::= SHOW GRANTS LOGS */ - -3, /* (290) cmd ::= SHOW CLUSTER MACHINES */ - -4, /* (291) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (292) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (293) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (294) cmd ::= SHOW ENCRYPTIONS */ - -2, /* (295) cmd ::= SHOW QUERIES */ - -2, /* (296) cmd ::= SHOW SCORES */ - -2, /* (297) cmd ::= SHOW TOPICS */ - -2, /* (298) cmd ::= SHOW VARIABLES */ - -3, /* (299) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (300) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (301) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (302) cmd ::= SHOW BNODES */ - -2, /* (303) cmd ::= SHOW SNODES */ - -2, /* (304) cmd ::= SHOW CLUSTER */ - -2, /* (305) cmd ::= SHOW TRANSACTIONS */ - -4, /* (306) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (307) cmd ::= SHOW CONSUMERS */ - -2, /* (308) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (309) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (310) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (311) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (313) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (314) cmd ::= SHOW VNODES */ - -3, /* (315) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (316) cmd ::= SHOW CLUSTER ALIVE */ - -4, /* (317) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - -4, /* (318) cmd ::= SHOW CREATE VIEW full_table_name */ - -2, /* (319) cmd ::= SHOW COMPACTS */ - -3, /* (320) cmd ::= SHOW COMPACT NK_INTEGER */ - 0, /* (321) table_kind_db_name_cond_opt ::= */ - -1, /* (322) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (323) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (324) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (325) table_kind ::= NORMAL */ - -1, /* (326) table_kind ::= CHILD */ - 0, /* (327) db_name_cond_opt ::= */ - -2, /* (328) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (329) like_pattern_opt ::= */ - -2, /* (330) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (331) table_name_cond ::= table_name */ - 0, /* (332) from_db_opt ::= */ - -2, /* (333) from_db_opt ::= FROM db_name */ - 0, /* (334) tag_list_opt ::= */ - -1, /* (335) tag_list_opt ::= tag_item */ - -3, /* (336) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (337) tag_item ::= TBNAME */ - -1, /* (338) tag_item ::= QTAGS */ - -1, /* (339) tag_item ::= column_name */ - -2, /* (340) tag_item ::= column_name column_alias */ - -3, /* (341) tag_item ::= column_name AS column_alias */ - 0, /* (342) db_kind_opt ::= */ - -1, /* (343) db_kind_opt ::= USER */ - -1, /* (344) db_kind_opt ::= SYSTEM */ - -11, /* (345) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - -11, /* (346) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - -4, /* (347) cmd ::= DROP TSMA exists_opt full_tsma_name */ - -3, /* (348) cmd ::= SHOW db_name_cond_opt TSMAS */ - -1, /* (349) full_tsma_name ::= tsma_name */ - -3, /* (350) full_tsma_name ::= db_name NK_DOT tsma_name */ - -4, /* (351) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - -8, /* (352) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (353) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (354) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (355) full_index_name ::= index_name */ - -3, /* (356) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (357) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (358) 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 */ - -1, /* (359) func_list ::= func */ - -3, /* (360) func_list ::= func_list NK_COMMA func */ - -4, /* (361) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (362) sma_func_name ::= function_name */ - -1, /* (363) sma_func_name ::= COUNT */ - -1, /* (364) sma_func_name ::= FIRST */ - -1, /* (365) sma_func_name ::= LAST */ - -1, /* (366) sma_func_name ::= LAST_ROW */ - 0, /* (367) sma_stream_opt ::= */ - -3, /* (368) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (369) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (370) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (371) with_meta ::= AS */ - -3, /* (372) with_meta ::= WITH META AS */ - -3, /* (373) with_meta ::= ONLY META AS */ - -6, /* (374) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (377) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (378) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (379) cmd ::= DESC full_table_name */ - -2, /* (380) cmd ::= DESCRIBE full_table_name */ - -3, /* (381) cmd ::= RESET QUERY CACHE */ - -4, /* (382) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (383) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (384) analyze_opt ::= */ - -1, /* (385) analyze_opt ::= ANALYZE */ - 0, /* (386) explain_options ::= */ - -3, /* (387) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (388) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (389) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (390) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (391) agg_func_opt ::= */ - -1, /* (392) agg_func_opt ::= AGGREGATE */ - 0, /* (393) bufsize_opt ::= */ - -2, /* (394) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (395) language_opt ::= */ - -2, /* (396) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (397) or_replace_opt ::= */ - -2, /* (398) or_replace_opt ::= OR REPLACE */ - -6, /* (399) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (400) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (401) full_view_name ::= view_name */ - -3, /* (402) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (403) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (404) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (405) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (406) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (407) col_list_opt ::= */ - -3, /* (408) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - -1, /* (409) column_stream_def_list ::= column_stream_def */ - -3, /* (410) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - -2, /* (411) column_stream_def ::= column_name stream_col_options */ - 0, /* (412) stream_col_options ::= */ - -3, /* (413) stream_col_options ::= stream_col_options PRIMARY KEY */ - 0, /* (414) tag_def_or_ref_opt ::= */ - -1, /* (415) tag_def_or_ref_opt ::= tags_def */ - -4, /* (416) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 0, /* (417) stream_options ::= */ - -3, /* (418) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (419) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (420) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (421) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (422) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (423) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (424) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (425) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (426) subtable_opt ::= */ - -4, /* (427) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (428) ignore_opt ::= */ - -2, /* (429) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (430) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (431) cmd ::= KILL QUERY NK_STRING */ - -3, /* (432) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (433) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (434) cmd ::= BALANCE VGROUP */ - -4, /* (435) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -5, /* (436) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - -4, /* (437) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (438) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (439) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (440) on_vgroup_id ::= */ - -2, /* (441) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (442) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (443) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (444) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (445) cmd ::= query_or_subquery */ - -1, /* (446) cmd ::= insert_query */ - -7, /* (447) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (448) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (449) tags_literal ::= NK_INTEGER */ - -3, /* (450) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - -3, /* (451) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - -2, /* (452) tags_literal ::= NK_PLUS NK_INTEGER */ - -4, /* (453) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - -2, /* (455) tags_literal ::= NK_MINUS NK_INTEGER */ - -4, /* (456) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - -1, /* (458) tags_literal ::= NK_FLOAT */ - -2, /* (459) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (460) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (461) tags_literal ::= NK_BIN */ - -3, /* (462) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - -3, /* (463) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - -2, /* (464) tags_literal ::= NK_PLUS NK_BIN */ - -4, /* (465) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - -4, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - -2, /* (467) tags_literal ::= NK_MINUS NK_BIN */ - -4, /* (468) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - -4, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - -1, /* (470) tags_literal ::= NK_HEX */ - -3, /* (471) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - -3, /* (472) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - -2, /* (473) tags_literal ::= NK_PLUS NK_HEX */ - -4, /* (474) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - -4, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - -2, /* (476) tags_literal ::= NK_MINUS NK_HEX */ - -4, /* (477) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - -4, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - -1, /* (479) tags_literal ::= NK_STRING */ - -3, /* (480) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - -3, /* (481) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - -1, /* (482) tags_literal ::= NK_BOOL */ - -1, /* (483) tags_literal ::= NULL */ - -1, /* (484) tags_literal ::= literal_func */ - -3, /* (485) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (486) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (487) tags_literal_list ::= tags_literal */ - -3, /* (488) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (489) literal ::= NK_INTEGER */ - -1, /* (490) literal ::= NK_FLOAT */ - -1, /* (491) literal ::= NK_STRING */ - -1, /* (492) literal ::= NK_BOOL */ - -2, /* (493) literal ::= TIMESTAMP NK_STRING */ - -1, /* (494) literal ::= duration_literal */ - -1, /* (495) literal ::= NULL */ - -1, /* (496) literal ::= NK_QUESTION */ - -1, /* (497) duration_literal ::= NK_VARIABLE */ - -1, /* (498) signed ::= NK_INTEGER */ - -2, /* (499) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (500) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (501) signed ::= NK_FLOAT */ - -2, /* (502) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (503) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (504) signed_literal ::= signed */ - -1, /* (505) signed_literal ::= NK_STRING */ - -1, /* (506) signed_literal ::= NK_BOOL */ - -2, /* (507) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (508) signed_literal ::= duration_literal */ - -1, /* (509) signed_literal ::= NULL */ - -1, /* (510) signed_literal ::= literal_func */ - -1, /* (511) signed_literal ::= NK_QUESTION */ - -1, /* (512) literal_list ::= signed_literal */ - -3, /* (513) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (514) db_name ::= NK_ID */ - -1, /* (515) table_name ::= NK_ID */ - -1, /* (516) column_name ::= NK_ID */ - -1, /* (517) function_name ::= NK_ID */ - -1, /* (518) view_name ::= NK_ID */ - -1, /* (519) table_alias ::= NK_ID */ - -1, /* (520) column_alias ::= NK_ID */ - -1, /* (521) column_alias ::= NK_ALIAS */ - -1, /* (522) user_name ::= NK_ID */ - -1, /* (523) topic_name ::= NK_ID */ - -1, /* (524) stream_name ::= NK_ID */ - -1, /* (525) cgroup_name ::= NK_ID */ - -1, /* (526) index_name ::= NK_ID */ - -1, /* (527) tsma_name ::= NK_ID */ - -1, /* (528) expr_or_subquery ::= expression */ - -1, /* (529) expression ::= literal */ - -1, /* (530) expression ::= pseudo_column */ - -1, /* (531) expression ::= column_reference */ - -1, /* (532) expression ::= function_expression */ - -1, /* (533) expression ::= case_when_expression */ - -3, /* (534) expression ::= NK_LP expression NK_RP */ - -2, /* (535) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (536) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (537) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (538) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (539) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (540) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (541) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (542) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (543) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (544) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (545) expression_list ::= expr_or_subquery */ - -3, /* (546) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (547) column_reference ::= column_name */ - -3, /* (548) column_reference ::= table_name NK_DOT column_name */ - -1, /* (549) column_reference ::= NK_ALIAS */ - -3, /* (550) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (551) pseudo_column ::= ROWTS */ - -1, /* (552) pseudo_column ::= TBNAME */ - -3, /* (553) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (554) pseudo_column ::= QSTART */ - -1, /* (555) pseudo_column ::= QEND */ - -1, /* (556) pseudo_column ::= QDURATION */ - -1, /* (557) pseudo_column ::= WSTART */ - -1, /* (558) pseudo_column ::= WEND */ - -1, /* (559) pseudo_column ::= WDURATION */ - -1, /* (560) pseudo_column ::= IROWTS */ - -1, /* (561) pseudo_column ::= ISFILLED */ - -1, /* (562) pseudo_column ::= QTAGS */ - -4, /* (563) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (564) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (565) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -6, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - -1, /* (567) function_expression ::= literal_func */ - -3, /* (568) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (569) literal_func ::= NOW */ - -1, /* (570) literal_func ::= TODAY */ - -1, /* (571) noarg_func ::= NOW */ - -1, /* (572) noarg_func ::= TODAY */ - -1, /* (573) noarg_func ::= TIMEZONE */ - -1, /* (574) noarg_func ::= DATABASE */ - -1, /* (575) noarg_func ::= CLIENT_VERSION */ - -1, /* (576) noarg_func ::= SERVER_VERSION */ - -1, /* (577) noarg_func ::= SERVER_STATUS */ - -1, /* (578) noarg_func ::= CURRENT_USER */ - -1, /* (579) noarg_func ::= USER */ - -1, /* (580) star_func ::= COUNT */ - -1, /* (581) star_func ::= FIRST */ - -1, /* (582) star_func ::= LAST */ - -1, /* (583) star_func ::= LAST_ROW */ - -1, /* (584) star_func_para_list ::= NK_STAR */ - -1, /* (585) star_func_para_list ::= other_para_list */ - -1, /* (586) other_para_list ::= star_func_para */ - -3, /* (587) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (588) star_func_para ::= expr_or_subquery */ - -3, /* (589) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (590) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (591) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (592) when_then_list ::= when_then_expr */ - -2, /* (593) when_then_list ::= when_then_list when_then_expr */ - -4, /* (594) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (595) case_when_else_opt ::= */ - -2, /* (596) case_when_else_opt ::= ELSE common_expression */ - -3, /* (597) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (598) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (599) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (600) predicate ::= expr_or_subquery IS NULL */ - -4, /* (601) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (602) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (603) compare_op ::= NK_LT */ - -1, /* (604) compare_op ::= NK_GT */ - -1, /* (605) compare_op ::= NK_LE */ - -1, /* (606) compare_op ::= NK_GE */ - -1, /* (607) compare_op ::= NK_NE */ - -1, /* (608) compare_op ::= NK_EQ */ - -1, /* (609) compare_op ::= LIKE */ - -2, /* (610) compare_op ::= NOT LIKE */ - -1, /* (611) compare_op ::= MATCH */ - -1, /* (612) compare_op ::= NMATCH */ - -1, /* (613) compare_op ::= CONTAINS */ - -1, /* (614) in_op ::= IN */ - -2, /* (615) in_op ::= NOT IN */ - -3, /* (616) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (617) boolean_value_expression ::= boolean_primary */ - -2, /* (618) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (619) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (620) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (621) boolean_primary ::= predicate */ - -3, /* (622) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (623) common_expression ::= expr_or_subquery */ - -1, /* (624) common_expression ::= boolean_value_expression */ - 0, /* (625) from_clause_opt ::= */ - -2, /* (626) from_clause_opt ::= FROM table_reference_list */ - -1, /* (627) table_reference_list ::= table_reference */ - -3, /* (628) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (629) table_reference ::= table_primary */ - -1, /* (630) table_reference ::= joined_table */ - -2, /* (631) table_primary ::= table_name alias_opt */ - -4, /* (632) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (633) table_primary ::= subquery alias_opt */ - -1, /* (634) table_primary ::= parenthesized_joined_table */ - 0, /* (635) alias_opt ::= */ - -1, /* (636) alias_opt ::= table_alias */ - -2, /* (637) alias_opt ::= AS table_alias */ - -3, /* (638) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (639) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (640) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (641) join_type ::= */ - -1, /* (642) join_type ::= INNER */ - -1, /* (643) join_type ::= LEFT */ - -1, /* (644) join_type ::= RIGHT */ - -1, /* (645) join_type ::= FULL */ - 0, /* (646) join_subtype ::= */ - -1, /* (647) join_subtype ::= OUTER */ - -1, /* (648) join_subtype ::= SEMI */ - -1, /* (649) join_subtype ::= ANTI */ - -1, /* (650) join_subtype ::= ASOF */ - -1, /* (651) join_subtype ::= WINDOW */ - 0, /* (652) join_on_clause_opt ::= */ - -2, /* (653) join_on_clause_opt ::= ON search_condition */ - 0, /* (654) window_offset_clause_opt ::= */ - -6, /* (655) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (656) window_offset_literal ::= NK_VARIABLE */ - -2, /* (657) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (658) jlimit_clause_opt ::= */ - -2, /* (659) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (660) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 0, /* (661) hint_list ::= */ - -1, /* (662) hint_list ::= NK_HINT */ - 0, /* (663) tag_mode_opt ::= */ - -1, /* (664) tag_mode_opt ::= TAGS */ - 0, /* (665) set_quantifier_opt ::= */ - -1, /* (666) set_quantifier_opt ::= DISTINCT */ - -1, /* (667) set_quantifier_opt ::= ALL */ - -1, /* (668) select_list ::= select_item */ - -3, /* (669) select_list ::= select_list NK_COMMA select_item */ - -1, /* (670) select_item ::= NK_STAR */ - -1, /* (671) select_item ::= common_expression */ - -2, /* (672) select_item ::= common_expression column_alias */ - -3, /* (673) select_item ::= common_expression AS column_alias */ - -3, /* (674) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (675) where_clause_opt ::= */ - -2, /* (676) where_clause_opt ::= WHERE search_condition */ - 0, /* (677) partition_by_clause_opt ::= */ - -3, /* (678) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (679) partition_list ::= partition_item */ - -3, /* (680) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (681) partition_item ::= expr_or_subquery */ - -2, /* (682) partition_item ::= expr_or_subquery column_alias */ - -3, /* (683) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (684) twindow_clause_opt ::= */ - -6, /* (685) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (686) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (687) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (689) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (690) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (692) sliding_opt ::= */ - -4, /* (693) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (694) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (695) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (696) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (697) fill_opt ::= */ - -4, /* (698) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (699) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (700) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (701) fill_mode ::= NONE */ - -1, /* (702) fill_mode ::= PREV */ - -1, /* (703) fill_mode ::= NULL */ - -1, /* (704) fill_mode ::= NULL_F */ - -1, /* (705) fill_mode ::= LINEAR */ - -1, /* (706) fill_mode ::= NEXT */ - 0, /* (707) group_by_clause_opt ::= */ - -3, /* (708) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (709) group_by_list ::= expr_or_subquery */ - -3, /* (710) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (711) having_clause_opt ::= */ - -2, /* (712) having_clause_opt ::= HAVING search_condition */ - 0, /* (713) range_opt ::= */ - -6, /* (714) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (716) every_opt ::= */ - -4, /* (717) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (718) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (719) query_simple ::= query_specification */ - -1, /* (720) query_simple ::= union_query_expression */ - -4, /* (721) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (722) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (723) query_simple_or_subquery ::= query_simple */ - -1, /* (724) query_simple_or_subquery ::= subquery */ - -1, /* (725) query_or_subquery ::= query_expression */ - -1, /* (726) query_or_subquery ::= subquery */ - 0, /* (727) order_by_clause_opt ::= */ - -3, /* (728) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (729) slimit_clause_opt ::= */ - -2, /* (730) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (733) limit_clause_opt ::= */ - -2, /* (734) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (737) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (738) subquery ::= NK_LP subquery NK_RP */ - -1, /* (739) search_condition ::= common_expression */ - -1, /* (740) sort_specification_list ::= sort_specification */ - -3, /* (741) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (742) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (743) ordering_specification_opt ::= */ - -1, /* (744) ordering_specification_opt ::= ASC */ - -1, /* (745) ordering_specification_opt ::= DESC */ - 0, /* (746) null_ordering_opt ::= */ - -2, /* (747) null_ordering_opt ::= NULLS FIRST */ - -2, /* (748) null_ordering_opt ::= NULLS LAST */ - 0, /* (749) column_options ::= */ - -3, /* (750) column_options ::= column_options PRIMARY KEY */ - -3, /* (751) column_options ::= column_options ENCODE NK_STRING */ - -3, /* (752) column_options ::= column_options COMPRESS NK_STRING */ - -3, /* (753) column_options ::= column_options LEVEL NK_STRING */ + -1, /* (201) multi_create_clause ::= create_from_file_clause */ + -10, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + -8, /* (203) create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + -1, /* (204) multi_drop_clause ::= drop_table_clause */ + -3, /* (205) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + -2, /* (206) drop_table_clause ::= exists_opt full_table_name */ + 0, /* (207) specific_cols_opt ::= */ + -3, /* (208) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + -1, /* (209) full_table_name ::= table_name */ + -3, /* (210) full_table_name ::= db_name NK_DOT table_name */ + -1, /* (211) tag_def_list ::= tag_def */ + -3, /* (212) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + -2, /* (213) tag_def ::= column_name type_name */ + -1, /* (214) column_def_list ::= column_def */ + -3, /* (215) column_def_list ::= column_def_list NK_COMMA column_def */ + -3, /* (216) column_def ::= column_name type_name column_options */ + -1, /* (217) type_name ::= BOOL */ + -1, /* (218) type_name ::= TINYINT */ + -1, /* (219) type_name ::= SMALLINT */ + -1, /* (220) type_name ::= INT */ + -1, /* (221) type_name ::= INTEGER */ + -1, /* (222) type_name ::= BIGINT */ + -1, /* (223) type_name ::= FLOAT */ + -1, /* (224) type_name ::= DOUBLE */ + -4, /* (225) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (226) type_name ::= TIMESTAMP */ + -4, /* (227) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (228) type_name ::= TINYINT UNSIGNED */ + -2, /* (229) type_name ::= SMALLINT UNSIGNED */ + -2, /* (230) type_name ::= INT UNSIGNED */ + -2, /* (231) type_name ::= BIGINT UNSIGNED */ + -1, /* (232) type_name ::= JSON */ + -4, /* (233) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (234) type_name ::= MEDIUMBLOB */ + -1, /* (235) type_name ::= BLOB */ + -4, /* (236) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (237) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (238) type_name ::= DECIMAL */ + -4, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + -1, /* (241) type_name_default_len ::= BINARY */ + -1, /* (242) type_name_default_len ::= NCHAR */ + -1, /* (243) type_name_default_len ::= VARCHAR */ + -1, /* (244) type_name_default_len ::= VARBINARY */ + 0, /* (245) tags_def_opt ::= */ + -1, /* (246) tags_def_opt ::= tags_def */ + -4, /* (247) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 0, /* (248) table_options ::= */ + -3, /* (249) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (250) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (251) table_options ::= table_options WATERMARK duration_list */ + -5, /* (252) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (253) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (254) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (255) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (256) alter_table_options ::= alter_table_option */ + -2, /* (257) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (258) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (259) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (260) duration_list ::= duration_literal */ + -3, /* (261) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (262) rollup_func_list ::= rollup_func_name */ + -3, /* (263) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (264) rollup_func_name ::= function_name */ + -1, /* (265) rollup_func_name ::= FIRST */ + -1, /* (266) rollup_func_name ::= LAST */ + -1, /* (267) col_name_list ::= col_name */ + -3, /* (268) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (269) col_name ::= column_name */ + -2, /* (270) cmd ::= SHOW DNODES */ + -2, /* (271) cmd ::= SHOW USERS */ + -3, /* (272) cmd ::= SHOW USERS FULL */ + -3, /* (273) cmd ::= SHOW USER PRIVILEGES */ + -3, /* (274) cmd ::= SHOW db_kind_opt DATABASES */ + -4, /* (275) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (276) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (277) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (278) cmd ::= SHOW MNODES */ + -2, /* (279) cmd ::= SHOW QNODES */ + -2, /* (280) cmd ::= SHOW ARBGROUPS */ + -2, /* (281) cmd ::= SHOW FUNCTIONS */ + -5, /* (282) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (283) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (284) cmd ::= SHOW STREAMS */ + -2, /* (285) cmd ::= SHOW ACCOUNTS */ + -2, /* (286) cmd ::= SHOW APPS */ + -2, /* (287) cmd ::= SHOW CONNECTIONS */ + -2, /* (288) cmd ::= SHOW LICENCES */ + -2, /* (289) cmd ::= SHOW GRANTS */ + -3, /* (290) cmd ::= SHOW GRANTS FULL */ + -3, /* (291) cmd ::= SHOW GRANTS LOGS */ + -3, /* (292) cmd ::= SHOW CLUSTER MACHINES */ + -4, /* (293) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (294) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (295) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (296) cmd ::= SHOW ENCRYPTIONS */ + -2, /* (297) cmd ::= SHOW QUERIES */ + -2, /* (298) cmd ::= SHOW SCORES */ + -2, /* (299) cmd ::= SHOW TOPICS */ + -2, /* (300) cmd ::= SHOW VARIABLES */ + -3, /* (301) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (302) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (303) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (304) cmd ::= SHOW BNODES */ + -2, /* (305) cmd ::= SHOW SNODES */ + -2, /* (306) cmd ::= SHOW CLUSTER */ + -2, /* (307) cmd ::= SHOW TRANSACTIONS */ + -4, /* (308) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (309) cmd ::= SHOW CONSUMERS */ + -2, /* (310) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (311) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (312) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (315) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (316) cmd ::= SHOW VNODES */ + -3, /* (317) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (318) cmd ::= SHOW CLUSTER ALIVE */ + -4, /* (319) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + -4, /* (320) cmd ::= SHOW CREATE VIEW full_table_name */ + -2, /* (321) cmd ::= SHOW COMPACTS */ + -3, /* (322) cmd ::= SHOW COMPACT NK_INTEGER */ + 0, /* (323) table_kind_db_name_cond_opt ::= */ + -1, /* (324) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (325) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (326) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (327) table_kind ::= NORMAL */ + -1, /* (328) table_kind ::= CHILD */ + 0, /* (329) db_name_cond_opt ::= */ + -2, /* (330) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (331) like_pattern_opt ::= */ + -2, /* (332) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (333) table_name_cond ::= table_name */ + 0, /* (334) from_db_opt ::= */ + -2, /* (335) from_db_opt ::= FROM db_name */ + 0, /* (336) tag_list_opt ::= */ + -1, /* (337) tag_list_opt ::= tag_item */ + -3, /* (338) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (339) tag_item ::= TBNAME */ + -1, /* (340) tag_item ::= QTAGS */ + -1, /* (341) tag_item ::= column_name */ + -2, /* (342) tag_item ::= column_name column_alias */ + -3, /* (343) tag_item ::= column_name AS column_alias */ + 0, /* (344) db_kind_opt ::= */ + -1, /* (345) db_kind_opt ::= USER */ + -1, /* (346) db_kind_opt ::= SYSTEM */ + -11, /* (347) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + -11, /* (348) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + -4, /* (349) cmd ::= DROP TSMA exists_opt full_tsma_name */ + -3, /* (350) cmd ::= SHOW db_name_cond_opt TSMAS */ + -1, /* (351) full_tsma_name ::= tsma_name */ + -3, /* (352) full_tsma_name ::= db_name NK_DOT tsma_name */ + -4, /* (353) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + -8, /* (354) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (355) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (356) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (357) full_index_name ::= index_name */ + -3, /* (358) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (360) 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 */ + -1, /* (361) func_list ::= func */ + -3, /* (362) func_list ::= func_list NK_COMMA func */ + -4, /* (363) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (364) sma_func_name ::= function_name */ + -1, /* (365) sma_func_name ::= COUNT */ + -1, /* (366) sma_func_name ::= FIRST */ + -1, /* (367) sma_func_name ::= LAST */ + -1, /* (368) sma_func_name ::= LAST_ROW */ + 0, /* (369) sma_stream_opt ::= */ + -3, /* (370) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (371) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (372) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (373) with_meta ::= AS */ + -3, /* (374) with_meta ::= WITH META AS */ + -3, /* (375) with_meta ::= ONLY META AS */ + -6, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (379) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (380) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (381) cmd ::= DESC full_table_name */ + -2, /* (382) cmd ::= DESCRIBE full_table_name */ + -3, /* (383) cmd ::= RESET QUERY CACHE */ + -4, /* (384) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (385) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (386) analyze_opt ::= */ + -1, /* (387) analyze_opt ::= ANALYZE */ + 0, /* (388) explain_options ::= */ + -3, /* (389) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (390) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (391) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + -4, /* (392) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (393) agg_func_opt ::= */ + -1, /* (394) agg_func_opt ::= AGGREGATE */ + 0, /* (395) bufsize_opt ::= */ + -2, /* (396) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (397) language_opt ::= */ + -2, /* (398) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (399) or_replace_opt ::= */ + -2, /* (400) or_replace_opt ::= OR REPLACE */ + -6, /* (401) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + -4, /* (402) cmd ::= DROP VIEW exists_opt full_view_name */ + -1, /* (403) full_view_name ::= view_name */ + -3, /* (404) full_view_name ::= db_name NK_DOT view_name */ + -12, /* (405) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + -4, /* (406) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (407) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (408) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (409) col_list_opt ::= */ + -3, /* (410) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + -1, /* (411) column_stream_def_list ::= column_stream_def */ + -3, /* (412) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + -2, /* (413) column_stream_def ::= column_name stream_col_options */ + 0, /* (414) stream_col_options ::= */ + -3, /* (415) stream_col_options ::= stream_col_options PRIMARY KEY */ + 0, /* (416) tag_def_or_ref_opt ::= */ + -1, /* (417) tag_def_or_ref_opt ::= tags_def */ + -4, /* (418) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 0, /* (419) stream_options ::= */ + -3, /* (420) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (421) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (428) subtable_opt ::= */ + -4, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (430) ignore_opt ::= */ + -2, /* (431) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (433) cmd ::= KILL QUERY NK_STRING */ + -3, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (436) cmd ::= BALANCE VGROUP */ + -4, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -5, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + -4, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (442) on_vgroup_id ::= */ + -2, /* (443) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (444) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (447) cmd ::= query_or_subquery */ + -1, /* (448) cmd ::= insert_query */ + -7, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (451) tags_literal ::= NK_INTEGER */ + -3, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + -3, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + -2, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ + -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + -2, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ + -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + -1, /* (460) tags_literal ::= NK_FLOAT */ + -2, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ + -2, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ + -1, /* (463) tags_literal ::= NK_BIN */ + -3, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + -3, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + -2, /* (466) tags_literal ::= NK_PLUS NK_BIN */ + -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + -4, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + -2, /* (469) tags_literal ::= NK_MINUS NK_BIN */ + -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + -4, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + -1, /* (472) tags_literal ::= NK_HEX */ + -3, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + -3, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + -2, /* (475) tags_literal ::= NK_PLUS NK_HEX */ + -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + -4, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + -2, /* (478) tags_literal ::= NK_MINUS NK_HEX */ + -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + -4, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + -1, /* (481) tags_literal ::= NK_STRING */ + -3, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + -3, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + -1, /* (484) tags_literal ::= NK_BOOL */ + -1, /* (485) tags_literal ::= NULL */ + -1, /* (486) tags_literal ::= literal_func */ + -3, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ + -3, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ + -1, /* (489) tags_literal_list ::= tags_literal */ + -3, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + -1, /* (491) literal ::= NK_INTEGER */ + -1, /* (492) literal ::= NK_FLOAT */ + -1, /* (493) literal ::= NK_STRING */ + -1, /* (494) literal ::= NK_BOOL */ + -2, /* (495) literal ::= TIMESTAMP NK_STRING */ + -1, /* (496) literal ::= duration_literal */ + -1, /* (497) literal ::= NULL */ + -1, /* (498) literal ::= NK_QUESTION */ + -1, /* (499) duration_literal ::= NK_VARIABLE */ + -1, /* (500) signed ::= NK_INTEGER */ + -2, /* (501) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (502) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (503) signed ::= NK_FLOAT */ + -2, /* (504) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (505) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (506) signed_literal ::= signed */ + -1, /* (507) signed_literal ::= NK_STRING */ + -1, /* (508) signed_literal ::= NK_BOOL */ + -2, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (510) signed_literal ::= duration_literal */ + -1, /* (511) signed_literal ::= NULL */ + -1, /* (512) signed_literal ::= literal_func */ + -1, /* (513) signed_literal ::= NK_QUESTION */ + -1, /* (514) literal_list ::= signed_literal */ + -3, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (516) db_name ::= NK_ID */ + -1, /* (517) table_name ::= NK_ID */ + -1, /* (518) column_name ::= NK_ID */ + -1, /* (519) function_name ::= NK_ID */ + -1, /* (520) view_name ::= NK_ID */ + -1, /* (521) table_alias ::= NK_ID */ + -1, /* (522) column_alias ::= NK_ID */ + -1, /* (523) column_alias ::= NK_ALIAS */ + -1, /* (524) user_name ::= NK_ID */ + -1, /* (525) topic_name ::= NK_ID */ + -1, /* (526) stream_name ::= NK_ID */ + -1, /* (527) cgroup_name ::= NK_ID */ + -1, /* (528) index_name ::= NK_ID */ + -1, /* (529) tsma_name ::= NK_ID */ + -1, /* (530) expr_or_subquery ::= expression */ + -1, /* (531) expression ::= literal */ + -1, /* (532) expression ::= pseudo_column */ + -1, /* (533) expression ::= column_reference */ + -1, /* (534) expression ::= function_expression */ + -1, /* (535) expression ::= case_when_expression */ + -3, /* (536) expression ::= NK_LP expression NK_RP */ + -2, /* (537) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (538) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (547) expression_list ::= expr_or_subquery */ + -3, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (549) column_reference ::= column_name */ + -3, /* (550) column_reference ::= table_name NK_DOT column_name */ + -1, /* (551) column_reference ::= NK_ALIAS */ + -3, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (553) pseudo_column ::= ROWTS */ + -1, /* (554) pseudo_column ::= TBNAME */ + -3, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (556) pseudo_column ::= QSTART */ + -1, /* (557) pseudo_column ::= QEND */ + -1, /* (558) pseudo_column ::= QDURATION */ + -1, /* (559) pseudo_column ::= WSTART */ + -1, /* (560) pseudo_column ::= WEND */ + -1, /* (561) pseudo_column ::= WDURATION */ + -1, /* (562) pseudo_column ::= IROWTS */ + -1, /* (563) pseudo_column ::= ISFILLED */ + -1, /* (564) pseudo_column ::= QTAGS */ + -4, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -6, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + -1, /* (569) function_expression ::= literal_func */ + -3, /* (570) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (571) literal_func ::= NOW */ + -1, /* (572) literal_func ::= TODAY */ + -1, /* (573) noarg_func ::= NOW */ + -1, /* (574) noarg_func ::= TODAY */ + -1, /* (575) noarg_func ::= TIMEZONE */ + -1, /* (576) noarg_func ::= DATABASE */ + -1, /* (577) noarg_func ::= CLIENT_VERSION */ + -1, /* (578) noarg_func ::= SERVER_VERSION */ + -1, /* (579) noarg_func ::= SERVER_STATUS */ + -1, /* (580) noarg_func ::= CURRENT_USER */ + -1, /* (581) noarg_func ::= USER */ + -1, /* (582) star_func ::= COUNT */ + -1, /* (583) star_func ::= FIRST */ + -1, /* (584) star_func ::= LAST */ + -1, /* (585) star_func ::= LAST_ROW */ + -1, /* (586) star_func_para_list ::= NK_STAR */ + -1, /* (587) star_func_para_list ::= other_para_list */ + -1, /* (588) other_para_list ::= star_func_para */ + -3, /* (589) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (590) star_func_para ::= expr_or_subquery */ + -3, /* (591) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (592) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (593) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (594) when_then_list ::= when_then_expr */ + -2, /* (595) when_then_list ::= when_then_list when_then_expr */ + -4, /* (596) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (597) case_when_else_opt ::= */ + -2, /* (598) case_when_else_opt ::= ELSE common_expression */ + -3, /* (599) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (600) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (601) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (602) predicate ::= expr_or_subquery IS NULL */ + -4, /* (603) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (604) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (605) compare_op ::= NK_LT */ + -1, /* (606) compare_op ::= NK_GT */ + -1, /* (607) compare_op ::= NK_LE */ + -1, /* (608) compare_op ::= NK_GE */ + -1, /* (609) compare_op ::= NK_NE */ + -1, /* (610) compare_op ::= NK_EQ */ + -1, /* (611) compare_op ::= LIKE */ + -2, /* (612) compare_op ::= NOT LIKE */ + -1, /* (613) compare_op ::= MATCH */ + -1, /* (614) compare_op ::= NMATCH */ + -1, /* (615) compare_op ::= CONTAINS */ + -1, /* (616) in_op ::= IN */ + -2, /* (617) in_op ::= NOT IN */ + -3, /* (618) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (619) boolean_value_expression ::= boolean_primary */ + -2, /* (620) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (621) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (622) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (623) boolean_primary ::= predicate */ + -3, /* (624) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (625) common_expression ::= expr_or_subquery */ + -1, /* (626) common_expression ::= boolean_value_expression */ + 0, /* (627) from_clause_opt ::= */ + -2, /* (628) from_clause_opt ::= FROM table_reference_list */ + -1, /* (629) table_reference_list ::= table_reference */ + -3, /* (630) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (631) table_reference ::= table_primary */ + -1, /* (632) table_reference ::= joined_table */ + -2, /* (633) table_primary ::= table_name alias_opt */ + -4, /* (634) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (635) table_primary ::= subquery alias_opt */ + -1, /* (636) table_primary ::= parenthesized_joined_table */ + 0, /* (637) alias_opt ::= */ + -1, /* (638) alias_opt ::= table_alias */ + -2, /* (639) alias_opt ::= AS table_alias */ + -3, /* (640) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (641) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -8, /* (642) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 0, /* (643) join_type ::= */ + -1, /* (644) join_type ::= INNER */ + -1, /* (645) join_type ::= LEFT */ + -1, /* (646) join_type ::= RIGHT */ + -1, /* (647) join_type ::= FULL */ + 0, /* (648) join_subtype ::= */ + -1, /* (649) join_subtype ::= OUTER */ + -1, /* (650) join_subtype ::= SEMI */ + -1, /* (651) join_subtype ::= ANTI */ + -1, /* (652) join_subtype ::= ASOF */ + -1, /* (653) join_subtype ::= WINDOW */ + 0, /* (654) join_on_clause_opt ::= */ + -2, /* (655) join_on_clause_opt ::= ON search_condition */ + 0, /* (656) window_offset_clause_opt ::= */ + -6, /* (657) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + -1, /* (658) window_offset_literal ::= NK_VARIABLE */ + -2, /* (659) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 0, /* (660) jlimit_clause_opt ::= */ + -2, /* (661) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + -14, /* (662) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (663) hint_list ::= */ + -1, /* (664) hint_list ::= NK_HINT */ + 0, /* (665) tag_mode_opt ::= */ + -1, /* (666) tag_mode_opt ::= TAGS */ + 0, /* (667) set_quantifier_opt ::= */ + -1, /* (668) set_quantifier_opt ::= DISTINCT */ + -1, /* (669) set_quantifier_opt ::= ALL */ + -1, /* (670) select_list ::= select_item */ + -3, /* (671) select_list ::= select_list NK_COMMA select_item */ + -1, /* (672) select_item ::= NK_STAR */ + -1, /* (673) select_item ::= common_expression */ + -2, /* (674) select_item ::= common_expression column_alias */ + -3, /* (675) select_item ::= common_expression AS column_alias */ + -3, /* (676) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (677) where_clause_opt ::= */ + -2, /* (678) where_clause_opt ::= WHERE search_condition */ + 0, /* (679) partition_by_clause_opt ::= */ + -3, /* (680) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (681) partition_list ::= partition_item */ + -3, /* (682) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (683) partition_item ::= expr_or_subquery */ + -2, /* (684) partition_item ::= expr_or_subquery column_alias */ + -3, /* (685) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (686) twindow_clause_opt ::= */ + -6, /* (687) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (688) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (690) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (691) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + -4, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + -6, /* (693) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (694) sliding_opt ::= */ + -4, /* (695) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (696) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (697) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (698) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (699) fill_opt ::= */ + -4, /* (700) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (701) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (702) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (703) fill_mode ::= NONE */ + -1, /* (704) fill_mode ::= PREV */ + -1, /* (705) fill_mode ::= NULL */ + -1, /* (706) fill_mode ::= NULL_F */ + -1, /* (707) fill_mode ::= LINEAR */ + -1, /* (708) fill_mode ::= NEXT */ + 0, /* (709) group_by_clause_opt ::= */ + -3, /* (710) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (711) group_by_list ::= expr_or_subquery */ + -3, /* (712) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (713) having_clause_opt ::= */ + -2, /* (714) having_clause_opt ::= HAVING search_condition */ + 0, /* (715) range_opt ::= */ + -6, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (717) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (718) every_opt ::= */ + -4, /* (719) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (720) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (721) query_simple ::= query_specification */ + -1, /* (722) query_simple ::= union_query_expression */ + -4, /* (723) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (724) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (725) query_simple_or_subquery ::= query_simple */ + -1, /* (726) query_simple_or_subquery ::= subquery */ + -1, /* (727) query_or_subquery ::= query_expression */ + -1, /* (728) query_or_subquery ::= subquery */ + 0, /* (729) order_by_clause_opt ::= */ + -3, /* (730) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (731) slimit_clause_opt ::= */ + -2, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (734) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (735) limit_clause_opt ::= */ + -2, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (738) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (739) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (740) subquery ::= NK_LP subquery NK_RP */ + -1, /* (741) search_condition ::= common_expression */ + -1, /* (742) sort_specification_list ::= sort_specification */ + -3, /* (743) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (744) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (745) ordering_specification_opt ::= */ + -1, /* (746) ordering_specification_opt ::= ASC */ + -1, /* (747) ordering_specification_opt ::= DESC */ + 0, /* (748) null_ordering_opt ::= */ + -2, /* (749) null_ordering_opt ::= NULLS FIRST */ + -2, /* (750) null_ordering_opt ::= NULLS LAST */ + 0, /* (751) column_options ::= */ + -3, /* (752) column_options ::= column_options PRIMARY KEY */ + -3, /* (753) column_options ::= column_options ENCODE NK_STRING */ + -3, /* (754) column_options ::= column_options COMPRESS NK_STRING */ + -3, /* (755) column_options ::= column_options LEVEL NK_STRING */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -5523,15 +5585,21 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ +#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 5590 "sql.c" yy_destructor(yypParser,379,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ +#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 5596 "sql.c" yy_destructor(yypParser,380,&yymsp[0].minor); break; case 2: /* account_options ::= */ +#line 55 "sql.y" { } +#line 5602 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5543,18 +5611,24 @@ static YYACTIONTYPE yy_reduce( case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); { yy_destructor(yypParser,379,&yymsp[-2].minor); +#line 56 "sql.y" { } +#line 5616 "sql.c" yy_destructor(yypParser,381,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ { yy_destructor(yypParser,382,&yymsp[0].minor); +#line 68 "sql.y" { } +#line 5624 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,380,&yymsp[-1].minor); +#line 69 "sql.y" { } +#line 5631 "sql.c" yy_destructor(yypParser,382,&yymsp[0].minor); } break; @@ -5568,2063 +5642,3056 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); +#line 73 "sql.y" { } +#line 5647 "sql.c" yy_destructor(yypParser,381,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy316 = yylhsminor.yy316; +#line 86 "sql.y" +{ yylhsminor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5653 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy316 = yylhsminor.yy316; +#line 87 "sql.y" +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5659 "sql.c" + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 26: /* white_list ::= HOST ip_range_list */ -{ yymsp[-1].minor.yy316 = yymsp[0].minor.yy316; } +#line 91 "sql.y" +{ yymsp[-1].minor.yy652 = yymsp[0].minor.yy652; } +#line 5665 "sql.c" break; case 27: /* white_list_opt ::= */ - case 205: /* specific_cols_opt ::= */ yytestcase(yyruleno==205); - case 243: /* tags_def_opt ::= */ yytestcase(yyruleno==243); - case 334: /* tag_list_opt ::= */ yytestcase(yyruleno==334); - case 407: /* col_list_opt ::= */ yytestcase(yyruleno==407); - case 414: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==414); - case 677: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==677); - case 707: /* group_by_clause_opt ::= */ yytestcase(yyruleno==707); - case 727: /* order_by_clause_opt ::= */ yytestcase(yyruleno==727); -{ yymsp[1].minor.yy316 = NULL; } + case 207: /* specific_cols_opt ::= */ yytestcase(yyruleno==207); + case 245: /* tags_def_opt ::= */ yytestcase(yyruleno==245); + case 336: /* tag_list_opt ::= */ yytestcase(yyruleno==336); + case 409: /* col_list_opt ::= */ yytestcase(yyruleno==409); + case 416: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==416); + case 679: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==679); + case 709: /* group_by_clause_opt ::= */ yytestcase(yyruleno==709); + case 729: /* order_by_clause_opt ::= */ yytestcase(yyruleno==729); +#line 95 "sql.y" +{ yymsp[1].minor.yy652 = NULL; } +#line 5678 "sql.c" break; case 28: /* white_list_opt ::= white_list */ - case 244: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==244); - case 415: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==415); - case 585: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==585); -{ yylhsminor.yy316 = yymsp[0].minor.yy316; } - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 246: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==246); + case 417: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==417); + case 587: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==587); +#line 96 "sql.y" +{ yylhsminor.yy652 = yymsp[0].minor.yy652; } +#line 5686 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); -{ yymsp[1].minor.yy1043 = 0; } +#line 100 "sql.y" +{ yymsp[1].minor.yy535 = 0; } +#line 5693 "sql.c" break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); -{ yymsp[-1].minor.yy1043 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 101 "sql.y" +{ yymsp[-1].minor.yy535 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5700 "sql.c" break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ +#line 109 "sql.y" { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy1043, yymsp[-1].minor.yy1043, yymsp[-2].minor.yy1043); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy316); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy837, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy535, yymsp[-1].minor.yy535, yymsp[-2].minor.yy535); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy652); } +#line 5708 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 113 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 5713 "sql.c" break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 114 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 5718 "sql.c" break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 115 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 5723 "sql.c" break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } +#line 116 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } +#line 5728 "sql.c" break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy316); } +#line 117 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy652); } +#line 5733 "sql.c" break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy316); } +#line 118 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy652); } +#line 5738 "sql.c" break; case 40: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 119 "sql.y" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy837); } +#line 5743 "sql.c" break; case 41: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy1043 = 1; } +#line 123 "sql.y" +{ yymsp[1].minor.yy535 = 1; } +#line 5748 "sql.c" break; case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } +#line 127 "sql.y" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy495, &yymsp[0].minor.yy837, yymsp[-2].minor.yy54); } +#line 5753 "sql.c" break; case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } +#line 128 "sql.y" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy495, &yymsp[0].minor.yy837, yymsp[-2].minor.yy54); } +#line 5758 "sql.c" break; case 45: /* privileges ::= ALL */ -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALL; } +#line 132 "sql.y" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALL; } +#line 5763 "sql.c" break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); -{ yylhsminor.yy1089 = yymsp[0].minor.yy1089; } - yymsp[0].minor.yy1089 = yylhsminor.yy1089; +#line 133 "sql.y" +{ yylhsminor.yy909 = yymsp[0].minor.yy909; } +#line 5769 "sql.c" + yymsp[0].minor.yy909 = yylhsminor.yy909; break; case 47: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 134 "sql.y" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 5775 "sql.c" break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy1089 = yymsp[-2].minor.yy1089 | yymsp[0].minor.yy1089; } - yymsp[-2].minor.yy1089 = yylhsminor.yy1089; +#line 139 "sql.y" +{ yylhsminor.yy909 = yymsp[-2].minor.yy909 | yymsp[0].minor.yy909; } +#line 5780 "sql.c" + yymsp[-2].minor.yy909 = yylhsminor.yy909; break; case 50: /* priv_type ::= READ */ -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_READ; } +#line 143 "sql.y" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_READ; } +#line 5786 "sql.c" break; case 51: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_WRITE; } +#line 144 "sql.y" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_WRITE; } +#line 5791 "sql.c" break; case 52: /* priv_type ::= ALTER */ -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALTER; } +#line 145 "sql.y" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALTER; } +#line 5796 "sql.c" break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy849.first = yymsp[-2].minor.yy0; yylhsminor.yy849.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy849 = yylhsminor.yy849; +#line 149 "sql.y" +{ yylhsminor.yy495.first = yymsp[-2].minor.yy0; yylhsminor.yy495.second = yymsp[0].minor.yy0; } +#line 5801 "sql.c" + yymsp[-2].minor.yy495 = yylhsminor.yy495; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy849 = yylhsminor.yy849; +#line 150 "sql.y" +{ yylhsminor.yy495.first = yymsp[-2].minor.yy837; yylhsminor.yy495.second = yymsp[0].minor.yy0; } +#line 5807 "sql.c" + yymsp[-2].minor.yy495 = yylhsminor.yy495; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ -{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy1109; } - yymsp[-2].minor.yy849 = yylhsminor.yy849; +#line 151 "sql.y" +{ yylhsminor.yy495.first = yymsp[-2].minor.yy837; yylhsminor.yy495.second = yymsp[0].minor.yy837; } +#line 5813 "sql.c" + yymsp[-2].minor.yy495 = yylhsminor.yy495; break; case 56: /* priv_level ::= topic_name */ -{ yylhsminor.yy849.first = yymsp[0].minor.yy1109; yylhsminor.yy849.second = nil_token; } - yymsp[0].minor.yy849 = yylhsminor.yy849; +#line 152 "sql.y" +{ yylhsminor.yy495.first = yymsp[0].minor.yy837; yylhsminor.yy495.second = nil_token; } +#line 5819 "sql.c" + yymsp[0].minor.yy495 = yylhsminor.yy495; break; case 57: /* with_opt ::= */ case 173: /* start_opt ::= */ yytestcase(yyruleno==173); case 177: /* end_opt ::= */ yytestcase(yyruleno==177); - case 329: /* like_pattern_opt ::= */ yytestcase(yyruleno==329); - case 426: /* subtable_opt ::= */ yytestcase(yyruleno==426); - case 595: /* case_when_else_opt ::= */ yytestcase(yyruleno==595); - case 625: /* from_clause_opt ::= */ yytestcase(yyruleno==625); - case 652: /* join_on_clause_opt ::= */ yytestcase(yyruleno==652); - case 654: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==654); - case 658: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==658); - case 675: /* where_clause_opt ::= */ yytestcase(yyruleno==675); - case 684: /* twindow_clause_opt ::= */ yytestcase(yyruleno==684); - case 692: /* sliding_opt ::= */ yytestcase(yyruleno==692); - case 697: /* fill_opt ::= */ yytestcase(yyruleno==697); - case 711: /* having_clause_opt ::= */ yytestcase(yyruleno==711); - case 713: /* range_opt ::= */ yytestcase(yyruleno==713); - case 716: /* every_opt ::= */ yytestcase(yyruleno==716); - case 729: /* slimit_clause_opt ::= */ yytestcase(yyruleno==729); - case 733: /* limit_clause_opt ::= */ yytestcase(yyruleno==733); -{ yymsp[1].minor.yy416 = NULL; } + case 331: /* like_pattern_opt ::= */ yytestcase(yyruleno==331); + case 428: /* subtable_opt ::= */ yytestcase(yyruleno==428); + case 597: /* case_when_else_opt ::= */ yytestcase(yyruleno==597); + case 627: /* from_clause_opt ::= */ yytestcase(yyruleno==627); + case 654: /* join_on_clause_opt ::= */ yytestcase(yyruleno==654); + case 656: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==656); + case 660: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==660); + case 677: /* where_clause_opt ::= */ yytestcase(yyruleno==677); + case 686: /* twindow_clause_opt ::= */ yytestcase(yyruleno==686); + case 694: /* sliding_opt ::= */ yytestcase(yyruleno==694); + case 699: /* fill_opt ::= */ yytestcase(yyruleno==699); + case 713: /* having_clause_opt ::= */ yytestcase(yyruleno==713); + case 715: /* range_opt ::= */ yytestcase(yyruleno==715); + case 718: /* every_opt ::= */ yytestcase(yyruleno==718); + case 731: /* slimit_clause_opt ::= */ yytestcase(yyruleno==731); + case 735: /* limit_clause_opt ::= */ yytestcase(yyruleno==735); +#line 154 "sql.y" +{ yymsp[1].minor.yy54 = NULL; } +#line 5843 "sql.c" break; case 58: /* with_opt ::= WITH search_condition */ - case 626: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==626); - case 653: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==653); - case 676: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==676); - case 712: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==712); -{ yymsp[-1].minor.yy416 = yymsp[0].minor.yy416; } + case 628: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==628); + case 655: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==655); + case 678: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==678); + case 714: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==714); +#line 155 "sql.y" +{ yymsp[-1].minor.yy54 = yymsp[0].minor.yy54; } +#line 5852 "sql.c" break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ +#line 158 "sql.y" { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } +#line 5857 "sql.c" break; case 60: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy1109, NULL); } +#line 161 "sql.y" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy837, NULL); } +#line 5862 "sql.c" break; case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } +#line 162 "sql.y" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0); } +#line 5867 "sql.c" break; case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy209, false); } +#line 163 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy325, false); } +#line 5872 "sql.c" break; case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy209, false); } +#line 164 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy325, false); } +#line 5877 "sql.c" break; case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy209); } +#line 165 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy325); } +#line 5882 "sql.c" break; case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, false, yymsp[0].minor.yy209); } +#line 166 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy837, false, yymsp[0].minor.yy325); } +#line 5887 "sql.c" break; case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ +#line 167 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } +#line 5892 "sql.c" break; case 67: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ +#line 168 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5897 "sql.c" break; case 68: /* cmd ::= ALTER ALL DNODES NK_STRING */ +#line 169 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } +#line 5902 "sql.c" break; case 69: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ +#line 170 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5907 "sql.c" break; case 70: /* cmd ::= RESTORE DNODE NK_INTEGER */ +#line 171 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } +#line 5912 "sql.c" break; case 71: /* dnode_endpoint ::= NK_STRING */ case 72: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==72); case 73: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==73); - case 363: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==363); - case 364: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==364); - case 365: /* sma_func_name ::= LAST */ yytestcase(yyruleno==365); - case 366: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==366); - case 514: /* db_name ::= NK_ID */ yytestcase(yyruleno==514); - case 515: /* table_name ::= NK_ID */ yytestcase(yyruleno==515); - case 516: /* column_name ::= NK_ID */ yytestcase(yyruleno==516); - case 517: /* function_name ::= NK_ID */ yytestcase(yyruleno==517); - case 518: /* view_name ::= NK_ID */ yytestcase(yyruleno==518); - case 519: /* table_alias ::= NK_ID */ yytestcase(yyruleno==519); - case 520: /* column_alias ::= NK_ID */ yytestcase(yyruleno==520); - case 521: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==521); - case 522: /* user_name ::= NK_ID */ yytestcase(yyruleno==522); - case 523: /* topic_name ::= NK_ID */ yytestcase(yyruleno==523); - case 524: /* stream_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* index_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==527); - case 571: /* noarg_func ::= NOW */ yytestcase(yyruleno==571); - case 572: /* noarg_func ::= TODAY */ yytestcase(yyruleno==572); - case 573: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==573); - case 574: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==574); - case 575: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==575); - case 576: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==576); - case 577: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==577); - case 578: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==578); - case 579: /* noarg_func ::= USER */ yytestcase(yyruleno==579); - case 580: /* star_func ::= COUNT */ yytestcase(yyruleno==580); - case 581: /* star_func ::= FIRST */ yytestcase(yyruleno==581); - case 582: /* star_func ::= LAST */ yytestcase(yyruleno==582); - case 583: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==583); -{ yylhsminor.yy1109 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy1109 = yylhsminor.yy1109; + case 365: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==365); + case 366: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==366); + case 367: /* sma_func_name ::= LAST */ yytestcase(yyruleno==367); + case 368: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==368); + case 516: /* db_name ::= NK_ID */ yytestcase(yyruleno==516); + case 517: /* table_name ::= NK_ID */ yytestcase(yyruleno==517); + case 518: /* column_name ::= NK_ID */ yytestcase(yyruleno==518); + case 519: /* function_name ::= NK_ID */ yytestcase(yyruleno==519); + case 520: /* view_name ::= NK_ID */ yytestcase(yyruleno==520); + case 521: /* table_alias ::= NK_ID */ yytestcase(yyruleno==521); + case 522: /* column_alias ::= NK_ID */ yytestcase(yyruleno==522); + case 523: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==523); + case 524: /* user_name ::= NK_ID */ yytestcase(yyruleno==524); + case 525: /* topic_name ::= NK_ID */ yytestcase(yyruleno==525); + case 526: /* stream_name ::= NK_ID */ yytestcase(yyruleno==526); + case 527: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==527); + case 528: /* index_name ::= NK_ID */ yytestcase(yyruleno==528); + case 529: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==529); + case 573: /* noarg_func ::= NOW */ yytestcase(yyruleno==573); + case 574: /* noarg_func ::= TODAY */ yytestcase(yyruleno==574); + case 575: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==575); + case 576: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==576); + case 577: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==577); + case 578: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==578); + case 579: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==579); + case 580: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==580); + case 581: /* noarg_func ::= USER */ yytestcase(yyruleno==581); + case 582: /* star_func ::= COUNT */ yytestcase(yyruleno==582); + case 583: /* star_func ::= FIRST */ yytestcase(yyruleno==583); + case 584: /* star_func ::= LAST */ yytestcase(yyruleno==584); + case 585: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==585); +#line 175 "sql.y" +{ yylhsminor.yy837 = yymsp[0].minor.yy0; } +#line 5950 "sql.c" + yymsp[0].minor.yy837 = yylhsminor.yy837; break; case 74: /* force_opt ::= */ case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101); case 103: /* exists_opt ::= */ yytestcase(yyruleno==103); - case 384: /* analyze_opt ::= */ yytestcase(yyruleno==384); - case 391: /* agg_func_opt ::= */ yytestcase(yyruleno==391); - case 397: /* or_replace_opt ::= */ yytestcase(yyruleno==397); - case 428: /* ignore_opt ::= */ yytestcase(yyruleno==428); - case 663: /* tag_mode_opt ::= */ yytestcase(yyruleno==663); - case 665: /* set_quantifier_opt ::= */ yytestcase(yyruleno==665); -{ yymsp[1].minor.yy209 = false; } + case 386: /* analyze_opt ::= */ yytestcase(yyruleno==386); + case 393: /* agg_func_opt ::= */ yytestcase(yyruleno==393); + case 399: /* or_replace_opt ::= */ yytestcase(yyruleno==399); + case 430: /* ignore_opt ::= */ yytestcase(yyruleno==430); + case 665: /* tag_mode_opt ::= */ yytestcase(yyruleno==665); + case 667: /* set_quantifier_opt ::= */ yytestcase(yyruleno==667); +#line 181 "sql.y" +{ yymsp[1].minor.yy325 = false; } +#line 5964 "sql.c" break; case 75: /* force_opt ::= FORCE */ case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76); - case 385: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==385); - case 392: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==392); - case 664: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==664); - case 666: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==666); -{ yymsp[0].minor.yy209 = true; } + case 387: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==387); + case 394: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==394); + case 666: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==666); + case 668: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==668); +#line 182 "sql.y" +{ yymsp[0].minor.yy325 = true; } +#line 5974 "sql.c" break; case 77: /* cmd ::= ALTER CLUSTER NK_STRING */ +#line 189 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 5979 "sql.c" break; case 78: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ +#line 190 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5984 "sql.c" break; case 79: /* cmd ::= ALTER LOCAL NK_STRING */ +#line 193 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 5989 "sql.c" break; case 80: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ +#line 194 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5994 "sql.c" break; case 81: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ +#line 197 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5999 "sql.c" break; case 82: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ +#line 198 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 6004 "sql.c" break; case 83: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ +#line 199 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 6009 "sql.c" break; case 84: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ +#line 202 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 6014 "sql.c" break; case 85: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ +#line 203 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 6019 "sql.c" break; case 86: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ +#line 206 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 6024 "sql.c" break; case 87: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ +#line 207 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 6029 "sql.c" break; case 88: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ +#line 210 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6034 "sql.c" break; case 89: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ +#line 211 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6039 "sql.c" break; case 90: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ +#line 212 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6044 "sql.c" break; case 91: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ +#line 215 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } +#line 6049 "sql.c" break; case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy209, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } +#line 218 "sql.y" +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy325, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } +#line 6054 "sql.c" break; case 93: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } +#line 219 "sql.y" +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } +#line 6059 "sql.c" break; case 94: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 220 "sql.y" +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } +#line 6064 "sql.c" break; case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } +#line 221 "sql.y" +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } +#line 6069 "sql.c" break; case 96: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 222 "sql.y" +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } +#line 6074 "sql.c" break; case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy820); } +#line 223 "sql.y" +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy332); } +#line 6079 "sql.c" break; case 98: /* cmd ::= S3MIGRATE DATABASE db_name */ -{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 224 "sql.y" +{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } +#line 6084 "sql.c" break; case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 225 "sql.y" +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 6089 "sql.c" break; case 100: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy209 = true; } +#line 229 "sql.y" +{ yymsp[-2].minor.yy325 = true; } +#line 6094 "sql.c" break; case 102: /* exists_opt ::= IF EXISTS */ - case 398: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==398); - case 429: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==429); -{ yymsp[-1].minor.yy209 = true; } + case 400: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==400); + case 431: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==431); +#line 234 "sql.y" +{ yymsp[-1].minor.yy325 = true; } +#line 6101 "sql.c" break; case 104: /* db_options ::= */ -{ yymsp[1].minor.yy416 = createDefaultDatabaseOptions(pCxt); } +#line 237 "sql.y" +{ yymsp[1].minor.yy54 = createDefaultDatabaseOptions(pCxt); } +#line 6106 "sql.c" break; case 105: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 238 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } +#line 6111 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 239 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } +#line 6117 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 240 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } +#line 6123 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 108: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 241 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_COMP, &yymsp[0].minor.yy0); } +#line 6129 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 109: /* db_options ::= db_options DURATION NK_INTEGER */ case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110); -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 242 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } +#line 6136 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 244 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } +#line 6142 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 112: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 245 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } +#line 6148 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 113: /* db_options ::= db_options KEEP integer_list */ case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114); -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP, yymsp[0].minor.yy316); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 246 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_KEEP, yymsp[0].minor.yy652); } +#line 6155 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 115: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 248 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } +#line 6161 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 249 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6167 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 250 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6173 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 118: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 251 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } +#line 6179 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 119: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 252 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } +#line 6185 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 254 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } +#line 6191 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 255 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } +#line 6197 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 122: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_RETENTIONS, yymsp[0].minor.yy316); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 256 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_RETENTIONS, yymsp[0].minor.yy652); } +#line 6203 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 257 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } +#line 6209 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 258 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL, &yymsp[0].minor.yy0); } +#line 6215 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 259 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } +#line 6221 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 260 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } +#line 6227 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 127: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 261 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-3].minor.yy54, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; +#line 6237 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 266 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } +#line 6243 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 129: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 267 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-3].minor.yy54, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; +#line 6253 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 272 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } +#line 6259 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 273 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } +#line 6265 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 274 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } +#line 6271 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 133: /* db_options ::= db_options TABLE_PREFIX signed */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy416); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 275 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy54); } +#line 6277 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 134: /* db_options ::= db_options TABLE_SUFFIX signed */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy416); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 276 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy54); } +#line 6283 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 277 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } +#line 6289 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137); -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 278 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } +#line 6296 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 280 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } +#line 6302 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 281 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } +#line 6308 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 282 "sql.y" +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } +#line 6314 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 141: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy416 = createAlterDatabaseOptions(pCxt); yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yylhsminor.yy416, &yymsp[0].minor.yy101); } - yymsp[0].minor.yy416 = yylhsminor.yy416; +#line 284 "sql.y" +{ yylhsminor.yy54 = createAlterDatabaseOptions(pCxt); yylhsminor.yy54 = setAlterDatabaseOption(pCxt, yylhsminor.yy54, &yymsp[0].minor.yy663); } +#line 6320 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 142: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy416, &yymsp[0].minor.yy101); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; +#line 285 "sql.y" +{ yylhsminor.yy54 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy54, &yymsp[0].minor.yy663); } +#line 6326 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 143: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 289 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6332 "sql.c" break; case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 290 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6337 "sql.c" break; case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 291 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6342 "sql.c" break; case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 292 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6347 "sql.c" break; case 147: /* alter_db_option ::= KEEP integer_list */ case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148); -{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP; yymsp[-1].minor.yy101.pList = yymsp[0].minor.yy316; } +#line 293 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_KEEP; yymsp[-1].minor.yy663.pList = yymsp[0].minor.yy652; } +#line 6353 "sql.c" break; case 149: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_PAGES; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 295 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_PAGES; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6358 "sql.c" break; case 150: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 296 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6363 "sql.c" break; case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 298 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6368 "sql.c" break; case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 299 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6373 "sql.c" break; case 153: /* alter_db_option ::= MINROWS NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 300 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6378 "sql.c" break; case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 301 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6383 "sql.c" break; case 155: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 302 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy101.val = t; + yymsp[-2].minor.yy663.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy663.val = t; } +#line 6392 "sql.c" break; case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 307 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6397 "sql.c" break; case 157: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 308 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy101.val = t; + yymsp[-2].minor.yy663.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy663.val = t; } +#line 6406 "sql.c" break; case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159); -{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 313 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6412 "sql.c" break; case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 315 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6417 "sql.c" break; case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 316 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6422 "sql.c" break; case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 317 "sql.y" +{ yymsp[-1].minor.yy663.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6427 "sql.c" break; case 163: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy316 = yylhsminor.yy316; +#line 321 "sql.y" +{ yylhsminor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6432 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 443: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==443); -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 445: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==445); +#line 322 "sql.y" +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6439 "sql.c" + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 165: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy316 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy316 = yylhsminor.yy316; +#line 326 "sql.y" +{ yylhsminor.yy652 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6445 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy316 = yylhsminor.yy316; +#line 327 "sql.y" +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6451 "sql.c" + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 167: /* retention_list ::= retention */ case 199: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==199); - case 202: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==202); - case 209: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==209); - case 212: /* column_def_list ::= column_def */ yytestcase(yyruleno==212); - case 260: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==260); - case 265: /* col_name_list ::= col_name */ yytestcase(yyruleno==265); - case 335: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==335); - case 359: /* func_list ::= func */ yytestcase(yyruleno==359); - case 409: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==409); - case 487: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==487); - case 512: /* literal_list ::= signed_literal */ yytestcase(yyruleno==512); - case 586: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==586); - case 592: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==592); - case 668: /* select_list ::= select_item */ yytestcase(yyruleno==668); - case 679: /* partition_list ::= partition_item */ yytestcase(yyruleno==679); - case 740: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==740); -{ yylhsminor.yy316 = createNodeList(pCxt, yymsp[0].minor.yy416); } - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 201: /* multi_create_clause ::= create_from_file_clause */ yytestcase(yyruleno==201); + case 204: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==204); + case 211: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==211); + case 214: /* column_def_list ::= column_def */ yytestcase(yyruleno==214); + case 262: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==262); + case 267: /* col_name_list ::= col_name */ yytestcase(yyruleno==267); + case 337: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==337); + case 361: /* func_list ::= func */ yytestcase(yyruleno==361); + case 411: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==411); + case 489: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==489); + case 514: /* literal_list ::= signed_literal */ yytestcase(yyruleno==514); + case 588: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==588); + case 594: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==594); + case 670: /* select_list ::= select_item */ yytestcase(yyruleno==670); + case 681: /* partition_list ::= partition_item */ yytestcase(yyruleno==681); + case 742: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==742); +#line 331 "sql.y" +{ yylhsminor.yy652 = createNodeList(pCxt, yymsp[0].minor.yy54); } +#line 6474 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 168: /* retention_list ::= retention_list NK_COMMA retention */ - case 203: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==203); - case 210: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==210); - case 213: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==213); - case 261: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==261); - case 266: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==266); - case 336: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==336); - case 360: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==360); - case 410: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==410); - case 488: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==488); - case 513: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==513); - case 587: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==587); - case 669: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==669); - case 680: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==680); - case 741: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==741); -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 205: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==205); + case 212: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==212); + case 215: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==215); + case 263: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==263); + case 268: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==268); + case 338: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==338); + case 362: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==362); + case 412: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==412); + case 490: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==490); + case 515: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==515); + case 589: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==589); + case 671: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==671); + case 682: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==682); + case 743: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==743); +#line 332 "sql.y" +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } +#line 6494 "sql.c" + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170); -{ yylhsminor.yy416 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 334 "sql.y" +{ yylhsminor.yy54 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6501 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 171: /* speed_opt ::= */ - case 393: /* bufsize_opt ::= */ yytestcase(yyruleno==393); -{ yymsp[1].minor.yy820 = 0; } + case 395: /* bufsize_opt ::= */ yytestcase(yyruleno==395); +#line 339 "sql.y" +{ yymsp[1].minor.yy332 = 0; } +#line 6508 "sql.c" break; case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 394: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==394); -{ yymsp[-1].minor.yy820 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 396: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==396); +#line 340 "sql.y" +{ yymsp[-1].minor.yy332 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +#line 6514 "sql.c" break; case 174: /* start_opt ::= START WITH NK_INTEGER */ case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178); -{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 343 "sql.y" +{ yymsp[-2].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 6520 "sql.c" break; case 175: /* start_opt ::= START WITH NK_STRING */ case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179); -{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 344 "sql.y" +{ yymsp[-2].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6526 "sql.c" break; case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180); -{ yymsp[-3].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 345 "sql.y" +{ yymsp[-3].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6532 "sql.c" break; case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 183: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==183); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy316, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } +#line 354 "sql.y" +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy652, yymsp[-1].minor.yy652, yymsp[0].minor.yy54); } +#line 6538 "sql.c" break; case 182: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy316); } +#line 355 "sql.y" +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy652); } +#line 6543 "sql.c" break; case 184: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy316); } +#line 358 "sql.y" +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy652); } +#line 6548 "sql.c" break; case 185: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } +#line 359 "sql.y" +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } +#line 6553 "sql.c" break; case 186: /* cmd ::= ALTER TABLE alter_table_clause */ - case 445: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==445); - case 446: /* cmd ::= insert_query */ yytestcase(yyruleno==446); -{ pCxt->pRootNode = yymsp[0].minor.yy416; } + case 447: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==447); + case 448: /* cmd ::= insert_query */ yytestcase(yyruleno==448); +#line 361 "sql.y" +{ pCxt->pRootNode = yymsp[0].minor.yy54; } +#line 6560 "sql.c" break; case 187: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy416); } +#line 362 "sql.y" +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy54); } +#line 6565 "sql.c" break; case 188: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy416 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; +#line 364 "sql.y" +{ yylhsminor.yy54 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 6570 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 189: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -{ yylhsminor.yy416 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy416, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } - yymsp[-5].minor.yy416 = yylhsminor.yy416; +#line 366 "sql.y" +{ yylhsminor.yy54 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy54, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy84, yymsp[0].minor.yy54); } +#line 6576 "sql.c" + yymsp[-5].minor.yy54 = yylhsminor.yy54; break; case 190: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy1109); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; +#line 367 "sql.y" +{ yylhsminor.yy54 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy54, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy837); } +#line 6582 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 191: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; +#line 369 "sql.y" +{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } +#line 6588 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ -{ yylhsminor.yy416 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; +#line 371 "sql.y" +{ yylhsminor.yy54 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } +#line 6594 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 193: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; +#line 373 "sql.y" +{ yylhsminor.yy54 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } +#line 6600 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 194: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; +#line 375 "sql.y" +{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } +#line 6606 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 195: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy1109); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; +#line 376 "sql.y" +{ yylhsminor.yy54 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy54, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy837); } +#line 6612 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 196: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; +#line 378 "sql.y" +{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } +#line 6618 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 197: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; +#line 380 "sql.y" +{ yylhsminor.yy54 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } +#line 6624 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 198: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -{ yylhsminor.yy416 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy416, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } - yymsp[-5].minor.yy416 = yylhsminor.yy416; +#line 382 "sql.y" +{ yylhsminor.yy54 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy54, &yymsp[-2].minor.yy837, yymsp[0].minor.yy54); } +#line 6630 "sql.c" + yymsp[-5].minor.yy54 = yylhsminor.yy54; break; case 200: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 593: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==593); -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } - yymsp[-1].minor.yy316 = yylhsminor.yy316; + case 595: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==595); +#line 387 "sql.y" +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy54); } +#line 6637 "sql.c" + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; - case 201: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -{ yylhsminor.yy416 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy209, yymsp[-8].minor.yy416, yymsp[-6].minor.yy416, yymsp[-5].minor.yy316, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } - yymsp[-9].minor.yy416 = yylhsminor.yy416; + case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ +#line 392 "sql.y" +{ yylhsminor.yy54 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy325, yymsp[-8].minor.yy54, yymsp[-6].minor.yy54, yymsp[-5].minor.yy652, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } +#line 6643 "sql.c" + yymsp[-9].minor.yy54 = yylhsminor.yy54; break; - case 204: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy416 = createDropTableClause(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; + case 203: /* create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ +#line 395 "sql.y" +{ yylhsminor.yy54 = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy652, &yymsp[0].minor.yy0); } +#line 6649 "sql.c" + yymsp[-7].minor.yy54 = yylhsminor.yy54; break; - case 206: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 408: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==408); -{ yymsp[-2].minor.yy316 = yymsp[-1].minor.yy316; } + case 206: /* drop_table_clause ::= exists_opt full_table_name */ +#line 402 "sql.y" +{ yylhsminor.yy54 = createDropTableClause(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } +#line 6655 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 207: /* full_table_name ::= table_name */ - case 349: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==349); -{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy1109, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 208: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 410: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==410); +#line 407 "sql.y" +{ yymsp[-2].minor.yy652 = yymsp[-1].minor.yy652; } +#line 6662 "sql.c" break; - case 208: /* full_table_name ::= db_name NK_DOT table_name */ - case 350: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==350); -{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, NULL); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 209: /* full_table_name ::= table_name */ + case 351: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==351); +#line 409 "sql.y" +{ yylhsminor.yy54 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy837, NULL); } +#line 6668 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 211: /* tag_def ::= column_name type_name */ -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952, NULL); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; + case 210: /* full_table_name ::= db_name NK_DOT table_name */ + case 352: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==352); +#line 410 "sql.y" +{ yylhsminor.yy54 = createRealTableNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837, NULL); } +#line 6675 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 214: /* column_def ::= column_name type_name column_options */ -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 213: /* tag_def ::= column_name type_name */ +#line 416 "sql.y" +{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84, NULL); } +#line 6681 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 215: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 216: /* column_def ::= column_name type_name column_options */ +#line 424 "sql.y" +{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy84, yymsp[0].minor.yy54); } +#line 6687 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 216: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 217: /* type_name ::= BOOL */ +#line 428 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BOOL); } +#line 6693 "sql.c" break; - case 217: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 218: /* type_name ::= TINYINT */ +#line 429 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 6698 "sql.c" break; - case 218: /* type_name ::= INT */ - case 219: /* type_name ::= INTEGER */ yytestcase(yyruleno==219); -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); } + case 219: /* type_name ::= SMALLINT */ +#line 430 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 6703 "sql.c" break; - case 220: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 220: /* type_name ::= INT */ + case 221: /* type_name ::= INTEGER */ yytestcase(yyruleno==221); +#line 431 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_INT); } +#line 6709 "sql.c" break; - case 221: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 222: /* type_name ::= BIGINT */ +#line 433 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 6714 "sql.c" break; - case 222: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 223: /* type_name ::= FLOAT */ +#line 434 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 6719 "sql.c" break; - case 223: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 224: /* type_name ::= DOUBLE */ +#line 435 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 6724 "sql.c" break; - case 224: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 225: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +#line 436 "sql.y" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 6729 "sql.c" break; - case 225: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 226: /* type_name ::= TIMESTAMP */ +#line 437 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +#line 6734 "sql.c" break; - case 226: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 227: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +#line 438 "sql.y" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +#line 6739 "sql.c" break; - case 227: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 228: /* type_name ::= TINYINT UNSIGNED */ +#line 439 "sql.y" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +#line 6744 "sql.c" break; - case 228: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); } + case 229: /* type_name ::= SMALLINT UNSIGNED */ +#line 440 "sql.y" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +#line 6749 "sql.c" break; - case 229: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 230: /* type_name ::= INT UNSIGNED */ +#line 441 "sql.y" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UINT); } +#line 6754 "sql.c" break; - case 230: /* type_name ::= JSON */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); } + case 231: /* type_name ::= BIGINT UNSIGNED */ +#line 442 "sql.y" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +#line 6759 "sql.c" break; - case 231: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 232: /* type_name ::= JSON */ +#line 443 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_JSON); } +#line 6764 "sql.c" break; - case 232: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 233: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +#line 444 "sql.y" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +#line 6769 "sql.c" break; - case 233: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 234: /* type_name ::= MEDIUMBLOB */ +#line 445 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +#line 6774 "sql.c" break; - case 234: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 235: /* type_name ::= BLOB */ +#line 446 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BLOB); } +#line 6779 "sql.c" break; - case 235: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } + case 236: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +#line 447 "sql.y" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +#line 6784 "sql.c" break; - case 236: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 237: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +#line 448 "sql.y" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +#line 6789 "sql.c" break; - case 237: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 238: /* type_name ::= DECIMAL */ +#line 449 "sql.y" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6794 "sql.c" break; - case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +#line 450 "sql.y" +{ yymsp[-3].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6799 "sql.c" break; - case 239: /* type_name_default_len ::= BINARY */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } + case 240: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 451 "sql.y" +{ yymsp[-5].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6804 "sql.c" break; - case 240: /* type_name_default_len ::= NCHAR */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } + case 241: /* type_name_default_len ::= BINARY */ +#line 455 "sql.y" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } +#line 6809 "sql.c" break; - case 241: /* type_name_default_len ::= VARCHAR */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } + case 242: /* type_name_default_len ::= NCHAR */ +#line 456 "sql.y" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } +#line 6814 "sql.c" break; - case 242: /* type_name_default_len ::= VARBINARY */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } + case 243: /* type_name_default_len ::= VARCHAR */ +#line 457 "sql.y" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } +#line 6819 "sql.c" break; - case 245: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - case 416: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==416); -{ yymsp[-3].minor.yy316 = yymsp[-1].minor.yy316; } + case 244: /* type_name_default_len ::= VARBINARY */ +#line 458 "sql.y" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } +#line 6824 "sql.c" break; - case 246: /* table_options ::= */ -{ yymsp[1].minor.yy416 = createDefaultTableOptions(pCxt); } + case 247: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + case 418: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==418); +#line 467 "sql.y" +{ yymsp[-3].minor.yy652 = yymsp[-1].minor.yy652; } +#line 6830 "sql.c" break; - case 247: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 248: /* table_options ::= */ +#line 469 "sql.y" +{ yymsp[1].minor.yy54 = createDefaultTableOptions(pCxt); } +#line 6835 "sql.c" break; - case 248: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy316); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 249: /* table_options ::= table_options COMMENT NK_STRING */ +#line 470 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } +#line 6840 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 249: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy316); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 250: /* table_options ::= table_options MAX_DELAY duration_list */ +#line 471 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy652); } +#line 6846 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 250: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy316); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; + case 251: /* table_options ::= table_options WATERMARK duration_list */ +#line 472 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy652); } +#line 6852 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 251: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 252: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +#line 473 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-4].minor.yy54, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy652); } +#line 6858 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; - case 252: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_SMA, yymsp[-1].minor.yy316); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; + case 253: /* table_options ::= table_options TTL NK_INTEGER */ +#line 474 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } +#line 6864 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 253: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy316); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 254: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +#line 475 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-4].minor.yy54, TABLE_OPTION_SMA, yymsp[-1].minor.yy652); } +#line 6870 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; - case 254: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy416 = createAlterTableOptions(pCxt); yylhsminor.yy416 = setTableOption(pCxt, yylhsminor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 255: /* table_options ::= table_options DELETE_MARK duration_list */ +#line 476 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy652); } +#line 6876 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 255: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; + case 256: /* alter_table_options ::= alter_table_option */ +#line 478 "sql.y" +{ yylhsminor.yy54 = createAlterTableOptions(pCxt); yylhsminor.yy54 = setTableOption(pCxt, yylhsminor.yy54, yymsp[0].minor.yy663.type, &yymsp[0].minor.yy663.val); } +#line 6882 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 256: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } + case 257: /* alter_table_options ::= alter_table_options alter_table_option */ +#line 479 "sql.y" +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy663.type, &yymsp[0].minor.yy663.val); } +#line 6888 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 257: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } + case 258: /* alter_table_option ::= COMMENT NK_STRING */ +#line 483 "sql.y" +{ yymsp[-1].minor.yy663.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6894 "sql.c" break; - case 258: /* duration_list ::= duration_literal */ - case 545: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==545); -{ yylhsminor.yy316 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 259: /* alter_table_option ::= TTL NK_INTEGER */ +#line 484 "sql.y" +{ yymsp[-1].minor.yy663.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } +#line 6899 "sql.c" break; - case 259: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 546: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==546); -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 260: /* duration_list ::= duration_literal */ + case 547: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==547); +#line 488 "sql.y" +{ yylhsminor.yy652 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } +#line 6905 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; break; - case 262: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy1109, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 261: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 548: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==548); +#line 489 "sql.y" +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } +#line 6912 "sql.c" + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 263: /* rollup_func_name ::= FIRST */ - case 264: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==264); - case 338: /* tag_item ::= QTAGS */ yytestcase(yyruleno==338); -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 264: /* rollup_func_name ::= function_name */ +#line 496 "sql.y" +{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[0].minor.yy837, NULL); } +#line 6918 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 267: /* col_name ::= column_name */ - case 339: /* tag_item ::= column_name */ yytestcase(yyruleno==339); -{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 265: /* rollup_func_name ::= FIRST */ + case 266: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==266); + case 340: /* tag_item ::= QTAGS */ yytestcase(yyruleno==340); +#line 497 "sql.y" +{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6926 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 268: /* cmd ::= SHOW DNODES */ + case 269: /* col_name ::= column_name */ + case 341: /* tag_item ::= column_name */ yytestcase(yyruleno==341); +#line 505 "sql.y" +{ yylhsminor.yy54 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy837); } +#line 6933 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 270: /* cmd ::= SHOW DNODES */ +#line 508 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } +#line 6939 "sql.c" break; - case 269: /* cmd ::= SHOW USERS */ + case 271: /* cmd ::= SHOW USERS */ +#line 509 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } +#line 6944 "sql.c" break; - case 270: /* cmd ::= SHOW USERS FULL */ + case 272: /* cmd ::= SHOW USERS FULL */ +#line 510 "sql.y" { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } +#line 6949 "sql.c" break; - case 271: /* cmd ::= SHOW USER PRIVILEGES */ + case 273: /* cmd ::= SHOW USER PRIVILEGES */ +#line 511 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } +#line 6954 "sql.c" break; - case 272: /* cmd ::= SHOW db_kind_opt DATABASES */ + case 274: /* cmd ::= SHOW db_kind_opt DATABASES */ +#line 512 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy681); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy719); } +#line 6962 "sql.c" break; - case 273: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + case 275: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ +#line 516 "sql.y" { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy925, yymsp[0].minor.yy416, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy579, yymsp[0].minor.yy54, OP_TYPE_LIKE); } +#line 6969 "sql.c" break; - case 274: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } + case 276: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +#line 519 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, OP_TYPE_LIKE); } +#line 6974 "sql.c" break; - case 275: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy416, NULL, OP_TYPE_LIKE); } + case 277: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +#line 520 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy54, NULL, OP_TYPE_LIKE); } +#line 6979 "sql.c" break; - case 276: /* cmd ::= SHOW MNODES */ + case 278: /* cmd ::= SHOW MNODES */ +#line 521 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } +#line 6984 "sql.c" break; - case 277: /* cmd ::= SHOW QNODES */ + case 279: /* cmd ::= SHOW QNODES */ +#line 523 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } +#line 6989 "sql.c" break; - case 278: /* cmd ::= SHOW ARBGROUPS */ + case 280: /* cmd ::= SHOW ARBGROUPS */ +#line 524 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } +#line 6994 "sql.c" break; - case 279: /* cmd ::= SHOW FUNCTIONS */ + case 281: /* cmd ::= SHOW FUNCTIONS */ +#line 525 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } +#line 6999 "sql.c" break; - case 280: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } + case 282: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +#line 526 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy54, yymsp[-1].minor.yy54, OP_TYPE_EQUAL); } +#line 7004 "sql.c" break; - case 281: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } + case 283: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +#line 527 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), OP_TYPE_EQUAL); } +#line 7009 "sql.c" break; - case 282: /* cmd ::= SHOW STREAMS */ + case 284: /* cmd ::= SHOW STREAMS */ +#line 528 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } +#line 7014 "sql.c" break; - case 283: /* cmd ::= SHOW ACCOUNTS */ + case 285: /* cmd ::= SHOW ACCOUNTS */ +#line 529 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 7019 "sql.c" break; - case 284: /* cmd ::= SHOW APPS */ + case 286: /* cmd ::= SHOW APPS */ +#line 530 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } +#line 7024 "sql.c" break; - case 285: /* cmd ::= SHOW CONNECTIONS */ + case 287: /* cmd ::= SHOW CONNECTIONS */ +#line 531 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } +#line 7029 "sql.c" break; - case 286: /* cmd ::= SHOW LICENCES */ - case 287: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==287); + case 288: /* cmd ::= SHOW LICENCES */ + case 289: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==289); +#line 532 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } +#line 7035 "sql.c" break; - case 288: /* cmd ::= SHOW GRANTS FULL */ + case 290: /* cmd ::= SHOW GRANTS FULL */ +#line 534 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } +#line 7040 "sql.c" break; - case 289: /* cmd ::= SHOW GRANTS LOGS */ + case 291: /* cmd ::= SHOW GRANTS LOGS */ +#line 535 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } +#line 7045 "sql.c" break; - case 290: /* cmd ::= SHOW CLUSTER MACHINES */ + case 292: /* cmd ::= SHOW CLUSTER MACHINES */ +#line 536 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } +#line 7050 "sql.c" break; - case 291: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } + case 293: /* cmd ::= SHOW CREATE DATABASE db_name */ +#line 537 "sql.y" +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } +#line 7055 "sql.c" break; - case 292: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy416); } + case 294: /* cmd ::= SHOW CREATE TABLE full_table_name */ +#line 538 "sql.y" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy54); } +#line 7060 "sql.c" break; - case 293: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, -yymsp[0].minor.yy416); } + case 295: /* cmd ::= SHOW CREATE STABLE full_table_name */ +#line 539 "sql.y" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, +yymsp[0].minor.yy54); } +#line 7066 "sql.c" break; - case 294: /* cmd ::= SHOW ENCRYPTIONS */ + case 296: /* cmd ::= SHOW ENCRYPTIONS */ +#line 541 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } +#line 7071 "sql.c" break; - case 295: /* cmd ::= SHOW QUERIES */ + case 297: /* cmd ::= SHOW QUERIES */ +#line 542 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } +#line 7076 "sql.c" break; - case 296: /* cmd ::= SHOW SCORES */ + case 298: /* cmd ::= SHOW SCORES */ +#line 543 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } +#line 7081 "sql.c" break; - case 297: /* cmd ::= SHOW TOPICS */ + case 299: /* cmd ::= SHOW TOPICS */ +#line 544 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } +#line 7086 "sql.c" break; - case 298: /* cmd ::= SHOW VARIABLES */ - case 299: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==299); + case 300: /* cmd ::= SHOW VARIABLES */ + case 301: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==301); +#line 545 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } +#line 7092 "sql.c" break; - case 300: /* cmd ::= SHOW LOCAL VARIABLES */ + case 302: /* cmd ::= SHOW LOCAL VARIABLES */ +#line 547 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } +#line 7097 "sql.c" break; - case 301: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy416); } + case 303: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +#line 548 "sql.y" +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy54); } +#line 7102 "sql.c" break; - case 302: /* cmd ::= SHOW BNODES */ + case 304: /* cmd ::= SHOW BNODES */ +#line 549 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } +#line 7107 "sql.c" break; - case 303: /* cmd ::= SHOW SNODES */ + case 305: /* cmd ::= SHOW SNODES */ +#line 550 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } +#line 7112 "sql.c" break; - case 304: /* cmd ::= SHOW CLUSTER */ + case 306: /* cmd ::= SHOW CLUSTER */ +#line 551 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } +#line 7117 "sql.c" break; - case 305: /* cmd ::= SHOW TRANSACTIONS */ + case 307: /* cmd ::= SHOW TRANSACTIONS */ +#line 552 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } +#line 7122 "sql.c" break; - case 306: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy416); } + case 308: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +#line 553 "sql.y" +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy54); } +#line 7127 "sql.c" break; - case 307: /* cmd ::= SHOW CONSUMERS */ + case 309: /* cmd ::= SHOW CONSUMERS */ +#line 554 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } +#line 7132 "sql.c" break; - case 308: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 310: /* cmd ::= SHOW SUBSCRIPTIONS */ +#line 555 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } +#line 7137 "sql.c" break; - case 309: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } + case 311: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +#line 556 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy54, yymsp[-1].minor.yy54, OP_TYPE_EQUAL); } +#line 7142 "sql.c" break; - case 310: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } + case 312: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +#line 557 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), OP_TYPE_EQUAL); } +#line 7147 "sql.c" break; - case 311: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416, yymsp[-3].minor.yy316); } + case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +#line 558 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54, yymsp[-3].minor.yy652); } +#line 7152 "sql.c" break; - case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), yymsp[-4].minor.yy316); } + case 314: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +#line 559 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), yymsp[-4].minor.yy652); } +#line 7157 "sql.c" break; - case 313: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + case 315: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ +#line 560 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } +#line 7162 "sql.c" break; - case 314: /* cmd ::= SHOW VNODES */ + case 316: /* cmd ::= SHOW VNODES */ +#line 561 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } +#line 7167 "sql.c" break; - case 315: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy416, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 317: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +#line 563 "sql.y" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy54, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +#line 7172 "sql.c" break; - case 316: /* cmd ::= SHOW CLUSTER ALIVE */ + case 318: /* cmd ::= SHOW CLUSTER ALIVE */ +#line 564 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } +#line 7177 "sql.c" break; - case 317: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } + case 319: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ +#line 565 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, OP_TYPE_LIKE); } +#line 7182 "sql.c" break; - case 318: /* cmd ::= SHOW CREATE VIEW full_table_name */ -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy416); } + case 320: /* cmd ::= SHOW CREATE VIEW full_table_name */ +#line 566 "sql.y" +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy54); } +#line 7187 "sql.c" break; - case 319: /* cmd ::= SHOW COMPACTS */ + case 321: /* cmd ::= SHOW COMPACTS */ +#line 567 "sql.y" { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } +#line 7192 "sql.c" break; - case 320: /* cmd ::= SHOW COMPACT NK_INTEGER */ + case 322: /* cmd ::= SHOW COMPACT NK_INTEGER */ +#line 568 "sql.y" { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 7197 "sql.c" break; - case 321: /* table_kind_db_name_cond_opt ::= */ -{ yymsp[1].minor.yy925.kind = SHOW_KIND_ALL; yymsp[1].minor.yy925.dbName = nil_token; } + case 323: /* table_kind_db_name_cond_opt ::= */ +#line 572 "sql.y" +{ yymsp[1].minor.yy579.kind = SHOW_KIND_ALL; yymsp[1].minor.yy579.dbName = nil_token; } +#line 7202 "sql.c" break; - case 322: /* table_kind_db_name_cond_opt ::= table_kind */ -{ yylhsminor.yy925.kind = yymsp[0].minor.yy681; yylhsminor.yy925.dbName = nil_token; } - yymsp[0].minor.yy925 = yylhsminor.yy925; + case 324: /* table_kind_db_name_cond_opt ::= table_kind */ +#line 573 "sql.y" +{ yylhsminor.yy579.kind = yymsp[0].minor.yy719; yylhsminor.yy579.dbName = nil_token; } +#line 7207 "sql.c" + yymsp[0].minor.yy579 = yylhsminor.yy579; break; - case 323: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy925.kind = SHOW_KIND_ALL; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } - yymsp[-1].minor.yy925 = yylhsminor.yy925; + case 325: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +#line 574 "sql.y" +{ yylhsminor.yy579.kind = SHOW_KIND_ALL; yylhsminor.yy579.dbName = yymsp[-1].minor.yy837; } +#line 7213 "sql.c" + yymsp[-1].minor.yy579 = yylhsminor.yy579; break; - case 324: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -{ yylhsminor.yy925.kind = yymsp[-2].minor.yy681; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } - yymsp[-2].minor.yy925 = yylhsminor.yy925; + case 326: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +#line 575 "sql.y" +{ yylhsminor.yy579.kind = yymsp[-2].minor.yy719; yylhsminor.yy579.dbName = yymsp[-1].minor.yy837; } +#line 7219 "sql.c" + yymsp[-2].minor.yy579 = yylhsminor.yy579; break; - case 325: /* table_kind ::= NORMAL */ -{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_NORMAL; } + case 327: /* table_kind ::= NORMAL */ +#line 579 "sql.y" +{ yymsp[0].minor.yy719 = SHOW_KIND_TABLES_NORMAL; } +#line 7225 "sql.c" break; - case 326: /* table_kind ::= CHILD */ -{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_CHILD; } + case 328: /* table_kind ::= CHILD */ +#line 580 "sql.y" +{ yymsp[0].minor.yy719 = SHOW_KIND_TABLES_CHILD; } +#line 7230 "sql.c" break; - case 327: /* db_name_cond_opt ::= */ - case 332: /* from_db_opt ::= */ yytestcase(yyruleno==332); -{ yymsp[1].minor.yy416 = createDefaultDatabaseCondValue(pCxt); } + case 329: /* db_name_cond_opt ::= */ + case 334: /* from_db_opt ::= */ yytestcase(yyruleno==334); +#line 582 "sql.y" +{ yymsp[1].minor.yy54 = createDefaultDatabaseCondValue(pCxt); } +#line 7236 "sql.c" break; - case 328: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy1109); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; + case 330: /* db_name_cond_opt ::= db_name NK_DOT */ +#line 583 "sql.y" +{ yylhsminor.yy54 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy837); } +#line 7241 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 330: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 332: /* like_pattern_opt ::= LIKE NK_STRING */ +#line 586 "sql.y" +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7247 "sql.c" break; - case 331: /* table_name_cond ::= table_name */ -{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 333: /* table_name_cond ::= table_name */ +#line 588 "sql.y" +{ yylhsminor.yy54 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837); } +#line 7252 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 333: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } + case 335: /* from_db_opt ::= FROM db_name */ +#line 591 "sql.y" +{ yymsp[-1].minor.yy54 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837); } +#line 7258 "sql.c" break; - case 337: /* tag_item ::= TBNAME */ -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 339: /* tag_item ::= TBNAME */ +#line 599 "sql.y" +{ yylhsminor.yy54 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } +#line 7263 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 340: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy1109), &yymsp[0].minor.yy1109); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; + case 342: /* tag_item ::= column_name column_alias */ +#line 602 "sql.y" +{ yylhsminor.yy54 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy837), &yymsp[0].minor.yy837); } +#line 7269 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 341: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy1109), &yymsp[0].minor.yy1109); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 343: /* tag_item ::= column_name AS column_alias */ +#line 603 "sql.y" +{ yylhsminor.yy54 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy837), &yymsp[0].minor.yy837); } +#line 7275 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 342: /* db_kind_opt ::= */ -{ yymsp[1].minor.yy681 = SHOW_KIND_ALL; } + case 344: /* db_kind_opt ::= */ +#line 607 "sql.y" +{ yymsp[1].minor.yy719 = SHOW_KIND_ALL; } +#line 7281 "sql.c" break; - case 343: /* db_kind_opt ::= USER */ -{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_USER; } + case 345: /* db_kind_opt ::= USER */ +#line 608 "sql.y" +{ yymsp[0].minor.yy719 = SHOW_KIND_DATABASES_USER; } +#line 7286 "sql.c" break; - case 344: /* db_kind_opt ::= SYSTEM */ -{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_SYSTEM; } + case 346: /* db_kind_opt ::= SYSTEM */ +#line 609 "sql.y" +{ yymsp[0].minor.yy719 = SHOW_KIND_DATABASES_SYSTEM; } +#line 7291 "sql.c" break; - case 345: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy209, &yymsp[-7].minor.yy1109, yymsp[-4].minor.yy416, yymsp[-5].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } + case 347: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ +#line 615 "sql.y" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy325, &yymsp[-7].minor.yy837, yymsp[-4].minor.yy54, yymsp[-5].minor.yy54, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 7296 "sql.c" break; - case 346: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy209, &yymsp[-6].minor.yy1109, NULL, yymsp[-4].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } + case 348: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ +#line 617 "sql.y" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy325, &yymsp[-6].minor.yy837, NULL, yymsp[-4].minor.yy54, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 7301 "sql.c" break; - case 347: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } + case 349: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ +#line 618 "sql.y" +{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } +#line 7306 "sql.c" break; - case 348: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy416); } + case 350: /* cmd ::= SHOW db_name_cond_opt TSMAS */ +#line 619 "sql.y" +{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy54); } +#line 7311 "sql.c" break; - case 351: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -{ yymsp[-3].minor.yy416 = createTSMAOptions(pCxt, yymsp[-1].minor.yy316); } + case 353: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ +#line 626 "sql.y" +{ yymsp[-3].minor.yy54 = createTSMAOptions(pCxt, yymsp[-1].minor.yy652); } +#line 7316 "sql.c" break; - case 352: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy209, yymsp[-3].minor.yy416, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } + case 354: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +#line 630 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy325, yymsp[-3].minor.yy54, yymsp[-1].minor.yy54, NULL, yymsp[0].minor.yy54); } +#line 7321 "sql.c" break; - case 353: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy416, yymsp[-1].minor.yy316, NULL); } + case 355: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +#line 632 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy54, yymsp[-1].minor.yy652, NULL); } +#line 7326 "sql.c" break; - case 354: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } + case 356: /* cmd ::= DROP INDEX exists_opt full_index_name */ +#line 633 "sql.y" +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } +#line 7331 "sql.c" break; - case 355: /* full_index_name ::= index_name */ -{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy1109); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 357: /* full_index_name ::= index_name */ +#line 635 "sql.y" +{ yylhsminor.yy54 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy837); } +#line 7336 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 356: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 358: /* full_index_name ::= db_name NK_DOT index_name */ +#line 636 "sql.y" +{ yylhsminor.yy54 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } +#line 7342 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 357: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy416 = createIndexOption(pCxt, yymsp[-7].minor.yy316, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } + case 359: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 639 "sql.y" +{ yymsp[-9].minor.yy54 = createIndexOption(pCxt, yymsp[-7].minor.yy652, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 7348 "sql.c" break; - case 358: /* 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.yy416 = createIndexOption(pCxt, yymsp[-9].minor.yy316, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } + case 360: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 642 "sql.y" +{ yymsp[-11].minor.yy54 = createIndexOption(pCxt, yymsp[-9].minor.yy652, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 7353 "sql.c" break; - case 361: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; + case 363: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +#line 649 "sql.y" +{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[-3].minor.yy837, yymsp[-1].minor.yy652); } +#line 7358 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; - case 362: /* sma_func_name ::= function_name */ - case 636: /* alias_opt ::= table_alias */ yytestcase(yyruleno==636); -{ yylhsminor.yy1109 = yymsp[0].minor.yy1109; } - yymsp[0].minor.yy1109 = yylhsminor.yy1109; + case 364: /* sma_func_name ::= function_name */ + case 638: /* alias_opt ::= table_alias */ yytestcase(yyruleno==638); +#line 653 "sql.y" +{ yylhsminor.yy837 = yymsp[0].minor.yy837; } +#line 7365 "sql.c" + yymsp[0].minor.yy837 = yylhsminor.yy837; break; - case 367: /* sma_stream_opt ::= */ - case 417: /* stream_options ::= */ yytestcase(yyruleno==417); -{ yymsp[1].minor.yy416 = createStreamOptions(pCxt); } + case 369: /* sma_stream_opt ::= */ + case 419: /* stream_options ::= */ yytestcase(yyruleno==419); +#line 659 "sql.y" +{ yymsp[1].minor.yy54 = createStreamOptions(pCxt); } +#line 7372 "sql.c" break; - case 368: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 370: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +#line 660 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } +#line 7377 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 369: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 371: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +#line 661 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } +#line 7383 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 370: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 372: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +#line 662 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } +#line 7389 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 371: /* with_meta ::= AS */ -{ yymsp[0].minor.yy820 = 0; } + case 373: /* with_meta ::= AS */ +#line 667 "sql.y" +{ yymsp[0].minor.yy332 = 0; } +#line 7395 "sql.c" break; - case 372: /* with_meta ::= WITH META AS */ -{ yymsp[-2].minor.yy820 = 1; } + case 374: /* with_meta ::= WITH META AS */ +#line 668 "sql.y" +{ yymsp[-2].minor.yy332 = 1; } +#line 7400 "sql.c" break; - case 373: /* with_meta ::= ONLY META AS */ -{ yymsp[-2].minor.yy820 = 2; } + case 375: /* with_meta ::= ONLY META AS */ +#line 669 "sql.y" +{ yymsp[-2].minor.yy332 = 2; } +#line 7405 "sql.c" break; - case 374: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } + case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +#line 671 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy325, &yymsp[-2].minor.yy837, yymsp[0].minor.yy54); } +#line 7410 "sql.c" break; - case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy209, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy820); } + case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +#line 673 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy325, &yymsp[-3].minor.yy837, &yymsp[0].minor.yy837, yymsp[-2].minor.yy332); } +#line 7415 "sql.c" break; - case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy209, &yymsp[-4].minor.yy1109, yymsp[-1].minor.yy416, yymsp[-3].minor.yy820, yymsp[0].minor.yy416); } + case 378: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +#line 675 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy325, &yymsp[-4].minor.yy837, yymsp[-1].minor.yy54, yymsp[-3].minor.yy332, yymsp[0].minor.yy54); } +#line 7420 "sql.c" break; - case 377: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } + case 379: /* cmd ::= DROP TOPIC exists_opt topic_name */ +#line 677 "sql.y" +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } +#line 7425 "sql.c" break; - case 378: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } + case 380: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +#line 678 "sql.y" +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy325, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } +#line 7430 "sql.c" break; - case 379: /* cmd ::= DESC full_table_name */ - case 380: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==380); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy416); } + case 381: /* cmd ::= DESC full_table_name */ + case 382: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==382); +#line 681 "sql.y" +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy54); } +#line 7436 "sql.c" break; - case 381: /* cmd ::= RESET QUERY CACHE */ + case 383: /* cmd ::= RESET QUERY CACHE */ +#line 685 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } +#line 7441 "sql.c" break; - case 382: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 383: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==383); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } + case 384: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 385: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==385); +#line 688 "sql.y" +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy325, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 7447 "sql.c" break; - case 386: /* explain_options ::= */ -{ yymsp[1].minor.yy416 = createDefaultExplainOptions(pCxt); } + case 388: /* explain_options ::= */ +#line 696 "sql.y" +{ yymsp[1].minor.yy54 = createDefaultExplainOptions(pCxt); } +#line 7452 "sql.c" break; - case 387: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy416 = setExplainVerbose(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 389: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +#line 697 "sql.y" +{ yylhsminor.yy54 = setExplainVerbose(pCxt, yymsp[-2].minor.yy54, &yymsp[0].minor.yy0); } +#line 7457 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 388: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy416 = setExplainRatio(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 390: /* explain_options ::= explain_options RATIO NK_FLOAT */ +#line 698 "sql.y" +{ yylhsminor.yy54 = setExplainRatio(pCxt, yymsp[-2].minor.yy54, &yymsp[0].minor.yy0); } +#line 7463 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 389: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy209, yymsp[-9].minor.yy209, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy820, &yymsp[0].minor.yy1109, yymsp[-10].minor.yy209); } + case 391: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +#line 703 "sql.y" +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy325, yymsp[-9].minor.yy325, &yymsp[-6].minor.yy837, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy84, yymsp[-1].minor.yy332, &yymsp[0].minor.yy837, yymsp[-10].minor.yy325); } +#line 7469 "sql.c" break; - case 390: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } + case 392: /* cmd ::= DROP FUNCTION exists_opt function_name */ +#line 704 "sql.y" +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } +#line 7474 "sql.c" break; - case 395: /* language_opt ::= */ - case 440: /* on_vgroup_id ::= */ yytestcase(yyruleno==440); -{ yymsp[1].minor.yy1109 = nil_token; } + case 397: /* language_opt ::= */ + case 442: /* on_vgroup_id ::= */ yytestcase(yyruleno==442); +#line 718 "sql.y" +{ yymsp[1].minor.yy837 = nil_token; } +#line 7480 "sql.c" break; - case 396: /* language_opt ::= LANGUAGE NK_STRING */ - case 441: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==441); -{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy0; } + case 398: /* language_opt ::= LANGUAGE NK_STRING */ + case 443: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==443); +#line 719 "sql.y" +{ yymsp[-1].minor.yy837 = yymsp[0].minor.yy0; } +#line 7486 "sql.c" break; - case 399: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy209, yymsp[-2].minor.yy416, &yymsp[-1].minor.yy0, yymsp[0].minor.yy416); } + case 401: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +#line 728 "sql.y" +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy325, yymsp[-2].minor.yy54, &yymsp[-1].minor.yy0, yymsp[0].minor.yy54); } +#line 7491 "sql.c" break; - case 400: /* cmd ::= DROP VIEW exists_opt full_view_name */ -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } + case 402: /* cmd ::= DROP VIEW exists_opt full_view_name */ +#line 729 "sql.y" +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } +#line 7496 "sql.c" break; - case 401: /* full_view_name ::= view_name */ -{ yylhsminor.yy416 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy1109); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 403: /* full_view_name ::= view_name */ +#line 731 "sql.y" +{ yylhsminor.yy54 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy837); } +#line 7501 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 402: /* full_view_name ::= db_name NK_DOT view_name */ -{ yylhsminor.yy416 = createViewNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 404: /* full_view_name ::= db_name NK_DOT view_name */ +#line 732 "sql.y" +{ yylhsminor.yy54 = createViewNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } +#line 7507 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 403: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy209, &yymsp[-8].minor.yy1109, yymsp[-5].minor.yy416, yymsp[-7].minor.yy416, yymsp[-3].minor.yy316, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, yymsp[-4].minor.yy316); } + case 405: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +#line 737 "sql.y" +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy325, &yymsp[-8].minor.yy837, yymsp[-5].minor.yy54, yymsp[-7].minor.yy54, yymsp[-3].minor.yy652, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, yymsp[-4].minor.yy652); } +#line 7513 "sql.c" break; - case 404: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } + case 406: /* cmd ::= DROP STREAM exists_opt stream_name */ +#line 738 "sql.y" +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } +#line 7518 "sql.c" break; - case 405: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } + case 407: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +#line 739 "sql.y" +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } +#line 7523 "sql.c" break; - case 406: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } + case 408: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +#line 740 "sql.y" +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy325, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } +#line 7528 "sql.c" break; - case 411: /* column_stream_def ::= column_name stream_col_options */ -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy416); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; + case 413: /* column_stream_def ::= column_name stream_col_options */ +#line 753 "sql.y" +{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy837, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy54); } +#line 7533 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 412: /* stream_col_options ::= */ - case 749: /* column_options ::= */ yytestcase(yyruleno==749); -{ yymsp[1].minor.yy416 = createDefaultColumnOptions(pCxt); } + case 414: /* stream_col_options ::= */ + case 751: /* column_options ::= */ yytestcase(yyruleno==751); +#line 754 "sql.y" +{ yymsp[1].minor.yy54 = createDefaultColumnOptions(pCxt); } +#line 7540 "sql.c" break; - case 413: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 750: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==750); -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_PRIMARYKEY, NULL); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 415: /* stream_col_options ::= stream_col_options PRIMARY KEY */ + case 752: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==752); +#line 755 "sql.y" +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_PRIMARYKEY, NULL); } +#line 7546 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 418: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 419: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==419); -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 420: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 421: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==421); +#line 765 "sql.y" +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } +#line 7553 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 420: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; + case 422: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +#line 767 "sql.y" +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } +#line 7559 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; - case 421: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 423: /* stream_options ::= stream_options WATERMARK duration_literal */ +#line 768 "sql.y" +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } +#line 7565 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 422: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; + case 424: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +#line 769 "sql.y" +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } +#line 7571 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; - case 423: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 425: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +#line 770 "sql.y" +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +#line 7577 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 424: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 426: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +#line 771 "sql.y" +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } +#line 7583 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 425: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; + case 427: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +#line 772 "sql.y" +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } +#line 7589 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; - case 427: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 693: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==693); - case 717: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==717); -{ yymsp[-3].minor.yy416 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy416); } + case 429: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 695: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==695); + case 719: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==719); +#line 775 "sql.y" +{ yymsp[-3].minor.yy54 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy54); } +#line 7597 "sql.c" break; - case 430: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 432: /* cmd ::= KILL CONNECTION NK_INTEGER */ +#line 783 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } +#line 7602 "sql.c" break; - case 431: /* cmd ::= KILL QUERY NK_STRING */ + case 433: /* cmd ::= KILL QUERY NK_STRING */ +#line 784 "sql.y" { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } +#line 7607 "sql.c" break; - case 432: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 434: /* cmd ::= KILL TRANSACTION NK_INTEGER */ +#line 785 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } +#line 7612 "sql.c" break; - case 433: /* cmd ::= KILL COMPACT NK_INTEGER */ + case 435: /* cmd ::= KILL COMPACT NK_INTEGER */ +#line 786 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } +#line 7617 "sql.c" break; - case 434: /* cmd ::= BALANCE VGROUP */ + case 436: /* cmd ::= BALANCE VGROUP */ +#line 789 "sql.y" { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } +#line 7622 "sql.c" break; - case 435: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy1109); } + case 437: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +#line 790 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy837); } +#line 7627 "sql.c" break; - case 436: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ -{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy1109); } + case 438: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ +#line 791 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy837); } +#line 7632 "sql.c" break; - case 437: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 439: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +#line 792 "sql.y" { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 7637 "sql.c" break; - case 438: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy316); } + case 440: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +#line 793 "sql.y" +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy652); } +#line 7642 "sql.c" break; - case 439: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 441: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +#line 794 "sql.y" { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } +#line 7647 "sql.c" break; - case 442: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 444: /* dnode_list ::= DNODE NK_INTEGER */ +#line 803 "sql.y" +{ yymsp[-1].minor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 7652 "sql.c" break; - case 444: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } + case 446: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +#line 810 "sql.y" +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 7657 "sql.c" break; - case 447: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy416 = createInsertStmt(pCxt, yymsp[-4].minor.yy416, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } + case 449: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +#line 819 "sql.y" +{ yymsp[-6].minor.yy54 = createInsertStmt(pCxt, yymsp[-4].minor.yy54, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } +#line 7662 "sql.c" break; - case 448: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy416 = createInsertStmt(pCxt, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } + case 450: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +#line 820 "sql.y" +{ yymsp[-3].minor.yy54 = createInsertStmt(pCxt, yymsp[-1].minor.yy54, NULL, yymsp[0].minor.yy54); } +#line 7667 "sql.c" break; - case 449: /* tags_literal ::= NK_INTEGER */ - case 461: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==461); - case 470: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==470); -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 451: /* tags_literal ::= NK_INTEGER */ + case 463: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==463); + case 472: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==472); +#line 823 "sql.y" +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } +#line 7674 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 450: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 451: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==451); - case 462: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==462); - case 463: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==463); - case 471: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==471); - case 472: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==472); - case 480: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==480); - case 481: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==481); + case 452: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 453: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==453); + case 464: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==464); + case 465: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==465); + case 473: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==473); + case 474: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==474); + case 482: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==482); + case 483: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==483); +#line 824 "sql.y" { SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + l.n = (r.z + r.n) - l.z; + yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy54); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 7692 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 452: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 455: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==455); - case 464: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==464); - case 467: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==467); - case 473: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==473); - case 476: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==476); + case 454: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 457: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==457); + case 466: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==466); + case 469: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==469); + case 475: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==475); + case 478: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==478); +#line 836 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; +#line 7707 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 453: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 454: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==454); - case 456: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==456); - case 457: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==457); - case 465: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==465); - case 466: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==466); - case 468: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==468); - case 469: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==469); - case 474: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==474); - case 475: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==475); - case 477: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==477); - case 478: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==478); + case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 456: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==456); + case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==458); + case 459: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==459); + case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==467); + case 468: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==468); + case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==470); + case 471: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==471); + case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==476); + case 477: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==477); + case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==479); + case 480: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==480); +#line 841 "sql.y" { SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); - } - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 458: /* tags_literal ::= NK_FLOAT */ -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 459: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 460: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==460); -{ - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); - } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 479: /* tags_literal ::= NK_STRING */ -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 482: /* tags_literal ::= NK_BOOL */ -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 483: /* tags_literal ::= NULL */ -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 484: /* tags_literal ::= literal_func */ -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy416); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 485: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 486: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==486); -{ - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); + yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy54); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; +#line 7729 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; - case 489: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 460: /* tags_literal ::= NK_FLOAT */ +#line 870 "sql.y" +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } +#line 7735 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 490: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 491: /* literal ::= NK_STRING */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 492: /* literal ::= NK_BOOL */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 493: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 494: /* literal ::= duration_literal */ - case 504: /* signed_literal ::= signed */ yytestcase(yyruleno==504); - case 528: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==528); - case 529: /* expression ::= literal */ yytestcase(yyruleno==529); - case 531: /* expression ::= column_reference */ yytestcase(yyruleno==531); - case 532: /* expression ::= function_expression */ yytestcase(yyruleno==532); - case 533: /* expression ::= case_when_expression */ yytestcase(yyruleno==533); - case 567: /* function_expression ::= literal_func */ yytestcase(yyruleno==567); - case 617: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==617); - case 621: /* boolean_primary ::= predicate */ yytestcase(yyruleno==621); - case 623: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==623); - case 624: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==624); - case 627: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==627); - case 629: /* table_reference ::= table_primary */ yytestcase(yyruleno==629); - case 630: /* table_reference ::= joined_table */ yytestcase(yyruleno==630); - case 634: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==634); - case 719: /* query_simple ::= query_specification */ yytestcase(yyruleno==719); - case 720: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==720); - case 723: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==723); - case 725: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==725); -{ yylhsminor.yy416 = yymsp[0].minor.yy416; } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 495: /* literal ::= NULL */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 496: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 497: /* duration_literal ::= NK_VARIABLE */ - case 694: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==694); - case 695: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==695); - case 696: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==696); -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 498: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 499: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - break; - case 500: /* signed ::= NK_MINUS NK_INTEGER */ + case 461: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 462: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==462); +#line 871 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; +#line 7746 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 501: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; + case 481: /* tags_literal ::= NK_STRING */ +#line 977 "sql.y" +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } +#line 7752 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 502: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 484: /* tags_literal ::= NK_BOOL */ +#line 990 "sql.y" +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } +#line 7758 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 503: /* signed ::= NK_MINUS NK_FLOAT */ + case 485: /* tags_literal ::= NULL */ +#line 991 "sql.y" +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } +#line 7764 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 486: /* tags_literal ::= literal_func */ +#line 993 "sql.y" +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy54); } +#line 7770 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 487: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 488: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==488); +#line 994 "sql.y" +{ + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + l.n = (r.z + r.n) - l.z; + yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy54, yymsp[0].minor.yy54); + } +#line 7782 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 491: /* literal ::= NK_INTEGER */ +#line 1013 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } +#line 7788 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 492: /* literal ::= NK_FLOAT */ +#line 1014 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } +#line 7794 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 493: /* literal ::= NK_STRING */ +#line 1015 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 7800 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 494: /* literal ::= NK_BOOL */ +#line 1016 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } +#line 7806 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 495: /* literal ::= TIMESTAMP NK_STRING */ +#line 1017 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +#line 7812 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 496: /* literal ::= duration_literal */ + case 506: /* signed_literal ::= signed */ yytestcase(yyruleno==506); + case 530: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==530); + case 531: /* expression ::= literal */ yytestcase(yyruleno==531); + case 533: /* expression ::= column_reference */ yytestcase(yyruleno==533); + case 534: /* expression ::= function_expression */ yytestcase(yyruleno==534); + case 535: /* expression ::= case_when_expression */ yytestcase(yyruleno==535); + case 569: /* function_expression ::= literal_func */ yytestcase(yyruleno==569); + case 619: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==619); + case 623: /* boolean_primary ::= predicate */ yytestcase(yyruleno==623); + case 625: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==625); + case 626: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==626); + case 629: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==629); + case 631: /* table_reference ::= table_primary */ yytestcase(yyruleno==631); + case 632: /* table_reference ::= joined_table */ yytestcase(yyruleno==632); + case 636: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==636); + case 721: /* query_simple ::= query_specification */ yytestcase(yyruleno==721); + case 722: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==722); + case 725: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==725); + case 727: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==727); +#line 1018 "sql.y" +{ yylhsminor.yy54 = yymsp[0].minor.yy54; } +#line 7837 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 497: /* literal ::= NULL */ +#line 1019 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } +#line 7843 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 498: /* literal ::= NK_QUESTION */ +#line 1020 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 7849 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 499: /* duration_literal ::= NK_VARIABLE */ + case 696: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==696); + case 697: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==697); + case 698: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==698); +#line 1022 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 7858 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 500: /* signed ::= NK_INTEGER */ +#line 1024 "sql.y" +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7864 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 501: /* signed ::= NK_PLUS NK_INTEGER */ +#line 1025 "sql.y" +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7870 "sql.c" + break; + case 502: /* signed ::= NK_MINUS NK_INTEGER */ +#line 1026 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 505: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 506: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 507: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 508: /* signed_literal ::= duration_literal */ - case 510: /* signed_literal ::= literal_func */ yytestcase(yyruleno==510); - case 588: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==588); - case 671: /* select_item ::= common_expression */ yytestcase(yyruleno==671); - case 681: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==681); - case 724: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==724); - case 726: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==726); - case 739: /* search_condition ::= common_expression */ yytestcase(yyruleno==739); -{ yylhsminor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 509: /* signed_literal ::= NULL */ -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 511: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy416 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 530: /* expression ::= pseudo_column */ -{ yylhsminor.yy416 = yymsp[0].minor.yy416; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy416, true); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 534: /* expression ::= NK_LP expression NK_RP */ - case 622: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==622); - case 738: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==738); -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 535: /* expression ::= NK_PLUS expr_or_subquery */ -{ - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); - } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 536: /* expression ::= NK_MINUS expr_or_subquery */ -{ - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); - } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 537: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 538: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 539: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 540: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 541: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 542: /* expression ::= column_reference NK_ARROW NK_STRING */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 543: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 544: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 547: /* column_reference ::= column_name */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy1109, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 548: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 549: /* column_reference ::= NK_ALIAS */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 550: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 551: /* pseudo_column ::= ROWTS */ - case 552: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==552); - case 554: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==554); - case 555: /* pseudo_column ::= QEND */ yytestcase(yyruleno==555); - case 556: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==556); - case 557: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==557); - case 558: /* pseudo_column ::= WEND */ yytestcase(yyruleno==558); - case 559: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==559); - case 560: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==560); - case 561: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==561); - case 562: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==562); - case 569: /* literal_func ::= NOW */ yytestcase(yyruleno==569); - case 570: /* literal_func ::= TODAY */ yytestcase(yyruleno==570); -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 553: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy1109)))); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 563: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 564: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==564); -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316)); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 565: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 566: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==566); -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy952)); } - yymsp[-5].minor.yy416 = yylhsminor.yy416; - break; - case 568: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy1109, NULL)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 584: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy316 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 589: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 674: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==674); -{ yylhsminor.yy416 = createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 590: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 591: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } - yymsp[-4].minor.yy416 = yylhsminor.yy416; - break; - case 594: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy416 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } - break; - case 596: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } - break; - case 597: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 602: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==602); -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy848, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 598: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-4].minor.yy416 = yylhsminor.yy416; - break; - case 599: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-5].minor.yy416 = yylhsminor.yy416; - break; - case 600: /* predicate ::= expr_or_subquery IS NULL */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), NULL)); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 601: /* predicate ::= expr_or_subquery IS NOT NULL */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL)); - } - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 603: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_THAN; } - break; - case 604: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_THAN; } - break; - case 605: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_EQUAL; } - break; - case 606: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_EQUAL; } - break; - case 607: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy848 = OP_TYPE_NOT_EQUAL; } - break; - case 608: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy848 = OP_TYPE_EQUAL; } - break; - case 609: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy848 = OP_TYPE_LIKE; } - break; - case 610: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_LIKE; } - break; - case 611: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy848 = OP_TYPE_MATCH; } - break; - case 612: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy848 = OP_TYPE_NMATCH; } - break; - case 613: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy848 = OP_TYPE_JSON_CONTAINS; } - break; - case 614: /* in_op ::= IN */ -{ yymsp[0].minor.yy848 = OP_TYPE_IN; } - break; - case 615: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_IN; } - break; - case 616: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 618: /* boolean_value_expression ::= NOT boolean_primary */ -{ - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); - } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 619: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 620: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); - } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 628: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy416 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, NULL); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 631: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 632: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-3].minor.yy1109, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 633: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy416 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 635: /* alias_opt ::= */ -{ yymsp[1].minor.yy1109 = nil_token; } - break; - case 637: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy1109; } - break; - case 638: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 639: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==639); -{ yymsp[-2].minor.yy416 = yymsp[-1].minor.yy416; } - break; - case 640: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ -{ - yylhsminor.yy416 = createJoinTableNode(pCxt, yymsp[-6].minor.yy972, yymsp[-5].minor.yy630, yymsp[-7].minor.yy416, yymsp[-3].minor.yy416, yymsp[-2].minor.yy416); - yylhsminor.yy416 = addWindowOffsetClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); - yylhsminor.yy416 = addJLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); - } - yymsp[-7].minor.yy416 = yylhsminor.yy416; - break; - case 641: /* join_type ::= */ -{ yymsp[1].minor.yy972 = JOIN_TYPE_INNER; } - break; - case 642: /* join_type ::= INNER */ -{ yymsp[0].minor.yy972 = JOIN_TYPE_INNER; } - break; - case 643: /* join_type ::= LEFT */ -{ yymsp[0].minor.yy972 = JOIN_TYPE_LEFT; } - break; - case 644: /* join_type ::= RIGHT */ -{ yymsp[0].minor.yy972 = JOIN_TYPE_RIGHT; } - break; - case 645: /* join_type ::= FULL */ -{ yymsp[0].minor.yy972 = JOIN_TYPE_FULL; } - break; - case 646: /* join_subtype ::= */ -{ yymsp[1].minor.yy630 = JOIN_STYPE_NONE; } - break; - case 647: /* join_subtype ::= OUTER */ -{ yymsp[0].minor.yy630 = JOIN_STYPE_OUTER; } - break; - case 648: /* join_subtype ::= SEMI */ -{ yymsp[0].minor.yy630 = JOIN_STYPE_SEMI; } - break; - case 649: /* join_subtype ::= ANTI */ -{ yymsp[0].minor.yy630 = JOIN_STYPE_ANTI; } - break; - case 650: /* join_subtype ::= ASOF */ -{ yymsp[0].minor.yy630 = JOIN_STYPE_ASOF; } - break; - case 651: /* join_subtype ::= WINDOW */ -{ yymsp[0].minor.yy630 = JOIN_STYPE_WIN; } - break; - case 655: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -{ yymsp[-5].minor.yy416 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } - break; - case 656: /* window_offset_literal ::= NK_VARIABLE */ -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 657: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ +#line 7879 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 503: /* signed ::= NK_FLOAT */ +#line 1031 "sql.y" +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7885 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 504: /* signed ::= NK_PLUS NK_FLOAT */ +#line 1032 "sql.y" +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7891 "sql.c" + break; + case 505: /* signed ::= NK_MINUS NK_FLOAT */ +#line 1033 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; +#line 7900 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 659: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 730: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==730); - case 734: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==734); -{ yymsp[-1].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 507: /* signed_literal ::= NK_STRING */ +#line 1040 "sql.y" +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7906 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 660: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 508: /* signed_literal ::= NK_BOOL */ +#line 1041 "sql.y" +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } +#line 7912 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 509: /* signed_literal ::= TIMESTAMP NK_STRING */ +#line 1042 "sql.y" +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 7918 "sql.c" + break; + case 510: /* signed_literal ::= duration_literal */ + case 512: /* signed_literal ::= literal_func */ yytestcase(yyruleno==512); + case 590: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==590); + case 673: /* select_item ::= common_expression */ yytestcase(yyruleno==673); + case 683: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==683); + case 726: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==726); + case 728: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==728); + case 741: /* search_condition ::= common_expression */ yytestcase(yyruleno==741); +#line 1043 "sql.y" +{ yylhsminor.yy54 = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); } +#line 7930 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 511: /* signed_literal ::= NULL */ +#line 1044 "sql.y" +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } +#line 7936 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 513: /* signed_literal ::= NK_QUESTION */ +#line 1046 "sql.y" +{ yylhsminor.yy54 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } +#line 7942 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 532: /* expression ::= pseudo_column */ +#line 1112 "sql.y" +{ yylhsminor.yy54 = yymsp[0].minor.yy54; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy54, true); } +#line 7948 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 536: /* expression ::= NK_LP expression NK_RP */ + case 624: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==624); + case 740: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==740); +#line 1116 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 7956 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 537: /* expression ::= NK_PLUS expr_or_subquery */ +#line 1117 "sql.y" { - yymsp[-13].minor.yy416 = createSelectStmt(pCxt, yymsp[-11].minor.yy209, yymsp[-9].minor.yy316, yymsp[-8].minor.yy416, yymsp[-12].minor.yy316); - yymsp[-13].minor.yy416 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy416, yymsp[-10].minor.yy209); - yymsp[-13].minor.yy416 = addWhereClause(pCxt, yymsp[-13].minor.yy416, yymsp[-7].minor.yy416); - yymsp[-13].minor.yy416 = addPartitionByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-6].minor.yy316); - yymsp[-13].minor.yy416 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy416, yymsp[-2].minor.yy416); - yymsp[-13].minor.yy416 = addGroupByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-1].minor.yy316); - yymsp[-13].minor.yy416 = addHavingClause(pCxt, yymsp[-13].minor.yy416, yymsp[0].minor.yy416); - yymsp[-13].minor.yy416 = addRangeClause(pCxt, yymsp[-13].minor.yy416, yymsp[-5].minor.yy416); - yymsp[-13].minor.yy416 = addEveryClause(pCxt, yymsp[-13].minor.yy416, yymsp[-4].minor.yy416); - yymsp[-13].minor.yy416 = addFillClause(pCxt, yymsp[-13].minor.yy416, yymsp[-3].minor.yy416); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } +#line 7965 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 661: /* hint_list ::= */ -{ yymsp[1].minor.yy316 = createHintNodeList(pCxt, NULL); } - break; - case 662: /* hint_list ::= NK_HINT */ -{ yylhsminor.yy316 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 667: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy209 = false; } - break; - case 670: /* select_item ::= NK_STAR */ -{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 672: /* select_item ::= common_expression column_alias */ - case 682: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==682); -{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 673: /* select_item ::= common_expression AS column_alias */ - case 683: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==683); -{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), &yymsp[0].minor.yy1109); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 678: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 708: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==708); - case 728: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==728); -{ yymsp[-2].minor.yy316 = yymsp[0].minor.yy316; } - break; - case 685: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -{ yymsp[-5].minor.yy416 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } - break; - case 686: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy416 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } - break; - case 687: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } - break; - case 688: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } - break; - case 689: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy416 = createEventWindowNode(pCxt, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } - break; - case 690: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } - break; - case 691: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } - break; - case 698: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy416 = createFillNode(pCxt, yymsp[-1].minor.yy882, NULL); } - break; - case 699: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } - break; - case 700: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } - break; - case 701: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy882 = FILL_MODE_NONE; } - break; - case 702: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy882 = FILL_MODE_PREV; } - break; - case 703: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy882 = FILL_MODE_NULL; } - break; - case 704: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy882 = FILL_MODE_NULL_F; } - break; - case 705: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy882 = FILL_MODE_LINEAR; } - break; - case 706: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy882 = FILL_MODE_NEXT; } - break; - case 709: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy316 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 710: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } - yymsp[-2].minor.yy316 = yylhsminor.yy316; - break; - case 714: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy416 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } - break; - case 715: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy416 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } - break; - case 718: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 538: /* expression ::= NK_MINUS expr_or_subquery */ +#line 1121 "sql.y" { - yylhsminor.yy416 = addOrderByClause(pCxt, yymsp[-3].minor.yy416, yymsp[-2].minor.yy316); - yylhsminor.yy416 = addSlimitClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); - yylhsminor.yy416 = addLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy54), NULL)); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; +#line 7974 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 721: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } - yymsp[-3].minor.yy416 = yylhsminor.yy416; + case 539: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ +#line 1125 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 7984 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 722: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 540: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ +#line 1130 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 7994 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 731: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 735: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==735); -{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 541: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ +#line 1135 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8004 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 732: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 736: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==736); -{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 542: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ +#line 1140 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8014 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 737: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy416); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 543: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ +#line 1145 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8024 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 742: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy416 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), yymsp[-1].minor.yy506, yymsp[0].minor.yy1045); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 544: /* expression ::= column_reference NK_ARROW NK_STRING */ +#line 1150 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + } +#line 8033 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 743: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy506 = ORDER_ASC; } + case 545: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ +#line 1154 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8043 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 744: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy506 = ORDER_ASC; } + case 546: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ +#line 1159 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8053 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 745: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy506 = ORDER_DESC; } + case 549: /* column_reference ::= column_name */ +#line 1170 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy837, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy837)); } +#line 8059 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 746: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy1045 = NULL_ORDER_DEFAULT; } + case 550: /* column_reference ::= table_name NK_DOT column_name */ +#line 1171 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837, createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837)); } +#line 8065 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 747: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy1045 = NULL_ORDER_FIRST; } + case 551: /* column_reference ::= NK_ALIAS */ +#line 1172 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8071 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 748: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy1045 = NULL_ORDER_LAST; } + case 552: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +#line 1173 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0)); } +#line 8077 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 751: /* column_options ::= column_options ENCODE NK_STRING */ -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 553: /* pseudo_column ::= ROWTS */ + case 554: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==554); + case 556: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==556); + case 557: /* pseudo_column ::= QEND */ yytestcase(yyruleno==557); + case 558: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==558); + case 559: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==559); + case 560: /* pseudo_column ::= WEND */ yytestcase(yyruleno==560); + case 561: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==561); + case 562: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==562); + case 563: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==563); + case 564: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==564); + case 571: /* literal_func ::= NOW */ yytestcase(yyruleno==571); + case 572: /* literal_func ::= TODAY */ yytestcase(yyruleno==572); +#line 1175 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } +#line 8095 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 752: /* column_options ::= column_options COMPRESS NK_STRING */ -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 555: /* pseudo_column ::= table_name NK_DOT TBNAME */ +#line 1177 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy837)))); } +#line 8101 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 753: /* column_options ::= column_options LEVEL NK_STRING */ -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 565: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 566: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==566); +#line 1188 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy837, yymsp[-1].minor.yy652)); } +#line 8108 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 568: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==568); +#line 1191 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy84)); } +#line 8115 "sql.c" + yymsp[-5].minor.yy54 = yylhsminor.yy54; + break; + case 570: /* literal_func ::= noarg_func NK_LP NK_RP */ +#line 1197 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy837, NULL)); } +#line 8121 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 586: /* star_func_para_list ::= NK_STAR */ +#line 1222 "sql.y" +{ yylhsminor.yy652 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8127 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; + break; + case 591: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 676: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==676); +#line 1231 "sql.y" +{ yylhsminor.yy54 = createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0); } +#line 8134 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 592: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +#line 1234 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy652, yymsp[-1].minor.yy54)); } +#line 8140 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 593: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +#line 1236 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-2].minor.yy652, yymsp[-1].minor.yy54)); } +#line 8146 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; + break; + case 596: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +#line 1243 "sql.y" +{ yymsp[-3].minor.yy54 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } +#line 8152 "sql.c" + break; + case 598: /* case_when_else_opt ::= ELSE common_expression */ +#line 1246 "sql.y" +{ yymsp[-1].minor.yy54 = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); } +#line 8157 "sql.c" + break; + case 599: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 604: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==604); +#line 1249 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy922, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8167 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 600: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1256 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy54), releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8177 "sql.c" + yymsp[-4].minor.yy54 = yylhsminor.yy54; + break; + case 601: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1262 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8187 "sql.c" + yymsp[-5].minor.yy54 = yylhsminor.yy54; + break; + case 602: /* predicate ::= expr_or_subquery IS NULL */ +#line 1267 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), NULL)); + } +#line 8196 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 603: /* predicate ::= expr_or_subquery IS NOT NULL */ +#line 1271 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL)); + } +#line 8205 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 605: /* compare_op ::= NK_LT */ +#line 1283 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_LOWER_THAN; } +#line 8211 "sql.c" + break; + case 606: /* compare_op ::= NK_GT */ +#line 1284 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_GREATER_THAN; } +#line 8216 "sql.c" + break; + case 607: /* compare_op ::= NK_LE */ +#line 1285 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_LOWER_EQUAL; } +#line 8221 "sql.c" + break; + case 608: /* compare_op ::= NK_GE */ +#line 1286 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_GREATER_EQUAL; } +#line 8226 "sql.c" + break; + case 609: /* compare_op ::= NK_NE */ +#line 1287 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_NOT_EQUAL; } +#line 8231 "sql.c" + break; + case 610: /* compare_op ::= NK_EQ */ +#line 1288 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_EQUAL; } +#line 8236 "sql.c" + break; + case 611: /* compare_op ::= LIKE */ +#line 1289 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_LIKE; } +#line 8241 "sql.c" + break; + case 612: /* compare_op ::= NOT LIKE */ +#line 1290 "sql.y" +{ yymsp[-1].minor.yy922 = OP_TYPE_NOT_LIKE; } +#line 8246 "sql.c" + break; + case 613: /* compare_op ::= MATCH */ +#line 1291 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_MATCH; } +#line 8251 "sql.c" + break; + case 614: /* compare_op ::= NMATCH */ +#line 1292 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_NMATCH; } +#line 8256 "sql.c" + break; + case 615: /* compare_op ::= CONTAINS */ +#line 1293 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_JSON_CONTAINS; } +#line 8261 "sql.c" + break; + case 616: /* in_op ::= IN */ +#line 1297 "sql.y" +{ yymsp[0].minor.yy922 = OP_TYPE_IN; } +#line 8266 "sql.c" + break; + case 617: /* in_op ::= NOT IN */ +#line 1298 "sql.y" +{ yymsp[-1].minor.yy922 = OP_TYPE_NOT_IN; } +#line 8271 "sql.c" + break; + case 618: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +#line 1300 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } +#line 8276 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 620: /* boolean_value_expression ::= NOT boolean_primary */ +#line 1304 "sql.y" +{ + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy54), NULL)); + } +#line 8285 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 621: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ +#line 1309 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8295 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 622: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +#line 1315 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + } +#line 8305 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 630: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +#line 1333 "sql.y" +{ yylhsminor.yy54 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, NULL); } +#line 8311 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 633: /* table_primary ::= table_name alias_opt */ +#line 1339 "sql.y" +{ yylhsminor.yy54 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } +#line 8317 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 634: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +#line 1340 "sql.y" +{ yylhsminor.yy54 = createRealTableNode(pCxt, &yymsp[-3].minor.yy837, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } +#line 8323 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 635: /* table_primary ::= subquery alias_opt */ +#line 1341 "sql.y" +{ yylhsminor.yy54 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54), &yymsp[0].minor.yy837); } +#line 8329 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 637: /* alias_opt ::= */ +#line 1346 "sql.y" +{ yymsp[1].minor.yy837 = nil_token; } +#line 8335 "sql.c" + break; + case 639: /* alias_opt ::= AS table_alias */ +#line 1348 "sql.y" +{ yymsp[-1].minor.yy837 = yymsp[0].minor.yy837; } +#line 8340 "sql.c" + break; + case 640: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 641: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==641); +#line 1350 "sql.y" +{ yymsp[-2].minor.yy54 = yymsp[-1].minor.yy54; } +#line 8346 "sql.c" + break; + case 642: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ +#line 1356 "sql.y" +{ + yylhsminor.yy54 = createJoinTableNode(pCxt, yymsp[-6].minor.yy230, yymsp[-5].minor.yy948, yymsp[-7].minor.yy54, yymsp[-3].minor.yy54, yymsp[-2].minor.yy54); + yylhsminor.yy54 = addWindowOffsetClause(pCxt, yylhsminor.yy54, yymsp[-1].minor.yy54); + yylhsminor.yy54 = addJLimitClause(pCxt, yylhsminor.yy54, yymsp[0].minor.yy54); + } +#line 8355 "sql.c" + yymsp[-7].minor.yy54 = yylhsminor.yy54; + break; + case 643: /* join_type ::= */ +#line 1364 "sql.y" +{ yymsp[1].minor.yy230 = JOIN_TYPE_INNER; } +#line 8361 "sql.c" + break; + case 644: /* join_type ::= INNER */ +#line 1365 "sql.y" +{ yymsp[0].minor.yy230 = JOIN_TYPE_INNER; } +#line 8366 "sql.c" + break; + case 645: /* join_type ::= LEFT */ +#line 1366 "sql.y" +{ yymsp[0].minor.yy230 = JOIN_TYPE_LEFT; } +#line 8371 "sql.c" + break; + case 646: /* join_type ::= RIGHT */ +#line 1367 "sql.y" +{ yymsp[0].minor.yy230 = JOIN_TYPE_RIGHT; } +#line 8376 "sql.c" + break; + case 647: /* join_type ::= FULL */ +#line 1368 "sql.y" +{ yymsp[0].minor.yy230 = JOIN_TYPE_FULL; } +#line 8381 "sql.c" + break; + case 648: /* join_subtype ::= */ +#line 1372 "sql.y" +{ yymsp[1].minor.yy948 = JOIN_STYPE_NONE; } +#line 8386 "sql.c" + break; + case 649: /* join_subtype ::= OUTER */ +#line 1373 "sql.y" +{ yymsp[0].minor.yy948 = JOIN_STYPE_OUTER; } +#line 8391 "sql.c" + break; + case 650: /* join_subtype ::= SEMI */ +#line 1374 "sql.y" +{ yymsp[0].minor.yy948 = JOIN_STYPE_SEMI; } +#line 8396 "sql.c" + break; + case 651: /* join_subtype ::= ANTI */ +#line 1375 "sql.y" +{ yymsp[0].minor.yy948 = JOIN_STYPE_ANTI; } +#line 8401 "sql.c" + break; + case 652: /* join_subtype ::= ASOF */ +#line 1376 "sql.y" +{ yymsp[0].minor.yy948 = JOIN_STYPE_ASOF; } +#line 8406 "sql.c" + break; + case 653: /* join_subtype ::= WINDOW */ +#line 1377 "sql.y" +{ yymsp[0].minor.yy948 = JOIN_STYPE_WIN; } +#line 8411 "sql.c" + break; + case 657: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +#line 1384 "sql.y" +{ yymsp[-5].minor.yy54 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 8416 "sql.c" + break; + case 658: /* window_offset_literal ::= NK_VARIABLE */ +#line 1386 "sql.y" +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 8421 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 659: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ +#line 1387 "sql.y" +{ + SToken t = yymsp[-1].minor.yy0; + t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; + yylhsminor.yy54 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + } +#line 8431 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 661: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 732: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==732); + case 736: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==736); +#line 1394 "sql.y" +{ yymsp[-1].minor.yy54 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 8439 "sql.c" + break; + case 662: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ +#line 1400 "sql.y" +{ + yymsp[-13].minor.yy54 = createSelectStmt(pCxt, yymsp[-11].minor.yy325, yymsp[-9].minor.yy652, yymsp[-8].minor.yy54, yymsp[-12].minor.yy652); + yymsp[-13].minor.yy54 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy54, yymsp[-10].minor.yy325); + yymsp[-13].minor.yy54 = addWhereClause(pCxt, yymsp[-13].minor.yy54, yymsp[-7].minor.yy54); + yymsp[-13].minor.yy54 = addPartitionByClause(pCxt, yymsp[-13].minor.yy54, yymsp[-6].minor.yy652); + yymsp[-13].minor.yy54 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy54, yymsp[-2].minor.yy54); + yymsp[-13].minor.yy54 = addGroupByClause(pCxt, yymsp[-13].minor.yy54, yymsp[-1].minor.yy652); + yymsp[-13].minor.yy54 = addHavingClause(pCxt, yymsp[-13].minor.yy54, yymsp[0].minor.yy54); + yymsp[-13].minor.yy54 = addRangeClause(pCxt, yymsp[-13].minor.yy54, yymsp[-5].minor.yy54); + yymsp[-13].minor.yy54 = addEveryClause(pCxt, yymsp[-13].minor.yy54, yymsp[-4].minor.yy54); + yymsp[-13].minor.yy54 = addFillClause(pCxt, yymsp[-13].minor.yy54, yymsp[-3].minor.yy54); + } +#line 8455 "sql.c" + break; + case 663: /* hint_list ::= */ +#line 1415 "sql.y" +{ yymsp[1].minor.yy652 = createHintNodeList(pCxt, NULL); } +#line 8460 "sql.c" + break; + case 664: /* hint_list ::= NK_HINT */ +#line 1416 "sql.y" +{ yylhsminor.yy652 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } +#line 8465 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; + break; + case 669: /* set_quantifier_opt ::= ALL */ +#line 1427 "sql.y" +{ yymsp[0].minor.yy325 = false; } +#line 8471 "sql.c" + break; + case 672: /* select_item ::= NK_STAR */ +#line 1434 "sql.y" +{ yylhsminor.yy54 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } +#line 8476 "sql.c" + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 674: /* select_item ::= common_expression column_alias */ + case 684: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==684); +#line 1436 "sql.y" +{ yylhsminor.yy54 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54), &yymsp[0].minor.yy837); } +#line 8483 "sql.c" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 675: /* select_item ::= common_expression AS column_alias */ + case 685: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==685); +#line 1437 "sql.y" +{ yylhsminor.yy54 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), &yymsp[0].minor.yy837); } +#line 8490 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 680: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 710: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==710); + case 730: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==730); +#line 1446 "sql.y" +{ yymsp[-2].minor.yy652 = yymsp[0].minor.yy652; } +#line 8498 "sql.c" + break; + case 687: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +#line 1459 "sql.y" +{ yymsp[-5].minor.yy54 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 8503 "sql.c" + break; + case 688: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1460 "sql.y" +{ yymsp[-3].minor.yy54 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 8508 "sql.c" + break; + case 689: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1462 "sql.y" +{ yymsp[-5].minor.yy54 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 8513 "sql.c" + break; + case 690: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1466 "sql.y" +{ yymsp[-7].minor.yy54 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } +#line 8518 "sql.c" + break; + case 691: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +#line 1468 "sql.y" +{ yymsp[-6].minor.yy54 = createEventWindowNode(pCxt, yymsp[-3].minor.yy54, yymsp[0].minor.yy54); } +#line 8523 "sql.c" + break; + case 692: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +#line 1470 "sql.y" +{ yymsp[-3].minor.yy54 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } +#line 8528 "sql.c" + break; + case 693: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 1472 "sql.y" +{ yymsp[-5].minor.yy54 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } +#line 8533 "sql.c" + break; + case 700: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +#line 1482 "sql.y" +{ yymsp[-3].minor.yy54 = createFillNode(pCxt, yymsp[-1].minor.yy478, NULL); } +#line 8538 "sql.c" + break; + case 701: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +#line 1483 "sql.y" +{ yymsp[-5].minor.yy54 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } +#line 8543 "sql.c" + break; + case 702: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +#line 1484 "sql.y" +{ yymsp[-5].minor.yy54 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } +#line 8548 "sql.c" + break; + case 703: /* fill_mode ::= NONE */ +#line 1488 "sql.y" +{ yymsp[0].minor.yy478 = FILL_MODE_NONE; } +#line 8553 "sql.c" + break; + case 704: /* fill_mode ::= PREV */ +#line 1489 "sql.y" +{ yymsp[0].minor.yy478 = FILL_MODE_PREV; } +#line 8558 "sql.c" + break; + case 705: /* fill_mode ::= NULL */ +#line 1490 "sql.y" +{ yymsp[0].minor.yy478 = FILL_MODE_NULL; } +#line 8563 "sql.c" + break; + case 706: /* fill_mode ::= NULL_F */ +#line 1491 "sql.y" +{ yymsp[0].minor.yy478 = FILL_MODE_NULL_F; } +#line 8568 "sql.c" + break; + case 707: /* fill_mode ::= LINEAR */ +#line 1492 "sql.y" +{ yymsp[0].minor.yy478 = FILL_MODE_LINEAR; } +#line 8573 "sql.c" + break; + case 708: /* fill_mode ::= NEXT */ +#line 1493 "sql.y" +{ yymsp[0].minor.yy478 = FILL_MODE_NEXT; } +#line 8578 "sql.c" + break; + case 711: /* group_by_list ::= expr_or_subquery */ +#line 1502 "sql.y" +{ yylhsminor.yy652 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } +#line 8583 "sql.c" + yymsp[0].minor.yy652 = yylhsminor.yy652; + break; + case 712: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +#line 1503 "sql.y" +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } +#line 8589 "sql.c" + yymsp[-2].minor.yy652 = yylhsminor.yy652; + break; + case 716: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +#line 1510 "sql.y" +{ yymsp[-5].minor.yy54 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 8595 "sql.c" + break; + case 717: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +#line 1512 "sql.y" +{ yymsp[-3].minor.yy54 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } +#line 8600 "sql.c" + break; + case 720: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ +#line 1519 "sql.y" +{ + yylhsminor.yy54 = addOrderByClause(pCxt, yymsp[-3].minor.yy54, yymsp[-2].minor.yy652); + yylhsminor.yy54 = addSlimitClause(pCxt, yylhsminor.yy54, yymsp[-1].minor.yy54); + yylhsminor.yy54 = addLimitClause(pCxt, yylhsminor.yy54, yymsp[0].minor.yy54); + } +#line 8609 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 723: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +#line 1529 "sql.y" +{ yylhsminor.yy54 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy54, yymsp[0].minor.yy54); } +#line 8615 "sql.c" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 724: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +#line 1531 "sql.y" +{ yylhsminor.yy54 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy54, yymsp[0].minor.yy54); } +#line 8621 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 733: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 737: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==737); +#line 1546 "sql.y" +{ yymsp[-3].minor.yy54 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +#line 8628 "sql.c" + break; + case 734: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 738: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==738); +#line 1547 "sql.y" +{ yymsp[-3].minor.yy54 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +#line 8634 "sql.c" + break; + case 739: /* subquery ::= NK_LP query_expression NK_RP */ +#line 1555 "sql.y" +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy54); } +#line 8639 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 744: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +#line 1569 "sql.y" +{ yylhsminor.yy54 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), yymsp[-1].minor.yy760, yymsp[0].minor.yy503); } +#line 8645 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 745: /* ordering_specification_opt ::= */ +#line 1573 "sql.y" +{ yymsp[1].minor.yy760 = ORDER_ASC; } +#line 8651 "sql.c" + break; + case 746: /* ordering_specification_opt ::= ASC */ +#line 1574 "sql.y" +{ yymsp[0].minor.yy760 = ORDER_ASC; } +#line 8656 "sql.c" + break; + case 747: /* ordering_specification_opt ::= DESC */ +#line 1575 "sql.y" +{ yymsp[0].minor.yy760 = ORDER_DESC; } +#line 8661 "sql.c" + break; + case 748: /* null_ordering_opt ::= */ +#line 1579 "sql.y" +{ yymsp[1].minor.yy503 = NULL_ORDER_DEFAULT; } +#line 8666 "sql.c" + break; + case 749: /* null_ordering_opt ::= NULLS FIRST */ +#line 1580 "sql.y" +{ yymsp[-1].minor.yy503 = NULL_ORDER_FIRST; } +#line 8671 "sql.c" + break; + case 750: /* null_ordering_opt ::= NULLS LAST */ +#line 1581 "sql.y" +{ yymsp[-1].minor.yy503 = NULL_ORDER_LAST; } +#line 8676 "sql.c" + break; + case 753: /* column_options ::= column_options ENCODE NK_STRING */ +#line 1589 "sql.y" +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } +#line 8681 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 754: /* column_options ::= column_options COMPRESS NK_STRING */ +#line 1590 "sql.y" +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } +#line 8687 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 755: /* column_options ::= column_options LEVEL NK_STRING */ +#line 1591 "sql.y" +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } +#line 8693 "sql.c" + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; default: break; @@ -7686,6 +8753,7 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ +#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -7696,6 +8764,7 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } +#line 8767 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 21bb6886b1..31b9ba303e 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -92,7 +92,6 @@ int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *re QW_RET(TSDB_CODE_SUCCESS); } - int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { qTaskInfo_t taskHandle = ctx->taskHandle; @@ -201,7 +200,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { } else { QW_TASK_DLOG("dyn task qExecTask done, useconds:%" PRIu64, useconds); } - + ctx->queryExecDone = true; } @@ -251,7 +250,6 @@ bool qwTaskNotInExec(SQWTaskCtx *ctx) { return false; } - int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) { int32_t taskNum = 0; @@ -340,7 +338,7 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, if (!ctx->dynamicTask) { qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask); } - + if (NULL == pRsp) { QW_ERR_RET(qwMallocFetchRsp(!ctx->localExec, len, &pRsp)); *pOutput = output; @@ -367,8 +365,8 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, // set the serialize start position output.pData = pRsp->data + *dataLen - (len + PAYLOAD_PREFIX_LEN); - ((int32_t*) output.pData)[0] = len; - ((int32_t*) output.pData)[1] = rawLen; + ((int32_t *)output.pData)[0] = len; + ((int32_t *)output.pData)[1] = rawLen; output.pData += sizeof(int32_t) * 2; taosEnableMemoryPoolUsage(gQueryPoolHandle, ctx->memPoolSession); @@ -463,8 +461,7 @@ int32_t qwGetDeleteResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SDeleteRes *pRes return TSDB_CODE_SUCCESS; } - -int32_t qwQuickRspFetchReq(QW_FPARAMS_DEF, SQWTaskCtx * ctx, SQWMsg *qwMsg, int32_t code) { +int32_t qwQuickRspFetchReq(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SQWMsg *qwMsg, int32_t code) { if (QUERY_RSP_POLICY_QUICK == tsQueryRspPolicy && ctx != NULL) { if (QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) { void *rsp = NULL; @@ -490,13 +487,13 @@ int32_t qwQuickRspFetchReq(QW_FPARAMS_DEF, SQWTaskCtx * ctx, SQWMsg *qwMsg, i qwMsg->connInfo = ctx->dataConnInfo; QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_FETCH); - + qwBuildAndSendFetchRsp(ctx->fetchMsgType + 1, &qwMsg->connInfo, rsp, dataLen, code); rsp = NULL; - + QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), dataLen); - } + } } return TSDB_CODE_SUCCESS; @@ -511,7 +508,7 @@ int32_t qwStartDynamicTaskNewExec(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SQWMsg *qwMsg if (!atomic_val_compare_exchange_8((int8_t*)&ctx->queryEnd, true, false)) { QW_TASK_ELOG("dynamic task prev exec not finished, queryEnd:%d", ctx->queryEnd); return TSDB_CODE_ACTION_IN_PROGRESS; - } + } #else ctx->queryExecDone = false; ctx->queryEnd = false; @@ -519,7 +516,7 @@ int32_t qwStartDynamicTaskNewExec(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SQWMsg *qwMsg taosEnableMemoryPoolUsage(gQueryPoolHandle, ctx->memPoolSession); dsReset(ctx->sinkHandle); - taosDisableMemoryPoolUsage() ; + taosDisableMemoryPoolUsage(); qUpdateOperatorParam(ctx->taskHandle, qwMsg->msg); @@ -537,7 +534,6 @@ int32_t qwStartDynamicTaskNewExec(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SQWMsg *qwMsg return TSDB_CODE_SUCCESS; } - int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *input, SQWPhaseOutput *output) { int32_t code = 0; SQWTaskCtx *ctx = NULL; @@ -805,7 +801,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) { ctx->queryExecDone = true; ctx->queryEnd = true; } - + _return: taosMemoryFree(sql); @@ -842,7 +838,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { if (!queryStop) { QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, &queryStop)); } - + if (QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) { SOutputData sOutput = {0}; QW_ERR_JRET(qwGetQueryResFromSink(QW_FPARAMS(), ctx, &dataLen, &rawLen, &rsp, &sOutput)); @@ -911,9 +907,9 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { } int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) { - int32_t code = 0; - int32_t dataLen = 0; - int32_t rawDataLen = 0; + int32_t code = 0; + int32_t dataLen = 0; + int32_t rawDataLen = 0; bool locked = false; SQWTaskCtx *ctx = NULL; @@ -995,8 +991,8 @@ _return: qwFreeFetchRsp(rsp); rsp = NULL; } - } else { - //qwQuickRspFetchReq(QW_FPARAMS(), ctx, qwMsg, code); + } else { + // qwQuickRspFetchReq(QW_FPARAMS(), ctx, qwMsg, code); } QW_RET(TSDB_CODE_SUCCESS); @@ -1038,6 +1034,8 @@ _return: if (ctx) { QW_UPDATE_RSP_CODE(ctx, code); qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); + } else { + tmsgReleaseHandle(&qwMsg->connInfo, TAOS_CONN_SERVER); } } @@ -1046,6 +1044,10 @@ _return: } if (ctx) { + if (qwMsg->connInfo.handle != ctx->ctrlConnInfo.handle) { + tmsgReleaseHandle(&qwMsg->connInfo, TAOS_CONN_SERVER); + } + qwReleaseTaskCtx(mgmt, ctx); } @@ -1073,7 +1075,7 @@ int32_t qwProcessNotify(QW_FPARAMS_DEF, SQWMsg *qwMsg) { if (ctx->explain && !ctx->explainRsped) { QW_ERR_RET(qwSendExplainResponse(QW_FPARAMS(), ctx)); } - break; + break; default: QW_ELOG("Invalid task notify type %d", qwMsg->msgType); QW_ERR_JRET(TSDB_CODE_INVALID_MSG); @@ -1100,7 +1102,6 @@ _return: QW_RET(TSDB_CODE_SUCCESS); } - int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { int32_t code = 0; SSchedulerHbRsp rsp = {0}; diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 48bedde91a..282e935dd8 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1095,24 +1095,45 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * char fraction[20] = {0}; bool hasFraction = false; NUM_TO_STRING(type, input, sizeof(fraction), fraction); - int32_t tsDigits = (int32_t)strlen(fraction); + int32_t fractionLen; char buf[64] = {0}; int64_t timeVal; + char* format = NULL; + int64_t quot = 0; + long mod = 0; + GET_TYPED_DATA(timeVal, int64_t, type, input); - if (tsDigits > TSDB_TIME_PRECISION_SEC_DIGITS) { - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - timeVal = timeVal / 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal / ((int64_t)(1000 * 1000)); - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / ((int64_t)(1000 * 1000 * 1000)); - } else { + + switch (pInput->columnData[0].info.precision) { + case TSDB_TIME_PRECISION_MILLI: { + quot = timeVal / 1000; + fractionLen = 5; + format = ".%03" PRId64; + mod = timeVal % 1000; + break; + } + + case TSDB_TIME_PRECISION_MICRO: { + quot = timeVal / 1000000; + fractionLen = 8; + format = ".%06" PRId64; + mod = timeVal % 1000000; + break; + } + + case TSDB_TIME_PRECISION_NANO: { + quot = timeVal / 1000000000; + fractionLen = 11; + format = ".%09" PRId64; + mod = timeVal % 1000000000; + break; + } + + default: { colDataSetNULL(pOutput->columnData, i); continue; } - hasFraction = true; - memmove(fraction, fraction + TSDB_TIME_PRECISION_SEC_DIGITS, TSDB_TIME_PRECISION_SEC_DIGITS); } // trans current timezone's unix ts to dest timezone @@ -1122,18 +1143,19 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * if (0 != offsetOfTimezone(tz, &offset)) { goto _end; } - timeVal -= offset + 3600 * ((int64_t)tsTimezone); + quot -= offset + 3600 * ((int64_t)tsTimezone); struct tm tmInfo; int32_t len = 0; - if (taosLocalTime((const time_t *)&timeVal, &tmInfo, buf) == NULL) { + if (taosLocalTime((const time_t *)", &tmInfo, buf) == NULL) { len = (int32_t)strlen(buf); goto _end; } - strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", &tmInfo); - len = (int32_t)strlen(buf); + len = (int32_t)strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", &tmInfo); + + len += snprintf(buf + len, fractionLen, format, mod); // add timezone string if (tzLen > 0) { @@ -1141,32 +1163,6 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * len += tzLen; } - if (hasFraction) { - int32_t fracLen = (int32_t)strlen(fraction) + 1; - - char *tzInfo; - if (buf[len - 1] == 'z' || buf[len - 1] == 'Z') { - tzInfo = &buf[len - 1]; - memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo)); - } else { - tzInfo = strchr(buf, '+'); - if (tzInfo) { - memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo)); - } else { - // search '-' backwards - tzInfo = strrchr(buf, '-'); - if (tzInfo) { - memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo)); - } - } - } - - char tmp[32] = {0}; - sprintf(tmp, ".%s", fraction); - memcpy(tzInfo, tmp, fracLen); - len += fracLen; - } - _end: memmove(buf + VARSTR_HEADER_SIZE, buf, len); varDataSetLen(buf, len); @@ -1347,9 +1343,6 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara GET_TYPED_DATA(timePrec, int64_t, GET_PARAM_TYPE(&pInput[timePrecIdx]), pInput[timePrecIdx].columnData->pData); memcpy(timezone, varDataVal(pInput[timeZoneIdx].columnData->pData), varDataLen(pInput[timeZoneIdx].columnData->pData)); - int64_t factor = TSDB_TICK_PER_SECOND(timePrec); - int64_t unit = timeUnit * 1000 / factor; - for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { if (colDataIsNull_s(pInput[0].columnData, i)) { colDataSetNULL(pOutput->columnData, i); @@ -1359,201 +1352,27 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara char *input = colDataGetData(pInput[0].columnData, i); if (IS_VAR_DATA_TYPE(type)) { /* datetime format strings */ - int32_t ret = convertStringToTimestamp(type, input, TSDB_TIME_PRECISION_NANO, &timeVal); + int32_t ret = convertStringToTimestamp(type, input, timePrec, &timeVal); if (ret != TSDB_CODE_SUCCESS) { colDataSetNULL(pOutput->columnData, i); continue; } - // If converted value is less than 10digits in second, use value in second instead - int64_t timeValSec = timeVal / 1000000000; - if (timeValSec < 1000000000) { - timeVal = timeValSec; - } } else if (type == TSDB_DATA_TYPE_BIGINT) { /* unix timestamp */ GET_TYPED_DATA(timeVal, int64_t, type, input); } else if (type == TSDB_DATA_TYPE_TIMESTAMP) { /* timestamp column*/ GET_TYPED_DATA(timeVal, int64_t, type, input); - int64_t timeValSec = timeVal / factor; - if (timeValSec < 1000000000) { - timeVal = timeValSec; - } } char buf[20] = {0}; NUM_TO_STRING(TSDB_DATA_TYPE_BIGINT, &timeVal, sizeof(buf), buf); - int32_t tsDigits = (int32_t)strlen(buf); - switch (unit) { - case 0: { /* 1u or 1b */ - if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - if (timePrec == TSDB_TIME_PRECISION_NANO && timeUnit == 1) { - timeVal = timeVal * 1; - } else { - timeVal = timeVal / 1000 * 1000; - } - } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { - timeVal = timeVal * factor; - } else { - timeVal = timeVal * 1; - } - break; - } - case 1: { /* 1a */ - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - timeVal = timeVal * 1; - } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal / 1000 * 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / 1000000 * 1000000; - } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { - timeVal = timeVal * factor; - } else { - colDataSetNULL(pOutput->columnData, i); - continue; - } - break; - } - case 1000: { /* 1s */ - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - timeVal = timeVal / 1000 * 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal / 1000000 * 1000000; - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / 1000000000 * 1000000000; - } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { - timeVal = timeVal * factor; - } else { - colDataSetNULL(pOutput->columnData, i); - continue; - } - break; - } - case 60000: { /* 1m */ - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - timeVal = timeVal / 1000 / 60 * 60 * 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal / 1000000 / 60 * 60 * 1000000; - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / 1000000000 / 60 * 60 * 1000000000; - } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { - timeVal = timeVal * factor / factor / 60 * 60 * factor; - } else { - colDataSetNULL(pOutput->columnData, i); - continue; - } - break; - } - case 3600000: { /* 1h */ - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - timeVal = timeVal / 1000 / 3600 * 3600 * 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal / 1000000 / 3600 * 3600 * 1000000; - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / 1000000000 / 3600 * 3600 * 1000000000; - } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { - timeVal = timeVal * factor / factor / 3600 * 3600 * factor; - } else { - colDataSetNULL(pOutput->columnData, i); - continue; - } - break; - } - case 86400000: { /* 1d */ - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000)) % (((int64_t)86400) * 1000); - } else { - timeVal = timeVal / 1000 / 86400 * 86400 * 1000; - } - } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000)) % (((int64_t)86400) * 1000000); - } else { - timeVal = timeVal / 1000000 / 86400 * 86400 * 1000000; - } - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000000)) % (((int64_t)86400) * 1000000000); - } else { - timeVal = timeVal / 1000000000 / 86400 * 86400 * 1000000000; - } - } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { - if (ignoreTz) { - timeVal = (timeVal - (timeVal + offsetFromTz(timezone, 1)) % (86400L)) * factor; - } else { - timeVal = timeVal * factor / factor / 86400 * 86400 * factor; - } - } else { - colDataSetNULL(pOutput->columnData, i); - continue; - } - break; - } - case 604800000: { /* 1w */ - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000)) % (((int64_t)604800) * 1000); - } else { - timeVal = timeVal / 1000 / 604800 * 604800 * 1000; - } - } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000)) % (((int64_t)604800) * 1000000); - } else { - timeVal = timeVal / 1000000 / 604800 * 604800 * 1000000; - } - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000000)) % (((int64_t)604800) * 1000000000); - } else { - timeVal = timeVal / 1000000000 / 604800 * 604800 * 1000000000; - } - } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { - if (ignoreTz) { - timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1)) % (((int64_t)604800L) * factor); - } else { - timeVal = timeVal * factor / factor / 604800 * 604800 * factor; - } - } else { - colDataSetNULL(pOutput->columnData, i); - continue; - } - break; - } - default: { - timeVal = timeVal * 1; - break; - } + // truncate the timestamp to time_unit precision + int64_t seconds = timeUnit / TSDB_TICK_PER_SECOND(timePrec); + if (ignoreTz && (seconds == 604800 || seconds == 86400)) { + timeVal = timeVal - (timeVal + offsetFromTz(timezone, TSDB_TICK_PER_SECOND(timePrec))) % timeUnit; + } else { + timeVal = timeVal / timeUnit * timeUnit; } - - // truncate the timestamp to db precision - switch (timePrec) { - case TSDB_TIME_PRECISION_MILLI: { - if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal / 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / 1000000; - } - break; - } - case TSDB_TIME_PRECISION_MICRO: { - if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal = timeVal / 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - timeVal = timeVal * 1000; - } - break; - } - case TSDB_TIME_PRECISION_NANO: { - if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { - timeVal = timeVal * 1000; - } else if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { - timeVal = timeVal * 1000000; - } - break; - } - } - colDataSetVal(pOutput->columnData, i, (char *)&timeVal, false); } diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index 08d0a5e486..4741745419 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -55,10 +55,10 @@ struct SActiveCheckpointInfo { int64_t activeId; // current active checkpoint id int64_t failedId; bool dispatchTrigger; - SArray* pDispatchTriggerList; // SArray - SArray* pReadyMsgList; // SArray + SArray* pDispatchTriggerList; // SArray + SArray* pReadyMsgList; // SArray int8_t allUpstreamTriggerRecv; - SArray* pCheckpointReadyRecvList; // SArray + SArray* pCheckpointReadyRecvList; // SArray int32_t checkCounter; tmr_h pChkptTriggerTmr; int32_t sendReadyCheckCounter; @@ -100,7 +100,7 @@ typedef struct { int32_t upstreamNodeId; int32_t transId; int32_t childId; - SRpcMsg msg; // for mnode checkpoint-source rsp + SRpcMsg msg; // for mnode checkpoint-source rsp int64_t checkpointId; int64_t recvTs; int32_t sendCompleted; diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index c151193284..06773c79e3 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -140,7 +140,7 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest); int32_t valueToString(void* k, char* buf); int32_t valueIsStale(void* k, int64_t ts); -void destroyCompare(void* arg); +void destroyCompare(void* arg); static void cleanDir(const char* pPath, const char* id); static bool streamStateIterSeekAndValid(rocksdb_iterator_t* iter, char* buf, size_t len); @@ -194,9 +194,7 @@ int32_t getCfIdx(const char* cfName) { return idx; } -bool isValidCheckpoint(const char* dir) { - return true; -} +bool isValidCheckpoint(const char* dir) { return true; } int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) { // impl later @@ -486,9 +484,7 @@ _ERROR: return code; } -int32_t backendCopyFiles(const char* src, const char* dst) { - return backendFileCopyFilesImpl(src, dst); -} +int32_t backendCopyFiles(const char* src, const char* dst) { return backendFileCopyFilesImpl(src, dst); } static int32_t rebuildFromLocalCheckpoint(const char* pTaskIdStr, const char* checkpointPath, int64_t checkpointId, const char* defaultPath) { @@ -540,7 +536,8 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId char* chkptPath = taosMemoryCalloc(1, pathLen); if (chkptId > 0) { - snprintf(chkptPath, pathLen, "%s%s%s%s%s%" PRId64 "", prefixPath, TD_DIRSEP, "checkpoints", TD_DIRSEP, "checkpoint", chkptId); + snprintf(chkptPath, pathLen, "%s%s%s%s%s%" PRId64 "", prefixPath, TD_DIRSEP, "checkpoints", TD_DIRSEP, "checkpoint", + chkptId); code = rebuildFromLocalCheckpoint(key, chkptPath, chkptId, defaultPath); if (code != 0) { @@ -549,11 +546,12 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId if (code != 0) { stError("failed to start stream backend at %s, reason: %s, restart from default defaultPath:%s", chkptPath, - tstrerror(code), defaultPath); - code = 0; // reset the error code + tstrerror(code), defaultPath); + code = 0; // reset the error code } } else { // no valid checkpoint id - stInfo("%s no valid checkpoint ever generated, no need to copy checkpoint data, clean defaultPath:%s", key, defaultPath); + stInfo("%s no valid checkpoint ever generated, no need to copy checkpoint data, clean defaultPath:%s", key, + defaultPath); cleanDir(defaultPath, key); } @@ -2143,13 +2141,18 @@ void taskDbDestroy(void* pDb, bool flush) { rocksdb_flushoptions_destroy(flushOpt); } } - for (int i = 0; i < nCf; i++) { - if (wrapper->pCf[i] != NULL) { - rocksdb_column_family_handle_destroy(wrapper->pCf[i]); + + if (wrapper->pCf != NULL) { + for (int i = 0; i < nCf; i++) { + if (wrapper->pCf[i] != NULL) { + rocksdb_column_family_handle_destroy(wrapper->pCf[i]); + } } } - if (wrapper->db) rocksdb_close(wrapper->db); + if (wrapper->db) { + rocksdb_close(wrapper->db); + } rocksdb_options_destroy(wrapper->dbOpt); rocksdb_readoptions_destroy(wrapper->readOpt); @@ -2205,7 +2208,8 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char return code; } -int32_t taskDbGenChkpUploadData__s3(STaskDbWrapper* pDb, void* bkdChkpMgt, int64_t chkpId, char** path, SArray* list, const char* idStr) { +int32_t taskDbGenChkpUploadData__s3(STaskDbWrapper* pDb, void* bkdChkpMgt, int64_t chkpId, char** path, SArray* list, + const char* idStr) { int32_t code = 0; SBkdMgt* p = (SBkdMgt*)bkdChkpMgt; @@ -2224,7 +2228,8 @@ int32_t taskDbGenChkpUploadData__s3(STaskDbWrapper* pDb, void* bkdChkpMgt, int64 return code; } -int32_t taskDbGenChkpUploadData(void* arg, void* mgt, int64_t chkpId, int8_t type, char** path, SArray* list, const char* idStr) { +int32_t taskDbGenChkpUploadData(void* arg, void* mgt, int64_t chkpId, int8_t type, char** path, SArray* list, + const char* idStr) { int32_t code = -1; STaskDbWrapper* pDb = arg; ECHECKPOINT_BACKUP_TYPE utype = type; @@ -3422,7 +3427,7 @@ SStreamStateCur* streamStateFillSeekKeyNext_rocksdb(SStreamState* pState, const size_t kLen = 0; char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); winKeyDecode((void*)&curKey, keyStr); - if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) > 0) { + if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) < 0) { return pCur; } rocksdb_iter_next(pCur->iter); @@ -3459,7 +3464,7 @@ SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const size_t kLen = 0; char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); winKeyDecode((void*)&curKey, keyStr); - if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) < 0) { + if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) > 0) { return pCur; } rocksdb_iter_prev(pCur->iter); diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c index 1728147c11..8778e3314a 100644 --- a/source/libs/stream/src/streamCheckStatus.c +++ b/source/libs/stream/src/streamCheckStatus.c @@ -58,7 +58,8 @@ int32_t streamTaskCheckStatus(SStreamTask* pTask, int32_t upstreamTaskId, int32_ } if (pInfo->stage < stage) { - stError("s-task:%s receive check msg from upstream task:0x%x(vgId:%d), new stage received:%" PRId64 ", prev:%" PRId64, + stError("s-task:%s receive check msg from upstream task:0x%x(vgId:%d), new stage received:%" PRId64 + ", prev:%" PRId64, id, upstreamTaskId, vgId, stage, pInfo->stage); // record the checkpoint failure id and sent to mnode taosThreadMutexLock(&pTask->lock); @@ -70,7 +71,6 @@ int32_t streamTaskCheckStatus(SStreamTask* pTask, int32_t upstreamTaskId, int32_ } if (pInfo->stage != stage) { - taosThreadMutexLock(&pTask->lock); ETaskStatus status = streamTaskGetStatus(pTask)->state; if (status == TASK_STATUS__CK) { @@ -168,7 +168,8 @@ void streamTaskProcessCheckMsg(SStreamMeta* pMeta, SStreamTaskCheckReq* pReq, SS } else { SStreamTask* pTask = streamMetaAcquireTask(pMeta, pReq->streamId, taskId); if (pTask != NULL) { - pRsp->status = streamTaskCheckStatus(pTask, pReq->upstreamTaskId, pReq->upstreamNodeId, pReq->stage, &pRsp->oldStage); + pRsp->status = + streamTaskCheckStatus(pTask, pReq->upstreamTaskId, pReq->upstreamNodeId, pReq->stage, &pRsp->oldStage); SStreamTaskState* pState = streamTaskGetStatus(pTask); stDebug("s-task:%s status:%s, stage:%" PRId64 " recv task check req(reqId:0x%" PRIx64 @@ -183,7 +184,6 @@ void streamTaskProcessCheckMsg(SStreamMeta* pMeta, SStreamTaskCheckReq* pReq, SS pReq->streamId, taskId, pRsp->reqId, pRsp->upstreamTaskId, pRsp->upstreamNodeId, pRsp->status); } } - } int32_t streamTaskProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp) { @@ -402,7 +402,8 @@ int32_t streamTaskUpdateCheckInfo(STaskCheckInfo* pInfo, int32_t taskId, int32_t SDownstreamStatusInfo* p = findCheckRspStatus(pInfo, taskId); if (p != NULL) { if (reqId != p->reqId) { - stError("s-task:%s reqId:0x%" PRIx64 " expected:0x%" PRIx64 " expired check-rsp recv from downstream task:0x%x, discarded", + stError("s-task:%s reqId:0x%" PRIx64 " expected:0x%" PRIx64 + " expired check-rsp recv from downstream task:0x%x, discarded", id, reqId, p->reqId, taskId); taosThreadMutexUnlock(&pInfo->checkInfoLock); return TSDB_CODE_FAILED; @@ -435,7 +436,7 @@ int32_t streamTaskStartCheckDownstream(STaskCheckInfo* pInfo, const char* id) { ASSERT(pInfo->startTs > 0); stError("s-task:%s already in check procedure, checkTs:%" PRId64 ", start monitor check rsp failed", id, pInfo->startTs); - pInfo->stopCheckProcess = 0; // disable auto stop of check process + pInfo->stopCheckProcess = 0; // disable auto stop of check process return TSDB_CODE_FAILED; } @@ -509,8 +510,8 @@ void doSendCheckMsg(SStreamTask* pTask, SDownstreamStatusInfo* p) { STaskDispatcherFixed* pDispatch = &pOutputInfo->fixedDispatcher; setCheckDownstreamReqInfo(&req, p->reqId, pDispatch->taskId, pDispatch->nodeId); - stDebug("s-task:%s (vgId:%d) stage:%" PRId64 " re-send check downstream task:0x%x(vgId:%d) reqId:0x%" PRIx64, - id, pTask->info.nodeId, req.stage, req.downstreamTaskId, req.downstreamNodeId, req.reqId); + stDebug("s-task:%s (vgId:%d) stage:%" PRId64 " re-send check downstream task:0x%x(vgId:%d) reqId:0x%" PRIx64, id, + pTask->info.nodeId, req.stage, req.downstreamTaskId, req.downstreamNodeId, req.reqId); streamSendCheckMsg(pTask, &req, pOutputInfo->fixedDispatcher.nodeId, &pOutputInfo->fixedDispatcher.epSet); } else if (pOutputInfo->type == TASK_OUTPUT__SHUFFLE_DISPATCH) { @@ -760,4 +761,3 @@ void rspMonitorFn(void* param, void* tmrId) { taosArrayDestroy(pNotReadyList); taosArrayDestroy(pTimeoutList); } - diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index e4729bee7d..78bd5c4511 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -24,14 +24,13 @@ static int32_t streamTaskUploadCheckpoint(const char* id, const char* path); static int32_t deleteCheckpoint(const char* id); static int32_t downloadCheckpointByNameS3(const char* id, const char* fname, const char* dstName); static int32_t continueDispatchCheckpointTriggerBlock(SStreamDataBlock* pBlock, SStreamTask* pTask); -static int32_t appendCheckpointIntoInputQ(SStreamTask* pTask, int32_t checkpointType, int64_t checkpointId, int32_t transId); +static int32_t appendCheckpointIntoInputQ(SStreamTask* pTask, int32_t checkpointType, int64_t checkpointId, + int32_t transId, int32_t srcTaskId); static int32_t doSendRetrieveTriggerMsg(SStreamTask* pTask, SArray* pNotSendList); static void checkpointTriggerMonitorFn(void* param, void* tmrId); -static SStreamDataBlock* createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpointType, int64_t checkpointId, int32_t transId); - SStreamDataBlock* createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpointType, int64_t checkpointId, - int32_t transId) { + int32_t transId, int32_t srcTaskId) { SStreamDataBlock* pChkpoint = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, sizeof(SSDataBlock)); if (pChkpoint == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -39,6 +38,10 @@ SStreamDataBlock* createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpoint } pChkpoint->type = checkpointType; + if (checkpointType == STREAM_INPUT__CHECKPOINT_TRIGGER && (pTask->info.taskLevel != TASK_LEVEL__SOURCE)) { + pChkpoint->srcTaskId = srcTaskId; + ASSERT(srcTaskId != 0); + } SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); if (pBlock == NULL) { @@ -62,8 +65,9 @@ SStreamDataBlock* createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpoint return pChkpoint; } -int32_t appendCheckpointIntoInputQ(SStreamTask* pTask, int32_t checkpointType, int64_t checkpointId, int32_t transId) { - SStreamDataBlock* pCheckpoint = createChkptTriggerBlock(pTask, checkpointType, checkpointId, transId); +int32_t appendCheckpointIntoInputQ(SStreamTask* pTask, int32_t checkpointType, int64_t checkpointId, int32_t transId, + int32_t srcTaskId) { + SStreamDataBlock* pCheckpoint = createChkptTriggerBlock(pTask, checkpointType, checkpointId, transId, srcTaskId); if (streamTaskPutDataIntoInputQ(pTask, (SStreamQueueItem*)pCheckpoint) < 0) { return TSDB_CODE_OUT_OF_MEMORY; @@ -88,7 +92,7 @@ int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSo // 2. Put the checkpoint block into inputQ, to make sure all blocks with less version have been handled by this task // and this is the last item in the inputQ. - return appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER, pReq->checkpointId, pReq->transId); + return appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER, pReq->checkpointId, pReq->transId, -1); } int32_t streamTaskProcessCheckpointTriggerRsp(SStreamTask* pTask, SCheckpointTriggerRsp* pRsp) { @@ -96,19 +100,20 @@ int32_t streamTaskProcessCheckpointTriggerRsp(SStreamTask* pTask, SCheckpointTri if (pRsp->rspCode != TSDB_CODE_SUCCESS) { stDebug("s-task:%s retrieve checkpoint-trgger rsp from upstream:0x%x invalid, code:%s", pTask->id.idStr, - pRsp->upstreamTaskId, tstrerror(pRsp->rspCode)); + pRsp->upstreamTaskId, tstrerror(pRsp->rspCode)); return TSDB_CODE_SUCCESS; } - appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER, pRsp->checkpointId, pRsp->transId); + appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER, pRsp->checkpointId, pRsp->transId, + pRsp->upstreamTaskId); return TSDB_CODE_SUCCESS; } int32_t streamTaskSendCheckpointTriggerMsg(SStreamTask* pTask, int32_t dstTaskId, int32_t downstreamNodeId, SRpcHandleInfo* pRpcInfo, int32_t code) { int32_t size = sizeof(SMsgHead) + sizeof(SCheckpointTriggerRsp); + void* pBuf = rpcMallocCont(size); - void* pBuf = rpcMallocCont(size); SCheckpointTriggerRsp* pRsp = POINTER_SHIFT(pBuf, sizeof(SMsgHead)); ((SMsgHead*)pBuf)->vgId = htonl(downstreamNodeId); @@ -116,6 +121,7 @@ int32_t streamTaskSendCheckpointTriggerMsg(SStreamTask* pTask, int32_t dstTaskId pRsp->streamId = pTask->id.streamId; pRsp->upstreamTaskId = pTask->id.taskId; pRsp->taskId = dstTaskId; + pRsp->rspCode = code; if (code == TSDB_CODE_SUCCESS) { pRsp->checkpointId = pTask->chkInfo.pActiveInfo->activeId; @@ -125,9 +131,7 @@ int32_t streamTaskSendCheckpointTriggerMsg(SStreamTask* pTask, int32_t dstTaskId pRsp->transId = -1; } - pRsp->rspCode = code; - - SRpcMsg rspMsg = {.code = 0, .pCont = pRsp, .contLen = size, .info = *pRpcInfo}; + SRpcMsg rspMsg = {.code = 0, .pCont = pBuf, .contLen = size, .info = *pRpcInfo}; tmsgSendRsp(&rspMsg); return 0; } @@ -162,15 +166,15 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock taosThreadMutexLock(&pTask->lock); if (pTask->chkInfo.checkpointId > checkpointId) { stError("s-task:%s vgId:%d current checkpointId:%" PRId64 - " recv expired checkpoint-trigger block, checkpointId:%" PRId64 " transId:%d, discard", - id, vgId, pTask->chkInfo.checkpointId, checkpointId, transId); + " recv expired checkpoint-trigger block, checkpointId:%" PRId64 " transId:%d, discard", + id, vgId, pTask->chkInfo.checkpointId, checkpointId, transId); taosThreadMutexUnlock(&pTask->lock); return TSDB_CODE_SUCCESS; } if (pTask->chkInfo.checkpointId == checkpointId) { { // send checkpoint-ready msg to upstream - SRpcMsg msg ={0}; + SRpcMsg msg = {0}; SStreamUpstreamEpInfo* pInfo = streamTaskGetUpstreamTaskEpInfo(pTask, pBlock->srcTaskId); initCheckpointReadyMsg(pTask, pInfo->nodeId, pBlock->srcTaskId, pInfo->childId, checkpointId, &msg); @@ -265,7 +269,7 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock stDebug("s-task:%s set childIdx:%d, and add checkpoint-trigger block into outputQ", id, pTask->info.selfChildId); continueDispatchCheckpointTriggerBlock(pBlock, pTask); } else { // only one task exists, no need to dispatch downstream info - appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, pActiveInfo->activeId, pActiveInfo->transId); + appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, pActiveInfo->activeId, pActiveInfo->transId, -1); streamFreeQitem((SStreamQueueItem*)pBlock); } } else if (taskLevel == TASK_LEVEL__SINK || taskLevel == TASK_LEVEL__AGG) { @@ -362,8 +366,8 @@ int32_t streamProcessCheckpointReadyMsg(SStreamTask* pTask, int64_t checkpointId taosThreadMutexUnlock(&pInfo->lock); if (notReady == 0) { - stDebug("s-task:%s all downstream task(s) have completed build checkpoint, start to do checkpoint for current task", id); - appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, checkpointId, transId); + stDebug("s-task:%s all downstream tasks have completed build checkpoint, do checkpoint for current task", id); + appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, checkpointId, transId, -1); } return 0; @@ -371,11 +375,11 @@ int32_t streamProcessCheckpointReadyMsg(SStreamTask* pTask, int64_t checkpointId int32_t streamTaskProcessCheckpointReadyRsp(SStreamTask* pTask, int32_t upstreamTaskId, int64_t checkpointId) { SActiveCheckpointInfo* pInfo = pTask->chkInfo.pActiveInfo; - int64_t now = taosGetTimestampMs(); - int32_t numOfConfirmed = 0; + int64_t now = taosGetTimestampMs(); + int32_t numOfConfirmed = 0; taosThreadMutexLock(&pInfo->lock); - for(int32_t i = 0; i < taosArrayGetSize(pInfo->pReadyMsgList); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pInfo->pReadyMsgList); ++i) { STaskCheckpointReadyInfo* pReadyInfo = taosArrayGet(pInfo->pReadyMsgList, i); if (pReadyInfo->upstreamTaskId == upstreamTaskId && pReadyInfo->checkpointId == checkpointId) { pReadyInfo->sendCompleted = 1; @@ -385,7 +389,7 @@ int32_t streamTaskProcessCheckpointReadyRsp(SStreamTask* pTask, int32_t upstream } } - for(int32_t i = 0; i < taosArrayGetSize(pInfo->pReadyMsgList); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pInfo->pReadyMsgList); ++i) { STaskCheckpointReadyInfo* pReadyInfo = taosArrayGet(pInfo->pReadyMsgList, i); if (pReadyInfo->sendCompleted == 1) { numOfConfirmed += 1; @@ -443,13 +447,14 @@ int32_t streamTaskUpdateTaskCheckpointInfo(SStreamTask* pTask, bool restored, SV SStreamTaskState* pStatus = streamTaskGetStatus(pTask); - if (restored && (pStatus->state != TASK_STATUS__CK)) { - stDebug("s-task:0x%x vgId:%d restored:%d status:%s not update checkpoint-info, checkpointId:%" PRId64 "->%" PRId64 - " failed", - pReq->taskId, vgId, restored, pStatus->name, pInfo->checkpointId, pReq->checkpointId); - taosThreadMutexUnlock(&pTask->lock); - return TSDB_CODE_STREAM_TASK_IVLD_STATUS; - } + // if (restored && (pStatus->state != TASK_STATUS__CK)) { + // stDebug("s-task:0x%x vgId:%d restored:%d status:%s not update checkpoint-info, checkpointId:%" PRId64 "->%" + // PRId64 + // " failed", + // pReq->taskId, vgId, restored, pStatus->name, pInfo->checkpointId, pReq->checkpointId); + // taosThreadMutexUnlock(&pTask->lock); + // return TSDB_CODE_STREAM_TASK_IVLD_STATUS; + // } if (!restored) { // during restore procedure, do update checkpoint-info stDebug("s-task:%s vgId:%d status:%s update the checkpoint-info during restore, checkpointId:%" PRId64 "->%" PRId64 @@ -568,12 +573,12 @@ static int32_t getCheckpointDataMeta(const char* id, const char* path, SArray* l } int32_t uploadCheckpointData(SStreamTask* pTask, int64_t checkpointId, int64_t dbRefId, ECHECKPOINT_BACKUP_TYPE type) { - char* path = NULL; - int32_t code = 0; - SArray* toDelFiles = taosArrayInit(4, POINTER_BYTES); - int64_t now = taosGetTimestampMs(); - SStreamMeta* pMeta = pTask->pMeta; - const char* idStr = pTask->id.idStr; + char* path = NULL; + int32_t code = 0; + SArray* toDelFiles = taosArrayInit(4, POINTER_BYTES); + int64_t now = taosGetTimestampMs(); + SStreamMeta* pMeta = pTask->pMeta; + const char* idStr = pTask->id.idStr; if ((code = taskDbGenChkpUploadData(pTask->pBackend, pMeta->bkdChkptMgt, checkpointId, type, &path, toDelFiles, pTask->id.idStr)) != 0) { @@ -619,8 +624,8 @@ int32_t uploadCheckpointData(SStreamTask* pTask, int64_t checkpointId, int64_t d idStr, checkpointId, el, path); taosRemoveDir(path); } else { - stDebug("s-task:%s failed to upload checkpointId:%" PRId64 " keep local checkpoint data, elapsed time:%.2fs", - idStr, checkpointId, el); + stDebug("s-task:%s failed to upload checkpointId:%" PRId64 " keep local checkpoint data, elapsed time:%.2fs", idStr, + checkpointId, el); } taosMemoryFree(path); @@ -639,9 +644,10 @@ int32_t streamTaskRemoteBackupCheckpoint(SStreamTask* pTask, int64_t checkpointI } int64_t dbRefId = taskGetDBRef(pTask->pBackend); - void* pBackend = taskAcquireDb(dbRefId); + void* pBackend = taskAcquireDb(dbRefId); if (pBackend == NULL) { - stError("s-task:%s failed to acquire db during update checkpoint data, failed to upload checkpointData", pTask->id.idStr); + stError("s-task:%s failed to acquire db during update checkpoint data, failed to upload checkpointData", + pTask->id.idStr); return -1; } @@ -702,11 +708,10 @@ int32_t streamTaskBuildCheckpoint(SStreamTask* pTask) { } } else { // clear the checkpoint info if failed taosThreadMutexLock(&pTask->lock); - streamTaskClearCheckInfo(pTask, false); + streamTaskSetFailedCheckpointId(pTask); // set failed checkpoint id before clear the checkpoint info taosThreadMutexUnlock(&pTask->lock); code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_CHECKPOINT_DONE); - streamTaskSetFailedCheckpointId(pTask); stDebug("s-task:%s clear checkpoint flag since gen checkpoint failed, checkpointId:%" PRId64, id, ckId); } @@ -773,11 +778,11 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) { ASSERT(pTask->info.taskLevel > TASK_LEVEL__SOURCE); SArray* pNotSendList = taosArrayInit(4, sizeof(SStreamUpstreamEpInfo)); - for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pList); ++i) { SStreamUpstreamEpInfo* pInfo = taosArrayGetP(pList, i); bool recved = false; - for(int32_t j = 0; j < taosArrayGetSize(pActiveInfo->pReadyMsgList); ++j) { + for (int32_t j = 0; j < taosArrayGetSize(pActiveInfo->pReadyMsgList); ++j) { STaskCheckpointReadyInfo* pReady = taosArrayGet(pActiveInfo->pReadyMsgList, j); if (pInfo->nodeId == pReady->upstreamNodeId) { recved = true; @@ -785,7 +790,7 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) { } } - if (!recved) { // make sure the inputQ is opened for not recv upstream checkpoint-trigger message + if (!recved) { // make sure the inputQ is opened for not recv upstream checkpoint-trigger message streamTaskOpenUpstreamInput(pTask, pInfo->taskId); taosArrayPush(pNotSendList, pInfo); } @@ -870,7 +875,7 @@ bool streamTaskAlreadySendTrigger(SStreamTask* pTask, int32_t downstreamNodeId) return false; } - for(int32_t i = 0; i < taosArrayGetSize(pInfo->pDispatchTriggerList); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pInfo->pDispatchTriggerList); ++i) { STaskTriggerSendInfo* pSendInfo = taosArrayGet(pInfo->pDispatchTriggerList, i); if (pSendInfo->nodeId != downstreamNodeId) { continue; @@ -939,10 +944,10 @@ int32_t streamTaskGetNumOfConfirmed(SStreamTask* pTask) { int32_t num = 0; taosThreadMutexLock(&pInfo->lock); - for(int32_t i = 0; i < taosArrayGetSize(pInfo->pDispatchTriggerList); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pInfo->pDispatchTriggerList); ++i) { STaskTriggerSendInfo* p = taosArrayGet(pInfo->pDispatchTriggerList, i); if (p->recved) { - num ++; + num++; } } taosThreadMutexUnlock(&pInfo->lock); diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 0f5559df89..83e73e8c88 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -40,6 +40,20 @@ void initRpcMsg(SRpcMsg* pMsg, int32_t msgType, void* pCont, int32_t contLen) { pMsg->contLen = contLen; } +static void initDispatchInfo(SDispatchMsgInfo* pInfo, int32_t msgId) { + pInfo->startTs = taosGetTimestampMs(); + pInfo->rspTs = -1; + pInfo->msgId = msgId; +} + +static void clearDispatchInfo(SDispatchMsgInfo* pInfo) { + pInfo->startTs = -1; + pInfo->msgId = -1; + pInfo->rspTs = -1; +} + +static void updateDispatchInfo(SDispatchMsgInfo* pInfo, int64_t recvTs) { pInfo->rspTs = recvTs; } + static int32_t tInitStreamDispatchReq(SStreamDispatchReq* pReq, const SStreamTask* pTask, int32_t vgId, int32_t numOfBlocks, int64_t dstTaskId, int32_t type) { pReq->streamId = pTask->id.streamId; @@ -65,7 +79,7 @@ static int32_t tInitStreamDispatchReq(SStreamDispatchReq* pReq, const SStreamTas return TSDB_CODE_SUCCESS; } -void streamTaskSendRetrieveRsp(SStreamRetrieveReq *pReq, SRpcMsg* pRsp){ +void streamTaskSendRetrieveRsp(SStreamRetrieveReq* pReq, SRpcMsg* pRsp) { void* buf = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamRetrieveRsp)); ((SMsgHead*)buf)->vgId = htonl(pReq->srcNodeId); @@ -119,7 +133,6 @@ int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* r return code; } - buf = NULL; stDebug("s-task:%s (child %d) send retrieve req to task:0x%x (vgId:%d), reqId:0x%" PRIx64, pTask->id.idStr, pTask->info.selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req->reqId); } @@ -127,7 +140,7 @@ int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* r return code; } -static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBlock, SStreamRetrieveReq* req){ +static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBlock, SStreamRetrieveReq* req) { SRetrieveTableRsp* pRetrieve = NULL; int32_t len = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; @@ -147,7 +160,7 @@ static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBl pRetrieve->ekey = htobe64(pBlock->info.window.ekey); pRetrieve->version = htobe64(pBlock->info.version); - int32_t actualLen = blockEncode(pBlock, pRetrieve->data+ PAYLOAD_PREFIX_LEN, numOfCols); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data + PAYLOAD_PREFIX_LEN, numOfCols); SET_PAYLOAD_LEN(pRetrieve->data, actualLen, actualLen); int32_t payloadLen = actualLen + PAYLOAD_PREFIX_LEN; @@ -165,8 +178,8 @@ static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBl int32_t streamBroadcastToUpTasks(SStreamTask* pTask, const SSDataBlock* pBlock) { SStreamRetrieveReq req; - int32_t code = buildStreamRetrieveReq(pTask, pBlock, &req); - if(code != 0){ + int32_t code = buildStreamRetrieveReq(pTask, pBlock, &req); + if (code != 0) { return code; } @@ -226,12 +239,15 @@ void clearBufferedDispatchMsg(SStreamTask* pTask) { destroyDispatchMsg(pMsgInfo->pData, streamTaskGetNumOfDownstream(pTask)); } + taosThreadMutexLock(&pMsgInfo->lock); + pMsgInfo->checkpointId = -1; pMsgInfo->transId = -1; pMsgInfo->pData = NULL; pMsgInfo->dispatchMsgType = 0; - taosThreadMutexLock(&pMsgInfo->lock); + clearDispatchInfo(pMsgInfo); + taosArrayClear(pTask->msgInfo.pSendInfo); taosThreadMutexUnlock(&pMsgInfo->lock); } @@ -310,7 +326,6 @@ static int32_t doBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* pD addDispatchEntry(&pTask->msgInfo, pTask->outputInfo.fixedDispatcher.nodeId, now, true); pTask->msgInfo.pData = pReqs; } else if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) { - SArray* vgInfo = pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos; int32_t numOfVgroups = taosArrayGetSize(vgInfo); @@ -418,6 +433,7 @@ static void setResendInfo(SDispatchEntry* pEntry, int64_t now) { pEntry->sendTs = now; pEntry->rspTs = -1; pEntry->retryCount += 1; + pEntry->status = TSDB_CODE_SUCCESS; } static void addDispatchEntry(SDispatchMsgInfo* pMsgInfo, int32_t nodeId, int64_t now, bool lock) { @@ -568,8 +584,8 @@ void streamStartMonitorDispatchData(SStreamTask* pTask, int64_t waitDuration) { } } -int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, SSDataBlock* pDataBlock, - int64_t groupId, int64_t now) { +int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, SSDataBlock* pDataBlock, int64_t groupId, + int64_t now) { uint32_t hashValue = 0; SArray* vgInfo = pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos; if (pTask->pNameMap == NULL) { @@ -644,22 +660,6 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S return 0; } -static void initDispatchInfo(SDispatchMsgInfo* pInfo, int32_t msgId) { - pInfo->startTs = taosGetTimestampMs(); - pInfo->rspTs = -1; - pInfo->msgId = msgId; -} - -static void clearDispatchInfo(SDispatchMsgInfo* pInfo) { - pInfo->startTs = -1; - pInfo->msgId = -1; - pInfo->rspTs = -1; -} - -static void updateDispatchInfo(SDispatchMsgInfo* pInfo, int64_t recvTs) { - pInfo->rspTs = recvTs; -} - int32_t streamDispatchStreamBlock(SStreamTask* pTask) { ASSERT((pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH)); @@ -702,7 +702,10 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) { type == STREAM_INPUT__TRANS_STATE); pTask->execInfo.dispatch += 1; + + taosThreadMutexLock(&pTask->msgInfo.lock); initDispatchInfo(&pTask->msgInfo, pTask->execInfo.dispatch); + taosThreadMutexUnlock(&pTask->msgInfo.lock); int32_t code = doBuildDispatchMsg(pTask, pBlock); if (code == 0) { @@ -719,8 +722,8 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) { taosThreadMutexLock(&pTask->msgInfo.lock); if (pTask->msgInfo.inMonitor == 0) { int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s start dispatch monitor tmr in %dms, ref:%d, dispatch code:%s", id, DISPATCH_RETRY_INTERVAL_MS, ref, - tstrerror(code)); + stDebug("s-task:%s start dispatch monitor tmr in %dms, ref:%d, dispatch code:%s", id, DISPATCH_RETRY_INTERVAL_MS, + ref, tstrerror(code)); streamStartMonitorDispatchData(pTask, DISPATCH_RETRY_INTERVAL_MS); pTask->msgInfo.inMonitor = 1; } else { @@ -829,13 +832,13 @@ static void checkpointReadyMsgSendMonitorFn(void* param, void* tmrId) { int32_t checkpointId = pActiveInfo->activeId; int32_t notRsp = taosArrayGetSize(pNotRspList); - if (notRsp > 0) { // send checkpoint-ready msg again + if (notRsp > 0) { // send checkpoint-ready msg again for (int32_t i = 0; i < taosArrayGetSize(pNotRspList); ++i) { int32_t taskId = *(int32_t*)taosArrayGet(pNotRspList, i); for (int32_t j = 0; j < num; ++j) { STaskCheckpointReadyInfo* pReadyInfo = taosArrayGet(pList, j); - if (taskId == pReadyInfo->upstreamTaskId) { // send msg again + if (taskId == pReadyInfo->upstreamTaskId) { // send msg again SRpcMsg msg = {0}; initCheckpointReadyMsg(pTask, pReadyInfo->upstreamNodeId, pReadyInfo->upstreamTaskId, pReadyInfo->childId, @@ -880,7 +883,8 @@ int32_t streamTaskSendCheckpointReadyMsg(SStreamTask* pTask) { STaskCheckpointReadyInfo* pInfo = taosArrayGet(pList, i); SRpcMsg msg = {0}; - initCheckpointReadyMsg(pTask, pInfo->upstreamNodeId, pInfo->upstreamTaskId, pInfo->childId, pInfo->checkpointId, &msg); + initCheckpointReadyMsg(pTask, pInfo->upstreamNodeId, pInfo->upstreamTaskId, pInfo->childId, pInfo->checkpointId, + &msg); tmsgSendReq(&pInfo->upstreamNodeEpset, &msg); stDebug("s-task:%s level:%d checkpoint-ready msg sent to upstream:0x%x", id, pTask->info.taskLevel, @@ -918,9 +922,11 @@ int32_t streamTaskSendCheckpointSourceRsp(SStreamTask* pTask) { tmsgSendRsp(&pInfo->msg); taosArrayClear(pList); - stDebug("s-task:%s level:%d checkpoint-source rsp completed msg sent to mnode", pTask->id.idStr, pTask->info.taskLevel); + stDebug("s-task:%s level:%d checkpoint-source rsp completed msg sent to mnode", pTask->id.idStr, + pTask->info.taskLevel); } else { - stDebug("s-task:%s level:%d already send checkpoint-source rsp success to mnode", pTask->id.idStr, pTask->info.taskLevel); + stDebug("s-task:%s level:%d already send checkpoint-source rsp success to mnode", pTask->id.idStr, + pTask->info.taskLevel); } taosThreadMutexUnlock(&pTask->chkInfo.pActiveInfo->lock); @@ -1010,7 +1016,7 @@ FAIL: } int32_t streamTaskBuildCheckpointSourceRsp(SStreamCheckpointSourceReq* pReq, SRpcHandleInfo* pRpcInfo, SRpcMsg* pMsg, - int32_t setCode) { + int32_t setCode) { int32_t len = 0; int32_t code = 0; SEncoder encoder; @@ -1049,7 +1055,8 @@ int32_t streamTaskBuildCheckpointSourceRsp(SStreamCheckpointSourceReq* pReq, SRp return 0; } -int32_t streamAddCheckpointSourceRspMsg(SStreamCheckpointSourceReq* pReq, SRpcHandleInfo* pRpcInfo, SStreamTask* pTask) { +int32_t streamAddCheckpointSourceRspMsg(SStreamCheckpointSourceReq* pReq, SRpcHandleInfo* pRpcInfo, + SStreamTask* pTask) { STaskCheckpointReadyInfo info = { .recvTs = taosGetTimestampMs(), .transId = pReq->transId, .checkpointId = pReq->checkpointId}; @@ -1070,7 +1077,7 @@ int32_t streamAddCheckpointSourceRspMsg(SStreamCheckpointSourceReq* pReq, SRpcHa stError("s-task:%s checkpointId:%" PRId64 " transId:%d not completed, new transId:%d checkpointId:%" PRId64 " recv from mnode", pTask->id.idStr, pReady->checkpointId, pReady->transId, pReq->transId, pReq->checkpointId); - ASSERT(0); // failed to handle it + ASSERT(0); // failed to handle it } } else { taosArrayPush(pActiveInfo->pReadyMsgList, &info); @@ -1105,8 +1112,7 @@ int32_t streamAddCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamTaskId, STaskCheckpointReadyInfo info = {0}; initCheckpointReadyInfo(&info, pInfo->nodeId, pInfo->taskId, pInfo->childId, &pInfo->epSet, checkpointId); - stDebug("s-task:%s (level:%d) prepare checkpoint-ready msg to upstream s-task:0x%" PRIx64 - "-0x%x (vgId:%d) idx:%d", + stDebug("s-task:%s (level:%d) prepare checkpoint-ready msg to upstream s-task:0x%" PRIx64 "-0x%x (vgId:%d) idx:%d", pTask->id.idStr, pTask->info.taskLevel, pTask->id.streamId, pInfo->taskId, pInfo->nodeId, index); SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; @@ -1178,7 +1184,7 @@ static int32_t setDispatchRspInfo(SDispatchMsgInfo* pMsgInfo, int32_t vgId, int3 bool updated = false; taosThreadMutexLock(&pMsgInfo->lock); - for(int32_t j = 0; j < taosArrayGetSize(pMsgInfo->pSendInfo); ++j) { + for (int32_t j = 0; j < taosArrayGetSize(pMsgInfo->pSendInfo); ++j) { SDispatchEntry* pEntry = taosArrayGet(pMsgInfo->pSendInfo, j); if (pEntry->nodeId == vgId) { ASSERT(!alreadySet); @@ -1186,7 +1192,7 @@ static int32_t setDispatchRspInfo(SDispatchMsgInfo* pMsgInfo, int32_t vgId, int3 pEntry->status = code; alreadySet = true; updated = true; - stDebug("s-task:%s record the rsp recv, ts:%"PRId64" code:%d, idx:%d", id, now, code, j); + stDebug("s-task:%s record the rsp recv, ts:%" PRId64 " code:%d, idx:%d", id, now, code, j); } if (pEntry->rspTs != -1) { @@ -1222,10 +1228,13 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i const char* id = pTask->id.idStr; int32_t vgId = pTask->pMeta->vgId; SDispatchMsgInfo* pMsgInfo = &pTask->msgInfo; - int32_t msgId = pMsgInfo->msgId; int64_t now = taosGetTimestampMs(); int32_t totalRsp = 0; + taosThreadMutexLock(&pMsgInfo->lock); + int32_t msgId = pMsgInfo->msgId; + taosThreadMutexUnlock(&pMsgInfo->lock); + // follower not handle the dispatch rsp if ((pTask->pMeta->role == NODE_ROLE_FOLLOWER) || (pTask->status.downstreamReady != 1)) { stError("s-task:%s vgId:%d is follower or task just re-launched, not handle the dispatch rsp, discard it", id, @@ -1301,12 +1310,14 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) { if (notRsp > 0) { stDebug( - "s-task:%s recv dispatch rsp, msgId:%d from 0x%x(vgId:%d), downstream task input status:%d code:%s, waiting " + "s-task:%s recv dispatch rsp, msgId:%d from 0x%x(vgId:%d), downstream task input status:%d code:%s, " + "waiting " "for %d rsp", id, msgId, pRsp->downstreamTaskId, pRsp->downstreamNodeId, pRsp->inputStatus, tstrerror(code), notRsp); } else { stDebug( - "s-task:%s recv dispatch rsp, msgId:%d from 0x%x(vgId:%d), downstream task input status:%d code:%s, all rsp", + "s-task:%s recv dispatch rsp, msgId:%d from 0x%x(vgId:%d), downstream task input status:%d code:%s, all " + "rsp", id, msgId, pRsp->downstreamTaskId, pRsp->downstreamNodeId, pRsp->inputStatus, tstrerror(code)); } } else { @@ -1407,7 +1418,7 @@ int32_t streamProcessDispatchMsg(SStreamTask* pTask, SStreamDispatchReq* pReq, S if (pReq->stage > pInfo->stage) { // upstream task has restarted/leader-follower switch/transferred to other dnodes stError("s-task:%s upstream task:0x%x (vgId:%d) has restart/leader-switch/vnode-transfer, prev stage:%" PRId64 - ", current:%" PRId64 " dispatch msg rejected", + ", current:%" PRId64 " dispatch msg rejected", id, pReq->upstreamTaskId, pReq->upstreamNodeId, pInfo->stage, pReq->stage); status = TASK_INPUT_STATUS__REFUSED; } else { diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 03c7b93f91..a7f73d1b52 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -151,7 +151,7 @@ int32_t streamMetaCheckBackendCompatible(SStreamMeta* pMeta) { int8_t ret = STREAM_STATA_COMPATIBLE; TBC* pCur = NULL; - if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) { // no task info, no stream + if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) { // no task info, no stream return ret; } @@ -557,7 +557,7 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) { return -1; } - if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER) { pTask->ver = SSTREAM_TASK_VER; } @@ -907,7 +907,7 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { if (p == NULL) { code = pMeta->buildTaskFn(pMeta->ahandle, pTask, pTask->chkInfo.checkpointVer + 1); if (code < 0) { - stError("failed to expand s-task:0x%"PRIx64", code:%s, continue", id.taskId, tstrerror(terrno)); + stError("failed to expand s-task:0x%" PRIx64 ", code:%s, continue", id.taskId, tstrerror(terrno)); tFreeStreamTask(pTask); continue; } @@ -958,6 +958,8 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { pMeta->numOfStreamTasks, pMeta->numOfPausedTasks); taosArrayDestroy(pRecycleList); + + (void)streamMetaCommit(pMeta); } static bool waitForEnoughDuration(SMetaHbInfo* pInfo) { @@ -1012,7 +1014,7 @@ static int32_t metaHeartbeatToMnodeImpl(SStreamMeta* pMeta) { for (int32_t i = 0; i < numOfTasks; ++i) { SStreamTaskId* pId = taosArrayGet(pMeta->pTaskList, i); - STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; + STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; SStreamTask** pTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); if (pTask == NULL) { continue; @@ -1051,13 +1053,19 @@ static int32_t metaHeartbeatToMnodeImpl(SStreamMeta* pMeta) { entry.sinkDataSize = SIZE_IN_MiB((*pTask)->execInfo.sink.dataSize); } - if ((*pTask)->chkInfo.pActiveInfo->activeId != 0) { - entry.checkpointInfo.failed = ((*pTask)->chkInfo.pActiveInfo->failedId >= (*pTask)->chkInfo.pActiveInfo->activeId) ? 1 : 0; - entry.checkpointInfo.activeId = (*pTask)->chkInfo.pActiveInfo->activeId; - entry.checkpointInfo.activeTransId = (*pTask)->chkInfo.pActiveInfo->transId; + SActiveCheckpointInfo* p = (*pTask)->chkInfo.pActiveInfo; + if (p->activeId != 0) { + entry.checkpointInfo.failed = (p->failedId >= p->activeId) ? 1 : 0; + entry.checkpointInfo.activeId = p->activeId; + entry.checkpointInfo.activeTransId = p->transId; if (entry.checkpointInfo.failed) { - stInfo("s-task:%s set kill checkpoint trans in hb, transId:%d", (*pTask)->id.idStr, (*pTask)->chkInfo.pActiveInfo->transId); + stInfo("s-task:%s set kill checkpoint trans in hb, transId:%d, clear the active checkpointInfo", + (*pTask)->id.idStr, p->transId); + + taosThreadMutexLock(&(*pTask)->lock); + streamTaskClearCheckInfo((*pTask), true); + taosThreadMutexUnlock(&(*pTask)->lock); } } @@ -1384,7 +1392,7 @@ int32_t streamMetaStartAllTasks(SStreamMeta* pMeta, __stream_task_expand_fn expa int64_t now = taosGetTimestampMs(); int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); - stInfo("vgId:%d start to check all %d stream task(s) downstream status, start ts:%"PRId64, vgId, numOfTasks, now); + stInfo("vgId:%d start to check all %d stream task(s) downstream status, start ts:%" PRId64, vgId, numOfTasks, now); if (numOfTasks == 0) { stInfo("vgId:%d no tasks to be started", pMeta->vgId); @@ -1513,8 +1521,8 @@ bool streamMetaAllTasksReady(const SStreamMeta* pMeta) { int32_t num = taosArrayGetSize(pMeta->pTaskList); for (int32_t i = 0; i < num; ++i) { SStreamTaskId* pId = taosArrayGet(pMeta->pTaskList, i); - STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; - SStreamTask** ppTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); + STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; + SStreamTask** ppTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); if (ppTask == NULL) { continue; } @@ -1598,7 +1606,7 @@ int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int3 if (pStartInfo->startAllTasks != 1) { int64_t el = endTs - startTs; stDebug("vgId:%d not start all task(s), not record status, s-task:0x%x launch succ:%d elapsed time:%" PRId64 "ms", - pMeta->vgId, taskId, ready, el); + pMeta->vgId, taskId, ready, el); streamMetaWUnLock(pMeta); return 0; } @@ -1725,7 +1733,8 @@ void streamMetaAddIntoUpdateTaskList(SStreamMeta* pMeta, SStreamTask* pTask, SSt taosHashPut(pMeta->updateInfo.pTasks, &hEntry, sizeof(hEntry), NULL, 0); stDebug("s-task:%s vgId:%d transId:%d task nodeEp update completed, streamTask/hTask closed, elapsed:%" PRId64 - " ms", id, vgId, transId, el); + " ms", + id, vgId, transId, el); } else { stDebug("s-task:%s vgId:%d transId:%d task nodeEp update completed, streamTask closed, elapsed time:%" PRId64 "ms", id, vgId, transId, el); @@ -1740,4 +1749,4 @@ void streamMetaClearUpdateTaskList(SStreamMeta* pMeta) { void streamMetaInitUpdateTaskList(SStreamMeta* pMeta, int32_t transId) { taosHashClear(pMeta->updateInfo.pTasks); pMeta->updateInfo.transId = transId; -} \ No newline at end of file +} diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index 9c817d565b..0a54dfa4c8 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -26,7 +26,8 @@ int32_t streamSetupScheduleTrigger(SStreamTask* pTask) { stDebug("s-task:%s setup scheduler trigger, delay:%" PRId64 " ms", pTask->id.idStr, pTask->info.delaySchedParam); - pTask->schedInfo.pDelayTimer = taosTmrStart(streamTaskSchedHelper, (int32_t)pTask->info.delaySchedParam, pTask, streamTimer); + pTask->schedInfo.pDelayTimer = + taosTmrStart(streamTaskSchedHelper, (int32_t)pTask->info.delaySchedParam, pTask, streamTimer); pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE; } @@ -78,7 +79,7 @@ int32_t streamTaskResumeInFuture(SStreamTask* pTask) { pTask->status.schedIdleTime, ref); // add one ref count for task - /*SStreamTask* pAddRefTask = */streamMetaAcquireOneTask(pTask); + /*SStreamTask* pAddRefTask = */ streamMetaAcquireOneTask(pTask); if (pTask->schedInfo.pIdleTimer == NULL) { pTask->schedInfo.pIdleTimer = taosTmrStart(streamTaskResumeHelper, pTask->status.schedIdleTime, pTask, streamTimer); diff --git a/source/libs/stream/src/streamStartHistory.c b/source/libs/stream/src/streamStartHistory.c index 7a723647ab..30bccd6479 100644 --- a/source/libs/stream/src/streamStartHistory.c +++ b/source/libs/stream/src/streamStartHistory.c @@ -105,9 +105,11 @@ int32_t streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration) stDebug("s-task:%s scan-history resumed in %.2fs, ref:%d", pTask->id.idStr, numOfTicks * 0.1, ref); if (pTask->schedHistoryInfo.pTimer == NULL) { - pTask->schedHistoryInfo.pTimer = taosTmrStart(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer); + pTask->schedHistoryInfo.pTimer = + taosTmrStart(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer); } else { - taosTmrReset(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, &pTask->schedHistoryInfo.pTimer); + taosTmrReset(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, + &pTask->schedHistoryInfo.pTimer); } return TSDB_CODE_SUCCESS; @@ -204,7 +206,8 @@ int32_t streamLaunchFillHistoryTask(SStreamTask* pTask) { // check stream task status in the first place. SStreamTaskState* pStatus = streamTaskGetStatus(pTask); - if (pStatus->state != TASK_STATUS__READY && pStatus->state != TASK_STATUS__HALT && pStatus->state != TASK_STATUS__PAUSE) { + if (pStatus->state != TASK_STATUS__READY && pStatus->state != TASK_STATUS__HALT && + pStatus->state != TASK_STATUS__PAUSE) { stDebug("s-task:%s not launch related fill-history task:0x%" PRIx64 "-0x%x, status:%s", idStr, hStreamId, hTaskId, pStatus->name); @@ -389,7 +392,7 @@ void tryLaunchHistoryTask(void* param, void* tmrId) { // not in timer anymore int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); stDebug("s-task:0x%x fill-history task launch completed, retry times:%d, ref:%d", (int32_t)pInfo->id.taskId, - pHTaskInfo->retryTimes, ref); + pHTaskInfo->retryTimes, ref); } streamMetaReleaseTask(pMeta, pHTask); } @@ -434,7 +437,7 @@ int32_t launchNotBuiltFillHistoryTask(SStreamTask* pTask) { stWarn("s-task:%s vgId:%d failed to launch history task:0x%x, since not built yet", idStr, pMeta->vgId, hTaskId); - STaskId id = streamTaskGetTaskId(pTask); + STaskId id = streamTaskGetTaskId(pTask); SLaunchHTaskInfo* pInfo = createHTaskLaunchInfo(pMeta, &id, hStreamId, hTaskId); if (pInfo == NULL) { stError("s-task:%s failed to launch related fill-history task, since Out Of Memory", idStr); @@ -494,8 +497,8 @@ bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t nextProcessVe // [pTask->dataRange.range.maxVer, ver1] pTask->step2Range.minVer = walScanStartVer; pTask->step2Range.maxVer = nextProcessVer - 1; - stDebug("s-task:%s set step2 verRange:%" PRId64 "-%" PRId64 ", step1 verRange:%" PRId64 "-%" PRId64, pTask->id.idStr, - pTask->step2Range.minVer, pTask->step2Range.maxVer, pRange->minVer, pRange->maxVer); + stDebug("s-task:%s set step2 verRange:%" PRId64 "-%" PRId64 ", step1 verRange:%" PRId64 "-%" PRId64, + pTask->id.idStr, pTask->step2Range.minVer, pTask->step2Range.maxVer, pRange->minVer, pRange->maxVer); return false; } } @@ -525,7 +528,7 @@ void streamTaskSetRangeStreamCalc(SStreamTask* pTask) { pRange->range.maxVer); SVersionRange verRange = pRange->range; - STimeWindow win = pRange->window; + STimeWindow win = pRange->window; streamSetParamForStreamScannerStep2(pTask, &verRange, &win); } } @@ -553,7 +556,8 @@ void doExecScanhistoryInFuture(void* param, void* tmrId) { // release the task. streamMetaReleaseTask(pTask->pMeta, pTask); } else { - taosTmrReset(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, &pTask->schedHistoryInfo.pTimer); + taosTmrReset(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, + &pTask->schedHistoryInfo.pTimer); } } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 70e3790209..ff020e88c9 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -121,7 +121,7 @@ SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, pTask->id.idStr = taosStrdup(buf); pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE; - pTask->status.taskStatus = fillHistory? TASK_STATUS__SCAN_HISTORY : TASK_STATUS__READY; + pTask->status.taskStatus = fillHistory ? TASK_STATUS__SCAN_HISTORY : TASK_STATUS__READY; pTask->inputq.status = TASK_INPUT_STATUS__NORMAL; pTask->outputq.status = TASK_OUTPUT_STATUS__NORMAL; @@ -208,9 +208,8 @@ void tFreeStreamTask(SStreamTask* pTask) { stDebug("s-task:0x%x task exec summary: create:%" PRId64 ", init:%" PRId64 ", start:%" PRId64 ", updateCount:%d latestUpdate:%" PRId64 ", latestCheckPoint:%" PRId64 ", ver:%" PRId64 " nextProcessVer:%" PRId64 ", checkpointCount:%d", - taskId, pStatis->created, pStatis->checkTs, pStatis->readyTs, pStatis->updateCount, - pStatis->latestUpdateTs, pCkInfo->checkpointId, pCkInfo->checkpointVer, pCkInfo->nextProcessVer, - pStatis->checkpoint); + taskId, pStatis->created, pStatis->checkTs, pStatis->readyTs, pStatis->updateCount, pStatis->latestUpdateTs, + pCkInfo->checkpointId, pCkInfo->checkpointVer, pCkInfo->nextProcessVer, pStatis->checkpoint); // remove the ref by timer while (pTask->status.timerActive > 0) { @@ -224,12 +223,12 @@ void tFreeStreamTask(SStreamTask* pTask) { } if (pTask->hTaskInfo.pTimer != NULL) { - /*bool ret = */taosTmrStop(pTask->hTaskInfo.pTimer); + /*bool ret = */ taosTmrStop(pTask->hTaskInfo.pTimer); pTask->hTaskInfo.pTimer = NULL; } if (pTask->msgInfo.pRetryTmr != NULL) { - /*bool ret = */taosTmrStop(pTask->msgInfo.pRetryTmr); + /*bool ret = */ taosTmrStop(pTask->msgInfo.pRetryTmr); pTask->msgInfo.pRetryTmr = NULL; } @@ -414,7 +413,8 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i streamTaskInitTokenBucket(pOutputInfo->pTokenBucket, 35, 35, tsSinkDataRate, pTask->id.idStr); pOutputInfo->pNodeEpsetUpdateList = taosArrayInit(4, sizeof(SDownstreamTaskEpset)); if (pOutputInfo->pNodeEpsetUpdateList == NULL) { - stError("s-task:%s failed to prepare downstreamUpdateList, code:%s", pTask->id.idStr, tstrerror(TSDB_CODE_OUT_OF_MEMORY)); + stError("s-task:%s failed to prepare downstreamUpdateList, code:%s", pTask->id.idStr, + tstrerror(TSDB_CODE_OUT_OF_MEMORY)); return TSDB_CODE_OUT_OF_MEMORY; } @@ -448,9 +448,7 @@ int32_t streamTaskGetNumOfDownstream(const SStreamTask* pTask) { } } -int32_t streamTaskGetNumOfUpstream(const SStreamTask* pTask) { - return taosArrayGetSize(pTask->upstreamInfo.pList); -} +int32_t streamTaskGetNumOfUpstream(const SStreamTask* pTask) { return taosArrayGetSize(pTask->upstreamInfo.pList); } int32_t streamTaskSetUpstreamInfo(SStreamTask* pTask, const SStreamTask* pUpstreamTask) { SStreamUpstreamEpInfo* pEpInfo = createStreamTaskEpInfo(pUpstreamTask); @@ -512,7 +510,7 @@ void streamTaskSetFixedDownstreamInfo(SStreamTask* pTask, const SStreamTask* pDo pTask->msgInfo.msgType = TDMT_STREAM_TASK_DISPATCH; } -void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool *pUpdated) { +void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdated) { char buf[512] = {0}; epsetToStr(pEpSet, buf, tListLen(buf)); @@ -740,10 +738,10 @@ int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskI } int32_t streamSendChkptReportMsg(SStreamTask* pTask, SCheckpointInfo* pCheckpointInfo, int8_t dropRelHTask) { - int32_t code; - int32_t tlen = 0; - int32_t vgId = pTask->pMeta->vgId; - const char* id = pTask->id.idStr; + int32_t code; + int32_t tlen = 0; + int32_t vgId = pTask->pMeta->vgId; + const char* id = pTask->id.idStr; SActiveCheckpointInfo* pActive = pCheckpointInfo->pActiveInfo; SCheckpointReport req = {.streamId = pTask->id.streamId, @@ -862,7 +860,8 @@ void streamTaskResume(SStreamTask* pTask) { int32_t num = atomic_sub_fetch_32(&pMeta->numOfPausedTasks, 1); stInfo("s-task:%s status:%s resume from %s, paused task(s):%d", pTask->id.idStr, pNew, prevState.name, num); } else { - stInfo("s-task:%s status:%s no need to resume, paused task(s):%d", pTask->id.idStr, prevState.name, pMeta->numOfPausedTasks); + stInfo("s-task:%s status:%s no need to resume, paused task(s):%d", pTask->id.idStr, prevState.name, + pMeta->numOfPausedTasks); } } @@ -925,7 +924,7 @@ SEpSet* streamTaskGetDownstreamEpInfo(SStreamTask* pTask, int32_t taskId) { } } else if (pTask->info.taskLevel == TASK_OUTPUT__SHUFFLE_DISPATCH) { SArray* pList = pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos; - for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pList); ++i) { SVgroupInfo* pVgInfo = taosArrayGet(pList, i); if (pVgInfo->taskId == taskId) { return &pVgInfo->epSet; @@ -979,9 +978,7 @@ int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq) { return streamTrySchedExec(pTask); } -void streamTaskSetRemoveBackendFiles(SStreamTask* pTask) { - pTask->status.removeBackendFiles = true; -} +void streamTaskSetRemoveBackendFiles(SStreamTask* pTask) { pTask->status.removeBackendFiles = true; } int32_t streamTaskGetActiveCheckpointInfo(const SStreamTask* pTask, int32_t* pTransId, int64_t* pCheckpointId) { if (pTransId != NULL) { @@ -1042,10 +1039,10 @@ void streamTaskDestroyActiveChkptInfo(SActiveCheckpointInfo* pInfo) { void streamTaskClearActiveInfo(SActiveCheckpointInfo* pInfo) { pInfo->activeId = 0; // clear the checkpoint id - pInfo->failedId = 0; pInfo->transId = 0; pInfo->allUpstreamTriggerRecv = 0; pInfo->dispatchTrigger = false; + pInfo->failedId = 0; taosArrayClear(pInfo->pDispatchTriggerList); taosArrayClear(pInfo->pCheckpointReadyRecvList); diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index 75d62ff324..5e991593e6 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -200,7 +200,6 @@ static int32_t removeEventInWaitingList(SStreamTask* pTask, EStreamTaskEvent eve SStreamTaskSM* pSM = pTask->status.pSM; bool removed = false; - taosThreadMutexLock(&pTask->lock); int32_t num = taosArrayGetSize(pSM->pWaitingEventList); for (int32_t i = 0; i < num; ++i) { @@ -218,7 +217,6 @@ static int32_t removeEventInWaitingList(SStreamTask* pTask, EStreamTaskEvent eve stDebug("s-task:%s failed to remove event:%s in waiting list", pTask->id.idStr, StreamTaskEventList[event].name); } - taosThreadMutexUnlock(&pTask->lock); return TSDB_CODE_SUCCESS; } @@ -671,4 +669,4 @@ void doInitStateTransferTable(void) { trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL); taosArrayPush(streamTaskSMTrans, &trans); } -//clang-format on \ No newline at end of file +//clang-format on diff --git a/source/libs/stream/src/streammsg.c b/source/libs/stream/src/streammsg.c index a6ab6a60c2..ac67742ef5 100644 --- a/source/libs/stream/src/streammsg.c +++ b/source/libs/stream/src/streammsg.c @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#include "os.h" #include "streammsg.h" +#include "os.h" #include "tstream.h" int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamUpstreamEpInfo* pInfo) { @@ -77,7 +77,6 @@ int32_t tEncodeStreamCheckpointSourceRsp(SEncoder* pEncoder, const SStreamCheckp return pEncoder->pos; } - int32_t tEncodeStreamTaskUpdateMsg(SEncoder* pEncoder, const SStreamTaskNodeUpdateMsg* pMsg) { if (tStartEncode(pEncoder) < 0) return -1; if (tEncodeI64(pEncoder, pMsg->streamId) < 0) return -1; @@ -99,7 +98,6 @@ int32_t tEncodeStreamTaskUpdateMsg(SEncoder* pEncoder, const SStreamTaskNodeUpda return pEncoder->pos; } - int32_t tDecodeStreamTaskUpdateMsg(SDecoder* pDecoder, SStreamTaskNodeUpdateMsg* pMsg) { if (tStartDecode(pDecoder) < 0) return -1; if (tDecodeI64(pDecoder, &pMsg->streamId) < 0) return -1; @@ -180,7 +178,6 @@ int32_t tDecodeStreamTaskCheckRsp(SDecoder* pDecoder, SStreamTaskCheckRsp* pRsp) return 0; } - int32_t tEncodeStreamCheckpointReadyMsg(SEncoder* pEncoder, const SStreamCheckpointReadyMsg* pReq) { if (tStartEncode(pEncoder) < 0) return -1; if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1; @@ -589,7 +586,7 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { if (tDecodeCStrTo(pDecoder, pTask->outputInfo.shuffleDispatcher.stbFullName) < 0) return -1; } if (tDecodeI64(pDecoder, &pTask->info.delaySchedParam) < 0) return -1; - if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER){ + if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER) { if (tDecodeI8(pDecoder, &pTask->subtableWithoutMd5) < 0) return -1; } if (tDecodeCStrTo(pDecoder, pTask->reserve) < 0) return -1; diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 1d5074fb03..4cca63a966 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -351,7 +351,12 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL } pCell = tdbPageGetCell(btc.pPage, btc.idx); - tdbBtreeDecodeCell(btc.pPage, pCell, &cd, btc.pTxn, pBt); + ret = tdbBtreeDecodeCell(btc.pPage, pCell, &cd, btc.pTxn, pBt); + if (ret < 0) { + tdbBtcClose(&btc); + tdbError("tdb/btree-pget: decode cell failed with ret: %d.", ret); + return -1; + } if (ppKey) { pTKey = tdbRealloc(*ppKey, cd.kLen); @@ -1072,6 +1077,7 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const // pack partial val to local if any space left if (nLocal > nHeader + kLen + sizeof(SPgno)) { if (ASSERT(pVal != NULL && vLen != 0)) { + tdbFree(pBuf); return -1; } memcpy(pCell + nHeader + kLen, pVal, nLocal - nHeader - kLen - sizeof(SPgno)); @@ -1859,7 +1865,11 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { pCell = tdbPageGetCell(pBtc->pPage, pBtc->idx); - tdbBtreeDecodeCell(pBtc->pPage, pCell, &cd, pBtc->pTxn, pBtc->pBt); + ret = tdbBtreeDecodeCell(pBtc->pPage, pCell, &cd, pBtc->pTxn, pBtc->pBt); + if (ret < 0) { + tdbError("tdb/btree-next: decode cell failed with ret: %d.", ret); + return -1; + } pKey = tdbRealloc(*ppKey, cd.kLen); if (pKey == NULL) { @@ -1918,7 +1928,11 @@ int tdbBtreePrev(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { pCell = tdbPageGetCell(pBtc->pPage, pBtc->idx); - tdbBtreeDecodeCell(pBtc->pPage, pCell, &cd, pBtc->pTxn, pBtc->pBt); + ret = tdbBtreeDecodeCell(pBtc->pPage, pCell, &cd, pBtc->pTxn, pBtc->pBt); + if (ret < 0) { + tdbError("tdb/btree-prev: decode cell failed with ret: %d.", ret); + return -1; + } pKey = tdbRealloc(*ppKey, cd.kLen); if (pKey == NULL) { diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 7bd746837f..ffcb1fbdb5 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -672,6 +672,7 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { SCliConn* conn = QUEUE_DATA(h, SCliConn, q); conn->status = ConnNormal; QUEUE_INIT(&conn->q); + tDebug("conn %p get from pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr); if (conn->task != NULL) { transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, conn->task); @@ -754,6 +755,7 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { SCliConn* conn = QUEUE_DATA(h, SCliConn, q); conn->status = ConnNormal; QUEUE_INIT(&conn->q); + tDebug("conn %p get from pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr); if (conn->task != NULL) { transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, conn->task); @@ -806,6 +808,7 @@ static void addConnToPool(void* pool, SCliConn* conn) { conn->status = ConnInPool; QUEUE_PUSH(&conn->list->conns, &conn->q); conn->list->size += 1; + tDebug("conn %p added to pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr); if (conn->list->size >= 10) { STaskArg* arg = taosMemoryCalloc(1, sizeof(STaskArg)); @@ -825,6 +828,9 @@ static int32_t allocConnRef(SCliConn* conn, bool update) { SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle)); exh->handle = conn; exh->pThrd = conn->hostThrd; + QUEUE_INIT(&exh->q); + taosInitRWLatch(&exh->latch); + exh->refId = transAddExHandle(transGetRefMgt(), exh); QUEUE_INIT(&exh->q); taosInitRWLatch(&exh->latch); @@ -849,6 +855,8 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { taosWLockLatch(&exh->latch); exh->handle = conn; exh->pThrd = conn->hostThrd; + taosWUnLockLatch(&exh->latch); + conn->refId = exh->refId; taosWUnLockLatch(&exh->latch); @@ -911,13 +919,11 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) { uv_timer_init(pThrd->loop, timer); } timer->data = conn; - conn->timer = timer; + conn->timer = timer; conn->connReq.data = conn; transReqQueueInit(&conn->wreqQueue); - transQueueInit(&conn->cliMsgs, NULL); - transInitBuffer(&conn->readBuf); QUEUE_INIT(&conn->q); conn->hostThrd = pThrd; @@ -1027,7 +1033,7 @@ static void cliSendCb(uv_write_t* req, int status) { SCliConn* pConn = transReqQueueRemove(req); if (pConn == NULL) return; - SCliMsg* pMsg = !transQueueEmpty(&pConn->cliMsgs) ? transQueueGet(&pConn->cliMsgs, 0) : NULL; + SCliMsg* pMsg = transQueueGet(&pConn->cliMsgs, 0); if (pMsg != NULL) { int64_t cost = taosGetTimestampUs() - pMsg->st; if (cost > 1000 * 50) { @@ -1133,6 +1139,7 @@ void cliSend(SCliConn* pConn) { STransMsg* pMsg = (STransMsg*)(&pCliMsg->msg); if (pMsg->pCont == 0) { pMsg->pCont = (void*)rpcMallocCont(0); + tDebug("malloc memory: %p", pMsg->pCont); pMsg->contLen = 0; } @@ -1579,7 +1586,7 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn) { tinet_ntoa(old, *v); tinet_ntoa(new, addr); tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new); - taosHashPut(cache, fqdn, strlen(fqdn) + 1, &addr, sizeof(addr)); + taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr)); } } return; @@ -1914,7 +1921,7 @@ void cliDestroyConnMsgs(SCliConn* conn, bool destroy) { } } -void cliIteraConnMsgs(SCliConn* conn) { +void cliConnFreeMsgs(SCliConn* conn) { SCliThrd* pThrd = conn->hostThrd; STrans* pTransInst = pThrd->pTransInst; @@ -1956,7 +1963,7 @@ bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) { } } - cliIteraConnMsgs(conn); + cliConnFreeMsgs(conn); tDebug("%s conn %p receive release request, refId:%" PRId64 "", CONN_GET_INST_LABEL(conn), conn, conn->refId); destroyCmsg(pMsg); @@ -2017,6 +2024,7 @@ static FORCE_INLINE void destroyCmsg(void* arg) { if (pMsg == NULL) { return; } + tDebug("free memory:%p, free ctx: %p", pMsg, pMsg->ctx); transDestroyConnCtx(pMsg->ctx); transFreeMsg(pMsg->msg.pCont); @@ -2523,6 +2531,8 @@ static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle); if (exh == NULL) { return NULL; + } else { + tDebug("conn %p got", exh->handle); } taosWLockLatch(&exh->latch); if (exh->pThrd == NULL && trans != NULL) { @@ -2568,7 +2578,7 @@ int transReleaseCliHandle(void* handle) { cmsg->ctx = pCtx; STraceId* trace = &tmsg.info.traceId; - tGDebug("send release request at thread:%08" PRId64 "", pThrd->pid); + tGDebug("send release request at thread:%08" PRId64 ", malloc memory:%p", pThrd->pid, cmsg); if (0 != transAsyncSend(pThrd->asyncPool, &cmsg->q)) { destroyCmsg(cmsg); @@ -2819,6 +2829,9 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { int64_t transAllocHandle() { SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle)); + QUEUE_INIT(&exh->q); + taosInitRWLatch(&exh->latch); + exh->refId = transAddExHandle(transGetRefMgt(), exh); QUEUE_INIT(&exh->q); taosInitRWLatch(&exh->latch); diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index e894d73c59..68ff5dc5e5 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -305,7 +305,7 @@ void transCtxCleanup(STransCtx* ctx) { ctx->freeFunc(iter->val); iter = taosHashIterate(ctx->args, iter); } - ctx->freeFunc(ctx->brokenVal.val); + if (ctx->freeFunc) ctx->freeFunc(ctx->brokenVal.val); taosHashCleanup(ctx->args); ctx->args = NULL; } @@ -676,6 +676,10 @@ void transDestroyExHandle(void* handle) { if (handle == NULL) { return; } + SExHandle* eh = handle; + if (!QUEUE_IS_EMPTY(&eh->q)) { + tDebug("handle %p mem leak", handle); + } taosMemoryFree(handle); } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index c205c1412c..94d2aa4b00 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1095,6 +1095,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { exh->handle = pConn; exh->pThrd = pThrd; exh->refId = transAddExHandle(transGetRefMgt(), exh); + QUEUE_INIT(&exh->q); transAcquireExHandle(transGetRefMgt(), exh->refId); STrans* pTransInst = pThrd->pTransInst; diff --git a/source/os/src/osEnv.c b/source/os/src/osEnv.c index 28f4178790..948040ac76 100644 --- a/source/os/src/osEnv.c +++ b/source/os/src/osEnv.c @@ -78,7 +78,9 @@ void osDefaultInit() { } strcpy(tsDataDir, TD_DATA_DIR_PATH); strcpy(tsLogDir, TD_LOG_DIR_PATH); - strcpy(tsTempDir, TD_TMP_DIR_PATH); + if(strlen(tsTempDir) == 0){ + strcpy(tsTempDir, TD_TMP_DIR_PATH); + } } void osUpdate() { diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index bdd43fe9fa..f63339bcfc 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -66,7 +66,7 @@ typedef struct TdFile { void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath) { #ifdef WINDOWS - const char *tdengineTmpFileNamePrefix = "tdengine-"; + char tmpPath[PATH_MAX]; int32_t len = (int32_t)strlen(inputTmpDir); @@ -76,7 +76,7 @@ void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, cha tmpPath[len++] = '\\'; } - strcpy(tmpPath + len, tdengineTmpFileNamePrefix); + strcpy(tmpPath + len, TD_TMP_FILE_PREFIX); if (strlen(tmpPath) + strlen(fileNamePrefix) + strlen("-%d-%s") < PATH_MAX) { strcat(tmpPath, fileNamePrefix); strcat(tmpPath, "-%d-%s"); @@ -88,8 +88,6 @@ void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, cha #else - const char *tdengineTmpFileNamePrefix = "tdengine-"; - char tmpPath[PATH_MAX]; int32_t len = strlen(inputTmpDir); memcpy(tmpPath, inputTmpDir, len); @@ -99,7 +97,7 @@ void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, cha tmpPath[len++] = '/'; } - strcpy(tmpPath + len, tdengineTmpFileNamePrefix); + strcpy(tmpPath + len, TD_TMP_FILE_PREFIX); if (strlen(tmpPath) + strlen(fileNamePrefix) + strlen("-%d-%s") < PATH_MAX) { strcat(tmpPath, fileNamePrefix); strcat(tmpPath, "-%d-%s"); @@ -1224,20 +1222,24 @@ int32_t taosUmaskFile(int32_t maskVal) { int32_t taosGetErrorFile(TdFilePtr pFile) { return errno; } int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) { + int64_t ret = -1; +#if FILE_WITH_LOCK + taosThreadRwlockRdlock(&(pFile->rwlock)); +#endif if (pFile == NULL || ptrBuf == NULL) { - return -1; + goto END; } if (*ptrBuf != NULL) { taosMemoryFreeClear(*ptrBuf); } ASSERT(pFile->fp != NULL); if (pFile->fp == NULL) { - return -1; + goto END; } #ifdef WINDOWS size_t bufferSize = 512; *ptrBuf = taosMemoryMalloc(bufferSize); - if (*ptrBuf == NULL) return -1; + if (*ptrBuf == NULL) goto END; size_t bytesRead = 0; size_t totalBytesRead = 0; @@ -1246,7 +1248,7 @@ int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) { char *result = fgets(*ptrBuf + totalBytesRead, bufferSize - totalBytesRead, pFile->fp); if (result == NULL) { taosMemoryFreeClear(*ptrBuf); - return -1; + goto END; } bytesRead = strlen(*ptrBuf + totalBytesRead); totalBytesRead += bytesRead; @@ -1259,18 +1261,24 @@ int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) { void *newBuf = taosMemoryRealloc(*ptrBuf, bufferSize); if (newBuf == NULL) { taosMemoryFreeClear(*ptrBuf); - return -1; + goto END; } *ptrBuf = newBuf; } (*ptrBuf)[totalBytesRead] = '\0'; - return totalBytesRead; + ret = totalBytesRead; #else size_t len = 0; - return getline(ptrBuf, &len, pFile->fp); + ret = getline(ptrBuf, &len, pFile->fp); #endif + + END: +#if FILE_WITH_LOCK + taosThreadRwlockUnlock(&(pFile->rwlock)); +#endif + return ret; } int64_t taosGetsFile(TdFilePtr pFile, int32_t maxSize, char *__restrict buf) { diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 8be38a811f..adde3a3331 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -23,6 +23,7 @@ #include "tlog.h" #include "tunit.h" #include "tutil.h" +#include "tglobal.h" #define CFG_NAME_PRINT_LEN 24 #define CFG_SRC_PRINT_LEN 12 @@ -432,6 +433,18 @@ int32_t cfgCheckRangeForDynUpdate(SConfig *pCfg, const char *name, const char *p } switch (pItem->dtype) { + case CFG_DTYPE_STRING:{ + if(strcasecmp(name, "slowLogScope") == 0){ + char* tmp = taosStrdup(pVal); + if(taosSetSlowLogScope(tmp) < 0){ + terrno = TSDB_CODE_INVALID_CFG; + cfgUnLock(pCfg); + taosMemoryFree(tmp); + return -1; + } + taosMemoryFree(tmp); + } + } break; case CFG_DTYPE_BOOL: { int32_t ival = (int32_t)atoi(pVal); if (ival != 0 && ival != 1) { diff --git a/source/util/src/tdecompress.c b/source/util/src/tdecompress.c index 470e43c957..aa1a8e3148 100644 --- a/source/util/src/tdecompress.c +++ b/source/util/src/tdecompress.c @@ -14,8 +14,8 @@ */ #include "os.h" -#include "ttypes.h" #include "tcompression.h" +#include "ttypes.h" int32_t getWordLength(char type) { int32_t wordLength = 0; @@ -54,7 +54,7 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, #if __AVX2__ || __AVX512F__ while (_pos < nelements) { - uint64_t w = *(uint64_t*) ip; + uint64_t w = *(uint64_t *)ip; char selector = (char)(w & INT64MASK(4)); // selector = 4 char bit = bit_per_integer[(int32_t)selector]; // bit = 3 @@ -67,22 +67,22 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, switch (type) { case TSDB_DATA_TYPE_BIGINT: { - int64_t* p = (int64_t*) output; + int64_t *p = (int64_t *)output; int32_t gRemainder = (nelements - _pos); - int32_t num = (gRemainder > elems)? elems:gRemainder; + int32_t num = (gRemainder > elems) ? elems : gRemainder; int32_t batch = 0; int32_t remain = 0; if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) { #if __AVX512F__ - batch = num >> 3; - remain = num & 0x07; + batch = num >> 3; + remain = num & 0x07; #endif } else if (tsSIMDEnable && tsAVX2Supported) { #if __AVX2__ - batch = num >> 2; - remain = num & 0x03; + batch = num >> 2; + remain = num & 0x03; #endif } @@ -90,12 +90,12 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) { #if __AVX512F__ for (int32_t i = 0; i < batch; ++i) { - __m512i prev = _mm512_set1_epi64(prevValue); - _mm512_storeu_si512((__m512i *)&p[_pos], prev); - _pos += 8; //handle 64bit x 8 = 512bit + __m512i prev = _mm512_set1_epi64(prevValue); + _mm512_storeu_si512((__m512i *)&p[_pos], prev); + _pos += 8; // handle 64bit x 8 = 512bit } for (int32_t i = 0; i < remain; ++i) { - p[_pos++] = prevValue; + p[_pos++] = prevValue; } #endif } else if (tsSIMDEnable && tsAVX2Supported) { @@ -109,7 +109,7 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, p[_pos++] = prevValue; } - } else { // alternative implementation without SIMD instructions. + } else { // alternative implementation without SIMD instructions. for (int32_t i = 0; i < elems && count < nelements; i++, count++) { p[_pos++] = prevValue; v += bit; @@ -117,69 +117,67 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, } } else { if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) { - #if __AVX512F__ +#if __AVX512F__ __m512i sum_mask1 = _mm512_set_epi64(6, 6, 4, 4, 2, 2, 0, 0); __m512i sum_mask2 = _mm512_set_epi64(5, 5, 5, 5, 1, 1, 1, 1); __m512i sum_mask3 = _mm512_set_epi64(3, 3, 3, 3, 3, 3, 3, 3); __m512i base = _mm512_set1_epi64(w); __m512i maskVal = _mm512_set1_epi64(mask); - __m512i shiftBits = _mm512_set_epi64(bit * 7 + 4, bit * 6 + 4, bit * 5 + 4, bit * 4 + 4, bit * 3 + 4, bit * 2 + 4, bit + 4, 4); + __m512i shiftBits = _mm512_set_epi64(bit * 7 + 4, bit * 6 + 4, bit * 5 + 4, bit * 4 + 4, bit * 3 + 4, + bit * 2 + 4, bit + 4, 4); __m512i inc = _mm512_set1_epi64(bit << 3); for (int32_t i = 0; i < batch; ++i) { + __m512i after = _mm512_srlv_epi64(base, shiftBits); + __m512i zigzagVal = _mm512_and_si512(after, maskVal); - __m512i after = _mm512_srlv_epi64(base, shiftBits); - __m512i zigzagVal = _mm512_and_si512(after, maskVal); + // ZIGZAG_DECODE(T, v) (((v) >> 1) ^ -((T)((v)&1))) + __m512i signmask = _mm512_and_si512(_mm512_set1_epi64(1), zigzagVal); + signmask = _mm512_sub_epi64(_mm512_setzero_si512(), signmask); + __m512i delta = _mm512_xor_si512(_mm512_srli_epi64(zigzagVal, 1), signmask); - // ZIGZAG_DECODE(T, v) (((v) >> 1) ^ -((T)((v)&1))) - __m512i signmask = _mm512_and_si512(_mm512_set1_epi64(1), zigzagVal); - signmask = _mm512_sub_epi64(_mm512_setzero_si512(), signmask); - __m512i delta = _mm512_xor_si512(_mm512_srli_epi64(zigzagVal, 1), signmask); + // calculate the cumulative sum (prefix sum) for each number + // decode[0] = prevValue + final[0] + // decode[1] = decode[0] + final[1] -----> prevValue + final[0] + final[1] + // decode[2] = decode[1] + final[2] -----> prevValue + final[0] + final[1] + final[2] + // decode[3] = decode[2] + final[3] -----> prevValue + final[0] + final[1] + final[2] + final[3] - // calculate the cumulative sum (prefix sum) for each number - // decode[0] = prevValue + final[0] - // decode[1] = decode[0] + final[1] -----> prevValue + final[0] + final[1] - // decode[2] = decode[1] + final[2] -----> prevValue + final[0] + final[1] + final[2] - // decode[3] = decode[2] + final[3] -----> prevValue + final[0] + final[1] + final[2] + final[3] + // 7 6 5 4 3 2 1 + // 0 D7 D6 D5 D4 D3 D2 D1 + // D0 D6 0 D4 0 D2 0 D0 + // 0 D7+D6 D6 D5+D4 D4 D3+D2 D2 + // D1+D0 D0 13 6 9 4 5 2 + // 1 0 + __m512i prev = _mm512_set1_epi64(prevValue); + __m512i cum_sum = _mm512_add_epi64(delta, _mm512_maskz_permutexvar_epi64(0xaa, sum_mask1, delta)); + cum_sum = _mm512_add_epi64(cum_sum, _mm512_maskz_permutexvar_epi64(0xcc, sum_mask2, cum_sum)); + cum_sum = _mm512_add_epi64(cum_sum, _mm512_maskz_permutexvar_epi64(0xf0, sum_mask3, cum_sum)); + // 13 6 9 4 5 2 1 + // 0 D7,D6 D6 D5,D4 D4 D3,D2 D2 + // D1,D0 D0 +D5,D4 D5,D4, 0 0 D1,D0 D1,D0 + //0 0 D7~D4 D6~D4 D5~D4 D4 D3~D0 D2~D0 + // D1~D0 D0 22 15 9 4 6 3 + // 1 0 + // + // D3~D0 D3~D0 D3~D0 D3~D0 0 0 0 + // 0 28 21 15 10 6 3 1 + // 0 - //7 6 5 4 3 2 1 0 - //D7 D6 D5 D4 D3 D2 D1 D0 - //D6 0 D4 0 D2 0 D0 0 - //D7+D6 D6 D5+D4 D4 D3+D2 D2 D1+D0 D0 - //13 6 9 4 5 2 1 0 - __m512i prev = _mm512_set1_epi64(prevValue); - __m512i cum_sum = _mm512_add_epi64(delta, _mm512_maskz_permutexvar_epi64(0xaa, sum_mask1, delta)); - cum_sum = _mm512_add_epi64(cum_sum, _mm512_maskz_permutexvar_epi64(0xcc, sum_mask2, cum_sum)); - cum_sum = _mm512_add_epi64(cum_sum, _mm512_maskz_permutexvar_epi64(0xf0, sum_mask3, cum_sum)); - - - - //13 6 9 4 5 2 1 0 - //D7,D6 D6 D5,D4 D4 D3,D2 D2 D1,D0 D0 - //+D5,D4 D5,D4, 0 0 D1,D0 D1,D0 0 0 - //D7~D4 D6~D4 D5~D4 D4 D3~D0 D2~D0 D1~D0 D0 - //22 15 9 4 6 3 1 0 - // - //D3~D0 D3~D0 D3~D0 D3~D0 0 0 0 0 - //28 21 15 10 6 3 1 0 - - - cum_sum = _mm512_add_epi64(cum_sum, prev); - _mm512_storeu_si512((__m512i *)&p[_pos], cum_sum); - - shiftBits = _mm512_add_epi64(shiftBits, inc); - prevValue = p[_pos + 7]; - _pos += 8; + cum_sum = _mm512_add_epi64(cum_sum, prev); + _mm512_storeu_si512((__m512i *)&p[_pos], cum_sum); + shiftBits = _mm512_add_epi64(shiftBits, inc); + prevValue = p[_pos + 7]; + _pos += 8; } // handle the remain value for (int32_t i = 0; i < remain; i++) { - zigzag_value = ((w >> (v + (batch * bit * 8))) & mask); - prevValue += ZIGZAG_DECODE(int64_t, zigzag_value); + zigzag_value = ((w >> (v + (batch * bit * 8))) & mask); + prevValue += ZIGZAG_DECODE(int64_t, zigzag_value); - p[_pos++] = prevValue; - v += bit; + p[_pos++] = prevValue; + v += bit; } #endif } else if (tsSIMDEnable && tsAVX2Supported) { @@ -255,7 +253,7 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, } } break; case TSDB_DATA_TYPE_INT: { - int32_t* p = (int32_t*) output; + int32_t *p = (int32_t *)output; if (selector == 0 || selector == 1) { for (int32_t i = 0; i < elems && count < nelements; i++, count++) { @@ -272,7 +270,7 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, } } break; case TSDB_DATA_TYPE_SMALLINT: { - int16_t* p = (int16_t*) output; + int16_t *p = (int16_t *)output; if (selector == 0 || selector == 1) { for (int32_t i = 0; i < elems && count < nelements; i++, count++) { @@ -317,7 +315,7 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, int32_t tsDecompressFloatImplAvx512(const char *const input, const int32_t nelements, char *const output) { #if __AVX512F__ - // todo add it + // todo add it #endif return 0; } @@ -336,12 +334,12 @@ int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelemen int32_t ipos = 1, opos = 0; #if __AVX2__ - __m128i prevVal = _mm_setzero_si128(); - __m128i prevDelta = _mm_setzero_si128(); + __m128i prevVal = _mm_setzero_si128(); + __m128i prevDelta = _mm_setzero_si128(); int32_t batch = nelements >> 1; int32_t remainder = nelements & 0x01; -// __mmask16 mask2[16] = {0, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff}; + // __mmask16 mask2[16] = {0, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff}; int32_t i = 0; if (batch > 1) { @@ -354,14 +352,14 @@ int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelemen __m128i data1 = _mm_setzero_si128(); if (nbytes1 > 0) { int64_t tmp = 0; - memcpy(&tmp, (const void*) (input + ipos), nbytes1); + memcpy(&tmp, (const void *)(input + ipos), nbytes1); data1 = _mm_set1_epi64x(tmp); } __m128i data2 = _mm_setzero_si128(); if (nbytes2 > 0) { int64_t tmp = 0; - memcpy(&tmp, (const void*) (input + ipos + nbytes1), nbytes2); + memcpy(&tmp, (const void *)(input + ipos + nbytes1), nbytes2); data2 = _mm_set1_epi64x(tmp); } @@ -382,7 +380,7 @@ int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelemen _mm_storeu_si128((__m128i *)&ostream[opos], finalVal); // keep the previous value - prevVal = _mm_shuffle_epi32 (finalVal, 0xEE); + prevVal = _mm_shuffle_epi32(finalVal, 0xEE); // keep the previous delta of delta, for the first item prevDelta = _mm_shuffle_epi32(deltaOfDelta, 0xEE); @@ -393,7 +391,7 @@ int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelemen } // the remain - for(; i < batch; ++i) { + for (; i < batch; ++i) { uint8_t flags = input[ipos++]; int8_t nbytes1 = flags & INT8MASK(4); // range of nbytes starts from 0 to 7 @@ -402,14 +400,14 @@ int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelemen __m128i data1 = _mm_setzero_si128(); if (nbytes1 > 0) { int64_t dd = 0; - memcpy(&dd, (const void*) (input + ipos), nbytes1); + memcpy(&dd, (const void *)(input + ipos), nbytes1); data1 = _mm_loadu_si64(&dd); } __m128i data2 = _mm_setzero_si128(); if (nbytes2 > 0) { int64_t dd = 0; - memcpy(&dd, (const void*) (input + ipos + nbytes1), nbytes2); + memcpy(&dd, (const void *)(input + ipos + nbytes1), nbytes2); data2 = _mm_loadu_si64(&dd); } @@ -433,10 +431,10 @@ int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelemen _mm_storeu_si128((__m128i *)&ostream[opos], finalVal); // keep the previous value - prevVal = _mm_shuffle_epi32 (finalVal, 0xEE); + prevVal = _mm_shuffle_epi32(finalVal, 0xEE); // keep the previous delta of delta - prevDelta = _mm_shuffle_epi32 (deltaCurrent, 0xEE); + prevDelta = _mm_shuffle_epi32(deltaCurrent, 0xEE); opos += 2; ipos += nbytes1 + nbytes2; @@ -478,8 +476,8 @@ int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelem #if __AVX512VL__ - __m128i prevVal = _mm_setzero_si128(); - __m128i prevDelta = _mm_setzero_si128(); + __m128i prevVal = _mm_setzero_si128(); + __m128i prevDelta = _mm_setzero_si128(); int32_t numOfBatch = nelements >> 1; int32_t remainder = nelements & 0x01; @@ -493,8 +491,8 @@ int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelem int8_t nbytes1 = flags & INT8MASK(4); // range of nbytes starts from 0 to 7 int8_t nbytes2 = (flags >> 4) & INT8MASK(4); - __m128i data1 = _mm_maskz_loadu_epi8(mask2[nbytes1], (const void*)(input + ipos)); - __m128i data2 = _mm_maskz_loadu_epi8(mask2[nbytes2], (const void*)(input + ipos + nbytes1)); + __m128i data1 = _mm_maskz_loadu_epi8(mask2[nbytes1], (const void *)(input + ipos)); + __m128i data2 = _mm_maskz_loadu_epi8(mask2[nbytes2], (const void *)(input + ipos + nbytes1)); data2 = _mm_broadcastq_epi64(data2); __m128i zzVal = _mm_blend_epi32(data2, data1, 0x03); @@ -513,7 +511,7 @@ int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelem _mm_storeu_si128((__m128i *)&ostream[opos], val); // keep the previous value - prevVal = _mm_shuffle_epi32 (val, 0xEE); + prevVal = _mm_shuffle_epi32(val, 0xEE); // keep the previous delta of delta, for the first item prevDelta = _mm_shuffle_epi32(deltaOfDelta, 0xEE); @@ -524,14 +522,14 @@ int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelem } // the remain - for(; i < numOfBatch; ++i) { + for (; i < numOfBatch; ++i) { uint8_t flags = input[ipos++]; int8_t nbytes1 = flags & INT8MASK(4); // range of nbytes starts from 0 to 7 int8_t nbytes2 = (flags >> 4) & INT8MASK(4); - __m128i data1 = _mm_maskz_loadu_epi8(mask2[nbytes1], (const void*)(input + ipos)); - __m128i data2 = _mm_maskz_loadu_epi8(mask2[nbytes2], (const void*)(input + ipos + nbytes1)); + __m128i data1 = _mm_maskz_loadu_epi8(mask2[nbytes1], (const void *)(input + ipos)); + __m128i data2 = _mm_maskz_loadu_epi8(mask2[nbytes2], (const void *)(input + ipos + nbytes1)); data2 = _mm_broadcastq_epi64(data2); __m128i zzVal = _mm_blend_epi32(data2, data1, 0x03); @@ -550,7 +548,7 @@ int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelem _mm_storeu_si128((__m128i *)&ostream[opos], val); // keep the previous value - prevVal = _mm_shuffle_epi32 (val, 0xEE); + prevVal = _mm_shuffle_epi32(val, 0xEE); // keep the previous delta of delta __m128i delta = _mm_add_epi64(_mm_slli_si128(deltaOfDelta, 8), deltaOfDelta); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 277763663e..b9edcf8680 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -53,7 +53,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_TIMEOUT, "Conn read timeout") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED, "some vnode/qnode/mnode(s) out of service") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MAX_SESSIONS, "rpc open too many session") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_ERROR, "rpc network error") -TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_BUSY, "rpc network busy") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_BUSY, "rpc network busy") //common & util TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized") @@ -222,7 +222,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_COLUMN_NOT_EXIST, "Column does not exist TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STB_OPTION, "Invalid stable options") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ROW_BYTES, "Invalid row bytes") // TAOS_DEFINE_ERROR(TSDB_CODE_MND_FIELD_VALUE_OVERFLOW, "out of range and overflow") // unused -TAOS_DEFINE_ERROR(TSDB_CODE_MND_COLUMN_COMPRESS_ALREADY_EXIST, "Same with old param") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_COLUMN_COMPRESS_ALREADY_EXIST, "Same with old param") // mnode-func @@ -304,6 +304,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL, "Unable to establish c TAOS_DEFINE_ERROR(TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED, "Last Transaction not finished") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_SYNC_TIMEOUT, "Sync timeout While execute transaction and will continue in the background") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CTX_SWITCH, "Transaction context switch") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CONFLICT_COMPACT, "Transaction not completed due to conflict with compact") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_UNKNOW_ERROR, "Unknown transaction error") // mnode-mq @@ -372,6 +373,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_ENCRYPTKEY, "invalid encryption ke TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_ENCRYPTKEY_CHANGED, "encryption key was changed") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_ENCRYPT_KLEN, "Invalid encryption key length") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_STATUS_INTERVAL,"statusInterval not match") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_MONITOR_PARAS, "monitor paras not match") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_TIMEZONE, "timezone not match") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_CHARSET, "charset not match") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_LOCALE, "locale not match") @@ -674,6 +676,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COL_PK_TYPE, "primary key column TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PK_OP, "primary key column can not be added, modified, and dropped") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL, "Primary key column should not be null") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PRIMARY_KEY_IS_NONE, "Primary key column should not be none") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TBNAME_ERROR, "Pseudo tag tbname not set") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TBNAME_DUPLICATED, "Table name duplicated") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_NAME_DUPLICATED, "Tag name duplicated") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error") //planner diff --git a/tests/army/cmdline/fullopt.py b/tests/army/cmdline/fullopt.py index e61501d7b8..77a22b9256 100644 --- a/tests/army/cmdline/fullopt.py +++ b/tests/army/cmdline/fullopt.py @@ -70,7 +70,6 @@ class TDTestCase(TBase): "smlTagName tagname", "smlTsDefaultName tsdef", "serverPort 6030", - "slowLogScope insert", "timezone tz", "tempDir /var/tmp" ] diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index b96c8eb030..533923ec73 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1488,12 +1488,14 @@ ,,y,script,./test.sh -f tmp/monitor.sim ,,y,script,./test.sh -f tsim/tagindex/add_index.sim ,,n,script,./test.sh -f tsim/tagindex/sma_and_tag_index.sim +,,y,script,./test.sh -f tsim/tagindex/indexOverflow.sim ,,y,script,./test.sh -f tsim/view/view.sim ,,y,script,./test.sh -f tsim/query/cache_last.sim ,,y,script,./test.sh -f tsim/query/const.sim ,,y,script,./test.sh -f tsim/query/nestedJoinView.sim + #develop test ,,n,develop-test,python3 ./test.py -f 2-query/table_count_scan.py ,,n,develop-test,python3 ./test.py -f 2-query/pseudo_column.py diff --git a/tests/script/tsim/show/basic.sim b/tests/script/tsim/show/basic.sim index 8990e492fa..4b2e33b45e 100644 --- a/tests/script/tsim/show/basic.sim +++ b/tests/script/tsim/show/basic.sim @@ -230,7 +230,7 @@ endi sql_error show create stable t0; sql show variables; -if $rows != 4 then +if $rows != 9 then return -1 endi diff --git a/tests/script/tsim/tagindex/indexOverflow.sim b/tests/script/tsim/tagindex/indexOverflow.sim new file mode 100644 index 0000000000..9e297099d1 --- /dev/null +++ b/tests/script/tsim/tagindex/indexOverflow.sim @@ -0,0 +1,82 @@ + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ======== step0 +$dbPrefix = ta_3_db +$tbPrefix = ta_3_tb +$mtPrefix = ta_3_mt +$lastRowNum = 0 +$tbNum = 100000 +$rowNum = 20 +$totalNum = 200 + +print =============== create database +sql create database $dbPrefix +sql use $dbPrefix + + + +sql create table if not exists $mtPrefix (ts timestamp, c1 int) tags (t1 tinyint, t1c tinyint) +$i = 0 +$tinyLimit = 127 +$tinyTable = tinyTable +while $i < $tinyLimit + $tb = $tinyTable . $i + sql insert into $tb using $mtPrefix tags( $i , $i ) values( now , $i ) + $i = $i + 1 +endw + +$i = 0 +$maxTinyLimit = 200 + +# 1. compress index and no-index to verify resultset +# 2. compress resultset of index filter and scalar filter +while $i < $maxTinyLimit + sql select * from $mtPrefix where t1 <= $i + $lastRowNum = $rows + + sql select * from $mtPrefix where t1c <= $i + if $lastRowNum != $rows then + return -1 + endi + + $i = $i + 1 +endw + + +$tbPrefix = ta_3_tb_c +$mtPrefix = ta_3_mt_c +$colPrefix = 'col' +sql create table if not exists $mtPrefix (ts timestamp, c1 int) tags (t1 nchar(18), t1c nchar(18)) +$i = 0 +$tinyLimit = 127 +while $i < $tinyLimit + $tb = $tbPrefix . $i + sql insert into $tb using $mtPrefix tags( $colPrefix , $colPrefix ) values( now , $i ) + $i = $i + 1 +endw + +$i = 0 +$maxTinyLimit = 200 + +# 1. compress index and no-index to verify resultset +# 2. compress resultset of index filter and scalar filter +while $i < $maxTinyLimit + sql select * from $mtPrefix where t1 <= $i + $lastRowNum = $rows + + sql select * from $mtPrefix where t1c <= $i + if $lastRowNum != $rows then + return -1 + endi + + $i = $i + 1 +endw + + + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/valgrind/checkError1.sim b/tests/script/tsim/valgrind/checkError1.sim index debe633f06..5629fbb4bd 100644 --- a/tests/script/tsim/valgrind/checkError1.sim +++ b/tests/script/tsim/valgrind/checkError1.sim @@ -120,7 +120,7 @@ if $rows != 3 then endi sql show variables; -if $rows != 4 then +if $rows != 9 then return -1 endi diff --git a/tests/script/win-test-file b/tests/script/win-test-file index d51de0a61b..acc4c74d21 100644 --- a/tests/script/win-test-file +++ b/tests/script/win-test-file @@ -401,6 +401,7 @@ ./test.sh -f tsim/tag/tbNameIn.sim ./test.sh -f tmp/monitor.sim ./test.sh -f tsim/tagindex/add_index.sim +./test.sh -f tsim/tagindex/indexOverflow.sim ./test.sh -f tsim/tagindex/sma_and_tag_index.sim ./test.sh -f tsim/view/view.sim ./test.sh -f tsim/query/cache_last.sim diff --git a/tests/system-test/2-query/To_iso8601.py b/tests/system-test/2-query/To_iso8601.py index 160473ffce..24865ada88 100644 --- a/tests/system-test/2-query/To_iso8601.py +++ b/tests/system-test/2-query/To_iso8601.py @@ -19,6 +19,61 @@ class TDTestCase: self.dbname = 'db' self.stbname = f'{self.dbname}.stb' self.ntbname = f'{self.dbname}.ntb' + def check_timestamp_precision(self): + time_zone = time.strftime('%z') + tdSql.execute(f'drop database if exists {self.dbname}') + tdSql.execute(f'create database {self.dbname} precision "us"') + tdSql.execute(f'use {self.dbname}') + tdSql.execute(f'create table if not exists {self.ntbname}(ts timestamp, c1 int, c2 timestamp)') + tdSql.execute(f'insert into {self.ntbname} values(now,1,today())') + ts_list = ['1', '11', '111', '1111', '11111', '111111', '1111111', '11111111', '111111111', '1111111111', + '11111111111','111111111111','1111111111111','11111111111111','111111111111111','1111111111111111', + '11111111111111111','111111111111111111','1111111111111111111'] + res_list_ms = ['1970-01-01T08:00:00.001+0800', '1970-01-01T08:00:00.011+0800', '1970-01-01T08:00:00.111+0800', + '1970-01-01T08:00:01.111+0800', '1970-01-01T08:00:11.111+0800', '1970-01-01T08:01:51.111+0800', + '1970-01-01T08:18:31.111+0800', '1970-01-01T11:05:11.111+0800', '1970-01-02T14:51:51.111+0800', + '1970-01-14T04:38:31.111+0800', '1970-05-09T22:25:11.111+0800', '1973-07-10T08:11:51.111+0800', + '2005-03-18T09:58:31.111+0800', '2322-02-06T03:45:11.111+0800', '5490-12-21T13:31:51.111+0800', + '37179-09-17T15:18:31.111+0800', '354067-02-04T09:05:11.111+0800', + '3522940-12-11T18:51:51.111+0800', '35211679-06-14T20:38:31.111+0800'] + res_list_us = ['1970-01-01T08:00:00.000001+0800', '1970-01-01T08:00:00.000011+0800', + '1970-01-01T08:00:00.000111+0800', '1970-01-01T08:00:00.001111+0800', + '1970-01-01T08:00:00.011111+0800', '1970-01-01T08:00:00.111111+0800', + '1970-01-01T08:00:01.111111+0800', '1970-01-01T08:00:11.111111+0800', + '1970-01-01T08:01:51.111111+0800', '1970-01-01T08:18:31.111111+0800', + '1970-01-01T11:05:11.111111+0800', '1970-01-02T14:51:51.111111+0800', + '1970-01-14T04:38:31.111111+0800', '1970-05-09T22:25:11.111111+0800', + '1973-07-10T08:11:51.111111+0800', '2005-03-18T09:58:31.111111+0800', + '2322-02-06T03:45:11.111111+0800', '5490-12-21T13:31:51.111111+0800', + '37179-09-17T15:18:31.111111+0800'] + res_list_ns = ['1970-01-01T08:00:00.000000001+0800', '1970-01-01T08:00:00.000000011+0800', + '1970-01-01T08:00:00.000000111+0800', '1970-01-01T08:00:00.000001111+0800', + '1970-01-01T08:00:00.000011111+0800', '1970-01-01T08:00:00.000111111+0800', + '1970-01-01T08:00:00.001111111+0800', '1970-01-01T08:00:00.011111111+0800', + '1970-01-01T08:00:00.111111111+0800', '1970-01-01T08:00:01.111111111+0800', + '1970-01-01T08:00:11.111111111+0800', '1970-01-01T08:01:51.111111111+0800', + '1970-01-01T08:18:31.111111111+0800', '1970-01-01T11:05:11.111111111+0800', + '1970-01-02T14:51:51.111111111+0800', '1970-01-14T04:38:31.111111111+0800', + '1970-05-09T22:25:11.111111111+0800', '1973-07-10T08:11:51.111111111+0800', + '2005-03-18T09:58:31.111111111+0800'] + # test to_iso8601's precision with default precision 'ms' + for i in range(len(ts_list)): + tdSql.query(f'select to_iso8601({ts_list[i]})') + tdSql.checkEqual(tdSql.queryResult[0][0],res_list_ms[i]) + # test to_iso8601's precision with table's precision 'us' + for i in range(len(ts_list)): + tdSql.query(f'select to_iso8601({ts_list[i]}) from {self.ntbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],res_list_us[i]) + + tdSql.execute(f'drop database if exists {self.dbname}') + tdSql.execute(f'create database {self.dbname} precision "ns"') + tdSql.execute(f'use {self.dbname}') + tdSql.execute(f'create table if not exists {self.ntbname}(ts timestamp, c1 int, c2 timestamp)') + tdSql.execute(f'insert into {self.ntbname} values(now,1,today())') + # test to_iso8601's precision with table's precision 'ns' + for i in range(len(ts_list)): + tdSql.query(f'select to_iso8601({ts_list[i]}) from {self.ntbname}') + tdSql.checkEqual(tdSql.queryResult[0][0],res_list_ns[i]) def check_customize_param_ms(self): time_zone = time.strftime('%z') tdSql.execute(f'drop database if exists {self.dbname}') @@ -65,7 +120,7 @@ class TDTestCase: tdSql.checkRows(1) for i in range(0,3): tdSql.query("select to_iso8601(1) from db.ntb") - tdSql.checkData(i,0,"1970-01-01T08:00:01+0800") + tdSql.checkData(i,0,"1970-01-01T08:00:00.001+0800") tdSql.checkRows(3) tdSql.query("select to_iso8601(ts) from db.ntb") tdSql.checkRows(3) @@ -97,7 +152,7 @@ class TDTestCase: tdSql.checkRows(3) tdSql.query("select to_iso8601(1) from db.stb") for i in range(0,3): - tdSql.checkData(i,0,"1970-01-01T08:00:01+0800") + tdSql.checkData(i,0,"1970-01-01T08:00:00.001+0800") tdSql.checkRows(3) tdSql.query("select to_iso8601(ts) from db.stb") tdSql.checkRows(3) @@ -113,6 +168,7 @@ class TDTestCase: def run(self): # sourcery skip: extract-duplicate-method self.check_base_function() self.check_customize_param_ms() + self.check_timestamp_precision() def stop(self): tdSql.close() diff --git a/tests/system-test/2-query/db.py b/tests/system-test/2-query/db.py index cfe224acb0..e2c056cd5b 100644 --- a/tests/system-test/2-query/db.py +++ b/tests/system-test/2-query/db.py @@ -45,7 +45,7 @@ class TDTestCase: def case2(self): tdSql.query("show variables") - tdSql.checkRows(4) + tdSql.checkRows(9) for i in range(self.replicaVar): tdSql.query("show dnode %d variables like 'debugFlag'" % (i + 1)) diff --git a/tests/system-test/2-query/timetruncate.py b/tests/system-test/2-query/timetruncate.py index 09bdfcef63..67a71cde17 100644 --- a/tests/system-test/2-query/timetruncate.py +++ b/tests/system-test/2-query/timetruncate.py @@ -22,6 +22,7 @@ class TDTestCase: '2020-4-1 00:00:00.001002', '2020-5-1 00:00:00.001002001' ] + self.unix_ts = ['1','1111','1111111','1111111111','1111111111111'] self.db_param_precision = ['ms','us','ns'] self.time_unit = ['1w','1d','1h','1m','1s','1a','1u','1b'] self.error_unit = ['2w','2d','2h','2m','2s','2a','2u','1c','#1'] @@ -134,7 +135,7 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60/24)*24*60*60*1000*1000*1000 ) else: # assuming the client timezone is UTC+0800 - tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i] - (date_time[i] + 8 * 3600 * 1000000) % (86400 * 1000000))) + tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i] - (date_time[i] + 8 * 3600 * 1000000000) % (86400 * 1000000000))) elif unit.lower() == '1w': for i in range(len(self.ts_str)): if self.rest_tag != 'rest': @@ -167,16 +168,49 @@ class TDTestCase: self.check_tb_type(unit,tb_type,ignore_tz) tdSql.checkRows(len(self.ts_str)) self.check_ms_timestamp(unit,date_time,ignore_tz) + for uts in self.unix_ts: + ans_time = [] + if tb_type.lower() == 'ntb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.ntbname}') + elif tb_type.lower() == 'ctb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.ctbname}') + elif tb_type.lower() == 'stb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.stbname}') + for i in range(len(self.ts_str)): + ans_time.append(int(uts)) + self.check_ms_timestamp(unit, ans_time, ignore_tz) elif precision.lower() == 'us': for ignore_tz in tz_options: self.check_tb_type(unit,tb_type,ignore_tz) tdSql.checkRows(len(self.ts_str)) self.check_us_timestamp(unit,date_time,ignore_tz) + for uts in self.unix_ts: + ans_time = [] + if tb_type.lower() == 'ntb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.ntbname}') + elif tb_type.lower() == 'ctb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.ctbname}') + elif tb_type.lower() == 'stb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.stbname}') + for i in range(len(self.ts_str)): + ans_time.append(int(uts)) + self.check_us_timestamp(unit, ans_time, ignore_tz) elif precision.lower() == 'ns': for ignore_tz in tz_options: self.check_tb_type(unit,tb_type, ignore_tz) tdSql.checkRows(len(self.ts_str)) self.check_ns_timestamp(unit,date_time,ignore_tz) + for uts in self.unix_ts: + ans_time = [] + if tb_type.lower() == 'ntb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.ntbname}') + elif tb_type.lower() == 'ctb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.ctbname}') + elif tb_type.lower() == 'stb': + tdSql.query(f'select timetruncate({uts},{unit},{ignore_tz}) from {self.stbname}') + for i in range(len(self.ts_str)): + ans_time.append(int(uts)) + self.check_ns_timestamp(unit, ans_time, ignore_tz) for unit in self.error_unit: if tb_type.lower() == 'ntb': tdSql.error(f'select timetruncate(ts,{unit}) from {self.ntbname}') diff --git a/tests/system-test/7-tmq/tmq_primary_key.py b/tests/system-test/7-tmq/tmq_primary_key.py index 7d0d3da4fc..80888ddbe6 100644 --- a/tests/system-test/7-tmq/tmq_primary_key.py +++ b/tests/system-test/7-tmq/tmq_primary_key.py @@ -12,6 +12,7 @@ from util.dnodes import * from util.common import * from taos.tmq import * from util.dnodes import * +from util.cluster import * import datetime sys.path.append("./7-tmq") @@ -137,6 +138,7 @@ class TDTestCase: print("index:" + str(index)) finally: consumer.close() + tdSql.execute(f'drop topic topic_pk_query;') def primaryKeyTestIntStable(self): print("==============Case 2: primary key test int for stable") @@ -247,6 +249,7 @@ class TDTestCase: print("index:" + str(index)) finally: consumer.close() + tdSql.execute(f'drop topic topic_pk_stable;') def primaryKeyTestInt(self): print("==============Case 3: primary key test int for db") @@ -356,6 +359,7 @@ class TDTestCase: print("index:" + str(index)) finally: consumer.close() + tdSql.execute(f'drop topic topic_in;') def primaryKeyTestString(self): print("==============Case 4: primary key test string for db") @@ -468,12 +472,90 @@ class TDTestCase: print("index:" + str(index)) finally: consumer.close() + tdSql.execute(f'drop topic topic_pk_string;') + def primaryKeyTestTD_30755(self): + print("==============Case 5: primary key test td-30755 for query") + tdSql.execute(f'create database if not exists db_pk_query_30755 vgroups 1 wal_retention_period 3600;') + tdSql.execute(f'use db_pk_query_30755;') + tdSql.execute(f'create table if not exists pk (ts timestamp, c1 int primary key, c2 int);') + for i in range(0, 100000): + tdSql.execute(f'insert into pk values(1669092069068, {i}, 1);') + tdSql.execute(f'flush database db_pk_query_30755') + + tdSql.execute(f'create topic topic_pk_query_30755 as select * from pk') + + consumer_dict = { + "group.id": "g1", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "auto.offset.reset": "earliest", + "enable.auto.commit": "false", + "experimental.snapshot.enable": "true", + } + consumer = Consumer(consumer_dict) + + try: + consumer.subscribe(["topic_pk_query_30755"]) + except TmqError: + tdLog.exit(f"subscribe error") + + firstConsume = 0 + try: + while firstConsume < 50000: + res = consumer.poll(1) + if not res: + continue + val = res.value() + if val is None: + continue + for block in val: + data = block.fetchall() + firstConsume += len(data) + consumer.commit(res) + finally: + consumer.close() + + tdSql.query(f'show subscriptions;') + sub = tdSql.getData(0, 4); + print(sub) + if not sub.startswith("tsdb"): + tdLog.exit(f"show subscriptions error") + + tdDnodes.stop(1) + time.sleep(2) + tdDnodes.start(1) + + consumer = Consumer(consumer_dict) + + tdSql.execute(f'use db_pk_query_30755;') + try: + consumer.subscribe(["topic_pk_query_30755"]) + except TmqError: + tdLog.exit(f"subscribe error") + + secondConsume = 0 + try: + while firstConsume + secondConsume < 100000: + res = consumer.poll(1) + if not res: + continue + val = res.value() + if val is None: + continue + for block in val: + data = block.fetchall() + secondConsume += len(data) + consumer.commit(res) + finally: + consumer.close() + tdSql.execute(f'drop topic topic_pk_query_30755;') def run(self): self.primaryKeyTestIntQuery() self.primaryKeyTestIntStable() self.primaryKeyTestInt() self.primaryKeyTestString() + self.primaryKeyTestTD_30755() def stop(self): tdSql.close() diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index 49b62d8abb..d30d88bb1c 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -516,17 +516,17 @@ class TDTestCase: "td.connect.pass": "taosdata", "auto.offset.reset": "earliest", } - consumer = Consumer(consumer_dict) + consumer1 = Consumer(consumer_dict) try: - consumer.subscribe(["t1"]) + consumer1.subscribe(["t1"]) except TmqError: tdLog.exit(f"subscribe error") index = 0 try: while True: - res = consumer.poll(1) + res = consumer1.poll(1) if not res: if index != 1: tdLog.exit("consume error") @@ -543,18 +543,85 @@ class TDTestCase: index += 1 finally: - consumer.close() + consumer1.close() - consumer1 = Consumer(consumer_dict) + consumer2 = Consumer(consumer_dict) try: - consumer1.subscribe(["t2"]) + consumer2.subscribe(["t2"]) except TmqError: tdLog.exit(f"subscribe error") + tdSql.query(f'show subscriptions') + tdSql.checkRows(2) + tdSql.checkData(0, 0, "t2") + tdSql.checkData(0, 1, 'g1') + tdSql.checkData(1, 0, 't1') + tdSql.checkData(1, 1, 'g1') + + tdSql.query(f'show consumers') + tdSql.checkRows(1) + tdSql.checkData(0, 1, 'g1') + tdSql.checkData(0, 4, 't2') tdSql.execute(f'drop consumer group g1 on t1') tdSql.query(f'show consumers') tdSql.checkRows(1) - consumer1.close() + tdSql.checkData(0, 1, 'g1') + tdSql.checkData(0, 4, 't2') + + tdSql.query(f'show subscriptions') + tdSql.checkRows(1) + tdSql.checkData(0, 0, "t2") + tdSql.checkData(0, 1, 'g1') + + index = 0 + try: + while True: + res = consumer2.poll(1) + if not res: + if index != 1: + tdLog.exit("consume error") + break + val = res.value() + if val is None: + continue + cnt = 0; + for block in val: + cnt += len(block.fetchall()) + + if cnt != 8: + tdLog.exit("consume error") + + index += 1 + finally: + consumer2.close() + + consumer3 = Consumer(consumer_dict) + try: + consumer3.subscribe(["t2"]) + except TmqError: + tdLog.exit(f"subscribe error") + + tdSql.query(f'show consumers') + tdSql.checkRows(1) + tdSql.checkData(0, 1, 'g1') + tdSql.checkData(0, 4, 't2') + + tdSql.execute(f'insert into t4 using st tags(3) values(now, 1)') + try: + res = consumer3.poll(1) + if not res: + tdLog.exit("consume1 error") + finally: + consumer3.close() + + tdSql.query(f'show consumers') + tdSql.checkRows(0) + + tdSql.query(f'show subscriptions') + tdSql.checkRows(1) + tdSql.checkData(0, 0, "t2") + tdSql.checkData(0, 1, 'g1') + tdSql.execute(f'drop topic t1') tdSql.execute(f'drop topic t2') tdSql.execute(f'drop database d1')