diff --git a/docs/en/14-reference/03-connector/java.mdx b/docs/en/14-reference/03-connector/java.mdx index ff15acf1a9..310e0a15c6 100644 --- a/docs/en/14-reference/03-connector/java.mdx +++ b/docs/en/14-reference/03-connector/java.mdx @@ -202,6 +202,10 @@ The configuration parameters in the URL are as follows. - batchfetch: true: pull the result set in batch when executing the query; false: pull the result set row by row. The default value is false. batchfetch uses HTTP for data transfer. The JDBC REST connection supports bulk data pulling function in taos-jdbcdriver-2.0.38 and TDengine 2.4.0.12 and later versions. taos-jdbcdriver and TDengine transfer data via WebSocket connection. Compared with HTTP, WebSocket enables JDBC REST connection to support large data volume querying and improve query performance. - charset: specify the charset to parse the string, this parameter is valid only when set batchfetch to true. - batchErrorIgnore: true: when executing executeBatch of Statement, if one SQL execution fails in the middle, continue to execute the following SQL. false: no longer execute any statement after the failed SQL. The default value is: false. +- httpConnectTimeout: REST connection timeout in milliseconds, the default value is 5000 ms. +- httpSocketTimeout: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when batchfetch is false. +- messageWaitTimeout: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when batchfetch is true. +- useSSL: connecting Securely Using SSL. true: using SSL conneciton, false: not using SSL connection. **Note**: Some configuration items (e.g., locale, timezone) do not work in the REST connection. @@ -257,14 +261,18 @@ In the above example, a connection is established to `taosdemo.com`, port is 603 The configuration parameters in properties are as follows. -- TSDBDriver.PROPERTY_KEY_USER: Login TDengine user name, default value 'root'. +- TSDBDriver.PROPERTY_KEY_USER: login TDengine user name, default value 'root'. - TSDBDriver.PROPERTY_KEY_PASSWORD: user login password, default value 'taosdata'. - TSDBDriver.PROPERTY_KEY_BATCH_LOAD: true: pull the result set in batch when executing query; false: pull the result set row by row. The default value is: false. - TSDBDriver.PROPERTY_KEY_BATCH_ERROR_IGNORE: true: when executing executeBatch of Statement, if there is a SQL execution failure in the middle, continue to execute the following sq. false: no longer execute any statement after the failed SQL. The default value is: false. -- TSDBDriver.PROPERTY_KEY_CONFIG_DIR: Only works when using JDBC native connection. Client configuration file directory path, default value `/etc/taos` on Linux OS, default value `C:/TDengine/cfg` on Windows OS. +- TSDBDriver.PROPERTY_KEY_CONFIG_DIR: only works when using JDBC native connection. Client configuration file directory path, default value `/etc/taos` on Linux OS, default value `C:/TDengine/cfg` on Windows OS. - TSDBDriver.PROPERTY_KEY_CHARSET: In the character set used by the client, the default value is the system character set. - TSDBDriver.PROPERTY_KEY_LOCALE: this only takes effect when using JDBC native connection. Client language environment, the default value is system current locale. - TSDBDriver.PROPERTY_KEY_TIME_ZONE: only takes effect when using JDBC native connection. In the time zone used by the client, the default value is the system's current time zone. +- TSDBDriver.HTTP_CONNECT_TIMEOUT: REST connection timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection. +- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket timeout in milliseconds, the default value is 5000 ms. It only takes effect when using JDBC REST connection and batchfetch is false. +- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: message transmission timeout in milliseconds, the default value is 3000 ms. It only takes effect when using JDBC REST connection and batchfetch is true. +- TSDBDriver.PROPERTY_KEY_USE_SSL: connecting Securely Using SSL. true: using SSL conneciton, false: not using SSL connection. It only takes effect when using using JDBC REST connection. For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](/reference/config/#Client-Only). ### Priority of configuration parameters @@ -812,11 +820,12 @@ Please refer to: [JDBC example](https://github.com/taosdata/TDengine/tree/develo ## Recent update logs -| taos-jdbcdriver version | major changes | -| :---------------------: | :------------------------------------------: | -| 2.0.38 | JDBC REST connections add bulk pull function | -| 2.0.37 | Added support for json tags | -| 2.0.36 | Add support for schemaless writing | +| taos-jdbcdriver version | major changes | +| :---------------------: | :--------------------------------------------: | +| 2.0.39 - 2.0.40 | Add REST connection/request timeout parameters | +| 2.0.38 | JDBC REST connections add bulk pull function | +| 2.0.37 | Support json tags | +| 2.0.36 | Support schemaless writing | ## Frequently Asked Questions diff --git a/docs/zh/14-reference/03-connector/java.mdx b/docs/zh/14-reference/03-connector/java.mdx index ddab9e5f24..838fa2eff8 100644 --- a/docs/zh/14-reference/03-connector/java.mdx +++ b/docs/zh/14-reference/03-connector/java.mdx @@ -201,6 +201,10 @@ url 中的配置参数如下: - batchfetch: true:在执行查询时批量拉取结果集;false:逐行拉取结果集。默认值为:false。逐行拉取结果集使用 HTTP 方式进行数据传输。从 taos-jdbcdriver-2.0.38 和 TDengine 2.4.0.12 版本开始,JDBC REST 连接增加批量拉取数据功能。taos-jdbcdriver 与 TDengine 之间通过 WebSocket 连接进行数据传输。相较于 HTTP,WebSocket 可以使 JDBC REST 连接支持大数据量查询,并提升查询性能。 - charset: 当开启批量拉取数据时,指定解析字符串数据的字符集。 - batchErrorIgnore:true:在执行 Statement 的 executeBatch 时,如果中间有一条 SQL 执行失败,继续执行下面的 SQL 了。false:不再执行失败 SQL 后的任何语句。默认值为:false。 +- httpConnectTimeout: 连接超时时间,单位 ms, 默认值为 5000。 +- httpSocketTimeout: socket 超时时间,单位 ms,默认值为 5000。仅在 batchfetch 设置为 false 时生效。 +- messageWaitTimeout: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 batchfetch 设置为 true 时生效。 +- useSSL: 连接中是否使用 SSL。 **注意**:部分配置项(比如:locale、timezone)在 REST 连接中不生效。 @@ -264,7 +268,11 @@ properties 中的配置参数如下: - TSDBDriver.PROPERTY_KEY_CHARSET:客户端使用的字符集,默认值为系统字符集。 - TSDBDriver.PROPERTY_KEY_LOCALE:仅在使用 JDBC 原生连接时生效。 客户端语言环境,默认值系统当前 locale。 - TSDBDriver.PROPERTY_KEY_TIME_ZONE:仅在使用 JDBC 原生连接时生效。 客户端使用的时区,默认值为系统当前时区。 -- 此外对 JDBC 原生连接,通过指定 URL 和 Properties 还可以指定其他参数,比如日志级别、SQL 长度等。更多详细配置请参考[客户端配置](/reference/config/#仅客户端适用)。 +- TSDBDriver.HTTP_CONNECT_TIMEOUT: 连接超时时间,单位 ms, 默认值为 5000。仅在 REST 连接时生效。 +- TSDBDriver.HTTP_SOCKET_TIMEOUT: socket 超时时间,单位 ms,默认值为 5000。仅在 REST 连接且 batchfetch 设置为 false 时生效。 +- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: 消息超时时间, 单位 ms, 默认值为 3000。 仅在 REST 连接且 batchfetch 设置为 true 时生效。 +- TSDBDriver.PROPERTY_KEY_USE_SSL: 连接中是否使用 SSL。仅在 REST 连接时生效。 + 此外对 JDBC 原生连接,通过指定 URL 和 Properties 还可以指定其他参数,比如日志级别、SQL 长度等。更多详细配置请参考[客户端配置](/reference/config/#仅客户端适用)。 ### 配置参数的优先级 @@ -809,6 +817,7 @@ Query OK, 1 row(s) in set (0.000141s) | taos-jdbcdriver 版本 | 主要变化 | | :------------------: | :----------------------------: | +| 2.0.39 - 2.0.40 | 增加 REST 连接/请求 超时设置 | | 2.0.38 | JDBC REST 连接增加批量拉取功能 | | 2.0.37 | 增加对 json tag 支持 | | 2.0.36 | 增加对 schemaless 写入支持 | diff --git a/include/client/taos.h b/include/client/taos.h index 8afefe4e6b..f8af010aa6 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -259,7 +259,7 @@ enum tmq_res_t { TMQ_RES_TABLE_META = 2, }; -typedef struct { +typedef struct tmq_raw_data{ void* raw_meta; uint32_t raw_meta_len; uint16_t raw_meta_type; diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 930b7be3ef..0b647934ff 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -54,12 +54,12 @@ enum { enum { STREAM_INPUT__DATA_SUBMIT = 1, STREAM_INPUT__DATA_BLOCK, + STREAM_INPUT__MERGED_SUBMIT, // STREAM_INPUT__TABLE_SCAN, STREAM_INPUT__TQ_SCAN, STREAM_INPUT__DATA_RETRIEVE, STREAM_INPUT__GET_RES, STREAM_INPUT__CHECKPOINT, - STREAM_INPUT__DROP, }; typedef enum EStreamType { diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 8b0a836ad2..16e1a1c395 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -40,6 +40,7 @@ typedef struct SReadHandle { bool initMetaReader; bool initTableReader; bool initTqReader; + int32_t numOfVgroups; } SReadHandle; // in queue mode, data streams are seperated by msg @@ -63,7 +64,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers); * @param SReadHandle * @return */ -qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers); +qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols); /** * Set the input data block for the stream scan. diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index a93cf1f9b8..58739b4af7 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -162,9 +162,12 @@ typedef struct SRequestConnInfo { SEpSet mgmtEps; } SRequestConnInfo; +typedef void (*__freeFunc)(void *param); + typedef struct SMsgSendInfo { __async_send_cb_fn_t fp; // async callback function STargetInfo target; // for update epset + __freeFunc paramFreeFp; void* param; uint64_t requestId; uint64_t requestObjRefId; @@ -188,6 +191,8 @@ int32_t cleanupTaskQueue(); */ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code); +void destroySendMsgInfo(SMsgSendInfo* pMsgBody); + int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo, bool persistHandle, void* ctx); diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 8c69c0f2de..f6c3b3f5b2 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -77,6 +77,13 @@ typedef struct { SSubmitReq* data; } SStreamDataSubmit; +typedef struct { + int8_t type; + int64_t ver; + SArray* dataRefs; // SArray + SArray* reqs; // SArray +} SStreamMergedSubmit; + typedef struct { int8_t type; @@ -262,6 +269,7 @@ typedef struct SStreamTask { int64_t startVer; int64_t checkpointVer; int64_t processedVer; + int32_t numOfVgroups; // children info SArray* childEpInfo; // SArray diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index 7e2d09dd63..00a36391fa 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -64,6 +64,7 @@ typedef struct { int64_t verInSnapshotting; int64_t snapshotVer; int64_t commitVer; + int64_t appliedVer; int64_t lastVer; } SWalVer; @@ -172,6 +173,9 @@ int32_t walRollback(SWal *, int64_t ver); int32_t walBeginSnapshot(SWal *, int64_t ver); int32_t walEndSnapshot(SWal *); int32_t walRestoreFromSnapshot(SWal *, int64_t ver); +// for tq +int32_t walApplyVer(SWal *, int64_t ver); + // int32_t walDataCorrupted(SWal*); // read @@ -186,7 +190,6 @@ void walSetReaderCapacity(SWalReader *pRead, int32_t capacity); int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead); int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead); int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead); - typedef struct { int64_t refId; int64_t ver; @@ -206,6 +209,7 @@ int64_t walGetFirstVer(SWal *); int64_t walGetSnapshotVer(SWal *); int64_t walGetLastVer(SWal *); int64_t walGetCommittedVer(SWal *); +int64_t walGetAppliedVer(SWal *); #ifdef __cplusplus } diff --git a/include/util/taoserror.h b/include/util/taoserror.h index d0321d3724..89b0e6f952 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -493,10 +493,11 @@ int32_t* taosGetErrno(); //parser #define TSDB_CODE_PAR_SYNTAX_ERROR TAOS_DEF_ERROR_CODE(0, 0x2600) -#define TSDB_CODE_PAR_INVALID_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2601) -#define TSDB_CODE_PAR_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x2602) -#define TSDB_CODE_PAR_AMBIGUOUS_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2603) -#define TSDB_CODE_PAR_WRONG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x2604) +#define TSDB_CODE_PAR_INCOMPLETE_SQL TAOS_DEF_ERROR_CODE(0, 0x2601) +#define TSDB_CODE_PAR_INVALID_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2602) +#define TSDB_CODE_PAR_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x2603) +#define TSDB_CODE_PAR_AMBIGUOUS_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2604) +#define TSDB_CODE_PAR_WRONG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x2605) #define TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION TAOS_DEF_ERROR_CODE(0, 0x2608) #define TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT TAOS_DEF_ERROR_CODE(0, 0x2609) #define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A) @@ -504,7 +505,6 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C) #define TSDB_CODE_PAR_TAGS_NOT_MATCHED TAOS_DEF_ERROR_CODE(0, 0x260D) #define TSDB_CODE_PAR_INVALID_TAG_NAME TAOS_DEF_ERROR_CODE(0, 0x260E) -#define TSDB_CODE_PAR_INCOMPLETE_SQL TAOS_DEF_ERROR_CODE(0, 0x260F) #define TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2610) #define TSDB_CODE_PAR_PASSWD_EMPTY TAOS_DEF_ERROR_CODE(0, 0x2611) #define TSDB_CODE_PAR_INVALID_PORT TAOS_DEF_ERROR_CODE(0, 0x2612) @@ -514,19 +514,9 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_DB_NOT_SPECIFIED TAOS_DEF_ERROR_CODE(0, 0x2616) #define TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME TAOS_DEF_ERROR_CODE(0, 0x2617) #define TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR TAOS_DEF_ERROR_CODE(0, 0x2618) -#define TSDB_CODE_PAR_INVALID_RANGE_OPTION TAOS_DEF_ERROR_CODE(0, 0x2619) -#define TSDB_CODE_PAR_INVALID_STR_OPTION TAOS_DEF_ERROR_CODE(0, 0x261A) -#define TSDB_CODE_PAR_INVALID_ENUM_OPTION TAOS_DEF_ERROR_CODE(0, 0x261B) -#define TSDB_CODE_PAR_INVALID_KEEP_NUM TAOS_DEF_ERROR_CODE(0, 0x261D) -#define TSDB_CODE_PAR_INVALID_KEEP_ORDER TAOS_DEF_ERROR_CODE(0, 0x261E) -#define TSDB_CODE_PAR_INVALID_KEEP_VALUE TAOS_DEF_ERROR_CODE(0, 0x261F) -#define TSDB_CODE_PAR_INVALID_COMMENT_OPTION TAOS_DEF_ERROR_CODE(0, 0x2620) -#define TSDB_CODE_PAR_INVALID_F_RANGE_OPTION TAOS_DEF_ERROR_CODE(0, 0x2621) -#define TSDB_CODE_PAR_INVALID_ROLLUP_OPTION TAOS_DEF_ERROR_CODE(0, 0x2622) -#define TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION TAOS_DEF_ERROR_CODE(0, 0x2623) +#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_GROUPBY_WINDOW_COEXIST TAOS_DEF_ERROR_CODE(0, 0x2624) -#define TSDB_CODE_PAR_INVALID_OPTION_UNIT TAOS_DEF_ERROR_CODE(0, 0x2625) -#define TSDB_CODE_PAR_INVALID_KEEP_UNIT TAOS_DEF_ERROR_CODE(0, 0x2626) #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) #define TSDB_CODE_PAR_INVALID_STATE_WIN_COL TAOS_DEF_ERROR_CODE(0, 0x2629) @@ -580,7 +570,6 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2659) #define TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x265A) #define TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x265B) -#define TSDB_CODE_PAR_INVALID_TABLE_OPTION TAOS_DEF_ERROR_CODE(0, 0x265C) #define TSDB_CODE_PAR_INVALID_INTERP_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x265D) #define TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN TAOS_DEF_ERROR_CODE(0, 0x265E) #define TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE TAOS_DEF_ERROR_CODE(0, 0x265F) diff --git a/include/util/tarray.h b/include/util/tarray.h index 482f13de39..7c1bc34d71 100644 --- a/include/util/tarray.h +++ b/include/util/tarray.h @@ -87,6 +87,14 @@ void taosArrayRemoveBatch(SArray* pArray, const int32_t* pData, int32_t numOfEle */ void taosArrayRemoveDuplicate(SArray* pArray, __compar_fn_t comparFn, void (*fp)(void*)); +/** + * + * @param pArray + * @param comparFn + * @param fp + */ +void taosArrayRemoveDuplicateP(SArray* pArray, __compar_fn_t comparFn, void (*fp)(void*)); + /** * add all element from the source array list into the destination * @param pArray diff --git a/packaging/deb/DEBIAN/preinst b/packaging/deb/DEBIAN/preinst index c9957fc89c..184653991c 100644 --- a/packaging/deb/DEBIAN/preinst +++ b/packaging/deb/DEBIAN/preinst @@ -38,4 +38,4 @@ fi # there can not libtaos.so*, otherwise ln -s error ${csudo}rm -f ${install_main_dir}/driver/libtaos.* || : -${csudo}rm -f ${install_main_dir}/driver/libtaosws.* || : +[ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}rm -f ${install_main_dir}/driver/libtaosws.so || : diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm index 5ff970bb70..14c814eb83 100644 --- a/packaging/deb/DEBIAN/prerm +++ b/packaging/deb/DEBIAN/prerm @@ -32,9 +32,9 @@ else ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : - ${csudo}rm -f ${inc_link_dir}/taosws.h || : + [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib_link_dir}/libtaosws.* || : + [ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || : ${csudo}rm -f ${log_link_dir} || : ${csudo}rm -f ${data_link_dir} || : diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index f09d46da59..3e46a1aa55 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -68,12 +68,12 @@ fi cp ${compile_dir}/build/bin/taos ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_path}/driver -cp ${compile_dir}/build/lib/${wslibfile} ${pkg_dir}${install_home_path}/driver ||: +[ -f ${compile_dir}/build/lib/${wslibfile} ] && cp ${compile_dir}/build/lib/${wslibfile} ${pkg_dir}${install_home_path}/driver ||: cp ${compile_dir}/../include/client/taos.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/common/taosdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/util/taoserror.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/libs/function/taosudf.h ${pkg_dir}${install_home_path}/include -cp ${compile_dir}/build/include/taosws.h ${pkg_dir}${install_home_path}/include ||: +[ -f ${compile_dir}/build/include/taosws.h ] && cp ${compile_dir}/build/include/taosws.h ${pkg_dir}${install_home_path}/include ||: cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples #cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index bf0921f18a..79e4b2edb8 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -75,12 +75,12 @@ if [ -f %{_compiledir}/build/bin/taosadapter ]; then cp %{_compiledir}/build/bin/taosadapter %{buildroot}%{homepath}/bin ||: fi cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver -cp %{_compiledir}/build/lib/${wslibfile} %{buildroot}%{homepath}/driver ||: +[ -f %{_compiledir}/build/lib/${wslibfile} ] && cp %{_compiledir}/build/lib/${wslibfile} %{buildroot}%{homepath}/driver ||: cp %{_compiledir}/../include/client/taos.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/common/taosdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/util/taoserror.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/libs/function/taosudf.h %{buildroot}%{homepath}/include -cp %{_compiledir}/build/include/taosws.h %{buildroot}%{homepath}/include ||: +[ -f %{_compiledir}/build/include/taosws.h ] && cp %{_compiledir}/build/include/taosws.h %{buildroot}%{homepath}/include ||: #cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 72ac76ec8e..2c3b70f5ed 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -229,13 +229,13 @@ function install_lib() { ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so - [ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.so ${lib_link_dir}/libtaosws.so || : + [ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -sf ${install_main_dir}/driver/libtaosws.so ${lib_link_dir}/libtaosws.so || : if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : - ${csudo}ln -s ${install_main_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || : + [ -f ${install_main_dir}/libtaosws.so ] && ${csudo}ln -sf ${install_main_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || : fi ${csudo}ldconfig @@ -320,7 +320,7 @@ function install_jemalloc() { function install_header() { ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : - ${csudo}rm -f ${inc_link_dir}/taosws.h || : + [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h @@ -328,7 +328,7 @@ function install_header() { ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h - [ -f ${install_main_dir}/include/taosws.h ] && ${csudo}ln -s ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h || : + [ -f ${install_main_dir}/include/taosws.h ] && ${csudo}ln -sf ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h || : } function add_newHostname_to_hosts() { diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index a205206dda..254e7212fc 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -116,7 +116,8 @@ function install_bin() { function clean_lib() { sudo rm -f /usr/lib/libtaos.* || : - sudo rm -f /usr/lib/libtaosws.* || : + [ -f /usr/lib/libtaosws.so ] && sudo rm -f /usr/lib/libtaosws.so || : + [ -f /usr/lib64/libtaosws.so ] && sudo rm -f /usr/lib64/libtaosws.so || : sudo rm -rf ${lib_dir} || : } @@ -125,8 +126,9 @@ function install_lib() { ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib_link_dir}/libtaosws.* || : - ${csudo}rm -f ${lib64_link_dir}/libtaosws.* || : + [ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || : + [ -f ${lib64_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.so || : + #${csudo}rm -rf ${v15_java_app_dir} || : ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/* @@ -135,19 +137,19 @@ function install_lib() { ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so - [ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.so ${lib_link_dir}/libtaosws.so + [ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -sf ${install_main_dir}/driver/libtaosws.so ${lib_link_dir}/libtaosws.so ||: if [ -d "${lib64_link_dir}" ]; then ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : - [ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.so ${lib64_link_dir}/libtaosws.so || : + [ -f ${install_main_dir}/driver/libtaosws.so ] && ${csudo}ln -sf ${install_main_dir}/driver/libtaosws.so ${lib64_link_dir}/libtaosws.so || : fi else ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib - [ -f ${install_main_dir}/driver/libtaosws.dylib ] && ${csudo}ln -s ${install_main_dir}/driver/libtaosws.dylib ${lib_link_dir}/libtaosws.dylib + [ -f ${install_main_dir}/driver/libtaosws.dylib ] && ${csudo}ln -sf ${install_main_dir}/driver/libtaosws.dylib ${lib_link_dir}/libtaosws.dylib ||: fi if [ "$osType" != "Darwin" ]; then @@ -165,7 +167,7 @@ function install_header() { ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h - [ -f ${install_main_dir}/include/taosws.h ] && ${csudo}ln -s ${install_main_dir}/include/taosws.h ${inc_link_dir}/taos.h + [ -f ${install_main_dir}/include/taosws.h ] && ${csudo}ln -sf ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h ||: } function install_jemalloc() { diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 680fa6736b..d8d4c5bf2a 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -294,10 +294,10 @@ function install_avro() { function install_lib() { # Remove links ${csudo}rm -f ${lib_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib_link_dir}/libtaosws.* || : + [ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || : if [ "$osType" != "Darwin" ]; then ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib64_link_dir}/libtaosws.* || : + [ -f ${lib64_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.so || : fi if [ "$osType" != "Darwin" ]; then @@ -362,13 +362,13 @@ function install_header() { if [ "$osType" != "Darwin" ]; then ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : - ${csudo}rm -f ${inc_link_dir}/taosws.h ||: + [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h ||: ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* if [ -f ${binary_dir}/build/include/taosws.h ]; then ${csudo}cp -f ${binary_dir}/build/include/taosws.h ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/taosws.h ||: - ${csudo}ln -s ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h ||: + ${csudo}ln -sf ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h ||: fi ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index f34adca9f8..a3f4c35842 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -93,7 +93,7 @@ else fi lib_files="${build_dir}/lib/libtaos.so.${version}" -wslib_files="${build_dir}/lib/libtaosws.so." +wslib_files="${build_dir}/lib/libtaosws.so" header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" wsheader_files="${build_dir}/include/taosws.h" diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 28163775a1..d637ab8d5a 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -82,33 +82,33 @@ function kill_taosd() { function install_include() { ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : - ${csudo}rm -f ${inc_link_dir}/taosws.h + [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h ||: ${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h - ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h + ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h - [ -f ${inc_dir}/taosws.h ] && ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h ||: + [ -f ${inc_dir}/taosws.h ] && ${csudo}ln -sf ${inc_dir}/taosws.h ${inc_link_dir}/taosws.h ||: } function install_lib() { ${csudo}rm -f ${lib_link_dir}/libtaos* || : ${csudo}rm -f ${lib64_link_dir}/libtaos* || : - ${csudo}rm -f ${lib_link_dir}/libtaosws* || : - ${csudo}rm -f ${lib64_link_dir}/libtaosws* || : + [ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || : + [ -f ${lib64_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.so || : ${csudo}ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so - [ -f ${lib_dir}/libtaosws.so ]${csudo}ln -s ${lib_dir}/libtaosws.so ${lib_link_dir}/libtaosws.so + [ -f ${lib_dir}/libtaosws.so ] && ${csudo}ln -sf ${lib_dir}/libtaosws.so ${lib_link_dir}/libtaosws.so ||: if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then ${csudo}ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : - [ -ff ${lib_dir}/libtaosws.so ] && ${csudo}ln -s ${lib_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || : + [ -f ${lib_dir}/libtaosws.so ] && ${csudo}ln -sf ${lib_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || : fi ${csudo}ldconfig diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 1bd5ed3ea4..bf4ff564f5 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -102,10 +102,10 @@ function clean_local_bin() { function clean_lib() { # Remove link ${csudo}rm -f ${lib_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib_link_dir}/libtaosws.* || : + [ -f ${lib_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.so || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : - ${csudo}rm -f ${lib64_link_dir}/libtaosws.* || : + [ -f ${lib64_link_dir}/libtaosws.so ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.so || : #${csudo}rm -rf ${v15_java_app_dir} || : } @@ -116,7 +116,7 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taoserror.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : - ${csudo}rm -f ${inc_link_dir}/taosws.h || : + [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : } function clean_config() { diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index b52df105b1..6a583842d1 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -286,13 +286,10 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { if (pInst == NULL || NULL == *pInst) { taosThreadMutexUnlock(&appInfo.mutex); tscError("cluster not exist, key:%s", key); - taosMemoryFreeClear(param); tFreeClientHbBatchRsp(&pRsp); return -1; } - taosMemoryFreeClear(param); - if (code != 0) { (*pInst)->onlineDnodes = ((*pInst)->totalDnodes ? 0 : -1); tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), (*pInst)->onlineDnodes, (*pInst)->totalDnodes); @@ -716,6 +713,7 @@ static void *hbThreadFunc(void *param) { pInfo->msgInfo.len = tlen; pInfo->msgType = TDMT_MND_HEARTBEAT; pInfo->param = strdup(pAppHbMgr->key); + pInfo->paramFreeFp = taosMemoryFree; pInfo->requestId = generateRequestId(); pInfo->requestObjRefId = 0; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 73374c7f77..bd9c8d794d 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -29,7 +29,6 @@ static int32_t initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet); static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest); -static void destroySendMsgInfo(SMsgSendInfo* pMsgBody); static bool stringLengthCheck(const char* str, size_t maxsize) { if (str == NULL) { @@ -1215,13 +1214,6 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) { return pMsgSendInfo; } -static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { - assert(pMsgBody != NULL); - taosMemoryFreeClear(pMsgBody->target.dbFName); - taosMemoryFreeClear(pMsgBody->msgInfo.pData); - taosMemoryFreeClear(pMsgBody); -} - void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg, SEpSet* pEpSet) { if (NULL == pEpSet) { return; @@ -2101,8 +2093,9 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly); tsem_wait(¶m->sem); - - param->pRequest->syncQuery = true; + if (param->pRequest != NULL) { + param->pRequest->syncQuery = true; + } return param->pRequest; #else size_t sqlLen = strlen(sql); diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 520a566e2b..db33532aef 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -255,6 +255,8 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid); } + taosMemoryFree(pMsg->pData); + if (pRequest->body.queryFp != NULL) { pRequest->body.queryFp(pRequest->body.param, pRequest, code); } else { @@ -278,6 +280,8 @@ int32_t processAlterStbRsp(void* param, SDataBuf* pMsg, int32_t code) { pRequest->body.resInfo.execRes.res = alterRsp.pMeta; } + taosMemoryFree(pMsg->pData); + if (pRequest->body.queryFp != NULL) { SExecResult* pRes = &pRequest->body.resInfo.execRes; @@ -387,6 +391,8 @@ int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) { tFreeSShowVariablesRsp(&rsp); } + taosMemoryFree(pMsg->pData); + if (pRequest->body.queryFp != NULL) { pRequest->body.queryFp(pRequest->body.param, pRequest, code); } else { diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 49f26e2c24..078ecbb4db 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1217,6 +1217,9 @@ static int32_t smlParseCols(const char *data, int32_t len, SArray *cols, char *c kv->value = value; kv->length = valueLen; if (isTag) { + if(valueLen > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE){ + return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; + } kv->type = TSDB_DATA_TYPE_NCHAR; } else { int32_t ret = smlParseValue(kv, msg); diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 18dc4d1659..4c29adcdc0 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -504,6 +504,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT pMsgSendInfo->requestId = generateRequestId(); pMsgSendInfo->requestObjRefId = 0; pMsgSendInfo->param = pParam; + pMsgSendInfo->paramFreeFp = taosMemoryFree; pMsgSendInfo->fp = tmqCommitCb2; pMsgSendInfo->msgType = TDMT_VND_MQ_COMMIT_OFFSET; // send msg @@ -2192,17 +2193,19 @@ static char* buildCreateCTableJson(STag* pTag, char* sname, char* name, SArray* cJSON* ttype = cJSON_CreateNumber(pTagVal->type); cJSON_AddItemToObject(tag, "type", ttype); - char* buf = NULL; + cJSON* tvalue = NULL; if (IS_VAR_DATA_TYPE(pTagVal->type)) { - buf = taosMemoryCalloc(pTagVal->nData + 1, 1); + char* buf = taosMemoryCalloc(pTagVal->nData + 3, 1); + if(!buf) goto end; dataConverToStr(buf, pTagVal->type, pTagVal->pData, pTagVal->nData, NULL); + tvalue = cJSON_CreateString(buf); + taosMemoryFree(buf); } else { - buf = taosMemoryCalloc(32, 1); - dataConverToStr(buf, pTagVal->type, &pTagVal->i64, tDataTypes[pTagVal->type].bytes, NULL); + double val = 0; + GET_TYPED_DATA(val, double, pTagVal->type, &pTagVal->i64); + tvalue = cJSON_CreateNumber(val); } - cJSON* tvalue = cJSON_CreateString(buf); - taosMemoryFree(buf); cJSON_AddItemToObject(tag, "value", tvalue); cJSON_AddItemToArray(tags, tag); } diff --git a/source/client/test/smlTest.cpp b/source/client/test/smlTest.cpp index 59eb841ab3..d74be742a2 100644 --- a/source/client/test/smlTest.cpp +++ b/source/client/test/smlTest.cpp @@ -649,9 +649,13 @@ TEST(testCase, smlParseLine_error_Test) { taos_free_result(pRes); const char *sql[] = { - "st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000", - "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000", - "test_stb,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532" + "krtqjjkzfg,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532", + "krtqjjkzfg,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532", + "krtqjjkzfg,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532" +// "ecaomjycxl,t0=t,t1=gptkzldguxgnfvlodfomaabofbsdfvwkzwokpyxqhfylzrzmddjllvatokfuzuzevmoxzmrdsgfyxzxcbxlkxtuctbmwgxjekojjbdtfbzabtccidinfsyrrbxjsliujnkqenagebvnkljjrqotmkjkprostwmtmufmihqbzrwpdomwzlyfsyhaydcofohwichlbesgujmlruftlikqsfbjyctopdxnesqfdklwvrkvolxxhinfaczkzynffphsccerjmiwteqllnhxprlpxxgwxrlgprakmvzdedptcxmeicgsewaefufdyicewiabmmduuwygggokwllirsuhstrvgruywfvftqstugcihsepltbtoqgsrvqbuzzjahbitssymdtieksqdjkafztekeybbqdhuyxqeniozgixutoikuugboapfhvknyipgmpnkhaqbccyycjfqohevpgsndcxppbtwemjwrvavvuxaontrknufynenrpnpyuhaozoeuizmvycknmmujmveaskgtybdkemrusekuaofntgzqijcrnnvnrdkbzigtoeiuihoohebaesfafqlszqoccbjakkbqdqohkvpzbzpjivkyqgiprreljvzaavymuojowacoexrbtrkdsmpnjpdapqtbilmihxoytvrphjckehpioilevatiulqgrnvavpzaknocgplwvocvonkjqaxmnzkghfxresuicfxpvurndqvvyuafmmcoaysogdhupdgrxupwzugslzehwtwapyditfhlwgvwypypfyiaouobpdherkdybrhatsejbxxozbencmwxxbveaoyvlwainfjttstygghihqyjpoerxxkdtrzhcephntuueludtywxirjntqvtafxhqkicpogphysnrtsfkqodahxevshxumecnxtenwmgcoalgvfzghmzsnysombtlkowgfuzelvihtzgxmoktqhltuxxyxucleydssoywkvribqkwwziqgllszvfwubtyuwwhyvicbhjiybkrryjvcqwnbwjkyatpaqntkevbrizjuzjnbwplqlpnpdkpewvgsuhhndudznazireluqkebawasxwdpewchxsegrgigxbixsarblhspuvkwcnyjwxygubrmrybvamjjoynozjsradzxnovldcfqesdzrdthgecporhfelhorgqoldssyuqmunrqhhrogjbcbzssrgnasxxixvusykowycwmcbhruxlflejsewksutysezeahfxfvifuujmtvuiddhetsykbrngppqhujuzdnvogltkwdwwvdhahdbtobpjwuqgnunvyenvmqdslkwuanvslyzodvkcfdvhgmixzzqqrukdslxugfqinqhmddwztygynowpkmlitnlcecoyjxtgwpggjrtphznarzwqlojninlqwcwizdmzwyimkirbrgxgroxbrajxbkwzjlhrccwmshfmddmxvewmwtedfwkjpbrrfcxkypigifjwgdiwesbyhbhnumcswcojnqlnzebhlpgsxufqycqadticqgkgbxkhrisyhkwjdfotladolmcspmqxpgreqctibcclbheaaudoigoevqrksohvuoskrufqdnzharmwkfxepzhvnkuywwhpzzmlksnfrjcbntwxzpgdsqonottkaevidbipxpssnlsqprupcvipcdumpeyrezvlzdxzwqpengyiugqbusgobgsxxxbcsobudpoliqndvepamaygrgueglxvxfsowflkzhmtgsninkgiecobbrzidsgtexvlxltipoohoaoxkslooojyyueeczrcaolsejlanqtyeetvtjlscihyibuujclpgbfzgznjxxqbcjymmtgzjiklyywhamjfdpycfaqtywuzhnvkkkpsarqxjszihjnmeorubperzbqdkzxmkjwfmnyfhgqzsintrfdolzxudqnwgkoowirkxmmrtbshgdydbsumeanvtewwfpaytqaaqfwbugwtvawqoxxtbitkgdjiwuuuclitrsaxlyyleqomzzhjdmuxzbdsdqdobnhmqoreewdbpmrvmnzsibrzizsocaziuoxgpxkqlcrxooaiduferfakupcxilxrvgscpdibyyzgvibjtukjdbdwfuebfgylswvvoouywbucdsxgvooaubjhhxnmjmjysvwxpkwemkisvfvpfesgvoksoyaafjrnzvjzscbqgmprmmrbnjtyphrwacmgbhfkpgxiyytvdtjgfurxziauixoymzchfrdynhizwjqqgepswgjimoaunqnqakyksbkkfeejdkemkhvjhnlrwoqzvipjhdreeqanuhqjdfjukhlqgvjczxwgsmfwlwsfnwxxbqwjqnatvffnyqyhbxgknkhlijccnjgxbmkdxixkvhaikxsnoacvsbwuluwfiagacqlfgqdervhzqvqxawsjovvlxvinvuvjqfbisgfcjbgkhrfeknnkqmyqxsqtlgejmdxgrygulpvrdnhoxwxdyszphcxacffedtgzphinzesdzlpxezstravtrytylbwstfzvlnayvvokzegijaclwodhddctlbslpfnnbnububsrwtexlvxfhgkluqzqykupxossvlkheptsoxcgmnocaryvinunlasadffshmrdegjmuglwnzqwvvjwpuwasewzpndmoumqrzjsorblotxjqcuwspdclcnfayyhimzuznfogkrvpcgbcmqsplnbvqebjdzyslqkzpeuqowaokbzjutiqvuxoghpjltfabfmqnnhhggcurgumdqckbowckwskrsogrnkxirlofwcoxqvbcgzpbyyvnpmdetblwxwkhjrfbwqtshaeihnwjaqpvxlmyzbxijfokizeczjdnxwxbsagycumauiuuxcwkxxexpufdmuuggafmtioxbklnfojjbdepdyjqonwwakznwfjusrhfpcufrgtwmvpnpzaymzaamzhzmezjqajzvrojqbkeqncmupdyfdhhpmvlpgviwaslqhkvsamooaekqyphvvmsnvbyrjczojeuxknjtaknktjdopcbmpsyndmvjmgaygrmpgejwelfxquecvoslzgocsvtyklwkaezzghsnpiogfsitwfknfigfbmgjmhzniebmqtaabzaoyxljukylniyagmsmpcxzcmbrxamwlzgbbdpzvicskvywzgidddfjitbereuzqhrbvhogcnalvhlaxdrjblxmdlkrqtppkxgpehmwrinbrurkrizybltkpojwhpnyjsbovbnqbboqgouefbmffobnvhfpgishijqghrixfkrgejmyxeuasepwoyuoorqwbkcxgvfitspizgxifmieyunghxbrsemepnjywuepkwovhimefasnygqdzadbvnuutipmwfnxqvlbztxelyootchpicwlzccxuqxdwfwbenfzdaopqajtureuurquxenlujmetrvxqbsbuswgngrwaexawkgdjlcxviguvmboepwhwvocklvkdpzvdpvkresfvmdqcikpnagssviaaqrwcpwxfwbrdnkvkrbgaicomqspynedeehfbfkxxkkbztvocusvxiyptvflnjvozjdwgituicqkoyierbhpjiitpcrwouoilsqromkoxjsyxytudxcinradsikwiytegqcxsgreuhsdggnjzdtbfcyojyzxtfnzobgejkwtlzqyjedwknrdjoicgtupmbpvcabwvjvqyreyzykrayhgqadtldjbjvrqnvyqpyfwagruxguwicydhcjascvexdqwqcdzydfhryusqdulkretvvjqpdbsawevvkmopfmpznkfbrzaggvrxwsfaeqossiyeipqevryhnuxdaflytknzzttixjovduqvgaduztsjcnefemanvcbjfjppmvfmqvwzjgzbgsliwchsxafnqhqqgehjpzrhactpebmysyuionrdyrjusiekjoexuubgyfntdpxjzfrdwhdckbezsgrapsxmaswjusjoruem c0=f 1626006833639000000" +// "st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000", +// "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000", +// "test_stb,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532" // "mqjqbesqqq,t0=t c0=f,c1=\"grigbrpnjctnyhamnwfqsjrywdforgpwpabdisdnymlboguwxuoscfyyajiyusxrocjndexxcvcqrzgxceqolvtdrpeabrcokpmcnhduylzxxljospclwuebutrdbpklpdbtkrdppamenzlmkkzttacrfxaozvwodpxzralhmdhvgaurtacnyhlsaojjglfnrylswactjumeldmuuafnmwsuuyiwhpdzqludgpluvllfowkwhfbtgsjsnxdbfbcrqnrxllmokbzrkiuxkhumfcjogeugbbjowmckoeyrilsoenowqwjpuufprqnxxzjlwfxnoljtodghyfdtyyptxafertndevhewboikewxwtwvbusnjpxwpnhhcrqqyicuuxmadxqjhbodsbexgpuaicbxduewqnogdhyjhcyjyftfbvbctgbjrwrkqtmqhzwxnilkmorotbiuwsimuvloeykzxqdepdkvvdcjtzmsvdseygtprbvhuikvomoafwnfojzaojxbkbpwbjqasazgokjjpktofqhjqhxxplkdvttwflbekawvozxiuhoahajwpimnjsbzjfhqgbbcgjgrjszmuqmwupxqlosfdsqnpkertnamcipfanxxewygtkeiaqopvykygkfbihdqqvhwapyctmxbjvzdndobrooemwtotrjzuknaupwxrjbrjzmnmupbwcdwkoghsilyfrjeefwrmgordzlafyjweavrapqqsicqnmkjulambrjxcmmsnvcjbbbwrloifqnmcmqlndubcynhumpikddliddyduafrpfgcltiymwlpbhtukmyawxdaaqiscvpfvsacjdljlfaeqhearjyczdpjsyjygfwaegqtylpibtdqinncmttbtiifbsesqbhpieectocontqhoyggjgbgjiyegoypfxorfqgbewhfqhkqftjdwtcnaiconxwjwryxqyexmlauoiysodziwfyyzyfewnfjyvfnvvxkkxeajmwbypoodsfrfygadcwpcjhzvemaplczgqxpsxkgxuqbxqhchpybojemqgxlhcyxmddjvwnbkvykkhwebfdpoovtvzgpkuwneodbochwxwauggxulmkynhoohchnkkcybhtwelotxpzoqzuczhwbjxsuqckuzsapdfkeiwxkcutimncyfpuaovhzwaebebkxgbognzpcxldjptnnldzqwtzzsiyjambnbrbyuyptxdkyxhlvigovllmkylbyzecxhdxczlkvsconlfvnafqvrwhcughqbtlmwgumeponoonhqqbklqaxvslkxowcuztjikgbutrnkmizschzrjxbmzvkkdlcuchpnrbxhgvxjqxawftlbirksyqbnltbaxtpyivrrqgxcjjgbhhvlltfqogehhddmgzivwlznkfuqgfbxrtixuonnywsxsdunhsmziyitecmrmxjkzmqhivinqkqywggffljpoxnofmzxkrmnxbdkokaleaqwbqizzhvywrweklybntszygkvuvypmukyxawhgbtnltemjchaytpqjplavcbypkwjwdmfogdxiddrtwrvvoqlmhsqlrdmmibawotbouzosrmbzocqvqdhoamuzvrfeyxkrnzpzyuacffbuvlcqupmbmqughegvjrobyzcyhynnpvvjntdcyplahaajwcbbleblkhjyauehbuoudyzrsgrtqnufijaawllbiexvhveipkaxffuiyczbkpcpzdnajwkkbbfrfchpedgabsraaalfbddgypeayprqwjzfvifjmgwaexrezitgaqgjmgizaohcfizhocckuzysshxzwqolddumeomghgsoaaerfxsapupejhywucurrhgctmmlgbyfjigveayriyvdmapvafzeydlxiwxcgnnajwjaqzkecczrdlbxgtdvehelzibmogdijpdiatcafnediqldwszonasgodqnnvajqxuwuftuvcqwtvayeiyysihhckitlimuimjllslrcnbobmumpbtoakqxallkqhszloxzpogfxxclnkmbfnqqomtzfpzdgxnfyvppeybjnekchjsafvhkrpvxpiumfvraeqcwqneatdrxdykoyscehvputknetluvfexdvtnnnaitrbdwyrzwnymuimydmadqbncdfixsgrcxkdnjzzyimcfbomioddimdxzxbmqwgnrezaquhiqytxmgsqpmywzxqksahlgwpxprtuzxtghkdbgxwpmdqxastvqggkhaqkxhjdsfcwyljwlleymorfgkezzroxaalrguityckdxsgqkcpaxxcsqvttvmmmmxezdztmkgcpnxbobuggzuqaetqfnmttjbshhfqqfsmfylavatksdchwvfvhyipfsepkwzqtprzogoxxohvibkwwiuwpsybbqqgbvziecnulnudzpudxvtcosvedrdxkhnkprghljzltucqljhdwpsfrsfryxpzybmybockeswpyihgossicvoxroiuzvgkbtduxzgsmgrohrxjbdvpnqwhgtvfkjrgpmirfdqddoyaztlooxlzllljsniwxfbihodjfywxallozikruusmzigztbzlyofrxtghhjwgptdbntmqkoxmrgzaznesgsgjnbmgarjqsqvswzygkbgquhbxsulabxzfpfnopzfnbiqeivuzayjbaikqrxrhyysttcafyxfdzgbbadcxiqltlwyhbcibkcxildnhmgwskeztcnmzdncqlyzpbzifjrhflsahlecmxwxlzmvpkqdexbfflmjhdqymxmjrktxaratynebetkfaltnrjgvsbdbvdcdyqujuypensmjnjskovbeweuwnqfjueeylefnqvmdmkwjqfvbjcuaibosymddysdymzhscroykljydnfvwosgplfphpznaqsddtbcjmyxhmcnxwdesycovtwrlmixqmpnzsbyfwpgnujxxqillwpbasdnbfxzokimfkujvlabycfwlplzpcgangjagrrhhjbrtddgitpoemixmobwyabyhsnkjtbeasdejawrueegmijbupygyciwbrhiwisguhlthnkpjqyzhiwvfrpgglqphhjtirtjxsjqxvqjpmokcgqbtjpsvravymmrrpyedruuncsjbjyrysjowqsnwtmvbakadxkxbyfunxnrkqhqvoeuzffmbpzfiiwrfdaekcrevffoxpsauhzziuyyjodsisaadbnyuugaxadvyxhfhbwhbmsgaklslihzwgvprpcawdtrniispfdnjoxkatlwebopgdqnaemwsflgfcuhkdnofblftofqzsphykpirzuckdnuxarzakvwurtrtbprdryikxmzytqhdmoyuizplphpvoliisgzhiganghwvqhzdmijccnfqqvboifovqxqvziktibyzpbffaguffgaqpbujvrvxecmaqygoyyptgzmwlnrwbeyuiiapgazdrgyrobtkcmsoheumgzjjpztatlpjkckxjqgfwvlhojdwztjgjdfdvalsglxjggmlfrbvtfeyhdbkggzukvdjnjtoytyrvxgrlvbqkkgrixhmjvwmojeiugbcyetihdtsizatgeukaczqllddwfqtwzsdquxmjmsypnftypppdsrqmkrfwxpwasrbtbeaaflqiatngmxylmhzwfoczsvcvwkgmxvhzyaoxrbblpqhbcozesrkjqncpyjukhppbubshyhwclceaefzhlbncxwdgglbtmzlksugrgnwjghgscqxfydztoraxrnthpqfojlgnablbxsovkcvpboujoczpihxrdblfirvlpxzgjhgiueyinhzasfelqnwmyhwwiaahrwoivetpfyyeeponmaqofwcbpvagruzshxaugnfzpaognklwcmfjmojrmjgmhroomwinouwdosuwtbrpkrzqtjfyspdnzgtbybsjyuohmchoukdyjfgovroyigpxqavcpmwnccdouskjxpqmpkjzkmcouwmauimkpatyfgkerqazsjuhctrbmqvqfdjfogajgrjnskzmrwnfjjfszebtbsioumdvhvqzgdkkhmsciutobqaefncvepnwqhvrfajmmrqnjryniwrckbaampnegmzoiqibwszbrqcpfgvtnlzemcmzaooywydmonegybzpdtukduxedpyquadxslnvirvewqihhnarvkpsbhmoggmoypwbimrnkuuiztvdqltnrytvvzlvhovoaekomlkqacgvlhdjaxhusehccgzjljjxjdpzpfnsrfnrxbzhoopziyrcmtpuvaqpvrevjjvmucezpecyckcmyvgnzgvitbkkdoptciamgkovowlhfcjmraynfyvlepowelkcjmjnibcsnabchcesnrwiplkavzgvdjyhulhthtbjgeckloshfcgobqovmxpryfbaaxfemkkpmtllovhqncrsbgbhjaozoycdnbcilhhlyfxbzvcmumpspgjszohxqhdocwnoxatmtnkqkpvupobukdudumdpsspzjxrcxstvajlarmicnsnjgdyyxcliqftvftmjmztbktbfmddbqtrfrygqzzzplqgemtvgijkydpshxiajzgcpmxsuamhtucpnejafrjqiwdxxflmaeyhntqfftvmsovtzunqszbvmvjhxcemtorseiariixtbnmxhkcwrghzposhvfnorlcwipsolpmkmvfpwdjswietamqfggxhpwfnsbkooocopbjzzxuhqxbtkklsxmmsgqvxldrfutlgntrewlyksrxdfexgkburyxbuqzhjmvqsqdzwppzyoqibdbhavyhexuybqhstktgtvtrckzqezauehcoxlnntilnkqekvdachlmvuxcowizzbqrldzaggpbvvlfwhsqfdyqvwqwrbkqvrqpzdihtnnafxbxqulzfswevlvxsjugrsaombysnngstmnlyayizrynmofiwbggehbfugsufhmyogsctxkfzlwwwshxnvoaqvstgpjtvyczlgoueutienayowbzwuhzearmhhbukmebpyewdrlmflwbvrzfhrkixvgewburjiqfovxrkiwvvbdrswvbcsznriinohlfeukcxmgmoyrlpqzjtgpjpvsnzbriifdyljkbqqiketrpvmvimmxhmpxlfzqluenskwrtshagizqrxigmmynfppfxfzxcvwbogamdxfipiqdasphwixefwvgrihkqjcflqvqqfvzxdtqyvvnnfzeucqhwlmxjconjuqkachpnysbnhrcfadculwgxcruihnuixxuvdmztugpvesdddargavwiudrtybxwmvywqleepplrchioqkyomusvamfawlxcwdkdjnydcmgfrlmkxpvqhcuioilsahnzrvlxnrfyxmjxvtlliyilcjtcwwcuucgurbbcshnlzrzilgkhdojcivhgltssezykltyzcubevrbapzmnhfhtntgnmjytjubvasdfiagwlzzwohzaibzqwqdlsikaodfljcgnhyckowudmfbqimtuszqgyxxzvipniipgsotrpkzamiwpkngnvwmjjivjtxhpzlmrwcjznavijhjjmvhxkjdahleprpynjnqltqhyamkfdfspbridpbuphtqxkncpognjgxwwyzxnkizrzvobpdxepncwvuhdspajmooiybeksqkhpncluiwwgsapihnkvgmwektybpzlnizkhtxtgeqqgaphditecptyoquueofaleodgsvfjxhokmzgjwflceebrbbjkxvqvkymjatpvdcvatnvkecfpxrpvwgnusmuetshyeyphgzjwktlwycqjqmsfjtiqkkbhndslyfxdegaejuzfylnbqlvacephpbuytqmxvwosukulbwdoofqomqlgdptocqlnjkikcvwcvyrpubzoeegonjhdtuibklelcgtacvovyntmucnzknumratvvwcphkfcxzjfmzwbqluzpexancupokekqnykxmwnyxvclvvxstnbbylaqknrgfegxfgkrnipkrstthxkkyborfgciqgksruwjzxwfuztgizrjrilmshcmnfzxwucrsscgotmniegribamhyzwjwyeuminjukrurpspcjmfllgceyuivmqfgegjjjpbswhjijrlajtbtevijdyanduyhbtedmihjaadtwbnjgrhlxgbvxxmtqzinsclkctlvhocntuppgfeaubksbwxouqsmdeaijulvlpawxuuvadmroswmaceodnqnxaxnwxwsoogqctfkadzabezoeufgskhtxgeefigmjcwrsoymyardzujtpejrsjslnorwixaawuqkhtgtqgrbjrzoxdpgetayqwsvptbwoljgypbkaxjcfujykdtikngwvnmwlpefdecpkywsbkoqjuyiaaizknmygqiqdjhfxfzpsdnlzqosmcdgacngjdrmhhnmltesihrwsfrfjvhctfjinwolonpeuibvxhhunarulabdrrwpipkczhxaxrqxvydmuerawuoshzupvvhfhlvbdahibhygftjmfqostlufujpwrfduppuhidftnjegdoqjyfekysuglomymoybrcypfkabcgiddimrpahbmtjwropodagfdfrpffqqgffriqcmvqsbnrjqwkqrpappefsabbjkotyspncbzjdlqjobgzkxzebhuliwikfvhfroqotbwsyywapztlwnnumngdwuinqefmgmndpvfsmmzrozkzplzmgjojgkzwkfwgljxrvvfuvozeihsiwqvksibqdkbsqslxwydowhsekwuslrppizukfcvvfxuffrnnceoriukxnqoujatnhqvgjaertcqcdfccsttyirwzxytgflyoedmkhzufythspclmyrwzxlvvhhqohxdppsvzoqgcvclykgadmtkwxfnzpcoziukoajwjjaiufyzormcokrwbdpnhcotdmvyihscatzmotgqoqthdcdegnxxsxdqgtbdirmvujyvssdvpztvhzaklkqvvhkpqmqyrwbfwcygnvbjjvrfmccrmjmspvqmxadbpipprbcurcjcjyjjbnzbjdnpgobvckrdcbjiphtgmavthjedrkulplgedfiavvdupwfugxvrowmuipujzqdkzebvfgzqxxznnbdfjmfrrgjwpqkudgscpotdhtguvgyymhhwkrctnvuphhjnrwcqzwargqxxpsdvsvfynlhxrzekjfgtdmcaspmtmzdaojduyhqieipeetptyfuhrynsszfnxcgtvnfahfgkjfbxmgnuhxtifzhgtlmjlgayybpshyzixkvocjlorxlpvsjqgssxlwmxwpmwouocgylxbmyfrezwpubyewxsnqalzgetnpdfwrgxsawaargjclnfxoucwljnuqaiokxgixwogrmfhegurpyzitefhejtqawnmglkhlhxoxblmgdhzkavxnqhoeagcrbbqlssotgphffqtcgkupzvlkmljmjomnqxgcmiyysmkvziridmuijdrzozgzxsuiudhjzuxxjoatipfcpjsqqckmvcgsjdaoecooposrptdwtrdwvfltbtczbnyqhvdrkphccwyyponubffazdikxuifbxnqmoubdtqbpxrpsfyoevuwgmwlnvgblxlvshhdavmdhbmurkmlhsiepzyiqoaiugfdzwkpmtjozzpqfrxpafkiebadrglatgpoiargnyofrhsdrpfgdipxnlsxopmbhxupantpxyasrvqziefcarckihgxkbfszzgtjpoazjuuuxxccegqhjtsjqdhgshczrznrbyjrraxeyzdgciyvaeapkwgvkejkrckdsbyekoukliqozslwgghnjrfbzpqkrfwjawoutztlnasoecujozksrefzdduhnvnskvziighbejokbqyrdespapyqbidgkzwlfvapyjcxcoybgwxweivmzblrdyumcxcnddqgvlthtfjwmefwzkzvnycnfduawgvsqmullejnpapzeujmmwkbmtalkrpunhjlargfhxpjphesgxdvldteileyzxpftdikjyyqgldfwrzglixzuegwslfyhrqjceeeggllgbvfeaefztngfpjncbjeyfmyvcmdashzponstxigskortcevevfpqcbwzmqrbvbniwjwajbdhdfqlyujnwiuveihahtbakokmzkpznqqrqdbbivaettleiciafubnklnowubzzhvzhyhkfhzvvcsajxkqnruuyoaxmrahzmqnuedlmjyiioucsaxvhspmrmglcmpoxvqzwssgxgptdcclstkjxwwaqekdwkixnowusxbnftnzjectfsckbeeevhytludfcdzwdiujywcsgwrvmbecqwibvusgqhhvmztiavlsmvlwztgburxaaotbcslvxnffaohthhwhaatkyvaptdxwoztfcqovimzbpsbxwuwbjwkbdvrkuytovzsvcmkporgabibniqiiobhljsbgeqsdbofcdpuxgdiqlmpwpadfuymdmauguvvewtnrkbkgfogitcidofpaduxeetslyqppgsquivqvvmfmdpyfvmqfliuhkasezljpmlagfgqcqahtfojamfwjmptsuvgbslskjmvqhmdlhouymghfngfysjiqkjfcwbjjtorzpjblzuabghntwyxrcqrrtviijbcknzjolpatwpssnzmobrpxwyaubjgakgdzydkkvsisnfscwklbmkdhrzbopcdmimqleofwvfugtbtogbdmazqjmlslpfeukuqcpmpwggseebnoqpadfpudcnriiwlhojpzpbbqdgqoweijlyjplkxxpxawanihmdkxmmdsdlknwcxrbsmrpsxawxxoepzckcilssqxntruzwmtqqjrxsupdaedboovfkecckmdxtymhagyoweznpgtwxkpbnoqfkrnzvsxpdlgynleqcpyrodfqngjgmkweiotmvpmbujluktefwwhhprfqtusjzebtnhyztjhbhlnmfzdrcsxktxbzqsoczgwoydpcssgksstfeslmesjkdbwhlorqtswfcfsxkysbedidqzsxorpgnhgieonzdzlpyqxjkkncypuhjtgwzxvrqmpleelcampexgswcdtezuqdghfzzxkzzyulqpfojwsdgcdniblomxrxflbnylwqxtifxxfkembyxhkvhfjnmpdinrpodvticucowipekvthfobnkdvgfhoobhhtwdtppcogtwqyynixndujqclzrvwfirjqsmvfjxbhisdaugeaswspcljkdigdqcekcftqcemsjlxhplmrxootbcsjylvkvwtvvnusaxtkxcjrxazsjeheguoxrebicpecuuorpwzsgpfgztgtfpilvauzikosbtzbhrwafktgltkteknizcioxefizyvwfgyfwhbgkssmvobxrzvqfkdhcvezdmyvqqedjvspyvsgwqwovdxrecdanapoydetgehibxaslvllrqkxdzhsebmrdflqxylvgfaaghcstzrlutizgxkgfjzatylehdqcctkhqahctbyazuibdkvvgyyoqlmiocgkripiofrbmjvkavkebaelrhrizmzbskptanrhwzcpzrtofjxzkrushctxejlaziteklpjakzskzklmdgukiabxxduslretgbomoexppmgimlfhfehoswtixefjffecudfmacfvlguvvbzcbtgywrxbwifkrxlhoqvtslpwhbcanoaynjonlyiobcwstxshesdowbviqdejatogcfbllmnctasbeininbnwmtpdhmuvurvtpnkqpscvwtlzhtlpvoztdqbncxxmqymjojjnllivocansiodawzlcygkejjgisvzvvdlmacnffffhxyodgtmmlevrjhnplezrfidsuygsariqdqbyvntpqnurmtrxtentgnopsipnayoxipkvysbunxqjisyjevmjvgxoqruhxvsqedcsimagxmsbjslwohsckiivuhbjnegobkpxjdoqfnicgunugidyfngasefvcbwltaljvxamhnuefkvhgbwyozaggdszyqghnnfmcyjfvhfcamcxjrggysglomdptedlthpfxmmbqbfzlzgodcsahagnuepupqbrfxjgqldwbuenabygoeduhwgtxnfmzlsojbvxmmavdbmxivmdozdratbytpyjysrzpejdggqguhyeshcobbfodtuqnwwundapkfkblfzdlnsbylsufiuycoejkljrcovadehyazpwqordifrsomfskmjzogqciiluldojkxfgtwrlbqjekbqotuhffowjptmjkitgolgsofzkvjasgzktoophkpnidqujvcdxofcfuwwwihpgitnsfsrgxxqzvzfjlabwqptlvsusszjajgxshshzncuhafxndwqcxujigvkymfztczglcuwbzhgomvqxkdmxilzewacpnffzlkxezzpxbfvlfosxkvmdopnuwoqkbjrogfecxpzcqvyzeuadikskcwpgyknryrgcumvspxtgzzdsoebizpsehtpqfmtgnwjhrcoqthrjxjugvzyhvoglnerbyffgastsyoizzzrmmeawztdizcebilasdsthmujjvmjsssvhwlyglddnljtigltporpjaiokkoeuqreawmpbvbnjiuvhdslieeanfazyxubwacizffpahfndinebzcqdrnqnbrwdddcorvatawhqeacjtfikkastvtluavsyixwldxuifyxpmgtxqpdcpyggdiztwihzsvhtotqgtscvmwtpsakuuyuastebtsivnoemlzhdllyvyifirqcvxfapegnfyaxepsvvqhdrztwzgbbtbslrtifugxhrsiidptyafyaxbtbrpxlsvwmxvcmrpgatnpnqoghnjqqxwtfpsicpwrtwtqrxgxrdzlkamgspznezzlezvaftrvbvjatefhsrtrqusxnrxrahdckrsdgyzbtflaaelpkwfddzgapzlktcrizyawqeazasrtkcsryowkcjvmsbkvhkmdxrudjjpczpzfxtjbmgpvwhchvtlctrhdqqjijrnkunalsucruwhhfrrdsjztcrkivvrlszopymvuxnnlqklatzgcjjuxmhrmydtcyxhisvxepljzwjuhinuxvsmkdtmrrojutimnivlxxcjvgbpclzuxcppfopckrvndccoelzzmzcdyqrkuxdwompgshazcuzxwytnjeejmpwpabiuaorkhctezqydizuuontnukrkvithhctnmwwivqbabuvqwvjyxpwsgpsoyszfsnjeeofmqoyxyakfcmwrwkisglzadmtcolpwhrnpasmxbkozdfgtuchqhvdnfahlxbzqqxgfisdjrwwqsjihtcgflpnskznnfdzeotcrzylojcuvsabyngjoetcptkdbihowprmxokppjfjvxsztypzkzgwuurqmlwdzapowwsaozebryypltamqzmduirxskstryqrdaagwerlbnwgteibjiktrladowyuhsuasqppzkqtsvpxzdcxyulrqgjzspppjqujffcwrtovaxaflttvrwdlojqdmmcvgeoiieifzkpzfusoozkunhnxaafpnrnhsfraglsbylzbigxjxqbjgxfbtevzeuqrewyjywvmedtwajobluxrsdlvaghovxhfcieuudwrhffehgfuwkqvgpofqijpklraclahqmewxggvrboqxveabgovkfylybrbrxqnvljafuooyscossddrmuosmcxbthyynfuhytjyhkkvwiaqpicrfjxvwftatdwhwuxxqessofyecjfzbzhpqblvqooasrwnlaqrlzindcvxzunpizmgpgsmnangmfargzqcvclgphenedrlpkfnhcccwzkhsgswrtqnqidkaleqitfqyikkjkcjokeelqfldfbzmtmvcyfzbpcgbsjfedviylpheoilpddgtohbywwuuqdcvihhcqtkrmntgfkeytjeytnfjzxongdmvahbyubjbsdkrejpiyezopkkvrfeiwycizgexqcnrpbqwrksztcjqlrhbyhenwqlxxjkicoajfphdxjpndnkfsjrfoqsmntuenabiufbjkyhemewernlberrrlivflnehtterrvdgnrlaosrljjggogsyxpguzinyohitcbcaqebmogtkamdzhgtiufxeshimfdrcmfqrqtcbapddsmerewofiqrwprfcgdmwzuddpavlnohnybgibsnxtsnzilexfehiphpbpqghnocawhmkzakmotjkeuuilvkagummlcclpuwxbyeoubwqtqsokrnxgotuajewgabdyzzyglufirtdfebmvafinbboecugtxacqdxwmbxyhcksiygftwubfrnxlivjiofvjctzygkjqsnjlhhmoshoxpbrkhbqkztkhjcmeqxgpzxymlfwozldnpllxboixvivoquplfrvtwxljpbmyjlbvbgujcczqhjwdvqtgatnvcuwmncazwmsykjsgjpvhkgusfzyctzmigqowhmdicguijmatupdjzxqbunxbeqardupokgfbtgnkwmajdacajwzsuvpiwjmtzyimluenlcrybwpvtuztfxfsvgrgndhljizthoceovimkxsxyneohxnbzbkmnxlidsczqkknlhrbqdlhxsfypqviucqiywljmiqlzlaofolpmtkvhzgvscoowmzlkehvfidefmcfeqssjquavrehjhugjoeeuqrrskpnsituzqjxoydxxssszyzgmczdtdahjisrjjgdwlnjglrqrzrnyudairljibcutnfcojuyjzuhazszfepncfyvoxgnbiyyixzspcnlhclxddafebdukcvdkblnqmzqkonheehbszjkhhyvecpizqjdnwraosmbfntitxhocadbbniuqzxfuyjqfrpvocwnrziazjitmtxxvkewhfdcewxqfovliuxzilicokdjmuncxipcixlipdcmuwukshsotjjcabvewtorjckmmqtknmdrsvvgqzilbwnxuzlogloepyrsaiqyoxwjwmxbnwckvbiesvybwdqvjnywbwthuadbgeieblmdboggqwxugtiporxgkbroidfuykuypwyavecwgfskshqogbvajbthoemgryusercuxztwgtbzofcsiduoavtafszohwwchuqjpjbbrbxsudotmxprrtavzddwxijonauwgscsvtrjwomoqchhwxtohwatxghcvsbaqxsntzsluhxsmrajjefralceyhhympznjuzmwqummdxuwwqzwdffrgkjggfnjnyebxegzzbujfyeivmlwwgwrglrooznuhlfvguwezrqwnekgnahtocwbjamdtrtowwyyohusnsmznehzpieuayritybnlrldihnbdsbsbdqtpdpqyjkdrcecfwlljsljpdgifxetsajmymzcdlefllhtcotecgnbtputyabsmeigdjxwxywoyvyimdleebaadxpsfeadudsvebxbjrnotvqldkxutesdeimkhwpdbbyvhxsgjalsoosgpikstmbapoffdkljthvhlagsjtnglpuomrvejsdvfcxlgwhitnekotzcmagrjnvqdumqohzpshypkcijkgwozgyxvdozkaasbuohhkzaabuhllmnvtxtwqooxzkkcfaveprjtvklmaoxtftwzkdbpvvuezwbgohnzcomtjsudbbdpowrrtvqixxfellzkloxbrxdroctzwywujgzzptupqmfpstlpiowfnmdgvgkciyzlvskiinwoxsxvbgyprttxjgasztpuvjvwztcnutyxplebjnsgipbarhlcnwjkaspbohchtiurjfykknkslygfkomhqnaiocohyccfguufzebncmchjsapecxdbkouugsmtnipfmdxdamfhfoxcdoqjnjnzfpqsgdirbcaszqchlqhxupypvepxgxecyrwpkaziqndjjkjrpqjowpspvbizerthixqznivlbaflzhtujtkmqgcjdkpnjdrxktphtwfbwpcwcavxaxdrojjteqsajvizogsvgcctyinjqzsjplfkjajuxaprouznlyepxtvfswdsglgbaclhnpoiwkfqrggbmlmpdavzubxdcifoxaokwfwonulygizsuvxqxnomczdjcrcgxfduosvazmwzbzlhcuvxywlzguxjjkkvyutqwwlvtgxljaiercxbzmlwgudfdhseusqifvoxksxpbxublditsfyiflzcvzfdfpdeibmoekyjpddexbfnudsusdxbthmtfxhrgwtiirccxhbizvqffcwghjuusqfcbynbfewdsskwexmpvtrilyqsgraromzsuhbqnjldrpchnclecocjykihgzlwynfcrnhigbfxkrwblbphkdjttqjihergujyickvhoaomtnkmsjpzkyvzljexphylviqyhnbuxrgqdirpcfbevfjtmmodmarupbgicdefifsprpfqszlgjpnhzowtorkanvprqqtjiausxyhtjmtiiwfidmasztdcpynqacphntdtmfpdvpjtaekaggbevqmyxymtiokdspbzgnxubwikzaapehiabcktjhwkgjzhzldgrxjsfyuwgmghenfrtzsdauuaodxqvvyerjuebapknrmhwjhbrojwzcodwhpdbgaeninbtyrhzqxsfpdwzrvfnbruccjfqfupcdsiqjlnrfjasrkhznssbintubxchjhhiqahjtkfawlfyonocudtjpgkgjlyrrkohgrzzvqcwfwgprofintyzpwiregtwyxjywrvrusvnsqyvciubsqaotawxlmromuszooghkkfxwjpsdmvxdkjukxjwjdksmrxpkkpxtpbwbfisfqneuohxhbinrbxmaklfdjzhhpzrfnzrkpegzqnjmdlngvthppmovnrbclgpmiqnzzcwxgstfbrtmealyfigyxfnogdxpoxonzlrzjrvoplzkaimklngxqvhkiijuecthgeqrtxfsajsimbwyknlohabegrkrrwfytemczxogrdrrgibzankeqfddiufslellsggwthsvwkentzyrfppyacqczprryimfnhzowoxtrlpvmtfkstlbcgicqsnkgpysifmykfdzreydxneuydzjhqpmbwrbxgefmsojgbhuxkdfhpfxzvdbpfgdhekmnmaokhssvbsdbgqisfcpwsfzsvojfjsrqhuuduwifaywnthkiuhsrgnkrvuknmilvrowfwsqohmrusibdhuhcjvzjlvrufbtypotgjqagipmmhlcmliieerwhuizsvjnxtubqwabqaifcvsrzlklwxbgwfmxrmimdgxjnlaxtctdrerfpxvifkwbxuskrybktiyeambeebcptsvvmsmhgdxollkhlomdzlyjvyvvnrbaddfrujpvzngaisvfluqjscncriugpimqlcinkebcrtczhiyyirdanhddlusnoezbziuwphjeejhfivvznkemfbtcoiyahtljlynrwzearpvekmzhlguwvmgmmbwzadorelfxidnoiwiehpzgzefmppajnmttvdyemgzwfodtlpirdsmnzkitryomcyfukylxoinaornrtmdisoiuddnzwqitqzwhjecrmyhoretzgxciqngpsxcfgfzyneoxresrogmeebiqrcnpyehfriprzueajqfnrczmullahnexfebqaqfnzzkysvbagwemvxttmwvrvflcfjenjoizhuubutzmsxogboepyyezibsqbmgkwkwrcjyqhikbfpiqsmrjmqriwppdbijldaqzxpuiawhxkaujicxchftemfyfmscxhbxweswtjgtlmtkhpyvpybrkmtgtqvtocnqvaxpkjwkedgvvgsjiftgdqdbukackiefopjqpnhzezgrgrzpyvttugsedhmjcmrvnkeofqqignddniiazspgwgfbxolzwwklvairwvqchjxybwfjugmyflkkuuulqzgqkgsuymvrlemwrblieexszuzkygujowopflsaadzidkrqgsnmntbipofuwrahnypixrpzp\" 1626006833639000000", // "measure,t1=3 c1=8", // "measure,t2=3 c1=8u8" diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index c4f3ca0bdf..fcc27e440c 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -556,7 +556,7 @@ static void taosSetSystemCfg(SConfig *pCfg) { osSetSystemLocale(locale, charset); bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval; - taosSetConsoleEcho(enableCore); + taosSetCoreDump(enableCore); // todo tsVersion = 30000000; @@ -675,7 +675,7 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { case 'e': { if (strcasecmp("enableCoreFile", name) == 0) { bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval; - taosSetConsoleEcho(enableCore); + taosSetCoreDump(enableCore); } break; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index a60db8a8c2..f7387f7e88 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -265,6 +265,10 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) { int64_t consumerId = be64toh(pReq->consumerId); SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, consumerId); + if (pConsumer == NULL) { + terrno = TSDB_CODE_MND_CONSUMER_NOT_EXIST; + return -1; + } atomic_store_32(&pConsumer->hbStatus, 0); @@ -452,7 +456,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { int32_t code = -1; SArray *newSub = subscribe.topicNames; taosArraySortString(newSub, taosArrayCompareString); - taosArrayRemoveDuplicate(newSub, taosArrayCompareString, taosMemoryFree); + taosArrayRemoveDuplicateP(newSub, taosArrayCompareString, taosMemoryFree); int32_t newTopicNum = taosArrayGetSize(newSub); // check topic existance diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index ec0ea90f46..a46938590e 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -383,6 +383,11 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { // exec pInnerTask->execType = TASK_EXEC__PIPE; + SDbObj* pSourceDb = mndAcquireDb(pMnode, pStream->sourceDb); + ASSERT(pDbObj != NULL); + sdbRelease(pSdb, pSourceDb); + pInnerTask->numOfVgroups = pSourceDb->cfg.numOfVgroups; + if (tsSchedStreamToSnode) { SSnodeObj* pSnode = mndSchedFetchOneSnode(pMnode); if (pSnode == NULL) { diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index a9c56a339b..810dcb9049 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -148,9 +148,11 @@ int32_t mndSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void **ppWrit } int32_t mndSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) { - mInfo("stop to apply snapshot to sdb, apply:%d", isApply); + mInfo("stop to apply snapshot to sdb, apply:%d, index:%" PRId64 " term:%" PRIu64 " config:%" PRId64, isApply, + pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, pSnapshot->lastApplyIndex); SMnode *pMnode = pFsm->data; - return sdbStopWrite(pMnode->pSdb, pWriter, isApply); + return sdbStopWrite(pMnode->pSdb, pWriter, isApply, pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, + pSnapshot->lastConfigIndex); } int32_t mndSnapshotDoWrite(struct SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) { @@ -161,7 +163,7 @@ int32_t mndSnapshotDoWrite(struct SSyncFSM *pFsm, void *pWriter, void *pBuf, int void mndLeaderTransfer(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) { SMnode *pMnode = pFsm->data; atomic_store_8(&(pMnode->syncMgmt.leaderTransferFinish), 1); - mDebug("vgId:1, mnd leader transfer finish"); + mDebug("vgId:1, mnode leader transfer finish"); } SSyncFSM *mndSyncMakeFsm(SMnode *pMnode) { diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 679f8085bd..096a1534fd 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -708,9 +708,13 @@ int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, c if (pTrans->oper == oper) { if (strcasecmp(dbname, pTrans->dbname1) == 0) { mDebug("trans:%d, db:%s oper:%d matched with input", pTrans->id, dbname, oper); - if (taosArrayPush(pTrans->pRpcArray, &pMsg->info) != NULL) { + if (pTrans->pRpcArray == NULL) { + pTrans->pRpcArray = taosArrayInit(1, sizeof(SRpcHandleInfo)); + } + if (pTrans->pRpcArray != NULL && taosArrayPush(pTrans->pRpcArray, &pMsg->info) != NULL) { code = 0; } + sdbRelease(pMnode->pSdb, pTrans); break; } diff --git a/source/dnode/mnode/impl/test/sdb/sdbTest.cpp b/source/dnode/mnode/impl/test/sdb/sdbTest.cpp index 87895d3b49..7a8a5e8ca7 100644 --- a/source/dnode/mnode/impl/test/sdb/sdbTest.cpp +++ b/source/dnode/mnode/impl/test/sdb/sdbTest.cpp @@ -925,7 +925,7 @@ TEST_F(MndTestSdb, 01_Read_Str) { } sdbStopRead(pSdb, pReader); - sdbStopWrite(pSdb, pWritter, true); + sdbStopWrite(pSdb, pWritter, true, -1, -1, -1); } ASSERT_EQ(sdbGetSize(pSdb, SDB_CONSUMER), 1); diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 991dd2c4f9..f922baf329 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -394,7 +394,7 @@ int32_t sdbStopRead(SSdb *pSdb, SSdbIter *pIter); int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len); int32_t sdbStartWrite(SSdb *pSdb, SSdbIter **ppIter); -int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply); +int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, int64_t term, int64_t config); int32_t sdbDoWrite(SSdb *pSdb, SSdbIter *pIter, void *pBuf, int32_t len); const char *sdbTableName(ESdbType type); diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index ff4a9e4ead..302f0c5fbb 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -613,7 +613,7 @@ int32_t sdbStartWrite(SSdb *pSdb, SSdbIter **ppIter) { return 0; } -int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply) { +int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, int64_t term, int64_t config) { int32_t code = 0; if (!isApply) { @@ -641,6 +641,19 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply) { return -1; } + if (config > 0) { + ASSERT(pSdb->commitConfig == config); + pSdb->commitConfig = config; + } + if (term > 0) { + ASSERT(pSdb->commitTerm == term); + pSdb->commitTerm = term; + } + if (index > 0) { + ASSERT(pSdb->commitIndex == index); + pSdb->commitIndex = index; + } + mDebug("sdbiter:%p, successfully applyed to sdb", pIter); return 0; } diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index 71792a2354..c579f82a9d 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -153,23 +153,22 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * return terrno; } - taosThreadRwlockUnlock(pLock); - int32_t code = 0; SdbInsertFp insertFp = pSdb->insertFps[pRow->type]; if (insertFp != NULL) { code = (*insertFp)(pSdb, pRow->pObj); if (code != 0) { code = terrno; - taosThreadRwlockWrlock(pLock); taosHashRemove(hash, pRow->pObj, keySize); - taosThreadRwlockUnlock(pLock); sdbFreeRow(pSdb, pRow, false); terrno = code; + taosThreadRwlockUnlock(pLock); return terrno; } } + taosThreadRwlockUnlock(pLock); + if (pSdb->keyTypes[pRow->type] == SDB_KEY_INT32) { pSdb->maxId[pRow->type] = TMAX(pSdb->maxId[pRow->type], *((int32_t *)pRow->pObj)); } @@ -194,7 +193,6 @@ static int32_t sdbUpdateRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * SSdbRow *pOldRow = *ppOldRow; pOldRow->status = pRaw->status; sdbPrintOper(pSdb, pOldRow, "update"); - taosThreadRwlockUnlock(pLock); int32_t code = 0; SdbUpdateFp updateFp = pSdb->updateFps[pNewRow->type]; @@ -202,6 +200,7 @@ static int32_t sdbUpdateRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * code = (*updateFp)(pSdb, pOldRow->pObj, pNewRow->pObj); } + taosThreadRwlockUnlock(pLock); sdbFreeRow(pSdb, pNewRow, false); pSdb->tableVer[pOldRow->type]++; diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index 757749a9b6..07bee22a1f 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -88,7 +88,7 @@ typedef struct { STqExecTb execTb; STqExecDb execDb; }; - + int32_t numOfCols; // number of out pout column, temporarily used } STqExecHandle; typedef struct { diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 4e2c762cd3..30a6188db0 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -174,6 +174,10 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg); int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable); void tsdbMemTableDestroy(SMemTable *pMemTable); void tsdbGetTbDataFromMemTable(SMemTable *pMemTable, tb_uid_t suid, tb_uid_t uid, STbData **ppTbData); +void tsdbRefMemTable(SMemTable *pMemTable); +void tsdbUnrefMemTable(SMemTable *pMemTable); +int32_t tsdbTakeMemSnapshot(STsdb *pTsdb, SMemTable **ppMem, SMemTable **ppIMem); +void tsdbUntakeMemSnapshot(STsdb *pTsdb, SMemTable *pMem, SMemTable *pIMem); // STbDataIter int32_t tsdbTbDataIterCreate(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter **ppIter); void *tsdbTbDataIterDestroy(STbDataIter *pIter); @@ -273,23 +277,14 @@ typedef struct { } SRtn; struct STsdb { - char *path; - SVnode *pVnode; - TdThreadMutex mutex; - bool repoLocked; - STsdbKeepCfg keepCfg; - SMemTable *mem; - SMemTable *imem; - SRtn rtn; - STsdbFS *fs; - SLRUCache *lruCache; -}; - -struct STable { - uint64_t suid; - uint64_t uid; - STSchema *pSchema; // latest schema - STSchema *pCacheSchema; // cached cache + char *path; + SVnode *pVnode; + STsdbKeepCfg keepCfg; + TdThreadRwlock rwLock; + SMemTable *mem; + SMemTable *imem; + STsdbFS *pFS; + SLRUCache *lruCache; }; struct TSDBKEY { @@ -330,21 +325,19 @@ struct STbData { }; struct SMemTable { - SRWLatch latch; - STsdb *pTsdb; - int32_t nRef; - TSKEY minKey; - TSKEY maxKey; - int64_t minVersion; - int64_t maxVersion; - int64_t nRow; - int64_t nDel; - SArray *aTbData; // SArray + SRWLatch latch; + STsdb *pTsdb; + SVBufPool *pPool; + volatile int32_t nRef; + TSKEY minKey; + TSKEY maxKey; + int64_t minVersion; + int64_t maxVersion; + int64_t nRow; + int64_t nDel; + SArray *aTbData; // SArray }; -int tsdbLockRepo(STsdb *pTsdb); -int tsdbUnlockRepo(STsdb *pTsdb); - struct TSDBROW { int8_t type; // 0 for row from tsRow, 1 for row from block data union { diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index cb25e93cde..984b34814d 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -62,12 +62,13 @@ struct SVBufPoolNode { }; struct SVBufPool { - SVBufPool* next; - int64_t nRef; - int64_t size; - uint8_t* ptr; - SVBufPoolNode* pTail; - SVBufPoolNode node; + SVBufPool* next; + SVnode* pVnode; + volatile int32_t nRef; + int64_t size; + uint8_t* ptr; + SVBufPoolNode* pTail; + SVBufPoolNode node; }; int32_t vnodeOpenBufPool(SVnode* pVnode, int64_t size); @@ -78,7 +79,7 @@ void vnodeBufPoolReset(SVBufPool* pPool); int32_t vnodeQueryOpen(SVnode* pVnode); void vnodeQueryClose(SVnode* pVnode); int32_t vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg); -int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg); +int vnodeGetTableCfg(SVnode* pVnode, SRpcMsg* pMsg); // vnodeCommit.c int32_t vnodeBegin(SVnode* pVnode); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index fb403f79a7..fd0f97a638 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -77,6 +77,8 @@ typedef struct SSnapDataHdr SSnapDataHdr; // vnd.h void* vnodeBufPoolMalloc(SVBufPool* pPool, int size); void vnodeBufPoolFree(SVBufPool* pPool, void* p); +void vnodeBufPoolRef(SVBufPool* pPool); +void vnodeBufPoolUnRef(SVBufPool* pPool); // meta typedef struct SMCtbCursor SMCtbCursor; @@ -89,7 +91,7 @@ int metaBegin(SMeta* pMeta); int metaCommit(SMeta* pMeta); int metaCreateSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq); int metaAlterSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq); -int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq); +int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq, SArray* tbUidList); int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq); int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids); int metaTtlDropTable(SMeta* pMeta, int64_t ttl, SArray* tbUids); @@ -247,34 +249,34 @@ struct STsdbKeepCfg { }; struct SVnode { - char* path; - SVnodeCfg config; - SVState state; - STfs* pTfs; - SMsgCb msgCb; - SVBufPool* pPool; - SVBufPool* inUse; - SVBufPool* onCommit; - SVBufPool* onRecycle; - SMeta* pMeta; - SSma* pSma; - STsdb* pTsdb; - SWal* pWal; - STQ* pTq; - SSink* pSink; - tsem_t canCommit; - int64_t sync; - int32_t blockCount; - tsem_t syncSem; - SQHandle* pQuery; + char* path; + SVnodeCfg config; + SVState state; + STfs* pTfs; + SMsgCb msgCb; + TdThreadMutex mutex; + TdThreadCond poolNotEmpty; + SVBufPool* pPool; + SVBufPool* inUse; + SMeta* pMeta; + SSma* pSma; + STsdb* pTsdb; + SWal* pWal; + STQ* pTq; + SSink* pSink; + tsem_t canCommit; + int64_t sync; + int32_t blockCount; + tsem_t syncSem; + SQHandle* pQuery; }; #define TD_VID(PVNODE) ((PVNODE)->config.vgId) #define VND_TSDB(vnd) ((vnd)->pTsdb) #define VND_RSMA0(vnd) ((vnd)->pTsdb) -#define VND_RSMA1(vnd) ((vnd)->pSma->pRSmaTsdb1) -#define VND_RSMA2(vnd) ((vnd)->pSma->pRSmaTsdb2) +#define VND_RSMA1(vnd) ((vnd)->pSma->pRSmaTsdb[TSDB_RETENTION_L0]) +#define VND_RSMA2(vnd) ((vnd)->pSma->pRSmaTsdb[TSDB_RETENTION_L1]) #define VND_RETENTIONS(vnd) (&(vnd)->config.tsdbCfg.retentions) #define VND_IS_RSMA(v) ((v)->config.isRsma == 1) #define VND_IS_TSMA(v) ((v)->config.isTsma == 1) @@ -289,8 +291,7 @@ struct SSma { bool locked; TdThreadMutex mutex; SVnode* pVnode; - STsdb* pRSmaTsdb1; - STsdb* pRSmaTsdb2; + STsdb* pRSmaTsdb[TSDB_RETENTION_L2]; void* pTSmaEnv; void* pRSmaEnv; }; @@ -305,8 +306,8 @@ struct SSma { #define SMA_TSMA_ENV(s) ((s)->pTSmaEnv) #define SMA_RSMA_ENV(s) ((s)->pRSmaEnv) #define SMA_RSMA_TSDB0(s) ((s)->pVnode->pTsdb) -#define SMA_RSMA_TSDB1(s) ((s)->pRSmaTsdb1) -#define SMA_RSMA_TSDB2(s) ((s)->pRSmaTsdb2) +#define SMA_RSMA_TSDB1(s) ((s)->pRSmaTsdb[TSDB_RETENTION_L0]) +#define SMA_RSMA_TSDB2(s) ((s)->pRSmaTsdb[TSDB_RETENTION_L1]) // sma void smaHandleRes(void* pVnode, int64_t smaId, const SArray* data); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 71345df747..5255724b58 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -212,7 +212,7 @@ _err: return -1; } -int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq) { +int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tbUidList) { void *pKey = NULL; int nKey = 0; void *pData = NULL; @@ -228,8 +228,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq) { } // drop all child tables - TBC *pCtbIdxc = NULL; - SArray *pArray = taosArrayInit(8, sizeof(tb_uid_t)); + TBC *pCtbIdxc = NULL; tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, &pMeta->txn); rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = pReq->suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c); @@ -249,20 +248,18 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq) { break; } - taosArrayPush(pArray, &(((SCtbIdxKey *)pKey)->uid)); + taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid)); } tdbTbcClose(pCtbIdxc); metaWLock(pMeta); - for (int32_t iChild = 0; iChild < taosArrayGetSize(pArray); iChild++) { - tb_uid_t uid = *(tb_uid_t *)taosArrayGet(pArray, iChild); + for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) { + tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUidList, iChild); metaDropTableByUid(pMeta, uid, NULL); } - taosArrayDestroy(pArray); - // drop super table _drop_super_table: tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData); @@ -374,6 +371,13 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) { } metaReaderClear(&mr); + if (pReq->type == TSDB_CHILD_TABLE) { + tb_uid_t suid = metaGetTableEntryUidByName(pMeta, pReq->ctb.name); + if (suid == 0) { + terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST; + return -1; + } + } // build SMetaEntry me.version = version; me.type = pReq->type; diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index d73b03f4a2..d260b11a55 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -123,11 +123,9 @@ int32_t smaOpen(SVnode *pVnode) { } // restore the rsma -#if 1 if (rsmaRestore(pSma) < 0) { goto _err; } -#endif } return 0; diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 5b1a87be20..054a8b6edf 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -605,7 +605,7 @@ static int32_t tdRSmaFetchAndSubmitResult(SRSmaInfoItem *pItem, STSchema *pTSche snprintf(flag, 10, "level %" PRIi8, pItem->level); blockDebugShowDataBlocks(pResult, flag); #endif - STsdb *sinkTsdb = (pItem->level == TSDB_RETENTION_L1 ? pSma->pRSmaTsdb1 : pSma->pRSmaTsdb2); + STsdb *sinkTsdb = (pItem->level == TSDB_RETENTION_L1 ? pSma->pRSmaTsdb[0] : pSma->pRSmaTsdb[1]); SSubmitReq *pReq = NULL; // TODO: the schema update should be handled if (buildSubmitReqFromDataBlock(&pReq, pResult, pTSchema, SMA_VID(pSma), suid) < 0) { @@ -949,13 +949,8 @@ _err: * @return int32_t */ static int32_t tdRSmaRestoreTSDataReload(SSma *pSma, int64_t committed) { - // TODO - smaDebug("vgId:%d, rsma restore from %" PRIi64 ", ts data reload success", SMA_VID(pSma), committed); + // NOTHING TODO: the data would be restored from the unified WAL replay procedure return TSDB_CODE_SUCCESS; -_err: - smaError("vgId:%d, rsma restore from %" PRIi64 ", ts data reload failed since %s", SMA_VID(pSma), committed, - terrstr()); - return TSDB_CODE_FAILED; } int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index fb05aeecd9..f6862621f9 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -506,7 +506,7 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) { .initTqReader = true, .version = ver, }; - pHandle->execHandle.execCol.task[i] = qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle); + pHandle->execHandle.execCol.task[i] = qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, &pHandle->execHandle.numOfCols); ASSERT(pHandle->execHandle.execCol.task[i]); void* scanner = NULL; qExtractStreamScanner(pHandle->execHandle.execCol.task[i], &scanner); @@ -591,7 +591,11 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) { }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle); } else { - pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, NULL); + SReadHandle mgHandle = { + .vnode = NULL, + .numOfVgroups = pTask->numOfVgroups, + }; + pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle); } ASSERT(pTask->exec.executor); } diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index f18b25bef4..5172819d2a 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -15,7 +15,7 @@ #include "tq.h" -static int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp) { +static int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols) { int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); void* buf = taosMemoryCalloc(1, dataStrLen); if (buf == NULL) return -1; @@ -29,7 +29,7 @@ static int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp) // TODO enable compress int32_t actualLen = 0; - blockEncode(pBlock, pRetrieve->data, &actualLen, taosArrayGetSize(pBlock->pDataBlock), false); + blockEncode(pBlock, pRetrieve->data, &actualLen, numOfCols, false); actualLen += sizeof(SRetrieveTableRsp); ASSERT(actualLen <= dataStrLen); taosArrayPush(pRsp->blockDataLen, &actualLen); @@ -49,8 +49,8 @@ static int32_t tqAddBlockSchemaToRsp(const STqExecHandle* pExec, int32_t workerI static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp) { SMetaReader mr = {0}; metaReaderInit(&mr, pTq->pVnode->pMeta, 0); + // TODO add reference to gurantee success if (metaGetTableEntryByUid(&mr, uid) < 0) { - ASSERT(0); return -1; } char* tbName = strdup(mr.me.name); @@ -87,16 +87,18 @@ int64_t tqScan(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVa tqDebug("task execute end, get %p", pDataBlock); if (pDataBlock != NULL) { - tqAddBlockDataToRsp(pDataBlock, pRsp); - pRsp->blockNum++; if (pRsp->withTbName) { if (pOffset->type == TMQ_OFFSET__LOG) { int64_t uid = pExec->pExecReader[0]->msgIter.uid; - tqAddTbNameToRsp(pTq, uid, pRsp); + if (tqAddTbNameToRsp(pTq, uid, pRsp) < 0) { + continue; + } } else { pRsp->withTbName = 0; } } + tqAddBlockDataToRsp(pDataBlock, pRsp, pExec->numOfCols); + pRsp->blockNum++; if (pOffset->type == TMQ_OFFSET__LOG) { continue; } else { @@ -193,13 +195,14 @@ int32_t tqLogScanExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataR SSDataBlock block = {0}; if (tqRetrieveDataBlock(&block, pReader) < 0) { if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) continue; - ASSERT(0); } - tqAddBlockDataToRsp(&block, pRsp); if (pRsp->withTbName) { int64_t uid = pExec->pExecReader[workerId]->msgIter.uid; - tqAddTbNameToRsp(pTq, uid, pRsp); + if (tqAddTbNameToRsp(pTq, uid, pRsp) < 0) { + continue; + } } + tqAddBlockDataToRsp(&block, pRsp, taosArrayGetSize(block.pDataBlock)); tqAddBlockSchemaToRsp(pExec, workerId, pRsp); pRsp->blockNum++; } @@ -211,13 +214,14 @@ int32_t tqLogScanExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataR SSDataBlock block = {0}; if (tqRetrieveDataBlock(&block, pReader) < 0) { if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) continue; - ASSERT(0); } - tqAddBlockDataToRsp(&block, pRsp); if (pRsp->withTbName) { int64_t uid = pExec->pExecReader[workerId]->msgIter.uid; - tqAddTbNameToRsp(pTq, uid, pRsp); + if (tqAddTbNameToRsp(pTq, uid, pRsp) < 0) { + continue; + } } + tqAddBlockDataToRsp(&block, pRsp, taosArrayGetSize(block.pDataBlock)); tqAddBlockSchemaToRsp(pExec, workerId, pRsp); pRsp->blockNum++; } diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index e6df58696d..468490350a 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -92,7 +92,8 @@ int32_t tqMetaOpen(STQ* pTq) { .initTqReader = true, .version = handle.snapshotVer, }; - handle.execHandle.execCol.task[i] = qCreateQueueExecTaskInfo(handle.execHandle.execCol.qmsg, &reader); + + handle.execHandle.execCol.task[i] = qCreateQueueExecTaskInfo(handle.execHandle.execCol.qmsg, &reader, &handle.execHandle.numOfCols); ASSERT(handle.execHandle.execCol.task[i]); void* scanner = NULL; qExtractStreamScanner(handle.execHandle.execCol.task[i], &scanner); diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c index c929c84203..4c0d416ad1 100644 --- a/source/dnode/vnode/src/tq/tqPush.c +++ b/source/dnode/vnode/src/tq/tqPush.c @@ -237,6 +237,8 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_ #endif int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) { + walApplyVer(pTq->pVnode->pWal, ver); + if (msgType == TDMT_VND_SUBMIT) { if (taosHashGetSize(pTq->pStreamTasks) == 0) return 0; @@ -253,4 +255,3 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) return 0; } - diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 47b497b480..e4c11c4787 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -299,6 +299,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { } if (blockDataEnsureCapacity(pBlock, pReader->msgIter.numOfRows) < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; goto FAIL; } diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 449f592ee4..b0eb7f4a14 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -49,8 +49,11 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo } SVCreateTbReq createTbReq = {0}; + SName name = {0}; + tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); + createTbReq.name = buildCtbNameByGroupId(stbFullName, pDataBlock->info.groupId); - createTbReq.ctb.name = strdup(stbFullName); + createTbReq.ctb.name = strdup((char*)tNameGetTableName(&name)); // strdup(stbFullName); createTbReq.flags = 0; createTbReq.type = TSDB_CHILD_TABLE; createTbReq.ctb.suid = suid; @@ -175,6 +178,8 @@ void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data) { const SArray* pRes = (const SArray*)data; SVnode* pVnode = (SVnode*)vnode; + tqDebug("task write into table, vgId %d, block num: %d", pVnode->config.vgId, (int32_t)pRes->size); + ASSERT(pTask->tbSink.pTSchema); SSubmitReq* pReq = tdBlockToSubmit(pRes, pTask->tbSink.pTSchema, true, pTask->tbSink.stbUid, pTask->tbSink.stbFullName, pVnode->config.vgId); diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 723caca5d7..484020e6e1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -464,7 +464,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) { switch (state->state) { case SFSNEXTROW_FS: - state->aDFileSet = state->pTsdb->fs->cState->aDFileSet; + state->aDFileSet = state->pTsdb->pFS->cState->aDFileSet; state->nFileSet = taosArrayGetSize(state->aDFileSet); state->iFileSet = state->nFileSet; @@ -793,6 +793,9 @@ typedef struct { TSDBROW memRow, imemRow, fsRow; TsdbNextRowState input[3]; + SMemTable *pMemTable; + SMemTable *pIMemTable; + STsdb *pTsdb; } CacheNextRowIter; static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTsdb) { @@ -800,21 +803,25 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs tb_uid_t suid = getTableSuidByUid(uid, pTsdb); + tsdbTakeMemSnapshot(pTsdb, &pIter->pMemTable, &pIter->pIMemTable); + STbData *pMem = NULL; - if (pTsdb->mem) { - tsdbGetTbDataFromMemTable(pTsdb->mem, suid, uid, &pMem); + if (pIter->pMemTable) { + tsdbGetTbDataFromMemTable(pIter->pMemTable, suid, uid, &pMem); } STbData *pIMem = NULL; - if (pTsdb->imem) { - tsdbGetTbDataFromMemTable(pTsdb->imem, suid, uid, &pIMem); + if (pIter->pIMemTable) { + tsdbGetTbDataFromMemTable(pIter->pIMemTable, suid, uid, &pIMem); } + pIter->pTsdb = pTsdb; + pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY)); SDelIdx delIdx; - SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState); + SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->pFS->cState); if (pDelFile) { SDelFReader *pDelFReader; @@ -878,6 +885,8 @@ static int32_t nextRowIterClose(CacheNextRowIter *pIter) { taosArrayDestroy(pIter->pSkyline); } + tsdbUntakeMemSnapshot(pIter->pTsdb, pIter->pMemTable, pIter->pIMemTable); + return code; _err: return code; @@ -1189,7 +1198,7 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, STSRow **ppRo SDelIdx delIdx; - SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState); + SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->pFS->cState); if (pDelFile) { SDelFReader *pDelFReader; @@ -1377,7 +1386,7 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray) { SDelIdx delIdx; - SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState); + SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->pFS->cState); if (pDelFile) { SDelFReader *pDelFReader; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 470bff1eae..13f310ae27 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -64,9 +64,26 @@ int32_t tsdbBegin(STsdb *pTsdb) { if (!pTsdb) return code; - code = tsdbMemTableCreate(pTsdb, &pTsdb->mem); + SMemTable *pMemTable; + code = tsdbMemTableCreate(pTsdb, &pMemTable); if (code) goto _err; + // lock + code = taosThreadRwlockWrlock(&pTsdb->rwLock); + if (code) { + code = TAOS_SYSTEM_ERROR(code); + goto _err; + } + + pTsdb->mem = pMemTable; + + // unlock + code = taosThreadRwlockUnlock(&pTsdb->rwLock); + if (code) { + code = TAOS_SYSTEM_ERROR(code); + goto _err; + } + return code; _err: @@ -83,9 +100,11 @@ int32_t tsdbCommit(STsdb *pTsdb) { // check if (pMemTable->nRow == 0 && pMemTable->nDel == 0) { - // TODO: lock? + taosThreadRwlockWrlock(&pTsdb->rwLock); pTsdb->mem = NULL; - tsdbMemTableDestroy(pMemTable); + taosThreadRwlockUnlock(&pTsdb->rwLock); + + tsdbUnrefMemTable(pMemTable); goto _exit; } @@ -139,7 +158,7 @@ static int32_t tsdbCommitDelStart(SCommitter *pCommitter) { goto _err; } - SDelFile *pDelFileR = pTsdb->fs->nState->pDelFile; + SDelFile *pDelFileR = pTsdb->pFS->nState->pDelFile; if (pDelFileR) { code = tsdbDelFReaderOpen(&pCommitter->pDelFReader, pDelFileR, pTsdb, NULL); if (code) goto _err; @@ -228,7 +247,7 @@ static int32_t tsdbCommitDelEnd(SCommitter *pCommitter) { code = tsdbUpdateDelFileHdr(pCommitter->pDelFWriter); if (code) goto _err; - code = tsdbFSStateUpsertDelFile(pTsdb->fs->nState, &pCommitter->pDelFWriter->fDel); + code = tsdbFSStateUpsertDelFile(pTsdb->pFS->nState, &pCommitter->pDelFWriter->fDel); if (code) goto _err; code = tsdbDelFWriterClose(&pCommitter->pDelFWriter, 1); @@ -263,7 +282,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { taosArrayClear(pCommitter->aBlockIdx); tMapDataReset(&pCommitter->oBlockMap); tBlockDataReset(&pCommitter->oBlockData); - pRSet = tsdbFSStateGetDFileSet(pTsdb->fs->nState, pCommitter->commitFid, TD_EQ); + pRSet = tsdbFSStateGetDFileSet(pTsdb->pFS->nState, pCommitter->commitFid, TD_EQ); if (pRSet) { code = tsdbDataFReaderOpen(&pCommitter->pReader, pTsdb, pRSet); if (code) goto _err; @@ -836,7 +855,7 @@ static int32_t tsdbCommitFileDataEnd(SCommitter *pCommitter) { if (code) goto _err; // upsert SDFileSet - code = tsdbFSStateUpsertDFileSet(pCommitter->pTsdb->fs->nState, tsdbDataFWriterGetWSet(pCommitter->pWriter)); + code = tsdbFSStateUpsertDFileSet(pCommitter->pTsdb->pFS->nState, tsdbDataFWriterGetWSet(pCommitter->pWriter)); if (code) goto _err; // close and sync @@ -941,10 +960,10 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) { memset(pCommitter, 0, sizeof(*pCommitter)); ASSERT(pTsdb->mem && pTsdb->imem == NULL); - // lock(); + taosThreadRwlockWrlock(&pTsdb->rwLock); pTsdb->imem = pTsdb->mem; pTsdb->mem = NULL; - // unlock(); + taosThreadRwlockUnlock(&pTsdb->rwLock); pCommitter->pTsdb = pTsdb; pCommitter->commitID = pTsdb->pVnode->state.commitID; @@ -954,7 +973,7 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) { pCommitter->maxRow = pTsdb->pVnode->config.tsdbCfg.maxRows; pCommitter->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression; - code = tsdbFSBegin(pTsdb->fs); + code = tsdbFSBegin(pTsdb->pFS); if (code) goto _err; return code; @@ -1135,13 +1154,16 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) { SMemTable *pMemTable = pTsdb->imem; if (eno == 0) { - code = tsdbFSCommit(pTsdb->fs); + code = tsdbFSCommit(pTsdb->pFS); } else { - code = tsdbFSRollback(pTsdb->fs); + code = tsdbFSRollback(pTsdb->pFS); } - tsdbMemTableDestroy(pMemTable); + taosThreadRwlockWrlock(&pTsdb->rwLock); pTsdb->imem = NULL; + taosThreadRwlockUnlock(&pTsdb->rwLock); + + tsdbUnrefMemTable(pMemTable); tsdbInfo("vgId:%d tsdb end commit", TD_VID(pTsdb->pVnode)); return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 82de931872..ee8a23e76e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -41,6 +41,7 @@ int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable) { } taosInitRWLatch(&pMemTable->latch); pMemTable->pTsdb = pTsdb; + pMemTable->pPool = pTsdb->pVnode->inUse; pMemTable->nRef = 1; pMemTable->minKey = TSKEY_MAX; pMemTable->maxKey = TSKEY_MIN; @@ -54,6 +55,7 @@ int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable) { taosMemoryFree(pMemTable); goto _err; } + vnodeBufPoolRef(pMemTable->pPool); *ppMemTable = pMemTable; return code; @@ -65,6 +67,7 @@ _err: void tsdbMemTableDestroy(SMemTable *pMemTable) { if (pMemTable) { + vnodeBufPoolUnRef(pMemTable->pPool); taosArrayDestroy(pMemTable->aTbData); taosMemoryFree(pMemTable); } @@ -590,3 +593,58 @@ _err: } int32_t tsdbGetNRowsInTbData(STbData *pTbData) { return pTbData->sl.size; } + +void tsdbRefMemTable(SMemTable *pMemTable) { + int32_t nRef = atomic_fetch_add_32(&pMemTable->nRef, 1); + ASSERT(nRef > 0); +} + +void tsdbUnrefMemTable(SMemTable *pMemTable) { + int32_t nRef = atomic_sub_fetch_32(&pMemTable->nRef, 1); + if (nRef == 0) { + tsdbMemTableDestroy(pMemTable); + } +} + +int32_t tsdbTakeMemSnapshot(STsdb *pTsdb, SMemTable **ppMem, SMemTable **ppIMem) { + int32_t code = 0; + + // lock + code = taosThreadRwlockRdlock(&pTsdb->rwLock); + if (code) { + code = TAOS_SYSTEM_ERROR(code); + goto _exit; + } + + // take snapshot + *ppMem = pTsdb->mem; + *ppIMem = pTsdb->imem; + + if (*ppMem) { + tsdbRefMemTable(*ppMem); + } + + if (*ppIMem) { + tsdbRefMemTable(*ppIMem); + } + + // unlock + code = taosThreadRwlockUnlock(&pTsdb->rwLock); + if (code) { + code = TAOS_SYSTEM_ERROR(code); + goto _exit; + } + +_exit: + return code; +} + +void tsdbUntakeMemSnapshot(STsdb *pTsdb, SMemTable *pMem, SMemTable *pIMem) { + if (pMem) { + tsdbUnrefMemTable(pMem); + } + + if (pIMem) { + tsdbUnrefMemTable(pIMem); + } +} \ 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 1fa582fae5..064c7adf4b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOpen.c +++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c @@ -54,8 +54,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee sprintf(pTsdb->path, "%s%s%s", pVnode->path, TD_DIRSEP, dir); taosRealPath(pTsdb->path, NULL, slen); pTsdb->pVnode = pVnode; - pTsdb->repoLocked = false; - taosThreadMutexInit(&pTsdb->mutex, NULL); + taosThreadRwlockInit(&pTsdb->rwLock, NULL); if (!pKeepCfg) { tsdbSetKeepCfg(&pTsdb->keepCfg, &pVnode->config.tsdbCfg); } else { @@ -67,7 +66,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee tfsMkdir(pVnode->pTfs, pTsdb->path); // open tsdb - if (tsdbFSOpen(pTsdb, &pTsdb->fs) < 0) { + if (tsdbFSOpen(pTsdb, &pTsdb->pFS) < 0) { goto _err; } @@ -88,33 +87,10 @@ _err: int tsdbClose(STsdb **pTsdb) { if (*pTsdb) { - taosThreadMutexDestroy(&(*pTsdb)->mutex); - tsdbFSClose((*pTsdb)->fs); + taosThreadRwlockDestroy(&(*pTsdb)->rwLock); + tsdbFSClose((*pTsdb)->pFS); tsdbCloseCache((*pTsdb)->lruCache); taosMemoryFreeClear(*pTsdb); } return 0; } - -int tsdbLockRepo(STsdb *pTsdb) { - int code = taosThreadMutexLock(&pTsdb->mutex); - if (code != 0) { - tsdbError("vgId:%d, failed to lock tsdb since %s", TD_VID(pTsdb->pVnode), strerror(errno)); - terrno = TAOS_SYSTEM_ERROR(code); - return -1; - } - pTsdb->repoLocked = true; - return 0; -} - -int tsdbUnlockRepo(STsdb *pTsdb) { - // ASSERT(IS_REPO_LOCKED(pTsdb)); - pTsdb->repoLocked = false; - int code = taosThreadMutexUnlock(&pTsdb->mutex); - if (code != 0) { - tsdbError("vgId:%d, failed to unlock tsdb since %s", TD_VID(pTsdb->pVnode), strerror(errno)); - terrno = TAOS_SYSTEM_ERROR(code); - return -1; - } - return 0; -} diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 0b05bb7224..c1778ed5ca 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -118,6 +118,8 @@ struct STsdbReader { char* idStr; // query info handle, for debug purpose int32_t type; // query type: 1. retrieve all data blocks, 2. retrieve direct prev|next rows SBlockLoadSuppInfo suppInfo; + SMemTable* pMem; + SMemTable* pIMem; SIOCostSummary cost; STSchema* pSchema; @@ -1453,38 +1455,70 @@ static bool keyOverlapFileBlock(TSDBKEY key, SBlock* pBlock, SVersionRange* pVer (pBlock->minVersion <= pVerRange->maxVer); } -static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SBlock* pBlock, int32_t order) { - if (pBlockScanInfo->delSkyline == NULL) { - return false; - } - - TSDBKEY* pFirst = taosArrayGet(pBlockScanInfo->delSkyline, 0); - TSDBKEY* pLast = taosArrayGetLast(pBlockScanInfo->delSkyline); - - // ts is not overlap - if (pBlock->minKey.ts > pLast->ts || pBlock->maxKey.ts < pFirst->ts) { - return false; - } - - int32_t step = ASCENDING_TRAVERSE(order) ? 1 : -1; - - // version is not overlap +static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, const SBlock* pBlock) { size_t num = taosArrayGetSize(pBlockScanInfo->delSkyline); - for (int32_t i = pBlockScanInfo->fileDelIndex; i < num; i += step) { + + for (int32_t i = pBlockScanInfo->fileDelIndex; i < num; i += 1) { TSDBKEY* p = taosArrayGet(pBlockScanInfo->delSkyline, i); if (p->ts >= pBlock->minKey.ts && p->ts <= pBlock->maxKey.ts) { if (p->version >= pBlock->minVersion) { return true; } - } else if (p->ts > pBlock->maxKey.ts) { + } else if (p->ts < pBlock->minKey.ts) { // p->ts < pBlock->minKey.ts + if (p->version >= pBlock->minVersion) { + if (i < num - 1) { + TSDBKEY* pnext = taosArrayGet(pBlockScanInfo->delSkyline, i + 1); + if (i + 1 == num - 1) { // pnext is the last point + if (pnext->ts >= pBlock->minKey.ts) { + return true; + } + } else { + if (pnext->ts >= pBlock->minKey.ts && pnext->version >= pBlock->minVersion) { + return true; + } + } + } else { // it must be the last point + ASSERT(p->version == 0); + } + } + } else { // (p->ts > pBlock->maxKey.ts) { return false; } } - ASSERT(0); return false; } +static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SBlock* pBlock, int32_t order) { + if (pBlockScanInfo->delSkyline == NULL) { + return false; + } + + // ts is not overlap + TSDBKEY* pFirst = taosArrayGet(pBlockScanInfo->delSkyline, 0); + TSDBKEY* pLast = taosArrayGetLast(pBlockScanInfo->delSkyline); + if (pBlock->minKey.ts > pLast->ts || pBlock->maxKey.ts < pFirst->ts) { + return false; + } + + // version is not overlap + if (ASCENDING_TRAVERSE(order)) { + return doCheckforDatablockOverlap(pBlockScanInfo, pBlock); + } else { + int32_t index = pBlockScanInfo->fileDelIndex; + while (1) { + TSDBKEY* p = taosArrayGet(pBlockScanInfo->delSkyline, index); + if (p->ts > pBlock->minKey.ts && index > 0) { + index -= 1; + } else { // find the first point that is smaller than the minKey.ts of dataBlock. + break; + } + } + + return doCheckforDatablockOverlap(pBlockScanInfo, pBlock); + } +} + // 1. the version of all rows should be less than the endVersion // 2. current block should not overlap with next neighbor block // 3. current timestamp should not be overlap with each other @@ -1847,8 +1881,8 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea int32_t backward = (!ASCENDING_TRAVERSE(pReader->order)); STbData* d = NULL; - if (pReader->pTsdb->mem != NULL) { - tsdbGetTbDataFromMemTable(pReader->pTsdb->mem, pReader->suid, pBlockScanInfo->uid, &d); + if (pReader->pMem != NULL) { + tsdbGetTbDataFromMemTable(pReader->pMem, pReader->suid, pBlockScanInfo->uid, &d); if (d != NULL) { code = tsdbTbDataIterCreate(d, &startKey, backward, &pBlockScanInfo->iter.iter); if (code == TSDB_CODE_SUCCESS) { @@ -1868,8 +1902,8 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea } STbData* di = NULL; - if (pReader->pTsdb->imem != NULL) { - tsdbGetTbDataFromMemTable(pReader->pTsdb->imem, pReader->suid, pBlockScanInfo->uid, &di); + if (pReader->pIMem != NULL) { + tsdbGetTbDataFromMemTable(pReader->pIMem, pReader->suid, pBlockScanInfo->uid, &di); if (di != NULL) { code = tsdbTbDataIterCreate(di, &startKey, backward, &pBlockScanInfo->iiter.iter); if (code == TSDB_CODE_SUCCESS) { @@ -1905,7 +1939,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* SArray* pDelData = taosArrayInit(4, sizeof(SDelData)); - SDelFile* pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState); + SDelFile* pDelFile = tsdbFSStateGetDelFile(pTsdb->pFS->cState); if (pDelFile) { SDelFReader* pDelFReader = NULL; code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb, NULL); @@ -1926,9 +1960,11 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* SDelIdx idx = {.suid = pReader->suid, .uid = pBlockScanInfo->uid}; SDelIdx* pIdx = taosArraySearch(aDelIdx, &idx, tCmprDelIdx, TD_EQ); - code = tsdbReadDelData(pDelFReader, pIdx, pDelData, NULL); - if (code != TSDB_CODE_SUCCESS) { - goto _err; + if (pIdx != NULL) { + code = tsdbReadDelData(pDelFReader, pIdx, pDelData, NULL); + if (code != TSDB_CODE_SUCCESS) { + goto _err; + } } } @@ -2771,7 +2807,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl if (pCond->suid != 0) { (*ppReader)->pSchema = metaGetTbTSchema((*ppReader)->pTsdb->pVnode->pMeta, (*ppReader)->suid, -1); - ASSERT((*ppReader)->pSchema); + // ASSERT((*ppReader)->pSchema); } else if (taosArrayGetSize(pTableList) > 0) { STableKeyInfo* pKey = taosArrayGet(pTableList, 0); (*ppReader)->pSchema = metaGetTbTSchema((*ppReader)->pTsdb->pVnode->pMeta, pKey->uid, -1); @@ -2795,7 +2831,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl SDataBlockIter* pBlockIter = &pReader->status.blockIter; - STsdbFSState* pFState = pReader->pTsdb->fs->cState; + STsdbFSState* pFState = pReader->pTsdb->pFS->cState; initFilesetIterator(&pReader->status.fileIter, pFState, pReader->order, pReader->idStr); resetDataBlockIterator(&pReader->status.blockIter, pReader->order); @@ -2809,6 +2845,8 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl } } + tsdbTakeMemSnapshot(pReader->pTsdb, &pReader->pMem, &pReader->pIMem); + tsdbDebug("%p total numOfTable:%d in this query %s", pReader, numOfTables, pReader->idStr); return code; @@ -2824,6 +2862,8 @@ void tsdbReaderClose(STsdbReader* pReader) { SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo; + tsdbUntakeMemSnapshot(pReader->pTsdb, pReader->pMem, pReader->pIMem); + taosMemoryFreeClear(pSupInfo->plist); taosMemoryFree(pSupInfo->colIds); @@ -3042,7 +3082,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) { tsdbDataFReaderClose(&pReader->pFileReader); - STsdbFSState* pFState = pReader->pTsdb->fs->cState; + STsdbFSState* pFState = pReader->pTsdb->pFS->cState; initFilesetIterator(&pReader->status.fileIter, pFState, pReader->order, pReader->idStr); resetDataBlockIterator(&pReader->status.blockIter, pReader->order); resetDataBlockScanInfo(pReader->status.pTableMap); diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index 2ae646a571..137ef9a4a6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -20,10 +20,10 @@ static int32_t tsdbDoRetentionImpl(STsdb *pTsdb, int64_t now, int8_t try, int8_t STsdbFSState *pState; if (try) { - pState = pTsdb->fs->cState; + pState = pTsdb->pFS->cState; *canDo = 0; } else { - pState = pTsdb->fs->nState; + pState = pTsdb->pFS->nState; } for (int32_t iSet = 0; iSet < taosArrayGetSize(pState->aDFileSet); iSet++) { @@ -83,7 +83,7 @@ int32_t tsdbDoRetention(STsdb *pTsdb, int64_t now) { if (!canDo) goto _exit; // begin - code = tsdbFSBegin(pTsdb->fs); + code = tsdbFSBegin(pTsdb->pFS); if (code) goto _err; // do retention @@ -91,7 +91,7 @@ int32_t tsdbDoRetention(STsdb *pTsdb, int64_t now) { if (code) goto _err; // commit - code = tsdbFSCommit(pTsdb->fs); + code = tsdbFSCommit(pTsdb->pFS); if (code) goto _err; _exit: @@ -99,6 +99,6 @@ _exit: _err: tsdbError("vgId:%d tsdb do retention failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code)); - tsdbFSRollback(pTsdb->fs); + tsdbFSRollback(pTsdb->pFS); return code; } \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 4886d874a9..fea0254045 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -45,7 +45,7 @@ static int32_t tsdbSnapReadData(STsdbSnapReader* pReader, uint8_t** ppData) { while (true) { if (pReader->pDataFReader == NULL) { - SDFileSet* pSet = tsdbFSStateGetDFileSet(pTsdb->fs->cState, pReader->fid, TD_GT); + SDFileSet* pSet = tsdbFSStateGetDFileSet(pTsdb->pFS->cState, pReader->fid, TD_GT); if (pSet == NULL) goto _exit; @@ -159,7 +159,7 @@ _err: static int32_t tsdbSnapReadDel(STsdbSnapReader* pReader, uint8_t** ppData) { int32_t code = 0; STsdb* pTsdb = pReader->pTsdb; - SDelFile* pDelFile = pTsdb->fs->cState->pDelFile; + SDelFile* pDelFile = pTsdb->pFS->cState->pDelFile; if (pReader->pDelFReader == NULL) { if (pDelFile == NULL) { @@ -798,7 +798,7 @@ static int32_t tsdbSnapWriteDataEnd(STsdbSnapWriter* pWriter) { code = tsdbWriteBlockIdx(pWriter->pDataFWriter, pWriter->aBlockIdxW, NULL); if (code) goto _err; - code = tsdbFSStateUpsertDFileSet(pTsdb->fs->nState, tsdbDataFWriterGetWSet(pWriter->pDataFWriter)); + code = tsdbFSStateUpsertDFileSet(pTsdb->pFS->nState, tsdbDataFWriterGetWSet(pWriter->pDataFWriter)); if (code) goto _err; code = tsdbDataFWriterClose(&pWriter->pDataFWriter, 1); @@ -843,7 +843,7 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3 pWriter->fid = fid; // read - SDFileSet* pSet = tsdbFSStateGetDFileSet(pTsdb->fs->nState, fid, TD_EQ); + SDFileSet* pSet = tsdbFSStateGetDFileSet(pTsdb->pFS->nState, fid, TD_EQ); if (pSet) { code = tsdbDataFReaderOpen(&pWriter->pDataFReader, pTsdb, pSet); if (code) goto _err; @@ -907,7 +907,7 @@ static int32_t tsdbSnapWriteDel(STsdbSnapWriter* pWriter, uint8_t* pData, uint32 STsdb* pTsdb = pWriter->pTsdb; if (pWriter->pDelFWriter == NULL) { - SDelFile* pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->nState); + SDelFile* pDelFile = tsdbFSStateGetDelFile(pTsdb->pFS->nState); // reader if (pDelFile) { @@ -1017,7 +1017,7 @@ static int32_t tsdbSnapWriteDelEnd(STsdbSnapWriter* pWriter) { code = tsdbUpdateDelFileHdr(pWriter->pDelFWriter); if (code) goto _err; - code = tsdbFSStateUpsertDelFile(pTsdb->fs->nState, &pWriter->pDelFWriter->fDel); + code = tsdbFSStateUpsertDelFile(pTsdb->pFS->nState, &pWriter->pDelFWriter->fDel); if (code) goto _err; code = tsdbDelFWriterClose(&pWriter->pDelFWriter, 1); @@ -1096,7 +1096,7 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWr goto _err; } - code = tsdbFSBegin(pTsdb->fs); + code = tsdbFSBegin(pTsdb->pFS); if (code) goto _err; *ppWriter = pWriter; @@ -1113,7 +1113,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) { STsdbSnapWriter* pWriter = *ppWriter; if (rollback) { - code = tsdbFSRollback(pWriter->pTsdb->fs); + code = tsdbFSRollback(pWriter->pTsdb->pFS); if (code) goto _err; } else { code = tsdbSnapWriteDataEnd(pWriter); @@ -1122,7 +1122,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) { code = tsdbSnapWriteDelEnd(pWriter); if (code) goto _err; - code = tsdbFSCommit(pWriter->pTsdb->fs); + code = tsdbFSCommit(pWriter->pTsdb->pFS); if (code) goto _err; } diff --git a/source/dnode/vnode/src/vnd/vnodeBufPool.c b/source/dnode/vnode/src/vnd/vnodeBufPool.c index 9ca4dd6efb..d1584f701e 100644 --- a/source/dnode/vnode/src/vnd/vnodeBufPool.c +++ b/source/dnode/vnode/src/vnd/vnodeBufPool.c @@ -17,7 +17,7 @@ /* ------------------------ STRUCTURES ------------------------ */ -static int vnodeBufPoolCreate(int64_t size, SVBufPool **ppPool); +static int vnodeBufPoolCreate(SVnode *pVnode, int64_t size, SVBufPool **ppPool); static int vnodeBufPoolDestroy(SVBufPool *pPool); int vnodeOpenBufPool(SVnode *pVnode, int64_t size) { @@ -28,7 +28,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) { for (int i = 0; i < 3; i++) { // create pool - ret = vnodeBufPoolCreate(size, &pPool); + ret = vnodeBufPoolCreate(pVnode, size, &pPool); if (ret < 0) { vError("vgId:%d, failed to open vnode buffer pool since %s", TD_VID(pVnode), tstrerror(terrno)); vnodeCloseBufPool(pVnode); @@ -120,7 +120,7 @@ void vnodeBufPoolFree(SVBufPool *pPool, void *p) { } // STATIC METHODS ------------------- -static int vnodeBufPoolCreate(int64_t size, SVBufPool **ppPool) { +static int vnodeBufPoolCreate(SVnode *pVnode, int64_t size, SVBufPool **ppPool) { SVBufPool *pPool; pPool = taosMemoryMalloc(sizeof(SVBufPool) + size); @@ -130,6 +130,7 @@ static int vnodeBufPoolCreate(int64_t size, SVBufPool **ppPool) { } pPool->next = NULL; + pPool->pVnode = pVnode; pPool->nRef = 0; pPool->size = 0; pPool->ptr = pPool->node.data; @@ -146,4 +147,26 @@ static int vnodeBufPoolDestroy(SVBufPool *pPool) { vnodeBufPoolReset(pPool); taosMemoryFree(pPool); return 0; +} + +void vnodeBufPoolRef(SVBufPool *pPool) { + int32_t nRef = atomic_fetch_add_32(&pPool->nRef, 1); + ASSERT(nRef > 0); +} + +void vnodeBufPoolUnRef(SVBufPool *pPool) { + int32_t nRef = atomic_sub_fetch_32(&pPool->nRef, 1); + if (nRef == 0) { + SVnode *pVnode = pPool->pVnode; + + vnodeBufPoolReset(pPool); + + taosThreadMutexLock(&pVnode->mutex); + + pPool->next = pVnode->pPool; + pVnode->pPool = pPool; + taosThreadCondSignal(&pVnode->poolNotEmpty); + + taosThreadMutexUnlock(&pVnode->mutex); + } } \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index c969861241..0c8a8a5fd1 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -15,7 +15,7 @@ #include "vnd.h" -#define VND_INFO_FNAME "vnode.json" +#define VND_INFO_FNAME "vnode.json" #define VND_INFO_FNAME_TMP "vnode_tmp.json" static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData); @@ -27,18 +27,18 @@ static void vnodeWaitCommit(SVnode *pVnode); int vnodeBegin(SVnode *pVnode) { // alloc buffer pool - /* pthread_mutex_lock(); */ + taosThreadMutexLock(&pVnode->mutex); while (pVnode->pPool == NULL) { - /* pthread_cond_wait(); */ + taosThreadCondWait(&pVnode->poolNotEmpty, &pVnode->mutex); } pVnode->inUse = pVnode->pPool; + pVnode->inUse->nRef = 1; pVnode->pPool = pVnode->inUse->next; pVnode->inUse->next = NULL; - /* ref pVnode->inUse buffer pool */ - /* pthread_mutex_unlock(); */ + taosThreadMutexUnlock(&pVnode->mutex); pVnode->state.commitID++; // begin meta @@ -217,7 +217,7 @@ int vnodeCommit(SVnode *pVnode) { vInfo("vgId:%d, start to commit, commit ID:%" PRId64 " version:%" PRId64, TD_VID(pVnode), pVnode->state.commitID, pVnode->state.applied); - pVnode->onCommit = pVnode->inUse; + vnodeBufPoolUnRef(pVnode->inUse); pVnode->inUse = NULL; // save info @@ -284,10 +284,6 @@ int vnodeCommit(SVnode *pVnode) { // apply the commit (TODO) walEndSnapshot(pVnode->pWal); - vnodeBufPoolReset(pVnode->onCommit); - pVnode->onCommit->next = pVnode->pPool; - pVnode->pPool = pVnode->onCommit; - pVnode->onCommit = NULL; vInfo("vgId:%d, commit over", TD_VID(pVnode)); diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 0914827950..fb2ac722a6 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -89,6 +89,8 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { tsem_init(&pVnode->syncSem, 0, 0); tsem_init(&(pVnode->canCommit), 0, 1); + taosThreadMutexInit(&pVnode->mutex, NULL); + taosThreadCondInit(&pVnode->poolNotEmpty, NULL); // open buffer pool if (vnodeOpenBufPool(pVnode, pVnode->config.isHeap ? 0 : pVnode->config.szBuf / 3) < 0) { @@ -195,6 +197,8 @@ void vnodeClose(SVnode *pVnode) { // destroy handle tsem_destroy(&(pVnode->canCommit)); tsem_destroy(&pVnode->syncSem); + taosThreadCondDestroy(&pVnode->poolNotEmpty); + taosThreadMutexDestroy(&pVnode->mutex); taosMemoryFree(pVnode); } } diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index 59242cbd8a..7241ca4971 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -27,6 +27,8 @@ struct SVSnapReader { // tsdb int8_t tsdbDone; STsdbSnapReader *pTsdbReader; + // rsma + int8_t rsmaDone[TSDB_RETENTION_L2]; }; int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapReader **ppReader) { @@ -115,6 +117,42 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData) } } + // RSMA ============== +#if 0 + if (VND_IS_RSMA(pReader->pVnode)) { + // RSMA1/RSMA2 + for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { + if (!pReader->rsmaDone[i]) { + if (!pReader->pVnode->pSma->pRSmaTsdb[i]) { + // no valid tsdb + pReader->rsmaDone[i] = 1; + continue; + } + if (pReader->pTsdbReader == NULL) { + code = tsdbSnapReaderOpen(pReader->pVnode->pSma->pRSmaTsdb[i], pReader->sver, pReader->ever, + &pReader->pTsdbReader); + if (code) goto _err; + } + + code = tsdbSnapRead(pReader->pTsdbReader, ppData); + if (code) { + goto _err; + } else { + if (*ppData) { + goto _exit; + } else { + pReader->tsdbDone = 1; + code = tsdbSnapReaderClose(&pReader->pTsdbReader); + if (code) goto _err; + } + } + } + } + // QTaskInfoFile + // TODO ... + } +#endif + *ppData = NULL; *nData = 0; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 5f730bcfa5..e6d116dfef 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -557,6 +557,7 @@ static int32_t vnodeProcessDropStbReq(SVnode *pVnode, int64_t version, void *pRe SVDropStbReq req = {0}; int32_t rcode = TSDB_CODE_SUCCESS; SDecoder decoder = {0}; + SArray *tbUidList = NULL; pRsp->msgType = TDMT_VND_CREATE_STB_RSP; pRsp->pCont = NULL; @@ -570,7 +571,14 @@ static int32_t vnodeProcessDropStbReq(SVnode *pVnode, int64_t version, void *pRe } // process request - if (metaDropSTable(pVnode->pMeta, version, &req) < 0) { + tbUidList = taosArrayInit(8, sizeof(int64_t)); + if (tbUidList == NULL) goto _exit; + if (metaDropSTable(pVnode->pMeta, version, &req, tbUidList) < 0) { + rcode = terrno; + goto _exit; + } + + if (tqUpdateTbUidList(pVnode->pTq, tbUidList, false) < 0) { rcode = terrno; goto _exit; } @@ -582,6 +590,7 @@ static int32_t vnodeProcessDropStbReq(SVnode *pVnode, int64_t version, void *pRe // return rsp _exit: + if (tbUidList) taosArrayDestroy(tbUidList); pRsp->code = rcode; tDecoderClear(&decoder); return 0; @@ -869,6 +878,8 @@ _exit: tdProcessRSmaSubmit(pVnode->pSma, pReq, STREAM_INPUT__DATA_SUBMIT); } + vDebug("successful submit in vg %d version %ld", pVnode->config.vgId, version); + return 0; } diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index fb9f588bae..9003de97d7 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -532,6 +532,14 @@ typedef struct SCtgOperation { } \ } while (0) +#define CTG_API_JENTER() do { \ + CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); \ + CTG_LOCK(CTG_READ, &gCtgMgmt.lock); \ + if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { \ + CTG_ERR_JRET(TSDB_CODE_CTG_OUT_OF_SERVICE); \ + } \ +} while (0) + #define CTG_API_LEAVE_NOLOCK(c) do { \ int32_t __code = c; \ diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 8e0a5b7de3..1e375471f9 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -244,10 +244,11 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { SCtgTaskCallbackParam* cbParam = (SCtgTaskCallbackParam*)param; int32_t code = 0; + SCtgJob* pJob = NULL; - CTG_API_ENTER(); + CTG_API_JENTER(); - SCtgJob* pJob = taosAcquireRef(gCtgMgmt.jobPool, cbParam->refId); + pJob = taosAcquireRef(gCtgMgmt.jobPool, cbParam->refId); if (NULL == pJob) { qDebug("ctg job refId 0x%" PRIx64 " already dropped", cbParam->refId); goto _return; @@ -266,8 +267,6 @@ _return: if (pJob) { taosReleaseRef(gCtgMgmt.jobPool, cbParam->refId); } - - taosMemoryFree(param); CTG_API_LEAVE(code); } @@ -293,6 +292,7 @@ int32_t ctgMakeMsgSendInfo(SCtgTask* pTask, int32_t msgType, SMsgSendInfo **pMsg param->taskId = pTask->taskId; msgSendInfo->param = param; + msgSendInfo->paramFreeFp = taosMemoryFree; msgSendInfo->fp = ctgHandleMsgCallback; *pMsgSendInfo = msgSendInfo; diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index a7e033e547..d7c283c70d 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -159,27 +159,28 @@ typedef struct { int64_t recoverEndVer; } SStreamTaskInfo; +typedef struct { + char* tablename; + char* dbname; + int32_t tversion; + SSchemaWrapper* sw; +} SSchemaInfo; + typedef struct SExecTaskInfo { - STaskIdInfo id; - uint32_t status; - STimeWindow window; - STaskCostInfo cost; - int64_t owner; // if it is in execution - int32_t code; + STaskIdInfo id; + uint32_t status; + STimeWindow window; + STaskCostInfo cost; + int64_t owner; // if it is in execution + int32_t code; - SStreamTaskInfo streamInfo; - - struct { - char* tablename; - char* dbname; - int32_t tversion; - SSchemaWrapper* sw; - } schemaVer; - - STableListInfo tableqinfoList; // this is a table list - const char* sql; // query sql string - jmp_buf env; // jump to this position when error happens. - EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + SStreamTaskInfo streamInfo; + SSchemaInfo schemaInfo; + STableListInfo tableqinfoList; // this is a table list + const char* sql; // query sql string + jmp_buf env; // jump to this position when error happens. + EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + SSubplan* pSubplan; struct SOperatorInfo* pRoot; } SExecTaskInfo; @@ -248,13 +249,13 @@ typedef struct SLoadRemoteDataInfo { } SLoadRemoteDataInfo; typedef struct SLimitInfo { - SLimit limit; - SLimit slimit; - uint64_t currentGroupId; - int64_t remainGroupOffset; - int64_t numOfOutputGroups; - int64_t remainOffset; - int64_t numOfOutputRows; + SLimit limit; + SLimit slimit; + uint64_t currentGroupId; + int64_t remainGroupOffset; + int64_t numOfOutputGroups; + int64_t remainOffset; + int64_t numOfOutputRows; } SLimitInfo; typedef struct SExchangeInfo { diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 395b42aa86..c46485a332 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -227,14 +227,14 @@ int32_t extractTargetSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInf for (int32_t i = 0; i < numOfCols; ++i) { SColMatchInfo* pColMatch = taosArrayGet(pColMatchInfo, i); - for (int32_t j = 0; j < pTaskInfo->schemaVer.sw->nCols; ++j) { - if (pColMatch->colId == pTaskInfo->schemaVer.sw->pSchema[j].colId && + for (int32_t j = 0; j < pTaskInfo->schemaInfo.sw->nCols; ++j) { + if (pColMatch->colId == pTaskInfo->schemaInfo.sw->pSchema[j].colId && pColMatch->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { (*pSlotIds)[pColMatch->targetSlotId] = -1; break; } - if (pColMatch->colId == pTaskInfo->schemaVer.sw->pSchema[j].colId) { + if (pColMatch->colId == pTaskInfo->schemaInfo.sw->pSchema[j].colId) { (*pSlotIds)[pColMatch->targetSlotId] = j; break; } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index b8495faffd..f0fb5852a0 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -67,15 +67,15 @@ static bool needCompress(const SSDataBlock* pData, int32_t numOfCols) { return false; } +// clang-format off // data format: -// +----------------+--------------+----------+--------------------------------------------+--------------------------------------+-------------+-----------+-------------+-----------+ -// |SDataCacheEntry | total length | group id | col1_schema | col2_schema | col3_schema ...| column#1 length, column#2 -// length ... | col1 bitmap | col1 data | col2 bitmap | col2 data | .... | | (4 bytes) |(8 bytes) -// |(sizeof(int16_t)+sizeof(int32_t))*numOfCols | sizeof(int32_t) * numOfCols | actual size | | -// actual size | | -// +----------------+--------------+----------+--------------------------------------------+--------------------------------------+-------------+-----------+-------------+-----------+ +// +----------------+--------------+-----------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+ +// |SDataCacheEntry | total length | group id | col1_schema | col2_schema | col3_schema... | column#1 length, column#2 length...| col1 bitmap | col1 data | col2 bitmap | col2 data | .... | | (4 bytes) |(8 bytes) +// | |sizeof(int32) |sizeof(uint64_t) |(sizeof(int16_t)+sizeof(int32_t))*numOfCols | sizeof(int32_t) * numOfCols | actual size | | +// +----------------+--------------+-----------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+ // The length of bitmap is decided by number of rows of this data block, and the length of each column data is // recorded in the first segment, next to the struct header +// clang-format on static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pInput, SDataDispatchBuf* pBuf) { int32_t numOfCols = 0; SNode* pNode; diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index a575e355f1..1c08fafaa3 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -91,7 +91,6 @@ _return: tsem_post(&pInserter->ready); taosMemoryFree(pMsg->pData); - taosMemoryFree(param); return TSDB_CODE_SUCCESS; } @@ -110,6 +109,7 @@ static int32_t sendSubmitRequest(SDataInserterHandle* pInserter, SSubmitReq* pMs pParam->pInserter = pInserter; pMsgSendInfo->param = pParam; + pMsgSendInfo->paramFreeFp = taosMemoryFree; pMsgSendInfo->msgInfo.pData = pMsg; pMsgSendInfo->msgInfo.len = ntohl(pMsg->length); pMsgSendInfo->msgType = TDMT_VND_SUBMIT; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 4c86a46b6c..978bef1607 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -842,30 +842,10 @@ static void getInitialStartTimeWindow(SInterval* pInterval, TSKEY ts, STimeWindo } static STimeWindow doCalculateTimeWindow(int64_t ts, SInterval* pInterval) { - STimeWindow w = {0}; - - if (pInterval->intervalUnit == 'n' || pInterval->intervalUnit == 'y') { - w.skey = taosTimeTruncate(ts, pInterval, pInterval->precision); - w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; - } else { - int64_t st = w.skey; - if (pInterval->offset > 0) { - st = taosTimeAdd(st, pInterval->offset, pInterval->offsetUnit, pInterval->precision); - } - - if (st > ts) { - st -= ((st - ts + pInterval->sliding - 1) / pInterval->sliding) * pInterval->sliding; - } - - int64_t et = st + pInterval->interval - 1; - if (et < ts) { - st += ((ts - et + pInterval->sliding - 1) / pInterval->sliding) * pInterval->sliding; - } - - w.skey = st; - w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; - } + STimeWindow w = {0}; + w.skey = taosTimeTruncate(ts, pInterval, pInterval->precision); + w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; return w; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 90952d5786..9491c675c1 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -42,17 +42,32 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu // TODO: if a block was set but not consumed, // prevent setting a different type of block - pInfo->blockType = type; + pInfo->validBlockIndex = 0; + taosArrayClear(pInfo->pBlockLists); - if (type == STREAM_INPUT__DATA_SUBMIT) { - if (tqReaderSetDataMsg(pInfo->tqReader, input, 0) < 0) { - qError("submit msg messed up when initing stream block, %s" PRIx64, id); - return TSDB_CODE_QRY_APP_ERROR; + if (type == STREAM_INPUT__MERGED_SUBMIT) { + ASSERT(numOfBlocks > 1); + for (int32_t i = 0; i < numOfBlocks; i++) { + SSubmitReq* pReq = *(void**)POINTER_SHIFT(input, i * sizeof(void*)); + taosArrayPush(pInfo->pBlockLists, &pReq); } + pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; + } else if (type == STREAM_INPUT__DATA_SUBMIT) { + /*if (tqReaderSetDataMsg(pInfo->tqReader, input, 0) < 0) {*/ + /*qError("submit msg messed up when initing stream block, %s" PRIx64, id);*/ + /*return TSDB_CODE_QRY_APP_ERROR;*/ + /*}*/ + ASSERT(numOfBlocks == 1); + /*if (numOfBlocks == 1) {*/ + taosArrayPush(pInfo->pBlockLists, &input); + pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; + /*} else {*/ + /*}*/ } else if (type == STREAM_INPUT__DATA_BLOCK) { for (int32_t i = 0; i < numOfBlocks; ++i) { SSDataBlock* pDataBlock = &((SSDataBlock*)input)[i]; + // TODO optimize SSDataBlock* p = createOneDataBlock(pDataBlock, false); p->info = pDataBlock->info; @@ -60,6 +75,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock); taosArrayPush(pInfo->pBlockLists, &p); } + pInfo->blockType = STREAM_INPUT__DATA_BLOCK; } else { ASSERT(0); } @@ -104,27 +120,40 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO return code; } -qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers) { +qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols) { if (msg == NULL) { // TODO create raw scan return NULL; } - struct SSubplan* plan = NULL; - int32_t code = qStringToSubplan(msg, &plan); + struct SSubplan* pPlan = NULL; + int32_t code = qStringToSubplan(msg, &pPlan); if (code != TSDB_CODE_SUCCESS) { terrno = code; return NULL; } qTaskInfo_t pTaskInfo = NULL; - code = qCreateExecTask(readers, 0, 0, plan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_QUEUE); + code = qCreateExecTask(readers, 0, 0, pPlan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_QUEUE); if (code != TSDB_CODE_SUCCESS) { - // TODO: destroy SSubplan & pTaskInfo + nodesDestroyNode((SNode*)pPlan); + qDestroyTask(pTaskInfo); terrno = code; return NULL; } + // extract the number of output columns + SDataBlockDescNode* pDescNode = pPlan->pNode->pOutputDataBlockDesc; + *numOfCols = 0; + + SNode* pNode; + FOREACH(pNode, pDescNode->pSlots) { + SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; + if (pSlotDesc->output) { + ++(*numOfCols); + } + } + return pTaskInfo; } @@ -135,17 +164,18 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers) { /*qDebugL("stream task string %s", (const char*)msg);*/ - struct SSubplan* plan = NULL; - int32_t code = qStringToSubplan(msg, &plan); + struct SSubplan* pPlan = NULL; + int32_t code = qStringToSubplan(msg, &pPlan); if (code != TSDB_CODE_SUCCESS) { terrno = code; return NULL; } qTaskInfo_t pTaskInfo = NULL; - code = qCreateExecTask(readers, 0, 0, plan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_STREAM); + code = qCreateExecTask(readers, 0, 0, pPlan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_STREAM); if (code != TSDB_CODE_SUCCESS) { - // TODO: destroy SSubplan & pTaskInfo + nodesDestroyNode((SNode*)pPlan); + qDestroyTask(pTaskInfo); terrno = code; return NULL; } @@ -153,7 +183,8 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers) { return pTaskInfo; } -static SArray* filterQualifiedChildTables(const SStreamScanInfo* pScanInfo, const SArray* tableIdList, const char* idstr) { +static SArray* filterQualifiedChildTables(const SStreamScanInfo* pScanInfo, const SArray* tableIdList, + const char* idstr) { SArray* qa = taosArrayInit(4, sizeof(tb_uid_t)); // let's discard the tables those are not created according to the queried super table. @@ -227,19 +258,19 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table ASSERT(tinfo != NULL && dbName != NULL && tableName != NULL); SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - if (pTaskInfo->schemaVer.sw == NULL) { + if (pTaskInfo->schemaInfo.sw == NULL) { return TSDB_CODE_SUCCESS; } - *sversion = pTaskInfo->schemaVer.sw->version; - *tversion = pTaskInfo->schemaVer.tversion; - if (pTaskInfo->schemaVer.dbname) { - strcpy(dbName, pTaskInfo->schemaVer.dbname); + *sversion = pTaskInfo->schemaInfo.sw->version; + *tversion = pTaskInfo->schemaInfo.tversion; + if (pTaskInfo->schemaInfo.dbname) { + strcpy(dbName, pTaskInfo->schemaInfo.dbname); } else { dbName[0] = 0; } - if (pTaskInfo->schemaVer.tablename) { - strcpy(tableName, pTaskInfo->schemaVer.tablename); + if (pTaskInfo->schemaInfo.tablename) { + strcpy(tableName, pTaskInfo->schemaInfo.tablename); } else { tableName[0] = 0; } diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index 9d3d62cabf..c3efbf9336 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -39,6 +39,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, taosThreadOnce(&initPoolOnce, initRefPool); atexit(cleanupRefPool); + int32_t code = createExecTaskInfoImpl(pSubplan, pTask, readHandle, taskId, sql, model); if (code != TSDB_CODE_SUCCESS) { goto _error; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 06bb096e59..7ff9e90c75 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1337,7 +1337,9 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) { if (pFilterNode == NULL) { return; } - + if (pBlock->info.rows == 0) { + return; + } SFilterInfo* filter = NULL; // todo move to the initialization function @@ -1994,16 +1996,9 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { tsem_post(&pExchangeInfo->ready); taosReleaseRef(exchangeObjRefPool, pWrapper->exchangeId); - taosMemoryFree(pWrapper); return TSDB_CODE_SUCCESS; } -static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { - assert(pMsgBody != NULL); - taosMemoryFreeClear(pMsgBody->msgInfo.pData); - taosMemoryFreeClear(pMsgBody); -} - void qProcessRspMsg(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->info.ahandle; assert(pMsg->info.ahandle != NULL); @@ -2063,6 +2058,7 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf pWrapper->sourceIndex = sourceIndex; pMsgSendInfo->param = pWrapper; + pMsgSendInfo->paramFreeFp = taosMemoryFree; pMsgSendInfo->msgInfo.pData = pMsg; pMsgSendInfo->msgInfo.len = sizeof(SResFetchReq); pMsgSendInfo->msgType = pSource->fetchMsgType; @@ -4127,7 +4123,7 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT SExecTaskInfo* pTaskInfo = taosMemoryCalloc(1, sizeof(SExecTaskInfo)); setTaskStatus(pTaskInfo, TASK_NOT_COMPLETED); - pTaskInfo->schemaVer.dbname = strdup(dbFName); + pTaskInfo->schemaInfo.dbname = strdup(dbFName); pTaskInfo->cost.created = taosGetTimestampMs(); pTaskInfo->id.queryId = queryId; pTaskInfo->execModel = model; @@ -4153,35 +4149,35 @@ int32_t extractTableSchemaInfo(SReadHandle* pHandle, uint64_t uid, SExecTaskInfo return terrno; } - pTaskInfo->schemaVer.tablename = strdup(mr.me.name); + pTaskInfo->schemaInfo.tablename = strdup(mr.me.name); if (mr.me.type == TSDB_SUPER_TABLE) { - pTaskInfo->schemaVer.sw = tCloneSSchemaWrapper(&mr.me.stbEntry.schemaRow); - pTaskInfo->schemaVer.tversion = mr.me.stbEntry.schemaTag.version; + pTaskInfo->schemaInfo.sw = tCloneSSchemaWrapper(&mr.me.stbEntry.schemaRow); + pTaskInfo->schemaInfo.tversion = mr.me.stbEntry.schemaTag.version; } else if (mr.me.type == TSDB_CHILD_TABLE) { tDecoderClear(&mr.coder); tb_uid_t suid = mr.me.ctbEntry.suid; metaGetTableEntryByUid(&mr, suid); - pTaskInfo->schemaVer.sw = tCloneSSchemaWrapper(&mr.me.stbEntry.schemaRow); - pTaskInfo->schemaVer.tversion = mr.me.stbEntry.schemaTag.version; + pTaskInfo->schemaInfo.sw = tCloneSSchemaWrapper(&mr.me.stbEntry.schemaRow); + pTaskInfo->schemaInfo.tversion = mr.me.stbEntry.schemaTag.version; } else { - pTaskInfo->schemaVer.sw = tCloneSSchemaWrapper(&mr.me.ntbEntry.schemaRow); + pTaskInfo->schemaInfo.sw = tCloneSSchemaWrapper(&mr.me.ntbEntry.schemaRow); } metaReaderClear(&mr); return TSDB_CODE_SUCCESS; } -static void cleanupTableSchemaInfo(SExecTaskInfo* pTaskInfo) { - taosMemoryFreeClear(pTaskInfo->schemaVer.dbname); - if (pTaskInfo->schemaVer.sw == NULL) { +static void cleanupTableSchemaInfo(SSchemaInfo* pSchemaInfo) { + taosMemoryFreeClear(pSchemaInfo->dbname); + if (pSchemaInfo->sw == NULL) { return; } - taosMemoryFree(pTaskInfo->schemaVer.sw->pSchema); - taosMemoryFree(pTaskInfo->schemaVer.sw); - taosMemoryFree(pTaskInfo->schemaVer.tablename); + taosMemoryFree(pSchemaInfo->tablename); + taosMemoryFree(pSchemaInfo->sw->pSchema); + taosMemoryFree(pSchemaInfo->sw); } static int32_t sortTableGroup(STableListInfo* pTableListInfo, int32_t groupNum) { @@ -4424,7 +4420,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo .calTrigger = pTableScanNode->triggerType, .maxTs = INT64_MIN, }; - if (pHandle) { + if (pHandle->vnode) { int32_t code = createScanTableListInfo(&pTableScanNode->scan, pTableScanNode->pGroupTags, pTableScanNode->groupSort, pHandle, pTableListInfo, pTagCond, pTagIndexCond, GET_TASKID(pTaskInfo)); if (code) { @@ -4590,7 +4586,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo int32_t children = 0; pOptr = createStreamFinalIntervalOperatorInfo(ops[0], pPhyNode, pTaskInfo, children); } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL == type) { - int32_t children = 1; + int32_t children = pHandle->numOfVgroups; pOptr = createStreamFinalIntervalOperatorInfo(ops[0], pPhyNode, pTaskInfo, children); } else if (QUERY_NODE_PHYSICAL_PLAN_SORT == type) { pOptr = createSortOperatorInfo(ops[0], (SSortPhysiNode*)pPhyNode, pTaskInfo); @@ -4939,6 +4935,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead } (*pTaskInfo)->sql = sql; + (*pTaskInfo)->pSubplan = pPlan; (*pTaskInfo)->pRoot = createOperatorTree(pPlan->pNode, *pTaskInfo, pHandle, &(*pTaskInfo)->tableqinfoList, pPlan->pTagCond, pPlan->pTagIndexCond, pPlan->user); if (NULL == (*pTaskInfo)->pRoot) { @@ -4977,7 +4974,9 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) { doDestroyTableList(&pTaskInfo->tableqinfoList); destroyOperatorInfo(pTaskInfo->pRoot); - cleanupTableSchemaInfo(pTaskInfo); + cleanupTableSchemaInfo(&pTaskInfo->schemaInfo); + + nodesDestroyNode((SNode*)pTaskInfo->pSubplan); taosMemoryFreeClear(pTaskInfo->sql); taosMemoryFreeClear(pTaskInfo->id.str); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index e60f6f8a5b..2e78b61b8c 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1196,7 +1196,6 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock if (pResCol->info.colId == pColMatchInfo->colId) { SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId); colDataAssign(pDst, pResCol, pBlock->info.rows, &pInfo->pRes->info); - // taosArraySet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId, pResCol); colExists = true; break; } @@ -1393,24 +1392,49 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { } SDataBlockInfo* pBlockInfo = &pInfo->pRes->info; - blockDataCleanup(pInfo->pRes); - while (tqNextDataBlock(pInfo->tqReader)) { - SSDataBlock block = {0}; + int32_t totBlockNum = taosArrayGetSize(pInfo->pBlockLists); - // todo refactor - int32_t code = tqRetrieveDataBlock(&block, pInfo->tqReader); + while (1) { + if (pInfo->tqReader->pMsg == NULL) { + if (pInfo->validBlockIndex >= totBlockNum) { + return NULL; + } - if (code != TSDB_CODE_SUCCESS || block.info.rows == 0) { - pTaskInfo->code = code; - return NULL; + int32_t current = pInfo->validBlockIndex++; + SSubmitReq* pSubmit = taosArrayGetP(pInfo->pBlockLists, current); + if (tqReaderSetDataMsg(pInfo->tqReader, pSubmit, 0) < 0) { + qError("submit msg messed up when initing stream submit block %p, current %d, total %d", pSubmit, current, + totBlockNum); + pInfo->tqReader->pMsg = NULL; + continue; + } } - setBlockIntoRes(pInfo, &block); + blockDataCleanup(pInfo->pRes); + while (tqNextDataBlock(pInfo->tqReader)) { + SSDataBlock block = {0}; + + int32_t code = tqRetrieveDataBlock(&block, pInfo->tqReader); + + if (code != TSDB_CODE_SUCCESS || block.info.rows == 0) { + continue; + } + + setBlockIntoRes(pInfo, &block); + + if (pBlockInfo->rows > 0) { + break; + } + } if (pBlockInfo->rows > 0) { break; + } else { + pInfo->tqReader->pMsg = NULL; + continue; } + /*blockDataCleanup(pInfo->pRes);*/ } // record the scan action. @@ -1435,6 +1459,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { } } } + qDebug("scan rows: %d", pBlockInfo->rows); return (pBlockInfo->rows == 0) ? NULL : pInfo->pRes; @@ -1507,8 +1532,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys goto _error; } - SScanPhysiNode* pScanPhyNode = &pTableScanNode->scan; - + SScanPhysiNode* pScanPhyNode = &pTableScanNode->scan; SDataBlockDescNode* pDescNode = pScanPhyNode->node.pOutputDataBlockDesc; pInfo->pTagCond = pTagCond; @@ -1539,7 +1563,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys goto _error; } - if (pHandle) { + if (pHandle->vnode) { SOperatorInfo* pTableScanOp = createTableScanOperatorInfo(pTableScanNode, pHandle, pTaskInfo); STableScanInfo* pTSInfo = (STableScanInfo*)pTableScanOp->info; if (pHandle->version > 0) { @@ -2558,30 +2582,30 @@ typedef struct STableMergeScanInfo { SArray* pSortInfo; SSortHandle* pSortHandle; - SSDataBlock* pSortInputBlock; - int64_t startTs; // sort start time - SArray* sortSourceParams; + SSDataBlock* pSortInputBlock; + int64_t startTs; // sort start time + SArray* sortSourceParams; SFileBlockLoadRecorder readRecorder; - int64_t numOfRows; - SScanInfo scanInfo; - int32_t scanTimes; - SNode* pFilterNode; // filter info, which is push down by optimizer - SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context - SResultRowInfo* pResultRowInfo; - int32_t* rowEntryInfoOffset; - SExprInfo* pExpr; - SSDataBlock* pResBlock; - SArray* pColMatchInfo; - int32_t numOfOutput; + int64_t numOfRows; + SScanInfo scanInfo; + int32_t scanTimes; + SNode* pFilterNode; // filter info, which is push down by optimizer + SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context + SResultRowInfo* pResultRowInfo; + int32_t* rowEntryInfoOffset; + SExprInfo* pExpr; + SSDataBlock* pResBlock; + SArray* pColMatchInfo; + int32_t numOfOutput; SExprInfo* pPseudoExpr; int32_t numOfPseudoExpr; SqlFunctionCtx* pPseudoCtx; SQueryTableDataCond cond; - int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan - int32_t dataBlockLoadFlag; + int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan + int32_t dataBlockLoadFlag; // if the upstream is an interval operator, the interval info is also kept here to get the time // window to check if current data block needs to be loaded. SInterval interval; @@ -2589,7 +2613,8 @@ typedef struct STableMergeScanInfo { } STableMergeScanInfo; int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags, bool groupSort, SReadHandle* pHandle, - STableListInfo* pTableListInfo, SNode* pTagCond, SNode* pTagIndexCond, const char* idStr) { + STableListInfo* pTableListInfo, SNode* pTagCond, SNode* pTagIndexCond, + const char* idStr) { int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanNode, pTagCond, pTagIndexCond, pTableListInfo); if (code != TSDB_CODE_SUCCESS) { return code; diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 550938140e..31c079e55f 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -544,8 +544,9 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) { return true; } - if (pFillInfo->numOfTotal > 0 && (((pFillInfo->end > pFillInfo->start) && FILL_IS_ASC_FILL(pFillInfo)) || - (pFillInfo->end < pFillInfo->start && !FILL_IS_ASC_FILL(pFillInfo)))) { + bool ascFill = FILL_IS_ASC_FILL(pFillInfo); + if (pFillInfo->numOfTotal > 0 && + (((pFillInfo->end > pFillInfo->start) && ascFill) || (pFillInfo->end < pFillInfo->start && !ascFill))) { return getNumOfResultsAfterFillGap(pFillInfo, pFillInfo->end, 4096) > 0; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 026222f83a..b0a74c3002 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1543,6 +1543,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) { taosArrayDestroy(pInfo->pPullWins); blockDataDestroy(pInfo->pPullDataRes); taosArrayDestroy(pInfo->pRecycledPages); + blockDataDestroy(pInfo->pUpdateRes); if (pInfo->pChildren) { int32_t size = taosArrayGetSize(pInfo->pChildren); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index fcde97ed5f..9c004bf1c4 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -192,9 +192,9 @@ static bool validateTimezoneFormat(const SValueNode* pVal) { } void static addTimezoneParam(SNodeList* pList) { - char buf[6] = {0}; - time_t t = taosTime(NULL); - struct tm tmInfo; + char buf[6] = {0}; + time_t t = taosTime(NULL); + struct tm tmInfo; taosLocalTime(&t, &tmInfo); strftime(buf, sizeof(buf), "%z", &tmInfo); int32_t len = (int32_t)strlen(buf); @@ -976,7 +976,7 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l // param1 ~ param3 if (((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type != TSDB_DATA_TYPE_BINARY || ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 2))->resType.type != TSDB_DATA_TYPE_BINARY || - ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type != TSDB_DATA_TYPE_BIGINT) { + !IS_INTEGER_TYPE(((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type)) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } @@ -1034,7 +1034,7 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32 // param1 ~ param3 if (((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type != TSDB_DATA_TYPE_BINARY || ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 2))->resType.type != TSDB_DATA_TYPE_BINARY || - ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type != TSDB_DATA_TYPE_BIGINT) { + !IS_INTEGER_TYPE(((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type)) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } @@ -1133,9 +1133,10 @@ static bool validateStateOper(const SValueNode* pVal) { if (TSDB_DATA_TYPE_BINARY != pVal->node.resType.type) { return false; } - return (0 == strncasecmp(varDataVal(pVal->datum.p), "GT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "GE", 2) || - 0 == strncasecmp(varDataVal(pVal->datum.p), "LT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "LE", 2) || - 0 == strncasecmp(varDataVal(pVal->datum.p), "EQ", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "NE", 2)); + return ( + 0 == strncasecmp(varDataVal(pVal->datum.p), "GT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "GE", 2) || + 0 == strncasecmp(varDataVal(pVal->datum.p), "LT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "LE", 2) || + 0 == strncasecmp(varDataVal(pVal->datum.p), "EQ", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "NE", 2)); } static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { @@ -1348,7 +1349,8 @@ static int32_t translateTail(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { SValueNode* pValue = (SValueNode*)pParamNode; - if (pValue->datum.i < ((i > 1) ? 0 : 1) || pValue->datum.i > 100) { + if ((IS_SIGNED_NUMERIC_TYPE(pValue->node.resType.type) ? pValue->datum.i : pValue->datum.u) < ((i > 1) ? 0 : 1) || + (IS_SIGNED_NUMERIC_TYPE(pValue->node.resType.type) ? pValue->datum.i : pValue->datum.u) > 100) { return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "TAIL function second parameter should be in range [1, 100], " "third parameter should be in range [0, 100]"); @@ -1423,6 +1425,17 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) } static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + // forbid null as first/last input, since first(c0, null, 1) may have different number of input + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + + for (int32_t i = 0; i < numOfParams; ++i) { + uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i)); + uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type; + if (IS_NULL_TYPE(paraType) && QUERY_NODE_VALUE == nodeType) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + } + pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType; return TSDB_CODE_SUCCESS; } @@ -1433,6 +1446,15 @@ static int32_t translateFirstLastImpl(SFunctionNode* pFunc, char* pErrBuf, int32 uint8_t paraType = ((SExprNode*)pPara)->resType.type; int32_t paraBytes = ((SExprNode*)pPara)->resType.bytes; if (isPartial) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + for (int32_t i = 0; i < numOfParams; ++i) { + uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i)); + uint8_t pType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type; + if (IS_NULL_TYPE(pType) && QUERY_NODE_VALUE == nodeType) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + } + pFunc->node.resType = (SDataType){.bytes = getFirstLastInfoSize(paraBytes) + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; } else { @@ -1646,9 +1668,9 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { if (IS_VAR_DATA_TYPE(para2Type)) { para2Bytes -= VARSTR_HEADER_SIZE; } - if (para2Bytes <= 0 || para2Bytes > 1000) { // cast dst var type length limits to 1000 + if (para2Bytes <= 0 || para2Bytes > 4096) { // cast dst var type length limits to 4096 bytes return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "CAST function converted length should be in range [0, 1000]"); + "CAST function converted length should be in range [0, 4096] bytes"); } // add database precision as param diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 9d40b15354..9534b2c7b3 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -80,7 +80,7 @@ typedef struct STopBotRes { } STopBotRes; typedef struct SFirstLastRes { - bool hasResult; + bool hasResult; // used for last_row function only, isNullRes in SResultRowEntry can not be passed to downstream.So, // this attribute is required bool isNull; @@ -2380,7 +2380,8 @@ int32_t percentileFunction(SqlFunctionCtx* pCtx) { int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SVariant* pVal = &pCtx->param[1].param; - double v = (pVal->nType == TSDB_DATA_TYPE_BIGINT) ? pVal->i : pVal->d; + double v = + (IS_SIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->i : (IS_UNSIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->u : pVal->d)); SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SPercentileInfo* ppInfo = (SPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo); @@ -2439,7 +2440,8 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); SVariant* pVal = &pCtx->param[1].param; - pInfo->percent = (pVal->nType == TSDB_DATA_TYPE_BIGINT) ? pVal->i : pVal->d; + pInfo->percent = + (IS_SIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->i : (IS_UNSIGNED_NUMERIC_TYPE(pVal->nType) ? pVal->u : pVal->d)); if (pCtx->numOfParams == 2) { pInfo->algo = APERCT_ALGO_DEFAULT; @@ -2640,9 +2642,7 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) return TSDB_CODE_SUCCESS; } -int32_t getFirstLastInfoSize(int32_t resBytes) { - return sizeof(SFirstLastRes) + resBytes; -} +int32_t getFirstLastInfoSize(int32_t resBytes) { return sizeof(SFirstLastRes) + resBytes; } bool getFirstLastFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { SColumnNode* pNode = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0); @@ -2968,7 +2968,7 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { return 1; } -//todo rewrite: +// todo rewrite: int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); char* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); @@ -2986,7 +2986,7 @@ int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { return TSDB_CODE_SUCCESS; } -static void doSaveLastrow(SqlFunctionCtx *pCtx, char* pData, int32_t rowIndex, int64_t cts, SFirstLastRes* pInfo) { +static void doSaveLastrow(SqlFunctionCtx* pCtx, char* pData, int32_t rowIndex, int64_t cts, SFirstLastRes* pInfo) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pInputCol = pInput->pData[0]; @@ -5098,12 +5098,7 @@ bool modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { return true; } -static void doModeAdd(SModeInfo* pInfo, char* data, bool isNull) { - // ignore null elements - if (isNull) { - return; - } - +static void doModeAdd(SModeInfo* pInfo, char* data) { int32_t hashKeyBytes = IS_VAR_DATA_TYPE(pInfo->colType) ? varDataTLen(data) : pInfo->colBytes; SModeItem** pHashItem = taosHashGet(pInfo->pHash, data, hashKeyBytes); if (pHashItem == NULL) { @@ -5128,10 +5123,16 @@ int32_t modeFunction(SqlFunctionCtx* pCtx) { SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; + int32_t numOfElems = 0; int32_t startOffset = pCtx->offset; for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { char* data = colDataGetData(pInputCol, i); - doModeAdd(pInfo, data, colDataIsNull_s(pInputCol, i)); + if (colDataIsNull_s(pInputCol, i)) { + continue; + } + + numOfElems++; + doModeAdd(pInfo, data); if (sizeof(SModeInfo) + pInfo->numOfPoints * (sizeof(SModeItem) + pInfo->colBytes) >= MODE_MAX_RESULT_SIZE) { taosHashCleanup(pInfo->pHash); @@ -5139,7 +5140,7 @@ int32_t modeFunction(SqlFunctionCtx* pCtx) { } } - SET_VAL(pResInfo, 1, 1); + SET_VAL(pResInfo, numOfElems, 1); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index fda02cd9ca..e3c50de654 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -159,6 +159,8 @@ const char* nodesNodeName(ENodeType type) { return "ShowStreamsStmt"; case QUERY_NODE_SHOW_TABLES_STMT: return "ShowTablesStmt"; + case QUERY_NODE_SHOW_TAGS_STMT: + return "ShowTagsStmt"; case QUERY_NODE_SHOW_USERS_STMT: return "ShowUsersStmt"; case QUERY_NODE_SHOW_LICENCE_STMT: @@ -4295,6 +4297,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { return alterDnodeStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_DATABASES_STMT: case QUERY_NODE_SHOW_TABLES_STMT: + case QUERY_NODE_SHOW_TAGS_STMT: break; case QUERY_NODE_CREATE_TOPIC_STMT: return createTopicStmtToJson(pObj, pJson); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 1dc3db033b..38f22f9696 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -216,6 +216,7 @@ SNode* nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT: case QUERY_NODE_SHOW_TRANSACTIONS_STMT: case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT: + case QUERY_NODE_SHOW_TAGS_STMT: return makeNode(type, sizeof(SShowStmt)); case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: return makeNode(type, sizeof(SShowDnodeVariablesStmt)); @@ -678,7 +679,8 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_VARIABLES_STMT: case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT: case QUERY_NODE_SHOW_TRANSACTIONS_STMT: - case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT: { + case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT: + case QUERY_NODE_SHOW_TAGS_STMT: { SShowStmt* pStmt = (SShowStmt*)pNode; nodesDestroyNode(pStmt->pDbName); nodesDestroyNode(pStmt->pTbName); @@ -1923,15 +1925,18 @@ int32_t nodesPartitionCond(SNode** pCondition, SNode** pPrimaryKeyCond, SNode** return partitionLogicCond(pCondition, pPrimaryKeyCond, pTagIndexCond, pTagCond, pOtherCond); } + bool needOutput = false; switch (classifyCondition(*pCondition)) { case COND_TYPE_PRIMARY_KEY: if (NULL != pPrimaryKeyCond) { *pPrimaryKeyCond = *pCondition; + needOutput = true; } break; case COND_TYPE_TAG_INDEX: if (NULL != pTagIndexCond) { *pTagIndexCond = *pCondition; + needOutput = true; } if (NULL != pTagCond) { SNode* pTempCond = *pCondition; @@ -1942,21 +1947,26 @@ int32_t nodesPartitionCond(SNode** pCondition, SNode** pPrimaryKeyCond, SNode** } } *pTagCond = pTempCond; + needOutput = true; } break; case COND_TYPE_TAG: if (NULL != pTagCond) { *pTagCond = *pCondition; + needOutput = true; } break; case COND_TYPE_NORMAL: default: if (NULL != pOtherCond) { *pOtherCond = *pCondition; + needOutput = true; } break; } - *pCondition = NULL; + if (needOutput) { + *pCondition = NULL; + } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 9cab419c2e..1236918f9f 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -82,7 +82,6 @@ alter_account_option ::= STATE literal. /************************************************ create/alter/drop user **********************************************/ cmd ::= CREATE USER user_name(A) PASS NK_STRING(B) sysinfo_opt(C). { pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B, C); } cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B); } -//cmd ::= ALTER USER user_name(A) PRIVILEGE NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PRIVILEGES, &B); } cmd ::= ALTER USER user_name(A) ENABLE NK_INTEGER(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_ENABLE, &B); } cmd ::= ALTER USER user_name(A) SYSINFO NK_INTEGER(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_SYSINFO, &B); } cmd ::= DROP USER user_name(A). { pCxt->pRootNode = createDropUserStmt(pCxt, &A); } @@ -198,15 +197,15 @@ alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). %type alter_db_option { SAlterOption } %destructor alter_db_option { } -alter_db_option(A) ::= BUFFER NK_INTEGER(B). { A.type = DB_OPTION_BUFFER; A.val = B; } +//alter_db_option(A) ::= BUFFER NK_INTEGER(B). { A.type = DB_OPTION_BUFFER; A.val = B; } alter_db_option(A) ::= CACHEMODEL NK_STRING(B). { A.type = DB_OPTION_CACHEMODEL; A.val = B; } alter_db_option(A) ::= CACHESIZE NK_INTEGER(B). { A.type = DB_OPTION_CACHESIZE; A.val = B; } alter_db_option(A) ::= FSYNC NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; } alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } -alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; } -alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } -alter_db_option(A) ::= STRICT NK_INTEGER(B). { A.type = DB_OPTION_STRICT; A.val = B; } +//alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; } +//alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } +//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; } alter_db_option(A) ::= WAL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } %type integer_list { SNodeList* } @@ -394,6 +393,7 @@ cmd ::= SHOW TRANSACTIONS. cmd ::= SHOW TABLE DISTRIBUTED full_table_name(A). { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, A); } cmd ::= SHOW CONSUMERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } cmd ::= SHOW SUBSCRIPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } +cmd ::= SHOW TAGS FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, B, A, OP_TYPE_EQUAL); } db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); } db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); } @@ -525,7 +525,7 @@ cmd ::= INSERT INTO full_table_name(A) cmd ::= INSERT INTO full_table_name(A) query_expression(B). { pCxt->pRootNode = createInsertStmt(pCxt, A, NULL, B); } /************************************************ literal *************************************************************/ -literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); } +literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); } literal(A) ::= NK_FLOAT(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B)); } literal(A) ::= NK_STRING(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)); } literal(A) ::= NK_BOOL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B)); } @@ -536,8 +536,8 @@ literal(A) ::= NK_QUESTION(B). duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); } -signed(A) ::= NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } -signed(A) ::= NK_PLUS NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +signed(A) ::= NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B); } +signed(A) ::= NK_PLUS NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B); } signed(A) ::= NK_MINUS(B) NK_INTEGER(C). { SToken t = B; t.n = (C.z + C.n) - B.z; diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 0a04ff3e30..895a51fdbe 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -393,9 +393,16 @@ SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pL SValueNode* pVal = (SValueNode*)pLeft; char* pNewLiteral = taosMemoryCalloc(1, strlen(pVal->literal) + 2); CHECK_OUT_OF_MEM(pNewLiteral); - sprintf(pNewLiteral, "-%s", pVal->literal); + if ('+' == pVal->literal[0]) { + sprintf(pNewLiteral, "-%s", pVal->literal + 1); + } else if ('-' == pVal->literal[0]) { + sprintf(pNewLiteral, "%s", pVal->literal + 1); + } else { + sprintf(pNewLiteral, "-%s", pVal->literal); + } taosMemoryFree(pVal->literal); pVal->literal = pNewLiteral; + pVal->node.resType.type = TSDB_DATA_TYPE_BIGINT; return pLeft; } SOperatorNode* op = (SOperatorNode*)nodesMakeNode(QUERY_NODE_OPERATOR); @@ -1343,7 +1350,11 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const CHECK_PARSER_STATUS(pCxt); SAlterDnodeStmt* pStmt = (SAlterDnodeStmt*)nodesMakeNode(QUERY_NODE_ALTER_DNODE_STMT); CHECK_OUT_OF_MEM(pStmt); - pStmt->dnodeId = taosStr2Int32(pDnode->z, NULL, 10); + if (NULL != pDnode) { + pStmt->dnodeId = taosStr2Int32(pDnode->z, NULL, 10); + } else { + pStmt->dnodeId = -1; + } trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config)); if (NULL != pValue) { trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value)); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index fd518f89af..a93091707a 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -372,8 +372,8 @@ static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt* } static int32_t collectMetaKeyFromShowTags(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { - int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, - TSDB_INS_TABLE_USER_TAGS, pCxt->pMetaCache); + int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_TAGS, + pCxt->pMetaCache); if (TSDB_CODE_SUCCESS == code) { if (NULL != pStmt->pDbName) { code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, ((SValueNode*)pStmt->pDbName)->literal, pCxt->pMetaCache); diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index a6862598ee..c6b608ddb4 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -2385,7 +2385,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols if (format) { if (j < rowDataSize) { kv = taosArrayGetP(rowData, j); - if (rowDataSize != spd->numOfBound && + if (rowDataSize != spd->numOfBound && j != 0 && (kv->keyLen != strlen(pColSchema->name) || strncmp(kv->key, pColSchema->name, kv->keyLen) != 0)) { kv = NULL; } else { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index bac073c631..026328be24 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -826,7 +826,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, } case TSDB_DATA_TYPE_UTINYINT: { code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); - if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UTINYINT(pVal->datum.i))) { + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UTINYINT(pVal->datum.u))) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } *(uint8_t*)&pVal->typeData = pVal->datum.u; @@ -834,7 +834,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, } case TSDB_DATA_TYPE_USMALLINT: { code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); - if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_USMALLINT(pVal->datum.i))) { + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_USMALLINT(pVal->datum.u))) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } *(uint16_t*)&pVal->typeData = pVal->datum.u; @@ -842,7 +842,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, } case TSDB_DATA_TYPE_UINT: { code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); - if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UINT(pVal->datum.i))) { + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UINT(pVal->datum.u))) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } *(uint32_t*)&pVal->typeData = pVal->datum.u; @@ -850,7 +850,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, } case TSDB_DATA_TYPE_UBIGINT: { code = toUInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.u); - if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UBIGINT(pVal->datum.i))) { + if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_UBIGINT(pVal->datum.u))) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } *(uint64_t*)&pVal->typeData = pVal->datum.u; @@ -858,11 +858,18 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, } case TSDB_DATA_TYPE_FLOAT: { pVal->datum.d = taosStr2Double(pVal->literal, NULL); + if (strict && !IS_VALID_FLOAT(pVal->datum.d)) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } *(float*)&pVal->typeData = pVal->datum.d; break; } case TSDB_DATA_TYPE_DOUBLE: { pVal->datum.d = taosStr2Double(pVal->literal, NULL); + if (strict && (((pVal->datum.d == HUGE_VAL || pVal->datum.d == -HUGE_VAL) && errno == ERANGE) || + isinf(pVal->datum.d) || isnan(pVal->datum.d))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } *(double*)&pVal->typeData = pVal->datum.d; break; } @@ -936,6 +943,9 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD pVal->node.resType = targetDt; pVal->node.resType.scale = pVal->unit; pVal->translate = true; + if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) { + pVal->node.resType.type = TSDB_DATA_TYPE_BIGINT; + } return res; } @@ -2955,14 +2965,25 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq); } -static int32_t checkRangeOption(STranslateContext* pCxt, const char* pName, int32_t val, int32_t minVal, +static int32_t checkRangeOption(STranslateContext* pCxt, int32_t code, const char* pName, int32_t val, int32_t minVal, int32_t maxVal) { if (val >= 0 && (val < minVal || val > maxVal)) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_RANGE_OPTION, pName, val, minVal, maxVal); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, code, "Invalid option %s: %" PRId64 " valid range: [%d, %d]", pName, + val, minVal, maxVal); } return TSDB_CODE_SUCCESS; } +static int32_t checkDbRangeOption(STranslateContext* pCxt, const char* pName, int32_t val, int32_t minVal, + int32_t maxVal) { + return checkRangeOption(pCxt, TSDB_CODE_PAR_INVALID_DB_OPTION, pName, val, minVal, maxVal); +} + +static int32_t checkTableRangeOption(STranslateContext* pCxt, const char* pName, int32_t val, int32_t minVal, + int32_t maxVal) { + return checkRangeOption(pCxt, TSDB_CODE_PAR_INVALID_TABLE_OPTION, pName, val, minVal, maxVal); +} + static int32_t checkDbDaysOption(STranslateContext* pCxt, SDatabaseOptions* pOptions) { if (NULL != pOptions->pDaysPerFile) { if (DEAL_RES_ERROR == translateValue(pCxt, pOptions->pDaysPerFile)) { @@ -2970,12 +2991,13 @@ static int32_t checkDbDaysOption(STranslateContext* pCxt, SDatabaseOptions* pOpt } if (TIME_UNIT_MINUTE != pOptions->pDaysPerFile->unit && TIME_UNIT_HOUR != pOptions->pDaysPerFile->unit && TIME_UNIT_DAY != pOptions->pDaysPerFile->unit) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_OPTION_UNIT, "daysPerFile", - pOptions->pDaysPerFile->unit, TIME_UNIT_MINUTE, TIME_UNIT_HOUR, TIME_UNIT_DAY); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid option duration unit: %c, only %c, %c, %c allowed", + pOptions->pDaysPerFile->unit, TIME_UNIT_MINUTE, TIME_UNIT_HOUR, TIME_UNIT_DAY); } pOptions->daysPerFile = getBigintFromValueNode(pOptions->pDaysPerFile); } - return checkRangeOption(pCxt, "daysPerFile", pOptions->daysPerFile, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); + return checkDbRangeOption(pCxt, "daysPerFile", pOptions->daysPerFile, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); } static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOptions) { @@ -2985,7 +3007,7 @@ static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOpt int32_t numOfKeep = LIST_LENGTH(pOptions->pKeep); if (numOfKeep > 3 || numOfKeep < 1) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_KEEP_NUM); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid number of keep options"); } SNode* pNode = NULL; @@ -2996,7 +3018,8 @@ static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOpt } if (pVal->isDuration && TIME_UNIT_MINUTE != pVal->unit && TIME_UNIT_HOUR != pVal->unit && TIME_UNIT_DAY != pVal->unit) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_KEEP_UNIT, pVal->unit); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid option keep unit: %c, only m, h, d allowed", pVal->unit); } if (!pVal->isDuration) { pVal->datum.i = pVal->datum.i * 1440; @@ -3018,12 +3041,15 @@ static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOpt if (pOptions->keep[0] < TSDB_MIN_KEEP || pOptions->keep[1] < TSDB_MIN_KEEP || pOptions->keep[2] < TSDB_MIN_KEEP || pOptions->keep[0] > TSDB_MAX_KEEP || pOptions->keep[1] > TSDB_MAX_KEEP || pOptions->keep[2] > TSDB_MAX_KEEP) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_KEEP_VALUE, pOptions->keep[0], pOptions->keep[1], - pOptions->keep[2], TSDB_MIN_KEEP, TSDB_MAX_KEEP); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid option keep: %" PRId64 ", %" PRId64 ", %" PRId64 " valid range: [%dm, %dm]", + pOptions->keep[0], pOptions->keep[1], pOptions->keep[2], TSDB_MIN_KEEP, + TSDB_MAX_KEEP); } if (!((pOptions->keep[0] <= pOptions->keep[1]) && (pOptions->keep[1] <= pOptions->keep[2]))) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_KEEP_ORDER); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid keep value, should be keep0 <= keep1 <= keep2"); } return TSDB_CODE_SUCCESS; @@ -3040,8 +3066,8 @@ static int32_t checkDbCacheModelOption(STranslateContext* pCxt, SDatabaseOptions } else if (0 == strcasecmp(pOptions->cacheModelStr, TSDB_CACHE_MODEL_BOTH_STR)) { pOptions->cacheModel = TSDB_CACHE_MODEL_BOTH; } else { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STR_OPTION, "cacheModel", - pOptions->cacheModelStr); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option cacheModel: %s", + pOptions->cacheModelStr); } } return TSDB_CODE_SUCCESS; @@ -3056,7 +3082,8 @@ static int32_t checkDbPrecisionOption(STranslateContext* pCxt, SDatabaseOptions* } else if (0 == strcasecmp(pOptions->precisionStr, TSDB_TIME_PRECISION_NANO_STR)) { pOptions->precision = TSDB_TIME_PRECISION_NANO; } else { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STR_OPTION, "precision", pOptions->precisionStr); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option precision: %s", + pOptions->precisionStr); } } return TSDB_CODE_SUCCESS; @@ -3069,7 +3096,8 @@ static int32_t checkDbStrictOption(STranslateContext* pCxt, SDatabaseOptions* pO } else if (0 == strcasecmp(pOptions->strictStr, TSDB_DB_STRICT_ON_STR)) { pOptions->strict = TSDB_DB_STRICT_ON; } else { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STR_OPTION, "strict", pOptions->strictStr); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option strict: %s", + pOptions->strictStr); } } return TSDB_CODE_SUCCESS; @@ -3077,7 +3105,8 @@ static int32_t checkDbStrictOption(STranslateContext* pCxt, SDatabaseOptions* pO static int32_t checkDbEnumOption(STranslateContext* pCxt, const char* pName, int32_t val, int32_t v1, int32_t v2) { if (val >= 0 && val != v1 && val != v2) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ENUM_OPTION, pName, val, v1, v2); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid option %s: %" PRId64 ", only %d, %d allowed", pName, val, v1, v2); } return TSDB_CODE_SUCCESS; } @@ -3088,7 +3117,7 @@ static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRete } if (LIST_LENGTH(pRetentions) > 3) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option retentions"); } SValueNode* pPrevFreq = NULL; @@ -3108,7 +3137,7 @@ static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRete if (pFreq->datum.i <= 0 || 'n' == pFreq->unit || 'y' == pFreq->unit || pFreq->datum.i >= pKeep->datum.i || (NULL != pPrevFreq && pPrevFreq->datum.i >= pFreq->datum.i) || (NULL != pPrevKeep && pPrevKeep->datum.i > pKeep->datum.i)) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option retentions"); } pPrevFreq = pFreq; pPrevKeep = pKeep; @@ -3139,39 +3168,41 @@ static int32_t checkOptionsDependency(STranslateContext* pCxt, const char* pDbNa static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName, SDatabaseOptions* pOptions) { int32_t code = - checkRangeOption(pCxt, "buffer", pOptions->buffer, TSDB_MIN_BUFFER_PER_VNODE, TSDB_MAX_BUFFER_PER_VNODE); + checkDbRangeOption(pCxt, "buffer", pOptions->buffer, TSDB_MIN_BUFFER_PER_VNODE, TSDB_MAX_BUFFER_PER_VNODE); if (TSDB_CODE_SUCCESS == code) { code = checkDbCacheModelOption(pCxt, pOptions); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "cacheSize", pOptions->cacheLastSize, TSDB_MIN_DB_CACHE_SIZE, TSDB_MAX_DB_CACHE_SIZE); + code = + checkDbRangeOption(pCxt, "cacheSize", pOptions->cacheLastSize, TSDB_MIN_DB_CACHE_SIZE, TSDB_MAX_DB_CACHE_SIZE); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "compression", pOptions->compressionLevel, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); + code = + checkDbRangeOption(pCxt, "compression", pOptions->compressionLevel, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); } if (TSDB_CODE_SUCCESS == code) { code = checkDbDaysOption(pCxt, pOptions); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "fsyncPeriod", pOptions->fsyncPeriod, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); + code = checkDbRangeOption(pCxt, "fsyncPeriod", pOptions->fsyncPeriod, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "maxRowsPerBlock", pOptions->maxRowsPerBlock, TSDB_MIN_MAXROWS_FBLOCK, - TSDB_MAX_MAXROWS_FBLOCK); + code = checkDbRangeOption(pCxt, "maxRowsPerBlock", pOptions->maxRowsPerBlock, TSDB_MIN_MAXROWS_FBLOCK, + TSDB_MAX_MAXROWS_FBLOCK); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "minRowsPerBlock", pOptions->minRowsPerBlock, TSDB_MIN_MINROWS_FBLOCK, - TSDB_MAX_MINROWS_FBLOCK); + code = checkDbRangeOption(pCxt, "minRowsPerBlock", pOptions->minRowsPerBlock, TSDB_MIN_MINROWS_FBLOCK, + TSDB_MAX_MINROWS_FBLOCK); } if (TSDB_CODE_SUCCESS == code) { code = checkDbKeepOption(pCxt, pOptions); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "pages", pOptions->pages, TSDB_MIN_PAGES_PER_VNODE, TSDB_MAX_PAGES_PER_VNODE); + code = checkDbRangeOption(pCxt, "pages", pOptions->pages, TSDB_MIN_PAGES_PER_VNODE, TSDB_MAX_PAGES_PER_VNODE); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "pagesize", pOptions->pagesize, TSDB_MIN_PAGESIZE_PER_VNODE, - TSDB_MAX_PAGESIZE_PER_VNODE); + code = checkDbRangeOption(pCxt, "pagesize", pOptions->pagesize, TSDB_MIN_PAGESIZE_PER_VNODE, + TSDB_MAX_PAGESIZE_PER_VNODE); } if (TSDB_CODE_SUCCESS == code) { code = checkDbPrecisionOption(pCxt, pOptions); @@ -3186,7 +3217,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName code = checkDbEnumOption(pCxt, "walLevel", pOptions->walLevel, TSDB_MIN_WAL_LEVEL, TSDB_MAX_WAL_LEVEL); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "vgroups", pOptions->numOfVgroups, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); + code = checkDbRangeOption(pCxt, "vgroups", pOptions->numOfVgroups, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); } if (TSDB_CODE_SUCCESS == code) { code = checkDbEnumOption(pCxt, "singleStable", pOptions->singleStable, TSDB_DB_SINGLE_STABLE_ON, @@ -3257,7 +3288,6 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, pReq->buffer = pStmt->pOptions->buffer; pReq->pageSize = -1; pReq->pages = pStmt->pOptions->pages; - pReq->cacheLastSize = -1; pReq->daysPerFile = -1; pReq->daysToKeep0 = pStmt->pOptions->keep[0]; pReq->daysToKeep1 = pStmt->pOptions->keep[1]; @@ -3361,12 +3391,12 @@ static int32_t checkTableRollupOption(STranslateContext* pCxt, SNodeList* pFuncs "configured with the 'RETENTIONS' option"); } if (1 != LIST_LENGTH(pFuncs)) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROLLUP_OPTION, + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "Invalid option rollup: only one function is allowed"); } const char* pFunc = ((SFunctionNode*)nodesListGetNode(pFuncs, 0))->functionName; if (!validRollupFunc(pFunc)) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROLLUP_OPTION, + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "Invalid option rollup: %s function is not supported", pFunc); } return TSDB_CODE_SUCCESS; @@ -3487,11 +3517,12 @@ static int32_t getTableDelayOrWatermarkOption(STranslateContext* pCxt, const cha int32_t code = (DEAL_RES_ERROR == translateValue(pCxt, pVal) ? pCxt->errCode : TSDB_CODE_SUCCESS); if (TSDB_CODE_SUCCESS == code && TIME_UNIT_MILLISECOND != pVal->unit && TIME_UNIT_SECOND != pVal->unit && TIME_UNIT_MINUTE != pVal->unit) { - code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_OPTION_UNIT, pName, pVal->unit, - TIME_UNIT_MILLISECOND, TIME_UNIT_SECOND, TIME_UNIT_MINUTE); + code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, + "Invalid option %s unit: %c, only %c, %c, %c allowed", pName, pVal->unit, + TIME_UNIT_MILLISECOND, TIME_UNIT_SECOND, TIME_UNIT_MINUTE); } if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, pName, pVal->datum.i, minVal, maxVal); + code = checkTableRangeOption(pCxt, pName, pVal->datum.i, minVal, maxVal); } if (TSDB_CODE_SUCCESS == code) { *pMaxDelay = pVal->datum.i; @@ -3517,7 +3548,7 @@ static int32_t checkTableMaxDelayOption(STranslateContext* pCxt, STableOptions* } if (LIST_LENGTH(pOptions->pMaxDelay) > 2) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "maxdelay"); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "Invalid option maxdelay"); } int32_t code = @@ -3547,7 +3578,7 @@ static int32_t checkTableWatermarkOption(STranslateContext* pCxt, STableOptions* } if (LIST_LENGTH(pOptions->pWatermark) > 2) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "watermark"); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TABLE_OPTION, "Invalid option watermark"); } int32_t code = @@ -3604,6 +3635,7 @@ typedef struct SSampleAstInfo { SNode* pInterval; SNode* pOffset; SNode* pSliding; + SNodeList* pPartitionByList; STableMeta* pRollupTableMeta; } SSampleAstInfo; @@ -3636,6 +3668,8 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch SNode* pProject = NULL; FOREACH(pProject, pSelect->pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } + TSWAP(pSelect->pPartitionByList, pInfo->pPartitionByList); + SIntervalWindowNode* pInterval = (SIntervalWindowNode*)nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW); if (NULL == pInterval) { nodesDestroyNode((SNode*)pSelect); @@ -3764,6 +3798,15 @@ static STableMeta* createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precisi return pMeta; } +static SNode* createTbnameFunction() { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return NULL; + } + strcpy(pFunc->functionName, "tbname"); + return (SNode*)pFunc; +} + static int32_t buildSampleAstInfoByTable(STranslateContext* pCxt, SCreateTableStmt* pStmt, SRetention* pRetension, int8_t precision, SSampleAstInfo* pInfo) { pInfo->pDbName = pStmt->dbName; @@ -3774,7 +3817,7 @@ static int32_t buildSampleAstInfoByTable(STranslateContext* pCxt, SCreateTableSt if (NULL == pInfo->pFuncs || NULL == pInfo->pInterval || NULL == pInfo->pRollupTableMeta) { return TSDB_CODE_OUT_OF_MEMORY; } - return TSDB_CODE_SUCCESS; + return nodesListMakeStrictAppend(&pInfo->pPartitionByList, createTbnameFunction()); } static int32_t getRollupAst(STranslateContext* pCxt, SCreateTableStmt* pStmt, SRetention* pRetension, int8_t precision, @@ -5043,6 +5086,7 @@ static const char* getSysDbName(ENodeType type) { case QUERY_NODE_SHOW_CLUSTER_STMT: case QUERY_NODE_SHOW_VARIABLES_STMT: case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: + case QUERY_NODE_SHOW_TAGS_STMT: return TSDB_INFORMATION_SCHEMA_DB; case QUERY_NODE_SHOW_CONNECTIONS_STMT: case QUERY_NODE_SHOW_QUERIES_STMT: @@ -6346,6 +6390,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_SHOW_APPS_STMT: case QUERY_NODE_SHOW_CONSUMERS_STMT: case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT: + case QUERY_NODE_SHOW_TAGS_STMT: code = rewriteShow(pCxt, pQuery); break; case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 51f59c9362..8eed02bbbe 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -67,32 +67,8 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "Invalid identifier name: %s"; case TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR: return "Corresponding super table not in this db"; - case TSDB_CODE_PAR_INVALID_RANGE_OPTION: - return "Invalid option %s: %" PRId64 " valid range: [%d, %d]"; - case TSDB_CODE_PAR_INVALID_STR_OPTION: - return "Invalid option %s: %s"; - case TSDB_CODE_PAR_INVALID_ENUM_OPTION: - return "Invalid option %s: %" PRId64 ", only %d, %d allowed"; - case TSDB_CODE_PAR_INVALID_KEEP_NUM: - return "Invalid number of keep options"; - case TSDB_CODE_PAR_INVALID_KEEP_ORDER: - return "Invalid keep value, should be keep0 <= keep1 <= keep2"; - case TSDB_CODE_PAR_INVALID_KEEP_VALUE: - return "Invalid option keep: %" PRId64 ", %" PRId64 ", %" PRId64 " valid range: [%dm, %dm]"; - case TSDB_CODE_PAR_INVALID_COMMENT_OPTION: - return "Invalid option comment, length cannot exceed %d"; - case TSDB_CODE_PAR_INVALID_F_RANGE_OPTION: - return "Invalid option %s: %f valid range: [%d, %d]"; - case TSDB_CODE_PAR_INVALID_ROLLUP_OPTION: - return "Invalid option rollup: only one function is allowed"; - case TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION: - return "Invalid option retentions"; case TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST: return "GROUP BY and WINDOW-clause can't be used together"; - case TSDB_CODE_PAR_INVALID_OPTION_UNIT: - return "Invalid option %s unit: %c, only %c, %c, %c allowed"; - case TSDB_CODE_PAR_INVALID_KEEP_UNIT: - return "Invalid option keep unit: %c, only m, h, d allowed"; case TSDB_CODE_PAR_AGG_FUNC_NESTING: return "Aggregate functions do not support nesting"; case TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE: @@ -194,8 +170,6 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "%s function is not supported in stream query"; case TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC: return "%s function is not supported in group query"; - case TSDB_CODE_PAR_INVALID_TABLE_OPTION: - return "Invalid option %s"; case TSDB_CODE_PAR_INVALID_INTERP_CLAUSE: return "Invalid usage of RANGE clause, EVERY clause or FILL clause"; case TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN: @@ -389,7 +363,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi continue; } STagVal val = {0}; -// strcpy(val.colName, colName); + // strcpy(val.colName, colName); val.pKey = jsonKey; taosHashPut(keyHash, jsonKey, keyLen, &keyLen, CHAR_BYTES); // add key to hash to remove dumplicate, value is useless diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 57a243257b..3a3e07acb0 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -140,16 +140,16 @@ typedef union { #define ParseCTX_STORE #define YYFALLBACK 1 #define YYNSTATE 669 -#define YYNRULE 491 +#define YYNRULE 488 #define YYNTOKEN 256 #define YY_MAX_SHIFT 668 -#define YY_MIN_SHIFTREDUCE 974 -#define YY_MAX_SHIFTREDUCE 1464 -#define YY_ERROR_ACTION 1465 -#define YY_ACCEPT_ACTION 1466 -#define YY_NO_ACTION 1467 -#define YY_MIN_REDUCE 1468 -#define YY_MAX_REDUCE 1958 +#define YY_MIN_SHIFTREDUCE 970 +#define YY_MAX_SHIFTREDUCE 1457 +#define YY_ERROR_ACTION 1458 +#define YY_ACCEPT_ACTION 1459 +#define YY_NO_ACTION 1460 +#define YY_MIN_REDUCE 1461 +#define YY_MAX_REDUCE 1948 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,263 +216,257 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2547) +#define YY_ACTTAB_COUNT (2481) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 532, 73, 1466, 436, 555, 437, 1503, 327, 520, 73, - /* 10 */ 1658, 115, 39, 37, 119, 142, 326, 312, 474, 1703, - /* 20 */ 340, 1469, 1264, 1601, 1608, 145, 1656, 555, 1606, 1562, - /* 30 */ 1810, 1602, 124, 1341, 444, 1262, 437, 1503, 548, 558, - /* 40 */ 345, 389, 105, 1651, 1653, 104, 103, 102, 101, 100, - /* 50 */ 99, 98, 97, 96, 81, 124, 1336, 1491, 1792, 33, - /* 60 */ 32, 14, 353, 40, 38, 36, 35, 34, 1270, 39, - /* 70 */ 37, 1404, 122, 558, 558, 1599, 547, 340, 303, 1264, - /* 80 */ 1936, 1290, 144, 1936, 1480, 1, 1810, 158, 1878, 1879, - /* 90 */ 1341, 1883, 1262, 162, 584, 122, 1935, 1933, 1761, 1761, - /* 100 */ 1933, 583, 435, 1936, 64, 439, 1289, 665, 532, 557, - /* 110 */ 157, 1878, 1879, 1336, 1883, 560, 161, 1290, 14, 55, - /* 120 */ 1933, 1343, 1344, 30, 261, 1270, 1824, 131, 155, 221, - /* 130 */ 91, 1793, 586, 1795, 1796, 582, 1606, 577, 43, 42, - /* 140 */ 1870, 1645, 2, 105, 306, 1866, 104, 103, 102, 101, - /* 150 */ 100, 99, 98, 97, 96, 343, 1936, 40, 38, 36, - /* 160 */ 35, 34, 1080, 142, 665, 63, 1265, 195, 1263, 163, - /* 170 */ 54, 63, 1608, 1933, 383, 519, 351, 443, 1343, 1344, - /* 180 */ 439, 148, 1160, 1161, 1401, 63, 470, 466, 462, 458, - /* 190 */ 194, 1243, 1244, 1268, 1269, 1082, 1318, 1319, 1321, 1322, - /* 200 */ 1323, 1324, 1325, 1326, 579, 575, 1334, 1335, 1337, 1338, - /* 210 */ 1339, 1340, 1342, 1345, 1936, 1936, 1936, 1936, 74, 1652, - /* 220 */ 1653, 192, 1024, 1265, 1023, 1263, 164, 162, 161, 161, - /* 230 */ 161, 1933, 1933, 1933, 1933, 33, 32, 350, 63, 40, - /* 240 */ 38, 36, 35, 34, 1490, 382, 171, 381, 555, 564, - /* 250 */ 1268, 1269, 1025, 1318, 1319, 1321, 1322, 1323, 1324, 1325, - /* 260 */ 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, - /* 270 */ 1345, 39, 37, 1468, 71, 1289, 124, 70, 1936, 340, - /* 280 */ 164, 1264, 1792, 191, 184, 1761, 189, 1584, 307, 49, - /* 290 */ 449, 161, 1341, 453, 1262, 1933, 532, 114, 113, 112, - /* 300 */ 111, 110, 109, 108, 107, 106, 164, 115, 1289, 182, - /* 310 */ 1810, 1489, 164, 1303, 479, 1336, 122, 1936, 559, 505, - /* 320 */ 14, 1363, 1488, 1761, 1606, 583, 164, 1270, 39, 37, - /* 330 */ 1934, 159, 1878, 1879, 1933, 1883, 340, 532, 1264, 1530, - /* 340 */ 317, 485, 484, 1425, 2, 478, 1658, 453, 166, 1341, - /* 350 */ 1824, 1262, 1761, 328, 92, 1793, 586, 1795, 1796, 582, - /* 360 */ 1936, 577, 1656, 1761, 1870, 1606, 665, 477, 331, 1866, - /* 370 */ 156, 1582, 1336, 161, 549, 1364, 1658, 1933, 1291, 164, - /* 380 */ 1343, 1344, 160, 344, 1270, 541, 1423, 1424, 1426, 1427, - /* 390 */ 1896, 318, 1656, 316, 315, 1702, 476, 300, 1369, 1706, - /* 400 */ 478, 8, 642, 641, 640, 639, 348, 1400, 638, 637, + /* 0 */ 532, 73, 1459, 440, 555, 441, 1496, 329, 520, 73, + /* 10 */ 1647, 114, 39, 37, 119, 143, 328, 314, 478, 1693, + /* 20 */ 342, 1462, 1257, 1590, 1597, 147, 1645, 555, 1595, 1555, + /* 30 */ 1800, 1591, 124, 1334, 448, 1255, 441, 1496, 548, 558, + /* 40 */ 347, 391, 104, 1640, 1642, 103, 102, 101, 100, 99, + /* 50 */ 98, 97, 96, 95, 439, 124, 1329, 443, 1782, 33, + /* 60 */ 32, 14, 355, 40, 38, 36, 35, 34, 1263, 39, + /* 70 */ 37, 1397, 122, 1283, 1282, 564, 547, 342, 305, 1257, + /* 80 */ 1926, 426, 145, 1926, 1473, 1, 1800, 159, 1868, 1869, + /* 90 */ 1334, 1873, 1255, 163, 584, 122, 1925, 1923, 558, 1751, + /* 100 */ 1923, 583, 64, 1926, 42, 63, 1020, 665, 1019, 557, + /* 110 */ 158, 1868, 1869, 1329, 1873, 560, 162, 81, 14, 1003, + /* 120 */ 1923, 1336, 1337, 30, 263, 1263, 1814, 177, 176, 223, + /* 130 */ 91, 1783, 586, 1785, 1786, 582, 1021, 577, 1588, 63, + /* 140 */ 1860, 1484, 2, 104, 308, 1856, 103, 102, 101, 100, + /* 150 */ 99, 98, 97, 96, 95, 1526, 1926, 489, 488, 1007, + /* 160 */ 1008, 143, 487, 43, 665, 120, 1258, 197, 1256, 164, + /* 170 */ 1598, 484, 1358, 1923, 1152, 1153, 385, 447, 1336, 1337, + /* 180 */ 443, 149, 1751, 63, 1641, 1642, 474, 470, 466, 462, + /* 190 */ 196, 1236, 1237, 1261, 1262, 1363, 1311, 1312, 1314, 1315, + /* 200 */ 1316, 1317, 1318, 1319, 579, 575, 1327, 1328, 1330, 1331, + /* 210 */ 1332, 1333, 1335, 1338, 1020, 1647, 1019, 1926, 74, 489, + /* 220 */ 488, 194, 330, 1258, 487, 1256, 165, 120, 558, 476, + /* 230 */ 162, 1645, 63, 484, 1923, 33, 32, 519, 27, 40, + /* 240 */ 38, 36, 35, 34, 1021, 165, 165, 1692, 555, 302, + /* 250 */ 1261, 1262, 376, 1311, 1312, 1314, 1315, 1316, 1317, 1318, + /* 260 */ 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, + /* 270 */ 1338, 39, 37, 1461, 378, 374, 124, 565, 1926, 342, + /* 280 */ 165, 1257, 1782, 193, 186, 1686, 191, 1875, 309, 49, + /* 290 */ 453, 162, 1334, 503, 1255, 1923, 172, 113, 112, 111, + /* 300 */ 110, 109, 108, 107, 106, 105, 501, 1483, 499, 184, + /* 310 */ 1800, 1872, 384, 1296, 383, 1329, 122, 1573, 559, 532, + /* 320 */ 14, 1356, 1482, 1751, 165, 583, 457, 1263, 39, 37, + /* 330 */ 114, 160, 1868, 1869, 532, 1873, 342, 483, 1257, 1523, + /* 340 */ 319, 11, 10, 1418, 2, 55, 445, 1595, 1751, 1334, + /* 350 */ 1814, 1255, 1280, 1394, 92, 1783, 586, 1785, 1786, 582, + /* 360 */ 1737, 577, 1595, 1751, 1860, 1401, 665, 532, 333, 1856, + /* 370 */ 157, 1282, 1329, 165, 1283, 1357, 1647, 457, 167, 1571, + /* 380 */ 1336, 1337, 161, 346, 1263, 541, 1416, 1417, 1419, 1420, + /* 390 */ 1886, 320, 1645, 318, 317, 1595, 480, 1282, 1362, 1481, + /* 400 */ 482, 8, 642, 641, 640, 639, 350, 364, 638, 637, /* 410 */ 636, 125, 631, 630, 629, 628, 627, 626, 625, 624, - /* 420 */ 135, 620, 477, 665, 1024, 1265, 1023, 1263, 33, 32, - /* 430 */ 164, 619, 40, 38, 36, 35, 34, 1343, 1344, 472, - /* 440 */ 1007, 29, 338, 1358, 1359, 1360, 1361, 1362, 1366, 1367, - /* 450 */ 1368, 565, 1268, 1269, 1025, 1318, 1319, 1321, 1322, 1323, - /* 460 */ 1324, 1325, 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, - /* 470 */ 1340, 1342, 1345, 1583, 216, 222, 223, 489, 488, 487, - /* 480 */ 1011, 1012, 1265, 486, 1263, 1320, 120, 483, 635, 633, - /* 490 */ 482, 481, 480, 33, 32, 1533, 1779, 40, 38, 36, - /* 500 */ 35, 34, 209, 63, 619, 77, 1487, 1775, 422, 1268, - /* 510 */ 1269, 253, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, - /* 520 */ 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, - /* 530 */ 39, 37, 1346, 1771, 1777, 329, 305, 441, 340, 522, - /* 540 */ 1264, 1792, 164, 1287, 215, 577, 307, 1761, 1701, 346, - /* 550 */ 300, 1341, 532, 1262, 175, 174, 1509, 142, 489, 488, - /* 560 */ 487, 75, 305, 387, 486, 522, 1608, 120, 483, 1810, - /* 570 */ 617, 482, 481, 480, 1336, 76, 1365, 559, 1461, 1363, - /* 580 */ 1606, 544, 1761, 494, 583, 1658, 1270, 39, 37, 133, - /* 590 */ 132, 614, 613, 612, 532, 340, 532, 1264, 504, 1370, - /* 600 */ 1696, 1657, 567, 9, 660, 388, 503, 392, 1341, 1824, - /* 610 */ 1262, 173, 208, 92, 1793, 586, 1795, 1796, 582, 501, - /* 620 */ 577, 499, 1606, 1870, 1606, 665, 497, 331, 1866, 156, - /* 630 */ 491, 1336, 374, 1364, 1597, 207, 532, 532, 1288, 1343, - /* 640 */ 1344, 1779, 27, 1270, 164, 1775, 88, 407, 408, 1897, - /* 650 */ 1595, 1408, 1775, 1486, 376, 372, 1369, 1289, 1270, 121, - /* 660 */ 9, 550, 545, 58, 1606, 1606, 57, 1598, 1460, 33, - /* 670 */ 32, 1771, 1777, 40, 38, 36, 35, 34, 1771, 1777, - /* 680 */ 335, 520, 665, 577, 1265, 1351, 1263, 36, 35, 34, - /* 690 */ 577, 1289, 1704, 1485, 1761, 611, 1343, 1344, 1581, 29, - /* 700 */ 338, 1358, 1359, 1360, 1361, 1362, 1366, 1367, 1368, 11, - /* 710 */ 10, 1268, 1269, 61, 1318, 1319, 1321, 1322, 1323, 1324, - /* 720 */ 1325, 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, - /* 730 */ 1342, 1345, 33, 32, 1761, 1885, 40, 38, 36, 35, - /* 740 */ 34, 1265, 615, 1263, 623, 1649, 1578, 1435, 1118, 608, - /* 750 */ 607, 606, 1122, 605, 1124, 1125, 604, 1127, 601, 1882, - /* 760 */ 1133, 598, 1135, 1136, 595, 592, 1484, 22, 1268, 1269, - /* 770 */ 1483, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, 579, - /* 780 */ 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 39, - /* 790 */ 37, 302, 1051, 1287, 1377, 617, 142, 340, 532, 1264, - /* 800 */ 415, 1792, 532, 427, 622, 1609, 568, 1761, 532, 452, - /* 810 */ 1341, 1761, 1262, 1603, 133, 132, 614, 613, 612, 1735, - /* 820 */ 400, 532, 428, 1747, 402, 1052, 1606, 532, 532, 1810, - /* 830 */ 1606, 1292, 513, 1336, 1320, 7, 1606, 584, 517, 530, - /* 840 */ 1482, 1479, 1761, 634, 583, 1270, 33, 32, 87, 1606, - /* 850 */ 40, 38, 36, 35, 34, 1606, 1606, 393, 84, 33, - /* 860 */ 32, 532, 2, 40, 38, 36, 35, 34, 1320, 1824, - /* 870 */ 362, 617, 531, 93, 1793, 586, 1795, 1796, 582, 1591, - /* 880 */ 577, 1761, 1761, 1870, 665, 1478, 377, 1869, 1866, 1606, - /* 890 */ 133, 132, 614, 613, 612, 44, 4, 426, 1343, 1344, - /* 900 */ 421, 420, 419, 418, 417, 414, 413, 412, 411, 410, - /* 910 */ 406, 405, 404, 403, 397, 396, 395, 394, 1885, 391, - /* 920 */ 390, 1593, 1477, 26, 1415, 1885, 1761, 143, 1589, 33, - /* 930 */ 32, 1476, 279, 40, 38, 36, 35, 34, 1011, 1012, - /* 940 */ 1273, 532, 1881, 1265, 212, 1263, 277, 60, 28, 1880, - /* 950 */ 59, 512, 262, 562, 33, 32, 1475, 41, 40, 38, - /* 960 */ 36, 35, 34, 1761, 233, 1792, 178, 432, 430, 1606, - /* 970 */ 1268, 1269, 1761, 1318, 1319, 1321, 1322, 1323, 1324, 1325, - /* 980 */ 1326, 579, 575, 1334, 1335, 1337, 1338, 1339, 1340, 1342, - /* 990 */ 1345, 668, 532, 1810, 63, 273, 616, 1761, 1636, 1649, - /* 1000 */ 1211, 584, 578, 347, 141, 268, 1761, 1474, 583, 1473, - /* 1010 */ 33, 32, 1472, 1471, 40, 38, 36, 35, 34, 153, - /* 1020 */ 1606, 1397, 560, 1520, 658, 654, 650, 646, 266, 1272, - /* 1030 */ 1890, 1397, 90, 1824, 53, 516, 1782, 91, 1793, 586, - /* 1040 */ 1795, 1796, 582, 220, 577, 490, 1792, 1870, 1761, 1515, - /* 1050 */ 1761, 306, 1866, 1761, 1761, 200, 89, 1513, 198, 231, - /* 1060 */ 337, 336, 202, 1936, 127, 201, 573, 68, 67, 386, - /* 1070 */ 1278, 492, 170, 1276, 1810, 1784, 161, 610, 380, 495, - /* 1080 */ 1933, 1341, 584, 1271, 130, 1481, 224, 1761, 1303, 583, - /* 1090 */ 1563, 301, 529, 256, 370, 131, 368, 364, 360, 167, - /* 1100 */ 355, 352, 1780, 204, 1336, 206, 203, 525, 205, 51, - /* 1110 */ 41, 237, 542, 1775, 1824, 51, 1270, 41, 92, 1793, - /* 1120 */ 586, 1795, 1796, 582, 218, 577, 590, 230, 1870, 11, - /* 1130 */ 10, 471, 331, 1866, 1949, 164, 1792, 1811, 1111, 1771, - /* 1140 */ 1777, 1463, 1464, 1904, 130, 1235, 131, 211, 116, 506, - /* 1150 */ 130, 577, 1422, 1327, 240, 572, 245, 349, 1371, 1504, - /* 1160 */ 272, 1646, 1275, 1900, 1810, 556, 250, 3, 255, 1139, - /* 1170 */ 258, 5, 584, 260, 354, 1287, 361, 1761, 357, 583, - /* 1180 */ 313, 1080, 1227, 314, 269, 409, 1698, 1143, 424, 1150, - /* 1190 */ 172, 1148, 1792, 134, 416, 423, 425, 429, 1355, 431, - /* 1200 */ 434, 433, 1293, 442, 1824, 1296, 445, 181, 93, 1793, - /* 1210 */ 586, 1795, 1796, 582, 1279, 577, 1274, 446, 1870, 183, - /* 1220 */ 1810, 1295, 571, 1866, 1297, 448, 186, 447, 584, 188, - /* 1230 */ 1294, 450, 451, 1761, 1792, 583, 190, 454, 72, 193, - /* 1240 */ 473, 1282, 1284, 475, 1596, 95, 197, 1592, 199, 136, - /* 1250 */ 137, 1594, 304, 575, 1334, 1335, 1337, 1338, 1339, 1340, - /* 1260 */ 1824, 1590, 1810, 138, 92, 1793, 586, 1795, 1796, 582, - /* 1270 */ 584, 577, 139, 270, 1870, 1761, 210, 583, 331, 1866, - /* 1280 */ 1949, 1740, 507, 540, 511, 526, 213, 1792, 217, 1927, - /* 1290 */ 508, 514, 518, 521, 128, 323, 1739, 1792, 1708, 523, - /* 1300 */ 129, 325, 1824, 226, 527, 528, 92, 1793, 586, 1795, - /* 1310 */ 1796, 582, 228, 577, 271, 1810, 1870, 1607, 1292, 543, - /* 1320 */ 331, 1866, 1949, 584, 80, 1810, 536, 538, 1761, 539, - /* 1330 */ 583, 1889, 1264, 584, 1901, 330, 546, 6, 1761, 534, - /* 1340 */ 583, 235, 244, 239, 552, 1262, 537, 1792, 1397, 1911, - /* 1350 */ 1910, 150, 535, 123, 560, 1824, 1291, 1792, 1892, 280, - /* 1360 */ 1793, 586, 1795, 1796, 582, 1824, 577, 249, 246, 286, - /* 1370 */ 1793, 586, 1795, 1796, 582, 1810, 577, 569, 1270, 332, - /* 1380 */ 1886, 566, 1932, 584, 254, 1810, 563, 257, 1761, 1952, - /* 1390 */ 583, 48, 82, 581, 247, 1936, 1650, 248, 1761, 1579, - /* 1400 */ 583, 274, 265, 1851, 560, 588, 661, 570, 163, 662, - /* 1410 */ 664, 259, 1933, 52, 149, 1824, 278, 665, 1755, 286, - /* 1420 */ 1793, 586, 1795, 1796, 582, 1824, 577, 276, 1754, 294, - /* 1430 */ 1793, 586, 1795, 1796, 582, 580, 577, 574, 1842, 1792, - /* 1440 */ 555, 287, 297, 296, 65, 1936, 1753, 1752, 66, 1751, - /* 1450 */ 356, 1748, 358, 359, 1255, 1256, 168, 363, 161, 1746, - /* 1460 */ 365, 366, 1933, 367, 1745, 369, 1744, 1810, 124, 1743, - /* 1470 */ 371, 1742, 373, 375, 1725, 584, 1265, 169, 1263, 378, - /* 1480 */ 1761, 379, 583, 1230, 1229, 1719, 1718, 384, 385, 560, - /* 1490 */ 1717, 1716, 1691, 1792, 1199, 1690, 1689, 69, 1688, 1687, - /* 1500 */ 1686, 1685, 1684, 1268, 1269, 398, 1683, 1824, 122, 401, - /* 1510 */ 399, 146, 1793, 586, 1795, 1796, 582, 1792, 577, 1682, - /* 1520 */ 1681, 1810, 126, 251, 1878, 554, 1680, 553, 1679, 584, - /* 1530 */ 1936, 1678, 1677, 1676, 1761, 1675, 583, 1674, 1673, 1672, - /* 1540 */ 1671, 1670, 1669, 163, 1668, 1810, 1667, 1933, 1666, 1665, - /* 1550 */ 324, 1664, 1663, 584, 117, 561, 1950, 1662, 1761, 1661, - /* 1560 */ 583, 1824, 1660, 1659, 1535, 93, 1793, 586, 1795, 1796, - /* 1570 */ 582, 1792, 577, 176, 1534, 1870, 1201, 177, 1532, 1500, - /* 1580 */ 1867, 1792, 1014, 1013, 1499, 1824, 154, 179, 1733, 295, - /* 1590 */ 1793, 586, 1795, 1796, 582, 1727, 577, 1715, 180, 1810, - /* 1600 */ 118, 438, 440, 1714, 533, 185, 1700, 584, 1585, 1810, - /* 1610 */ 187, 1531, 1761, 1529, 583, 1044, 455, 584, 456, 457, - /* 1620 */ 1527, 459, 1761, 460, 583, 1525, 461, 1523, 463, 465, - /* 1630 */ 464, 1792, 468, 467, 1512, 469, 1511, 1496, 1587, 1824, - /* 1640 */ 1154, 50, 196, 295, 1793, 586, 1795, 1796, 582, 1824, - /* 1650 */ 577, 1153, 1586, 290, 1793, 586, 1795, 1796, 582, 1810, - /* 1660 */ 577, 1079, 632, 1078, 634, 1077, 1076, 584, 1073, 1071, - /* 1670 */ 1072, 1521, 1761, 319, 583, 1070, 1516, 320, 1514, 321, - /* 1680 */ 496, 1792, 1495, 498, 1494, 500, 1493, 502, 493, 94, - /* 1690 */ 1732, 551, 509, 1792, 1237, 1726, 140, 1713, 1711, 1824, - /* 1700 */ 1712, 1710, 1709, 146, 1793, 586, 1795, 1796, 582, 1810, - /* 1710 */ 577, 1247, 1707, 56, 1699, 41, 227, 581, 510, 84, - /* 1720 */ 214, 1810, 1761, 16, 583, 232, 339, 15, 322, 584, - /* 1730 */ 219, 225, 515, 243, 1761, 1437, 583, 47, 78, 79, - /* 1740 */ 524, 23, 242, 229, 236, 234, 25, 1419, 1951, 1824, - /* 1750 */ 1421, 238, 147, 294, 1793, 586, 1795, 1796, 582, 241, - /* 1760 */ 577, 1824, 1843, 1782, 17, 295, 1793, 586, 1795, 1796, - /* 1770 */ 582, 1792, 577, 24, 252, 1414, 83, 46, 1781, 1394, - /* 1780 */ 1449, 1792, 1393, 151, 18, 1448, 333, 1453, 1452, 10, - /* 1790 */ 1454, 45, 1443, 334, 1280, 1356, 1827, 1311, 19, 1810, - /* 1800 */ 589, 1331, 1329, 13, 341, 576, 31, 584, 1328, 1810, - /* 1810 */ 152, 12, 1761, 165, 583, 20, 21, 584, 585, 587, - /* 1820 */ 342, 1140, 1761, 591, 583, 1137, 593, 594, 596, 1134, - /* 1830 */ 1128, 1792, 597, 599, 600, 602, 1132, 1117, 1131, 1824, - /* 1840 */ 1149, 1792, 1126, 295, 1793, 586, 1795, 1796, 582, 1824, - /* 1850 */ 577, 1792, 263, 281, 1793, 586, 1795, 1796, 582, 1810, - /* 1860 */ 577, 603, 85, 609, 86, 62, 1130, 584, 1129, 1810, - /* 1870 */ 1145, 618, 1761, 1042, 583, 1086, 1067, 584, 621, 1810, - /* 1880 */ 264, 1065, 1761, 1062, 583, 1064, 1063, 584, 1061, 1060, - /* 1890 */ 1059, 1058, 1761, 1083, 583, 1081, 1048, 1055, 1054, 1824, - /* 1900 */ 1053, 1050, 1528, 282, 1793, 586, 1795, 1796, 582, 1824, - /* 1910 */ 577, 1049, 1047, 289, 1793, 586, 1795, 1796, 582, 1824, - /* 1920 */ 577, 643, 644, 291, 1793, 586, 1795, 1796, 582, 645, - /* 1930 */ 577, 1526, 1792, 647, 648, 649, 1524, 1522, 651, 652, - /* 1940 */ 653, 655, 656, 657, 1510, 659, 1004, 1492, 267, 663, - /* 1950 */ 666, 1792, 1266, 667, 275, 1467, 1467, 1467, 1467, 1467, - /* 1960 */ 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, - /* 1970 */ 1467, 1467, 1467, 1761, 1467, 583, 1467, 1467, 1467, 1810, - /* 1980 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, - /* 1990 */ 1467, 1467, 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, - /* 2000 */ 1824, 1467, 1467, 1467, 283, 1793, 586, 1795, 1796, 582, - /* 2010 */ 1467, 577, 1467, 1792, 1467, 1467, 1467, 1467, 1467, 1824, - /* 2020 */ 1467, 1467, 1467, 292, 1793, 586, 1795, 1796, 582, 1792, - /* 2030 */ 577, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2040 */ 1467, 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, - /* 2050 */ 1467, 1467, 1467, 1467, 1761, 1467, 583, 1810, 1467, 1467, - /* 2060 */ 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, - /* 2070 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2080 */ 1467, 1824, 1792, 1467, 1467, 284, 1793, 586, 1795, 1796, - /* 2090 */ 582, 1467, 577, 1467, 1467, 1467, 1467, 1824, 1467, 1792, - /* 2100 */ 1467, 293, 1793, 586, 1795, 1796, 582, 1467, 577, 1467, - /* 2110 */ 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, - /* 2120 */ 1467, 1467, 1467, 1761, 1467, 583, 1467, 1810, 1467, 1467, - /* 2130 */ 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, - /* 2140 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2150 */ 1824, 1467, 1792, 1467, 285, 1793, 586, 1795, 1796, 582, - /* 2160 */ 1467, 577, 1467, 1467, 1792, 1467, 1467, 1824, 1467, 1467, - /* 2170 */ 1467, 298, 1793, 586, 1795, 1796, 582, 1467, 577, 1467, - /* 2180 */ 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, - /* 2190 */ 1467, 1467, 1810, 1761, 1467, 583, 1467, 1467, 1467, 1467, - /* 2200 */ 584, 1467, 1467, 1467, 1467, 1761, 1467, 583, 1467, 1467, - /* 2210 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2220 */ 1824, 1467, 1467, 1467, 299, 1793, 586, 1795, 1796, 582, - /* 2230 */ 1467, 577, 1824, 1792, 1467, 1467, 1804, 1793, 586, 1795, - /* 2240 */ 1796, 582, 1467, 577, 1467, 1467, 1467, 1792, 1467, 1467, - /* 2250 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2260 */ 1467, 1810, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, - /* 2270 */ 1467, 1467, 1467, 1467, 1761, 1810, 583, 1467, 1467, 1467, - /* 2280 */ 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, 1761, 1792, - /* 2290 */ 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2300 */ 1467, 1824, 1467, 1467, 1467, 1803, 1793, 586, 1795, 1796, - /* 2310 */ 582, 1467, 577, 1467, 1467, 1824, 1467, 1810, 1467, 1802, - /* 2320 */ 1793, 586, 1795, 1796, 582, 584, 577, 1467, 1467, 1467, - /* 2330 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2340 */ 1467, 1792, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2350 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1824, 1467, 1792, - /* 2360 */ 1467, 310, 1793, 586, 1795, 1796, 582, 1467, 577, 1810, - /* 2370 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, - /* 2380 */ 1467, 1467, 1761, 1792, 583, 1467, 1467, 1810, 1467, 1467, - /* 2390 */ 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, 1467, - /* 2400 */ 1761, 1467, 583, 1467, 1467, 1467, 1467, 1467, 1467, 1824, - /* 2410 */ 1467, 1810, 1467, 309, 1793, 586, 1795, 1796, 582, 584, - /* 2420 */ 577, 1467, 1467, 1467, 1761, 1467, 583, 1824, 1467, 1467, - /* 2430 */ 1467, 311, 1793, 586, 1795, 1796, 582, 1467, 577, 555, - /* 2440 */ 1792, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2450 */ 1467, 1824, 1467, 1467, 1467, 308, 1793, 586, 1795, 1796, - /* 2460 */ 582, 1467, 577, 1467, 1467, 1467, 1467, 124, 1810, 1467, - /* 2470 */ 1467, 1467, 1467, 1467, 1467, 1467, 584, 1467, 1467, 1467, - /* 2480 */ 1467, 1761, 1467, 583, 1467, 1467, 1467, 1467, 560, 1467, - /* 2490 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2500 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 122, 1824, 1467, - /* 2510 */ 1467, 1467, 288, 1793, 586, 1795, 1796, 582, 1467, 577, - /* 2520 */ 1467, 1467, 251, 1878, 554, 1467, 553, 1467, 1467, 1936, - /* 2530 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, - /* 2540 */ 1467, 1467, 161, 1467, 1467, 1467, 1933, + /* 420 */ 136, 620, 481, 665, 1284, 1258, 1370, 1256, 33, 32, + /* 430 */ 165, 549, 40, 38, 36, 35, 34, 1336, 1337, 619, + /* 440 */ 1751, 29, 340, 1351, 1352, 1353, 1354, 1355, 1359, 1360, + /* 450 */ 1361, 1480, 1261, 1262, 1479, 1311, 1312, 1314, 1315, 1316, + /* 460 */ 1317, 1318, 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, + /* 470 */ 1333, 1335, 1338, 33, 32, 218, 619, 40, 38, 36, + /* 480 */ 35, 34, 1258, 482, 1256, 40, 38, 36, 35, 34, + /* 490 */ 1257, 1686, 1751, 33, 32, 1751, 1769, 40, 38, 36, + /* 500 */ 35, 34, 175, 1255, 63, 481, 77, 1765, 22, 1261, + /* 510 */ 1262, 1285, 1311, 1312, 1314, 1315, 1316, 1317, 1318, 1319, + /* 520 */ 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, 1338, + /* 530 */ 39, 37, 1339, 1761, 1767, 331, 1263, 156, 342, 345, + /* 540 */ 1257, 1782, 165, 1586, 532, 577, 309, 143, 1313, 88, + /* 550 */ 1634, 1334, 1769, 1255, 1765, 389, 1597, 255, 224, 225, + /* 560 */ 33, 32, 121, 1765, 40, 38, 36, 35, 34, 1800, + /* 570 */ 1587, 173, 1595, 1072, 1329, 665, 1393, 559, 1454, 1356, + /* 580 */ 1761, 1767, 1751, 494, 583, 520, 1263, 39, 37, 1761, + /* 590 */ 1767, 337, 577, 532, 1926, 342, 1694, 1257, 504, 71, + /* 600 */ 544, 577, 70, 9, 390, 1478, 1074, 163, 1334, 1814, + /* 610 */ 1255, 1923, 210, 92, 1783, 586, 1785, 1786, 582, 307, + /* 620 */ 577, 1595, 522, 1860, 1477, 665, 497, 333, 1856, 157, + /* 630 */ 491, 1329, 1281, 1357, 1258, 209, 1256, 353, 1428, 1336, + /* 640 */ 1337, 26, 1476, 1263, 235, 165, 1751, 33, 32, 1887, + /* 650 */ 211, 40, 38, 36, 35, 34, 1362, 1691, 1344, 302, + /* 660 */ 9, 1261, 1262, 58, 1282, 1751, 57, 7, 1453, 33, + /* 670 */ 32, 348, 1926, 40, 38, 36, 35, 34, 1926, 143, + /* 680 */ 550, 545, 665, 1751, 1258, 1924, 1256, 615, 1597, 1923, + /* 690 */ 1638, 162, 36, 35, 34, 1923, 1336, 1337, 1502, 29, + /* 700 */ 340, 1351, 1352, 1353, 1354, 1355, 1359, 1360, 1361, 75, + /* 710 */ 307, 1261, 1262, 522, 1311, 1312, 1314, 1315, 1316, 1317, + /* 720 */ 1318, 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, + /* 730 */ 1335, 1338, 33, 32, 486, 485, 40, 38, 36, 35, + /* 740 */ 34, 1258, 1875, 1256, 635, 633, 660, 1408, 1110, 608, + /* 750 */ 607, 606, 1114, 605, 1116, 1117, 604, 1119, 601, 61, + /* 760 */ 1125, 598, 1127, 1128, 595, 592, 1871, 352, 1261, 1262, + /* 770 */ 1475, 1311, 1312, 1314, 1315, 1316, 1317, 1318, 1319, 579, + /* 780 */ 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, 1338, 39, + /* 790 */ 37, 304, 1282, 1280, 617, 668, 505, 342, 1472, 1257, + /* 800 */ 419, 616, 1471, 431, 1638, 1470, 1782, 532, 1926, 270, + /* 810 */ 1334, 1751, 1255, 134, 133, 614, 613, 612, 349, 1696, + /* 820 */ 404, 162, 432, 154, 406, 1923, 1469, 532, 658, 654, + /* 830 */ 650, 646, 268, 1329, 1800, 1595, 1647, 1926, 396, 1751, + /* 840 */ 532, 1313, 584, 1751, 611, 1263, 1751, 1751, 532, 583, + /* 850 */ 162, 411, 1646, 1390, 1923, 1595, 1584, 397, 1047, 412, + /* 860 */ 89, 532, 2, 233, 623, 1263, 1567, 1751, 1595, 393, + /* 870 */ 275, 1875, 456, 1625, 1814, 132, 1595, 142, 93, 1783, + /* 880 */ 586, 1785, 1786, 582, 665, 577, 1007, 1008, 1860, 1595, + /* 890 */ 1468, 1048, 1859, 1856, 1572, 1870, 529, 430, 1336, 1337, + /* 900 */ 425, 424, 423, 422, 421, 418, 417, 416, 415, 414, + /* 910 */ 410, 409, 408, 407, 401, 400, 399, 398, 54, 395, + /* 920 */ 394, 1467, 1466, 28, 1880, 1390, 622, 144, 220, 33, + /* 930 */ 32, 1751, 281, 40, 38, 36, 35, 34, 1570, 44, + /* 940 */ 4, 53, 516, 1258, 532, 1256, 279, 60, 1580, 1228, + /* 950 */ 59, 213, 33, 32, 1465, 1592, 40, 38, 36, 35, + /* 960 */ 34, 1464, 1751, 1751, 1582, 1782, 180, 436, 434, 1313, + /* 970 */ 1261, 1262, 1595, 1311, 1312, 1314, 1315, 1316, 1317, 1318, + /* 980 */ 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, + /* 990 */ 1338, 617, 532, 1800, 63, 1751, 532, 1513, 532, 562, + /* 1000 */ 634, 584, 1751, 1725, 1266, 41, 1751, 513, 583, 517, + /* 1010 */ 134, 133, 614, 613, 612, 202, 222, 532, 200, 490, + /* 1020 */ 1595, 1265, 560, 128, 1595, 532, 1595, 1508, 530, 1578, + /* 1030 */ 1296, 573, 90, 1814, 217, 617, 531, 91, 1783, 586, + /* 1040 */ 1785, 1786, 582, 379, 577, 1595, 1782, 1860, 1204, 492, + /* 1050 */ 214, 308, 1856, 1595, 134, 133, 614, 613, 612, 226, + /* 1060 */ 339, 338, 532, 1926, 131, 76, 525, 68, 67, 388, + /* 1070 */ 1271, 1506, 171, 264, 1800, 1770, 162, 555, 382, 567, + /* 1080 */ 1923, 1334, 584, 1264, 132, 204, 1765, 1751, 203, 583, + /* 1090 */ 1595, 303, 206, 495, 372, 205, 370, 366, 362, 168, + /* 1100 */ 357, 354, 1772, 208, 1329, 124, 207, 232, 51, 239, + /* 1110 */ 11, 10, 1761, 1767, 1814, 51, 1263, 578, 92, 1783, + /* 1120 */ 586, 1785, 1786, 582, 577, 577, 560, 1103, 1860, 1782, + /* 1130 */ 1456, 1457, 333, 1856, 1939, 165, 41, 1269, 41, 590, + /* 1140 */ 131, 1774, 132, 1894, 116, 122, 131, 610, 512, 87, + /* 1150 */ 1474, 1415, 242, 1556, 1268, 572, 258, 1800, 1364, 84, + /* 1160 */ 253, 1868, 554, 1348, 553, 584, 542, 1926, 475, 506, + /* 1170 */ 1751, 247, 583, 1801, 351, 1635, 1497, 1890, 252, 1320, + /* 1180 */ 164, 274, 1131, 1135, 1923, 1142, 560, 1140, 556, 135, + /* 1190 */ 356, 257, 1782, 260, 3, 262, 5, 1814, 1280, 359, + /* 1200 */ 363, 288, 1783, 586, 1785, 1786, 582, 315, 577, 1072, + /* 1210 */ 316, 1220, 174, 271, 1272, 392, 1267, 413, 1688, 420, + /* 1220 */ 1800, 428, 427, 429, 1286, 433, 435, 1926, 584, 1289, + /* 1230 */ 437, 183, 438, 1751, 1782, 583, 449, 446, 450, 1288, + /* 1240 */ 164, 1275, 1277, 185, 1923, 451, 1290, 1287, 452, 454, + /* 1250 */ 188, 455, 190, 575, 1327, 1328, 1330, 1331, 1332, 1333, + /* 1260 */ 1814, 192, 1800, 72, 92, 1783, 586, 1785, 1786, 582, + /* 1270 */ 584, 577, 458, 195, 1860, 1751, 477, 583, 333, 1856, + /* 1280 */ 1939, 479, 1585, 568, 115, 199, 1581, 201, 137, 1917, + /* 1290 */ 306, 138, 212, 1583, 1579, 139, 272, 1782, 140, 507, + /* 1300 */ 215, 514, 1814, 508, 518, 526, 92, 1783, 586, 1785, + /* 1310 */ 1786, 582, 1730, 577, 219, 511, 1860, 540, 521, 527, + /* 1320 */ 333, 1856, 1939, 230, 1729, 1800, 1698, 129, 523, 273, + /* 1330 */ 327, 1879, 80, 584, 325, 228, 130, 1596, 1751, 1285, + /* 1340 */ 583, 528, 543, 536, 6, 552, 1901, 1782, 1900, 538, + /* 1350 */ 1891, 539, 332, 546, 560, 237, 537, 1882, 246, 535, + /* 1360 */ 534, 241, 1390, 123, 1782, 1814, 1284, 569, 566, 288, + /* 1370 */ 1783, 586, 1785, 1786, 582, 1800, 577, 334, 48, 82, + /* 1380 */ 251, 588, 1639, 584, 1568, 151, 1876, 276, 1751, 661, + /* 1390 */ 583, 267, 1800, 664, 248, 1926, 249, 662, 52, 250, + /* 1400 */ 581, 150, 280, 1841, 289, 1751, 278, 583, 162, 1745, + /* 1410 */ 299, 298, 1923, 1744, 65, 1814, 1743, 1742, 66, 93, + /* 1420 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1741, 358, 1860, + /* 1430 */ 1738, 1922, 1814, 571, 1856, 563, 296, 1783, 586, 1785, + /* 1440 */ 1786, 582, 580, 577, 574, 1832, 1782, 256, 1942, 259, + /* 1450 */ 360, 570, 261, 1800, 1248, 361, 1249, 169, 365, 1736, + /* 1460 */ 367, 584, 369, 368, 1735, 371, 1751, 1734, 583, 373, + /* 1470 */ 1733, 375, 1732, 1715, 1800, 377, 170, 380, 381, 1223, + /* 1480 */ 1222, 1709, 584, 1708, 386, 387, 1707, 1751, 1192, 583, + /* 1490 */ 1706, 1681, 126, 1814, 1680, 1679, 1678, 146, 1783, 586, + /* 1500 */ 1785, 1786, 582, 69, 577, 1677, 1676, 1675, 1674, 1673, + /* 1510 */ 402, 403, 1672, 405, 1814, 1782, 1671, 1670, 93, 1783, + /* 1520 */ 586, 1785, 1786, 582, 1669, 577, 1668, 1782, 1860, 1667, + /* 1530 */ 1666, 1665, 1664, 1857, 1663, 1662, 1661, 1782, 178, 127, + /* 1540 */ 1657, 561, 1940, 1800, 1660, 1659, 1658, 1656, 326, 1655, + /* 1550 */ 1654, 584, 181, 117, 179, 1800, 1751, 1653, 583, 1652, + /* 1560 */ 533, 1651, 1650, 584, 1194, 1800, 1649, 1648, 1751, 1528, + /* 1570 */ 583, 1527, 1525, 584, 1493, 1492, 155, 1010, 1751, 1009, + /* 1580 */ 583, 182, 118, 1814, 1723, 442, 1717, 297, 1783, 586, + /* 1590 */ 1785, 1786, 582, 1782, 577, 1814, 1705, 444, 189, 297, + /* 1600 */ 1783, 586, 1785, 1786, 582, 1814, 577, 1782, 1704, 292, + /* 1610 */ 1783, 586, 1785, 1786, 582, 187, 577, 1690, 1574, 1524, + /* 1620 */ 1040, 1800, 1522, 459, 460, 1520, 461, 463, 464, 584, + /* 1630 */ 465, 1518, 467, 1516, 1751, 1800, 583, 468, 469, 473, + /* 1640 */ 471, 1505, 472, 581, 1504, 1489, 1576, 551, 1751, 50, + /* 1650 */ 583, 1146, 198, 1575, 1145, 1071, 632, 634, 1068, 1067, + /* 1660 */ 1066, 1814, 1514, 1509, 321, 146, 1783, 586, 1785, 1786, + /* 1670 */ 582, 322, 577, 1507, 323, 1814, 493, 1488, 496, 296, + /* 1680 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1487, 1833, 498, + /* 1690 */ 500, 1486, 502, 1722, 94, 1230, 1716, 1782, 509, 141, + /* 1700 */ 1703, 56, 1701, 1702, 216, 1700, 510, 1699, 1697, 324, + /* 1710 */ 1941, 15, 1689, 1800, 221, 227, 84, 229, 341, 515, + /* 1720 */ 78, 584, 79, 41, 524, 1800, 1751, 231, 583, 234, + /* 1730 */ 343, 16, 23, 584, 1430, 236, 245, 238, 1751, 45, + /* 1740 */ 583, 1772, 1412, 240, 47, 1414, 148, 1782, 17, 1240, + /* 1750 */ 243, 24, 244, 1814, 1407, 1387, 83, 297, 1783, 586, + /* 1760 */ 1785, 1786, 582, 25, 577, 1814, 46, 1386, 254, 297, + /* 1770 */ 1783, 586, 1785, 1786, 582, 1800, 577, 1771, 152, 18, + /* 1780 */ 1447, 1442, 1441, 584, 335, 1436, 1446, 1445, 1751, 336, + /* 1790 */ 583, 10, 1273, 19, 1349, 1817, 576, 1782, 1304, 1324, + /* 1800 */ 13, 1322, 31, 153, 1321, 166, 12, 585, 589, 20, + /* 1810 */ 21, 1782, 587, 1132, 344, 1814, 1129, 593, 591, 282, + /* 1820 */ 1783, 586, 1785, 1786, 582, 1800, 577, 594, 596, 1126, + /* 1830 */ 597, 599, 602, 584, 609, 1124, 1109, 1123, 1751, 1800, + /* 1840 */ 583, 1120, 1118, 600, 1122, 1141, 603, 584, 1121, 85, + /* 1850 */ 86, 62, 1751, 1782, 583, 1137, 265, 1038, 1063, 618, + /* 1860 */ 1078, 621, 266, 1782, 1061, 1814, 1060, 1059, 1058, 283, + /* 1870 */ 1783, 586, 1785, 1786, 582, 1057, 577, 1056, 1055, 1814, + /* 1880 */ 1054, 1800, 1073, 284, 1783, 586, 1785, 1786, 582, 584, + /* 1890 */ 577, 1800, 1075, 1051, 1751, 1050, 583, 1049, 1046, 584, + /* 1900 */ 1045, 1044, 1043, 1521, 1751, 643, 583, 645, 644, 1519, + /* 1910 */ 647, 648, 649, 1517, 1515, 651, 652, 653, 655, 656, + /* 1920 */ 657, 1814, 1503, 659, 1000, 291, 1783, 586, 1785, 1786, + /* 1930 */ 582, 1814, 577, 1485, 269, 293, 1783, 586, 1785, 1786, + /* 1940 */ 582, 1782, 577, 1259, 663, 667, 277, 666, 1460, 1460, + /* 1950 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1782, 1460, 1460, + /* 1960 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1800, + /* 1970 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, + /* 1980 */ 1460, 1460, 1751, 1460, 583, 1800, 1460, 1460, 1460, 1460, + /* 1990 */ 1460, 1460, 1460, 584, 1460, 1460, 1460, 1460, 1751, 1460, + /* 2000 */ 583, 1460, 1460, 1460, 1460, 1460, 1460, 1782, 1460, 1814, + /* 2010 */ 1460, 1460, 1460, 285, 1783, 586, 1785, 1786, 582, 1782, + /* 2020 */ 577, 1460, 1460, 1460, 1460, 1814, 1460, 1460, 1460, 294, + /* 2030 */ 1783, 586, 1785, 1786, 582, 1800, 577, 1460, 1460, 1460, + /* 2040 */ 1460, 1460, 1460, 584, 1460, 1460, 1460, 1800, 1751, 1460, + /* 2050 */ 583, 1460, 1460, 1460, 1460, 584, 1460, 1460, 1460, 1460, + /* 2060 */ 1751, 1460, 583, 1460, 1460, 1460, 1460, 1460, 1460, 1460, + /* 2070 */ 1460, 1782, 1460, 1460, 1460, 1814, 1460, 1460, 1460, 286, + /* 2080 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1814, 555, 1460, + /* 2090 */ 1460, 295, 1783, 586, 1785, 1786, 582, 1460, 577, 1800, + /* 2100 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, + /* 2110 */ 1460, 1460, 1751, 1800, 583, 1460, 124, 1460, 1460, 1460, + /* 2120 */ 1460, 584, 1460, 1460, 1460, 1460, 1751, 1460, 583, 1460, + /* 2130 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 560, 1460, 1814, + /* 2140 */ 1460, 1782, 1460, 287, 1783, 586, 1785, 1786, 582, 1460, + /* 2150 */ 577, 1782, 1460, 1814, 1460, 1460, 122, 300, 1783, 586, + /* 2160 */ 1785, 1786, 582, 1460, 577, 1460, 1460, 1460, 1460, 1800, + /* 2170 */ 1460, 253, 1868, 554, 1460, 553, 1460, 584, 1926, 1800, + /* 2180 */ 1460, 1460, 1751, 1460, 583, 1460, 1460, 584, 1460, 1460, + /* 2190 */ 1460, 162, 1751, 1460, 583, 1923, 1460, 1460, 1460, 1460, + /* 2200 */ 1460, 1782, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1814, + /* 2210 */ 1460, 1460, 1460, 301, 1783, 586, 1785, 1786, 582, 1814, + /* 2220 */ 577, 1460, 1460, 1794, 1783, 586, 1785, 1786, 582, 1800, + /* 2230 */ 577, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, + /* 2240 */ 1460, 1460, 1751, 1460, 583, 1460, 1460, 1460, 1460, 1460, + /* 2250 */ 1460, 1460, 1460, 1782, 1460, 1460, 1460, 1460, 1460, 1460, + /* 2260 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1782, 1460, 1814, + /* 2270 */ 1460, 1460, 1460, 1793, 1783, 586, 1785, 1786, 582, 1782, + /* 2280 */ 577, 1800, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, + /* 2290 */ 1460, 1460, 1460, 1460, 1751, 1800, 583, 1460, 1460, 1460, + /* 2300 */ 1460, 1460, 1460, 584, 1460, 1460, 1460, 1800, 1751, 1460, + /* 2310 */ 583, 1460, 1460, 1460, 1460, 584, 1460, 1460, 1460, 1460, + /* 2320 */ 1751, 1814, 583, 1460, 1460, 1792, 1783, 586, 1785, 1786, + /* 2330 */ 582, 1782, 577, 1460, 1460, 1814, 1460, 1460, 1460, 312, + /* 2340 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1814, 1460, 1460, + /* 2350 */ 1460, 311, 1783, 586, 1785, 1786, 582, 1460, 577, 1800, + /* 2360 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, + /* 2370 */ 1460, 1460, 1751, 1800, 583, 1460, 1460, 1460, 1460, 1460, + /* 2380 */ 1460, 584, 1460, 1460, 1460, 1460, 1751, 1460, 583, 1460, + /* 2390 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1814, + /* 2400 */ 1460, 1782, 1460, 313, 1783, 586, 1785, 1786, 582, 1460, + /* 2410 */ 577, 1460, 1460, 1814, 1460, 1460, 1460, 310, 1783, 586, + /* 2420 */ 1785, 1786, 582, 1460, 577, 1460, 1460, 1460, 1460, 1800, + /* 2430 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, + /* 2440 */ 1460, 1460, 1751, 1460, 583, 1460, 1460, 1460, 1460, 1460, + /* 2450 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, + /* 2460 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1814, + /* 2470 */ 1460, 1460, 1460, 290, 1783, 586, 1785, 1786, 582, 1460, + /* 2480 */ 577, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 267, 271, 256, 263, 267, 265, 266, 279, 302, 271, @@ -480,430 +474,424 @@ static const YYCODETYPE yy_lookahead[] = { /* 20 */ 20, 0, 22, 293, 296, 272, 303, 267, 295, 276, /* 30 */ 287, 293, 295, 33, 263, 35, 265, 266, 295, 20, /* 40 */ 298, 267, 21, 301, 302, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 269, 295, 56, 259, 259, 8, + /* 50 */ 29, 30, 31, 32, 264, 295, 56, 267, 259, 8, /* 60 */ 9, 61, 316, 12, 13, 14, 15, 16, 68, 12, - /* 70 */ 13, 14, 335, 20, 20, 290, 333, 20, 304, 22, - /* 80 */ 357, 20, 258, 357, 260, 85, 287, 350, 351, 352, - /* 90 */ 33, 354, 35, 370, 295, 335, 370, 374, 300, 300, - /* 100 */ 374, 302, 264, 357, 4, 267, 20, 107, 267, 349, - /* 110 */ 350, 351, 352, 56, 354, 316, 370, 20, 61, 278, - /* 120 */ 374, 121, 122, 342, 343, 68, 327, 43, 286, 116, - /* 130 */ 331, 332, 333, 334, 335, 336, 295, 338, 85, 85, - /* 140 */ 341, 299, 85, 21, 345, 346, 24, 25, 26, 27, - /* 150 */ 28, 29, 30, 31, 32, 279, 357, 12, 13, 14, - /* 160 */ 15, 16, 35, 287, 107, 85, 166, 33, 168, 370, - /* 170 */ 86, 85, 296, 374, 316, 316, 316, 264, 121, 122, - /* 180 */ 267, 47, 121, 122, 4, 85, 52, 53, 54, 55, - /* 190 */ 56, 178, 179, 193, 194, 68, 196, 197, 198, 199, + /* 70 */ 13, 14, 335, 20, 20, 43, 333, 20, 304, 22, + /* 80 */ 357, 79, 258, 357, 260, 85, 287, 350, 351, 352, + /* 90 */ 33, 354, 35, 370, 295, 335, 370, 374, 20, 300, + /* 100 */ 374, 302, 4, 357, 85, 85, 20, 107, 22, 349, + /* 110 */ 350, 351, 352, 56, 354, 316, 370, 269, 61, 4, + /* 120 */ 374, 121, 122, 342, 343, 68, 327, 125, 126, 116, + /* 130 */ 331, 332, 333, 334, 335, 336, 50, 338, 290, 85, + /* 140 */ 341, 259, 85, 21, 345, 346, 24, 25, 26, 27, + /* 150 */ 28, 29, 30, 31, 32, 0, 357, 64, 65, 44, + /* 160 */ 45, 287, 69, 85, 107, 72, 166, 33, 168, 370, + /* 170 */ 296, 78, 148, 374, 121, 122, 316, 264, 121, 122, + /* 180 */ 267, 47, 300, 85, 301, 302, 52, 53, 54, 55, + /* 190 */ 56, 178, 179, 193, 194, 171, 196, 197, 198, 199, /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 210 */ 210, 211, 212, 213, 357, 357, 357, 357, 84, 301, - /* 220 */ 302, 87, 20, 166, 22, 168, 226, 370, 370, 370, - /* 230 */ 370, 374, 374, 374, 374, 8, 9, 316, 85, 12, - /* 240 */ 13, 14, 15, 16, 259, 165, 56, 167, 267, 43, - /* 250 */ 193, 194, 50, 196, 197, 198, 199, 200, 201, 202, + /* 210 */ 210, 211, 212, 213, 20, 287, 22, 357, 84, 64, + /* 220 */ 65, 87, 294, 166, 69, 168, 226, 72, 20, 35, + /* 230 */ 370, 303, 85, 78, 374, 8, 9, 316, 214, 12, + /* 240 */ 13, 14, 15, 16, 50, 226, 226, 312, 267, 314, + /* 250 */ 193, 194, 161, 196, 197, 198, 199, 200, 201, 202, /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - /* 270 */ 213, 12, 13, 0, 84, 20, 295, 87, 357, 20, - /* 280 */ 226, 22, 259, 149, 150, 300, 152, 0, 61, 85, - /* 290 */ 156, 370, 33, 60, 35, 374, 267, 24, 25, 26, - /* 300 */ 27, 28, 29, 30, 31, 32, 226, 278, 20, 175, - /* 310 */ 287, 259, 226, 86, 285, 56, 335, 357, 295, 316, - /* 320 */ 61, 94, 259, 300, 295, 302, 226, 68, 12, 13, - /* 330 */ 370, 350, 351, 352, 374, 354, 20, 267, 22, 0, - /* 340 */ 37, 273, 274, 193, 85, 97, 287, 60, 278, 33, - /* 350 */ 327, 35, 300, 294, 331, 332, 333, 334, 335, 336, - /* 360 */ 357, 338, 303, 300, 341, 295, 107, 119, 345, 346, - /* 370 */ 347, 0, 56, 370, 20, 148, 287, 374, 20, 226, + /* 270 */ 213, 12, 13, 0, 183, 184, 295, 245, 357, 20, + /* 280 */ 226, 22, 259, 149, 150, 295, 152, 329, 61, 85, + /* 290 */ 156, 370, 33, 21, 35, 374, 306, 24, 25, 26, + /* 300 */ 27, 28, 29, 30, 31, 32, 34, 259, 36, 175, + /* 310 */ 287, 353, 165, 86, 167, 56, 335, 0, 295, 267, + /* 320 */ 61, 94, 259, 300, 226, 302, 60, 68, 12, 13, + /* 330 */ 278, 350, 351, 352, 267, 354, 20, 285, 22, 0, + /* 340 */ 37, 1, 2, 193, 85, 278, 14, 295, 300, 33, + /* 350 */ 327, 35, 20, 4, 331, 332, 333, 334, 335, 336, + /* 360 */ 0, 338, 295, 300, 341, 14, 107, 267, 345, 346, + /* 370 */ 347, 20, 56, 226, 20, 148, 287, 60, 278, 0, /* 380 */ 121, 122, 359, 294, 68, 235, 236, 237, 238, 239, - /* 390 */ 367, 88, 303, 90, 91, 312, 93, 314, 171, 0, - /* 400 */ 97, 85, 63, 64, 65, 66, 67, 227, 69, 70, + /* 390 */ 367, 88, 303, 90, 91, 295, 93, 20, 171, 259, + /* 400 */ 97, 85, 63, 64, 65, 66, 67, 47, 69, 70, /* 410 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - /* 420 */ 81, 82, 119, 107, 20, 166, 22, 168, 8, 9, - /* 430 */ 226, 60, 12, 13, 14, 15, 16, 121, 122, 35, - /* 440 */ 4, 214, 215, 216, 217, 218, 219, 220, 221, 222, - /* 450 */ 223, 245, 193, 194, 50, 196, 197, 198, 199, 200, + /* 420 */ 81, 82, 119, 107, 20, 166, 86, 168, 8, 9, + /* 430 */ 226, 20, 12, 13, 14, 15, 16, 121, 122, 60, + /* 440 */ 300, 214, 215, 216, 217, 218, 219, 220, 221, 222, + /* 450 */ 223, 259, 193, 194, 259, 196, 197, 198, 199, 200, /* 460 */ 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - /* 470 */ 211, 212, 213, 0, 56, 116, 117, 63, 64, 65, - /* 480 */ 44, 45, 166, 69, 168, 197, 72, 73, 273, 274, - /* 490 */ 76, 77, 78, 8, 9, 0, 289, 12, 13, 14, - /* 500 */ 15, 16, 117, 85, 60, 87, 259, 300, 79, 193, - /* 510 */ 194, 153, 196, 197, 198, 199, 200, 201, 202, 203, + /* 470 */ 211, 212, 213, 8, 9, 56, 60, 12, 13, 14, + /* 480 */ 15, 16, 166, 97, 168, 12, 13, 14, 15, 16, + /* 490 */ 22, 295, 300, 8, 9, 300, 289, 12, 13, 14, + /* 500 */ 15, 16, 306, 35, 85, 119, 87, 300, 43, 193, + /* 510 */ 194, 20, 196, 197, 198, 199, 200, 201, 202, 203, /* 520 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - /* 530 */ 12, 13, 14, 326, 327, 328, 177, 14, 20, 180, - /* 540 */ 22, 259, 226, 20, 56, 338, 61, 300, 312, 279, - /* 550 */ 314, 33, 267, 35, 125, 126, 0, 287, 63, 64, - /* 560 */ 65, 176, 177, 278, 69, 180, 296, 72, 73, 287, - /* 570 */ 97, 76, 77, 78, 56, 87, 148, 295, 158, 94, - /* 580 */ 295, 151, 300, 4, 302, 287, 68, 12, 13, 116, - /* 590 */ 117, 118, 119, 120, 267, 20, 267, 22, 19, 171, - /* 600 */ 295, 303, 43, 85, 48, 278, 21, 278, 33, 327, - /* 610 */ 35, 306, 33, 331, 332, 333, 334, 335, 336, 34, - /* 620 */ 338, 36, 295, 341, 295, 107, 47, 345, 346, 347, - /* 630 */ 51, 56, 161, 148, 289, 56, 267, 267, 20, 121, - /* 640 */ 122, 289, 214, 68, 226, 300, 269, 278, 278, 367, - /* 650 */ 288, 14, 300, 259, 183, 184, 171, 20, 68, 282, - /* 660 */ 85, 231, 232, 84, 295, 295, 87, 290, 248, 8, - /* 670 */ 9, 326, 327, 12, 13, 14, 15, 16, 326, 327, - /* 680 */ 328, 302, 107, 338, 166, 14, 168, 14, 15, 16, - /* 690 */ 338, 20, 313, 259, 300, 96, 121, 122, 0, 214, - /* 700 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 1, - /* 710 */ 2, 193, 194, 3, 196, 197, 198, 199, 200, 201, + /* 530 */ 12, 13, 14, 326, 327, 328, 68, 286, 20, 279, + /* 540 */ 22, 259, 226, 289, 267, 338, 61, 287, 197, 269, + /* 550 */ 299, 33, 289, 35, 300, 278, 296, 153, 116, 117, + /* 560 */ 8, 9, 282, 300, 12, 13, 14, 15, 16, 287, + /* 570 */ 290, 56, 295, 35, 56, 107, 227, 295, 158, 94, + /* 580 */ 326, 327, 300, 4, 302, 302, 68, 12, 13, 326, + /* 590 */ 327, 328, 338, 267, 357, 20, 313, 22, 19, 84, + /* 600 */ 151, 338, 87, 85, 278, 259, 68, 370, 33, 327, + /* 610 */ 35, 374, 33, 331, 332, 333, 334, 335, 336, 177, + /* 620 */ 338, 295, 180, 341, 259, 107, 47, 345, 346, 347, + /* 630 */ 51, 56, 20, 148, 166, 56, 168, 316, 86, 121, + /* 640 */ 122, 2, 259, 68, 153, 226, 300, 8, 9, 367, + /* 650 */ 117, 12, 13, 14, 15, 16, 171, 312, 14, 314, + /* 660 */ 85, 193, 194, 84, 20, 300, 87, 39, 248, 8, + /* 670 */ 9, 279, 357, 12, 13, 14, 15, 16, 357, 287, + /* 680 */ 231, 232, 107, 300, 166, 370, 168, 297, 296, 374, + /* 690 */ 300, 370, 14, 15, 16, 374, 121, 122, 0, 214, + /* 700 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 176, + /* 710 */ 177, 193, 194, 180, 196, 197, 198, 199, 200, 201, /* 720 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - /* 730 */ 212, 213, 8, 9, 300, 329, 12, 13, 14, 15, - /* 740 */ 16, 166, 297, 168, 275, 300, 277, 86, 98, 99, - /* 750 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 353, - /* 760 */ 110, 111, 112, 113, 114, 115, 259, 43, 193, 194, + /* 730 */ 212, 213, 8, 9, 273, 274, 12, 13, 14, 15, + /* 740 */ 16, 166, 329, 168, 273, 274, 48, 86, 98, 99, + /* 750 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 3, + /* 760 */ 110, 111, 112, 113, 114, 115, 353, 316, 193, 194, /* 770 */ 259, 196, 197, 198, 199, 200, 201, 202, 203, 204, /* 780 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 12, - /* 790 */ 13, 18, 35, 20, 86, 97, 287, 20, 267, 22, - /* 800 */ 27, 259, 267, 30, 68, 296, 247, 300, 267, 278, - /* 810 */ 33, 300, 35, 278, 116, 117, 118, 119, 120, 278, - /* 820 */ 47, 267, 49, 0, 51, 68, 295, 267, 267, 287, - /* 830 */ 295, 20, 278, 56, 197, 39, 295, 295, 278, 278, - /* 840 */ 259, 259, 300, 43, 302, 68, 8, 9, 85, 295, - /* 850 */ 12, 13, 14, 15, 16, 295, 295, 84, 95, 8, - /* 860 */ 9, 267, 85, 12, 13, 14, 15, 16, 197, 327, - /* 870 */ 47, 97, 278, 331, 332, 333, 334, 335, 336, 288, - /* 880 */ 338, 300, 300, 341, 107, 259, 86, 345, 346, 295, - /* 890 */ 116, 117, 118, 119, 120, 42, 43, 124, 121, 122, + /* 790 */ 13, 18, 20, 20, 97, 19, 316, 20, 259, 22, + /* 800 */ 27, 297, 259, 30, 300, 259, 259, 267, 357, 33, + /* 810 */ 33, 300, 35, 116, 117, 118, 119, 120, 278, 0, + /* 820 */ 47, 370, 49, 47, 51, 374, 259, 267, 52, 53, + /* 830 */ 54, 55, 56, 56, 287, 295, 287, 357, 278, 300, + /* 840 */ 267, 197, 295, 300, 96, 68, 300, 300, 267, 302, + /* 850 */ 370, 278, 303, 225, 374, 295, 288, 84, 35, 278, + /* 860 */ 84, 267, 85, 87, 275, 68, 277, 300, 295, 96, + /* 870 */ 280, 329, 278, 283, 327, 43, 295, 153, 331, 332, + /* 880 */ 333, 334, 335, 336, 107, 338, 44, 45, 341, 295, + /* 890 */ 259, 68, 345, 346, 0, 353, 120, 124, 121, 122, /* 900 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 910 */ 137, 138, 139, 140, 141, 142, 143, 144, 329, 146, - /* 920 */ 147, 288, 259, 2, 86, 329, 300, 18, 288, 8, - /* 930 */ 9, 259, 23, 12, 13, 14, 15, 16, 44, 45, - /* 940 */ 35, 267, 353, 166, 288, 168, 37, 38, 2, 353, - /* 950 */ 41, 320, 278, 243, 8, 9, 259, 43, 12, 13, - /* 960 */ 14, 15, 16, 300, 153, 259, 57, 58, 59, 295, - /* 970 */ 193, 194, 300, 196, 197, 198, 199, 200, 201, 202, + /* 910 */ 137, 138, 139, 140, 141, 142, 143, 144, 86, 146, + /* 920 */ 147, 259, 259, 2, 224, 225, 68, 18, 152, 8, + /* 930 */ 9, 300, 23, 12, 13, 14, 15, 16, 0, 42, + /* 940 */ 43, 153, 154, 166, 267, 168, 37, 38, 288, 173, + /* 950 */ 41, 175, 8, 9, 259, 278, 12, 13, 14, 15, + /* 960 */ 16, 259, 300, 300, 288, 259, 57, 58, 59, 197, + /* 970 */ 193, 194, 295, 196, 197, 198, 199, 200, 201, 202, /* 980 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - /* 990 */ 213, 19, 267, 287, 85, 280, 297, 300, 283, 300, - /* 1000 */ 86, 295, 288, 278, 153, 33, 300, 259, 302, 259, - /* 1010 */ 8, 9, 259, 259, 12, 13, 14, 15, 16, 47, - /* 1020 */ 295, 225, 316, 0, 52, 53, 54, 55, 56, 35, - /* 1030 */ 224, 225, 123, 327, 153, 154, 46, 331, 332, 333, - /* 1040 */ 334, 335, 336, 43, 338, 22, 259, 341, 300, 0, - /* 1050 */ 300, 345, 346, 300, 300, 89, 84, 0, 92, 87, - /* 1060 */ 12, 13, 89, 357, 43, 92, 61, 158, 159, 160, - /* 1070 */ 22, 22, 163, 168, 287, 85, 370, 288, 169, 22, - /* 1080 */ 374, 33, 295, 35, 43, 260, 86, 300, 86, 302, - /* 1090 */ 276, 182, 120, 377, 185, 43, 187, 188, 189, 190, - /* 1100 */ 191, 192, 289, 89, 56, 89, 92, 86, 92, 43, - /* 1110 */ 43, 43, 368, 300, 327, 43, 68, 43, 331, 332, - /* 1120 */ 333, 334, 335, 336, 152, 338, 43, 86, 341, 1, - /* 1130 */ 2, 268, 345, 346, 347, 226, 259, 287, 86, 326, - /* 1140 */ 327, 121, 122, 356, 43, 173, 43, 175, 43, 323, - /* 1150 */ 43, 338, 86, 86, 86, 107, 364, 268, 86, 266, - /* 1160 */ 86, 299, 168, 330, 287, 355, 348, 358, 371, 86, - /* 1170 */ 371, 228, 295, 371, 325, 20, 47, 300, 267, 302, - /* 1180 */ 324, 35, 164, 273, 318, 267, 267, 86, 148, 86, - /* 1190 */ 42, 86, 259, 86, 307, 305, 305, 267, 193, 267, - /* 1200 */ 261, 267, 20, 261, 327, 20, 322, 271, 331, 332, - /* 1210 */ 333, 334, 335, 336, 166, 338, 168, 302, 341, 271, - /* 1220 */ 287, 20, 345, 346, 20, 317, 271, 315, 295, 271, - /* 1230 */ 20, 315, 308, 300, 259, 302, 271, 267, 271, 271, - /* 1240 */ 261, 193, 194, 287, 287, 267, 287, 287, 287, 287, - /* 1250 */ 287, 287, 261, 205, 206, 207, 208, 209, 210, 211, - /* 1260 */ 327, 287, 287, 287, 331, 332, 333, 334, 335, 336, - /* 1270 */ 295, 338, 287, 322, 341, 300, 269, 302, 345, 346, - /* 1280 */ 347, 300, 174, 233, 302, 150, 269, 259, 269, 356, - /* 1290 */ 321, 267, 267, 300, 311, 315, 300, 259, 300, 300, - /* 1300 */ 311, 300, 327, 295, 309, 308, 331, 332, 333, 334, - /* 1310 */ 335, 336, 269, 338, 283, 287, 341, 295, 20, 234, - /* 1320 */ 345, 346, 347, 295, 269, 287, 300, 300, 300, 300, - /* 1330 */ 302, 356, 22, 295, 330, 300, 300, 240, 300, 229, - /* 1340 */ 302, 311, 365, 311, 157, 35, 242, 259, 225, 363, - /* 1350 */ 363, 363, 241, 295, 316, 327, 20, 259, 366, 331, - /* 1360 */ 332, 333, 334, 335, 336, 327, 338, 325, 362, 331, - /* 1370 */ 332, 333, 334, 335, 336, 287, 338, 246, 68, 249, - /* 1380 */ 329, 244, 373, 295, 372, 287, 373, 372, 300, 378, - /* 1390 */ 302, 85, 85, 295, 361, 357, 300, 360, 300, 277, - /* 1400 */ 302, 267, 269, 344, 316, 291, 36, 373, 370, 262, - /* 1410 */ 261, 372, 374, 319, 314, 327, 257, 107, 0, 331, - /* 1420 */ 332, 333, 334, 335, 336, 327, 338, 270, 0, 331, - /* 1430 */ 332, 333, 334, 335, 336, 337, 338, 339, 340, 259, - /* 1440 */ 267, 281, 281, 281, 176, 357, 0, 0, 42, 0, - /* 1450 */ 76, 0, 35, 186, 35, 35, 35, 186, 370, 0, - /* 1460 */ 35, 35, 374, 186, 0, 186, 0, 287, 295, 0, - /* 1470 */ 35, 0, 22, 35, 0, 295, 166, 85, 168, 171, - /* 1480 */ 300, 170, 302, 168, 166, 0, 0, 162, 161, 316, - /* 1490 */ 0, 0, 0, 259, 46, 0, 0, 145, 0, 0, - /* 1500 */ 0, 0, 0, 193, 194, 140, 0, 327, 335, 140, - /* 1510 */ 35, 331, 332, 333, 334, 335, 336, 259, 338, 0, - /* 1520 */ 0, 287, 42, 350, 351, 352, 0, 354, 0, 295, - /* 1530 */ 357, 0, 0, 0, 300, 0, 302, 0, 0, 0, - /* 1540 */ 0, 0, 0, 370, 0, 287, 0, 374, 0, 0, - /* 1550 */ 292, 0, 0, 295, 39, 375, 376, 0, 300, 0, - /* 1560 */ 302, 327, 0, 0, 0, 331, 332, 333, 334, 335, - /* 1570 */ 336, 259, 338, 56, 0, 341, 22, 56, 0, 0, - /* 1580 */ 346, 259, 14, 14, 0, 327, 43, 42, 0, 331, - /* 1590 */ 332, 333, 334, 335, 336, 0, 338, 0, 40, 287, - /* 1600 */ 39, 46, 46, 0, 292, 39, 0, 295, 0, 287, - /* 1610 */ 157, 0, 300, 0, 302, 62, 35, 295, 47, 39, - /* 1620 */ 0, 35, 300, 47, 302, 0, 39, 0, 35, 39, - /* 1630 */ 47, 259, 47, 35, 0, 39, 0, 0, 0, 327, - /* 1640 */ 35, 94, 92, 331, 332, 333, 334, 335, 336, 327, - /* 1650 */ 338, 22, 0, 331, 332, 333, 334, 335, 336, 287, - /* 1660 */ 338, 35, 43, 35, 43, 35, 35, 295, 35, 22, - /* 1670 */ 35, 0, 300, 22, 302, 35, 0, 22, 0, 22, - /* 1680 */ 35, 259, 0, 35, 0, 35, 0, 22, 49, 20, - /* 1690 */ 0, 369, 22, 259, 35, 0, 172, 0, 0, 327, - /* 1700 */ 0, 0, 0, 331, 332, 333, 334, 335, 336, 287, - /* 1710 */ 338, 181, 0, 153, 0, 43, 39, 295, 153, 95, - /* 1720 */ 150, 287, 300, 230, 302, 46, 292, 85, 153, 295, - /* 1730 */ 86, 85, 155, 46, 300, 86, 302, 43, 85, 85, - /* 1740 */ 151, 85, 43, 149, 86, 85, 43, 86, 376, 327, - /* 1750 */ 86, 85, 85, 331, 332, 333, 334, 335, 336, 85, - /* 1760 */ 338, 327, 340, 46, 230, 331, 332, 333, 334, 335, - /* 1770 */ 336, 259, 338, 85, 46, 86, 85, 43, 46, 86, - /* 1780 */ 35, 259, 86, 46, 43, 35, 35, 35, 35, 2, - /* 1790 */ 86, 224, 86, 35, 22, 193, 85, 22, 43, 287, - /* 1800 */ 35, 86, 86, 230, 292, 85, 85, 295, 86, 287, - /* 1810 */ 46, 85, 300, 46, 302, 85, 85, 295, 195, 96, - /* 1820 */ 35, 86, 300, 85, 302, 86, 35, 85, 35, 86, - /* 1830 */ 86, 259, 85, 35, 85, 35, 109, 22, 109, 327, - /* 1840 */ 35, 259, 86, 331, 332, 333, 334, 335, 336, 327, - /* 1850 */ 338, 259, 43, 331, 332, 333, 334, 335, 336, 287, - /* 1860 */ 338, 85, 85, 97, 85, 85, 109, 295, 109, 287, - /* 1870 */ 22, 61, 300, 62, 302, 68, 35, 295, 83, 287, - /* 1880 */ 43, 35, 300, 22, 302, 35, 35, 295, 35, 22, - /* 1890 */ 35, 35, 300, 68, 302, 35, 22, 35, 35, 327, - /* 1900 */ 35, 35, 0, 331, 332, 333, 334, 335, 336, 327, - /* 1910 */ 338, 35, 35, 331, 332, 333, 334, 335, 336, 327, - /* 1920 */ 338, 35, 47, 331, 332, 333, 334, 335, 336, 39, - /* 1930 */ 338, 0, 259, 35, 47, 39, 0, 0, 35, 47, - /* 1940 */ 39, 35, 47, 39, 0, 35, 35, 0, 22, 21, - /* 1950 */ 21, 259, 22, 20, 22, 379, 379, 379, 379, 379, - /* 1960 */ 287, 379, 379, 379, 379, 379, 379, 379, 295, 379, - /* 1970 */ 379, 379, 379, 300, 379, 302, 379, 379, 379, 287, - /* 1980 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, - /* 1990 */ 379, 379, 300, 379, 302, 379, 379, 379, 379, 379, - /* 2000 */ 327, 379, 379, 379, 331, 332, 333, 334, 335, 336, - /* 2010 */ 379, 338, 379, 259, 379, 379, 379, 379, 379, 327, - /* 2020 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 259, - /* 2030 */ 338, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2040 */ 379, 287, 379, 379, 379, 379, 379, 379, 379, 295, - /* 2050 */ 379, 379, 379, 379, 300, 379, 302, 287, 379, 379, - /* 2060 */ 379, 379, 379, 379, 379, 295, 379, 379, 379, 379, - /* 2070 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, - /* 2080 */ 379, 327, 259, 379, 379, 331, 332, 333, 334, 335, - /* 2090 */ 336, 379, 338, 379, 379, 379, 379, 327, 379, 259, - /* 2100 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 379, - /* 2110 */ 287, 379, 379, 379, 379, 379, 379, 379, 295, 379, - /* 2120 */ 379, 379, 379, 300, 379, 302, 379, 287, 379, 379, - /* 2130 */ 379, 379, 379, 379, 379, 295, 379, 379, 379, 379, - /* 2140 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, - /* 2150 */ 327, 379, 259, 379, 331, 332, 333, 334, 335, 336, - /* 2160 */ 379, 338, 379, 379, 259, 379, 379, 327, 379, 379, - /* 2170 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 379, - /* 2180 */ 287, 379, 379, 379, 379, 379, 379, 379, 295, 379, - /* 2190 */ 379, 379, 287, 300, 379, 302, 379, 379, 379, 379, - /* 2200 */ 295, 379, 379, 379, 379, 300, 379, 302, 379, 379, - /* 2210 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2220 */ 327, 379, 379, 379, 331, 332, 333, 334, 335, 336, - /* 2230 */ 379, 338, 327, 259, 379, 379, 331, 332, 333, 334, - /* 2240 */ 335, 336, 379, 338, 379, 379, 379, 259, 379, 379, - /* 2250 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2260 */ 379, 287, 379, 379, 379, 379, 379, 379, 379, 295, - /* 2270 */ 379, 379, 379, 379, 300, 287, 302, 379, 379, 379, - /* 2280 */ 379, 379, 379, 295, 379, 379, 379, 379, 300, 259, - /* 2290 */ 302, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2300 */ 379, 327, 379, 379, 379, 331, 332, 333, 334, 335, - /* 2310 */ 336, 379, 338, 379, 379, 327, 379, 287, 379, 331, - /* 2320 */ 332, 333, 334, 335, 336, 295, 338, 379, 379, 379, - /* 2330 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, - /* 2340 */ 379, 259, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2350 */ 379, 379, 379, 379, 379, 379, 379, 327, 379, 259, - /* 2360 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 287, - /* 2370 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, - /* 2380 */ 379, 379, 300, 259, 302, 379, 379, 287, 379, 379, - /* 2390 */ 379, 379, 379, 379, 379, 295, 379, 379, 379, 379, - /* 2400 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 327, - /* 2410 */ 379, 287, 379, 331, 332, 333, 334, 335, 336, 295, - /* 2420 */ 338, 379, 379, 379, 300, 379, 302, 327, 379, 379, - /* 2430 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 267, - /* 2440 */ 259, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2450 */ 379, 327, 379, 379, 379, 331, 332, 333, 334, 335, - /* 2460 */ 336, 379, 338, 379, 379, 379, 379, 295, 287, 379, - /* 2470 */ 379, 379, 379, 379, 379, 379, 295, 379, 379, 379, - /* 2480 */ 379, 300, 379, 302, 379, 379, 379, 379, 316, 379, - /* 2490 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2500 */ 379, 379, 379, 379, 379, 379, 379, 335, 327, 379, - /* 2510 */ 379, 379, 331, 332, 333, 334, 335, 336, 379, 338, - /* 2520 */ 379, 379, 350, 351, 352, 379, 354, 379, 379, 357, - /* 2530 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2540 */ 379, 379, 370, 379, 379, 379, 374, + /* 990 */ 213, 97, 267, 287, 85, 300, 267, 0, 267, 243, + /* 1000 */ 43, 295, 300, 278, 35, 43, 300, 278, 302, 278, + /* 1010 */ 116, 117, 118, 119, 120, 89, 43, 267, 92, 22, + /* 1020 */ 295, 35, 316, 43, 295, 267, 295, 0, 278, 288, + /* 1030 */ 86, 61, 123, 327, 56, 97, 278, 331, 332, 333, + /* 1040 */ 334, 335, 336, 86, 338, 295, 259, 341, 86, 22, + /* 1050 */ 288, 345, 346, 295, 116, 117, 118, 119, 120, 86, + /* 1060 */ 12, 13, 267, 357, 43, 87, 86, 158, 159, 160, + /* 1070 */ 22, 0, 163, 278, 287, 289, 370, 267, 169, 43, + /* 1080 */ 374, 33, 295, 35, 43, 89, 300, 300, 92, 302, + /* 1090 */ 295, 182, 89, 22, 185, 92, 187, 188, 189, 190, + /* 1100 */ 191, 192, 46, 89, 56, 295, 92, 86, 43, 43, + /* 1110 */ 1, 2, 326, 327, 327, 43, 68, 288, 331, 332, + /* 1120 */ 333, 334, 335, 336, 338, 338, 316, 86, 341, 259, + /* 1130 */ 121, 122, 345, 346, 347, 226, 43, 168, 43, 43, + /* 1140 */ 43, 85, 43, 356, 43, 335, 43, 288, 320, 85, + /* 1150 */ 260, 86, 86, 276, 168, 107, 377, 287, 86, 95, + /* 1160 */ 350, 351, 352, 193, 354, 295, 368, 357, 268, 323, + /* 1170 */ 300, 364, 302, 287, 268, 299, 266, 330, 348, 86, + /* 1180 */ 370, 86, 86, 86, 374, 86, 316, 86, 355, 86, + /* 1190 */ 325, 371, 259, 371, 358, 371, 228, 327, 20, 267, + /* 1200 */ 47, 331, 332, 333, 334, 335, 336, 324, 338, 35, + /* 1210 */ 273, 164, 42, 318, 166, 307, 168, 267, 267, 307, + /* 1220 */ 287, 148, 305, 305, 20, 267, 267, 357, 295, 20, + /* 1230 */ 267, 271, 261, 300, 259, 302, 322, 261, 302, 20, + /* 1240 */ 370, 193, 194, 271, 374, 315, 20, 20, 317, 315, + /* 1250 */ 271, 308, 271, 205, 206, 207, 208, 209, 210, 211, + /* 1260 */ 327, 271, 287, 271, 331, 332, 333, 334, 335, 336, + /* 1270 */ 295, 338, 267, 271, 341, 300, 261, 302, 345, 346, + /* 1280 */ 347, 287, 287, 247, 267, 287, 287, 287, 287, 356, + /* 1290 */ 261, 287, 269, 287, 287, 287, 322, 259, 287, 174, + /* 1300 */ 269, 267, 327, 321, 267, 150, 331, 332, 333, 334, + /* 1310 */ 335, 336, 300, 338, 269, 302, 341, 233, 300, 309, + /* 1320 */ 345, 346, 347, 269, 300, 287, 300, 311, 300, 283, + /* 1330 */ 300, 356, 269, 295, 315, 295, 311, 295, 300, 20, + /* 1340 */ 302, 308, 234, 300, 240, 157, 363, 259, 363, 300, + /* 1350 */ 330, 300, 300, 300, 316, 311, 242, 366, 365, 241, + /* 1360 */ 229, 311, 225, 295, 259, 327, 20, 246, 244, 331, + /* 1370 */ 332, 333, 334, 335, 336, 287, 338, 249, 85, 85, + /* 1380 */ 325, 291, 300, 295, 277, 363, 329, 267, 300, 36, + /* 1390 */ 302, 269, 287, 261, 362, 357, 361, 262, 319, 360, + /* 1400 */ 295, 314, 257, 344, 281, 300, 270, 302, 370, 0, + /* 1410 */ 281, 281, 374, 0, 176, 327, 0, 0, 42, 331, + /* 1420 */ 332, 333, 334, 335, 336, 259, 338, 0, 76, 341, + /* 1430 */ 0, 373, 327, 345, 346, 373, 331, 332, 333, 334, + /* 1440 */ 335, 336, 337, 338, 339, 340, 259, 372, 378, 372, + /* 1450 */ 35, 373, 372, 287, 35, 186, 35, 35, 186, 0, + /* 1460 */ 35, 295, 186, 35, 0, 186, 300, 0, 302, 35, + /* 1470 */ 0, 22, 0, 0, 287, 35, 85, 171, 170, 168, + /* 1480 */ 166, 0, 295, 0, 162, 161, 0, 300, 46, 302, + /* 1490 */ 0, 0, 42, 327, 0, 0, 0, 331, 332, 333, + /* 1500 */ 334, 335, 336, 145, 338, 0, 0, 0, 0, 0, + /* 1510 */ 140, 35, 0, 140, 327, 259, 0, 0, 331, 332, + /* 1520 */ 333, 334, 335, 336, 0, 338, 0, 259, 341, 0, + /* 1530 */ 0, 0, 0, 346, 0, 0, 0, 259, 56, 42, + /* 1540 */ 0, 375, 376, 287, 0, 0, 0, 0, 292, 0, + /* 1550 */ 0, 295, 42, 39, 56, 287, 300, 0, 302, 0, + /* 1560 */ 292, 0, 0, 295, 22, 287, 0, 0, 300, 0, + /* 1570 */ 302, 0, 0, 295, 0, 0, 43, 14, 300, 14, + /* 1580 */ 302, 40, 39, 327, 0, 46, 0, 331, 332, 333, + /* 1590 */ 334, 335, 336, 259, 338, 327, 0, 46, 157, 331, + /* 1600 */ 332, 333, 334, 335, 336, 327, 338, 259, 0, 331, + /* 1610 */ 332, 333, 334, 335, 336, 39, 338, 0, 0, 0, + /* 1620 */ 62, 287, 0, 35, 47, 0, 39, 35, 47, 295, + /* 1630 */ 39, 0, 35, 0, 300, 287, 302, 47, 39, 39, + /* 1640 */ 35, 0, 47, 295, 0, 0, 0, 369, 300, 94, + /* 1650 */ 302, 35, 92, 0, 22, 35, 43, 43, 35, 35, + /* 1660 */ 22, 327, 0, 0, 22, 331, 332, 333, 334, 335, + /* 1670 */ 336, 22, 338, 0, 22, 327, 49, 0, 35, 331, + /* 1680 */ 332, 333, 334, 335, 336, 259, 338, 0, 340, 35, + /* 1690 */ 35, 0, 22, 0, 20, 35, 0, 259, 22, 172, + /* 1700 */ 0, 153, 0, 0, 150, 0, 153, 0, 0, 153, + /* 1710 */ 376, 85, 0, 287, 86, 85, 95, 39, 292, 155, + /* 1720 */ 85, 295, 85, 43, 151, 287, 300, 149, 302, 46, + /* 1730 */ 292, 230, 85, 295, 86, 85, 46, 86, 300, 224, + /* 1740 */ 302, 46, 86, 85, 43, 86, 85, 259, 230, 181, + /* 1750 */ 85, 85, 43, 327, 86, 86, 85, 331, 332, 333, + /* 1760 */ 334, 335, 336, 43, 338, 327, 43, 86, 46, 331, + /* 1770 */ 332, 333, 334, 335, 336, 287, 338, 46, 46, 43, + /* 1780 */ 86, 35, 35, 295, 35, 86, 35, 35, 300, 35, + /* 1790 */ 302, 2, 22, 43, 193, 85, 85, 259, 22, 86, + /* 1800 */ 230, 86, 85, 46, 86, 46, 85, 195, 35, 85, + /* 1810 */ 85, 259, 96, 86, 35, 327, 86, 35, 85, 331, + /* 1820 */ 332, 333, 334, 335, 336, 287, 338, 85, 35, 86, + /* 1830 */ 85, 35, 35, 295, 97, 109, 22, 109, 300, 287, + /* 1840 */ 302, 86, 86, 85, 109, 35, 85, 295, 109, 85, + /* 1850 */ 85, 85, 300, 259, 302, 22, 43, 62, 35, 61, + /* 1860 */ 68, 83, 43, 259, 35, 327, 35, 35, 22, 331, + /* 1870 */ 332, 333, 334, 335, 336, 35, 338, 22, 35, 327, + /* 1880 */ 35, 287, 35, 331, 332, 333, 334, 335, 336, 295, + /* 1890 */ 338, 287, 68, 35, 300, 35, 302, 35, 35, 295, + /* 1900 */ 35, 22, 35, 0, 300, 35, 302, 39, 47, 0, + /* 1910 */ 35, 47, 39, 0, 0, 35, 47, 39, 35, 47, + /* 1920 */ 39, 327, 0, 35, 35, 331, 332, 333, 334, 335, + /* 1930 */ 336, 327, 338, 0, 22, 331, 332, 333, 334, 335, + /* 1940 */ 336, 259, 338, 22, 21, 20, 22, 21, 379, 379, + /* 1950 */ 379, 379, 379, 379, 379, 379, 379, 259, 379, 379, + /* 1960 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 287, + /* 1970 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, + /* 1980 */ 379, 379, 300, 379, 302, 287, 379, 379, 379, 379, + /* 1990 */ 379, 379, 379, 295, 379, 379, 379, 379, 300, 379, + /* 2000 */ 302, 379, 379, 379, 379, 379, 379, 259, 379, 327, + /* 2010 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 259, + /* 2020 */ 338, 379, 379, 379, 379, 327, 379, 379, 379, 331, + /* 2030 */ 332, 333, 334, 335, 336, 287, 338, 379, 379, 379, + /* 2040 */ 379, 379, 379, 295, 379, 379, 379, 287, 300, 379, + /* 2050 */ 302, 379, 379, 379, 379, 295, 379, 379, 379, 379, + /* 2060 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, + /* 2070 */ 379, 259, 379, 379, 379, 327, 379, 379, 379, 331, + /* 2080 */ 332, 333, 334, 335, 336, 259, 338, 327, 267, 379, + /* 2090 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 287, + /* 2100 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, + /* 2110 */ 379, 379, 300, 287, 302, 379, 295, 379, 379, 379, + /* 2120 */ 379, 295, 379, 379, 379, 379, 300, 379, 302, 379, + /* 2130 */ 379, 379, 379, 379, 379, 379, 379, 316, 379, 327, + /* 2140 */ 379, 259, 379, 331, 332, 333, 334, 335, 336, 379, + /* 2150 */ 338, 259, 379, 327, 379, 379, 335, 331, 332, 333, + /* 2160 */ 334, 335, 336, 379, 338, 379, 379, 379, 379, 287, + /* 2170 */ 379, 350, 351, 352, 379, 354, 379, 295, 357, 287, + /* 2180 */ 379, 379, 300, 379, 302, 379, 379, 295, 379, 379, + /* 2190 */ 379, 370, 300, 379, 302, 374, 379, 379, 379, 379, + /* 2200 */ 379, 259, 379, 379, 379, 379, 379, 379, 379, 327, + /* 2210 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 327, + /* 2220 */ 338, 379, 379, 331, 332, 333, 334, 335, 336, 287, + /* 2230 */ 338, 379, 379, 379, 379, 379, 379, 295, 379, 379, + /* 2240 */ 379, 379, 300, 379, 302, 379, 379, 379, 379, 379, + /* 2250 */ 379, 379, 379, 259, 379, 379, 379, 379, 379, 379, + /* 2260 */ 379, 379, 379, 379, 379, 379, 379, 259, 379, 327, + /* 2270 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 259, + /* 2280 */ 338, 287, 379, 379, 379, 379, 379, 379, 379, 295, + /* 2290 */ 379, 379, 379, 379, 300, 287, 302, 379, 379, 379, + /* 2300 */ 379, 379, 379, 295, 379, 379, 379, 287, 300, 379, + /* 2310 */ 302, 379, 379, 379, 379, 295, 379, 379, 379, 379, + /* 2320 */ 300, 327, 302, 379, 379, 331, 332, 333, 334, 335, + /* 2330 */ 336, 259, 338, 379, 379, 327, 379, 379, 379, 331, + /* 2340 */ 332, 333, 334, 335, 336, 259, 338, 327, 379, 379, + /* 2350 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 287, + /* 2360 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, + /* 2370 */ 379, 379, 300, 287, 302, 379, 379, 379, 379, 379, + /* 2380 */ 379, 295, 379, 379, 379, 379, 300, 379, 302, 379, + /* 2390 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 327, + /* 2400 */ 379, 259, 379, 331, 332, 333, 334, 335, 336, 379, + /* 2410 */ 338, 379, 379, 327, 379, 379, 379, 331, 332, 333, + /* 2420 */ 334, 335, 336, 379, 338, 379, 379, 379, 379, 287, + /* 2430 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, + /* 2440 */ 379, 379, 300, 379, 302, 379, 379, 379, 379, 379, + /* 2450 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 2460 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 327, + /* 2470 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 379, + /* 2480 */ 338, }; #define YY_SHIFT_COUNT (668) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1947) +#define YY_SHIFT_MAX (1933) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 909, 0, 0, 57, 57, 259, 259, 259, 316, 316, /* 10 */ 259, 259, 518, 575, 777, 575, 575, 575, 575, 575, /* 20 */ 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, /* 30 */ 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, - /* 40 */ 575, 575, 54, 54, 53, 53, 53, 1048, 1048, 86, - /* 50 */ 1048, 1048, 80, 418, 153, 204, 153, 19, 19, 436, - /* 60 */ 436, 100, 61, 153, 153, 19, 19, 19, 19, 19, - /* 70 */ 19, 19, 19, 19, 233, 19, 19, 19, 97, 255, - /* 80 */ 19, 19, 255, 354, 19, 255, 255, 255, 19, 444, - /* 90 */ 773, 227, 485, 485, 122, 414, 1310, 1310, 1310, 1310, - /* 100 */ 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, - /* 110 */ 1310, 1310, 1310, 1310, 1310, 303, 61, 523, 523, 287, - /* 120 */ 127, 371, 358, 358, 358, 127, 618, 97, 399, 399, - /* 130 */ 255, 255, 590, 590, 599, 736, 650, 650, 650, 650, - /* 140 */ 650, 650, 650, 972, 21, 495, 420, 150, 404, 385, - /* 150 */ 430, 637, 671, 202, 894, 248, 811, 806, 796, 806, - /* 160 */ 853, 710, 710, 710, 180, 288, 943, 1155, 1129, 1146, - /* 170 */ 1018, 1155, 1155, 1148, 1040, 1040, 1155, 1155, 1155, 1182, - /* 180 */ 1182, 1185, 233, 97, 233, 1201, 1204, 233, 1201, 233, - /* 190 */ 1210, 233, 233, 1155, 233, 1182, 255, 255, 255, 255, - /* 200 */ 255, 255, 255, 255, 255, 255, 255, 1155, 1182, 590, - /* 210 */ 1185, 444, 1108, 97, 444, 1155, 1155, 1201, 444, 1050, - /* 220 */ 590, 590, 590, 590, 1050, 590, 1135, 618, 1210, 444, - /* 230 */ 599, 444, 618, 1298, 590, 1085, 1050, 590, 590, 1085, - /* 240 */ 1050, 590, 590, 255, 1097, 1187, 1085, 1104, 1111, 1110, - /* 250 */ 943, 1123, 618, 1336, 1131, 1137, 1130, 1131, 1137, 1131, - /* 260 */ 1137, 1306, 1307, 590, 736, 1155, 444, 1370, 1182, 2547, - /* 270 */ 2547, 2547, 2547, 2547, 2547, 2547, 339, 134, 273, 579, - /* 280 */ 661, 724, 838, 921, 946, 851, 1002, 473, 51, 51, - /* 290 */ 51, 51, 51, 51, 51, 51, 698, 774, 145, 145, - /* 300 */ 359, 471, 190, 429, 585, 13, 708, 428, 673, 673, - /* 310 */ 673, 673, 84, 823, 800, 966, 973, 1014, 1016, 1023, - /* 320 */ 1049, 1057, 488, 881, 914, 1000, 1021, 1041, 1052, 1066, - /* 330 */ 1068, 1128, 1020, 206, 559, 1072, 905, 994, 1005, 1067, - /* 340 */ 990, 1074, 1083, 1101, 1103, 1105, 1107, 763, 757, 556, - /* 350 */ 1418, 1428, 1268, 1446, 1447, 1406, 1449, 1374, 1451, 1417, - /* 360 */ 1267, 1419, 1420, 1421, 1271, 1459, 1425, 1426, 1277, 1464, - /* 370 */ 1279, 1466, 1435, 1469, 1450, 1471, 1438, 1474, 1392, 1308, - /* 380 */ 1311, 1315, 1318, 1485, 1486, 1325, 1327, 1490, 1491, 1448, - /* 390 */ 1492, 1495, 1496, 1352, 1498, 1499, 1500, 1501, 1502, 1365, - /* 400 */ 1475, 1506, 1369, 1519, 1520, 1526, 1528, 1531, 1532, 1533, - /* 410 */ 1535, 1537, 1538, 1539, 1540, 1541, 1542, 1480, 1544, 1546, - /* 420 */ 1548, 1549, 1551, 1552, 1554, 1557, 1559, 1562, 1563, 1564, - /* 430 */ 1517, 1574, 1521, 1578, 1579, 1545, 1515, 1543, 1568, 1555, - /* 440 */ 1569, 1556, 1584, 1558, 1561, 1588, 1595, 1597, 1566, 1453, - /* 450 */ 1603, 1606, 1608, 1553, 1611, 1613, 1581, 1571, 1580, 1620, - /* 460 */ 1586, 1576, 1587, 1625, 1593, 1583, 1590, 1627, 1598, 1585, - /* 470 */ 1596, 1634, 1636, 1637, 1638, 1547, 1550, 1605, 1629, 1652, - /* 480 */ 1626, 1628, 1630, 1631, 1619, 1621, 1633, 1635, 1647, 1640, - /* 490 */ 1671, 1651, 1676, 1655, 1639, 1678, 1657, 1645, 1682, 1648, - /* 500 */ 1684, 1650, 1686, 1665, 1669, 1690, 1560, 1659, 1695, 1524, - /* 510 */ 1670, 1565, 1570, 1697, 1698, 1575, 1577, 1700, 1701, 1702, - /* 520 */ 1642, 1644, 1530, 1712, 1646, 1589, 1653, 1714, 1677, 1594, - /* 530 */ 1654, 1624, 1679, 1672, 1493, 1656, 1649, 1660, 1658, 1661, - /* 540 */ 1666, 1694, 1664, 1667, 1674, 1688, 1689, 1699, 1687, 1717, - /* 550 */ 1691, 1703, 1534, 1693, 1696, 1728, 1567, 1734, 1732, 1737, - /* 560 */ 1704, 1741, 1573, 1706, 1745, 1750, 1751, 1752, 1753, 1758, - /* 570 */ 1706, 1787, 1772, 1602, 1755, 1711, 1715, 1720, 1716, 1721, - /* 580 */ 1722, 1764, 1726, 1730, 1767, 1775, 1623, 1731, 1723, 1735, - /* 590 */ 1765, 1785, 1738, 1739, 1791, 1742, 1743, 1793, 1747, 1744, - /* 600 */ 1798, 1749, 1756, 1800, 1776, 1727, 1729, 1757, 1759, 1815, - /* 610 */ 1766, 1777, 1779, 1805, 1780, 1809, 1809, 1848, 1811, 1810, - /* 620 */ 1841, 1807, 1795, 1837, 1846, 1850, 1851, 1861, 1853, 1867, - /* 630 */ 1855, 1856, 1825, 1619, 1860, 1621, 1862, 1863, 1865, 1866, - /* 640 */ 1876, 1874, 1877, 1902, 1886, 1875, 1890, 1931, 1898, 1887, - /* 650 */ 1896, 1936, 1903, 1892, 1901, 1937, 1906, 1895, 1904, 1944, - /* 660 */ 1910, 1911, 1947, 1926, 1928, 1930, 1932, 1929, 1933, + /* 40 */ 575, 575, 19, 19, 78, 78, 78, 1048, 1048, 54, + /* 50 */ 1048, 1048, 147, 419, 20, 204, 20, 208, 208, 115, + /* 60 */ 115, 98, 53, 20, 20, 208, 208, 208, 208, 208, + /* 70 */ 208, 208, 208, 208, 266, 208, 208, 208, 354, 377, + /* 80 */ 208, 208, 377, 411, 208, 377, 377, 377, 208, 416, + /* 90 */ 773, 227, 485, 485, 122, 468, 468, 468, 468, 468, + /* 100 */ 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, + /* 110 */ 468, 468, 468, 468, 303, 93, 53, 332, 332, 317, + /* 120 */ 538, 379, 404, 404, 404, 538, 612, 612, 354, 819, + /* 130 */ 819, 377, 377, 797, 797, 748, 858, 650, 650, 650, + /* 140 */ 650, 650, 650, 650, 776, 21, 420, 155, 150, 194, + /* 150 */ 533, 449, 351, 644, 86, 842, 386, 491, 700, 628, + /* 160 */ 700, 897, 756, 756, 756, 349, 772, 968, 1178, 1153, + /* 170 */ 1174, 1047, 1170, 1178, 1178, 1170, 1073, 1073, 1178, 1178, + /* 180 */ 1178, 1204, 1204, 1209, 266, 354, 266, 1219, 1226, 266, + /* 190 */ 1219, 266, 1227, 266, 266, 1178, 266, 1204, 377, 377, + /* 200 */ 377, 377, 377, 377, 377, 377, 377, 377, 377, 1178, + /* 210 */ 1204, 797, 1209, 416, 1125, 354, 416, 1178, 1178, 1219, + /* 220 */ 416, 1084, 797, 797, 797, 797, 1084, 797, 1155, 612, + /* 230 */ 1227, 416, 748, 416, 612, 1319, 797, 1108, 1084, 797, + /* 240 */ 797, 1108, 1084, 797, 797, 377, 1104, 1188, 1108, 1114, + /* 250 */ 1118, 1131, 968, 1137, 612, 1346, 1121, 1124, 1128, 1121, + /* 260 */ 1124, 1121, 1124, 1293, 1294, 797, 858, 1178, 416, 1353, + /* 270 */ 1204, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 339, 134, + /* 280 */ 273, 579, 552, 465, 661, 639, 921, 724, 944, 894, + /* 290 */ 51, 51, 51, 51, 51, 51, 51, 51, 938, 697, + /* 300 */ 473, 473, 442, 91, 515, 2, 272, 13, 340, 24, + /* 310 */ 678, 678, 678, 678, 832, 360, 957, 926, 996, 1003, + /* 320 */ 1014, 997, 1027, 1071, 978, 788, 962, 973, 980, 1021, + /* 330 */ 1041, 1065, 1066, 1109, 1009, 32, 1036, 1072, 969, 986, + /* 340 */ 970, 1093, 1056, 1095, 1096, 1097, 1099, 1101, 1103, 1064, + /* 350 */ 823, 698, 1409, 1413, 1238, 1416, 1417, 1376, 1427, 1352, + /* 360 */ 1430, 1415, 1269, 1419, 1421, 1422, 1272, 1459, 1425, 1428, + /* 370 */ 1276, 1464, 1279, 1467, 1434, 1470, 1449, 1472, 1440, 1473, + /* 380 */ 1391, 1306, 1308, 1311, 1314, 1481, 1483, 1322, 1324, 1486, + /* 390 */ 1490, 1442, 1491, 1450, 1494, 1495, 1496, 1358, 1505, 1506, + /* 400 */ 1507, 1508, 1509, 1370, 1476, 1512, 1373, 1516, 1517, 1524, + /* 410 */ 1526, 1529, 1530, 1531, 1532, 1534, 1535, 1536, 1544, 1545, + /* 420 */ 1546, 1497, 1540, 1547, 1549, 1550, 1557, 1559, 1542, 1561, + /* 430 */ 1562, 1566, 1567, 1569, 1482, 1571, 1498, 1572, 1574, 1510, + /* 440 */ 1514, 1533, 1563, 1539, 1565, 1551, 1575, 1541, 1543, 1584, + /* 450 */ 1586, 1596, 1576, 1441, 1608, 1617, 1618, 1558, 1619, 1622, + /* 460 */ 1588, 1577, 1587, 1625, 1592, 1581, 1591, 1631, 1597, 1590, + /* 470 */ 1599, 1633, 1605, 1595, 1600, 1641, 1644, 1645, 1646, 1555, + /* 480 */ 1560, 1616, 1632, 1653, 1620, 1613, 1614, 1623, 1624, 1638, + /* 490 */ 1662, 1642, 1663, 1649, 1627, 1673, 1652, 1643, 1677, 1654, + /* 500 */ 1687, 1655, 1691, 1670, 1674, 1693, 1548, 1660, 1696, 1527, + /* 510 */ 1676, 1553, 1554, 1700, 1702, 1556, 1564, 1703, 1705, 1707, + /* 520 */ 1626, 1628, 1568, 1708, 1630, 1573, 1635, 1712, 1678, 1578, + /* 530 */ 1637, 1621, 1683, 1680, 1501, 1647, 1648, 1650, 1651, 1656, + /* 540 */ 1658, 1701, 1659, 1661, 1665, 1666, 1668, 1709, 1690, 1695, + /* 550 */ 1671, 1720, 1518, 1669, 1681, 1722, 1515, 1723, 1731, 1732, + /* 560 */ 1694, 1736, 1570, 1699, 1746, 1747, 1749, 1751, 1752, 1754, + /* 570 */ 1699, 1789, 1770, 1601, 1750, 1710, 1713, 1711, 1715, 1717, + /* 580 */ 1718, 1757, 1721, 1724, 1759, 1776, 1612, 1725, 1716, 1727, + /* 590 */ 1773, 1779, 1733, 1730, 1782, 1742, 1743, 1793, 1745, 1755, + /* 600 */ 1796, 1758, 1756, 1797, 1761, 1726, 1728, 1735, 1739, 1814, + /* 610 */ 1737, 1764, 1765, 1810, 1766, 1813, 1813, 1833, 1795, 1798, + /* 620 */ 1823, 1792, 1778, 1819, 1829, 1831, 1832, 1846, 1840, 1855, + /* 630 */ 1843, 1845, 1824, 1613, 1847, 1614, 1858, 1860, 1862, 1863, + /* 640 */ 1865, 1879, 1867, 1903, 1870, 1861, 1868, 1909, 1875, 1864, + /* 650 */ 1873, 1913, 1880, 1869, 1878, 1914, 1883, 1872, 1881, 1922, + /* 660 */ 1888, 1889, 1933, 1912, 1923, 1921, 1924, 1926, 1925, }; -#define YY_REDUCE_COUNT (275) +#define YY_REDUCE_COUNT (277) #define YY_REDUCE_MIN (-294) -#define YY_REDUCE_MAX (2181) +#define YY_REDUCE_MAX (2142) static const short yy_reduce_ofst[] = { - /* 0 */ -254, -201, 706, 23, 282, 787, 933, 975, 1038, 1088, - /* 10 */ 542, 877, 1098, 1180, 1234, 1258, 1312, 1322, 1372, 1422, - /* 20 */ 1434, 1512, 1028, 1522, 1572, 1582, 1592, 1673, 1692, 1754, - /* 30 */ 1770, 1823, 1840, 1893, 1905, 1974, 1988, 2030, 2082, 2100, - /* 40 */ 2124, 2181, 1173, 2172, -240, -263, -19, 207, 352, -277, - /* 50 */ 345, 813, -142, -141, -140, -79, 3, -267, 29, -260, - /* 60 */ -229, -274, -258, -143, -40, -159, 70, 285, 327, 329, - /* 70 */ 369, 370, 531, 535, -270, 541, 554, 560, -294, -272, - /* 80 */ 561, 594, 59, -257, 674, -124, 89, 270, 725, 377, - /* 90 */ -226, -219, -219, -219, -176, -247, -202, -15, 52, 63, - /* 100 */ 247, 394, 434, 507, 511, 581, 582, 626, 663, 672, - /* 110 */ 697, 748, 750, 753, 754, -158, -82, -162, -87, -262, - /* 120 */ 68, -215, 406, 589, 596, 215, 305, 379, 83, 236, - /* 130 */ 509, 298, 445, 699, 715, 469, 362, 591, 633, 640, - /* 140 */ 656, 714, 789, 631, 825, 814, 716, 744, 863, 826, - /* 150 */ 792, 850, 850, 889, 893, 862, 833, 810, 810, 810, - /* 160 */ 818, 797, 799, 802, 809, 850, 849, 911, 856, 910, - /* 170 */ 866, 918, 919, 887, 890, 891, 930, 932, 934, 939, - /* 180 */ 942, 884, 936, 915, 948, 912, 908, 955, 916, 958, - /* 190 */ 924, 965, 967, 970, 968, 979, 956, 957, 959, 960, - /* 200 */ 961, 962, 963, 964, 974, 976, 985, 978, 991, 981, - /* 210 */ 951, 1007, 969, 982, 1017, 1024, 1025, 980, 1019, 983, - /* 220 */ 993, 996, 998, 999, 989, 1001, 995, 1008, 997, 1043, - /* 230 */ 1031, 1055, 1022, 1004, 1026, 986, 1030, 1027, 1029, 987, - /* 240 */ 1032, 1035, 1036, 850, 992, 977, 988, 1006, 1033, 1037, - /* 250 */ 1042, 810, 1058, 1051, 1009, 1012, 1011, 1013, 1015, 1034, - /* 260 */ 1039, 1059, 1114, 1096, 1122, 1134, 1133, 1147, 1149, 1094, - /* 270 */ 1100, 1160, 1161, 1162, 1157, 1159, + /* 0 */ -254, -201, 706, 23, 282, 787, 933, 975, 870, 1038, + /* 10 */ 547, 1088, 1105, 1166, 1187, 1256, 1268, 1278, 1334, 1348, + /* 20 */ 1426, 1438, 1488, 1538, 1552, 1594, 1604, 1682, 1698, 1748, + /* 30 */ 1760, 1812, 1826, 1882, 1892, 1942, 1994, 2008, 2020, 2072, + /* 40 */ 2086, 2142, 810, 1821, -240, -263, -19, 207, 263, -277, + /* 50 */ 254, 786, -140, -79, 321, 451, 480, -267, 52, -260, + /* 60 */ -229, -274, -258, 237, 315, 67, 100, 277, 326, 560, + /* 70 */ 573, 581, 594, 677, -270, 725, 729, 731, -294, -272, + /* 80 */ 750, 758, -72, -257, 795, 260, 89, 392, 540, 280, + /* 90 */ -226, -219, -219, -219, -176, -118, 48, 63, 140, 192, + /* 100 */ 195, 346, 365, 383, 511, 539, 543, 546, 567, 631, + /* 110 */ 662, 663, 695, 702, 251, -247, -117, -210, -87, -262, + /* 120 */ 461, -152, -42, 413, 542, 471, -10, 196, 283, -65, + /* 130 */ 345, -126, 549, 390, 504, 590, 589, 568, 660, 676, + /* 140 */ 741, 762, 829, 859, 828, 890, 779, 877, 798, 900, + /* 150 */ 846, 807, 886, 886, 906, 910, 876, 847, 833, 833, + /* 160 */ 833, 830, 820, 822, 824, 836, 886, 865, 932, 883, + /* 170 */ 937, 895, 908, 950, 951, 912, 917, 918, 958, 959, + /* 180 */ 963, 971, 976, 914, 960, 936, 972, 930, 931, 979, + /* 190 */ 934, 981, 943, 990, 992, 1005, 1002, 1015, 994, 995, + /* 200 */ 998, 999, 1000, 1001, 1004, 1006, 1007, 1008, 1011, 1017, + /* 210 */ 1029, 1012, 974, 1023, 982, 1013, 1031, 1034, 1037, 1019, + /* 220 */ 1045, 1016, 1018, 1024, 1026, 1028, 1025, 1030, 1010, 1040, + /* 230 */ 1033, 1054, 1046, 1063, 1042, 1020, 1043, 983, 1044, 1049, + /* 240 */ 1051, 985, 1050, 1052, 1053, 886, 991, 993, 1022, 1032, + /* 250 */ 1035, 1039, 1055, 833, 1068, 1057, 1058, 1075, 1070, 1062, + /* 260 */ 1077, 1078, 1080, 1059, 1090, 1082, 1107, 1120, 1122, 1135, + /* 270 */ 1132, 1079, 1087, 1123, 1129, 1130, 1136, 1145, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 10 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 20 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 30 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 40 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 50 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 60 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 70 */ 1465, 1465, 1465, 1465, 1539, 1465, 1465, 1465, 1465, 1465, - /* 80 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1537, - /* 90 */ 1692, 1465, 1872, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 100 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1539, - /* 120 */ 1465, 1537, 1884, 1884, 1884, 1465, 1465, 1465, 1736, 1736, - /* 130 */ 1465, 1465, 1465, 1465, 1635, 1465, 1465, 1465, 1465, 1465, - /* 140 */ 1465, 1465, 1465, 1728, 1465, 1465, 1953, 1465, 1465, 1734, - /* 150 */ 1907, 1465, 1465, 1465, 1465, 1588, 1899, 1876, 1890, 1877, - /* 160 */ 1874, 1938, 1938, 1938, 1893, 1465, 1903, 1465, 1465, 1465, - /* 170 */ 1720, 1465, 1465, 1697, 1694, 1694, 1465, 1465, 1465, 1465, - /* 180 */ 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465, 1539, - /* 190 */ 1465, 1539, 1539, 1465, 1539, 1465, 1465, 1465, 1465, 1465, - /* 200 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 210 */ 1465, 1537, 1730, 1465, 1537, 1465, 1465, 1465, 1537, 1912, - /* 220 */ 1465, 1465, 1465, 1465, 1912, 1465, 1465, 1465, 1465, 1537, - /* 230 */ 1465, 1537, 1465, 1465, 1465, 1914, 1912, 1465, 1465, 1914, - /* 240 */ 1912, 1465, 1465, 1465, 1926, 1922, 1914, 1930, 1928, 1905, - /* 250 */ 1903, 1890, 1465, 1465, 1944, 1940, 1956, 1944, 1940, 1944, - /* 260 */ 1940, 1465, 1604, 1465, 1465, 1465, 1537, 1497, 1465, 1722, - /* 270 */ 1736, 1638, 1638, 1638, 1540, 1470, 1465, 1465, 1465, 1465, - /* 280 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1809, 1925, - /* 290 */ 1924, 1848, 1847, 1846, 1844, 1808, 1465, 1600, 1807, 1806, - /* 300 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1800, 1801, - /* 310 */ 1799, 1798, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 320 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 330 */ 1465, 1873, 1465, 1941, 1945, 1465, 1465, 1465, 1465, 1465, - /* 340 */ 1783, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 350 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 360 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 370 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 380 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 390 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 400 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 410 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 420 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 430 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1502, 1465, 1465, - /* 440 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 450 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 460 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 470 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 480 */ 1465, 1465, 1465, 1465, 1569, 1568, 1465, 1465, 1465, 1465, - /* 490 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 500 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 510 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 520 */ 1465, 1465, 1465, 1740, 1465, 1465, 1465, 1465, 1465, 1465, - /* 530 */ 1465, 1465, 1465, 1906, 1465, 1465, 1465, 1465, 1465, 1465, - /* 540 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1783, - /* 550 */ 1465, 1923, 1465, 1883, 1879, 1465, 1465, 1875, 1782, 1465, - /* 560 */ 1465, 1939, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 570 */ 1465, 1868, 1465, 1465, 1841, 1826, 1465, 1465, 1465, 1465, - /* 580 */ 1465, 1465, 1465, 1465, 1465, 1465, 1794, 1465, 1465, 1465, - /* 590 */ 1465, 1465, 1632, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 600 */ 1465, 1465, 1465, 1465, 1465, 1617, 1615, 1614, 1613, 1465, - /* 610 */ 1610, 1465, 1465, 1465, 1465, 1641, 1640, 1465, 1465, 1465, - /* 620 */ 1465, 1465, 1465, 1560, 1465, 1465, 1465, 1465, 1465, 1465, - /* 630 */ 1465, 1465, 1465, 1551, 1465, 1550, 1465, 1465, 1465, 1465, - /* 640 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 650 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, - /* 660 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 0 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 10 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 20 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 30 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 40 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 50 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 60 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 70 */ 1458, 1458, 1458, 1458, 1532, 1458, 1458, 1458, 1458, 1458, + /* 80 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1530, + /* 90 */ 1682, 1458, 1862, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 100 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 110 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1532, + /* 120 */ 1458, 1530, 1874, 1874, 1874, 1458, 1458, 1458, 1458, 1726, + /* 130 */ 1726, 1458, 1458, 1458, 1458, 1624, 1458, 1458, 1458, 1458, + /* 140 */ 1458, 1458, 1458, 1458, 1718, 1458, 1943, 1458, 1458, 1458, + /* 150 */ 1724, 1897, 1458, 1458, 1458, 1458, 1577, 1889, 1866, 1880, + /* 160 */ 1867, 1864, 1928, 1928, 1928, 1883, 1458, 1893, 1458, 1458, + /* 170 */ 1458, 1710, 1687, 1458, 1458, 1687, 1684, 1684, 1458, 1458, + /* 180 */ 1458, 1458, 1458, 1458, 1532, 1458, 1532, 1458, 1458, 1532, + /* 190 */ 1458, 1532, 1458, 1532, 1532, 1458, 1532, 1458, 1458, 1458, + /* 200 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 210 */ 1458, 1458, 1458, 1530, 1720, 1458, 1530, 1458, 1458, 1458, + /* 220 */ 1530, 1902, 1458, 1458, 1458, 1458, 1902, 1458, 1458, 1458, + /* 230 */ 1458, 1530, 1458, 1530, 1458, 1458, 1458, 1904, 1902, 1458, + /* 240 */ 1458, 1904, 1902, 1458, 1458, 1458, 1916, 1912, 1904, 1920, + /* 250 */ 1918, 1895, 1893, 1880, 1458, 1458, 1934, 1930, 1946, 1934, + /* 260 */ 1930, 1934, 1930, 1458, 1593, 1458, 1458, 1458, 1530, 1490, + /* 270 */ 1458, 1712, 1726, 1627, 1627, 1627, 1533, 1463, 1458, 1458, + /* 280 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 290 */ 1799, 1915, 1914, 1838, 1837, 1836, 1834, 1798, 1458, 1589, + /* 300 */ 1797, 1796, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 310 */ 1790, 1791, 1789, 1788, 1458, 1458, 1458, 1458, 1458, 1458, + /* 320 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 330 */ 1458, 1458, 1458, 1863, 1458, 1931, 1935, 1458, 1458, 1458, + /* 340 */ 1458, 1458, 1773, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 350 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 360 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 370 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 380 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 390 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 400 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 410 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 420 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 430 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 440 */ 1458, 1495, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 450 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 460 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 470 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 480 */ 1458, 1458, 1458, 1458, 1458, 1561, 1560, 1458, 1458, 1458, + /* 490 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 500 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 510 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 520 */ 1458, 1458, 1458, 1730, 1458, 1458, 1458, 1458, 1458, 1458, + /* 530 */ 1458, 1458, 1458, 1896, 1458, 1458, 1458, 1458, 1458, 1458, + /* 540 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1773, + /* 550 */ 1458, 1913, 1458, 1873, 1869, 1458, 1458, 1865, 1772, 1458, + /* 560 */ 1458, 1929, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 570 */ 1458, 1858, 1458, 1458, 1831, 1816, 1458, 1458, 1458, 1458, + /* 580 */ 1458, 1458, 1458, 1458, 1458, 1458, 1784, 1458, 1458, 1458, + /* 590 */ 1458, 1458, 1621, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 600 */ 1458, 1458, 1458, 1458, 1458, 1606, 1604, 1603, 1602, 1458, + /* 610 */ 1599, 1458, 1458, 1458, 1458, 1630, 1629, 1458, 1458, 1458, + /* 620 */ 1458, 1458, 1458, 1553, 1458, 1458, 1458, 1458, 1458, 1458, + /* 630 */ 1458, 1458, 1458, 1544, 1458, 1543, 1458, 1458, 1458, 1458, + /* 640 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 650 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 660 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1748,401 +1736,398 @@ static const char *const yyRuleName[] = { /* 93 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", /* 94 */ "alter_db_options ::= alter_db_option", /* 95 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 96 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 97 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 98 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 99 */ "alter_db_option ::= FSYNC NK_INTEGER", - /* 100 */ "alter_db_option ::= KEEP integer_list", - /* 101 */ "alter_db_option ::= KEEP variable_list", - /* 102 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 103 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 104 */ "alter_db_option ::= STRICT NK_INTEGER", - /* 105 */ "alter_db_option ::= WAL NK_INTEGER", - /* 106 */ "integer_list ::= NK_INTEGER", - /* 107 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 108 */ "variable_list ::= NK_VARIABLE", - /* 109 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 110 */ "retention_list ::= retention", - /* 111 */ "retention_list ::= retention_list NK_COMMA retention", - /* 112 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 113 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 114 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 115 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 116 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 117 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 118 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 119 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 120 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 121 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 122 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 123 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 124 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 125 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 126 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 127 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 128 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 129 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 130 */ "multi_create_clause ::= create_subtable_clause", - /* 131 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 132 */ "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", - /* 133 */ "multi_drop_clause ::= drop_table_clause", - /* 134 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 135 */ "drop_table_clause ::= exists_opt full_table_name", - /* 136 */ "specific_cols_opt ::=", - /* 137 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 138 */ "full_table_name ::= table_name", - /* 139 */ "full_table_name ::= db_name NK_DOT table_name", - /* 140 */ "column_def_list ::= column_def", - /* 141 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 142 */ "column_def ::= column_name type_name", - /* 143 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 144 */ "type_name ::= BOOL", - /* 145 */ "type_name ::= TINYINT", - /* 146 */ "type_name ::= SMALLINT", - /* 147 */ "type_name ::= INT", - /* 148 */ "type_name ::= INTEGER", - /* 149 */ "type_name ::= BIGINT", - /* 150 */ "type_name ::= FLOAT", - /* 151 */ "type_name ::= DOUBLE", - /* 152 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 153 */ "type_name ::= TIMESTAMP", - /* 154 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 155 */ "type_name ::= TINYINT UNSIGNED", - /* 156 */ "type_name ::= SMALLINT UNSIGNED", - /* 157 */ "type_name ::= INT UNSIGNED", - /* 158 */ "type_name ::= BIGINT UNSIGNED", - /* 159 */ "type_name ::= JSON", - /* 160 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 161 */ "type_name ::= MEDIUMBLOB", - /* 162 */ "type_name ::= BLOB", - /* 163 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 164 */ "type_name ::= DECIMAL", - /* 165 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 166 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 167 */ "tags_def_opt ::=", - /* 168 */ "tags_def_opt ::= tags_def", - /* 169 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 170 */ "table_options ::=", - /* 171 */ "table_options ::= table_options COMMENT NK_STRING", - /* 172 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 173 */ "table_options ::= table_options WATERMARK duration_list", - /* 174 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 175 */ "table_options ::= table_options TTL NK_INTEGER", - /* 176 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 177 */ "alter_table_options ::= alter_table_option", - /* 178 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 179 */ "alter_table_option ::= COMMENT NK_STRING", - /* 180 */ "alter_table_option ::= TTL NK_INTEGER", - /* 181 */ "duration_list ::= duration_literal", - /* 182 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 183 */ "rollup_func_list ::= rollup_func_name", - /* 184 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 185 */ "rollup_func_name ::= function_name", - /* 186 */ "rollup_func_name ::= FIRST", - /* 187 */ "rollup_func_name ::= LAST", - /* 188 */ "col_name_list ::= col_name", - /* 189 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 190 */ "col_name ::= column_name", - /* 191 */ "cmd ::= SHOW DNODES", - /* 192 */ "cmd ::= SHOW USERS", - /* 193 */ "cmd ::= SHOW DATABASES", - /* 194 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 195 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 196 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 197 */ "cmd ::= SHOW MNODES", - /* 198 */ "cmd ::= SHOW MODULES", - /* 199 */ "cmd ::= SHOW QNODES", - /* 200 */ "cmd ::= SHOW FUNCTIONS", - /* 201 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 202 */ "cmd ::= SHOW STREAMS", - /* 203 */ "cmd ::= SHOW ACCOUNTS", - /* 204 */ "cmd ::= SHOW APPS", - /* 205 */ "cmd ::= SHOW CONNECTIONS", - /* 206 */ "cmd ::= SHOW LICENCE", - /* 207 */ "cmd ::= SHOW GRANTS", - /* 208 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 209 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 210 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 211 */ "cmd ::= SHOW QUERIES", - /* 212 */ "cmd ::= SHOW SCORES", - /* 213 */ "cmd ::= SHOW TOPICS", - /* 214 */ "cmd ::= SHOW VARIABLES", - /* 215 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 216 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", - /* 217 */ "cmd ::= SHOW BNODES", - /* 218 */ "cmd ::= SHOW SNODES", - /* 219 */ "cmd ::= SHOW CLUSTER", - /* 220 */ "cmd ::= SHOW TRANSACTIONS", - /* 221 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 222 */ "cmd ::= SHOW CONSUMERS", - /* 223 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 224 */ "db_name_cond_opt ::=", - /* 225 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 226 */ "like_pattern_opt ::=", - /* 227 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 228 */ "table_name_cond ::= table_name", - /* 229 */ "from_db_opt ::=", - /* 230 */ "from_db_opt ::= FROM db_name", - /* 231 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 232 */ "cmd ::= DROP INDEX exists_opt index_name", - /* 233 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 234 */ "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", - /* 235 */ "func_list ::= func", - /* 236 */ "func_list ::= func_list NK_COMMA func", - /* 237 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 238 */ "sma_stream_opt ::=", - /* 239 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", - /* 240 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", - /* 241 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 242 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 243 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 244 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 245 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 246 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 247 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 248 */ "cmd ::= DESC full_table_name", - /* 249 */ "cmd ::= DESCRIBE full_table_name", - /* 250 */ "cmd ::= RESET QUERY CACHE", - /* 251 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 252 */ "analyze_opt ::=", - /* 253 */ "analyze_opt ::= ANALYZE", - /* 254 */ "explain_options ::=", - /* 255 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 256 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 257 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 258 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 259 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 260 */ "agg_func_opt ::=", - /* 261 */ "agg_func_opt ::= AGGREGATE", - /* 262 */ "bufsize_opt ::=", - /* 263 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 264 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", - /* 265 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 266 */ "into_opt ::=", - /* 267 */ "into_opt ::= INTO full_table_name", - /* 268 */ "stream_options ::=", - /* 269 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 270 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 271 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 272 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 273 */ "stream_options ::= stream_options IGNORE EXPIRED", - /* 274 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 275 */ "cmd ::= KILL QUERY NK_STRING", - /* 276 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 277 */ "cmd ::= BALANCE VGROUP", - /* 278 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 279 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 280 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 281 */ "dnode_list ::= DNODE NK_INTEGER", - /* 282 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 283 */ "cmd ::= SYNCDB db_name REPLICA", - /* 284 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 285 */ "cmd ::= query_expression", - /* 286 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression", - /* 287 */ "cmd ::= INSERT INTO full_table_name query_expression", - /* 288 */ "literal ::= NK_INTEGER", - /* 289 */ "literal ::= NK_FLOAT", - /* 290 */ "literal ::= NK_STRING", - /* 291 */ "literal ::= NK_BOOL", - /* 292 */ "literal ::= TIMESTAMP NK_STRING", - /* 293 */ "literal ::= duration_literal", - /* 294 */ "literal ::= NULL", - /* 295 */ "literal ::= NK_QUESTION", - /* 296 */ "duration_literal ::= NK_VARIABLE", - /* 297 */ "signed ::= NK_INTEGER", - /* 298 */ "signed ::= NK_PLUS NK_INTEGER", - /* 299 */ "signed ::= NK_MINUS NK_INTEGER", - /* 300 */ "signed ::= NK_FLOAT", - /* 301 */ "signed ::= NK_PLUS NK_FLOAT", - /* 302 */ "signed ::= NK_MINUS NK_FLOAT", - /* 303 */ "signed_literal ::= signed", - /* 304 */ "signed_literal ::= NK_STRING", - /* 305 */ "signed_literal ::= NK_BOOL", - /* 306 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 307 */ "signed_literal ::= duration_literal", - /* 308 */ "signed_literal ::= NULL", - /* 309 */ "signed_literal ::= literal_func", - /* 310 */ "signed_literal ::= NK_QUESTION", - /* 311 */ "literal_list ::= signed_literal", - /* 312 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 313 */ "db_name ::= NK_ID", - /* 314 */ "table_name ::= NK_ID", - /* 315 */ "column_name ::= NK_ID", - /* 316 */ "function_name ::= NK_ID", - /* 317 */ "table_alias ::= NK_ID", - /* 318 */ "column_alias ::= NK_ID", - /* 319 */ "user_name ::= NK_ID", - /* 320 */ "index_name ::= NK_ID", - /* 321 */ "topic_name ::= NK_ID", - /* 322 */ "stream_name ::= NK_ID", - /* 323 */ "cgroup_name ::= NK_ID", - /* 324 */ "expression ::= literal", - /* 325 */ "expression ::= pseudo_column", - /* 326 */ "expression ::= column_reference", - /* 327 */ "expression ::= function_expression", - /* 328 */ "expression ::= subquery", - /* 329 */ "expression ::= NK_LP expression NK_RP", - /* 330 */ "expression ::= NK_PLUS expression", - /* 331 */ "expression ::= NK_MINUS expression", - /* 332 */ "expression ::= expression NK_PLUS expression", - /* 333 */ "expression ::= expression NK_MINUS expression", - /* 334 */ "expression ::= expression NK_STAR expression", - /* 335 */ "expression ::= expression NK_SLASH expression", - /* 336 */ "expression ::= expression NK_REM expression", - /* 337 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 338 */ "expression ::= expression NK_BITAND expression", - /* 339 */ "expression ::= expression NK_BITOR expression", - /* 340 */ "expression_list ::= expression", - /* 341 */ "expression_list ::= expression_list NK_COMMA expression", - /* 342 */ "column_reference ::= column_name", - /* 343 */ "column_reference ::= table_name NK_DOT column_name", - /* 344 */ "pseudo_column ::= ROWTS", - /* 345 */ "pseudo_column ::= TBNAME", - /* 346 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 347 */ "pseudo_column ::= QSTART", - /* 348 */ "pseudo_column ::= QEND", - /* 349 */ "pseudo_column ::= QDURATION", - /* 350 */ "pseudo_column ::= WSTART", - /* 351 */ "pseudo_column ::= WEND", - /* 352 */ "pseudo_column ::= WDURATION", - /* 353 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 354 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 355 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 356 */ "function_expression ::= literal_func", - /* 357 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 358 */ "literal_func ::= NOW", - /* 359 */ "noarg_func ::= NOW", - /* 360 */ "noarg_func ::= TODAY", - /* 361 */ "noarg_func ::= TIMEZONE", - /* 362 */ "noarg_func ::= DATABASE", - /* 363 */ "noarg_func ::= CLIENT_VERSION", - /* 364 */ "noarg_func ::= SERVER_VERSION", - /* 365 */ "noarg_func ::= SERVER_STATUS", - /* 366 */ "noarg_func ::= CURRENT_USER", - /* 367 */ "noarg_func ::= USER", - /* 368 */ "star_func ::= COUNT", - /* 369 */ "star_func ::= FIRST", - /* 370 */ "star_func ::= LAST", - /* 371 */ "star_func ::= LAST_ROW", - /* 372 */ "star_func_para_list ::= NK_STAR", - /* 373 */ "star_func_para_list ::= other_para_list", - /* 374 */ "other_para_list ::= star_func_para", - /* 375 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 376 */ "star_func_para ::= expression", - /* 377 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 378 */ "predicate ::= expression compare_op expression", - /* 379 */ "predicate ::= expression BETWEEN expression AND expression", - /* 380 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 381 */ "predicate ::= expression IS NULL", - /* 382 */ "predicate ::= expression IS NOT NULL", - /* 383 */ "predicate ::= expression in_op in_predicate_value", - /* 384 */ "compare_op ::= NK_LT", - /* 385 */ "compare_op ::= NK_GT", - /* 386 */ "compare_op ::= NK_LE", - /* 387 */ "compare_op ::= NK_GE", - /* 388 */ "compare_op ::= NK_NE", - /* 389 */ "compare_op ::= NK_EQ", - /* 390 */ "compare_op ::= LIKE", - /* 391 */ "compare_op ::= NOT LIKE", - /* 392 */ "compare_op ::= MATCH", - /* 393 */ "compare_op ::= NMATCH", - /* 394 */ "compare_op ::= CONTAINS", - /* 395 */ "in_op ::= IN", - /* 396 */ "in_op ::= NOT IN", - /* 397 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 398 */ "boolean_value_expression ::= boolean_primary", - /* 399 */ "boolean_value_expression ::= NOT boolean_primary", - /* 400 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 401 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 402 */ "boolean_primary ::= predicate", - /* 403 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 404 */ "common_expression ::= expression", - /* 405 */ "common_expression ::= boolean_value_expression", - /* 406 */ "from_clause_opt ::=", - /* 407 */ "from_clause_opt ::= FROM table_reference_list", - /* 408 */ "table_reference_list ::= table_reference", - /* 409 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 410 */ "table_reference ::= table_primary", - /* 411 */ "table_reference ::= joined_table", - /* 412 */ "table_primary ::= table_name alias_opt", - /* 413 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 414 */ "table_primary ::= subquery alias_opt", - /* 415 */ "table_primary ::= parenthesized_joined_table", - /* 416 */ "alias_opt ::=", - /* 417 */ "alias_opt ::= table_alias", - /* 418 */ "alias_opt ::= AS table_alias", - /* 419 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 420 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 421 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 422 */ "join_type ::=", - /* 423 */ "join_type ::= INNER", - /* 424 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 425 */ "set_quantifier_opt ::=", - /* 426 */ "set_quantifier_opt ::= DISTINCT", - /* 427 */ "set_quantifier_opt ::= ALL", - /* 428 */ "select_list ::= select_item", - /* 429 */ "select_list ::= select_list NK_COMMA select_item", - /* 430 */ "select_item ::= NK_STAR", - /* 431 */ "select_item ::= common_expression", - /* 432 */ "select_item ::= common_expression column_alias", - /* 433 */ "select_item ::= common_expression AS column_alias", - /* 434 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 435 */ "where_clause_opt ::=", - /* 436 */ "where_clause_opt ::= WHERE search_condition", - /* 437 */ "partition_by_clause_opt ::=", - /* 438 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 439 */ "twindow_clause_opt ::=", - /* 440 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 441 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 442 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 443 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 444 */ "sliding_opt ::=", - /* 445 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 446 */ "fill_opt ::=", - /* 447 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 448 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 449 */ "fill_mode ::= NONE", - /* 450 */ "fill_mode ::= PREV", - /* 451 */ "fill_mode ::= NULL", - /* 452 */ "fill_mode ::= LINEAR", - /* 453 */ "fill_mode ::= NEXT", - /* 454 */ "group_by_clause_opt ::=", - /* 455 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 456 */ "group_by_list ::= expression", - /* 457 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 458 */ "having_clause_opt ::=", - /* 459 */ "having_clause_opt ::= HAVING search_condition", - /* 460 */ "range_opt ::=", - /* 461 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 462 */ "every_opt ::=", - /* 463 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 464 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 465 */ "query_expression_body ::= query_primary", - /* 466 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 467 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 468 */ "query_primary ::= query_specification", - /* 469 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 470 */ "order_by_clause_opt ::=", - /* 471 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 472 */ "slimit_clause_opt ::=", - /* 473 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 474 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 475 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 476 */ "limit_clause_opt ::=", - /* 477 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 478 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 479 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 480 */ "subquery ::= NK_LP query_expression NK_RP", - /* 481 */ "search_condition ::= common_expression", - /* 482 */ "sort_specification_list ::= sort_specification", - /* 483 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 484 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 485 */ "ordering_specification_opt ::=", - /* 486 */ "ordering_specification_opt ::= ASC", - /* 487 */ "ordering_specification_opt ::= DESC", - /* 488 */ "null_ordering_opt ::=", - /* 489 */ "null_ordering_opt ::= NULLS FIRST", - /* 490 */ "null_ordering_opt ::= NULLS LAST", + /* 96 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 97 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 98 */ "alter_db_option ::= FSYNC NK_INTEGER", + /* 99 */ "alter_db_option ::= KEEP integer_list", + /* 100 */ "alter_db_option ::= KEEP variable_list", + /* 101 */ "alter_db_option ::= WAL NK_INTEGER", + /* 102 */ "integer_list ::= NK_INTEGER", + /* 103 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 104 */ "variable_list ::= NK_VARIABLE", + /* 105 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 106 */ "retention_list ::= retention", + /* 107 */ "retention_list ::= retention_list NK_COMMA retention", + /* 108 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 109 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 110 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 111 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 112 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 113 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 114 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 115 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 116 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 117 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 118 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 119 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 120 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 121 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 122 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 123 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 124 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 125 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 126 */ "multi_create_clause ::= create_subtable_clause", + /* 127 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 128 */ "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", + /* 129 */ "multi_drop_clause ::= drop_table_clause", + /* 130 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 131 */ "drop_table_clause ::= exists_opt full_table_name", + /* 132 */ "specific_cols_opt ::=", + /* 133 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 134 */ "full_table_name ::= table_name", + /* 135 */ "full_table_name ::= db_name NK_DOT table_name", + /* 136 */ "column_def_list ::= column_def", + /* 137 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 138 */ "column_def ::= column_name type_name", + /* 139 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 140 */ "type_name ::= BOOL", + /* 141 */ "type_name ::= TINYINT", + /* 142 */ "type_name ::= SMALLINT", + /* 143 */ "type_name ::= INT", + /* 144 */ "type_name ::= INTEGER", + /* 145 */ "type_name ::= BIGINT", + /* 146 */ "type_name ::= FLOAT", + /* 147 */ "type_name ::= DOUBLE", + /* 148 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 149 */ "type_name ::= TIMESTAMP", + /* 150 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 151 */ "type_name ::= TINYINT UNSIGNED", + /* 152 */ "type_name ::= SMALLINT UNSIGNED", + /* 153 */ "type_name ::= INT UNSIGNED", + /* 154 */ "type_name ::= BIGINT UNSIGNED", + /* 155 */ "type_name ::= JSON", + /* 156 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 157 */ "type_name ::= MEDIUMBLOB", + /* 158 */ "type_name ::= BLOB", + /* 159 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 160 */ "type_name ::= DECIMAL", + /* 161 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 162 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 163 */ "tags_def_opt ::=", + /* 164 */ "tags_def_opt ::= tags_def", + /* 165 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 166 */ "table_options ::=", + /* 167 */ "table_options ::= table_options COMMENT NK_STRING", + /* 168 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 169 */ "table_options ::= table_options WATERMARK duration_list", + /* 170 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 171 */ "table_options ::= table_options TTL NK_INTEGER", + /* 172 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 173 */ "alter_table_options ::= alter_table_option", + /* 174 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 175 */ "alter_table_option ::= COMMENT NK_STRING", + /* 176 */ "alter_table_option ::= TTL NK_INTEGER", + /* 177 */ "duration_list ::= duration_literal", + /* 178 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 179 */ "rollup_func_list ::= rollup_func_name", + /* 180 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 181 */ "rollup_func_name ::= function_name", + /* 182 */ "rollup_func_name ::= FIRST", + /* 183 */ "rollup_func_name ::= LAST", + /* 184 */ "col_name_list ::= col_name", + /* 185 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 186 */ "col_name ::= column_name", + /* 187 */ "cmd ::= SHOW DNODES", + /* 188 */ "cmd ::= SHOW USERS", + /* 189 */ "cmd ::= SHOW DATABASES", + /* 190 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 191 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 192 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 193 */ "cmd ::= SHOW MNODES", + /* 194 */ "cmd ::= SHOW MODULES", + /* 195 */ "cmd ::= SHOW QNODES", + /* 196 */ "cmd ::= SHOW FUNCTIONS", + /* 197 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 198 */ "cmd ::= SHOW STREAMS", + /* 199 */ "cmd ::= SHOW ACCOUNTS", + /* 200 */ "cmd ::= SHOW APPS", + /* 201 */ "cmd ::= SHOW CONNECTIONS", + /* 202 */ "cmd ::= SHOW LICENCE", + /* 203 */ "cmd ::= SHOW GRANTS", + /* 204 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 205 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 206 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 207 */ "cmd ::= SHOW QUERIES", + /* 208 */ "cmd ::= SHOW SCORES", + /* 209 */ "cmd ::= SHOW TOPICS", + /* 210 */ "cmd ::= SHOW VARIABLES", + /* 211 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 212 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", + /* 213 */ "cmd ::= SHOW BNODES", + /* 214 */ "cmd ::= SHOW SNODES", + /* 215 */ "cmd ::= SHOW CLUSTER", + /* 216 */ "cmd ::= SHOW TRANSACTIONS", + /* 217 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 218 */ "cmd ::= SHOW CONSUMERS", + /* 219 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 220 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 221 */ "db_name_cond_opt ::=", + /* 222 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 223 */ "like_pattern_opt ::=", + /* 224 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 225 */ "table_name_cond ::= table_name", + /* 226 */ "from_db_opt ::=", + /* 227 */ "from_db_opt ::= FROM db_name", + /* 228 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 229 */ "cmd ::= DROP INDEX exists_opt index_name", + /* 230 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 231 */ "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", + /* 232 */ "func_list ::= func", + /* 233 */ "func_list ::= func_list NK_COMMA func", + /* 234 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 235 */ "sma_stream_opt ::=", + /* 236 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", + /* 237 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", + /* 238 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 239 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 240 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 241 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 242 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 243 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 244 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 245 */ "cmd ::= DESC full_table_name", + /* 246 */ "cmd ::= DESCRIBE full_table_name", + /* 247 */ "cmd ::= RESET QUERY CACHE", + /* 248 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 249 */ "analyze_opt ::=", + /* 250 */ "analyze_opt ::= ANALYZE", + /* 251 */ "explain_options ::=", + /* 252 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 253 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 254 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 255 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 256 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 257 */ "agg_func_opt ::=", + /* 258 */ "agg_func_opt ::= AGGREGATE", + /* 259 */ "bufsize_opt ::=", + /* 260 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 261 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", + /* 262 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 263 */ "into_opt ::=", + /* 264 */ "into_opt ::= INTO full_table_name", + /* 265 */ "stream_options ::=", + /* 266 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 267 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 268 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 269 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 270 */ "stream_options ::= stream_options IGNORE EXPIRED", + /* 271 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 272 */ "cmd ::= KILL QUERY NK_STRING", + /* 273 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 274 */ "cmd ::= BALANCE VGROUP", + /* 275 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 276 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 277 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 278 */ "dnode_list ::= DNODE NK_INTEGER", + /* 279 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 280 */ "cmd ::= SYNCDB db_name REPLICA", + /* 281 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 282 */ "cmd ::= query_expression", + /* 283 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression", + /* 284 */ "cmd ::= INSERT INTO full_table_name query_expression", + /* 285 */ "literal ::= NK_INTEGER", + /* 286 */ "literal ::= NK_FLOAT", + /* 287 */ "literal ::= NK_STRING", + /* 288 */ "literal ::= NK_BOOL", + /* 289 */ "literal ::= TIMESTAMP NK_STRING", + /* 290 */ "literal ::= duration_literal", + /* 291 */ "literal ::= NULL", + /* 292 */ "literal ::= NK_QUESTION", + /* 293 */ "duration_literal ::= NK_VARIABLE", + /* 294 */ "signed ::= NK_INTEGER", + /* 295 */ "signed ::= NK_PLUS NK_INTEGER", + /* 296 */ "signed ::= NK_MINUS NK_INTEGER", + /* 297 */ "signed ::= NK_FLOAT", + /* 298 */ "signed ::= NK_PLUS NK_FLOAT", + /* 299 */ "signed ::= NK_MINUS NK_FLOAT", + /* 300 */ "signed_literal ::= signed", + /* 301 */ "signed_literal ::= NK_STRING", + /* 302 */ "signed_literal ::= NK_BOOL", + /* 303 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 304 */ "signed_literal ::= duration_literal", + /* 305 */ "signed_literal ::= NULL", + /* 306 */ "signed_literal ::= literal_func", + /* 307 */ "signed_literal ::= NK_QUESTION", + /* 308 */ "literal_list ::= signed_literal", + /* 309 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 310 */ "db_name ::= NK_ID", + /* 311 */ "table_name ::= NK_ID", + /* 312 */ "column_name ::= NK_ID", + /* 313 */ "function_name ::= NK_ID", + /* 314 */ "table_alias ::= NK_ID", + /* 315 */ "column_alias ::= NK_ID", + /* 316 */ "user_name ::= NK_ID", + /* 317 */ "index_name ::= NK_ID", + /* 318 */ "topic_name ::= NK_ID", + /* 319 */ "stream_name ::= NK_ID", + /* 320 */ "cgroup_name ::= NK_ID", + /* 321 */ "expression ::= literal", + /* 322 */ "expression ::= pseudo_column", + /* 323 */ "expression ::= column_reference", + /* 324 */ "expression ::= function_expression", + /* 325 */ "expression ::= subquery", + /* 326 */ "expression ::= NK_LP expression NK_RP", + /* 327 */ "expression ::= NK_PLUS expression", + /* 328 */ "expression ::= NK_MINUS expression", + /* 329 */ "expression ::= expression NK_PLUS expression", + /* 330 */ "expression ::= expression NK_MINUS expression", + /* 331 */ "expression ::= expression NK_STAR expression", + /* 332 */ "expression ::= expression NK_SLASH expression", + /* 333 */ "expression ::= expression NK_REM expression", + /* 334 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 335 */ "expression ::= expression NK_BITAND expression", + /* 336 */ "expression ::= expression NK_BITOR expression", + /* 337 */ "expression_list ::= expression", + /* 338 */ "expression_list ::= expression_list NK_COMMA expression", + /* 339 */ "column_reference ::= column_name", + /* 340 */ "column_reference ::= table_name NK_DOT column_name", + /* 341 */ "pseudo_column ::= ROWTS", + /* 342 */ "pseudo_column ::= TBNAME", + /* 343 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 344 */ "pseudo_column ::= QSTART", + /* 345 */ "pseudo_column ::= QEND", + /* 346 */ "pseudo_column ::= QDURATION", + /* 347 */ "pseudo_column ::= WSTART", + /* 348 */ "pseudo_column ::= WEND", + /* 349 */ "pseudo_column ::= WDURATION", + /* 350 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 351 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 352 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 353 */ "function_expression ::= literal_func", + /* 354 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 355 */ "literal_func ::= NOW", + /* 356 */ "noarg_func ::= NOW", + /* 357 */ "noarg_func ::= TODAY", + /* 358 */ "noarg_func ::= TIMEZONE", + /* 359 */ "noarg_func ::= DATABASE", + /* 360 */ "noarg_func ::= CLIENT_VERSION", + /* 361 */ "noarg_func ::= SERVER_VERSION", + /* 362 */ "noarg_func ::= SERVER_STATUS", + /* 363 */ "noarg_func ::= CURRENT_USER", + /* 364 */ "noarg_func ::= USER", + /* 365 */ "star_func ::= COUNT", + /* 366 */ "star_func ::= FIRST", + /* 367 */ "star_func ::= LAST", + /* 368 */ "star_func ::= LAST_ROW", + /* 369 */ "star_func_para_list ::= NK_STAR", + /* 370 */ "star_func_para_list ::= other_para_list", + /* 371 */ "other_para_list ::= star_func_para", + /* 372 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 373 */ "star_func_para ::= expression", + /* 374 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 375 */ "predicate ::= expression compare_op expression", + /* 376 */ "predicate ::= expression BETWEEN expression AND expression", + /* 377 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 378 */ "predicate ::= expression IS NULL", + /* 379 */ "predicate ::= expression IS NOT NULL", + /* 380 */ "predicate ::= expression in_op in_predicate_value", + /* 381 */ "compare_op ::= NK_LT", + /* 382 */ "compare_op ::= NK_GT", + /* 383 */ "compare_op ::= NK_LE", + /* 384 */ "compare_op ::= NK_GE", + /* 385 */ "compare_op ::= NK_NE", + /* 386 */ "compare_op ::= NK_EQ", + /* 387 */ "compare_op ::= LIKE", + /* 388 */ "compare_op ::= NOT LIKE", + /* 389 */ "compare_op ::= MATCH", + /* 390 */ "compare_op ::= NMATCH", + /* 391 */ "compare_op ::= CONTAINS", + /* 392 */ "in_op ::= IN", + /* 393 */ "in_op ::= NOT IN", + /* 394 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 395 */ "boolean_value_expression ::= boolean_primary", + /* 396 */ "boolean_value_expression ::= NOT boolean_primary", + /* 397 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 398 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 399 */ "boolean_primary ::= predicate", + /* 400 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 401 */ "common_expression ::= expression", + /* 402 */ "common_expression ::= boolean_value_expression", + /* 403 */ "from_clause_opt ::=", + /* 404 */ "from_clause_opt ::= FROM table_reference_list", + /* 405 */ "table_reference_list ::= table_reference", + /* 406 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 407 */ "table_reference ::= table_primary", + /* 408 */ "table_reference ::= joined_table", + /* 409 */ "table_primary ::= table_name alias_opt", + /* 410 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 411 */ "table_primary ::= subquery alias_opt", + /* 412 */ "table_primary ::= parenthesized_joined_table", + /* 413 */ "alias_opt ::=", + /* 414 */ "alias_opt ::= table_alias", + /* 415 */ "alias_opt ::= AS table_alias", + /* 416 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 417 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 418 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 419 */ "join_type ::=", + /* 420 */ "join_type ::= INNER", + /* 421 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 422 */ "set_quantifier_opt ::=", + /* 423 */ "set_quantifier_opt ::= DISTINCT", + /* 424 */ "set_quantifier_opt ::= ALL", + /* 425 */ "select_list ::= select_item", + /* 426 */ "select_list ::= select_list NK_COMMA select_item", + /* 427 */ "select_item ::= NK_STAR", + /* 428 */ "select_item ::= common_expression", + /* 429 */ "select_item ::= common_expression column_alias", + /* 430 */ "select_item ::= common_expression AS column_alias", + /* 431 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 432 */ "where_clause_opt ::=", + /* 433 */ "where_clause_opt ::= WHERE search_condition", + /* 434 */ "partition_by_clause_opt ::=", + /* 435 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 436 */ "twindow_clause_opt ::=", + /* 437 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 438 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 439 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 440 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 441 */ "sliding_opt ::=", + /* 442 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 443 */ "fill_opt ::=", + /* 444 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 445 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 446 */ "fill_mode ::= NONE", + /* 447 */ "fill_mode ::= PREV", + /* 448 */ "fill_mode ::= NULL", + /* 449 */ "fill_mode ::= LINEAR", + /* 450 */ "fill_mode ::= NEXT", + /* 451 */ "group_by_clause_opt ::=", + /* 452 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 453 */ "group_by_list ::= expression", + /* 454 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 455 */ "having_clause_opt ::=", + /* 456 */ "having_clause_opt ::= HAVING search_condition", + /* 457 */ "range_opt ::=", + /* 458 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 459 */ "every_opt ::=", + /* 460 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 461 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 462 */ "query_expression_body ::= query_primary", + /* 463 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 464 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 465 */ "query_primary ::= query_specification", + /* 466 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 467 */ "order_by_clause_opt ::=", + /* 468 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 469 */ "slimit_clause_opt ::=", + /* 470 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 471 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 472 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 473 */ "limit_clause_opt ::=", + /* 474 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 475 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 476 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 477 */ "subquery ::= NK_LP query_expression NK_RP", + /* 478 */ "search_condition ::= common_expression", + /* 479 */ "sort_specification_list ::= sort_specification", + /* 480 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 481 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 482 */ "ordering_specification_opt ::=", + /* 483 */ "ordering_specification_opt ::= ASC", + /* 484 */ "ordering_specification_opt ::= DESC", + /* 485 */ "null_ordering_opt ::=", + /* 486 */ "null_ordering_opt ::= NULLS FIRST", + /* 487 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2838,401 +2823,398 @@ static const struct { { 270, -3 }, /* (93) db_options ::= db_options SCHEMALESS NK_INTEGER */ { 272, -1 }, /* (94) alter_db_options ::= alter_db_option */ { 272, -2 }, /* (95) alter_db_options ::= alter_db_options alter_db_option */ - { 276, -2 }, /* (96) alter_db_option ::= BUFFER NK_INTEGER */ - { 276, -2 }, /* (97) alter_db_option ::= CACHEMODEL NK_STRING */ - { 276, -2 }, /* (98) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 276, -2 }, /* (99) alter_db_option ::= FSYNC NK_INTEGER */ - { 276, -2 }, /* (100) alter_db_option ::= KEEP integer_list */ - { 276, -2 }, /* (101) alter_db_option ::= KEEP variable_list */ - { 276, -2 }, /* (102) alter_db_option ::= PAGES NK_INTEGER */ - { 276, -2 }, /* (103) alter_db_option ::= REPLICA NK_INTEGER */ - { 276, -2 }, /* (104) alter_db_option ::= STRICT NK_INTEGER */ - { 276, -2 }, /* (105) alter_db_option ::= WAL NK_INTEGER */ - { 273, -1 }, /* (106) integer_list ::= NK_INTEGER */ - { 273, -3 }, /* (107) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 274, -1 }, /* (108) variable_list ::= NK_VARIABLE */ - { 274, -3 }, /* (109) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 275, -1 }, /* (110) retention_list ::= retention */ - { 275, -3 }, /* (111) retention_list ::= retention_list NK_COMMA retention */ - { 277, -3 }, /* (112) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 256, -9 }, /* (113) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 256, -3 }, /* (114) cmd ::= CREATE TABLE multi_create_clause */ - { 256, -9 }, /* (115) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 256, -3 }, /* (116) cmd ::= DROP TABLE multi_drop_clause */ - { 256, -4 }, /* (117) cmd ::= DROP STABLE exists_opt full_table_name */ - { 256, -3 }, /* (118) cmd ::= ALTER TABLE alter_table_clause */ - { 256, -3 }, /* (119) cmd ::= ALTER STABLE alter_table_clause */ - { 285, -2 }, /* (120) alter_table_clause ::= full_table_name alter_table_options */ - { 285, -5 }, /* (121) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 285, -4 }, /* (122) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 285, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 285, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 285, -5 }, /* (125) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 285, -4 }, /* (126) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 285, -5 }, /* (127) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 285, -5 }, /* (128) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 285, -6 }, /* (129) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 282, -1 }, /* (130) multi_create_clause ::= create_subtable_clause */ - { 282, -2 }, /* (131) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 290, -10 }, /* (132) 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 */ - { 284, -1 }, /* (133) multi_drop_clause ::= drop_table_clause */ - { 284, -2 }, /* (134) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 293, -2 }, /* (135) drop_table_clause ::= exists_opt full_table_name */ - { 291, 0 }, /* (136) specific_cols_opt ::= */ - { 291, -3 }, /* (137) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 278, -1 }, /* (138) full_table_name ::= table_name */ - { 278, -3 }, /* (139) full_table_name ::= db_name NK_DOT table_name */ - { 279, -1 }, /* (140) column_def_list ::= column_def */ - { 279, -3 }, /* (141) column_def_list ::= column_def_list NK_COMMA column_def */ - { 296, -2 }, /* (142) column_def ::= column_name type_name */ - { 296, -4 }, /* (143) column_def ::= column_name type_name COMMENT NK_STRING */ - { 288, -1 }, /* (144) type_name ::= BOOL */ - { 288, -1 }, /* (145) type_name ::= TINYINT */ - { 288, -1 }, /* (146) type_name ::= SMALLINT */ - { 288, -1 }, /* (147) type_name ::= INT */ - { 288, -1 }, /* (148) type_name ::= INTEGER */ - { 288, -1 }, /* (149) type_name ::= BIGINT */ - { 288, -1 }, /* (150) type_name ::= FLOAT */ - { 288, -1 }, /* (151) type_name ::= DOUBLE */ - { 288, -4 }, /* (152) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 288, -1 }, /* (153) type_name ::= TIMESTAMP */ - { 288, -4 }, /* (154) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 288, -2 }, /* (155) type_name ::= TINYINT UNSIGNED */ - { 288, -2 }, /* (156) type_name ::= SMALLINT UNSIGNED */ - { 288, -2 }, /* (157) type_name ::= INT UNSIGNED */ - { 288, -2 }, /* (158) type_name ::= BIGINT UNSIGNED */ - { 288, -1 }, /* (159) type_name ::= JSON */ - { 288, -4 }, /* (160) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 288, -1 }, /* (161) type_name ::= MEDIUMBLOB */ - { 288, -1 }, /* (162) type_name ::= BLOB */ - { 288, -4 }, /* (163) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 288, -1 }, /* (164) type_name ::= DECIMAL */ - { 288, -4 }, /* (165) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 288, -6 }, /* (166) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 280, 0 }, /* (167) tags_def_opt ::= */ - { 280, -1 }, /* (168) tags_def_opt ::= tags_def */ - { 283, -4 }, /* (169) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 281, 0 }, /* (170) table_options ::= */ - { 281, -3 }, /* (171) table_options ::= table_options COMMENT NK_STRING */ - { 281, -3 }, /* (172) table_options ::= table_options MAX_DELAY duration_list */ - { 281, -3 }, /* (173) table_options ::= table_options WATERMARK duration_list */ - { 281, -5 }, /* (174) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 281, -3 }, /* (175) table_options ::= table_options TTL NK_INTEGER */ - { 281, -5 }, /* (176) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 286, -1 }, /* (177) alter_table_options ::= alter_table_option */ - { 286, -2 }, /* (178) alter_table_options ::= alter_table_options alter_table_option */ - { 299, -2 }, /* (179) alter_table_option ::= COMMENT NK_STRING */ - { 299, -2 }, /* (180) alter_table_option ::= TTL NK_INTEGER */ - { 297, -1 }, /* (181) duration_list ::= duration_literal */ - { 297, -3 }, /* (182) duration_list ::= duration_list NK_COMMA duration_literal */ - { 298, -1 }, /* (183) rollup_func_list ::= rollup_func_name */ - { 298, -3 }, /* (184) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 301, -1 }, /* (185) rollup_func_name ::= function_name */ - { 301, -1 }, /* (186) rollup_func_name ::= FIRST */ - { 301, -1 }, /* (187) rollup_func_name ::= LAST */ - { 294, -1 }, /* (188) col_name_list ::= col_name */ - { 294, -3 }, /* (189) col_name_list ::= col_name_list NK_COMMA col_name */ - { 303, -1 }, /* (190) col_name ::= column_name */ - { 256, -2 }, /* (191) cmd ::= SHOW DNODES */ - { 256, -2 }, /* (192) cmd ::= SHOW USERS */ - { 256, -2 }, /* (193) cmd ::= SHOW DATABASES */ - { 256, -4 }, /* (194) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 256, -4 }, /* (195) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 256, -3 }, /* (196) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 256, -2 }, /* (197) cmd ::= SHOW MNODES */ - { 256, -2 }, /* (198) cmd ::= SHOW MODULES */ - { 256, -2 }, /* (199) cmd ::= SHOW QNODES */ - { 256, -2 }, /* (200) cmd ::= SHOW FUNCTIONS */ - { 256, -5 }, /* (201) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 256, -2 }, /* (202) cmd ::= SHOW STREAMS */ - { 256, -2 }, /* (203) cmd ::= SHOW ACCOUNTS */ - { 256, -2 }, /* (204) cmd ::= SHOW APPS */ - { 256, -2 }, /* (205) cmd ::= SHOW CONNECTIONS */ - { 256, -2 }, /* (206) cmd ::= SHOW LICENCE */ - { 256, -2 }, /* (207) cmd ::= SHOW GRANTS */ - { 256, -4 }, /* (208) cmd ::= SHOW CREATE DATABASE db_name */ - { 256, -4 }, /* (209) cmd ::= SHOW CREATE TABLE full_table_name */ - { 256, -4 }, /* (210) cmd ::= SHOW CREATE STABLE full_table_name */ - { 256, -2 }, /* (211) cmd ::= SHOW QUERIES */ - { 256, -2 }, /* (212) cmd ::= SHOW SCORES */ - { 256, -2 }, /* (213) cmd ::= SHOW TOPICS */ - { 256, -2 }, /* (214) cmd ::= SHOW VARIABLES */ - { 256, -3 }, /* (215) cmd ::= SHOW LOCAL VARIABLES */ - { 256, -4 }, /* (216) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 256, -2 }, /* (217) cmd ::= SHOW BNODES */ - { 256, -2 }, /* (218) cmd ::= SHOW SNODES */ - { 256, -2 }, /* (219) cmd ::= SHOW CLUSTER */ - { 256, -2 }, /* (220) cmd ::= SHOW TRANSACTIONS */ - { 256, -4 }, /* (221) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 256, -2 }, /* (222) cmd ::= SHOW CONSUMERS */ - { 256, -2 }, /* (223) cmd ::= SHOW SUBSCRIPTIONS */ - { 304, 0 }, /* (224) db_name_cond_opt ::= */ - { 304, -2 }, /* (225) db_name_cond_opt ::= db_name NK_DOT */ - { 305, 0 }, /* (226) like_pattern_opt ::= */ - { 305, -2 }, /* (227) like_pattern_opt ::= LIKE NK_STRING */ - { 306, -1 }, /* (228) table_name_cond ::= table_name */ - { 307, 0 }, /* (229) from_db_opt ::= */ - { 307, -2 }, /* (230) from_db_opt ::= FROM db_name */ - { 256, -8 }, /* (231) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 256, -4 }, /* (232) cmd ::= DROP INDEX exists_opt index_name */ - { 309, -10 }, /* (233) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 309, -12 }, /* (234) 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 */ - { 310, -1 }, /* (235) func_list ::= func */ - { 310, -3 }, /* (236) func_list ::= func_list NK_COMMA func */ - { 313, -4 }, /* (237) func ::= function_name NK_LP expression_list NK_RP */ - { 312, 0 }, /* (238) sma_stream_opt ::= */ - { 312, -3 }, /* (239) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 312, -3 }, /* (240) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 256, -6 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 256, -7 }, /* (242) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 256, -9 }, /* (243) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 256, -7 }, /* (244) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 256, -9 }, /* (245) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 256, -4 }, /* (246) cmd ::= DROP TOPIC exists_opt topic_name */ - { 256, -7 }, /* (247) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 256, -2 }, /* (248) cmd ::= DESC full_table_name */ - { 256, -2 }, /* (249) cmd ::= DESCRIBE full_table_name */ - { 256, -3 }, /* (250) cmd ::= RESET QUERY CACHE */ - { 256, -4 }, /* (251) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 318, 0 }, /* (252) analyze_opt ::= */ - { 318, -1 }, /* (253) analyze_opt ::= ANALYZE */ - { 319, 0 }, /* (254) explain_options ::= */ - { 319, -3 }, /* (255) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 319, -3 }, /* (256) explain_options ::= explain_options RATIO NK_FLOAT */ - { 256, -6 }, /* (257) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 256, -10 }, /* (258) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 256, -4 }, /* (259) cmd ::= DROP FUNCTION exists_opt function_name */ - { 320, 0 }, /* (260) agg_func_opt ::= */ - { 320, -1 }, /* (261) agg_func_opt ::= AGGREGATE */ - { 321, 0 }, /* (262) bufsize_opt ::= */ - { 321, -2 }, /* (263) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 256, -8 }, /* (264) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 256, -4 }, /* (265) cmd ::= DROP STREAM exists_opt stream_name */ - { 323, 0 }, /* (266) into_opt ::= */ - { 323, -2 }, /* (267) into_opt ::= INTO full_table_name */ - { 314, 0 }, /* (268) stream_options ::= */ - { 314, -3 }, /* (269) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 314, -3 }, /* (270) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 314, -4 }, /* (271) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 314, -3 }, /* (272) stream_options ::= stream_options WATERMARK duration_literal */ - { 314, -3 }, /* (273) stream_options ::= stream_options IGNORE EXPIRED */ - { 256, -3 }, /* (274) cmd ::= KILL CONNECTION NK_INTEGER */ - { 256, -3 }, /* (275) cmd ::= KILL QUERY NK_STRING */ - { 256, -3 }, /* (276) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 256, -2 }, /* (277) cmd ::= BALANCE VGROUP */ - { 256, -4 }, /* (278) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 256, -4 }, /* (279) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 256, -3 }, /* (280) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 324, -2 }, /* (281) dnode_list ::= DNODE NK_INTEGER */ - { 324, -3 }, /* (282) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 256, -3 }, /* (283) cmd ::= SYNCDB db_name REPLICA */ - { 256, -4 }, /* (284) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 256, -1 }, /* (285) cmd ::= query_expression */ - { 256, -7 }, /* (286) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ - { 256, -4 }, /* (287) cmd ::= INSERT INTO full_table_name query_expression */ - { 259, -1 }, /* (288) literal ::= NK_INTEGER */ - { 259, -1 }, /* (289) literal ::= NK_FLOAT */ - { 259, -1 }, /* (290) literal ::= NK_STRING */ - { 259, -1 }, /* (291) literal ::= NK_BOOL */ - { 259, -2 }, /* (292) literal ::= TIMESTAMP NK_STRING */ - { 259, -1 }, /* (293) literal ::= duration_literal */ - { 259, -1 }, /* (294) literal ::= NULL */ - { 259, -1 }, /* (295) literal ::= NK_QUESTION */ - { 300, -1 }, /* (296) duration_literal ::= NK_VARIABLE */ - { 326, -1 }, /* (297) signed ::= NK_INTEGER */ - { 326, -2 }, /* (298) signed ::= NK_PLUS NK_INTEGER */ - { 326, -2 }, /* (299) signed ::= NK_MINUS NK_INTEGER */ - { 326, -1 }, /* (300) signed ::= NK_FLOAT */ - { 326, -2 }, /* (301) signed ::= NK_PLUS NK_FLOAT */ - { 326, -2 }, /* (302) signed ::= NK_MINUS NK_FLOAT */ - { 289, -1 }, /* (303) signed_literal ::= signed */ - { 289, -1 }, /* (304) signed_literal ::= NK_STRING */ - { 289, -1 }, /* (305) signed_literal ::= NK_BOOL */ - { 289, -2 }, /* (306) signed_literal ::= TIMESTAMP NK_STRING */ - { 289, -1 }, /* (307) signed_literal ::= duration_literal */ - { 289, -1 }, /* (308) signed_literal ::= NULL */ - { 289, -1 }, /* (309) signed_literal ::= literal_func */ - { 289, -1 }, /* (310) signed_literal ::= NK_QUESTION */ - { 328, -1 }, /* (311) literal_list ::= signed_literal */ - { 328, -3 }, /* (312) literal_list ::= literal_list NK_COMMA signed_literal */ - { 267, -1 }, /* (313) db_name ::= NK_ID */ - { 295, -1 }, /* (314) table_name ::= NK_ID */ - { 287, -1 }, /* (315) column_name ::= NK_ID */ - { 302, -1 }, /* (316) function_name ::= NK_ID */ - { 329, -1 }, /* (317) table_alias ::= NK_ID */ - { 330, -1 }, /* (318) column_alias ::= NK_ID */ - { 261, -1 }, /* (319) user_name ::= NK_ID */ - { 308, -1 }, /* (320) index_name ::= NK_ID */ - { 315, -1 }, /* (321) topic_name ::= NK_ID */ - { 322, -1 }, /* (322) stream_name ::= NK_ID */ - { 317, -1 }, /* (323) cgroup_name ::= NK_ID */ - { 331, -1 }, /* (324) expression ::= literal */ - { 331, -1 }, /* (325) expression ::= pseudo_column */ - { 331, -1 }, /* (326) expression ::= column_reference */ - { 331, -1 }, /* (327) expression ::= function_expression */ - { 331, -1 }, /* (328) expression ::= subquery */ - { 331, -3 }, /* (329) expression ::= NK_LP expression NK_RP */ - { 331, -2 }, /* (330) expression ::= NK_PLUS expression */ - { 331, -2 }, /* (331) expression ::= NK_MINUS expression */ - { 331, -3 }, /* (332) expression ::= expression NK_PLUS expression */ - { 331, -3 }, /* (333) expression ::= expression NK_MINUS expression */ - { 331, -3 }, /* (334) expression ::= expression NK_STAR expression */ - { 331, -3 }, /* (335) expression ::= expression NK_SLASH expression */ - { 331, -3 }, /* (336) expression ::= expression NK_REM expression */ - { 331, -3 }, /* (337) expression ::= column_reference NK_ARROW NK_STRING */ - { 331, -3 }, /* (338) expression ::= expression NK_BITAND expression */ - { 331, -3 }, /* (339) expression ::= expression NK_BITOR expression */ - { 292, -1 }, /* (340) expression_list ::= expression */ - { 292, -3 }, /* (341) expression_list ::= expression_list NK_COMMA expression */ - { 333, -1 }, /* (342) column_reference ::= column_name */ - { 333, -3 }, /* (343) column_reference ::= table_name NK_DOT column_name */ - { 332, -1 }, /* (344) pseudo_column ::= ROWTS */ - { 332, -1 }, /* (345) pseudo_column ::= TBNAME */ - { 332, -3 }, /* (346) pseudo_column ::= table_name NK_DOT TBNAME */ - { 332, -1 }, /* (347) pseudo_column ::= QSTART */ - { 332, -1 }, /* (348) pseudo_column ::= QEND */ - { 332, -1 }, /* (349) pseudo_column ::= QDURATION */ - { 332, -1 }, /* (350) pseudo_column ::= WSTART */ - { 332, -1 }, /* (351) pseudo_column ::= WEND */ - { 332, -1 }, /* (352) pseudo_column ::= WDURATION */ - { 334, -4 }, /* (353) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 334, -4 }, /* (354) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 334, -6 }, /* (355) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 334, -1 }, /* (356) function_expression ::= literal_func */ - { 327, -3 }, /* (357) literal_func ::= noarg_func NK_LP NK_RP */ - { 327, -1 }, /* (358) literal_func ::= NOW */ - { 338, -1 }, /* (359) noarg_func ::= NOW */ - { 338, -1 }, /* (360) noarg_func ::= TODAY */ - { 338, -1 }, /* (361) noarg_func ::= TIMEZONE */ - { 338, -1 }, /* (362) noarg_func ::= DATABASE */ - { 338, -1 }, /* (363) noarg_func ::= CLIENT_VERSION */ - { 338, -1 }, /* (364) noarg_func ::= SERVER_VERSION */ - { 338, -1 }, /* (365) noarg_func ::= SERVER_STATUS */ - { 338, -1 }, /* (366) noarg_func ::= CURRENT_USER */ - { 338, -1 }, /* (367) noarg_func ::= USER */ - { 336, -1 }, /* (368) star_func ::= COUNT */ - { 336, -1 }, /* (369) star_func ::= FIRST */ - { 336, -1 }, /* (370) star_func ::= LAST */ - { 336, -1 }, /* (371) star_func ::= LAST_ROW */ - { 337, -1 }, /* (372) star_func_para_list ::= NK_STAR */ - { 337, -1 }, /* (373) star_func_para_list ::= other_para_list */ - { 339, -1 }, /* (374) other_para_list ::= star_func_para */ - { 339, -3 }, /* (375) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 340, -1 }, /* (376) star_func_para ::= expression */ - { 340, -3 }, /* (377) star_func_para ::= table_name NK_DOT NK_STAR */ - { 341, -3 }, /* (378) predicate ::= expression compare_op expression */ - { 341, -5 }, /* (379) predicate ::= expression BETWEEN expression AND expression */ - { 341, -6 }, /* (380) predicate ::= expression NOT BETWEEN expression AND expression */ - { 341, -3 }, /* (381) predicate ::= expression IS NULL */ - { 341, -4 }, /* (382) predicate ::= expression IS NOT NULL */ - { 341, -3 }, /* (383) predicate ::= expression in_op in_predicate_value */ - { 342, -1 }, /* (384) compare_op ::= NK_LT */ - { 342, -1 }, /* (385) compare_op ::= NK_GT */ - { 342, -1 }, /* (386) compare_op ::= NK_LE */ - { 342, -1 }, /* (387) compare_op ::= NK_GE */ - { 342, -1 }, /* (388) compare_op ::= NK_NE */ - { 342, -1 }, /* (389) compare_op ::= NK_EQ */ - { 342, -1 }, /* (390) compare_op ::= LIKE */ - { 342, -2 }, /* (391) compare_op ::= NOT LIKE */ - { 342, -1 }, /* (392) compare_op ::= MATCH */ - { 342, -1 }, /* (393) compare_op ::= NMATCH */ - { 342, -1 }, /* (394) compare_op ::= CONTAINS */ - { 343, -1 }, /* (395) in_op ::= IN */ - { 343, -2 }, /* (396) in_op ::= NOT IN */ - { 344, -3 }, /* (397) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 345, -1 }, /* (398) boolean_value_expression ::= boolean_primary */ - { 345, -2 }, /* (399) boolean_value_expression ::= NOT boolean_primary */ - { 345, -3 }, /* (400) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 345, -3 }, /* (401) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 346, -1 }, /* (402) boolean_primary ::= predicate */ - { 346, -3 }, /* (403) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 347, -1 }, /* (404) common_expression ::= expression */ - { 347, -1 }, /* (405) common_expression ::= boolean_value_expression */ - { 348, 0 }, /* (406) from_clause_opt ::= */ - { 348, -2 }, /* (407) from_clause_opt ::= FROM table_reference_list */ - { 349, -1 }, /* (408) table_reference_list ::= table_reference */ - { 349, -3 }, /* (409) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 350, -1 }, /* (410) table_reference ::= table_primary */ - { 350, -1 }, /* (411) table_reference ::= joined_table */ - { 351, -2 }, /* (412) table_primary ::= table_name alias_opt */ - { 351, -4 }, /* (413) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 351, -2 }, /* (414) table_primary ::= subquery alias_opt */ - { 351, -1 }, /* (415) table_primary ::= parenthesized_joined_table */ - { 353, 0 }, /* (416) alias_opt ::= */ - { 353, -1 }, /* (417) alias_opt ::= table_alias */ - { 353, -2 }, /* (418) alias_opt ::= AS table_alias */ - { 354, -3 }, /* (419) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 354, -3 }, /* (420) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 352, -6 }, /* (421) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 355, 0 }, /* (422) join_type ::= */ - { 355, -1 }, /* (423) join_type ::= INNER */ - { 357, -12 }, /* (424) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 358, 0 }, /* (425) set_quantifier_opt ::= */ - { 358, -1 }, /* (426) set_quantifier_opt ::= DISTINCT */ - { 358, -1 }, /* (427) set_quantifier_opt ::= ALL */ - { 359, -1 }, /* (428) select_list ::= select_item */ - { 359, -3 }, /* (429) select_list ::= select_list NK_COMMA select_item */ - { 367, -1 }, /* (430) select_item ::= NK_STAR */ - { 367, -1 }, /* (431) select_item ::= common_expression */ - { 367, -2 }, /* (432) select_item ::= common_expression column_alias */ - { 367, -3 }, /* (433) select_item ::= common_expression AS column_alias */ - { 367, -3 }, /* (434) select_item ::= table_name NK_DOT NK_STAR */ - { 325, 0 }, /* (435) where_clause_opt ::= */ - { 325, -2 }, /* (436) where_clause_opt ::= WHERE search_condition */ - { 360, 0 }, /* (437) partition_by_clause_opt ::= */ - { 360, -3 }, /* (438) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 364, 0 }, /* (439) twindow_clause_opt ::= */ - { 364, -6 }, /* (440) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 364, -4 }, /* (441) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 364, -6 }, /* (442) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 364, -8 }, /* (443) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 311, 0 }, /* (444) sliding_opt ::= */ - { 311, -4 }, /* (445) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 363, 0 }, /* (446) fill_opt ::= */ - { 363, -4 }, /* (447) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 363, -6 }, /* (448) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 368, -1 }, /* (449) fill_mode ::= NONE */ - { 368, -1 }, /* (450) fill_mode ::= PREV */ - { 368, -1 }, /* (451) fill_mode ::= NULL */ - { 368, -1 }, /* (452) fill_mode ::= LINEAR */ - { 368, -1 }, /* (453) fill_mode ::= NEXT */ - { 365, 0 }, /* (454) group_by_clause_opt ::= */ - { 365, -3 }, /* (455) group_by_clause_opt ::= GROUP BY group_by_list */ - { 369, -1 }, /* (456) group_by_list ::= expression */ - { 369, -3 }, /* (457) group_by_list ::= group_by_list NK_COMMA expression */ - { 366, 0 }, /* (458) having_clause_opt ::= */ - { 366, -2 }, /* (459) having_clause_opt ::= HAVING search_condition */ - { 361, 0 }, /* (460) range_opt ::= */ - { 361, -6 }, /* (461) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 362, 0 }, /* (462) every_opt ::= */ - { 362, -4 }, /* (463) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 316, -4 }, /* (464) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 370, -1 }, /* (465) query_expression_body ::= query_primary */ - { 370, -4 }, /* (466) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 370, -3 }, /* (467) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 374, -1 }, /* (468) query_primary ::= query_specification */ - { 374, -6 }, /* (469) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 371, 0 }, /* (470) order_by_clause_opt ::= */ - { 371, -3 }, /* (471) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 372, 0 }, /* (472) slimit_clause_opt ::= */ - { 372, -2 }, /* (473) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 372, -4 }, /* (474) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 372, -4 }, /* (475) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 373, 0 }, /* (476) limit_clause_opt ::= */ - { 373, -2 }, /* (477) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 373, -4 }, /* (478) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 373, -4 }, /* (479) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 335, -3 }, /* (480) subquery ::= NK_LP query_expression NK_RP */ - { 356, -1 }, /* (481) search_condition ::= common_expression */ - { 375, -1 }, /* (482) sort_specification_list ::= sort_specification */ - { 375, -3 }, /* (483) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 376, -3 }, /* (484) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 377, 0 }, /* (485) ordering_specification_opt ::= */ - { 377, -1 }, /* (486) ordering_specification_opt ::= ASC */ - { 377, -1 }, /* (487) ordering_specification_opt ::= DESC */ - { 378, 0 }, /* (488) null_ordering_opt ::= */ - { 378, -2 }, /* (489) null_ordering_opt ::= NULLS FIRST */ - { 378, -2 }, /* (490) null_ordering_opt ::= NULLS LAST */ + { 276, -2 }, /* (96) alter_db_option ::= CACHEMODEL NK_STRING */ + { 276, -2 }, /* (97) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 276, -2 }, /* (98) alter_db_option ::= FSYNC NK_INTEGER */ + { 276, -2 }, /* (99) alter_db_option ::= KEEP integer_list */ + { 276, -2 }, /* (100) alter_db_option ::= KEEP variable_list */ + { 276, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ + { 273, -1 }, /* (102) integer_list ::= NK_INTEGER */ + { 273, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 274, -1 }, /* (104) variable_list ::= NK_VARIABLE */ + { 274, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 275, -1 }, /* (106) retention_list ::= retention */ + { 275, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ + { 277, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 256, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 256, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ + { 256, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 256, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ + { 256, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ + { 256, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ + { 256, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ + { 285, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ + { 285, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 285, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 285, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 285, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 285, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 285, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 285, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 285, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 285, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 282, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ + { 282, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 290, -10 }, /* (128) 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 */ + { 284, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ + { 284, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 293, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ + { 291, 0 }, /* (132) specific_cols_opt ::= */ + { 291, -3 }, /* (133) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 278, -1 }, /* (134) full_table_name ::= table_name */ + { 278, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ + { 279, -1 }, /* (136) column_def_list ::= column_def */ + { 279, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ + { 296, -2 }, /* (138) column_def ::= column_name type_name */ + { 296, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ + { 288, -1 }, /* (140) type_name ::= BOOL */ + { 288, -1 }, /* (141) type_name ::= TINYINT */ + { 288, -1 }, /* (142) type_name ::= SMALLINT */ + { 288, -1 }, /* (143) type_name ::= INT */ + { 288, -1 }, /* (144) type_name ::= INTEGER */ + { 288, -1 }, /* (145) type_name ::= BIGINT */ + { 288, -1 }, /* (146) type_name ::= FLOAT */ + { 288, -1 }, /* (147) type_name ::= DOUBLE */ + { 288, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 288, -1 }, /* (149) type_name ::= TIMESTAMP */ + { 288, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 288, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ + { 288, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ + { 288, -2 }, /* (153) type_name ::= INT UNSIGNED */ + { 288, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ + { 288, -1 }, /* (155) type_name ::= JSON */ + { 288, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 288, -1 }, /* (157) type_name ::= MEDIUMBLOB */ + { 288, -1 }, /* (158) type_name ::= BLOB */ + { 288, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 288, -1 }, /* (160) type_name ::= DECIMAL */ + { 288, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 288, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 280, 0 }, /* (163) tags_def_opt ::= */ + { 280, -1 }, /* (164) tags_def_opt ::= tags_def */ + { 283, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 281, 0 }, /* (166) table_options ::= */ + { 281, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ + { 281, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ + { 281, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ + { 281, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 281, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ + { 281, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 286, -1 }, /* (173) alter_table_options ::= alter_table_option */ + { 286, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ + { 299, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ + { 299, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ + { 297, -1 }, /* (177) duration_list ::= duration_literal */ + { 297, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ + { 298, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ + { 298, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 301, -1 }, /* (181) rollup_func_name ::= function_name */ + { 301, -1 }, /* (182) rollup_func_name ::= FIRST */ + { 301, -1 }, /* (183) rollup_func_name ::= LAST */ + { 294, -1 }, /* (184) col_name_list ::= col_name */ + { 294, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ + { 303, -1 }, /* (186) col_name ::= column_name */ + { 256, -2 }, /* (187) cmd ::= SHOW DNODES */ + { 256, -2 }, /* (188) cmd ::= SHOW USERS */ + { 256, -2 }, /* (189) cmd ::= SHOW DATABASES */ + { 256, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 256, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 256, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 256, -2 }, /* (193) cmd ::= SHOW MNODES */ + { 256, -2 }, /* (194) cmd ::= SHOW MODULES */ + { 256, -2 }, /* (195) cmd ::= SHOW QNODES */ + { 256, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ + { 256, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 256, -2 }, /* (198) cmd ::= SHOW STREAMS */ + { 256, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ + { 256, -2 }, /* (200) cmd ::= SHOW APPS */ + { 256, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ + { 256, -2 }, /* (202) cmd ::= SHOW LICENCE */ + { 256, -2 }, /* (203) cmd ::= SHOW GRANTS */ + { 256, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ + { 256, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ + { 256, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ + { 256, -2 }, /* (207) cmd ::= SHOW QUERIES */ + { 256, -2 }, /* (208) cmd ::= SHOW SCORES */ + { 256, -2 }, /* (209) cmd ::= SHOW TOPICS */ + { 256, -2 }, /* (210) cmd ::= SHOW VARIABLES */ + { 256, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ + { 256, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 256, -2 }, /* (213) cmd ::= SHOW BNODES */ + { 256, -2 }, /* (214) cmd ::= SHOW SNODES */ + { 256, -2 }, /* (215) cmd ::= SHOW CLUSTER */ + { 256, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ + { 256, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 256, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ + { 256, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ + { 256, -5 }, /* (220) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 304, 0 }, /* (221) db_name_cond_opt ::= */ + { 304, -2 }, /* (222) db_name_cond_opt ::= db_name NK_DOT */ + { 305, 0 }, /* (223) like_pattern_opt ::= */ + { 305, -2 }, /* (224) like_pattern_opt ::= LIKE NK_STRING */ + { 306, -1 }, /* (225) table_name_cond ::= table_name */ + { 307, 0 }, /* (226) from_db_opt ::= */ + { 307, -2 }, /* (227) from_db_opt ::= FROM db_name */ + { 256, -8 }, /* (228) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 256, -4 }, /* (229) cmd ::= DROP INDEX exists_opt index_name */ + { 309, -10 }, /* (230) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 309, -12 }, /* (231) 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 */ + { 310, -1 }, /* (232) func_list ::= func */ + { 310, -3 }, /* (233) func_list ::= func_list NK_COMMA func */ + { 313, -4 }, /* (234) func ::= function_name NK_LP expression_list NK_RP */ + { 312, 0 }, /* (235) sma_stream_opt ::= */ + { 312, -3 }, /* (236) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 312, -3 }, /* (237) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 256, -6 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 256, -7 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 256, -9 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 256, -7 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 256, -9 }, /* (242) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 256, -4 }, /* (243) cmd ::= DROP TOPIC exists_opt topic_name */ + { 256, -7 }, /* (244) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 256, -2 }, /* (245) cmd ::= DESC full_table_name */ + { 256, -2 }, /* (246) cmd ::= DESCRIBE full_table_name */ + { 256, -3 }, /* (247) cmd ::= RESET QUERY CACHE */ + { 256, -4 }, /* (248) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 318, 0 }, /* (249) analyze_opt ::= */ + { 318, -1 }, /* (250) analyze_opt ::= ANALYZE */ + { 319, 0 }, /* (251) explain_options ::= */ + { 319, -3 }, /* (252) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 319, -3 }, /* (253) explain_options ::= explain_options RATIO NK_FLOAT */ + { 256, -6 }, /* (254) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 256, -10 }, /* (255) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 256, -4 }, /* (256) cmd ::= DROP FUNCTION exists_opt function_name */ + { 320, 0 }, /* (257) agg_func_opt ::= */ + { 320, -1 }, /* (258) agg_func_opt ::= AGGREGATE */ + { 321, 0 }, /* (259) bufsize_opt ::= */ + { 321, -2 }, /* (260) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 256, -8 }, /* (261) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 256, -4 }, /* (262) cmd ::= DROP STREAM exists_opt stream_name */ + { 323, 0 }, /* (263) into_opt ::= */ + { 323, -2 }, /* (264) into_opt ::= INTO full_table_name */ + { 314, 0 }, /* (265) stream_options ::= */ + { 314, -3 }, /* (266) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 314, -3 }, /* (267) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 314, -4 }, /* (268) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 314, -3 }, /* (269) stream_options ::= stream_options WATERMARK duration_literal */ + { 314, -3 }, /* (270) stream_options ::= stream_options IGNORE EXPIRED */ + { 256, -3 }, /* (271) cmd ::= KILL CONNECTION NK_INTEGER */ + { 256, -3 }, /* (272) cmd ::= KILL QUERY NK_STRING */ + { 256, -3 }, /* (273) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 256, -2 }, /* (274) cmd ::= BALANCE VGROUP */ + { 256, -4 }, /* (275) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 256, -4 }, /* (276) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 256, -3 }, /* (277) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 324, -2 }, /* (278) dnode_list ::= DNODE NK_INTEGER */ + { 324, -3 }, /* (279) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 256, -3 }, /* (280) cmd ::= SYNCDB db_name REPLICA */ + { 256, -4 }, /* (281) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 256, -1 }, /* (282) cmd ::= query_expression */ + { 256, -7 }, /* (283) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ + { 256, -4 }, /* (284) cmd ::= INSERT INTO full_table_name query_expression */ + { 259, -1 }, /* (285) literal ::= NK_INTEGER */ + { 259, -1 }, /* (286) literal ::= NK_FLOAT */ + { 259, -1 }, /* (287) literal ::= NK_STRING */ + { 259, -1 }, /* (288) literal ::= NK_BOOL */ + { 259, -2 }, /* (289) literal ::= TIMESTAMP NK_STRING */ + { 259, -1 }, /* (290) literal ::= duration_literal */ + { 259, -1 }, /* (291) literal ::= NULL */ + { 259, -1 }, /* (292) literal ::= NK_QUESTION */ + { 300, -1 }, /* (293) duration_literal ::= NK_VARIABLE */ + { 326, -1 }, /* (294) signed ::= NK_INTEGER */ + { 326, -2 }, /* (295) signed ::= NK_PLUS NK_INTEGER */ + { 326, -2 }, /* (296) signed ::= NK_MINUS NK_INTEGER */ + { 326, -1 }, /* (297) signed ::= NK_FLOAT */ + { 326, -2 }, /* (298) signed ::= NK_PLUS NK_FLOAT */ + { 326, -2 }, /* (299) signed ::= NK_MINUS NK_FLOAT */ + { 289, -1 }, /* (300) signed_literal ::= signed */ + { 289, -1 }, /* (301) signed_literal ::= NK_STRING */ + { 289, -1 }, /* (302) signed_literal ::= NK_BOOL */ + { 289, -2 }, /* (303) signed_literal ::= TIMESTAMP NK_STRING */ + { 289, -1 }, /* (304) signed_literal ::= duration_literal */ + { 289, -1 }, /* (305) signed_literal ::= NULL */ + { 289, -1 }, /* (306) signed_literal ::= literal_func */ + { 289, -1 }, /* (307) signed_literal ::= NK_QUESTION */ + { 328, -1 }, /* (308) literal_list ::= signed_literal */ + { 328, -3 }, /* (309) literal_list ::= literal_list NK_COMMA signed_literal */ + { 267, -1 }, /* (310) db_name ::= NK_ID */ + { 295, -1 }, /* (311) table_name ::= NK_ID */ + { 287, -1 }, /* (312) column_name ::= NK_ID */ + { 302, -1 }, /* (313) function_name ::= NK_ID */ + { 329, -1 }, /* (314) table_alias ::= NK_ID */ + { 330, -1 }, /* (315) column_alias ::= NK_ID */ + { 261, -1 }, /* (316) user_name ::= NK_ID */ + { 308, -1 }, /* (317) index_name ::= NK_ID */ + { 315, -1 }, /* (318) topic_name ::= NK_ID */ + { 322, -1 }, /* (319) stream_name ::= NK_ID */ + { 317, -1 }, /* (320) cgroup_name ::= NK_ID */ + { 331, -1 }, /* (321) expression ::= literal */ + { 331, -1 }, /* (322) expression ::= pseudo_column */ + { 331, -1 }, /* (323) expression ::= column_reference */ + { 331, -1 }, /* (324) expression ::= function_expression */ + { 331, -1 }, /* (325) expression ::= subquery */ + { 331, -3 }, /* (326) expression ::= NK_LP expression NK_RP */ + { 331, -2 }, /* (327) expression ::= NK_PLUS expression */ + { 331, -2 }, /* (328) expression ::= NK_MINUS expression */ + { 331, -3 }, /* (329) expression ::= expression NK_PLUS expression */ + { 331, -3 }, /* (330) expression ::= expression NK_MINUS expression */ + { 331, -3 }, /* (331) expression ::= expression NK_STAR expression */ + { 331, -3 }, /* (332) expression ::= expression NK_SLASH expression */ + { 331, -3 }, /* (333) expression ::= expression NK_REM expression */ + { 331, -3 }, /* (334) expression ::= column_reference NK_ARROW NK_STRING */ + { 331, -3 }, /* (335) expression ::= expression NK_BITAND expression */ + { 331, -3 }, /* (336) expression ::= expression NK_BITOR expression */ + { 292, -1 }, /* (337) expression_list ::= expression */ + { 292, -3 }, /* (338) expression_list ::= expression_list NK_COMMA expression */ + { 333, -1 }, /* (339) column_reference ::= column_name */ + { 333, -3 }, /* (340) column_reference ::= table_name NK_DOT column_name */ + { 332, -1 }, /* (341) pseudo_column ::= ROWTS */ + { 332, -1 }, /* (342) pseudo_column ::= TBNAME */ + { 332, -3 }, /* (343) pseudo_column ::= table_name NK_DOT TBNAME */ + { 332, -1 }, /* (344) pseudo_column ::= QSTART */ + { 332, -1 }, /* (345) pseudo_column ::= QEND */ + { 332, -1 }, /* (346) pseudo_column ::= QDURATION */ + { 332, -1 }, /* (347) pseudo_column ::= WSTART */ + { 332, -1 }, /* (348) pseudo_column ::= WEND */ + { 332, -1 }, /* (349) pseudo_column ::= WDURATION */ + { 334, -4 }, /* (350) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 334, -4 }, /* (351) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 334, -6 }, /* (352) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 334, -1 }, /* (353) function_expression ::= literal_func */ + { 327, -3 }, /* (354) literal_func ::= noarg_func NK_LP NK_RP */ + { 327, -1 }, /* (355) literal_func ::= NOW */ + { 338, -1 }, /* (356) noarg_func ::= NOW */ + { 338, -1 }, /* (357) noarg_func ::= TODAY */ + { 338, -1 }, /* (358) noarg_func ::= TIMEZONE */ + { 338, -1 }, /* (359) noarg_func ::= DATABASE */ + { 338, -1 }, /* (360) noarg_func ::= CLIENT_VERSION */ + { 338, -1 }, /* (361) noarg_func ::= SERVER_VERSION */ + { 338, -1 }, /* (362) noarg_func ::= SERVER_STATUS */ + { 338, -1 }, /* (363) noarg_func ::= CURRENT_USER */ + { 338, -1 }, /* (364) noarg_func ::= USER */ + { 336, -1 }, /* (365) star_func ::= COUNT */ + { 336, -1 }, /* (366) star_func ::= FIRST */ + { 336, -1 }, /* (367) star_func ::= LAST */ + { 336, -1 }, /* (368) star_func ::= LAST_ROW */ + { 337, -1 }, /* (369) star_func_para_list ::= NK_STAR */ + { 337, -1 }, /* (370) star_func_para_list ::= other_para_list */ + { 339, -1 }, /* (371) other_para_list ::= star_func_para */ + { 339, -3 }, /* (372) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 340, -1 }, /* (373) star_func_para ::= expression */ + { 340, -3 }, /* (374) star_func_para ::= table_name NK_DOT NK_STAR */ + { 341, -3 }, /* (375) predicate ::= expression compare_op expression */ + { 341, -5 }, /* (376) predicate ::= expression BETWEEN expression AND expression */ + { 341, -6 }, /* (377) predicate ::= expression NOT BETWEEN expression AND expression */ + { 341, -3 }, /* (378) predicate ::= expression IS NULL */ + { 341, -4 }, /* (379) predicate ::= expression IS NOT NULL */ + { 341, -3 }, /* (380) predicate ::= expression in_op in_predicate_value */ + { 342, -1 }, /* (381) compare_op ::= NK_LT */ + { 342, -1 }, /* (382) compare_op ::= NK_GT */ + { 342, -1 }, /* (383) compare_op ::= NK_LE */ + { 342, -1 }, /* (384) compare_op ::= NK_GE */ + { 342, -1 }, /* (385) compare_op ::= NK_NE */ + { 342, -1 }, /* (386) compare_op ::= NK_EQ */ + { 342, -1 }, /* (387) compare_op ::= LIKE */ + { 342, -2 }, /* (388) compare_op ::= NOT LIKE */ + { 342, -1 }, /* (389) compare_op ::= MATCH */ + { 342, -1 }, /* (390) compare_op ::= NMATCH */ + { 342, -1 }, /* (391) compare_op ::= CONTAINS */ + { 343, -1 }, /* (392) in_op ::= IN */ + { 343, -2 }, /* (393) in_op ::= NOT IN */ + { 344, -3 }, /* (394) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 345, -1 }, /* (395) boolean_value_expression ::= boolean_primary */ + { 345, -2 }, /* (396) boolean_value_expression ::= NOT boolean_primary */ + { 345, -3 }, /* (397) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 345, -3 }, /* (398) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 346, -1 }, /* (399) boolean_primary ::= predicate */ + { 346, -3 }, /* (400) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 347, -1 }, /* (401) common_expression ::= expression */ + { 347, -1 }, /* (402) common_expression ::= boolean_value_expression */ + { 348, 0 }, /* (403) from_clause_opt ::= */ + { 348, -2 }, /* (404) from_clause_opt ::= FROM table_reference_list */ + { 349, -1 }, /* (405) table_reference_list ::= table_reference */ + { 349, -3 }, /* (406) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 350, -1 }, /* (407) table_reference ::= table_primary */ + { 350, -1 }, /* (408) table_reference ::= joined_table */ + { 351, -2 }, /* (409) table_primary ::= table_name alias_opt */ + { 351, -4 }, /* (410) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 351, -2 }, /* (411) table_primary ::= subquery alias_opt */ + { 351, -1 }, /* (412) table_primary ::= parenthesized_joined_table */ + { 353, 0 }, /* (413) alias_opt ::= */ + { 353, -1 }, /* (414) alias_opt ::= table_alias */ + { 353, -2 }, /* (415) alias_opt ::= AS table_alias */ + { 354, -3 }, /* (416) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 354, -3 }, /* (417) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 352, -6 }, /* (418) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 355, 0 }, /* (419) join_type ::= */ + { 355, -1 }, /* (420) join_type ::= INNER */ + { 357, -12 }, /* (421) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 358, 0 }, /* (422) set_quantifier_opt ::= */ + { 358, -1 }, /* (423) set_quantifier_opt ::= DISTINCT */ + { 358, -1 }, /* (424) set_quantifier_opt ::= ALL */ + { 359, -1 }, /* (425) select_list ::= select_item */ + { 359, -3 }, /* (426) select_list ::= select_list NK_COMMA select_item */ + { 367, -1 }, /* (427) select_item ::= NK_STAR */ + { 367, -1 }, /* (428) select_item ::= common_expression */ + { 367, -2 }, /* (429) select_item ::= common_expression column_alias */ + { 367, -3 }, /* (430) select_item ::= common_expression AS column_alias */ + { 367, -3 }, /* (431) select_item ::= table_name NK_DOT NK_STAR */ + { 325, 0 }, /* (432) where_clause_opt ::= */ + { 325, -2 }, /* (433) where_clause_opt ::= WHERE search_condition */ + { 360, 0 }, /* (434) partition_by_clause_opt ::= */ + { 360, -3 }, /* (435) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 364, 0 }, /* (436) twindow_clause_opt ::= */ + { 364, -6 }, /* (437) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 364, -4 }, /* (438) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 364, -6 }, /* (439) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 364, -8 }, /* (440) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 311, 0 }, /* (441) sliding_opt ::= */ + { 311, -4 }, /* (442) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 363, 0 }, /* (443) fill_opt ::= */ + { 363, -4 }, /* (444) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 363, -6 }, /* (445) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 368, -1 }, /* (446) fill_mode ::= NONE */ + { 368, -1 }, /* (447) fill_mode ::= PREV */ + { 368, -1 }, /* (448) fill_mode ::= NULL */ + { 368, -1 }, /* (449) fill_mode ::= LINEAR */ + { 368, -1 }, /* (450) fill_mode ::= NEXT */ + { 365, 0 }, /* (451) group_by_clause_opt ::= */ + { 365, -3 }, /* (452) group_by_clause_opt ::= GROUP BY group_by_list */ + { 369, -1 }, /* (453) group_by_list ::= expression */ + { 369, -3 }, /* (454) group_by_list ::= group_by_list NK_COMMA expression */ + { 366, 0 }, /* (455) having_clause_opt ::= */ + { 366, -2 }, /* (456) having_clause_opt ::= HAVING search_condition */ + { 361, 0 }, /* (457) range_opt ::= */ + { 361, -6 }, /* (458) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 362, 0 }, /* (459) every_opt ::= */ + { 362, -4 }, /* (460) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 316, -4 }, /* (461) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 370, -1 }, /* (462) query_expression_body ::= query_primary */ + { 370, -4 }, /* (463) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 370, -3 }, /* (464) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 374, -1 }, /* (465) query_primary ::= query_specification */ + { 374, -6 }, /* (466) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 371, 0 }, /* (467) order_by_clause_opt ::= */ + { 371, -3 }, /* (468) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 372, 0 }, /* (469) slimit_clause_opt ::= */ + { 372, -2 }, /* (470) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 372, -4 }, /* (471) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 372, -4 }, /* (472) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 373, 0 }, /* (473) limit_clause_opt ::= */ + { 373, -2 }, /* (474) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 373, -4 }, /* (475) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 373, -4 }, /* (476) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 335, -3 }, /* (477) subquery ::= NK_LP query_expression NK_RP */ + { 356, -1 }, /* (478) search_condition ::= common_expression */ + { 375, -1 }, /* (479) sort_specification_list ::= sort_specification */ + { 375, -3 }, /* (480) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 376, -3 }, /* (481) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 377, 0 }, /* (482) ordering_specification_opt ::= */ + { 377, -1 }, /* (483) ordering_specification_opt ::= ASC */ + { 377, -1 }, /* (484) ordering_specification_opt ::= DESC */ + { 378, 0 }, /* (485) null_ordering_opt ::= */ + { 378, -2 }, /* (486) null_ordering_opt ::= NULLS FIRST */ + { 378, -2 }, /* (487) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3448,30 +3430,30 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 313: /* db_name ::= NK_ID */ yytestcase(yyruleno==313); - case 314: /* table_name ::= NK_ID */ yytestcase(yyruleno==314); - case 315: /* column_name ::= NK_ID */ yytestcase(yyruleno==315); - case 316: /* function_name ::= NK_ID */ yytestcase(yyruleno==316); - case 317: /* table_alias ::= NK_ID */ yytestcase(yyruleno==317); - case 318: /* column_alias ::= NK_ID */ yytestcase(yyruleno==318); - case 319: /* user_name ::= NK_ID */ yytestcase(yyruleno==319); - case 320: /* index_name ::= NK_ID */ yytestcase(yyruleno==320); - case 321: /* topic_name ::= NK_ID */ yytestcase(yyruleno==321); - case 322: /* stream_name ::= NK_ID */ yytestcase(yyruleno==322); - case 323: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==323); - case 359: /* noarg_func ::= NOW */ yytestcase(yyruleno==359); - case 360: /* noarg_func ::= TODAY */ yytestcase(yyruleno==360); - case 361: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==361); - case 362: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==362); - case 363: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==363); - case 364: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==364); - case 365: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==365); - case 366: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==366); - case 367: /* noarg_func ::= USER */ yytestcase(yyruleno==367); - case 368: /* star_func ::= COUNT */ yytestcase(yyruleno==368); - case 369: /* star_func ::= FIRST */ yytestcase(yyruleno==369); - case 370: /* star_func ::= LAST */ yytestcase(yyruleno==370); - case 371: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==371); + case 310: /* db_name ::= NK_ID */ yytestcase(yyruleno==310); + case 311: /* table_name ::= NK_ID */ yytestcase(yyruleno==311); + case 312: /* column_name ::= NK_ID */ yytestcase(yyruleno==312); + case 313: /* function_name ::= NK_ID */ yytestcase(yyruleno==313); + case 314: /* table_alias ::= NK_ID */ yytestcase(yyruleno==314); + case 315: /* column_alias ::= NK_ID */ yytestcase(yyruleno==315); + case 316: /* user_name ::= NK_ID */ yytestcase(yyruleno==316); + case 317: /* index_name ::= NK_ID */ yytestcase(yyruleno==317); + case 318: /* topic_name ::= NK_ID */ yytestcase(yyruleno==318); + case 319: /* stream_name ::= NK_ID */ yytestcase(yyruleno==319); + case 320: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==320); + case 356: /* noarg_func ::= NOW */ yytestcase(yyruleno==356); + case 357: /* noarg_func ::= TODAY */ yytestcase(yyruleno==357); + case 358: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==358); + case 359: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==359); + case 360: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==360); + case 361: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==361); + case 362: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==362); + case 363: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==363); + case 364: /* noarg_func ::= USER */ yytestcase(yyruleno==364); + case 365: /* star_func ::= COUNT */ yytestcase(yyruleno==365); + case 366: /* star_func ::= FIRST */ yytestcase(yyruleno==366); + case 367: /* star_func ::= LAST */ yytestcase(yyruleno==367); + case 368: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==368); { yylhsminor.yy361 = yymsp[0].minor.yy0; } yymsp[0].minor.yy361 = yylhsminor.yy361; break; @@ -3528,9 +3510,9 @@ static YYACTIONTYPE yy_reduce( break; case 69: /* not_exists_opt ::= */ case 71: /* exists_opt ::= */ yytestcase(yyruleno==71); - case 252: /* analyze_opt ::= */ yytestcase(yyruleno==252); - case 260: /* agg_func_opt ::= */ yytestcase(yyruleno==260); - case 425: /* set_quantifier_opt ::= */ yytestcase(yyruleno==425); + case 249: /* analyze_opt ::= */ yytestcase(yyruleno==249); + case 257: /* agg_func_opt ::= */ yytestcase(yyruleno==257); + case 422: /* set_quantifier_opt ::= */ yytestcase(yyruleno==422); { yymsp[1].minor.yy151 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ @@ -3625,664 +3607,655 @@ static YYACTIONTYPE yy_reduce( { yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy616, &yymsp[0].minor.yy409); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 96: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 97: /* alter_db_option ::= CACHEMODEL NK_STRING */ + case 96: /* alter_db_option ::= CACHEMODEL NK_STRING */ { yymsp[-1].minor.yy409.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; - case 98: /* alter_db_option ::= CACHESIZE NK_INTEGER */ + case 97: /* alter_db_option ::= CACHESIZE NK_INTEGER */ { yymsp[-1].minor.yy409.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; - case 99: /* alter_db_option ::= FSYNC NK_INTEGER */ + case 98: /* alter_db_option ::= FSYNC NK_INTEGER */ { yymsp[-1].minor.yy409.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; - case 100: /* alter_db_option ::= KEEP integer_list */ - case 101: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==101); + case 99: /* alter_db_option ::= KEEP integer_list */ + case 100: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==100); { yymsp[-1].minor.yy409.type = DB_OPTION_KEEP; yymsp[-1].minor.yy409.pList = yymsp[0].minor.yy356; } break; - case 102: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_PAGES; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 103: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 104: /* alter_db_option ::= STRICT NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_STRICT; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 105: /* alter_db_option ::= WAL NK_INTEGER */ + case 101: /* alter_db_option ::= WAL NK_INTEGER */ { yymsp[-1].minor.yy409.type = DB_OPTION_WAL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; - case 106: /* integer_list ::= NK_INTEGER */ + case 102: /* integer_list ::= NK_INTEGER */ { yylhsminor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 107: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 282: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==282); + case 103: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 279: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==279); { yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy356 = yylhsminor.yy356; break; - case 108: /* variable_list ::= NK_VARIABLE */ + case 104: /* variable_list ::= NK_VARIABLE */ { yylhsminor.yy356 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 109: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + case 105: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ { yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy356 = yylhsminor.yy356; break; - case 110: /* retention_list ::= retention */ - case 130: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==130); - case 133: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==133); - case 140: /* column_def_list ::= column_def */ yytestcase(yyruleno==140); - case 183: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==183); - case 188: /* col_name_list ::= col_name */ yytestcase(yyruleno==188); - case 235: /* func_list ::= func */ yytestcase(yyruleno==235); - case 311: /* literal_list ::= signed_literal */ yytestcase(yyruleno==311); - case 374: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==374); - case 428: /* select_list ::= select_item */ yytestcase(yyruleno==428); - case 482: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==482); + case 106: /* retention_list ::= retention */ + case 126: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==126); + case 129: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==129); + case 136: /* column_def_list ::= column_def */ yytestcase(yyruleno==136); + case 179: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==179); + case 184: /* col_name_list ::= col_name */ yytestcase(yyruleno==184); + case 232: /* func_list ::= func */ yytestcase(yyruleno==232); + case 308: /* literal_list ::= signed_literal */ yytestcase(yyruleno==308); + case 371: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==371); + case 425: /* select_list ::= select_item */ yytestcase(yyruleno==425); + case 479: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==479); { yylhsminor.yy356 = createNodeList(pCxt, yymsp[0].minor.yy616); } yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 111: /* retention_list ::= retention_list NK_COMMA retention */ - case 141: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==141); - case 184: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==184); - case 189: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==189); - case 236: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==236); - case 312: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==312); - case 375: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==375); - case 429: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==429); - case 483: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==483); + case 107: /* retention_list ::= retention_list NK_COMMA retention */ + case 137: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==137); + case 180: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==180); + case 185: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); + case 233: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==233); + case 309: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==309); + case 372: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==372); + case 426: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==426); + case 480: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==480); { yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } yymsp[-2].minor.yy356 = yylhsminor.yy356; break; - case 112: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + case 108: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ { yylhsminor.yy616 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 113: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 115: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==115); + case 109: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 111: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==111); { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-5].minor.yy616, yymsp[-3].minor.yy356, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); } break; - case 114: /* cmd ::= CREATE TABLE multi_create_clause */ + case 110: /* cmd ::= CREATE TABLE multi_create_clause */ { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy356); } break; - case 116: /* cmd ::= DROP TABLE multi_drop_clause */ + case 112: /* cmd ::= DROP TABLE multi_drop_clause */ { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy356); } break; - case 117: /* cmd ::= DROP STABLE exists_opt full_table_name */ + case 113: /* cmd ::= DROP STABLE exists_opt full_table_name */ { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); } break; - case 118: /* cmd ::= ALTER TABLE alter_table_clause */ - case 285: /* cmd ::= query_expression */ yytestcase(yyruleno==285); + case 114: /* cmd ::= ALTER TABLE alter_table_clause */ + case 282: /* cmd ::= query_expression */ yytestcase(yyruleno==282); { pCxt->pRootNode = yymsp[0].minor.yy616; } break; - case 119: /* cmd ::= ALTER STABLE alter_table_clause */ + case 115: /* cmd ::= ALTER STABLE alter_table_clause */ { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy616); } break; - case 120: /* alter_table_clause ::= full_table_name alter_table_options */ + case 116: /* alter_table_clause ::= full_table_name alter_table_options */ { yylhsminor.yy616 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 121: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + case 117: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ { yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 122: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ + case 118: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ { yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy361); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 123: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + case 119: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ { yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 124: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + case 120: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ { yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 125: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + case 121: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ { yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 126: /* alter_table_clause ::= full_table_name DROP TAG column_name */ + case 122: /* alter_table_clause ::= full_table_name DROP TAG column_name */ { yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy361); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 127: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + case 123: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ { yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 128: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + case 124: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ { yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 129: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + case 125: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ { yylhsminor.yy616 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy616, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); } yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 131: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 134: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==134); + case 127: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 130: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==130); { yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); } yymsp[-1].minor.yy356 = yylhsminor.yy356; break; - case 132: /* 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 128: /* 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.yy616 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy151, yymsp[-8].minor.yy616, yymsp[-6].minor.yy616, yymsp[-5].minor.yy356, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } yymsp[-9].minor.yy616 = yylhsminor.yy616; break; - case 135: /* drop_table_clause ::= exists_opt full_table_name */ + case 131: /* drop_table_clause ::= exists_opt full_table_name */ { yylhsminor.yy616 = createDropTableClause(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 136: /* specific_cols_opt ::= */ - case 167: /* tags_def_opt ::= */ yytestcase(yyruleno==167); - case 437: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==437); - case 454: /* group_by_clause_opt ::= */ yytestcase(yyruleno==454); - case 470: /* order_by_clause_opt ::= */ yytestcase(yyruleno==470); + case 132: /* specific_cols_opt ::= */ + case 163: /* tags_def_opt ::= */ yytestcase(yyruleno==163); + case 434: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==434); + case 451: /* group_by_clause_opt ::= */ yytestcase(yyruleno==451); + case 467: /* order_by_clause_opt ::= */ yytestcase(yyruleno==467); { yymsp[1].minor.yy356 = NULL; } break; - case 137: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 133: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ { yymsp[-2].minor.yy356 = yymsp[-1].minor.yy356; } break; - case 138: /* full_table_name ::= table_name */ + case 134: /* full_table_name ::= table_name */ { yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy361, NULL); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 139: /* full_table_name ::= db_name NK_DOT table_name */ + case 135: /* full_table_name ::= db_name NK_DOT table_name */ { yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, NULL); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 142: /* column_def ::= column_name type_name */ + case 138: /* column_def ::= column_name type_name */ { yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600, NULL); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 143: /* column_def ::= column_name type_name COMMENT NK_STRING */ + case 139: /* column_def ::= column_name type_name COMMENT NK_STRING */ { yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 144: /* type_name ::= BOOL */ + case 140: /* type_name ::= BOOL */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 145: /* type_name ::= TINYINT */ + case 141: /* type_name ::= TINYINT */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 146: /* type_name ::= SMALLINT */ + case 142: /* type_name ::= SMALLINT */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 147: /* type_name ::= INT */ - case 148: /* type_name ::= INTEGER */ yytestcase(yyruleno==148); + case 143: /* type_name ::= INT */ + case 144: /* type_name ::= INTEGER */ yytestcase(yyruleno==144); { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 149: /* type_name ::= BIGINT */ + case 145: /* type_name ::= BIGINT */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 150: /* type_name ::= FLOAT */ + case 146: /* type_name ::= FLOAT */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 151: /* type_name ::= DOUBLE */ + case 147: /* type_name ::= DOUBLE */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 152: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + case 148: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 153: /* type_name ::= TIMESTAMP */ + case 149: /* type_name ::= TIMESTAMP */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 154: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + case 150: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 155: /* type_name ::= TINYINT UNSIGNED */ + case 151: /* type_name ::= TINYINT UNSIGNED */ { yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 156: /* type_name ::= SMALLINT UNSIGNED */ + case 152: /* type_name ::= SMALLINT UNSIGNED */ { yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 157: /* type_name ::= INT UNSIGNED */ + case 153: /* type_name ::= INT UNSIGNED */ { yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 158: /* type_name ::= BIGINT UNSIGNED */ + case 154: /* type_name ::= BIGINT UNSIGNED */ { yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 159: /* type_name ::= JSON */ + case 155: /* type_name ::= JSON */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 160: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + case 156: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 161: /* type_name ::= MEDIUMBLOB */ + case 157: /* type_name ::= MEDIUMBLOB */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 162: /* type_name ::= BLOB */ + case 158: /* type_name ::= BLOB */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 163: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + case 159: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 164: /* type_name ::= DECIMAL */ + case 160: /* type_name ::= DECIMAL */ { yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 165: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + case 161: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 166: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 168: /* tags_def_opt ::= tags_def */ - case 373: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==373); + case 164: /* tags_def_opt ::= tags_def */ + case 370: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==370); { yylhsminor.yy356 = yymsp[0].minor.yy356; } yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 169: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 165: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ { yymsp[-3].minor.yy356 = yymsp[-1].minor.yy356; } break; - case 170: /* table_options ::= */ + case 166: /* table_options ::= */ { yymsp[1].minor.yy616 = createDefaultTableOptions(pCxt); } break; - case 171: /* table_options ::= table_options COMMENT NK_STRING */ + case 167: /* table_options ::= table_options COMMENT NK_STRING */ { yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 172: /* table_options ::= table_options MAX_DELAY duration_list */ + case 168: /* table_options ::= table_options MAX_DELAY duration_list */ { yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy356); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 173: /* table_options ::= table_options WATERMARK duration_list */ + case 169: /* table_options ::= table_options WATERMARK duration_list */ { yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy356); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 174: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + case 170: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ { yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy356); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 175: /* table_options ::= table_options TTL NK_INTEGER */ + case 171: /* table_options ::= table_options TTL NK_INTEGER */ { yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 176: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + case 172: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ { yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_SMA, yymsp[-1].minor.yy356); } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 177: /* alter_table_options ::= alter_table_option */ + case 173: /* alter_table_options ::= alter_table_option */ { yylhsminor.yy616 = createAlterTableOptions(pCxt); yylhsminor.yy616 = setTableOption(pCxt, yylhsminor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 178: /* alter_table_options ::= alter_table_options alter_table_option */ + case 174: /* alter_table_options ::= alter_table_options alter_table_option */ { yylhsminor.yy616 = setTableOption(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 179: /* alter_table_option ::= COMMENT NK_STRING */ + case 175: /* alter_table_option ::= COMMENT NK_STRING */ { yymsp[-1].minor.yy409.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; - case 180: /* alter_table_option ::= TTL NK_INTEGER */ + case 176: /* alter_table_option ::= TTL NK_INTEGER */ { yymsp[-1].minor.yy409.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } break; - case 181: /* duration_list ::= duration_literal */ - case 340: /* expression_list ::= expression */ yytestcase(yyruleno==340); + case 177: /* duration_list ::= duration_literal */ + case 337: /* expression_list ::= expression */ yytestcase(yyruleno==337); { yylhsminor.yy356 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 182: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 341: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==341); + case 178: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 338: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==338); { yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } yymsp[-2].minor.yy356 = yylhsminor.yy356; break; - case 185: /* rollup_func_name ::= function_name */ + case 181: /* rollup_func_name ::= function_name */ { yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy361, NULL); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 186: /* rollup_func_name ::= FIRST */ - case 187: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==187); + case 182: /* rollup_func_name ::= FIRST */ + case 183: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==183); { yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 190: /* col_name ::= column_name */ + case 186: /* col_name ::= column_name */ { yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 191: /* cmd ::= SHOW DNODES */ + case 187: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 192: /* cmd ::= SHOW USERS */ + case 188: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 193: /* cmd ::= SHOW DATABASES */ + case 189: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 194: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + case 190: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); } break; - case 195: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + case 191: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); } break; - case 196: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ + case 192: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy616, NULL, OP_TYPE_LIKE); } break; - case 197: /* cmd ::= SHOW MNODES */ + case 193: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 198: /* cmd ::= SHOW MODULES */ + case 194: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT); } break; - case 199: /* cmd ::= SHOW QNODES */ + case 195: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 200: /* cmd ::= SHOW FUNCTIONS */ + case 196: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 201: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + case 197: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy616, yymsp[-1].minor.yy616, OP_TYPE_EQUAL); } break; - case 202: /* cmd ::= SHOW STREAMS */ + case 198: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 203: /* cmd ::= SHOW ACCOUNTS */ + case 199: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 204: /* cmd ::= SHOW APPS */ + case 200: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 205: /* cmd ::= SHOW CONNECTIONS */ + case 201: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 206: /* cmd ::= SHOW LICENCE */ - case 207: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==207); + case 202: /* cmd ::= SHOW LICENCE */ + case 203: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==203); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; - case 208: /* cmd ::= SHOW CREATE DATABASE db_name */ + case 204: /* cmd ::= SHOW CREATE DATABASE db_name */ { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } break; - case 209: /* cmd ::= SHOW CREATE TABLE full_table_name */ + case 205: /* cmd ::= SHOW CREATE TABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy616); } break; - case 210: /* cmd ::= SHOW CREATE STABLE full_table_name */ + case 206: /* cmd ::= SHOW CREATE STABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy616); } break; - case 211: /* cmd ::= SHOW QUERIES */ + case 207: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 212: /* cmd ::= SHOW SCORES */ + case 208: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 213: /* cmd ::= SHOW TOPICS */ + case 209: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 214: /* cmd ::= SHOW VARIABLES */ + case 210: /* cmd ::= SHOW VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 215: /* cmd ::= SHOW LOCAL VARIABLES */ + case 211: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 216: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + case 212: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-1].minor.yy0)); } break; - case 217: /* cmd ::= SHOW BNODES */ + case 213: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 218: /* cmd ::= SHOW SNODES */ + case 214: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 219: /* cmd ::= SHOW CLUSTER */ + case 215: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 220: /* cmd ::= SHOW TRANSACTIONS */ + case 216: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 221: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + case 217: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy616); } break; - case 222: /* cmd ::= SHOW CONSUMERS */ + case 218: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 223: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 219: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 224: /* db_name_cond_opt ::= */ - case 229: /* from_db_opt ::= */ yytestcase(yyruleno==229); + case 220: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy616, yymsp[-1].minor.yy616, OP_TYPE_EQUAL); } + break; + case 221: /* db_name_cond_opt ::= */ + case 226: /* from_db_opt ::= */ yytestcase(yyruleno==226); { yymsp[1].minor.yy616 = createDefaultDatabaseCondValue(pCxt); } break; - case 225: /* db_name_cond_opt ::= db_name NK_DOT */ + case 222: /* db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy361); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 226: /* like_pattern_opt ::= */ - case 266: /* into_opt ::= */ yytestcase(yyruleno==266); - case 406: /* from_clause_opt ::= */ yytestcase(yyruleno==406); - case 435: /* where_clause_opt ::= */ yytestcase(yyruleno==435); - case 439: /* twindow_clause_opt ::= */ yytestcase(yyruleno==439); - case 444: /* sliding_opt ::= */ yytestcase(yyruleno==444); - case 446: /* fill_opt ::= */ yytestcase(yyruleno==446); - case 458: /* having_clause_opt ::= */ yytestcase(yyruleno==458); - case 460: /* range_opt ::= */ yytestcase(yyruleno==460); - case 462: /* every_opt ::= */ yytestcase(yyruleno==462); - case 472: /* slimit_clause_opt ::= */ yytestcase(yyruleno==472); - case 476: /* limit_clause_opt ::= */ yytestcase(yyruleno==476); + case 223: /* like_pattern_opt ::= */ + case 263: /* into_opt ::= */ yytestcase(yyruleno==263); + case 403: /* from_clause_opt ::= */ yytestcase(yyruleno==403); + case 432: /* where_clause_opt ::= */ yytestcase(yyruleno==432); + case 436: /* twindow_clause_opt ::= */ yytestcase(yyruleno==436); + case 441: /* sliding_opt ::= */ yytestcase(yyruleno==441); + case 443: /* fill_opt ::= */ yytestcase(yyruleno==443); + case 455: /* having_clause_opt ::= */ yytestcase(yyruleno==455); + case 457: /* range_opt ::= */ yytestcase(yyruleno==457); + case 459: /* every_opt ::= */ yytestcase(yyruleno==459); + case 469: /* slimit_clause_opt ::= */ yytestcase(yyruleno==469); + case 473: /* limit_clause_opt ::= */ yytestcase(yyruleno==473); { yymsp[1].minor.yy616 = NULL; } break; - case 227: /* like_pattern_opt ::= LIKE NK_STRING */ + case 224: /* like_pattern_opt ::= LIKE NK_STRING */ { yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 228: /* table_name_cond ::= table_name */ + case 225: /* table_name_cond ::= table_name */ { yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 230: /* from_db_opt ::= FROM db_name */ + case 227: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); } break; - case 231: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + case 228: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy361, NULL, yymsp[0].minor.yy616); } break; - case 232: /* cmd ::= DROP INDEX exists_opt index_name */ + case 229: /* cmd ::= DROP INDEX exists_opt index_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; - case 233: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + case 230: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-9].minor.yy616 = createIndexOption(pCxt, yymsp[-7].minor.yy356, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 234: /* 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 231: /* 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.yy616 = createIndexOption(pCxt, yymsp[-9].minor.yy356, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 237: /* func ::= function_name NK_LP expression_list NK_RP */ + case 234: /* func ::= function_name NK_LP expression_list NK_RP */ { yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 238: /* sma_stream_opt ::= */ - case 268: /* stream_options ::= */ yytestcase(yyruleno==268); + case 235: /* sma_stream_opt ::= */ + case 265: /* stream_options ::= */ yytestcase(yyruleno==265); { yymsp[1].minor.yy616 = createStreamOptions(pCxt); } break; - case 239: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ - case 272: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==272); + case 236: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ + case 269: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==269); { ((SStreamOptions*)yymsp[-2].minor.yy616)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 240: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + case 237: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); } break; - case 242: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + case 239: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy361, false); } break; - case 243: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[0].minor.yy361, true); } break; - case 244: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, yymsp[0].minor.yy616, false); } break; - case 245: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + case 242: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, yymsp[0].minor.yy616, true); } break; - case 246: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 243: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; - case 247: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + case 244: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); } break; - case 248: /* cmd ::= DESC full_table_name */ - case 249: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==249); + case 245: /* cmd ::= DESC full_table_name */ + case 246: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==246); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy616); } break; - case 250: /* cmd ::= RESET QUERY CACHE */ + case 247: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 251: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + case 248: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy151, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 253: /* analyze_opt ::= ANALYZE */ - case 261: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==261); - case 426: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==426); + case 250: /* analyze_opt ::= ANALYZE */ + case 258: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==258); + case 423: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==423); { yymsp[0].minor.yy151 = true; } break; - case 254: /* explain_options ::= */ + case 251: /* explain_options ::= */ { yymsp[1].minor.yy616 = createDefaultExplainOptions(pCxt); } break; - case 255: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 252: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy616 = setExplainVerbose(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 256: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 253: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy616 = setExplainRatio(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 257: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + case 254: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ { pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy356); } break; - case 258: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + case 255: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-8].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy600, yymsp[0].minor.yy734); } break; - case 259: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 256: /* cmd ::= DROP FUNCTION exists_opt function_name */ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; - case 262: /* bufsize_opt ::= */ + case 259: /* bufsize_opt ::= */ { yymsp[1].minor.yy734 = 0; } break; - case 263: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ + case 260: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ { yymsp[-1].minor.yy734 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 264: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + case 261: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy151, &yymsp[-4].minor.yy361, yymsp[-2].minor.yy616, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); } break; - case 265: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 262: /* cmd ::= DROP STREAM exists_opt stream_name */ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } break; - case 267: /* into_opt ::= INTO full_table_name */ - case 407: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==407); - case 436: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==436); - case 459: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==459); + case 264: /* into_opt ::= INTO full_table_name */ + case 404: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==404); + case 433: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==433); + case 456: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==456); { yymsp[-1].minor.yy616 = yymsp[0].minor.yy616; } break; - case 269: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 266: /* stream_options ::= stream_options TRIGGER AT_ONCE */ { ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 270: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + case 267: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ { ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 271: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 268: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-3].minor.yy616)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-3].minor.yy616; } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 273: /* stream_options ::= stream_options IGNORE EXPIRED */ + case 270: /* stream_options ::= stream_options IGNORE EXPIRED */ { ((SStreamOptions*)yymsp[-2].minor.yy616)->ignoreExpired = true; yylhsminor.yy616 = yymsp[-2].minor.yy616; } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 274: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 271: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 275: /* cmd ::= KILL QUERY NK_STRING */ + case 272: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 276: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 273: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 277: /* cmd ::= BALANCE VGROUP */ + case 274: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 278: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 275: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 279: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + case 276: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy356); } break; - case 280: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 277: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 281: /* dnode_list ::= DNODE NK_INTEGER */ + case 278: /* dnode_list ::= DNODE NK_INTEGER */ { yymsp[-1].minor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 283: /* cmd ::= SYNCDB db_name REPLICA */ + case 280: /* cmd ::= SYNCDB db_name REPLICA */ { pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy361); } break; - case 284: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ + case 281: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 286: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ + case 283: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy616, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } break; - case 287: /* cmd ::= INSERT INTO full_table_name query_expression */ + case 284: /* cmd ::= INSERT INTO full_table_name query_expression */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy616, NULL, yymsp[0].minor.yy616); } break; - case 288: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 285: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 289: /* literal ::= NK_FLOAT */ + case 286: /* literal ::= NK_FLOAT */ { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 290: /* literal ::= NK_STRING */ + case 287: /* literal ::= NK_STRING */ { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 291: /* literal ::= NK_BOOL */ + case 288: /* literal ::= NK_BOOL */ { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 292: /* literal ::= TIMESTAMP NK_STRING */ + case 289: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 293: /* literal ::= duration_literal */ - case 303: /* signed_literal ::= signed */ yytestcase(yyruleno==303); - case 324: /* expression ::= literal */ yytestcase(yyruleno==324); - case 325: /* expression ::= pseudo_column */ yytestcase(yyruleno==325); - case 326: /* expression ::= column_reference */ yytestcase(yyruleno==326); - case 327: /* expression ::= function_expression */ yytestcase(yyruleno==327); - case 328: /* expression ::= subquery */ yytestcase(yyruleno==328); - case 356: /* function_expression ::= literal_func */ yytestcase(yyruleno==356); - case 398: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==398); - case 402: /* boolean_primary ::= predicate */ yytestcase(yyruleno==402); - case 404: /* common_expression ::= expression */ yytestcase(yyruleno==404); - case 405: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==405); - case 408: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==408); - case 410: /* table_reference ::= table_primary */ yytestcase(yyruleno==410); - case 411: /* table_reference ::= joined_table */ yytestcase(yyruleno==411); - case 415: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==415); - case 465: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==465); - case 468: /* query_primary ::= query_specification */ yytestcase(yyruleno==468); + case 290: /* literal ::= duration_literal */ + case 300: /* signed_literal ::= signed */ yytestcase(yyruleno==300); + case 321: /* expression ::= literal */ yytestcase(yyruleno==321); + case 322: /* expression ::= pseudo_column */ yytestcase(yyruleno==322); + case 323: /* expression ::= column_reference */ yytestcase(yyruleno==323); + case 324: /* expression ::= function_expression */ yytestcase(yyruleno==324); + case 325: /* expression ::= subquery */ yytestcase(yyruleno==325); + case 353: /* function_expression ::= literal_func */ yytestcase(yyruleno==353); + case 395: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==395); + case 399: /* boolean_primary ::= predicate */ yytestcase(yyruleno==399); + case 401: /* common_expression ::= expression */ yytestcase(yyruleno==401); + case 402: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==402); + case 405: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==405); + case 407: /* table_reference ::= table_primary */ yytestcase(yyruleno==407); + case 408: /* table_reference ::= joined_table */ yytestcase(yyruleno==408); + case 412: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==412); + case 462: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==462); + case 465: /* query_primary ::= query_specification */ yytestcase(yyruleno==465); { yylhsminor.yy616 = yymsp[0].minor.yy616; } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 294: /* literal ::= NULL */ + case 291: /* literal ::= NULL */ { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 295: /* literal ::= NK_QUESTION */ + case 292: /* literal ::= NK_QUESTION */ { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 296: /* duration_literal ::= NK_VARIABLE */ + case 293: /* duration_literal ::= NK_VARIABLE */ { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 297: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 294: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 298: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 295: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 299: /* signed ::= NK_MINUS NK_INTEGER */ + case 296: /* 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; @@ -4290,14 +4263,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 300: /* signed ::= NK_FLOAT */ + case 297: /* signed ::= NK_FLOAT */ { yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 301: /* signed ::= NK_PLUS NK_FLOAT */ + case 298: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 302: /* signed ::= NK_MINUS NK_FLOAT */ + case 299: /* 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; @@ -4305,53 +4278,53 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 304: /* signed_literal ::= NK_STRING */ + case 301: /* signed_literal ::= NK_STRING */ { yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 305: /* signed_literal ::= NK_BOOL */ + case 302: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 306: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 303: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 307: /* signed_literal ::= duration_literal */ - case 309: /* signed_literal ::= literal_func */ yytestcase(yyruleno==309); - case 376: /* star_func_para ::= expression */ yytestcase(yyruleno==376); - case 431: /* select_item ::= common_expression */ yytestcase(yyruleno==431); - case 481: /* search_condition ::= common_expression */ yytestcase(yyruleno==481); + case 304: /* signed_literal ::= duration_literal */ + case 306: /* signed_literal ::= literal_func */ yytestcase(yyruleno==306); + case 373: /* star_func_para ::= expression */ yytestcase(yyruleno==373); + case 428: /* select_item ::= common_expression */ yytestcase(yyruleno==428); + case 478: /* search_condition ::= common_expression */ yytestcase(yyruleno==478); { yylhsminor.yy616 = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 308: /* signed_literal ::= NULL */ + case 305: /* signed_literal ::= NULL */ { yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 310: /* signed_literal ::= NK_QUESTION */ + case 307: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy616 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 329: /* expression ::= NK_LP expression NK_RP */ - case 403: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==403); + case 326: /* expression ::= NK_LP expression NK_RP */ + case 400: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==400); { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 330: /* expression ::= NK_PLUS expression */ + case 327: /* expression ::= NK_PLUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 331: /* expression ::= NK_MINUS expression */ + case 328: /* expression ::= NK_MINUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 332: /* expression ::= expression NK_PLUS expression */ + case 329: /* expression ::= expression NK_PLUS expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4359,7 +4332,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 333: /* expression ::= expression NK_MINUS expression */ + case 330: /* expression ::= expression NK_MINUS expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4367,7 +4340,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 334: /* expression ::= expression NK_STAR expression */ + case 331: /* expression ::= expression NK_STAR expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4375,7 +4348,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 335: /* expression ::= expression NK_SLASH expression */ + case 332: /* expression ::= expression NK_SLASH expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4383,7 +4356,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 336: /* expression ::= expression NK_REM expression */ + case 333: /* expression ::= expression NK_REM expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4391,14 +4364,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 337: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 334: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 338: /* expression ::= expression NK_BITAND expression */ + case 335: /* expression ::= expression NK_BITAND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4406,7 +4379,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 339: /* expression ::= expression NK_BITOR expression */ + case 336: /* expression ::= expression NK_BITOR expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4414,54 +4387,54 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 342: /* column_reference ::= column_name */ + case 339: /* column_reference ::= column_name */ { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy361, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 343: /* column_reference ::= table_name NK_DOT column_name */ + case 340: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361)); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 344: /* pseudo_column ::= ROWTS */ - case 345: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==345); - case 347: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==347); - case 348: /* pseudo_column ::= QEND */ yytestcase(yyruleno==348); - case 349: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==349); - case 350: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==350); - case 351: /* pseudo_column ::= WEND */ yytestcase(yyruleno==351); - case 352: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==352); - case 358: /* literal_func ::= NOW */ yytestcase(yyruleno==358); + case 341: /* pseudo_column ::= ROWTS */ + case 342: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==342); + case 344: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==344); + case 345: /* pseudo_column ::= QEND */ yytestcase(yyruleno==345); + case 346: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==346); + case 347: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==347); + case 348: /* pseudo_column ::= WEND */ yytestcase(yyruleno==348); + case 349: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==349); + case 355: /* literal_func ::= NOW */ yytestcase(yyruleno==355); { yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 346: /* pseudo_column ::= table_name NK_DOT TBNAME */ + case 343: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy361)))); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 353: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 354: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==354); + case 350: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 351: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==351); { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356)); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 355: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + case 352: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy600)); } yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 357: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 354: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy361, NULL)); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 372: /* star_func_para_list ::= NK_STAR */ + case 369: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy356 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 377: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 434: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==434); + case 374: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 431: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==431); { yylhsminor.yy616 = createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 378: /* predicate ::= expression compare_op expression */ - case 383: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==383); + case 375: /* predicate ::= expression compare_op expression */ + case 380: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==380); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4469,7 +4442,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 379: /* predicate ::= expression BETWEEN expression AND expression */ + case 376: /* predicate ::= expression BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4477,7 +4450,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 380: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 377: /* predicate ::= expression NOT BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4485,71 +4458,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 381: /* predicate ::= expression IS NULL */ + case 378: /* predicate ::= expression IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), NULL)); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 382: /* predicate ::= expression IS NOT NULL */ + case 379: /* predicate ::= expression IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy616); yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL)); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 384: /* compare_op ::= NK_LT */ + case 381: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy526 = OP_TYPE_LOWER_THAN; } break; - case 385: /* compare_op ::= NK_GT */ + case 382: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy526 = OP_TYPE_GREATER_THAN; } break; - case 386: /* compare_op ::= NK_LE */ + case 383: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy526 = OP_TYPE_LOWER_EQUAL; } break; - case 387: /* compare_op ::= NK_GE */ + case 384: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy526 = OP_TYPE_GREATER_EQUAL; } break; - case 388: /* compare_op ::= NK_NE */ + case 385: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy526 = OP_TYPE_NOT_EQUAL; } break; - case 389: /* compare_op ::= NK_EQ */ + case 386: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy526 = OP_TYPE_EQUAL; } break; - case 390: /* compare_op ::= LIKE */ + case 387: /* compare_op ::= LIKE */ { yymsp[0].minor.yy526 = OP_TYPE_LIKE; } break; - case 391: /* compare_op ::= NOT LIKE */ + case 388: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy526 = OP_TYPE_NOT_LIKE; } break; - case 392: /* compare_op ::= MATCH */ + case 389: /* compare_op ::= MATCH */ { yymsp[0].minor.yy526 = OP_TYPE_MATCH; } break; - case 393: /* compare_op ::= NMATCH */ + case 390: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy526 = OP_TYPE_NMATCH; } break; - case 394: /* compare_op ::= CONTAINS */ + case 391: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy526 = OP_TYPE_JSON_CONTAINS; } break; - case 395: /* in_op ::= IN */ + case 392: /* in_op ::= IN */ { yymsp[0].minor.yy526 = OP_TYPE_IN; } break; - case 396: /* in_op ::= NOT IN */ + case 393: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy526 = OP_TYPE_NOT_IN; } break; - case 397: /* in_predicate_value ::= NK_LP literal_list NK_RP */ + case 394: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 399: /* boolean_value_expression ::= NOT boolean_primary */ + case 396: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 400: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 397: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4557,7 +4530,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 401: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 398: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); @@ -4565,47 +4538,47 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 409: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 406: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy616 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, NULL); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 412: /* table_primary ::= table_name alias_opt */ + case 409: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 413: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 410: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 414: /* table_primary ::= subquery alias_opt */ + case 411: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy616 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 416: /* alias_opt ::= */ + case 413: /* alias_opt ::= */ { yymsp[1].minor.yy361 = nil_token; } break; - case 417: /* alias_opt ::= table_alias */ + case 414: /* alias_opt ::= table_alias */ { yylhsminor.yy361 = yymsp[0].minor.yy361; } yymsp[0].minor.yy361 = yylhsminor.yy361; break; - case 418: /* alias_opt ::= AS table_alias */ + case 415: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy361 = yymsp[0].minor.yy361; } break; - case 419: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 420: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==420); + case 416: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 417: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==417); { yymsp[-2].minor.yy616 = yymsp[-1].minor.yy616; } break; - case 421: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 418: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy616 = createJoinTableNode(pCxt, yymsp[-4].minor.yy504, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 422: /* join_type ::= */ + case 419: /* join_type ::= */ { yymsp[1].minor.yy504 = JOIN_TYPE_INNER; } break; - case 423: /* join_type ::= INNER */ + case 420: /* join_type ::= INNER */ { yymsp[0].minor.yy504 = JOIN_TYPE_INNER; } break; - case 424: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 421: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { yymsp[-11].minor.yy616 = createSelectStmt(pCxt, yymsp[-10].minor.yy151, yymsp[-9].minor.yy356, yymsp[-8].minor.yy616); yymsp[-11].minor.yy616 = addWhereClause(pCxt, yymsp[-11].minor.yy616, yymsp[-7].minor.yy616); @@ -4618,75 +4591,75 @@ static YYACTIONTYPE yy_reduce( yymsp[-11].minor.yy616 = addFillClause(pCxt, yymsp[-11].minor.yy616, yymsp[-3].minor.yy616); } break; - case 427: /* set_quantifier_opt ::= ALL */ + case 424: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy151 = false; } break; - case 430: /* select_item ::= NK_STAR */ + case 427: /* select_item ::= NK_STAR */ { yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 432: /* select_item ::= common_expression column_alias */ + case 429: /* select_item ::= common_expression column_alias */ { yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); } yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 433: /* select_item ::= common_expression AS column_alias */ + case 430: /* select_item ::= common_expression AS column_alias */ { yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), &yymsp[0].minor.yy361); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 438: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 455: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==455); - case 471: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==471); + case 435: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 452: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==452); + case 468: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==468); { yymsp[-2].minor.yy356 = yymsp[0].minor.yy356; } break; - case 440: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 437: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy616 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 441: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + case 438: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ { yymsp[-3].minor.yy616 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 442: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 439: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 443: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 440: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 445: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 463: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==463); + case 442: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 460: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==460); { yymsp[-3].minor.yy616 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy616); } break; - case 447: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 444: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy616 = createFillNode(pCxt, yymsp[-1].minor.yy494, NULL); } break; - case 448: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 445: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy616 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); } break; - case 449: /* fill_mode ::= NONE */ + case 446: /* fill_mode ::= NONE */ { yymsp[0].minor.yy494 = FILL_MODE_NONE; } break; - case 450: /* fill_mode ::= PREV */ + case 447: /* fill_mode ::= PREV */ { yymsp[0].minor.yy494 = FILL_MODE_PREV; } break; - case 451: /* fill_mode ::= NULL */ + case 448: /* fill_mode ::= NULL */ { yymsp[0].minor.yy494 = FILL_MODE_NULL; } break; - case 452: /* fill_mode ::= LINEAR */ + case 449: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy494 = FILL_MODE_LINEAR; } break; - case 453: /* fill_mode ::= NEXT */ + case 450: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy494 = FILL_MODE_NEXT; } break; - case 456: /* group_by_list ::= expression */ + case 453: /* group_by_list ::= expression */ { yylhsminor.yy356 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } yymsp[0].minor.yy356 = yylhsminor.yy356; break; - case 457: /* group_by_list ::= group_by_list NK_COMMA expression */ + case 454: /* group_by_list ::= group_by_list NK_COMMA expression */ { yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } yymsp[-2].minor.yy356 = yylhsminor.yy356; break; - case 461: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + case 458: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ { yymsp[-5].minor.yy616 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 464: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 461: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy616 = addOrderByClause(pCxt, yymsp[-3].minor.yy616, yymsp[-2].minor.yy356); yylhsminor.yy616 = addSlimitClause(pCxt, yylhsminor.yy616, yymsp[-1].minor.yy616); @@ -4694,57 +4667,57 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 466: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + case 463: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); } yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 467: /* query_expression_body ::= query_expression_body UNION query_expression_body */ + case 464: /* query_expression_body ::= query_expression_body UNION query_expression_body */ { yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 469: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + case 466: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ { yymsp[-5].minor.yy616 = addOrderByClause(pCxt, yymsp[-4].minor.yy616, yymsp[-3].minor.yy356); yymsp[-5].minor.yy616 = addSlimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616); yymsp[-5].minor.yy616 = addLimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-1].minor.yy616); } break; - case 473: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 477: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==477); + case 470: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 474: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==474); { yymsp[-1].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 474: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 478: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==478); + case 471: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 475: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==475); { yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 475: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 479: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==479); + case 472: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 476: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==476); { yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 480: /* subquery ::= NK_LP query_expression NK_RP */ + case 477: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy616); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 484: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + case 481: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { yylhsminor.yy616 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), yymsp[-1].minor.yy58, yymsp[0].minor.yy613); } yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 485: /* ordering_specification_opt ::= */ + case 482: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy58 = ORDER_ASC; } break; - case 486: /* ordering_specification_opt ::= ASC */ + case 483: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy58 = ORDER_ASC; } break; - case 487: /* ordering_specification_opt ::= DESC */ + case 484: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy58 = ORDER_DESC; } break; - case 488: /* null_ordering_opt ::= */ + case 485: /* null_ordering_opt ::= */ { yymsp[1].minor.yy613 = NULL_ORDER_DEFAULT; } break; - case 489: /* null_ordering_opt ::= NULLS FIRST */ + case 486: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy613 = NULL_ORDER_FIRST; } break; - case 490: /* null_ordering_opt ::= NULLS LAST */ + case 487: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy613 = NULL_ORDER_LAST; } break; default: diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index 6c6a1f24f0..f064566d5f 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -328,46 +328,6 @@ void initMetaDataEnv() { stub.set(catalogGetTableIndex, __catalogGetTableIndex); stub.set(catalogGetDnodeList, __catalogGetDnodeList); stub.set(catalogRefreshGetTableCfg, __catalogRefreshGetTableCfg); - // { - // AddrAny any("libcatalog.so"); - // std::map result; - // any.get_global_func_addr_dynsym("^catalogGetHandle$", result); - // for (const auto& f : result) { - // stub.set(f.second, __catalogGetHandle); - // } - // } - // { - // AddrAny any("libcatalog.so"); - // std::map result; - // any.get_global_func_addr_dynsym("^catalogGetTableMeta$", result); - // for (const auto& f : result) { - // stub.set(f.second, __catalogGetTableMeta); - // } - // } - // { - // AddrAny any("libcatalog.so"); - // std::map result; - // any.get_global_func_addr_dynsym("^catalogGetTableHashVgroup$", result); - // for (const auto& f : result) { - // stub.set(f.second, __catalogGetTableHashVgroup); - // } - // } - // { - // AddrAny any("libcatalog.so"); - // std::map result; - // any.get_global_func_addr_dynsym("^catalogGetTableDistVgInfo$", result); - // for (const auto& f : result) { - // stub.set(f.second, __catalogGetTableDistVgInfo); - // } - // } - // { - // AddrAny any("libcatalog.so"); - // std::map result; - // any.get_global_func_addr_dynsym("^catalogGetDBVgVersion$", result); - // for (const auto& f : result) { - // stub.set(f.second, __catalogGetDBVgVersion); - // } - // } } void generateMetaData() { diff --git a/source/libs/parser/test/parInitialATest.cpp b/source/libs/parser/test/parInitialATest.cpp index 079a9540c3..39052738f6 100644 --- a/source/libs/parser/test/parInitialATest.cpp +++ b/source/libs/parser/test/parInitialATest.cpp @@ -27,22 +27,217 @@ TEST_F(ParserInitialATest, alterAccount) { run("ALTER ACCOUNT ac_wxy PASS '123456'", TSDB_CODE_PAR_EXPRIE_STATEMENT, PARSER_STAGE_PARSE); } +/* + * ALTER DNODE dnode_id 'config' ['value'] + * ALTER ALL DNODES 'config' ['value'] + */ TEST_F(ParserInitialATest, alterDnode) { useDb("root", "test"); - run("ALTER DNODE 1 'resetLog'"); + SMCfgDnodeReq expect = {0}; - run("ALTER DNODE 1 'debugFlag' '134'"); + auto clearCfgDnodeReq = [&]() { memset(&expect, 0, sizeof(SMCfgDnodeReq)); }; + + auto setCfgDnodeReq = [&](int32_t dnodeId, const char* pConfig, const char* pValue = nullptr) { + expect.dnodeId = dnodeId; + strcpy(expect.config, pConfig); + if (nullptr != pValue) { + strcpy(expect.value, pValue); + } + }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DNODE_STMT); + SMCfgDnodeReq req = {0}; + ASSERT_EQ(tDeserializeSMCfgDnodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); + ASSERT_EQ(req.dnodeId, expect.dnodeId); + ASSERT_EQ(std::string(req.config), std::string(expect.config)); + ASSERT_EQ(std::string(req.value), std::string(expect.value)); + }); + + setCfgDnodeReq(1, "resetLog"); + run("ALTER DNODE 1 'resetLog'"); + clearCfgDnodeReq(); + + setCfgDnodeReq(2, "debugFlag", "134"); + run("ALTER DNODE 2 'debugFlag' '134'"); + clearCfgDnodeReq(); + + setCfgDnodeReq(-1, "resetQueryCache"); + run("ALTER ALL DNODES 'resetQueryCache'"); + clearCfgDnodeReq(); + + setCfgDnodeReq(-1, "qDebugflag", "135"); + run("ALTER ALL DNODES 'qDebugflag' '135'"); + clearCfgDnodeReq(); } +/* + * ALTER DATABASE db_name [alter_database_options] + * + * alter_database_options: + * alter_database_option ... + * + * alter_database_option: { + * BUFFER int_value -- todo: range [3, 16384], default 96, unit MB + * | CACHEMODEL {'none' | 'last_row' | 'last_value' | 'both'} -- default 'none' + * | CACHESIZE int_value -- range [1, 65536], default 1, unit MB + * | FSYNC int_value -- rang [0, 180000], default 3000, unit ms + * | KEEP {int_value | duration_value} -- rang [1, 365000], default 3650, unit day + * | PAGES int_value -- todo: rang [64, +oo), default 256, unit page + * | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica + * | STRICT {'off' | 'on'} -- todo: default 'off' + * | WAL int_value -- enum 1, 2, default 1 + * } + */ TEST_F(ParserInitialATest, alterDatabase) { useDb("root", "test"); - run("ALTER DATABASE test CACHEMODEL 'last_row' FSYNC 200 WAL 1"); + SAlterDbReq expect = {0}; - run("ALTER DATABASE test KEEP 2400"); + auto clearAlterDbReq = [&]() { memset(&expect, 0, sizeof(SAlterDbReq)); }; + + auto initAlterDb = [&](const char* pDb) { + snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); + expect.buffer = -1; + expect.pageSize = -1; + expect.pages = -1; + expect.daysPerFile = -1; + expect.daysToKeep0 = -1; + expect.daysToKeep1 = -1; + expect.daysToKeep2 = -1; + expect.fsyncPeriod = -1; + expect.walLevel = -1; + expect.strict = -1; + expect.cacheLast = -1; + expect.cacheLastSize = -1; + expect.replications = -1; + }; + auto setAlterDbBuffer = [&](int32_t buffer) { expect.buffer = buffer; }; + auto setAlterDbPageSize = [&](int32_t pageSize) { expect.pageSize = pageSize; }; + auto setAlterDbPages = [&](int32_t pages) { expect.pages = pages; }; + auto setAlterDbCacheSize = [&](int32_t cacheSize) { expect.cacheLastSize = cacheSize; }; + auto setAlterDbDuration = [&](int32_t duration) { expect.daysPerFile = duration; }; + auto setAlterDbKeep = [&](int32_t daysToKeep0, int32_t daysToKeep1 = -1, int32_t daysToKeep2 = -1) { + expect.daysToKeep0 = daysToKeep0; + expect.daysToKeep1 = (-1 == daysToKeep1 ? expect.daysToKeep0 : daysToKeep1); + expect.daysToKeep2 = (-1 == daysToKeep1 ? expect.daysToKeep1 : daysToKeep2); + }; + auto setAlterDbFsync = [&](int32_t fsync) { expect.fsyncPeriod = fsync; }; + auto setAlterDbWal = [&](int8_t wal) { expect.walLevel = wal; }; + auto setAlterDbStrict = [&](int8_t strict) { expect.strict = strict; }; + auto setAlterDbCacheModel = [&](int8_t cacheModel) { expect.cacheLast = cacheModel; }; + auto setAlterDbReplica = [&](int8_t replications) { expect.replications = replications; }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DATABASE_STMT); + SAlterDbReq req = {0}; + ASSERT_EQ(tDeserializeSAlterDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); + ASSERT_EQ(std::string(req.db), std::string(expect.db)); + ASSERT_EQ(req.buffer, expect.buffer); + ASSERT_EQ(req.pageSize, expect.pageSize); + ASSERT_EQ(req.pages, expect.pages); + ASSERT_EQ(req.cacheLastSize, expect.cacheLastSize); + ASSERT_EQ(req.daysToKeep0, expect.daysToKeep0); + ASSERT_EQ(req.daysToKeep1, expect.daysToKeep1); + ASSERT_EQ(req.daysToKeep2, expect.daysToKeep2); + ASSERT_EQ(req.fsyncPeriod, expect.fsyncPeriod); + ASSERT_EQ(req.walLevel, expect.walLevel); + ASSERT_EQ(req.strict, expect.strict); + ASSERT_EQ(req.cacheLast, expect.cacheLast); + ASSERT_EQ(req.replications, expect.replications); + }); + + const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE; + const int32_t MINUTE_PER_HOUR = MILLISECOND_PER_HOUR / MILLISECOND_PER_MINUTE; + + initAlterDb("test"); + setAlterDbCacheSize(32); + setAlterDbKeep(10 * MINUTE_PER_DAY); + setAlterDbFsync(200); + setAlterDbWal(1); + setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW); + run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 FSYNC 200 KEEP 10 WAL 1"); + clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbCacheModel(TSDB_CACHE_MODEL_NONE); + run("ALTER DATABASE test CACHEMODEL 'none'"); + setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW); + run("ALTER DATABASE test CACHEMODEL 'last_row'"); + setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_VALUE); + run("ALTER DATABASE test CACHEMODEL 'last_value'"); + setAlterDbCacheModel(TSDB_CACHE_MODEL_BOTH); + run("ALTER DATABASE test CACHEMODEL 'both'"); + clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbCacheSize(1); + run("ALTER DATABASE test CACHESIZE 1"); + setAlterDbCacheSize(64); + run("ALTER DATABASE test CACHESIZE 64"); + setAlterDbCacheSize(65536); + run("ALTER DATABASE test CACHESIZE 65536"); + clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbFsync(0); + run("ALTER DATABASE test FSYNC 0"); + setAlterDbFsync(1000); + run("ALTER DATABASE test FSYNC 1000"); + setAlterDbFsync(180000); + run("ALTER DATABASE test FSYNC 180000"); + clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbKeep(1 * MINUTE_PER_DAY); + run("ALTER DATABASE test KEEP 1"); + setAlterDbKeep(30 * MINUTE_PER_DAY); + run("ALTER DATABASE test KEEP 30"); + setAlterDbKeep(365000 * MINUTE_PER_DAY); + run("ALTER DATABASE test KEEP 365000"); + setAlterDbKeep(1440); + run("ALTER DATABASE test KEEP 1440m"); + setAlterDbKeep(14400); + run("ALTER DATABASE test KEEP 14400m"); + setAlterDbKeep(525600000); + run("ALTER DATABASE test KEEP 525600000m"); + setAlterDbKeep(5 * MINUTE_PER_DAY, 35 * MINUTE_PER_DAY, 500 * MINUTE_PER_DAY); + run("ALTER DATABASE test KEEP 5,35,500"); + setAlterDbKeep(14400, 2400 * MINUTE_PER_HOUR, 1500 * MINUTE_PER_DAY); + run("ALTER DATABASE test KEEP 14400m,2400h,1500d"); + clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbWal(1); + run("ALTER DATABASE test WAL 1"); + setAlterDbWal(2); + run("ALTER DATABASE test WAL 2"); + clearAlterDbReq(); } +TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { + useDb("root", "test"); + + run("ALTER DATABASE test CACHEMODEL 'other'", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test CACHESIZE 0", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test CACHESIZE 65537", TSDB_CODE_PAR_INVALID_DB_OPTION); + // The syntax limits it to only positive numbers + run("ALTER DATABASE test FSYNC -1", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE); + run("ALTER DATABASE test FSYNC 180001", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test KEEP 0", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test KEEP 365001", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test KEEP 1000000000s", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test KEEP 1w", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test WAL 0", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test WAL 3", TSDB_CODE_PAR_INVALID_DB_OPTION); + // Regardless of the specific sentence + run("ALTER DATABASE db WAL 0 # td-14436", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE); +} + +/* + * ALTER LOCAL dnode_id 'config' ['value'] + */ TEST_F(ParserInitialATest, alterLocal) { useDb("root", "test"); @@ -53,7 +248,7 @@ TEST_F(ParserInitialATest, alterLocal) { expect.second.clear(); }; - auto setAlterLocalFunc = [&](const char* pConfig, const char* pValue = nullptr) { + auto setAlterLocal = [&](const char* pConfig, const char* pValue = nullptr) { expect.first.assign(pConfig); if (nullptr != pValue) { expect.second.assign(pValue); @@ -68,38 +263,37 @@ TEST_F(ParserInitialATest, alterLocal) { ASSERT_EQ(string(pStmt->value), expect.second); }); - setAlterLocalFunc("resetlog"); + setAlterLocal("resetlog"); run("ALTER LOCAL 'resetlog'"); clearAlterLocal(); - setAlterLocalFunc("querypolicy", "2"); + setAlterLocal("querypolicy", "2"); run("ALTER LOCAL 'querypolicy' '2'"); clearAlterLocal(); } /* - * ALTER TABLE [db_name.]tb_name alter_table_clause + * ALTER STABLE [db_name.]tb_name alter_table_clause * * alter_table_clause: { * alter_table_options * | ADD COLUMN col_name column_type * | DROP COLUMN col_name * | MODIFY COLUMN col_name column_type - * | RENAME COLUMN old_col_name new_col_name - * | ADD TAG tag_name tag_type - * | DROP TAG tag_name - * | MODIFY TAG tag_name tag_type - * | RENAME TAG old_tag_name new_tag_name - * | SET TAG tag_name = new_tag_value - * | ADD {FULLTEXT | SMA} INDEX index_name (col_name [, col_name] ...) [index_option] + * | RENAME COLUMN old_col_name new_col_name -- normal table + * | ADD TAG tag_name tag_type -- super table + * | DROP TAG tag_name -- super table + * | MODIFY TAG tag_name tag_type -- super table + * | RENAME TAG old_tag_name new_tag_name -- super table + * | SET TAG tag_name = new_tag_value -- child table * } * * alter_table_options: * alter_table_option ... * * alter_table_option: { - * TTL value - * | COMMENT 'string_value' + * TTL int_value -- child/normal table + * | COMMENT 'string_value' * } */ TEST_F(ParserInitialATest, alterSTable) { @@ -112,14 +306,12 @@ TEST_F(ParserInitialATest, alterSTable) { memset(&expect, 0, sizeof(SMAlterStbReq)); }; - auto setAlterStbReqFunc = [&](const char* pTbname, int8_t alterType, int32_t numOfFields = 0, - const char* pField1Name = nullptr, int8_t field1Type = 0, int32_t field1Bytes = 0, - const char* pField2Name = nullptr, const char* pComment = nullptr, - int32_t ttl = TSDB_DEFAULT_TABLE_TTL) { + auto setAlterStbReq = [&](const char* pTbname, int8_t alterType, int32_t numOfFields = 0, + const char* pField1Name = nullptr, int8_t field1Type = 0, int32_t field1Bytes = 0, + const char* pField2Name = nullptr, const char* pComment = nullptr) { int32_t len = snprintf(expect.name, sizeof(expect.name), "0.test.%s", pTbname); expect.name[len] = '\0'; expect.alterType = alterType; - // expect.ttl = ttl; if (nullptr != pComment) { expect.comment = strdup(pComment); expect.commentLen = strlen(pComment); @@ -178,59 +370,47 @@ TEST_F(ParserInitialATest, alterSTable) { tFreeSMAltertbReq(&req); }); - // setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, nullptr, 10); - // run("ALTER STABLE st1 TTL 10"); - // clearAlterStbReq(); - - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, "test"); + setAlterStbReq("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, "test"); run("ALTER STABLE st1 COMMENT 'test'"); clearAlterStbReq(); - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_ADD_COLUMN, 1, "cc1", TSDB_DATA_TYPE_BIGINT); + setAlterStbReq("st1", TSDB_ALTER_TABLE_ADD_COLUMN, 1, "cc1", TSDB_DATA_TYPE_BIGINT); run("ALTER STABLE st1 ADD COLUMN cc1 BIGINT"); clearAlterStbReq(); - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_DROP_COLUMN, 1, "c1"); + setAlterStbReq("st1", TSDB_ALTER_TABLE_DROP_COLUMN, 1, "c1"); run("ALTER STABLE st1 DROP COLUMN c1"); clearAlterStbReq(); - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, 1, "c2", TSDB_DATA_TYPE_VARCHAR, - 30 + VARSTR_HEADER_SIZE); + setAlterStbReq("st1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, 1, "c2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); run("ALTER STABLE st1 MODIFY COLUMN c2 VARCHAR(30)"); clearAlterStbReq(); - // setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, 2, "c1", 0, 0, "cc1"); - // run("ALTER STABLE st1 RENAME COLUMN c1 cc1"); - - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_ADD_TAG, 1, "tag11", TSDB_DATA_TYPE_BIGINT); + setAlterStbReq("st1", TSDB_ALTER_TABLE_ADD_TAG, 1, "tag11", TSDB_DATA_TYPE_BIGINT); run("ALTER STABLE st1 ADD TAG tag11 BIGINT"); clearAlterStbReq(); - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_DROP_TAG, 1, "tag1"); + setAlterStbReq("st1", TSDB_ALTER_TABLE_DROP_TAG, 1, "tag1"); run("ALTER STABLE st1 DROP TAG tag1"); clearAlterStbReq(); - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, 1, "tag2", TSDB_DATA_TYPE_VARCHAR, - 30 + VARSTR_HEADER_SIZE); + setAlterStbReq("st1", TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, 1, "tag2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); run("ALTER STABLE st1 MODIFY TAG tag2 VARCHAR(30)"); clearAlterStbReq(); - setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_TAG_NAME, 2, "tag1", 0, 0, "tag11"); + setAlterStbReq("st1", TSDB_ALTER_TABLE_UPDATE_TAG_NAME, 2, "tag1", 0, 0, "tag11"); run("ALTER STABLE st1 RENAME TAG tag1 tag11"); clearAlterStbReq(); - - // todo - // ADD {FULLTEXT | SMA} INDEX index_name (col_name [, col_name] ...) [index_option] } TEST_F(ParserInitialATest, alterSTableSemanticCheck) { useDb("root", "test"); run("ALTER STABLE st1 RENAME COLUMN c1 cc1", TSDB_CODE_PAR_INVALID_ALTER_TABLE); - run("ALTER STABLE st1 MODIFY COLUMN c2 NCHAR(10)", TSDB_CODE_PAR_INVALID_MODIFY_COL); - run("ALTER STABLE st1 MODIFY TAG tag2 NCHAR(10)", TSDB_CODE_PAR_INVALID_MODIFY_COL); + run("ALTER STABLE st1 SET TAG tag1 = 10", TSDB_CODE_PAR_INVALID_ALTER_TABLE); + run("ALTER STABLE st1 TTL 10", TSDB_CODE_PAR_INVALID_ALTER_TABLE); } TEST_F(ParserInitialATest, alterTable) { @@ -246,8 +426,8 @@ TEST_F(ParserInitialATest, alterTable) { memset(&expect, 0, sizeof(SVAlterTbReq)); }; - auto setAlterColFunc = [&](const char* pTbname, int8_t alterType, const char* pColName, int8_t dataType = 0, - int32_t dataBytes = 0, const char* pNewColName = nullptr) { + auto setAlterTableCol = [&](const char* pTbname, int8_t alterType, const char* pColName, int8_t dataType = 0, + int32_t dataBytes = 0, const char* pNewColName = nullptr) { expect.tbName = strdup(pTbname); expect.action = alterType; expect.colName = strdup(pColName); @@ -269,7 +449,7 @@ TEST_F(ParserInitialATest, alterTable) { } }; - auto setAlterTagFunc = [&](const char* pTbname, const char* pTagName, uint8_t* pNewVal, uint32_t bytes) { + auto setAlterTableTag = [&](const char* pTbname, const char* pTagName, uint8_t* pNewVal, uint32_t bytes) { expect.tbName = strdup(pTbname); expect.action = TSDB_ALTER_TABLE_UPDATE_TAG_VAL; expect.tagName = strdup(pTagName); @@ -279,7 +459,7 @@ TEST_F(ParserInitialATest, alterTable) { expect.pTagVal = pNewVal; }; - auto setAlterOptionsFunc = [&](const char* pTbname, int32_t ttl, char* pComment = nullptr) { + auto setAlterTableOptions = [&](const char* pTbname, int32_t ttl, char* pComment = nullptr) { expect.tbName = strdup(pTbname); expect.action = TSDB_ALTER_TABLE_UPDATE_OPTIONS; if (-1 != ttl) { @@ -335,47 +515,56 @@ TEST_F(ParserInitialATest, alterTable) { tDecoderClear(&coder); }); - setAlterOptionsFunc("t1", 10, nullptr); + setAlterTableOptions("t1", 10, nullptr); run("ALTER TABLE t1 TTL 10"); clearAlterTbReq(); - setAlterOptionsFunc("t1", -1, (char*)"test"); + setAlterTableOptions("t1", -1, (char*)"test"); run("ALTER TABLE t1 COMMENT 'test'"); clearAlterTbReq(); - setAlterColFunc("t1", TSDB_ALTER_TABLE_ADD_COLUMN, "cc1", TSDB_DATA_TYPE_BIGINT); + setAlterTableCol("t1", TSDB_ALTER_TABLE_ADD_COLUMN, "cc1", TSDB_DATA_TYPE_BIGINT); run("ALTER TABLE t1 ADD COLUMN cc1 BIGINT"); clearAlterTbReq(); - setAlterColFunc("t1", TSDB_ALTER_TABLE_DROP_COLUMN, "c1"); + setAlterTableCol("t1", TSDB_ALTER_TABLE_DROP_COLUMN, "c1"); run("ALTER TABLE t1 DROP COLUMN c1"); clearAlterTbReq(); - setAlterColFunc("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, "c2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); + setAlterTableCol("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, "c2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); run("ALTER TABLE t1 MODIFY COLUMN c2 VARCHAR(30)"); clearAlterTbReq(); - setAlterColFunc("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, "c1", 0, 0, "cc1"); + setAlterTableCol("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, "c1", 0, 0, "cc1"); run("ALTER TABLE t1 RENAME COLUMN c1 cc1"); clearAlterTbReq(); int32_t val = 10; - setAlterTagFunc("st1s1", "tag1", (uint8_t*)&val, sizeof(val)); + setAlterTableTag("st1s1", "tag1", (uint8_t*)&val, sizeof(val)); run("ALTER TABLE st1s1 SET TAG tag1=10"); clearAlterTbReq(); - - // todo - // ADD {FULLTEXT | SMA} INDEX index_name (col_name [, col_name] ...) [index_option] } TEST_F(ParserInitialATest, alterTableSemanticCheck) { useDb("root", "test"); run("ALTER TABLE st1s1 RENAME COLUMN c1 cc1", TSDB_CODE_PAR_INVALID_ALTER_TABLE); - + run("ALTER TABLE st1s1 ADD TAG tag11 BIGINT", TSDB_CODE_PAR_INVALID_ALTER_TABLE); + run("ALTER TABLE st1s1 DROP TAG tag1", TSDB_CODE_PAR_INVALID_ALTER_TABLE); + run("ALTER TABLE st1s1 MODIFY TAG tag2 VARCHAR(30)", TSDB_CODE_PAR_INVALID_ALTER_TABLE); + run("ALTER TABLE st1s1 RENAME TAG tag1 tag11", TSDB_CODE_PAR_INVALID_ALTER_TABLE); run("ALTER TABLE st1s1 SET TAG tag2 = '123456789012345678901'", TSDB_CODE_PAR_WRONG_VALUE_TYPE); } +/* + * ALTER USER user_name PASS str_value + * + * alter_user_clause: { + * PASS str_value + * | ENABLE int_value + * | SYSINFO int_value + * } + */ TEST_F(ParserInitialATest, alterUser) { useDb("root", "test"); @@ -423,6 +612,9 @@ TEST_F(ParserInitialATest, alterUser) { clearAlterUserReq(); } +/* + * BALANCE VGROUP + */ TEST_F(ParserInitialATest, balanceVgroup) { useDb("root", "test"); @@ -436,10 +628,4 @@ TEST_F(ParserInitialATest, balanceVgroup) { run("BALANCE VGROUP"); } -TEST_F(ParserInitialATest, bug001) { - useDb("root", "test"); - - run("ALTER DATABASE db WAL 0 # td-14436", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE); -} - } // namespace ParserTest \ No newline at end of file diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 7ea4fab470..617191eb4a 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -236,12 +236,12 @@ TEST_F(ParserInitialCTest, createDatabase) { TEST_F(ParserInitialCTest, createDatabaseSemanticCheck) { useDb("root", "test"); - run("create database db2 retentions 0s:1d", TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); - run("create database db2 retentions 10s:0d", TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); - run("create database db2 retentions 1w:1d", TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); - run("create database db2 retentions 1w:1n", TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); - run("create database db2 retentions 15s:7d,15m:21d,10m:500d", TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); - run("create database db2 retentions 15s:7d,5m:21d,10m:10d", TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); + 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); } TEST_F(ParserInitialCTest, createDnode) { @@ -514,13 +514,13 @@ TEST_F(ParserInitialCTest, createStableSemanticCheck) { useDb("root", "test"); run("CREATE STABLE rollup_db.stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(CEIL)", - TSDB_CODE_PAR_INVALID_ROLLUP_OPTION); + TSDB_CODE_PAR_INVALID_TABLE_OPTION); run("CREATE STABLE rollup_db.stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 0s WATERMARK 1m", - TSDB_CODE_PAR_INVALID_RANGE_OPTION); + TSDB_CODE_PAR_INVALID_TABLE_OPTION); run("CREATE STABLE rollup_db.stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 10s WATERMARK 18m", - TSDB_CODE_PAR_INVALID_RANGE_OPTION); + TSDB_CODE_PAR_INVALID_TABLE_OPTION); } TEST_F(ParserInitialCTest, createStream) { diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp index 2b312642cd..074d12c626 100644 --- a/source/libs/parser/test/parTestUtil.cpp +++ b/source/libs/parser/test/parTestUtil.cpp @@ -192,7 +192,7 @@ class ParserTestBaseImpl { void setParseContext(const string& sql, SParseContext* pCxt, bool async = false) { stmtEnv_.sql_ = sql; - transform(stmtEnv_.sql_.begin(), stmtEnv_.sql_.end(), stmtEnv_.sql_.begin(), ::tolower); + strtolower((char*)stmtEnv_.sql_.c_str(), sql.c_str()); pCxt->acctId = atoi(caseEnv_.acctId_.c_str()); pCxt->db = caseEnv_.db_.c_str(); diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 4473c7c8b6..c0494aa2ae 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1378,6 +1378,22 @@ static bool planOptNodeListHasCol(SNodeList* pKeys) { return hasCol; } +static EDealRes partTagsOptHasTbname(SNode* pNode, void* pContext) { + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + if (COLUMN_TYPE_TBNAME == ((SColumnNode*)pNode)->colType) { + *(bool*)pContext = true; + return DEAL_RES_END; + } + } + return DEAL_RES_CONTINUE; +} + +static bool planOptNodeListHasTbname(SNodeList* pKeys) { + bool hasCol = false; + nodesWalkExprs(pKeys, partTagsOptHasTbname, &hasCol); + return hasCol; +} + static bool partTagsIsOptimizableNode(SLogicNode* pNode) { return ((QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode) || (QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode) && NULL != ((SAggLogicNode*)pNode)->pGroupKeys && @@ -2129,7 +2145,8 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) { } SAggLogicNode* pAgg = (SAggLogicNode*)(pNode->pParent); - if (NULL == pAgg->pGroupKeys || NULL != pAgg->pAggFuncs || planOptNodeListHasCol(pAgg->pGroupKeys)) { + if (NULL == pAgg->pGroupKeys || NULL != pAgg->pAggFuncs || + planOptNodeListHasCol(pAgg->pGroupKeys) || !planOptNodeListHasTbname(pAgg->pGroupKeys)) { return false; } @@ -2143,6 +2160,22 @@ static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubp } pScanNode->scanType = SCAN_TYPE_TAG; + SNode* pTarget = NULL; + FOREACH(pTarget, pScanNode->node.pTargets) { + if (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)(pTarget))->colId) { + ERASE_NODE(pScanNode->node.pTargets); + break; + } + } + + NODES_DESTORY_LIST(pScanNode->pScanCols); + + SLogicNode* pAgg = pScanNode->node.pParent; + int32_t code = replaceLogicNode(pLogicSubplan, pAgg, (SLogicNode*)pScanNode); + if (TSDB_CODE_SUCCESS == code) { + NODES_CLEAR_LIST(pAgg->pChildren); + } + nodesDestroyNode((SNode*)pAgg); pCxt->optimized = true; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index eeb44c4f82..6b1476fe46 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -138,6 +138,16 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code) return 0; } +void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { + assert(pMsgBody != NULL); + taosMemoryFreeClear(pMsgBody->target.dbFName); + taosMemoryFreeClear(pMsgBody->msgInfo.pData); + if (pMsgBody->paramFreeFp) { + (*pMsgBody->paramFreeFp)(pMsgBody->param); + } + taosMemoryFreeClear(pMsgBody); +} + int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo, bool persistHandle, void* rpcCtx) { char* pMsg = rpcMallocCont(pInfo->msgInfo.len); diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index c8e5204e91..8f036714c9 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -150,7 +150,6 @@ typedef struct SQWTaskCtx { void *taskHandle; void *sinkHandle; - SSubplan *plan; STbVerInfo tbInfo; } SQWTaskCtx; diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index b56cb29628..c7bf7ab7e7 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -306,11 +306,6 @@ void qwFreeTaskCtx(SQWTaskCtx *ctx) { dsDestroyDataSinker(ctx->sinkHandle); ctx->sinkHandle = NULL; } - - if (ctx->plan) { - nodesDestroyNode((SNode*)ctx->plan); - ctx->plan = NULL; - } } int32_t qwDropTaskCtx(QW_FPARAMS_DEF) { @@ -327,7 +322,6 @@ int32_t qwDropTaskCtx(QW_FPARAMS_DEF) { atomic_store_ptr(&ctx->taskHandle, NULL); atomic_store_ptr(&ctx->sinkHandle, NULL); - atomic_store_ptr(&ctx->plan, NULL); QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_DROP); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index e99695e962..ebccb7950c 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -522,8 +522,6 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, const char* sql) { QW_ERR_JRET(code); } - ctx->plan = plan; - code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, sql, OPTR_EXEC_MODEL_BATCH); if (code) { QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code)); @@ -928,8 +926,6 @@ int32_t qwProcessDelete(QW_FPARAMS_DEF, SQWMsg *qwMsg, SDeleteRes *pRes) { QW_ERR_JRET(code); } - ctx.plan = plan; - code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, NULL, OPTR_EXEC_MODEL_BATCH); if (code) { QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code)); diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 0348f13191..41ca72dc7b 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -3682,6 +3682,10 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { if (OP_TYPE_IN != node->opType) { SColumnNode *refNode = (SColumnNode *)node->pLeft; SValueNode *valueNode = (SValueNode *)node->pRight; + if (FILTER_GET_FLAG(stat->info->options, FLT_OPTION_TIMESTAMP) + && TSDB_DATA_TYPE_UBIGINT == valueNode->node.resType.type && valueNode->datum.u <= INT64_MAX) { + valueNode->node.resType.type = TSDB_DATA_TYPE_BIGINT; + } int32_t type = vectorGetConvertType(refNode->node.resType.type, valueNode->node.resType.type); if (0 != type && type != refNode->node.resType.type) { stat->scalarMode = true; diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 65b45cc612..02e878f4f8 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -277,7 +277,7 @@ typedef struct SSchJob { bool fetched; int32_t resNumOfRows; SSchResInfo userRes; - const char *sql; + char *sql; SQueryProfileSummary summary; } SSchJob; @@ -461,7 +461,6 @@ int32_t schJobFetchRows(SSchJob *pJob); int32_t schJobFetchRowsA(SSchJob *pJob); int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execId); int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList); -void schFreeSMsgSendInfo(SMsgSendInfo *msgSendInfo); char* schGetOpStr(SCH_OP_TYPE type); int32_t schBeginOperation(SSchJob *pJob, SCH_OP_TYPE type, bool sync); int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq); diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 13a369fac9..50f8b91023 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -675,6 +675,7 @@ void schFreeJobImpl(void *job) { taosMemoryFreeClear(pJob->userRes.execRes); taosMemoryFreeClear(pJob->fetchRes); + taosMemoryFreeClear(pJob->sql); taosMemoryFree(pJob); int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1); @@ -718,7 +719,9 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { pJob->attr.explainMode = pReq->pDag->explainInfo.mode; pJob->conn = *pReq->pConn; - pJob->sql = pReq->sql; + if (pReq->sql) { + pJob->sql = strdup(pReq->sql); + } pJob->pDag = pReq->pDag; pJob->chkKillFp = pReq->chkKillFp; pJob->chkKillParam = pReq->chkKillParam; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 6983bbf013..5452ca31a5 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -386,7 +386,6 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { schProcessOnCbEnd(pJob, pTask, code); taosMemoryFreeClear(pMsg->pData); - taosMemoryFreeClear(param); qDebug("end to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle, tstrerror(rspCode)); @@ -398,7 +397,6 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " drop task rsp received, code:0x%x", pParam->queryId, pParam->taskId, code); - taosMemoryFreeClear(param); return TSDB_CODE_SUCCESS; } @@ -447,8 +445,8 @@ int32_t schHandleHbCallback(void *param, SDataBuf *pMsg, int32_t code) { SCH_ERR_JRET(schProcessOnTaskStatusRsp(&rsp.epId, rsp.taskStatus)); _return: + tFreeSSchedulerHbRsp(&rsp); - taosMemoryFree(param); taosMemoryFree(pMsg->pData); SCH_RET(code); } @@ -514,7 +512,9 @@ int32_t schGenerateCallBackInfo(SSchJob *pJob, SSchTask *pTask, void *msg, uint3 SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } + msgSendInfo->paramFreeFp = taosMemoryFree; SCH_ERR_JRET(schMakeCallbackParam(pJob, pTask, msgType, isHb, trans, &msgSendInfo->param)); + SCH_ERR_JRET(schGetCallbackFp(msgType, &msgSendInfo->fp)); if (pJob) { @@ -535,7 +535,7 @@ int32_t schGenerateCallBackInfo(SSchJob *pJob, SSchTask *pTask, void *msg, uint3 _return: - schFreeSMsgSendInfo(msgSendInfo); + destroySendMsgInfo(msgSendInfo); SCH_RET(code); } @@ -676,6 +676,7 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { param->pTrans = pJob->conn.pTrans; pMsgSendInfo->param = param; + pMsgSendInfo->paramFreeFp = taosMemoryFree; pMsgSendInfo->fp = fp; SRpcCtxVal ctxVal = {.val = pMsgSendInfo, .clone = schCloneSMsgSendInfo}; @@ -795,6 +796,7 @@ int32_t schCloneSMsgSendInfo(void *src, void **dst) { pDst->param = NULL; SCH_ERR_JRET(schCloneCallbackParam(pSrc->param, (SSchCallbackParamHeader **)&pDst->param)); + pDst->paramFreeFp = taosMemoryFree; *dst = pDst; @@ -861,8 +863,7 @@ _return: } if (pMsgSendInfo) { - taosMemoryFreeClear(pMsgSendInfo->param); - taosMemoryFreeClear(pMsgSendInfo); + destroySendMsgInfo(pMsgSendInfo); } SCH_RET(code); diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index f848dfa210..6f12780ff9 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -50,6 +50,12 @@ char* schGetOpStr(SCH_OP_TYPE type) { } } +void schFreeHbTrans(SSchHbTrans *pTrans) { + rpcReleaseHandle(pTrans->trans.pHandle, TAOS_CONN_CLIENT); + + schFreeRpcCtx(&pTrans->rpcCtx); +} + void schCleanClusterHb(void* pTrans) { SCH_LOCK(SCH_WRITE, &schMgmt.hbLock); @@ -57,7 +63,7 @@ void schCleanClusterHb(void* pTrans) { while (hb) { if (hb->trans.pTrans == pTrans) { SQueryNodeEpId* pEpId = taosHashGetKey(hb, NULL); - rpcReleaseHandle(hb->trans.pHandle, TAOS_CONN_CLIENT); + schFreeHbTrans(hb); taosHashRemove(schMgmt.hbConnections, pEpId, sizeof(SQueryNodeEpId)); } @@ -68,8 +74,6 @@ void schCleanClusterHb(void* pTrans) { } int32_t schRemoveHbConnection(SSchJob *pJob, SSchTask *pTask, SQueryNodeEpId *epId) { - return TSDB_CODE_SUCCESS; // TODO ENABLE IT WHEN RPC IS READY - int32_t code = 0; SCH_LOCK(SCH_WRITE, &schMgmt.hbLock); @@ -82,7 +86,7 @@ int32_t schRemoveHbConnection(SSchJob *pJob, SSchTask *pTask, SQueryNodeEpId *ep int64_t taskNum = atomic_load_64(&hb->taskNum); if (taskNum <= 0) { - rpcReleaseHandle(hb->trans.pHandle, TAOS_CONN_CLIENT); + schFreeHbTrans(hb); taosHashRemove(schMgmt.hbConnections, epId, sizeof(SQueryNodeEpId)); } SCH_UNLOCK(SCH_WRITE, &schMgmt.hbLock); @@ -265,9 +269,7 @@ void schFreeRpcCtxVal(const void *arg) { } SMsgSendInfo *pMsgSendInfo = (SMsgSendInfo *)arg; - taosMemoryFreeClear(pMsgSendInfo->param); - taosMemoryFreeClear(pMsgSendInfo->msgInfo.pData); - taosMemoryFreeClear(pMsgSendInfo); + destroySendMsgInfo(pMsgSendInfo); } void schFreeRpcCtx(SRpcCtx *pCtx) { @@ -290,15 +292,6 @@ void schFreeRpcCtx(SRpcCtx *pCtx) { } } -void schFreeSMsgSendInfo(SMsgSendInfo *msgSendInfo) { - if (NULL == msgSendInfo) { - return; - } - - taosMemoryFree(msgSendInfo->param); - taosMemoryFree(msgSendInfo); -} - int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask) { int32_t s = taosHashGetSize(pTaskList); if (s <= 0) { diff --git a/source/libs/stream/inc/streamInc.h b/source/libs/stream/inc/streamInc.h index d10ea76c83..093242c610 100644 --- a/source/libs/stream/inc/streamInc.h +++ b/source/libs/stream/inc/streamInc.h @@ -44,7 +44,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq); -int32_t streamAppendQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem); +SStreamQueueItem* streamAppendQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem); void streamFreeQitem(SStreamQueueItem* data); #ifdef __cplusplus diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 6be15222db..d476980393 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -77,6 +77,28 @@ FAIL: return NULL; } +SStreamMergedSubmit* streamMergedSubmitNew() { + SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)taosAllocateQitem(sizeof(SStreamMergedSubmit), DEF_QITEM); + if (pMerged == NULL) return NULL; + pMerged->reqs = taosArrayInit(0, sizeof(void*)); + pMerged->dataRefs = taosArrayInit(0, sizeof(void*)); + if (pMerged->dataRefs == NULL || pMerged->reqs == NULL) goto FAIL; + pMerged->type = STREAM_INPUT__MERGED_SUBMIT; + return pMerged; +FAIL: + if (pMerged->reqs) taosArrayDestroy(pMerged->reqs); + if (pMerged->dataRefs) taosArrayDestroy(pMerged->dataRefs); + taosFreeQitem(pMerged); + return NULL; +} + +int32_t streamMergeSubmit(SStreamMergedSubmit* pMerged, SStreamDataSubmit* pSubmit) { + taosArrayPush(pMerged->dataRefs, &pSubmit->dataRef); + taosArrayPush(pMerged->reqs, &pSubmit->data); + pMerged->ver = pSubmit->ver; + return 0; +} + static FORCE_INLINE void streamDataSubmitRefInc(SStreamDataSubmit* pDataSubmit) { atomic_add_fetch_32(pDataSubmit->dataRef, 1); } @@ -100,15 +122,31 @@ void streamDataSubmitRefDec(SStreamDataSubmit* pDataSubmit) { } } -int32_t streamAppendQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem) { +SStreamQueueItem* streamAppendQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem) { ASSERT(elem); - if (dst->type == elem->type && dst->type == STREAM_INPUT__DATA_BLOCK) { + if (dst->type == STREAM_INPUT__DATA_BLOCK && elem->type == STREAM_INPUT__DATA_BLOCK) { SStreamDataBlock* pBlock = (SStreamDataBlock*)dst; SStreamDataBlock* pBlockSrc = (SStreamDataBlock*)elem; taosArrayAddAll(pBlock->blocks, pBlockSrc->blocks); - return 0; + taosArrayDestroy(pBlockSrc->blocks); + taosFreeQitem(elem); + return dst; + } else if (dst->type == STREAM_INPUT__MERGED_SUBMIT && elem->type == STREAM_INPUT__DATA_SUBMIT) { + SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)dst; + SStreamDataSubmit* pBlockSrc = (SStreamDataSubmit*)elem; + streamMergeSubmit(pMerged, pBlockSrc); + taosFreeQitem(elem); + return dst; + } else if (dst->type == STREAM_INPUT__DATA_SUBMIT && elem->type == STREAM_INPUT__DATA_SUBMIT) { + SStreamMergedSubmit* pMerged = streamMergedSubmitNew(); + ASSERT(pMerged); + streamMergeSubmit(pMerged, (SStreamDataSubmit*)dst); + streamMergeSubmit(pMerged, (SStreamDataSubmit*)elem); + taosFreeQitem(dst); + taosFreeQitem(elem); + return (SStreamQueueItem*)pMerged; } else { - return -1; + return NULL; } } @@ -123,5 +161,20 @@ void streamFreeQitem(SStreamQueueItem* data) { } else if (type == STREAM_INPUT__DATA_SUBMIT) { streamDataSubmitRefDec((SStreamDataSubmit*)data); taosFreeQitem(data); + } else if (type == STREAM_INPUT__MERGED_SUBMIT) { + SStreamMergedSubmit* pMerge = (SStreamMergedSubmit*)data; + int32_t sz = taosArrayGetSize(pMerge->reqs); + for (int32_t i = 0; i < sz; i++) { + int32_t* ref = taosArrayGetP(pMerge->dataRefs, i); + (*ref)--; + if (*ref == 0) { + void* data = taosArrayGetP(pMerge->reqs, i); + taosMemoryFree(data); + taosMemoryFree(ref); + } + } + taosArrayDestroy(pMerge->reqs); + taosArrayDestroy(pMerge->dataRefs); + taosFreeQitem(pMerge); } } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index b59a812678..a8192b49f3 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -33,9 +33,13 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes) SArray* blocks = pBlock->blocks; qDebug("task %d %p set ssdata input", pTask->taskId, pTask); qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__DATA_BLOCK, false); - } else if (pItem->type == STREAM_INPUT__DROP) { - // TODO exec drop - return 0; + } else if (pItem->type == STREAM_INPUT__MERGED_SUBMIT) { + SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)data; + SArray* blocks = pMerged->reqs; + qDebug("task %d %p set submit input (merged), batch num: %d", pTask->taskId, pTask, (int32_t)blocks->size); + qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__MERGED_SUBMIT, false); + } else { + ASSERT(0); } // exec @@ -144,7 +148,7 @@ int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum) { static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { while (1) { - int32_t cnt = 0; + int32_t cnt = 1; void* data = NULL; while (1) { SStreamQueueItem* qItem = streamQueueNextItem(pTask->inputQueue); @@ -155,24 +159,23 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { if (data == NULL) { data = qItem; streamQueueProcessSuccess(pTask->inputQueue); - if (qItem->type == STREAM_INPUT__DATA_BLOCK) { - /*streamUpdateVer(pTask, (SStreamDataBlock*)qItem);*/ - } else { - break; - } + /*if (qItem->type == STREAM_INPUT__DATA_BLOCK) {*/ + /*streamUpdateVer(pTask, (SStreamDataBlock*)qItem);*/ + /*}*/ } else { - if (streamAppendQueueItem(data, qItem) < 0) { + void* newRet; + if ((newRet = streamAppendQueueItem(data, qItem)) == NULL) { streamQueueProcessFail(pTask->inputQueue); break; } else { cnt++; + data = newRet; /*streamUpdateVer(pTask, (SStreamDataBlock*)qItem);*/ streamQueueProcessSuccess(pTask->inputQueue); - taosArrayDestroy(((SStreamDataBlock*)qItem)->blocks); - taosFreeQitem(qItem); } } } + if (pTask->taskStatus == TASK_STATUS__DROPPING) { if (data) streamFreeQitem(data); taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); @@ -194,6 +197,7 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { if (taosArrayGetSize(pRes) != 0) { SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); if (qRes == NULL) { + // TODO log failed ver streamQueueProcessFail(pTask->inputQueue); taosArrayDestroy(pRes); return NULL; @@ -201,6 +205,7 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { qRes->type = STREAM_INPUT__DATA_BLOCK; qRes->blocks = pRes; if (streamTaskOutput(pTask, qRes) < 0) { + // TODO log failed ver /*streamQueueProcessFail(pTask->inputQueue);*/ taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); taosFreeQitem(qRes); diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 2d15c31bf1..5921e44a9c 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -64,6 +64,7 @@ int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) { if (tEncodeI32(pEncoder, pTask->selfChildId) < 0) return -1; if (tEncodeI32(pEncoder, pTask->nodeId) < 0) return -1; if (tEncodeSEpSet(pEncoder, &pTask->epSet) < 0) return -1; + if (tEncodeI32(pEncoder, pTask->numOfVgroups) < 0) return -1; int32_t epSz = taosArrayGetSize(pTask->childEpInfo); if (tEncodeI32(pEncoder, epSz) < 0) return -1; @@ -118,6 +119,7 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { if (tDecodeI32(pDecoder, &pTask->selfChildId) < 0) return -1; if (tDecodeI32(pDecoder, &pTask->nodeId) < 0) return -1; if (tDecodeSEpSet(pDecoder, &pTask->epSet) < 0) return -1; + if (tDecodeI32(pDecoder, &pTask->numOfVgroups) < 0) return -1; int32_t epSz; if (tDecodeI32(pDecoder, &epSz) < 0) return -1; diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 991b50f7c0..edc811fe82 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -33,6 +33,8 @@ int64_t FORCE_INLINE walGetLastVer(SWal* pWal) { return pWal->vers.lastVer; } int64_t FORCE_INLINE walGetCommittedVer(SWal* pWal) { return pWal->vers.commitVer; } +int64_t FORCE_INLINE walGetAppliedVer(SWal* pWal) { return pWal->vers.appliedVer; } + static FORCE_INLINE int walBuildMetaName(SWal* pWal, int metaVer, char* buf) { return sprintf(buf, "%s/meta-ver%d", pWal->path, metaVer); } diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index c47964803a..5bc9cdafa2 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -66,9 +66,15 @@ void walCloseReader(SWalReader *pRead) { } int32_t walNextValidMsg(SWalReader *pRead) { - wDebug("vgId:%d wal start to fetch", pRead->pWal->cfg.vgId); int64_t fetchVer = pRead->curVersion; - int64_t endVer = pRead->cond.scanUncommited ? walGetLastVer(pRead->pWal) : walGetCommittedVer(pRead->pWal); + int64_t lastVer = walGetLastVer(pRead->pWal); + int64_t committedVer = walGetCommittedVer(pRead->pWal); + int64_t appliedVer = walGetAppliedVer(pRead->pWal); + int64_t endVer = pRead->cond.scanUncommited ? lastVer : committedVer; + endVer = TMIN(appliedVer, endVer); + + wDebug("vgId:%d wal start to fetch, ver %ld, last ver %ld commit ver %ld, applied ver %ld, end ver %ld", + pRead->pWal->cfg.vgId, fetchVer, lastVer, committedVer, appliedVer, endVer); while (fetchVer <= endVer) { if (walFetchHeadNew(pRead, fetchVer) < 0) { return -1; @@ -417,7 +423,7 @@ int32_t walReadVer(SWalReader *pRead, int64_t ver) { } if (ver > pRead->pWal->vers.lastVer || ver < pRead->pWal->vers.firstVer) { - wError("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pRead->pWal->cfg.vgId, + wDebug("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pRead->pWal->cfg.vgId, ver, pRead->pWal->vers.firstVer, pRead->pWal->vers.lastVer); terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; @@ -425,7 +431,7 @@ int32_t walReadVer(SWalReader *pRead, int64_t ver) { if (pRead->curInvalid || pRead->curVersion != ver) { if (walReadSeekVer(pRead, ver) < 0) { - wError("vgId:%d, unexpected wal log index:%" PRId64 ", since %s", pRead->pWal->cfg.vgId, ver, terrstr()); + wError("vgId:%d, unexpected wal log, index:%" PRId64 ", since %s", pRead->pWal->cfg.vgId, ver, terrstr()); return -1; } seeked = true; @@ -452,7 +458,8 @@ int32_t walReadVer(SWalReader *pRead, int64_t ver) { contLen = walValidHeadCksum(pRead->pHead); if (contLen != 0) { - wError("vgId:%d, unexpected wal log index:%" PRId64 ", since head checksum not passed", pRead->pWal->cfg.vgId, ver); + wError("vgId:%d, unexpected wal log, index:%" PRId64 ", since head checksum not passed", pRead->pWal->cfg.vgId, + ver); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -479,7 +486,7 @@ int32_t walReadVer(SWalReader *pRead, int64_t ver) { } if (pRead->pHead->head.version != ver) { - wError("vgId:%d, unexpected wal log index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId, + wError("vgId:%d, unexpected wal log, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId, pRead->pHead->head.version, ver); pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; @@ -489,7 +496,8 @@ int32_t walReadVer(SWalReader *pRead, int64_t ver) { contLen = walValidBodyCksum(pRead->pHead); if (contLen != 0) { - wError("vgId:%d, unexpected wal log index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); + wError("vgId:%d, unexpected wal log, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, + ver); pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; ASSERT(0); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 26dc3cdffb..4fc135a1cf 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -64,6 +64,12 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) { return 0; } +int32_t walApplyVer(SWal *pWal, int64_t ver) { + // TODO: error check + pWal->vers.appliedVer = ver; + return 0; +} + int32_t walCommit(SWal *pWal, int64_t ver) { ASSERT(pWal->vers.commitVer >= pWal->vers.snapshotVer); ASSERT(pWal->vers.commitVer <= pWal->vers.lastVer); diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index 23e79da948..6095b67588 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -173,6 +173,46 @@ void taosArrayRemoveDuplicate(SArray* pArray, __compar_fn_t comparFn, void (*fp) pArray->size = pos + 1; } +void taosArrayRemoveDuplicateP(SArray* pArray, __compar_fn_t comparFn, void (*fp)(void*)) { + assert(pArray); + + size_t size = pArray->size; + if (size <= 1) { + return; + } + + int32_t pos = 0; + for (int32_t i = 1; i < size; ++i) { + char* p1 = taosArrayGet(pArray, pos); + char* p2 = taosArrayGet(pArray, i); + + if (comparFn(p1, p2) == 0) { + // do nothing + } else { + if (pos + 1 != i) { + void* p = taosArrayGet(pArray, pos + 1); + if (fp != NULL) { + fp(p); + } + + taosArraySet(pArray, pos + 1, p2); + pos += 1; + } else { + pos += 1; + } + } + } + + if (fp != NULL) { + for (int32_t i = pos + 1; i < pArray->size; ++i) { + void* p = taosArrayGetP(pArray, i); + fp(p); + } + } + + pArray->size = pos + 1; +} + void* taosArrayAddAll(SArray* pArray, const SArray* pInput) { if (pInput) { return taosArrayAddBatch(pArray, pInput->pData, (int32_t)taosArrayGetSize(pInput)); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index b323887d93..184b1a9edf 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -501,19 +501,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL, "Interval too small") 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") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_RANGE_OPTION, "Invalid option") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_STR_OPTION, "Invalid option") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ENUM_OPTION, "Invalid option") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_KEEP_NUM, "Invalid number of keep options") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_KEEP_ORDER, "Invalid keep value, should be keep0 <= keep1 <= keep2") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_KEEP_VALUE, "Invalid option keep") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COMMENT_OPTION, "Invalid option comment") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_F_RANGE_OPTION, "Invalid option") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ROLLUP_OPTION, "Invalid option rollup: only one function is allowed") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION, "Invalid option retentions") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid database option") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_TABLE_OPTION, "Invalid table option") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST, "GROUP BY and WINDOW-clause can't be used together") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_OPTION_UNIT, "Invalid option unit: only m, h, d allowed") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_KEEP_UNIT, "Invalid option keep unit: only m, h, d allowed") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_AGG_FUNC_NESTING, "Aggregate functions do not support nesting") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE, "Only support STATE_WINDOW on integer/bool/varchar column") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_STATE_WIN_COL, "Not support STATE_WINDOW on tag column") diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh index f80c2b217f..deaea4fa40 100755 --- a/tests/parallel_test/container_build.sh +++ b/tests/parallel_test/container_build.sh @@ -52,7 +52,7 @@ fi docker run \ -v $REP_MOUNT_PARAM \ - --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true;make -j $THREAD_COUNT" + --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DWEBSOCKET=true;make -j $THREAD_COUNT" ret=$? exit $ret diff --git a/tests/pytest/crash_gen/crash_gen_main.py b/tests/pytest/crash_gen/crash_gen_main.py index 8f0bfdd481..eba1d938da 100755 --- a/tests/pytest/crash_gen/crash_gen_main.py +++ b/tests/pytest/crash_gen/crash_gen_main.py @@ -1326,7 +1326,7 @@ class Task(): 0x03A1, # STable [does] not exist 0x03AA, # Tag already exists 0x0603, # Table already exists - 0x2602, # Table does not exist + 0x2603, # Table does not exist 0x260d, # Tags number not matched diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 96723978ae..613673ea8e 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -488,10 +488,13 @@ class TDDnode: psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") - + + onlyKillOnceWindows = 0 while(processID): - killCmd = "kill -INT %s > /dev/null 2>&1" % processID - os.system(killCmd) + if not platform.system().lower() == 'windows' or (onlyKillOnceWindows == 0 and platform.system().lower() == 'windows'): + killCmd = "kill -INT %s > /dev/null 2>&1" % processID + os.system(killCmd) + onlyKillOnceWindows = 1 time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") @@ -524,9 +527,12 @@ class TDDnode: processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") + onlyKillOnceWindows = 0 while(processID): - killCmd = "kill -INT %s > /dev/null 2>&1" % processID - os.system(killCmd) + if not platform.system().lower() == 'windows' or (onlyKillOnceWindows == 0 and platform.system().lower() == 'windows'): + killCmd = "kill -INT %s > /dev/null 2>&1" % processID + os.system(killCmd) + onlyKillOnceWindows = 1 time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") @@ -550,9 +556,12 @@ class TDDnode: processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") + onlyKillOnceWindows = 0 while(processID): - killCmd = "kill -KILL %s > /dev/null 2>&1" % processID - os.system(killCmd) + if not platform.system().lower() == 'windows' or (onlyKillOnceWindows == 0 and platform.system().lower() == 'windows'): + killCmd = "kill -KILL %s > /dev/null 2>&1" % processID + os.system(killCmd) + onlyKillOnceWindows = 1 time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 4961355f06..85a782ecb1 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -94,6 +94,7 @@ class TDSql: except Exception as e: i+=1 tdLog.notice("Try to query again, query times: %d "%i) + time.sleep(1) pass else: try: @@ -293,6 +294,7 @@ class TDSql: except Exception as e: i+=1 tdLog.notice("Try to execute sql again, query times: %d "%i) + time.sleep(1) pass else: try: diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 1b228925b1..90353ef114 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -56,6 +56,7 @@ # unsupport ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim # unsupport ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim # unsupport ./test.sh -f tsim/dnode/vnode_clean.sim +./test.sh -f tsim/dnode/use_dropped_dnode.sim # ---- import ./test.sh -f tsim/import/basic.sim diff --git a/tests/script/tsim/dnode/use_dropped_dnode.sim b/tests/script/tsim/dnode/use_dropped_dnode.sim new file mode 100644 index 0000000000..9c546e295f --- /dev/null +++ b/tests/script/tsim/dnode/use_dropped_dnode.sim @@ -0,0 +1,133 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +sql connect + +print =============== step1 create dnode2 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 + +$x = 0 +step1: + $ = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not online! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi + +print =============== step2 drop dnode 3 +sql drop dnode 3 +sql create dnode $hostname port 7300 + +$x = 0 +step2: + $ = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not online! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi +if $data(3)[4] != null then + goto step2 +endi +if $data(4)[4] != offline then + goto step2 +endi + +print =============== step3: create dnode 4 +sleep 1000 +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/deploy.sh -n dnode3 -i 3 +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step3: + $ = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not online! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step3 +endi +if $data(2)[4] != ready then + goto step3 +endi +if $data(3)[4] != null then + goto step3 +endi +if $data(4)[4] != ready then + goto step3 +endi + +print =============== step4: create mnode 4 +sql create mnode on dnode 4 + +$x = 0 +step4: + $ = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not online! + return -1 + endi +sql show mnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[2] != leader then + goto step4 +endi +if $data(4)[2] != follower then + goto step4 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/checkError1.sim b/tests/script/tsim/valgrind/checkError1.sim index 59eede7c91..83ae280721 100644 --- a/tests/script/tsim/valgrind/checkError1.sim +++ b/tests/script/tsim/valgrind/checkError1.sim @@ -7,6 +7,7 @@ system sh/exec.sh -n dnode1 -s start -v system sh/exec.sh -n dnode2 -s start -v sql connect + print =============== step1: create alter drop show user sql create user u1 pass 'taosdata' sql show users @@ -158,4 +159,4 @@ endi if $system_content == $null then return -1 -endi \ No newline at end of file +endi diff --git a/tests/system-test/2-query/last_row.py b/tests/system-test/2-query/last_row.py index cbe83b5a30..cdb26f7589 100644 --- a/tests/system-test/2-query/last_row.py +++ b/tests/system-test/2-query/last_row.py @@ -221,7 +221,7 @@ class TDTestCase: tdSql.execute("use testdb") # bug need fix - tdSql.query("select last_row(c1 ,NULL) from testdb.t1") + tdSql.error("select last_row(c1 ,NULL) from testdb.t1") error_sql_lists = [ "select last_row from testdb.t1", diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index d766bc5089..1863f67c8e 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -2,6 +2,7 @@ import taos import sys import datetime import inspect +import random from util.log import * from util.sql import * @@ -32,15 +33,23 @@ class TDTestCase: ''') for i in range(10): - tdSql.execute(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')") - tdSql.execute(f"create table dct{i} using diagnostics (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')") + if i == 1 or i == 2 : + tdLog.debug(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}', NULL,'v2.3')") + tdSql.execute(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}', NULL,'v2.3')") + else : + tdSql.execute(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')") + if i == 1 or i == 2 : + tdSql.execute(f"create table dct{i} using diagnostics (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}',NULL ,'v2.3')") + else: + tdSql.execute(f"create table dct{i} using diagnostics (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')") for j in range(10): - for i in range(10): + for i in range(100): tdSql.execute( - f"insert into rct{j} values ( {ts+i*10000}, {80+i}, {90+i}, {85+i}, {30+i*10}, {1.2*i}, {221+i*2}, {20+i*0.2}, {1500+i*20}, {150+i*2},{5+i} )" + f"insert into rct{j} values ( {ts+i*60000}, {80+i}, {90+i}, {85+i}, {30+i*10}, {1.2*i}, {221+i*2}, {20+i*0.2}, {1500+i*20}, {150+i*2},{5+i} )" ) + status= random.randint(0,1) tdSql.execute( - f"insert into dct{j} values ( {ts+i*10000}, {1+i*0.1},{1400+i*15}, {i},{1500+i*20}, {150+i*2},{5+i} )" + f"insert into dct{j} values ( {ts+i*60000}, {1+i*0.1},{1400+i*15}, {status},{1500+i*20}, {150+i*2},{5+i} )" ) tdSql.execute("insert into dct9 (ts,fuel_state) values('2021-07-13 14:06:33.123Z',1.2) ;") # def check_avg(self ,origin_query , check_query): @@ -109,12 +118,12 @@ class TDTestCase: tdSql.query("select _wstart as ts,fleet,name,driver,count(mv)/6 as hours_driven from ( select _wstart as ts,fleet,name,driver,avg(velocity) as mv from readings where ts > '2016-01-01T00:00:00Z' and ts < '2016-01-05T00:00:01Z' partition by fleet,name,driver interval(10m)) where ts > '2016-01-01T00:00:00Z' and ts < '2016-01-05T00:00:01Z' partition by fleet,name,driver interval(1d) ;") - # 6. avg-daily-driving-session - #taosc core dumped - tdSql.execute("create table random_measure2_1 (ts timestamp,ela float, name binary(40))") - tdSql.query("SELECT ts,diff(mv) AS difka FROM (SELECT ts,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name,ts interval(10m) fill(value,0)) GROUP BY name,ts;") - tdSql.query("select name,diff(mv) AS difka FROM (SELECT ts,name,mv FROM (SELECT _wstart as ts,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0))) group BY name ;") - tdSql.query("SELECT _wstart,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0)") + # # 6. avg-daily-driving-session + # #taosc core dumped + # tdSql.execute("create table random_measure2_1 (ts timestamp,ela float, name binary(40))") + # tdSql.query("SELECT ts,diff(mv) AS difka FROM (SELECT ts,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name,ts interval(10m) fill(value,0)) GROUP BY name,ts;") + # tdSql.query("select name,diff(mv) AS difka FROM (SELECT ts,name,mv FROM (SELECT _wstart as ts,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0))) group BY name ;") + # tdSql.query("SELECT _wstart,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0)") # 7. avg-load tdSql.query("SELECT fleet, model,avg(ml) AS mean_load_percentage FROM (SELECT fleet, model,current_load/load_capacity AS ml FROM diagnostics partition BY name, fleet, model) partition BY fleet, model order by fleet ;") @@ -123,6 +132,13 @@ class TDTestCase: tdSql.query(" SELECT model,ms1 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) fill(value,0)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;") tdSql.query("SELECT _wstart,model,fleet,count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) fill(value,0)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1 partition by model, fleet interval(1d) ;") + # 9. breakdown-frequency + # NULL ---count(NULL)=0 expect count(NULL)= 100 + tdSql.query("select tbname,count(model),model from readings partition by tbname,model;") + # model=NULL count(other) is 0 + tdSql.query("select tbname,count(name),model from readings where model=NULL partition by tbname,model;") + + tdSql.query(" SELECT model,state_changed,count(state_changed) FROM (SELECT model,diff(broken_down) AS state_changed FROM (SELECT _wstart,model,cast(cast(floor(2*(sum(nzs)/count(nzs))) as bool) as int) AS broken_down FROM (SELECT ts,model, cast(cast(status as bool) as int) AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model interval(10m)) partition BY model) where state_changed =1 partition BY model,state_changed ;") #it's already supported: # last-loc tdSql.query("SELECT last_row(ts),latitude,longitude,name,driver FROM readings WHERE fleet='South' and name IS NOT NULL partition BY name,driver order by name ;") diff --git a/tests/system-test/6-cluster/5dnode2mnode.py b/tests/system-test/6-cluster/5dnode2mnode.py index 509e535f01..7ce716c483 100644 --- a/tests/system-test/6-cluster/5dnode2mnode.py +++ b/tests/system-test/6-cluster/5dnode2mnode.py @@ -124,9 +124,10 @@ class TDTestCase: tdDnodes[0].stoptaosd() try: cluster.checkConnectStatus(2) - tdLog.exit(" The election still succeeds when leader of both mnodes are killed ") + tdLog.notice(" The election still succeeds when leader of both mnodes are killed ") except Exception: pass + tdSql.error("create user user1 pass '123';") tdLog.info("start leader") tdDnodes[0].starttaosd() if clusterComCheck.checkMnodeStatus(2) : diff --git a/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py b/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py index d3de31eb04..7b86ee0067 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py +++ b/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py @@ -160,7 +160,7 @@ class TDTestCase: stableName= '%s_%d'%(paraDict['stbName'],i) newTdSql=tdCom.newTdSql() clusterComCreate.create_ctable(newTdSql, paraDict["dbName"],stableName,stableName, paraDict['ctbNum']) - #insert date + #insert data for i in range(paraDict['stbNumbers']): stableName= '%s_%d'%(paraDict['stbName'],i) newTdSql=tdCom.newTdSql() @@ -170,7 +170,8 @@ class TDTestCase: dnode6Port=int(6030+5*100) tdSql.execute("create dnode '%s:%d'"%(hostname,dnode6Port)) clusterComCheck.checkDnodes(dnodeNumbers) - + for tr in threads: + tr.join() while stopcount < restartNumbers: tdLog.info(" restart loop: %d"%stopcount ) if stopRole == "mnode": @@ -202,8 +203,7 @@ class TDTestCase: tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - for tr in threads: - tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py index 2a4e86db49..d9871bb35f 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py @@ -68,10 +68,10 @@ class TDTestCase: def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db', - 'dbNumbers': 6, + 'dbNumbers': 10, 'dropFlag': 1, 'event': '', - 'vgroups': 4, + 'vgroups': 2, 'replica': 1, 'stbName': 'stb', 'stbNumbers': 100, @@ -170,7 +170,7 @@ class TDTestCase: def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode') + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=10,stopRole='mnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py index 51bd12410f..a9c8afd741 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py @@ -124,37 +124,37 @@ class TDTestCase: for tr in threads: tr.start() - # tdLog.info("Take turns stopping Mnodes ") - # while stopcount < restartNumbers: - # tdLog.info(" restart loop: %d"%stopcount ) - # if stopRole == "mnode": - # for i in range(mnodeNums): - # tdDnodes[i].stoptaosd() - # # sleep(10) - # tdDnodes[i].starttaosd() - # # sleep(10) - # elif stopRole == "vnode": - # for i in range(vnodeNumbers): - # tdDnodes[i+mnodeNums].stoptaosd() - # # sleep(10) - # tdDnodes[i+mnodeNums].starttaosd() - # # sleep(10) - # elif stopRole == "dnode": - # for i in range(dnodeNumbers): - # tdDnodes[i].stoptaosd() - # # sleep(10) - # tdDnodes[i].starttaosd() - # # sleep(10) + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) - # # dnodeNumbers don't include database of schema - # if clusterComCheck.checkDnodes(dnodeNumbers): - # tdLog.info("check dnodes status is ready") - # else: - # tdLog.info("check dnodes status is not ready") - # self.stopThread(threads) - # tdLog.exit("one or more of dnodes failed to start ") - # # self.check3mnode() - # stopcount+=1 + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("check dnodes status is ready") + else: + tdLog.info("check dnodes status is not ready") + self.stopThread(threads) + tdLog.exit("one or more of dnodes failed to start ") + # self.check3mnode() + stopcount+=1 for tr in threads: tr.join() diff --git a/tests/system-test/7-tmq/stbTagFilter.py b/tests/system-test/7-tmq/stbTagFilter-1ctb.py similarity index 82% rename from tests/system-test/7-tmq/stbTagFilter.py rename to tests/system-test/7-tmq/stbTagFilter-1ctb.py index 1bb3d24bde..003dd9a47d 100644 --- a/tests/system-test/7-tmq/stbTagFilter.py +++ b/tests/system-test/7-tmq/stbTagFilter-1ctb.py @@ -39,8 +39,8 @@ class TDTestCase: 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, 'ctbNum': 1, - 'rowsPerTbl': 100000, - 'batchNum': 1200, + 'rowsPerTbl': 10000, + 'batchNum': 2000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 3, 'showMsg': 1, @@ -84,8 +84,8 @@ class TDTestCase: 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, 'ctbNum': 1, - 'rowsPerTbl': 100000, - 'batchNum': 3000, + 'rowsPerTbl': 10000, + 'batchNum': 2000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 5, 'showMsg': 1, @@ -106,9 +106,9 @@ class TDTestCase: # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) tdLog.info("create topics from stb1") - topicFromStb1 = 'topic_stb1' - queryString = "select ts, c1, c2 from %s.%s where t4 == 'shanghai' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) - # queryString = "select ts, c1, c2, t4 from %s.%s where t4 == 'shanghai' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) + topicFromStb1 = 'topic_UpperCase_stb1' + # queryString = "select ts, c1, c2 from %s.%s where t4 == 'shanghai' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) + queryString = "select ts, c1, c2, t4 from %s.%s where t4 == 'shanghai' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) sqlString = "create topic %s as %s" %(topicFromStb1, queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) @@ -116,7 +116,7 @@ class TDTestCase: # paraDict['ctbNum'] = self.ctbNum paraDict['rowsPerTbl'] = self.rowsPerTbl consumerId = 0 - expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2) + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 1) topicList = topicFromStb1 ifcheckdata = 1 ifManualCommit = 1 @@ -138,10 +138,10 @@ class TDTestCase: tdLog.info("run select sql from db") tdSql.query(queryString) - expectrowcnt = tdSql.getRows() + totalRowsFromQuery = tdSql.getRows() - tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) - if totalConsumeRows != expectrowcnt: + tdLog.info("act consume rows: %d, act query rows: %d"%(totalConsumeRows, totalRowsFromQuery)) + if totalConsumeRows != totalRowsFromQuery: tdLog.exit("tmq consume rows error!") tmqCom.checkFileContent(consumerId, queryString) @@ -164,7 +164,7 @@ class TDTestCase: 'ctbStartIdx': 0, 'ctbNum': 1, 'rowsPerTbl': 10000, - 'batchNum': 5000, + 'batchNum': 2000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 5, 'showMsg': 1, @@ -176,23 +176,24 @@ class TDTestCase: paraDict['ctbNum'] = self.ctbNum paraDict['rowsPerTbl'] = self.rowsPerTbl - tdLog.info("restart taosd to ensure that the data falls into the disk") - tdSql.query("flush database %s"%(paraDict['dbName'])) + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) # update to half tables - paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) - paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) - tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"], - ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], - startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) + # paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"], + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) # tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) tmqCom.initConsumerTable() tdLog.info("create topics from stb1") - topicFromStb1 = 'topic_stb1' - queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + topicFromStb1 = 'topic_UpperCase_stb1' + queryString = "select ts, c1, c2 from %s.%s where t4 == 'shanghai' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) + # queryString = "select ts, c1, c2, t4 from %s.%s where t4 == 'shanghai' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) sqlString = "create topic %s as %s" %(topicFromStb1, queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) @@ -200,7 +201,7 @@ class TDTestCase: # paraDict['ctbNum'] = self.ctbNum paraDict['rowsPerTbl'] = self.rowsPerTbl consumerId = 1 - expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2) + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1/2)) topicList = topicFromStb1 ifcheckdata = 1 ifManualCommit = 1 @@ -212,6 +213,12 @@ class TDTestCase: tdLog.info("start consume processor") tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) + paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) tdLog.info("insert process end, and start to check consume result") expectRows = 1 @@ -221,12 +228,15 @@ class TDTestCase: totalConsumeRows += resultList[i] tdSql.query(queryString) - totalRowsInserted = tdSql.getRows() + totalRowsFromQuery = tdSql.getRows() - tdLog.info("act consume rows: %d, act insert rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsInserted, expectrowcnt)) - - if totalConsumeRows != expectrowcnt: - tdLog.exit("tmq consume rows error!") + tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt)) + if self.snapshot == 0: + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + elif self.snapshot == 1: + if totalConsumeRows != totalRowsFromQuery: + tdLog.exit("tmq consume rows error!") # tmqCom.checkFileContent(consumerId, queryString) @@ -240,14 +250,14 @@ class TDTestCase: tdLog.printNoPrefix("=============================================") tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") self.tmqCase1() - # self.tmqCase2() + self.tmqCase2() - # self.prepareTestEnv() - # tdLog.printNoPrefix("====================================================================") - # tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") - # self.snapshot = 1 - # self.tmqCase1() - # self.tmqCase2() + self.prepareTestEnv() + tdLog.printNoPrefix("====================================================================") + tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + self.snapshot = 1 + self.tmqCase1() + self.tmqCase2() def stop(self): diff --git a/tests/system-test/7-tmq/stbTagFilter-multiCtb.py b/tests/system-test/7-tmq/stbTagFilter-multiCtb.py new file mode 100644 index 0000000000..1ea23fe376 --- /dev/null +++ b/tests/system-test/7-tmq/stbTagFilter-multiCtb.py @@ -0,0 +1,271 @@ + +import taos +import sys +import time +import socket +import os +import threading +from enum import Enum + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 100 + self.rowsPerTbl = 1000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 200, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 200, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 5, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + # update to half tables + # paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_UpperCase_stb1' + queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) + # queryString = "select ts, c1, c2, t4 from %s.%s where t4 == 'beijing' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + # paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 0 + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 1) + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("insert process end, and start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdLog.info("run select sql from db") + tdSql.query(queryString) + totalRowsFromQuery = tdSql.getRows() + + tdLog.info("act consume rows: %d, act query rows: %d"%(totalConsumeRows, totalRowsFromQuery)) + if totalConsumeRows != totalRowsFromQuery: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tdSql.query("drop topic %s"%topicFromStb1) + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 200, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + + # update to half tables + # paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) + # paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"], + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tmqCom.initConsumerTable() + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_UpperCase_stb1' + # queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) + queryString = "select ts, c1, c2, t4 from %s.%s where t4 == 'beijing' or t4 == 'changsha'"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + # paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 1 + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2)) + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl * 7/10) + paraDict['ctbStartIdx'] = int(paraDict['ctbNum'] * 7/10) + # paraDict["rowsPerTbl"] = 100 + paraDict["ctbPrefix"] = 'newCtbx' + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("insert process end, and start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsFromQuery = tdSql.getRows() + + tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt)) + if self.snapshot == 0: + if totalConsumeRows != expectrowcnt / 2: + tdLog.exit("tmq consume rows error!") + elif self.snapshot == 1: + if totalConsumeRows != totalRowsFromQuery: + tdLog.exit("tmq consume rows error when snapshot is 1!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tdSql.query("drop topic %s"%topicFromStb1) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + tdSql.prepare() + self.prepareTestEnv() + tdLog.printNoPrefix("=============================================") + tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + self.tmqCase1() + self.tmqCase2() + + self.prepareTestEnv() + tdLog.printNoPrefix("====================================================================") + tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + self.snapshot = 1 + self.tmqCase1() + self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/subscribeDb4.py b/tests/system-test/7-tmq/subscribeDb4.py index b99704b602..145cbbbbf5 100644 --- a/tests/system-test/7-tmq/subscribeDb4.py +++ b/tests/system-test/7-tmq/subscribeDb4.py @@ -88,7 +88,7 @@ class TDTestCase: tmqCom.startTmqSimProcess(self.pollDelay,self.paraDict["dbName"],self.showMsg, self.showRow,self.cdbName) tdLog.info("After waiting for a period of time, drop one stable") - time.sleep(10) + time.sleep(3) tdSql.execute("drop table %s.%s" %(self.paraDict['dbName'], self.paraDict['stbName'])) tdLog.info("wait result from consumer, then check it") diff --git a/tests/system-test/7-tmq/tmqAutoCreateTbl.py b/tests/system-test/7-tmq/tmqAutoCreateTbl.py index 1622ad7621..8fcb57aea6 100644 --- a/tests/system-test/7-tmq/tmqAutoCreateTbl.py +++ b/tests/system-test/7-tmq/tmqAutoCreateTbl.py @@ -225,7 +225,7 @@ class TDTestCase: tdSql.prepare() self.prepareTestEnv() self.tmqCase1() - # self.tmqCase2() TD-17267 + # self.tmqCase2() # TD-17267 def stop(self): diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 1f57099e3a..164a6b24ba 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -360,7 +360,7 @@ class TMQCom: return pThread def insert_data_with_autoCreateTbl(self,tsql,dbName,stbName,ctbPrefix,ctbNum,rowsPerTbl,batchNum,startTs=0,ctbStartIdx=0): - tdLog.debug("start to insert data wiht auto create child table ............") + tdLog.debug("start to insert data with auto create child table ............") tsql.execute("use %s" %dbName) pre_insert = "insert into " sql = pre_insert diff --git a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py new file mode 100644 index 0000000000..84db8e840b --- /dev/null +++ b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py @@ -0,0 +1,372 @@ +from distutils.log import error +import taos +import sys +import time +import socket +import os +import threading +import subprocess +import platform + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 100 + self.rowsPerTbl = 1000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def prepare_udf_so(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + print(projPath) + + if platform.system().lower() == 'windows': + self.libudf1 = subprocess.Popen('(for /r %s %%i in ("udf1.d*") do @echo %%i)|grep lib|head -n1'%projPath , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + if (not tdDnodes.dnodes[0].remoteIP == ""): + tdDnodes.dnodes[0].remote_conn.get(tdDnodes.dnodes[0].config["path"]+'/debug/build/lib/libudf1.so',projPath+"\\debug\\build\\lib\\") + self.libudf1 = self.libudf1.replace('udf1.dll','libudf1.so') + else: + self.libudf1 = subprocess.Popen('find %s -name "libudf1.so"|grep lib|head -n1'%projPath , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + self.libudf1 = self.libudf1.replace('\r','').replace('\n','') + return + + def create_udf_function(self): + # create scalar functions + tdSql.execute("create function udf1 as '%s' outputtype int bufSize 8;"%self.libudf1) + + functions = tdSql.getResult("show functions") + function_nums = len(functions) + if function_nums == 1: + tdLog.info("create one udf functions success ") + else: + tdLog.exit("create udf functions fail") + return + + def checkFileContent(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + + while True: + dst = queryFile.readline() + src = consumeFile.readline() + + if dst: + if dst != src: + tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) + else: + break + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: multi sub table") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1', 'topic2'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdLog.info("create topics from stb with filter") + queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("0 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + + queryString = "select ts, c1,udf1(c1),sin(udf1(c2)), log(udf1(c2)) from %s.%s where udf1(c1) == 88 or sin(udf1(c1)) > 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[1], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + consumerId = 1 + topicList = topicNameList[1] + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + if expectRowsList[1] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) + tdLog.exit("1 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: multi sub table, consume with auto create tble and insert data") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1', 'topic2'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdLog.info("create topics from stb with filter") + queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + # tdSql.query(queryString) + # expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 2 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl) + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("2 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + + queryString = "select ts, c1,udf1(c1),sin(udf1(c2)), log(udf1(c2)) from %s.%s where udf1(c1) == 88 or sin(udf1(c1)) > 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[1], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + consumerId = 3 + topicList = topicNameList[1] + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + if expectRowsList[1] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) + tdLog.exit("3 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + # tdSql.prepare() + self.prepare_udf_so() + self.create_udf_function() + + tdLog.printNoPrefix("=============================================") + tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + self.prepareTestEnv() + self.tmqCase1() + self.tmqCase2() + + # tdLog.printNoPrefix("====================================================================") + # tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + # self.prepareTestEnv() + # self.snapshot = 1 + # self.tmqCase1() + # self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py new file mode 100644 index 0000000000..5b964e1d38 --- /dev/null +++ b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py @@ -0,0 +1,372 @@ +from distutils.log import error +import taos +import sys +import time +import socket +import os +import threading +import subprocess +import platform + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 100 + self.rowsPerTbl = 1000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def prepare_udf_so(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + print(projPath) + + if platform.system().lower() == 'windows': + self.libudf1 = subprocess.Popen('(for /r %s %%i in ("udf1.d*") do @echo %%i)|grep lib|head -n1'%projPath , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + if (not tdDnodes.dnodes[0].remoteIP == ""): + tdDnodes.dnodes[0].remote_conn.get(tdDnodes.dnodes[0].config["path"]+'/debug/build/lib/libudf1.so',projPath+"\\debug\\build\\lib\\") + self.libudf1 = self.libudf1.replace('udf1.dll','libudf1.so') + else: + self.libudf1 = subprocess.Popen('find %s -name "libudf1.so"|grep lib|head -n1'%projPath , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + self.libudf1 = self.libudf1.replace('\r','').replace('\n','') + return + + def create_udf_function(self): + # create scalar functions + tdSql.execute("create function udf1 as '%s' outputtype int bufSize 8;"%self.libudf1) + + functions = tdSql.getResult("show functions") + function_nums = len(functions) + if function_nums == 1: + tdLog.info("create one udf functions success ") + else: + tdLog.exit("create udf functions fail") + return + + def checkFileContent(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + + while True: + dst = queryFile.readline() + src = consumeFile.readline() + + if dst: + if dst != src: + tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) + else: + break + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: multi sub table") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1', 'topic2'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdLog.info("create topics from stb with filter") + queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("0 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + + queryString = "select ts, c1,udf1(c1),sin(udf1(c2)), log(udf1(c2)) from %s.%s where udf1(c1) == 88 or sin(udf1(c1)) > 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[1], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + consumerId = 1 + topicList = topicNameList[1] + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + if expectRowsList[1] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) + tdLog.exit("1 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: multi sub table, consume with auto create tble and insert data") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1', 'topic2'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdLog.info("create topics from stb with filter") + queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + # tdSql.query(queryString) + # expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 2 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl) + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("2 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + + queryString = "select ts, c1,udf1(c1),sin(udf1(c2)), log(udf1(c2)) from %s.%s where udf1(c1) == 88 or sin(udf1(c1)) > 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[1], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + consumerId = 3 + topicList = topicNameList[1] + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + if expectRowsList[1] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) + tdLog.exit("3 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + # tdSql.prepare() + self.prepare_udf_so() + self.create_udf_function() + + # tdLog.printNoPrefix("=============================================") + # tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + # self.prepareTestEnv() + # self.tmqCase1() + # self.tmqCase2() + + tdLog.printNoPrefix("====================================================================") + tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + self.prepareTestEnv() + self.snapshot = 1 + self.tmqCase1() + self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqUdf-multCtb.py b/tests/system-test/7-tmq/tmqUdf-multCtb.py new file mode 100644 index 0000000000..392a7d452e --- /dev/null +++ b/tests/system-test/7-tmq/tmqUdf-multCtb.py @@ -0,0 +1,372 @@ +from distutils.log import error +import taos +import sys +import time +import socket +import os +import threading +import subprocess +import platform + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 100 + self.rowsPerTbl = 1000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def prepare_udf_so(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + print(projPath) + + if platform.system().lower() == 'windows': + self.libudf1 = subprocess.Popen('(for /r %s %%i in ("udf1.d*") do @echo %%i)|grep lib|head -n1'%projPath , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + if (not tdDnodes.dnodes[0].remoteIP == ""): + tdDnodes.dnodes[0].remote_conn.get(tdDnodes.dnodes[0].config["path"]+'/debug/build/lib/libudf1.so',projPath+"\\debug\\build\\lib\\") + self.libudf1 = self.libudf1.replace('udf1.dll','libudf1.so') + else: + self.libudf1 = subprocess.Popen('find %s -name "libudf1.so"|grep lib|head -n1'%projPath , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + self.libudf1 = self.libudf1.replace('\r','').replace('\n','') + return + + def create_udf_function(self): + # create scalar functions + tdSql.execute("create function udf1 as '%s' outputtype int bufSize 8;"%self.libudf1) + + functions = tdSql.getResult("show functions") + function_nums = len(functions) + if function_nums == 1: + tdLog.info("create one udf functions success ") + else: + tdLog.exit("create udf functions fail") + return + + def checkFileContent(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + + while True: + dst = queryFile.readline() + src = consumeFile.readline() + + if dst: + if dst != src: + tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) + else: + break + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: multi sub table") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1', 'topic2'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdLog.info("create topics from stb with filter") + queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("0 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + + queryString = "select ts, c1,udf1(c1),sin(udf1(c2)), log(udf1(c2)) from %s.%s where udf1(c1) == 88 or sin(udf1(c1)) > 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[1], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + consumerId = 1 + topicList = topicNameList[1] + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + if expectRowsList[1] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) + tdLog.exit("1 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: multi sub table, consume with auto create tble and insert data") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1', 'topic2'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdLog.info("create topics from stb with filter") + queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + # tdSql.query(queryString) + # expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 2 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl) + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("2 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + + queryString = "select ts, c1,udf1(c1),sin(udf1(c2)), log(udf1(c2)) from %s.%s where udf1(c1) == 88 or sin(udf1(c1)) > 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[1], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + consumerId = 3 + topicList = topicNameList[1] + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + if expectRowsList[1] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) + tdLog.exit("3 tmq consume rows error!") + + # self.checkFileContent(consumerId, queryString) + # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + # tdSql.prepare() + self.prepare_udf_so() + self.create_udf_function() + + tdLog.printNoPrefix("=============================================") + tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + self.prepareTestEnv() + self.tmqCase1() + self.tmqCase2() + + tdLog.printNoPrefix("====================================================================") + tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + self.prepareTestEnv() + self.snapshot = 1 + self.tmqCase1() + self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqUdf.py b/tests/system-test/7-tmq/tmqUdf.py index d241a97e0c..04067ccf65 100644 --- a/tests/system-test/7-tmq/tmqUdf.py +++ b/tests/system-test/7-tmq/tmqUdf.py @@ -17,6 +17,12 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 1 + self.rowsPerTbl = 1000 + def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor()) @@ -79,38 +85,89 @@ class TDTestCase: tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) else: break - return + return - def tmqCase1(self): - tdLog.printNoPrefix("======== test case 1: ") - paraDict = {'dbName': 'db1', + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', 'dropFlag': 1, 'event': '', 'vgroups': 4, 'stbName': 'stb', 'colPrefix': 'c', 'tagPrefix': 't', - 'colSchema': [{'type': 'INT', 'count':2}, {'type': 'binary', 'len':20, 'count':1}], - 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, 'ctbNum': 1, 'rowsPerTbl': 1000, - 'batchNum': 10, + 'batchNum': 100, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, + 'pollDelay': 3, 'showMsg': 1, - 'showRow': 1} + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: one sub table") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl topicNameList = ['topic1', 'topic2'] expectRowsList = [] tmqCom.initConsumerTable() - tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) - tdLog.info("create stb") - tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) - tdLog.info("create ctb") - tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) - tdLog.info("insert data") - tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) tdLog.info("create topics from stb with filter") queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) @@ -131,7 +188,7 @@ class TDTestCase: tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor") - tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) tdLog.info("wait the consume result") expectRows = 1 @@ -160,7 +217,7 @@ class TDTestCase: tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) tdLog.info("start consume processor") - tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) tdLog.info("wait the consume result") expectRows = 1 @@ -177,12 +234,134 @@ class TDTestCase: tdSql.query("drop topic %s"%topicNameList[i]) tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: one sub table, consume with auto create tble and insert data") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1', 'topic2'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data_1(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdLog.info("create topics from stb with filter") + queryString = "select ts,c1,udf1(c1),c2,udf1(c2) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + # tdSql.query(queryString) + # expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 2 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl) + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("2 tmq consume rows error!") + + self.checkFileContent(consumerId, queryString) + tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + + queryString = "select ts, c1,udf1(c1),sin(udf1(c2)), log(udf1(c2)) from %s.%s where udf1(c1) == 88 or sin(udf1(c1)) > 0" %(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[1], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + consumerId = 3 + topicList = topicNameList[1] + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("wait the consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + if expectRowsList[1] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) + tdLog.exit("3 tmq consume rows error!") + + self.checkFileContent(consumerId, queryString) + tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") def run(self): - tdSql.prepare() + # tdSql.prepare() self.prepare_udf_so() self.create_udf_function() + + tdLog.printNoPrefix("=============================================") + tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + self.prepareTestEnv() self.tmqCase1() + self.tmqCase2() + + tdLog.printNoPrefix("====================================================================") + tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + self.prepareTestEnv() + self.snapshot = 1 + self.tmqCase1() + self.tmqCase2() def stop(self): tdSql.close() diff --git a/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py new file mode 100644 index 0000000000..3b6ae65316 --- /dev/null +++ b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot0.py @@ -0,0 +1,275 @@ + +import taos +import sys +import time +import socket +import os +import threading +from enum import Enum + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 50 + self.rowsPerTbl = 1000 + self.autoCtbPrefix = 'aCtb' + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 1000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix, + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 1000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 5, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + # update to half tables + paraDict['ctbNum'] = int(self.ctbNum/2) + paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix, + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 0 + if self.snapshot == 0: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2*2)) + elif self.snapshot == 1: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2)) + + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsInserted = tdSql.getRows() + + tdLog.info("act consume rows: %d, expect consume rows: %d, act insert rows: %d"%(totalConsumeRows, expectrowcnt, totalRowsInserted)) + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tdSql.query("drop topic %s"%topicFromStb1) + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 1000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 5, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("restart taosd to ensure that the data falls into the disk") + tdSql.query("flush database %s"%(paraDict['dbName'])) + + # update to half tables + paraDict['ctbNum'] = int(self.ctbNum/2) + paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix, + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2)) + + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="aCtby", + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2)) + + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2)) + + tmqCom.initConsumerTable() + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + # paraDict['ctbNum'] = self.ctbNum + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 1 + if self.snapshot == 0: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2*2 + 1/2*1/2)) + elif self.snapshot == 1: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2)) + + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsInserted = tdSql.getRows() + + tdLog.info("act consume rows: %d, act insert rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsInserted, expectrowcnt)) + + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tdSql.query("drop topic %s"%topicFromStb1) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + # tdSql.prepare() + self.prepareTestEnv() + tdLog.printNoPrefix("=============================================") + tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + self.tmqCase1() + self.tmqCase2() + + # self.prepareTestEnv() + # tdLog.printNoPrefix("====================================================================") + # tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + # self.snapshot = 1 + # self.tmqCase1() + # self.tmqCase2() + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot1.py b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot1.py new file mode 100644 index 0000000000..0ac897c2cd --- /dev/null +++ b/tests/system-test/7-tmq/tmqUpdate-multiCtb-snapshot1.py @@ -0,0 +1,275 @@ + +import taos +import sys +import time +import socket +import os +import threading +from enum import Enum + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 50 + self.rowsPerTbl = 1000 + self.autoCtbPrefix = 'aCtb' + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 1000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix, + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 1000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 5, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + # update to half tables + paraDict['ctbNum'] = int(self.ctbNum/2) + paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix, + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 0 + if self.snapshot == 0: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2*2)) + elif self.snapshot == 1: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2)) + + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsInserted = tdSql.getRows() + + tdLog.info("act consume rows: %d, expect consume rows: %d, act insert rows: %d"%(totalConsumeRows, expectrowcnt, totalRowsInserted)) + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tdSql.query("drop topic %s"%topicFromStb1) + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 1000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 5, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("restart taosd to ensure that the data falls into the disk") + tdSql.query("flush database %s"%(paraDict['dbName'])) + + # update to half tables + paraDict['ctbNum'] = int(self.ctbNum/2) + paraDict['rowsPerTbl'] = int(self.rowsPerTbl / 2) + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl / 2) + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=self.autoCtbPrefix, + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2)) + + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="aCtby", + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2)) + + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']+int(self.ctbNum/2)) + + tmqCom.initConsumerTable() + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + # paraDict['ctbNum'] = self.ctbNum + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 1 + if self.snapshot == 0: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2*2 + 1/2*1/2)) + elif self.snapshot == 1: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (2 + 1/2*1/2)) + + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsInserted = tdSql.getRows() + + tdLog.info("act consume rows: %d, act insert rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsInserted, expectrowcnt)) + + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tdSql.query("drop topic %s"%topicFromStb1) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + # tdSql.prepare() + # self.prepareTestEnv() + # tdLog.printNoPrefix("=============================================") + # tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + # self.tmqCase1() + # self.tmqCase2() + + self.prepareTestEnv() + tdLog.printNoPrefix("====================================================================") + tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + self.snapshot = 1 + self.tmqCase1() + self.tmqCase2() + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqUpdate-multiCtb.py b/tests/system-test/7-tmq/tmqUpdate-multiCtb.py index 491feb68bd..892137be43 100644 --- a/tests/system-test/7-tmq/tmqUpdate-multiCtb.py +++ b/tests/system-test/7-tmq/tmqUpdate-multiCtb.py @@ -18,7 +18,7 @@ class TDTestCase: def __init__(self): self.snapshot = 0 self.vgroups = 4 - self.ctbNum = 100 + self.ctbNum = 50 self.rowsPerTbl = 1000 self.autoCtbPrefix = 'aCtb' @@ -39,9 +39,9 @@ class TDTestCase: 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, - 'ctbNum': 1000, + 'ctbNum': 100, 'rowsPerTbl': 1000, - 'batchNum': 10000, + 'batchNum': 1000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 3, 'showMsg': 1, @@ -71,7 +71,6 @@ class TDTestCase: # tdSql.query("flush database %s"%(paraDict['dbName'])) return - # 自动建表完成数据插入,启动消费 def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'dbt', @@ -85,9 +84,9 @@ class TDTestCase: 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, - 'ctbNum': 1000, + 'ctbNum': 100, 'rowsPerTbl': 1000, - 'batchNum': 10000, + 'batchNum': 1000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 5, 'showMsg': 1, @@ -167,9 +166,9 @@ class TDTestCase: 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, - 'ctbNum': 1000, + 'ctbNum': 100, 'rowsPerTbl': 1000, - 'batchNum': 10000, + 'batchNum': 1000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 5, 'showMsg': 1, diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 19658c3a0a..6639376485 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -132,21 +132,23 @@ python3 ./test.py -f 2-query/max_partition.py python3 ./test.py -f 2-query/last_row.py python3 ./test.py -f 6-cluster/5dnode1mnode.py -#BUG python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3 #python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 # python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py # python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 # python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 # BUG Redict python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 6 -M 3 -C 5 # python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 5 -M 3 + python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 6 -M 3 -C 5 + python3 ./test.py -f 7-tmq/basic5.py python3 ./test.py -f 7-tmq/subscribeDb.py python3 ./test.py -f 7-tmq/subscribeDb0.py @@ -166,7 +168,6 @@ python3 ./test.py -f 7-tmq/schema.py python3 ./test.py -f 7-tmq/stbFilter.py python3 ./test.py -f 7-tmq/tmqCheckData.py python3 ./test.py -f 7-tmq/tmqCheckData1.py -python3 ./test.py -f 7-tmq/tmqUdf.py #python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 5 python3 ./test.py -f 7-tmq/tmqConsumerGroup.py python3 ./test.py -f 7-tmq/tmqShow.py @@ -186,8 +187,15 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py #python3 ./test.py -f 7-tmq/tmqDnodeRestart.py python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py -python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb.py +python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py +python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py #python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py +python3 ./test.py -f 7-tmq/tmqUdf.py +python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py +python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py +python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py +python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py + #------------querPolicy 2----------- diff --git a/tests/tsim/inc/simParse.h b/tests/tsim/inc/simParse.h index 349a117944..2a683f9561 100644 --- a/tests/tsim/inc/simParse.h +++ b/tests/tsim/inc/simParse.h @@ -35,14 +35,14 @@ enum { /* label stack */ typedef struct { - char top; /* number of labels */ + int8_t top; /* number of labels */ int16_t pos[MAX_NUM_LABLES]; /* the position of the label */ char label[MAX_NUM_LABLES][MAX_LABEL_LEN]; /* name of the label */ } SLabel; /* block definition */ typedef struct { - char top; /* the number of blocks stacked */ + int8_t top; /* the number of blocks stacked */ char type[MAX_NUM_BLOCK]; /* the block type */ int16_t *pos[MAX_NUM_BLOCK]; /* position of the jump for if/elif/case */ int16_t back[MAX_NUM_BLOCK]; /* go back, endw and continue */ diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 14cab041f6..a496cc2864 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -758,7 +758,6 @@ void shellReadHistory() { taosCloseFile(&pFile); int64_t file_size; if (taosStatFile(pHistory->file, &file_size, NULL) == 0 && file_size > SHELL_MAX_COMMAND_SIZE) { - fprintf(stdout,"%s(%d) %s %08" PRId64 "\n", __FILE__, __LINE__,__func__,taosGetSelfPthreadId());fflush(stdout); TdFilePtr pFile = taosOpenFile(pHistory->file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_STREAM | TD_FILE_TRUNC); if (pFile == NULL) return; int32_t endIndex = pHistory->hstart; diff --git a/tools/taos-tools b/tools/taos-tools index 0b8a3373bb..2b75339b8b 160000 --- a/tools/taos-tools +++ b/tools/taos-tools @@ -1 +1 @@ -Subproject commit 0b8a3373bb7548f8106d13e7d3b0a988d3c4d48a +Subproject commit 2b75339b8b5c239619d1f09970d03075c58140dd diff --git a/tools/taosws-rs b/tools/taosws-rs index c5fded266d..d8cf0e7e06 160000 --- a/tools/taosws-rs +++ b/tools/taosws-rs @@ -1 +1 @@ -Subproject commit c5fded266d3b10508e38bf3285bb7ecf798bc343 +Subproject commit d8cf0e7e067d193cfaf3e920b6ec6cbb9b9f4165