diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 165d203a22..f308db759d 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -424,7 +424,7 @@ pipeline { echo "${WKDIR}/restore.sh -p ${BRANCH_NAME} -n ${BUILD_ID} -c {container name}" } catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - timeout(time: 130, unit: 'MINUTES'){ + timeout(time: 150, unit: 'MINUTES'){ pre_test() script { sh ''' diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index 340a3e917b..18c7ffc345 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -483,6 +483,91 @@ return_timestamp: { - The precision of the returned timestamp is same as the precision set for the current data base in use - return_timestamp indicates whether the returned value type is TIMESTAMP or not. If this parameter set to 1, function will return TIMESTAMP type. Otherwise function will return BIGINT type. If parameter is omitted, default return value type is BIGINT. +#### TO_CHAR + +```sql +TO_CHAR(ts, format_str_literal) +``` + +**Description**: Convert a ts column to string as the format specified + +**Return value type**: VARCHAR + +**Applicable column types**: TIMESTAMP + +**Nested query**: It can be used in both the outer query and inner query in a nested query. + +**Applicable table types**: standard tables and supertables + +**Supported Formats** + +| **Format** | **Comment**| **example** | +| --- | --- | --- | +|AM,am,PM,pm| Meridiem indicator(without periods) | 07:00:00am| +|A.M.,a.m.,P.M.,p.m.| Meridiem indicator(with periods)| 07:00:00a.m.| +|YYYY,yyyy|year, 4 or more digits| 2023-10-10| +|YYY,yyy| year, last 3 digits| 023-10-10| +|YY,yy| year, last 2 digits| 23-10-10| +|Y,y| year, last digit| 3-10-10| +|MONTH|full uppercase of month| 2023-JANUARY-01| +|Month|full capitalized month| 2023-January-01| +|month|full lowercase of month| 2023-january-01| +|MON| abbreviated uppercase of month(3 char)| JAN, SEP| +|Mon| abbreviated capitalized month| Jan, Sep| +|mon|abbreviated lowercase of month| jan, sep| +|MM,mm|month number 01-12|2023-01-01| +|DD,dd|month day, 01-31|| +|DAY|full uppercase of week day|MONDAY| +|Day|full capitalized week day|Monday| +|day|full lowercase of week day|monday| +|DY|abbreviated uppercase of week day|MON| +|Dy|abbreviated capitalized week day|Mon| +|dy|abbreviated lowercase of week day|mon| +|DDD|year day, 001-366|| +|D,d|week day number, 1-7, Sunday(1) to Saturday(7)|| +|HH24,hh24|hour of day, 00-23|2023-01-30 23:59:59| +|hh12,HH12, hh, HH| hour of day, 01-12|2023-01-30 12:59:59PM| +|MI,mi|minute, 00-59|| +|SS,ss|second, 00-59|| +|MS,ms|milli second, 000-999|| +|US,us|micro second, 000000-999999|| +|NS,ns|nano second, 000000000-999999999|| +|TZH,tzh|time zone hour|2023-01-30 11:59:59PM +08| + +**More explanations**: +- The output format of `Month`, `Day` are left aligined, like`2023-OCTOBER -01`, `2023-SEPTEMBER-01`, `September` is the longest, no paddings. Week days are slimilar. +- When `ms`,`us`,`ns` are used in `to_char`, like `to_char(ts, 'yyyy-mm-dd hh:mi:ss.ms.us.ns')`, The time of `ms`,`us`,`ns` corresponds to the same fraction seconds. When ts is `1697182085123`, the output of `ms` is `123`, `us` is `123000`, `ns` is `123000000`. +- If we want to output some characters of format without converting, surround it with double quotes. `to_char(ts, 'yyyy-mm-dd "is formated by yyyy-mm-dd"')`. If want to output double quotes, add a back slash before double quote, like `to_char(ts, '\"yyyy-mm-dd\"')` will output `"2023-10-10"`. +- For formats that output digits, the uppercase and lowercase formats are the same. +- It's recommended to put time zone in the format, if not, the default time zone zone will be that in server or client. + +#### TO_TIMESTAMP + +```sql +TO_TIMESTAMP(ts_str_literal, format_str_literal) +``` + +**Description**: Convert a formated timestamp string to a timestamp + +**Return value type**: TIMESTAMP + +**Applicable column types**: VARCHAR + +**Nested query**: It can be used in both the outer query and inner query in a nested query. + +**Applicable table types**: standard tables and supertables + +**Supported Formats**: The same as `TO_CHAR`. + +**More explanations**: +- When `ms`, `us`, `ns` are used in `to_timestamp`, if multi of them are specified, the results are accumulated. For example, `to_timestamp('2023-10-10 10:10:10.123.000456.000000789', 'yyyy-mm-dd hh:mi:ss.ms.us.ns')` will output the timestamp of `2023-10-10 10:10:10.123456789`. +- The uppercase or lowercase of `MONTH`, `MON`, `DAY`, `DY` and formtas that output digits have same effect when used in `to_timestamp`, like `to_timestamp('2023-JANUARY-01', 'YYYY-month-dd')`, `month` can be replaced by `MONTH`, or `month`. The cases are ignored. +- If multi times are specified for one component, the previous will be overwritten. Like `to_timestamp('2023-22-10-10', 'yyyy-yy-MM-dd')`, the output year will be `2022`. +- To avoid unexpected time zone used during the convertion, it's recommended to put time zone in the ts string, e.g. '2023-10-10 10:10:10+08'. If time zone not specified, default will be that in server or client. +- The default timestamp if some components are not specified will be: `1970-01-01 00:00:00` with specified or default local timezone. +- If `AM` or `PM` is specified in formats, the Hour must between `1-12`. +- In some cases, `to_timestamp` can convert correctly even the format and the timestamp string are not totally matched. Like `to_timetamp('200101/2', 'yyyyMM1/dd')`, the digit `1` in format string are ignored, and the output timestsamp is `2001-01-02 00:00:00`. Spaces and tabs in formats and tiemstamp string are also ignored automatically. + ### Time and Date Functions diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 8b87a18e54..4371124623 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -483,6 +483,91 @@ return_timestamp: { - 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 - return_timestamp 指定函数返回值是否为时间戳类型,设置为1时返回 TIMESTAMP 类型,设置为0时返回 BIGINT 类型。如不指定缺省返回 BIGINT 类型。 +#### TO_CHAR + +```sql +TO_CHAR(ts, format_str_literal) +``` + +**功能说明**: 将timestamp类型按照指定格式转换为字符串 + +**返回结果数据类型**: VARCHAR + +**应用字段**: TIMESTAMP + +**嵌套子查询支持**: 适用于内层查询和外层查询 + +**适用于**: 表和超级表 + +**支持的格式** + +| **格式** | **说明**| **例子** | +| --- | --- | --- | +|AM,am,PM,pm| 无点分隔的上午下午 | 07:00:00am| +|A.M.,a.m.,P.M.,p.m.| 有点分隔的上午下午| 07:00:00a.m.| +|YYYY,yyyy|年, 4个及以上数字| 2023-10-10| +|YYY,yyy| 年, 最后3位数字| 023-10-10| +|YY,yy| 年, 最后2位数字| 23-10-10| +|Y,y|年, 最后一位数字| 3-10-10| +|MONTH|月, 全大写| 2023-JANUARY-01| +|Month|月, 首字母大写| 2023-January-01| +|month|月, 全小写| 2023-january-01| +|MON| 月, 缩写, 全大写(三个字符)| JAN, SEP| +|Mon| 月, 缩写, 首字母大写| Jan, Sep| +|mon|月, 缩写, 全小写| jan, sep| +|MM,mm|月, 数字 01-12|2023-01-01| +|DD,dd|月日, 01-31|| +|DAY|周日, 全大写|MONDAY| +|Day|周日, 首字符大写|Monday| +|day|周日, 全小写|monday| +|DY|周日, 缩写, 全大写|MON| +|Dy|周日, 缩写, 首字符大写|Mon| +|dy|周日, 缩写, 全小写|mon| +|DDD|年日, 001-366|| +|D,d|周日, 数字, 1-7, Sunday(1) to Saturday(7)|| +|HH24,hh24|小时, 00-23|2023-01-30 23:59:59| +|hh12,HH12, hh, HH| 小时, 01-12|2023-01-30 12:59:59PM| +|MI,mi|分钟, 00-59|| +|SS,ss|秒, 00-59|| +|MS,ms|毫秒, 000-999|| +|US,us|微秒, 000000-999999|| +|NS,ns|纳秒, 000000000-999999999|| +|TZH,tzh|时区小时|2023-01-30 11:59:59PM +08| + +**使用说明**: +- `Month`, `Day`等的输出格式是左对齐的, 右侧添加空格, 如`2023-OCTOBER -01`, `2023-SEPTEMBER-01`, 9月是月份中英文字母数最长的, 因此9月没有空格. 星期类似. +- 使用`ms`, `us`, `ns`时, 以上三种格式的输出只在精度上不同, 比如ts为 `1697182085123`, `ms` 的输出为 `123`, `us` 的输出为 `123000`, `ns` 的输出为 `123000000`. +- 时间格式中无法匹配规则的内容会直接输出. 如果想要在格式串中指定某些能够匹配规则的部分不做转换, 可以使用双引号, 如`to_char(ts, 'yyyy-mm-dd "is formated by yyyy-mm-dd"')`. 如果想要输出双引号, 那么在双引号之前加一个反斜杠, 如 `to_char(ts, '\"yyyy-mm-dd\"')` 将会输出 `"2023-10-10"`. +- 那些输出是数字的格式, 如`YYYY`, `DD`, 大写与小写意义相同, 即`yyyy` 和 `YYYY` 可以互换. +- 推荐在时间格式中带时区信息,如果不带则默认输出的时区为服务端或客户端所配置的时区. + +#### TO_TIMESTAMP + +```sql +TO_TIMESTAMP(ts_str_literal, format_str_literal) +``` + +**功能说明**: 将字符串按照指定格式转化为时间戳. + +**返回结果数据类型**: TIMESTAMP + +**应用字段**: VARCHAR + +**嵌套子查询支持**: 适用于内层查询和外层查询 + +**适用于**: 表和超级表 + +**支持的格式**: 与`to_char`相同 + +**使用说明**: +- 若`ms`, `us`, `ns`同时指定, 那么结果时间戳包含上述三个字段的和. 如 `to_timestamp('2023-10-10 10:10:10.123.000456.000000789', 'yyyy-mm-dd hh:mi:ss.ms.us.ns')` 输出是 `2023-10-10 10:10:10.123456789`. +- `MONTH`, `MON`, `DAY`, `DY` 以及其他输出为数字的格式的大小写意义相同, 如 `to_timestamp('2023-JANUARY-01', 'YYYY-month-dd')`, `month`可以被替换为`MONTH` 或者`Month`. +- 如果同一字段被指定了多次, 那么前面的指定将会被覆盖. 如 `to_timestamp('2023-22-10-10', 'yyyy-yy-MM-dd')`, 输出年份是`2022`. +- 为避免转换时使用了非预期的时区,推荐在时间中携带时区信息,例如'2023-10-10 10:10:10+08',如果未指定时区则默认时区为服务端或客户端指定的时区。 +- 如果没有指定完整的时间,那么默认时间值为指定或默认时区的 `1970-01-01 00:00:00`, 未指定部分使用该默认值中的对应部分. +- 如果格式串中有`AM`, `PM`等, 那么小时必须是12小时制, 范围必须是01-12. +- `to_timestamp`转换具有一定的容错机制, 在格式串和时间戳串不完全对应时, 有时也可转换, 如: `to_timestamp('200101/2', 'yyyyMM1/dd')`, 格式串中多出来的1会被丢弃. 格式串与时间戳串中多余的空格字符(空格, tab等)也会被 自动忽略. 如`to_timestamp(' 23 年 - 1 月 - 01 日 ', 'yy 年-MM月-dd日')` 可以被成功转换. 虽然`MM`等字段需要两个数字对应(只有一位时前面补0), 在`to_timestamp`时, 一个数字也可以成功转换. + ### 时间和日期函数 diff --git a/include/common/tmsg.h b/include/common/tmsg.h index b492a1d231..4ef4273631 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -445,7 +445,7 @@ typedef struct SRetention { int8_t keepUnit; } SRetention; -#define RETENTION_VALID(r) (((r)->freq > 0) && ((r)->keep > 0)) +#define RETENTION_VALID(l, r) ((((l) == 0 && (r)->freq >= 0) || ((r)->freq > 0)) && ((r)->keep > 0)) #pragma pack(push, 1) @@ -1568,9 +1568,7 @@ typedef struct { typedef struct { int32_t id; int8_t isMnode; -#ifdef TD_GRANT_HB_OPTIMIZE int8_t offlineReason; -#endif SEp ep; char active[TSDB_ACTIVE_KEY_LEN]; char connActive[TSDB_CONN_ACTIVE_KEY_LEN]; diff --git a/include/common/ttime.h b/include/common/ttime.h index 37e3045817..306b5105d0 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -90,6 +90,34 @@ int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t ts, int32_t precision); +struct STm { + struct tm tm; + int64_t fsec; // in NANOSECOND +}; + +int32_t taosTs2Tm(int64_t ts, int32_t precision, struct STm* tm); +int32_t taosTm2Ts(struct STm* tm, int64_t* ts, int32_t precision); + +/// @brief convert a timestamp to a formatted string +/// @param format the timestamp format, must null terminated +/// @param [in,out] formats the formats array pointer generated. Shouldn't be NULL. +/// If (*formats == NULL), [format] will be used and [formats] will be updated to the new generated +/// formats array; If not NULL, [formats] will be used instead of [format] to skip parse formats again. +/// @param out output buffer, should be initialized by memset +/// @notes remember to free the generated formats +void taosTs2Char(const char* format, SArray** formats, int64_t ts, int32_t precision, char* out, int32_t outLen); +/// @brief convert a formatted timestamp string to a timestamp +/// @param format must null terminated +/// @param [in, out] formats, see taosTs2Char +/// @param tsStr must null terminated +/// @retval 0 for success, otherwise error occured +/// @notes remember to free the generated formats even when error occured +int32_t taosChar2Ts(const char* format, SArray** formats, const char* tsStr, int64_t* ts, int32_t precision, char* errMsg, + int32_t errMsgLen); + +void TEST_ts2char(const char* format, int64_t ts, int32_t precision, char* out, int32_t outLen); +int32_t TEST_char2ts(const char* format, int64_t* ts, int32_t precision, const char* tsStr); + #ifdef __cplusplus } #endif diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 5e8ebbdf83..cb080ab118 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -366,6 +366,8 @@ + + #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 #define TK_NK_ILLEGAL 602 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 48c2210f46..865f1b2295 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -94,6 +94,8 @@ typedef enum EFunctionType { FUNCTION_TYPE_TO_ISO8601, FUNCTION_TYPE_TO_UNIXTIMESTAMP, FUNCTION_TYPE_TO_JSON, + FUNCTION_TYPE_TO_TIMESTAMP, + FUNCTION_TYPE_TO_CHAR, // date and time function FUNCTION_TYPE_NOW = 2500, diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index 2e6652f860..789ba554e2 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -80,6 +80,8 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t toTimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t toCharFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t nowFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index ad525a2aa7..a19b249bc7 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -46,6 +46,7 @@ extern "C" { #define SYNC_HEARTBEAT_SLOW_MS 1500 #define SYNC_HEARTBEAT_REPLY_SLOW_MS 1500 #define SYNC_SNAP_RESEND_MS 1000 * 60 +#define SYNC_SNAP_TIMEOUT_MS 1000 * 600 #define SYNC_VND_COMMIT_MIN_MS 3000 diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 4c87bd31bf..8002bc46b6 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -665,6 +665,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR TAOS_DEF_ERROR_CODE(0, 0x2618) #define TSDB_CODE_PAR_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x2619) #define TSDB_CODE_PAR_INVALID_TABLE_OPTION TAOS_DEF_ERROR_CODE(0, 0x261A) +#define TSDB_CODE_PAR_INTER_VALUE_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x261B) #define TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST TAOS_DEF_ERROR_CODE(0, 0x2624) #define TSDB_CODE_PAR_AGG_FUNC_NESTING TAOS_DEF_ERROR_CODE(0, 0x2627) #define TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE TAOS_DEF_ERROR_CODE(0, 0x2628) @@ -750,6 +751,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_FUNC_FUNTION_PARA_VALUE TAOS_DEF_ERROR_CODE(0, 0x2803) #define TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION TAOS_DEF_ERROR_CODE(0, 0x2804) #define TSDB_CODE_FUNC_DUP_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x2805) +#define TSDB_CODE_FUNC_TO_TIMESTAMP_FAILED TAOS_DEF_ERROR_CODE(0, 0x2806) //udf #define TSDB_CODE_UDF_STOPPING TAOS_DEF_ERROR_CODE(0, 0x2901) diff --git a/include/util/tdef.h b/include/util/tdef.h index 2dfbde6638..1b56b5b623 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -109,6 +109,15 @@ extern const int32_t TYPE_BYTES[21]; #define TSDB_INS_USER_STABLES_DBNAME_COLID 2 +static const int64_t TICK_PER_SECOND[] = { + 1000LL, // MILLISECOND + 1000000LL, // MICROSECOND + 1000000000LL, // NANOSECOND + 0LL, // HOUR + 0LL, // MINUTE + 1LL // SECOND +}; + #define TSDB_TICK_PER_SECOND(precision) \ ((int64_t)((precision) == TSDB_TIME_PRECISION_MILLI \ ? 1000LL \ @@ -297,6 +306,8 @@ typedef enum ELogicConditionType { #define TSDB_SYNC_APPLYQ_SIZE_LIMIT 512 #define TSDB_SYNC_NEGOTIATION_WIN 512 +#define TSDB_SYNC_SNAP_BUFFER_SIZE 2048 + #define TSDB_TBNAME_COLUMN_INDEX (-1) #define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta @@ -319,7 +330,7 @@ typedef enum ELogicConditionType { #define TSDB_MAX_DAYS_PER_FILE (3650 * 1440) #define TSDB_DEFAULT_DAYS_PER_FILE (10 * 1440) #define TSDB_MIN_DURATION_PER_FILE 60 // unit minute -#define TSDB_MAX_DURATION_PER_FILE (3650 * 1440) +#define TSDB_MAX_DURATION_PER_FILE (90 * 1440) #define TSDB_DEFAULT_DURATION_PER_FILE (10 * 1440) #define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute #define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 0a155f4ea1..c6cff27011 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -104,13 +104,21 @@ uint16_t tsAuditPort = 6043; bool tsEnableAuditCreateTable = true; // telem +#ifdef TD_ENTERPRISE +bool tsEnableTelem = false; +#else bool tsEnableTelem = true; +#endif int32_t tsTelemInterval = 43200; char tsTelemServer[TSDB_FQDN_LEN] = "telemetry.tdengine.com"; uint16_t tsTelemPort = 80; char *tsTelemUri = "/report"; +#ifdef TD_ENTERPRISE +bool tsEnableCrashReport = false; +#else bool tsEnableCrashReport = true; +#endif char *tsClientCrashReportUri = "/ccrashreport"; char *tsSvrCrashReportUri = "/dcrashreport"; diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 723298f256..6b5bb8680e 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -25,7 +25,6 @@ #include "tlog.h" - // ==== mktime() kernel code =================// static int64_t m_deltaUtc = 0; @@ -682,7 +681,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) { } // The following code handles the y/n time duration - int64_t numOfMonth = (unit == 'y')? duration*12:duration; + int64_t numOfMonth = (unit == 'y') ? duration * 12 : duration; int64_t fraction = t % TSDB_TICK_PER_SECOND(precision); struct tm tm; @@ -725,7 +724,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) { * Total num of windows is ret + 1(the first window) */ int32_t taosTimeCountIntervalForFill(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision, - int32_t order) { + int32_t order) { if (ekey < skey) { int64_t tmp = ekey; ekey = skey; @@ -768,7 +767,6 @@ int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval) { int32_t precision = pInterval->precision; if (IS_CALENDAR_TIME_DURATION(pInterval->slidingUnit)) { - start /= (int64_t)(TSDB_TICK_PER_SECOND(precision)); struct tm tm; time_t tt = (time_t)start; @@ -799,7 +797,7 @@ int64_t taosTimeTruncate(int64_t ts, const SInterval* pInterval) { int64_t newe = taosTimeAdd(news, pInterval->interval, pInterval->intervalUnit, precision) - 1; if (newe < ts) { // move towards the greater endpoint - while(newe < ts && news < ts) { + while (newe < ts && news < ts) { news += pInterval->sliding; newe = taosTimeAdd(news, pInterval->interval, pInterval->intervalUnit, precision) - 1; } @@ -978,3 +976,947 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision) tstrncpy(buf, ts, bufLen); } + +int32_t taosTs2Tm(int64_t ts, int32_t precision, struct STm* tm) { + tm->fsec = ts % TICK_PER_SECOND[precision] * (TICK_PER_SECOND[TSDB_TIME_PRECISION_NANO] / TICK_PER_SECOND[precision]); + time_t t = ts / TICK_PER_SECOND[precision]; + taosLocalTime(&t, &tm->tm, NULL); + return TSDB_CODE_SUCCESS; +} + +int32_t taosTm2Ts(struct STm* tm, int64_t* ts, int32_t precision) { + *ts = taosMktime(&tm->tm); + *ts *= TICK_PER_SECOND[precision]; + *ts += tm->fsec / (TICK_PER_SECOND[TSDB_TIME_PRECISION_NANO] / TICK_PER_SECOND[precision]); + return TSDB_CODE_SUCCESS; +} + +typedef struct { + const char* name; + int len; + int id; + bool isDigit; +} TSFormatKeyWord; + +typedef enum { + // TSFKW_AD, // BC AD + // TSFKW_A_D, // A.D. B.C. + TSFKW_AM, // AM, PM + TSFKW_A_M, // A.M., P.M. + // TSFKW_BC, // BC AD + // TSFKW_B_C, // B.C. A.D. + TSFKW_DAY, // MONDAY, TUESDAY ... + TSFKW_DDD, // Day of year 001-366 + TSFKW_DD, // Day of month 01-31 + TSFKW_Day, // Sunday, Monday + TSFKW_DY, // MON, TUE + TSFKW_Dy, // Mon, Tue + TSFKW_D, // 1-7 -> Sunday(1) -> Saturday(7) + TSFKW_HH24, + TSFKW_HH12, + TSFKW_HH, + TSFKW_MI, // minute + TSFKW_MM, + TSFKW_MONTH, // JANUARY, FEBRUARY + TSFKW_MON, + TSFKW_Month, + TSFKW_Mon, + TSFKW_MS, + TSFKW_NS, + //TSFKW_OF, + TSFKW_PM, + TSFKW_P_M, + TSFKW_SS, + TSFKW_TZH, + // TSFKW_TZM, + // TSFKW_TZ, + TSFKW_US, + TSFKW_YYYY, + TSFKW_YYY, + TSFKW_YY, + TSFKW_Y, + // TSFKW_a_d, + // TSFKW_ad, + TSFKW_am, + TSFKW_a_m, + // TSFKW_b_c, + // TSFKW_bc, + TSFKW_day, + TSFKW_ddd, + TSFKW_dd, + TSFKW_dy, // mon, tue + TSFKW_d, + TSFKW_hh24, + TSFKW_hh12, + TSFKW_hh, + TSFKW_mi, + TSFKW_mm, + TSFKW_month, + TSFKW_mon, + TSFKW_ms, + TSFKW_ns, + TSFKW_pm, + TSFKW_p_m, + TSFKW_ss, + TSFKW_tzh, + // TSFKW_tzm, + // TSFKW_tz, + TSFKW_us, + TSFKW_yyyy, + TSFKW_yyy, + TSFKW_yy, + TSFKW_y, + TSFKW_last_ +} TSFormatKeywordId; + +// clang-format off +static const TSFormatKeyWord formatKeyWords[] = { + //{"AD", 2, TSFKW_AD, false}, + //{"A.D.", 4, TSFKW_A_D}, + {"AM", 2, TSFKW_AM, false}, + {"A.M.", 4, TSFKW_A_M, false}, + //{"BC", 2, TSFKW_BC, false}, + //{"B.C.", 4, TSFKW_B_C, false}, + {"DAY", 3, TSFKW_DAY, false}, + {"DDD", 3, TSFKW_DDD, true}, + {"DD", 2, TSFKW_DD, true}, + {"Day", 3, TSFKW_Day, false}, + {"DY", 2, TSFKW_DY, false}, + {"Dy", 2, TSFKW_Dy, false}, + {"D", 1, TSFKW_D, true}, + {"HH24", 4, TSFKW_HH24, true}, + {"HH12", 4, TSFKW_HH12, true}, + {"HH", 2, TSFKW_HH, true}, + {"MI", 2, TSFKW_MI, true}, + {"MM", 2, TSFKW_MM, true}, + {"MONTH", 5, TSFKW_MONTH, false}, + {"MON", 3, TSFKW_MON, false}, + {"Month", 5, TSFKW_Month, false}, + {"Mon", 3, TSFKW_Mon, false}, + {"MS", 2, TSFKW_MS, true}, + {"NS", 2, TSFKW_NS, true}, + //{"OF", 2, TSFKW_OF, false}, + {"PM", 2, TSFKW_PM, false}, + {"P.M.", 4, TSFKW_P_M, false}, + {"SS", 2, TSFKW_SS, true}, + {"TZH", 3, TSFKW_TZH, false}, + //{"TZM", 3, TSFKW_TZM}, + //{"TZ", 2, TSFKW_TZ}, + {"US", 2, TSFKW_US, true}, + {"YYYY", 4, TSFKW_YYYY, true}, + {"YYY", 3, TSFKW_YYY, true}, + {"YY", 2, TSFKW_YY, true}, + {"Y", 1, TSFKW_Y, true}, + //{"a.d.", 4, TSFKW_a_d, false}, + //{"ad", 2, TSFKW_ad, false}, + {"am", 2, TSFKW_am, false}, + {"a.m.", 4, TSFKW_a_m, false}, + //{"b.c.", 4, TSFKW_b_c, false}, + //{"bc", 2, TSFKW_bc, false}, + {"day", 3, TSFKW_day, false}, + {"ddd", 3, TSFKW_DDD, true}, + {"dd", 2, TSFKW_DD, true}, + {"dy", 2, TSFKW_dy, false}, + {"d", 1, TSFKW_D, true}, + {"hh24", 4, TSFKW_HH24, true}, + {"hh12", 4, TSFKW_HH12, true}, + {"hh", 2, TSFKW_HH, true}, + {"mi", 2, TSFKW_MI, true}, + {"mm", 2, TSFKW_MM, true}, + {"month", 5, TSFKW_month, false}, + {"mon", 3, TSFKW_mon, false}, + {"ms", 2, TSFKW_MS, true}, + {"ns", 2, TSFKW_NS, true}, + //{"of", 2, TSFKW_OF, false}, + {"pm", 2, TSFKW_pm, false}, + {"p.m.", 4, TSFKW_p_m, false}, + {"ss", 2, TSFKW_SS, true}, + {"tzh", 3, TSFKW_TZH, false}, + //{"tzm", 3, TSFKW_TZM}, + //{"tz", 2, TSFKW_tz}, + {"us", 2, TSFKW_US, true}, + {"yyyy", 4, TSFKW_YYYY, true}, + {"yyy", 3, TSFKW_YYY, true}, + {"yy", 2, TSFKW_YY, true}, + {"y", 1, TSFKW_Y, true}, + {NULL, 0, 0} +}; +// clang-format on + +#define TS_FROMAT_KEYWORD_INDEX_SIZE ('z' - 'A' + 1) +static const int TSFormatKeywordIndex[TS_FROMAT_KEYWORD_INDEX_SIZE] = { + /*A*/ TSFKW_AM, -1, -1, + /*D*/ TSFKW_DAY, -1, -1, -1, + /*H*/ TSFKW_HH24, -1, -1, -1, -1, + /*M*/ TSFKW_MI, + /*N*/ TSFKW_NS, -1, + /*P*/ TSFKW_PM, -1, -1, + /*S*/ TSFKW_SS, + /*T*/ TSFKW_TZH, + /*U*/ TSFKW_US, -1, -1, -1, + /*Y*/ TSFKW_YYYY, -1, + /*[ \ ] ^ _ `*/ -1, -1, -1, -1, -1, -1, + /*a*/ TSFKW_am, -1, -1, + /*d*/ TSFKW_day, -1, -1, -1, + /*h*/ TSFKW_hh24, -1, -1, -1, -1, + /*m*/ TSFKW_mi, + /*n*/ TSFKW_ns, -1, + /*p*/ TSFKW_pm, -1, -1, + /*s*/ TSFKW_ss, + /*t*/ TSFKW_tzh, + /*u*/ TSFKW_us, -1, -1, -1, + /*y*/ TSFKW_yyyy, -1}; + +typedef struct { + uint8_t type; + const char* c; + int32_t len; + const TSFormatKeyWord* key; +} TSFormatNode; + +static const char* const weekDays[] = {"Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", "NULL"}; +static const char* const shortWeekDays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "NULL"}; +static const char* const fullMonths[] = {"January", "February", "March", "April", "May", "June", "July", + "August", "September", "October", "November", "December", NULL}; +static const char* const months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Aug", "Sep", "Oct", "Nov", "Dec", NULL}; +#define A_M_STR "A.M." +#define a_m_str "a.m." +#define AM_STR "AM" +#define am_str "am" +#define P_M_STR "P.M." +#define p_m_str "p.m." +#define PM_STR "PM" +#define pm_str "pm" +static const char* const apms[] = {AM_STR, PM_STR, am_str, pm_str, NULL}; +static const char* const long_apms[] = {A_M_STR, P_M_STR, a_m_str, p_m_str, NULL}; + +#define TS_FORMAT_NODE_TYPE_KEYWORD 1 +#define TS_FORMAT_NODE_TYPE_SEPARATOR 2 +#define TS_FORMAT_NODE_TYPE_CHAR 3 + +static const TSFormatKeyWord* keywordSearch(const char* str) { + if (*str < 'A' || *str > 'z' || (*str > 'Z' && *str < 'a')) return NULL; + int32_t idx = TSFormatKeywordIndex[str[0] - 'A']; + if (idx < 0) return NULL; + const TSFormatKeyWord* key = &formatKeyWords[idx++]; + while (key->name && str[0] == key->name[0]) { + if (0 == strncmp(key->name, str, key->len)) { + return key; + } + key = &formatKeyWords[idx++]; + } + return NULL; +} + +static bool isSeperatorChar(char c) { + return (c > 0x20 && c < 0x7F && !(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z') && !(c >= '0' && c <= '9')); +} + +static void parseTsFormat(const char* formatStr, SArray* formats) { + TSFormatNode* lastOtherFormat = NULL; + while (*formatStr) { + const TSFormatKeyWord* key = keywordSearch(formatStr); + if (key) { + TSFormatNode format = {.key = key, .type = TS_FORMAT_NODE_TYPE_KEYWORD}; + taosArrayPush(formats, &format); + formatStr += key->len; + lastOtherFormat = NULL; + } else { + if (*formatStr == '"') { + lastOtherFormat = NULL; + // for double quoted string + formatStr++; + TSFormatNode* last = NULL; + while (*formatStr) { + if (*formatStr == '"') { + formatStr++; + break; + } + if (*formatStr == '\\' && *(formatStr + 1)) { + formatStr++; + last = NULL; // stop expanding last format, create new format + } + if (last) { + // expand + assert(last->type == TS_FORMAT_NODE_TYPE_CHAR); + last->len++; + formatStr++; + } else { + // create new + TSFormatNode format = {.type = TS_FORMAT_NODE_TYPE_CHAR, .key = NULL}; + format.c = formatStr; + format.len = 1; + taosArrayPush(formats, &format); + formatStr++; + last = taosArrayGetLast(formats); + } + } + } else { + // for other strings + if (*formatStr == '\\' && *(formatStr + 1)) { + formatStr++; + lastOtherFormat = NULL; // stop expanding + } else { + if (lastOtherFormat && !isSeperatorChar(*formatStr)) { + // expanding + } else { + // create new + lastOtherFormat = NULL; + } + } + if (lastOtherFormat) { + assert(lastOtherFormat->type == TS_FORMAT_NODE_TYPE_CHAR); + lastOtherFormat->len++; + formatStr++; + } else { + TSFormatNode format = { + .type = isSeperatorChar(*formatStr) ? TS_FORMAT_NODE_TYPE_SEPARATOR : TS_FORMAT_NODE_TYPE_CHAR, + .key = NULL}; + format.c = formatStr; + format.len = 1; + taosArrayPush(formats, &format); + formatStr++; + if (format.type == TS_FORMAT_NODE_TYPE_CHAR) lastOtherFormat = taosArrayGetLast(formats); + } + } + } + } +} + +static void tm2char(const SArray* formats, const struct STm* tm, char* s, int32_t outLen) { + int32_t size = taosArrayGetSize(formats); + const char* start = s; + for (int32_t i = 0; i < size; ++i) { + TSFormatNode* format = taosArrayGet(formats, i); + if (format->type != TS_FORMAT_NODE_TYPE_KEYWORD) { + if (s - start + format->len + 1 > outLen) break; + strncpy(s, format->c, format->len); + s += format->len; + continue; + } + if (s - start + 16 > outLen) break; + + switch (format->key->id) { + case TSFKW_AM: + case TSFKW_PM: + sprintf(s, tm->tm.tm_hour % 24 >= 12 ? "PM" : "AM"); + s += 2; + break; + case TSFKW_A_M: + case TSFKW_P_M: + sprintf(s, tm->tm.tm_hour % 24 >= 12 ? "P.M." : "A.M."); + s += 4; + break; + case TSFKW_am: + case TSFKW_pm: + sprintf(s, tm->tm.tm_hour % 24 >= 12 ? "pm" : "am"); + s += 2; + break; + case TSFKW_a_m: + case TSFKW_p_m: + sprintf(s, tm->tm.tm_hour % 24 >= 12 ? "p.m." : "a.m."); + s += 4; + break; + case TSFKW_DDD: + sprintf(s, "%d", tm->tm.tm_yday); + s += strlen(s); + break; + case TSFKW_DD: + sprintf(s, "%02d", tm->tm.tm_mday); + s += 2; + break; + case TSFKW_D: + sprintf(s, "%d", tm->tm.tm_wday + 1); + s += 1; + break; + case TSFKW_DAY: { + // MONDAY, TUESDAY... + const char* wd = weekDays[tm->tm.tm_wday]; + char buf[10] = {0}; + for (int32_t i = 0; i < strlen(wd); ++i) buf[i] = toupper(wd[i]); + sprintf(s, "%-9s", buf); + s += strlen(s); + break; + } + case TSFKW_Day: + // Monday, TuesDay... + sprintf(s, "%-9s", weekDays[tm->tm.tm_wday]); + s += strlen(s); + break; + case TSFKW_day: { + const char* wd = weekDays[tm->tm.tm_wday]; + char buf[10] = {0}; + for (int32_t i = 0; i < strlen(wd); ++i) buf[i] = tolower(wd[i]); + sprintf(s, "%-9s", buf); + s += strlen(s); + break; + } + case TSFKW_DY: { + // MON, TUE + const char* wd = shortWeekDays[tm->tm.tm_wday]; + char buf[8] = {0}; + for (int32_t i = 0; i < strlen(wd); ++i) buf[i] = toupper(wd[i]); + sprintf(s, "%3s", buf); + s += 3; + break; + } + case TSFKW_Dy: + // Mon, Tue + sprintf(s, "%3s", shortWeekDays[tm->tm.tm_wday]); + s += 3; + break; + case TSFKW_dy: { + // mon, tue + const char* wd = shortWeekDays[tm->tm.tm_wday]; + char buf[8] = {0}; + for (int32_t i = 0; i < strlen(wd); ++i) buf[i] = tolower(wd[i]); + sprintf(s, "%3s", buf); + s += 3; + break; + } + case TSFKW_HH24: + sprintf(s, "%02d", tm->tm.tm_hour); + s += 2; + break; + case TSFKW_HH: + case TSFKW_HH12: + // 0 or 12 o'clock in 24H coresponds to 12 o'clock (AM/PM) in 12H + sprintf(s, "%02d", tm->tm.tm_hour % 12 == 0 ? 12 : tm->tm.tm_hour % 12); + s += 2; + break; + case TSFKW_MI: + sprintf(s, "%02d", tm->tm.tm_min); + s += 2; + break; + case TSFKW_MM: + sprintf(s, "%02d", tm->tm.tm_mon + 1); + s += 2; + break; + case TSFKW_MONTH: { + const char* mon = fullMonths[tm->tm.tm_mon]; + char buf[10] = {0}; + for (int32_t i = 0; i < strlen(mon); ++i) buf[i] = toupper(mon[i]); + sprintf(s, "%-9s", buf); + s += strlen(s); + break; + } + case TSFKW_MON: { + const char* mon = months[tm->tm.tm_mon]; + char buf[10] = {0}; + for (int32_t i = 0; i < strlen(mon); ++i) buf[i] = toupper(mon[i]); + sprintf(s, "%s", buf); + s += strlen(s); + break; + } + case TSFKW_Month: + sprintf(s, "%-9s", fullMonths[tm->tm.tm_mon]); + s += strlen(s); + break; + case TSFKW_month: { + const char* mon = fullMonths[tm->tm.tm_mon]; + char buf[10] = {0}; + for (int32_t i = 0; i < strlen(mon); ++i) buf[i] = tolower(mon[i]); + sprintf(s, "%-9s", buf); + s += strlen(s); + break; + } + case TSFKW_Mon: + sprintf(s, "%s", months[tm->tm.tm_mon]); + s += strlen(s); + break; + case TSFKW_mon: { + const char* mon = months[tm->tm.tm_mon]; + char buf[10] = {0}; + for (int32_t i = 0; i < strlen(mon); ++i) buf[i] = tolower(mon[i]); + sprintf(s, "%s", buf); + s += strlen(s); + break; + } + case TSFKW_SS: + sprintf(s, "%02d", tm->tm.tm_sec); + s += 2; + break; + case TSFKW_MS: + sprintf(s, "%03" PRId64, tm->fsec / 1000000L); + s += 3; + break; + case TSFKW_US: + sprintf(s, "%06" PRId64, tm->fsec / 1000L); + s += 6; + break; + case TSFKW_NS: + sprintf(s, "%09" PRId64, tm->fsec); + s += 9; + break; + case TSFKW_TZH: + sprintf(s, "%s%02d", tsTimezone < 0 ? "-" : "+", tsTimezone); + s += strlen(s); + break; + case TSFKW_YYYY: + sprintf(s, "%04d", tm->tm.tm_year + 1900); + s += strlen(s); + break; + case TSFKW_YYY: + sprintf(s, "%03d", (tm->tm.tm_year + 1900) % 1000); + s += strlen(s); + break; + case TSFKW_YY: + sprintf(s, "%02d", (tm->tm.tm_year + 1900) % 100); + s += strlen(s); + break; + case TSFKW_Y: + sprintf(s, "%01d", (tm->tm.tm_year + 1900) % 10); + s += strlen(s); + break; + default: + break; + } + } +} + +/// @brief find s in arr case insensitively +/// @retval the index in arr if found, -1 if not found +static int32_t strArrayCaseSearch(const char* const* arr, const char* s) { + if (!*s) return -1; + const char* const* fmt = arr; + for (; *fmt; ++fmt) { + const char *l, *r; + for (l = fmt[0], r = s;; l++, r++) { + if (*l == '\0') return fmt - arr; + if (*r == '\0' || tolower(*l) != tolower(*r)) break; + } + } + return -1; +} + +static const char* tsFormatStr2Int32(int32_t* dest, const char* str, int32_t len, bool needMoreDigit) { + char* last; + int64_t res; + const char* s = str; + if ('\0' == str[0]) return NULL; + if (len <= 0) { + res = taosStr2Int64(s, &last, 10); + s = last; + } else { + char buf[16] = {0}; + strncpy(buf, s, len); + int32_t copiedLen = strlen(buf); + if (copiedLen < len) { + if (!needMoreDigit) { + // digits not enough, that's ok, cause we do not need more digits + // '2023-1' 'YYYY-MM' + // '202a' 'YYYY' -> 202 + res = taosStr2Int64(s, &last, 10); + s += copiedLen; + } else { + // bytes not enough, and there are other digit formats to match + // '2023-1' 'YYYY-MMDD' + return NULL; + } + } else { + if (needMoreDigit) { + res = taosStr2Int64(buf, &last, 10); + // bytes enough, but digits not enough, like '202a12' 'YYYYMM', YYYY needs four digits + if (last - buf < len) return NULL; + s += last - buf; + } else { + res = taosStr2Int64(s, &last, 10); + s = last; + } + } + } + if (s == str) { + // no integers found + return NULL; + } + if (errno == ERANGE || res > INT32_MAX || res < INT32_MIN) { + // out of range + return NULL; + } + *dest = res; + return s; +} + +static int32_t adjustYearTo2020(int32_t year) { + if (year < 70) return year + 2000; // 2000 - 2069 + if (year < 100) return year + 1900; // 1970 - 1999 + if (year < 520) return year + 2000; // 2100 - 2519 + if (year < 1000) return year + 1000; // 1520 - 1999 + return year; +} + +static bool checkTm(const struct tm* tm) { + if (tm->tm_mon < 0 || tm->tm_mon > 11) return false; + if (tm->tm_wday < 0 || tm->tm_wday > 6) return false; + if (tm->tm_yday < 0 || tm->tm_yday > 365) return false; + if (tm->tm_mday < 0 || tm->tm_mday > 31) return false; + if (tm->tm_hour < 0 || tm->tm_hour > 23) return false; + if (tm->tm_min < 0 || tm->tm_min > 59) return false; + if (tm->tm_sec < 0 || tm->tm_sec > 60) return false; + return true; +} + +static bool needMoreDigits(SArray* formats, int32_t curIdx) { + if (curIdx == taosArrayGetSize(formats) - 1) return false; + TSFormatNode* pNextNode = taosArrayGet(formats, curIdx + 1); + if (pNextNode->type == TS_FORMAT_NODE_TYPE_SEPARATOR) { + return false; + } else if (pNextNode->type == TS_FORMAT_NODE_TYPE_KEYWORD) { + return pNextNode->key->isDigit; + } else { + return isdigit(pNextNode->c[0]); + } +} + +/// @brief convert a formatted time str to timestamp +/// @param[in] s the formatted timestamp str +/// @param[in] formats array of TSFormatNode, output of parseTsFormat +/// @param[out] ts output timestamp +/// @param precision the timestamp precision to convert to, sec/milli/micro/nano +/// @param[out] sErrPos if not NULL, when err occured, points to the failed position of s, only set when ret is -1 +/// @param[out] fErrIdx if not NULL, when err occured, the idx of the failed format idx, only set when ret is -1 +/// @retval 0 for success +/// @retval -1 for format and s mismatch error +/// @retval -2 if datetime err, like 2023-13-32 25:61:69 +static int32_t char2ts(const char* s, SArray* formats, int64_t* ts, int32_t precision, const char** sErrPos, + int32_t* fErrIdx) { + int32_t size = taosArrayGetSize(formats); + int32_t pm = 0; // default am + int32_t hour12 = 0; // default HH24 + int32_t year = 0, mon = 0, yd = 0, md = 1, wd = 0; + int32_t hour = 0, min = 0, sec = 0, us = 0, ms = 0, ns = 0; + int32_t tzSign = 1, tz = tsTimezone; + int32_t err = 0; + + for (int32_t i = 0; i < size && *s != '\0'; ++i) { + while (isspace(*s) && *s != '\0') { + s++; + } + if (!s) break; + TSFormatNode* node = taosArrayGet(formats, i); + if (node->type == TS_FORMAT_NODE_TYPE_SEPARATOR) { + // separator matches any character + if (isSeperatorChar(s[0])) s += node->len; + continue; + } + if (node->type == TS_FORMAT_NODE_TYPE_CHAR) { + int32_t pos = 0; + // skip leading spaces + while (isspace(node->c[pos]) && node->len > 0) pos++; + while (pos < node->len && *s != '\0') { + if (!isspace(node->c[pos++])) { + while (isspace(*s) && *s != '\0') s++; + if (*s != '\0') s++; // forward together + } + } + continue; + } + assert(node->type == TS_FORMAT_NODE_TYPE_KEYWORD); + switch (node->key->id) { + case TSFKW_A_M: + case TSFKW_P_M: + case TSFKW_a_m: + case TSFKW_p_m: { + int32_t idx = strArrayCaseSearch(long_apms, s); + if (idx >= 0) { + s += 4; + pm = idx % 2; + hour12 = 1; + } else { + err = -1; + } + } break; + case TSFKW_AM: + case TSFKW_PM: + case TSFKW_am: + case TSFKW_pm: { + int32_t idx = strArrayCaseSearch(apms, s); + if (idx >= 0) { + s += 2; + pm = idx % 2; + hour12 = 1; + } else { + err = -1; + } + } break; + case TSFKW_HH: + case TSFKW_HH12: { + const char* newPos = tsFormatStr2Int32(&hour, s, 2, needMoreDigits(formats, i)); + if (NULL == newPos || hour > 12 || hour <= 0) { + err = -1; + } else { + hour12 = 1; + s = newPos; + } + } break; + case TSFKW_HH24: { + const char* newPos = tsFormatStr2Int32(&hour, s, 2, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + hour12 = 0; + s = newPos; + } + } break; + case TSFKW_MI: { + const char* newPos = tsFormatStr2Int32(&min, s, 2, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + s = newPos; + } + } break; + case TSFKW_SS: { + const char* newPos = tsFormatStr2Int32(&sec, s, 2, needMoreDigits(formats, i)); + if (NULL == newPos) + err = -1; + else + s = newPos; + } break; + case TSFKW_MS: { + const char* newPos = tsFormatStr2Int32(&ms, s, 3, needMoreDigits(formats, i)); + if (NULL == newPos) + err = -1; + else { + int32_t len = newPos - s; + ms *= len == 1 ? 100 : len == 2 ? 10 : 1; + s = newPos; + } + } break; + case TSFKW_US: { + const char* newPos = tsFormatStr2Int32(&us, s, 6, needMoreDigits(formats, i)); + if (NULL == newPos) + err = -1; + else { + int32_t len = newPos - s; + us *= len == 1 ? 100000 : len == 2 ? 10000 : len == 3 ? 1000 : len == 4 ? 100 : len == 5 ? 10 : 1; + s = newPos; + } + } break; + case TSFKW_NS: { + const char* newPos = tsFormatStr2Int32(&ns, s, 9, needMoreDigits(formats, i)); + if (NULL == newPos) + err = -1; + else { + int32_t len = newPos - s; + ns *= len == 1 ? 100000000 + : len == 2 ? 10000000 + : len == 3 ? 1000000 + : len == 4 ? 100000 + : len == 5 ? 10000 + : len == 6 ? 1000 + : len == 7 ? 100 + : len == 8 ? 10 + : 1; + s = newPos; + } + } break; + case TSFKW_TZH: { + tzSign = *s == '-' ? -1 : 1; + const char* newPos = tsFormatStr2Int32(&tz, s, -1, needMoreDigits(formats, i)); + if (NULL == newPos) + err = -1; + else { + s = newPos; + } + } break; + case TSFKW_MONTH: + case TSFKW_Month: + case TSFKW_month: { + int32_t idx = strArrayCaseSearch(fullMonths, s); + if (idx >= 0) { + s += strlen(fullMonths[idx]); + mon = idx; + } else { + err = -1; + } + } break; + case TSFKW_MON: + case TSFKW_Mon: + case TSFKW_mon: { + int32_t idx = strArrayCaseSearch(months, s); + if (idx >= 0) { + s += strlen(months[idx]); + mon = idx; + } else { + err = -1; + } + } break; + case TSFKW_MM: { + const char* newPos = tsFormatStr2Int32(&mon, s, 2, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + s = newPos; + mon -= 1; + } + } break; + case TSFKW_DAY: + case TSFKW_Day: + case TSFKW_day: { + int32_t idx = strArrayCaseSearch(weekDays, s); + if (idx >= 0) { + s += strlen(weekDays[idx]); + wd = idx; + } else { + err = -1; + } + } break; + case TSFKW_DY: + case TSFKW_Dy: + case TSFKW_dy: { + int32_t idx = strArrayCaseSearch(shortWeekDays, s); + if (idx >= 0) { + s += strlen(shortWeekDays[idx]); + wd = idx; + } else { + err = -1; + } + } break; + case TSFKW_DDD: { + const char* newPos = tsFormatStr2Int32(&yd, s, 3, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + s = newPos; + } + } break; + case TSFKW_DD: { + const char* newPos = tsFormatStr2Int32(&md, s, 2, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + s = newPos; + } + } break; + case TSFKW_D: { + const char* newPos = tsFormatStr2Int32(&wd, s, 1, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + s = newPos; + } + } break; + case TSFKW_YYYY: { + const char* newPos = tsFormatStr2Int32(&year, s, 4, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + s = newPos; + } + } break; + case TSFKW_YYY: { + const char* newPos = tsFormatStr2Int32(&year, s, 3, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + year = adjustYearTo2020(year); + s = newPos; + } + } break; + case TSFKW_YY: { + const char* newPos = tsFormatStr2Int32(&year, s, 2, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + year = adjustYearTo2020(year); + s = newPos; + } + } break; + case TSFKW_Y: { + const char* newPos = tsFormatStr2Int32(&year, s, 1, needMoreDigits(formats, i)); + if (NULL == newPos) { + err = -1; + } else { + year = adjustYearTo2020(year); + s = newPos; + } + } break; + default: + break; + } + if (err) { + if (sErrPos) *sErrPos = s; + if (fErrIdx) *fErrIdx = i; + return err; + } + } + struct STm tm = {0}; + tm.tm.tm_year = year - 1900; + tm.tm.tm_mon = mon; + tm.tm.tm_yday = yd; + tm.tm.tm_mday = md; + tm.tm.tm_wday = wd; + if (hour12) { + if (pm && hour < 12) + tm.tm.tm_hour = hour + 12; + else if (!pm && hour == 12) + tm.tm.tm_hour = 0; + else + tm.tm.tm_hour = hour; + } else { + tm.tm.tm_hour = hour; + } + tm.tm.tm_min = min; + tm.tm.tm_sec = sec; + if (!checkTm(&tm.tm)) return -2; + if (tz < -12 || tz > 12) return -2; + tm.fsec = ms * 1000000 + us * 1000 + ns; + int32_t ret = taosTm2Ts(&tm, ts, precision); + *ts += 60 * 60 * (tsTimezone - tz) * TICK_PER_SECOND[precision]; + return ret; +} + +void taosTs2Char(const char* format, SArray** formats, int64_t ts, int32_t precision, char* out, int32_t outLen) { + if (!*formats) { + *formats = taosArrayInit(8, sizeof(TSFormatNode)); + parseTsFormat(format, *formats); + } + struct STm tm; + taosTs2Tm(ts, precision, &tm); + tm2char(*formats, &tm, out, outLen); +} + +int32_t taosChar2Ts(const char* format, SArray** formats, const char* tsStr, int64_t* ts, int32_t precision, char* errMsg, + int32_t errMsgLen) { + const char* sErrPos; + int32_t fErrIdx; + if (!*formats) { + *formats = taosArrayInit(4, sizeof(TSFormatNode)); + parseTsFormat(format, *formats); + } + int32_t code = char2ts(tsStr, *formats, ts, precision, &sErrPos, &fErrIdx); + if (code == -1) { + TSFormatNode* fNode = (taosArrayGet(*formats, fErrIdx)); + snprintf(errMsg, errMsgLen, "mismatch format for: %s and %s", sErrPos, + fErrIdx < taosArrayGetSize(*formats) ? ((TSFormatNode*)taosArrayGet(*formats, fErrIdx))->key->name : ""); + } else if (code == -2) { + snprintf(errMsg, errMsgLen, "timestamp format error: %s -> %s", tsStr, format); + } + return code; +} + +void TEST_ts2char(const char* format, int64_t ts, int32_t precision, char* out, int32_t outLen) { + SArray* formats = taosArrayInit(4, sizeof(TSFormatNode)); + parseTsFormat(format, formats); + struct STm tm; + taosTs2Tm(ts, precision, &tm); + tm2char(formats, &tm, out, outLen); + taosArrayDestroy(formats); +} + +int32_t TEST_char2ts(const char* format, int64_t* ts, int32_t precision, const char* tsStr) { + const char* sErrPos; + int32_t fErrIdx; + SArray* formats = taosArrayInit(4, sizeof(TSFormatNode)); + parseTsFormat(format, formats); + int32_t code = char2ts(tsStr, formats, ts, precision, &sErrPos, &fErrIdx); + if (code == -1) { + printf("failed position: %s\n", sErrPos); + printf("failed format: %s\n", ((TSFormatNode*)taosArrayGet(formats, fErrIdx))->key->name); + } + taosArrayDestroy(formats); + return code; +} diff --git a/source/common/test/commonTests.cpp b/source/common/test/commonTests.cpp index 8a77087d23..dc320ebcb2 100644 --- a/source/common/test/commonTests.cpp +++ b/source/common/test/commonTests.cpp @@ -13,6 +13,7 @@ #include "tdatablock.h" #include "tdef.h" #include "tvariant.h" +#include "ttime.h" namespace { // @@ -260,4 +261,234 @@ TEST(testCase, var_dataBlock_split_test) { } } -#pragma GCC diagnostic pop \ No newline at end of file +void check_tm(const STm* tm, int32_t y, int32_t mon, int32_t d, int32_t h, int32_t m, int32_t s, int64_t fsec) { + ASSERT_EQ(tm->tm.tm_year, y); + ASSERT_EQ(tm->tm.tm_mon, mon); + ASSERT_EQ(tm->tm.tm_mday, d); + ASSERT_EQ(tm->tm.tm_hour, h); + ASSERT_EQ(tm->tm.tm_min, m); + ASSERT_EQ(tm->tm.tm_sec, s); + ASSERT_EQ(tm->fsec, fsec); +} + +void test_timestamp_tm_conversion(int64_t ts, int32_t precision, int32_t y, int32_t mon, int32_t d, int32_t h, int32_t m, int32_t s, int64_t fsec) { + int64_t ts_tmp; + char buf[128] = {0}; + struct STm tm; + taosFormatUtcTime(buf, 128, ts, precision); + printf("formated ts of %ld, precision: %d is: %s\n", ts, precision, buf); + taosTs2Tm(ts, precision, &tm); + check_tm(&tm, y, mon, d, h, m, s, fsec); + taosTm2Ts(&tm, &ts_tmp, precision); + ASSERT_EQ(ts, ts_tmp); +} + +TEST(timeTest, timestamp2tm) { + const char* ts_str_ns = "2023-10-12T11:29:00.775726171+0800"; + const char* ts_str_us = "2023-10-12T11:29:00.775726+0800"; + const char* ts_str_ms = "2023-10-12T11:29:00.775+0800"; + int64_t ts, tmp_ts = 0; + struct STm tm; + + ASSERT_EQ(TSDB_CODE_SUCCESS, taosParseTime(ts_str_ns, &ts, strlen(ts_str_ns), TSDB_TIME_PRECISION_NANO, 0)); + test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_NANO, 2023 - 1900, 9 /* mon start from 0*/, 12, 11, 29, 0, + 775726171L); + + ASSERT_EQ(TSDB_CODE_SUCCESS, taosParseTime(ts_str_us, &ts, strlen(ts_str_us), TSDB_TIME_PRECISION_MICRO, 0)); + test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_MICRO, 2023 - 1900, 9 /* mon start from 0*/, 12, 11, 29, 0, + 775726000L); + + ASSERT_EQ(TSDB_CODE_SUCCESS, taosParseTime(ts_str_ms, &ts, strlen(ts_str_ms), TSDB_TIME_PRECISION_MILLI, 0)); + test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_MILLI, 2023 - 1900, 9 /* mon start from 0*/, 12, 11, 29, 0, + 775000000L); + + ts = -5364687943000; // milliseconds since epoch, Wednesday, January 1, 1800 1:00:00 AM GMT+08:06 + test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_MILLI, 1800 - 1900, 0 /* mon start from 0*/, 1, 1, 0, 0, + 000000000L); + + ts = 0; + test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_MILLI, 1970 - 1900, 0 /* mon start from 0*/, 1, 8, 0, 0, + 000000000L); + + ts = -62198784343000; // milliseconds before epoch, Friday, January 1, -0001 12:00:00 AM GMT+08:06 + test_timestamp_tm_conversion(ts, TSDB_TIME_PRECISION_MILLI, -1 - 1900, 0 /* mon start from 0*/, 1, + 0 /* hour start from 0*/, 0, 0, 000000000L); +} + +void test_ts2char(int64_t ts, const char* format, int32_t precison, const char* expected) { + char buf[256] = {0}; + TEST_ts2char(format, ts, precison, buf, 256); + printf("ts: %ld format: %s res: [%s], expected: [%s]\n", ts, format, buf, expected); + ASSERT_STREQ(expected, buf); +} + +TEST(timeTest, ts2char) { + osDefaultInit(); + if (tsTimezone != TdEastZone8) GTEST_SKIP(); + int64_t ts; + const char* format = "YYYY-MM-DD"; + ts = 0; + test_ts2char(ts, format, TSDB_TIME_PRECISION_MILLI, "1970-01-01"); + test_ts2char(ts, format, TSDB_TIME_PRECISION_MICRO, "1970-01-01"); + test_ts2char(ts, format, TSDB_TIME_PRECISION_NANO, "1970-01-01"); + test_ts2char(ts, format, TSDB_TIME_PRECISION_SECONDS, "1970-01-01"); + + ts = 1697163517; + test_ts2char(ts, "YYYY-MM-DD", TSDB_TIME_PRECISION_SECONDS, "2023-10-13"); + ts = 1697163517000; + test_ts2char(ts, "YYYY-MM-DD-Day-DAY", TSDB_TIME_PRECISION_MILLI, "2023-10-13-Friday -FRIDAY "); +#ifndef WINDOWS + // double quoted: year, month, day are not parsed + test_ts2char(ts, + "YYYY-YYY-YY-Y-yyyy-yyy-yy-y-\"年\"-MONTH-MON-Month-Mon-month-mon-\"月\"-DDD-DD-D-ddd-dd-d-DAY-Day-" + "day-\"日\"", + TSDB_TIME_PRECISION_MILLI, + "2023-023-23-3-2023-023-23-3-年-OCTOBER -OCT-October -Oct-october " + "-oct-月-285-13-6-285-13-6-FRIDAY -Friday -friday -日"); +#endif + ts = 1697182085123L; // Friday, October 13, 2023 3:28:05.123 PM GMT+08:00 + test_ts2char(ts, "HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am", TSDB_TIME_PRECISION_MILLI, + "15:15:03:03:03:03:28:28:05:05:123:123:123000:123000:123000000:123000000:PM:PM:pm:pm"); + + // double quotes normal output + test_ts2char(ts, "\\\"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am\\\"", TSDB_TIME_PRECISION_MILLI, + "\"15:15:03:03:03:03:28:28:05:05:123:123:123000:123000:123000000:123000000:PM:PM:pm:pm\""); + test_ts2char(ts, "\\\"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am", TSDB_TIME_PRECISION_MILLI, + "\"15:15:03:03:03:03:28:28:05:05:123:123:123000:123000:123000000:123000000:PM:PM:pm:pm"); + // double quoted strings recognized as literal string, parsing skipped + test_ts2char(ts, "\"HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am", TSDB_TIME_PRECISION_MILLI, + "HH24:hh24:HH12:hh12:HH:hh:MI:mi:SS:ss:MS:ms:US:us:NS:ns:PM:AM:pm:am"); + test_ts2char(ts, "yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI, "2023-10-13 15:28:05.123000000pmaaa"); + test_ts2char(ts, "aaa--yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI, "aaa--2023-10-13 15:28:05.123000000pmaaa"); + test_ts2char(ts, "add--yyyy-mm-dd hh24:mi:ss.nsamaaa", TSDB_TIME_PRECISION_MILLI, "a13--2023-10-13 15:28:05.123000000pmaaa"); + + ts = 1693946405000; + test_ts2char(ts, "Day, Month dd, YYYY hh24:mi:ss AM TZH:tzh", TSDB_TIME_PRECISION_MILLI, "Wednesday, September 06, 2023 04:40:05 AM +08:+08"); + + ts = -62198784343000; // milliseconds before epoch, Friday, January 1, -0001 12:00:00 AM GMT+08:06 + test_ts2char(ts, "Day, Month dd, YYYY hh12:mi:ss AM", TSDB_TIME_PRECISION_MILLI, "Friday , January 01, -001 12:00:00 AM"); +} + +TEST(timeTest, char2ts) { + osDefaultInit(); + if (tsTimezone != TdEastZone8) GTEST_SKIP(); + int64_t ts; + int32_t code = + TEST_char2ts("YYYY-DD-MM HH12:MI:SS:MSPM", &ts, TSDB_TIME_PRECISION_MILLI, "2023-10-10 12:00:00.000AM"); + ASSERT_EQ(code, 0); + ASSERT_EQ(ts, 1696867200000LL); + + // 2009-1-1 00:00:00 + ASSERT_EQ(0, TEST_char2ts("YYYY-YYY-YY-Y", &ts, TSDB_TIME_PRECISION_MILLI, "2023-123-23-9")); + ASSERT_EQ(1230739200000LL, ts); + // 2023-1-1 + ASSERT_EQ(0, TEST_char2ts("YYYY-YYY-YY", &ts, TSDB_TIME_PRECISION_MILLI, "2023-123-23-9")); + ASSERT_EQ(ts, 1672502400000LL); + + // 2123-1-1, the second year(123) is used, which converted to 2123 + ASSERT_EQ(0, TEST_char2ts("YYYY-YYY", &ts, TSDB_TIME_PRECISION_MILLI, "2023-123-23-9")); + ASSERT_EQ(ts, 4828176000000LL); + // 2023-1-1 12:10:10am + ASSERT_EQ(0, TEST_char2ts("yyyy-mm-dd HH12:MI:SSAM", &ts, TSDB_TIME_PRECISION_MILLI, "2023-1-1 12:10:10am")); + ASSERT_EQ(ts, 1672503010000LL); + + // 2023-1-1 21:10:10.123 + ASSERT_EQ(0, TEST_char2ts("yy-MM-dd HH12:MI:ss.msa.m.", &ts, TSDB_TIME_PRECISION_MILLI, "23-1-01 9:10:10.123p.m.")); + ASSERT_EQ(ts, 1672578610123LL); + + // 2023-1-1 21:10:10.123456789 + ASSERT_EQ(0, TEST_char2ts("yy-MM-dd HH:MI:ss.ms.us.nsa.m.", &ts, TSDB_TIME_PRECISION_NANO, + "23-1-01 9:10:10.123.000456.000000789p.m.")); + ASSERT_EQ(ts, 1672578610123456789LL); + + // 2023-1-1 21:10:10.120450780 + ASSERT_EQ(0, TEST_char2ts("yy-MM-dd HH24:MI:SS.ms.us.ns", &ts, TSDB_TIME_PRECISION_NANO, + " 23 - 1 - 01 \t 21:10:10 . 12 . \t 00045 . 00000078 \t")); + ASSERT_EQ(ts, 1672578610120450780LL); + +#ifndef WINDOWS + // 2023-1-1 21:10:10.120450780 + ASSERT_EQ(0, TEST_char2ts("yy \"年\"-MM 月-dd \"日 子\" HH24:MI:ss.ms.us.ns TZH", &ts, TSDB_TIME_PRECISION_NANO, + " 23 年 - 1 月 - 01 日 子 \t 21:10:10 . 12 . \t 00045 . 00000078 \t+08")); + ASSERT_EQ(ts, 1672578610120450780LL); +#endif + + // 2023-1-1 19:10:10.123456789+06 -> 2023-1-1 21:10:10.123456789+08 + ASSERT_EQ(0, TEST_char2ts("yy-MM-dd HH:MI:ss.ms.us.nsa.m.TZH", &ts, TSDB_TIME_PRECISION_NANO, + "23-1-01 7:10:10.123.000456.000000789p.m.6")); + ASSERT_EQ(ts, 1672578610123456789LL); + + // 2023-1-1 12:10:10.123456789-01 -> 2023-1-1 21:10:10.123456789+08 + ASSERT_EQ(0, TEST_char2ts("yy-MM-dd HH24:MI:ss.ms.us.nsTZH", &ts, TSDB_TIME_PRECISION_NANO, + "23-1-01 12:10:10.123.000456.000000789-1")); + ASSERT_EQ(ts, 1672578610123456789LL); + + // 2100-01-01 11:10:10.124456+08 + ASSERT_EQ( + 0, TEST_char2ts("yyyy-MM-dd HH24:MI:ss.usTZH", &ts, TSDB_TIME_PRECISION_MICRO, "2100-01-01 11:10:10.124456+08")); + ASSERT_EQ(ts, 4102456210124456LL); + + // 2100-01-01 11:10:10.124456+08 Firday + ASSERT_EQ(0, TEST_char2ts("yyyy/MONTH/dd DAY HH24:MI:ss.usTZH", &ts, TSDB_TIME_PRECISION_MICRO, + "2100/january/01 friday 11:10:10.124456+08")); + ASSERT_EQ(ts, 4102456210124456LL); + + ASSERT_EQ(0, TEST_char2ts("yyyy/Month/dd Day HH24:MI:ss.usTZH", &ts, TSDB_TIME_PRECISION_MICRO, + "2100/january/01 FRIDAY 11:10:10.124456+08")); + ASSERT_EQ(ts, 4102456210124456LL); + ASSERT_EQ(0, TEST_char2ts("yyyy/Month/dd Dy HH24:MI:ss.usTZH", &ts, TSDB_TIME_PRECISION_MICRO, + "2100/january/01 Fri 11:10:10.124456+08:00")); + ASSERT_EQ(ts, 4102456210124456LL); + + ASSERT_EQ(0, TEST_char2ts("yyyy/month/dd day HH24:MI:ss.usTZH", &ts, TSDB_TIME_PRECISION_MICRO, + "2100/january/01 Friday 11:10:10.124456+08")); + ASSERT_EQ(ts, 4102456210124456LL); + + // 2100-02-01 11:10:10.124456+08 Firday + ASSERT_EQ(0, TEST_char2ts("yyyy/mon/dd DY HH24:MI:ss.usTZH", &ts, TSDB_TIME_PRECISION_MICRO, + "2100/Feb/01 Mon 11:10:10.124456+08")); + ASSERT_EQ(ts, 4105134610124456LL); + + // 2100-02-01 11:10:10.124456+08 Firday + ASSERT_EQ(0, TEST_char2ts("yyyy/mon/dd DY DDD-DD-D HH24:MI:ss.usTZH", &ts, TSDB_TIME_PRECISION_MICRO, + "2100/Feb/01 Mon 100-1-01 11:10:10.124456+08")); + ASSERT_EQ(ts, 4105134610124456LL); + + ASSERT_EQ(0, TEST_char2ts("yyyyMMdd ", &ts, TSDB_TIME_PRECISION_MICRO, "21000101")); + + // What is Fe? + ASSERT_EQ(-1, TEST_char2ts("yyyy/mon/dd ", &ts, TSDB_TIME_PRECISION_MICRO, "2100/Fe/01")); + // '/' cannot convert to MM + ASSERT_EQ(-1, TEST_char2ts("yyyyMMdd ", &ts, TSDB_TIME_PRECISION_MICRO, "2100/2/1")); + // nothing to be converted to dd + ASSERT_EQ(0, TEST_char2ts("yyyyMMdd ", &ts, TSDB_TIME_PRECISION_MICRO, "210012")); + ASSERT_EQ(ts, 4131273600000000LL); // 2100-12-1 + ASSERT_EQ(-1, TEST_char2ts("yyyyMMdd ", &ts, TSDB_TIME_PRECISION_MICRO, "21001")); + ASSERT_EQ(-1, TEST_char2ts("yyyyMM-dd ", &ts, TSDB_TIME_PRECISION_MICRO, "23a1-1")); + + // 2100-1-2 + ASSERT_EQ(0, TEST_char2ts("yyyyMM/dd ", &ts, TSDB_TIME_PRECISION_MICRO, "21001/2")); + ASSERT_EQ(ts, 4102502400000000LL); + + // default to 1970-1-1 00:00:00+08 -> 1969-12-31 16:00:00+00 + ASSERT_EQ(0, TEST_char2ts("YYYY", &ts, TSDB_TIME_PRECISION_SECONDS, "1970")); + ASSERT_EQ(ts, -1 * tsTimezone * 60 * 60); + + ASSERT_EQ(0, TEST_char2ts("yyyyMM1/dd ", &ts, TSDB_TIME_PRECISION_MICRO, "210001/2")); + ASSERT_EQ(ts, 4102502400000000LL); + + ASSERT_EQ(-2, TEST_char2ts("yyyyMM/dd ", &ts, TSDB_TIME_PRECISION_MICRO, "210013/2")); + ASSERT_EQ(-2, TEST_char2ts("yyyyMM/dd ", &ts, TSDB_TIME_PRECISION_MICRO, "210011/32")); + ASSERT_EQ(-1, TEST_char2ts("HH12:MI:SS", &ts, TSDB_TIME_PRECISION_MICRO, "21:12:12")); + ASSERT_EQ(-1, TEST_char2ts("yyyy/MM1/dd ", &ts, TSDB_TIME_PRECISION_MICRO, "2100111111111/11/2")); + ASSERT_EQ(-2, TEST_char2ts("yyyy/MM1/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "23/11/2-13")); + ASSERT_EQ(0, TEST_char2ts("yyyy年 MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "1970年1/1+0")); + ASSERT_EQ(ts, 0); + ASSERT_EQ(-1, TEST_char2ts("yyyy年a MM/dd", &ts, TSDB_TIME_PRECISION_MICRO, "2023年1/2")); + ASSERT_EQ(0, TEST_char2ts("yyyy年 MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "1970年 1/1+0")); + ASSERT_EQ(ts, 0); + ASSERT_EQ(0, TEST_char2ts("yyyy年 a a a MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "1970年 a a a 1/1+0")); + ASSERT_EQ(0, TEST_char2ts("yyyy年 a a a a a a a a a a a a a a a MM/ddTZH", &ts, TSDB_TIME_PRECISION_MICRO, "1970年 a ")); +} + +#pragma GCC diagnostic pop diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index cc542f51ce..c4d525a871 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -137,7 +137,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { SRetention *pRetention = &pCfg->tsdbCfg.retentions[i]; memcpy(pRetention, taosArrayGet(pCreate->pRetensions, i), sizeof(SRetention)); if (i == 0) { - if ((pRetention->freq > 0 && pRetention->keep > 0)) pCfg->isRsma = 1; + if ((pRetention->freq >= 0 && pRetention->keep > 0)) pCfg->isRsma = 1; } } diff --git a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h index b04d336c51..36097438a2 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h @@ -97,11 +97,7 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper); void dmReleaseWrapper(SMgmtWrapper *pWrapper); int32_t dmInitVars(SDnode *pDnode); void dmClearVars(SDnode *pDnode); -#if defined(TD_MODULE_OPTIMIZE) || !defined(TD_ENTERPRISE) int32_t dmInitModule(SDnode *pDnode, SMgmtWrapper *wrappers); -#else -int32_t dmInitModule(SDnode *pDnode); -#endif bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper); SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper); void dmSetStatus(SDnode *pDnode, EDndRunStatus stype); @@ -123,11 +119,7 @@ int32_t dmInitStatusClient(SDnode *pDnode); void dmCleanupClient(SDnode *pDnode); void dmCleanupStatusClient(SDnode *pDnode); SMsgCb dmGetMsgcb(SDnode *pDnode); -#if defined(TD_MODULE_OPTIMIZE) || !defined(TD_ENTERPRISE) int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers); -#else -int32_t dmInitMsgHandle(SDnode *pDnode); -#endif int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); // dmMonitor.c diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c index e9ce4c4f89..409ee45cd3 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -66,15 +66,9 @@ int32_t dmInitDnode(SDnode *pDnode) { goto _OVER; } -#if defined(TD_MODULE_OPTIMIZE) || !defined(TD_ENTERPRISE) if (dmInitModule(pDnode, pDnode->wrappers) != 0) { goto _OVER; } -#else - if (dmInitModule(pDnode) != 0) { - goto _OVER; - } -#endif indexInit(tsNumOfCommitThreads); streamMetaInit(); @@ -113,7 +107,6 @@ void dmCleanupDnode(SDnode *pDnode) { dDebug("dnode is closed, ptr:%p", pDnode); } -#if defined(TD_MODULE_OPTIMIZE) || !defined(TD_ENTERPRISE) int32_t dmInitVars(SDnode *pDnode) { SDnodeData *pData = &pDnode->data; pData->dnodeId = 0; @@ -182,7 +175,6 @@ void dmClearVars(SDnode *pDnode) { taosThreadMutexDestroy(&pDnode->mutex); memset(&pDnode->mutex, 0, sizeof(pDnode->mutex)); } -#endif void dmSetStatus(SDnode *pDnode, EDndRunStatus status) { if (pDnode->status != status) { diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index b7381891d1..ad5ca2cecf 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -251,7 +251,6 @@ _OVER: dmReleaseWrapper(pWrapper); } -#if defined(TD_MODULE_OPTIMIZE) || !defined(TD_ENTERPRISE) int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers) { SDnodeTrans *pTrans = &pDnode->trans; @@ -277,33 +276,6 @@ int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers) { return 0; } -#else -int32_t dmInitMsgHandle(SDnode *pDnode) { - SDnodeTrans *pTrans = &pDnode->trans; - - for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype]; - SArray *pArray = (*pWrapper->func.getHandlesFp)(); - if (pArray == NULL) return -1; - - for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) { - SMgmtHandle *pMgmt = taosArrayGet(pArray, i); - SDnodeHandle *pHandle = &pTrans->msgHandles[TMSG_INDEX(pMgmt->msgType)]; - if (pMgmt->needCheckVgId) { - pHandle->needCheckVgId = pMgmt->needCheckVgId; - } - if (!pMgmt->needCheckVgId) { - pHandle->defaultNtype = ntype; - } - pWrapper->msgFps[TMSG_INDEX(pMgmt->msgType)] = pMgmt->msgFp; - } - - taosArrayDestroy(pArray); - } - - return 0; -} -#endif static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) { SDnode *pDnode = dmInstance(); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 4e93bcdbe7..a9aa96720c 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -397,9 +397,7 @@ void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeInfo) { SDnodeInfo dInfo; dInfo.id = pDnode->id; dInfo.ep.port = pDnode->port; -#ifdef TD_GRANT_HB_OPTIMIZE dInfo.offlineReason = pDnode->offlineReason; -#endif tstrncpy(dInfo.ep.fqdn, pDnode->fqdn, TSDB_FQDN_LEN); tstrncpy(dInfo.active, pDnode->active, TSDB_ACTIVE_KEY_LEN); tstrncpy(dInfo.connActive, pDnode->connActive, TSDB_CONN_ACTIVE_KEY_LEN); diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 79112babc3..1efcd9417d 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -309,7 +309,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader *pReader, _query_reseek_func_t reseek, STs void tsdbUntakeReadSnap2(STsdbReader *pReader, STsdbReadSnap *pSnap, bool proactive); // tsdbMerge.c ============================================================================================== -int32_t tsdbMerge(void *arg); +int32_t tsdbSchedMerge(STsdb *tsdb, int32_t fid); // tsdbDiskData ============================================================================================== int32_t tDiskDataBuilderCreate(SDiskDataBuilder **ppBuilder); @@ -371,7 +371,7 @@ struct STsdb { char *path; SVnode *pVnode; STsdbKeepCfg keepCfg; - TdThreadRwlock rwLock; + TdThreadMutex mutex; SMemTable *mem; SMemTable *imem; STsdbFS fs; // old @@ -668,8 +668,8 @@ struct SDelFWriter { }; #include "tarray2.h" -//#include "tsdbFS2.h" -// struct STFileSet; +// #include "tsdbFS2.h" +// struct STFileSet; typedef struct STFileSet STFileSet; typedef TARRAY2(STFileSet *) TFileSetArray; @@ -677,9 +677,9 @@ typedef struct STSnapRange STSnapRange; typedef TARRAY2(STSnapRange *) TSnapRangeArray; // disjoint snap ranges // util -int32_t tSerializeSnapRangeArray(void *buf, int32_t bufLen, TSnapRangeArray *pSnapR); -int32_t tDeserializeSnapRangeArray(void *buf, int32_t bufLen, TSnapRangeArray *pSnapR); -void tsdbSnapRangeArrayDestroy(TSnapRangeArray **ppSnap); +int32_t tSerializeSnapRangeArray(void *buf, int32_t bufLen, TSnapRangeArray *pSnapR); +int32_t tDeserializeSnapRangeArray(void *buf, int32_t bufLen, TSnapRangeArray *pSnapR); +void tsdbSnapRangeArrayDestroy(TSnapRangeArray **ppSnap); SHashObj *tsdbGetSnapRangeHash(TSnapRangeArray *pRanges); // snap partition list @@ -873,8 +873,8 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf); void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter); bool tMergeTreeNext(SMergeTree *pMTree); -void tMergeTreePinSttBlock(SMergeTree* pMTree); -void tMergeTreeUnpinSttBlock(SMergeTree* pMTree); +void tMergeTreePinSttBlock(SMergeTree *pMTree); +void tMergeTreeUnpinSttBlock(SMergeTree *pMTree); bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree); void tMergeTreeClose(SMergeTree *pMTree); diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index 49f25c0b0a..633e096314 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -31,21 +31,21 @@ static int32_t rsmaRestore(SSma *pSma); } while (0) #define SMA_OPEN_RSMA_IMPL(v, l, force) \ - do { \ - SRetention *r = (SRetention *)VND_RETENTIONS(v) + l; \ - if (!RETENTION_VALID(r)) { \ - if (l == 0) { \ - code = TSDB_CODE_INVALID_PARA; \ - TSDB_CHECK_CODE(code, lino, _exit); \ - } \ - break; \ - } \ - code = smaSetKeepCfg(v, &keepCfg, pCfg, TSDB_TYPE_RSMA_L##l); \ - TSDB_CHECK_CODE(code, lino, _exit); \ + do { \ + SRetention *r = (SRetention *)VND_RETENTIONS(v) + l; \ + if (!RETENTION_VALID(l, r)) { \ + if (l == 0) { \ + code = TSDB_CODE_INVALID_PARA; \ + TSDB_CHECK_CODE(code, lino, _exit); \ + } \ + break; \ + } \ + code = smaSetKeepCfg(v, &keepCfg, pCfg, TSDB_TYPE_RSMA_L##l); \ + TSDB_CHECK_CODE(code, lino, _exit); \ if (tsdbOpen(v, &SMA_RSMA_TSDB##l(pSma), VNODE_RSMA##l##_DIR, &keepCfg, rollback, force) < 0) { \ - code = terrno; \ - TSDB_CHECK_CODE(code, lino, _exit); \ - } \ + code = terrno; \ + TSDB_CHECK_CODE(code, lino, _exit); \ + } \ } while (0) /** @@ -79,20 +79,18 @@ static int32_t smaEvalDays(SVnode *pVnode, SRetention *r, int8_t level, int8_t p freqDuration = convertTimeFromPrecisionToUnit((r + level)->freq, precision, TIME_UNIT_MINUTE); keepDuration = convertTimeFromPrecisionToUnit((r + level)->keep, precision, TIME_UNIT_MINUTE); - int32_t nFreqTimes = (r + level)->freq / (r + TSDB_RETENTION_L0)->freq; + int32_t nFreqTimes = (r + level)->freq / (60 * 1000); // use 60s for freq of 1st level days *= (nFreqTimes > 1 ? nFreqTimes : 1); - if (days > keepDuration) { - days = keepDuration; - } - - if (days > TSDB_MAX_DURATION_PER_FILE) { - days = TSDB_MAX_DURATION_PER_FILE; - } - if (days < freqDuration) { days = freqDuration; } + + int32_t maxKeepDuration = TMIN(keepDuration, TSDB_MAX_DURATION_PER_FILE); + if (days > maxKeepDuration) { + days = maxKeepDuration; + } + _exit: smaInfo("vgId:%d, evaluated duration for level %d is %d, raw val:%d", TD_VID(pVnode), level + 1, days, duration); return days; @@ -157,6 +155,7 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback, bool force) { _exit: if (code) { smaError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); + terrno = code; } return code; } diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 8da2fff5a6..14c5baa402 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -31,8 +31,6 @@ SSmaMgmt smaMgmt = { typedef struct SRSmaQTaskInfoItem SRSmaQTaskInfoItem; -extern int32_t tsdbDoRetention(STsdb *pTsdb, int64_t now); - static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid); static void tdUidStoreDestory(STbUidStore *pStore); static int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SArray *tbUids, bool isAdd); diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index b4c2c0a979..55ae25aee4 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -131,7 +131,7 @@ int32_t tsdbBegin(STsdb *pTsdb) { TSDB_CHECK_CODE(code, lino, _exit); // lock - if ((code = taosThreadRwlockWrlock(&pTsdb->rwLock))) { + if ((code = taosThreadMutexLock(&pTsdb->mutex))) { code = TAOS_SYSTEM_ERROR(code); TSDB_CHECK_CODE(code, lino, _exit); } @@ -139,7 +139,7 @@ int32_t tsdbBegin(STsdb *pTsdb) { pTsdb->mem = pMemTable; // unlock - if ((code = taosThreadRwlockUnlock(&pTsdb->rwLock))) { + if ((code = taosThreadMutexUnlock(&pTsdb->mutex))) { code = TAOS_SYSTEM_ERROR(code); TSDB_CHECK_CODE(code, lino, _exit); } @@ -152,11 +152,11 @@ _exit: } int32_t tsdbPrepareCommit(STsdb *pTsdb) { - taosThreadRwlockWrlock(&pTsdb->rwLock); + taosThreadMutexLock(&pTsdb->mutex); ASSERT(pTsdb->imem == NULL); pTsdb->imem = pTsdb->mem; pTsdb->mem = NULL; - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); return 0; } @@ -171,9 +171,9 @@ int32_t tsdbCommit(STsdb *pTsdb, SCommitInfo *pInfo) { // check if (pMemTable->nRow == 0 && pMemTable->nDel == 0) { - taosThreadRwlockWrlock(&pTsdb->rwLock); + taosThreadMutexLock(&pTsdb->mutex); pTsdb->imem = NULL; - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); tsdbUnrefMemTable(pMemTable, NULL, true); goto _exit; @@ -501,6 +501,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { int32_t lino = 0; STsdb *pTsdb = pCommitter->pTsdb; SDFileSet *pRSet = NULL; + // memory pCommitter->commitFid = tsdbKeyFid(pCommitter->nextKey, pCommitter->minutes, pCommitter->precision); pCommitter->expLevel = tsdbFidLevel(pCommitter->commitFid, &pCommitter->pTsdb->keepCfg, taosGetTimestampSec()); @@ -798,6 +799,7 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) { int32_t lino = 0; STsdb *pTsdb = pCommitter->pTsdb; SMemTable *pMemTable = pTsdb->imem; + // commit file data start code = tsdbCommitFileDataStart(pCommitter); TSDB_CHECK_CODE(code, lino, _exit); @@ -1650,18 +1652,18 @@ int32_t tsdbFinishCommit(STsdb *pTsdb) { SMemTable *pMemTable = pTsdb->imem; // lock - taosThreadRwlockWrlock(&pTsdb->rwLock); + taosThreadMutexLock(&pTsdb->mutex); code = tsdbFSCommit(pTsdb); if (code) { - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); TSDB_CHECK_CODE(code, lino, _exit); } pTsdb->imem = NULL; // unlock - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); if (pMemTable) { tsdbUnrefMemTable(pMemTable, NULL, true); } diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index 6dc492f420..79ecdab15c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -367,7 +367,12 @@ static int32_t tsdbCommitFileSetBegin(SCommitter2 *committer) { int32_t lino = 0; STsdb *tsdb = committer->tsdb; - committer->ctx->fid = tsdbKeyFid(committer->ctx->nextKey, committer->minutes, committer->precision); + int32_t fid = tsdbKeyFid(committer->ctx->nextKey, committer->minutes, committer->precision); + + // check if can commit + tsdbFSCheckCommit(tsdb, fid); + + committer->ctx->fid = fid; committer->ctx->expLevel = tsdbFidLevel(committer->ctx->fid, &tsdb->keepCfg, committer->ctx->now); tsdbFidKeyRange(committer->ctx->fid, committer->minutes, committer->precision, &committer->ctx->minKey, &committer->ctx->maxKey); @@ -549,11 +554,11 @@ _exit: } int32_t tsdbPreCommit(STsdb *tsdb) { - taosThreadRwlockWrlock(&tsdb->rwLock); + taosThreadMutexLock(&tsdb->mutex); ASSERT(tsdb->imem == NULL); tsdb->imem = tsdb->mem; tsdb->mem = NULL; - taosThreadRwlockUnlock(&tsdb->rwLock); + taosThreadMutexUnlock(&tsdb->mutex); return 0; } @@ -568,15 +573,13 @@ int32_t tsdbCommitBegin(STsdb *tsdb, SCommitInfo *info) { int64_t nDel = imem->nDel; if (nRow == 0 && nDel == 0) { - taosThreadRwlockWrlock(&tsdb->rwLock); + taosThreadMutexLock(&tsdb->mutex); tsdb->imem = NULL; - taosThreadRwlockUnlock(&tsdb->rwLock); + taosThreadMutexUnlock(&tsdb->mutex); tsdbUnrefMemTable(imem, NULL, true); } else { SCommitter2 committer[1]; - tsdbFSCheckCommit(tsdb->pFS); - code = tsdbOpenCommitter(tsdb, info, committer); TSDB_CHECK_CODE(code, lino, _exit); @@ -605,14 +608,14 @@ int32_t tsdbCommitCommit(STsdb *tsdb) { if (tsdb->imem == NULL) goto _exit; SMemTable *pMemTable = tsdb->imem; - taosThreadRwlockWrlock(&tsdb->rwLock); + taosThreadMutexLock(&tsdb->mutex); code = tsdbFSEditCommit(tsdb->pFS); if (code) { - taosThreadRwlockUnlock(&tsdb->rwLock); + taosThreadMutexUnlock(&tsdb->mutex); TSDB_CHECK_CODE(code, lino, _exit); } tsdb->imem = NULL; - taosThreadRwlockUnlock(&tsdb->rwLock); + taosThreadMutexUnlock(&tsdb->mutex); tsdbUnrefMemTable(pMemTable, NULL, true); _exit: @@ -640,4 +643,4 @@ _exit: tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); } return code; -} +} \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 93a16b5502..38d221d978 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -55,25 +55,11 @@ static int32_t create_fs(STsdb *pTsdb, STFileSystem **fs) { TARRAY2_INIT(fs[0]->fSetArr); TARRAY2_INIT(fs[0]->fSetArrTmp); - // background task queue - taosThreadMutexInit(fs[0]->mutex, NULL); - fs[0]->bgTaskQueue->next = fs[0]->bgTaskQueue; - fs[0]->bgTaskQueue->prev = fs[0]->bgTaskQueue; - - taosThreadMutexInit(&fs[0]->commitMutex, NULL); - taosThreadCondInit(&fs[0]->canCommit, NULL); - fs[0]->blockCommit = false; - return 0; } static int32_t destroy_fs(STFileSystem **fs) { if (fs[0] == NULL) return 0; - taosThreadMutexDestroy(&fs[0]->commitMutex); - taosThreadCondDestroy(&fs[0]->canCommit); - taosThreadMutexDestroy(fs[0]->mutex); - - ASSERT(fs[0]->bgTaskNum == 0); TARRAY2_DESTROY(fs[0]->fSetArr, NULL); TARRAY2_DESTROY(fs[0]->fSetArrTmp, NULL); @@ -264,10 +250,11 @@ static int32_t apply_commit(STFileSystem *fs) { if (fset1 && fset2) { if (fset1->fid < fset2->fid) { // delete fset1 - TARRAY2_REMOVE(fsetArray1, i1, tsdbTFileSetRemove); + tsdbTFileSetRemove(fset1); + i1++; } else if (fset1->fid > fset2->fid) { // create new file set with fid of fset2->fid - code = tsdbTFileSetInitDup(fs->tsdb, fset2, &fset1); + code = tsdbTFileSetInitCopy(fs->tsdb, fset2, &fset1); if (code) return code; code = TARRAY2_SORT_INSERT(fsetArray1, fset1, tsdbTFileSetCmprFn); if (code) return code; @@ -282,10 +269,11 @@ static int32_t apply_commit(STFileSystem *fs) { } } else if (fset1) { // delete fset1 - TARRAY2_REMOVE(fsetArray1, i1, tsdbTFileSetRemove); + tsdbTFileSetRemove(fset1); + i1++; } else { // create new file set with fid of fset2->fid - code = tsdbTFileSetInitDup(fs->tsdb, fset2, &fset1); + code = tsdbTFileSetInitCopy(fs->tsdb, fset2, &fset1); if (code) return code; code = TARRAY2_SORT_INSERT(fsetArray1, fset1, tsdbTFileSetCmprFn); if (code) return code; @@ -512,7 +500,8 @@ static int32_t tsdbFSDoSanAndFix(STFileSystem *fs) { TARRAY2_FOREACH(lvl->fobjArr, fobj) { code = tsdbFSDoScanAndFixFile(fs, fobj); if (code) { - fset->maxVerValid = (fobj->f->minVer <= fobj->f->maxVer) ? TMIN(fset->maxVerValid, fobj->f->minVer - 1) : -1; + fset->maxVerValid = + (fobj->f->minVer <= fobj->f->maxVer) ? TMIN(fset->maxVerValid, fobj->f->minVer - 1) : -1; corrupt = true; } } @@ -592,7 +581,7 @@ static int32_t tsdbFSDupState(STFileSystem *fs) { const STFileSet *fset1; TARRAY2_FOREACH(src, fset1) { STFileSet *fset2; - code = tsdbTFileSetInitDup(fs->tsdb, fset1, &fset2); + code = tsdbTFileSetInitCopy(fs->tsdb, fset1, &fset2); if (code) return code; code = TARRAY2_APPEND(dst, fset2); if (code) return code; @@ -665,12 +654,6 @@ static int32_t close_file_system(STFileSystem *fs) { return 0; } -static int32_t apply_edit(STFileSystem *pFS) { - int32_t code = 0; - ASSERTS(0, "TODO: Not implemented yet"); - return code; -} - static int32_t fset_cmpr_fn(const struct STFileSet *pSet1, const struct STFileSet *pSet2) { if (pSet1->fid < pSet2->fid) { return -1; @@ -710,10 +693,23 @@ static int32_t edit_fs(STFileSystem *fs, const TFileOpArray *opArray) { TSDB_CHECK_CODE(code, lino, _exit); } - // remove empty file set + // remove empty empty stt level and empty file set int32_t i = 0; while (i < TARRAY2_SIZE(fsetArray)) { fset = TARRAY2_GET(fsetArray, i); + + SSttLvl *lvl; + int32_t j = 0; + while (j < TARRAY2_SIZE(fset->lvlArr)) { + lvl = TARRAY2_GET(fset->lvlArr, j); + + if (TARRAY2_SIZE(lvl->fobjArr) == 0) { + TARRAY2_REMOVE(fset->lvlArr, j, tsdbSttLvlClear); + } else { + j++; + } + } + if (tsdbTFileSetIsEmpty(fset)) { TARRAY2_REMOVE(fsetArray, i, tsdbTFileSetClear); } else { @@ -753,13 +749,13 @@ _exit: static void tsdbDoWaitBgTask(STFileSystem *fs, STFSBgTask *task) { task->numWait++; - taosThreadCondWait(task->done, fs->mutex); + taosThreadCondWait(task->done, &fs->tsdb->mutex); task->numWait--; if (task->numWait == 0) { taosThreadCondDestroy(task->done); - if (task->free) { - task->free(task->arg); + if (task->destroy) { + task->destroy(task->arg); } taosMemoryFree(task); } @@ -770,8 +766,8 @@ static void tsdbDoDoneBgTask(STFileSystem *fs, STFSBgTask *task) { taosThreadCondBroadcast(task->done); } else { taosThreadCondDestroy(task->done); - if (task->free) { - task->free(task->arg); + if (task->destroy) { + task->destroy(task->arg); } taosMemoryFree(task); } @@ -780,23 +776,16 @@ static void tsdbDoDoneBgTask(STFileSystem *fs, STFSBgTask *task) { int32_t tsdbCloseFS(STFileSystem **fs) { if (fs[0] == NULL) return 0; - taosThreadMutexLock(fs[0]->mutex); - fs[0]->stop = true; - - if (fs[0]->bgTaskRunning) { - tsdbDoWaitBgTask(fs[0], fs[0]->bgTaskRunning); - } - taosThreadMutexUnlock(fs[0]->mutex); - + tsdbFSDisableBgTask(fs[0]); close_file_system(fs[0]); destroy_fs(fs); return 0; } int64_t tsdbFSAllocEid(STFileSystem *fs) { - taosThreadRwlockRdlock(&fs->tsdb->rwLock); + taosThreadMutexLock(&fs->tsdb->mutex); int64_t cid = ++fs->neid; - taosThreadRwlockUnlock(&fs->tsdb->rwLock); + taosThreadMutexUnlock(&fs->tsdb->mutex); return cid; } @@ -837,27 +826,34 @@ _exit: return code; } -static int32_t tsdbFSSetBlockCommit(STFileSystem *fs, bool block) { - taosThreadMutexLock(&fs->commitMutex); +static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block) { if (block) { - fs->blockCommit = true; + fset->blockCommit = true; } else { - fs->blockCommit = false; - taosThreadCondSignal(&fs->canCommit); + fset->blockCommit = false; + if (fset->numWaitCommit > 0) { + taosThreadCondSignal(&fset->canCommit); + } } - taosThreadMutexUnlock(&fs->commitMutex); return 0; } -int32_t tsdbFSCheckCommit(STFileSystem *fs) { - taosThreadMutexLock(&fs->commitMutex); - while (fs->blockCommit) { - taosThreadCondWait(&fs->canCommit, &fs->commitMutex); +int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid) { + taosThreadMutexLock(&tsdb->mutex); + STFileSet *fset; + tsdbFSGetFSet(tsdb->pFS, fid, &fset); + if (fset) { + while (fset->blockCommit) { + fset->numWaitCommit++; + taosThreadCondWait(&fset->canCommit, &tsdb->mutex); + fset->numWaitCommit--; + } } - taosThreadMutexUnlock(&fs->commitMutex); + taosThreadMutexUnlock(&tsdb->mutex); return 0; } +// IMPORTANT: the caller must hold fs->tsdb->mutex int32_t tsdbFSEditCommit(STFileSystem *fs) { int32_t code = 0; int32_t lino = 0; @@ -867,36 +863,57 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) { TSDB_CHECK_CODE(code, lino, _exit); // schedule merge - if (fs->tsdb->pVnode->config.sttTrigger > 1) { + int32_t sttTrigger = fs->tsdb->pVnode->config.sttTrigger; + if (sttTrigger > 1) { STFileSet *fset; - int32_t sttTrigger = fs->tsdb->pVnode->config.sttTrigger; - bool schedMerge = false; - bool blockCommit = false; - TARRAY2_FOREACH_REVERSE(fs->fSetArr, fset) { - if (TARRAY2_SIZE(fset->lvlArr) == 0) continue; + if (TARRAY2_SIZE(fset->lvlArr) == 0) { + tsdbFSSetBlockCommit(fset, false); + continue; + } SSttLvl *lvl = TARRAY2_FIRST(fset->lvlArr); - if (lvl->level != 0) continue; + if (lvl->level != 0) { + tsdbFSSetBlockCommit(fset, false); + continue; + } int32_t numFile = TARRAY2_SIZE(lvl->fobjArr); if (numFile >= sttTrigger) { - schedMerge = true; + // launch merge + code = tsdbSchedMerge(fs->tsdb, fset->fid); + TSDB_CHECK_CODE(code, lino, _exit); } if (numFile >= sttTrigger * BLOCK_COMMIT_FACTOR) { - blockCommit = true; + tsdbFSSetBlockCommit(fset, true); + } else { + tsdbFSSetBlockCommit(fset, false); } + } + } - if (schedMerge && blockCommit) break; + // clear empty level and fset + int32_t i = 0; + while (i < TARRAY2_SIZE(fs->fSetArr)) { + STFileSet *fset = TARRAY2_GET(fs->fSetArr, i); + + int32_t j = 0; + while (j < TARRAY2_SIZE(fset->lvlArr)) { + SSttLvl *lvl = TARRAY2_GET(fset->lvlArr, j); + + if (TARRAY2_SIZE(lvl->fobjArr) == 0) { + TARRAY2_REMOVE(fset->lvlArr, j, tsdbSttLvlClear); + } else { + j++; + } } - if (schedMerge) { - code = tsdbFSScheduleBgTask(fs, TSDB_BG_TASK_MERGER, tsdbMerge, NULL, fs->tsdb, NULL); - TSDB_CHECK_CODE(code, lino, _exit); + if (tsdbTFileSetIsEmpty(fset) && fset->bgTaskRunning == NULL) { + TARRAY2_REMOVE(fs->fSetArr, i, tsdbTFileSetClear); + } else { + i++; } - - tsdbFSSetBlockCommit(fs, blockCommit); } _exit: @@ -933,15 +950,15 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) { TARRAY2_INIT(fsetArr[0]); - taosThreadRwlockRdlock(&fs->tsdb->rwLock); + taosThreadMutexLock(&fs->tsdb->mutex); TARRAY2_FOREACH(fs->fSetArr, fset) { - code = tsdbTFileSetInitDup(fs->tsdb, fset, &fset1); + code = tsdbTFileSetInitCopy(fs->tsdb, fset, &fset1); if (code) break; code = TARRAY2_APPEND(fsetArr[0], fset1); if (code) break; } - taosThreadRwlockUnlock(&fs->tsdb->rwLock); + taosThreadMutexUnlock(&fs->tsdb->mutex); if (code) { TARRAY2_DESTROY(fsetArr[0], tsdbTFileSetClear); @@ -961,9 +978,9 @@ int32_t tsdbFSDestroyCopySnapshot(TFileSetArray **fsetArr) { } int32_t tsdbFSCreateRefSnapshot(STFileSystem *fs, TFileSetArray **fsetArr) { - taosThreadRwlockRdlock(&fs->tsdb->rwLock); + taosThreadMutexLock(&fs->tsdb->mutex); int32_t code = tsdbFSCreateRefSnapshotWithoutLock(fs, fsetArr); - taosThreadRwlockUnlock(&fs->tsdb->rwLock); + taosThreadMutexUnlock(&fs->tsdb->mutex); return code; } @@ -1017,7 +1034,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TSnapRangeArray *pRange } } - taosThreadRwlockRdlock(&fs->tsdb->rwLock); + taosThreadMutexLock(&fs->tsdb->mutex); TARRAY2_FOREACH(fs->fSetArr, fset) { int64_t ever = VERSION_MAX; if (pHash) { @@ -1034,7 +1051,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TSnapRangeArray *pRange code = TARRAY2_APPEND(fsetArr[0], fset1); if (code) break; } - taosThreadRwlockUnlock(&fs->tsdb->rwLock); + taosThreadMutexUnlock(&fs->tsdb->mutex); _out: if (code) { @@ -1089,7 +1106,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev } } - taosThreadRwlockRdlock(&fs->tsdb->rwLock); + taosThreadMutexLock(&fs->tsdb->mutex); TARRAY2_FOREACH(fs->fSetArr, fset) { int64_t sver1 = sver; int64_t ever1 = ever; @@ -1118,7 +1135,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev fsr1 = NULL; } - taosThreadRwlockUnlock(&fs->tsdb->rwLock); + taosThreadMutexUnlock(&fs->tsdb->mutex); if (code) { tsdbTSnapRangeClear(&fsr1); @@ -1137,59 +1154,69 @@ _out: const char *gFSBgTaskName[] = {NULL, "MERGE", "RETENTION", "COMPACT"}; static int32_t tsdbFSRunBgTask(void *arg) { - STFileSystem *fs = (STFileSystem *)arg; + STFSBgTask *task = (STFSBgTask *)arg; + STFileSystem *fs = task->fs; + STFileSet *fset; - ASSERT(fs->bgTaskRunning != NULL); + tsdbFSGetFSet(fs, task->fid, &fset); - fs->bgTaskRunning->launchTime = taosGetTimestampMs(); - fs->bgTaskRunning->run(fs->bgTaskRunning->arg); - fs->bgTaskRunning->finishTime = taosGetTimestampMs(); + ASSERT(fset != NULL && fset->bgTaskRunning == task); + + task->launchTime = taosGetTimestampMs(); + task->run(task->arg); + task->finishTime = taosGetTimestampMs(); tsdbDebug("vgId:%d bg task:%s task id:%" PRId64 " finished, schedule time:%" PRId64 " launch time:%" PRId64 " finish time:%" PRId64, - TD_VID(fs->tsdb->pVnode), gFSBgTaskName[fs->bgTaskRunning->type], fs->bgTaskRunning->taskid, - fs->bgTaskRunning->scheduleTime, fs->bgTaskRunning->launchTime, fs->bgTaskRunning->finishTime); + TD_VID(fs->tsdb->pVnode), gFSBgTaskName[task->type], task->taskid, task->scheduleTime, task->launchTime, + task->finishTime); - taosThreadMutexLock(fs->mutex); + taosThreadMutexLock(&fs->tsdb->mutex); // free last - tsdbDoDoneBgTask(fs, fs->bgTaskRunning); - fs->bgTaskRunning = NULL; + tsdbDoDoneBgTask(fs, task); + fset->bgTaskRunning = NULL; // schedule next - if (fs->bgTaskNum > 0) { + if (fset->bgTaskNum > 0) { if (fs->stop) { - while (fs->bgTaskNum > 0) { - STFSBgTask *task = fs->bgTaskQueue->next; - task->prev->next = task->next; - task->next->prev = task->prev; - fs->bgTaskNum--; - tsdbDoDoneBgTask(fs, task); + while (fset->bgTaskNum > 0) { + STFSBgTask *nextTask = fset->bgTaskQueue->next; + nextTask->prev->next = nextTask->next; + nextTask->next->prev = nextTask->prev; + fset->bgTaskNum--; + tsdbDoDoneBgTask(fs, nextTask); } } else { // pop task from head - fs->bgTaskRunning = fs->bgTaskQueue->next; - fs->bgTaskRunning->prev->next = fs->bgTaskRunning->next; - fs->bgTaskRunning->next->prev = fs->bgTaskRunning->prev; - fs->bgTaskNum--; - vnodeScheduleTaskEx(1, tsdbFSRunBgTask, arg); + fset->bgTaskRunning = fset->bgTaskQueue->next; + fset->bgTaskRunning->prev->next = fset->bgTaskRunning->next; + fset->bgTaskRunning->next->prev = fset->bgTaskRunning->prev; + fset->bgTaskNum--; + vnodeScheduleTaskEx(1, tsdbFSRunBgTask, fset->bgTaskRunning); } } - taosThreadMutexUnlock(fs->mutex); + taosThreadMutexUnlock(&fs->tsdb->mutex); return 0; } -static int32_t tsdbFSScheduleBgTaskImpl(STFileSystem *fs, EFSBgTaskT type, int32_t (*run)(void *), - void (*destroy)(void *), void *arg, int64_t *taskid) { +// IMPORTANT: the caller must hold the fs->tsdb->mutex +int32_t tsdbFSScheduleBgTask(STFileSystem *fs, int32_t fid, EFSBgTaskT type, int32_t (*run)(void *), + void (*destroy)(void *), void *arg, int64_t *taskid) { if (fs->stop) { if (destroy) { destroy(arg); } - return 0; // TODO: use a better error code + return 0; } - for (STFSBgTask *task = fs->bgTaskQueue->next; task != fs->bgTaskQueue; task = task->next) { + STFileSet *fset; + tsdbFSGetFSet(fs, fid, &fset); + + ASSERT(fset != NULL); + + for (STFSBgTask *task = fset->bgTaskQueue->next; task != fset->bgTaskQueue; task = task->next) { if (task->type == type) { if (destroy) { destroy(arg); @@ -1203,22 +1230,24 @@ static int32_t tsdbFSScheduleBgTaskImpl(STFileSystem *fs, EFSBgTaskT type, int if (task == NULL) return TSDB_CODE_OUT_OF_MEMORY; taosThreadCondInit(task->done, NULL); + task->fs = fs; + task->fid = fid; task->type = type; task->run = run; - task->free = destroy; + task->destroy = destroy; task->arg = arg; task->scheduleTime = taosGetTimestampMs(); task->taskid = ++fs->taskid; - if (fs->bgTaskRunning == NULL && fs->bgTaskNum == 0) { + if (fset->bgTaskRunning == NULL && fset->bgTaskNum == 0) { // launch task directly - fs->bgTaskRunning = task; - vnodeScheduleTaskEx(1, tsdbFSRunBgTask, fs); + fset->bgTaskRunning = task; + vnodeScheduleTaskEx(1, tsdbFSRunBgTask, task); } else { // add to the queue tail - fs->bgTaskNum++; - task->next = fs->bgTaskQueue; - task->prev = fs->bgTaskQueue->prev; + fset->bgTaskNum++; + task->next = fset->bgTaskQueue; + task->prev = fset->bgTaskQueue->prev; task->prev->next = task; task->next->prev = task; } @@ -1227,68 +1256,30 @@ static int32_t tsdbFSScheduleBgTaskImpl(STFileSystem *fs, EFSBgTaskT type, int return 0; } -int32_t tsdbFSScheduleBgTask(STFileSystem *fs, EFSBgTaskT type, int32_t (*run)(void *), void (*free)(void *), void *arg, - int64_t *taskid) { - taosThreadMutexLock(fs->mutex); - int32_t code = tsdbFSScheduleBgTaskImpl(fs, type, run, free, arg, taskid); - taosThreadMutexUnlock(fs->mutex); - return code; -} +int32_t tsdbFSDisableBgTask(STFileSystem *fs) { + taosThreadMutexLock(&fs->tsdb->mutex); + for (;;) { + fs->stop = true; + bool done = true; -int32_t tsdbFSWaitBgTask(STFileSystem *fs, int64_t taskid) { - STFSBgTask *task = NULL; - - taosThreadMutexLock(fs->mutex); - - if (fs->bgTaskRunning && fs->bgTaskRunning->taskid == taskid) { - task = fs->bgTaskRunning; - } else { - for (STFSBgTask *taskt = fs->bgTaskQueue->next; taskt != fs->bgTaskQueue; taskt = taskt->next) { - if (taskt->taskid == taskid) { - task = taskt; + STFileSet *fset; + TARRAY2_FOREACH(fs->fSetArr, fset) { + if (fset->bgTaskRunning) { + tsdbDoWaitBgTask(fs, fset->bgTaskRunning); + done = false; break; } } - } - if (task) { - tsdbDoWaitBgTask(fs, task); + if (done) break; } - - taosThreadMutexUnlock(fs->mutex); + taosThreadMutexUnlock(&fs->tsdb->mutex); return 0; } -int32_t tsdbFSWaitAllBgTask(STFileSystem *fs) { - taosThreadMutexLock(fs->mutex); - - while (fs->bgTaskRunning) { - taosThreadCondWait(fs->bgTaskRunning->done, fs->mutex); - } - - taosThreadMutexUnlock(fs->mutex); - return 0; -} - -static int32_t tsdbFSDoDisableBgTask(STFileSystem *fs) { - fs->stop = true; - - if (fs->bgTaskRunning) { - tsdbDoWaitBgTask(fs, fs->bgTaskRunning); - } - return 0; -} - -int32_t tsdbFSDisableBgTask(STFileSystem *fs) { - taosThreadMutexLock(fs->mutex); - int32_t code = tsdbFSDoDisableBgTask(fs); - taosThreadMutexUnlock(fs->mutex); - return code; -} - int32_t tsdbFSEnableBgTask(STFileSystem *fs) { - taosThreadMutexLock(fs->mutex); + taosThreadMutexLock(&fs->tsdb->mutex); fs->stop = false; - taosThreadMutexUnlock(fs->mutex); + taosThreadMutexUnlock(&fs->tsdb->mutex); return 0; -} +} \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.h b/source/dnode/vnode/src/tsdb/tsdbFS2.h index 31b98e5656..a3a8e2f575 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.h +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.h @@ -22,22 +22,11 @@ extern "C" { #endif -/* Exposed Handle */ -typedef struct STFileSystem STFileSystem; -typedef struct STFSBgTask STFSBgTask; -// typedef TARRAY2(STFileSet *) TFileSetArray; - typedef enum { TSDB_FEDIT_COMMIT = 1, // TSDB_FEDIT_MERGE } EFEditT; -typedef enum { - TSDB_BG_TASK_MERGER = 1, - TSDB_BG_TASK_RETENTION, - TSDB_BG_TASK_COMPACT, -} EFSBgTaskT; - typedef enum { TSDB_FCURRENT = 1, TSDB_FCURRENT_C, // for commit @@ -67,37 +56,17 @@ int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT e int32_t tsdbFSEditCommit(STFileSystem *fs); int32_t tsdbFSEditAbort(STFileSystem *fs); // background task -int32_t tsdbFSScheduleBgTask(STFileSystem *fs, EFSBgTaskT type, int32_t (*run)(void *), void (*free)(void *), void *arg, - int64_t *taskid); -int32_t tsdbFSWaitBgTask(STFileSystem *fs, int64_t taskid); -int32_t tsdbFSWaitAllBgTask(STFileSystem *fs); +int32_t tsdbFSScheduleBgTask(STFileSystem *fs, int32_t fid, EFSBgTaskT type, int32_t (*run)(void *), + void (*destroy)(void *), void *arg, int64_t *taskid); int32_t tsdbFSDisableBgTask(STFileSystem *fs); int32_t tsdbFSEnableBgTask(STFileSystem *fs); // other int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset); -int32_t tsdbFSCheckCommit(STFileSystem *fs); +int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid); // utils int32_t save_fs(const TFileSetArray *arr, const char *fname); int32_t current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype); -struct STFSBgTask { - EFSBgTaskT type; - int32_t (*run)(void *arg); - void (*free)(void *arg); - void *arg; - - TdThreadCond done[1]; - int32_t numWait; - - int64_t taskid; - int64_t scheduleTime; - int64_t launchTime; - int64_t finishTime; - - struct STFSBgTask *prev; - struct STFSBgTask *next; -}; - /* Exposed Structs */ struct STFileSystem { STsdb *tsdb; @@ -109,17 +78,8 @@ struct STFileSystem { TFileSetArray fSetArrTmp[1]; // background task queue - TdThreadMutex mutex[1]; - bool stop; - int64_t taskid; - int32_t bgTaskNum; - STFSBgTask bgTaskQueue[1]; - STFSBgTask *bgTaskRunning; - - // block commit variables - TdThreadMutex commitMutex; - TdThreadCond canCommit; - bool blockCommit; + bool stop; + int64_t taskid; }; #ifdef __cplusplus diff --git a/source/dnode/vnode/src/tsdb/tsdbFSet2.c b/source/dnode/vnode/src/tsdb/tsdbFSet2.c index 620fcb3a47..642d555366 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFSet2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFSet2.c @@ -342,11 +342,6 @@ int32_t tsdbTFileSetEdit(STsdb *pTsdb, STFileSet *fset, const STFileOp *op) { int32_t idx = TARRAY2_SEARCH_IDX(lvl->fobjArr, &tfobjp, tsdbTFileObjCmpr, TD_EQ); ASSERT(idx >= 0); TARRAY2_REMOVE(lvl->fobjArr, idx, tsdbSttLvlClearFObj); - - if (TARRAY2_SIZE(lvl->fobjArr) == 0) { - // TODO: remove the stt level if no file exists anymore - // TARRAY2_REMOVE(&fset->lvlArr, lvl - fset->lvlArr.data, tsdbSttLvlClear); - } } else { ASSERT(tsdbIsSameTFile(&op->of, fset->farr[op->of.type]->f)); tsdbTFileObjUnref(fset->farr[op->of.type]); @@ -454,10 +449,22 @@ int32_t tsdbTFileSetInit(int32_t fid, STFileSet **fset) { fset[0]->fid = fid; fset[0]->maxVerValid = VERSION_MAX; TARRAY2_INIT(fset[0]->lvlArr); + + // background task queue + fset[0]->bgTaskNum = 0; + fset[0]->bgTaskQueue->next = fset[0]->bgTaskQueue; + fset[0]->bgTaskQueue->prev = fset[0]->bgTaskQueue; + fset[0]->bgTaskRunning = NULL; + + // block commit variables + taosThreadCondInit(&fset[0]->canCommit, NULL); + fset[0]->numWaitCommit = 0; + fset[0]->blockCommit = false; + return 0; } -int32_t tsdbTFileSetInitDup(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fset) { +int32_t tsdbTFileSetInitCopy(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fset) { int32_t code = tsdbTFileSetInit(fset1->fid, fset); if (code) return code; @@ -588,21 +595,23 @@ int32_t tsdbTFileSetClear(STFileSet **fset) { TARRAY2_DESTROY(fset[0]->lvlArr, tsdbSttLvlClear); + taosThreadCondDestroy(&fset[0]->canCommit); taosMemoryFree(fset[0]); fset[0] = NULL; return 0; } -int32_t tsdbTFileSetRemove(STFileSet **fset) { +int32_t tsdbTFileSetRemove(STFileSet *fset) { + if (fset == NULL) return 0; + for (tsdb_ftype_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) { - if (fset[0]->farr[ftype] == NULL) continue; - tsdbTFileObjRemove(fset[0]->farr[ftype]); + if (fset->farr[ftype] == NULL) continue; + tsdbTFileObjRemove(fset->farr[ftype]); } - TARRAY2_DESTROY(fset[0]->lvlArr, tsdbSttLvlRemove); - taosMemoryFree(fset[0]); - fset[0] = NULL; + TARRAY2_DESTROY(fset->lvlArr, tsdbSttLvlRemove); + return 0; } diff --git a/source/dnode/vnode/src/tsdb/tsdbFSet2.h b/source/dnode/vnode/src/tsdb/tsdbFSet2.h index ea0f99f68e..34f174ade7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFSet2.h +++ b/source/dnode/vnode/src/tsdb/tsdbFSet2.h @@ -28,6 +28,8 @@ typedef struct SSttLvl SSttLvl; typedef TARRAY2(STFileObj *) TFileObjArray; typedef TARRAY2(SSttLvl *) TSttLvlArray; typedef TARRAY2(STFileOp) TFileOpArray; +typedef struct STFileSystem STFileSystem; +typedef struct STFSBgTask STFSBgTask; typedef enum { TSDB_FOP_NONE = 0, @@ -41,10 +43,10 @@ typedef enum { // init/clear int32_t tsdbTFileSetInit(int32_t fid, STFileSet **fset); -int32_t tsdbTFileSetInitDup(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fset); +int32_t tsdbTFileSetInitCopy(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fset); int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fset); int32_t tsdbTFileSetClear(STFileSet **fset); -int32_t tsdbTFileSetRemove(STFileSet **fset); +int32_t tsdbTFileSetRemove(STFileSet *fset); int32_t tsdbTFileSetFilteredInitDup(STsdb *pTsdb, const STFileSet *fset1, int64_t ever, STFileSet **fset, TFileOpArray *fopArr); @@ -58,6 +60,7 @@ int32_t tsdbJsonToTFileSet(STsdb *pTsdb, const cJSON *json, STFileSet **fset); // cmpr int32_t tsdbTFileSetCmprFn(const STFileSet **fset1, const STFileSet **fset2); // edit +int32_t tsdbSttLvlClear(SSttLvl **lvl); int32_t tsdbTFileSetEdit(STsdb *pTsdb, STFileSet *fset, const STFileOp *op); int32_t tsdbTFileSetApplyEdit(STsdb *pTsdb, const STFileSet *fset1, STFileSet *fset); // max commit id @@ -70,6 +73,33 @@ bool tsdbTFileSetIsEmpty(const STFileSet *fset); int32_t tsdbSttLvlInit(int32_t level, SSttLvl **lvl); int32_t tsdbSttLvlClear(SSttLvl **lvl); +typedef enum { + TSDB_BG_TASK_MERGER = 1, + TSDB_BG_TASK_RETENTION, + TSDB_BG_TASK_COMPACT, +} EFSBgTaskT; + +struct STFSBgTask { + STFileSystem *fs; + int32_t fid; + + EFSBgTaskT type; + int32_t (*run)(void *arg); + void (*destroy)(void *arg); + void *arg; + + TdThreadCond done[1]; + int32_t numWait; + + int64_t taskid; + int64_t scheduleTime; + int64_t launchTime; + int64_t finishTime; + + struct STFSBgTask *prev; + struct STFSBgTask *next; +}; + struct STFileOp { tsdb_fop_t optype; int32_t fid; @@ -87,6 +117,16 @@ struct STFileSet { int64_t maxVerValid; STFileObj *farr[TSDB_FTYPE_MAX]; // file array TSttLvlArray lvlArr[1]; // level array + + // background task queue + int32_t bgTaskNum; + STFSBgTask bgTaskQueue[1]; + STFSBgTask *bgTaskRunning; + + // block commit variables + TdThreadCond canCommit; + int32_t numWaitCommit; + bool blockCommit; }; struct STSnapRange { diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index ee3abf7559..cc77474e79 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -191,7 +191,7 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid pMemTable->nDel++; pMemTable->minVer = TMIN(pMemTable->minVer, version); - pMemTable->maxVer = TMIN(pMemTable->maxVer, version); + pMemTable->maxVer = TMAX(pMemTable->maxVer, version); /* if (TSDB_CACHE_LAST_ROW(pMemTable->pTsdb->pVnode->config) && tsdbKeyCmprFn(&lastKey, &pTbData->maxKey) >= 0) { tsdbCacheDeleteLastrow(pTsdb->lruCache, pTbData->uid, eKey); diff --git a/source/dnode/vnode/src/tsdb/tsdbMerge.c b/source/dnode/vnode/src/tsdb/tsdbMerge.c index e659cedba3..0c20a342d3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMerge.c +++ b/source/dnode/vnode/src/tsdb/tsdbMerge.c @@ -15,11 +15,17 @@ #include "tsdbMerge.h" -#define TSDB_MAX_LEVEL 6 // means max level is 7 +#define TSDB_MAX_LEVEL 2 // means max level is 3 typedef struct { - STsdb *tsdb; - TFileSetArray *fsetArr; + STsdb *tsdb; + int32_t fid; +} SMergeArg; + +typedef struct { + STsdb *tsdb; + int32_t fid; + STFileSet *fset; int32_t sttTrigger; int32_t maxRow; @@ -313,7 +319,6 @@ static int32_t tsdbMergeFileSetBeginOpenWriter(SMerger *merger) { if (merger->ctx->fset->farr[ftype]) { config.files[ftype].exist = true; config.files[ftype].file = merger->ctx->fset->farr[ftype]->f[0]; - } else { config.files[ftype].exist = false; } @@ -397,13 +402,13 @@ static int32_t tsdbMergeFileSetEnd(SMerger *merger) { code = tsdbFSEditBegin(merger->tsdb->pFS, merger->fopArr, TSDB_FEDIT_MERGE); TSDB_CHECK_CODE(code, lino, _exit); - taosThreadRwlockWrlock(&merger->tsdb->rwLock); + taosThreadMutexLock(&merger->tsdb->mutex); code = tsdbFSEditCommit(merger->tsdb->pFS); if (code) { - taosThreadRwlockUnlock(&merger->tsdb->rwLock); + taosThreadMutexUnlock(&merger->tsdb->mutex); TSDB_CHECK_CODE(code, lino, _exit); } - taosThreadRwlockUnlock(&merger->tsdb->rwLock); + taosThreadMutexUnlock(&merger->tsdb->mutex); _exit: if (code) { @@ -478,30 +483,21 @@ _exit: } static int32_t tsdbDoMerge(SMerger *merger) { - int32_t code = 0; - int32_t lino = 0; + int32_t code = 0; + int32_t lino = 0; + SSttLvl *lvl = TARRAY2_FIRST(merger->fset->lvlArr); - STFileSet *fset; - TARRAY2_FOREACH(merger->fsetArr, fset) { - if (TARRAY2_SIZE(fset->lvlArr) == 0) continue; + if (TARRAY2_SIZE(merger->fset->lvlArr) == 0) return 0; + if (lvl->level != 0 || TARRAY2_SIZE(lvl->fobjArr) < merger->sttTrigger) return 0; - SSttLvl *lvl = TARRAY2_FIRST(fset->lvlArr); + code = tsdbMergerOpen(merger); + TSDB_CHECK_CODE(code, lino, _exit); - if (lvl->level != 0 || TARRAY2_SIZE(lvl->fobjArr) < merger->sttTrigger) continue; + code = tsdbMergeFileSet(merger, merger->fset); + TSDB_CHECK_CODE(code, lino, _exit); - if (!merger->ctx->opened) { - code = tsdbMergerOpen(merger); - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tsdbMergeFileSet(merger, fset); - TSDB_CHECK_CODE(code, lino, _exit); - } - - if (merger->ctx->opened) { - code = tsdbMergerClose(merger); - TSDB_CHECK_CODE(code, lino, _exit); - } + code = tsdbMergerClose(merger); + TSDB_CHECK_CODE(code, lino, _exit); _exit: if (code) { @@ -512,36 +508,73 @@ _exit: return code; } -int32_t tsdbMerge(void *arg) { - int32_t code = 0; - int32_t lino = 0; - STsdb *tsdb = (STsdb *)arg; +static int32_t tsdbMergeGetFSet(SMerger *merger) { + STFileSet *fset; - SMerger merger[1] = {{ - .tsdb = tsdb, - .sttTrigger = tsdb->pVnode->config.sttTrigger, - }}; - - if (merger->sttTrigger <= 1) { + taosThreadMutexLock(&merger->tsdb->mutex); + tsdbFSGetFSet(merger->tsdb->pFS, merger->fid, &fset); + if (fset == NULL) { + taosThreadMutexUnlock(&merger->tsdb->mutex); return 0; } - code = tsdbFSCreateCopySnapshot(tsdb->pFS, &merger->fsetArr); + int32_t code = tsdbTFileSetInitCopy(merger->tsdb, fset, &merger->fset); + if (code) { + taosThreadMutexUnlock(&merger->tsdb->mutex); + return code; + } + taosThreadMutexUnlock(&merger->tsdb->mutex); + return 0; +} + +static int32_t tsdbMerge(void *arg) { + int32_t code = 0; + int32_t lino = 0; + SMergeArg *mergeArg = (SMergeArg *)arg; + STsdb *tsdb = mergeArg->tsdb; + + SMerger merger[1] = {{ + .tsdb = tsdb, + .fid = mergeArg->fid, + .sttTrigger = tsdb->pVnode->config.sttTrigger, + }}; + + if (merger->sttTrigger <= 1) return 0; + + // copy snapshot + code = tsdbMergeGetFSet(merger); TSDB_CHECK_CODE(code, lino, _exit); + if (merger->fset == NULL) return 0; + + // do merge + tsdbDebug("vgId:%d merge begin, fid:%d", TD_VID(tsdb->pVnode), merger->fid); code = tsdbDoMerge(merger); + tsdbDebug("vgId:%d merge done, fid:%d", TD_VID(tsdb->pVnode), mergeArg->fid); TSDB_CHECK_CODE(code, lino, _exit); - tsdbFSDestroyCopySnapshot(&merger->fsetArr); - _exit: if (code) { TSDB_ERROR_LOG(TD_VID(tsdb->pVnode), lino, code); tsdbFatal("vgId:%d, failed to merge stt files since %s. code:%d", TD_VID(tsdb->pVnode), terrstr(), code); taosMsleep(100); exit(EXIT_FAILURE); - } else if (merger->ctx->opened) { - tsdbDebug("vgId:%d %s done", TD_VID(tsdb->pVnode), __func__); } + tsdbTFileSetClear(&merger->fset); return code; } + +int32_t tsdbSchedMerge(STsdb *tsdb, int32_t fid) { + SMergeArg *arg = taosMemoryMalloc(sizeof(*arg)); + if (arg == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + arg->tsdb = tsdb; + arg->fid = fid; + + int32_t code = tsdbFSScheduleBgTask(tsdb->pFS, fid, TSDB_BG_TASK_MERGER, tsdbMerge, taosMemoryFree, arg, NULL); + if (code) taosMemoryFree(arg); + + return code; +} \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbOpen.c b/source/dnode/vnode/src/tsdb/tsdbOpen.c index 6dd66c7a40..c32b2eedd7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOpen.c +++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c @@ -53,7 +53,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir); // taosRealPath(pTsdb->path, NULL, slen); pTsdb->pVnode = pVnode; - taosThreadRwlockInit(&pTsdb->rwLock, NULL); + taosThreadMutexInit(&pTsdb->mutex, NULL); if (!pKeepCfg) { tsdbSetKeepCfg(pTsdb, &pVnode->config.tsdbCfg); } else { @@ -99,15 +99,14 @@ int tsdbClose(STsdb **pTsdb) { tsdbDebug("vgId:%d, tsdb is close at %s, days:%d, keep:%d,%d,%d, keepTimeOffset:%d", TD_VID(pdb->pVnode), pdb->path, pdb->keepCfg.days, pdb->keepCfg.keep0, pdb->keepCfg.keep1, pdb->keepCfg.keep2, pdb->keepCfg.keepTimeOffset); - taosThreadRwlockWrlock(&(*pTsdb)->rwLock); + taosThreadMutexLock(&(*pTsdb)->mutex); tsdbMemTableDestroy((*pTsdb)->mem, true); (*pTsdb)->mem = NULL; - taosThreadRwlockUnlock(&(*pTsdb)->rwLock); - - taosThreadRwlockDestroy(&(*pTsdb)->rwLock); + taosThreadMutexUnlock(&(*pTsdb)->mutex); tsdbCloseFS(&(*pTsdb)->pFS); tsdbCloseCache(*pTsdb); + taosThreadMutexDestroy(&(*pTsdb)->mutex); taosMemoryFreeClear(*pTsdb); } return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 65cebf0ca0..41e0bd373e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -1105,8 +1105,9 @@ static int32_t dataBlockPartiallyRequired(STimeWindow* pWindow, SVersionRange* p (pVerRange->maxVer < pBlock->record.maxVer && pVerRange->maxVer >= pBlock->record.minVer); } -static bool getNeighborBlockOfSameTable(SDataBlockIter* pBlockIter, SFileDataBlockInfo* pBlockInfo, STableBlockScanInfo* pTableBlockScanInfo, - int32_t* nextIndex, int32_t order, SBrinRecord* pRecord) { +static bool getNeighborBlockOfSameTable(SDataBlockIter* pBlockIter, SFileDataBlockInfo* pBlockInfo, + STableBlockScanInfo* pTableBlockScanInfo, int32_t* nextIndex, int32_t order, + SBrinRecord* pRecord) { bool asc = ASCENDING_TRAVERSE(order); if (asc && pBlockInfo->tbBlockIdx >= taosArrayGetSize(pTableBlockScanInfo->pBlockIdxList) - 1) { return false; @@ -1119,7 +1120,8 @@ static bool getNeighborBlockOfSameTable(SDataBlockIter* pBlockIter, SFileDataBlo int32_t step = asc ? 1 : -1; // *nextIndex = pBlockInfo->tbBlockIdx + step; // *pBlockIndex = *(SBlockIndex*)taosArrayGet(pTableBlockScanInfo->pBlockList, *nextIndex); - STableDataBlockIdx* pTableDataBlockIdx = taosArrayGet(pTableBlockScanInfo->pBlockIdxList, pBlockInfo->tbBlockIdx + step); + STableDataBlockIdx* pTableDataBlockIdx = + taosArrayGet(pTableBlockScanInfo->pBlockIdxList, pBlockInfo->tbBlockIdx + step); SFileDataBlockInfo* p = taosArrayGet(pBlockIter->blockList, pTableDataBlockIdx->globalIndex); memcpy(pRecord, &p->record, sizeof(SBrinRecord)); @@ -1145,7 +1147,8 @@ static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlock return -1; } -static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIter* pBlockIter, int32_t index, int32_t step) { +static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIter* pBlockIter, int32_t index, + int32_t step) { if (index < 0 || index >= pBlockIter->numOfBlocks) { return -1; } @@ -1153,12 +1156,13 @@ static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIte SFileDataBlockInfo fblock = *(SFileDataBlockInfo*)taosArrayGet(pBlockIter->blockList, index); pBlockIter->index += step; - if (index != pBlockIter->index) { + if (index != pBlockIter->index) { if (index > pBlockIter->index) { for (int32_t i = index - 1; i >= pBlockIter->index; --i) { SFileDataBlockInfo* pBlockInfo = taosArrayGet(pBlockIter->blockList, i); - STableBlockScanInfo* pBlockScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); + STableBlockScanInfo* pBlockScanInfo = + getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); STableDataBlockIdx* pTableDataBlockIdx = taosArrayGet(pBlockScanInfo->pBlockIdxList, pBlockInfo->tbBlockIdx); pTableDataBlockIdx->globalIndex = i + 1; @@ -1168,13 +1172,13 @@ static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIte for (int32_t i = index + 1; i <= pBlockIter->index; ++i) { SFileDataBlockInfo* pBlockInfo = taosArrayGet(pBlockIter->blockList, i); - STableBlockScanInfo* pBlockScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); + STableBlockScanInfo* pBlockScanInfo = + getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); STableDataBlockIdx* pTableDataBlockIdx = taosArrayGet(pBlockScanInfo->pBlockIdxList, pBlockInfo->tbBlockIdx); pTableDataBlockIdx->globalIndex = i - 1; taosArraySet(pBlockIter->blockList, i - 1, pBlockInfo); } - } taosArraySet(pBlockIter->blockList, pBlockIter->index, &fblock); @@ -1286,7 +1290,8 @@ static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo* int32_t neighborIndex = 0; SBrinRecord rec = {0}; - bool hasNeighbor = getNeighborBlockOfSameTable(&pReader->status.blockIter, pBlockInfo, pScanInfo, &neighborIndex, pReader->info.order, &rec); + bool hasNeighbor = getNeighborBlockOfSameTable(&pReader->status.blockIter, pBlockInfo, pScanInfo, &neighborIndex, + pReader->info.order, &rec); // overlap with neighbor if (hasNeighbor) { @@ -1420,9 +1425,7 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc } } -static void doPinSttBlock(SLastBlockReader* pLastBlockReader) { - tMergeTreePinSttBlock(&pLastBlockReader->mergeTree); -} +static void doPinSttBlock(SLastBlockReader* pLastBlockReader) { tMergeTreePinSttBlock(&pLastBlockReader->mergeTree); } static void doUnpinSttBlock(SLastBlockReader* pLastBlockReader) { tMergeTreeUnpinSttBlock(&pLastBlockReader->mergeTree); @@ -1568,7 +1571,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* if (minKey == tsLast) { TSDBROW* fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); - int32_t code = tsdbRowMergerAdd(pMerger, fRow1, NULL); + int32_t code = tsdbRowMergerAdd(pMerger, fRow1, NULL); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1618,7 +1621,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* if (minKey == tsLast) { TSDBROW* fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); - int32_t code = tsdbRowMergerAdd(pMerger, fRow1, NULL); + int32_t code = tsdbRowMergerAdd(pMerger, fRow1, NULL); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1826,8 +1829,8 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN; - TSDBKEY k = TSDBROW_KEY(pRow); - TSDBKEY ik = TSDBROW_KEY(piRow); + TSDBKEY k = TSDBROW_KEY(pRow); + TSDBKEY ik = TSDBROW_KEY(piRow); STSchema* pSchema = NULL; if (pRow->type == TSDBROW_ROW_FMT) { @@ -2219,8 +2222,9 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; TSDBROW *pRow = NULL, *piRow = NULL; - int64_t key = (pBlockData->nRow > 0 && (!pDumpInfo->allDumped)) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : - (ASCENDING_TRAVERSE(pReader->info.order) ? INT64_MAX : INT64_MIN); + int64_t key = (pBlockData->nRow > 0 && (!pDumpInfo->allDumped)) + ? pBlockData->aTSKEY[pDumpInfo->rowIndex] + : (ASCENDING_TRAVERSE(pReader->info.order) ? INT64_MAX : INT64_MIN); if (pBlockScanInfo->iter.hasVal) { pRow = getValidMemRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader); } @@ -2257,7 +2261,8 @@ static int32_t loadNeighborIfOverlap(SFileDataBlockInfo* pBlockInfo, STableBlock *loadNeighbor = false; SBrinRecord rec = {0}; - bool hasNeighbor = getNeighborBlockOfSameTable(&pReader->status.blockIter, pBlockInfo, pBlockScanInfo, &nextIndex, pReader->info.order, &rec); + bool hasNeighbor = getNeighborBlockOfSameTable(&pReader->status.blockIter, pBlockInfo, pBlockScanInfo, &nextIndex, + pReader->info.order, &rec); if (!hasNeighbor) { // do nothing return code; } @@ -2268,7 +2273,7 @@ static int32_t loadNeighborIfOverlap(SFileDataBlockInfo* pBlockInfo, STableBlock // 1. find the next neighbor block in the scan block list STableDataBlockIdx* tableDataBlockIdx = taosArrayGet(pBlockScanInfo->pBlockIdxList, nextIndex); - int32_t neighborIndex = tableDataBlockIdx->globalIndex; + int32_t neighborIndex = tableDataBlockIdx->globalIndex; // 2. remove it from the scan block list setFileBlockActiveInBlockIter(pReader, pBlockIter, neighborIndex, step); @@ -2704,7 +2709,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { (ASCENDING_TRAVERSE(pReader->info.order)) ? pBlockInfo->record.firstKey : pBlockInfo->record.lastKey; code = buildDataBlockFromBuf(pReader, pScanInfo, endKey); } else { - bool bHasDataInLastBlock = hasDataInLastBlock(pLastBlockReader); + bool bHasDataInLastBlock = hasDataInLastBlock(pLastBlockReader); int64_t tsLast = bHasDataInLastBlock ? getCurrentKeyInLastBlock(pLastBlockReader) : INT64_MIN; if (!bHasDataInLastBlock || ((asc && pBlockInfo->record.lastKey < tsLast) || (!asc && pBlockInfo->record.firstKey > tsLast))) { @@ -3479,7 +3484,7 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, // start to merge duplicated rows STSchema* pTSchema = NULL; - if (current.type == TSDBROW_ROW_FMT) { // get the correct schema for row-wise data in memory + if (current.type == TSDBROW_ROW_FMT) { // get the correct schema for row-wise data in memory pTSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(¤t), pReader, uid); if (pTSchema == NULL) { return terrno; @@ -3525,8 +3530,8 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p SRow** pTSRow) { SRowMerger* pMerger = &pReader->status.merger; - TSDBKEY k = TSDBROW_KEY(pRow); - TSDBKEY ik = TSDBROW_KEY(piRow); + TSDBKEY k = TSDBROW_KEY(pRow); + TSDBKEY ik = TSDBROW_KEY(piRow); STSchema* pSchema = NULL; if (pRow->type == TSDBROW_ROW_FMT) { @@ -4907,12 +4912,12 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs SVersionRange* pRange = &pReader->info.verRange; // lock - taosThreadRwlockRdlock(&pTsdb->rwLock); + taosThreadMutexLock(&pTsdb->mutex); // alloc STsdbReadSnap* pSnap = (STsdbReadSnap*)taosMemoryCalloc(1, sizeof(STsdbReadSnap)); if (pSnap == NULL) { - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } @@ -4922,7 +4927,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs pSnap->pMem = pTsdb->mem; pSnap->pNode = taosMemoryMalloc(sizeof(*pSnap->pNode)); if (pSnap->pNode == NULL) { - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } @@ -4937,7 +4942,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs pSnap->pIMem = pTsdb->imem; pSnap->pINode = taosMemoryMalloc(sizeof(*pSnap->pINode)); if (pSnap->pINode == NULL) { - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } @@ -4952,7 +4957,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs code = tsdbFSCreateRefSnapshotWithoutLock(pTsdb->pFS, &pSnap->pfSetArray); // unlock - taosThreadRwlockUnlock(&pTsdb->rwLock); + taosThreadMutexUnlock(&pTsdb->mutex); if (code == TSDB_CODE_SUCCESS) { tsdbTrace("vgId:%d, take read snapshot", TD_VID(pTsdb->pVnode)); @@ -5005,4 +5010,5 @@ void tsdbReaderSetId2(STsdbReader* pReader, const char* idstr) { pReader->status.fileIter.pLastBlockReader->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;*/ +} diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index f2665dcf26..6c41b46c73 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -25,11 +25,6 @@ typedef struct { TFileSetArray *fsetArr; TFileOpArray fopArr[1]; - - struct { - int32_t fsetArrIdx; - STFileSet *fset; - } ctx[1]; } SRTNer; static int32_t tsdbDoRemoveFileObject(SRTNer *rtner, const STFileObj *fobj) { @@ -227,8 +222,8 @@ _exit: typedef struct { STsdb *tsdb; - int32_t sync; int64_t now; + int32_t fid; } SRtnArg; static int32_t tsdbDoRetentionBegin(SRtnArg *arg, SRTNer *rtner) { @@ -263,15 +258,15 @@ static int32_t tsdbDoRetentionEnd(SRTNer *rtner) { code = tsdbFSEditBegin(rtner->tsdb->pFS, rtner->fopArr, TSDB_FEDIT_MERGE); TSDB_CHECK_CODE(code, lino, _exit); - taosThreadRwlockWrlock(&rtner->tsdb->rwLock); + taosThreadMutexLock(&rtner->tsdb->mutex); code = tsdbFSEditCommit(rtner->tsdb->pFS); if (code) { - taosThreadRwlockUnlock(&rtner->tsdb->rwLock); + taosThreadMutexUnlock(&rtner->tsdb->mutex); TSDB_CHECK_CODE(code, lino, _exit); } - taosThreadRwlockUnlock(&rtner->tsdb->rwLock); + taosThreadMutexUnlock(&rtner->tsdb->mutex); TARRAY2_DESTROY(rtner->fopArr, NULL); @@ -285,95 +280,83 @@ _exit: return code; } -static int32_t tsdbDoRetention2(void *arg) { - int32_t code = 0; - int32_t lino = 0; - SRTNer rtner[1] = {0}; +static int32_t tsdbDoRetentionOnFileSet(SRTNer *rtner, STFileSet *fset) { + int32_t code = 0; + int32_t lino = 0; + STFileObj *fobj = NULL; + int32_t expLevel = tsdbFidLevel(fset->fid, &rtner->tsdb->keepCfg, rtner->now); - code = tsdbDoRetentionBegin(arg, rtner); - TSDB_CHECK_CODE(code, lino, _exit); + if (expLevel < 0) { // remove the fileset + for (int32_t ftype = 0; (ftype < TSDB_FTYPE_MAX) && (fobj = fset->farr[ftype], 1); ++ftype) { + if (fobj == NULL) continue; - for (rtner->ctx->fsetArrIdx = 0; rtner->ctx->fsetArrIdx < TARRAY2_SIZE(rtner->fsetArr); rtner->ctx->fsetArrIdx++) { - rtner->ctx->fset = TARRAY2_GET(rtner->fsetArr, rtner->ctx->fsetArrIdx); - - STFileObj *fobj; - int32_t expLevel = tsdbFidLevel(rtner->ctx->fset->fid, &rtner->tsdb->keepCfg, rtner->now); - - if (expLevel < 0) { // remove the file set - for (int32_t ftype = 0; (ftype < TSDB_FTYPE_MAX) && (fobj = rtner->ctx->fset->farr[ftype], 1); ++ftype) { - if (fobj == NULL) continue; - - int32_t nlevel = tfsGetLevel(rtner->tsdb->pVnode->pTfs); - if (tsS3Enabled && nlevel > 1 && TSDB_FTYPE_DATA == ftype && fobj->f->did.level == nlevel - 1) { - code = tsdbRemoveFileObjectS3(rtner, fobj); - TSDB_CHECK_CODE(code, lino, _exit); - } else { - code = tsdbDoRemoveFileObject(rtner, fobj); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - - SSttLvl *lvl; - TARRAY2_FOREACH(rtner->ctx->fset->lvlArr, lvl) { - TARRAY2_FOREACH(lvl->fobjArr, fobj) { - code = tsdbDoRemoveFileObject(rtner, fobj); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - } else if (expLevel == 0) { - continue; - } else { - SDiskID did; - - if (tfsAllocDisk(rtner->tsdb->pVnode->pTfs, expLevel, &did) < 0) { - code = terrno; + int32_t nlevel = tfsGetLevel(rtner->tsdb->pVnode->pTfs); + if (tsS3Enabled && nlevel > 1 && TSDB_FTYPE_DATA == ftype && fobj->f->did.level == nlevel - 1) { + code = tsdbRemoveFileObjectS3(rtner, fobj); + TSDB_CHECK_CODE(code, lino, _exit); + } else { + code = tsdbDoRemoveFileObject(rtner, fobj); TSDB_CHECK_CODE(code, lino, _exit); } - tfsMkdirRecurAt(rtner->tsdb->pVnode->pTfs, rtner->tsdb->path, did); + } - // data - for (int32_t ftype = 0; ftype < TSDB_FTYPE_MAX && (fobj = rtner->ctx->fset->farr[ftype], 1); ++ftype) { - if (fobj == NULL) continue; + SSttLvl *lvl; + TARRAY2_FOREACH(fset->lvlArr, lvl) { + TARRAY2_FOREACH(lvl->fobjArr, fobj) { + code = tsdbDoRemoveFileObject(rtner, fobj); + TSDB_CHECK_CODE(code, lino, _exit); + } + } + } else if (expLevel == 0) { // only migrate to upper level + return 0; + } else { // migrate + SDiskID did; + if (tfsAllocDisk(rtner->tsdb->pVnode->pTfs, expLevel, &did) < 0) { + code = terrno; + TSDB_CHECK_CODE(code, lino, _exit); + } + tfsMkdirRecurAt(rtner->tsdb->pVnode->pTfs, rtner->tsdb->path, did); + + // data + for (int32_t ftype = 0; ftype < TSDB_FTYPE_MAX && (fobj = fset->farr[ftype], 1); ++ftype) { + if (fobj == NULL) continue; + + if (fobj->f->did.level == did.level) continue; + + int32_t nlevel = tfsGetLevel(rtner->tsdb->pVnode->pTfs); + if (tsS3Enabled && nlevel > 1 && TSDB_FTYPE_DATA == ftype && did.level == nlevel - 1) { + code = tsdbMigrateDataFileS3(rtner, fobj, &did); + TSDB_CHECK_CODE(code, lino, _exit); + } else { + if (tsS3Enabled) { + int64_t fsize = 0; + if (taosStatFile(fobj->fname, &fsize, NULL, NULL) < 0) { + code = TAOS_SYSTEM_ERROR(terrno); + tsdbError("vgId:%d %s failed since file:%s stat failed, reason:%s", TD_VID(rtner->tsdb->pVnode), __func__, + fobj->fname, tstrerror(code)); + TSDB_CHECK_CODE(code, lino, _exit); + } + s3EvictCache(fobj->fname, fsize * 2); + } + + code = tsdbDoMigrateFileObj(rtner, fobj, &did); + TSDB_CHECK_CODE(code, lino, _exit); + } + } + + // stt + SSttLvl *lvl; + TARRAY2_FOREACH(fset->lvlArr, lvl) { + TARRAY2_FOREACH(lvl->fobjArr, fobj) { if (fobj->f->did.level == did.level) continue; - int32_t nlevel = tfsGetLevel(rtner->tsdb->pVnode->pTfs); - if (tsS3Enabled && nlevel > 1 && TSDB_FTYPE_DATA == ftype && did.level == nlevel - 1) { - code = tsdbMigrateDataFileS3(rtner, fobj, &did); - TSDB_CHECK_CODE(code, lino, _exit); - } else { - if (tsS3Enabled) { - int64_t fsize = 0; - if (taosStatFile(fobj->fname, &fsize, NULL, NULL) < 0) { - code = TAOS_SYSTEM_ERROR(terrno); - tsdbError("vgId:%d %s failed since file:%s stat failed, reason:%s", TD_VID(rtner->tsdb->pVnode), __func__, - fobj->fname, tstrerror(code)); - TSDB_CHECK_CODE(code, lino, _exit); - } - s3EvictCache(fobj->fname, fsize * 2); - } - - code = tsdbDoMigrateFileObj(rtner, fobj, &did); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - - // stt - SSttLvl *lvl; - TARRAY2_FOREACH(rtner->ctx->fset->lvlArr, lvl) { - TARRAY2_FOREACH(lvl->fobjArr, fobj) { - if (fobj->f->did.level == did.level) continue; - - code = tsdbDoMigrateFileObj(rtner, fobj, &did); - TSDB_CHECK_CODE(code, lino, _exit); - } + code = tsdbDoMigrateFileObj(rtner, fobj, &did); + TSDB_CHECK_CODE(code, lino, _exit); } } } - code = tsdbDoRetentionEnd(rtner); - TSDB_CHECK_CODE(code, lino, _exit); - _exit: if (code) { if (TARRAY2_DATA(rtner->fopArr)) { @@ -389,30 +372,105 @@ _exit: return code; } -static void tsdbFreeRtnArg(void *arg) { - SRtnArg *rArg = (SRtnArg *)arg; - if (rArg->sync) { - tsem_post(&rArg->tsdb->pVnode->canCommit); +static int32_t tsdbDoRetentionSync(void *arg) { + int32_t code = 0; + int32_t lino = 0; + SRTNer rtner[1] = {0}; + + code = tsdbDoRetentionBegin(arg, rtner); + TSDB_CHECK_CODE(code, lino, _exit); + + STFileSet *fset; + TARRAY2_FOREACH(rtner->fsetArr, fset) { + code = tsdbDoRetentionOnFileSet(rtner, fset); + TSDB_CHECK_CODE(code, lino, _exit); } - taosMemoryFree(arg); + + code = tsdbDoRetentionEnd(rtner); + TSDB_CHECK_CODE(code, lino, _exit); + +_exit: + if (code) { + TSDB_ERROR_LOG(TD_VID(rtner->tsdb->pVnode), lino, code); + } + tsem_post(&((SRtnArg *)arg)->tsdb->pVnode->canCommit); + return code; } -int32_t tsdbRetention(STsdb *tsdb, int64_t now, int32_t sync) { - SRtnArg *arg = taosMemoryMalloc(sizeof(*arg)); - if (arg == NULL) return TSDB_CODE_OUT_OF_MEMORY; - arg->tsdb = tsdb; - arg->sync = sync; - arg->now = now; +static int32_t tsdbDoRetentionAsync(void *arg) { + int32_t code = 0; + int32_t lino = 0; + SRTNer rtner[1] = {0}; - if (sync) { - tsem_wait(&tsdb->pVnode->canCommit); + code = tsdbDoRetentionBegin(arg, rtner); + TSDB_CHECK_CODE(code, lino, _exit); + + STFileSet *fset; + TARRAY2_FOREACH(rtner->fsetArr, fset) { + if (fset->fid != ((SRtnArg *)arg)->fid) continue; + + code = tsdbDoRetentionOnFileSet(rtner, fset); + TSDB_CHECK_CODE(code, lino, _exit); } - int64_t taskid; - int32_t code = - tsdbFSScheduleBgTask(tsdb->pFS, TSDB_BG_TASK_RETENTION, tsdbDoRetention2, tsdbFreeRtnArg, arg, &taskid); + code = tsdbDoRetentionEnd(rtner); + TSDB_CHECK_CODE(code, lino, _exit); + +_exit: if (code) { - tsdbFreeRtnArg(arg); + TSDB_ERROR_LOG(TD_VID(rtner->tsdb->pVnode), lino, code); } return code; } + +static void tsdbFreeRtnArg(void *arg) { taosMemoryFree(arg); } + +int32_t tsdbRetention(STsdb *tsdb, int64_t now, int32_t sync) { + int32_t code = 0; + + if (sync) { // sync retention + SRtnArg *arg = taosMemoryMalloc(sizeof(*arg)); + if (arg == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + arg->tsdb = tsdb; + arg->now = now; + arg->fid = INT32_MAX; + + tsem_wait(&tsdb->pVnode->canCommit); + code = vnodeScheduleTask(tsdbDoRetentionSync, arg); + if (code) { + tsem_post(&tsdb->pVnode->canCommit); + taosMemoryFree(arg); + return code; + } + } else { // async retention + taosThreadMutexLock(&tsdb->mutex); + + STFileSet *fset; + TARRAY2_FOREACH(tsdb->pFS->fSetArr, fset) { + SRtnArg *arg = taosMemoryMalloc(sizeof(*arg)); + if (arg == NULL) { + taosThreadMutexUnlock(&tsdb->mutex); + return TSDB_CODE_OUT_OF_MEMORY; + } + + arg->tsdb = tsdb; + arg->now = now; + arg->fid = fset->fid; + + code = tsdbFSScheduleBgTask(tsdb->pFS, fset->fid, TSDB_BG_TASK_RETENTION, tsdbDoRetentionAsync, tsdbFreeRtnArg, + arg, NULL); + if (code) { + tsdbFreeRtnArg(arg); + taosThreadMutexUnlock(&tsdb->mutex); + return code; + } + } + + taosThreadMutexUnlock(&tsdb->mutex); + } + + return code; +} diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 76177766ed..a9da0fbcec 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -38,8 +38,8 @@ struct STsdbSnapReader { struct { int32_t fsrArrIdx; STSnapRange* fsr; - bool isDataDone; - bool isTombDone; + bool isDataDone; + bool isTombDone; } ctx[1]; // reader @@ -1095,17 +1095,17 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** writer, int8_t rollback) { code = tsdbFSEditAbort(writer[0]->tsdb->pFS); TSDB_CHECK_CODE(code, lino, _exit); } else { - taosThreadRwlockWrlock(&writer[0]->tsdb->rwLock); + taosThreadMutexLock(&writer[0]->tsdb->mutex); code = tsdbFSEditCommit(writer[0]->tsdb->pFS); if (code) { - taosThreadRwlockUnlock(&writer[0]->tsdb->rwLock); + taosThreadMutexUnlock(&writer[0]->tsdb->mutex); TSDB_CHECK_CODE(code, lino, _exit); } writer[0]->tsdb->pFS->fsstate = TSDB_FS_STATE_NORMAL; - taosThreadRwlockUnlock(&writer[0]->tsdb->rwLock); + taosThreadMutexUnlock(&writer[0]->tsdb->mutex); } tsdbFSEnableBgTask(tsdb->pFS); @@ -1236,7 +1236,7 @@ static int32_t tsdbTFileSetToSnapPart(STFileSet* fset, STsdbSnapPartition** ppSP if (fset->farr[ftype] == NULL) continue; typ = tsdbFTypeToSRangeTyp(ftype); ASSERT(typ < TSDB_SNAP_RANGE_TYP_MAX); - STFile* f = fset->farr[ftype]->f; + STFile* f = fset->farr[ftype]->f; if (f->maxVer > fset->maxVerValid) { corrupt = true; tsdbError("skip incomplete data file: fid:%d, maxVerValid:%" PRId64 ", minVer:%" PRId64 ", maxVer:%" PRId64 @@ -1255,7 +1255,7 @@ static int32_t tsdbTFileSetToSnapPart(STFileSet* fset, STsdbSnapPartition** ppSP TARRAY2_FOREACH(fset->lvlArr, lvl) { STFileObj* fobj; TARRAY2_FOREACH(lvl->fobjArr, fobj) { - STFile* f = fobj->f; + STFile* f = fobj->f; if (f->maxVer > fset->maxVerValid) { corrupt = true; tsdbError("skip incomplete stt file.fid:%d, maxVerValid:%" PRId64 ", minVer:%" PRId64 ", maxVer:%" PRId64 @@ -1299,7 +1299,7 @@ static STsdbSnapPartList* tsdbGetSnapPartList(STFileSystem* fs) { } int32_t code = 0; - taosThreadRwlockRdlock(&fs->tsdb->rwLock); + taosThreadMutexLock(&fs->tsdb->mutex); STFileSet* fset; TARRAY2_FOREACH(fs->fSetArr, fset) { STsdbSnapPartition* pItem = NULL; @@ -1311,7 +1311,7 @@ static STsdbSnapPartList* tsdbGetSnapPartList(STFileSystem* fs) { code = TARRAY2_SORT_INSERT(pList, pItem, tsdbSnapPartCmprFn); ASSERT(code == 0); } - taosThreadRwlockUnlock(&fs->tsdb->rwLock); + taosThreadMutexUnlock(&fs->tsdb->mutex); if (code) { TARRAY2_DESTROY(pList, tsdbSnapPartitionClear); diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index bbd67611cb..07bfa6c719 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -106,7 +106,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keepTimeOffset", pCfg->tsdbCfg.keepTimeOffset) < 0) return -1; - if (pCfg->tsdbCfg.retentions[0].freq > 0) { + if (pCfg->tsdbCfg.retentions[0].keep > 0) { int32_t nRetention = 1; if (pCfg->tsdbCfg.retentions[1].freq > 0) { ++nRetention; diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index 87b407efcb..91244e321f 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -584,6 +584,7 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot * // commit json if (!rollback) { + ASSERT(pVnode->config.vgId == pWriter->info.config.vgId); pWriter->info.state.committed = pWriter->ever; pVnode->config = pWriter->info.config; pVnode->state = (SVState){.committed = pWriter->info.state.committed, diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index c46ea15111..b6a4aaf388 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -20,6 +20,7 @@ #include "vnode.h" #include "vnodeInt.h" #include "audit.h" +#include "tstrbuild.h" static int32_t vnodeProcessCreateStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessAlterStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); @@ -886,6 +887,7 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, char tbName[TSDB_TABLE_FNAME_LEN]; STbUidStore *pStore = NULL; SArray *tbUids = NULL; + SArray *tbNames = NULL; pRsp->msgType = TDMT_VND_CREATE_TABLE_RSP; pRsp->code = TSDB_CODE_SUCCESS; @@ -902,7 +904,8 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, rsp.pArray = taosArrayInit(req.nReqs, sizeof(cRsp)); tbUids = taosArrayInit(req.nReqs, sizeof(int64_t)); - if (rsp.pArray == NULL || tbUids == NULL) { + tbNames = taosArrayInit(req.nReqs, sizeof(char*)); + if (rsp.pArray == NULL || tbUids == NULL || tbNames == NULL) { rcode = -1; terrno = TSDB_CODE_OUT_OF_MEMORY; goto _exit; @@ -948,12 +951,9 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, taosArrayPush(rsp.pArray, &cRsp); if(tsEnableAuditCreateTable){ - int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId; - - SName name = {0}; - tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB); - - auditRecord(NULL, clusterId, "createTable", name.dbname, "", pCreateReq->name, strlen(pCreateReq->name)); + char* str = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN); + strcpy(str, pCreateReq->name); + taosArrayPush(tbNames, &str); } } @@ -976,17 +976,42 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, tEncoderInit(&encoder, pRsp->pCont, pRsp->contLen); tEncodeSVCreateTbBatchRsp(&encoder, &rsp); + if(tsEnableAuditCreateTable){ + int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId; + + SName name = {0}; + tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB); + + SStringBuilder sb = {0}; + for(int32_t iReq = 0; iReq < req.nReqs; iReq++){ + char** key = (char**)taosArrayGet(tbNames, iReq); + taosStringBuilderAppendStringLen(&sb, *key, strlen(*key)); + if(iReq < req.nReqs - 1){ + taosStringBuilderAppendChar(&sb, ','); + } + taosMemoryFreeClear(*key); + } + + size_t len = 0; + char* keyJoined = taosStringBuilderGetResult(&sb, &len); + + auditRecord(NULL, clusterId, "createTable", name.dbname, "", keyJoined, len); + + taosStringBuilderDestroy(&sb); + } + _exit: for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pCreateReq = req.pReqs + iReq; taosMemoryFree(pCreateReq->sql); taosMemoryFree(pCreateReq->comment); - taosArrayDestroy(pCreateReq->ctb.tagName); + taosArrayDestroy(pCreateReq->ctb.tagName); } taosArrayDestroyEx(rsp.pArray, tFreeSVCreateTbRsp); taosArrayDestroy(tbUids); tDecoderClear(&decoder); tEncoderClear(&encoder); + taosArrayDestroy(tbNames); return rcode; } @@ -1120,6 +1145,7 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in int32_t ret; SArray *tbUids = NULL; STbUidStore *pStore = NULL; + SArray *tbNames = NULL; pRsp->msgType = TDMT_VND_DROP_TABLE_RSP; pRsp->pCont = NULL; @@ -1138,7 +1164,8 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in // process req tbUids = taosArrayInit(req.nReqs, sizeof(int64_t)); rsp.pArray = taosArrayInit(req.nReqs, sizeof(SVDropTbRsp)); - if (tbUids == NULL || rsp.pArray == NULL) goto _exit; + tbNames = taosArrayInit(req.nReqs, sizeof(char*)); + if (tbUids == NULL || rsp.pArray == NULL || tbNames == NULL) goto _exit; for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { SVDropTbReq *pDropTbReq = req.pReqs + iReq; @@ -1159,11 +1186,41 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in } taosArrayPush(rsp.pArray, &dropTbRsp); + + if(tsEnableAuditCreateTable){ + char* str = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN); + strcpy(str, pDropTbReq->name); + taosArrayPush(tbNames, &str); + } } tqUpdateTbUidList(pVnode->pTq, tbUids, false); tdUpdateTbUidList(pVnode->pSma, pStore, false); + if(tsEnableAuditCreateTable){ + int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId; + + SName name = {0}; + tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB); + + SStringBuilder sb = {0}; + for(int32_t iReq = 0; iReq < req.nReqs; iReq++){ + char** key = (char**)taosArrayGet(tbNames, iReq); + taosStringBuilderAppendStringLen(&sb, *key, strlen(*key)); + if(iReq < req.nReqs - 1){ + taosStringBuilderAppendChar(&sb, ','); + } + taosMemoryFreeClear(*key); + } + + size_t len = 0; + char* keyJoined = taosStringBuilderGetResult(&sb, &len); + + auditRecord(NULL, clusterId, "dropTable", name.dbname, "", keyJoined, len); + + taosStringBuilderDestroy(&sb); + } + _exit: taosArrayDestroy(tbUids); tdUidStoreFree(pStore); @@ -1174,6 +1231,7 @@ _exit: tEncodeSVDropTbBatchRsp(&encoder, &rsp); tEncoderClear(&encoder); taosArrayDestroy(rsp.pArray); + taosArrayDestroy(tbNames); return 0; } diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 6c03ed68e9..c9e805d80b 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -516,7 +516,10 @@ static int32_t vnodeSnapshotStopWrite(const SSyncFSM *pFsm, void *pWriter, bool pVnode->config.vgId, isApply, pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, pSnapshot->lastConfigIndex); int32_t code = vnodeSnapWriterClose(pWriter, !isApply, pSnapshot); - vInfo("vgId:%d, apply vnode snapshot finished, code:0x%x", pVnode->config.vgId, code); + if (code != 0) { + vError("vgId:%d, failed to finish applying vnode snapshot since %s, code:0x%x", pVnode->config.vgId, terrstr(), + code); + } return code; } diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 252b20a23c..4cc76c6572 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -219,37 +219,28 @@ int64_t getValOfDiffPrecision(int8_t unit, int64_t val) { return v; } -char* buildRetension(SArray* pRetension) { +static char* buildRetension(SArray* pRetension) { size_t size = taosArrayGetSize(pRetension); if (size == 0) { return NULL; } - char* p1 = taosMemoryCalloc(1, 100); - SRetention* p = taosArrayGet(pRetension, 0); - + char* p1 = taosMemoryCalloc(1, 100); int32_t len = 0; - int64_t v1 = getValOfDiffPrecision(p->freqUnit, p->freq); - int64_t v2 = getValOfDiffPrecision(p->keepUnit, p->keep); - len += sprintf(p1 + len, "%" PRId64 "%c:%" PRId64 "%c", v1, p->freqUnit, v2, p->keepUnit); + for (int32_t i = 0; i < size; ++i) { + SRetention* p = TARRAY_GET_ELEM(pRetension, i); + int64_t v1 = getValOfDiffPrecision(p->freqUnit, p->freq); + int64_t v2 = getValOfDiffPrecision(p->keepUnit, p->keep); + if (i == 0) { + len += sprintf(p1 + len, "-:%" PRId64 "%c", v2, p->keepUnit); + } else { + len += sprintf(p1 + len, "%" PRId64 "%c:%" PRId64 "%c", v1, p->freqUnit, v2, p->keepUnit); + } - if (size > 1) { - len += sprintf(p1 + len, ","); - p = taosArrayGet(pRetension, 1); - - v1 = getValOfDiffPrecision(p->freqUnit, p->freq); - v2 = getValOfDiffPrecision(p->keepUnit, p->keep); - len += sprintf(p1 + len, "%" PRId64 "%c:%" PRId64 "%c", v1, p->freqUnit, v2, p->keepUnit); - } - - if (size > 2) { - len += sprintf(p1 + len, ","); - p = taosArrayGet(pRetension, 2); - - v1 = getValOfDiffPrecision(p->freqUnit, p->freq); - v2 = getValOfDiffPrecision(p->keepUnit, p->keep); - len += sprintf(p1 + len, "%" PRId64 "%c:%" PRId64 "%c", v1, p->freqUnit, v2, p->keepUnit); + if (i < size - 1) { + len += sprintf(p1 + len, ","); + } } return p1; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 68a83fa662..84aff9fa88 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2083,6 +2083,34 @@ static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int return TSDB_CODE_SUCCESS; } +static int32_t translateToTimestamp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (LIST_LENGTH(pFunc->pParameterList) != 2) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + uint8_t para2Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type; + if (!IS_STR_DATA_TYPE(para1Type) || !IS_STR_DATA_TYPE(para2Type)) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + pFunc->node.resType = + (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateToChar(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (LIST_LENGTH(pFunc->pParameterList) != 2) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + uint8_t para2Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type; + // currently only support to_char(timestamp, str) + if (!IS_STR_DATA_TYPE(para2Type) || !IS_TIMESTAMP_TYPE(para1Type)) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + pFunc->node.resType = (SDataType){.bytes = 4096, .type = TSDB_DATA_TYPE_VARCHAR}; + return TSDB_CODE_SUCCESS; +} + static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); if (2 != numOfParams && 3 != numOfParams) { @@ -3284,6 +3312,26 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .sprocessFunc = castFunction, .finalizeFunc = NULL }, + { + .name = "to_timestamp", + .type = FUNCTION_TYPE_TO_TIMESTAMP, + .classification = FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateToTimestamp, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = toTimestampFunction, + .finalizeFunc = NULL + }, + { + .name = "to_char", + .type = FUNCTION_TYPE_TO_CHAR, + .classification = FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateToChar, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = toCharFunction, + .finalizeFunc = NULL + }, { .name = "to_iso8601", .type = FUNCTION_TYPE_TO_ISO8601, diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 60abbf0ef1..9bcf65dbbe 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -305,6 +305,7 @@ retention_list(A) ::= retention(B). retention_list(A) ::= retention_list(B) NK_COMMA retention(C). { A = addNodeToList(pCxt, B, C); } retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). { A = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &B), createDurationValueNode(pCxt, &C)); } +retention(A) ::= NK_MINUS(B) NK_COLON NK_VARIABLE(C). { A = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &B), createDurationValueNode(pCxt, &C)); } %type speed_opt { int32_t } %destructor speed_opt { } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 939c93714c..3ae82c3615 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1055,9 +1055,13 @@ SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pPr return select; } -SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags) { +SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags) { if (pStmt && QUERY_NODE_SELECT_STMT == nodeType(pStmt)) { - ((SSelectStmt*)pStmt)->tagScan = bSelectTags; + if (pCxt->pQueryCxt->biMode) { + ((SSelectStmt*)pStmt)->tagScan = true; + } else { + ((SSelectStmt*)pStmt)->tagScan = bSelectTags; + } } return pStmt; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 582e198028..e49c0845a0 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3559,6 +3559,20 @@ static const char* getPrecisionStr(uint8_t precision) { return "unknown"; } +static int64_t getPrecisionMultiple(uint8_t precision) { + switch (precision) { + case TSDB_TIME_PRECISION_MILLI: + return 1; + case TSDB_TIME_PRECISION_MICRO: + return 1000; + case TSDB_TIME_PRECISION_NANO: + return 1000000; + default: + break; + } + return 1; +} + static void convertVarDuration(SValueNode* pOffset, uint8_t precision) { const int64_t factors[3] = {NANOSECOND_PER_MSEC, NANOSECOND_PER_USEC, 1}; const int8_t units[3] = {TIME_UNIT_MILLISECOND, TIME_UNIT_MICROSECOND, TIME_UNIT_NANOSECOND}; @@ -3572,6 +3586,7 @@ static void convertVarDuration(SValueNode* pOffset, uint8_t precision) { pOffset->unit = units[precision]; } +static const int64_t tsdbMaxKeepMS = (int64_t)60 * 1000 * TSDB_MAX_KEEP; static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* pInterval) { uint8_t precision = ((SColumnNode*)pInterval->pCol)->node.resType.precision; @@ -3580,6 +3595,8 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* if (pInter->datum.i <= 0 || (!valInter && pInter->datum.i < tsMinIntervalTime)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL, tsMinIntervalTime, getPrecisionStr(precision)); + } else if (pInter->datum.i / getPrecisionMultiple(precision) > tsdbMaxKeepMS) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_VALUE_TOO_BIG, 1000, "years"); } if (NULL != pInterval->pOffset) { @@ -4648,10 +4665,22 @@ static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRete SValueNode* pPrevFreq = NULL; SValueNode* pPrevKeep = NULL; SNode* pRetention = NULL; + bool firstFreq = true; FOREACH(pRetention, pRetentions) { SNode* pNode = NULL; FOREACH(pNode, ((SNodeListNode*)pRetention)->pNodeList) { SValueNode* pVal = (SValueNode*)pNode; + if (firstFreq) { + firstFreq = false; + if (pVal->literal[0] != '-' || strlen(pVal->literal) != 1) { + return generateSyntaxErrMsgExt( + &pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid option retentions(freq): %s, the interval of 1st retention level should be '-'", pVal->literal); + } + pVal->unit = TIME_UNIT_SECOND; // assign minimum unit + pVal->datum.i = 0; // assign minimum value + continue; + } if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) { return pCxt->errCode; } @@ -4676,7 +4705,7 @@ static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRete } // check value range - if (pFreq->datum.i <= 0) { + if (pPrevFreq != NULL && pFreq->datum.i <= 0) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option retentions(freq): %s should larger than 0", pFreq->literal); } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index f87f7ef1f0..26e6111074 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -65,6 +65,8 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "This statement is no longer supported"; case TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL: return "Interval cannot be less than %d %s"; + case TSDB_CODE_PAR_INTER_VALUE_TOO_BIG: + return "Interval cannot be more than %d %s"; case TSDB_CODE_PAR_DB_NOT_SPECIFIED: return "Database not specified"; case TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index e0c4ccff43..f012b90941 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -142,18 +142,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 833 -#define YYNRULE 638 -#define YYNRULE_WITH_ACTION 638 +#define YYNSTATE 835 +#define YYNRULE 639 +#define YYNRULE_WITH_ACTION 639 #define YYNTOKEN 346 -#define YY_MAX_SHIFT 832 -#define YY_MIN_SHIFTREDUCE 1234 -#define YY_MAX_SHIFTREDUCE 1871 -#define YY_ERROR_ACTION 1872 -#define YY_ACCEPT_ACTION 1873 -#define YY_NO_ACTION 1874 -#define YY_MIN_REDUCE 1875 -#define YY_MAX_REDUCE 2512 +#define YY_MAX_SHIFT 834 +#define YY_MIN_SHIFTREDUCE 1237 +#define YY_MAX_SHIFTREDUCE 1875 +#define YY_ERROR_ACTION 1876 +#define YY_ACCEPT_ACTION 1877 +#define YY_NO_ACTION 1878 +#define YY_MIN_REDUCE 1879 +#define YY_MAX_REDUCE 2517 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -222,324 +222,324 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (3178) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 173, 409, 462, 418, 2273, 720, 2062, 461, 2002, 171, - /* 10 */ 2003, 168, 48, 46, 1795, 424, 423, 2064, 397, 2064, - /* 20 */ 415, 1665, 1636, 41, 40, 137, 2113, 47, 45, 44, - /* 30 */ 43, 42, 599, 475, 2171, 1721, 1959, 1634, 41, 40, - /* 40 */ 1643, 694, 47, 45, 44, 43, 42, 2314, 1661, 720, - /* 50 */ 2062, 2115, 662, 469, 662, 2483, 681, 2483, 381, 148, - /* 60 */ 702, 184, 2375, 30, 1716, 1876, 2113, 719, 556, 207, - /* 70 */ 19, 557, 1918, 2489, 203, 2489, 203, 1642, 2484, 688, - /* 80 */ 2484, 688, 218, 383, 2332, 2175, 127, 719, 2332, 126, + /* 0 */ 173, 409, 462, 418, 2278, 720, 2067, 461, 2006, 171, + /* 10 */ 2007, 168, 48, 46, 1799, 424, 423, 2069, 397, 2069, + /* 20 */ 415, 1669, 1640, 41, 40, 137, 2118, 47, 45, 44, + /* 30 */ 43, 42, 599, 475, 2176, 1725, 1963, 1638, 41, 40, + /* 40 */ 1647, 694, 47, 45, 44, 43, 42, 2319, 1665, 720, + /* 50 */ 2067, 2120, 662, 469, 662, 2488, 681, 2488, 381, 789, + /* 60 */ 702, 184, 2028, 30, 1720, 1880, 2118, 719, 556, 208, + /* 70 */ 19, 557, 1922, 2494, 203, 2494, 203, 1646, 2489, 688, + /* 80 */ 2489, 688, 219, 383, 2337, 2180, 127, 719, 2337, 126, /* 90 */ 125, 124, 123, 122, 121, 120, 119, 118, 523, 521, - /* 100 */ 2280, 364, 736, 829, 645, 216, 15, 1661, 804, 803, - /* 110 */ 802, 801, 427, 719, 800, 799, 150, 794, 793, 792, - /* 120 */ 791, 790, 789, 788, 162, 784, 783, 782, 426, 425, - /* 130 */ 779, 778, 777, 183, 182, 776, 687, 1838, 573, 2483, - /* 140 */ 561, 2313, 1723, 1724, 2351, 680, 558, 114, 2315, 740, - /* 150 */ 2317, 2318, 735, 51, 730, 2419, 2195, 686, 203, 186, - /* 160 */ 2195, 2404, 2484, 688, 687, 411, 2400, 2483, 572, 720, - /* 170 */ 2062, 408, 699, 146, 2192, 707, 1696, 1706, 2193, 707, - /* 180 */ 205, 2416, 1661, 1722, 1725, 686, 203, 1379, 2434, 137, - /* 190 */ 2484, 688, 1435, 682, 574, 2188, 604, 1873, 1637, 51, - /* 200 */ 1635, 677, 2290, 1646, 2301, 1868, 1426, 765, 764, 763, - /* 210 */ 1430, 762, 1432, 1433, 761, 758, 2298, 1441, 755, 1443, - /* 220 */ 1444, 752, 749, 746, 481, 2171, 2294, 1381, 389, 388, - /* 230 */ 1640, 1641, 1693, 1666, 1695, 1698, 1699, 1700, 1701, 1702, - /* 240 */ 1703, 1704, 1705, 732, 728, 1714, 1715, 1717, 1718, 1719, - /* 250 */ 1720, 2, 48, 46, 509, 2171, 576, 363, 63, 1659, - /* 260 */ 415, 2303, 1636, 1536, 1537, 2314, 507, 184, 63, 526, - /* 270 */ 2296, 412, 95, 220, 525, 1721, 430, 1634, 734, 95, - /* 280 */ 730, 429, 299, 2412, 698, 68, 138, 697, 1664, 2483, - /* 290 */ 489, 2176, 527, 683, 678, 671, 385, 491, 2058, 387, - /* 300 */ 386, 695, 601, 225, 1716, 2057, 2332, 686, 203, 1867, - /* 310 */ 19, 1662, 2484, 688, 618, 617, 616, 1642, 2280, 2419, - /* 320 */ 736, 608, 143, 612, 603, 1818, 662, 611, 602, 2483, - /* 330 */ 720, 2062, 610, 615, 391, 390, 1799, 643, 609, 634, - /* 340 */ 1819, 605, 1661, 829, 384, 2415, 15, 2489, 203, 460, - /* 350 */ 56, 459, 2484, 688, 632, 477, 630, 268, 267, 2313, - /* 360 */ 564, 303, 2351, 557, 1918, 356, 2315, 740, 2317, 2318, - /* 370 */ 735, 733, 730, 721, 2369, 47, 45, 44, 43, 42, - /* 380 */ 1817, 458, 1723, 1724, 63, 2182, 2161, 63, 514, 513, + /* 100 */ 2285, 364, 736, 831, 786, 217, 15, 1665, 806, 805, + /* 110 */ 804, 803, 427, 719, 802, 801, 151, 796, 795, 794, + /* 120 */ 793, 792, 791, 790, 150, 784, 783, 782, 426, 425, + /* 130 */ 779, 778, 777, 183, 182, 776, 687, 1842, 573, 2488, + /* 140 */ 561, 2318, 1727, 1728, 2356, 680, 558, 114, 2320, 740, + /* 150 */ 2322, 2323, 735, 51, 730, 2424, 2200, 686, 203, 186, + /* 160 */ 2200, 2409, 2489, 688, 687, 411, 2405, 2488, 788, 720, + /* 170 */ 2067, 408, 699, 146, 2197, 707, 1700, 1710, 2198, 707, + /* 180 */ 205, 2421, 1665, 1726, 1729, 686, 203, 1382, 2439, 137, + /* 190 */ 2489, 688, 1439, 682, 574, 2193, 604, 1877, 1641, 51, + /* 200 */ 1639, 677, 2295, 1650, 2306, 1872, 1430, 765, 764, 763, + /* 210 */ 1434, 762, 1436, 1437, 761, 758, 2303, 1445, 755, 1447, + /* 220 */ 1448, 752, 749, 746, 481, 2176, 2299, 1384, 389, 388, + /* 230 */ 1644, 1645, 1697, 1670, 1699, 1702, 1703, 1704, 1705, 1706, + /* 240 */ 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, 1723, + /* 250 */ 1724, 2, 48, 46, 509, 2176, 576, 363, 63, 1663, + /* 260 */ 415, 2308, 1640, 1540, 1541, 2319, 507, 184, 63, 526, + /* 270 */ 2301, 412, 95, 221, 525, 1725, 430, 1638, 734, 95, + /* 280 */ 730, 429, 300, 2417, 698, 68, 138, 697, 1668, 2488, + /* 290 */ 489, 2181, 527, 683, 678, 671, 385, 491, 2063, 387, + /* 300 */ 386, 695, 601, 226, 1720, 2062, 2337, 686, 203, 1871, + /* 310 */ 19, 1666, 2489, 688, 618, 617, 616, 1646, 2285, 2424, + /* 320 */ 736, 608, 143, 612, 603, 1822, 662, 611, 602, 2488, + /* 330 */ 720, 2067, 610, 615, 391, 390, 1803, 645, 609, 634, + /* 340 */ 1823, 605, 1665, 831, 384, 2420, 15, 2494, 203, 460, + /* 350 */ 56, 459, 2489, 688, 632, 477, 630, 269, 268, 2318, + /* 360 */ 564, 304, 2356, 557, 1922, 356, 2320, 740, 2322, 2323, + /* 370 */ 735, 733, 730, 721, 2374, 47, 45, 44, 43, 42, + /* 380 */ 1821, 458, 1727, 1728, 63, 2187, 2166, 63, 514, 513, /* 390 */ 512, 511, 506, 505, 504, 503, 502, 497, 496, 495, - /* 400 */ 494, 367, 486, 485, 484, 1693, 479, 478, 382, 172, - /* 410 */ 38, 319, 1524, 1525, 341, 34, 1696, 1706, 1543, 222, - /* 420 */ 303, 41, 40, 1722, 1725, 47, 45, 44, 43, 42, - /* 430 */ 303, 338, 74, 1470, 1471, 73, 646, 775, 1637, 420, - /* 440 */ 1635, 1962, 2108, 2110, 517, 365, 301, 41, 40, 52, - /* 450 */ 1642, 47, 45, 44, 43, 42, 234, 538, 536, 533, - /* 460 */ 90, 41, 40, 89, 1898, 47, 45, 44, 43, 42, - /* 470 */ 1640, 1641, 1693, 1665, 1695, 1698, 1699, 1700, 1701, 1702, - /* 480 */ 1703, 1704, 1705, 732, 728, 1714, 1715, 1717, 1718, 1719, - /* 490 */ 1720, 2, 12, 48, 46, 158, 553, 63, 1697, 720, - /* 500 */ 2062, 415, 2243, 1636, 551, 644, 226, 547, 543, 375, - /* 510 */ 566, 2234, 12, 618, 617, 616, 1721, 2280, 1634, 466, - /* 520 */ 608, 143, 612, 832, 699, 146, 611, 88, 516, 515, - /* 530 */ 1731, 610, 615, 391, 390, 64, 1661, 609, 236, 327, - /* 540 */ 605, 283, 559, 1826, 1926, 1716, 303, 1665, 2314, 303, - /* 550 */ 196, 19, 661, 1750, 1694, 193, 273, 1752, 1642, 720, - /* 560 */ 2062, 702, 2102, 820, 816, 812, 808, 127, 324, 55, + /* 400 */ 494, 367, 486, 485, 484, 1697, 479, 478, 382, 172, + /* 410 */ 38, 320, 1528, 1529, 341, 34, 1700, 1710, 1547, 223, + /* 420 */ 304, 41, 40, 1726, 1729, 47, 45, 44, 43, 42, + /* 430 */ 304, 338, 74, 1474, 1475, 73, 646, 775, 1641, 420, + /* 440 */ 1639, 1966, 2113, 2115, 517, 365, 302, 41, 40, 52, + /* 450 */ 691, 47, 45, 44, 43, 42, 235, 538, 536, 533, + /* 460 */ 90, 41, 40, 89, 1902, 47, 45, 44, 43, 42, + /* 470 */ 1644, 1645, 1697, 1669, 1699, 1702, 1703, 1704, 1705, 1706, + /* 480 */ 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, 1723, + /* 490 */ 1724, 2, 12, 48, 46, 159, 553, 63, 1701, 720, + /* 500 */ 2067, 415, 2248, 1640, 551, 644, 227, 547, 543, 375, + /* 510 */ 566, 2239, 572, 618, 617, 616, 1725, 2285, 1638, 466, + /* 520 */ 608, 143, 612, 834, 699, 146, 611, 88, 516, 515, + /* 530 */ 1735, 610, 615, 391, 390, 64, 1665, 609, 237, 327, + /* 540 */ 605, 284, 559, 1830, 1930, 1720, 304, 1669, 2319, 304, + /* 550 */ 196, 19, 661, 1754, 1698, 193, 274, 1756, 1646, 720, + /* 560 */ 2067, 702, 2107, 822, 818, 814, 810, 127, 324, 55, /* 570 */ 126, 125, 124, 123, 122, 121, 120, 119, 118, 467, - /* 580 */ 9, 84, 83, 465, 829, 100, 215, 15, 12, 2332, - /* 590 */ 10, 1636, 674, 673, 1824, 1825, 1827, 1828, 1829, 457, - /* 600 */ 455, 2280, 766, 736, 112, 2488, 1634, 720, 2062, 113, - /* 610 */ 366, 303, 317, 446, 1751, 1662, 443, 439, 435, 432, - /* 620 */ 458, 147, 1664, 1723, 1724, 2039, 1300, 483, 1299, 2054, - /* 630 */ 174, 199, 1887, 701, 201, 2412, 2413, 35, 144, 2417, - /* 640 */ 699, 146, 2313, 142, 716, 2351, 1642, 1757, 114, 2315, - /* 650 */ 740, 2317, 2318, 735, 1897, 730, 2115, 1696, 1706, 303, - /* 660 */ 186, 1301, 2404, 36, 1722, 1725, 411, 2400, 106, 41, - /* 670 */ 40, 706, 829, 47, 45, 44, 43, 42, 2038, 1637, - /* 680 */ 61, 1635, 699, 146, 306, 1666, 720, 2062, 659, 2435, - /* 690 */ 786, 305, 1697, 2055, 37, 413, 1745, 1746, 1747, 1748, - /* 700 */ 1749, 1753, 1754, 1755, 1756, 194, 498, 2280, 1283, 1861, - /* 710 */ 276, 1640, 1641, 1693, 1660, 1695, 1698, 1699, 1700, 1701, - /* 720 */ 1702, 1703, 1704, 1705, 732, 728, 1714, 1715, 1717, 1718, - /* 730 */ 1719, 1720, 2, 48, 46, 1726, 2314, 1556, 1557, 325, - /* 740 */ 238, 415, 1896, 1636, 559, 1792, 1926, 775, 1694, 737, - /* 750 */ 202, 2412, 2413, 603, 144, 2417, 1721, 602, 1634, 1666, - /* 760 */ 773, 160, 159, 770, 769, 768, 157, 1637, 2314, 1635, - /* 770 */ 773, 160, 159, 770, 769, 768, 157, 2332, 1555, 1558, - /* 780 */ 301, 737, 1895, 1928, 727, 1716, 1875, 720, 2062, 2280, - /* 790 */ 1665, 736, 204, 2412, 2413, 2280, 144, 2417, 1642, 1640, - /* 800 */ 1641, 2109, 2110, 1894, 646, 1784, 2314, 499, 2419, 2332, + /* 580 */ 9, 84, 83, 465, 831, 100, 216, 15, 12, 2337, + /* 590 */ 10, 1640, 674, 673, 1828, 1829, 1831, 1832, 1833, 457, + /* 600 */ 455, 2285, 643, 736, 112, 2493, 1638, 720, 2067, 113, + /* 610 */ 366, 304, 318, 446, 1755, 1666, 443, 439, 435, 432, + /* 620 */ 458, 147, 1668, 1727, 1728, 2044, 1303, 483, 1302, 2059, + /* 630 */ 174, 199, 1891, 701, 201, 2417, 2418, 35, 144, 2422, + /* 640 */ 699, 146, 2318, 142, 716, 2356, 1646, 1761, 114, 2320, + /* 650 */ 740, 2322, 2323, 735, 1901, 730, 2120, 1700, 1710, 304, + /* 660 */ 186, 1304, 2409, 36, 1726, 1729, 411, 2405, 106, 41, + /* 670 */ 40, 706, 831, 47, 45, 44, 43, 42, 2043, 1641, + /* 680 */ 61, 1639, 699, 146, 307, 1670, 720, 2067, 659, 2440, + /* 690 */ 606, 306, 1701, 2060, 37, 413, 1749, 1750, 1751, 1752, + /* 700 */ 1753, 1757, 1758, 1759, 1760, 194, 498, 2285, 692, 1865, + /* 710 */ 277, 1644, 1645, 1697, 1379, 1699, 1702, 1703, 1704, 1705, + /* 720 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, + /* 730 */ 1723, 1724, 2, 48, 46, 1730, 2319, 1560, 1561, 1286, + /* 740 */ 239, 415, 1900, 1640, 559, 1664, 1930, 775, 1698, 737, + /* 750 */ 202, 2417, 2418, 603, 144, 2422, 1725, 602, 1638, 1670, + /* 760 */ 773, 161, 160, 770, 769, 768, 158, 1641, 2319, 1639, + /* 770 */ 773, 161, 160, 770, 769, 768, 158, 2337, 1559, 1562, + /* 780 */ 302, 737, 1899, 1932, 727, 1720, 1879, 720, 2067, 2285, + /* 790 */ 1669, 736, 204, 2417, 2418, 2285, 144, 2422, 1646, 1644, + /* 800 */ 1645, 2114, 2115, 1898, 646, 1788, 2319, 499, 2424, 2337, /* 810 */ 136, 135, 134, 133, 132, 131, 130, 129, 128, 737, - /* 820 */ 1661, 2280, 99, 736, 829, 720, 2062, 49, 1661, 623, - /* 830 */ 2313, 720, 2062, 2351, 2414, 2280, 114, 2315, 740, 2317, - /* 840 */ 2318, 735, 1893, 730, 635, 500, 149, 2332, 155, 2375, - /* 850 */ 2404, 575, 1584, 271, 411, 2400, 2280, 270, 418, 2280, - /* 860 */ 269, 736, 2313, 1723, 1724, 2351, 171, 2146, 114, 2315, - /* 870 */ 740, 2317, 2318, 735, 2064, 730, 626, 2037, 648, 2234, - /* 880 */ 2503, 2115, 2404, 620, 2115, 296, 411, 2400, 396, 266, - /* 890 */ 2051, 405, 720, 2062, 1892, 2280, 2113, 1696, 1706, 2113, - /* 900 */ 2313, 595, 594, 2351, 1722, 1725, 114, 2315, 740, 2317, - /* 910 */ 2318, 735, 2059, 730, 2290, 722, 254, 2376, 2379, 1637, - /* 920 */ 2404, 1635, 1891, 98, 411, 2400, 370, 1890, 2053, 395, - /* 930 */ 72, 636, 178, 71, 2115, 1274, 614, 613, 2294, 2047, - /* 940 */ 593, 589, 585, 581, 1742, 253, 1889, 2280, 198, 715, - /* 950 */ 2274, 1640, 1641, 1693, 1281, 1695, 1698, 1699, 1700, 1701, - /* 960 */ 1702, 1703, 1704, 1705, 732, 728, 1714, 1715, 1717, 1718, - /* 970 */ 1719, 1720, 2, 48, 46, 2280, 1697, 1276, 1279, 1280, - /* 980 */ 2280, 415, 2296, 1636, 720, 2062, 96, 720, 2062, 251, - /* 990 */ 2115, 2487, 730, 197, 2115, 2314, 1721, 410, 1634, 2280, - /* 1000 */ 662, 419, 1666, 2483, 274, 2113, 1281, 282, 737, 2113, - /* 1010 */ 2442, 1791, 773, 160, 159, 770, 769, 768, 157, 720, - /* 1020 */ 2062, 2489, 203, 720, 2062, 1716, 2484, 688, 493, 2314, - /* 1030 */ 1279, 1280, 1694, 421, 720, 2062, 2332, 492, 1642, 705, - /* 1040 */ 1694, 171, 737, 314, 2455, 720, 2062, 2049, 2280, 2064, - /* 1050 */ 736, 41, 40, 241, 717, 47, 45, 44, 43, 42, - /* 1060 */ 2045, 250, 243, 450, 829, 718, 2156, 49, 248, 570, - /* 1070 */ 2332, 41, 40, 720, 2062, 47, 45, 44, 43, 42, - /* 1080 */ 1303, 1304, 2280, 2066, 736, 720, 2062, 240, 1334, 2313, - /* 1090 */ 452, 448, 2351, 320, 1929, 114, 2315, 740, 2317, 2318, - /* 1100 */ 735, 641, 730, 1723, 1724, 422, 2261, 2503, 473, 2404, - /* 1110 */ 647, 41, 40, 411, 2400, 47, 45, 44, 43, 42, - /* 1120 */ 1300, 1886, 1299, 2313, 798, 796, 2351, 1885, 1335, 114, - /* 1130 */ 2315, 740, 2317, 2318, 735, 691, 730, 1696, 1706, 597, - /* 1140 */ 596, 2503, 272, 2404, 1722, 1725, 822, 411, 2400, 2488, - /* 1150 */ 1837, 662, 2483, 787, 2483, 1301, 2024, 310, 311, 1637, - /* 1160 */ 662, 1635, 309, 2483, 724, 2290, 2376, 1884, 1390, 703, - /* 1170 */ 1811, 2487, 2489, 203, 2280, 2484, 2486, 2484, 688, 2299, - /* 1180 */ 2280, 2489, 203, 1389, 14, 13, 2484, 688, 638, 2294, - /* 1190 */ 637, 1640, 1641, 1693, 1883, 1695, 1698, 1699, 1700, 1701, - /* 1200 */ 1702, 1703, 1704, 1705, 732, 728, 1714, 1715, 1717, 1718, - /* 1210 */ 1719, 1720, 2, 48, 46, 2314, 2448, 1605, 1606, 662, - /* 1220 */ 2280, 415, 2483, 1636, 1394, 44, 43, 42, 737, 1882, - /* 1230 */ 669, 2488, 767, 2296, 2483, 2106, 1721, 2115, 1634, 1393, - /* 1240 */ 2489, 203, 1881, 730, 1880, 2484, 688, 2280, 2314, 528, - /* 1250 */ 1645, 171, 2114, 2487, 279, 1879, 2332, 2484, 2485, 2065, - /* 1260 */ 1878, 737, 1644, 2476, 771, 1716, 334, 2106, 2280, 2092, - /* 1270 */ 736, 772, 1903, 824, 2106, 2424, 1784, 690, 1642, 41, - /* 1280 */ 40, 170, 2280, 47, 45, 44, 43, 42, 2264, 2332, - /* 1290 */ 1764, 2040, 1946, 731, 3, 2280, 76, 2280, 139, 259, - /* 1300 */ 158, 2280, 257, 736, 829, 530, 54, 15, 2280, 2313, - /* 1310 */ 86, 675, 2351, 2280, 619, 114, 2315, 740, 2317, 2318, - /* 1320 */ 735, 1888, 730, 261, 151, 263, 260, 2503, 262, 2404, - /* 1330 */ 209, 424, 423, 411, 2400, 265, 1937, 606, 264, 437, - /* 1340 */ 607, 1650, 2313, 1723, 1724, 2351, 87, 1935, 114, 2315, - /* 1350 */ 740, 2317, 2318, 735, 1721, 730, 1643, 141, 621, 111, - /* 1360 */ 2503, 1376, 2404, 290, 1374, 2333, 411, 2400, 108, 624, - /* 1370 */ 1870, 1871, 14, 13, 1600, 2314, 2000, 1696, 1706, 158, - /* 1380 */ 1999, 50, 50, 1716, 1722, 1725, 187, 158, 737, 50, - /* 1390 */ 2423, 2180, 308, 692, 75, 780, 1642, 1919, 672, 1637, - /* 1400 */ 156, 1635, 2438, 401, 398, 679, 709, 66, 2181, 428, - /* 1410 */ 781, 158, 50, 1648, 1925, 2103, 2332, 50, 744, 1353, - /* 1420 */ 2439, 156, 726, 158, 140, 1647, 156, 655, 2280, 700, - /* 1430 */ 736, 1640, 1641, 1693, 1351, 1695, 1698, 1699, 1700, 1701, - /* 1440 */ 1702, 1703, 1704, 1705, 732, 728, 1714, 1715, 1717, 1718, - /* 1450 */ 1719, 1720, 2, 1603, 2449, 1823, 1822, 298, 295, 302, - /* 1460 */ 288, 704, 5, 1553, 431, 436, 312, 379, 712, 2313, - /* 1470 */ 444, 445, 2351, 1669, 316, 114, 2315, 740, 2317, 2318, - /* 1480 */ 735, 1758, 730, 2314, 454, 1420, 1707, 2503, 453, 2404, - /* 1490 */ 210, 333, 1448, 411, 2400, 1452, 737, 1459, 1457, 211, - /* 1500 */ 161, 456, 213, 1577, 328, 1659, 470, 1660, 224, 474, - /* 1510 */ 476, 480, 482, 519, 501, 487, 508, 1651, 2173, 1646, - /* 1520 */ 510, 518, 520, 531, 2332, 532, 529, 229, 228, 231, - /* 1530 */ 534, 535, 537, 539, 1667, 554, 2280, 555, 736, 4, - /* 1540 */ 562, 2314, 563, 239, 92, 565, 1662, 567, 242, 1654, - /* 1550 */ 1656, 1668, 568, 1670, 737, 569, 571, 245, 247, 1671, - /* 1560 */ 2189, 598, 2252, 728, 1714, 1715, 1717, 1718, 1719, 1720, - /* 1570 */ 93, 577, 600, 94, 252, 2052, 627, 2313, 2314, 628, - /* 1580 */ 2351, 640, 2332, 114, 2315, 740, 2317, 2318, 735, 256, - /* 1590 */ 730, 737, 116, 360, 2280, 2377, 736, 2404, 2048, 258, - /* 1600 */ 2249, 411, 2400, 642, 97, 164, 152, 165, 2050, 2046, - /* 1610 */ 166, 2314, 167, 329, 2248, 275, 1663, 650, 649, 2332, - /* 1620 */ 280, 657, 656, 676, 737, 654, 2454, 710, 2426, 651, - /* 1630 */ 2235, 2280, 666, 736, 2453, 2313, 685, 8, 2351, 278, - /* 1640 */ 289, 114, 2315, 740, 2317, 2318, 735, 179, 730, 291, - /* 1650 */ 667, 145, 2332, 723, 2314, 2404, 285, 287, 664, 411, - /* 1660 */ 2400, 292, 665, 402, 2280, 696, 736, 737, 294, 2506, - /* 1670 */ 2482, 693, 2313, 1784, 297, 2351, 1664, 1789, 115, 2315, - /* 1680 */ 740, 2317, 2318, 735, 190, 730, 2420, 1787, 293, 330, - /* 1690 */ 304, 2314, 2404, 153, 331, 2332, 2403, 2400, 708, 2203, - /* 1700 */ 2202, 2201, 206, 407, 737, 2313, 713, 2280, 2351, 736, - /* 1710 */ 714, 115, 2315, 740, 2317, 2318, 735, 332, 730, 2063, - /* 1720 */ 154, 1, 62, 105, 2385, 2404, 107, 742, 2107, 725, - /* 1730 */ 2400, 335, 2332, 323, 1258, 823, 371, 828, 2025, 53, - /* 1740 */ 826, 359, 163, 339, 2280, 2272, 736, 344, 738, 2314, - /* 1750 */ 372, 2351, 2271, 358, 115, 2315, 740, 2317, 2318, 735, - /* 1760 */ 348, 730, 737, 337, 2270, 81, 2314, 2265, 2404, 433, - /* 1770 */ 434, 1627, 374, 2400, 1628, 208, 438, 2263, 440, 737, - /* 1780 */ 441, 442, 2262, 1626, 2260, 2313, 380, 2314, 2351, 2259, - /* 1790 */ 2332, 175, 2315, 740, 2317, 2318, 735, 447, 730, 2258, - /* 1800 */ 737, 449, 2280, 451, 736, 1616, 2239, 2332, 212, 2238, - /* 1810 */ 214, 1580, 82, 1579, 2216, 2215, 2214, 463, 464, 2280, - /* 1820 */ 2213, 736, 2212, 2163, 468, 1523, 2155, 471, 2332, 472, - /* 1830 */ 2152, 2151, 217, 663, 2445, 2150, 85, 2149, 2154, 2153, - /* 1840 */ 2280, 219, 736, 2313, 2148, 2147, 2351, 2145, 2144, 176, - /* 1850 */ 2315, 740, 2317, 2318, 735, 2143, 730, 221, 488, 2142, - /* 1860 */ 2313, 490, 2158, 2351, 2141, 2140, 115, 2315, 740, 2317, - /* 1870 */ 2318, 735, 2139, 730, 2138, 2137, 2160, 2136, 2135, 2134, - /* 1880 */ 2404, 2313, 2133, 2132, 2351, 2401, 2314, 175, 2315, 740, - /* 1890 */ 2317, 2318, 735, 2131, 730, 2130, 2129, 2128, 2127, 737, - /* 1900 */ 223, 2126, 91, 689, 2504, 2125, 2124, 2123, 2159, 2157, - /* 1910 */ 2122, 2121, 1529, 2314, 2120, 227, 2119, 522, 2118, 524, - /* 1920 */ 2117, 2116, 1391, 368, 1395, 1965, 737, 2332, 1387, 1964, - /* 1930 */ 2446, 369, 399, 230, 232, 1963, 1961, 1958, 541, 2280, - /* 1940 */ 540, 736, 1957, 545, 2314, 1950, 542, 1939, 233, 544, - /* 1950 */ 549, 1914, 548, 1282, 2332, 546, 1913, 737, 2237, 400, - /* 1960 */ 552, 550, 235, 185, 78, 2233, 2280, 2223, 736, 2211, - /* 1970 */ 246, 237, 2210, 2300, 79, 195, 560, 2187, 2041, 1960, - /* 1980 */ 2313, 2314, 244, 2351, 1956, 2332, 357, 2315, 740, 2317, - /* 1990 */ 2318, 735, 249, 730, 737, 579, 578, 2280, 1463, 736, - /* 2000 */ 1954, 582, 1327, 580, 583, 584, 1952, 2313, 586, 1949, - /* 2010 */ 2351, 587, 588, 357, 2315, 740, 2317, 2318, 735, 590, - /* 2020 */ 730, 1934, 2332, 1932, 591, 592, 1933, 1931, 1910, 2043, - /* 2030 */ 1464, 2042, 1378, 1377, 2280, 1947, 736, 795, 2313, 1375, - /* 2040 */ 1373, 2351, 1372, 797, 350, 2315, 740, 2317, 2318, 735, - /* 2050 */ 1371, 730, 65, 255, 2314, 1370, 1369, 1366, 392, 1365, - /* 2060 */ 1364, 1363, 1938, 393, 622, 1936, 394, 737, 1909, 625, - /* 2070 */ 1908, 1907, 1906, 1905, 629, 2313, 631, 633, 2351, 2314, - /* 2080 */ 117, 176, 2315, 740, 2317, 2318, 735, 1610, 730, 1612, - /* 2090 */ 684, 1609, 734, 1614, 29, 2332, 2236, 69, 277, 1590, - /* 2100 */ 406, 2232, 1588, 1586, 2222, 652, 2209, 2280, 2208, 736, - /* 2110 */ 2488, 57, 58, 17, 20, 1840, 23, 6, 31, 7, - /* 2120 */ 2332, 284, 2314, 286, 1821, 21, 653, 22, 1565, 668, - /* 2130 */ 281, 189, 2280, 1564, 736, 737, 2505, 2314, 200, 658, - /* 2140 */ 177, 67, 660, 2207, 670, 33, 188, 169, 2313, 32, - /* 2150 */ 737, 2351, 2314, 1810, 357, 2315, 740, 2317, 2318, 735, - /* 2160 */ 2301, 730, 80, 2332, 1860, 737, 1861, 24, 414, 1855, - /* 2170 */ 1854, 1781, 403, 2313, 1859, 2280, 2351, 736, 2332, 356, - /* 2180 */ 2315, 740, 2317, 2318, 735, 1858, 730, 404, 2370, 1780, - /* 2190 */ 2280, 300, 736, 2332, 60, 180, 2186, 102, 416, 101, - /* 2200 */ 2185, 25, 103, 108, 307, 2280, 1816, 736, 191, 313, - /* 2210 */ 13, 70, 711, 315, 318, 104, 2313, 2314, 59, 2351, - /* 2220 */ 26, 1733, 357, 2315, 740, 2317, 2318, 735, 11, 730, - /* 2230 */ 737, 639, 1732, 1652, 2351, 2314, 2354, 352, 2315, 740, - /* 2240 */ 2317, 2318, 735, 1711, 730, 729, 2313, 18, 737, 2351, - /* 2250 */ 181, 1709, 357, 2315, 740, 2317, 2318, 735, 2332, 730, - /* 2260 */ 39, 192, 1686, 1708, 16, 27, 743, 741, 417, 1678, - /* 2270 */ 2280, 1449, 736, 28, 745, 1743, 2332, 1446, 747, 748, - /* 2280 */ 739, 1445, 750, 1442, 751, 753, 754, 756, 2280, 1436, - /* 2290 */ 736, 757, 759, 1434, 760, 109, 1440, 321, 1439, 1438, - /* 2300 */ 110, 77, 1437, 1458, 1454, 1325, 774, 1360, 1357, 1356, - /* 2310 */ 1385, 2313, 1355, 1354, 2351, 1352, 1350, 342, 2315, 740, - /* 2320 */ 2317, 2318, 735, 1349, 730, 1348, 785, 322, 1346, 2313, - /* 2330 */ 2314, 1343, 2351, 1345, 1344, 340, 2315, 740, 2317, 2318, - /* 2340 */ 735, 1342, 730, 737, 1341, 1340, 1382, 2314, 1380, 1337, - /* 2350 */ 1336, 1333, 1332, 1331, 1330, 1955, 805, 806, 807, 1953, - /* 2360 */ 737, 809, 811, 2314, 1951, 813, 1948, 815, 819, 810, - /* 2370 */ 817, 2332, 814, 818, 1930, 821, 737, 1271, 1904, 1259, - /* 2380 */ 825, 831, 326, 2280, 827, 736, 1874, 1638, 2332, 336, - /* 2390 */ 830, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2400 */ 2280, 1874, 736, 1874, 2332, 1874, 1874, 1874, 1874, 1874, - /* 2410 */ 1874, 1874, 1874, 1874, 1874, 1874, 2280, 1874, 736, 1874, - /* 2420 */ 1874, 1874, 1874, 1874, 2313, 1874, 1874, 2351, 1874, 1874, - /* 2430 */ 343, 2315, 740, 2317, 2318, 735, 1874, 730, 1874, 1874, - /* 2440 */ 2314, 2313, 1874, 1874, 2351, 1874, 1874, 349, 2315, 740, - /* 2450 */ 2317, 2318, 735, 737, 730, 1874, 1874, 2313, 1874, 2314, - /* 2460 */ 2351, 1874, 1874, 353, 2315, 740, 2317, 2318, 735, 1874, - /* 2470 */ 730, 1874, 737, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2480 */ 1874, 2332, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2490 */ 1874, 1874, 1874, 2280, 1874, 736, 1874, 1874, 1874, 1874, - /* 2500 */ 2332, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2510 */ 1874, 1874, 2280, 1874, 736, 1874, 1874, 1874, 1874, 1874, - /* 2520 */ 1874, 1874, 1874, 1874, 1874, 1874, 2314, 1874, 1874, 1874, - /* 2530 */ 1874, 1874, 1874, 1874, 2313, 1874, 1874, 2351, 1874, 737, - /* 2540 */ 345, 2315, 740, 2317, 2318, 735, 1874, 730, 1874, 1874, - /* 2550 */ 1874, 1874, 1874, 2313, 1874, 2314, 2351, 1874, 1874, 354, - /* 2560 */ 2315, 740, 2317, 2318, 735, 1874, 730, 2332, 737, 1874, - /* 2570 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 2280, - /* 2580 */ 1874, 736, 1874, 1874, 2314, 1874, 1874, 1874, 1874, 1874, - /* 2590 */ 1874, 1874, 1874, 1874, 1874, 1874, 2332, 737, 1874, 1874, - /* 2600 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 2280, 1874, - /* 2610 */ 736, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2620 */ 2313, 1874, 2314, 2351, 1874, 2332, 346, 2315, 740, 2317, - /* 2630 */ 2318, 735, 1874, 730, 1874, 737, 1874, 2280, 1874, 736, - /* 2640 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 2313, - /* 2650 */ 1874, 1874, 2351, 1874, 1874, 355, 2315, 740, 2317, 2318, - /* 2660 */ 735, 1874, 730, 2332, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2670 */ 1874, 1874, 1874, 1874, 1874, 2280, 1874, 736, 2313, 2314, - /* 2680 */ 1874, 2351, 1874, 1874, 347, 2315, 740, 2317, 2318, 735, - /* 2690 */ 1874, 730, 737, 1874, 1874, 1874, 1874, 2314, 1874, 1874, - /* 2700 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2710 */ 737, 1874, 1874, 1874, 1874, 1874, 2313, 1874, 1874, 2351, - /* 2720 */ 2332, 1874, 361, 2315, 740, 2317, 2318, 735, 1874, 730, - /* 2730 */ 1874, 1874, 2280, 1874, 736, 1874, 1874, 1874, 2332, 1874, - /* 2740 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2750 */ 2280, 1874, 736, 1874, 2314, 1874, 1874, 1874, 1874, 1874, - /* 2760 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 737, 1874, 1874, - /* 2770 */ 1874, 1874, 1874, 2313, 2314, 1874, 2351, 1874, 1874, 362, - /* 2780 */ 2315, 740, 2317, 2318, 735, 1874, 730, 737, 1874, 1874, - /* 2790 */ 2314, 2313, 1874, 1874, 2351, 2332, 1874, 2326, 2315, 740, - /* 2800 */ 2317, 2318, 735, 737, 730, 1874, 1874, 2280, 1874, 736, - /* 2810 */ 1874, 1874, 1874, 1874, 1874, 2332, 1874, 1874, 1874, 1874, - /* 2820 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 2280, 1874, 736, - /* 2830 */ 1874, 2332, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2840 */ 1874, 1874, 1874, 2280, 1874, 736, 1874, 1874, 2313, 1874, - /* 2850 */ 1874, 2351, 1874, 1874, 2325, 2315, 740, 2317, 2318, 735, - /* 2860 */ 1874, 730, 1874, 1874, 1874, 1874, 1874, 1874, 2313, 1874, - /* 2870 */ 1874, 2351, 1874, 1874, 2324, 2315, 740, 2317, 2318, 735, - /* 2880 */ 1874, 730, 1874, 1874, 2313, 1874, 1874, 2351, 1874, 2314, - /* 2890 */ 376, 2315, 740, 2317, 2318, 735, 1874, 730, 1874, 1874, - /* 2900 */ 1874, 1874, 737, 1874, 1874, 2314, 1874, 1874, 1874, 1874, - /* 2910 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 737, 1874, - /* 2920 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2930 */ 2332, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2940 */ 1874, 1874, 2280, 1874, 736, 1874, 2332, 1874, 1874, 1874, - /* 2950 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 2280, 1874, - /* 2960 */ 736, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2970 */ 1874, 1874, 2314, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 2980 */ 1874, 1874, 1874, 2313, 1874, 737, 2351, 2314, 1874, 377, - /* 2990 */ 2315, 740, 2317, 2318, 735, 1874, 730, 1874, 1874, 2313, - /* 3000 */ 737, 1874, 2351, 1874, 1874, 373, 2315, 740, 2317, 2318, - /* 3010 */ 735, 1874, 730, 2332, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3020 */ 1874, 1874, 1874, 1874, 1874, 2280, 1874, 736, 2332, 1874, - /* 3030 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3040 */ 2280, 1874, 736, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3050 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3060 */ 1874, 1874, 1874, 1874, 1874, 1874, 2313, 1874, 1874, 2351, - /* 3070 */ 2314, 1874, 378, 2315, 740, 2317, 2318, 735, 1874, 730, - /* 3080 */ 1874, 738, 1874, 737, 2351, 1874, 1874, 352, 2315, 740, - /* 3090 */ 2317, 2318, 735, 1874, 730, 1874, 1874, 1874, 1874, 1874, - /* 3100 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3110 */ 1874, 2332, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3120 */ 1874, 1874, 1874, 2280, 1874, 736, 1874, 1874, 1874, 1874, - /* 3130 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3140 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3150 */ 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, 1874, - /* 3160 */ 1874, 1874, 1874, 1874, 2313, 1874, 1874, 2351, 1874, 1874, - /* 3170 */ 351, 2315, 740, 2317, 2318, 735, 1874, 730, + /* 820 */ 1665, 2285, 99, 736, 831, 720, 2067, 49, 1665, 623, + /* 830 */ 2318, 720, 2067, 2356, 2419, 2285, 114, 2320, 740, 2322, + /* 840 */ 2323, 735, 1897, 730, 635, 500, 149, 2337, 156, 2380, + /* 850 */ 2409, 575, 1588, 272, 411, 2405, 2285, 271, 418, 2285, + /* 860 */ 270, 736, 2318, 1727, 1728, 2356, 171, 2151, 114, 2320, + /* 870 */ 740, 2322, 2323, 735, 2069, 730, 626, 2042, 648, 2239, + /* 880 */ 2508, 2120, 2409, 620, 2120, 12, 411, 2405, 396, 267, + /* 890 */ 1646, 405, 720, 2067, 1896, 2285, 2118, 1700, 1710, 2118, + /* 900 */ 2318, 595, 594, 2356, 1726, 1729, 114, 2320, 740, 2322, + /* 910 */ 2323, 735, 2064, 730, 2295, 722, 255, 2381, 2384, 1641, + /* 920 */ 2409, 1639, 1895, 98, 411, 2405, 370, 1894, 2058, 395, + /* 930 */ 72, 636, 178, 71, 2120, 1277, 614, 613, 2299, 766, + /* 940 */ 593, 589, 585, 581, 1746, 254, 1893, 2285, 198, 715, + /* 950 */ 2279, 1644, 1645, 1697, 1284, 1699, 1702, 1703, 1704, 1705, + /* 960 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, + /* 970 */ 1723, 1724, 2, 48, 46, 2285, 1701, 1279, 1282, 1283, + /* 980 */ 2285, 415, 2301, 1640, 720, 2067, 96, 720, 2067, 252, + /* 990 */ 2120, 2492, 730, 325, 2120, 2319, 1725, 410, 1638, 2285, + /* 1000 */ 662, 419, 1670, 2488, 275, 2118, 1284, 283, 737, 2118, + /* 1010 */ 2447, 2056, 773, 161, 160, 770, 769, 768, 158, 720, + /* 1020 */ 2067, 2494, 203, 720, 2067, 1720, 2489, 688, 493, 2319, + /* 1030 */ 1282, 1283, 1698, 421, 720, 2067, 2337, 492, 1646, 705, + /* 1040 */ 1698, 171, 737, 315, 2460, 720, 2067, 2052, 2285, 2069, + /* 1050 */ 736, 41, 40, 242, 717, 47, 45, 44, 43, 42, + /* 1060 */ 1796, 251, 244, 450, 831, 718, 2161, 49, 249, 570, + /* 1070 */ 2337, 41, 40, 720, 2067, 47, 45, 44, 43, 42, + /* 1080 */ 1306, 1307, 2285, 1933, 736, 720, 2067, 241, 1337, 2318, + /* 1090 */ 452, 448, 2356, 321, 2054, 114, 2320, 740, 2322, 2323, + /* 1100 */ 735, 641, 730, 1727, 1728, 422, 2266, 2508, 473, 2409, + /* 1110 */ 647, 41, 40, 411, 2405, 47, 45, 44, 43, 42, + /* 1120 */ 1303, 1890, 1302, 2318, 800, 798, 2356, 1889, 1338, 114, + /* 1130 */ 2320, 740, 2322, 2323, 735, 824, 730, 1700, 1710, 597, + /* 1140 */ 596, 2508, 273, 2409, 1726, 1729, 2050, 411, 2405, 2493, + /* 1150 */ 1841, 662, 2488, 148, 2488, 1304, 2380, 311, 312, 1641, + /* 1160 */ 662, 1639, 310, 2488, 724, 2295, 2381, 1888, 1394, 703, + /* 1170 */ 1815, 2492, 2494, 203, 2285, 2489, 2491, 2489, 688, 2304, + /* 1180 */ 2285, 2494, 203, 1393, 14, 13, 2489, 688, 638, 2299, + /* 1190 */ 637, 1644, 1645, 1697, 1887, 1699, 1702, 1703, 1704, 1705, + /* 1200 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, + /* 1210 */ 1723, 1724, 2, 48, 46, 2319, 197, 1609, 1610, 662, + /* 1220 */ 2285, 415, 2488, 1640, 1398, 44, 43, 42, 737, 1886, + /* 1230 */ 669, 2493, 767, 2301, 2488, 2111, 1725, 2120, 1638, 1397, + /* 1240 */ 2494, 203, 1885, 730, 1884, 2489, 688, 2285, 2319, 528, + /* 1250 */ 1649, 171, 2119, 2492, 2071, 1883, 2337, 2489, 2490, 2070, + /* 1260 */ 1882, 737, 1648, 2481, 771, 1720, 334, 2111, 2285, 2097, + /* 1270 */ 736, 772, 1907, 826, 2111, 2429, 1788, 690, 1646, 41, + /* 1280 */ 40, 170, 2285, 47, 45, 44, 43, 42, 2269, 2337, + /* 1290 */ 1768, 2045, 1950, 280, 3, 2285, 76, 2285, 139, 260, + /* 1300 */ 159, 2285, 258, 736, 831, 530, 54, 15, 2285, 2318, + /* 1310 */ 86, 2453, 2356, 2285, 619, 114, 2320, 740, 2322, 2323, + /* 1320 */ 735, 731, 730, 607, 152, 262, 1795, 2508, 261, 2409, + /* 1330 */ 210, 424, 423, 411, 2405, 264, 1941, 266, 263, 437, + /* 1340 */ 265, 1654, 2318, 1727, 1728, 2356, 87, 1377, 114, 2320, + /* 1350 */ 740, 2322, 2323, 735, 1725, 730, 1647, 1939, 621, 297, + /* 1360 */ 2508, 1892, 2409, 1874, 1875, 675, 411, 2405, 14, 13, + /* 1370 */ 141, 291, 2338, 2004, 1604, 2319, 780, 1700, 1710, 624, + /* 1380 */ 159, 50, 50, 1720, 1726, 1729, 187, 159, 737, 50, + /* 1390 */ 2428, 309, 75, 111, 157, 781, 1646, 159, 2003, 1641, + /* 1400 */ 1356, 1639, 108, 672, 2185, 1923, 2443, 401, 679, 398, + /* 1410 */ 709, 66, 50, 1652, 50, 428, 2337, 744, 157, 1354, + /* 1420 */ 1929, 159, 726, 140, 157, 1651, 2108, 2186, 2285, 655, + /* 1430 */ 736, 1644, 1645, 1697, 2444, 1699, 1702, 1703, 1704, 1705, + /* 1440 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, + /* 1450 */ 1723, 1724, 2, 2454, 1607, 1827, 1826, 700, 299, 296, + /* 1460 */ 289, 704, 2029, 1557, 303, 313, 712, 5, 317, 2318, + /* 1470 */ 431, 1424, 2356, 436, 379, 114, 2320, 740, 2322, 2323, + /* 1480 */ 735, 444, 730, 2319, 445, 1762, 1711, 2508, 333, 2409, + /* 1490 */ 1673, 1452, 1456, 411, 2405, 1463, 737, 1461, 162, 454, + /* 1500 */ 212, 211, 453, 214, 456, 1581, 328, 1663, 470, 1664, + /* 1510 */ 474, 225, 476, 480, 519, 482, 487, 1655, 501, 1650, + /* 1520 */ 508, 2178, 510, 518, 2337, 520, 532, 531, 529, 229, + /* 1530 */ 230, 534, 232, 535, 537, 539, 2285, 1671, 736, 554, + /* 1540 */ 4, 2319, 555, 562, 563, 240, 565, 92, 1666, 1658, + /* 1550 */ 1660, 243, 1672, 567, 737, 1674, 568, 246, 569, 1675, + /* 1560 */ 571, 248, 2194, 728, 1718, 1719, 1721, 1722, 1723, 1724, + /* 1570 */ 93, 577, 598, 94, 253, 97, 642, 2318, 2319, 627, + /* 1580 */ 2356, 2257, 2337, 114, 2320, 740, 2322, 2323, 735, 600, + /* 1590 */ 730, 737, 116, 628, 2285, 2382, 736, 2409, 2057, 257, + /* 1600 */ 360, 411, 2405, 640, 2053, 259, 153, 164, 2254, 165, + /* 1610 */ 2055, 2319, 2051, 166, 167, 329, 276, 1667, 2240, 2337, + /* 1620 */ 650, 649, 651, 281, 737, 657, 2459, 279, 676, 710, + /* 1630 */ 8, 2285, 2253, 736, 2431, 2318, 654, 685, 2356, 666, + /* 1640 */ 2458, 114, 2320, 740, 2322, 2323, 735, 290, 730, 179, + /* 1650 */ 667, 292, 2337, 723, 2319, 2409, 286, 665, 288, 411, + /* 1660 */ 2405, 656, 2487, 402, 2285, 664, 736, 737, 295, 696, + /* 1670 */ 2511, 298, 2318, 693, 1788, 2356, 145, 1668, 115, 2320, + /* 1680 */ 740, 2322, 2323, 735, 1793, 730, 190, 2425, 1791, 293, + /* 1690 */ 294, 2319, 2409, 1, 305, 2337, 2408, 2405, 154, 330, + /* 1700 */ 708, 2208, 2207, 2206, 737, 2318, 331, 2285, 2356, 736, + /* 1710 */ 407, 115, 2320, 740, 2322, 2323, 735, 713, 730, 206, + /* 1720 */ 714, 332, 62, 155, 2390, 2409, 107, 2068, 105, 725, + /* 1730 */ 2405, 742, 2337, 2112, 335, 1261, 825, 323, 828, 371, + /* 1740 */ 53, 359, 372, 830, 2285, 339, 736, 163, 738, 2319, + /* 1750 */ 344, 2356, 2277, 2276, 115, 2320, 740, 2322, 2323, 735, + /* 1760 */ 358, 730, 737, 337, 348, 2275, 2319, 81, 2409, 2270, + /* 1770 */ 433, 434, 374, 2405, 1631, 1632, 209, 438, 2268, 737, + /* 1780 */ 440, 441, 442, 1630, 2267, 2318, 380, 2319, 2356, 2265, + /* 1790 */ 2337, 175, 2320, 740, 2322, 2323, 735, 447, 730, 2264, + /* 1800 */ 737, 449, 2285, 451, 736, 2263, 1620, 2337, 2244, 213, + /* 1810 */ 2243, 215, 1584, 82, 2221, 1583, 2220, 2219, 463, 2285, + /* 1820 */ 464, 736, 2218, 2217, 2168, 468, 1527, 2160, 2337, 471, + /* 1830 */ 2157, 472, 218, 663, 2450, 2156, 85, 2155, 2154, 2159, + /* 1840 */ 2285, 2158, 736, 2318, 220, 2153, 2356, 2152, 2150, 176, + /* 1850 */ 2320, 740, 2322, 2323, 735, 2149, 730, 2148, 222, 2147, + /* 1860 */ 2318, 488, 490, 2356, 2163, 2146, 115, 2320, 740, 2322, + /* 1870 */ 2323, 735, 2145, 730, 2144, 2143, 2142, 2165, 2141, 2140, + /* 1880 */ 2409, 2318, 2139, 2138, 2356, 2406, 2319, 175, 2320, 740, + /* 1890 */ 2322, 2323, 735, 2137, 730, 2136, 2135, 2134, 2133, 737, + /* 1900 */ 2132, 224, 2131, 689, 2509, 91, 2130, 2129, 2128, 2164, + /* 1910 */ 2162, 2127, 2126, 2319, 1533, 2125, 2124, 228, 522, 2123, + /* 1920 */ 524, 2122, 2121, 1395, 1969, 1399, 737, 2337, 1391, 1968, + /* 1930 */ 2451, 368, 399, 231, 369, 233, 1967, 234, 1965, 2285, + /* 1940 */ 1962, 736, 540, 1961, 2319, 541, 542, 1954, 1943, 1918, + /* 1950 */ 544, 1285, 1917, 2242, 2337, 2238, 185, 737, 2228, 400, + /* 1960 */ 546, 2216, 548, 552, 2215, 545, 2285, 2192, 736, 550, + /* 1970 */ 247, 549, 78, 236, 238, 2046, 79, 1964, 1960, 578, + /* 1980 */ 2318, 2319, 2305, 2356, 195, 2337, 357, 2320, 740, 2322, + /* 1990 */ 2323, 735, 245, 730, 737, 560, 579, 2285, 580, 736, + /* 2000 */ 250, 1958, 582, 1330, 584, 583, 1956, 2318, 586, 1953, + /* 2010 */ 2356, 587, 588, 357, 2320, 740, 2322, 2323, 735, 590, + /* 2020 */ 730, 592, 2337, 591, 1938, 1936, 1937, 1935, 1914, 2048, + /* 2030 */ 1468, 65, 1467, 2047, 2285, 1951, 736, 1381, 2318, 1380, + /* 2040 */ 1378, 2356, 1376, 1942, 350, 2320, 740, 2322, 2323, 735, + /* 2050 */ 1375, 730, 1374, 256, 2319, 1373, 1372, 1369, 1368, 1367, + /* 2060 */ 1366, 392, 393, 797, 799, 622, 1940, 737, 394, 625, + /* 2070 */ 1913, 1912, 1911, 629, 1910, 2318, 1909, 633, 2356, 2319, + /* 2080 */ 117, 176, 2320, 740, 2322, 2323, 735, 631, 730, 1614, + /* 2090 */ 684, 1616, 734, 1613, 1618, 2337, 29, 2241, 69, 2237, + /* 2100 */ 406, 1590, 278, 1592, 1594, 2227, 652, 2285, 2214, 736, + /* 2110 */ 2493, 20, 6, 17, 31, 668, 21, 57, 2213, 7, + /* 2120 */ 2337, 22, 2319, 1844, 287, 189, 200, 33, 285, 2306, + /* 2130 */ 67, 23, 2285, 24, 736, 737, 2510, 2319, 282, 18, + /* 2140 */ 670, 58, 301, 1859, 653, 169, 1569, 1568, 2318, 1825, + /* 2150 */ 737, 2356, 2319, 177, 357, 2320, 740, 2322, 2323, 735, + /* 2160 */ 1858, 730, 403, 2337, 188, 737, 1814, 32, 414, 658, + /* 2170 */ 660, 80, 1863, 2318, 1864, 2285, 2356, 736, 2337, 356, + /* 2180 */ 2320, 740, 2322, 2323, 735, 1862, 730, 404, 2375, 1865, + /* 2190 */ 2285, 60, 736, 2337, 1785, 180, 1784, 2212, 416, 2191, + /* 2200 */ 2190, 101, 102, 308, 25, 2285, 103, 736, 1820, 191, + /* 2210 */ 314, 319, 26, 13, 316, 70, 2318, 2319, 104, 2356, + /* 2220 */ 1737, 1736, 357, 2320, 740, 2322, 2323, 735, 108, 730, + /* 2230 */ 737, 639, 1656, 711, 2356, 2319, 11, 352, 2320, 740, + /* 2240 */ 2322, 2323, 735, 2359, 730, 1715, 2318, 729, 737, 2356, + /* 2250 */ 1713, 39, 357, 2320, 740, 2322, 2323, 735, 2337, 730, + /* 2260 */ 59, 1712, 181, 16, 192, 27, 1690, 741, 1682, 28, + /* 2270 */ 2285, 1747, 736, 1453, 743, 417, 2337, 739, 745, 747, + /* 2280 */ 1450, 748, 750, 1449, 751, 753, 756, 1446, 2285, 754, + /* 2290 */ 736, 1440, 757, 759, 1438, 760, 1444, 1443, 1442, 109, + /* 2300 */ 322, 1441, 110, 1462, 77, 1458, 1363, 1328, 1360, 774, + /* 2310 */ 1389, 2318, 1359, 1358, 2356, 1357, 1355, 342, 2320, 740, + /* 2320 */ 2322, 2323, 735, 1353, 730, 1352, 1351, 785, 1388, 2318, + /* 2330 */ 2319, 787, 2356, 207, 1349, 340, 2320, 740, 2322, 2323, + /* 2340 */ 735, 1348, 730, 737, 1347, 1346, 1345, 2319, 1344, 1343, + /* 2350 */ 1383, 1385, 1340, 1339, 1336, 1335, 1334, 1333, 1959, 807, + /* 2360 */ 737, 808, 1957, 2319, 811, 812, 809, 813, 1955, 815, + /* 2370 */ 816, 2337, 1952, 817, 819, 821, 737, 820, 1934, 823, + /* 2380 */ 1274, 1908, 1262, 2285, 827, 736, 326, 829, 2337, 1642, + /* 2390 */ 833, 336, 832, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2400 */ 2285, 1878, 736, 1878, 2337, 1878, 1878, 1878, 1878, 1878, + /* 2410 */ 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, 1878, + /* 2420 */ 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 1878, + /* 2430 */ 343, 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, + /* 2440 */ 2319, 2318, 1878, 1878, 2356, 1878, 1878, 349, 2320, 740, + /* 2450 */ 2322, 2323, 735, 737, 730, 1878, 1878, 2318, 1878, 2319, + /* 2460 */ 2356, 1878, 1878, 353, 2320, 740, 2322, 2323, 735, 1878, + /* 2470 */ 730, 1878, 737, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2480 */ 1878, 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2490 */ 1878, 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 1878, + /* 2500 */ 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2510 */ 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 1878, 1878, + /* 2520 */ 1878, 1878, 1878, 1878, 1878, 1878, 2319, 1878, 1878, 1878, + /* 2530 */ 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 737, + /* 2540 */ 345, 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, + /* 2550 */ 1878, 1878, 1878, 2318, 1878, 2319, 2356, 1878, 1878, 354, + /* 2560 */ 2320, 740, 2322, 2323, 735, 1878, 730, 2337, 737, 1878, + /* 2570 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, + /* 2580 */ 1878, 736, 1878, 1878, 2319, 1878, 1878, 1878, 1878, 1878, + /* 2590 */ 1878, 1878, 1878, 1878, 1878, 1878, 2337, 737, 1878, 1878, + /* 2600 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, + /* 2610 */ 736, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2620 */ 2318, 1878, 2319, 2356, 1878, 2337, 346, 2320, 740, 2322, + /* 2630 */ 2323, 735, 1878, 730, 1878, 737, 1878, 2285, 1878, 736, + /* 2640 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2318, + /* 2650 */ 1878, 1878, 2356, 1878, 1878, 355, 2320, 740, 2322, 2323, + /* 2660 */ 735, 1878, 730, 2337, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2670 */ 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, 2318, 2319, + /* 2680 */ 1878, 2356, 1878, 1878, 347, 2320, 740, 2322, 2323, 735, + /* 2690 */ 1878, 730, 737, 1878, 1878, 1878, 1878, 2319, 1878, 1878, + /* 2700 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2710 */ 737, 1878, 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, + /* 2720 */ 2337, 1878, 361, 2320, 740, 2322, 2323, 735, 1878, 730, + /* 2730 */ 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 2337, 1878, + /* 2740 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2750 */ 2285, 1878, 736, 1878, 2319, 1878, 1878, 1878, 1878, 1878, + /* 2760 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 737, 1878, 1878, + /* 2770 */ 1878, 1878, 1878, 2318, 2319, 1878, 2356, 1878, 1878, 362, + /* 2780 */ 2320, 740, 2322, 2323, 735, 1878, 730, 737, 1878, 1878, + /* 2790 */ 2319, 2318, 1878, 1878, 2356, 2337, 1878, 2331, 2320, 740, + /* 2800 */ 2322, 2323, 735, 737, 730, 1878, 1878, 2285, 1878, 736, + /* 2810 */ 1878, 1878, 1878, 1878, 1878, 2337, 1878, 1878, 1878, 1878, + /* 2820 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, + /* 2830 */ 1878, 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2840 */ 1878, 1878, 1878, 2285, 1878, 736, 1878, 1878, 2318, 1878, + /* 2850 */ 1878, 2356, 1878, 1878, 2330, 2320, 740, 2322, 2323, 735, + /* 2860 */ 1878, 730, 1878, 1878, 1878, 1878, 1878, 1878, 2318, 1878, + /* 2870 */ 1878, 2356, 1878, 1878, 2329, 2320, 740, 2322, 2323, 735, + /* 2880 */ 1878, 730, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 2319, + /* 2890 */ 376, 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, + /* 2900 */ 1878, 1878, 737, 1878, 1878, 2319, 1878, 1878, 1878, 1878, + /* 2910 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 737, 1878, + /* 2920 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2930 */ 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2940 */ 1878, 1878, 2285, 1878, 736, 1878, 2337, 1878, 1878, 1878, + /* 2950 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, + /* 2960 */ 736, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2970 */ 1878, 1878, 2319, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 2980 */ 1878, 1878, 1878, 2318, 1878, 737, 2356, 2319, 1878, 377, + /* 2990 */ 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, 2318, + /* 3000 */ 737, 1878, 2356, 1878, 1878, 373, 2320, 740, 2322, 2323, + /* 3010 */ 735, 1878, 730, 2337, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3020 */ 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, 2337, 1878, + /* 3030 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3040 */ 2285, 1878, 736, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3050 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3060 */ 1878, 1878, 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, + /* 3070 */ 2319, 1878, 378, 2320, 740, 2322, 2323, 735, 1878, 730, + /* 3080 */ 1878, 738, 1878, 737, 2356, 1878, 1878, 352, 2320, 740, + /* 3090 */ 2322, 2323, 735, 1878, 730, 1878, 1878, 1878, 1878, 1878, + /* 3100 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3110 */ 1878, 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3120 */ 1878, 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 1878, + /* 3130 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3140 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3150 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, + /* 3160 */ 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 1878, + /* 3170 */ 351, 2320, 740, 2322, 2323, 735, 1878, 730, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 371, 382, 425, 382, 425, 361, 362, 430, 379, 390, @@ -547,18 +547,18 @@ static const YYCODETYPE yy_lookahead[] = { /* 20 */ 20, 20, 22, 8, 9, 381, 405, 12, 13, 14, /* 30 */ 15, 16, 388, 361, 362, 35, 0, 37, 8, 9, /* 40 */ 37, 33, 12, 13, 14, 15, 16, 349, 20, 361, - /* 50 */ 362, 390, 475, 361, 475, 478, 362, 478, 397, 459, - /* 60 */ 362, 390, 462, 33, 64, 0, 405, 20, 356, 381, + /* 50 */ 362, 390, 475, 361, 475, 478, 362, 478, 397, 377, + /* 60 */ 362, 390, 380, 33, 64, 0, 405, 20, 356, 381, /* 70 */ 70, 359, 360, 496, 497, 496, 497, 77, 501, 502, /* 80 */ 501, 502, 410, 412, 390, 414, 21, 20, 390, 24, /* 90 */ 25, 26, 27, 28, 29, 30, 31, 32, 406, 407, - /* 100 */ 402, 409, 404, 103, 20, 413, 106, 20, 72, 73, + /* 100 */ 402, 409, 404, 103, 13, 413, 106, 20, 72, 73, /* 110 */ 74, 75, 76, 20, 78, 79, 80, 81, 82, 83, /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, /* 130 */ 94, 95, 96, 97, 98, 99, 475, 107, 361, 478, /* 140 */ 14, 443, 142, 143, 446, 451, 20, 449, 450, 451, /* 150 */ 452, 453, 454, 106, 456, 448, 404, 496, 497, 461, - /* 160 */ 404, 463, 501, 502, 475, 467, 468, 478, 20, 361, + /* 160 */ 404, 463, 501, 502, 475, 467, 468, 478, 77, 361, /* 170 */ 362, 419, 361, 362, 422, 423, 176, 177, 422, 423, /* 180 */ 482, 474, 20, 183, 184, 496, 497, 37, 490, 381, /* 190 */ 501, 502, 103, 20, 417, 418, 388, 346, 198, 106, @@ -575,7 +575,7 @@ static const YYCODETYPE yy_lookahead[] = { /* 300 */ 111, 293, 113, 410, 64, 396, 390, 496, 497, 294, /* 310 */ 70, 20, 501, 502, 72, 73, 74, 77, 402, 448, /* 320 */ 404, 79, 80, 81, 135, 22, 475, 85, 139, 478, - /* 330 */ 361, 362, 90, 91, 92, 93, 14, 116, 96, 21, + /* 330 */ 361, 362, 90, 91, 92, 93, 14, 20, 96, 21, /* 340 */ 37, 99, 20, 103, 105, 474, 106, 496, 497, 197, /* 350 */ 381, 199, 501, 502, 36, 116, 38, 39, 40, 443, /* 360 */ 356, 268, 446, 359, 360, 449, 450, 451, 452, 453, @@ -587,13 +587,13 @@ static const YYCODETYPE yy_lookahead[] = { /* 420 */ 268, 8, 9, 183, 184, 12, 13, 14, 15, 16, /* 430 */ 268, 40, 41, 142, 143, 44, 361, 69, 198, 400, /* 440 */ 200, 0, 403, 404, 86, 54, 178, 8, 9, 106, - /* 450 */ 77, 12, 13, 14, 15, 16, 65, 66, 67, 68, + /* 450 */ 33, 12, 13, 14, 15, 16, 65, 66, 67, 68, /* 460 */ 105, 8, 9, 108, 349, 12, 13, 14, 15, 16, /* 470 */ 230, 231, 232, 20, 234, 235, 236, 237, 238, 239, /* 480 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, /* 490 */ 250, 251, 252, 12, 13, 33, 51, 106, 176, 361, /* 500 */ 362, 20, 386, 22, 59, 1, 148, 62, 63, 70, - /* 510 */ 435, 436, 252, 72, 73, 74, 35, 402, 37, 381, + /* 510 */ 435, 436, 20, 72, 73, 74, 35, 402, 37, 381, /* 520 */ 79, 80, 81, 19, 361, 362, 85, 172, 170, 171, /* 530 */ 14, 90, 91, 92, 93, 144, 20, 96, 357, 35, /* 540 */ 99, 64, 361, 230, 363, 64, 268, 20, 349, 268, @@ -611,12 +611,12 @@ static const YYCODETYPE yy_lookahead[] = { /* 660 */ 461, 55, 463, 2, 183, 184, 467, 468, 368, 8, /* 670 */ 9, 405, 103, 12, 13, 14, 15, 16, 0, 198, /* 680 */ 178, 200, 361, 362, 180, 232, 361, 362, 186, 490, - /* 690 */ 77, 187, 176, 393, 255, 256, 257, 258, 259, 260, - /* 700 */ 261, 262, 263, 264, 265, 178, 381, 402, 14, 107, - /* 710 */ 206, 230, 231, 232, 20, 234, 235, 236, 237, 238, + /* 690 */ 13, 187, 176, 393, 255, 256, 257, 258, 259, 260, + /* 700 */ 261, 262, 263, 264, 265, 178, 381, 402, 291, 107, + /* 710 */ 206, 230, 231, 232, 37, 234, 235, 236, 237, 238, /* 720 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 730 */ 249, 250, 251, 12, 13, 14, 349, 142, 143, 34, - /* 740 */ 357, 20, 349, 22, 361, 4, 363, 69, 232, 362, + /* 730 */ 249, 250, 251, 12, 13, 14, 349, 142, 143, 14, + /* 740 */ 357, 20, 349, 22, 361, 20, 363, 69, 232, 362, /* 750 */ 471, 472, 473, 135, 475, 476, 35, 139, 37, 232, /* 760 */ 135, 136, 137, 138, 139, 140, 141, 198, 349, 200, /* 770 */ 135, 136, 137, 138, 139, 140, 141, 390, 183, 184, @@ -630,40 +630,40 @@ static const YYCODETYPE yy_lookahead[] = { /* 850 */ 463, 381, 202, 137, 467, 468, 402, 141, 382, 402, /* 860 */ 35, 404, 443, 142, 143, 446, 390, 0, 449, 450, /* 870 */ 451, 452, 453, 454, 398, 456, 51, 0, 435, 436, - /* 880 */ 461, 390, 463, 58, 390, 505, 467, 468, 397, 64, - /* 890 */ 391, 397, 361, 362, 349, 402, 405, 176, 177, 405, + /* 880 */ 461, 390, 463, 58, 390, 252, 467, 468, 397, 64, + /* 890 */ 77, 397, 361, 362, 349, 402, 405, 176, 177, 405, /* 900 */ 443, 366, 367, 446, 183, 184, 449, 450, 451, 452, /* 910 */ 453, 454, 381, 456, 378, 460, 35, 462, 461, 198, /* 920 */ 463, 200, 349, 207, 467, 468, 210, 349, 392, 213, - /* 930 */ 105, 215, 51, 108, 390, 4, 375, 376, 402, 391, + /* 930 */ 105, 215, 51, 108, 390, 4, 375, 376, 402, 116, /* 940 */ 59, 60, 61, 62, 230, 64, 349, 402, 178, 405, /* 950 */ 425, 230, 231, 232, 23, 234, 235, 236, 237, 238, /* 960 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, /* 970 */ 249, 250, 251, 12, 13, 402, 176, 46, 47, 48, /* 980 */ 402, 20, 446, 22, 361, 362, 105, 361, 362, 108, - /* 990 */ 390, 3, 456, 431, 390, 349, 35, 397, 37, 402, + /* 990 */ 390, 3, 456, 34, 390, 349, 35, 397, 37, 402, /* 1000 */ 475, 397, 232, 478, 381, 405, 23, 381, 362, 405, - /* 1010 */ 364, 270, 135, 136, 137, 138, 139, 140, 141, 361, + /* 1010 */ 364, 391, 135, 136, 137, 138, 139, 140, 141, 361, /* 1020 */ 362, 496, 497, 361, 362, 64, 501, 502, 161, 349, /* 1030 */ 47, 48, 232, 382, 361, 362, 390, 170, 77, 381, /* 1040 */ 232, 390, 362, 381, 364, 361, 362, 391, 402, 398, /* 1050 */ 404, 8, 9, 172, 381, 12, 13, 14, 15, 16, - /* 1060 */ 391, 180, 181, 193, 103, 381, 0, 106, 187, 188, + /* 1060 */ 4, 180, 181, 193, 103, 381, 0, 106, 187, 188, /* 1070 */ 390, 8, 9, 361, 362, 12, 13, 14, 15, 16, - /* 1080 */ 56, 57, 402, 391, 404, 361, 362, 206, 37, 443, - /* 1090 */ 220, 221, 446, 381, 0, 449, 450, 451, 452, 453, + /* 1080 */ 56, 57, 402, 0, 404, 361, 362, 206, 37, 443, + /* 1090 */ 220, 221, 446, 381, 391, 449, 450, 451, 452, 453, /* 1100 */ 454, 425, 456, 142, 143, 381, 0, 461, 42, 463, /* 1110 */ 425, 8, 9, 467, 468, 12, 13, 14, 15, 16, /* 1120 */ 20, 349, 22, 443, 375, 376, 446, 349, 77, 449, - /* 1130 */ 450, 451, 452, 453, 454, 33, 456, 176, 177, 366, - /* 1140 */ 367, 461, 136, 463, 183, 184, 52, 467, 468, 475, - /* 1150 */ 107, 475, 478, 377, 478, 55, 380, 136, 137, 198, + /* 1130 */ 450, 451, 452, 453, 454, 52, 456, 176, 177, 366, + /* 1140 */ 367, 461, 136, 463, 183, 184, 391, 467, 468, 475, + /* 1150 */ 107, 475, 478, 459, 478, 55, 462, 136, 137, 198, /* 1160 */ 475, 200, 141, 478, 460, 378, 462, 349, 22, 425, /* 1170 */ 107, 497, 496, 497, 402, 501, 502, 501, 502, 392, /* 1180 */ 402, 496, 497, 37, 1, 2, 501, 502, 214, 402, /* 1190 */ 216, 230, 231, 232, 349, 234, 235, 236, 237, 238, /* 1200 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 1210 */ 249, 250, 251, 12, 13, 349, 415, 211, 212, 475, + /* 1210 */ 249, 250, 251, 12, 13, 349, 431, 211, 212, 475, /* 1220 */ 402, 20, 478, 22, 22, 14, 15, 16, 362, 349, /* 1230 */ 364, 475, 399, 446, 478, 402, 35, 390, 37, 37, /* 1240 */ 496, 497, 349, 456, 349, 501, 502, 402, 349, 103, @@ -673,115 +673,115 @@ static const YYCODETYPE yy_lookahead[] = { /* 1280 */ 9, 178, 402, 12, 13, 14, 15, 16, 0, 390, /* 1290 */ 107, 0, 0, 391, 33, 402, 116, 402, 33, 109, /* 1300 */ 33, 402, 112, 404, 103, 103, 45, 106, 402, 443, - /* 1310 */ 45, 494, 446, 402, 22, 449, 450, 451, 452, 453, - /* 1320 */ 454, 350, 456, 109, 33, 109, 112, 461, 112, 463, - /* 1330 */ 224, 12, 13, 467, 468, 109, 0, 13, 112, 51, - /* 1340 */ 13, 22, 443, 142, 143, 446, 166, 0, 449, 450, - /* 1350 */ 451, 452, 453, 454, 35, 456, 37, 365, 22, 106, - /* 1360 */ 461, 37, 463, 487, 37, 390, 467, 468, 115, 22, - /* 1370 */ 142, 143, 1, 2, 107, 349, 378, 176, 177, 33, - /* 1380 */ 378, 33, 33, 64, 183, 184, 33, 33, 362, 33, - /* 1390 */ 364, 415, 33, 291, 33, 13, 77, 360, 493, 198, - /* 1400 */ 33, 200, 415, 493, 424, 493, 493, 33, 415, 365, - /* 1410 */ 13, 33, 33, 200, 362, 401, 390, 33, 33, 37, - /* 1420 */ 415, 33, 103, 33, 33, 200, 33, 432, 402, 477, - /* 1430 */ 404, 230, 231, 232, 37, 234, 235, 236, 237, 238, + /* 1310 */ 45, 415, 446, 402, 22, 449, 450, 451, 452, 453, + /* 1320 */ 454, 391, 456, 13, 33, 109, 270, 461, 112, 463, + /* 1330 */ 224, 12, 13, 467, 468, 109, 0, 109, 112, 51, + /* 1340 */ 112, 22, 443, 142, 143, 446, 166, 37, 449, 450, + /* 1350 */ 451, 452, 453, 454, 35, 456, 37, 0, 22, 505, + /* 1360 */ 461, 350, 463, 142, 143, 494, 467, 468, 1, 2, + /* 1370 */ 365, 487, 390, 378, 107, 349, 13, 176, 177, 22, + /* 1380 */ 33, 33, 33, 64, 183, 184, 33, 33, 362, 33, + /* 1390 */ 364, 33, 33, 106, 33, 13, 77, 33, 378, 198, + /* 1400 */ 37, 200, 115, 493, 415, 360, 415, 493, 493, 424, + /* 1410 */ 493, 33, 33, 200, 33, 365, 390, 33, 33, 37, + /* 1420 */ 362, 33, 103, 33, 33, 200, 401, 415, 402, 432, + /* 1430 */ 404, 230, 231, 232, 415, 234, 235, 236, 237, 238, /* 1440 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 1450 */ 249, 250, 251, 107, 415, 107, 107, 498, 469, 480, - /* 1460 */ 107, 107, 271, 107, 426, 51, 107, 445, 107, 443, - /* 1470 */ 42, 444, 446, 20, 107, 449, 450, 451, 452, 453, - /* 1480 */ 454, 107, 456, 349, 437, 107, 107, 461, 213, 463, - /* 1490 */ 442, 107, 107, 467, 468, 107, 362, 107, 107, 370, - /* 1500 */ 107, 437, 370, 196, 428, 20, 361, 20, 45, 362, - /* 1510 */ 411, 362, 411, 175, 361, 408, 362, 198, 361, 200, - /* 1520 */ 411, 408, 408, 104, 390, 374, 102, 361, 373, 361, - /* 1530 */ 101, 372, 361, 361, 20, 354, 402, 358, 404, 50, - /* 1540 */ 354, 349, 358, 370, 370, 437, 20, 404, 370, 230, - /* 1550 */ 231, 20, 363, 20, 362, 427, 363, 370, 370, 20, - /* 1560 */ 418, 354, 402, 244, 245, 246, 247, 248, 249, 250, - /* 1570 */ 370, 361, 390, 370, 370, 390, 352, 443, 349, 352, - /* 1580 */ 446, 217, 390, 449, 450, 451, 452, 453, 454, 390, - /* 1590 */ 456, 362, 361, 354, 402, 461, 404, 463, 390, 390, - /* 1600 */ 402, 467, 468, 441, 106, 390, 439, 390, 390, 390, - /* 1610 */ 390, 349, 390, 437, 402, 368, 20, 204, 203, 390, - /* 1620 */ 368, 361, 426, 278, 362, 404, 486, 277, 489, 434, - /* 1630 */ 436, 402, 402, 404, 486, 443, 189, 286, 446, 433, - /* 1640 */ 488, 449, 450, 451, 452, 453, 454, 486, 456, 485, - /* 1650 */ 288, 362, 390, 461, 349, 463, 420, 420, 272, 467, - /* 1660 */ 468, 484, 287, 295, 402, 292, 404, 362, 426, 506, - /* 1670 */ 500, 290, 443, 267, 499, 446, 20, 116, 449, 450, - /* 1680 */ 451, 452, 453, 454, 363, 456, 448, 269, 483, 420, - /* 1690 */ 368, 349, 463, 368, 420, 390, 467, 468, 402, 402, - /* 1700 */ 402, 402, 479, 402, 362, 443, 181, 402, 446, 404, - /* 1710 */ 416, 449, 450, 451, 452, 453, 454, 386, 456, 362, - /* 1720 */ 368, 481, 106, 368, 466, 463, 106, 394, 402, 467, - /* 1730 */ 468, 361, 390, 368, 22, 38, 421, 354, 380, 429, - /* 1740 */ 351, 438, 355, 347, 402, 0, 404, 384, 443, 349, - /* 1750 */ 421, 446, 0, 384, 449, 450, 451, 452, 453, 454, - /* 1760 */ 384, 456, 362, 369, 0, 45, 349, 0, 463, 37, - /* 1770 */ 223, 37, 467, 468, 37, 37, 223, 0, 37, 362, - /* 1780 */ 37, 223, 0, 37, 0, 443, 223, 349, 446, 0, + /* 1450 */ 249, 250, 251, 415, 107, 107, 107, 477, 498, 469, + /* 1460 */ 107, 107, 380, 107, 480, 107, 107, 271, 107, 443, + /* 1470 */ 426, 107, 446, 51, 445, 449, 450, 451, 452, 453, + /* 1480 */ 454, 42, 456, 349, 444, 107, 107, 461, 107, 463, + /* 1490 */ 20, 107, 107, 467, 468, 107, 362, 107, 107, 437, + /* 1500 */ 370, 442, 213, 370, 437, 196, 428, 20, 361, 20, + /* 1510 */ 362, 45, 411, 362, 175, 411, 408, 198, 361, 200, + /* 1520 */ 362, 361, 411, 408, 390, 408, 374, 104, 102, 373, + /* 1530 */ 361, 101, 361, 372, 361, 361, 402, 20, 404, 354, + /* 1540 */ 50, 349, 358, 354, 358, 370, 437, 370, 20, 230, + /* 1550 */ 231, 370, 20, 404, 362, 20, 363, 370, 427, 20, + /* 1560 */ 363, 370, 418, 244, 245, 246, 247, 248, 249, 250, + /* 1570 */ 370, 361, 354, 370, 370, 106, 441, 443, 349, 352, + /* 1580 */ 446, 402, 390, 449, 450, 451, 452, 453, 454, 390, + /* 1590 */ 456, 362, 361, 352, 402, 461, 404, 463, 390, 390, + /* 1600 */ 354, 467, 468, 217, 390, 390, 439, 390, 402, 390, + /* 1610 */ 390, 349, 390, 390, 390, 437, 368, 20, 436, 390, + /* 1620 */ 204, 203, 434, 368, 362, 361, 486, 433, 278, 277, + /* 1630 */ 286, 402, 402, 404, 489, 443, 404, 189, 446, 402, + /* 1640 */ 486, 449, 450, 451, 452, 453, 454, 488, 456, 486, + /* 1650 */ 288, 485, 390, 461, 349, 463, 420, 287, 420, 467, + /* 1660 */ 468, 426, 500, 295, 402, 272, 404, 362, 426, 292, + /* 1670 */ 506, 499, 443, 290, 267, 446, 362, 20, 449, 450, + /* 1680 */ 451, 452, 453, 454, 116, 456, 363, 448, 269, 484, + /* 1690 */ 483, 349, 463, 481, 368, 390, 467, 468, 368, 420, + /* 1700 */ 402, 402, 402, 402, 362, 443, 420, 402, 446, 404, + /* 1710 */ 402, 449, 450, 451, 452, 453, 454, 181, 456, 479, + /* 1720 */ 416, 386, 106, 368, 466, 463, 106, 362, 368, 467, + /* 1730 */ 468, 394, 390, 402, 361, 22, 38, 368, 351, 421, + /* 1740 */ 429, 438, 421, 354, 402, 347, 404, 355, 443, 349, + /* 1750 */ 384, 446, 0, 0, 449, 450, 451, 452, 453, 454, + /* 1760 */ 384, 456, 362, 369, 384, 0, 349, 45, 463, 0, + /* 1770 */ 37, 223, 467, 468, 37, 37, 37, 223, 0, 362, + /* 1780 */ 37, 37, 223, 37, 0, 443, 223, 349, 446, 0, /* 1790 */ 390, 449, 450, 451, 452, 453, 454, 37, 456, 0, - /* 1800 */ 362, 22, 402, 37, 404, 218, 0, 390, 206, 0, - /* 1810 */ 206, 200, 207, 198, 0, 0, 0, 194, 193, 402, - /* 1820 */ 0, 404, 0, 147, 49, 49, 0, 37, 390, 51, - /* 1830 */ 0, 0, 49, 491, 492, 0, 45, 0, 0, 0, - /* 1840 */ 402, 49, 404, 443, 0, 0, 446, 0, 0, 449, - /* 1850 */ 450, 451, 452, 453, 454, 0, 456, 161, 37, 0, - /* 1860 */ 443, 161, 0, 446, 0, 0, 449, 450, 451, 452, + /* 1800 */ 362, 22, 402, 37, 404, 0, 218, 390, 0, 206, + /* 1810 */ 0, 206, 200, 207, 0, 198, 0, 0, 194, 402, + /* 1820 */ 193, 404, 0, 0, 147, 49, 49, 0, 390, 37, + /* 1830 */ 0, 51, 49, 491, 492, 0, 45, 0, 0, 0, + /* 1840 */ 402, 0, 404, 443, 49, 0, 446, 0, 0, 449, + /* 1850 */ 450, 451, 452, 453, 454, 0, 456, 0, 161, 0, + /* 1860 */ 443, 37, 161, 446, 0, 0, 449, 450, 451, 452, /* 1870 */ 453, 454, 0, 456, 0, 0, 0, 0, 0, 0, /* 1880 */ 463, 443, 0, 0, 446, 468, 349, 449, 450, 451, /* 1890 */ 452, 453, 454, 0, 456, 0, 0, 0, 0, 362, - /* 1900 */ 49, 0, 45, 503, 504, 0, 0, 0, 0, 0, - /* 1910 */ 0, 0, 22, 349, 0, 147, 0, 146, 0, 145, - /* 1920 */ 0, 0, 22, 50, 22, 0, 362, 390, 37, 0, - /* 1930 */ 492, 50, 395, 64, 64, 0, 0, 0, 51, 402, - /* 1940 */ 37, 404, 0, 51, 349, 0, 42, 0, 64, 37, - /* 1950 */ 51, 0, 37, 14, 390, 42, 0, 362, 0, 395, - /* 1960 */ 37, 42, 45, 33, 42, 0, 402, 0, 404, 0, - /* 1970 */ 189, 43, 0, 49, 42, 49, 49, 0, 0, 0, - /* 1980 */ 443, 349, 42, 446, 0, 390, 449, 450, 451, 452, - /* 1990 */ 453, 454, 49, 456, 362, 51, 37, 402, 22, 404, - /* 2000 */ 0, 37, 71, 42, 51, 42, 0, 443, 37, 0, + /* 1900 */ 0, 49, 0, 503, 504, 45, 0, 0, 0, 0, + /* 1910 */ 0, 0, 0, 349, 22, 0, 0, 147, 146, 0, + /* 1920 */ 145, 0, 0, 22, 0, 22, 362, 390, 37, 0, + /* 1930 */ 492, 50, 395, 64, 50, 64, 0, 64, 0, 402, + /* 1940 */ 0, 404, 37, 0, 349, 51, 42, 0, 0, 0, + /* 1950 */ 37, 14, 0, 0, 390, 0, 33, 362, 0, 395, + /* 1960 */ 42, 0, 37, 37, 0, 51, 402, 0, 404, 42, + /* 1970 */ 189, 51, 42, 45, 43, 0, 42, 0, 0, 37, + /* 1980 */ 443, 349, 49, 446, 49, 390, 449, 450, 451, 452, + /* 1990 */ 453, 454, 42, 456, 362, 49, 51, 402, 42, 404, + /* 2000 */ 49, 0, 37, 71, 42, 51, 0, 443, 37, 0, /* 2010 */ 446, 51, 42, 449, 450, 451, 452, 453, 454, 37, - /* 2020 */ 456, 0, 390, 0, 51, 42, 0, 0, 0, 0, - /* 2030 */ 37, 0, 37, 37, 402, 0, 404, 33, 443, 37, - /* 2040 */ 37, 446, 37, 33, 449, 450, 451, 452, 453, 454, - /* 2050 */ 37, 456, 114, 112, 349, 37, 37, 37, 22, 37, - /* 2060 */ 22, 37, 0, 22, 53, 0, 22, 362, 0, 37, - /* 2070 */ 0, 0, 0, 0, 37, 443, 37, 22, 446, 349, + /* 2020 */ 456, 42, 390, 51, 0, 0, 0, 0, 0, 0, + /* 2030 */ 37, 114, 22, 0, 402, 0, 404, 37, 443, 37, + /* 2040 */ 37, 446, 37, 0, 449, 450, 451, 452, 453, 454, + /* 2050 */ 37, 456, 37, 112, 349, 37, 37, 37, 37, 22, + /* 2060 */ 37, 22, 22, 33, 33, 53, 0, 362, 22, 37, + /* 2070 */ 0, 0, 0, 37, 0, 443, 0, 22, 446, 349, /* 2080 */ 20, 449, 450, 451, 452, 453, 454, 37, 456, 37, - /* 2090 */ 495, 37, 362, 107, 106, 390, 0, 106, 49, 205, - /* 2100 */ 395, 0, 22, 37, 0, 22, 0, 402, 0, 404, - /* 2110 */ 3, 178, 178, 273, 33, 107, 273, 50, 106, 50, - /* 2120 */ 390, 106, 349, 107, 107, 33, 178, 33, 178, 104, - /* 2130 */ 181, 33, 402, 178, 404, 362, 504, 349, 49, 185, - /* 2140 */ 106, 3, 185, 0, 102, 33, 106, 201, 443, 106, - /* 2150 */ 362, 446, 349, 107, 449, 450, 451, 452, 453, 454, - /* 2160 */ 49, 456, 106, 390, 107, 362, 107, 33, 395, 37, - /* 2170 */ 37, 107, 37, 443, 37, 402, 446, 404, 390, 449, + /* 2090 */ 495, 37, 362, 37, 107, 390, 106, 0, 106, 0, + /* 2100 */ 395, 37, 49, 22, 205, 0, 22, 402, 0, 404, + /* 2110 */ 3, 33, 50, 273, 106, 104, 33, 178, 0, 50, + /* 2120 */ 390, 33, 349, 107, 107, 33, 49, 33, 106, 49, + /* 2130 */ 3, 273, 402, 33, 404, 362, 504, 349, 181, 273, + /* 2140 */ 102, 178, 49, 37, 178, 201, 178, 178, 443, 107, + /* 2150 */ 362, 446, 349, 106, 449, 450, 451, 452, 453, 454, + /* 2160 */ 37, 456, 37, 390, 106, 362, 107, 106, 395, 185, + /* 2170 */ 185, 106, 37, 443, 107, 402, 446, 404, 390, 449, /* 2180 */ 450, 451, 452, 453, 454, 37, 456, 37, 458, 107, - /* 2190 */ 402, 49, 404, 390, 33, 49, 0, 42, 395, 106, - /* 2200 */ 0, 106, 42, 115, 107, 402, 107, 404, 106, 106, - /* 2210 */ 2, 106, 182, 180, 49, 106, 443, 349, 266, 446, - /* 2220 */ 33, 104, 449, 450, 451, 452, 453, 454, 253, 456, - /* 2230 */ 362, 443, 104, 22, 446, 349, 106, 449, 450, 451, - /* 2240 */ 452, 453, 454, 107, 456, 106, 443, 273, 362, 446, - /* 2250 */ 49, 107, 449, 450, 451, 452, 453, 454, 390, 456, - /* 2260 */ 106, 49, 22, 107, 106, 106, 37, 116, 37, 107, - /* 2270 */ 402, 107, 404, 106, 106, 230, 390, 107, 37, 106, - /* 2280 */ 233, 107, 37, 107, 106, 37, 106, 37, 402, 107, - /* 2290 */ 404, 106, 37, 107, 106, 106, 127, 33, 127, 127, - /* 2300 */ 106, 106, 127, 37, 22, 71, 70, 37, 37, 37, + /* 2190 */ 402, 33, 404, 390, 107, 49, 107, 0, 395, 0, + /* 2200 */ 0, 106, 42, 107, 106, 402, 42, 404, 107, 106, + /* 2210 */ 106, 49, 33, 2, 180, 106, 443, 349, 106, 446, + /* 2220 */ 104, 104, 449, 450, 451, 452, 453, 454, 115, 456, + /* 2230 */ 362, 443, 22, 182, 446, 349, 253, 449, 450, 451, + /* 2240 */ 452, 453, 454, 106, 456, 107, 443, 106, 362, 446, + /* 2250 */ 107, 106, 449, 450, 451, 452, 453, 454, 390, 456, + /* 2260 */ 266, 107, 49, 106, 49, 106, 22, 116, 107, 106, + /* 2270 */ 402, 230, 404, 107, 37, 37, 390, 233, 106, 37, + /* 2280 */ 107, 106, 37, 107, 106, 37, 37, 107, 402, 106, + /* 2290 */ 404, 107, 106, 37, 107, 106, 127, 127, 127, 106, + /* 2300 */ 33, 127, 106, 37, 106, 22, 37, 71, 37, 70, /* 2310 */ 77, 443, 37, 37, 446, 37, 37, 449, 450, 451, - /* 2320 */ 452, 453, 454, 37, 456, 37, 100, 33, 37, 443, - /* 2330 */ 349, 22, 446, 37, 37, 449, 450, 451, 452, 453, - /* 2340 */ 454, 37, 456, 362, 37, 37, 77, 349, 37, 37, - /* 2350 */ 37, 37, 37, 22, 37, 0, 37, 51, 42, 0, - /* 2360 */ 362, 37, 42, 349, 0, 37, 0, 42, 42, 51, - /* 2370 */ 37, 390, 51, 51, 0, 37, 362, 37, 0, 22, - /* 2380 */ 33, 20, 22, 402, 21, 404, 507, 22, 390, 22, - /* 2390 */ 21, 507, 507, 507, 507, 507, 507, 507, 507, 507, + /* 2320 */ 452, 453, 454, 37, 456, 37, 37, 100, 77, 443, + /* 2330 */ 349, 100, 446, 33, 37, 449, 450, 451, 452, 453, + /* 2340 */ 454, 37, 456, 362, 37, 22, 37, 349, 37, 37, + /* 2350 */ 37, 77, 37, 37, 37, 37, 22, 37, 0, 37, + /* 2360 */ 362, 51, 0, 349, 37, 51, 42, 42, 0, 37, + /* 2370 */ 51, 390, 0, 42, 37, 42, 362, 51, 0, 37, + /* 2380 */ 37, 0, 22, 402, 33, 404, 22, 21, 390, 22, + /* 2390 */ 20, 22, 21, 507, 507, 507, 507, 507, 507, 507, /* 2400 */ 402, 507, 404, 507, 390, 507, 507, 507, 507, 507, /* 2410 */ 507, 507, 507, 507, 507, 507, 402, 507, 404, 507, /* 2420 */ 507, 507, 507, 507, 443, 507, 507, 446, 507, 507, @@ -896,9 +896,9 @@ static const YYCODETYPE yy_lookahead[] = { /* 3510 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, /* 3520 */ 346, 346, 346, 346, }; -#define YY_SHIFT_COUNT (832) +#define YY_SHIFT_COUNT (834) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2378) +#define YY_SHIFT_MAX (2381) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 391, 0, 240, 0, 481, 481, 481, 481, 481, 481, /* 10 */ 481, 481, 481, 481, 481, 481, 721, 961, 961, 1201, @@ -909,81 +909,81 @@ static const unsigned short int yy_shift_ofst[] = { /* 60 */ 47, 278, 1319, 278, 239, 1319, 1319, 281, 278, 28, /* 70 */ 595, 67, 67, 931, 931, 595, 87, 291, 126, 126, /* 80 */ 173, 67, 67, 67, 67, 67, 67, 67, 67, 67, - /* 90 */ 67, 67, 84, 148, 67, 67, 187, 28, 67, 84, + /* 90 */ 67, 67, 317, 492, 67, 67, 187, 28, 67, 317, /* 100 */ 67, 28, 67, 67, 28, 67, 67, 28, 67, 28, /* 110 */ 28, 28, 67, 368, 439, 439, 242, 546, 569, 569, /* 120 */ 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, /* 130 */ 569, 569, 569, 569, 569, 569, 569, 189, 602, 87, /* 140 */ 291, 1024, 1024, 150, 268, 268, 268, 678, 336, 336, - /* 150 */ 150, 187, 221, 28, 28, 260, 28, 373, 28, 373, - /* 160 */ 373, 486, 613, 705, 89, 89, 89, 89, 89, 89, + /* 150 */ 91, 150, 187, 486, 28, 28, 633, 28, 813, 28, + /* 160 */ 813, 813, 823, 959, 89, 89, 89, 89, 89, 89, /* 170 */ 89, 89, 504, 441, 65, 453, 15, 313, 606, 19, /* 180 */ 322, 516, 3, 3, 527, 983, 770, 303, 303, 303, - /* 190 */ 502, 303, 800, 1100, 1, 694, 618, 650, 1, 1, - /* 200 */ 808, 1009, 538, 988, 1009, 1261, 741, 1191, 1414, 1428, - /* 210 */ 1453, 1275, 187, 1453, 187, 1307, 1485, 1487, 1463, 1487, - /* 220 */ 1463, 1338, 1485, 1487, 1485, 1463, 1338, 1338, 1419, 1424, - /* 230 */ 1485, 1429, 1485, 1485, 1485, 1514, 1489, 1514, 1489, 1453, - /* 240 */ 187, 187, 1526, 187, 1531, 1533, 187, 1531, 187, 1539, - /* 250 */ 187, 187, 1485, 187, 1514, 28, 28, 28, 28, 28, - /* 260 */ 28, 28, 28, 28, 28, 28, 1485, 705, 705, 1514, - /* 270 */ 373, 373, 373, 1364, 1498, 1453, 368, 1596, 1413, 1415, - /* 280 */ 1526, 368, 1191, 1485, 373, 1345, 1350, 1345, 1350, 1351, - /* 290 */ 1447, 1345, 1362, 1375, 1386, 1191, 1368, 1373, 1381, 1406, - /* 300 */ 1487, 1656, 1561, 1418, 1531, 368, 368, 1350, 373, 373, - /* 310 */ 373, 373, 1350, 373, 1525, 368, 486, 368, 1487, 1616, - /* 320 */ 1620, 373, 613, 1485, 368, 1712, 1697, 1514, 3178, 3178, + /* 190 */ 502, 303, 800, 1100, 1, 725, 618, 650, 1, 1, + /* 200 */ 808, 1009, 538, 988, 1009, 1261, 1056, 91, 1196, 1422, + /* 210 */ 1439, 1470, 1289, 187, 1470, 187, 1309, 1487, 1489, 1466, + /* 220 */ 1489, 1466, 1339, 1487, 1489, 1487, 1466, 1339, 1339, 1423, + /* 230 */ 1426, 1487, 1430, 1487, 1487, 1487, 1517, 1490, 1517, 1490, + /* 240 */ 1470, 187, 187, 1528, 187, 1532, 1535, 187, 1532, 187, + /* 250 */ 1539, 187, 187, 1487, 187, 1517, 28, 28, 28, 28, + /* 260 */ 28, 28, 28, 28, 28, 28, 28, 1487, 959, 959, + /* 270 */ 1517, 813, 813, 813, 1386, 1469, 1470, 368, 1597, 1416, + /* 280 */ 1418, 1528, 368, 1196, 1487, 813, 1350, 1352, 1350, 1352, + /* 290 */ 1344, 1448, 1350, 1362, 1370, 1393, 1196, 1368, 1377, 1383, + /* 300 */ 1407, 1489, 1657, 1568, 1419, 1532, 368, 368, 1352, 813, + /* 310 */ 813, 813, 813, 1352, 813, 1536, 368, 823, 368, 1489, + /* 320 */ 1616, 1620, 813, 1487, 368, 1713, 1698, 1517, 3178, 3178, /* 330 */ 3178, 3178, 3178, 3178, 3178, 3178, 3178, 36, 881, 786, /* 340 */ 30, 825, 1043, 1063, 625, 413, 661, 1103, 877, 1271, /* 350 */ 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 635, 716, /* 360 */ 318, 363, 363, 355, 358, 445, 870, 867, 1146, 1202, /* 370 */ 1006, 1021, 1021, 1211, 1183, 382, 1211, 1211, 1211, 1288, - /* 380 */ 1106, 462, 1066, 1265, 1180, 1291, 1190, 1214, 1216, 1226, - /* 390 */ 1324, 1327, 1292, 1336, 1347, 974, 1267, 1346, 477, 1348, - /* 400 */ 1349, 1353, 1228, 1102, 8, 1354, 1356, 1359, 1361, 1367, - /* 410 */ 1378, 1371, 1374, 714, 1379, 155, 1384, 1385, 1388, 1390, - /* 420 */ 1391, 1393, 1253, 1213, 1225, 1382, 1397, 1051, 1094, 1745, - /* 430 */ 1752, 1764, 1720, 1767, 1732, 1547, 1734, 1737, 1738, 1553, - /* 440 */ 1777, 1741, 1743, 1558, 1746, 1782, 1563, 1784, 1760, 1789, - /* 450 */ 1779, 1799, 1766, 1587, 1806, 1602, 1809, 1604, 1605, 1611, - /* 460 */ 1615, 1814, 1815, 1816, 1623, 1625, 1820, 1822, 1676, 1775, - /* 470 */ 1776, 1826, 1790, 1778, 1830, 1783, 1831, 1791, 1835, 1837, - /* 480 */ 1838, 1792, 1839, 1844, 1845, 1847, 1848, 1855, 1696, 1821, - /* 490 */ 1859, 1700, 1862, 1864, 1865, 1872, 1874, 1875, 1876, 1877, - /* 500 */ 1878, 1879, 1882, 1883, 1893, 1895, 1896, 1897, 1898, 1851, - /* 510 */ 1901, 1857, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1890, - /* 520 */ 1914, 1768, 1916, 1771, 1918, 1774, 1920, 1921, 1900, 1873, - /* 530 */ 1902, 1881, 1925, 1869, 1891, 1929, 1870, 1935, 1884, 1936, - /* 540 */ 1937, 1903, 1887, 1904, 1942, 1912, 1892, 1913, 1945, 1915, - /* 550 */ 1899, 1919, 1947, 1923, 1951, 1917, 1922, 1930, 1924, 1926, - /* 560 */ 1939, 1927, 1956, 1928, 1932, 1958, 1965, 1967, 1969, 1940, - /* 570 */ 1781, 1972, 1924, 1943, 1977, 1978, 1931, 1979, 1984, 1959, - /* 580 */ 1944, 1961, 2000, 1964, 1953, 1963, 2006, 1971, 1960, 1970, - /* 590 */ 2009, 1982, 1973, 1983, 2021, 2023, 2026, 2027, 2028, 2029, - /* 600 */ 1938, 1941, 1993, 1976, 2031, 1995, 1996, 2002, 2003, 2005, - /* 610 */ 2013, 2018, 2019, 2004, 2010, 2020, 2022, 2038, 2024, 2035, - /* 620 */ 2036, 2062, 2041, 2011, 2065, 2044, 2032, 2068, 2070, 2071, - /* 630 */ 2037, 2072, 2039, 2073, 2055, 2060, 2050, 2052, 2054, 1986, - /* 640 */ 1988, 2096, 1933, 1991, 1894, 1924, 2049, 2101, 1934, 2066, - /* 650 */ 2080, 2104, 1946, 2083, 1948, 1949, 2106, 2108, 1950, 1954, - /* 660 */ 1955, 1957, 2107, 2081, 1840, 2012, 2008, 2015, 2067, 2025, - /* 670 */ 2069, 2042, 2016, 2092, 2094, 2017, 2034, 2040, 2043, 2046, - /* 680 */ 2098, 2089, 2111, 2056, 2112, 1843, 2057, 2059, 2138, 2134, - /* 690 */ 1974, 2132, 2133, 2135, 2137, 2148, 2150, 2064, 2082, 2142, - /* 700 */ 1952, 2161, 2146, 2143, 2196, 2093, 2155, 2095, 2097, 2099, - /* 710 */ 2102, 2103, 2030, 2105, 2200, 2160, 2033, 2109, 2088, 1924, - /* 720 */ 2165, 2187, 2117, 1975, 2128, 2208, 2211, 2045, 2130, 2136, - /* 730 */ 2139, 2144, 2154, 2156, 2201, 2158, 2159, 2212, 2162, 2240, - /* 740 */ 2047, 2167, 2151, 2164, 2229, 2231, 2168, 2170, 2241, 2173, - /* 750 */ 2174, 2245, 2178, 2176, 2248, 2180, 2182, 2250, 2185, 2186, - /* 760 */ 2255, 2188, 2169, 2171, 2172, 2175, 2189, 2264, 2194, 2266, - /* 770 */ 2195, 2264, 2264, 2282, 2234, 2236, 2270, 2271, 2272, 2275, - /* 780 */ 2276, 2278, 2279, 2286, 2288, 2233, 2226, 2294, 2291, 2296, - /* 790 */ 2297, 2309, 2304, 2307, 2308, 2269, 2004, 2311, 2010, 2312, - /* 800 */ 2313, 2314, 2315, 2331, 2317, 2355, 2319, 2306, 2316, 2359, - /* 810 */ 2324, 2318, 2320, 2364, 2328, 2321, 2325, 2366, 2333, 2322, - /* 820 */ 2326, 2374, 2338, 2340, 2378, 2357, 2347, 2360, 2363, 2365, - /* 830 */ 2367, 2369, 2361, + /* 380 */ 1106, 462, 1066, 1265, 1180, 1291, 1190, 1216, 1226, 1228, + /* 390 */ 677, 1310, 1292, 1336, 1357, 974, 1267, 1347, 477, 1348, + /* 400 */ 1349, 1353, 1221, 417, 8, 1354, 1356, 1358, 1359, 1361, + /* 410 */ 1364, 1367, 1378, 714, 1379, 155, 1381, 1384, 1385, 1388, + /* 420 */ 1390, 1391, 1287, 1213, 1225, 1363, 1382, 1051, 1083, 1752, + /* 430 */ 1753, 1765, 1722, 1769, 1733, 1548, 1737, 1738, 1739, 1554, + /* 440 */ 1778, 1743, 1744, 1559, 1746, 1784, 1563, 1789, 1760, 1799, + /* 450 */ 1779, 1805, 1766, 1588, 1808, 1603, 1810, 1605, 1606, 1612, + /* 460 */ 1617, 1814, 1816, 1817, 1624, 1627, 1822, 1823, 1677, 1776, + /* 470 */ 1777, 1827, 1792, 1780, 1830, 1783, 1835, 1791, 1837, 1838, + /* 480 */ 1839, 1795, 1841, 1845, 1847, 1848, 1855, 1857, 1697, 1824, + /* 490 */ 1859, 1701, 1864, 1865, 1872, 1874, 1875, 1876, 1877, 1878, + /* 500 */ 1879, 1882, 1883, 1893, 1895, 1896, 1897, 1898, 1900, 1852, + /* 510 */ 1902, 1860, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1892, + /* 520 */ 1915, 1770, 1916, 1772, 1919, 1775, 1921, 1922, 1901, 1881, + /* 530 */ 1903, 1884, 1924, 1869, 1891, 1929, 1871, 1936, 1873, 1938, + /* 540 */ 1940, 1905, 1894, 1904, 1943, 1913, 1914, 1918, 1947, 1925, + /* 550 */ 1920, 1927, 1948, 1926, 1949, 1928, 1930, 1923, 1933, 1935, + /* 560 */ 1937, 1946, 1952, 1931, 1934, 1953, 1955, 1958, 1961, 1950, + /* 570 */ 1781, 1964, 1933, 1951, 1967, 1975, 1932, 1977, 1978, 1942, + /* 580 */ 1945, 1956, 2001, 1965, 1954, 1962, 2006, 1971, 1960, 1970, + /* 590 */ 2009, 1982, 1972, 1979, 2024, 2025, 2026, 2027, 2028, 2029, + /* 600 */ 1917, 1941, 1993, 2010, 2033, 2000, 2002, 2003, 2005, 2013, + /* 610 */ 2015, 2018, 2019, 2030, 2031, 2020, 2021, 2037, 2023, 2035, + /* 620 */ 2039, 2043, 2040, 2012, 2066, 2046, 2032, 2070, 2071, 2072, + /* 630 */ 2036, 2074, 2050, 2076, 2055, 2060, 2052, 2054, 2056, 1987, + /* 640 */ 1990, 2097, 1939, 1992, 1899, 1933, 2053, 2099, 1963, 2064, + /* 650 */ 2081, 2105, 1944, 2084, 1966, 1957, 2108, 2118, 1968, 1984, + /* 660 */ 1969, 1985, 2107, 2078, 1840, 2008, 2016, 2022, 2062, 2011, + /* 670 */ 2069, 2038, 2017, 2083, 2088, 2042, 2047, 2058, 2061, 2059, + /* 680 */ 2092, 2077, 2080, 2065, 2094, 1858, 2067, 2082, 2127, 2100, + /* 690 */ 1866, 2106, 2123, 2125, 2135, 2148, 2150, 2087, 2089, 2093, + /* 700 */ 1994, 2158, 2146, 2197, 2199, 2095, 2160, 2098, 2096, 2101, + /* 710 */ 2103, 2104, 2051, 2109, 2200, 2164, 2034, 2112, 2113, 1933, + /* 720 */ 2162, 2179, 2116, 1983, 2117, 2211, 2210, 2041, 2137, 2138, + /* 730 */ 2141, 2143, 2145, 2154, 2213, 2157, 2159, 2215, 2161, 2244, + /* 740 */ 2044, 2163, 2151, 2166, 2237, 2238, 2172, 2173, 2242, 2175, + /* 750 */ 2176, 2245, 2178, 2180, 2248, 2183, 2184, 2249, 2186, 2187, + /* 760 */ 2256, 2189, 2169, 2170, 2171, 2174, 2193, 2267, 2196, 2266, + /* 770 */ 2198, 2267, 2267, 2283, 2236, 2239, 2269, 2271, 2275, 2276, + /* 780 */ 2278, 2279, 2286, 2288, 2289, 2233, 2227, 2251, 2231, 2300, + /* 790 */ 2297, 2304, 2307, 2323, 2309, 2311, 2312, 2274, 2030, 2313, + /* 800 */ 2031, 2315, 2316, 2317, 2318, 2334, 2320, 2358, 2322, 2310, + /* 810 */ 2324, 2362, 2327, 2314, 2325, 2368, 2332, 2319, 2331, 2372, + /* 820 */ 2337, 2326, 2333, 2378, 2342, 2343, 2381, 2360, 2351, 2364, + /* 830 */ 2366, 2367, 2369, 2371, 2370, }; #define YY_REDUCE_COUNT (336) #define YY_REDUCE_MIN (-423) @@ -1004,111 +1004,111 @@ static const short yy_reduce_ofst[] = { /* 120 */ 393, 433, 454, 493, 545, 573, 578, 597, 772, 778, /* 130 */ 818, 845, 880, 893, 895, 906, 911, 161, -293, -123, /* 140 */ 398, 535, 773, 561, -293, -129, 360, 300, 455, 704, - /* 150 */ 749, -98, 116, 266, 544, -400, 861, 833, 847, 865, - /* 160 */ 872, 883, 776, 920, 499, 548, 656, 669, 692, 863, - /* 170 */ 902, 692, 562, -369, 971, 801, 380, 817, 992, 876, - /* 180 */ 975, 975, 998, 1002, 976, 1037, 987, 905, 910, 912, - /* 190 */ 980, 913, 975, 1044, 993, 1052, 1014, 995, 1005, 1039, - /* 200 */ 975, 952, 952, 959, 952, 989, 979, 1038, 1022, 1027, - /* 210 */ 1047, 1048, 1129, 1064, 1132, 1076, 1145, 1147, 1099, 1149, - /* 220 */ 1101, 1107, 1153, 1154, 1157, 1109, 1113, 1114, 1151, 1155, - /* 230 */ 1166, 1159, 1168, 1171, 1172, 1181, 1179, 1186, 1184, 1108, - /* 240 */ 1173, 1174, 1143, 1178, 1189, 1128, 1187, 1193, 1188, 1142, - /* 250 */ 1200, 1203, 1210, 1204, 1207, 1182, 1185, 1199, 1208, 1209, - /* 260 */ 1215, 1217, 1218, 1219, 1220, 1222, 1231, 1224, 1227, 1239, - /* 270 */ 1160, 1198, 1212, 1162, 1167, 1176, 1247, 1194, 1195, 1206, - /* 280 */ 1221, 1252, 1196, 1260, 1230, 1140, 1236, 1148, 1237, 1139, - /* 290 */ 1152, 1161, 1164, 1177, 1205, 1242, 1163, 1170, 1175, 952, - /* 300 */ 1289, 1238, 1240, 1223, 1321, 1322, 1325, 1269, 1296, 1297, - /* 310 */ 1298, 1299, 1274, 1301, 1294, 1352, 1331, 1355, 1357, 1258, - /* 320 */ 1333, 1326, 1358, 1370, 1365, 1389, 1387, 1383, 1310, 1303, - /* 330 */ 1315, 1329, 1363, 1369, 1376, 1394, 1396, + /* 150 */ -318, 749, -98, 116, 266, 544, 694, 861, 833, 847, + /* 160 */ 865, 872, 883, 920, 620, 656, 703, 755, 863, 902, + /* 170 */ 930, 863, 785, -369, 1011, 896, 854, 871, 1005, 884, + /* 180 */ 982, 982, 995, 1020, 989, 1045, 991, 910, 914, 915, + /* 190 */ 985, 917, 982, 1050, 1012, 1058, 1025, 997, 1019, 1038, + /* 200 */ 982, 980, 980, 960, 980, 990, 984, 1082, 1044, 1029, + /* 210 */ 1040, 1062, 1059, 1130, 1067, 1133, 1078, 1147, 1148, 1101, + /* 220 */ 1151, 1104, 1108, 1157, 1158, 1160, 1111, 1115, 1117, 1152, + /* 230 */ 1156, 1169, 1161, 1171, 1173, 1174, 1185, 1184, 1189, 1186, + /* 240 */ 1109, 1175, 1177, 1149, 1181, 1193, 1131, 1187, 1197, 1191, + /* 250 */ 1144, 1200, 1203, 1210, 1204, 1218, 1199, 1208, 1209, 1214, + /* 260 */ 1215, 1217, 1219, 1220, 1222, 1223, 1224, 1231, 1227, 1241, + /* 270 */ 1246, 1179, 1206, 1230, 1135, 1167, 1178, 1248, 1182, 1188, + /* 280 */ 1194, 1232, 1255, 1235, 1264, 1237, 1140, 1236, 1154, 1238, + /* 290 */ 1145, 1159, 1163, 1166, 1205, 1207, 1242, 1164, 1162, 1172, + /* 300 */ 980, 1314, 1239, 1212, 1240, 1323, 1326, 1330, 1279, 1298, + /* 310 */ 1299, 1300, 1301, 1286, 1308, 1304, 1355, 1335, 1360, 1365, + /* 320 */ 1258, 1337, 1331, 1373, 1369, 1387, 1392, 1389, 1311, 1303, + /* 330 */ 1318, 1321, 1366, 1376, 1380, 1394, 1398, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 10 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 20 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 30 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 40 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 50 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 60 */ 1872, 2204, 1872, 1872, 2167, 1872, 1872, 1872, 1872, 1872, - /* 70 */ 1872, 1872, 1872, 1872, 1872, 1872, 2174, 1872, 1872, 1872, - /* 80 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 90 */ 1872, 1872, 1872, 1872, 1872, 1872, 1969, 1872, 1872, 1872, - /* 100 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 110 */ 1872, 1872, 1872, 1967, 2406, 1872, 1872, 1872, 1872, 1872, - /* 120 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 130 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 2418, 1872, - /* 140 */ 1872, 1943, 1943, 1872, 2418, 2418, 2418, 1967, 2378, 2378, - /* 150 */ 1872, 1969, 2242, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 160 */ 1872, 2091, 1872, 1902, 1872, 1872, 1872, 1872, 2115, 1872, - /* 170 */ 1872, 1872, 2230, 1872, 1872, 2447, 2507, 1872, 1872, 2450, - /* 180 */ 1872, 1872, 1872, 1872, 2179, 1872, 2437, 1872, 1872, 1872, - /* 190 */ 1872, 1872, 1872, 1872, 1872, 1872, 2044, 2224, 1872, 1872, - /* 200 */ 1872, 2410, 2424, 2491, 2411, 2408, 2431, 2441, 1872, 2266, - /* 210 */ 1872, 2256, 1969, 1872, 1969, 2217, 2162, 1872, 2172, 1872, - /* 220 */ 2172, 2169, 1872, 1872, 1872, 2172, 2169, 2169, 2033, 2029, - /* 230 */ 1872, 2027, 1872, 1872, 1872, 1872, 1927, 1872, 1927, 1872, - /* 240 */ 1969, 1969, 1872, 1969, 1872, 1872, 1969, 1872, 1969, 1872, - /* 250 */ 1969, 1969, 1872, 1969, 1872, 1872, 1872, 1872, 1872, 1872, - /* 260 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 270 */ 1872, 1872, 1872, 2254, 2240, 1872, 1967, 1872, 2228, 2226, - /* 280 */ 1872, 1967, 2441, 1872, 1872, 2461, 2456, 2461, 2456, 2475, - /* 290 */ 2471, 2461, 2480, 2477, 2443, 2441, 2510, 2497, 2493, 2424, - /* 300 */ 1872, 1872, 2429, 2427, 1872, 1967, 1967, 2456, 1872, 1872, - /* 310 */ 1872, 1872, 2456, 1872, 1872, 1967, 1872, 1967, 1872, 1872, - /* 320 */ 2060, 1872, 1872, 1872, 1967, 1872, 1911, 1872, 2219, 2245, - /* 330 */ 2200, 2200, 2094, 2094, 2094, 1970, 1877, 1872, 1872, 1872, - /* 340 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 2474, - /* 350 */ 2473, 2331, 1872, 2382, 2381, 2380, 2371, 2330, 2056, 1872, - /* 360 */ 1872, 2329, 2328, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 370 */ 1872, 2191, 2190, 2322, 1872, 1872, 2323, 2321, 2320, 1872, - /* 380 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 390 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 400 */ 1872, 1872, 1872, 2494, 2498, 1872, 1872, 1872, 1872, 1872, - /* 410 */ 1872, 2407, 1872, 1872, 1872, 2302, 1872, 1872, 1872, 1872, - /* 420 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 430 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 440 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 450 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 460 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 2168, 1872, - /* 470 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 480 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 490 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 500 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 510 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 520 */ 1872, 1872, 1872, 1872, 1872, 2183, 1872, 1872, 1872, 1872, - /* 530 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 540 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 550 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1916, 2309, 1872, - /* 560 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 570 */ 1872, 1872, 2312, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 580 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 590 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 600 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 610 */ 1872, 1872, 1872, 2009, 2008, 1872, 1872, 1872, 1872, 1872, - /* 620 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 630 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 2313, - /* 640 */ 1872, 1872, 1872, 1872, 1872, 2304, 1872, 1872, 1872, 1872, - /* 650 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 660 */ 1872, 1872, 2490, 2444, 1872, 1872, 1872, 1872, 1872, 1872, - /* 670 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 680 */ 1872, 1872, 2302, 1872, 2472, 1872, 1872, 2488, 1872, 2492, - /* 690 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 2417, 2413, 1872, - /* 700 */ 1872, 2409, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 710 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 2301, - /* 720 */ 1872, 2368, 1872, 1872, 1872, 2402, 1872, 1872, 2353, 1872, - /* 730 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 2313, 1872, - /* 740 */ 2316, 1872, 1872, 1872, 1872, 1872, 2088, 1872, 1872, 1872, - /* 750 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 760 */ 1872, 1872, 2072, 2070, 2069, 2068, 1872, 2101, 1872, 1872, - /* 770 */ 1872, 2097, 2096, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 780 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1988, 1872, 1872, - /* 790 */ 1872, 1872, 1872, 1872, 1872, 1872, 1980, 1872, 1979, 1872, - /* 800 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 810 */ 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, - /* 820 */ 1872, 1872, 1872, 1872, 1872, 1872, 1901, 1872, 1872, 1872, - /* 830 */ 1872, 1872, 1872, + /* 0 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 10 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 20 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 30 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 40 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 50 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 60 */ 1876, 2209, 1876, 1876, 2172, 1876, 1876, 1876, 1876, 1876, + /* 70 */ 1876, 1876, 1876, 1876, 1876, 1876, 2179, 1876, 1876, 1876, + /* 80 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 90 */ 1876, 1876, 1876, 1876, 1876, 1876, 1973, 1876, 1876, 1876, + /* 100 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 110 */ 1876, 1876, 1876, 1971, 2411, 1876, 1876, 1876, 1876, 1876, + /* 120 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 130 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2423, 1876, + /* 140 */ 1876, 1947, 1947, 1876, 2423, 2423, 2423, 1971, 2383, 2383, + /* 150 */ 1876, 1876, 1973, 2247, 1876, 1876, 1876, 1876, 1876, 1876, + /* 160 */ 1876, 1876, 2096, 1906, 1876, 1876, 1876, 1876, 2120, 1876, + /* 170 */ 1876, 1876, 2235, 1876, 1876, 2452, 2512, 1876, 1876, 2455, + /* 180 */ 1876, 1876, 1876, 1876, 2184, 1876, 2442, 1876, 1876, 1876, + /* 190 */ 1876, 1876, 1876, 1876, 1876, 1876, 2049, 2229, 1876, 1876, + /* 200 */ 1876, 2415, 2429, 2496, 2416, 2413, 2436, 1876, 2446, 1876, + /* 210 */ 2271, 1876, 2261, 1973, 1876, 1973, 2222, 2167, 1876, 2177, + /* 220 */ 1876, 2177, 2174, 1876, 1876, 1876, 2177, 2174, 2174, 2038, + /* 230 */ 2034, 1876, 2032, 1876, 1876, 1876, 1876, 1931, 1876, 1931, + /* 240 */ 1876, 1973, 1973, 1876, 1973, 1876, 1876, 1973, 1876, 1973, + /* 250 */ 1876, 1973, 1973, 1876, 1973, 1876, 1876, 1876, 1876, 1876, + /* 260 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 270 */ 1876, 1876, 1876, 1876, 2259, 2245, 1876, 1971, 1876, 2233, + /* 280 */ 2231, 1876, 1971, 2446, 1876, 1876, 2466, 2461, 2466, 2461, + /* 290 */ 2480, 2476, 2466, 2485, 2482, 2448, 2446, 2515, 2502, 2498, + /* 300 */ 2429, 1876, 1876, 2434, 2432, 1876, 1971, 1971, 2461, 1876, + /* 310 */ 1876, 1876, 1876, 2461, 1876, 1876, 1971, 1876, 1971, 1876, + /* 320 */ 1876, 2065, 1876, 1876, 1971, 1876, 1915, 1876, 2224, 2250, + /* 330 */ 2205, 2205, 2099, 2099, 2099, 1974, 1881, 1876, 1876, 1876, + /* 340 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2479, + /* 350 */ 2478, 2336, 1876, 2387, 2386, 2385, 2376, 2335, 2061, 1876, + /* 360 */ 1876, 2334, 2333, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 370 */ 1876, 2196, 2195, 2327, 1876, 1876, 2328, 2326, 2325, 1876, + /* 380 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 390 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 400 */ 1876, 1876, 1876, 2499, 2503, 1876, 1876, 1876, 1876, 1876, + /* 410 */ 1876, 2412, 1876, 1876, 1876, 2307, 1876, 1876, 1876, 1876, + /* 420 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 430 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 440 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 450 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 460 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2173, 1876, + /* 470 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 480 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 490 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 500 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 510 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 520 */ 1876, 1876, 1876, 1876, 1876, 2188, 1876, 1876, 1876, 1876, + /* 530 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 540 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 550 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1920, 2314, 1876, + /* 560 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 570 */ 1876, 1876, 2317, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 580 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 590 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 600 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 610 */ 1876, 1876, 1876, 2013, 2012, 1876, 1876, 1876, 1876, 1876, + /* 620 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 630 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2318, + /* 640 */ 1876, 1876, 1876, 1876, 1876, 2309, 1876, 1876, 1876, 1876, + /* 650 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 660 */ 1876, 1876, 2495, 2449, 1876, 1876, 1876, 1876, 1876, 1876, + /* 670 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 680 */ 1876, 1876, 2307, 1876, 2477, 1876, 1876, 2493, 1876, 2497, + /* 690 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2422, 2418, 1876, + /* 700 */ 1876, 2414, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 710 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2306, + /* 720 */ 1876, 2373, 1876, 1876, 1876, 2407, 1876, 1876, 2358, 1876, + /* 730 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2318, 1876, + /* 740 */ 2321, 1876, 1876, 1876, 1876, 1876, 2093, 1876, 1876, 1876, + /* 750 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 760 */ 1876, 1876, 2077, 2075, 2074, 2073, 1876, 2106, 1876, 1876, + /* 770 */ 1876, 2102, 2101, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 780 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1992, + /* 790 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1984, 1876, + /* 800 */ 1983, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 810 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, + /* 820 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1905, 1876, + /* 830 */ 1876, 1876, 1876, 1876, 1876, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2227,492 +2227,493 @@ static const char *const yyRuleName[] = { /* 149 */ "retention_list ::= retention", /* 150 */ "retention_list ::= retention_list NK_COMMA retention", /* 151 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 152 */ "speed_opt ::=", - /* 153 */ "speed_opt ::= BWLIMIT NK_INTEGER", - /* 154 */ "start_opt ::=", - /* 155 */ "start_opt ::= START WITH NK_INTEGER", - /* 156 */ "start_opt ::= START WITH NK_STRING", - /* 157 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 158 */ "end_opt ::=", - /* 159 */ "end_opt ::= END WITH NK_INTEGER", - /* 160 */ "end_opt ::= END WITH NK_STRING", - /* 161 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 162 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 163 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 164 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 165 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 166 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 167 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 168 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 169 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 170 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 171 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 172 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 173 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 174 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 175 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 176 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 177 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 178 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 179 */ "multi_create_clause ::= create_subtable_clause", - /* 180 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 181 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", - /* 182 */ "multi_drop_clause ::= drop_table_clause", - /* 183 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 184 */ "drop_table_clause ::= exists_opt full_table_name", - /* 185 */ "specific_cols_opt ::=", - /* 186 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 187 */ "full_table_name ::= table_name", - /* 188 */ "full_table_name ::= db_name NK_DOT table_name", - /* 189 */ "column_def_list ::= column_def", - /* 190 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 191 */ "column_def ::= column_name type_name", - /* 192 */ "type_name ::= BOOL", - /* 193 */ "type_name ::= TINYINT", - /* 194 */ "type_name ::= SMALLINT", - /* 195 */ "type_name ::= INT", - /* 196 */ "type_name ::= INTEGER", - /* 197 */ "type_name ::= BIGINT", - /* 198 */ "type_name ::= FLOAT", - /* 199 */ "type_name ::= DOUBLE", - /* 200 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 201 */ "type_name ::= TIMESTAMP", - /* 202 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 203 */ "type_name ::= TINYINT UNSIGNED", - /* 204 */ "type_name ::= SMALLINT UNSIGNED", - /* 205 */ "type_name ::= INT UNSIGNED", - /* 206 */ "type_name ::= BIGINT UNSIGNED", - /* 207 */ "type_name ::= JSON", - /* 208 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 209 */ "type_name ::= MEDIUMBLOB", - /* 210 */ "type_name ::= BLOB", - /* 211 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 212 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 213 */ "type_name ::= DECIMAL", - /* 214 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 215 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 216 */ "tags_def_opt ::=", - /* 217 */ "tags_def_opt ::= tags_def", - /* 218 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 219 */ "table_options ::=", - /* 220 */ "table_options ::= table_options COMMENT NK_STRING", - /* 221 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 222 */ "table_options ::= table_options WATERMARK duration_list", - /* 223 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 224 */ "table_options ::= table_options TTL NK_INTEGER", - /* 225 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 226 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 227 */ "alter_table_options ::= alter_table_option", - /* 228 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 229 */ "alter_table_option ::= COMMENT NK_STRING", - /* 230 */ "alter_table_option ::= TTL NK_INTEGER", - /* 231 */ "duration_list ::= duration_literal", - /* 232 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 233 */ "rollup_func_list ::= rollup_func_name", - /* 234 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 235 */ "rollup_func_name ::= function_name", - /* 236 */ "rollup_func_name ::= FIRST", - /* 237 */ "rollup_func_name ::= LAST", - /* 238 */ "col_name_list ::= col_name", - /* 239 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 240 */ "col_name ::= column_name", - /* 241 */ "cmd ::= SHOW DNODES", - /* 242 */ "cmd ::= SHOW USERS", - /* 243 */ "cmd ::= SHOW USER PRIVILEGES", - /* 244 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 245 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 246 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 247 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 248 */ "cmd ::= SHOW MNODES", - /* 249 */ "cmd ::= SHOW QNODES", - /* 250 */ "cmd ::= SHOW FUNCTIONS", - /* 251 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 252 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 253 */ "cmd ::= SHOW STREAMS", - /* 254 */ "cmd ::= SHOW ACCOUNTS", - /* 255 */ "cmd ::= SHOW APPS", - /* 256 */ "cmd ::= SHOW CONNECTIONS", - /* 257 */ "cmd ::= SHOW LICENCES", - /* 258 */ "cmd ::= SHOW GRANTS", - /* 259 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 260 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 261 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 262 */ "cmd ::= SHOW QUERIES", - /* 263 */ "cmd ::= SHOW SCORES", - /* 264 */ "cmd ::= SHOW TOPICS", - /* 265 */ "cmd ::= SHOW VARIABLES", - /* 266 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 267 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 268 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 269 */ "cmd ::= SHOW BNODES", - /* 270 */ "cmd ::= SHOW SNODES", - /* 271 */ "cmd ::= SHOW CLUSTER", - /* 272 */ "cmd ::= SHOW TRANSACTIONS", - /* 273 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 274 */ "cmd ::= SHOW CONSUMERS", - /* 275 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 276 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 277 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 278 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 279 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 280 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 281 */ "cmd ::= SHOW VNODES", - /* 282 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 283 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 284 */ "cmd ::= SHOW db_name_cond_opt VIEWS", - /* 285 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 286 */ "table_kind_db_name_cond_opt ::=", - /* 287 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 288 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 289 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 290 */ "table_kind ::= NORMAL", - /* 291 */ "table_kind ::= CHILD", - /* 292 */ "db_name_cond_opt ::=", - /* 293 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 294 */ "like_pattern_opt ::=", - /* 295 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 296 */ "table_name_cond ::= table_name", - /* 297 */ "from_db_opt ::=", - /* 298 */ "from_db_opt ::= FROM db_name", - /* 299 */ "tag_list_opt ::=", - /* 300 */ "tag_list_opt ::= tag_item", - /* 301 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 302 */ "tag_item ::= TBNAME", - /* 303 */ "tag_item ::= QTAGS", - /* 304 */ "tag_item ::= column_name", - /* 305 */ "tag_item ::= column_name column_alias", - /* 306 */ "tag_item ::= column_name AS column_alias", - /* 307 */ "db_kind_opt ::=", - /* 308 */ "db_kind_opt ::= USER", - /* 309 */ "db_kind_opt ::= SYSTEM", - /* 310 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 311 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 312 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 313 */ "full_index_name ::= index_name", - /* 314 */ "full_index_name ::= db_name NK_DOT index_name", - /* 315 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 316 */ "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", - /* 317 */ "func_list ::= func", - /* 318 */ "func_list ::= func_list NK_COMMA func", - /* 319 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 320 */ "sma_func_name ::= function_name", - /* 321 */ "sma_func_name ::= COUNT", - /* 322 */ "sma_func_name ::= FIRST", - /* 323 */ "sma_func_name ::= LAST", - /* 324 */ "sma_func_name ::= LAST_ROW", - /* 325 */ "sma_stream_opt ::=", - /* 326 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 327 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 328 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 329 */ "with_meta ::= AS", - /* 330 */ "with_meta ::= WITH META AS", - /* 331 */ "with_meta ::= ONLY META AS", - /* 332 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 333 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 334 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 335 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 336 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 337 */ "cmd ::= DESC full_table_name", - /* 338 */ "cmd ::= DESCRIBE full_table_name", - /* 339 */ "cmd ::= RESET QUERY CACHE", - /* 340 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 341 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 342 */ "analyze_opt ::=", - /* 343 */ "analyze_opt ::= ANALYZE", - /* 344 */ "explain_options ::=", - /* 345 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 346 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 347 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 348 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 349 */ "agg_func_opt ::=", - /* 350 */ "agg_func_opt ::= AGGREGATE", - /* 351 */ "bufsize_opt ::=", - /* 352 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 353 */ "language_opt ::=", - /* 354 */ "language_opt ::= LANGUAGE NK_STRING", - /* 355 */ "or_replace_opt ::=", - /* 356 */ "or_replace_opt ::= OR REPLACE", - /* 357 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 358 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 359 */ "full_view_name ::= view_name", - /* 360 */ "full_view_name ::= db_name NK_DOT view_name", - /* 361 */ "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", - /* 362 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 363 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 364 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 365 */ "col_list_opt ::=", - /* 366 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 367 */ "tag_def_or_ref_opt ::=", - /* 368 */ "tag_def_or_ref_opt ::= tags_def", - /* 369 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 370 */ "stream_options ::=", - /* 371 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 372 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 373 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 374 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 375 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 376 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 377 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 378 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 379 */ "subtable_opt ::=", - /* 380 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 381 */ "ignore_opt ::=", - /* 382 */ "ignore_opt ::= IGNORE UNTREATED", - /* 383 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 384 */ "cmd ::= KILL QUERY NK_STRING", - /* 385 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 386 */ "cmd ::= BALANCE VGROUP", - /* 387 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 388 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 389 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 390 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 391 */ "on_vgroup_id ::=", - /* 392 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 393 */ "dnode_list ::= DNODE NK_INTEGER", - /* 394 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 395 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 396 */ "cmd ::= query_or_subquery", - /* 397 */ "cmd ::= insert_query", - /* 398 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 399 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 400 */ "literal ::= NK_INTEGER", - /* 401 */ "literal ::= NK_FLOAT", - /* 402 */ "literal ::= NK_STRING", - /* 403 */ "literal ::= NK_BOOL", - /* 404 */ "literal ::= TIMESTAMP NK_STRING", - /* 405 */ "literal ::= duration_literal", - /* 406 */ "literal ::= NULL", - /* 407 */ "literal ::= NK_QUESTION", - /* 408 */ "duration_literal ::= NK_VARIABLE", - /* 409 */ "signed ::= NK_INTEGER", - /* 410 */ "signed ::= NK_PLUS NK_INTEGER", - /* 411 */ "signed ::= NK_MINUS NK_INTEGER", - /* 412 */ "signed ::= NK_FLOAT", - /* 413 */ "signed ::= NK_PLUS NK_FLOAT", - /* 414 */ "signed ::= NK_MINUS NK_FLOAT", - /* 415 */ "signed_literal ::= signed", - /* 416 */ "signed_literal ::= NK_STRING", - /* 417 */ "signed_literal ::= NK_BOOL", - /* 418 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 419 */ "signed_literal ::= duration_literal", - /* 420 */ "signed_literal ::= NULL", - /* 421 */ "signed_literal ::= literal_func", - /* 422 */ "signed_literal ::= NK_QUESTION", - /* 423 */ "literal_list ::= signed_literal", - /* 424 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 425 */ "db_name ::= NK_ID", - /* 426 */ "table_name ::= NK_ID", - /* 427 */ "column_name ::= NK_ID", - /* 428 */ "function_name ::= NK_ID", - /* 429 */ "view_name ::= NK_ID", - /* 430 */ "table_alias ::= NK_ID", - /* 431 */ "column_alias ::= NK_ID", - /* 432 */ "column_alias ::= NK_ALIAS", - /* 433 */ "user_name ::= NK_ID", - /* 434 */ "topic_name ::= NK_ID", - /* 435 */ "stream_name ::= NK_ID", - /* 436 */ "cgroup_name ::= NK_ID", - /* 437 */ "index_name ::= NK_ID", - /* 438 */ "expr_or_subquery ::= expression", - /* 439 */ "expression ::= literal", - /* 440 */ "expression ::= pseudo_column", - /* 441 */ "expression ::= column_reference", - /* 442 */ "expression ::= function_expression", - /* 443 */ "expression ::= case_when_expression", - /* 444 */ "expression ::= NK_LP expression NK_RP", - /* 445 */ "expression ::= NK_PLUS expr_or_subquery", - /* 446 */ "expression ::= NK_MINUS expr_or_subquery", - /* 447 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 448 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 449 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 450 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 451 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 452 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 453 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 454 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 455 */ "expression_list ::= expr_or_subquery", - /* 456 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 457 */ "column_reference ::= column_name", - /* 458 */ "column_reference ::= table_name NK_DOT column_name", - /* 459 */ "column_reference ::= NK_ALIAS", - /* 460 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 461 */ "pseudo_column ::= ROWTS", - /* 462 */ "pseudo_column ::= TBNAME", - /* 463 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 464 */ "pseudo_column ::= QSTART", - /* 465 */ "pseudo_column ::= QEND", - /* 466 */ "pseudo_column ::= QDURATION", - /* 467 */ "pseudo_column ::= WSTART", - /* 468 */ "pseudo_column ::= WEND", - /* 469 */ "pseudo_column ::= WDURATION", - /* 470 */ "pseudo_column ::= IROWTS", - /* 471 */ "pseudo_column ::= ISFILLED", - /* 472 */ "pseudo_column ::= QTAGS", - /* 473 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 474 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 475 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 476 */ "function_expression ::= literal_func", - /* 477 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 478 */ "literal_func ::= NOW", - /* 479 */ "noarg_func ::= NOW", - /* 480 */ "noarg_func ::= TODAY", - /* 481 */ "noarg_func ::= TIMEZONE", - /* 482 */ "noarg_func ::= DATABASE", - /* 483 */ "noarg_func ::= CLIENT_VERSION", - /* 484 */ "noarg_func ::= SERVER_VERSION", - /* 485 */ "noarg_func ::= SERVER_STATUS", - /* 486 */ "noarg_func ::= CURRENT_USER", - /* 487 */ "noarg_func ::= USER", - /* 488 */ "star_func ::= COUNT", - /* 489 */ "star_func ::= FIRST", - /* 490 */ "star_func ::= LAST", - /* 491 */ "star_func ::= LAST_ROW", - /* 492 */ "star_func_para_list ::= NK_STAR", - /* 493 */ "star_func_para_list ::= other_para_list", - /* 494 */ "other_para_list ::= star_func_para", - /* 495 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 496 */ "star_func_para ::= expr_or_subquery", - /* 497 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 498 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 499 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 500 */ "when_then_list ::= when_then_expr", - /* 501 */ "when_then_list ::= when_then_list when_then_expr", - /* 502 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 503 */ "case_when_else_opt ::=", - /* 504 */ "case_when_else_opt ::= ELSE common_expression", - /* 505 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 506 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 507 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 508 */ "predicate ::= expr_or_subquery IS NULL", - /* 509 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 510 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 511 */ "compare_op ::= NK_LT", - /* 512 */ "compare_op ::= NK_GT", - /* 513 */ "compare_op ::= NK_LE", - /* 514 */ "compare_op ::= NK_GE", - /* 515 */ "compare_op ::= NK_NE", - /* 516 */ "compare_op ::= NK_EQ", - /* 517 */ "compare_op ::= LIKE", - /* 518 */ "compare_op ::= NOT LIKE", - /* 519 */ "compare_op ::= MATCH", - /* 520 */ "compare_op ::= NMATCH", - /* 521 */ "compare_op ::= CONTAINS", - /* 522 */ "in_op ::= IN", - /* 523 */ "in_op ::= NOT IN", - /* 524 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 525 */ "boolean_value_expression ::= boolean_primary", - /* 526 */ "boolean_value_expression ::= NOT boolean_primary", - /* 527 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 528 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 529 */ "boolean_primary ::= predicate", - /* 530 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 531 */ "common_expression ::= expr_or_subquery", - /* 532 */ "common_expression ::= boolean_value_expression", - /* 533 */ "from_clause_opt ::=", - /* 534 */ "from_clause_opt ::= FROM table_reference_list", - /* 535 */ "table_reference_list ::= table_reference", - /* 536 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 537 */ "table_reference ::= table_primary", - /* 538 */ "table_reference ::= joined_table", - /* 539 */ "table_primary ::= table_name alias_opt", - /* 540 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 541 */ "table_primary ::= subquery alias_opt", - /* 542 */ "table_primary ::= parenthesized_joined_table", - /* 543 */ "alias_opt ::=", - /* 544 */ "alias_opt ::= table_alias", - /* 545 */ "alias_opt ::= AS table_alias", - /* 546 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 547 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 548 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 549 */ "join_type ::=", - /* 550 */ "join_type ::= INNER", - /* 551 */ "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", - /* 552 */ "hint_list ::=", - /* 553 */ "hint_list ::= NK_HINT", - /* 554 */ "tag_mode_opt ::=", - /* 555 */ "tag_mode_opt ::= TAGS", - /* 556 */ "set_quantifier_opt ::=", - /* 557 */ "set_quantifier_opt ::= DISTINCT", - /* 558 */ "set_quantifier_opt ::= ALL", - /* 559 */ "select_list ::= select_item", - /* 560 */ "select_list ::= select_list NK_COMMA select_item", - /* 561 */ "select_item ::= NK_STAR", - /* 562 */ "select_item ::= common_expression", - /* 563 */ "select_item ::= common_expression column_alias", - /* 564 */ "select_item ::= common_expression AS column_alias", - /* 565 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 566 */ "where_clause_opt ::=", - /* 567 */ "where_clause_opt ::= WHERE search_condition", - /* 568 */ "partition_by_clause_opt ::=", - /* 569 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 570 */ "partition_list ::= partition_item", - /* 571 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 572 */ "partition_item ::= expr_or_subquery", - /* 573 */ "partition_item ::= expr_or_subquery column_alias", - /* 574 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 575 */ "twindow_clause_opt ::=", - /* 576 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 577 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 578 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 579 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 580 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 581 */ "sliding_opt ::=", - /* 582 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 583 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 584 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 585 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 586 */ "fill_opt ::=", - /* 587 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 588 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 589 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 590 */ "fill_mode ::= NONE", - /* 591 */ "fill_mode ::= PREV", - /* 592 */ "fill_mode ::= NULL", - /* 593 */ "fill_mode ::= NULL_F", - /* 594 */ "fill_mode ::= LINEAR", - /* 595 */ "fill_mode ::= NEXT", - /* 596 */ "group_by_clause_opt ::=", - /* 597 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 598 */ "group_by_list ::= expr_or_subquery", - /* 599 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 600 */ "having_clause_opt ::=", - /* 601 */ "having_clause_opt ::= HAVING search_condition", - /* 602 */ "range_opt ::=", - /* 603 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 604 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 605 */ "every_opt ::=", - /* 606 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 607 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 608 */ "query_simple ::= query_specification", - /* 609 */ "query_simple ::= union_query_expression", - /* 610 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 611 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 612 */ "query_simple_or_subquery ::= query_simple", - /* 613 */ "query_simple_or_subquery ::= subquery", - /* 614 */ "query_or_subquery ::= query_expression", - /* 615 */ "query_or_subquery ::= subquery", - /* 616 */ "order_by_clause_opt ::=", - /* 617 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 618 */ "slimit_clause_opt ::=", - /* 619 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 620 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 621 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 622 */ "limit_clause_opt ::=", - /* 623 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 624 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 625 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 626 */ "subquery ::= NK_LP query_expression NK_RP", - /* 627 */ "subquery ::= NK_LP subquery NK_RP", - /* 628 */ "search_condition ::= common_expression", - /* 629 */ "sort_specification_list ::= sort_specification", - /* 630 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 631 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 632 */ "ordering_specification_opt ::=", - /* 633 */ "ordering_specification_opt ::= ASC", - /* 634 */ "ordering_specification_opt ::= DESC", - /* 635 */ "null_ordering_opt ::=", - /* 636 */ "null_ordering_opt ::= NULLS FIRST", - /* 637 */ "null_ordering_opt ::= NULLS LAST", + /* 152 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", + /* 153 */ "speed_opt ::=", + /* 154 */ "speed_opt ::= BWLIMIT NK_INTEGER", + /* 155 */ "start_opt ::=", + /* 156 */ "start_opt ::= START WITH NK_INTEGER", + /* 157 */ "start_opt ::= START WITH NK_STRING", + /* 158 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 159 */ "end_opt ::=", + /* 160 */ "end_opt ::= END WITH NK_INTEGER", + /* 161 */ "end_opt ::= END WITH NK_STRING", + /* 162 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 163 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 164 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 165 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 166 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 167 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 168 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 169 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 170 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 171 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 172 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 173 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 174 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 175 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 176 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 177 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 178 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 179 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 180 */ "multi_create_clause ::= create_subtable_clause", + /* 181 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 182 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", + /* 183 */ "multi_drop_clause ::= drop_table_clause", + /* 184 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 185 */ "drop_table_clause ::= exists_opt full_table_name", + /* 186 */ "specific_cols_opt ::=", + /* 187 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 188 */ "full_table_name ::= table_name", + /* 189 */ "full_table_name ::= db_name NK_DOT table_name", + /* 190 */ "column_def_list ::= column_def", + /* 191 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 192 */ "column_def ::= column_name type_name", + /* 193 */ "type_name ::= BOOL", + /* 194 */ "type_name ::= TINYINT", + /* 195 */ "type_name ::= SMALLINT", + /* 196 */ "type_name ::= INT", + /* 197 */ "type_name ::= INTEGER", + /* 198 */ "type_name ::= BIGINT", + /* 199 */ "type_name ::= FLOAT", + /* 200 */ "type_name ::= DOUBLE", + /* 201 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 202 */ "type_name ::= TIMESTAMP", + /* 203 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 204 */ "type_name ::= TINYINT UNSIGNED", + /* 205 */ "type_name ::= SMALLINT UNSIGNED", + /* 206 */ "type_name ::= INT UNSIGNED", + /* 207 */ "type_name ::= BIGINT UNSIGNED", + /* 208 */ "type_name ::= JSON", + /* 209 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 210 */ "type_name ::= MEDIUMBLOB", + /* 211 */ "type_name ::= BLOB", + /* 212 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 213 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 214 */ "type_name ::= DECIMAL", + /* 215 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 216 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 217 */ "tags_def_opt ::=", + /* 218 */ "tags_def_opt ::= tags_def", + /* 219 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 220 */ "table_options ::=", + /* 221 */ "table_options ::= table_options COMMENT NK_STRING", + /* 222 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 223 */ "table_options ::= table_options WATERMARK duration_list", + /* 224 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 225 */ "table_options ::= table_options TTL NK_INTEGER", + /* 226 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 227 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 228 */ "alter_table_options ::= alter_table_option", + /* 229 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 230 */ "alter_table_option ::= COMMENT NK_STRING", + /* 231 */ "alter_table_option ::= TTL NK_INTEGER", + /* 232 */ "duration_list ::= duration_literal", + /* 233 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 234 */ "rollup_func_list ::= rollup_func_name", + /* 235 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 236 */ "rollup_func_name ::= function_name", + /* 237 */ "rollup_func_name ::= FIRST", + /* 238 */ "rollup_func_name ::= LAST", + /* 239 */ "col_name_list ::= col_name", + /* 240 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 241 */ "col_name ::= column_name", + /* 242 */ "cmd ::= SHOW DNODES", + /* 243 */ "cmd ::= SHOW USERS", + /* 244 */ "cmd ::= SHOW USER PRIVILEGES", + /* 245 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 246 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", + /* 247 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 248 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 249 */ "cmd ::= SHOW MNODES", + /* 250 */ "cmd ::= SHOW QNODES", + /* 251 */ "cmd ::= SHOW FUNCTIONS", + /* 252 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 253 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 254 */ "cmd ::= SHOW STREAMS", + /* 255 */ "cmd ::= SHOW ACCOUNTS", + /* 256 */ "cmd ::= SHOW APPS", + /* 257 */ "cmd ::= SHOW CONNECTIONS", + /* 258 */ "cmd ::= SHOW LICENCES", + /* 259 */ "cmd ::= SHOW GRANTS", + /* 260 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 261 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 262 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 263 */ "cmd ::= SHOW QUERIES", + /* 264 */ "cmd ::= SHOW SCORES", + /* 265 */ "cmd ::= SHOW TOPICS", + /* 266 */ "cmd ::= SHOW VARIABLES", + /* 267 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 268 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 269 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 270 */ "cmd ::= SHOW BNODES", + /* 271 */ "cmd ::= SHOW SNODES", + /* 272 */ "cmd ::= SHOW CLUSTER", + /* 273 */ "cmd ::= SHOW TRANSACTIONS", + /* 274 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 275 */ "cmd ::= SHOW CONSUMERS", + /* 276 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 277 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 278 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 279 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 280 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 281 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 282 */ "cmd ::= SHOW VNODES", + /* 283 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 284 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 285 */ "cmd ::= SHOW db_name_cond_opt VIEWS", + /* 286 */ "cmd ::= SHOW CREATE VIEW full_table_name", + /* 287 */ "table_kind_db_name_cond_opt ::=", + /* 288 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 289 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 290 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 291 */ "table_kind ::= NORMAL", + /* 292 */ "table_kind ::= CHILD", + /* 293 */ "db_name_cond_opt ::=", + /* 294 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 295 */ "like_pattern_opt ::=", + /* 296 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 297 */ "table_name_cond ::= table_name", + /* 298 */ "from_db_opt ::=", + /* 299 */ "from_db_opt ::= FROM db_name", + /* 300 */ "tag_list_opt ::=", + /* 301 */ "tag_list_opt ::= tag_item", + /* 302 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 303 */ "tag_item ::= TBNAME", + /* 304 */ "tag_item ::= QTAGS", + /* 305 */ "tag_item ::= column_name", + /* 306 */ "tag_item ::= column_name column_alias", + /* 307 */ "tag_item ::= column_name AS column_alias", + /* 308 */ "db_kind_opt ::=", + /* 309 */ "db_kind_opt ::= USER", + /* 310 */ "db_kind_opt ::= SYSTEM", + /* 311 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 312 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 313 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 314 */ "full_index_name ::= index_name", + /* 315 */ "full_index_name ::= db_name NK_DOT index_name", + /* 316 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 317 */ "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", + /* 318 */ "func_list ::= func", + /* 319 */ "func_list ::= func_list NK_COMMA func", + /* 320 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 321 */ "sma_func_name ::= function_name", + /* 322 */ "sma_func_name ::= COUNT", + /* 323 */ "sma_func_name ::= FIRST", + /* 324 */ "sma_func_name ::= LAST", + /* 325 */ "sma_func_name ::= LAST_ROW", + /* 326 */ "sma_stream_opt ::=", + /* 327 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 328 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 329 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 330 */ "with_meta ::= AS", + /* 331 */ "with_meta ::= WITH META AS", + /* 332 */ "with_meta ::= ONLY META AS", + /* 333 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 334 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 335 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 336 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 337 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 338 */ "cmd ::= DESC full_table_name", + /* 339 */ "cmd ::= DESCRIBE full_table_name", + /* 340 */ "cmd ::= RESET QUERY CACHE", + /* 341 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 342 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 343 */ "analyze_opt ::=", + /* 344 */ "analyze_opt ::= ANALYZE", + /* 345 */ "explain_options ::=", + /* 346 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 347 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 348 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 349 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 350 */ "agg_func_opt ::=", + /* 351 */ "agg_func_opt ::= AGGREGATE", + /* 352 */ "bufsize_opt ::=", + /* 353 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 354 */ "language_opt ::=", + /* 355 */ "language_opt ::= LANGUAGE NK_STRING", + /* 356 */ "or_replace_opt ::=", + /* 357 */ "or_replace_opt ::= OR REPLACE", + /* 358 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 359 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 360 */ "full_view_name ::= view_name", + /* 361 */ "full_view_name ::= db_name NK_DOT view_name", + /* 362 */ "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", + /* 363 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 364 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 365 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 366 */ "col_list_opt ::=", + /* 367 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 368 */ "tag_def_or_ref_opt ::=", + /* 369 */ "tag_def_or_ref_opt ::= tags_def", + /* 370 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 371 */ "stream_options ::=", + /* 372 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 373 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 374 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 375 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 376 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 377 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 378 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 379 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 380 */ "subtable_opt ::=", + /* 381 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 382 */ "ignore_opt ::=", + /* 383 */ "ignore_opt ::= IGNORE UNTREATED", + /* 384 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 385 */ "cmd ::= KILL QUERY NK_STRING", + /* 386 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 387 */ "cmd ::= BALANCE VGROUP", + /* 388 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 389 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 390 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 391 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 392 */ "on_vgroup_id ::=", + /* 393 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 394 */ "dnode_list ::= DNODE NK_INTEGER", + /* 395 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 396 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 397 */ "cmd ::= query_or_subquery", + /* 398 */ "cmd ::= insert_query", + /* 399 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 400 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 401 */ "literal ::= NK_INTEGER", + /* 402 */ "literal ::= NK_FLOAT", + /* 403 */ "literal ::= NK_STRING", + /* 404 */ "literal ::= NK_BOOL", + /* 405 */ "literal ::= TIMESTAMP NK_STRING", + /* 406 */ "literal ::= duration_literal", + /* 407 */ "literal ::= NULL", + /* 408 */ "literal ::= NK_QUESTION", + /* 409 */ "duration_literal ::= NK_VARIABLE", + /* 410 */ "signed ::= NK_INTEGER", + /* 411 */ "signed ::= NK_PLUS NK_INTEGER", + /* 412 */ "signed ::= NK_MINUS NK_INTEGER", + /* 413 */ "signed ::= NK_FLOAT", + /* 414 */ "signed ::= NK_PLUS NK_FLOAT", + /* 415 */ "signed ::= NK_MINUS NK_FLOAT", + /* 416 */ "signed_literal ::= signed", + /* 417 */ "signed_literal ::= NK_STRING", + /* 418 */ "signed_literal ::= NK_BOOL", + /* 419 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 420 */ "signed_literal ::= duration_literal", + /* 421 */ "signed_literal ::= NULL", + /* 422 */ "signed_literal ::= literal_func", + /* 423 */ "signed_literal ::= NK_QUESTION", + /* 424 */ "literal_list ::= signed_literal", + /* 425 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 426 */ "db_name ::= NK_ID", + /* 427 */ "table_name ::= NK_ID", + /* 428 */ "column_name ::= NK_ID", + /* 429 */ "function_name ::= NK_ID", + /* 430 */ "view_name ::= NK_ID", + /* 431 */ "table_alias ::= NK_ID", + /* 432 */ "column_alias ::= NK_ID", + /* 433 */ "column_alias ::= NK_ALIAS", + /* 434 */ "user_name ::= NK_ID", + /* 435 */ "topic_name ::= NK_ID", + /* 436 */ "stream_name ::= NK_ID", + /* 437 */ "cgroup_name ::= NK_ID", + /* 438 */ "index_name ::= NK_ID", + /* 439 */ "expr_or_subquery ::= expression", + /* 440 */ "expression ::= literal", + /* 441 */ "expression ::= pseudo_column", + /* 442 */ "expression ::= column_reference", + /* 443 */ "expression ::= function_expression", + /* 444 */ "expression ::= case_when_expression", + /* 445 */ "expression ::= NK_LP expression NK_RP", + /* 446 */ "expression ::= NK_PLUS expr_or_subquery", + /* 447 */ "expression ::= NK_MINUS expr_or_subquery", + /* 448 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 449 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 450 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 451 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 452 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 453 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 454 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 455 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 456 */ "expression_list ::= expr_or_subquery", + /* 457 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 458 */ "column_reference ::= column_name", + /* 459 */ "column_reference ::= table_name NK_DOT column_name", + /* 460 */ "column_reference ::= NK_ALIAS", + /* 461 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 462 */ "pseudo_column ::= ROWTS", + /* 463 */ "pseudo_column ::= TBNAME", + /* 464 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 465 */ "pseudo_column ::= QSTART", + /* 466 */ "pseudo_column ::= QEND", + /* 467 */ "pseudo_column ::= QDURATION", + /* 468 */ "pseudo_column ::= WSTART", + /* 469 */ "pseudo_column ::= WEND", + /* 470 */ "pseudo_column ::= WDURATION", + /* 471 */ "pseudo_column ::= IROWTS", + /* 472 */ "pseudo_column ::= ISFILLED", + /* 473 */ "pseudo_column ::= QTAGS", + /* 474 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 475 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 476 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 477 */ "function_expression ::= literal_func", + /* 478 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 479 */ "literal_func ::= NOW", + /* 480 */ "noarg_func ::= NOW", + /* 481 */ "noarg_func ::= TODAY", + /* 482 */ "noarg_func ::= TIMEZONE", + /* 483 */ "noarg_func ::= DATABASE", + /* 484 */ "noarg_func ::= CLIENT_VERSION", + /* 485 */ "noarg_func ::= SERVER_VERSION", + /* 486 */ "noarg_func ::= SERVER_STATUS", + /* 487 */ "noarg_func ::= CURRENT_USER", + /* 488 */ "noarg_func ::= USER", + /* 489 */ "star_func ::= COUNT", + /* 490 */ "star_func ::= FIRST", + /* 491 */ "star_func ::= LAST", + /* 492 */ "star_func ::= LAST_ROW", + /* 493 */ "star_func_para_list ::= NK_STAR", + /* 494 */ "star_func_para_list ::= other_para_list", + /* 495 */ "other_para_list ::= star_func_para", + /* 496 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 497 */ "star_func_para ::= expr_or_subquery", + /* 498 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 499 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 500 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 501 */ "when_then_list ::= when_then_expr", + /* 502 */ "when_then_list ::= when_then_list when_then_expr", + /* 503 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 504 */ "case_when_else_opt ::=", + /* 505 */ "case_when_else_opt ::= ELSE common_expression", + /* 506 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 507 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 508 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 509 */ "predicate ::= expr_or_subquery IS NULL", + /* 510 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 511 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 512 */ "compare_op ::= NK_LT", + /* 513 */ "compare_op ::= NK_GT", + /* 514 */ "compare_op ::= NK_LE", + /* 515 */ "compare_op ::= NK_GE", + /* 516 */ "compare_op ::= NK_NE", + /* 517 */ "compare_op ::= NK_EQ", + /* 518 */ "compare_op ::= LIKE", + /* 519 */ "compare_op ::= NOT LIKE", + /* 520 */ "compare_op ::= MATCH", + /* 521 */ "compare_op ::= NMATCH", + /* 522 */ "compare_op ::= CONTAINS", + /* 523 */ "in_op ::= IN", + /* 524 */ "in_op ::= NOT IN", + /* 525 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 526 */ "boolean_value_expression ::= boolean_primary", + /* 527 */ "boolean_value_expression ::= NOT boolean_primary", + /* 528 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 529 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 530 */ "boolean_primary ::= predicate", + /* 531 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 532 */ "common_expression ::= expr_or_subquery", + /* 533 */ "common_expression ::= boolean_value_expression", + /* 534 */ "from_clause_opt ::=", + /* 535 */ "from_clause_opt ::= FROM table_reference_list", + /* 536 */ "table_reference_list ::= table_reference", + /* 537 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 538 */ "table_reference ::= table_primary", + /* 539 */ "table_reference ::= joined_table", + /* 540 */ "table_primary ::= table_name alias_opt", + /* 541 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 542 */ "table_primary ::= subquery alias_opt", + /* 543 */ "table_primary ::= parenthesized_joined_table", + /* 544 */ "alias_opt ::=", + /* 545 */ "alias_opt ::= table_alias", + /* 546 */ "alias_opt ::= AS table_alias", + /* 547 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 548 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 549 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 550 */ "join_type ::=", + /* 551 */ "join_type ::= INNER", + /* 552 */ "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", + /* 553 */ "hint_list ::=", + /* 554 */ "hint_list ::= NK_HINT", + /* 555 */ "tag_mode_opt ::=", + /* 556 */ "tag_mode_opt ::= TAGS", + /* 557 */ "set_quantifier_opt ::=", + /* 558 */ "set_quantifier_opt ::= DISTINCT", + /* 559 */ "set_quantifier_opt ::= ALL", + /* 560 */ "select_list ::= select_item", + /* 561 */ "select_list ::= select_list NK_COMMA select_item", + /* 562 */ "select_item ::= NK_STAR", + /* 563 */ "select_item ::= common_expression", + /* 564 */ "select_item ::= common_expression column_alias", + /* 565 */ "select_item ::= common_expression AS column_alias", + /* 566 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 567 */ "where_clause_opt ::=", + /* 568 */ "where_clause_opt ::= WHERE search_condition", + /* 569 */ "partition_by_clause_opt ::=", + /* 570 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 571 */ "partition_list ::= partition_item", + /* 572 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 573 */ "partition_item ::= expr_or_subquery", + /* 574 */ "partition_item ::= expr_or_subquery column_alias", + /* 575 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 576 */ "twindow_clause_opt ::=", + /* 577 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 578 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 579 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 580 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 581 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 582 */ "sliding_opt ::=", + /* 583 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 584 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 585 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 586 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 587 */ "fill_opt ::=", + /* 588 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 589 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 590 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 591 */ "fill_mode ::= NONE", + /* 592 */ "fill_mode ::= PREV", + /* 593 */ "fill_mode ::= NULL", + /* 594 */ "fill_mode ::= NULL_F", + /* 595 */ "fill_mode ::= LINEAR", + /* 596 */ "fill_mode ::= NEXT", + /* 597 */ "group_by_clause_opt ::=", + /* 598 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 599 */ "group_by_list ::= expr_or_subquery", + /* 600 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 601 */ "having_clause_opt ::=", + /* 602 */ "having_clause_opt ::= HAVING search_condition", + /* 603 */ "range_opt ::=", + /* 604 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 605 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 606 */ "every_opt ::=", + /* 607 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 608 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 609 */ "query_simple ::= query_specification", + /* 610 */ "query_simple ::= union_query_expression", + /* 611 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 612 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 613 */ "query_simple_or_subquery ::= query_simple", + /* 614 */ "query_simple_or_subquery ::= subquery", + /* 615 */ "query_or_subquery ::= query_expression", + /* 616 */ "query_or_subquery ::= subquery", + /* 617 */ "order_by_clause_opt ::=", + /* 618 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 619 */ "slimit_clause_opt ::=", + /* 620 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 621 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 622 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 623 */ "limit_clause_opt ::=", + /* 624 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 625 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 626 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 627 */ "subquery ::= NK_LP query_expression NK_RP", + /* 628 */ "subquery ::= NK_LP subquery NK_RP", + /* 629 */ "search_condition ::= common_expression", + /* 630 */ "sort_specification_list ::= sort_specification", + /* 631 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 632 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 633 */ "ordering_specification_opt ::=", + /* 634 */ "ordering_specification_opt ::= ASC", + /* 635 */ "ordering_specification_opt ::= DESC", + /* 636 */ "null_ordering_opt ::=", + /* 637 */ "null_ordering_opt ::= NULLS FIRST", + /* 638 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3506,492 +3507,493 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 377, /* (149) retention_list ::= retention */ 377, /* (150) retention_list ::= retention_list NK_COMMA retention */ 380, /* (151) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 372, /* (152) speed_opt ::= */ - 372, /* (153) speed_opt ::= BWLIMIT NK_INTEGER */ - 373, /* (154) start_opt ::= */ - 373, /* (155) start_opt ::= START WITH NK_INTEGER */ - 373, /* (156) start_opt ::= START WITH NK_STRING */ - 373, /* (157) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 374, /* (158) end_opt ::= */ - 374, /* (159) end_opt ::= END WITH NK_INTEGER */ - 374, /* (160) end_opt ::= END WITH NK_STRING */ - 374, /* (161) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 346, /* (162) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 346, /* (163) cmd ::= CREATE TABLE multi_create_clause */ - 346, /* (164) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 346, /* (165) cmd ::= DROP TABLE multi_drop_clause */ - 346, /* (166) cmd ::= DROP STABLE exists_opt full_table_name */ - 346, /* (167) cmd ::= ALTER TABLE alter_table_clause */ - 346, /* (168) cmd ::= ALTER STABLE alter_table_clause */ - 388, /* (169) alter_table_clause ::= full_table_name alter_table_options */ - 388, /* (170) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - 388, /* (171) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 388, /* (172) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 388, /* (173) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 388, /* (174) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 388, /* (175) alter_table_clause ::= full_table_name DROP TAG column_name */ - 388, /* (176) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 388, /* (177) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 388, /* (178) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - 385, /* (179) multi_create_clause ::= create_subtable_clause */ - 385, /* (180) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 393, /* (181) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - 387, /* (182) multi_drop_clause ::= drop_table_clause */ - 387, /* (183) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 396, /* (184) drop_table_clause ::= exists_opt full_table_name */ - 394, /* (185) specific_cols_opt ::= */ - 394, /* (186) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 381, /* (187) full_table_name ::= table_name */ - 381, /* (188) full_table_name ::= db_name NK_DOT table_name */ - 382, /* (189) column_def_list ::= column_def */ - 382, /* (190) column_def_list ::= column_def_list NK_COMMA column_def */ - 398, /* (191) column_def ::= column_name type_name */ - 391, /* (192) type_name ::= BOOL */ - 391, /* (193) type_name ::= TINYINT */ - 391, /* (194) type_name ::= SMALLINT */ - 391, /* (195) type_name ::= INT */ - 391, /* (196) type_name ::= INTEGER */ - 391, /* (197) type_name ::= BIGINT */ - 391, /* (198) type_name ::= FLOAT */ - 391, /* (199) type_name ::= DOUBLE */ - 391, /* (200) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 391, /* (201) type_name ::= TIMESTAMP */ - 391, /* (202) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 391, /* (203) type_name ::= TINYINT UNSIGNED */ - 391, /* (204) type_name ::= SMALLINT UNSIGNED */ - 391, /* (205) type_name ::= INT UNSIGNED */ - 391, /* (206) type_name ::= BIGINT UNSIGNED */ - 391, /* (207) type_name ::= JSON */ - 391, /* (208) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 391, /* (209) type_name ::= MEDIUMBLOB */ - 391, /* (210) type_name ::= BLOB */ - 391, /* (211) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 391, /* (212) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 391, /* (213) type_name ::= DECIMAL */ - 391, /* (214) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 391, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 383, /* (216) tags_def_opt ::= */ - 383, /* (217) tags_def_opt ::= tags_def */ - 386, /* (218) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 384, /* (219) table_options ::= */ - 384, /* (220) table_options ::= table_options COMMENT NK_STRING */ - 384, /* (221) table_options ::= table_options MAX_DELAY duration_list */ - 384, /* (222) table_options ::= table_options WATERMARK duration_list */ - 384, /* (223) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 384, /* (224) table_options ::= table_options TTL NK_INTEGER */ - 384, /* (225) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 384, /* (226) table_options ::= table_options DELETE_MARK duration_list */ - 389, /* (227) alter_table_options ::= alter_table_option */ - 389, /* (228) alter_table_options ::= alter_table_options alter_table_option */ - 401, /* (229) alter_table_option ::= COMMENT NK_STRING */ - 401, /* (230) alter_table_option ::= TTL NK_INTEGER */ - 399, /* (231) duration_list ::= duration_literal */ - 399, /* (232) duration_list ::= duration_list NK_COMMA duration_literal */ - 400, /* (233) rollup_func_list ::= rollup_func_name */ - 400, /* (234) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 403, /* (235) rollup_func_name ::= function_name */ - 403, /* (236) rollup_func_name ::= FIRST */ - 403, /* (237) rollup_func_name ::= LAST */ - 397, /* (238) col_name_list ::= col_name */ - 397, /* (239) col_name_list ::= col_name_list NK_COMMA col_name */ - 405, /* (240) col_name ::= column_name */ - 346, /* (241) cmd ::= SHOW DNODES */ - 346, /* (242) cmd ::= SHOW USERS */ - 346, /* (243) cmd ::= SHOW USER PRIVILEGES */ - 346, /* (244) cmd ::= SHOW db_kind_opt DATABASES */ - 346, /* (245) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 346, /* (246) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 346, /* (247) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 346, /* (248) cmd ::= SHOW MNODES */ - 346, /* (249) cmd ::= SHOW QNODES */ - 346, /* (250) cmd ::= SHOW FUNCTIONS */ - 346, /* (251) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 346, /* (252) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 346, /* (253) cmd ::= SHOW STREAMS */ - 346, /* (254) cmd ::= SHOW ACCOUNTS */ - 346, /* (255) cmd ::= SHOW APPS */ - 346, /* (256) cmd ::= SHOW CONNECTIONS */ - 346, /* (257) cmd ::= SHOW LICENCES */ - 346, /* (258) cmd ::= SHOW GRANTS */ - 346, /* (259) cmd ::= SHOW CREATE DATABASE db_name */ - 346, /* (260) cmd ::= SHOW CREATE TABLE full_table_name */ - 346, /* (261) cmd ::= SHOW CREATE STABLE full_table_name */ - 346, /* (262) cmd ::= SHOW QUERIES */ - 346, /* (263) cmd ::= SHOW SCORES */ - 346, /* (264) cmd ::= SHOW TOPICS */ - 346, /* (265) cmd ::= SHOW VARIABLES */ - 346, /* (266) cmd ::= SHOW CLUSTER VARIABLES */ - 346, /* (267) cmd ::= SHOW LOCAL VARIABLES */ - 346, /* (268) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 346, /* (269) cmd ::= SHOW BNODES */ - 346, /* (270) cmd ::= SHOW SNODES */ - 346, /* (271) cmd ::= SHOW CLUSTER */ - 346, /* (272) cmd ::= SHOW TRANSACTIONS */ - 346, /* (273) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 346, /* (274) cmd ::= SHOW CONSUMERS */ - 346, /* (275) cmd ::= SHOW SUBSCRIPTIONS */ - 346, /* (276) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 346, /* (277) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 346, /* (278) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 346, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 346, /* (280) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 346, /* (281) cmd ::= SHOW VNODES */ - 346, /* (282) cmd ::= SHOW db_name_cond_opt ALIVE */ - 346, /* (283) cmd ::= SHOW CLUSTER ALIVE */ - 346, /* (284) cmd ::= SHOW db_name_cond_opt VIEWS */ - 346, /* (285) cmd ::= SHOW CREATE VIEW full_table_name */ - 407, /* (286) table_kind_db_name_cond_opt ::= */ - 407, /* (287) table_kind_db_name_cond_opt ::= table_kind */ - 407, /* (288) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 407, /* (289) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 413, /* (290) table_kind ::= NORMAL */ - 413, /* (291) table_kind ::= CHILD */ - 409, /* (292) db_name_cond_opt ::= */ - 409, /* (293) db_name_cond_opt ::= db_name NK_DOT */ - 408, /* (294) like_pattern_opt ::= */ - 408, /* (295) like_pattern_opt ::= LIKE NK_STRING */ - 410, /* (296) table_name_cond ::= table_name */ - 411, /* (297) from_db_opt ::= */ - 411, /* (298) from_db_opt ::= FROM db_name */ - 412, /* (299) tag_list_opt ::= */ - 412, /* (300) tag_list_opt ::= tag_item */ - 412, /* (301) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 414, /* (302) tag_item ::= TBNAME */ - 414, /* (303) tag_item ::= QTAGS */ - 414, /* (304) tag_item ::= column_name */ - 414, /* (305) tag_item ::= column_name column_alias */ - 414, /* (306) tag_item ::= column_name AS column_alias */ - 406, /* (307) db_kind_opt ::= */ - 406, /* (308) db_kind_opt ::= USER */ - 406, /* (309) db_kind_opt ::= SYSTEM */ - 346, /* (310) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 346, /* (311) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 346, /* (312) cmd ::= DROP INDEX exists_opt full_index_name */ - 417, /* (313) full_index_name ::= index_name */ - 417, /* (314) full_index_name ::= db_name NK_DOT index_name */ - 416, /* (315) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 416, /* (316) 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 */ - 419, /* (317) func_list ::= func */ - 419, /* (318) func_list ::= func_list NK_COMMA func */ - 422, /* (319) func ::= sma_func_name NK_LP expression_list NK_RP */ - 423, /* (320) sma_func_name ::= function_name */ - 423, /* (321) sma_func_name ::= COUNT */ - 423, /* (322) sma_func_name ::= FIRST */ - 423, /* (323) sma_func_name ::= LAST */ - 423, /* (324) sma_func_name ::= LAST_ROW */ - 421, /* (325) sma_stream_opt ::= */ - 421, /* (326) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 421, /* (327) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 421, /* (328) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 424, /* (329) with_meta ::= AS */ - 424, /* (330) with_meta ::= WITH META AS */ - 424, /* (331) with_meta ::= ONLY META AS */ - 346, /* (332) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 346, /* (333) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 346, /* (334) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 346, /* (335) cmd ::= DROP TOPIC exists_opt topic_name */ - 346, /* (336) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 346, /* (337) cmd ::= DESC full_table_name */ - 346, /* (338) cmd ::= DESCRIBE full_table_name */ - 346, /* (339) cmd ::= RESET QUERY CACHE */ - 346, /* (340) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 346, /* (341) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 428, /* (342) analyze_opt ::= */ - 428, /* (343) analyze_opt ::= ANALYZE */ - 429, /* (344) explain_options ::= */ - 429, /* (345) explain_options ::= explain_options VERBOSE NK_BOOL */ - 429, /* (346) explain_options ::= explain_options RATIO NK_FLOAT */ - 346, /* (347) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 346, /* (348) cmd ::= DROP FUNCTION exists_opt function_name */ - 432, /* (349) agg_func_opt ::= */ - 432, /* (350) agg_func_opt ::= AGGREGATE */ - 433, /* (351) bufsize_opt ::= */ - 433, /* (352) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 434, /* (353) language_opt ::= */ - 434, /* (354) language_opt ::= LANGUAGE NK_STRING */ - 431, /* (355) or_replace_opt ::= */ - 431, /* (356) or_replace_opt ::= OR REPLACE */ - 346, /* (357) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 346, /* (358) cmd ::= DROP VIEW exists_opt full_view_name */ - 435, /* (359) full_view_name ::= view_name */ - 435, /* (360) full_view_name ::= db_name NK_DOT view_name */ - 346, /* (361) 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 */ - 346, /* (362) cmd ::= DROP STREAM exists_opt stream_name */ - 346, /* (363) cmd ::= PAUSE STREAM exists_opt stream_name */ - 346, /* (364) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 439, /* (365) col_list_opt ::= */ - 439, /* (366) col_list_opt ::= NK_LP col_name_list NK_RP */ - 440, /* (367) tag_def_or_ref_opt ::= */ - 440, /* (368) tag_def_or_ref_opt ::= tags_def */ - 440, /* (369) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 438, /* (370) stream_options ::= */ - 438, /* (371) stream_options ::= stream_options TRIGGER AT_ONCE */ - 438, /* (372) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 438, /* (373) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 438, /* (374) stream_options ::= stream_options WATERMARK duration_literal */ - 438, /* (375) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 438, /* (376) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 438, /* (377) stream_options ::= stream_options DELETE_MARK duration_literal */ - 438, /* (378) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 441, /* (379) subtable_opt ::= */ - 441, /* (380) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 442, /* (381) ignore_opt ::= */ - 442, /* (382) ignore_opt ::= IGNORE UNTREATED */ - 346, /* (383) cmd ::= KILL CONNECTION NK_INTEGER */ - 346, /* (384) cmd ::= KILL QUERY NK_STRING */ - 346, /* (385) cmd ::= KILL TRANSACTION NK_INTEGER */ - 346, /* (386) cmd ::= BALANCE VGROUP */ - 346, /* (387) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 346, /* (388) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 346, /* (389) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 346, /* (390) cmd ::= SPLIT VGROUP NK_INTEGER */ - 444, /* (391) on_vgroup_id ::= */ - 444, /* (392) on_vgroup_id ::= ON NK_INTEGER */ - 445, /* (393) dnode_list ::= DNODE NK_INTEGER */ - 445, /* (394) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 346, /* (395) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 346, /* (396) cmd ::= query_or_subquery */ - 346, /* (397) cmd ::= insert_query */ - 430, /* (398) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 430, /* (399) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 349, /* (400) literal ::= NK_INTEGER */ - 349, /* (401) literal ::= NK_FLOAT */ - 349, /* (402) literal ::= NK_STRING */ - 349, /* (403) literal ::= NK_BOOL */ - 349, /* (404) literal ::= TIMESTAMP NK_STRING */ - 349, /* (405) literal ::= duration_literal */ - 349, /* (406) literal ::= NULL */ - 349, /* (407) literal ::= NK_QUESTION */ - 402, /* (408) duration_literal ::= NK_VARIABLE */ - 378, /* (409) signed ::= NK_INTEGER */ - 378, /* (410) signed ::= NK_PLUS NK_INTEGER */ - 378, /* (411) signed ::= NK_MINUS NK_INTEGER */ - 378, /* (412) signed ::= NK_FLOAT */ - 378, /* (413) signed ::= NK_PLUS NK_FLOAT */ - 378, /* (414) signed ::= NK_MINUS NK_FLOAT */ - 392, /* (415) signed_literal ::= signed */ - 392, /* (416) signed_literal ::= NK_STRING */ - 392, /* (417) signed_literal ::= NK_BOOL */ - 392, /* (418) signed_literal ::= TIMESTAMP NK_STRING */ - 392, /* (419) signed_literal ::= duration_literal */ - 392, /* (420) signed_literal ::= NULL */ - 392, /* (421) signed_literal ::= literal_func */ - 392, /* (422) signed_literal ::= NK_QUESTION */ - 447, /* (423) literal_list ::= signed_literal */ - 447, /* (424) literal_list ::= literal_list NK_COMMA signed_literal */ - 361, /* (425) db_name ::= NK_ID */ - 362, /* (426) table_name ::= NK_ID */ - 390, /* (427) column_name ::= NK_ID */ - 404, /* (428) function_name ::= NK_ID */ - 436, /* (429) view_name ::= NK_ID */ - 448, /* (430) table_alias ::= NK_ID */ - 415, /* (431) column_alias ::= NK_ID */ - 415, /* (432) column_alias ::= NK_ALIAS */ - 354, /* (433) user_name ::= NK_ID */ - 363, /* (434) topic_name ::= NK_ID */ - 437, /* (435) stream_name ::= NK_ID */ - 427, /* (436) cgroup_name ::= NK_ID */ - 418, /* (437) index_name ::= NK_ID */ - 449, /* (438) expr_or_subquery ::= expression */ - 443, /* (439) expression ::= literal */ - 443, /* (440) expression ::= pseudo_column */ - 443, /* (441) expression ::= column_reference */ - 443, /* (442) expression ::= function_expression */ - 443, /* (443) expression ::= case_when_expression */ - 443, /* (444) expression ::= NK_LP expression NK_RP */ - 443, /* (445) expression ::= NK_PLUS expr_or_subquery */ - 443, /* (446) expression ::= NK_MINUS expr_or_subquery */ - 443, /* (447) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 443, /* (448) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 443, /* (449) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 443, /* (450) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 443, /* (451) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 443, /* (452) expression ::= column_reference NK_ARROW NK_STRING */ - 443, /* (453) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 443, /* (454) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 395, /* (455) expression_list ::= expr_or_subquery */ - 395, /* (456) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 451, /* (457) column_reference ::= column_name */ - 451, /* (458) column_reference ::= table_name NK_DOT column_name */ - 451, /* (459) column_reference ::= NK_ALIAS */ - 451, /* (460) column_reference ::= table_name NK_DOT NK_ALIAS */ - 450, /* (461) pseudo_column ::= ROWTS */ - 450, /* (462) pseudo_column ::= TBNAME */ - 450, /* (463) pseudo_column ::= table_name NK_DOT TBNAME */ - 450, /* (464) pseudo_column ::= QSTART */ - 450, /* (465) pseudo_column ::= QEND */ - 450, /* (466) pseudo_column ::= QDURATION */ - 450, /* (467) pseudo_column ::= WSTART */ - 450, /* (468) pseudo_column ::= WEND */ - 450, /* (469) pseudo_column ::= WDURATION */ - 450, /* (470) pseudo_column ::= IROWTS */ - 450, /* (471) pseudo_column ::= ISFILLED */ - 450, /* (472) pseudo_column ::= QTAGS */ - 452, /* (473) function_expression ::= function_name NK_LP expression_list NK_RP */ - 452, /* (474) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 452, /* (475) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 452, /* (476) function_expression ::= literal_func */ - 446, /* (477) literal_func ::= noarg_func NK_LP NK_RP */ - 446, /* (478) literal_func ::= NOW */ - 456, /* (479) noarg_func ::= NOW */ - 456, /* (480) noarg_func ::= TODAY */ - 456, /* (481) noarg_func ::= TIMEZONE */ - 456, /* (482) noarg_func ::= DATABASE */ - 456, /* (483) noarg_func ::= CLIENT_VERSION */ - 456, /* (484) noarg_func ::= SERVER_VERSION */ - 456, /* (485) noarg_func ::= SERVER_STATUS */ - 456, /* (486) noarg_func ::= CURRENT_USER */ - 456, /* (487) noarg_func ::= USER */ - 454, /* (488) star_func ::= COUNT */ - 454, /* (489) star_func ::= FIRST */ - 454, /* (490) star_func ::= LAST */ - 454, /* (491) star_func ::= LAST_ROW */ - 455, /* (492) star_func_para_list ::= NK_STAR */ - 455, /* (493) star_func_para_list ::= other_para_list */ - 457, /* (494) other_para_list ::= star_func_para */ - 457, /* (495) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 458, /* (496) star_func_para ::= expr_or_subquery */ - 458, /* (497) star_func_para ::= table_name NK_DOT NK_STAR */ - 453, /* (498) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 453, /* (499) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 459, /* (500) when_then_list ::= when_then_expr */ - 459, /* (501) when_then_list ::= when_then_list when_then_expr */ - 462, /* (502) when_then_expr ::= WHEN common_expression THEN common_expression */ - 460, /* (503) case_when_else_opt ::= */ - 460, /* (504) case_when_else_opt ::= ELSE common_expression */ - 463, /* (505) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 463, /* (506) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 463, /* (507) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 463, /* (508) predicate ::= expr_or_subquery IS NULL */ - 463, /* (509) predicate ::= expr_or_subquery IS NOT NULL */ - 463, /* (510) predicate ::= expr_or_subquery in_op in_predicate_value */ - 464, /* (511) compare_op ::= NK_LT */ - 464, /* (512) compare_op ::= NK_GT */ - 464, /* (513) compare_op ::= NK_LE */ - 464, /* (514) compare_op ::= NK_GE */ - 464, /* (515) compare_op ::= NK_NE */ - 464, /* (516) compare_op ::= NK_EQ */ - 464, /* (517) compare_op ::= LIKE */ - 464, /* (518) compare_op ::= NOT LIKE */ - 464, /* (519) compare_op ::= MATCH */ - 464, /* (520) compare_op ::= NMATCH */ - 464, /* (521) compare_op ::= CONTAINS */ - 465, /* (522) in_op ::= IN */ - 465, /* (523) in_op ::= NOT IN */ - 466, /* (524) in_predicate_value ::= NK_LP literal_list NK_RP */ - 467, /* (525) boolean_value_expression ::= boolean_primary */ - 467, /* (526) boolean_value_expression ::= NOT boolean_primary */ - 467, /* (527) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 467, /* (528) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 468, /* (529) boolean_primary ::= predicate */ - 468, /* (530) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 461, /* (531) common_expression ::= expr_or_subquery */ - 461, /* (532) common_expression ::= boolean_value_expression */ - 469, /* (533) from_clause_opt ::= */ - 469, /* (534) from_clause_opt ::= FROM table_reference_list */ - 470, /* (535) table_reference_list ::= table_reference */ - 470, /* (536) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 471, /* (537) table_reference ::= table_primary */ - 471, /* (538) table_reference ::= joined_table */ - 472, /* (539) table_primary ::= table_name alias_opt */ - 472, /* (540) table_primary ::= db_name NK_DOT table_name alias_opt */ - 472, /* (541) table_primary ::= subquery alias_opt */ - 472, /* (542) table_primary ::= parenthesized_joined_table */ - 474, /* (543) alias_opt ::= */ - 474, /* (544) alias_opt ::= table_alias */ - 474, /* (545) alias_opt ::= AS table_alias */ - 476, /* (546) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 476, /* (547) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 473, /* (548) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 477, /* (549) join_type ::= */ - 477, /* (550) join_type ::= INNER */ - 478, /* (551) 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 */ - 479, /* (552) hint_list ::= */ - 479, /* (553) hint_list ::= NK_HINT */ - 481, /* (554) tag_mode_opt ::= */ - 481, /* (555) tag_mode_opt ::= TAGS */ - 480, /* (556) set_quantifier_opt ::= */ - 480, /* (557) set_quantifier_opt ::= DISTINCT */ - 480, /* (558) set_quantifier_opt ::= ALL */ - 482, /* (559) select_list ::= select_item */ - 482, /* (560) select_list ::= select_list NK_COMMA select_item */ - 490, /* (561) select_item ::= NK_STAR */ - 490, /* (562) select_item ::= common_expression */ - 490, /* (563) select_item ::= common_expression column_alias */ - 490, /* (564) select_item ::= common_expression AS column_alias */ - 490, /* (565) select_item ::= table_name NK_DOT NK_STAR */ - 426, /* (566) where_clause_opt ::= */ - 426, /* (567) where_clause_opt ::= WHERE search_condition */ - 483, /* (568) partition_by_clause_opt ::= */ - 483, /* (569) partition_by_clause_opt ::= PARTITION BY partition_list */ - 491, /* (570) partition_list ::= partition_item */ - 491, /* (571) partition_list ::= partition_list NK_COMMA partition_item */ - 492, /* (572) partition_item ::= expr_or_subquery */ - 492, /* (573) partition_item ::= expr_or_subquery column_alias */ - 492, /* (574) partition_item ::= expr_or_subquery AS column_alias */ - 487, /* (575) twindow_clause_opt ::= */ - 487, /* (576) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 487, /* (577) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 487, /* (578) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 487, /* (579) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 487, /* (580) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 420, /* (581) sliding_opt ::= */ - 420, /* (582) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 493, /* (583) interval_sliding_duration_literal ::= NK_VARIABLE */ - 493, /* (584) interval_sliding_duration_literal ::= NK_STRING */ - 493, /* (585) interval_sliding_duration_literal ::= NK_INTEGER */ - 486, /* (586) fill_opt ::= */ - 486, /* (587) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 486, /* (588) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 486, /* (589) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 494, /* (590) fill_mode ::= NONE */ - 494, /* (591) fill_mode ::= PREV */ - 494, /* (592) fill_mode ::= NULL */ - 494, /* (593) fill_mode ::= NULL_F */ - 494, /* (594) fill_mode ::= LINEAR */ - 494, /* (595) fill_mode ::= NEXT */ - 488, /* (596) group_by_clause_opt ::= */ - 488, /* (597) group_by_clause_opt ::= GROUP BY group_by_list */ - 495, /* (598) group_by_list ::= expr_or_subquery */ - 495, /* (599) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 489, /* (600) having_clause_opt ::= */ - 489, /* (601) having_clause_opt ::= HAVING search_condition */ - 484, /* (602) range_opt ::= */ - 484, /* (603) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 484, /* (604) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 485, /* (605) every_opt ::= */ - 485, /* (606) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 496, /* (607) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 497, /* (608) query_simple ::= query_specification */ - 497, /* (609) query_simple ::= union_query_expression */ - 501, /* (610) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 501, /* (611) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 502, /* (612) query_simple_or_subquery ::= query_simple */ - 502, /* (613) query_simple_or_subquery ::= subquery */ - 425, /* (614) query_or_subquery ::= query_expression */ - 425, /* (615) query_or_subquery ::= subquery */ - 498, /* (616) order_by_clause_opt ::= */ - 498, /* (617) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 499, /* (618) slimit_clause_opt ::= */ - 499, /* (619) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 499, /* (620) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 499, /* (621) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 500, /* (622) limit_clause_opt ::= */ - 500, /* (623) limit_clause_opt ::= LIMIT NK_INTEGER */ - 500, /* (624) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 500, /* (625) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 475, /* (626) subquery ::= NK_LP query_expression NK_RP */ - 475, /* (627) subquery ::= NK_LP subquery NK_RP */ - 364, /* (628) search_condition ::= common_expression */ - 503, /* (629) sort_specification_list ::= sort_specification */ - 503, /* (630) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 504, /* (631) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 505, /* (632) ordering_specification_opt ::= */ - 505, /* (633) ordering_specification_opt ::= ASC */ - 505, /* (634) ordering_specification_opt ::= DESC */ - 506, /* (635) null_ordering_opt ::= */ - 506, /* (636) null_ordering_opt ::= NULLS FIRST */ - 506, /* (637) null_ordering_opt ::= NULLS LAST */ + 380, /* (152) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 372, /* (153) speed_opt ::= */ + 372, /* (154) speed_opt ::= BWLIMIT NK_INTEGER */ + 373, /* (155) start_opt ::= */ + 373, /* (156) start_opt ::= START WITH NK_INTEGER */ + 373, /* (157) start_opt ::= START WITH NK_STRING */ + 373, /* (158) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 374, /* (159) end_opt ::= */ + 374, /* (160) end_opt ::= END WITH NK_INTEGER */ + 374, /* (161) end_opt ::= END WITH NK_STRING */ + 374, /* (162) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 346, /* (163) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 346, /* (164) cmd ::= CREATE TABLE multi_create_clause */ + 346, /* (165) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 346, /* (166) cmd ::= DROP TABLE multi_drop_clause */ + 346, /* (167) cmd ::= DROP STABLE exists_opt full_table_name */ + 346, /* (168) cmd ::= ALTER TABLE alter_table_clause */ + 346, /* (169) cmd ::= ALTER STABLE alter_table_clause */ + 388, /* (170) alter_table_clause ::= full_table_name alter_table_options */ + 388, /* (171) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 388, /* (172) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 388, /* (173) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 388, /* (174) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 388, /* (175) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 388, /* (176) alter_table_clause ::= full_table_name DROP TAG column_name */ + 388, /* (177) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 388, /* (178) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 388, /* (179) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + 385, /* (180) multi_create_clause ::= create_subtable_clause */ + 385, /* (181) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 393, /* (182) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + 387, /* (183) multi_drop_clause ::= drop_table_clause */ + 387, /* (184) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 396, /* (185) drop_table_clause ::= exists_opt full_table_name */ + 394, /* (186) specific_cols_opt ::= */ + 394, /* (187) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 381, /* (188) full_table_name ::= table_name */ + 381, /* (189) full_table_name ::= db_name NK_DOT table_name */ + 382, /* (190) column_def_list ::= column_def */ + 382, /* (191) column_def_list ::= column_def_list NK_COMMA column_def */ + 398, /* (192) column_def ::= column_name type_name */ + 391, /* (193) type_name ::= BOOL */ + 391, /* (194) type_name ::= TINYINT */ + 391, /* (195) type_name ::= SMALLINT */ + 391, /* (196) type_name ::= INT */ + 391, /* (197) type_name ::= INTEGER */ + 391, /* (198) type_name ::= BIGINT */ + 391, /* (199) type_name ::= FLOAT */ + 391, /* (200) type_name ::= DOUBLE */ + 391, /* (201) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 391, /* (202) type_name ::= TIMESTAMP */ + 391, /* (203) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 391, /* (204) type_name ::= TINYINT UNSIGNED */ + 391, /* (205) type_name ::= SMALLINT UNSIGNED */ + 391, /* (206) type_name ::= INT UNSIGNED */ + 391, /* (207) type_name ::= BIGINT UNSIGNED */ + 391, /* (208) type_name ::= JSON */ + 391, /* (209) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 391, /* (210) type_name ::= MEDIUMBLOB */ + 391, /* (211) type_name ::= BLOB */ + 391, /* (212) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 391, /* (213) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 391, /* (214) type_name ::= DECIMAL */ + 391, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 391, /* (216) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 383, /* (217) tags_def_opt ::= */ + 383, /* (218) tags_def_opt ::= tags_def */ + 386, /* (219) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 384, /* (220) table_options ::= */ + 384, /* (221) table_options ::= table_options COMMENT NK_STRING */ + 384, /* (222) table_options ::= table_options MAX_DELAY duration_list */ + 384, /* (223) table_options ::= table_options WATERMARK duration_list */ + 384, /* (224) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 384, /* (225) table_options ::= table_options TTL NK_INTEGER */ + 384, /* (226) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 384, /* (227) table_options ::= table_options DELETE_MARK duration_list */ + 389, /* (228) alter_table_options ::= alter_table_option */ + 389, /* (229) alter_table_options ::= alter_table_options alter_table_option */ + 401, /* (230) alter_table_option ::= COMMENT NK_STRING */ + 401, /* (231) alter_table_option ::= TTL NK_INTEGER */ + 399, /* (232) duration_list ::= duration_literal */ + 399, /* (233) duration_list ::= duration_list NK_COMMA duration_literal */ + 400, /* (234) rollup_func_list ::= rollup_func_name */ + 400, /* (235) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 403, /* (236) rollup_func_name ::= function_name */ + 403, /* (237) rollup_func_name ::= FIRST */ + 403, /* (238) rollup_func_name ::= LAST */ + 397, /* (239) col_name_list ::= col_name */ + 397, /* (240) col_name_list ::= col_name_list NK_COMMA col_name */ + 405, /* (241) col_name ::= column_name */ + 346, /* (242) cmd ::= SHOW DNODES */ + 346, /* (243) cmd ::= SHOW USERS */ + 346, /* (244) cmd ::= SHOW USER PRIVILEGES */ + 346, /* (245) cmd ::= SHOW db_kind_opt DATABASES */ + 346, /* (246) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 346, /* (247) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 346, /* (248) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 346, /* (249) cmd ::= SHOW MNODES */ + 346, /* (250) cmd ::= SHOW QNODES */ + 346, /* (251) cmd ::= SHOW FUNCTIONS */ + 346, /* (252) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 346, /* (253) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 346, /* (254) cmd ::= SHOW STREAMS */ + 346, /* (255) cmd ::= SHOW ACCOUNTS */ + 346, /* (256) cmd ::= SHOW APPS */ + 346, /* (257) cmd ::= SHOW CONNECTIONS */ + 346, /* (258) cmd ::= SHOW LICENCES */ + 346, /* (259) cmd ::= SHOW GRANTS */ + 346, /* (260) cmd ::= SHOW CREATE DATABASE db_name */ + 346, /* (261) cmd ::= SHOW CREATE TABLE full_table_name */ + 346, /* (262) cmd ::= SHOW CREATE STABLE full_table_name */ + 346, /* (263) cmd ::= SHOW QUERIES */ + 346, /* (264) cmd ::= SHOW SCORES */ + 346, /* (265) cmd ::= SHOW TOPICS */ + 346, /* (266) cmd ::= SHOW VARIABLES */ + 346, /* (267) cmd ::= SHOW CLUSTER VARIABLES */ + 346, /* (268) cmd ::= SHOW LOCAL VARIABLES */ + 346, /* (269) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 346, /* (270) cmd ::= SHOW BNODES */ + 346, /* (271) cmd ::= SHOW SNODES */ + 346, /* (272) cmd ::= SHOW CLUSTER */ + 346, /* (273) cmd ::= SHOW TRANSACTIONS */ + 346, /* (274) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 346, /* (275) cmd ::= SHOW CONSUMERS */ + 346, /* (276) cmd ::= SHOW SUBSCRIPTIONS */ + 346, /* (277) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 346, /* (278) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 346, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 346, /* (280) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 346, /* (281) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 346, /* (282) cmd ::= SHOW VNODES */ + 346, /* (283) cmd ::= SHOW db_name_cond_opt ALIVE */ + 346, /* (284) cmd ::= SHOW CLUSTER ALIVE */ + 346, /* (285) cmd ::= SHOW db_name_cond_opt VIEWS */ + 346, /* (286) cmd ::= SHOW CREATE VIEW full_table_name */ + 407, /* (287) table_kind_db_name_cond_opt ::= */ + 407, /* (288) table_kind_db_name_cond_opt ::= table_kind */ + 407, /* (289) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 407, /* (290) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 413, /* (291) table_kind ::= NORMAL */ + 413, /* (292) table_kind ::= CHILD */ + 409, /* (293) db_name_cond_opt ::= */ + 409, /* (294) db_name_cond_opt ::= db_name NK_DOT */ + 408, /* (295) like_pattern_opt ::= */ + 408, /* (296) like_pattern_opt ::= LIKE NK_STRING */ + 410, /* (297) table_name_cond ::= table_name */ + 411, /* (298) from_db_opt ::= */ + 411, /* (299) from_db_opt ::= FROM db_name */ + 412, /* (300) tag_list_opt ::= */ + 412, /* (301) tag_list_opt ::= tag_item */ + 412, /* (302) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 414, /* (303) tag_item ::= TBNAME */ + 414, /* (304) tag_item ::= QTAGS */ + 414, /* (305) tag_item ::= column_name */ + 414, /* (306) tag_item ::= column_name column_alias */ + 414, /* (307) tag_item ::= column_name AS column_alias */ + 406, /* (308) db_kind_opt ::= */ + 406, /* (309) db_kind_opt ::= USER */ + 406, /* (310) db_kind_opt ::= SYSTEM */ + 346, /* (311) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 346, /* (312) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 346, /* (313) cmd ::= DROP INDEX exists_opt full_index_name */ + 417, /* (314) full_index_name ::= index_name */ + 417, /* (315) full_index_name ::= db_name NK_DOT index_name */ + 416, /* (316) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 416, /* (317) 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 */ + 419, /* (318) func_list ::= func */ + 419, /* (319) func_list ::= func_list NK_COMMA func */ + 422, /* (320) func ::= sma_func_name NK_LP expression_list NK_RP */ + 423, /* (321) sma_func_name ::= function_name */ + 423, /* (322) sma_func_name ::= COUNT */ + 423, /* (323) sma_func_name ::= FIRST */ + 423, /* (324) sma_func_name ::= LAST */ + 423, /* (325) sma_func_name ::= LAST_ROW */ + 421, /* (326) sma_stream_opt ::= */ + 421, /* (327) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 421, /* (328) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 421, /* (329) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 424, /* (330) with_meta ::= AS */ + 424, /* (331) with_meta ::= WITH META AS */ + 424, /* (332) with_meta ::= ONLY META AS */ + 346, /* (333) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 346, /* (334) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 346, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 346, /* (336) cmd ::= DROP TOPIC exists_opt topic_name */ + 346, /* (337) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 346, /* (338) cmd ::= DESC full_table_name */ + 346, /* (339) cmd ::= DESCRIBE full_table_name */ + 346, /* (340) cmd ::= RESET QUERY CACHE */ + 346, /* (341) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 346, /* (342) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 428, /* (343) analyze_opt ::= */ + 428, /* (344) analyze_opt ::= ANALYZE */ + 429, /* (345) explain_options ::= */ + 429, /* (346) explain_options ::= explain_options VERBOSE NK_BOOL */ + 429, /* (347) explain_options ::= explain_options RATIO NK_FLOAT */ + 346, /* (348) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 346, /* (349) cmd ::= DROP FUNCTION exists_opt function_name */ + 432, /* (350) agg_func_opt ::= */ + 432, /* (351) agg_func_opt ::= AGGREGATE */ + 433, /* (352) bufsize_opt ::= */ + 433, /* (353) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 434, /* (354) language_opt ::= */ + 434, /* (355) language_opt ::= LANGUAGE NK_STRING */ + 431, /* (356) or_replace_opt ::= */ + 431, /* (357) or_replace_opt ::= OR REPLACE */ + 346, /* (358) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 346, /* (359) cmd ::= DROP VIEW exists_opt full_view_name */ + 435, /* (360) full_view_name ::= view_name */ + 435, /* (361) full_view_name ::= db_name NK_DOT view_name */ + 346, /* (362) 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 */ + 346, /* (363) cmd ::= DROP STREAM exists_opt stream_name */ + 346, /* (364) cmd ::= PAUSE STREAM exists_opt stream_name */ + 346, /* (365) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 439, /* (366) col_list_opt ::= */ + 439, /* (367) col_list_opt ::= NK_LP col_name_list NK_RP */ + 440, /* (368) tag_def_or_ref_opt ::= */ + 440, /* (369) tag_def_or_ref_opt ::= tags_def */ + 440, /* (370) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 438, /* (371) stream_options ::= */ + 438, /* (372) stream_options ::= stream_options TRIGGER AT_ONCE */ + 438, /* (373) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 438, /* (374) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 438, /* (375) stream_options ::= stream_options WATERMARK duration_literal */ + 438, /* (376) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 438, /* (377) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 438, /* (378) stream_options ::= stream_options DELETE_MARK duration_literal */ + 438, /* (379) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 441, /* (380) subtable_opt ::= */ + 441, /* (381) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 442, /* (382) ignore_opt ::= */ + 442, /* (383) ignore_opt ::= IGNORE UNTREATED */ + 346, /* (384) cmd ::= KILL CONNECTION NK_INTEGER */ + 346, /* (385) cmd ::= KILL QUERY NK_STRING */ + 346, /* (386) cmd ::= KILL TRANSACTION NK_INTEGER */ + 346, /* (387) cmd ::= BALANCE VGROUP */ + 346, /* (388) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 346, /* (389) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 346, /* (390) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 346, /* (391) cmd ::= SPLIT VGROUP NK_INTEGER */ + 444, /* (392) on_vgroup_id ::= */ + 444, /* (393) on_vgroup_id ::= ON NK_INTEGER */ + 445, /* (394) dnode_list ::= DNODE NK_INTEGER */ + 445, /* (395) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 346, /* (396) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 346, /* (397) cmd ::= query_or_subquery */ + 346, /* (398) cmd ::= insert_query */ + 430, /* (399) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 430, /* (400) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 349, /* (401) literal ::= NK_INTEGER */ + 349, /* (402) literal ::= NK_FLOAT */ + 349, /* (403) literal ::= NK_STRING */ + 349, /* (404) literal ::= NK_BOOL */ + 349, /* (405) literal ::= TIMESTAMP NK_STRING */ + 349, /* (406) literal ::= duration_literal */ + 349, /* (407) literal ::= NULL */ + 349, /* (408) literal ::= NK_QUESTION */ + 402, /* (409) duration_literal ::= NK_VARIABLE */ + 378, /* (410) signed ::= NK_INTEGER */ + 378, /* (411) signed ::= NK_PLUS NK_INTEGER */ + 378, /* (412) signed ::= NK_MINUS NK_INTEGER */ + 378, /* (413) signed ::= NK_FLOAT */ + 378, /* (414) signed ::= NK_PLUS NK_FLOAT */ + 378, /* (415) signed ::= NK_MINUS NK_FLOAT */ + 392, /* (416) signed_literal ::= signed */ + 392, /* (417) signed_literal ::= NK_STRING */ + 392, /* (418) signed_literal ::= NK_BOOL */ + 392, /* (419) signed_literal ::= TIMESTAMP NK_STRING */ + 392, /* (420) signed_literal ::= duration_literal */ + 392, /* (421) signed_literal ::= NULL */ + 392, /* (422) signed_literal ::= literal_func */ + 392, /* (423) signed_literal ::= NK_QUESTION */ + 447, /* (424) literal_list ::= signed_literal */ + 447, /* (425) literal_list ::= literal_list NK_COMMA signed_literal */ + 361, /* (426) db_name ::= NK_ID */ + 362, /* (427) table_name ::= NK_ID */ + 390, /* (428) column_name ::= NK_ID */ + 404, /* (429) function_name ::= NK_ID */ + 436, /* (430) view_name ::= NK_ID */ + 448, /* (431) table_alias ::= NK_ID */ + 415, /* (432) column_alias ::= NK_ID */ + 415, /* (433) column_alias ::= NK_ALIAS */ + 354, /* (434) user_name ::= NK_ID */ + 363, /* (435) topic_name ::= NK_ID */ + 437, /* (436) stream_name ::= NK_ID */ + 427, /* (437) cgroup_name ::= NK_ID */ + 418, /* (438) index_name ::= NK_ID */ + 449, /* (439) expr_or_subquery ::= expression */ + 443, /* (440) expression ::= literal */ + 443, /* (441) expression ::= pseudo_column */ + 443, /* (442) expression ::= column_reference */ + 443, /* (443) expression ::= function_expression */ + 443, /* (444) expression ::= case_when_expression */ + 443, /* (445) expression ::= NK_LP expression NK_RP */ + 443, /* (446) expression ::= NK_PLUS expr_or_subquery */ + 443, /* (447) expression ::= NK_MINUS expr_or_subquery */ + 443, /* (448) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 443, /* (449) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 443, /* (450) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 443, /* (451) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 443, /* (452) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 443, /* (453) expression ::= column_reference NK_ARROW NK_STRING */ + 443, /* (454) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 443, /* (455) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 395, /* (456) expression_list ::= expr_or_subquery */ + 395, /* (457) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 451, /* (458) column_reference ::= column_name */ + 451, /* (459) column_reference ::= table_name NK_DOT column_name */ + 451, /* (460) column_reference ::= NK_ALIAS */ + 451, /* (461) column_reference ::= table_name NK_DOT NK_ALIAS */ + 450, /* (462) pseudo_column ::= ROWTS */ + 450, /* (463) pseudo_column ::= TBNAME */ + 450, /* (464) pseudo_column ::= table_name NK_DOT TBNAME */ + 450, /* (465) pseudo_column ::= QSTART */ + 450, /* (466) pseudo_column ::= QEND */ + 450, /* (467) pseudo_column ::= QDURATION */ + 450, /* (468) pseudo_column ::= WSTART */ + 450, /* (469) pseudo_column ::= WEND */ + 450, /* (470) pseudo_column ::= WDURATION */ + 450, /* (471) pseudo_column ::= IROWTS */ + 450, /* (472) pseudo_column ::= ISFILLED */ + 450, /* (473) pseudo_column ::= QTAGS */ + 452, /* (474) function_expression ::= function_name NK_LP expression_list NK_RP */ + 452, /* (475) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 452, /* (476) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 452, /* (477) function_expression ::= literal_func */ + 446, /* (478) literal_func ::= noarg_func NK_LP NK_RP */ + 446, /* (479) literal_func ::= NOW */ + 456, /* (480) noarg_func ::= NOW */ + 456, /* (481) noarg_func ::= TODAY */ + 456, /* (482) noarg_func ::= TIMEZONE */ + 456, /* (483) noarg_func ::= DATABASE */ + 456, /* (484) noarg_func ::= CLIENT_VERSION */ + 456, /* (485) noarg_func ::= SERVER_VERSION */ + 456, /* (486) noarg_func ::= SERVER_STATUS */ + 456, /* (487) noarg_func ::= CURRENT_USER */ + 456, /* (488) noarg_func ::= USER */ + 454, /* (489) star_func ::= COUNT */ + 454, /* (490) star_func ::= FIRST */ + 454, /* (491) star_func ::= LAST */ + 454, /* (492) star_func ::= LAST_ROW */ + 455, /* (493) star_func_para_list ::= NK_STAR */ + 455, /* (494) star_func_para_list ::= other_para_list */ + 457, /* (495) other_para_list ::= star_func_para */ + 457, /* (496) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 458, /* (497) star_func_para ::= expr_or_subquery */ + 458, /* (498) star_func_para ::= table_name NK_DOT NK_STAR */ + 453, /* (499) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 453, /* (500) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 459, /* (501) when_then_list ::= when_then_expr */ + 459, /* (502) when_then_list ::= when_then_list when_then_expr */ + 462, /* (503) when_then_expr ::= WHEN common_expression THEN common_expression */ + 460, /* (504) case_when_else_opt ::= */ + 460, /* (505) case_when_else_opt ::= ELSE common_expression */ + 463, /* (506) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 463, /* (507) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 463, /* (508) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 463, /* (509) predicate ::= expr_or_subquery IS NULL */ + 463, /* (510) predicate ::= expr_or_subquery IS NOT NULL */ + 463, /* (511) predicate ::= expr_or_subquery in_op in_predicate_value */ + 464, /* (512) compare_op ::= NK_LT */ + 464, /* (513) compare_op ::= NK_GT */ + 464, /* (514) compare_op ::= NK_LE */ + 464, /* (515) compare_op ::= NK_GE */ + 464, /* (516) compare_op ::= NK_NE */ + 464, /* (517) compare_op ::= NK_EQ */ + 464, /* (518) compare_op ::= LIKE */ + 464, /* (519) compare_op ::= NOT LIKE */ + 464, /* (520) compare_op ::= MATCH */ + 464, /* (521) compare_op ::= NMATCH */ + 464, /* (522) compare_op ::= CONTAINS */ + 465, /* (523) in_op ::= IN */ + 465, /* (524) in_op ::= NOT IN */ + 466, /* (525) in_predicate_value ::= NK_LP literal_list NK_RP */ + 467, /* (526) boolean_value_expression ::= boolean_primary */ + 467, /* (527) boolean_value_expression ::= NOT boolean_primary */ + 467, /* (528) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 467, /* (529) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 468, /* (530) boolean_primary ::= predicate */ + 468, /* (531) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 461, /* (532) common_expression ::= expr_or_subquery */ + 461, /* (533) common_expression ::= boolean_value_expression */ + 469, /* (534) from_clause_opt ::= */ + 469, /* (535) from_clause_opt ::= FROM table_reference_list */ + 470, /* (536) table_reference_list ::= table_reference */ + 470, /* (537) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 471, /* (538) table_reference ::= table_primary */ + 471, /* (539) table_reference ::= joined_table */ + 472, /* (540) table_primary ::= table_name alias_opt */ + 472, /* (541) table_primary ::= db_name NK_DOT table_name alias_opt */ + 472, /* (542) table_primary ::= subquery alias_opt */ + 472, /* (543) table_primary ::= parenthesized_joined_table */ + 474, /* (544) alias_opt ::= */ + 474, /* (545) alias_opt ::= table_alias */ + 474, /* (546) alias_opt ::= AS table_alias */ + 476, /* (547) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 476, /* (548) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 473, /* (549) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 477, /* (550) join_type ::= */ + 477, /* (551) join_type ::= INNER */ + 478, /* (552) 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 */ + 479, /* (553) hint_list ::= */ + 479, /* (554) hint_list ::= NK_HINT */ + 481, /* (555) tag_mode_opt ::= */ + 481, /* (556) tag_mode_opt ::= TAGS */ + 480, /* (557) set_quantifier_opt ::= */ + 480, /* (558) set_quantifier_opt ::= DISTINCT */ + 480, /* (559) set_quantifier_opt ::= ALL */ + 482, /* (560) select_list ::= select_item */ + 482, /* (561) select_list ::= select_list NK_COMMA select_item */ + 490, /* (562) select_item ::= NK_STAR */ + 490, /* (563) select_item ::= common_expression */ + 490, /* (564) select_item ::= common_expression column_alias */ + 490, /* (565) select_item ::= common_expression AS column_alias */ + 490, /* (566) select_item ::= table_name NK_DOT NK_STAR */ + 426, /* (567) where_clause_opt ::= */ + 426, /* (568) where_clause_opt ::= WHERE search_condition */ + 483, /* (569) partition_by_clause_opt ::= */ + 483, /* (570) partition_by_clause_opt ::= PARTITION BY partition_list */ + 491, /* (571) partition_list ::= partition_item */ + 491, /* (572) partition_list ::= partition_list NK_COMMA partition_item */ + 492, /* (573) partition_item ::= expr_or_subquery */ + 492, /* (574) partition_item ::= expr_or_subquery column_alias */ + 492, /* (575) partition_item ::= expr_or_subquery AS column_alias */ + 487, /* (576) twindow_clause_opt ::= */ + 487, /* (577) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 487, /* (578) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 487, /* (579) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 487, /* (580) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 487, /* (581) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 420, /* (582) sliding_opt ::= */ + 420, /* (583) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 493, /* (584) interval_sliding_duration_literal ::= NK_VARIABLE */ + 493, /* (585) interval_sliding_duration_literal ::= NK_STRING */ + 493, /* (586) interval_sliding_duration_literal ::= NK_INTEGER */ + 486, /* (587) fill_opt ::= */ + 486, /* (588) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 486, /* (589) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 486, /* (590) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 494, /* (591) fill_mode ::= NONE */ + 494, /* (592) fill_mode ::= PREV */ + 494, /* (593) fill_mode ::= NULL */ + 494, /* (594) fill_mode ::= NULL_F */ + 494, /* (595) fill_mode ::= LINEAR */ + 494, /* (596) fill_mode ::= NEXT */ + 488, /* (597) group_by_clause_opt ::= */ + 488, /* (598) group_by_clause_opt ::= GROUP BY group_by_list */ + 495, /* (599) group_by_list ::= expr_or_subquery */ + 495, /* (600) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 489, /* (601) having_clause_opt ::= */ + 489, /* (602) having_clause_opt ::= HAVING search_condition */ + 484, /* (603) range_opt ::= */ + 484, /* (604) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 484, /* (605) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 485, /* (606) every_opt ::= */ + 485, /* (607) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 496, /* (608) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 497, /* (609) query_simple ::= query_specification */ + 497, /* (610) query_simple ::= union_query_expression */ + 501, /* (611) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 501, /* (612) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 502, /* (613) query_simple_or_subquery ::= query_simple */ + 502, /* (614) query_simple_or_subquery ::= subquery */ + 425, /* (615) query_or_subquery ::= query_expression */ + 425, /* (616) query_or_subquery ::= subquery */ + 498, /* (617) order_by_clause_opt ::= */ + 498, /* (618) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 499, /* (619) slimit_clause_opt ::= */ + 499, /* (620) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 499, /* (621) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 499, /* (622) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 500, /* (623) limit_clause_opt ::= */ + 500, /* (624) limit_clause_opt ::= LIMIT NK_INTEGER */ + 500, /* (625) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 500, /* (626) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 475, /* (627) subquery ::= NK_LP query_expression NK_RP */ + 475, /* (628) subquery ::= NK_LP subquery NK_RP */ + 364, /* (629) search_condition ::= common_expression */ + 503, /* (630) sort_specification_list ::= sort_specification */ + 503, /* (631) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 504, /* (632) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 505, /* (633) ordering_specification_opt ::= */ + 505, /* (634) ordering_specification_opt ::= ASC */ + 505, /* (635) ordering_specification_opt ::= DESC */ + 506, /* (636) null_ordering_opt ::= */ + 506, /* (637) null_ordering_opt ::= NULLS FIRST */ + 506, /* (638) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4149,492 +4151,493 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (149) retention_list ::= retention */ -3, /* (150) retention_list ::= retention_list NK_COMMA retention */ -3, /* (151) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 0, /* (152) speed_opt ::= */ - -2, /* (153) speed_opt ::= BWLIMIT NK_INTEGER */ - 0, /* (154) start_opt ::= */ - -3, /* (155) start_opt ::= START WITH NK_INTEGER */ - -3, /* (156) start_opt ::= START WITH NK_STRING */ - -4, /* (157) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 0, /* (158) end_opt ::= */ - -3, /* (159) end_opt ::= END WITH NK_INTEGER */ - -3, /* (160) end_opt ::= END WITH NK_STRING */ - -4, /* (161) end_opt ::= END WITH TIMESTAMP NK_STRING */ - -9, /* (162) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - -3, /* (163) cmd ::= CREATE TABLE multi_create_clause */ - -9, /* (164) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - -3, /* (165) cmd ::= DROP TABLE multi_drop_clause */ - -4, /* (166) cmd ::= DROP STABLE exists_opt full_table_name */ - -3, /* (167) cmd ::= ALTER TABLE alter_table_clause */ - -3, /* (168) cmd ::= ALTER STABLE alter_table_clause */ - -2, /* (169) alter_table_clause ::= full_table_name alter_table_options */ - -5, /* (170) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - -4, /* (171) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -5, /* (172) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - -5, /* (173) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -5, /* (174) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - -4, /* (175) alter_table_clause ::= full_table_name DROP TAG column_name */ - -5, /* (176) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - -5, /* (177) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - -6, /* (178) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - -1, /* (179) multi_create_clause ::= create_subtable_clause */ - -2, /* (180) multi_create_clause ::= multi_create_clause create_subtable_clause */ - -10, /* (181) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - -1, /* (182) multi_drop_clause ::= drop_table_clause */ - -3, /* (183) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - -2, /* (184) drop_table_clause ::= exists_opt full_table_name */ - 0, /* (185) specific_cols_opt ::= */ - -3, /* (186) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (187) full_table_name ::= table_name */ - -3, /* (188) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (189) column_def_list ::= column_def */ - -3, /* (190) column_def_list ::= column_def_list NK_COMMA column_def */ - -2, /* (191) column_def ::= column_name type_name */ - -1, /* (192) type_name ::= BOOL */ - -1, /* (193) type_name ::= TINYINT */ - -1, /* (194) type_name ::= SMALLINT */ - -1, /* (195) type_name ::= INT */ - -1, /* (196) type_name ::= INTEGER */ - -1, /* (197) type_name ::= BIGINT */ - -1, /* (198) type_name ::= FLOAT */ - -1, /* (199) type_name ::= DOUBLE */ - -4, /* (200) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (201) type_name ::= TIMESTAMP */ - -4, /* (202) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (203) type_name ::= TINYINT UNSIGNED */ - -2, /* (204) type_name ::= SMALLINT UNSIGNED */ - -2, /* (205) type_name ::= INT UNSIGNED */ - -2, /* (206) type_name ::= BIGINT UNSIGNED */ - -1, /* (207) type_name ::= JSON */ - -4, /* (208) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (209) type_name ::= MEDIUMBLOB */ - -1, /* (210) type_name ::= BLOB */ - -4, /* (211) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (212) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (213) type_name ::= DECIMAL */ - -4, /* (214) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (216) tags_def_opt ::= */ - -1, /* (217) tags_def_opt ::= tags_def */ - -4, /* (218) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 0, /* (219) table_options ::= */ - -3, /* (220) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (221) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (222) table_options ::= table_options WATERMARK duration_list */ - -5, /* (223) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (224) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (225) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (226) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (227) alter_table_options ::= alter_table_option */ - -2, /* (228) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (229) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (230) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (231) duration_list ::= duration_literal */ - -3, /* (232) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (233) rollup_func_list ::= rollup_func_name */ - -3, /* (234) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (235) rollup_func_name ::= function_name */ - -1, /* (236) rollup_func_name ::= FIRST */ - -1, /* (237) rollup_func_name ::= LAST */ - -1, /* (238) col_name_list ::= col_name */ - -3, /* (239) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (240) col_name ::= column_name */ - -2, /* (241) cmd ::= SHOW DNODES */ - -2, /* (242) cmd ::= SHOW USERS */ - -3, /* (243) cmd ::= SHOW USER PRIVILEGES */ - -3, /* (244) cmd ::= SHOW db_kind_opt DATABASES */ - -4, /* (245) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (246) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (247) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (248) cmd ::= SHOW MNODES */ - -2, /* (249) cmd ::= SHOW QNODES */ - -2, /* (250) cmd ::= SHOW FUNCTIONS */ - -5, /* (251) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (252) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (253) cmd ::= SHOW STREAMS */ - -2, /* (254) cmd ::= SHOW ACCOUNTS */ - -2, /* (255) cmd ::= SHOW APPS */ - -2, /* (256) cmd ::= SHOW CONNECTIONS */ - -2, /* (257) cmd ::= SHOW LICENCES */ - -2, /* (258) cmd ::= SHOW GRANTS */ - -4, /* (259) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (260) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (261) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (262) cmd ::= SHOW QUERIES */ - -2, /* (263) cmd ::= SHOW SCORES */ - -2, /* (264) cmd ::= SHOW TOPICS */ - -2, /* (265) cmd ::= SHOW VARIABLES */ - -3, /* (266) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (267) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (268) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (269) cmd ::= SHOW BNODES */ - -2, /* (270) cmd ::= SHOW SNODES */ - -2, /* (271) cmd ::= SHOW CLUSTER */ - -2, /* (272) cmd ::= SHOW TRANSACTIONS */ - -4, /* (273) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (274) cmd ::= SHOW CONSUMERS */ - -2, /* (275) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (276) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (277) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (278) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (280) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (281) cmd ::= SHOW VNODES */ - -3, /* (282) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (283) cmd ::= SHOW CLUSTER ALIVE */ - -3, /* (284) cmd ::= SHOW db_name_cond_opt VIEWS */ - -4, /* (285) cmd ::= SHOW CREATE VIEW full_table_name */ - 0, /* (286) table_kind_db_name_cond_opt ::= */ - -1, /* (287) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (288) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (289) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (290) table_kind ::= NORMAL */ - -1, /* (291) table_kind ::= CHILD */ - 0, /* (292) db_name_cond_opt ::= */ - -2, /* (293) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (294) like_pattern_opt ::= */ - -2, /* (295) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (296) table_name_cond ::= table_name */ - 0, /* (297) from_db_opt ::= */ - -2, /* (298) from_db_opt ::= FROM db_name */ - 0, /* (299) tag_list_opt ::= */ - -1, /* (300) tag_list_opt ::= tag_item */ - -3, /* (301) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (302) tag_item ::= TBNAME */ - -1, /* (303) tag_item ::= QTAGS */ - -1, /* (304) tag_item ::= column_name */ - -2, /* (305) tag_item ::= column_name column_alias */ - -3, /* (306) tag_item ::= column_name AS column_alias */ - 0, /* (307) db_kind_opt ::= */ - -1, /* (308) db_kind_opt ::= USER */ - -1, /* (309) db_kind_opt ::= SYSTEM */ - -8, /* (310) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (311) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (312) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (313) full_index_name ::= index_name */ - -3, /* (314) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (315) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (316) 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, /* (317) func_list ::= func */ - -3, /* (318) func_list ::= func_list NK_COMMA func */ - -4, /* (319) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (320) sma_func_name ::= function_name */ - -1, /* (321) sma_func_name ::= COUNT */ - -1, /* (322) sma_func_name ::= FIRST */ - -1, /* (323) sma_func_name ::= LAST */ - -1, /* (324) sma_func_name ::= LAST_ROW */ - 0, /* (325) sma_stream_opt ::= */ - -3, /* (326) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (327) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (328) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (329) with_meta ::= AS */ - -3, /* (330) with_meta ::= WITH META AS */ - -3, /* (331) with_meta ::= ONLY META AS */ - -6, /* (332) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (333) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (334) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (335) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (336) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (337) cmd ::= DESC full_table_name */ - -2, /* (338) cmd ::= DESCRIBE full_table_name */ - -3, /* (339) cmd ::= RESET QUERY CACHE */ - -4, /* (340) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (341) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (342) analyze_opt ::= */ - -1, /* (343) analyze_opt ::= ANALYZE */ - 0, /* (344) explain_options ::= */ - -3, /* (345) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (346) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (347) 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, /* (348) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (349) agg_func_opt ::= */ - -1, /* (350) agg_func_opt ::= AGGREGATE */ - 0, /* (351) bufsize_opt ::= */ - -2, /* (352) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (353) language_opt ::= */ - -2, /* (354) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (355) or_replace_opt ::= */ - -2, /* (356) or_replace_opt ::= OR REPLACE */ - -6, /* (357) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (358) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (359) full_view_name ::= view_name */ - -3, /* (360) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (361) 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, /* (362) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (363) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (364) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (365) col_list_opt ::= */ - -3, /* (366) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (367) tag_def_or_ref_opt ::= */ - -1, /* (368) tag_def_or_ref_opt ::= tags_def */ - -4, /* (369) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (370) stream_options ::= */ - -3, /* (371) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (372) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (373) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (374) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (375) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (376) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (377) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (378) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (379) subtable_opt ::= */ - -4, /* (380) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (381) ignore_opt ::= */ - -2, /* (382) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (383) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (384) cmd ::= KILL QUERY NK_STRING */ - -3, /* (385) cmd ::= KILL TRANSACTION NK_INTEGER */ - -2, /* (386) cmd ::= BALANCE VGROUP */ - -4, /* (387) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -4, /* (388) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (389) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (390) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (391) on_vgroup_id ::= */ - -2, /* (392) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (393) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (394) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (395) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (396) cmd ::= query_or_subquery */ - -1, /* (397) cmd ::= insert_query */ - -7, /* (398) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (399) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (400) literal ::= NK_INTEGER */ - -1, /* (401) literal ::= NK_FLOAT */ - -1, /* (402) literal ::= NK_STRING */ - -1, /* (403) literal ::= NK_BOOL */ - -2, /* (404) literal ::= TIMESTAMP NK_STRING */ - -1, /* (405) literal ::= duration_literal */ - -1, /* (406) literal ::= NULL */ - -1, /* (407) literal ::= NK_QUESTION */ - -1, /* (408) duration_literal ::= NK_VARIABLE */ - -1, /* (409) signed ::= NK_INTEGER */ - -2, /* (410) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (411) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (412) signed ::= NK_FLOAT */ - -2, /* (413) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (414) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (415) signed_literal ::= signed */ - -1, /* (416) signed_literal ::= NK_STRING */ - -1, /* (417) signed_literal ::= NK_BOOL */ - -2, /* (418) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (419) signed_literal ::= duration_literal */ - -1, /* (420) signed_literal ::= NULL */ - -1, /* (421) signed_literal ::= literal_func */ - -1, /* (422) signed_literal ::= NK_QUESTION */ - -1, /* (423) literal_list ::= signed_literal */ - -3, /* (424) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (425) db_name ::= NK_ID */ - -1, /* (426) table_name ::= NK_ID */ - -1, /* (427) column_name ::= NK_ID */ - -1, /* (428) function_name ::= NK_ID */ - -1, /* (429) view_name ::= NK_ID */ - -1, /* (430) table_alias ::= NK_ID */ - -1, /* (431) column_alias ::= NK_ID */ - -1, /* (432) column_alias ::= NK_ALIAS */ - -1, /* (433) user_name ::= NK_ID */ - -1, /* (434) topic_name ::= NK_ID */ - -1, /* (435) stream_name ::= NK_ID */ - -1, /* (436) cgroup_name ::= NK_ID */ - -1, /* (437) index_name ::= NK_ID */ - -1, /* (438) expr_or_subquery ::= expression */ - -1, /* (439) expression ::= literal */ - -1, /* (440) expression ::= pseudo_column */ - -1, /* (441) expression ::= column_reference */ - -1, /* (442) expression ::= function_expression */ - -1, /* (443) expression ::= case_when_expression */ - -3, /* (444) expression ::= NK_LP expression NK_RP */ - -2, /* (445) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (446) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (447) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (448) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (449) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (450) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (451) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (452) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (453) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (454) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (455) expression_list ::= expr_or_subquery */ - -3, /* (456) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (457) column_reference ::= column_name */ - -3, /* (458) column_reference ::= table_name NK_DOT column_name */ - -1, /* (459) column_reference ::= NK_ALIAS */ - -3, /* (460) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (461) pseudo_column ::= ROWTS */ - -1, /* (462) pseudo_column ::= TBNAME */ - -3, /* (463) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (464) pseudo_column ::= QSTART */ - -1, /* (465) pseudo_column ::= QEND */ - -1, /* (466) pseudo_column ::= QDURATION */ - -1, /* (467) pseudo_column ::= WSTART */ - -1, /* (468) pseudo_column ::= WEND */ - -1, /* (469) pseudo_column ::= WDURATION */ - -1, /* (470) pseudo_column ::= IROWTS */ - -1, /* (471) pseudo_column ::= ISFILLED */ - -1, /* (472) pseudo_column ::= QTAGS */ - -4, /* (473) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (474) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (475) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (476) function_expression ::= literal_func */ - -3, /* (477) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (478) literal_func ::= NOW */ - -1, /* (479) noarg_func ::= NOW */ - -1, /* (480) noarg_func ::= TODAY */ - -1, /* (481) noarg_func ::= TIMEZONE */ - -1, /* (482) noarg_func ::= DATABASE */ - -1, /* (483) noarg_func ::= CLIENT_VERSION */ - -1, /* (484) noarg_func ::= SERVER_VERSION */ - -1, /* (485) noarg_func ::= SERVER_STATUS */ - -1, /* (486) noarg_func ::= CURRENT_USER */ - -1, /* (487) noarg_func ::= USER */ - -1, /* (488) star_func ::= COUNT */ - -1, /* (489) star_func ::= FIRST */ - -1, /* (490) star_func ::= LAST */ - -1, /* (491) star_func ::= LAST_ROW */ - -1, /* (492) star_func_para_list ::= NK_STAR */ - -1, /* (493) star_func_para_list ::= other_para_list */ - -1, /* (494) other_para_list ::= star_func_para */ - -3, /* (495) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (496) star_func_para ::= expr_or_subquery */ - -3, /* (497) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (498) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (499) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (500) when_then_list ::= when_then_expr */ - -2, /* (501) when_then_list ::= when_then_list when_then_expr */ - -4, /* (502) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (503) case_when_else_opt ::= */ - -2, /* (504) case_when_else_opt ::= ELSE common_expression */ - -3, /* (505) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (506) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (507) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (508) predicate ::= expr_or_subquery IS NULL */ - -4, /* (509) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (510) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (511) compare_op ::= NK_LT */ - -1, /* (512) compare_op ::= NK_GT */ - -1, /* (513) compare_op ::= NK_LE */ - -1, /* (514) compare_op ::= NK_GE */ - -1, /* (515) compare_op ::= NK_NE */ - -1, /* (516) compare_op ::= NK_EQ */ - -1, /* (517) compare_op ::= LIKE */ - -2, /* (518) compare_op ::= NOT LIKE */ - -1, /* (519) compare_op ::= MATCH */ - -1, /* (520) compare_op ::= NMATCH */ - -1, /* (521) compare_op ::= CONTAINS */ - -1, /* (522) in_op ::= IN */ - -2, /* (523) in_op ::= NOT IN */ - -3, /* (524) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (525) boolean_value_expression ::= boolean_primary */ - -2, /* (526) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (527) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (528) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (529) boolean_primary ::= predicate */ - -3, /* (530) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (531) common_expression ::= expr_or_subquery */ - -1, /* (532) common_expression ::= boolean_value_expression */ - 0, /* (533) from_clause_opt ::= */ - -2, /* (534) from_clause_opt ::= FROM table_reference_list */ - -1, /* (535) table_reference_list ::= table_reference */ - -3, /* (536) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (537) table_reference ::= table_primary */ - -1, /* (538) table_reference ::= joined_table */ - -2, /* (539) table_primary ::= table_name alias_opt */ - -4, /* (540) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (541) table_primary ::= subquery alias_opt */ - -1, /* (542) table_primary ::= parenthesized_joined_table */ - 0, /* (543) alias_opt ::= */ - -1, /* (544) alias_opt ::= table_alias */ - -2, /* (545) alias_opt ::= AS table_alias */ - -3, /* (546) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (547) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (548) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (549) join_type ::= */ - -1, /* (550) join_type ::= INNER */ - -14, /* (551) 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, /* (552) hint_list ::= */ - -1, /* (553) hint_list ::= NK_HINT */ - 0, /* (554) tag_mode_opt ::= */ - -1, /* (555) tag_mode_opt ::= TAGS */ - 0, /* (556) set_quantifier_opt ::= */ - -1, /* (557) set_quantifier_opt ::= DISTINCT */ - -1, /* (558) set_quantifier_opt ::= ALL */ - -1, /* (559) select_list ::= select_item */ - -3, /* (560) select_list ::= select_list NK_COMMA select_item */ - -1, /* (561) select_item ::= NK_STAR */ - -1, /* (562) select_item ::= common_expression */ - -2, /* (563) select_item ::= common_expression column_alias */ - -3, /* (564) select_item ::= common_expression AS column_alias */ - -3, /* (565) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (566) where_clause_opt ::= */ - -2, /* (567) where_clause_opt ::= WHERE search_condition */ - 0, /* (568) partition_by_clause_opt ::= */ - -3, /* (569) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (570) partition_list ::= partition_item */ - -3, /* (571) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (572) partition_item ::= expr_or_subquery */ - -2, /* (573) partition_item ::= expr_or_subquery column_alias */ - -3, /* (574) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (575) twindow_clause_opt ::= */ - -6, /* (576) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (577) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (578) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (579) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (580) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (581) sliding_opt ::= */ - -4, /* (582) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (583) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (584) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (585) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (586) fill_opt ::= */ - -4, /* (587) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (588) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (589) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (590) fill_mode ::= NONE */ - -1, /* (591) fill_mode ::= PREV */ - -1, /* (592) fill_mode ::= NULL */ - -1, /* (593) fill_mode ::= NULL_F */ - -1, /* (594) fill_mode ::= LINEAR */ - -1, /* (595) fill_mode ::= NEXT */ - 0, /* (596) group_by_clause_opt ::= */ - -3, /* (597) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (598) group_by_list ::= expr_or_subquery */ - -3, /* (599) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (600) having_clause_opt ::= */ - -2, /* (601) having_clause_opt ::= HAVING search_condition */ - 0, /* (602) range_opt ::= */ - -6, /* (603) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (604) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (605) every_opt ::= */ - -4, /* (606) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (607) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (608) query_simple ::= query_specification */ - -1, /* (609) query_simple ::= union_query_expression */ - -4, /* (610) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (611) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (612) query_simple_or_subquery ::= query_simple */ - -1, /* (613) query_simple_or_subquery ::= subquery */ - -1, /* (614) query_or_subquery ::= query_expression */ - -1, /* (615) query_or_subquery ::= subquery */ - 0, /* (616) order_by_clause_opt ::= */ - -3, /* (617) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (618) slimit_clause_opt ::= */ - -2, /* (619) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (620) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (621) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (622) limit_clause_opt ::= */ - -2, /* (623) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (624) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (625) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (626) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (627) subquery ::= NK_LP subquery NK_RP */ - -1, /* (628) search_condition ::= common_expression */ - -1, /* (629) sort_specification_list ::= sort_specification */ - -3, /* (630) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (631) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (632) ordering_specification_opt ::= */ - -1, /* (633) ordering_specification_opt ::= ASC */ - -1, /* (634) ordering_specification_opt ::= DESC */ - 0, /* (635) null_ordering_opt ::= */ - -2, /* (636) null_ordering_opt ::= NULLS FIRST */ - -2, /* (637) null_ordering_opt ::= NULLS LAST */ + -3, /* (152) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 0, /* (153) speed_opt ::= */ + -2, /* (154) speed_opt ::= BWLIMIT NK_INTEGER */ + 0, /* (155) start_opt ::= */ + -3, /* (156) start_opt ::= START WITH NK_INTEGER */ + -3, /* (157) start_opt ::= START WITH NK_STRING */ + -4, /* (158) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 0, /* (159) end_opt ::= */ + -3, /* (160) end_opt ::= END WITH NK_INTEGER */ + -3, /* (161) end_opt ::= END WITH NK_STRING */ + -4, /* (162) end_opt ::= END WITH TIMESTAMP NK_STRING */ + -9, /* (163) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + -3, /* (164) cmd ::= CREATE TABLE multi_create_clause */ + -9, /* (165) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + -3, /* (166) cmd ::= DROP TABLE multi_drop_clause */ + -4, /* (167) cmd ::= DROP STABLE exists_opt full_table_name */ + -3, /* (168) cmd ::= ALTER TABLE alter_table_clause */ + -3, /* (169) cmd ::= ALTER STABLE alter_table_clause */ + -2, /* (170) alter_table_clause ::= full_table_name alter_table_options */ + -5, /* (171) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + -4, /* (172) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + -5, /* (173) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + -5, /* (174) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + -5, /* (175) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + -4, /* (176) alter_table_clause ::= full_table_name DROP TAG column_name */ + -5, /* (177) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + -5, /* (178) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + -6, /* (179) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + -1, /* (180) multi_create_clause ::= create_subtable_clause */ + -2, /* (181) multi_create_clause ::= multi_create_clause create_subtable_clause */ + -10, /* (182) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + -1, /* (183) multi_drop_clause ::= drop_table_clause */ + -3, /* (184) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + -2, /* (185) drop_table_clause ::= exists_opt full_table_name */ + 0, /* (186) specific_cols_opt ::= */ + -3, /* (187) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + -1, /* (188) full_table_name ::= table_name */ + -3, /* (189) full_table_name ::= db_name NK_DOT table_name */ + -1, /* (190) column_def_list ::= column_def */ + -3, /* (191) column_def_list ::= column_def_list NK_COMMA column_def */ + -2, /* (192) column_def ::= column_name type_name */ + -1, /* (193) type_name ::= BOOL */ + -1, /* (194) type_name ::= TINYINT */ + -1, /* (195) type_name ::= SMALLINT */ + -1, /* (196) type_name ::= INT */ + -1, /* (197) type_name ::= INTEGER */ + -1, /* (198) type_name ::= BIGINT */ + -1, /* (199) type_name ::= FLOAT */ + -1, /* (200) type_name ::= DOUBLE */ + -4, /* (201) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (202) type_name ::= TIMESTAMP */ + -4, /* (203) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (204) type_name ::= TINYINT UNSIGNED */ + -2, /* (205) type_name ::= SMALLINT UNSIGNED */ + -2, /* (206) type_name ::= INT UNSIGNED */ + -2, /* (207) type_name ::= BIGINT UNSIGNED */ + -1, /* (208) type_name ::= JSON */ + -4, /* (209) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (210) type_name ::= MEDIUMBLOB */ + -1, /* (211) type_name ::= BLOB */ + -4, /* (212) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (213) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (214) type_name ::= DECIMAL */ + -4, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (216) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (217) tags_def_opt ::= */ + -1, /* (218) tags_def_opt ::= tags_def */ + -4, /* (219) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 0, /* (220) table_options ::= */ + -3, /* (221) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (222) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (223) table_options ::= table_options WATERMARK duration_list */ + -5, /* (224) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (225) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (226) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (227) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (228) alter_table_options ::= alter_table_option */ + -2, /* (229) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (230) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (231) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (232) duration_list ::= duration_literal */ + -3, /* (233) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (234) rollup_func_list ::= rollup_func_name */ + -3, /* (235) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (236) rollup_func_name ::= function_name */ + -1, /* (237) rollup_func_name ::= FIRST */ + -1, /* (238) rollup_func_name ::= LAST */ + -1, /* (239) col_name_list ::= col_name */ + -3, /* (240) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (241) col_name ::= column_name */ + -2, /* (242) cmd ::= SHOW DNODES */ + -2, /* (243) cmd ::= SHOW USERS */ + -3, /* (244) cmd ::= SHOW USER PRIVILEGES */ + -3, /* (245) cmd ::= SHOW db_kind_opt DATABASES */ + -4, /* (246) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (247) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (248) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (249) cmd ::= SHOW MNODES */ + -2, /* (250) cmd ::= SHOW QNODES */ + -2, /* (251) cmd ::= SHOW FUNCTIONS */ + -5, /* (252) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (253) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (254) cmd ::= SHOW STREAMS */ + -2, /* (255) cmd ::= SHOW ACCOUNTS */ + -2, /* (256) cmd ::= SHOW APPS */ + -2, /* (257) cmd ::= SHOW CONNECTIONS */ + -2, /* (258) cmd ::= SHOW LICENCES */ + -2, /* (259) cmd ::= SHOW GRANTS */ + -4, /* (260) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (261) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (262) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (263) cmd ::= SHOW QUERIES */ + -2, /* (264) cmd ::= SHOW SCORES */ + -2, /* (265) cmd ::= SHOW TOPICS */ + -2, /* (266) cmd ::= SHOW VARIABLES */ + -3, /* (267) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (268) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (269) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (270) cmd ::= SHOW BNODES */ + -2, /* (271) cmd ::= SHOW SNODES */ + -2, /* (272) cmd ::= SHOW CLUSTER */ + -2, /* (273) cmd ::= SHOW TRANSACTIONS */ + -4, /* (274) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (275) cmd ::= SHOW CONSUMERS */ + -2, /* (276) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (277) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (278) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (280) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (281) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (282) cmd ::= SHOW VNODES */ + -3, /* (283) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (284) cmd ::= SHOW CLUSTER ALIVE */ + -3, /* (285) cmd ::= SHOW db_name_cond_opt VIEWS */ + -4, /* (286) cmd ::= SHOW CREATE VIEW full_table_name */ + 0, /* (287) table_kind_db_name_cond_opt ::= */ + -1, /* (288) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (289) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (290) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (291) table_kind ::= NORMAL */ + -1, /* (292) table_kind ::= CHILD */ + 0, /* (293) db_name_cond_opt ::= */ + -2, /* (294) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (295) like_pattern_opt ::= */ + -2, /* (296) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (297) table_name_cond ::= table_name */ + 0, /* (298) from_db_opt ::= */ + -2, /* (299) from_db_opt ::= FROM db_name */ + 0, /* (300) tag_list_opt ::= */ + -1, /* (301) tag_list_opt ::= tag_item */ + -3, /* (302) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (303) tag_item ::= TBNAME */ + -1, /* (304) tag_item ::= QTAGS */ + -1, /* (305) tag_item ::= column_name */ + -2, /* (306) tag_item ::= column_name column_alias */ + -3, /* (307) tag_item ::= column_name AS column_alias */ + 0, /* (308) db_kind_opt ::= */ + -1, /* (309) db_kind_opt ::= USER */ + -1, /* (310) db_kind_opt ::= SYSTEM */ + -8, /* (311) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (312) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (313) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (314) full_index_name ::= index_name */ + -3, /* (315) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (316) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (317) 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, /* (318) func_list ::= func */ + -3, /* (319) func_list ::= func_list NK_COMMA func */ + -4, /* (320) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (321) sma_func_name ::= function_name */ + -1, /* (322) sma_func_name ::= COUNT */ + -1, /* (323) sma_func_name ::= FIRST */ + -1, /* (324) sma_func_name ::= LAST */ + -1, /* (325) sma_func_name ::= LAST_ROW */ + 0, /* (326) sma_stream_opt ::= */ + -3, /* (327) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (328) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (329) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (330) with_meta ::= AS */ + -3, /* (331) with_meta ::= WITH META AS */ + -3, /* (332) with_meta ::= ONLY META AS */ + -6, /* (333) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (334) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (336) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (337) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (338) cmd ::= DESC full_table_name */ + -2, /* (339) cmd ::= DESCRIBE full_table_name */ + -3, /* (340) cmd ::= RESET QUERY CACHE */ + -4, /* (341) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (342) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (343) analyze_opt ::= */ + -1, /* (344) analyze_opt ::= ANALYZE */ + 0, /* (345) explain_options ::= */ + -3, /* (346) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (347) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (348) 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, /* (349) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (350) agg_func_opt ::= */ + -1, /* (351) agg_func_opt ::= AGGREGATE */ + 0, /* (352) bufsize_opt ::= */ + -2, /* (353) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (354) language_opt ::= */ + -2, /* (355) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (356) or_replace_opt ::= */ + -2, /* (357) or_replace_opt ::= OR REPLACE */ + -6, /* (358) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + -4, /* (359) cmd ::= DROP VIEW exists_opt full_view_name */ + -1, /* (360) full_view_name ::= view_name */ + -3, /* (361) full_view_name ::= db_name NK_DOT view_name */ + -12, /* (362) 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, /* (363) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (364) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (365) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (366) col_list_opt ::= */ + -3, /* (367) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (368) tag_def_or_ref_opt ::= */ + -1, /* (369) tag_def_or_ref_opt ::= tags_def */ + -4, /* (370) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 0, /* (371) stream_options ::= */ + -3, /* (372) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (373) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (374) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (375) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (376) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (377) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (378) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (379) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (380) subtable_opt ::= */ + -4, /* (381) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (382) ignore_opt ::= */ + -2, /* (383) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (384) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (385) cmd ::= KILL QUERY NK_STRING */ + -3, /* (386) cmd ::= KILL TRANSACTION NK_INTEGER */ + -2, /* (387) cmd ::= BALANCE VGROUP */ + -4, /* (388) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -4, /* (389) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (390) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (391) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (392) on_vgroup_id ::= */ + -2, /* (393) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (394) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (395) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (396) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (397) cmd ::= query_or_subquery */ + -1, /* (398) cmd ::= insert_query */ + -7, /* (399) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (400) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (401) literal ::= NK_INTEGER */ + -1, /* (402) literal ::= NK_FLOAT */ + -1, /* (403) literal ::= NK_STRING */ + -1, /* (404) literal ::= NK_BOOL */ + -2, /* (405) literal ::= TIMESTAMP NK_STRING */ + -1, /* (406) literal ::= duration_literal */ + -1, /* (407) literal ::= NULL */ + -1, /* (408) literal ::= NK_QUESTION */ + -1, /* (409) duration_literal ::= NK_VARIABLE */ + -1, /* (410) signed ::= NK_INTEGER */ + -2, /* (411) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (412) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (413) signed ::= NK_FLOAT */ + -2, /* (414) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (415) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (416) signed_literal ::= signed */ + -1, /* (417) signed_literal ::= NK_STRING */ + -1, /* (418) signed_literal ::= NK_BOOL */ + -2, /* (419) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (420) signed_literal ::= duration_literal */ + -1, /* (421) signed_literal ::= NULL */ + -1, /* (422) signed_literal ::= literal_func */ + -1, /* (423) signed_literal ::= NK_QUESTION */ + -1, /* (424) literal_list ::= signed_literal */ + -3, /* (425) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (426) db_name ::= NK_ID */ + -1, /* (427) table_name ::= NK_ID */ + -1, /* (428) column_name ::= NK_ID */ + -1, /* (429) function_name ::= NK_ID */ + -1, /* (430) view_name ::= NK_ID */ + -1, /* (431) table_alias ::= NK_ID */ + -1, /* (432) column_alias ::= NK_ID */ + -1, /* (433) column_alias ::= NK_ALIAS */ + -1, /* (434) user_name ::= NK_ID */ + -1, /* (435) topic_name ::= NK_ID */ + -1, /* (436) stream_name ::= NK_ID */ + -1, /* (437) cgroup_name ::= NK_ID */ + -1, /* (438) index_name ::= NK_ID */ + -1, /* (439) expr_or_subquery ::= expression */ + -1, /* (440) expression ::= literal */ + -1, /* (441) expression ::= pseudo_column */ + -1, /* (442) expression ::= column_reference */ + -1, /* (443) expression ::= function_expression */ + -1, /* (444) expression ::= case_when_expression */ + -3, /* (445) expression ::= NK_LP expression NK_RP */ + -2, /* (446) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (447) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (448) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (449) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (450) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (451) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (452) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (453) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (454) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (455) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (456) expression_list ::= expr_or_subquery */ + -3, /* (457) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (458) column_reference ::= column_name */ + -3, /* (459) column_reference ::= table_name NK_DOT column_name */ + -1, /* (460) column_reference ::= NK_ALIAS */ + -3, /* (461) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (462) pseudo_column ::= ROWTS */ + -1, /* (463) pseudo_column ::= TBNAME */ + -3, /* (464) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (465) pseudo_column ::= QSTART */ + -1, /* (466) pseudo_column ::= QEND */ + -1, /* (467) pseudo_column ::= QDURATION */ + -1, /* (468) pseudo_column ::= WSTART */ + -1, /* (469) pseudo_column ::= WEND */ + -1, /* (470) pseudo_column ::= WDURATION */ + -1, /* (471) pseudo_column ::= IROWTS */ + -1, /* (472) pseudo_column ::= ISFILLED */ + -1, /* (473) pseudo_column ::= QTAGS */ + -4, /* (474) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (475) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (476) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (477) function_expression ::= literal_func */ + -3, /* (478) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (479) literal_func ::= NOW */ + -1, /* (480) noarg_func ::= NOW */ + -1, /* (481) noarg_func ::= TODAY */ + -1, /* (482) noarg_func ::= TIMEZONE */ + -1, /* (483) noarg_func ::= DATABASE */ + -1, /* (484) noarg_func ::= CLIENT_VERSION */ + -1, /* (485) noarg_func ::= SERVER_VERSION */ + -1, /* (486) noarg_func ::= SERVER_STATUS */ + -1, /* (487) noarg_func ::= CURRENT_USER */ + -1, /* (488) noarg_func ::= USER */ + -1, /* (489) star_func ::= COUNT */ + -1, /* (490) star_func ::= FIRST */ + -1, /* (491) star_func ::= LAST */ + -1, /* (492) star_func ::= LAST_ROW */ + -1, /* (493) star_func_para_list ::= NK_STAR */ + -1, /* (494) star_func_para_list ::= other_para_list */ + -1, /* (495) other_para_list ::= star_func_para */ + -3, /* (496) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (497) star_func_para ::= expr_or_subquery */ + -3, /* (498) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (499) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (500) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (501) when_then_list ::= when_then_expr */ + -2, /* (502) when_then_list ::= when_then_list when_then_expr */ + -4, /* (503) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (504) case_when_else_opt ::= */ + -2, /* (505) case_when_else_opt ::= ELSE common_expression */ + -3, /* (506) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (507) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (508) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (509) predicate ::= expr_or_subquery IS NULL */ + -4, /* (510) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (511) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (512) compare_op ::= NK_LT */ + -1, /* (513) compare_op ::= NK_GT */ + -1, /* (514) compare_op ::= NK_LE */ + -1, /* (515) compare_op ::= NK_GE */ + -1, /* (516) compare_op ::= NK_NE */ + -1, /* (517) compare_op ::= NK_EQ */ + -1, /* (518) compare_op ::= LIKE */ + -2, /* (519) compare_op ::= NOT LIKE */ + -1, /* (520) compare_op ::= MATCH */ + -1, /* (521) compare_op ::= NMATCH */ + -1, /* (522) compare_op ::= CONTAINS */ + -1, /* (523) in_op ::= IN */ + -2, /* (524) in_op ::= NOT IN */ + -3, /* (525) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (526) boolean_value_expression ::= boolean_primary */ + -2, /* (527) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (528) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (529) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (530) boolean_primary ::= predicate */ + -3, /* (531) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (532) common_expression ::= expr_or_subquery */ + -1, /* (533) common_expression ::= boolean_value_expression */ + 0, /* (534) from_clause_opt ::= */ + -2, /* (535) from_clause_opt ::= FROM table_reference_list */ + -1, /* (536) table_reference_list ::= table_reference */ + -3, /* (537) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (538) table_reference ::= table_primary */ + -1, /* (539) table_reference ::= joined_table */ + -2, /* (540) table_primary ::= table_name alias_opt */ + -4, /* (541) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (542) table_primary ::= subquery alias_opt */ + -1, /* (543) table_primary ::= parenthesized_joined_table */ + 0, /* (544) alias_opt ::= */ + -1, /* (545) alias_opt ::= table_alias */ + -2, /* (546) alias_opt ::= AS table_alias */ + -3, /* (547) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (548) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (549) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (550) join_type ::= */ + -1, /* (551) join_type ::= INNER */ + -14, /* (552) 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, /* (553) hint_list ::= */ + -1, /* (554) hint_list ::= NK_HINT */ + 0, /* (555) tag_mode_opt ::= */ + -1, /* (556) tag_mode_opt ::= TAGS */ + 0, /* (557) set_quantifier_opt ::= */ + -1, /* (558) set_quantifier_opt ::= DISTINCT */ + -1, /* (559) set_quantifier_opt ::= ALL */ + -1, /* (560) select_list ::= select_item */ + -3, /* (561) select_list ::= select_list NK_COMMA select_item */ + -1, /* (562) select_item ::= NK_STAR */ + -1, /* (563) select_item ::= common_expression */ + -2, /* (564) select_item ::= common_expression column_alias */ + -3, /* (565) select_item ::= common_expression AS column_alias */ + -3, /* (566) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (567) where_clause_opt ::= */ + -2, /* (568) where_clause_opt ::= WHERE search_condition */ + 0, /* (569) partition_by_clause_opt ::= */ + -3, /* (570) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (571) partition_list ::= partition_item */ + -3, /* (572) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (573) partition_item ::= expr_or_subquery */ + -2, /* (574) partition_item ::= expr_or_subquery column_alias */ + -3, /* (575) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (576) twindow_clause_opt ::= */ + -6, /* (577) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (578) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (579) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (580) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (581) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (582) sliding_opt ::= */ + -4, /* (583) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (584) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (585) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (586) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (587) fill_opt ::= */ + -4, /* (588) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (589) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (590) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (591) fill_mode ::= NONE */ + -1, /* (592) fill_mode ::= PREV */ + -1, /* (593) fill_mode ::= NULL */ + -1, /* (594) fill_mode ::= NULL_F */ + -1, /* (595) fill_mode ::= LINEAR */ + -1, /* (596) fill_mode ::= NEXT */ + 0, /* (597) group_by_clause_opt ::= */ + -3, /* (598) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (599) group_by_list ::= expr_or_subquery */ + -3, /* (600) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (601) having_clause_opt ::= */ + -2, /* (602) having_clause_opt ::= HAVING search_condition */ + 0, /* (603) range_opt ::= */ + -6, /* (604) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (605) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (606) every_opt ::= */ + -4, /* (607) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (608) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (609) query_simple ::= query_specification */ + -1, /* (610) query_simple ::= union_query_expression */ + -4, /* (611) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (612) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (613) query_simple_or_subquery ::= query_simple */ + -1, /* (614) query_simple_or_subquery ::= subquery */ + -1, /* (615) query_or_subquery ::= query_expression */ + -1, /* (616) query_or_subquery ::= subquery */ + 0, /* (617) order_by_clause_opt ::= */ + -3, /* (618) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (619) slimit_clause_opt ::= */ + -2, /* (620) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (621) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (622) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (623) limit_clause_opt ::= */ + -2, /* (624) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (625) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (626) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (627) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (628) subquery ::= NK_LP subquery NK_RP */ + -1, /* (629) search_condition ::= common_expression */ + -1, /* (630) sort_specification_list ::= sort_specification */ + -3, /* (631) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (632) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (633) ordering_specification_opt ::= */ + -1, /* (634) ordering_specification_opt ::= ASC */ + -1, /* (635) ordering_specification_opt ::= DESC */ + 0, /* (636) null_ordering_opt ::= */ + -2, /* (637) null_ordering_opt ::= NULLS FIRST */ + -2, /* (638) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4785,20 +4788,20 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy106 = yymsp[0].minor.yy106; } break; case 27: /* white_list_opt ::= */ - case 185: /* specific_cols_opt ::= */ yytestcase(yyruleno==185); - case 216: /* tags_def_opt ::= */ yytestcase(yyruleno==216); - case 299: /* tag_list_opt ::= */ yytestcase(yyruleno==299); - case 365: /* col_list_opt ::= */ yytestcase(yyruleno==365); - case 367: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==367); - case 568: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==568); - case 596: /* group_by_clause_opt ::= */ yytestcase(yyruleno==596); - case 616: /* order_by_clause_opt ::= */ yytestcase(yyruleno==616); + case 186: /* specific_cols_opt ::= */ yytestcase(yyruleno==186); + case 217: /* tags_def_opt ::= */ yytestcase(yyruleno==217); + case 300: /* tag_list_opt ::= */ yytestcase(yyruleno==300); + case 366: /* col_list_opt ::= */ yytestcase(yyruleno==366); + case 368: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==368); + case 569: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==569); + case 597: /* group_by_clause_opt ::= */ yytestcase(yyruleno==597); + case 617: /* order_by_clause_opt ::= */ yytestcase(yyruleno==617); { yymsp[1].minor.yy106 = NULL; } break; case 28: /* white_list_opt ::= white_list */ - case 217: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==217); - case 368: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==368); - case 493: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==493); + case 218: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==218); + case 369: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==369); + case 494: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==494); { yylhsminor.yy106 = yymsp[0].minor.yy106; } yymsp[0].minor.yy106 = yylhsminor.yy106; break; @@ -4879,27 +4882,27 @@ static YYACTIONTYPE yy_reduce( yymsp[0].minor.yy573 = yylhsminor.yy573; break; case 52: /* with_opt ::= */ - case 154: /* start_opt ::= */ yytestcase(yyruleno==154); - case 158: /* end_opt ::= */ yytestcase(yyruleno==158); - case 294: /* like_pattern_opt ::= */ yytestcase(yyruleno==294); - case 379: /* subtable_opt ::= */ yytestcase(yyruleno==379); - case 503: /* case_when_else_opt ::= */ yytestcase(yyruleno==503); - case 533: /* from_clause_opt ::= */ yytestcase(yyruleno==533); - case 566: /* where_clause_opt ::= */ yytestcase(yyruleno==566); - case 575: /* twindow_clause_opt ::= */ yytestcase(yyruleno==575); - case 581: /* sliding_opt ::= */ yytestcase(yyruleno==581); - case 586: /* fill_opt ::= */ yytestcase(yyruleno==586); - case 600: /* having_clause_opt ::= */ yytestcase(yyruleno==600); - case 602: /* range_opt ::= */ yytestcase(yyruleno==602); - case 605: /* every_opt ::= */ yytestcase(yyruleno==605); - case 618: /* slimit_clause_opt ::= */ yytestcase(yyruleno==618); - case 622: /* limit_clause_opt ::= */ yytestcase(yyruleno==622); + case 155: /* start_opt ::= */ yytestcase(yyruleno==155); + case 159: /* end_opt ::= */ yytestcase(yyruleno==159); + case 295: /* like_pattern_opt ::= */ yytestcase(yyruleno==295); + case 380: /* subtable_opt ::= */ yytestcase(yyruleno==380); + case 504: /* case_when_else_opt ::= */ yytestcase(yyruleno==504); + case 534: /* from_clause_opt ::= */ yytestcase(yyruleno==534); + case 567: /* where_clause_opt ::= */ yytestcase(yyruleno==567); + case 576: /* twindow_clause_opt ::= */ yytestcase(yyruleno==576); + case 582: /* sliding_opt ::= */ yytestcase(yyruleno==582); + case 587: /* fill_opt ::= */ yytestcase(yyruleno==587); + case 601: /* having_clause_opt ::= */ yytestcase(yyruleno==601); + case 603: /* range_opt ::= */ yytestcase(yyruleno==603); + case 606: /* every_opt ::= */ yytestcase(yyruleno==606); + case 619: /* slimit_clause_opt ::= */ yytestcase(yyruleno==619); + case 623: /* limit_clause_opt ::= */ yytestcase(yyruleno==623); { yymsp[1].minor.yy80 = NULL; } break; case 53: /* with_opt ::= WITH search_condition */ - case 534: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==534); - case 567: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==567); - case 601: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==601); + case 535: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==535); + case 568: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==568); + case 602: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==602); { yymsp[-1].minor.yy80 = yymsp[0].minor.yy80; } break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint */ @@ -4938,56 +4941,56 @@ static YYACTIONTYPE yy_reduce( case 65: /* dnode_endpoint ::= NK_STRING */ case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66); case 67: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==67); - case 321: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==321); - case 322: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==322); - case 323: /* sma_func_name ::= LAST */ yytestcase(yyruleno==323); - case 324: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==324); - case 425: /* db_name ::= NK_ID */ yytestcase(yyruleno==425); - case 426: /* table_name ::= NK_ID */ yytestcase(yyruleno==426); - case 427: /* column_name ::= NK_ID */ yytestcase(yyruleno==427); - case 428: /* function_name ::= NK_ID */ yytestcase(yyruleno==428); - case 429: /* view_name ::= NK_ID */ yytestcase(yyruleno==429); - case 430: /* table_alias ::= NK_ID */ yytestcase(yyruleno==430); - case 431: /* column_alias ::= NK_ID */ yytestcase(yyruleno==431); - case 432: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==432); - case 433: /* user_name ::= NK_ID */ yytestcase(yyruleno==433); - case 434: /* topic_name ::= NK_ID */ yytestcase(yyruleno==434); - case 435: /* stream_name ::= NK_ID */ yytestcase(yyruleno==435); - case 436: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==436); - case 437: /* index_name ::= NK_ID */ yytestcase(yyruleno==437); - case 479: /* noarg_func ::= NOW */ yytestcase(yyruleno==479); - case 480: /* noarg_func ::= TODAY */ yytestcase(yyruleno==480); - case 481: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==481); - case 482: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==482); - case 483: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==483); - case 484: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==484); - case 485: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==485); - case 486: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==486); - case 487: /* noarg_func ::= USER */ yytestcase(yyruleno==487); - case 488: /* star_func ::= COUNT */ yytestcase(yyruleno==488); - case 489: /* star_func ::= FIRST */ yytestcase(yyruleno==489); - case 490: /* star_func ::= LAST */ yytestcase(yyruleno==490); - case 491: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==491); + case 322: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==322); + case 323: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==323); + case 324: /* sma_func_name ::= LAST */ yytestcase(yyruleno==324); + case 325: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==325); + case 426: /* db_name ::= NK_ID */ yytestcase(yyruleno==426); + case 427: /* table_name ::= NK_ID */ yytestcase(yyruleno==427); + case 428: /* column_name ::= NK_ID */ yytestcase(yyruleno==428); + case 429: /* function_name ::= NK_ID */ yytestcase(yyruleno==429); + case 430: /* view_name ::= NK_ID */ yytestcase(yyruleno==430); + case 431: /* table_alias ::= NK_ID */ yytestcase(yyruleno==431); + case 432: /* column_alias ::= NK_ID */ yytestcase(yyruleno==432); + case 433: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==433); + case 434: /* user_name ::= NK_ID */ yytestcase(yyruleno==434); + case 435: /* topic_name ::= NK_ID */ yytestcase(yyruleno==435); + case 436: /* stream_name ::= NK_ID */ yytestcase(yyruleno==436); + case 437: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==437); + case 438: /* index_name ::= NK_ID */ yytestcase(yyruleno==438); + case 480: /* noarg_func ::= NOW */ yytestcase(yyruleno==480); + case 481: /* noarg_func ::= TODAY */ yytestcase(yyruleno==481); + case 482: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==482); + case 483: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==483); + case 484: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==484); + case 485: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==485); + case 486: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==486); + case 487: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==487); + case 488: /* noarg_func ::= USER */ yytestcase(yyruleno==488); + case 489: /* star_func ::= COUNT */ yytestcase(yyruleno==489); + case 490: /* star_func ::= FIRST */ yytestcase(yyruleno==490); + case 491: /* star_func ::= LAST */ yytestcase(yyruleno==491); + case 492: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==492); { yylhsminor.yy785 = yymsp[0].minor.yy0; } yymsp[0].minor.yy785 = yylhsminor.yy785; break; case 68: /* force_opt ::= */ case 92: /* not_exists_opt ::= */ yytestcase(yyruleno==92); case 94: /* exists_opt ::= */ yytestcase(yyruleno==94); - case 342: /* analyze_opt ::= */ yytestcase(yyruleno==342); - case 349: /* agg_func_opt ::= */ yytestcase(yyruleno==349); - case 355: /* or_replace_opt ::= */ yytestcase(yyruleno==355); - case 381: /* ignore_opt ::= */ yytestcase(yyruleno==381); - case 554: /* tag_mode_opt ::= */ yytestcase(yyruleno==554); - case 556: /* set_quantifier_opt ::= */ yytestcase(yyruleno==556); + case 343: /* analyze_opt ::= */ yytestcase(yyruleno==343); + case 350: /* agg_func_opt ::= */ yytestcase(yyruleno==350); + case 356: /* or_replace_opt ::= */ yytestcase(yyruleno==356); + case 382: /* ignore_opt ::= */ yytestcase(yyruleno==382); + case 555: /* tag_mode_opt ::= */ yytestcase(yyruleno==555); + case 557: /* set_quantifier_opt ::= */ yytestcase(yyruleno==557); { yymsp[1].minor.yy923 = false; } break; case 69: /* force_opt ::= FORCE */ case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70); - case 343: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==343); - case 350: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==350); - case 555: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==555); - case 557: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==557); + case 344: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==344); + case 351: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==351); + case 556: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==556); + case 558: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==558); { yymsp[0].minor.yy923 = true; } break; case 71: /* cmd ::= ALTER LOCAL NK_STRING */ @@ -5054,8 +5057,8 @@ static YYACTIONTYPE yy_reduce( { yymsp[-2].minor.yy923 = true; } break; case 93: /* exists_opt ::= IF EXISTS */ - case 356: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==356); - case 382: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==382); + case 357: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==357); + case 383: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==383); { yymsp[-1].minor.yy923 = true; } break; case 95: /* db_options ::= */ @@ -5254,7 +5257,7 @@ static YYACTIONTYPE yy_reduce( yymsp[0].minor.yy106 = yylhsminor.yy106; break; case 146: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 394: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==394); + case 395: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==395); { yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy106 = yylhsminor.yy106; break; @@ -5267,761 +5270,762 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy106 = yylhsminor.yy106; break; case 149: /* retention_list ::= retention */ - case 179: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==179); - case 182: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==182); - case 189: /* column_def_list ::= column_def */ yytestcase(yyruleno==189); - case 233: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==233); - case 238: /* col_name_list ::= col_name */ yytestcase(yyruleno==238); - case 300: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==300); - case 317: /* func_list ::= func */ yytestcase(yyruleno==317); - case 423: /* literal_list ::= signed_literal */ yytestcase(yyruleno==423); - case 494: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==494); - case 500: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==500); - case 559: /* select_list ::= select_item */ yytestcase(yyruleno==559); - case 570: /* partition_list ::= partition_item */ yytestcase(yyruleno==570); - case 629: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==629); + case 180: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==180); + case 183: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==183); + case 190: /* column_def_list ::= column_def */ yytestcase(yyruleno==190); + case 234: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==234); + case 239: /* col_name_list ::= col_name */ yytestcase(yyruleno==239); + case 301: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==301); + case 318: /* func_list ::= func */ yytestcase(yyruleno==318); + case 424: /* literal_list ::= signed_literal */ yytestcase(yyruleno==424); + case 495: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==495); + case 501: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==501); + case 560: /* select_list ::= select_item */ yytestcase(yyruleno==560); + case 571: /* partition_list ::= partition_item */ yytestcase(yyruleno==571); + case 630: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==630); { yylhsminor.yy106 = createNodeList(pCxt, yymsp[0].minor.yy80); } yymsp[0].minor.yy106 = yylhsminor.yy106; break; case 150: /* retention_list ::= retention_list NK_COMMA retention */ - case 183: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==183); - case 190: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==190); - case 234: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==234); - case 239: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==239); - case 301: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==301); - case 318: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==318); - case 424: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==424); - case 495: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==495); - case 560: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==560); - case 571: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==571); - case 630: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==630); + case 184: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==184); + case 191: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==191); + case 235: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==235); + case 240: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==240); + case 302: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==302); + case 319: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==319); + case 425: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==425); + case 496: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==496); + case 561: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==561); + case 572: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==572); + case 631: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==631); { yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, yymsp[0].minor.yy80); } yymsp[-2].minor.yy106 = yylhsminor.yy106; break; case 151: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + case 152: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==152); { yylhsminor.yy80 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 152: /* speed_opt ::= */ - case 351: /* bufsize_opt ::= */ yytestcase(yyruleno==351); + case 153: /* speed_opt ::= */ + case 352: /* bufsize_opt ::= */ yytestcase(yyruleno==352); { yymsp[1].minor.yy982 = 0; } break; - case 153: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 352: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==352); + case 154: /* speed_opt ::= BWLIMIT NK_INTEGER */ + case 353: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==353); { yymsp[-1].minor.yy982 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 155: /* start_opt ::= START WITH NK_INTEGER */ - case 159: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==159); + case 156: /* start_opt ::= START WITH NK_INTEGER */ + case 160: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==160); { yymsp[-2].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 156: /* start_opt ::= START WITH NK_STRING */ - case 160: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==160); + case 157: /* start_opt ::= START WITH NK_STRING */ + case 161: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==161); { yymsp[-2].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 157: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 161: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==161); + case 158: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 162: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==162); { yymsp[-3].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 162: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 164: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==164); + case 163: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 165: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==165); { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy923, yymsp[-5].minor.yy80, yymsp[-3].minor.yy106, yymsp[-1].minor.yy106, yymsp[0].minor.yy80); } break; - case 163: /* cmd ::= CREATE TABLE multi_create_clause */ + case 164: /* cmd ::= CREATE TABLE multi_create_clause */ { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy106); } break; - case 165: /* cmd ::= DROP TABLE multi_drop_clause */ + case 166: /* cmd ::= DROP TABLE multi_drop_clause */ { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy106); } break; - case 166: /* cmd ::= DROP STABLE exists_opt full_table_name */ + case 167: /* cmd ::= DROP STABLE exists_opt full_table_name */ { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } break; - case 167: /* cmd ::= ALTER TABLE alter_table_clause */ - case 396: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==396); - case 397: /* cmd ::= insert_query */ yytestcase(yyruleno==397); + case 168: /* cmd ::= ALTER TABLE alter_table_clause */ + case 397: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==397); + case 398: /* cmd ::= insert_query */ yytestcase(yyruleno==398); { pCxt->pRootNode = yymsp[0].minor.yy80; } break; - case 168: /* cmd ::= ALTER STABLE alter_table_clause */ + case 169: /* cmd ::= ALTER STABLE alter_table_clause */ { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy80); } break; - case 169: /* alter_table_clause ::= full_table_name alter_table_options */ + case 170: /* alter_table_clause ::= full_table_name alter_table_options */ { yylhsminor.yy80 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 170: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + case 171: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ { yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 171: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ + case 172: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ { yylhsminor.yy80 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy80, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy785); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 172: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + case 173: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ { yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 173: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + case 174: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ { yylhsminor.yy80 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 174: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + case 175: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ { yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 175: /* alter_table_clause ::= full_table_name DROP TAG column_name */ + case 176: /* alter_table_clause ::= full_table_name DROP TAG column_name */ { yylhsminor.yy80 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy80, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy785); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 176: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + case 177: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ { yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 177: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + case 178: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ { yylhsminor.yy80 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 178: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + case 179: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ { yylhsminor.yy80 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy80, &yymsp[-2].minor.yy785, yymsp[0].minor.yy80); } yymsp[-5].minor.yy80 = yylhsminor.yy80; break; - case 180: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 501: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==501); + case 181: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 502: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==502); { yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-1].minor.yy106, yymsp[0].minor.yy80); } yymsp[-1].minor.yy106 = yylhsminor.yy106; break; - case 181: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + case 182: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ { yylhsminor.yy80 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy923, yymsp[-8].minor.yy80, yymsp[-6].minor.yy80, yymsp[-5].minor.yy106, yymsp[-2].minor.yy106, yymsp[0].minor.yy80); } yymsp[-9].minor.yy80 = yylhsminor.yy80; break; - case 184: /* drop_table_clause ::= exists_opt full_table_name */ + case 185: /* drop_table_clause ::= exists_opt full_table_name */ { yylhsminor.yy80 = createDropTableClause(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 186: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 366: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==366); + case 187: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 367: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==367); { yymsp[-2].minor.yy106 = yymsp[-1].minor.yy106; } break; - case 187: /* full_table_name ::= table_name */ + case 188: /* full_table_name ::= table_name */ { yylhsminor.yy80 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy785, NULL); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 188: /* full_table_name ::= db_name NK_DOT table_name */ + case 189: /* full_table_name ::= db_name NK_DOT table_name */ { yylhsminor.yy80 = createRealTableNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785, NULL); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 191: /* column_def ::= column_name type_name */ + case 192: /* column_def ::= column_name type_name */ { yylhsminor.yy80 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292, NULL); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 192: /* type_name ::= BOOL */ + case 193: /* type_name ::= BOOL */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 193: /* type_name ::= TINYINT */ + case 194: /* type_name ::= TINYINT */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 194: /* type_name ::= SMALLINT */ + case 195: /* type_name ::= SMALLINT */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 195: /* type_name ::= INT */ - case 196: /* type_name ::= INTEGER */ yytestcase(yyruleno==196); + case 196: /* type_name ::= INT */ + case 197: /* type_name ::= INTEGER */ yytestcase(yyruleno==197); { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 197: /* type_name ::= BIGINT */ + case 198: /* type_name ::= BIGINT */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 198: /* type_name ::= FLOAT */ + case 199: /* type_name ::= FLOAT */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 199: /* type_name ::= DOUBLE */ + case 200: /* type_name ::= DOUBLE */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 200: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + case 201: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 201: /* type_name ::= TIMESTAMP */ + case 202: /* type_name ::= TIMESTAMP */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 202: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + case 203: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 203: /* type_name ::= TINYINT UNSIGNED */ + case 204: /* type_name ::= TINYINT UNSIGNED */ { yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 204: /* type_name ::= SMALLINT UNSIGNED */ + case 205: /* type_name ::= SMALLINT UNSIGNED */ { yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 205: /* type_name ::= INT UNSIGNED */ + case 206: /* type_name ::= INT UNSIGNED */ { yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 206: /* type_name ::= BIGINT UNSIGNED */ + case 207: /* type_name ::= BIGINT UNSIGNED */ { yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 207: /* type_name ::= JSON */ + case 208: /* type_name ::= JSON */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 208: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + case 209: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 209: /* type_name ::= MEDIUMBLOB */ + case 210: /* type_name ::= MEDIUMBLOB */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 210: /* type_name ::= BLOB */ + case 211: /* type_name ::= BLOB */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 211: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + case 212: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 212: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + case 213: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; - case 213: /* type_name ::= DECIMAL */ + case 214: /* type_name ::= DECIMAL */ { yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 214: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + case 215: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy292 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 215: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + case 216: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy292 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 218: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 369: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==369); + case 219: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 370: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==370); { yymsp[-3].minor.yy106 = yymsp[-1].minor.yy106; } break; - case 219: /* table_options ::= */ + case 220: /* table_options ::= */ { yymsp[1].minor.yy80 = createDefaultTableOptions(pCxt); } break; - case 220: /* table_options ::= table_options COMMENT NK_STRING */ + case 221: /* table_options ::= table_options COMMENT NK_STRING */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 221: /* table_options ::= table_options MAX_DELAY duration_list */ + case 222: /* table_options ::= table_options MAX_DELAY duration_list */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy106); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 222: /* table_options ::= table_options WATERMARK duration_list */ + case 223: /* table_options ::= table_options WATERMARK duration_list */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy106); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 223: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + case 224: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-4].minor.yy80, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy106); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 224: /* table_options ::= table_options TTL NK_INTEGER */ + case 225: /* table_options ::= table_options TTL NK_INTEGER */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 225: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + case 226: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-4].minor.yy80, TABLE_OPTION_SMA, yymsp[-1].minor.yy106); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 226: /* table_options ::= table_options DELETE_MARK duration_list */ + case 227: /* table_options ::= table_options DELETE_MARK duration_list */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy106); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 227: /* alter_table_options ::= alter_table_option */ + case 228: /* alter_table_options ::= alter_table_option */ { yylhsminor.yy80 = createAlterTableOptions(pCxt); yylhsminor.yy80 = setTableOption(pCxt, yylhsminor.yy80, yymsp[0].minor.yy455.type, &yymsp[0].minor.yy455.val); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 228: /* alter_table_options ::= alter_table_options alter_table_option */ + case 229: /* alter_table_options ::= alter_table_options alter_table_option */ { yylhsminor.yy80 = setTableOption(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy455.type, &yymsp[0].minor.yy455.val); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 229: /* alter_table_option ::= COMMENT NK_STRING */ + case 230: /* alter_table_option ::= COMMENT NK_STRING */ { yymsp[-1].minor.yy455.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } break; - case 230: /* alter_table_option ::= TTL NK_INTEGER */ + case 231: /* alter_table_option ::= TTL NK_INTEGER */ { yymsp[-1].minor.yy455.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } break; - case 231: /* duration_list ::= duration_literal */ - case 455: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==455); + case 232: /* duration_list ::= duration_literal */ + case 456: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==456); { yylhsminor.yy106 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } yymsp[0].minor.yy106 = yylhsminor.yy106; break; - case 232: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 456: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==456); + case 233: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 457: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==457); { yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } yymsp[-2].minor.yy106 = yylhsminor.yy106; break; - case 235: /* rollup_func_name ::= function_name */ + case 236: /* rollup_func_name ::= function_name */ { yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[0].minor.yy785, NULL); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 236: /* rollup_func_name ::= FIRST */ - case 237: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==237); - case 303: /* tag_item ::= QTAGS */ yytestcase(yyruleno==303); + case 237: /* rollup_func_name ::= FIRST */ + case 238: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==238); + case 304: /* tag_item ::= QTAGS */ yytestcase(yyruleno==304); { yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 240: /* col_name ::= column_name */ - case 304: /* tag_item ::= column_name */ yytestcase(yyruleno==304); + case 241: /* col_name ::= column_name */ + case 305: /* tag_item ::= column_name */ yytestcase(yyruleno==305); { yylhsminor.yy80 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy785); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 241: /* cmd ::= SHOW DNODES */ + case 242: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 242: /* cmd ::= SHOW USERS */ + case 243: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 243: /* cmd ::= SHOW USER PRIVILEGES */ + case 244: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 244: /* cmd ::= SHOW db_kind_opt DATABASES */ + case 245: /* cmd ::= SHOW db_kind_opt DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy459); } break; - case 245: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + case 246: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ { pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy709, yymsp[0].minor.yy80, OP_TYPE_LIKE); } break; - case 246: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + case 247: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, OP_TYPE_LIKE); } break; - case 247: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ + case 248: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy80, NULL, OP_TYPE_LIKE); } break; - case 248: /* cmd ::= SHOW MNODES */ + case 249: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 249: /* cmd ::= SHOW QNODES */ + case 250: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 250: /* cmd ::= SHOW FUNCTIONS */ + case 251: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 251: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + case 252: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy80, yymsp[-1].minor.yy80, OP_TYPE_EQUAL); } break; - case 252: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + case 253: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy785), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785), OP_TYPE_EQUAL); } break; - case 253: /* cmd ::= SHOW STREAMS */ + case 254: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 254: /* cmd ::= SHOW ACCOUNTS */ + case 255: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 255: /* cmd ::= SHOW APPS */ + case 256: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 256: /* cmd ::= SHOW CONNECTIONS */ + case 257: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 257: /* cmd ::= SHOW LICENCES */ - case 258: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==258); + case 258: /* cmd ::= SHOW LICENCES */ + case 259: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==259); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 259: /* cmd ::= SHOW CREATE DATABASE db_name */ + case 260: /* cmd ::= SHOW CREATE DATABASE db_name */ { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy785); } break; - case 260: /* cmd ::= SHOW CREATE TABLE full_table_name */ + case 261: /* cmd ::= SHOW CREATE TABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy80); } break; - case 261: /* cmd ::= SHOW CREATE STABLE full_table_name */ + case 262: /* cmd ::= SHOW CREATE STABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy80); } break; - case 262: /* cmd ::= SHOW QUERIES */ + case 263: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 263: /* cmd ::= SHOW SCORES */ + case 264: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 264: /* cmd ::= SHOW TOPICS */ + case 265: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 265: /* cmd ::= SHOW VARIABLES */ - case 266: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==266); + case 266: /* cmd ::= SHOW VARIABLES */ + case 267: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==267); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 267: /* cmd ::= SHOW LOCAL VARIABLES */ + case 268: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 268: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + case 269: /* 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.yy80); } break; - case 269: /* cmd ::= SHOW BNODES */ + case 270: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 270: /* cmd ::= SHOW SNODES */ + case 271: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 271: /* cmd ::= SHOW CLUSTER */ + case 272: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 272: /* cmd ::= SHOW TRANSACTIONS */ + case 273: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 273: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + case 274: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy80); } break; - case 274: /* cmd ::= SHOW CONSUMERS */ + case 275: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 275: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 276: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 276: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + case 277: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy80, yymsp[-1].minor.yy80, OP_TYPE_EQUAL); } break; - case 277: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + case 278: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy785), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785), OP_TYPE_EQUAL); } break; - case 278: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + case 279: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80, yymsp[-3].minor.yy106); } break; - case 279: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + case 280: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy785), yymsp[-4].minor.yy106); } break; - case 280: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + case 281: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 281: /* cmd ::= SHOW VNODES */ + case 282: /* cmd ::= SHOW VNODES */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } break; - case 282: /* cmd ::= SHOW db_name_cond_opt ALIVE */ + case 283: /* cmd ::= SHOW db_name_cond_opt ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy80, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 283: /* cmd ::= SHOW CLUSTER ALIVE */ + case 284: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 284: /* cmd ::= SHOW db_name_cond_opt VIEWS */ + case 285: /* cmd ::= SHOW db_name_cond_opt VIEWS */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-1].minor.yy80, NULL, OP_TYPE_LIKE); } break; - case 285: /* cmd ::= SHOW CREATE VIEW full_table_name */ + case 286: /* cmd ::= SHOW CREATE VIEW full_table_name */ { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy80); } break; - case 286: /* table_kind_db_name_cond_opt ::= */ + case 287: /* table_kind_db_name_cond_opt ::= */ { yymsp[1].minor.yy709.kind = SHOW_KIND_ALL; yymsp[1].minor.yy709.dbName = nil_token; } break; - case 287: /* table_kind_db_name_cond_opt ::= table_kind */ + case 288: /* table_kind_db_name_cond_opt ::= table_kind */ { yylhsminor.yy709.kind = yymsp[0].minor.yy459; yylhsminor.yy709.dbName = nil_token; } yymsp[0].minor.yy709 = yylhsminor.yy709; break; - case 288: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ + case 289: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy709.kind = SHOW_KIND_ALL; yylhsminor.yy709.dbName = yymsp[-1].minor.yy785; } yymsp[-1].minor.yy709 = yylhsminor.yy709; break; - case 289: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + case 290: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ { yylhsminor.yy709.kind = yymsp[-2].minor.yy459; yylhsminor.yy709.dbName = yymsp[-1].minor.yy785; } yymsp[-2].minor.yy709 = yylhsminor.yy709; break; - case 290: /* table_kind ::= NORMAL */ + case 291: /* table_kind ::= NORMAL */ { yymsp[0].minor.yy459 = SHOW_KIND_TABLES_NORMAL; } break; - case 291: /* table_kind ::= CHILD */ + case 292: /* table_kind ::= CHILD */ { yymsp[0].minor.yy459 = SHOW_KIND_TABLES_CHILD; } break; - case 292: /* db_name_cond_opt ::= */ - case 297: /* from_db_opt ::= */ yytestcase(yyruleno==297); + case 293: /* db_name_cond_opt ::= */ + case 298: /* from_db_opt ::= */ yytestcase(yyruleno==298); { yymsp[1].minor.yy80 = createDefaultDatabaseCondValue(pCxt); } break; - case 293: /* db_name_cond_opt ::= db_name NK_DOT */ + case 294: /* db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy80 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy785); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 295: /* like_pattern_opt ::= LIKE NK_STRING */ + case 296: /* like_pattern_opt ::= LIKE NK_STRING */ { yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 296: /* table_name_cond ::= table_name */ + case 297: /* table_name_cond ::= table_name */ { yylhsminor.yy80 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 298: /* from_db_opt ::= FROM db_name */ + case 299: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy80 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785); } break; - case 302: /* tag_item ::= TBNAME */ + case 303: /* tag_item ::= TBNAME */ { yylhsminor.yy80 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 305: /* tag_item ::= column_name column_alias */ + case 306: /* tag_item ::= column_name column_alias */ { yylhsminor.yy80 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy785), &yymsp[0].minor.yy785); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 306: /* tag_item ::= column_name AS column_alias */ + case 307: /* tag_item ::= column_name AS column_alias */ { yylhsminor.yy80 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy785), &yymsp[0].minor.yy785); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 307: /* db_kind_opt ::= */ + case 308: /* db_kind_opt ::= */ { yymsp[1].minor.yy459 = SHOW_KIND_ALL; } break; - case 308: /* db_kind_opt ::= USER */ + case 309: /* db_kind_opt ::= USER */ { yymsp[0].minor.yy459 = SHOW_KIND_DATABASES_USER; } break; - case 309: /* db_kind_opt ::= SYSTEM */ + case 310: /* db_kind_opt ::= SYSTEM */ { yymsp[0].minor.yy459 = SHOW_KIND_DATABASES_SYSTEM; } break; - case 310: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + case 311: /* 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.yy923, yymsp[-3].minor.yy80, yymsp[-1].minor.yy80, NULL, yymsp[0].minor.yy80); } break; - case 311: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + case 312: /* 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.yy923, yymsp[-5].minor.yy80, yymsp[-3].minor.yy80, yymsp[-1].minor.yy106, NULL); } break; - case 312: /* cmd ::= DROP INDEX exists_opt full_index_name */ + case 313: /* cmd ::= DROP INDEX exists_opt full_index_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } break; - case 313: /* full_index_name ::= index_name */ + case 314: /* full_index_name ::= index_name */ { yylhsminor.yy80 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy785); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 314: /* full_index_name ::= db_name NK_DOT index_name */ + case 315: /* full_index_name ::= db_name NK_DOT index_name */ { yylhsminor.yy80 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 315: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + case 316: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-9].minor.yy80 = createIndexOption(pCxt, yymsp[-7].minor.yy106, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } break; - case 316: /* 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 */ + case 317: /* 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.yy80 = createIndexOption(pCxt, yymsp[-9].minor.yy106, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } break; - case 319: /* func ::= sma_func_name NK_LP expression_list NK_RP */ + case 320: /* func ::= sma_func_name NK_LP expression_list NK_RP */ { yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[-3].minor.yy785, yymsp[-1].minor.yy106); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 320: /* sma_func_name ::= function_name */ - case 544: /* alias_opt ::= table_alias */ yytestcase(yyruleno==544); + case 321: /* sma_func_name ::= function_name */ + case 545: /* alias_opt ::= table_alias */ yytestcase(yyruleno==545); { yylhsminor.yy785 = yymsp[0].minor.yy785; } yymsp[0].minor.yy785 = yylhsminor.yy785; break; - case 325: /* sma_stream_opt ::= */ - case 370: /* stream_options ::= */ yytestcase(yyruleno==370); + case 326: /* sma_stream_opt ::= */ + case 371: /* stream_options ::= */ yytestcase(yyruleno==371); { yymsp[1].minor.yy80 = createStreamOptions(pCxt); } break; - case 326: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 327: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy80)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 327: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + case 328: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy80)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 328: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + case 329: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy80)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 329: /* with_meta ::= AS */ + case 330: /* with_meta ::= AS */ { yymsp[0].minor.yy982 = 0; } break; - case 330: /* with_meta ::= WITH META AS */ + case 331: /* with_meta ::= WITH META AS */ { yymsp[-2].minor.yy982 = 1; } break; - case 331: /* with_meta ::= ONLY META AS */ + case 332: /* with_meta ::= ONLY META AS */ { yymsp[-2].minor.yy982 = 2; } break; - case 332: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + case 333: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy923, &yymsp[-2].minor.yy785, yymsp[0].minor.yy80); } break; - case 333: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + case 334: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy923, &yymsp[-3].minor.yy785, &yymsp[0].minor.yy785, yymsp[-2].minor.yy982); } break; - case 334: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + case 335: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy923, &yymsp[-4].minor.yy785, yymsp[-1].minor.yy80, yymsp[-3].minor.yy982, yymsp[0].minor.yy80); } break; - case 335: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 336: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } break; - case 336: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + case 337: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy923, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785); } break; - case 337: /* cmd ::= DESC full_table_name */ - case 338: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==338); + case 338: /* cmd ::= DESC full_table_name */ + case 339: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==339); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy80); } break; - case 339: /* cmd ::= RESET QUERY CACHE */ + case 340: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 340: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 341: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==341); + case 341: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 342: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==342); { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy923, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } break; - case 344: /* explain_options ::= */ + case 345: /* explain_options ::= */ { yymsp[1].minor.yy80 = createDefaultExplainOptions(pCxt); } break; - case 345: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 346: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy80 = setExplainVerbose(pCxt, yymsp[-2].minor.yy80, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 346: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 347: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy80 = setExplainRatio(pCxt, yymsp[-2].minor.yy80, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 347: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + case 348: /* 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.yy923, yymsp[-9].minor.yy923, &yymsp[-6].minor.yy785, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy292, yymsp[-1].minor.yy982, &yymsp[0].minor.yy785, yymsp[-10].minor.yy923); } break; - case 348: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 349: /* cmd ::= DROP FUNCTION exists_opt function_name */ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } break; - case 353: /* language_opt ::= */ - case 391: /* on_vgroup_id ::= */ yytestcase(yyruleno==391); + case 354: /* language_opt ::= */ + case 392: /* on_vgroup_id ::= */ yytestcase(yyruleno==392); { yymsp[1].minor.yy785 = nil_token; } break; - case 354: /* language_opt ::= LANGUAGE NK_STRING */ - case 392: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==392); + case 355: /* language_opt ::= LANGUAGE NK_STRING */ + case 393: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==393); { yymsp[-1].minor.yy785 = yymsp[0].minor.yy0; } break; - case 357: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + case 358: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy923, yymsp[-2].minor.yy80, &yymsp[-1].minor.yy0, yymsp[0].minor.yy80); } break; - case 358: /* cmd ::= DROP VIEW exists_opt full_view_name */ + case 359: /* cmd ::= DROP VIEW exists_opt full_view_name */ { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } break; - case 359: /* full_view_name ::= view_name */ + case 360: /* full_view_name ::= view_name */ { yylhsminor.yy80 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy785); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 360: /* full_view_name ::= db_name NK_DOT view_name */ + case 361: /* full_view_name ::= db_name NK_DOT view_name */ { yylhsminor.yy80 = createViewNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 361: /* 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 */ + case 362: /* 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.yy923, &yymsp[-8].minor.yy785, yymsp[-5].minor.yy80, yymsp[-7].minor.yy80, yymsp[-3].minor.yy106, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, yymsp[-4].minor.yy106); } break; - case 362: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 363: /* cmd ::= DROP STREAM exists_opt stream_name */ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } break; - case 363: /* cmd ::= PAUSE STREAM exists_opt stream_name */ + case 364: /* cmd ::= PAUSE STREAM exists_opt stream_name */ { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } break; - case 364: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + case 365: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy923, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } break; - case 371: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 372: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==372); + case 372: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 373: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==373); { yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 373: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 374: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ { yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-3].minor.yy80, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 374: /* stream_options ::= stream_options WATERMARK duration_literal */ + case 375: /* stream_options ::= stream_options WATERMARK duration_literal */ { yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 375: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + case 376: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ { yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-3].minor.yy80, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 376: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + case 377: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ { yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 377: /* stream_options ::= stream_options DELETE_MARK duration_literal */ + case 378: /* stream_options ::= stream_options DELETE_MARK duration_literal */ { yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 378: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + case 379: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ { yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-3].minor.yy80, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 380: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 582: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==582); - case 606: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==606); + case 381: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 583: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==583); + case 607: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==607); { yymsp[-3].minor.yy80 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy80); } break; - case 383: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 384: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 384: /* cmd ::= KILL QUERY NK_STRING */ + case 385: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 385: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 386: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 386: /* cmd ::= BALANCE VGROUP */ + case 387: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 387: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + case 388: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy785); } break; - case 388: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 389: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 389: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + case 390: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy106); } break; - case 390: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 391: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 393: /* dnode_list ::= DNODE NK_INTEGER */ + case 394: /* dnode_list ::= DNODE NK_INTEGER */ { yymsp[-1].minor.yy106 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 395: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ + case 396: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } break; - case 398: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + case 399: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ { yymsp[-6].minor.yy80 = createInsertStmt(pCxt, yymsp[-4].minor.yy80, yymsp[-2].minor.yy106, yymsp[0].minor.yy80); } break; - case 399: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ + case 400: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ { yymsp[-3].minor.yy80 = createInsertStmt(pCxt, yymsp[-1].minor.yy80, NULL, yymsp[0].minor.yy80); } break; - case 400: /* literal ::= NK_INTEGER */ + case 401: /* literal ::= NK_INTEGER */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 401: /* literal ::= NK_FLOAT */ + case 402: /* literal ::= NK_FLOAT */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 402: /* literal ::= NK_STRING */ + case 403: /* literal ::= NK_STRING */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 403: /* literal ::= NK_BOOL */ + case 404: /* literal ::= NK_BOOL */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 404: /* literal ::= TIMESTAMP NK_STRING */ + case 405: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 405: /* literal ::= duration_literal */ - case 415: /* signed_literal ::= signed */ yytestcase(yyruleno==415); - case 438: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==438); - case 439: /* expression ::= literal */ yytestcase(yyruleno==439); - case 441: /* expression ::= column_reference */ yytestcase(yyruleno==441); - case 442: /* expression ::= function_expression */ yytestcase(yyruleno==442); - case 443: /* expression ::= case_when_expression */ yytestcase(yyruleno==443); - case 476: /* function_expression ::= literal_func */ yytestcase(yyruleno==476); - case 525: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==525); - case 529: /* boolean_primary ::= predicate */ yytestcase(yyruleno==529); - case 531: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==531); - case 532: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==532); - case 535: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==535); - case 537: /* table_reference ::= table_primary */ yytestcase(yyruleno==537); - case 538: /* table_reference ::= joined_table */ yytestcase(yyruleno==538); - case 542: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==542); - case 608: /* query_simple ::= query_specification */ yytestcase(yyruleno==608); - case 609: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==609); - case 612: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==612); - case 614: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==614); + case 406: /* literal ::= duration_literal */ + case 416: /* signed_literal ::= signed */ yytestcase(yyruleno==416); + case 439: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==439); + case 440: /* expression ::= literal */ yytestcase(yyruleno==440); + case 442: /* expression ::= column_reference */ yytestcase(yyruleno==442); + case 443: /* expression ::= function_expression */ yytestcase(yyruleno==443); + case 444: /* expression ::= case_when_expression */ yytestcase(yyruleno==444); + case 477: /* function_expression ::= literal_func */ yytestcase(yyruleno==477); + case 526: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==526); + case 530: /* boolean_primary ::= predicate */ yytestcase(yyruleno==530); + case 532: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==532); + case 533: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==533); + case 536: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==536); + case 538: /* table_reference ::= table_primary */ yytestcase(yyruleno==538); + case 539: /* table_reference ::= joined_table */ yytestcase(yyruleno==539); + case 543: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==543); + case 609: /* query_simple ::= query_specification */ yytestcase(yyruleno==609); + case 610: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==610); + case 613: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==613); + case 615: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==615); { yylhsminor.yy80 = yymsp[0].minor.yy80; } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 406: /* literal ::= NULL */ + case 407: /* literal ::= NULL */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 407: /* literal ::= NK_QUESTION */ + case 408: /* literal ::= NK_QUESTION */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 408: /* duration_literal ::= NK_VARIABLE */ - case 583: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==583); - case 584: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==584); - case 585: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==585); + case 409: /* duration_literal ::= NK_VARIABLE */ + case 584: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==584); + case 585: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==585); + case 586: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==586); { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 409: /* signed ::= NK_INTEGER */ + case 410: /* signed ::= NK_INTEGER */ { yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 410: /* signed ::= NK_PLUS NK_INTEGER */ + case 411: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 411: /* signed ::= NK_MINUS NK_INTEGER */ + case 412: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -6029,14 +6033,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 412: /* signed ::= NK_FLOAT */ + case 413: /* signed ::= NK_FLOAT */ { yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 413: /* signed ::= NK_PLUS NK_FLOAT */ + case 414: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 414: /* signed ::= NK_MINUS NK_FLOAT */ + case 415: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -6044,61 +6048,61 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 416: /* signed_literal ::= NK_STRING */ + case 417: /* signed_literal ::= NK_STRING */ { yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 417: /* signed_literal ::= NK_BOOL */ + case 418: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 418: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 419: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 419: /* signed_literal ::= duration_literal */ - case 421: /* signed_literal ::= literal_func */ yytestcase(yyruleno==421); - case 496: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==496); - case 562: /* select_item ::= common_expression */ yytestcase(yyruleno==562); - case 572: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==572); - case 613: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==613); - case 615: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==615); - case 628: /* search_condition ::= common_expression */ yytestcase(yyruleno==628); + case 420: /* signed_literal ::= duration_literal */ + case 422: /* signed_literal ::= literal_func */ yytestcase(yyruleno==422); + case 497: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==497); + case 563: /* select_item ::= common_expression */ yytestcase(yyruleno==563); + case 573: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==573); + case 614: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==614); + case 616: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==616); + case 629: /* search_condition ::= common_expression */ yytestcase(yyruleno==629); { yylhsminor.yy80 = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 420: /* signed_literal ::= NULL */ + case 421: /* signed_literal ::= NULL */ { yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 422: /* signed_literal ::= NK_QUESTION */ + case 423: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy80 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 440: /* expression ::= pseudo_column */ + case 441: /* expression ::= pseudo_column */ { yylhsminor.yy80 = yymsp[0].minor.yy80; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy80, true); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 444: /* expression ::= NK_LP expression NK_RP */ - case 530: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==530); - case 627: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==627); + case 445: /* expression ::= NK_LP expression NK_RP */ + case 531: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==531); + case 628: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==628); { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 445: /* expression ::= NK_PLUS expr_or_subquery */ + case 446: /* expression ::= NK_PLUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 446: /* expression ::= NK_MINUS expr_or_subquery */ + case 447: /* expression ::= NK_MINUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy80), NULL)); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 447: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 448: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6106,7 +6110,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 448: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 449: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6114,7 +6118,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 449: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 450: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6122,7 +6126,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 450: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 451: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6130,7 +6134,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 451: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 452: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6138,14 +6142,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 452: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 453: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 453: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 454: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6153,7 +6157,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 454: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 455: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6161,79 +6165,79 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 457: /* column_reference ::= column_name */ + case 458: /* column_reference ::= column_name */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy785, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy785)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 458: /* column_reference ::= table_name NK_DOT column_name */ + case 459: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785, createColumnNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 459: /* column_reference ::= NK_ALIAS */ + case 460: /* column_reference ::= NK_ALIAS */ { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 460: /* column_reference ::= table_name NK_DOT NK_ALIAS */ + case 461: /* column_reference ::= table_name NK_DOT NK_ALIAS */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 461: /* pseudo_column ::= ROWTS */ - case 462: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==462); - case 464: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==464); - case 465: /* pseudo_column ::= QEND */ yytestcase(yyruleno==465); - case 466: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==466); - case 467: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==467); - case 468: /* pseudo_column ::= WEND */ yytestcase(yyruleno==468); - case 469: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==469); - case 470: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==470); - case 471: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==471); - case 472: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==472); - case 478: /* literal_func ::= NOW */ yytestcase(yyruleno==478); + case 462: /* pseudo_column ::= ROWTS */ + case 463: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==463); + case 465: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==465); + case 466: /* pseudo_column ::= QEND */ yytestcase(yyruleno==466); + case 467: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==467); + case 468: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==468); + case 469: /* pseudo_column ::= WEND */ yytestcase(yyruleno==469); + case 470: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==470); + case 471: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==471); + case 472: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==472); + case 473: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==473); + case 479: /* literal_func ::= NOW */ yytestcase(yyruleno==479); { yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 463: /* pseudo_column ::= table_name NK_DOT TBNAME */ + case 464: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy785)))); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 473: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 474: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==474); + case 474: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 475: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==475); { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy785, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy785, yymsp[-1].minor.yy106)); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 475: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 476: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy292)); } yymsp[-5].minor.yy80 = yylhsminor.yy80; break; - case 477: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 478: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy785, NULL)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 492: /* star_func_para_list ::= NK_STAR */ + case 493: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy106 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy106 = yylhsminor.yy106; break; - case 497: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 565: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==565); + case 498: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 566: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==566); { yylhsminor.yy80 = createColumnNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 498: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ + case 499: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy106, yymsp[-1].minor.yy80)); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 499: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + case 500: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-2].minor.yy106, yymsp[-1].minor.yy80)); } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 502: /* when_then_expr ::= WHEN common_expression THEN common_expression */ + case 503: /* when_then_expr ::= WHEN common_expression THEN common_expression */ { yymsp[-3].minor.yy80 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } break; - case 504: /* case_when_else_opt ::= ELSE common_expression */ + case 505: /* case_when_else_opt ::= ELSE common_expression */ { yymsp[-1].minor.yy80 = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); } break; - case 505: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 510: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==510); + case 506: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 511: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==511); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6241,7 +6245,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 506: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 507: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6249,7 +6253,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy80 = yylhsminor.yy80; break; - case 507: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 508: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6257,71 +6261,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy80 = yylhsminor.yy80; break; - case 508: /* predicate ::= expr_or_subquery IS NULL */ + case 509: /* predicate ::= expr_or_subquery IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), NULL)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 509: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 510: /* predicate ::= expr_or_subquery IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy80); yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL)); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 511: /* compare_op ::= NK_LT */ + case 512: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy428 = OP_TYPE_LOWER_THAN; } break; - case 512: /* compare_op ::= NK_GT */ + case 513: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy428 = OP_TYPE_GREATER_THAN; } break; - case 513: /* compare_op ::= NK_LE */ + case 514: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy428 = OP_TYPE_LOWER_EQUAL; } break; - case 514: /* compare_op ::= NK_GE */ + case 515: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy428 = OP_TYPE_GREATER_EQUAL; } break; - case 515: /* compare_op ::= NK_NE */ + case 516: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy428 = OP_TYPE_NOT_EQUAL; } break; - case 516: /* compare_op ::= NK_EQ */ + case 517: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy428 = OP_TYPE_EQUAL; } break; - case 517: /* compare_op ::= LIKE */ + case 518: /* compare_op ::= LIKE */ { yymsp[0].minor.yy428 = OP_TYPE_LIKE; } break; - case 518: /* compare_op ::= NOT LIKE */ + case 519: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy428 = OP_TYPE_NOT_LIKE; } break; - case 519: /* compare_op ::= MATCH */ + case 520: /* compare_op ::= MATCH */ { yymsp[0].minor.yy428 = OP_TYPE_MATCH; } break; - case 520: /* compare_op ::= NMATCH */ + case 521: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy428 = OP_TYPE_NMATCH; } break; - case 521: /* compare_op ::= CONTAINS */ + case 522: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy428 = OP_TYPE_JSON_CONTAINS; } break; - case 522: /* in_op ::= IN */ + case 523: /* in_op ::= IN */ { yymsp[0].minor.yy428 = OP_TYPE_IN; } break; - case 523: /* in_op ::= NOT IN */ + case 524: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy428 = OP_TYPE_NOT_IN; } break; - case 524: /* in_predicate_value ::= NK_LP literal_list NK_RP */ + case 525: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy106)); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 526: /* boolean_value_expression ::= NOT boolean_primary */ + case 527: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy80), NULL)); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 527: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 528: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6329,7 +6333,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 528: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 529: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); @@ -6337,43 +6341,43 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 536: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 537: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy80 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, NULL); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 539: /* table_primary ::= table_name alias_opt */ + case 540: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy80 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 540: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 541: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy80 = createRealTableNode(pCxt, &yymsp[-3].minor.yy785, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 541: /* table_primary ::= subquery alias_opt */ + case 542: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy80 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80), &yymsp[0].minor.yy785); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 543: /* alias_opt ::= */ + case 544: /* alias_opt ::= */ { yymsp[1].minor.yy785 = nil_token; } break; - case 545: /* alias_opt ::= AS table_alias */ + case 546: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy785 = yymsp[0].minor.yy785; } break; - case 546: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 547: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==547); + case 547: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 548: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==548); { yymsp[-2].minor.yy80 = yymsp[-1].minor.yy80; } break; - case 548: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 549: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy80 = createJoinTableNode(pCxt, yymsp[-4].minor.yy828, yymsp[-5].minor.yy80, yymsp[-2].minor.yy80, yymsp[0].minor.yy80); } yymsp[-5].minor.yy80 = yylhsminor.yy80; break; - case 549: /* join_type ::= */ + case 550: /* join_type ::= */ { yymsp[1].minor.yy828 = JOIN_TYPE_INNER; } break; - case 550: /* join_type ::= INNER */ + case 551: /* join_type ::= INNER */ { yymsp[0].minor.yy828 = JOIN_TYPE_INNER; } break; - case 551: /* 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 552: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { yymsp[-13].minor.yy80 = createSelectStmt(pCxt, yymsp[-11].minor.yy923, yymsp[-9].minor.yy106, yymsp[-8].minor.yy80, yymsp[-12].minor.yy106); yymsp[-13].minor.yy80 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy80, yymsp[-10].minor.yy923); @@ -6387,92 +6391,92 @@ static YYACTIONTYPE yy_reduce( yymsp[-13].minor.yy80 = addFillClause(pCxt, yymsp[-13].minor.yy80, yymsp[-3].minor.yy80); } break; - case 552: /* hint_list ::= */ + case 553: /* hint_list ::= */ { yymsp[1].minor.yy106 = createHintNodeList(pCxt, NULL); } break; - case 553: /* hint_list ::= NK_HINT */ + case 554: /* hint_list ::= NK_HINT */ { yylhsminor.yy106 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy106 = yylhsminor.yy106; break; - case 558: /* set_quantifier_opt ::= ALL */ + case 559: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy923 = false; } break; - case 561: /* select_item ::= NK_STAR */ + case 562: /* select_item ::= NK_STAR */ { yylhsminor.yy80 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy80 = yylhsminor.yy80; break; - case 563: /* select_item ::= common_expression column_alias */ - case 573: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==573); + case 564: /* select_item ::= common_expression column_alias */ + case 574: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==574); { yylhsminor.yy80 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80), &yymsp[0].minor.yy785); } yymsp[-1].minor.yy80 = yylhsminor.yy80; break; - case 564: /* select_item ::= common_expression AS column_alias */ - case 574: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==574); + case 565: /* select_item ::= common_expression AS column_alias */ + case 575: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==575); { yylhsminor.yy80 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), &yymsp[0].minor.yy785); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 569: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 597: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==597); - case 617: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==617); + case 570: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 598: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==598); + case 618: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==618); { yymsp[-2].minor.yy106 = yymsp[0].minor.yy106; } break; - case 576: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + case 577: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ { yymsp[-5].minor.yy80 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } break; - case 577: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + case 578: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy80 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } break; - case 578: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + case 579: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy80 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } break; - case 579: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + case 580: /* 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.yy80 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } break; - case 580: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + case 581: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ { yymsp[-6].minor.yy80 = createEventWindowNode(pCxt, yymsp[-3].minor.yy80, yymsp[0].minor.yy80); } break; - case 587: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 588: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy80 = createFillNode(pCxt, yymsp[-1].minor.yy36, NULL); } break; - case 588: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + case 589: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy80 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy106)); } break; - case 589: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + case 590: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy80 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy106)); } break; - case 590: /* fill_mode ::= NONE */ + case 591: /* fill_mode ::= NONE */ { yymsp[0].minor.yy36 = FILL_MODE_NONE; } break; - case 591: /* fill_mode ::= PREV */ + case 592: /* fill_mode ::= PREV */ { yymsp[0].minor.yy36 = FILL_MODE_PREV; } break; - case 592: /* fill_mode ::= NULL */ + case 593: /* fill_mode ::= NULL */ { yymsp[0].minor.yy36 = FILL_MODE_NULL; } break; - case 593: /* fill_mode ::= NULL_F */ + case 594: /* fill_mode ::= NULL_F */ { yymsp[0].minor.yy36 = FILL_MODE_NULL_F; } break; - case 594: /* fill_mode ::= LINEAR */ + case 595: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy36 = FILL_MODE_LINEAR; } break; - case 595: /* fill_mode ::= NEXT */ + case 596: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy36 = FILL_MODE_NEXT; } break; - case 598: /* group_by_list ::= expr_or_subquery */ + case 599: /* group_by_list ::= expr_or_subquery */ { yylhsminor.yy106 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); } yymsp[0].minor.yy106 = yylhsminor.yy106; break; - case 599: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + case 600: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ { yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); } yymsp[-2].minor.yy106 = yylhsminor.yy106; break; - case 603: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + case 604: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ { yymsp[-5].minor.yy80 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } break; - case 604: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + case 605: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy80 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } break; - case 607: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 608: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy80 = addOrderByClause(pCxt, yymsp[-3].minor.yy80, yymsp[-2].minor.yy106); yylhsminor.yy80 = addSlimitClause(pCxt, yylhsminor.yy80, yymsp[-1].minor.yy80); @@ -6480,50 +6484,50 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 610: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + case 611: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ { yylhsminor.yy80 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy80, yymsp[0].minor.yy80); } yymsp[-3].minor.yy80 = yylhsminor.yy80; break; - case 611: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + case 612: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ { yylhsminor.yy80 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy80, yymsp[0].minor.yy80); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 619: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 623: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==623); + case 620: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 624: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==624); { yymsp[-1].minor.yy80 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 620: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 624: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==624); + case 621: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 625: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==625); { yymsp[-3].minor.yy80 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 621: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 625: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==625); + case 622: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 626: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==626); { yymsp[-3].minor.yy80 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 626: /* subquery ::= NK_LP query_expression NK_RP */ + case 627: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy80); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 631: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + case 632: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ { yylhsminor.yy80 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), yymsp[-1].minor.yy812, yymsp[0].minor.yy763); } yymsp[-2].minor.yy80 = yylhsminor.yy80; break; - case 632: /* ordering_specification_opt ::= */ + case 633: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy812 = ORDER_ASC; } break; - case 633: /* ordering_specification_opt ::= ASC */ + case 634: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy812 = ORDER_ASC; } break; - case 634: /* ordering_specification_opt ::= DESC */ + case 635: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy812 = ORDER_DESC; } break; - case 635: /* null_ordering_opt ::= */ + case 636: /* null_ordering_opt ::= */ { yymsp[1].minor.yy763 = NULL_ORDER_DEFAULT; } break; - case 636: /* null_ordering_opt ::= NULLS FIRST */ + case 637: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy763 = NULL_ORDER_FIRST; } break; - case 637: /* null_ordering_opt ::= NULLS LAST */ + case 638: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy763 = NULL_ORDER_LAST; } break; default: diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 92b2f510b6..0f6aa22050 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -247,7 +247,11 @@ TEST_F(ParserInitialCTest, createDatabase) { for (int32_t i = 0; i < expect.numOfRetensions; ++i) { SRetention* pReten = (SRetention*)taosArrayGet(req.pRetensions, i); SRetention* pExpectReten = (SRetention*)taosArrayGet(expect.pRetensions, i); - ASSERT_EQ(pReten->freq, pExpectReten->freq); + if(i == 0) { + ASSERT_EQ(pReten->freq, 0); + } else { + ASSERT_EQ(pReten->freq, pExpectReten->freq); + } ASSERT_EQ(pReten->keep, pExpectReten->keep); ASSERT_EQ(pReten->freqUnit, pExpectReten->freqUnit); ASSERT_EQ(pReten->keepUnit, pExpectReten->keepUnit); @@ -304,7 +308,7 @@ TEST_F(ParserInitialCTest, createDatabase) { "PAGESIZE 8 " "PRECISION 'ns' " "REPLICA 3 " - "RETENTIONS 15s:7d,1m:21d,15m:500d " + "RETENTIONS -:7d,1m:21d,15m:500d " // "STRICT 'on' " "WAL_LEVEL 2 " "VGROUPS 100 " @@ -340,12 +344,12 @@ TEST_F(ParserInitialCTest, createDatabase) { TEST_F(ParserInitialCTest, createDatabaseSemanticCheck) { useDb("root", "test"); - run("create database db2 retentions 0s:1d", TSDB_CODE_PAR_INVALID_DB_OPTION); - run("create database db2 retentions 10s:0d", TSDB_CODE_PAR_INVALID_DB_OPTION); - run("create database db2 retentions 1w:1d", TSDB_CODE_PAR_INVALID_DB_OPTION); - run("create database db2 retentions 1w:1n", TSDB_CODE_PAR_INVALID_DB_OPTION); - run("create database db2 retentions 15s:7d,15m:21d,10m:500d", TSDB_CODE_PAR_INVALID_DB_OPTION); - run("create database db2 retentions 15s:7d,5m:21d,10m:10d", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("create database db2 retentions -:1d,0s:1d", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("create database db2 retentions -:0d", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("create database db2 retentions -:1d,1w:1d", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("create database db2 retentions -:1n,1w:1d", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("create database db2 retentions -:7d,15m:21d,10m:500d", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("create database db2 retentions -:7d,5m:21d,10m:10d", TSDB_CODE_PAR_INVALID_DB_OPTION); } /* diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 4df7454df8..48886b1eec 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1197,6 +1197,83 @@ int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu return TSDB_CODE_SUCCESS; } +#define TS_FORMAT_MAX_LEN 4096 +int32_t toTimestampFunction(SScalarParam* pInput, int32_t inputNum, SScalarParam* pOutput) { + int64_t ts; + char * tsStr = taosMemoryMalloc(TS_FORMAT_MAX_LEN); + char * format = taosMemoryMalloc(TS_FORMAT_MAX_LEN); + int32_t len, code = TSDB_CODE_SUCCESS; + SArray *formats = NULL; + + for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { + if (colDataIsNull_s(pInput[1].columnData, i) || colDataIsNull_s(pInput[0].columnData, i)) { + colDataSetNULL(pOutput->columnData, i); + continue; + } + + char *tsData = colDataGetData(pInput[0].columnData, i); + char *formatData = colDataGetData(pInput[1].columnData, pInput[1].numOfRows > 1 ? i : 0); + len = TMIN(TS_FORMAT_MAX_LEN - 1, varDataLen(tsData)); + strncpy(tsStr, varDataVal(tsData), len); + tsStr[len] = '\0'; + len = TMIN(TS_FORMAT_MAX_LEN - 1, varDataLen(formatData)); + if (pInput[1].numOfRows > 1 || i == 0) { + strncpy(format, varDataVal(formatData), len); + format[len] = '\0'; + if (formats) { + taosArrayDestroy(formats); + formats = NULL; + } + } + int32_t precision = pOutput->columnData->info.precision; + char errMsg[128] = {0}; + code = taosChar2Ts(format, &formats, tsStr, &ts, precision, errMsg, 128); + if (code) { + qError("func to_timestamp failed %s", errMsg); + code = TSDB_CODE_FUNC_TO_TIMESTAMP_FAILED; + break; + } + colDataSetVal(pOutput->columnData, i, (char *)&ts, false); + } + if (formats) taosArrayDestroy(formats); + taosMemoryFree(tsStr); + taosMemoryFree(format); + return code; +} + +int32_t toCharFunction(SScalarParam* pInput, int32_t inputNum, SScalarParam* pOutput) { + char * format = taosMemoryMalloc(TS_FORMAT_MAX_LEN); + char * out = taosMemoryCalloc(1, TS_FORMAT_MAX_LEN + VARSTR_HEADER_SIZE); + int32_t len; + SArray *formats = NULL; + for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { + if (colDataIsNull_s(pInput[1].columnData, i) || colDataIsNull_s(pInput[0].columnData, i)) { + colDataSetNULL(pOutput->columnData, i); + continue; + } + + char *ts = colDataGetData(pInput[0].columnData, i); + char *formatData = colDataGetData(pInput[1].columnData, pInput[1].numOfRows > 1 ? i : 0); + len = TMIN(TS_FORMAT_MAX_LEN - 1, varDataLen(formatData)); + if (pInput[1].numOfRows > 1 || i == 0) { + strncpy(format, varDataVal(formatData), len); + format[len] = '\0'; + if (formats) { + taosArrayDestroy(formats); + formats = NULL; + } + } + int32_t precision = pInput[0].columnData->info.precision; + taosTs2Char(format, &formats, *(int64_t *)ts, precision, varDataVal(out), TS_FORMAT_MAX_LEN); + varDataSetLen(out, strlen(varDataVal(out))); + colDataSetVal(pOutput->columnData, i, out, false); + } + if (formats) taosArrayDestroy(formats); + taosMemoryFree(format); + taosMemoryFree(out); + return TSDB_CODE_SUCCESS; +} + /** Time functions **/ static int64_t offsetFromTz(char *timezone, int64_t factor) { char *minStr = &timezone[3]; diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index cec1a12024..637c18e97d 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -249,8 +249,8 @@ int32_t syncNodeOnRequestVote(SSyncNode* pNode, const SRpcMsg* pMsg); int32_t syncNodeOnRequestVoteReply(SSyncNode* pNode, const SRpcMsg* pMsg); int32_t syncNodeOnAppendEntries(SSyncNode* pNode, const SRpcMsg* pMsg); int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pMsg); -int32_t syncNodeOnSnapshot(SSyncNode* ths, const SRpcMsg* pMsg); -int32_t syncNodeOnSnapshotRsp(SSyncNode* ths, const SRpcMsg* pMsg); +int32_t syncNodeOnSnapshot(SSyncNode* ths, SRpcMsg* pMsg); +int32_t syncNodeOnSnapshotRsp(SSyncNode* ths, SRpcMsg* pMsg); int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pMsg); int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, const SRpcMsg* pMsg); int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pMsg); diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index 95382132b5..f8ee99e8a0 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -22,21 +22,41 @@ extern "C" { #include "syncInt.h" -#define SYNC_SNAPSHOT_SEQ_INVALID -2 #define SYNC_SNAPSHOT_SEQ_FORCE_CLOSE -3 -#define SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT -1 +#define SYNC_SNAPSHOT_SEQ_INVALID -2 +#define SYNC_SNAPSHOT_SEQ_PREP -1 #define SYNC_SNAPSHOT_SEQ_BEGIN 0 #define SYNC_SNAPSHOT_SEQ_END 0x7FFFFFFF #define SYNC_SNAPSHOT_RETRY_MS 5000 +typedef struct SSyncSnapBuffer { + void *entries[TSDB_SYNC_SNAP_BUFFER_SIZE]; + int64_t start; + int64_t cursor; + int64_t end; + int64_t size; + TdThreadMutex mutex; + void (*entryDeleteCb)(void *ptr); +} SSyncSnapBuffer; + +typedef struct SyncSnapBlock { + int32_t seq; + int8_t acked; + int64_t sendTimeMs; + + int16_t blockType; + void *pBlock; + int32_t blockLen; +} SyncSnapBlock; + +void syncSnapBlockDestroy(void *ptr); + typedef struct SSyncSnapshotSender { int8_t start; int32_t seq; int32_t ack; void *pReader; - void *pCurrentBlock; - int32_t blockLen; SSnapshotParam snapshotParam; SSnapshot snapshot; SSyncCfg lastConfig; @@ -47,6 +67,9 @@ typedef struct SSyncSnapshotSender { int64_t lastSendTime; bool finish; + // ring buffer for ack + SSyncSnapBuffer *pSndBuf; + // init when create SSyncNode *pSyncNode; int32_t replicaIndex; @@ -72,6 +95,9 @@ typedef struct SSyncSnapshotReceiver { SSnapshotParam snapshotParam; SSnapshot snapshot; + // buffer + SSyncSnapBuffer *pRcvBuf; + // init when create SSyncNode *pSyncNode; } SSyncSnapshotReceiver; @@ -83,8 +109,8 @@ void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver); // on message -int32_t syncNodeOnSnapshot(SSyncNode *ths, const SRpcMsg *pMsg); -int32_t syncNodeOnSnapshotRsp(SSyncNode *ths, const SRpcMsg *pMsg); +// int32_t syncNodeOnSnapshot(SSyncNode *ths, const SRpcMsg *pMsg); +// int32_t syncNodeOnSnapshotRsp(SSyncNode *ths, const SRpcMsg *pMsg); SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode *pSyncNode, SyncIndex snapshotLastApplyIndex); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index f9dc10da02..199c7a1445 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -818,7 +818,8 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) { if (!taosCheckExistFile(pSyncNode->configPath)) { // create a new raft config file - sInfo("vgId:%d, create a new raft config file", pSyncNode->vgId); + sInfo("vgId:%d, create a new raft config file", pSyncInfo->vgId); + pSyncNode->vgId = pSyncInfo->vgId; pSyncNode->raftCfg.isStandBy = pSyncInfo->isStandBy; pSyncNode->raftCfg.snapshotStrategy = pSyncInfo->snapshotStrategy; pSyncNode->raftCfg.lastConfigIndex = pSyncInfo->syncCfg.lastIndex; diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index a7ee37cc3b..f2386797c1 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -797,7 +797,7 @@ _out: pMgr->retryBackoff = syncLogReplGetNextRetryBackoff(pMgr); SSyncLogBuffer* pBuf = pNode->pLogBuf; sInfo("vgId:%d, resend %d sync log entries. dest:%" PRIx64 ", indexes:%" PRId64 " ..., terms: ... %" PRId64 - ", retryWaitMs:%" PRId64 ", mgr: [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 + ", retryWaitMs:%" PRId64 ", repl-mgr:[%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, count, pDestId->addr, firstIndex, term, retryWaitMs, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -815,9 +815,9 @@ int32_t syncLogReplRecover(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEn ASSERT(pMgr->matchIndex == 0); if (pMsg->matchIndex < 0) { pMgr->restored = true; - sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 - ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", - pNode->vgId, DID(&destId), destId.addr, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, + sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), repl-mgr:[%" PRId64 " %" PRId64 ", %" PRId64 + "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", + pNode->vgId, DID(&destId), destId.addr, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); return 0; } @@ -832,9 +832,9 @@ int32_t syncLogReplRecover(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEn if (pMsg->success && pMsg->matchIndex == pMsg->lastSendIndex) { pMgr->matchIndex = pMsg->matchIndex; pMgr->restored = true; - sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 - ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", - pNode->vgId, DID(&destId), destId.addr, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, + sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), repl-mgr:[%" PRId64 " %" PRId64 ", %" PRId64 + "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", + pNode->vgId, DID(&destId), destId.addr, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); return 0; } @@ -958,10 +958,10 @@ int32_t syncLogReplProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex inde pMgr->endIndex = index + 1; SSyncLogBuffer* pBuf = pNode->pLogBuf; - sTrace("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term:%" PRId64 ". mgr (rs:%d): [%" PRId64 - " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", - pNode->vgId, pDestId->addr, index, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, - pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); + sTrace("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term:%" PRId64 ". repl-mgr:[%" PRId64 + " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", + pNode->vgId, pDestId->addr, index, term, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, + pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); return 0; } @@ -1002,9 +1002,9 @@ int32_t syncLogReplAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { pMgr->endIndex = index + 1; if (barrier) { - sInfo("vgId:%d, replicated sync barrier to dnode:%d. index:%" PRId64 ", term:%" PRId64 - ", repl mgr: rs(%d) [%" PRId64 " %" PRId64 ", %" PRId64 ")", - pNode->vgId, DID(pDestId), index, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex); + sInfo("vgId:%d, replicated sync barrier to dnode:%d. index:%" PRId64 ", term:%" PRId64 ", repl-mgr:[%" PRId64 + " %" PRId64 ", %" PRId64 ")", + pNode->vgId, DID(pDestId), index, term, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex); break; } } @@ -1013,10 +1013,10 @@ int32_t syncLogReplAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { SSyncLogBuffer* pBuf = pNode->pLogBuf; sTrace("vgId:%d, replicated %d msgs to peer:%" PRIx64 ". indexes:%" PRId64 "..., terms: ...%" PRId64 - ", mgr: (rs:%d) [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 + ", repl-mgr:[%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", - pNode->vgId, count, pDestId->addr, firstIndex, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, - pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); + pNode->vgId, count, pDestId->addr, firstIndex, term, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, + pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); return 0; } diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 924813eb98..0b94d377f1 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -23,6 +23,44 @@ #include "syncReplication.h" #include "syncUtil.h" +static void syncSnapBufferReset(SSyncSnapBuffer *pBuf) { + taosThreadMutexLock(&pBuf->mutex); + for (int64_t i = pBuf->start; i < pBuf->end; ++i) { + if (pBuf->entryDeleteCb) { + pBuf->entryDeleteCb(pBuf->entries[i % pBuf->size]); + } + pBuf->entries[i % pBuf->size] = NULL; + } + pBuf->start = SYNC_SNAPSHOT_SEQ_BEGIN + 1; + pBuf->end = pBuf->start; + pBuf->cursor = pBuf->start - 1; + taosThreadMutexUnlock(&pBuf->mutex); +} + +static void syncSnapBufferDestroy(SSyncSnapBuffer **ppBuf) { + if (ppBuf == NULL || ppBuf[0] == NULL) return; + SSyncSnapBuffer *pBuf = ppBuf[0]; + + syncSnapBufferReset(pBuf); + + taosThreadMutexDestroy(&pBuf->mutex); + taosMemoryFree(ppBuf[0]); + ppBuf[0] = NULL; + return; +} + +static SSyncSnapBuffer *syncSnapBufferCreate() { + SSyncSnapBuffer *pBuf = taosMemoryCalloc(1, sizeof(SSyncSnapBuffer)); + if (pBuf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + pBuf->size = sizeof(pBuf->entries) / sizeof(void *); + ASSERT(pBuf->size == TSDB_SYNC_SNAP_BUFFER_SIZE); + taosThreadMutexInit(&pBuf->mutex, NULL); + return pBuf; +} + SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex) { bool condition = (pSyncNode->pFsm->FpSnapshotStartRead != NULL) && (pSyncNode->pFsm->FpSnapshotStopRead != NULL) && (pSyncNode->pFsm->FpSnapshotDoRead != NULL); @@ -38,8 +76,6 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI pSender->seq = SYNC_SNAPSHOT_SEQ_INVALID; pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID; pSender->pReader = NULL; - pSender->pCurrentBlock = NULL; - pSender->blockLen = 0; pSender->sendingMS = SYNC_SNAPSHOT_RETRY_MS; pSender->pSyncNode = pSyncNode; pSender->replicaIndex = replicaIndex; @@ -49,24 +85,42 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &pSender->snapshot); pSender->finish = false; + SSyncSnapBuffer *pSndBuf = syncSnapBufferCreate(); + if (pSndBuf == NULL) { + taosMemoryFree(pSender); + pSender = NULL; + return NULL; + } + pSndBuf->entryDeleteCb = syncSnapBlockDestroy; + pSender->pSndBuf = pSndBuf; + + syncSnapBufferReset(pSender->pSndBuf); return pSender; } +void syncSnapBlockDestroy(void *ptr) { + SyncSnapBlock *pBlk = ptr; + if (pBlk->pBlock != NULL) { + taosMemoryFree(pBlk->pBlock); + pBlk->pBlock = NULL; + pBlk->blockLen = 0; + } + taosMemoryFree(pBlk); +} + void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { if (pSender == NULL) return; - // free current block - if (pSender->pCurrentBlock != NULL) { - taosMemoryFree(pSender->pCurrentBlock); - pSender->pCurrentBlock = NULL; - } - // close reader if (pSender->pReader != NULL) { pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); pSender->pReader = NULL; } + // free snap buffer + if (pSender->pSndBuf) { + syncSnapBufferDestroy(&pSender->pSndBuf); + } // free sender taosMemoryFree(pSender); } @@ -79,11 +133,9 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { int8_t started = atomic_val_compare_exchange_8(&pSender->start, false, true); if (started) return 0; - pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN; + pSender->seq = SYNC_SNAPSHOT_SEQ_PREP; pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID; pSender->pReader = NULL; - pSender->pCurrentBlock = NULL; - pSender->blockLen = 0; pSender->snapshotParam.start = SYNC_INDEX_INVALID; pSender->snapshotParam.end = SYNC_INDEX_INVALID; pSender->snapshot.data = NULL; @@ -127,29 +179,28 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { SyncSnapshotSend *pMsg = rpcMsg.pCont; pMsg->srcId = pSender->pSyncNode->myRaftId; pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; - pMsg->term = raftStoreGetTerm(pSender->pSyncNode); + pMsg->term = pSender->term; pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; pMsg->lastTerm = pSender->snapshot.lastApplyTerm; pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; pMsg->lastConfig = pSender->lastConfig; pMsg->startTime = pSender->startTime; - pMsg->seq = SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT; + pMsg->seq = pSender->seq; if (dataLen > 0) { pMsg->payloadType = snapInfo.type; memcpy(pMsg->data, snapInfo.data, dataLen); } - // event log - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender start"); - // send msg if (syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { sSError(pSender, "snapshot sender send msg failed since %s", terrstr()); goto _out; } + sSInfo(pSender, "snapshot sender start, to dnode:%d.", DID(&pMsg->destId)); + code = 0; _out: if (snapInfo.data) { @@ -175,48 +226,59 @@ void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { pSender->pReader = NULL; } - // free current block - if (pSender->pCurrentBlock != NULL) { - taosMemoryFree(pSender->pCurrentBlock); - pSender->pCurrentBlock = NULL; - pSender->blockLen = 0; - } + syncSnapBufferReset(pSender->pSndBuf); + + SRaftId destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; + sSInfo(pSender, "snapshot sender stop, to dnode:%d, finish:%d", DID(&destId), finish); } // when sender receive ack, call this function to send msg from seq // seq = ack + 1, already updated static int32_t snapshotSend(SSyncSnapshotSender *pSender) { - // free memory last time (current seq - 1) - if (pSender->pCurrentBlock != NULL) { - taosMemoryFree(pSender->pCurrentBlock); - pSender->pCurrentBlock = NULL; - pSender->blockLen = 0; + int32_t code = -1; + SyncSnapBlock *pBlk = NULL; + + if (pSender->seq < SYNC_SNAPSHOT_SEQ_END) { + pSender->seq++; + + if (pSender->seq > SYNC_SNAPSHOT_SEQ_BEGIN) { + pBlk = taosMemoryCalloc(1, sizeof(SyncSnapBlock)); + if (pBlk == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _OUT; + } + + pBlk->seq = pSender->seq; + + // read data + int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotDoRead(pSender->pSyncNode->pFsm, pSender->pReader, + &pBlk->pBlock, &pBlk->blockLen); + if (ret != 0) { + sSError(pSender, "snapshot sender read failed since %s", terrstr()); + goto _OUT; + } + + if (pBlk->blockLen > 0) { + // has read data + sSDebug(pSender, "snapshot sender continue to read, blockLen:%d seq:%d", pBlk->blockLen, pBlk->seq); + } else { + // read finish, update seq to end + pSender->seq = SYNC_SNAPSHOT_SEQ_END; + sSInfo(pSender, "snapshot sender read to the end"); + code = 0; + goto _OUT; + } + } } - // read data - int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotDoRead(pSender->pSyncNode->pFsm, pSender->pReader, - &pSender->pCurrentBlock, &pSender->blockLen); - if (ret != 0) { - sSError(pSender, "snapshot sender read failed since %s", terrstr()); - return -1; - } - - if (pSender->blockLen > 0) { - // has read data - sSDebug(pSender, "vgId:%d, snapshot sender continue to read, blockLen:%d seq:%d", pSender->pSyncNode->vgId, - pSender->blockLen, pSender->seq); - } else { - // read finish, update seq to end - pSender->seq = SYNC_SNAPSHOT_SEQ_END; - sSInfo(pSender, "vgId:%d, snapshot sender read to the end, blockLen:%d seq:%d", pSender->pSyncNode->vgId, - pSender->blockLen, pSender->seq); - } + ASSERT(pSender->seq >= SYNC_SNAPSHOT_SEQ_BEGIN && pSender->seq <= SYNC_SNAPSHOT_SEQ_END); + int32_t blockLen = (pBlk != NULL) ? pBlk->blockLen : 0; // build msg SRpcMsg rpcMsg = {0}; - if (syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId) != 0) { + if (syncBuildSnapshotSend(&rpcMsg, blockLen, pSender->pSyncNode->vgId) != 0) { sSError(pSender, "vgId:%d, snapshot sender build msg failed since %s", pSender->pSyncNode->vgId, terrstr()); - return -1; + goto _OUT; } SyncSnapshotSend *pMsg = rpcMsg.pCont; @@ -231,77 +293,83 @@ static int32_t snapshotSend(SSyncSnapshotSender *pSender) { pMsg->startTime = pSender->startTime; pMsg->seq = pSender->seq; - if (pSender->pCurrentBlock != NULL) { - memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); - } - - // event log - if (pSender->seq == SYNC_SNAPSHOT_SEQ_END) { - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender finish"); - } else { - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender sending"); + if (pBlk != NULL && pBlk->pBlock != NULL && pBlk->blockLen > 0) { + memcpy(pMsg->data, pBlk->pBlock, pBlk->blockLen); } // send msg if (syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { sSError(pSender, "snapshot sender send msg failed since %s", terrstr()); - return -1; + goto _OUT; } - pSender->lastSendTime = taosGetTimestampMs(); - return 0; + // put in buffer + int64_t nowMs = taosGetTimestampMs(); + if (pBlk) { + ASSERT(pBlk->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pBlk->seq < SYNC_SNAPSHOT_SEQ_END); + pBlk->sendTimeMs = nowMs; + pSender->pSndBuf->entries[pSender->seq % pSender->pSndBuf->size] = pBlk; + pBlk = NULL; + pSender->pSndBuf->end = TMAX(pSender->seq + 1, pSender->pSndBuf->end); + } + pSender->lastSendTime = nowMs; + code = 0; + +_OUT:; + if (pBlk != NULL) { + syncSnapBlockDestroy(pBlk); + pBlk = NULL; + } + return code; } // send snapshot data from cache int32_t snapshotReSend(SSyncSnapshotSender *pSender) { - // build msg - SRpcMsg rpcMsg = {0}; - if (syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId) != 0) { - sSError(pSender, "snapshot sender build msg failed since %s", terrstr()); - return -1; + SSyncSnapBuffer *pSndBuf = pSender->pSndBuf; + int32_t code = -1; + taosThreadMutexLock(&pSndBuf->mutex); + + for (int32_t seq = pSndBuf->cursor + 1; seq < pSndBuf->end; ++seq) { + SyncSnapBlock *pBlk = pSndBuf->entries[seq % pSndBuf->size]; + ASSERT(pBlk && !pBlk->acked); + int64_t nowMs = taosGetTimestampMs(); + if (nowMs < pBlk->sendTimeMs + SYNC_SNAP_RESEND_MS) { + continue; + } + // build msg + SRpcMsg rpcMsg = {0}; + if (syncBuildSnapshotSend(&rpcMsg, pBlk->blockLen, pSender->pSyncNode->vgId) != 0) { + sSError(pSender, "snapshot sender build msg failed since %s", terrstr()); + goto _out; + } + + SyncSnapshotSend *pMsg = rpcMsg.pCont; + pMsg->srcId = pSender->pSyncNode->myRaftId; + pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; + pMsg->term = pSender->term; + pMsg->beginIndex = pSender->snapshotParam.start; + pMsg->lastIndex = pSender->snapshot.lastApplyIndex; + pMsg->lastTerm = pSender->snapshot.lastApplyTerm; + pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; + pMsg->lastConfig = pSender->lastConfig; + pMsg->startTime = pSender->startTime; + pMsg->seq = pBlk->seq; + + if (pBlk->pBlock != NULL && pBlk->blockLen > 0) { + memcpy(pMsg->data, pBlk->pBlock, pBlk->blockLen); + } + + // send msg + if (syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { + sSError(pSender, "snapshot sender resend msg failed since %s", terrstr()); + goto _out; + } + pBlk->sendTimeMs = nowMs; } - - SyncSnapshotSend *pMsg = rpcMsg.pCont; - pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; - pMsg->term = raftStoreGetTerm(pSender->pSyncNode); - pMsg->beginIndex = pSender->snapshotParam.start; - pMsg->lastIndex = pSender->snapshot.lastApplyIndex; - pMsg->lastTerm = pSender->snapshot.lastApplyTerm; - pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; - pMsg->lastConfig = pSender->lastConfig; - pMsg->startTime = pSender->startTime; - pMsg->seq = pSender->seq; - - if (pSender->pCurrentBlock != NULL && pSender->blockLen > 0) { - memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); - } - - // event log - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender resend"); - - // send msg - if (syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { - sSError(pSender, "snapshot sender resend msg failed since %s", terrstr()); - return -1; - } - - pSender->lastSendTime = taosGetTimestampMs(); - return 0; -} - -static int32_t snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { - if (pMsg->ack != pSender->seq) { - sSError(pSender, "snapshot sender update seq failed, ack:%d seq:%d", pMsg->ack, pSender->seq); - terrno = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; - return -1; - } - - pSender->ack = pMsg->ack; - pSender->seq++; - - sSDebug(pSender, "snapshot sender update seq:%d", pSender->seq); - return 0; + code = 0; +_out:; + taosThreadMutexUnlock(&pSndBuf->mutex); + return code; } // return 0, start ok @@ -328,8 +396,6 @@ int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { return 0; } - sSInfo(pSender, "snapshot sender start"); - int32_t code = snapshotSenderStart(pSender); if (code != 0) { sSError(pSender, "snapshot sender start error since %s", terrstr()); @@ -362,6 +428,16 @@ SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId from pReceiver->snapshot.lastApplyTerm = 0; pReceiver->snapshot.lastConfigIndex = SYNC_INDEX_INVALID; + SSyncSnapBuffer *pRcvBuf = syncSnapBufferCreate(); + if (pRcvBuf == NULL) { + taosMemoryFree(pReceiver); + pReceiver = NULL; + return NULL; + } + pRcvBuf->entryDeleteCb = rpcFreeCont; + pReceiver->pRcvBuf = pRcvBuf; + + syncSnapBufferReset(pReceiver->pRcvBuf); return pReceiver; } @@ -389,6 +465,11 @@ void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) { pReceiver->snapshot.data = NULL; } + // free snap buf + if (pReceiver->pRcvBuf) { + syncSnapBufferDestroy(&pReceiver->pRcvBuf); + } + // free receiver taosMemoryFree(pReceiver); } @@ -444,20 +525,19 @@ void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *p int8_t started = atomic_val_compare_exchange_8(&pReceiver->start, false, true); if (started) return; - pReceiver->ack = SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT; + pReceiver->ack = SYNC_SNAPSHOT_SEQ_PREP; pReceiver->term = pPreMsg->term; pReceiver->fromId = pPreMsg->srcId; pReceiver->startTime = pPreMsg->startTime; ASSERT(pReceiver->startTime); - // event log - sRInfo(pReceiver, "snapshot receiver is start"); + sRInfo(pReceiver, "snapshot receiver start, from dnode:%d.", DID(&pReceiver->fromId)); } // just set start = false // FpSnapshotStopWrite should not be called void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { - sRInfo(pReceiver, "snapshot receiver stop, not apply, writer:%p", pReceiver->pWriter); + sRDebug(pReceiver, "snapshot receiver stop, not apply, writer:%p", pReceiver->pWriter); int8_t stopped = !atomic_val_compare_exchange_8(&pReceiver->start, true, false); if (stopped) return; @@ -472,6 +552,8 @@ void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { } else { sRInfo(pReceiver, "snapshot receiver stop, writer is null"); } + + syncSnapBufferReset(pReceiver->pRcvBuf); } // when recv last snapshot block, apply data into snapshot @@ -479,7 +561,7 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap int32_t code = 0; if (pReceiver->pWriter != NULL) { // write data - sRInfo(pReceiver, "snapshot receiver write finish, blockLen:%d seq:%d", pMsg->dataLen, pMsg->seq); + sRInfo(pReceiver, "snapshot receiver write about to finish, blockLen:%d seq:%d", pMsg->dataLen, pMsg->seq); if (pMsg->dataLen > 0) { code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, pMsg->dataLen); @@ -489,15 +571,6 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap } } - // reset wal - sRInfo(pReceiver, "snapshot receiver log restore"); - code = - pReceiver->pSyncNode->pLogStore->syncLogRestoreFromSnapshot(pReceiver->pSyncNode->pLogStore, pMsg->lastIndex); - if (code != 0) { - sRError(pReceiver, "failed to snapshot receiver log restore since %s", terrstr()); - return -1; - } - // update commit index if (pReceiver->snapshot.lastApplyIndex > pReceiver->pSyncNode->commitIndex) { pReceiver->pSyncNode->commitIndex = pReceiver->snapshot.lastApplyIndex; @@ -509,7 +582,6 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap } // stop writer, apply data - sRInfo(pReceiver, "snapshot receiver apply write"); code = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, true, &pReceiver->snapshot); if (code != 0) { @@ -517,21 +589,29 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap return -1; } pReceiver->pWriter = NULL; + sRInfo(pReceiver, "snapshot receiver write stopped"); // update progress pReceiver->ack = SYNC_SNAPSHOT_SEQ_END; + // get fsmState SSnapshot snapshot = {0}; pReceiver->pSyncNode->pFsm->FpGetSnapshotInfo(pReceiver->pSyncNode->pFsm, &snapshot); pReceiver->pSyncNode->fsmState = snapshot.state; + // reset wal + code = + pReceiver->pSyncNode->pLogStore->syncLogRestoreFromSnapshot(pReceiver->pSyncNode->pLogStore, pMsg->lastIndex); + if (code != 0) { + sRError(pReceiver, "failed to snapshot receiver log restore since %s", terrstr()); + return -1; + } + sRInfo(pReceiver, "wal log restored from snapshot"); } else { sRError(pReceiver, "snapshot receiver finish error since writer is null"); return -1; } - // event log - sRInfo(pReceiver, "snapshot receiver got last data and apply snapshot finished"); return 0; } @@ -599,22 +679,22 @@ static int32_t syncNodeOnSnapshotPrep(SSyncNode *pSyncNode, SyncSnapshotSend *pM int32_t order = 0; if ((order = snapshotReceiverSignatureCmp(pReceiver, pMsg)) < 0) { sRInfo(pReceiver, - "received a new snapshot preparation. restart receiver" - "receiver signature: (%" PRId64 ", %" PRId64 "), msg signature:(%" PRId64 ", %" PRId64 ")", - pReceiver->term, pReceiver->startTime, pMsg->term, pMsg->startTime); + "received a new snapshot preparation. restart receiver." + " msg signature:(%" PRId64 ", %" PRId64 ")", + pMsg->term, pMsg->startTime); goto _START_RECEIVER; } else if (order == 0) { sRInfo(pReceiver, - "received a duplicate snapshot preparation. send reply" - "receiver signature: (%" PRId64 ", %" PRId64 "), msg signature:(%" PRId64 ", %" PRId64 ")", - pReceiver->term, pReceiver->startTime, pMsg->term, pMsg->startTime); + "received a duplicate snapshot preparation. send reply." + " msg signature:(%" PRId64 ", %" PRId64 ")", + pMsg->term, pMsg->startTime); goto _SEND_REPLY; } else { // ignore sRError(pReceiver, - "received a stale snapshot preparation. ignore" - "receiver signature: (%" PRId64 ", %" PRId64 "), msg signature:(%" PRId64 ", %" PRId64 ")", - pReceiver->term, pReceiver->startTime, pMsg->term, pMsg->startTime); + "received a stale snapshot preparation. ignore." + " msg signature:(%" PRId64 ", %" PRId64 ")", + pMsg->term, pMsg->startTime); terrno = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; code = terrno; goto _SEND_REPLY; @@ -765,29 +845,8 @@ _SEND_REPLY: return code; } -static int32_t syncNodeOnSnapshotReceive(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { - // condition 4 - // transfering - SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; - int64_t timeNow = taosGetTimestampMs(); - int32_t code = 0; - - if (snapshotReceiverSignatureCmp(pReceiver, pMsg) != 0) { - terrno = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; - sRError(pReceiver, "failed to receive snapshot data since %s.", terrstr()); - code = terrno; - goto _SEND_REPLY; - } - - if (snapshotReceiverGotData(pReceiver, pMsg) != 0) { - code = terrno; - if (code >= SYNC_SNAPSHOT_SEQ_INVALID) { - code = TSDB_CODE_SYN_INTERNAL_ERROR; - } - } - -_SEND_REPLY:; - +static int32_t syncSnapSendRsp(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg, int32_t code) { + SSyncNode *pSyncNode = pReceiver->pSyncNode; // build msg SRpcMsg rpcMsg = {0}; if (syncBuildSnapshotSendRsp(&rpcMsg, 0, pSyncNode->vgId)) { @@ -811,10 +870,79 @@ _SEND_REPLY:; sRError(pReceiver, "failed to send snapshot receiver resp since %s", terrstr()); return -1; } + return 0; +} +static int32_t syncSnapBufferRecv(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend **ppMsg) { + int32_t code = 0; + SSyncSnapBuffer *pRcvBuf = pReceiver->pRcvBuf; + SyncSnapshotSend *pMsg = ppMsg[0]; + terrno = TSDB_CODE_SUCCESS; + + taosThreadMutexLock(&pRcvBuf->mutex); + + if (pMsg->seq - pRcvBuf->start >= pRcvBuf->size) { + terrno = TSDB_CODE_SYN_BUFFER_FULL; + code = terrno; + goto _out; + } + + ASSERT(pRcvBuf->start <= pRcvBuf->cursor + 1 && pRcvBuf->cursor < pRcvBuf->end); + + if (pMsg->seq > pRcvBuf->cursor) { + pRcvBuf->entries[pMsg->seq % pRcvBuf->size] = pMsg; + ppMsg[0] = NULL; + pRcvBuf->end = TMAX(pMsg->seq + 1, pRcvBuf->end); + } else { + syncSnapSendRsp(pReceiver, pMsg, code); + goto _out; + } + + for (int64_t seq = pRcvBuf->cursor + 1; seq < pRcvBuf->end; ++seq) { + if (pRcvBuf->entries[seq]) { + pRcvBuf->cursor = seq; + } else { + break; + } + } + + for (int64_t seq = pRcvBuf->start; seq <= pRcvBuf->cursor; ++seq) { + if (snapshotReceiverGotData(pReceiver, pRcvBuf->entries[seq % pRcvBuf->size]) != 0) { + code = terrno; + if (code >= SYNC_SNAPSHOT_SEQ_INVALID) { + code = TSDB_CODE_SYN_INTERNAL_ERROR; + } + } + pRcvBuf->start = seq + 1; + syncSnapSendRsp(pReceiver, pRcvBuf->entries[seq % pRcvBuf->size], code); + pRcvBuf->entryDeleteCb(pRcvBuf->entries[seq % pRcvBuf->size]); + pRcvBuf->entries[seq % pRcvBuf->size] = NULL; + if (code) goto _out; + } + +_out: + taosThreadMutexUnlock(&pRcvBuf->mutex); return code; } +static int32_t syncNodeOnSnapshotReceive(SSyncNode *pSyncNode, SyncSnapshotSend **ppMsg) { + // condition 4 + // transfering + SyncSnapshotSend *pMsg = ppMsg[0]; + ASSERT(pMsg); + SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; + int64_t timeNow = taosGetTimestampMs(); + int32_t code = 0; + + if (snapshotReceiverSignatureCmp(pReceiver, pMsg) != 0) { + terrno = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; + sRError(pReceiver, "failed to receive snapshot data since %s.", terrstr()); + return syncSnapSendRsp(pReceiver, pMsg, terrno); + } + + return syncSnapBufferRecv(pReceiver, ppMsg); +} + static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { // condition 2 // end, finish FSM @@ -867,7 +995,7 @@ _SEND_REPLY:; // receiver on message // -// condition 1, recv SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT +// condition 1, recv SYNC_SNAPSHOT_SEQ_PREP // if receiver already start // if sender.start-time > receiver.start-time, restart receiver(reply snapshot start) // if sender.start-time = receiver.start-time, maybe duplicate msg @@ -885,9 +1013,11 @@ _SEND_REPLY:; // // condition 5, got data, update ack // -int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { - SyncSnapshotSend *pMsg = pRpcMsg->pCont; +int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SRpcMsg *pRpcMsg) { + SyncSnapshotSend **ppMsg = (SyncSnapshotSend **)&pRpcMsg->pCont; + SyncSnapshotSend *pMsg = ppMsg[0]; SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; + int32_t code = 0; // if already drop replica, do not process if (!syncNodeInRaftGroup(pSyncNode, &pMsg->srcId)) { @@ -911,49 +1041,56 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncNodeUpdateTermWithoutStepDown(pSyncNode, pMsg->term); } - // state, term, seq/ack - int32_t code = 0; - if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER || pSyncNode->state == TAOS_SYNC_STATE_LEARNER) { - if (pMsg->term == raftStoreGetTerm(pSyncNode)) { - if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT) { - sInfo("vgId:%d, receive pre-snapshot msg of snapshot replication. signature:(%" PRId64 ", %" PRId64 ")", - pSyncNode->vgId, pMsg->term, pMsg->startTime); - code = syncNodeOnSnapshotPrep(pSyncNode, pMsg); - } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) { - sInfo("vgId:%d, receive begin msg of snapshot replication. signature:(%" PRId64 ", %" PRId64 ")", - pSyncNode->vgId, pMsg->term, pMsg->startTime); - code = syncNodeOnSnapshotBegin(pSyncNode, pMsg); - } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) { - sInfo("vgId:%d, receive end msg of snapshot replication. signature: (%" PRId64 ", %" PRId64 ")", - pSyncNode->vgId, pMsg->term, pMsg->startTime); - code = syncNodeOnSnapshotEnd(pSyncNode, pMsg); - if (syncLogBufferReInit(pSyncNode->pLogBuf, pSyncNode) != 0) { - sRError(pReceiver, "failed to reinit log buffer since %s", terrstr()); - code = -1; - } - } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_FORCE_CLOSE) { - // force close, no response - syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process force stop"); - snapshotReceiverStop(pReceiver); - } else if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) { - syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq data"); - code = syncNodeOnSnapshotReceive(pSyncNode, pMsg); - } else { - // error log - sRError(pReceiver, "snapshot receiver recv error seq:%d, my ack:%d", pMsg->seq, pReceiver->ack); - code = -1; - } - } else { - // error log - sRError(pReceiver, "snapshot receiver term not equal"); - code = -1; - } - } else { - // error log - sRError(pReceiver, "snapshot receiver not follower"); - code = -1; + if (pSyncNode->state != TAOS_SYNC_STATE_FOLLOWER && pSyncNode->state != TAOS_SYNC_STATE_LEARNER) { + sRError(pReceiver, "snapshot receiver not a follower or learner"); + return -1; } + if (pMsg->seq < SYNC_SNAPSHOT_SEQ_PREP || pMsg->seq > SYNC_SNAPSHOT_SEQ_END) { + sRError(pReceiver, "snap replication msg with invalid seq:%d", pMsg->seq); + return -1; + } + + // prepare + if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PREP) { + sInfo("vgId:%d, prepare snap replication. msg signature:(%" PRId64 ", %" PRId64 ")", pSyncNode->vgId, pMsg->term, + pMsg->startTime); + code = syncNodeOnSnapshotPrep(pSyncNode, pMsg); + goto _out; + } + + // begin + if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) { + sInfo("vgId:%d, begin snap replication. msg signature:(%" PRId64 ", %" PRId64 ")", pSyncNode->vgId, pMsg->term, + pMsg->startTime); + code = syncNodeOnSnapshotBegin(pSyncNode, pMsg); + goto _out; + } + + // data + if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) { + code = syncNodeOnSnapshotReceive(pSyncNode, ppMsg); + goto _out; + } + + // end + if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) { + sInfo("vgId:%d, end snap replication. msg signature:(%" PRId64 ", %" PRId64 ")", pSyncNode->vgId, pMsg->term, + pMsg->startTime); + code = syncNodeOnSnapshotEnd(pSyncNode, pMsg); + if (code != 0) { + sRError(pReceiver, "failed to end snapshot."); + goto _out; + } + + code = syncLogBufferReInit(pSyncNode->pLogBuf, pSyncNode); + if (code != 0) { + sRError(pReceiver, "failed to reinit log buffer since %s", terrstr()); + } + goto _out; + } + +_out:; syncNodeResetElectTimer(pSyncNode); return code; } @@ -993,41 +1130,7 @@ static int32_t syncNodeOnSnapshotPrepRsp(SSyncNode *pSyncNode, SSyncSnapshotSend // update next index syncIndexMgrSetIndex(pSyncNode->pNextIndex, &pMsg->srcId, snapshot.lastApplyIndex + 1); - // update seq - pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN; - - // build begin msg - SRpcMsg rpcMsg = {0}; - if (syncBuildSnapshotSend(&rpcMsg, 0, pSender->pSyncNode->vgId) != 0) { - sSError(pSender, "prepare snapshot failed since build msg error"); - return -1; - } - - SyncSnapshotSend *pSendMsg = rpcMsg.pCont; - pSendMsg->srcId = pSender->pSyncNode->myRaftId; - pSendMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; - pSendMsg->term = raftStoreGetTerm(pSender->pSyncNode); - pSendMsg->beginIndex = pSender->snapshotParam.start; - pSendMsg->lastIndex = pSender->snapshot.lastApplyIndex; - pSendMsg->lastTerm = pSender->snapshot.lastApplyTerm; - pSendMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; - pSendMsg->lastConfig = pSender->lastConfig; - pSendMsg->startTime = pSender->startTime; - pSendMsg->seq = SYNC_SNAPSHOT_SEQ_BEGIN; - - ASSERT(pSendMsg->startTime); - - sSInfo(pSender, "begin snapshot replication to dnode %d. startTime:%" PRId64, DID(&pSendMsg->destId), - pSendMsg->startTime); - - // send msg - syncLogSendSyncSnapshotSend(pSyncNode, pSendMsg, "snapshot sender reply pre"); - if (syncNodeSendMsgById(&pSendMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { - sSError(pSender, "prepare snapshot failed since send msg error"); - return -1; - } - - return 0; + return snapshotSend(pSender); } static int32_t snapshotSenderSignatureCmp(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { @@ -1038,14 +1141,77 @@ static int32_t snapshotSenderSignatureCmp(SSyncSnapshotSender *pSender, SyncSnap return 0; } +static int32_t syncSnapBufferSend(SSyncSnapshotSender *pSender, SyncSnapshotRsp **ppMsg) { + int32_t code = 0; + SSyncSnapBuffer *pSndBuf = pSender->pSndBuf; + SyncSnapshotRsp *pMsg = ppMsg[0]; + + taosThreadMutexLock(&pSndBuf->mutex); + if (snapshotSenderSignatureCmp(pSender, pMsg) != 0) { + code = terrno = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; + goto _out; + } + + if (pSender->pReader == NULL || pSender->finish) { + code = terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + goto _out; + } + + if (pMsg->ack - pSndBuf->start >= pSndBuf->size) { + code = terrno = TSDB_CODE_SYN_BUFFER_FULL; + goto _out; + } + + ASSERT(pSndBuf->start <= pSndBuf->cursor + 1 && pSndBuf->cursor < pSndBuf->end); + + if (pMsg->ack > pSndBuf->cursor && pMsg->ack < pSndBuf->end) { + SyncSnapBlock *pBlk = pSndBuf->entries[pMsg->ack % pSndBuf->size]; + ASSERT(pBlk); + pBlk->acked = 1; + } + + for (int64_t ack = pSndBuf->cursor + 1; ack < pSndBuf->end; ++ack) { + SyncSnapBlock *pBlk = pSndBuf->entries[ack % pSndBuf->size]; + if (pBlk->acked) { + pSndBuf->cursor = ack; + } else { + break; + } + } + + for (int64_t ack = pSndBuf->start; ack <= pSndBuf->cursor; ++ack) { + pSndBuf->entryDeleteCb(pSndBuf->entries[ack % pSndBuf->size]); + pSndBuf->entries[ack % pSndBuf->size] = NULL; + pSndBuf->start = ack + 1; + } + + while (pSender->seq != SYNC_SNAPSHOT_SEQ_END && pSender->seq - pSndBuf->start < (pSndBuf->size >> 2)) { + if (snapshotSend(pSender) != 0) { + code = terrno; + goto _out; + } + } + + if (pSender->seq == SYNC_SNAPSHOT_SEQ_END && pSndBuf->end <= pSndBuf->start) { + if (snapshotSend(pSender) != 0) { + code = terrno; + goto _out; + } + } +_out: + taosThreadMutexUnlock(&pSndBuf->mutex); + return code; +} + // sender on message // // condition 1 sender receives SYNC_SNAPSHOT_SEQ_END, close sender // condition 2 sender receives ack, set seq = ack + 1, send msg from seq // condition 3 sender receives error msg, just print error log // -int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { - SyncSnapshotRsp *pMsg = pRpcMsg->pCont; +int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, SRpcMsg *pRpcMsg) { + SyncSnapshotRsp **ppMsg = (SyncSnapshotRsp **)&pRpcMsg->pCont; + SyncSnapshotRsp *pMsg = ppMsg[0]; // if already drop replica, do not process if (!syncNodeInRaftGroup(pSyncNode, &pMsg->srcId)) { @@ -1071,10 +1237,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { // check signature int32_t order = 0; if ((order = snapshotSenderSignatureCmp(pSender, pMsg)) > 0) { - sSError(pSender, - "received a stale snapshot rsp. ignore it" - "sender signature: (%" PRId64 ", %" PRId64 "), msg signature:(%" PRId64 ", %" PRId64 ")", - pSender->term, pSender->startTime, pMsg->term, pMsg->startTime); + sSWarn(pSender, "ignore a stale snap rsp, msg signature:(%" PRId64 ", %" PRId64 ").", pMsg->term, pMsg->startTime); terrno = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; return -1; } else if (order < 0) { @@ -1083,9 +1246,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { goto _ERROR; } - // state, term, seq/ack if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender not leader"); sSError(pSender, "snapshot sender not leader"); terrno = TSDB_CODE_SYN_NOT_LEADER; goto _ERROR; @@ -1093,83 +1254,46 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { SyncTerm currentTerm = raftStoreGetTerm(pSyncNode); if (pMsg->term != currentTerm) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver term not match"); - sSError(pSender, "snapshot sender term not equal, msg term:%" PRId64 " currentTerm:%" PRId64, pMsg->term, + sSError(pSender, "snapshot sender term mismatch, msg term:%" PRId64 " currentTerm:%" PRId64, pMsg->term, currentTerm); terrno = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; goto _ERROR; } if (pMsg->code != 0) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error code"); sSError(pSender, "snapshot sender receive error:%s 0x%x and stop sender", tstrerror(pMsg->code), pMsg->code); terrno = pMsg->code; goto _ERROR; } - // prepare , send begin msg - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq pre-snapshot"); - return syncNodeOnSnapshotPrepRsp(pSyncNode, pSender, pMsg); - } - - if (pSender->pReader == NULL || pSender->finish) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender invalid"); - sSError(pSender, "snapshot sender invalid error:%s 0x%x, pReader:%p finish:%d", tstrerror(pMsg->code), pMsg->code, - pSender->pReader, pSender->finish); - terrno = pMsg->code; - goto _ERROR; - } - - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_BEGIN) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq begin"); - if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { - return -1; + // send begin + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PREP) { + sSInfo(pSender, "process prepare rsp"); + if (syncNodeOnSnapshotPrepRsp(pSyncNode, pSender, pMsg) != 0) { + goto _ERROR; } - - if (snapshotSend(pSender) != 0) { - return -1; - } - return 0; } - // receive ack is finish, close sender + // send msg of data or end + if (pMsg->ack >= SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->ack < SYNC_SNAPSHOT_SEQ_END) { + if (syncSnapBufferSend(pSender, ppMsg) != 0) { + sSError(pSender, "failed to replicate snap since %s. seq:%d, pReader:%p, finish:%d", terrstr(), pSender->seq, + pSender->pReader, pSender->finish); + goto _ERROR; + } + } + + // end if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); + sSInfo(pSender, "process end rsp"); snapshotSenderStop(pSender, true); syncNodeReplicateReset(pSyncNode, &pMsg->srcId); - return 0; - } - - // send next msg - if (pMsg->ack == pSender->seq) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq data"); - // update sender ack - if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { - return -1; - } - if (snapshotSend(pSender) != 0) { - return -1; - } - } else if (pMsg->ack == pSender->seq - 1) { - // maybe resend - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq and resend"); - if (snapshotReSend(pSender) != 0) { - return -1; - } - } else { - // error log - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack"); - sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq); - snapshotSenderStop(pSender, true); - syncNodeReplicateReset(pSyncNode, &pMsg->srcId); - return -1; } return 0; _ERROR: - snapshotSenderStop(pSender, true); + snapshotSenderStop(pSender, false); syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return -1; } diff --git a/source/libs/sync/src/syncTimeout.c b/source/libs/sync/src/syncTimeout.c index 37166805ce..a57dfbee53 100644 --- a/source/libs/sync/src/syncTimeout.c +++ b/source/libs/sync/src/syncTimeout.c @@ -77,12 +77,19 @@ static int32_t syncNodeTimerRoutine(SSyncNode* ths) { for (int i = 0; i < ths->peersNum; ++i) { SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(ths, &(ths->peersId[i])); if (pSender != NULL) { - if (ths->isStart && ths->state == TAOS_SYNC_STATE_LEADER && pSender->start && - timeNow - pSender->lastSendTime > SYNC_SNAP_RESEND_MS) { - snapshotReSend(pSender); - } else { - sTrace("vgId:%d, do not resend: nstart%d, now:%" PRId64 ", lstsend:%" PRId64 ", diff:%" PRId64, ths->vgId, - ths->isStart, timeNow, pSender->lastSendTime, timeNow - pSender->lastSendTime); + if (ths->isStart && ths->state == TAOS_SYNC_STATE_LEADER && pSender->start) { + int64_t elapsedMs = timeNow - pSender->lastSendTime; + if (elapsedMs < SYNC_SNAP_RESEND_MS) { + continue; + } + + if (elapsedMs > SYNC_SNAP_TIMEOUT_MS) { + sSError(pSender, "snap replication timeout, terminate."); + snapshotSenderStop(pSender, false); + } else { + sSWarn(pSender, "snap replication resend."); + snapshotReSend(pSender); + } } } } diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 9acc17e130..9e6ea94e78 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -267,21 +267,23 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla va_end(argpointer); taosPrintLog(flags, level, dflag, - "vgId:%d, %s, sync:%s, snap-sender:{%p start:%" PRId64 " end:%" PRId64 " last-index:%" PRId64 - " last-term:%" PRIu64 " last-cfg:%" PRId64 - ", seq:%d ack:%d finish:%d, as:%d dnode:%d}" + "vgId:%d, %s, sync:%s, snap-sender:%p signature:(%" PRId64 ", %" PRId64 "), {start:%" PRId64 + " end:%" PRId64 " last-index:%" PRId64 " last-term:%" PRIu64 " last-cfg:%" PRId64 + ", seq:%d, ack:%d, " + " buf:[%" PRId64 " %" PRId64 ", %" PRId64 + "), finish:%d, as:%d, to-dnode:%d}" ", term:%" PRIu64 ", commit-index:%" PRId64 ", firstver:%" PRId64 ", lastver:%" PRId64 ", min-match:%" PRId64 ", snap:{last-index:%" PRId64 ", term:%" PRIu64 "}, standby:%d, batch-sz:%d, replicas:%d, last-cfg:%" PRId64 - ", chging:%d, restore:%d, quorum:%d, lc-timer:{elect:%" PRId64 ", hb:%" PRId64 "}, peer:%s, cfg:%s", - pNode->vgId, eventLog, syncStr(pNode->state), pSender, pSender->snapshotParam.start, - pSender->snapshotParam.end, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm, - pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack, pSender->finish, pSender->replicaIndex, - DID(&pNode->replicasId[pSender->replicaIndex]), raftStoreGetTerm(pNode), pNode->commitIndex, - logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, - pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize, pNode->replicaNum, pNode->raftCfg.lastConfigIndex, - pNode->changing, pNode->restoreFinish, syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock, - pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr); + ", chging:%d, restore:%d, quorum:%d, peer:%s, cfg:%s", + pNode->vgId, eventLog, syncStr(pNode->state), pSender, pSender->term, pSender->startTime, + pSender->snapshotParam.start, pSender->snapshotParam.end, pSender->snapshot.lastApplyIndex, + pSender->snapshot.lastApplyTerm, pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack, + pSender->pSndBuf->start, pSender->pSndBuf->cursor, pSender->pSndBuf->end, pSender->finish, + pSender->replicaIndex, DID(&pNode->replicasId[pSender->replicaIndex]), raftStoreGetTerm(pNode), + pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, + snapshot.lastApplyTerm, pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize, pNode->replicaNum, + pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, pNode->quorum, peerStr, cfgStr); } void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t dflag, SSyncSnapshotReceiver* pReceiver, @@ -316,19 +318,21 @@ void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t df taosPrintLog( flags, level, dflag, "vgId:%d, %s, sync:%s," - " snap-receiver:{%p started:%d acked:%d term:%" PRIu64 " start-time:%" PRId64 " from-dnode:%d, start:%" PRId64 - " end:%" PRId64 " last-index:%" PRId64 " last-term:%" PRIu64 " last-cfg:%" PRId64 + " snap-receiver:%p signature:(%" PRId64 ", %" PRId64 "), {start:%d ack:%d buf:[%" PRId64 " %" PRId64 ", %" PRId64 + ")" + " from-dnode:%d, start:%" PRId64 " end:%" PRId64 " last-index:%" PRId64 " last-term:%" PRIu64 " last-cfg:%" PRId64 "}" ", term:%" PRIu64 ", commit-index:%" PRId64 ", firstver:%" PRId64 ", lastver:%" PRId64 ", min-match:%" PRId64 ", snap:{last-index:%" PRId64 ", last-term:%" PRIu64 "}, standby:%d, batch-sz:%d, replicas:%d, last-cfg:%" PRId64 - ", chging:%d, restore:%d, quorum:%d, lc-timers:{elect:%" PRId64 ", hb:%" PRId64 "}, peer:%s, cfg:%s", - pNode->vgId, eventLog, syncStr(pNode->state), pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term, - pReceiver->startTime, DID(&pReceiver->fromId), pReceiver->snapshotParam.start, pReceiver->snapshotParam.end, + ", chging:%d, restore:%d, quorum:%d, peer:%s, cfg:%s", + pNode->vgId, eventLog, syncStr(pNode->state), pReceiver, pReceiver->term, pReceiver->startTime, pReceiver->start, + pReceiver->ack, pReceiver->pRcvBuf->start, pReceiver->pRcvBuf->cursor, pReceiver->pRcvBuf->end, + DID(&pReceiver->fromId), pReceiver->snapshotParam.start, pReceiver->snapshotParam.end, pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex, raftStoreGetTerm(pNode), pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize, - pNode->replicaNum, pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, - syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr); + pNode->replicaNum, pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, pNode->quorum, peerStr, + cfgStr); } void syncLogRecvTimer(SSyncNode* pSyncNode, const SyncTimeout* pMsg, const char* s) { diff --git a/source/libs/tfs/src/tfsTier.c b/source/libs/tfs/src/tfsTier.c index 1c47182e2a..d4f228a537 100644 --- a/source/libs/tfs/src/tfsTier.c +++ b/source/libs/tfs/src/tfsTier.c @@ -110,7 +110,9 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) { } int32_t retId = -1; + int64_t avail = 0; for (int32_t id = 0; id < TFS_MAX_DISKS_PER_TIER; ++id) { +#if 0 // round-robin int32_t diskId = (pTier->nextid + id) % pTier->ndisk; STfsDisk *pDisk = pTier->disks[diskId]; @@ -126,6 +128,18 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) { terrno = 0; pTier->nextid = (diskId + 1) % pTier->ndisk; break; +#else // select the disk with the most available space + STfsDisk *pDisk = pTier->disks[id]; + if (pDisk == NULL) continue; + + if (pDisk->size.avail < tsMinDiskFreeSize) continue; + + if (pDisk->size.avail > avail) { + avail = pDisk->size.avail; + retId = id; + terrno = 0; + } +#endif } tfsUnLockTier(pTier); diff --git a/source/libs/tfs/test/CMakeLists.txt b/source/libs/tfs/test/CMakeLists.txt index ee28dcf723..2fd0836a1d 100644 --- a/source/libs/tfs/test/CMakeLists.txt +++ b/source/libs/tfs/test/CMakeLists.txt @@ -8,7 +8,7 @@ target_link_libraries( PUBLIC gtest_main ) -add_test( - NAME tfs_test - COMMAND tfs_test -) +# add_test( +# NAME tfs_test +# COMMAND tfs_test +# ) diff --git a/source/os/src/osTime.c b/source/os/src/osTime.c index 05233065fa..e506ee603b 100644 --- a/source/os/src/osTime.c +++ b/source/os/src/osTime.c @@ -477,47 +477,38 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf) { return res; } #ifdef WINDOWS - if (*timep < 0) { - if (*timep < -2208988800LL) { - if (buf != NULL) { - sprintf(buf, "NaN"); - } - return NULL; - } - - SYSTEMTIME s; - FILETIME f; - LARGE_INTEGER offset; - struct tm tm1; - time_t tt = 0; - if (localtime_s(&tm1, &tt) != 0 ) { - if (buf != NULL) { - sprintf(buf, "NaN"); - } - return NULL; - } - offset.QuadPart = TIMEEPOCH1900; - offset.QuadPart += *timep * 10000000; - f.dwLowDateTime = offset.QuadPart & 0xffffffff; - f.dwHighDateTime = (offset.QuadPart >> 32) & 0xffffffff; - FileTimeToSystemTime(&f, &s); - result->tm_sec = s.wSecond; - result->tm_min = s.wMinute; - result->tm_hour = s.wHour; - result->tm_mday = s.wDay; - result->tm_mon = s.wMonth - 1; - result->tm_year = s.wYear - 1900; - result->tm_wday = s.wDayOfWeek; - result->tm_yday = 0; - result->tm_isdst = 0; - } else { - if (localtime_s(result, timep) != 0) { - if (buf != NULL) { - sprintf(buf, "NaN"); - } - return NULL; + if (*timep < -2208988800LL) { + if (buf != NULL) { + sprintf(buf, "NaN"); } + return NULL; } + + SYSTEMTIME s; + FILETIME f; + LARGE_INTEGER offset; + struct tm tm1; + time_t tt = 0; + if (localtime_s(&tm1, &tt) != 0) { + if (buf != NULL) { + sprintf(buf, "NaN"); + } + return NULL; + } + offset.QuadPart = TIMEEPOCH1900; + offset.QuadPart += *timep * 10000000; + f.dwLowDateTime = offset.QuadPart & 0xffffffff; + f.dwHighDateTime = (offset.QuadPart >> 32) & 0xffffffff; + FileTimeToSystemTime(&f, &s); + result->tm_sec = s.wSecond; + result->tm_min = s.wMinute; + result->tm_hour = s.wHour; + result->tm_mday = s.wDay; + result->tm_mon = s.wMonth - 1; + result->tm_year = s.wYear - 1900; + result->tm_wday = s.wDayOfWeek; + result->tm_yday = 0; + result->tm_isdst = 0; #else res = localtime_r(timep, result); if (res == NULL && buf != NULL) { diff --git a/source/os/test/osTimeTests.cpp b/source/os/test/osTimeTests.cpp index 5dd15db4ab..90c089e310 100644 --- a/source/os/test/osTimeTests.cpp +++ b/source/os/test/osTimeTests.cpp @@ -114,10 +114,6 @@ TEST(osTimeTests, taosLocalTime) { ASSERT_EQ(local_time->tm_min, 0); ASSERT_EQ(local_time->tm_sec, 0); - time_t over_timep = 6406301441633558; - local_time = taosLocalTime(&over_timep, &result, NULL); - ASSERT_EQ(local_time, nullptr); - time_t neg_timep3 = -78115158887; local_time = taosLocalTime(&neg_timep3, &result, NULL); ASSERT_EQ(local_time, nullptr); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 233c04b8e3..0e995452c3 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -523,6 +523,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PORT, "Port should be an in TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ENDPOINT, "Endpoint should be in the format of 'fqdn:port'") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_EXPRIE_STATEMENT, "This statement is no longer supported") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL, "Interval too small") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_VALUE_TOO_BIG, "Interval too big") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_DB_NOT_SPECIFIED, "Database not specified") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, "Invalid identifier name") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR, "Corresponding super table not in this db") @@ -611,6 +612,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_TYPE, "Invalid function par TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_VALUE, "Invalid function para value") TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION, "Not buildin function") TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_DUP_TIMESTAMP, "Duplicate timestamps not allowed in function") +TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_TO_TIMESTAMP_FAILED, "Func to_timestamp failed, check log for detail") //udf TAOS_DEFINE_ERROR(TSDB_CODE_UDF_STOPPING, "udf is stopping") diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 24f2ad7e9d..15cb1f034f 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -65,6 +65,10 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interval_limit_opt_2.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interval_limit_opt_2.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interval_limit_opt_2.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/func_to_char_timestamp.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/func_to_char_timestamp.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/func_to_char_timestamp.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/func_to_char_timestamp.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqShow.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeStb0.py @@ -1044,6 +1048,7 @@ e ,,y,script,./test.sh -f tsim/query/tableCount.sim ,,y,script,./test.sh -f tsim/query/show_db_table_kind.sim ,,y,script,./test.sh -f tsim/query/bi_star_table.sim +,,y,script,./test.sh -f tsim/query/bi_tag_scan.sim ,,y,script,./test.sh -f tsim/query/tag_scan.sim ,,y,script,./test.sh -f tsim/query/nullColSma.sim ,,y,script,./test.sh -f tsim/query/bug3398.sim diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh index 94704b1c25..f4db7edb8b 100755 --- a/tests/parallel_test/container_build.sh +++ b/tests/parallel_test/container_build.sh @@ -69,7 +69,7 @@ docker run \ -v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \ -v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \ -v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \ - --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=0;make -j 10|| exit 1" + --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=false -DJEMALLOC_ENABLED=0;make -j 10|| exit 1" # -v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \ if [[ -d ${WORKDIR}/debugNoSan ]] ;then @@ -99,7 +99,7 @@ docker run \ -v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \ -v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \ -v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \ - --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=0;make -j 10|| exit 1 " + --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=false -DJEMALLOC_ENABLED=0;make -j 10|| exit 1 " mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan diff --git a/tests/script/tsim/query/bi_tag_scan.sim b/tests/script/tsim/query/bi_tag_scan.sim new file mode 100644 index 0000000000..5b8af68b5a --- /dev/null +++ b/tests/script/tsim/query/bi_tag_scan.sim @@ -0,0 +1,31 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql drop database if exists db1; +sql create database db1 vgroups 3; +sql create database db1; +sql use db1; +sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create table tba1 using sta tags(1, 1, 1); +sql create table tba2 using sta tags(2, 2, 2); +sql insert into tba1 values(now, 1, "1")(now+3s, 3, "3")(now+5s, 5, "5"); +sql insert into tba2 values(now + 1s, 2, "2")(now+2s, 2, "2")(now+4s, 4, "4"); +sql create table tbn1 (ts timestamp, f1 int); + +set_bi_mode 1 +sql select t1,t2,t3 from db1.sta order by t1; +print $rows $data00 $data10 +if $rows != 2 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim index b3144e4e0d..e5e07dfaec 100644 --- a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim +++ b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim @@ -5,7 +5,7 @@ sleep 50 sql connect print =============== create database with retentions -sql create database d0 retentions 5s:7d,10s:21d,15s:365d; +sql create database d0 retentions -:7d,10s:21d,15s:365d; sql use d0 print =============== create super table and register rsma diff --git a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim index 0b3938d773..6f78829db7 100644 --- a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim +++ b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim @@ -8,7 +8,7 @@ sql connect return 1 print =============== create database with retentions -sql create database d0 retentions 5s:7d,5m:21d,15m:365d; +sql create database d0 retentions -:7d,5m:21d,15m:365d; sql use d0 print =============== create super table and register rsma diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 18893245fa..a92da7f472 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -21,6 +21,7 @@ sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 in sql create stream streams2 trigger at_once watermark 1d IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); sql create stream stream_t2 trigger at_once watermark 1d IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sleep 1000 sql insert into t1 values(1648791210000,1,2,3,1.0); sql insert into t1 values(1648791216000,2,2,3,1.1); @@ -311,6 +312,7 @@ sql create table t2 using st tags(2,2,2); sql create stream streams11 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); sql create stream streams12 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sleep 1000 sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); @@ -444,6 +446,7 @@ sql create table t2 using st tags(2,2,2); sql create stream streams21 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt21 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); sql create stream streams22 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt22 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sleep 1000 sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791223001,2,2,2,1.1); @@ -582,6 +585,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create stream streams23 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt23 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); +sleep 1000 sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791223001,2,2,2,1.1); @@ -706,6 +710,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); +sleep 1000 sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791243000,2,1,1,1.0); @@ -818,4 +823,4 @@ print ============loop_all=$loop_all #=goto looptest -system sh/stop_dnodes.sh \ No newline at end of file +system sh/stop_dnodes.sh diff --git a/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim b/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim index 6f8c095162..3b3cd01521 100644 --- a/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim +++ b/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim @@ -47,7 +47,7 @@ endi $replica = 3 $vgroups = 1 -$retentions = 5s:7d,15s:21d,1m:365d +$retentions = -:7d,15s:21d,1m:365d print ============= create database sql create database db replica $replica vgroups $vgroups retentions $retentions diff --git a/tests/system-test/1-insert/block_wise.py b/tests/system-test/1-insert/block_wise.py index 8222000cd6..1aff2e7708 100644 --- a/tests/system-test/1-insert/block_wise.py +++ b/tests/system-test/1-insert/block_wise.py @@ -417,7 +417,7 @@ class TDTestCase: self.all_test() tdLog.printNoPrefix("==========step2:create table in rollup database") - tdSql.execute("create database db3 retentions 1s:4m,2s:8m,3s:12m") + tdSql.execute("create database db3 retentions -:4m,2s:8m,3s:12m") tdSql.execute("use db3") tdSql.query(f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m sma({INT_COL})") @@ -438,7 +438,7 @@ class TDTestCase: tdSql.execute("drop database if exists db_s20 ") tdLog.printNoPrefix("==========step4:insert and flush in rollup database") - tdSql.execute("create database db4 retentions 1s:4m,2s:8m,3s:12m") + tdSql.execute("create database db4 retentions -:4m,2s:8m,3s:12m") tdSql.execute("use db4") self.__create_tb(rollup="first") self.__insert_data(rollup="first") diff --git a/tests/system-test/1-insert/create_retentions.py b/tests/system-test/1-insert/create_retentions.py index 9435dcd081..a4b2cae68a 100644 --- a/tests/system-test/1-insert/create_retentions.py +++ b/tests/system-test/1-insert/create_retentions.py @@ -54,53 +54,63 @@ class TDTestCase: return [ # check grammar "create database db1 retentions", - "create database db1 retentions 1s:1d,2s:2d,3s:3d,4s:4d", + "create database db1 retentions 1s:1d", + "create database db1 retentions 1s:1d,2s:2d", + "create database db1 retentions 1s:1d,2s:2d,3s:3d", + "create database db1 retentions -:1d,2s:2d,3s:3d,4s:4d", + "create database db1 retentions -:-", + "create database db1 retentions --:1d", + "create database db1 retentions +:1d", + "create database db1 retentions :1d", + "create database db1 retentions -:1d,-:2d", + "create database db1 retentions -:1d,1s:-", + "create database db1 retentions -:1d,15s:2d,-:3d", + # check unit - "create database db1 retentions 1b:1d", - "create database db1 retentions 1u:1d", - "create database db1 retentions 1a:1d", - "create database db1 retentions 1n:1d", - "create database db1 retentions 1y:1d", - "create database db1 retentions 1s:86400s", - "create database db1 retentions 1s:86400000a", - "create database db1 retentions 1s:86400000000u", - "create database db1 retentions 1s:86400000000000b", - "create database db1 retentions 1s:1w", - "create database db1 retentions 1s:1n", - "create database db1 retentions 1s:1y", + "create database db1 retentions -:1d,1b:1d", + "create database db1 retentions -:1d,1u:1d", + "create database db1 retentions -:1d,1a:1d", + "create database db1 retentions -:1d,1n:1d", + "create database db1 retentions -:1d,1y:1d", + "create database db1 retentions -:1d,1s:86400s", + "create database db1 retentions -:1d,1s:86400000a", + "create database db1 retentions -:1d,1s:86400000000u", + "create database db1 retentions -:1d,1s:86400000000000b", + "create database db1 retentions -:1d,1s:1w", + "create database db1 retentions -:1d,1s:1n", + "create database db1 retentions -:1d,1s:1y", + # check value range - "create database db1 retentions -1s:1d", - "create database db1 retentions 0s:1d", - "create database db3 retentions 1s:-1d", - "create database db3 retentions 1s:0d", - "create database db3 retentions 1s:1439m", - "create database db3 retentions 1s:365001d", - "create database db3 retentions 1s:8760001h", - "create database db3 retentions 1s:525600001m", - "create database db3 retentions 1s:106581d precision 'ns'", - "create database db3 retentions 1s:2557921h precision 'ns'", - "create database db3 retentions 1s:153475201m precision 'ns'", + "create database db3 retentions -:-1d", + "create database db3 retentions -:0d", + "create database db3 retentions -:1439m", + "create database db3 retentions -:365001d", + "create database db3 retentions -:8760001h", + "create database db3 retentions -:525600001m", + "create database db3 retentions -:106581d precision 'ns'", + "create database db3 retentions -:2557921h precision 'ns'", + "create database db3 retentions -:153475201m precision 'ns'", # check relationships - "create database db5 retentions 1441m:1440m,2d:3d", - "create database db5 retentions 2m:1d,1s:2d", - "create database db5 retentions 1s:2880m,2s:2879m", - "create database db5 retentions 1s:1d,2s:2d,2s:3d", - "create database db5 retentions 1s:1d,3s:2d,2s:3d", - "create database db1 retentions 1s:1d,2s:3d,3s:2d", + "create database db5 retentions -:1440m,1441m:1440m,2d:3d", + "create database db5 retentions -:1d,2m:1d,1s:2d", + "create database db5 retentions -:1440m,1s:2880m,2s:2879m", + "create database db5 retentions -:1d,2s:2d,2s:3d", + "create database db5 retentions -:1d,3s:2d,2s:3d", + "create database db1 retentions -:1d,2s:3d,3s:2d", ] @property def create_databases_sql_current(self): return [ - f"create database {DB1} retentions 1s:1d", - f"create database {DB2} retentions 1s:1d,2m:2d,3h:3d", + f"create database {DB1} retentions -:1d", + f"create database {DB2} retentions -:1d,2m:2d,3h:3d", ] @property def alter_database_sql(self): return [ - "alter database db1 retentions 99h:99d", - "alter database db2 retentions 97h:97d,98h:98d,99h:99d,", + "alter database db1 retentions -:99d", + "alter database db2 retentions -:97d,98h:98d,99h:99d,", ] @property @@ -172,9 +182,17 @@ class TDTestCase: def test_create_databases(self): for err_sql in self.create_databases_sql_err: tdSql.error(err_sql) + index = 0 for cur_sql in self.create_databases_sql_current: tdSql.execute(cur_sql) - # tdSql.query("select * from information_schema.ins_databases") + if(index == 0): + tdSql.query(f"show create database {DB1}") + else: + tdSql.query(f"show create database {DB2}") + tdSql.checkEqual(len(tdSql.queryResult),1) + tdLog.info("%s" % (tdSql.queryResult[0][1])) + tdSql.checkEqual(tdSql.queryResult[0][1].find("RETENTIONS -:") > 0, True) + index += 1 for alter_sql in self.alter_database_sql: tdSql.error(alter_sql) @@ -281,7 +299,7 @@ class TDTestCase: tdLog.printNoPrefix("==========step2:create table in rollup database") tdLog.printNoPrefix("==========step2.1 : rolluo func is not last/first") - tdSql.prepare(dbname=DB3, **{"retentions": "1s:1d, 3s:3d, 5s:5d"}) + tdSql.prepare(dbname=DB3, **{"retentions": "-:1d, 3s:3d, 5s:5d"}) db3_ctb_num = 10 self.__create_tb(rsma=True, dbname=DB3, ctb_num=db3_ctb_num, stb=STBNAME) @@ -338,7 +356,7 @@ class TDTestCase: tdLog.printNoPrefix("==========step2.2 : rolluo func is last/first") - tdSql.prepare(dbname=DB4, **{"retentions": "1s:1d, 2m:3d, 3m:5d"}) + tdSql.prepare(dbname=DB4, **{"retentions": "-:1d, 2m:3d, 3m:5d"}) db4_ctb_num = 10 tdSql.execute(f"use {DB4}") diff --git a/tests/system-test/1-insert/time_range_wise.py b/tests/system-test/1-insert/time_range_wise.py index df1cc516c5..14b717d1da 100644 --- a/tests/system-test/1-insert/time_range_wise.py +++ b/tests/system-test/1-insert/time_range_wise.py @@ -584,7 +584,7 @@ class TDTestCase: self.all_test() tdLog.printNoPrefix("==========step2:create table in rollup database") - tdSql.execute("create database db3 retentions 1s:4m,2s:8m,3s:12m") + tdSql.execute("create database db3 retentions -:4m,2s:8m,3s:12m") tdSql.execute("use db3") tdSql.execute(f"create stable stb1 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m sma({INT_COL}) ") self.all_test() @@ -603,7 +603,7 @@ class TDTestCase: # add for TS-2440 for i in range(self.rows): tdSql.execute("drop database if exists db3 ") - tdSql.execute("create database db3 retentions 1s:4m,2s:8m,3s:12m") + tdSql.execute("create database db3 retentions -:4m,2s:8m,3s:12m") def stop(self): tdSql.close() diff --git a/tests/system-test/2-query/func_to_char_timestamp.py b/tests/system-test/2-query/func_to_char_timestamp.py new file mode 100644 index 0000000000..639811d275 --- /dev/null +++ b/tests/system-test/2-query/func_to_char_timestamp.py @@ -0,0 +1,177 @@ +import taos +import sys +import time +import socket +import os +import threading +import math + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +# from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.vgroups = 4 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + self.duraion = '1h' + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def create_database(self,tsql, dbName,dropFlag=1,vgroups=2,replica=1, duration:str='1d'): + if dropFlag == 1: + tsql.execute("drop database if exists %s"%(dbName)) + + tsql.execute("create database if not exists %s vgroups %d replica %d duration %s"%(dbName, vgroups, replica, duration)) + tdLog.debug("complete to create database %s"%(dbName)) + return + + def create_stable(self,tsql, paraDict): + colString = tdCom.gen_column_type_str(colname_prefix=paraDict["colPrefix"], column_elm_list=paraDict["colSchema"]) + tagString = tdCom.gen_tag_type_str(tagname_prefix=paraDict["tagPrefix"], tag_elm_list=paraDict["tagSchema"]) + sqlString = f"create table if not exists %s.%s (%s) tags (%s)"%(paraDict["dbName"], paraDict["stbName"], colString, tagString) + tdLog.debug("%s"%(sqlString)) + tsql.execute(sqlString) + return + + def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1,ctbStartIdx=0): + for i in range(ctbNum): + sqlString = "create table %s.%s%d using %s.%s tags(%d, 'tb%d', 'tb%d', %d, %d, %d)" % \ + (dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,(i+ctbStartIdx) % 5,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx) + tsql.execute(sqlString) + + tdLog.debug("complete to create %d child tables by %s.%s" %(ctbNum, dbName, stbName)) + return + + def insert_data(self,tsql,dbName,ctbPrefix,ctbNum,rowsPerTbl,batchNum,startTs,tsStep): + tdLog.debug("start to insert data ............") + tsql.execute("use %s" %dbName) + pre_insert = "insert into " + sql = pre_insert + + for i in range(ctbNum): + rowsBatched = 0 + sql += " %s%d values "%(ctbPrefix,i) + for j in range(rowsPerTbl): + if i % 3 == 0: + ts_format = 'NULL' + else: + ts_format = "'yyyy-mm-dd hh24:mi:ss'" + + if (i < ctbNum/2): + sql += "(%d, %d, %d, %d,%d,%d,%d,true,'2023-11-01 10:10:%d', %s, 'nchar%d') "%(startTs + j*tsStep, j%10, j%10, j%10, j%10, j%10, j%10, j%10, ts_format, j%10) + else: + sql += "(%d, %d, NULL, %d,NULL,%d,%d,true,NULL , %s, 'nchar%d') "%(startTs + j*tsStep, j%10, j%10, j%10, j%10, ts_format, j%10) + rowsBatched += 1 + if ((rowsBatched == batchNum) or (j == rowsPerTbl - 1)): + tsql.execute(sql) + rowsBatched = 0 + if j < rowsPerTbl - 1: + sql = "insert into %s%d values " %(ctbPrefix,i) + else: + sql = "insert into " + if sql != pre_insert: + tsql.execute(sql) + tdLog.debug("insert data ............ [OK]") + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'test', + 'dropFlag': 1, + 'vgroups': 2, + 'stbName': 'meters', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'FLOAT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'smallint', 'count':1},{'type': 'tinyint', 'count':1},{'type': 'bool', 'count':1},{'type': 'varchar', 'len':1024, 'count':2},{'type': 'nchar', 'len':10, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'nchar', 'len':20, 'count':1},{'type': 'binary', 'len':20, 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'smallint', 'count':1},{'type': 'DOUBLE', 'count':1}], + 'ctbPrefix': 't', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 10000, + 'batchNum': 3000, + 'startTs': 1537146000000, + 'tsStep': 600000} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create database") + self.create_database(tsql=tdSql, dbName=paraDict["dbName"], dropFlag=paraDict["dropFlag"], vgroups=paraDict["vgroups"], replica=self.replicaVar, duration=self.duraion) + + tdLog.info("create stb") + self.create_stable(tsql=tdSql, paraDict=paraDict) + + tdLog.info("create child tables") + self.create_ctable(tsql=tdSql, dbName=paraDict["dbName"], \ + stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"],\ + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict["ctbStartIdx"]) + self.insert_data(tsql=tdSql, dbName=paraDict["dbName"],\ + ctbPrefix=paraDict["ctbPrefix"],ctbNum=paraDict["ctbNum"],\ + rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],\ + startTs=paraDict["startTs"],tsStep=paraDict["tsStep"]) + return + + def convert_ts_and_check(self, ts_str: str, ts_format: str, expect_ts_char: str, expect_ts: str): + tdSql.query("select to_timestamp('%s', '%s')" % (ts_str, ts_format), queryTimes=1) + tdSql.checkData(0, 0, expect_ts) + tdSql.query("select to_char(to_timestamp('%s', '%s'), '%s')" % (ts_str, ts_format, ts_format), queryTimes=1) + tdSql.checkData(0, 0, expect_ts_char) + + def test_to_timestamp(self): + self.convert_ts_and_check('2023-10-10 12:13:14.123', 'YYYY-MM-DD HH:MI:SS.MS', '2023-10-10 12:13:14.123', '2023-10-10 00:13:14.123000') + self.convert_ts_and_check('2023-10-10 12:00:00.000AM', 'YYYY-DD-MM HH12:MI:SS.MSPM', '2023-10-10 12:00:00.000AM', '2023-10-10 00:00:00.000000') + self.convert_ts_and_check('2023-01-01 12:10:10am', 'yyyy-mm-dd HH12:MI:SSAM', '2023-01-01 12:10:10AM', '2023-1-1 00:10:10.000000') + self.convert_ts_and_check('23-1-01 9:10:10.123p.m.', 'yy-MM-dd HH12:MI:ss.msa.m.', '23-01-01 09:10:10.123p.m.', '2023-1-1 21:10:10.123000') + self.convert_ts_and_check('23-1-01 9:10:10.123.000456.000000789p.m.', 'yy-MM-dd HH12:MI:ss.ms.us.nsa.m.', '23-01-01 09:10:10.123.123000.123000000p.m.', '2023-1-1 21:10:10.123000') + self.convert_ts_and_check(' 23 -1 - 01 \t 21:10:10 . 12 . \t 00045 . 00000078 \t', 'yy-MM-dd HH24:MI:SS.ms.us.ns', '23-01-01 21:10:10.120.120000.120000000', '2023-1-1 21:10:10.120000') + self.convert_ts_and_check(' 23 年 -1 月 - 01 日 \t 21:10:10 . 12 . \t 00045 . 00000078 \t+08', 'yy\"年\"-MM月-dd日 HH24:MI:SS.ms.us.ns TZH', '23年-01月-01日 21:10:10.120.120000.120000000 +08', '2023-1-1 21:10:10.120000') + self.convert_ts_and_check('23-1-01 7:10:10.123p.m.6', 'yy-MM-dd HH:MI:ss.msa.m.TZH', '23-01-01 09:10:10.123p.m.+08', '2023-1-1 21:10:10.123000') + + self.convert_ts_and_check('2023-OCTober-19 10:10:10AM Thu', 'yyyy-month-dd hh24:mi:ssam dy', '2023-october -19 10:10:10am thu', '2023-10-19 10:10:10') + + tdSql.error("select to_timestamp('210013/2', 'yyyyMM/dd')") + tdSql.error("select to_timestamp('2100111111111/13/2', 'yyyyMM/dd')") + + tdSql.error("select to_timestamp('210a12/2', 'yyyyMM/dd')") + + tdSql.query("select to_timestamp(to_char(ts, 'yy-mon-dd hh24:mi:ss dy'), 'yy-mon-dd hh24:mi:ss dy') == ts from meters limit 10") + tdSql.checkData(0, 0, 1) + tdSql.checkData(1, 0, 1) + tdSql.checkRows(10) + + tdSql.query("select to_char(ts, 'yy-mon-dd hh24:mi:ss.msa.m.TZH Day') from meters where to_timestamp(to_char(ts, 'yy-mon-dd hh24:mi:ss dy'), 'yy-mon-dd hh24:mi:ss dy') != ts") + tdSql.checkRows(0) + + tdSql.query("select to_timestamp(c8, 'YYYY-MM-DD hh24:mi:ss') from meters") + tdSql.query("select to_timestamp(c8, c9) from meters") + + format = "YYYY-MM-DD HH:MI:SS" + for i in range(500): + format = format + "1234567890" + tdSql.query("select to_char(ts, '%s') from meters" % (format), queryTimes=1) + time_str = '2023-11-11 10:10:10' + for i in range(500): + time_str = time_str + "1234567890" + tdSql.query("select to_timestamp('%s', '%s')" % (time_str, format)) + + def run(self): + self.prepareTestEnv() + self.test_to_timestamp() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase())