diff --git a/.appveyor.yml b/.appveyor.yml index ee1dc91767da710bbc508801d88474a20eba60df..e7802b3d0d3cf969381b5fa2a99862b3df5aa05f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,49 +1,49 @@ -version: 1.0.{build} -image: - - Visual Studio 2015 - - macos -environment: - matrix: - - ARCH: amd64 - - ARCH: x86 -matrix: - exclude: - - image: macos - ARCH: x86 -for: - - - matrix: - only: - - image: Visual Studio 2015 - clone_folder: c:\dev\TDengine - clone_depth: 1 - - init: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% - - before_build: - - cd c:\dev\TDengine - - md build - - build_script: - - cd build - - cmake -G "NMake Makefiles" .. - - nmake install - - - matrix: - only: - - image: macos - clone_depth: 1 - - build_script: - - mkdir debug - - cd debug - - cmake .. > /dev/null - - make > /dev/null -notifications: -- provider: Email - to: - - sangshuduo@gmail.com - on_build_success: true - on_build_failure: true - on_build_status_changed: true +version: 1.0.{build} +image: + - Visual Studio 2015 + - macos +environment: + matrix: + - ARCH: amd64 + - ARCH: x86 +matrix: + exclude: + - image: macos + ARCH: x86 +for: + - + matrix: + only: + - image: Visual Studio 2015 + clone_folder: c:\dev\TDengine + clone_depth: 1 + + init: + - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% + + before_build: + - cd c:\dev\TDengine + - md build + + build_script: + - cd build + - cmake -G "NMake Makefiles" .. -DBUILD_JDBC=false + - nmake install + - + matrix: + only: + - image: macos + clone_depth: 1 + + build_script: + - mkdir debug + - cd debug + - cmake .. > /dev/null + - make > /dev/null +notifications: +- provider: Email + to: + - sangshuduo@gmail.com + on_build_success: true + on_build_failure: true + on_build_status_changed: true diff --git a/cmake/env.inc b/cmake/env.inc index 3989993953f8cd0608a2bf7adfe9fd349f9e9a03..6c1ce8fd89847b41f0cdb595384c2772823c7885 100755 --- a/cmake/env.inc +++ b/cmake/env.inc @@ -14,11 +14,13 @@ MESSAGE(STATUS "Project binary files output path: " ${PROJECT_BINARY_DIR}) MESSAGE(STATUS "Project executable files output path: " ${EXECUTABLE_OUTPUT_PATH}) MESSAGE(STATUS "Project library files output path: " ${LIBRARY_OUTPUT_PATH}) -FIND_PROGRAM(TD_MVN_INSTALLED mvn) -IF (TD_MVN_INSTALLED) - MESSAGE(STATUS "MVN is installed and JDBC will be compiled") -ELSE () - MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") +IF (TD_BUILD_JDBC) + FIND_PROGRAM(TD_MVN_INSTALLED mvn) + IF (TD_MVN_INSTALLED) + MESSAGE(STATUS "MVN is installed and JDBC will be compiled") + ELSE () + MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") + ENDIF () ENDIF () # @@ -55,4 +57,4 @@ ELSE () SET(CMAKE_BUILD_TYPE "Debug") MESSAGE(STATUS "Build Debug Version as default") ENDIF() -ENDIF () \ No newline at end of file +ENDIF () diff --git a/cmake/input.inc b/cmake/input.inc index 543114ad0956d24900ece70731da504acdf6a72d..9b72a35d940ba5e3d79458bbe2455b0db2b59e14 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -77,3 +77,9 @@ IF (${JEMALLOC_ENABLED} MATCHES "true") SET(TD_JEMALLOC_ENABLED TRUE) MESSAGE(STATUS "build with jemalloc enabled") ENDIF () + +SET(TD_BUILD_JDBC TRUE) + +IF (${BUILD_JDBC} MATCHES "false") + SET(TD_BUILD_JDBC FALSE) +ENDIF () diff --git a/documentation20/cn/08.connector/01.java/docs.md b/documentation20/cn/08.connector/01.java/docs.md index 5eec33e2f1740eeff9042a5dc3ea01ecab50632b..4fc10b542b2e4ad4c9a82bfe0d342e56e1297ba7 100644 --- a/documentation20/cn/08.connector/01.java/docs.md +++ b/documentation20/cn/08.connector/01.java/docs.md @@ -266,7 +266,9 @@ while(resultSet.next()){ > 查询和操作关系型数据库一致,使用下标获取返回字段内容时从 1 开始,建议使用字段名称获取。 ### 处理异常 + 在报错后,通过SQLException可以获取到错误的信息和错误码: + ```java try (Statement statement = connection.createStatement()) { // executeQuery @@ -279,11 +281,87 @@ try (Statement statement = connection.createStatement()) { e.printStackTrace(); } ``` + JDBC连接器可能报错的错误码包括3种:JDBC driver本身的报错(错误码在0x2301到0x2350之间),JNI方法的报错(错误码在0x2351到0x2400之间),TDengine其他功能模块的报错。 具体的错误码请参考: * https://github.com/taosdata/TDengine/blob/develop/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java * https://github.com/taosdata/TDengine/blob/develop/src/inc/taoserror.h +### 通过参数绑定写入数据 + +从 2.1.2.0 版本开始,TDengine 的 **JDBC-JNI** 实现大幅改进了参数绑定方式对数据写入(INSERT)场景的支持。采用这种方式写入数据时,能避免 SQL 语法解析的资源消耗,从而在很多情况下显著提升写入性能。(注意:**JDBC-RESTful** 实现并不提供参数绑定这种使用方式。) + +```java +Statement stmt = conn.createStatement(); +Random r = new Random(); + +// INSERT 语句中,VALUES 部分允许指定具体的数据列;如果采取自动建表,则 TAGS 部分需要设定全部 TAGS 列的参数值: +TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags (?, ?) (ts, c1, c2) values(?, ?, ?)"); + +// 设定数据表名: +s.setTableName("w1"); +// 设定 TAGS 取值: +s.setTagInt(0, r.nextInt(10)); +s.setTagString(1, "Beijing"); + +int numOfRows = 10; + +// VALUES 部分以逐列的方式进行设置: +ArrayList ts = new ArrayList<>(); +for (int i = 0; i < numOfRows; i++){ + ts.add(System.currentTimeMillis() + i); +} +s.setTimestamp(0, ts); + +ArrayList s1 = new ArrayList<>(); +for (int i = 0; i < numOfRows; i++){ + s1.add(r.nextInt(100)); +} +s.setInt(1, s1); + +ArrayList s2 = new ArrayList<>(); +for (int i = 0; i < numOfRows; i++){ + s2.add("test" + r.nextInt(100)); +} +s.setString(2, s2, 10); + +// AddBatch 之后,可以再设定新的表名、TAGS、VALUES 取值,这样就能实现一次执行向多个数据表写入: +s.columnDataAddBatch(); +// 执行语句: +s.columnDataExecuteBatch(); +// 执行完毕,释放资源: +s.columnDataCloseBatch(); +``` + +用于设定 TAGS 取值的方法总共有: +```java +public void setTagNull(int index, int type) +public void setTagBoolean(int index, boolean value) +public void setTagInt(int index, int value) +public void setTagByte(int index, byte value) +public void setTagShort(int index, short value) +public void setTagLong(int index, long value) +public void setTagTimestamp(int index, long value) +public void setTagFloat(int index, float value) +public void setTagDouble(int index, double value) +public void setTagString(int index, String value) +public void setTagNString(int index, String value) +``` + +用于设定 VALUES 数据列的取值的方法总共有: +```java +public void setInt(int columnIndex, ArrayList list) throws SQLException +public void setFloat(int columnIndex, ArrayList list) throws SQLException +public void setTimestamp(int columnIndex, ArrayList list) throws SQLException +public void setLong(int columnIndex, ArrayList list) throws SQLException +public void setDouble(int columnIndex, ArrayList list) throws SQLException +public void setBoolean(int columnIndex, ArrayList list) throws SQLException +public void setByte(int columnIndex, ArrayList list) throws SQLException +public void setShort(int columnIndex, ArrayList list) throws SQLException +public void setString(int columnIndex, ArrayList list, int size) throws SQLException +public void setNString(int columnIndex, ArrayList list, int size) throws SQLException +``` + ### 订阅 #### 创建 diff --git a/documentation20/cn/08.connector/docs.md b/documentation20/cn/08.connector/docs.md index 94849179936f909de1f344b6a1e61cb1a36a7940..60f8df95f8c9d9a5510512c081713d32b568bfd8 100644 --- a/documentation20/cn/08.connector/docs.md +++ b/documentation20/cn/08.connector/docs.md @@ -291,9 +291,25 @@ typedef struct taosField { TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线程同时打开多张表,并可以同时对每张打开的表进行查询或者插入操作。需要指出的是,**客户端应用必须确保对同一张表的操作完全串行化**,即对同一个表的插入或查询操作未完成时(未返回时),不能够执行第二个插入或查询操作。 -### 参数绑定API + +### 参数绑定 API -除了直接调用 `taos_query` 进行查询,TDengine也提供了支持参数绑定的Prepare API,与 MySQL 一样,这些API目前也仅支持用问号`?`来代表待绑定的参数,具体如下: +除了直接调用 `taos_query` 进行查询,TDengine 也提供了支持参数绑定的 Prepare API,与 MySQL 一样,这些 API 目前也仅支持用问号 `?` 来代表待绑定的参数。 + +从 2.1.1.0 和 2.1.2.0 版本开始,TDengine 大幅改进了参数绑定接口对数据写入(INSERT)场景的支持。这样在通过参数绑定接口写入数据时,就避免了 SQL 语法解析的资源消耗,从而在绝大多数情况下显著提升写入性能。此时的典型操作步骤如下: +1. 调用 `taos_stmt_init` 创建参数绑定对象; +2. 调用 `taos_stmt_prepare` 解析 INSERT 语句; +3. 如果 INSERT 语句中预留了表名但没有预留 TAGS,那么调用 `taos_stmt_set_tbname` 来设置表名; +4. 如果 INSERT 语句中既预留了表名又预留了 TAGS(例如 INSERT 语句采取的是自动建表的方式),那么调用 `taos_stmt_set_tbname_tags` 来设置表名和 TAGS 的值; +5. 调用 `taos_stmt_bind_param_batch` 以多列的方式设置 VALUES 的值; +6. 调用 `taos_stmt_add_batch` 把当前绑定的参数加入批处理; +7. 可以重复第 3~6 步,为批处理加入更多的数据行; +8. 调用 `taos_stmt_execute` 执行已经准备好的批处理指令; +9. 执行完毕,调用 `taos_stmt_close` 释放所有资源。 + +除 C/C++ 语言外,TDengine 的 Java 语言 JNI Connector 也提供参数绑定接口支持,具体请另外参见:[参数绑定接口的 Java 用法](https://www.taosdata.com/cn/documentation/connector/java#stmt-java)。 + +接口相关的具体函数如下(也可以参考 [apitest.c](https://github.com/taosdata/TDengine/blob/develop/tests/examples/c/apitest.c) 文件中使用对应函数的方式): - `TAOS_STMT* taos_stmt_init(TAOS *taos)` @@ -301,11 +317,12 @@ TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线 - `int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length)` - 解析一条sql语句,将解析结果和参数信息绑定到stmt上,如果参数length大于0,将使用此参数作为sql语句的长度,如等于0,将自动判断sql语句的长度。 + 解析一条 SQL 语句,将解析结果和参数信息绑定到 stmt 上,如果参数 length 大于 0,将使用此参数作为 SQL 语句的长度,如等于 0,将自动判断 SQL 语句的长度。 - `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind)` - 进行参数绑定,bind指向一个数组,需保证此数组的元素数量和顺序与sql语句中的参数完全一致。TAOS_BIND 的使用方法与 MySQL中的 MYSQL_BIND 一致,具体定义如下: + 不如 `taos_stmt_bind_param_batch` 效率高,但可以支持非 INSERT 类型的 SQL 语句。 + 进行参数绑定,bind 指向一个数组(代表所要绑定的一行数据),需保证此数组中的元素数量和顺序与 SQL 语句中的参数完全一致。TAOS_BIND 的使用方法与 MySQL 中的 MYSQL_BIND 一致,具体定义如下: ```c typedef struct TAOS_BIND { @@ -319,9 +336,35 @@ typedef struct TAOS_BIND { } TAOS_BIND; ``` +- `int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name)` + + (2.1.1.0 版本新增) + 当 SQL 语句中的表名使用了 `?` 占位时,可以使用此函数绑定一个具体的表名。 + +- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags)` + + (2.1.2.0 版本新增) + 当 SQL 语句中的表名和 TAGS 都使用了 `?` 占位时,可以使用此函数绑定具体的表名和具体的 TAGS 取值。最典型的使用场景是使用了自动建表功能的 INSERT 语句(目前版本不支持指定具体的 TAGS 列)。tags 参数中的列数量需要与 SQL 语句中要求的 TAGS 数量完全一致。 + +- `int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind)` + + (2.1.1.0 版本新增) + 以多列的方式传递待绑定的数据,需要保证这里传递的数据列的顺序、列的数量与 SQL 语句中的 VALUES 参数完全一致。TAOS_MULTI_BIND 的具体定义如下: + +```c +typedef struct TAOS_MULTI_BIND { + int buffer_type; + void * buffer; + uintptr_t buffer_length; + int32_t * length; + char * is_null; + int num; // 列的个数,即 buffer 中的参数个数 +} TAOS_MULTI_BIND; +``` + - `int taos_stmt_add_batch(TAOS_STMT *stmt)` - 将当前绑定的参数加入批处理中,调用此函数后,可以再次调用`taos_stmt_bind_param`绑定新的参数。需要注意,此函数仅支持 insert/import 语句,如果是select等其他SQL语句,将返回错误。 + 将当前绑定的参数加入批处理中,调用此函数后,可以再次调用 `taos_stmt_bind_param` 或 `taos_stmt_bind_param_batch` 绑定新的参数。需要注意,此函数仅支持 INSERT/IMPORT 语句,如果是 SELECT 等其他 SQL 语句,将返回错误。 - `int taos_stmt_execute(TAOS_STMT *stmt)` @@ -329,7 +372,7 @@ typedef struct TAOS_BIND { - `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)` - 获取语句的结果集。结果集的使用方式与非参数化调用时一致,使用完成后,应对此结果集调用 `taos_free_result`以释放资源。 + 获取语句的结果集。结果集的使用方式与非参数化调用时一致,使用完成后,应对此结果集调用 `taos_free_result` 以释放资源。 - `int taos_stmt_close(TAOS_STMT *stmt)` diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index f34434e66c697008d73b7870cc533003eed27652..84d87af385506beeee29575002a31c873845d186 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5142,6 +5142,10 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg18 = "primary timestamp column cannot be dropped"; const char* msg19 = "invalid new tag name"; const char* msg20 = "table is not super table"; + const char* msg21 = "only binary/nchar column length could be modified"; + const char* msg22 = "new column length should be bigger than old one"; + const char* msg23 = "only column length coulbe be modified"; + const char* msg24 = "invalid binary/nchar column length"; int32_t code = TSDB_CODE_SUCCESS; @@ -5172,13 +5176,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { } if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN || - pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN) { - if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { + pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { + if (!UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } } else if ((pAlterSQL->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) && (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); - } else if ((pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN) && + } else if ((pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) && UTIL_TABLE_IS_CHILD_TABLE(pTableMetaInfo)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); } @@ -5394,6 +5398,85 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { tstrncpy(name1, pItem->pVar.pz, sizeof(name1)); TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + } else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { + if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg16); + } + + + TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0); + if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); + } + + SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; + SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)}; + if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17); + } + + SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex); + + if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); + } + + if (pItem->type != pColSchema->type) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23); + } + + if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) || + (pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg24); + } + + if (pItem->bytes <= pColSchema->bytes) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); + } + + TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes); + tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + }else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { + if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg16); + } + + TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0); + if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); + } + + SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; + SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)}; + if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17); + } + + SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex); + + if (columnIndex.columnIndex < tscGetNumOfColumns(pTableMetaInfo->pTableMeta)) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10); + } + + if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); + } + + if (pItem->type != pColSchema->type) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23); + } + + if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) || + (pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg24); + } + + if (pItem->bytes <= pColSchema->bytes) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); + } + + TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes); + tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); } return TSDB_CODE_SUCCESS; @@ -5745,11 +5828,17 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p tVariantListItem* p0 = taosArrayGet(pKeep, 0); switch (s) { case 1: { + if ((int32_t)p0->pVar.i64 <= 0) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); + } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); } break; case 2: { tVariantListItem* p1 = taosArrayGet(pKeep, 1); + if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); + } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); break; @@ -5758,6 +5847,10 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p tVariantListItem* p1 = taosArrayGet(pKeep, 1); tVariantListItem* p2 = taosArrayGet(pKeep, 2); + if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); + } + pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64); @@ -7186,8 +7279,9 @@ static int32_t getTableNameFromSqlNode(SSqlNode* pSqlNode, SArray* tableNameList } SName name = {0}; - if (tscSetTableFullName(&name, t, pSql) != TSDB_CODE_SUCCESS) { - return invalidOperationMsg(msgBuf, msg1); + int32_t code = tscSetTableFullName(&name, t, pSql); + if (code != TSDB_CODE_SUCCESS) { + return code; } taosArrayPush(tableNameList, &name); diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 2fc18943da73ed394b61d9e42157f2e6523d2191..9b13cd2140dea3bc416f1a418d69b2ef0e187992 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -110,7 +110,8 @@ static void doLaunchQuery(void* param, TAOS_RES* tres, int32_t code) { // failed to get table Meta or vgroup list, retry in 10sec. if (code == TSDB_CODE_SUCCESS) { tscTansformFuncForSTableQuery(pQueryInfo); - tscDebug("0x%"PRIx64" stream:%p started to query table:%s", pSql->self, pStream, tNameGetTableName(&pTableMetaInfo->name)); + + tscDebug("0x%"PRIx64" stream:%p, start stream query on:%s QueryInfo->skey=%"PRId64" ekey=%"PRId64" ", pSql->self, pStream, tNameGetTableName(&pTableMetaInfo->name), pQueryInfo->window.skey, pQueryInfo->window.ekey); pQueryInfo->command = TSDB_SQL_SELECT; @@ -164,7 +165,11 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) { if (etime > pStream->etime) { etime = pStream->etime; } else if (pStream->interval.intervalUnit != 'y' && pStream->interval.intervalUnit != 'n') { - etime = pStream->stime + (etime - pStream->stime) / pStream->interval.interval * pStream->interval.interval; + if(pStream->stime == INT64_MIN) { + etime = taosTimeTruncate(etime, &pStream->interval, pStream->precision); + } else { + etime = pStream->stime + (etime - pStream->stime) / pStream->interval.interval * pStream->interval.interval; + } } else { etime = taosTimeTruncate(etime, &pStream->interval, pStream->precision); } @@ -353,8 +358,8 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer) tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 "(ts window ekey), in %" PRId64 " ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream, now + timer, timer, delay, pStream->stime, etime); } else { - tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 "(ts window ekey), in %" PRId64 " ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream, - pStream->stime, timer, delay, pStream->stime - pStream->interval.interval, pStream->stime - 1); + tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 " - %" PRId64 " end, in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream, + pStream->stime, pStream->etime, timer, delay, pStream->stime - pStream->interval.interval, pStream->stime - 1); } pSql->cmd.command = TSDB_SQL_SELECT; @@ -663,6 +668,11 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c STscObj *pObj = (STscObj *)taos; if (pObj == NULL || pObj->signature != pObj) return NULL; + if(fp == NULL){ + tscError(" taos_open_stream api fp param must not NULL."); + return NULL; + } + SSqlObj *pSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); if (pSql == NULL) { return NULL; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 8042f032c8a2fad85de23c4f2bbdc5c07670cdc3..b5dfc956ddd31a141c009bbf8200299cd82c607f 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1119,6 +1119,8 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue SOperatorInfo* pSourceOperator = createDummyInputOperator(pSqlObjList[0], pSchema, numOfCol1, pFilterInfo, numOfFilterCols); + pOutput->precision = pSqlObjList[0]->res.precision; + SSchema* schema = NULL; if (px->numOfTables > 1) { SOperatorInfo** p = calloc(px->numOfTables, POINTER_BYTES); @@ -4477,4 +4479,4 @@ SNewVgroupInfo createNewVgroupInfo(SVgroupMsg *pVgroupMsg) { } return info; -} \ No newline at end of file +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java index 52858e7f88c9375ea6ff0282fbe0519b9953a121..277ca447f5efcead8cf3b1d6a3d32017aac3036d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java @@ -243,15 +243,15 @@ public class TSDBPreparedStatementTest { s.setNString(1, s2, 4); random = 10 + r.nextInt(5); - ArrayList s5 = new ArrayList(); + ArrayList s3 = new ArrayList(); for(int i = 0; i < numOfRows; i++) { if(i % random == 0) { - s5.add(null); + s3.add(null); }else{ - s5.add("test" + i % 10); + s3.add("test" + i % 10); } } - s.setString(2, s5, 10); + s.setString(2, s3, 10); s.columnDataAddBatch(); s.columnDataExecuteBatch(); @@ -268,7 +268,126 @@ public class TSDBPreparedStatementTest { } } + @Test + public void bindDataWithSingleTagTest() throws SQLException { + Statement stmt = conn.createStatement(); + + String types[] = new String[] {"tinyint", "smallint", "int", "bigint", "bool", "float", "double", "binary(10)", "nchar(10)"}; + + for (String type : types) { + stmt.execute("drop table if exists weather_test"); + stmt.execute("create table weather_test(ts timestamp, f1 nchar(10), f2 binary(10)) tags (t " + type + ")"); + + int numOfRows = 1; + + TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags(?) values(?, ?, ?)"); + Random r = new Random(); + s.setTableName("w1"); + + switch(type) { + case "tinyint": + case "smallint": + case "int": + case "bigint": + s.setTagInt(0, 1); + break; + case "float": + s.setTagFloat(0, 1.23f); + break; + case "double": + s.setTagDouble(0, 3.14159265); + break; + case "bool": + s.setTagBoolean(0, true); + break; + case "binary(10)": + s.setTagString(0, "test"); + break; + case "nchar(10)": + s.setTagNString(0, "test"); + break; + default: + break; + } + + + ArrayList ts = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + ts.add(System.currentTimeMillis() + i); + } + s.setTimestamp(0, ts); + + int random = 10 + r.nextInt(5); + ArrayList s2 = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + s2.add("分支" + i % 4); + } + s.setNString(1, s2, 10); + + random = 10 + r.nextInt(5); + ArrayList s3 = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + s3.add("test" + i % 4); + } + s.setString(2, s3, 10); + + s.columnDataAddBatch(); + s.columnDataExecuteBatch(); + s.columnDataCloseBatch(); + + String sql = "select * from weather_test"; + PreparedStatement statement = conn.prepareStatement(sql); + ResultSet rs = statement.executeQuery(); + int rows = 0; + while(rs.next()) { + rows++; + } + Assert.assertEquals(numOfRows, rows); + } + } + + @Test + public void bindDataWithMultipleTagsTest() throws SQLException { + Statement stmt = conn.createStatement(); + + stmt.execute("drop table if exists weather_test"); + stmt.execute("create table weather_test(ts timestamp, f1 nchar(10), f2 binary(10)) tags (t1 int, t2 binary(10))"); + + int numOfRows = 1; + + TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags(?,?) (ts, f2) values(?, ?)"); + s.setTableName("w2"); + s.setTagInt(0, 1); + s.setTagString(1, "test"); + + + ArrayList ts = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + ts.add(System.currentTimeMillis() + i); + } + s.setTimestamp(0, ts); + + ArrayList s2 = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + s2.add("test" + i % 4); + } + s.setString(1, s2, 10); + + s.columnDataAddBatch(); + s.columnDataExecuteBatch(); + s.columnDataCloseBatch(); + + String sql = "select * from weather_test"; + PreparedStatement statement = conn.prepareStatement(sql); + ResultSet rs = statement.executeQuery(); + int rows = 0; + while(rs.next()) { + rows++; + } + Assert.assertEquals(numOfRows, rows); + + } @Test public void setBoolean() throws SQLException { diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 64da11f3123b5eafd1de2ae9253fe5fc3090ad80..cf633502c14ddc3f85f8e8f36059c5e835d402c0 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -88,13 +88,24 @@ static SStep tsDnodeSteps[] = { static SStep tsDnodeCompactSteps[] = { {"dnode-tfile", tfInit, tfCleanup}, + {"dnode-globalcfg", taosCheckGlobalCfg, NULL}, {"dnode-storage", dnodeInitStorage, dnodeCleanupStorage}, + {"dnode-cfg", dnodeInitCfg, dnodeCleanupCfg}, {"dnode-eps", dnodeInitEps, dnodeCleanupEps}, + {"dnode-minfos", dnodeInitMInfos, dnodeCleanupMInfos}, {"dnode-wal", walInit, walCleanUp}, + {"dnode-sync", syncInit, syncCleanUp}, + {"dnode-vread", dnodeInitVRead, dnodeCleanupVRead}, + {"dnode-vwrite", dnodeInitVWrite, dnodeCleanupVWrite}, + {"dnode-vmgmt", dnodeInitVMgmt, dnodeCleanupVMgmt}, {"dnode-mread", dnodeInitMRead, NULL}, {"dnode-mwrite", dnodeInitMWrite, NULL}, {"dnode-mpeer", dnodeInitMPeer, NULL}, + {"dnode-vnodes", dnodeInitVnodes, dnodeCleanupVnodes}, {"dnode-modules", dnodeInitModules, dnodeCleanupModules}, + {"dnode-mread", NULL, dnodeCleanupMRead}, + {"dnode-mwrite", NULL, dnodeCleanupMWrite}, + {"dnode-mpeer", NULL, dnodeCleanupMPeer}, }; static int dnodeCreateDir(const char *dir) { diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 0d8f555670f642ee580d02a435462c689287230e..15b1da1dd31ea7df4a7772515e1dc8812aaddadb 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -161,6 +161,7 @@ enum _mgmt_table { #define TSDB_ALTER_TABLE_ADD_COLUMN 5 #define TSDB_ALTER_TABLE_DROP_COLUMN 6 #define TSDB_ALTER_TABLE_CHANGE_COLUMN 7 +#define TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN 8 #define TSDB_FILL_NONE 0 #define TSDB_FILL_NULL 1 diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index e9585636fd97bd4bcb856317689aed615d275026..c7d630891b59e88af1360af67542dbe5ca601418 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -156,54 +156,62 @@ #define TK_SYNCDB 137 #define TK_ADD 138 #define TK_COLUMN 139 -#define TK_TAG 140 -#define TK_CHANGE 141 -#define TK_SET 142 -#define TK_KILL 143 -#define TK_CONNECTION 144 -#define TK_STREAM 145 -#define TK_COLON 146 -#define TK_ABORT 147 -#define TK_AFTER 148 -#define TK_ATTACH 149 -#define TK_BEFORE 150 -#define TK_BEGIN 151 -#define TK_CASCADE 152 -#define TK_CLUSTER 153 -#define TK_CONFLICT 154 -#define TK_COPY 155 -#define TK_DEFERRED 156 -#define TK_DELIMITERS 157 -#define TK_DETACH 158 -#define TK_EACH 159 -#define TK_END 160 -#define TK_EXPLAIN 161 -#define TK_FAIL 162 -#define TK_FOR 163 -#define TK_IGNORE 164 -#define TK_IMMEDIATE 165 -#define TK_INITIALLY 166 -#define TK_INSTEAD 167 -#define TK_MATCH 168 -#define TK_KEY 169 -#define TK_OF 170 -#define TK_RAISE 171 -#define TK_REPLACE 172 -#define TK_RESTRICT 173 -#define TK_ROW 174 -#define TK_STATEMENT 175 -#define TK_TRIGGER 176 -#define TK_VIEW 177 -#define TK_SEMI 178 -#define TK_NONE 179 -#define TK_PREV 180 -#define TK_LINEAR 181 -#define TK_IMPORT 182 -#define TK_TBNAME 183 -#define TK_JOIN 184 -#define TK_INSERT 185 -#define TK_INTO 186 -#define TK_VALUES 187 +#define TK_MODIFY 140 +#define TK_TAG 141 +#define TK_CHANGE 142 +#define TK_SET 143 +#define TK_KILL 144 +#define TK_CONNECTION 145 +#define TK_STREAM 146 +#define TK_COLON 147 +#define TK_ABORT 148 +#define TK_AFTER 149 +#define TK_ATTACH 150 +#define TK_BEFORE 151 +#define TK_BEGIN 152 +#define TK_CASCADE 153 +#define TK_CLUSTER 154 +#define TK_CONFLICT 155 +#define TK_COPY 156 +#define TK_DEFERRED 157 +#define TK_DELIMITERS 158 +#define TK_DETACH 159 +#define TK_EACH 160 +#define TK_END 161 +#define TK_EXPLAIN 162 +#define TK_FAIL 163 +#define TK_FOR 164 +#define TK_IGNORE 165 +#define TK_IMMEDIATE 166 +#define TK_INITIALLY 167 +#define TK_INSTEAD 168 +#define TK_MATCH 169 +#define TK_KEY 170 +#define TK_OF 171 +#define TK_RAISE 172 +#define TK_REPLACE 173 +#define TK_RESTRICT 174 +#define TK_ROW 175 +#define TK_STATEMENT 176 +#define TK_TRIGGER 177 +#define TK_VIEW 178 +#define TK_SEMI 179 +#define TK_NONE 180 +#define TK_PREV 181 +#define TK_LINEAR 182 +#define TK_IMPORT 183 +#define TK_TBNAME 184 +#define TK_JOIN 185 +#define TK_INSERT 186 +#define TK_INTO 187 +#define TK_VALUES 188 + + + + + + + #define TK_SPACE 300 #define TK_COMMENT 301 diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 7702978af19f192ec9ec1ee4a7cda6df24db1f20..76144b53f9ffa0cb5f1ac48c8fc19a52808275af 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -799,7 +799,7 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; - pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE; + pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema[cols].name, "end_point"); pSchema[cols].bytes = htons(pShow->bytes[cols]); diff --git a/src/mnode/src/mnodeMnode.c b/src/mnode/src/mnodeMnode.c index ddc9ea59c41a793707ba76c06f6a89abcf60a5ca..bccad221574d49f770bebb61822609c2138f258e 100644 --- a/src/mnode/src/mnodeMnode.c +++ b/src/mnode/src/mnodeMnode.c @@ -485,7 +485,7 @@ static int32_t mnodeGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; - pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE; + pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema[cols].name, "end_point"); pSchema[cols].bytes = htons(pShow->bytes[cols]); diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index e9acd5b9bc69f0354f28009254c57c004fbb7995..a8bcdfa59e6c5c4d75f8478989600aa6d7677baf 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -1176,9 +1176,10 @@ int32_t mnodeCompactWal() { return -1; } - // close wal - walFsync(tsSdbMgmt.wal, true); - walClose(tsSdbMgmt.wal); + // close sdb and sync to disk + //walFsync(tsSdbMgmt.wal, true); + //walClose(tsSdbMgmt.wal); + sdbCleanUp(); // rename old wal to wal_bak if (taosRename(tsMnodeDir, tsMnodeBakDir) != 0) { diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 5710601e5c057282637bd6c67ac5d7b1e41d7341..be53d353c9cd5b16b91b4d33650d340f25c939af 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -93,6 +93,9 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg); static void mnodeProcessAlterTableRsp(SRpcMsg *rpcMsg); static int32_t mnodeFindSuperTableColumnIndex(SSTableObj *pStable, char *colName); +static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg); +static int32_t mnodeChangeSuperTableTag(SMnodeMsg *pMsg); +static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg); static void mnodeDestroyChildTable(SCTableObj *pTable) { tfree(pTable->info.tableId); @@ -1457,31 +1460,52 @@ static int32_t mnodeChangeSuperTableColumnCb(SMnodeMsg *pMsg, int32_t code) { return code; } -static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg, char *oldName, char *newName) { +static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg) { + SAlterTableMsg *pAlter = pMsg->rpcMsg.pCont; + char* name = pAlter->schema[0].name; SSTableObj *pStable = (SSTableObj *)pMsg->pTable; - int32_t col = mnodeFindSuperTableColumnIndex(pStable, oldName); + int32_t col = mnodeFindSuperTableColumnIndex(pStable, name); if (col < 0) { - mError("msg:%p, app:%p stable:%s, change column, oldName:%s, newName:%s", pMsg, pMsg->rpcMsg.ahandle, - pStable->info.tableId, oldName, newName); + mError("msg:%p, app:%p stable:%s, change column, name:%s", pMsg, pMsg->rpcMsg.ahandle, + pStable->info.tableId, name); return TSDB_CODE_MND_FIELD_NOT_EXIST; } - // int32_t rowSize = 0; - uint32_t len = (uint32_t)strlen(newName); - if (len >= TSDB_COL_NAME_LEN) { - return TSDB_CODE_MND_COL_NAME_TOO_LONG; - } + // update + SSchema *schema = (SSchema *) (pStable->schema + col); + ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR); + schema->bytes = pAlter->schema[0].bytes; + mInfo("msg:%p, app:%p stable %s, start to modify column %s len to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId, + name, schema->bytes); - if (mnodeFindSuperTableColumnIndex(pStable, newName) >= 0) { - return TSDB_CODE_MND_FIELD_ALREAY_EXIST; + SSdbRow row = { + .type = SDB_OPER_GLOBAL, + .pTable = tsSuperTableSdb, + .pObj = pStable, + .pMsg = pMsg, + .fpRsp = mnodeChangeSuperTableColumnCb + }; + + return sdbUpdateRow(&row); +} + +static int32_t mnodeChangeSuperTableTag(SMnodeMsg *pMsg) { + SAlterTableMsg *pAlter = pMsg->rpcMsg.pCont; + char* name = pAlter->schema[0].name; + SSTableObj *pStable = (SSTableObj *)pMsg->pTable; + int32_t col = mnodeFindSuperTableTagIndex(pStable, name); + if (col < 0) { + mError("msg:%p, app:%p stable:%s, change column, name:%s", pMsg, pMsg->rpcMsg.ahandle, + pStable->info.tableId, name); + return TSDB_CODE_MND_FIELD_NOT_EXIST; } // update SSchema *schema = (SSchema *) (pStable->schema + col); - tstrncpy(schema->name, newName, sizeof(schema->name)); - - mInfo("msg:%p, app:%p stable %s, start to modify column %s to %s", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId, - oldName, newName); + ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR); + schema->bytes = pAlter->schema[0].bytes; + mInfo("msg:%p, app:%p stable %s, start to modify tag len %s to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId, + name, schema->bytes); SSdbRow row = { .type = SDB_OPER_GLOBAL, @@ -2355,31 +2379,23 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) { return sdbUpdateRow(&row); } -static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg, char *oldName, char *newName) { +static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg) { + SAlterTableMsg *pAlter = pMsg->rpcMsg.pCont; + char* name = pAlter->schema[0].name; SCTableObj *pTable = (SCTableObj *)pMsg->pTable; - int32_t col = mnodeFindNormalTableColumnIndex(pTable, oldName); + int32_t col = mnodeFindNormalTableColumnIndex(pTable, name); if (col < 0) { - mError("msg:%p, app:%p ctable:%s, change column, oldName: %s, newName: %s", pMsg, pMsg->rpcMsg.ahandle, - pTable->info.tableId, oldName, newName); + mError("msg:%p, app:%p ctable:%s, change column, name: %s", pMsg, pMsg->rpcMsg.ahandle, + pTable->info.tableId, name); return TSDB_CODE_MND_FIELD_NOT_EXIST; } - // int32_t rowSize = 0; - uint32_t len = (uint32_t)strlen(newName); - if (len >= TSDB_COL_NAME_LEN) { - return TSDB_CODE_MND_COL_NAME_TOO_LONG; - } - - if (mnodeFindNormalTableColumnIndex(pTable, newName) >= 0) { - return TSDB_CODE_MND_FIELD_ALREAY_EXIST; - } - - // update SSchema *schema = (SSchema *) (pTable->schema + col); - tstrncpy(schema->name, newName, sizeof(schema->name)); + ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR); + schema->bytes = pAlter->schema[0].bytes; - mInfo("msg:%p, app:%p ctable %s, start to modify column %s to %s", pMsg, pMsg->rpcMsg.ahandle, pTable->info.tableId, - oldName, newName); + mInfo("msg:%p, app:%p ctable %s, start to modify column %s len to %d", pMsg, pMsg->rpcMsg.ahandle, pTable->info.tableId, + name, schema->bytes); SSdbRow row = { .type = SDB_OPER_GLOBAL, @@ -3214,7 +3230,9 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { code = mnodeDropSuperTableColumn(pMsg, pAlter->schema[0].name); } else if (pAlter->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { - code = mnodeChangeSuperTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); + code = mnodeChangeSuperTableColumn(pMsg); + } else if (pAlter->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { + code = mnodeChangeSuperTableTag(pMsg); } else { } } else { @@ -3226,7 +3244,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { code = mnodeDropNormalTableColumn(pMsg, pAlter->schema[0].name); } else if (pAlter->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { - code = mnodeChangeNormalTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); + code = mnodeChangeNormalTableColumn(pMsg); } else { } } @@ -3417,4 +3435,4 @@ int32_t mnodeCompactTables() { mnodeCompactChildTables(); return 0; -} \ No newline at end of file +} diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index ba16eef763adc48b0492aedbaa825b23c3a74e0a..01eaf3bbb6e7996a9eabc8fee0c81bdc6f4c231e 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -759,6 +759,12 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). { + X.n += F.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + //////////////////////////////////ALTER TAGS statement///////////////////////////////////// cmd ::= ALTER TABLE ids(X) cpxName(Y) ADD TAG columnlist(A). { X.n += Y.n; @@ -799,6 +805,11 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). { + X.n += F.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} ///////////////////////////////////ALTER STABLE statement////////////////////////////////// cmd ::= ALTER STABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). { @@ -817,6 +828,12 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). { + X.n += F.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + //////////////////////////////////ALTER TAGS statement///////////////////////////////////// cmd ::= ALTER STABLE ids(X) cpxName(Y) ADD TAG columnlist(A). { X.n += Y.n; @@ -846,6 +863,23 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { + X.n += F.n; + + toTSDBType(Y.type); + SArray* A = tVariantListAppendToken(NULL, &Y, -1); + A = tVariantListAppend(A, &Z, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + +cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). { + X.n += F.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + ////////////////////////////////////////kill statement/////////////////////////////////////// cmd ::= KILL CONNECTION INTEGER(Y). {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &Y);} cmd ::= KILL STREAM INTEGER(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &X);} diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 25e7e446bd1f1114bae12fd05678474d40a32a5e..b7512ac1f04e1cbc45100afd2bf1e84bb8e26dff 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1347,7 +1347,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf pInfo->start = j; } else if (tsList[j] - pInfo->prevTs <= gap) { pInfo->curWindow.ekey = tsList[j]; - //pInfo->prevTs = tsList[j]; + pInfo->prevTs = tsList[j]; pInfo->numOfRows += 1; if (j == 0 && pInfo->start != 0) { pInfo->numOfRows = 1; diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index efe35ba72b51a4bbc7c2b838eced738de3eedd6f..2cf3463d6009f47802e89f0651257d6f6f803376 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -893,7 +893,7 @@ SAlterTableInfo *tSetAlterTableInfo(SStrToken *pTableName, SArray *pCols, SArray pAlterTable->type = type; pAlterTable->tableType = tableType; - if (type == TSDB_ALTER_TABLE_ADD_COLUMN || type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) { + if (type == TSDB_ALTER_TABLE_ADD_COLUMN || type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || type == TSDB_ALTER_TABLE_CHANGE_COLUMN || type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { pAlterTable->pAddColumns = pCols; assert(pVals == NULL); } else { diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 55a6833cc1238a2a17f2c621c292b9b1b1322b29..0d11153e8e0ca70e2a58be3ae5724dd4facaf241 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -23,6 +23,7 @@ ** input grammar file: */ #include +#include /************ Begin %include sections from the grammar ************************/ #include @@ -76,8 +77,10 @@ ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser +** ParseCTX_* As ParseARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -97,7 +100,7 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 267 +#define YYNOCODE 266 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { @@ -125,21 +128,29 @@ typedef union { #endif #define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_PDECL ,SSqlInfo* pInfo -#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo -#define ParseARG_STORE yypParser->pInfo = pInfo +#define ParseARG_PARAM ,pInfo +#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; +#define ParseARG_STORE yypParser->pInfo=pInfo; +#define ParseCTX_SDECL +#define ParseCTX_PDECL +#define ParseCTX_PARAM +#define ParseCTX_FETCH +#define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 327 -#define YYNRULE 275 -#define YYNTOKEN 188 -#define YY_MAX_SHIFT 326 -#define YY_MIN_SHIFTREDUCE 523 -#define YY_MAX_SHIFTREDUCE 797 -#define YY_ERROR_ACTION 798 -#define YY_ACCEPT_ACTION 799 -#define YY_NO_ACTION 800 -#define YY_MIN_REDUCE 801 -#define YY_MAX_REDUCE 1075 +#define YYNSTATE 341 +#define YYNRULE 280 +#define YYNRULE_WITH_ACTION 280 +#define YYNTOKEN 189 +#define YY_MAX_SHIFT 340 +#define YY_MIN_SHIFTREDUCE 538 +#define YY_MAX_SHIFTREDUCE 817 +#define YY_ERROR_ACTION 818 +#define YY_ACCEPT_ACTION 819 +#define YY_NO_ACTION 820 +#define YY_MIN_REDUCE 821 +#define YY_MAX_REDUCE 1100 /************* End control #defines *******************************************/ +#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -204,78 +215,81 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (700) +#define YY_ACTTAB_COUNT (722) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 969, 571, 211, 324, 934, 18, 217, 186, 188, 572, - /* 10 */ 799, 326, 192, 48, 49, 145, 52, 53, 220, 1057, - /* 20 */ 223, 42, 275, 51, 274, 56, 54, 58, 55, 1053, - /* 30 */ 650, 188, 948, 47, 46, 188, 228, 45, 44, 43, - /* 40 */ 48, 49, 1056, 52, 53, 219, 1057, 223, 42, 571, - /* 50 */ 51, 274, 56, 54, 58, 55, 960, 572, 300, 299, - /* 60 */ 47, 46, 948, 966, 45, 44, 43, 49, 31, 52, - /* 70 */ 53, 138, 250, 223, 42, 1067, 51, 274, 56, 54, - /* 80 */ 58, 55, 271, 290, 82, 1052, 47, 46, 89, 234, - /* 90 */ 45, 44, 43, 524, 525, 526, 527, 528, 529, 530, - /* 100 */ 531, 532, 533, 534, 535, 536, 325, 571, 290, 212, - /* 110 */ 71, 571, 944, 48, 49, 572, 52, 53, 760, 572, - /* 120 */ 223, 42, 936, 51, 274, 56, 54, 58, 55, 45, - /* 130 */ 44, 43, 741, 47, 46, 257, 256, 45, 44, 43, - /* 140 */ 48, 50, 145, 52, 53, 1, 160, 223, 42, 145, - /* 150 */ 51, 274, 56, 54, 58, 55, 323, 322, 130, 236, - /* 160 */ 47, 46, 297, 296, 45, 44, 43, 24, 288, 319, - /* 170 */ 318, 287, 286, 285, 317, 284, 316, 315, 314, 283, - /* 180 */ 313, 312, 908, 31, 896, 897, 898, 899, 900, 901, - /* 190 */ 902, 903, 904, 905, 906, 907, 909, 910, 52, 53, - /* 200 */ 847, 960, 223, 42, 172, 51, 274, 56, 54, 58, - /* 210 */ 55, 1005, 19, 86, 25, 47, 46, 214, 83, 45, - /* 220 */ 44, 43, 222, 756, 213, 310, 745, 945, 748, 197, - /* 230 */ 751, 222, 756, 230, 13, 745, 198, 748, 88, 751, - /* 240 */ 85, 122, 121, 196, 931, 932, 30, 935, 56, 54, - /* 250 */ 58, 55, 3, 173, 207, 208, 47, 46, 273, 948, - /* 260 */ 45, 44, 43, 207, 208, 242, 232, 747, 24, 750, - /* 270 */ 319, 318, 77, 246, 245, 317, 689, 316, 315, 314, - /* 280 */ 37, 313, 312, 62, 916, 47, 46, 914, 915, 45, - /* 290 */ 44, 43, 917, 942, 919, 920, 918, 145, 921, 922, - /* 300 */ 107, 101, 112, 249, 31, 69, 63, 111, 117, 120, - /* 310 */ 110, 204, 674, 109, 235, 671, 114, 672, 310, 673, - /* 320 */ 5, 34, 162, 1051, 70, 57, 31, 161, 96, 91, - /* 330 */ 95, 31, 757, 31, 57, 229, 233, 31, 753, 292, - /* 340 */ 746, 757, 749, 237, 238, 226, 31, 753, 945, 946, - /* 350 */ 180, 178, 176, 205, 693, 752, 933, 175, 125, 124, - /* 360 */ 123, 136, 134, 133, 752, 77, 1006, 227, 269, 320, - /* 370 */ 945, 84, 293, 37, 294, 945, 856, 945, 298, 754, - /* 380 */ 172, 945, 848, 960, 686, 72, 172, 302, 722, 723, - /* 390 */ 945, 8, 251, 743, 74, 948, 32, 75, 221, 215, - /* 400 */ 705, 206, 253, 713, 140, 253, 714, 61, 777, 758, - /* 410 */ 21, 65, 20, 20, 660, 678, 277, 679, 32, 662, - /* 420 */ 32, 675, 279, 61, 661, 190, 87, 29, 61, 744, - /* 430 */ 280, 191, 66, 100, 99, 15, 14, 119, 118, 106, - /* 440 */ 105, 68, 6, 649, 17, 16, 676, 193, 677, 187, - /* 450 */ 194, 195, 755, 201, 202, 200, 185, 199, 189, 947, - /* 460 */ 1016, 1015, 224, 1012, 1011, 247, 137, 40, 225, 301, - /* 470 */ 968, 979, 976, 977, 981, 139, 143, 961, 254, 998, - /* 480 */ 997, 943, 263, 156, 135, 157, 704, 258, 311, 941, - /* 490 */ 912, 306, 108, 303, 155, 150, 148, 958, 158, 159, - /* 500 */ 859, 67, 146, 216, 282, 38, 260, 183, 35, 267, - /* 510 */ 291, 64, 855, 1072, 97, 59, 1071, 1069, 163, 295, - /* 520 */ 1066, 103, 1065, 1063, 164, 877, 36, 272, 33, 270, - /* 530 */ 268, 39, 184, 844, 113, 842, 115, 116, 840, 839, - /* 540 */ 239, 174, 837, 836, 835, 834, 833, 832, 177, 179, - /* 550 */ 829, 827, 825, 266, 823, 181, 820, 182, 264, 252, - /* 560 */ 73, 78, 262, 261, 999, 259, 41, 304, 305, 307, - /* 570 */ 209, 231, 308, 309, 281, 321, 797, 240, 241, 210, - /* 580 */ 796, 92, 93, 203, 244, 243, 795, 783, 782, 838, - /* 590 */ 248, 253, 681, 276, 126, 171, 166, 878, 167, 165, - /* 600 */ 168, 169, 831, 170, 9, 127, 128, 830, 76, 129, - /* 610 */ 822, 821, 2, 26, 4, 255, 79, 706, 153, 151, - /* 620 */ 149, 147, 152, 154, 141, 924, 709, 142, 80, 218, - /* 630 */ 711, 81, 265, 761, 715, 144, 90, 10, 11, 27, - /* 640 */ 759, 28, 7, 12, 22, 88, 23, 613, 278, 609, - /* 650 */ 607, 606, 605, 602, 575, 289, 94, 32, 60, 98, - /* 660 */ 652, 651, 648, 102, 597, 595, 104, 587, 593, 589, - /* 670 */ 591, 585, 583, 616, 615, 614, 612, 611, 610, 608, - /* 680 */ 604, 603, 573, 540, 538, 61, 801, 800, 800, 800, - /* 690 */ 800, 800, 800, 800, 800, 800, 800, 800, 131, 132, + /* 0 */ 989, 586, 217, 338, 954, 22, 223, 192, 194, 587, + /* 10 */ 819, 340, 198, 52, 53, 151, 56, 57, 226, 1077, + /* 20 */ 229, 46, 283, 55, 282, 60, 58, 62, 59, 1073, + /* 30 */ 665, 194, 968, 51, 50, 194, 234, 49, 48, 47, + /* 40 */ 52, 53, 1076, 56, 57, 225, 1077, 229, 46, 586, + /* 50 */ 55, 282, 60, 58, 62, 59, 980, 587, 314, 313, + /* 60 */ 51, 50, 968, 986, 49, 48, 47, 53, 35, 56, + /* 70 */ 57, 144, 258, 229, 46, 75, 55, 282, 60, 58, + /* 80 */ 62, 59, 279, 298, 87, 867, 51, 50, 94, 178, + /* 90 */ 49, 48, 47, 539, 540, 541, 542, 543, 544, 545, + /* 100 */ 546, 547, 548, 549, 550, 551, 339, 953, 298, 218, + /* 110 */ 76, 586, 964, 52, 53, 35, 56, 57, 775, 587, + /* 120 */ 229, 46, 956, 55, 282, 60, 58, 62, 59, 49, + /* 130 */ 48, 47, 756, 51, 50, 265, 264, 49, 48, 47, + /* 140 */ 52, 54, 980, 56, 57, 324, 980, 229, 46, 586, + /* 150 */ 55, 282, 60, 58, 62, 59, 219, 587, 220, 965, + /* 160 */ 51, 50, 221, 1072, 49, 48, 47, 28, 296, 333, + /* 170 */ 332, 295, 294, 293, 331, 292, 330, 329, 328, 291, + /* 180 */ 327, 326, 928, 35, 916, 917, 918, 919, 920, 921, + /* 190 */ 922, 923, 924, 925, 926, 927, 929, 930, 56, 57, + /* 200 */ 876, 1071, 229, 46, 178, 55, 282, 60, 58, 62, + /* 210 */ 59, 962, 23, 91, 29, 51, 50, 1, 166, 49, + /* 220 */ 48, 47, 228, 771, 232, 79, 760, 965, 763, 203, + /* 230 */ 766, 228, 771, 261, 13, 760, 204, 763, 93, 766, + /* 240 */ 90, 128, 127, 202, 951, 952, 34, 955, 60, 58, + /* 250 */ 62, 59, 89, 235, 214, 215, 51, 50, 281, 151, + /* 260 */ 49, 48, 47, 214, 215, 762, 77, 765, 28, 1096, + /* 270 */ 333, 332, 82, 35, 35, 331, 701, 330, 329, 328, + /* 280 */ 41, 327, 326, 8, 936, 51, 50, 934, 935, 49, + /* 290 */ 48, 47, 937, 868, 939, 940, 938, 178, 941, 942, + /* 300 */ 113, 107, 118, 257, 239, 74, 704, 117, 123, 126, + /* 310 */ 116, 242, 211, 35, 233, 303, 120, 965, 965, 689, + /* 320 */ 212, 761, 686, 764, 687, 61, 688, 213, 1026, 35, + /* 330 */ 277, 35, 772, 1036, 61, 5, 38, 168, 768, 151, + /* 340 */ 196, 772, 167, 101, 96, 100, 35, 768, 35, 151, + /* 350 */ 245, 246, 35, 35, 304, 767, 236, 965, 186, 184, + /* 360 */ 182, 142, 140, 139, 767, 181, 131, 130, 129, 334, + /* 370 */ 305, 243, 306, 965, 240, 965, 238, 769, 302, 301, + /* 380 */ 82, 244, 968, 241, 708, 309, 308, 310, 41, 311, + /* 390 */ 965, 250, 965, 312, 316, 968, 965, 965, 3, 179, + /* 400 */ 254, 253, 337, 336, 136, 115, 966, 80, 1025, 259, + /* 410 */ 324, 737, 738, 36, 758, 261, 720, 728, 88, 729, + /* 420 */ 146, 66, 227, 25, 67, 792, 197, 773, 690, 24, + /* 430 */ 675, 24, 70, 770, 36, 285, 677, 287, 676, 36, + /* 440 */ 66, 92, 66, 33, 125, 124, 288, 68, 199, 15, + /* 450 */ 759, 14, 106, 71, 105, 193, 200, 17, 19, 16, + /* 460 */ 18, 201, 73, 112, 664, 111, 6, 207, 693, 691, + /* 470 */ 694, 692, 208, 206, 21, 1035, 20, 1088, 191, 205, + /* 480 */ 195, 967, 230, 255, 1032, 1031, 231, 315, 44, 143, + /* 490 */ 988, 1018, 999, 996, 1017, 997, 981, 262, 1001, 145, + /* 500 */ 149, 271, 162, 963, 141, 114, 266, 222, 719, 268, + /* 510 */ 158, 275, 154, 163, 978, 152, 155, 276, 961, 164, + /* 520 */ 165, 280, 153, 72, 156, 63, 879, 69, 290, 278, + /* 530 */ 42, 274, 189, 39, 299, 875, 300, 1095, 103, 1094, + /* 540 */ 1091, 169, 307, 1087, 109, 1086, 1083, 170, 897, 40, + /* 550 */ 272, 37, 43, 190, 270, 864, 119, 862, 121, 122, + /* 560 */ 267, 860, 859, 247, 180, 857, 856, 855, 854, 853, + /* 570 */ 852, 183, 185, 849, 847, 845, 843, 187, 840, 188, + /* 580 */ 45, 260, 78, 83, 325, 269, 1019, 317, 318, 319, + /* 590 */ 320, 321, 322, 323, 335, 817, 248, 216, 237, 289, + /* 600 */ 249, 816, 251, 252, 209, 210, 97, 98, 815, 798, + /* 610 */ 797, 256, 261, 263, 858, 696, 284, 9, 132, 851, + /* 620 */ 173, 133, 172, 898, 171, 174, 175, 177, 176, 4, + /* 630 */ 134, 850, 842, 932, 135, 30, 841, 81, 84, 721, + /* 640 */ 2, 161, 159, 157, 160, 147, 944, 724, 148, 85, + /* 650 */ 224, 726, 86, 273, 10, 730, 150, 11, 776, 774, + /* 660 */ 31, 7, 32, 12, 26, 286, 27, 95, 628, 93, + /* 670 */ 624, 622, 621, 620, 617, 297, 99, 590, 64, 36, + /* 680 */ 65, 102, 667, 666, 104, 108, 663, 612, 610, 602, + /* 690 */ 608, 604, 606, 600, 598, 631, 110, 630, 629, 627, + /* 700 */ 626, 625, 623, 619, 618, 588, 555, 553, 66, 821, + /* 710 */ 820, 820, 137, 820, 820, 820, 820, 820, 820, 820, + /* 720 */ 820, 138, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 192, 1, 191, 192, 0, 254, 211, 254, 254, 9, @@ -285,72 +299,72 @@ static const YYCODETYPE yy_lookahead[] = { /* 40 */ 13, 14, 265, 16, 17, 264, 265, 20, 21, 1, /* 50 */ 23, 24, 25, 26, 27, 28, 235, 9, 33, 34, /* 60 */ 33, 34, 237, 255, 37, 38, 39, 14, 192, 16, - /* 70 */ 17, 192, 251, 20, 21, 237, 23, 24, 25, 26, - /* 80 */ 27, 28, 259, 79, 261, 254, 33, 34, 198, 68, + /* 70 */ 17, 192, 251, 20, 21, 198, 23, 24, 25, 26, + /* 80 */ 27, 28, 259, 79, 261, 197, 33, 34, 198, 201, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, - /* 100 */ 52, 53, 54, 55, 56, 57, 58, 1, 79, 61, - /* 110 */ 110, 1, 236, 13, 14, 9, 16, 17, 111, 9, + /* 100 */ 52, 53, 54, 55, 56, 57, 58, 230, 79, 61, + /* 110 */ 110, 1, 236, 13, 14, 192, 16, 17, 111, 9, /* 120 */ 20, 21, 232, 23, 24, 25, 26, 27, 28, 37, /* 130 */ 38, 39, 105, 33, 34, 256, 257, 37, 38, 39, - /* 140 */ 13, 14, 192, 16, 17, 199, 200, 20, 21, 192, - /* 150 */ 23, 24, 25, 26, 27, 28, 65, 66, 67, 138, - /* 160 */ 33, 34, 141, 142, 37, 38, 39, 88, 89, 90, + /* 140 */ 13, 14, 235, 16, 17, 81, 235, 20, 21, 1, + /* 150 */ 23, 24, 25, 26, 27, 28, 233, 9, 251, 236, + /* 160 */ 33, 34, 251, 254, 37, 38, 39, 88, 89, 90, /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 180 */ 101, 102, 210, 192, 212, 213, 214, 215, 216, 217, /* 190 */ 218, 219, 220, 221, 222, 223, 224, 225, 16, 17, - /* 200 */ 197, 235, 20, 21, 201, 23, 24, 25, 26, 27, - /* 210 */ 28, 261, 44, 198, 104, 33, 34, 251, 261, 37, - /* 220 */ 38, 39, 1, 2, 233, 81, 5, 236, 7, 61, - /* 230 */ 9, 1, 2, 211, 104, 5, 68, 7, 108, 9, + /* 200 */ 197, 254, 20, 21, 201, 23, 24, 25, 26, 27, + /* 210 */ 28, 192, 44, 198, 104, 33, 34, 199, 200, 37, + /* 220 */ 38, 39, 1, 2, 233, 105, 5, 236, 7, 61, + /* 230 */ 9, 1, 2, 113, 104, 5, 68, 7, 108, 9, /* 240 */ 110, 73, 74, 75, 229, 230, 231, 232, 25, 26, - /* 250 */ 27, 28, 195, 196, 33, 34, 33, 34, 37, 237, - /* 260 */ 37, 38, 39, 33, 34, 136, 68, 5, 88, 7, - /* 270 */ 90, 91, 104, 144, 145, 95, 37, 97, 98, 99, - /* 280 */ 112, 101, 102, 109, 210, 33, 34, 213, 214, 37, - /* 290 */ 38, 39, 218, 192, 220, 221, 222, 192, 224, 225, - /* 300 */ 62, 63, 64, 135, 192, 137, 132, 69, 70, 71, - /* 310 */ 72, 143, 2, 76, 192, 5, 78, 7, 81, 9, - /* 320 */ 62, 63, 64, 254, 198, 104, 192, 69, 70, 71, - /* 330 */ 72, 192, 111, 192, 104, 234, 138, 192, 117, 141, - /* 340 */ 5, 111, 7, 33, 34, 233, 192, 117, 236, 227, - /* 350 */ 62, 63, 64, 254, 115, 134, 230, 69, 70, 71, - /* 360 */ 72, 62, 63, 64, 134, 104, 261, 233, 263, 211, - /* 370 */ 236, 238, 233, 112, 233, 236, 197, 236, 233, 117, - /* 380 */ 201, 236, 197, 235, 109, 252, 201, 233, 125, 126, - /* 390 */ 236, 116, 105, 1, 105, 237, 109, 105, 60, 251, - /* 400 */ 105, 254, 113, 105, 109, 113, 105, 109, 105, 105, - /* 410 */ 109, 109, 109, 109, 105, 5, 105, 7, 109, 105, - /* 420 */ 109, 111, 105, 109, 105, 254, 109, 104, 109, 37, - /* 430 */ 107, 254, 130, 139, 140, 139, 140, 76, 77, 139, - /* 440 */ 140, 104, 104, 106, 139, 140, 5, 254, 7, 254, - /* 450 */ 254, 254, 117, 254, 254, 254, 254, 254, 254, 237, - /* 460 */ 228, 228, 228, 228, 228, 192, 192, 253, 228, 228, - /* 470 */ 192, 192, 192, 192, 192, 192, 192, 235, 235, 262, - /* 480 */ 262, 235, 192, 239, 60, 192, 117, 258, 103, 192, - /* 490 */ 226, 85, 87, 86, 240, 245, 247, 250, 192, 192, - /* 500 */ 192, 129, 249, 258, 192, 192, 258, 192, 192, 258, - /* 510 */ 192, 131, 192, 192, 192, 128, 192, 192, 192, 192, - /* 520 */ 192, 192, 192, 192, 192, 192, 192, 123, 192, 127, - /* 530 */ 122, 192, 192, 192, 192, 192, 192, 192, 192, 192, + /* 250 */ 27, 28, 238, 234, 33, 34, 33, 34, 37, 192, + /* 260 */ 37, 38, 39, 33, 34, 5, 252, 7, 88, 237, + /* 270 */ 90, 91, 104, 192, 192, 95, 109, 97, 98, 99, + /* 280 */ 112, 101, 102, 116, 210, 33, 34, 213, 214, 37, + /* 290 */ 38, 39, 218, 197, 220, 221, 222, 201, 224, 225, + /* 300 */ 62, 63, 64, 135, 68, 137, 37, 69, 70, 71, + /* 310 */ 72, 68, 144, 192, 233, 233, 78, 236, 236, 2, + /* 320 */ 254, 5, 5, 7, 7, 104, 9, 254, 261, 192, + /* 330 */ 263, 192, 111, 228, 104, 62, 63, 64, 117, 192, + /* 340 */ 254, 111, 69, 70, 71, 72, 192, 117, 192, 192, + /* 350 */ 33, 34, 192, 192, 233, 134, 211, 236, 62, 63, + /* 360 */ 64, 62, 63, 64, 134, 69, 70, 71, 72, 211, + /* 370 */ 233, 192, 233, 236, 138, 236, 140, 117, 142, 143, + /* 380 */ 104, 138, 237, 140, 115, 142, 143, 233, 112, 233, + /* 390 */ 236, 136, 236, 233, 233, 237, 236, 236, 195, 196, + /* 400 */ 145, 146, 65, 66, 67, 76, 227, 105, 261, 105, + /* 410 */ 81, 125, 126, 109, 1, 113, 105, 105, 261, 105, + /* 420 */ 109, 109, 60, 109, 109, 105, 254, 105, 111, 109, + /* 430 */ 105, 109, 109, 117, 109, 105, 105, 105, 105, 109, + /* 440 */ 109, 109, 109, 104, 76, 77, 107, 132, 254, 139, + /* 450 */ 37, 141, 139, 130, 141, 254, 254, 139, 139, 141, + /* 460 */ 141, 254, 104, 139, 106, 141, 104, 254, 5, 5, + /* 470 */ 7, 7, 254, 254, 139, 228, 141, 237, 254, 254, + /* 480 */ 254, 237, 228, 192, 228, 228, 228, 228, 253, 192, + /* 490 */ 192, 262, 192, 192, 262, 192, 235, 235, 192, 192, + /* 500 */ 192, 192, 239, 235, 60, 87, 258, 258, 117, 258, + /* 510 */ 243, 258, 247, 192, 250, 249, 246, 122, 192, 192, + /* 520 */ 192, 123, 248, 129, 245, 128, 192, 131, 192, 127, + /* 530 */ 192, 121, 192, 192, 192, 192, 192, 192, 192, 192, /* 540 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - /* 550 */ 192, 192, 192, 121, 192, 192, 192, 192, 120, 193, - /* 560 */ 193, 193, 119, 193, 193, 118, 133, 50, 83, 54, - /* 570 */ 193, 193, 84, 82, 193, 79, 5, 146, 5, 193, - /* 580 */ 5, 198, 198, 193, 5, 146, 5, 90, 89, 193, - /* 590 */ 136, 113, 105, 107, 194, 202, 207, 209, 203, 208, - /* 600 */ 206, 204, 193, 205, 104, 194, 194, 193, 114, 194, - /* 610 */ 193, 193, 199, 104, 195, 109, 109, 105, 242, 244, - /* 620 */ 246, 248, 243, 241, 104, 226, 105, 109, 104, 1, - /* 630 */ 105, 104, 104, 111, 105, 104, 76, 124, 124, 109, - /* 640 */ 105, 109, 104, 104, 104, 108, 104, 9, 107, 5, - /* 650 */ 5, 5, 5, 5, 80, 15, 76, 109, 16, 140, - /* 660 */ 5, 5, 105, 140, 5, 5, 140, 5, 5, 5, - /* 670 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 680 */ 5, 5, 80, 60, 59, 109, 0, 266, 266, 266, - /* 690 */ 266, 266, 266, 266, 266, 266, 266, 266, 21, 21, - /* 700 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - /* 710 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - /* 720 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + /* 550 */ 120, 192, 192, 192, 119, 192, 192, 192, 192, 192, + /* 560 */ 118, 192, 192, 192, 192, 192, 192, 192, 192, 192, + /* 570 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + /* 580 */ 133, 193, 193, 193, 103, 193, 193, 86, 50, 83, + /* 590 */ 85, 54, 84, 82, 79, 5, 147, 193, 193, 193, + /* 600 */ 5, 5, 147, 5, 193, 193, 198, 198, 5, 90, + /* 610 */ 89, 136, 113, 109, 193, 105, 107, 104, 194, 193, + /* 620 */ 203, 194, 207, 209, 208, 206, 204, 202, 205, 195, + /* 630 */ 194, 193, 193, 226, 194, 104, 193, 114, 109, 105, + /* 640 */ 199, 240, 242, 244, 241, 104, 226, 105, 109, 104, + /* 650 */ 1, 105, 104, 104, 124, 105, 104, 124, 111, 105, + /* 660 */ 109, 104, 109, 104, 104, 107, 104, 76, 9, 108, + /* 670 */ 5, 5, 5, 5, 5, 15, 76, 80, 16, 109, + /* 680 */ 16, 141, 5, 5, 141, 141, 105, 5, 5, 5, + /* 690 */ 5, 5, 5, 5, 5, 5, 141, 5, 5, 5, + /* 700 */ 5, 5, 5, 5, 5, 80, 60, 59, 109, 0, + /* 710 */ 266, 266, 21, 266, 266, 266, 266, 266, 266, 266, + /* 720 */ 266, 21, 266, 266, 266, 266, 266, 266, 266, 266, /* 730 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 740 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 750 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, @@ -366,104 +380,112 @@ static const YYCODETYPE yy_lookahead[] = { /* 850 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 860 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, /* 870 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - /* 880 */ 266, 266, 266, 266, 266, 266, 266, 266, + /* 880 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + /* 890 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + /* 900 */ 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + /* 910 */ 266, }; -#define YY_SHIFT_COUNT (326) +#define YY_SHIFT_COUNT (340) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (686) +#define YY_SHIFT_MAX (709) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 168, 79, 79, 180, 180, 29, 221, 230, 110, 106, - /* 10 */ 106, 106, 106, 106, 106, 106, 106, 106, 0, 48, - /* 20 */ 230, 310, 310, 310, 310, 261, 261, 106, 106, 106, - /* 30 */ 4, 106, 106, 237, 29, 144, 144, 700, 700, 700, - /* 40 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, + /* 0 */ 168, 79, 79, 180, 180, 29, 221, 230, 110, 148, + /* 10 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 20 */ 148, 148, 0, 48, 230, 317, 317, 317, 317, 276, + /* 30 */ 276, 148, 148, 148, 4, 148, 148, 329, 29, 64, + /* 40 */ 64, 722, 722, 722, 230, 230, 230, 230, 230, 230, /* 50 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, - /* 60 */ 310, 310, 25, 25, 25, 25, 25, 25, 25, 106, - /* 70 */ 106, 106, 239, 106, 106, 106, 261, 261, 106, 106, - /* 80 */ 106, 106, 263, 263, 275, 261, 106, 106, 106, 106, - /* 90 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 100 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 110 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 120 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 130 */ 106, 106, 106, 106, 106, 106, 106, 424, 424, 424, - /* 140 */ 369, 369, 369, 424, 369, 424, 372, 380, 387, 404, - /* 150 */ 402, 408, 432, 438, 443, 447, 433, 424, 424, 424, - /* 160 */ 385, 29, 29, 424, 424, 405, 407, 517, 485, 406, - /* 170 */ 515, 488, 491, 385, 424, 496, 496, 424, 496, 424, - /* 180 */ 496, 424, 424, 700, 700, 27, 100, 127, 100, 100, - /* 190 */ 53, 182, 223, 223, 223, 223, 238, 258, 288, 252, - /* 200 */ 252, 252, 252, 21, 129, 92, 92, 262, 335, 130, - /* 210 */ 198, 91, 299, 287, 289, 292, 295, 298, 301, 303, - /* 220 */ 304, 392, 338, 7, 174, 302, 309, 311, 314, 317, - /* 230 */ 319, 323, 294, 296, 300, 337, 305, 410, 441, 361, - /* 240 */ 571, 431, 573, 575, 439, 579, 581, 497, 499, 454, - /* 250 */ 478, 486, 500, 494, 487, 509, 506, 507, 512, 520, - /* 260 */ 521, 518, 524, 525, 527, 628, 528, 529, 531, 530, - /* 270 */ 513, 532, 514, 535, 538, 522, 539, 486, 540, 541, - /* 280 */ 542, 537, 560, 638, 644, 645, 646, 647, 648, 574, - /* 290 */ 640, 580, 519, 548, 548, 642, 523, 526, 548, 655, - /* 300 */ 656, 557, 548, 659, 660, 662, 663, 664, 665, 666, - /* 310 */ 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, - /* 320 */ 576, 602, 677, 678, 623, 625, 686, + /* 60 */ 230, 230, 230, 230, 317, 317, 317, 25, 25, 25, + /* 70 */ 25, 25, 25, 25, 148, 148, 148, 269, 148, 148, + /* 80 */ 148, 276, 276, 148, 148, 148, 148, 286, 286, 167, + /* 90 */ 276, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 100 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 110 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 120 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 130 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 140 */ 148, 148, 148, 444, 444, 444, 391, 391, 391, 444, + /* 150 */ 391, 444, 394, 396, 397, 398, 402, 395, 410, 430, + /* 160 */ 435, 442, 447, 444, 444, 444, 481, 29, 29, 444, + /* 170 */ 444, 418, 501, 538, 506, 505, 537, 508, 511, 481, + /* 180 */ 444, 515, 515, 444, 515, 444, 515, 444, 444, 722, + /* 190 */ 722, 27, 100, 127, 100, 100, 53, 182, 223, 223, + /* 200 */ 223, 223, 238, 273, 296, 252, 252, 252, 252, 236, + /* 210 */ 243, 255, 92, 92, 260, 316, 130, 337, 299, 304, + /* 220 */ 120, 302, 311, 312, 314, 320, 322, 413, 362, 7, + /* 230 */ 315, 323, 325, 330, 331, 332, 333, 339, 310, 313, + /* 240 */ 318, 319, 324, 358, 335, 463, 464, 368, 590, 449, + /* 250 */ 595, 596, 455, 598, 603, 519, 521, 475, 499, 509, + /* 260 */ 513, 523, 510, 531, 504, 529, 534, 541, 542, 539, + /* 270 */ 545, 546, 548, 649, 549, 550, 552, 551, 530, 553, + /* 280 */ 533, 554, 557, 547, 559, 509, 560, 558, 562, 561, + /* 290 */ 591, 659, 665, 666, 667, 668, 669, 597, 660, 600, + /* 300 */ 662, 540, 543, 570, 570, 570, 570, 664, 544, 555, + /* 310 */ 570, 570, 570, 677, 678, 581, 570, 682, 683, 684, + /* 320 */ 685, 686, 687, 688, 689, 690, 692, 693, 694, 695, + /* 330 */ 696, 697, 698, 699, 599, 625, 691, 700, 646, 648, + /* 340 */ 709, }; -#define YY_REDUCE_COUNT (184) +#define YY_REDUCE_COUNT (190) #define YY_REDUCE_MIN (-249) -#define YY_REDUCE_MAX (419) +#define YY_REDUCE_MAX (443) static const short yy_reduce_ofst[] = { - /* 0 */ -179, -28, -28, 74, 74, 15, -246, -219, -121, -9, - /* 10 */ 105, -177, 112, 134, 139, 141, 145, 154, -192, -189, - /* 20 */ -223, -205, -175, 22, 158, -34, 148, -50, -43, 101, - /* 30 */ -110, 122, -124, 3, 126, 179, 185, 133, -54, 57, - /* 40 */ -249, -247, -242, -225, -169, 69, 99, 147, 171, 177, - /* 50 */ 193, 195, 196, 197, 199, 200, 201, 202, 203, 204, - /* 60 */ -162, 222, 232, 233, 234, 235, 236, 240, 241, 273, - /* 70 */ 274, 278, 214, 279, 280, 281, 242, 243, 282, 283, - /* 80 */ 284, 290, 217, 218, 244, 246, 293, 297, 306, 307, - /* 90 */ 308, 312, 313, 315, 316, 318, 320, 321, 322, 324, - /* 100 */ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - /* 110 */ 336, 339, 340, 341, 342, 343, 344, 345, 346, 347, - /* 120 */ 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - /* 130 */ 358, 359, 360, 362, 363, 364, 365, 366, 367, 368, - /* 140 */ 229, 245, 248, 370, 251, 371, 247, 253, 373, 249, - /* 150 */ 374, 250, 375, 379, 376, 382, 254, 377, 378, 381, - /* 160 */ 264, 383, 384, 386, 390, 388, 391, 389, 395, 394, - /* 170 */ 397, 398, 393, 399, 396, 400, 411, 409, 412, 414, - /* 180 */ 415, 417, 418, 413, 419, + /* 0 */ -179, -28, -28, 74, 74, 15, -246, -219, -121, -77, + /* 10 */ 67, -177, -9, 81, 82, 121, 137, 139, 154, 156, + /* 20 */ 160, 161, -192, -189, -223, -205, -175, 145, 158, -93, + /* 30 */ -89, 147, 157, 19, -110, 179, -124, -112, -123, 3, + /* 40 */ 96, 14, 18, 203, -249, -247, -242, -225, -91, -53, + /* 50 */ 66, 73, 86, 172, 194, 201, 202, 207, 213, 218, + /* 60 */ 219, 224, 225, 226, 32, 240, 244, 105, 247, 254, + /* 70 */ 256, 257, 258, 259, 291, 297, 298, 235, 300, 301, + /* 80 */ 303, 261, 262, 306, 307, 308, 309, 229, 232, 263, + /* 90 */ 268, 321, 326, 327, 328, 334, 336, 338, 340, 341, + /* 100 */ 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + /* 110 */ 352, 353, 354, 355, 356, 357, 359, 360, 361, 363, + /* 120 */ 364, 365, 366, 367, 369, 370, 371, 372, 373, 374, + /* 130 */ 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + /* 140 */ 385, 386, 387, 388, 389, 390, 248, 249, 251, 392, + /* 150 */ 253, 393, 264, 266, 274, 265, 270, 279, 399, 267, + /* 160 */ 400, 403, 401, 404, 405, 406, 407, 408, 409, 411, + /* 170 */ 412, 414, 416, 415, 417, 419, 422, 423, 425, 420, + /* 180 */ 421, 424, 427, 426, 436, 438, 440, 439, 443, 441, + /* 190 */ 434, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 798, 911, 857, 923, 845, 854, 1059, 1059, 798, 798, - /* 10 */ 798, 798, 798, 798, 798, 798, 798, 798, 970, 817, - /* 20 */ 1059, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 30 */ 854, 798, 798, 860, 854, 860, 860, 965, 895, 913, - /* 40 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 50 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 60 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 70 */ 798, 798, 972, 978, 975, 798, 798, 798, 980, 798, - /* 80 */ 798, 798, 1002, 1002, 963, 798, 798, 798, 798, 798, - /* 90 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 100 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 110 */ 798, 798, 798, 843, 798, 841, 798, 798, 798, 798, - /* 120 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 130 */ 828, 798, 798, 798, 798, 798, 798, 819, 819, 819, - /* 140 */ 798, 798, 798, 819, 798, 819, 1009, 1013, 1007, 995, - /* 150 */ 1003, 994, 990, 988, 986, 985, 1017, 819, 819, 819, - /* 160 */ 858, 854, 854, 819, 819, 876, 874, 872, 864, 870, - /* 170 */ 866, 868, 862, 846, 819, 852, 852, 819, 852, 819, - /* 180 */ 852, 819, 819, 895, 913, 798, 1018, 798, 1058, 1008, - /* 190 */ 1048, 1047, 1054, 1046, 1045, 1044, 798, 798, 798, 1040, - /* 200 */ 1041, 1043, 1042, 798, 798, 1050, 1049, 798, 798, 798, - /* 210 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 220 */ 798, 798, 1020, 798, 1014, 1010, 798, 798, 798, 798, - /* 230 */ 798, 798, 798, 798, 798, 925, 798, 798, 798, 798, - /* 240 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 250 */ 962, 798, 798, 798, 798, 798, 974, 973, 798, 798, - /* 260 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 1004, - /* 270 */ 798, 996, 798, 798, 798, 798, 798, 937, 798, 798, - /* 280 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 290 */ 798, 798, 798, 1070, 1068, 798, 798, 798, 1064, 798, - /* 300 */ 798, 798, 1062, 798, 798, 798, 798, 798, 798, 798, - /* 310 */ 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, - /* 320 */ 879, 798, 826, 824, 798, 815, 798, + /* 0 */ 818, 931, 877, 943, 865, 874, 1079, 1079, 818, 818, + /* 10 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 20 */ 818, 818, 990, 837, 1079, 818, 818, 818, 818, 818, + /* 30 */ 818, 818, 818, 818, 874, 818, 818, 880, 874, 880, + /* 40 */ 880, 985, 915, 933, 818, 818, 818, 818, 818, 818, + /* 50 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 60 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 70 */ 818, 818, 818, 818, 818, 818, 818, 992, 998, 995, + /* 80 */ 818, 818, 818, 1000, 818, 818, 818, 1022, 1022, 983, + /* 90 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 100 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 110 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 863, + /* 120 */ 818, 861, 818, 818, 818, 818, 818, 818, 818, 818, + /* 130 */ 818, 818, 818, 818, 818, 818, 848, 818, 818, 818, + /* 140 */ 818, 818, 818, 839, 839, 839, 818, 818, 818, 839, + /* 150 */ 818, 839, 1029, 1033, 1027, 1015, 1023, 1014, 1010, 1008, + /* 160 */ 1006, 1005, 1037, 839, 839, 839, 878, 874, 874, 839, + /* 170 */ 839, 896, 894, 892, 884, 890, 886, 888, 882, 866, + /* 180 */ 839, 872, 872, 839, 872, 839, 872, 839, 839, 915, + /* 190 */ 933, 818, 1038, 818, 1078, 1028, 1068, 1067, 1074, 1066, + /* 200 */ 1065, 1064, 818, 818, 818, 1060, 1061, 1063, 1062, 818, + /* 210 */ 818, 818, 1070, 1069, 818, 818, 818, 818, 818, 818, + /* 220 */ 818, 818, 818, 818, 818, 818, 818, 818, 1040, 818, + /* 230 */ 1034, 1030, 818, 818, 818, 818, 818, 818, 818, 818, + /* 240 */ 818, 818, 818, 945, 818, 818, 818, 818, 818, 818, + /* 250 */ 818, 818, 818, 818, 818, 818, 818, 818, 982, 818, + /* 260 */ 818, 818, 818, 818, 994, 993, 818, 818, 818, 818, + /* 270 */ 818, 818, 818, 818, 818, 818, 818, 1024, 818, 1016, + /* 280 */ 818, 818, 818, 818, 818, 957, 818, 818, 818, 818, + /* 290 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 300 */ 818, 818, 818, 1097, 1092, 1093, 1090, 818, 818, 818, + /* 310 */ 1089, 1084, 1085, 818, 818, 818, 1082, 818, 818, 818, + /* 320 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 330 */ 818, 818, 818, 818, 899, 818, 846, 844, 818, 835, + /* 340 */ 818, }; /********** End of lemon-generated parsing tables *****************************/ @@ -623,6 +645,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* SYNCDB => nothing */ 0, /* ADD => nothing */ 0, /* COLUMN => nothing */ + 0, /* MODIFY => nothing */ 0, /* TAG => nothing */ 0, /* CHANGE => nothing */ 0, /* SET => nothing */ @@ -710,6 +733,7 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ + ParseCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -897,55 +921,55 @@ static const char *const yyTokenName[] = { /* 137 */ "SYNCDB", /* 138 */ "ADD", /* 139 */ "COLUMN", - /* 140 */ "TAG", - /* 141 */ "CHANGE", - /* 142 */ "SET", - /* 143 */ "KILL", - /* 144 */ "CONNECTION", - /* 145 */ "STREAM", - /* 146 */ "COLON", - /* 147 */ "ABORT", - /* 148 */ "AFTER", - /* 149 */ "ATTACH", - /* 150 */ "BEFORE", - /* 151 */ "BEGIN", - /* 152 */ "CASCADE", - /* 153 */ "CLUSTER", - /* 154 */ "CONFLICT", - /* 155 */ "COPY", - /* 156 */ "DEFERRED", - /* 157 */ "DELIMITERS", - /* 158 */ "DETACH", - /* 159 */ "EACH", - /* 160 */ "END", - /* 161 */ "EXPLAIN", - /* 162 */ "FAIL", - /* 163 */ "FOR", - /* 164 */ "IGNORE", - /* 165 */ "IMMEDIATE", - /* 166 */ "INITIALLY", - /* 167 */ "INSTEAD", - /* 168 */ "MATCH", - /* 169 */ "KEY", - /* 170 */ "OF", - /* 171 */ "RAISE", - /* 172 */ "REPLACE", - /* 173 */ "RESTRICT", - /* 174 */ "ROW", - /* 175 */ "STATEMENT", - /* 176 */ "TRIGGER", - /* 177 */ "VIEW", - /* 178 */ "SEMI", - /* 179 */ "NONE", - /* 180 */ "PREV", - /* 181 */ "LINEAR", - /* 182 */ "IMPORT", - /* 183 */ "TBNAME", - /* 184 */ "JOIN", - /* 185 */ "INSERT", - /* 186 */ "INTO", - /* 187 */ "VALUES", - /* 188 */ "error", + /* 140 */ "MODIFY", + /* 141 */ "TAG", + /* 142 */ "CHANGE", + /* 143 */ "SET", + /* 144 */ "KILL", + /* 145 */ "CONNECTION", + /* 146 */ "STREAM", + /* 147 */ "COLON", + /* 148 */ "ABORT", + /* 149 */ "AFTER", + /* 150 */ "ATTACH", + /* 151 */ "BEFORE", + /* 152 */ "BEGIN", + /* 153 */ "CASCADE", + /* 154 */ "CLUSTER", + /* 155 */ "CONFLICT", + /* 156 */ "COPY", + /* 157 */ "DEFERRED", + /* 158 */ "DELIMITERS", + /* 159 */ "DETACH", + /* 160 */ "EACH", + /* 161 */ "END", + /* 162 */ "EXPLAIN", + /* 163 */ "FAIL", + /* 164 */ "FOR", + /* 165 */ "IGNORE", + /* 166 */ "IMMEDIATE", + /* 167 */ "INITIALLY", + /* 168 */ "INSTEAD", + /* 169 */ "MATCH", + /* 170 */ "KEY", + /* 171 */ "OF", + /* 172 */ "RAISE", + /* 173 */ "REPLACE", + /* 174 */ "RESTRICT", + /* 175 */ "ROW", + /* 176 */ "STATEMENT", + /* 177 */ "TRIGGER", + /* 178 */ "VIEW", + /* 179 */ "SEMI", + /* 180 */ "NONE", + /* 181 */ "PREV", + /* 182 */ "LINEAR", + /* 183 */ "IMPORT", + /* 184 */ "TBNAME", + /* 185 */ "JOIN", + /* 186 */ "INSERT", + /* 187 */ "INTO", + /* 188 */ "VALUES", /* 189 */ "program", /* 190 */ "cmd", /* 191 */ "dbPrefix", @@ -1293,18 +1317,23 @@ static const char *const yyRuleName[] = { /* 260 */ "cmd ::= SYNCDB ids REPLICA", /* 261 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", /* 262 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 263 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 264 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 265 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 266 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 267 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 268 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 269 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 270 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 271 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 272 */ "cmd ::= KILL CONNECTION INTEGER", - /* 273 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 274 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 263 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 264 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 265 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 266 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 267 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 268 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 269 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 270 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 271 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 272 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 273 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 274 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 275 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 276 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 277 */ "cmd ::= KILL CONNECTION INTEGER", + /* 278 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 279 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1353,28 +1382,29 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -void ParseInit(void *yypParser){ - yyParser *pParser = (yyParser*)yypParser; +void ParseInit(void *yypRawParser ParseCTX_PDECL){ + yyParser *yypParser = (yyParser*)yypRawParser; + ParseCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH - pParser->yyhwm = 0; + yypParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 - pParser->yytos = NULL; - pParser->yystack = NULL; - pParser->yystksz = 0; - if( yyGrowStack(pParser) ){ - pParser->yystack = &pParser->yystk0; - pParser->yystksz = 1; + yypParser->yytos = NULL; + yypParser->yystack = NULL; + yypParser->yystksz = 0; + if( yyGrowStack(yypParser) ){ + yypParser->yystack = &yypParser->yystk0; + yypParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY - pParser->yyerrcnt = -1; + yypParser->yyerrcnt = -1; #endif - pParser->yytos = pParser->yystack; - pParser->yystack[0].stateno = 0; - pParser->yystack[0].major = 0; + yypParser->yytos = yypParser->yystack; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 - pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #endif } @@ -1391,11 +1421,14 @@ void ParseInit(void *yypParser){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( pParser ) ParseInit(pParser); - return pParser; +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ + yyParser *yypParser; + yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( yypParser ){ + ParseCTX_STORE + ParseInit(yypParser ParseCTX_PARAM); + } + return (void*)yypParser; } #endif /* Parse_ENGINEALWAYSONSTACK */ @@ -1412,7 +1445,8 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -1589,13 +1623,12 @@ int ParseCoverage(FILE *out){ ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ -static unsigned int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ +static YYACTIONTYPE yy_find_shift_action( + YYCODETYPE iLookAhead, /* The look-ahead token */ + YYACTIONTYPE stateno /* Current state number */ ){ int i; - int stateno = pParser->yytos->stateno; - + if( stateno>YY_MAX_SHIFT ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); #if defined(YYCOVERAGE) @@ -1603,15 +1636,19 @@ static unsigned int yy_find_shift_action( #endif do{ i = yy_shift_ofst[stateno]; - assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); + assert( i>=0 ); + assert( i<=YY_ACTTAB_COUNT ); + assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; + assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead %s\n", @@ -1626,15 +1663,8 @@ static unsigned int yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j0 - ){ + assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); + if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1648,6 +1678,7 @@ static unsigned int yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ + assert( i>=0 && iyytos; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; + yytos->stateno = yyNewState; + yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - signed char nrhs; /* Negative of the number of RHS symbols in the rule */ -} yyRuleInfo[] = { - { 189, -1 }, /* (0) program ::= cmd */ - { 190, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 190, -2 }, /* (2) cmd ::= SHOW TOPICS */ - { 190, -2 }, /* (3) cmd ::= SHOW MNODES */ - { 190, -2 }, /* (4) cmd ::= SHOW DNODES */ - { 190, -2 }, /* (5) cmd ::= SHOW ACCOUNTS */ - { 190, -2 }, /* (6) cmd ::= SHOW USERS */ - { 190, -2 }, /* (7) cmd ::= SHOW MODULES */ - { 190, -2 }, /* (8) cmd ::= SHOW QUERIES */ - { 190, -2 }, /* (9) cmd ::= SHOW CONNECTIONS */ - { 190, -2 }, /* (10) cmd ::= SHOW STREAMS */ - { 190, -2 }, /* (11) cmd ::= SHOW VARIABLES */ - { 190, -2 }, /* (12) cmd ::= SHOW SCORES */ - { 190, -2 }, /* (13) cmd ::= SHOW GRANTS */ - { 190, -2 }, /* (14) cmd ::= SHOW VNODES */ - { 190, -3 }, /* (15) cmd ::= SHOW VNODES IPTOKEN */ - { 191, 0 }, /* (16) dbPrefix ::= */ - { 191, -2 }, /* (17) dbPrefix ::= ids DOT */ - { 193, 0 }, /* (18) cpxName ::= */ - { 193, -2 }, /* (19) cpxName ::= DOT ids */ - { 190, -5 }, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 190, -5 }, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */ - { 190, -4 }, /* (22) cmd ::= SHOW CREATE DATABASE ids */ - { 190, -3 }, /* (23) cmd ::= SHOW dbPrefix TABLES */ - { 190, -5 }, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 190, -3 }, /* (25) cmd ::= SHOW dbPrefix STABLES */ - { 190, -5 }, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 190, -3 }, /* (27) cmd ::= SHOW dbPrefix VGROUPS */ - { 190, -4 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 190, -5 }, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ - { 190, -5 }, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ - { 190, -4 }, /* (31) cmd ::= DROP DATABASE ifexists ids */ - { 190, -4 }, /* (32) cmd ::= DROP TOPIC ifexists ids */ - { 190, -3 }, /* (33) cmd ::= DROP DNODE ids */ - { 190, -3 }, /* (34) cmd ::= DROP USER ids */ - { 190, -3 }, /* (35) cmd ::= DROP ACCOUNT ids */ - { 190, -2 }, /* (36) cmd ::= USE ids */ - { 190, -3 }, /* (37) cmd ::= DESCRIBE ids cpxName */ - { 190, -5 }, /* (38) cmd ::= ALTER USER ids PASS ids */ - { 190, -5 }, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 190, -4 }, /* (40) cmd ::= ALTER DNODE ids ids */ - { 190, -5 }, /* (41) cmd ::= ALTER DNODE ids ids ids */ - { 190, -3 }, /* (42) cmd ::= ALTER LOCAL ids */ - { 190, -4 }, /* (43) cmd ::= ALTER LOCAL ids ids */ - { 190, -4 }, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 190, -4 }, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */ - { 190, -4 }, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 190, -6 }, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 192, -1 }, /* (48) ids ::= ID */ - { 192, -1 }, /* (49) ids ::= STRING */ - { 194, -2 }, /* (50) ifexists ::= IF EXISTS */ - { 194, 0 }, /* (51) ifexists ::= */ - { 198, -3 }, /* (52) ifnotexists ::= IF NOT EXISTS */ - { 198, 0 }, /* (53) ifnotexists ::= */ - { 190, -3 }, /* (54) cmd ::= CREATE DNODE ids */ - { 190, -6 }, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 190, -5 }, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 190, -5 }, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - { 190, -5 }, /* (58) cmd ::= CREATE USER ids PASS ids */ - { 201, 0 }, /* (59) pps ::= */ - { 201, -2 }, /* (60) pps ::= PPS INTEGER */ - { 202, 0 }, /* (61) tseries ::= */ - { 202, -2 }, /* (62) tseries ::= TSERIES INTEGER */ - { 203, 0 }, /* (63) dbs ::= */ - { 203, -2 }, /* (64) dbs ::= DBS INTEGER */ - { 204, 0 }, /* (65) streams ::= */ - { 204, -2 }, /* (66) streams ::= STREAMS INTEGER */ - { 205, 0 }, /* (67) storage ::= */ - { 205, -2 }, /* (68) storage ::= STORAGE INTEGER */ - { 206, 0 }, /* (69) qtime ::= */ - { 206, -2 }, /* (70) qtime ::= QTIME INTEGER */ - { 207, 0 }, /* (71) users ::= */ - { 207, -2 }, /* (72) users ::= USERS INTEGER */ - { 208, 0 }, /* (73) conns ::= */ - { 208, -2 }, /* (74) conns ::= CONNS INTEGER */ - { 209, 0 }, /* (75) state ::= */ - { 209, -2 }, /* (76) state ::= STATE ids */ - { 197, -9 }, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 210, -2 }, /* (78) keep ::= KEEP tagitemlist */ - { 212, -2 }, /* (79) cache ::= CACHE INTEGER */ - { 213, -2 }, /* (80) replica ::= REPLICA INTEGER */ - { 214, -2 }, /* (81) quorum ::= QUORUM INTEGER */ - { 215, -2 }, /* (82) days ::= DAYS INTEGER */ - { 216, -2 }, /* (83) minrows ::= MINROWS INTEGER */ - { 217, -2 }, /* (84) maxrows ::= MAXROWS INTEGER */ - { 218, -2 }, /* (85) blocks ::= BLOCKS INTEGER */ - { 219, -2 }, /* (86) ctime ::= CTIME INTEGER */ - { 220, -2 }, /* (87) wal ::= WAL INTEGER */ - { 221, -2 }, /* (88) fsync ::= FSYNC INTEGER */ - { 222, -2 }, /* (89) comp ::= COMP INTEGER */ - { 223, -2 }, /* (90) prec ::= PRECISION STRING */ - { 224, -2 }, /* (91) update ::= UPDATE INTEGER */ - { 225, -2 }, /* (92) cachelast ::= CACHELAST INTEGER */ - { 226, -2 }, /* (93) partitions ::= PARTITIONS INTEGER */ - { 199, 0 }, /* (94) db_optr ::= */ - { 199, -2 }, /* (95) db_optr ::= db_optr cache */ - { 199, -2 }, /* (96) db_optr ::= db_optr replica */ - { 199, -2 }, /* (97) db_optr ::= db_optr quorum */ - { 199, -2 }, /* (98) db_optr ::= db_optr days */ - { 199, -2 }, /* (99) db_optr ::= db_optr minrows */ - { 199, -2 }, /* (100) db_optr ::= db_optr maxrows */ - { 199, -2 }, /* (101) db_optr ::= db_optr blocks */ - { 199, -2 }, /* (102) db_optr ::= db_optr ctime */ - { 199, -2 }, /* (103) db_optr ::= db_optr wal */ - { 199, -2 }, /* (104) db_optr ::= db_optr fsync */ - { 199, -2 }, /* (105) db_optr ::= db_optr comp */ - { 199, -2 }, /* (106) db_optr ::= db_optr prec */ - { 199, -2 }, /* (107) db_optr ::= db_optr keep */ - { 199, -2 }, /* (108) db_optr ::= db_optr update */ - { 199, -2 }, /* (109) db_optr ::= db_optr cachelast */ - { 200, -1 }, /* (110) topic_optr ::= db_optr */ - { 200, -2 }, /* (111) topic_optr ::= topic_optr partitions */ - { 195, 0 }, /* (112) alter_db_optr ::= */ - { 195, -2 }, /* (113) alter_db_optr ::= alter_db_optr replica */ - { 195, -2 }, /* (114) alter_db_optr ::= alter_db_optr quorum */ - { 195, -2 }, /* (115) alter_db_optr ::= alter_db_optr keep */ - { 195, -2 }, /* (116) alter_db_optr ::= alter_db_optr blocks */ - { 195, -2 }, /* (117) alter_db_optr ::= alter_db_optr comp */ - { 195, -2 }, /* (118) alter_db_optr ::= alter_db_optr wal */ - { 195, -2 }, /* (119) alter_db_optr ::= alter_db_optr fsync */ - { 195, -2 }, /* (120) alter_db_optr ::= alter_db_optr update */ - { 195, -2 }, /* (121) alter_db_optr ::= alter_db_optr cachelast */ - { 196, -1 }, /* (122) alter_topic_optr ::= alter_db_optr */ - { 196, -2 }, /* (123) alter_topic_optr ::= alter_topic_optr partitions */ - { 227, -1 }, /* (124) typename ::= ids */ - { 227, -4 }, /* (125) typename ::= ids LP signed RP */ - { 227, -2 }, /* (126) typename ::= ids UNSIGNED */ - { 228, -1 }, /* (127) signed ::= INTEGER */ - { 228, -2 }, /* (128) signed ::= PLUS INTEGER */ - { 228, -2 }, /* (129) signed ::= MINUS INTEGER */ - { 190, -3 }, /* (130) cmd ::= CREATE TABLE create_table_args */ - { 190, -3 }, /* (131) cmd ::= CREATE TABLE create_stable_args */ - { 190, -3 }, /* (132) cmd ::= CREATE STABLE create_stable_args */ - { 190, -3 }, /* (133) cmd ::= CREATE TABLE create_table_list */ - { 231, -1 }, /* (134) create_table_list ::= create_from_stable */ - { 231, -2 }, /* (135) create_table_list ::= create_table_list create_from_stable */ - { 229, -6 }, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 230, -10 }, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 232, -10 }, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 232, -13 }, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - { 234, -3 }, /* (140) tagNamelist ::= tagNamelist COMMA ids */ - { 234, -1 }, /* (141) tagNamelist ::= ids */ - { 229, -5 }, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */ - { 233, -3 }, /* (143) columnlist ::= columnlist COMMA column */ - { 233, -1 }, /* (144) columnlist ::= column */ - { 236, -2 }, /* (145) column ::= ids typename */ - { 211, -3 }, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */ - { 211, -1 }, /* (147) tagitemlist ::= tagitem */ - { 237, -1 }, /* (148) tagitem ::= INTEGER */ - { 237, -1 }, /* (149) tagitem ::= FLOAT */ - { 237, -1 }, /* (150) tagitem ::= STRING */ - { 237, -1 }, /* (151) tagitem ::= BOOL */ - { 237, -1 }, /* (152) tagitem ::= NULL */ - { 237, -2 }, /* (153) tagitem ::= MINUS INTEGER */ - { 237, -2 }, /* (154) tagitem ::= MINUS FLOAT */ - { 237, -2 }, /* (155) tagitem ::= PLUS INTEGER */ - { 237, -2 }, /* (156) tagitem ::= PLUS FLOAT */ - { 235, -14 }, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 235, -3 }, /* (158) select ::= LP select RP */ - { 251, -1 }, /* (159) union ::= select */ - { 251, -4 }, /* (160) union ::= union UNION ALL select */ - { 190, -1 }, /* (161) cmd ::= union */ - { 235, -2 }, /* (162) select ::= SELECT selcollist */ - { 252, -2 }, /* (163) sclp ::= selcollist COMMA */ - { 252, 0 }, /* (164) sclp ::= */ - { 238, -4 }, /* (165) selcollist ::= sclp distinct expr as */ - { 238, -2 }, /* (166) selcollist ::= sclp STAR */ - { 255, -2 }, /* (167) as ::= AS ids */ - { 255, -1 }, /* (168) as ::= ids */ - { 255, 0 }, /* (169) as ::= */ - { 253, -1 }, /* (170) distinct ::= DISTINCT */ - { 253, 0 }, /* (171) distinct ::= */ - { 239, -2 }, /* (172) from ::= FROM tablelist */ - { 239, -2 }, /* (173) from ::= FROM sub */ - { 257, -3 }, /* (174) sub ::= LP union RP */ - { 257, -4 }, /* (175) sub ::= LP union RP ids */ - { 257, -6 }, /* (176) sub ::= sub COMMA LP union RP ids */ - { 256, -2 }, /* (177) tablelist ::= ids cpxName */ - { 256, -3 }, /* (178) tablelist ::= ids cpxName ids */ - { 256, -4 }, /* (179) tablelist ::= tablelist COMMA ids cpxName */ - { 256, -5 }, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */ - { 258, -1 }, /* (181) tmvar ::= VARIABLE */ - { 241, -4 }, /* (182) interval_opt ::= INTERVAL LP tmvar RP */ - { 241, -6 }, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - { 241, 0 }, /* (184) interval_opt ::= */ - { 242, 0 }, /* (185) session_option ::= */ - { 242, -7 }, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 243, 0 }, /* (187) windowstate_option ::= */ - { 243, -4 }, /* (188) windowstate_option ::= STATE_WINDOW LP ids RP */ - { 244, 0 }, /* (189) fill_opt ::= */ - { 244, -6 }, /* (190) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 244, -4 }, /* (191) fill_opt ::= FILL LP ID RP */ - { 245, -4 }, /* (192) sliding_opt ::= SLIDING LP tmvar RP */ - { 245, 0 }, /* (193) sliding_opt ::= */ - { 247, 0 }, /* (194) orderby_opt ::= */ - { 247, -3 }, /* (195) orderby_opt ::= ORDER BY sortlist */ - { 259, -4 }, /* (196) sortlist ::= sortlist COMMA item sortorder */ - { 259, -2 }, /* (197) sortlist ::= item sortorder */ - { 261, -2 }, /* (198) item ::= ids cpxName */ - { 262, -1 }, /* (199) sortorder ::= ASC */ - { 262, -1 }, /* (200) sortorder ::= DESC */ - { 262, 0 }, /* (201) sortorder ::= */ - { 246, 0 }, /* (202) groupby_opt ::= */ - { 246, -3 }, /* (203) groupby_opt ::= GROUP BY grouplist */ - { 263, -3 }, /* (204) grouplist ::= grouplist COMMA item */ - { 263, -1 }, /* (205) grouplist ::= item */ - { 248, 0 }, /* (206) having_opt ::= */ - { 248, -2 }, /* (207) having_opt ::= HAVING expr */ - { 250, 0 }, /* (208) limit_opt ::= */ - { 250, -2 }, /* (209) limit_opt ::= LIMIT signed */ - { 250, -4 }, /* (210) limit_opt ::= LIMIT signed OFFSET signed */ - { 250, -4 }, /* (211) limit_opt ::= LIMIT signed COMMA signed */ - { 249, 0 }, /* (212) slimit_opt ::= */ - { 249, -2 }, /* (213) slimit_opt ::= SLIMIT signed */ - { 249, -4 }, /* (214) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 249, -4 }, /* (215) slimit_opt ::= SLIMIT signed COMMA signed */ - { 240, 0 }, /* (216) where_opt ::= */ - { 240, -2 }, /* (217) where_opt ::= WHERE expr */ - { 254, -3 }, /* (218) expr ::= LP expr RP */ - { 254, -1 }, /* (219) expr ::= ID */ - { 254, -3 }, /* (220) expr ::= ID DOT ID */ - { 254, -3 }, /* (221) expr ::= ID DOT STAR */ - { 254, -1 }, /* (222) expr ::= INTEGER */ - { 254, -2 }, /* (223) expr ::= MINUS INTEGER */ - { 254, -2 }, /* (224) expr ::= PLUS INTEGER */ - { 254, -1 }, /* (225) expr ::= FLOAT */ - { 254, -2 }, /* (226) expr ::= MINUS FLOAT */ - { 254, -2 }, /* (227) expr ::= PLUS FLOAT */ - { 254, -1 }, /* (228) expr ::= STRING */ - { 254, -1 }, /* (229) expr ::= NOW */ - { 254, -1 }, /* (230) expr ::= VARIABLE */ - { 254, -2 }, /* (231) expr ::= PLUS VARIABLE */ - { 254, -2 }, /* (232) expr ::= MINUS VARIABLE */ - { 254, -1 }, /* (233) expr ::= BOOL */ - { 254, -1 }, /* (234) expr ::= NULL */ - { 254, -4 }, /* (235) expr ::= ID LP exprlist RP */ - { 254, -4 }, /* (236) expr ::= ID LP STAR RP */ - { 254, -3 }, /* (237) expr ::= expr IS NULL */ - { 254, -4 }, /* (238) expr ::= expr IS NOT NULL */ - { 254, -3 }, /* (239) expr ::= expr LT expr */ - { 254, -3 }, /* (240) expr ::= expr GT expr */ - { 254, -3 }, /* (241) expr ::= expr LE expr */ - { 254, -3 }, /* (242) expr ::= expr GE expr */ - { 254, -3 }, /* (243) expr ::= expr NE expr */ - { 254, -3 }, /* (244) expr ::= expr EQ expr */ - { 254, -5 }, /* (245) expr ::= expr BETWEEN expr AND expr */ - { 254, -3 }, /* (246) expr ::= expr AND expr */ - { 254, -3 }, /* (247) expr ::= expr OR expr */ - { 254, -3 }, /* (248) expr ::= expr PLUS expr */ - { 254, -3 }, /* (249) expr ::= expr MINUS expr */ - { 254, -3 }, /* (250) expr ::= expr STAR expr */ - { 254, -3 }, /* (251) expr ::= expr SLASH expr */ - { 254, -3 }, /* (252) expr ::= expr REM expr */ - { 254, -3 }, /* (253) expr ::= expr LIKE expr */ - { 254, -5 }, /* (254) expr ::= expr IN LP exprlist RP */ - { 264, -3 }, /* (255) exprlist ::= exprlist COMMA expritem */ - { 264, -1 }, /* (256) exprlist ::= expritem */ - { 265, -1 }, /* (257) expritem ::= expr */ - { 265, 0 }, /* (258) expritem ::= */ - { 190, -3 }, /* (259) cmd ::= RESET QUERY CACHE */ - { 190, -3 }, /* (260) cmd ::= SYNCDB ids REPLICA */ - { 190, -7 }, /* (261) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 190, -7 }, /* (262) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 190, -7 }, /* (263) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 190, -7 }, /* (264) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 190, -8 }, /* (265) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 190, -9 }, /* (266) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 190, -7 }, /* (267) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 190, -7 }, /* (268) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 190, -7 }, /* (269) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 190, -7 }, /* (270) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 190, -8 }, /* (271) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 190, -3 }, /* (272) cmd ::= KILL CONNECTION INTEGER */ - { 190, -5 }, /* (273) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 190, -5 }, /* (274) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +** of that rule */ +static const YYCODETYPE yyRuleInfoLhs[] = { + 189, /* (0) program ::= cmd */ + 190, /* (1) cmd ::= SHOW DATABASES */ + 190, /* (2) cmd ::= SHOW TOPICS */ + 190, /* (3) cmd ::= SHOW MNODES */ + 190, /* (4) cmd ::= SHOW DNODES */ + 190, /* (5) cmd ::= SHOW ACCOUNTS */ + 190, /* (6) cmd ::= SHOW USERS */ + 190, /* (7) cmd ::= SHOW MODULES */ + 190, /* (8) cmd ::= SHOW QUERIES */ + 190, /* (9) cmd ::= SHOW CONNECTIONS */ + 190, /* (10) cmd ::= SHOW STREAMS */ + 190, /* (11) cmd ::= SHOW VARIABLES */ + 190, /* (12) cmd ::= SHOW SCORES */ + 190, /* (13) cmd ::= SHOW GRANTS */ + 190, /* (14) cmd ::= SHOW VNODES */ + 190, /* (15) cmd ::= SHOW VNODES IPTOKEN */ + 191, /* (16) dbPrefix ::= */ + 191, /* (17) dbPrefix ::= ids DOT */ + 193, /* (18) cpxName ::= */ + 193, /* (19) cpxName ::= DOT ids */ + 190, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ + 190, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */ + 190, /* (22) cmd ::= SHOW CREATE DATABASE ids */ + 190, /* (23) cmd ::= SHOW dbPrefix TABLES */ + 190, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + 190, /* (25) cmd ::= SHOW dbPrefix STABLES */ + 190, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + 190, /* (27) cmd ::= SHOW dbPrefix VGROUPS */ + 190, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */ + 190, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ + 190, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ + 190, /* (31) cmd ::= DROP DATABASE ifexists ids */ + 190, /* (32) cmd ::= DROP TOPIC ifexists ids */ + 190, /* (33) cmd ::= DROP DNODE ids */ + 190, /* (34) cmd ::= DROP USER ids */ + 190, /* (35) cmd ::= DROP ACCOUNT ids */ + 190, /* (36) cmd ::= USE ids */ + 190, /* (37) cmd ::= DESCRIBE ids cpxName */ + 190, /* (38) cmd ::= ALTER USER ids PASS ids */ + 190, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */ + 190, /* (40) cmd ::= ALTER DNODE ids ids */ + 190, /* (41) cmd ::= ALTER DNODE ids ids ids */ + 190, /* (42) cmd ::= ALTER LOCAL ids */ + 190, /* (43) cmd ::= ALTER LOCAL ids ids */ + 190, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */ + 190, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */ + 190, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */ + 190, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + 192, /* (48) ids ::= ID */ + 192, /* (49) ids ::= STRING */ + 194, /* (50) ifexists ::= IF EXISTS */ + 194, /* (51) ifexists ::= */ + 198, /* (52) ifnotexists ::= IF NOT EXISTS */ + 198, /* (53) ifnotexists ::= */ + 190, /* (54) cmd ::= CREATE DNODE ids */ + 190, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + 190, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + 190, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + 190, /* (58) cmd ::= CREATE USER ids PASS ids */ + 201, /* (59) pps ::= */ + 201, /* (60) pps ::= PPS INTEGER */ + 202, /* (61) tseries ::= */ + 202, /* (62) tseries ::= TSERIES INTEGER */ + 203, /* (63) dbs ::= */ + 203, /* (64) dbs ::= DBS INTEGER */ + 204, /* (65) streams ::= */ + 204, /* (66) streams ::= STREAMS INTEGER */ + 205, /* (67) storage ::= */ + 205, /* (68) storage ::= STORAGE INTEGER */ + 206, /* (69) qtime ::= */ + 206, /* (70) qtime ::= QTIME INTEGER */ + 207, /* (71) users ::= */ + 207, /* (72) users ::= USERS INTEGER */ + 208, /* (73) conns ::= */ + 208, /* (74) conns ::= CONNS INTEGER */ + 209, /* (75) state ::= */ + 209, /* (76) state ::= STATE ids */ + 197, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + 210, /* (78) keep ::= KEEP tagitemlist */ + 212, /* (79) cache ::= CACHE INTEGER */ + 213, /* (80) replica ::= REPLICA INTEGER */ + 214, /* (81) quorum ::= QUORUM INTEGER */ + 215, /* (82) days ::= DAYS INTEGER */ + 216, /* (83) minrows ::= MINROWS INTEGER */ + 217, /* (84) maxrows ::= MAXROWS INTEGER */ + 218, /* (85) blocks ::= BLOCKS INTEGER */ + 219, /* (86) ctime ::= CTIME INTEGER */ + 220, /* (87) wal ::= WAL INTEGER */ + 221, /* (88) fsync ::= FSYNC INTEGER */ + 222, /* (89) comp ::= COMP INTEGER */ + 223, /* (90) prec ::= PRECISION STRING */ + 224, /* (91) update ::= UPDATE INTEGER */ + 225, /* (92) cachelast ::= CACHELAST INTEGER */ + 226, /* (93) partitions ::= PARTITIONS INTEGER */ + 199, /* (94) db_optr ::= */ + 199, /* (95) db_optr ::= db_optr cache */ + 199, /* (96) db_optr ::= db_optr replica */ + 199, /* (97) db_optr ::= db_optr quorum */ + 199, /* (98) db_optr ::= db_optr days */ + 199, /* (99) db_optr ::= db_optr minrows */ + 199, /* (100) db_optr ::= db_optr maxrows */ + 199, /* (101) db_optr ::= db_optr blocks */ + 199, /* (102) db_optr ::= db_optr ctime */ + 199, /* (103) db_optr ::= db_optr wal */ + 199, /* (104) db_optr ::= db_optr fsync */ + 199, /* (105) db_optr ::= db_optr comp */ + 199, /* (106) db_optr ::= db_optr prec */ + 199, /* (107) db_optr ::= db_optr keep */ + 199, /* (108) db_optr ::= db_optr update */ + 199, /* (109) db_optr ::= db_optr cachelast */ + 200, /* (110) topic_optr ::= db_optr */ + 200, /* (111) topic_optr ::= topic_optr partitions */ + 195, /* (112) alter_db_optr ::= */ + 195, /* (113) alter_db_optr ::= alter_db_optr replica */ + 195, /* (114) alter_db_optr ::= alter_db_optr quorum */ + 195, /* (115) alter_db_optr ::= alter_db_optr keep */ + 195, /* (116) alter_db_optr ::= alter_db_optr blocks */ + 195, /* (117) alter_db_optr ::= alter_db_optr comp */ + 195, /* (118) alter_db_optr ::= alter_db_optr wal */ + 195, /* (119) alter_db_optr ::= alter_db_optr fsync */ + 195, /* (120) alter_db_optr ::= alter_db_optr update */ + 195, /* (121) alter_db_optr ::= alter_db_optr cachelast */ + 196, /* (122) alter_topic_optr ::= alter_db_optr */ + 196, /* (123) alter_topic_optr ::= alter_topic_optr partitions */ + 227, /* (124) typename ::= ids */ + 227, /* (125) typename ::= ids LP signed RP */ + 227, /* (126) typename ::= ids UNSIGNED */ + 228, /* (127) signed ::= INTEGER */ + 228, /* (128) signed ::= PLUS INTEGER */ + 228, /* (129) signed ::= MINUS INTEGER */ + 190, /* (130) cmd ::= CREATE TABLE create_table_args */ + 190, /* (131) cmd ::= CREATE TABLE create_stable_args */ + 190, /* (132) cmd ::= CREATE STABLE create_stable_args */ + 190, /* (133) cmd ::= CREATE TABLE create_table_list */ + 231, /* (134) create_table_list ::= create_from_stable */ + 231, /* (135) create_table_list ::= create_table_list create_from_stable */ + 229, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + 230, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + 232, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + 232, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + 234, /* (140) tagNamelist ::= tagNamelist COMMA ids */ + 234, /* (141) tagNamelist ::= ids */ + 229, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */ + 233, /* (143) columnlist ::= columnlist COMMA column */ + 233, /* (144) columnlist ::= column */ + 236, /* (145) column ::= ids typename */ + 211, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */ + 211, /* (147) tagitemlist ::= tagitem */ + 237, /* (148) tagitem ::= INTEGER */ + 237, /* (149) tagitem ::= FLOAT */ + 237, /* (150) tagitem ::= STRING */ + 237, /* (151) tagitem ::= BOOL */ + 237, /* (152) tagitem ::= NULL */ + 237, /* (153) tagitem ::= MINUS INTEGER */ + 237, /* (154) tagitem ::= MINUS FLOAT */ + 237, /* (155) tagitem ::= PLUS INTEGER */ + 237, /* (156) tagitem ::= PLUS FLOAT */ + 235, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + 235, /* (158) select ::= LP select RP */ + 251, /* (159) union ::= select */ + 251, /* (160) union ::= union UNION ALL select */ + 190, /* (161) cmd ::= union */ + 235, /* (162) select ::= SELECT selcollist */ + 252, /* (163) sclp ::= selcollist COMMA */ + 252, /* (164) sclp ::= */ + 238, /* (165) selcollist ::= sclp distinct expr as */ + 238, /* (166) selcollist ::= sclp STAR */ + 255, /* (167) as ::= AS ids */ + 255, /* (168) as ::= ids */ + 255, /* (169) as ::= */ + 253, /* (170) distinct ::= DISTINCT */ + 253, /* (171) distinct ::= */ + 239, /* (172) from ::= FROM tablelist */ + 239, /* (173) from ::= FROM sub */ + 257, /* (174) sub ::= LP union RP */ + 257, /* (175) sub ::= LP union RP ids */ + 257, /* (176) sub ::= sub COMMA LP union RP ids */ + 256, /* (177) tablelist ::= ids cpxName */ + 256, /* (178) tablelist ::= ids cpxName ids */ + 256, /* (179) tablelist ::= tablelist COMMA ids cpxName */ + 256, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */ + 258, /* (181) tmvar ::= VARIABLE */ + 241, /* (182) interval_opt ::= INTERVAL LP tmvar RP */ + 241, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + 241, /* (184) interval_opt ::= */ + 242, /* (185) session_option ::= */ + 242, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 243, /* (187) windowstate_option ::= */ + 243, /* (188) windowstate_option ::= STATE_WINDOW LP ids RP */ + 244, /* (189) fill_opt ::= */ + 244, /* (190) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 244, /* (191) fill_opt ::= FILL LP ID RP */ + 245, /* (192) sliding_opt ::= SLIDING LP tmvar RP */ + 245, /* (193) sliding_opt ::= */ + 247, /* (194) orderby_opt ::= */ + 247, /* (195) orderby_opt ::= ORDER BY sortlist */ + 259, /* (196) sortlist ::= sortlist COMMA item sortorder */ + 259, /* (197) sortlist ::= item sortorder */ + 261, /* (198) item ::= ids cpxName */ + 262, /* (199) sortorder ::= ASC */ + 262, /* (200) sortorder ::= DESC */ + 262, /* (201) sortorder ::= */ + 246, /* (202) groupby_opt ::= */ + 246, /* (203) groupby_opt ::= GROUP BY grouplist */ + 263, /* (204) grouplist ::= grouplist COMMA item */ + 263, /* (205) grouplist ::= item */ + 248, /* (206) having_opt ::= */ + 248, /* (207) having_opt ::= HAVING expr */ + 250, /* (208) limit_opt ::= */ + 250, /* (209) limit_opt ::= LIMIT signed */ + 250, /* (210) limit_opt ::= LIMIT signed OFFSET signed */ + 250, /* (211) limit_opt ::= LIMIT signed COMMA signed */ + 249, /* (212) slimit_opt ::= */ + 249, /* (213) slimit_opt ::= SLIMIT signed */ + 249, /* (214) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 249, /* (215) slimit_opt ::= SLIMIT signed COMMA signed */ + 240, /* (216) where_opt ::= */ + 240, /* (217) where_opt ::= WHERE expr */ + 254, /* (218) expr ::= LP expr RP */ + 254, /* (219) expr ::= ID */ + 254, /* (220) expr ::= ID DOT ID */ + 254, /* (221) expr ::= ID DOT STAR */ + 254, /* (222) expr ::= INTEGER */ + 254, /* (223) expr ::= MINUS INTEGER */ + 254, /* (224) expr ::= PLUS INTEGER */ + 254, /* (225) expr ::= FLOAT */ + 254, /* (226) expr ::= MINUS FLOAT */ + 254, /* (227) expr ::= PLUS FLOAT */ + 254, /* (228) expr ::= STRING */ + 254, /* (229) expr ::= NOW */ + 254, /* (230) expr ::= VARIABLE */ + 254, /* (231) expr ::= PLUS VARIABLE */ + 254, /* (232) expr ::= MINUS VARIABLE */ + 254, /* (233) expr ::= BOOL */ + 254, /* (234) expr ::= NULL */ + 254, /* (235) expr ::= ID LP exprlist RP */ + 254, /* (236) expr ::= ID LP STAR RP */ + 254, /* (237) expr ::= expr IS NULL */ + 254, /* (238) expr ::= expr IS NOT NULL */ + 254, /* (239) expr ::= expr LT expr */ + 254, /* (240) expr ::= expr GT expr */ + 254, /* (241) expr ::= expr LE expr */ + 254, /* (242) expr ::= expr GE expr */ + 254, /* (243) expr ::= expr NE expr */ + 254, /* (244) expr ::= expr EQ expr */ + 254, /* (245) expr ::= expr BETWEEN expr AND expr */ + 254, /* (246) expr ::= expr AND expr */ + 254, /* (247) expr ::= expr OR expr */ + 254, /* (248) expr ::= expr PLUS expr */ + 254, /* (249) expr ::= expr MINUS expr */ + 254, /* (250) expr ::= expr STAR expr */ + 254, /* (251) expr ::= expr SLASH expr */ + 254, /* (252) expr ::= expr REM expr */ + 254, /* (253) expr ::= expr LIKE expr */ + 254, /* (254) expr ::= expr IN LP exprlist RP */ + 264, /* (255) exprlist ::= exprlist COMMA expritem */ + 264, /* (256) exprlist ::= expritem */ + 265, /* (257) expritem ::= expr */ + 265, /* (258) expritem ::= */ + 190, /* (259) cmd ::= RESET QUERY CACHE */ + 190, /* (260) cmd ::= SYNCDB ids REPLICA */ + 190, /* (261) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 190, /* (262) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 190, /* (263) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + 190, /* (264) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 190, /* (265) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 190, /* (266) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 190, /* (267) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 190, /* (268) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 190, /* (269) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 190, /* (270) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 190, /* (271) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 190, /* (272) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 190, /* (273) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 190, /* (274) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 190, /* (275) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 190, /* (276) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 190, /* (277) cmd ::= KILL CONNECTION INTEGER */ + 190, /* (278) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 190, /* (279) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +}; + +/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number +** of symbols on the right-hand side of that rule. */ +static const signed char yyRuleInfoNRhs[] = { + -1, /* (0) program ::= cmd */ + -2, /* (1) cmd ::= SHOW DATABASES */ + -2, /* (2) cmd ::= SHOW TOPICS */ + -2, /* (3) cmd ::= SHOW MNODES */ + -2, /* (4) cmd ::= SHOW DNODES */ + -2, /* (5) cmd ::= SHOW ACCOUNTS */ + -2, /* (6) cmd ::= SHOW USERS */ + -2, /* (7) cmd ::= SHOW MODULES */ + -2, /* (8) cmd ::= SHOW QUERIES */ + -2, /* (9) cmd ::= SHOW CONNECTIONS */ + -2, /* (10) cmd ::= SHOW STREAMS */ + -2, /* (11) cmd ::= SHOW VARIABLES */ + -2, /* (12) cmd ::= SHOW SCORES */ + -2, /* (13) cmd ::= SHOW GRANTS */ + -2, /* (14) cmd ::= SHOW VNODES */ + -3, /* (15) cmd ::= SHOW VNODES IPTOKEN */ + 0, /* (16) dbPrefix ::= */ + -2, /* (17) dbPrefix ::= ids DOT */ + 0, /* (18) cpxName ::= */ + -2, /* (19) cpxName ::= DOT ids */ + -5, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ + -5, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */ + -4, /* (22) cmd ::= SHOW CREATE DATABASE ids */ + -3, /* (23) cmd ::= SHOW dbPrefix TABLES */ + -5, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + -3, /* (25) cmd ::= SHOW dbPrefix STABLES */ + -5, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + -3, /* (27) cmd ::= SHOW dbPrefix VGROUPS */ + -4, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */ + -5, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ + -5, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ + -4, /* (31) cmd ::= DROP DATABASE ifexists ids */ + -4, /* (32) cmd ::= DROP TOPIC ifexists ids */ + -3, /* (33) cmd ::= DROP DNODE ids */ + -3, /* (34) cmd ::= DROP USER ids */ + -3, /* (35) cmd ::= DROP ACCOUNT ids */ + -2, /* (36) cmd ::= USE ids */ + -3, /* (37) cmd ::= DESCRIBE ids cpxName */ + -5, /* (38) cmd ::= ALTER USER ids PASS ids */ + -5, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */ + -4, /* (40) cmd ::= ALTER DNODE ids ids */ + -5, /* (41) cmd ::= ALTER DNODE ids ids ids */ + -3, /* (42) cmd ::= ALTER LOCAL ids */ + -4, /* (43) cmd ::= ALTER LOCAL ids ids */ + -4, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */ + -4, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */ + -4, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */ + -6, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + -1, /* (48) ids ::= ID */ + -1, /* (49) ids ::= STRING */ + -2, /* (50) ifexists ::= IF EXISTS */ + 0, /* (51) ifexists ::= */ + -3, /* (52) ifnotexists ::= IF NOT EXISTS */ + 0, /* (53) ifnotexists ::= */ + -3, /* (54) cmd ::= CREATE DNODE ids */ + -6, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + -5, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + -5, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + -5, /* (58) cmd ::= CREATE USER ids PASS ids */ + 0, /* (59) pps ::= */ + -2, /* (60) pps ::= PPS INTEGER */ + 0, /* (61) tseries ::= */ + -2, /* (62) tseries ::= TSERIES INTEGER */ + 0, /* (63) dbs ::= */ + -2, /* (64) dbs ::= DBS INTEGER */ + 0, /* (65) streams ::= */ + -2, /* (66) streams ::= STREAMS INTEGER */ + 0, /* (67) storage ::= */ + -2, /* (68) storage ::= STORAGE INTEGER */ + 0, /* (69) qtime ::= */ + -2, /* (70) qtime ::= QTIME INTEGER */ + 0, /* (71) users ::= */ + -2, /* (72) users ::= USERS INTEGER */ + 0, /* (73) conns ::= */ + -2, /* (74) conns ::= CONNS INTEGER */ + 0, /* (75) state ::= */ + -2, /* (76) state ::= STATE ids */ + -9, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + -2, /* (78) keep ::= KEEP tagitemlist */ + -2, /* (79) cache ::= CACHE INTEGER */ + -2, /* (80) replica ::= REPLICA INTEGER */ + -2, /* (81) quorum ::= QUORUM INTEGER */ + -2, /* (82) days ::= DAYS INTEGER */ + -2, /* (83) minrows ::= MINROWS INTEGER */ + -2, /* (84) maxrows ::= MAXROWS INTEGER */ + -2, /* (85) blocks ::= BLOCKS INTEGER */ + -2, /* (86) ctime ::= CTIME INTEGER */ + -2, /* (87) wal ::= WAL INTEGER */ + -2, /* (88) fsync ::= FSYNC INTEGER */ + -2, /* (89) comp ::= COMP INTEGER */ + -2, /* (90) prec ::= PRECISION STRING */ + -2, /* (91) update ::= UPDATE INTEGER */ + -2, /* (92) cachelast ::= CACHELAST INTEGER */ + -2, /* (93) partitions ::= PARTITIONS INTEGER */ + 0, /* (94) db_optr ::= */ + -2, /* (95) db_optr ::= db_optr cache */ + -2, /* (96) db_optr ::= db_optr replica */ + -2, /* (97) db_optr ::= db_optr quorum */ + -2, /* (98) db_optr ::= db_optr days */ + -2, /* (99) db_optr ::= db_optr minrows */ + -2, /* (100) db_optr ::= db_optr maxrows */ + -2, /* (101) db_optr ::= db_optr blocks */ + -2, /* (102) db_optr ::= db_optr ctime */ + -2, /* (103) db_optr ::= db_optr wal */ + -2, /* (104) db_optr ::= db_optr fsync */ + -2, /* (105) db_optr ::= db_optr comp */ + -2, /* (106) db_optr ::= db_optr prec */ + -2, /* (107) db_optr ::= db_optr keep */ + -2, /* (108) db_optr ::= db_optr update */ + -2, /* (109) db_optr ::= db_optr cachelast */ + -1, /* (110) topic_optr ::= db_optr */ + -2, /* (111) topic_optr ::= topic_optr partitions */ + 0, /* (112) alter_db_optr ::= */ + -2, /* (113) alter_db_optr ::= alter_db_optr replica */ + -2, /* (114) alter_db_optr ::= alter_db_optr quorum */ + -2, /* (115) alter_db_optr ::= alter_db_optr keep */ + -2, /* (116) alter_db_optr ::= alter_db_optr blocks */ + -2, /* (117) alter_db_optr ::= alter_db_optr comp */ + -2, /* (118) alter_db_optr ::= alter_db_optr wal */ + -2, /* (119) alter_db_optr ::= alter_db_optr fsync */ + -2, /* (120) alter_db_optr ::= alter_db_optr update */ + -2, /* (121) alter_db_optr ::= alter_db_optr cachelast */ + -1, /* (122) alter_topic_optr ::= alter_db_optr */ + -2, /* (123) alter_topic_optr ::= alter_topic_optr partitions */ + -1, /* (124) typename ::= ids */ + -4, /* (125) typename ::= ids LP signed RP */ + -2, /* (126) typename ::= ids UNSIGNED */ + -1, /* (127) signed ::= INTEGER */ + -2, /* (128) signed ::= PLUS INTEGER */ + -2, /* (129) signed ::= MINUS INTEGER */ + -3, /* (130) cmd ::= CREATE TABLE create_table_args */ + -3, /* (131) cmd ::= CREATE TABLE create_stable_args */ + -3, /* (132) cmd ::= CREATE STABLE create_stable_args */ + -3, /* (133) cmd ::= CREATE TABLE create_table_list */ + -1, /* (134) create_table_list ::= create_from_stable */ + -2, /* (135) create_table_list ::= create_table_list create_from_stable */ + -6, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + -10, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + -10, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + -13, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + -3, /* (140) tagNamelist ::= tagNamelist COMMA ids */ + -1, /* (141) tagNamelist ::= ids */ + -5, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */ + -3, /* (143) columnlist ::= columnlist COMMA column */ + -1, /* (144) columnlist ::= column */ + -2, /* (145) column ::= ids typename */ + -3, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */ + -1, /* (147) tagitemlist ::= tagitem */ + -1, /* (148) tagitem ::= INTEGER */ + -1, /* (149) tagitem ::= FLOAT */ + -1, /* (150) tagitem ::= STRING */ + -1, /* (151) tagitem ::= BOOL */ + -1, /* (152) tagitem ::= NULL */ + -2, /* (153) tagitem ::= MINUS INTEGER */ + -2, /* (154) tagitem ::= MINUS FLOAT */ + -2, /* (155) tagitem ::= PLUS INTEGER */ + -2, /* (156) tagitem ::= PLUS FLOAT */ + -14, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + -3, /* (158) select ::= LP select RP */ + -1, /* (159) union ::= select */ + -4, /* (160) union ::= union UNION ALL select */ + -1, /* (161) cmd ::= union */ + -2, /* (162) select ::= SELECT selcollist */ + -2, /* (163) sclp ::= selcollist COMMA */ + 0, /* (164) sclp ::= */ + -4, /* (165) selcollist ::= sclp distinct expr as */ + -2, /* (166) selcollist ::= sclp STAR */ + -2, /* (167) as ::= AS ids */ + -1, /* (168) as ::= ids */ + 0, /* (169) as ::= */ + -1, /* (170) distinct ::= DISTINCT */ + 0, /* (171) distinct ::= */ + -2, /* (172) from ::= FROM tablelist */ + -2, /* (173) from ::= FROM sub */ + -3, /* (174) sub ::= LP union RP */ + -4, /* (175) sub ::= LP union RP ids */ + -6, /* (176) sub ::= sub COMMA LP union RP ids */ + -2, /* (177) tablelist ::= ids cpxName */ + -3, /* (178) tablelist ::= ids cpxName ids */ + -4, /* (179) tablelist ::= tablelist COMMA ids cpxName */ + -5, /* (180) tablelist ::= tablelist COMMA ids cpxName ids */ + -1, /* (181) tmvar ::= VARIABLE */ + -4, /* (182) interval_opt ::= INTERVAL LP tmvar RP */ + -6, /* (183) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + 0, /* (184) interval_opt ::= */ + 0, /* (185) session_option ::= */ + -7, /* (186) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 0, /* (187) windowstate_option ::= */ + -4, /* (188) windowstate_option ::= STATE_WINDOW LP ids RP */ + 0, /* (189) fill_opt ::= */ + -6, /* (190) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + -4, /* (191) fill_opt ::= FILL LP ID RP */ + -4, /* (192) sliding_opt ::= SLIDING LP tmvar RP */ + 0, /* (193) sliding_opt ::= */ + 0, /* (194) orderby_opt ::= */ + -3, /* (195) orderby_opt ::= ORDER BY sortlist */ + -4, /* (196) sortlist ::= sortlist COMMA item sortorder */ + -2, /* (197) sortlist ::= item sortorder */ + -2, /* (198) item ::= ids cpxName */ + -1, /* (199) sortorder ::= ASC */ + -1, /* (200) sortorder ::= DESC */ + 0, /* (201) sortorder ::= */ + 0, /* (202) groupby_opt ::= */ + -3, /* (203) groupby_opt ::= GROUP BY grouplist */ + -3, /* (204) grouplist ::= grouplist COMMA item */ + -1, /* (205) grouplist ::= item */ + 0, /* (206) having_opt ::= */ + -2, /* (207) having_opt ::= HAVING expr */ + 0, /* (208) limit_opt ::= */ + -2, /* (209) limit_opt ::= LIMIT signed */ + -4, /* (210) limit_opt ::= LIMIT signed OFFSET signed */ + -4, /* (211) limit_opt ::= LIMIT signed COMMA signed */ + 0, /* (212) slimit_opt ::= */ + -2, /* (213) slimit_opt ::= SLIMIT signed */ + -4, /* (214) slimit_opt ::= SLIMIT signed SOFFSET signed */ + -4, /* (215) slimit_opt ::= SLIMIT signed COMMA signed */ + 0, /* (216) where_opt ::= */ + -2, /* (217) where_opt ::= WHERE expr */ + -3, /* (218) expr ::= LP expr RP */ + -1, /* (219) expr ::= ID */ + -3, /* (220) expr ::= ID DOT ID */ + -3, /* (221) expr ::= ID DOT STAR */ + -1, /* (222) expr ::= INTEGER */ + -2, /* (223) expr ::= MINUS INTEGER */ + -2, /* (224) expr ::= PLUS INTEGER */ + -1, /* (225) expr ::= FLOAT */ + -2, /* (226) expr ::= MINUS FLOAT */ + -2, /* (227) expr ::= PLUS FLOAT */ + -1, /* (228) expr ::= STRING */ + -1, /* (229) expr ::= NOW */ + -1, /* (230) expr ::= VARIABLE */ + -2, /* (231) expr ::= PLUS VARIABLE */ + -2, /* (232) expr ::= MINUS VARIABLE */ + -1, /* (233) expr ::= BOOL */ + -1, /* (234) expr ::= NULL */ + -4, /* (235) expr ::= ID LP exprlist RP */ + -4, /* (236) expr ::= ID LP STAR RP */ + -3, /* (237) expr ::= expr IS NULL */ + -4, /* (238) expr ::= expr IS NOT NULL */ + -3, /* (239) expr ::= expr LT expr */ + -3, /* (240) expr ::= expr GT expr */ + -3, /* (241) expr ::= expr LE expr */ + -3, /* (242) expr ::= expr GE expr */ + -3, /* (243) expr ::= expr NE expr */ + -3, /* (244) expr ::= expr EQ expr */ + -5, /* (245) expr ::= expr BETWEEN expr AND expr */ + -3, /* (246) expr ::= expr AND expr */ + -3, /* (247) expr ::= expr OR expr */ + -3, /* (248) expr ::= expr PLUS expr */ + -3, /* (249) expr ::= expr MINUS expr */ + -3, /* (250) expr ::= expr STAR expr */ + -3, /* (251) expr ::= expr SLASH expr */ + -3, /* (252) expr ::= expr REM expr */ + -3, /* (253) expr ::= expr LIKE expr */ + -5, /* (254) expr ::= expr IN LP exprlist RP */ + -3, /* (255) exprlist ::= exprlist COMMA expritem */ + -1, /* (256) exprlist ::= expritem */ + -1, /* (257) expritem ::= expr */ + 0, /* (258) expritem ::= */ + -3, /* (259) cmd ::= RESET QUERY CACHE */ + -3, /* (260) cmd ::= SYNCDB ids REPLICA */ + -7, /* (261) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (262) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (263) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (264) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (265) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (266) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (267) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (268) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (269) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (270) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (271) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (272) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (273) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (274) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (275) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (276) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (277) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (278) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (279) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2060,30 +2379,34 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ -static void yy_reduce( +static YYACTIONTYPE yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ - int yyact; /* The next action */ + YYACTIONTYPE yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; + ParseARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfo[yyruleno].nrhs; + yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno); + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -2101,13 +2424,19 @@ static void yy_reduce( #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } #else if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } yymsp = yypParser->yytos; } @@ -3047,14 +3376,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 263: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 263: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ +{ + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 264: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 264: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 265: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3065,7 +3401,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 265: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 266: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3079,7 +3415,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 266: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 267: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3091,14 +3427,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 267: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 268: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ +{ + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 269: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 268: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 270: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3109,14 +3452,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 269: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 271: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ +{ + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 272: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 270: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 273: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3127,7 +3477,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 271: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 274: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3141,22 +3491,41 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 272: /* cmd ::= KILL CONNECTION INTEGER */ + case 275: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ +{ + yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; + + toTSDBType(yymsp[-2].minor.yy0.type); + SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy442, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 276: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ +{ + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy193, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 277: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 273: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 278: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 274: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 279: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: break; /********** End reduce actions ************************************************/ }; - assert( yyrulenostateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); + return yyact; } /* @@ -3180,7 +3550,8 @@ static void yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -3191,7 +3562,8 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } #endif /* YYNOERRORRECOVERY */ @@ -3203,7 +3575,8 @@ static void yy_syntax_error( int yymajor, /* The major type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ @@ -3229,7 +3602,8 @@ static void yy_syntax_error( assert(len <= outputBufLen); /************ End %syntax_error code ******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* @@ -3238,7 +3612,8 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -3253,7 +3628,8 @@ static void yy_accept( /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* The main parser program. @@ -3282,45 +3658,47 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - unsigned int yyact; /* The parser action. */ + YYACTIONTYPE yyact; /* The parser action. */ #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ #endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif - yyParser *yypParser; /* The parser */ + yyParser *yypParser = (yyParser*)yyp; /* The parser */ + ParseCTX_FETCH + ParseARG_STORE - yypParser = (yyParser*)yyp; assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif - ParseARG_STORE; + yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ - int stateno = yypParser->yytos->stateno; - if( stateno < YY_MIN_REDUCE ){ + if( yyact < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno); + yyTracePrompt,yyTokenName[yymajor],yyact); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); + yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); } } #endif do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + assert( yyact==yypParser->yytos->stateno ); + yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, + yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,yymajor,yyminor); + yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif - yymajor = YYNOCODE; + break; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); @@ -3371,10 +3749,9 @@ void Parse( yymajor = YYNOCODE; }else{ while( yypParser->yytos >= yypParser->yystack - && yymx != YYERRORSYMBOL && (yyact = yy_find_reduce_action( yypParser->yytos->stateno, - YYERRORSYMBOL)) >= YY_MIN_REDUCE + YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE ){ yy_pop_parser_stack(yypParser); } @@ -3391,6 +3768,8 @@ void Parse( } yypParser->yyerrcnt = 3; yyerrorhit = 1; + if( yymajor==YYNOCODE ) break; + yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -3401,8 +3780,7 @@ void Parse( */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - + break; #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -3424,10 +3802,10 @@ void Parse( yypParser->yyerrcnt = -1; #endif } - yymajor = YYNOCODE; + break; #endif } - }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); + }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; @@ -3442,3 +3820,17 @@ void Parse( #endif return; } + +/* +** Return the fallback token corresponding to canonical token iToken, or +** 0 if iToken has no fallback. +*/ +int ParseFallback(int iToken){ +#ifdef YYFALLBACK + assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); + return yyFallback[iToken]; +#else + (void)iToken; + return 0; +#endif +} diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index ea15ced8983206809190c70d3f94f1be2d4c67ac..7026fcda0f156c9edc6fb17dd192aae88e3042a3 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -218,7 +218,8 @@ static SKeyword keywordTable[] = { {"DISTINCT", TK_DISTINCT}, {"PARTITIONS", TK_PARTITIONS}, {"TOPIC", TK_TOPIC}, - {"TOPICS", TK_TOPICS} + {"TOPICS", TK_TOPICS}, + {"MODIFY", TK_MODIFY} }; static const char isIdChar[] = { diff --git a/tests/pytest/alter/alter_keep_exception.py b/tests/pytest/alter/alter_keep_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..cddaaa55222785df81aa4c88b75733083d06be72 --- /dev/null +++ b/tests/pytest/alter/alter_keep_exception.py @@ -0,0 +1,44 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +#TODO: after TD-4518 and TD-4510 is resolved, add the exception test case for these situations + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdSql.error('alter database keep db 0') + tdSql.error('alter database keep db -10') + tdSql.error('alter database keep db -2147483648') + + #this is the test case problem for keep overflow + #the error is caught, but type is wrong. + #TODO: can be solved in the future, but improvement is minimal + tdSql.error('alter database keep db -2147483649') + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 19bc5e9cf920344a1caeebadcc7f0a62c853d50e..5e4f57e1a2db5984c13fafc8f8a046403914c900 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -314,6 +314,8 @@ python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f account/account_create.py python3 ./test.py -f alter/alter_table.py python3 ./test.py -f query/queryGroupbySort.py +python3 ./test.py -f functions/function_session.py +python3 ./test.py -f functions/function_stateWindow.py python3 ./test.py -f insert/unsignedInt.py python3 ./test.py -f insert/unsignedBigint.py @@ -337,4 +339,5 @@ python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 ./test.py -f tag_lite/drop_auto_create.py python3 test.py -f insert/insert_before_use_db.py python3 test.py -f alter/alter_cacheLastRow.py +python3 test.py -f alter/alter_keep_exception.py #======================p4-end=============== diff --git a/tests/pytest/functions/function_session.py b/tests/pytest/functions/function_session.py new file mode 100644 index 0000000000000000000000000000000000000000..21b6d088ffd45c3a0e1b867335b8a36d834b93cc --- /dev/null +++ b/tests/pytest/functions/function_session.py @@ -0,0 +1,86 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import * +from util.cases import * +from util.sql import * +#import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + tdSql.execute("create table test1 using test tags('beijing')") + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + # operation not allowed on super table + tdSql.error("select count(*) from test session(ts, 1s)") + # operation not allowde on col pro + tdSql.error("select * from test1 session(ts, 1s)") + # operation not allowed on col except primary ts + tdSql.error("select * from test1 session(col1, 1s)") + + tdSql.query("select count(*) from test1 session(ts, 1s)") + + tdSql.checkRows(1) + tdSql.checkData(0, 1, 10) + # append more data + + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + 2000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + tdSql.query("select count(*) from test1 session(ts, 1s)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 10) + tdSql.checkData(1, 1, 1) + + tdSql.query("select count(*) from test1 session(ts, 1m)") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 11) + + tdSql.query("select first(col1) from test1 session(ts, 1s)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 1) + + + tdSql.query("select first(col1), last(col2) from test1 session(ts, 1s)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 10) + tdSql.checkData(1, 1, 1) + tdSql.checkData(1, 1, 1) + + # add more function + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_stateWindow.py b/tests/pytest/functions/function_stateWindow.py new file mode 100644 index 0000000000000000000000000000000000000000..8f05b321643516f6701db23965278de17f3ca1e9 --- /dev/null +++ b/tests/pytest/functions/function_stateWindow.py @@ -0,0 +1,109 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import * +from util.cases import * +from util.sql import * +#import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + tdSql.execute("create table test1 using test tags('beijing')") + col0 = 0 + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + i, col0, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + # operation not allowed on super table + tdSql.error("select count(*) from test session(ts, 1s)") + # operation not allowde on col pro + tdSql.error("select * from test1 session(ts, 1s)") + # operation not allowed on col except primary ts + tdSql.error("select * from test1 session(col1, 1s)") + + tdSql.query("select count(*) from test1 state_window(col1)") + + tdSql.checkRows(1) + tdSql.checkData(0, 0, self.rowNum) + # append more data + + col0 = col0 + 1 + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + i + 10000, col0, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + tdSql.query("select count(*) from test1 state_window(col1)") + + tdSql.checkRows(2) + tdSql.checkData(0, 0, self.rowNum) + tdSql.checkData(1, 0, self.rowNum) + + + tdSql.query("select first(col1) from test1 state_window(col1)") + tdSql.checkRows(2) + col0 = col0 - 1 + tdSql.checkData(0, 0, col0) + col0 = col0 + 1 + tdSql.checkData(1, 0, col0) + + tdSql.query("select first(col2) from test1 state_window(col1)") + tdSql.checkRows(2) + tdSql.checkData(0, 0, 1) + tdSql.checkData(1, 0, 1) + + tdSql.query("select count(col1), first(col2) from test1 state_window(col1)") + tdSql.checkRows(2) + tdSql.checkData(0, 0, 10) + tdSql.checkData(0, 1, 1) + + tdSql.checkData(1, 0, 10) + tdSql.checkData(1, 1, 1) + + + #tdSql.query("select count(*) from test1 session(ts, 1m)") + #tdSql.checkRows(1) + #tdSql.checkData(0, 1, 11) + + #tdSql.query("select first(col1) from test1 session(ts, 1s)") + #tdSql.checkRows(2) + #tdSql.checkData(0, 1, 1) + #tdSql.checkData(1, 1, 1) + + #tdSql.query("select first(col1), last(col2) from test1 session(ts, 1s)") + #tdSql.checkRows(2) + #tdSql.checkData(0, 1, 1) + #tdSql.checkData(0, 2, 10) + #tdSql.checkData(1, 1, 1) + #tdSql.checkData(1, 1, 1) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/manualTest/manual_alter_block.py b/tests/pytest/manualTest/manual_alter_block.py new file mode 100644 index 0000000000000000000000000000000000000000..ccd98b1421400a765d85a35cf3a0b13b15f35f8e --- /dev/null +++ b/tests/pytest/manualTest/manual_alter_block.py @@ -0,0 +1,82 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes + +##TODO: auto test version is currently unsupported, need to come up with +# an auto test version in the future +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + #alter cache block to 3, then check alter + tdSql.execute('alter database db blocks 3') + tdSql.query('show databases') + tdSql.checkData(0,9,3) + + #run taosdemo to occupy all cache, need to manually check memory consumption + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + input("please check memory usage for taosd. After checking, press enter") + + #alter cache block to 8, then check alter + tdSql.execute('alter database db blocks 8') + tdSql.query('show databases') + tdSql.checkData(0,9,8) + + #run taosdemo to occupy all cache, need to manually check memory consumption + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block2.json" % binPath) + input("please check memory usage for taosd. After checking, press enter") + + ##expected result the peak memory consumption should increase by around 80MB = 5 blocks of cache + + ##test results + #2021/06/02 before:2621700K after: 2703640K memory usage increased by 80MB = 5 block + # confirm with the change in block. Baosheng Chang + + def stop(self): + tdSql.close() + tdLog.debug("%s alter block manual check finish" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/manualTest/manual_alter_comp.py b/tests/pytest/manualTest/manual_alter_comp.py new file mode 100644 index 0000000000000000000000000000000000000000..6c3e0fc29606caae32b981c662daaacbd31b15be --- /dev/null +++ b/tests/pytest/manualTest/manual_alter_comp.py @@ -0,0 +1,126 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes + +##TODO: auto test version is currently unsupported, need to come up with +# an auto test version in the future +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getRootPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + print(selfPath) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + print(projPath) + else: + projPath = selfPath[:selfPath.find("tests")] + print("test" + projPath) + + for root, dirs, files in os.walk(projPath): + if ('data' in dirs and 'sim' in root): + rootPath = root + + return rootPath + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + + + def run(self): + dnodePath = self.getRootPath() + os.system(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + #comp is at 14 + #check disk usage when comp=2 + tdSql.query('show databases') + tdSql.execute('alter database db blocks 3') # minimize the data in cache + tdSql.checkData(0,14,2) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data/vnode") + print('comp = 2') + input("please check disk usage for taosd. After checking, press enter") + + #removing all data file + os.system(f'sudo rm -rf {dnodePath}/data/* {dnodePath}/log/*') + #print(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') #for showing the command ran + input("please check if the pervious data is being deleted. Then, press enter") + + #check disk usage when comp=0 + tdSql.prepare() + tdSql.query('show databases') + tdSql.checkData(0,14,2) + tdSql.execute('alter database db comp 0') + tdSql.query('show databases') + tdSql.checkData(0,14,0) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data") + print('comp = 0') + input("please check disk usage for taosd. After checking, press enter") + + #removing all data file + os.system(f'sudo rm -rf {dnodePath}/data/* {dnodePath}/log/*') + #print(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') #for showing the command ran + input("please check if the pervious data is being deleted. Then, press enter") + + #check disk usage when comp=1 + tdSql.prepare() + tdSql.query('show databases') + tdSql.checkData(0,14,2) + tdSql.execute('alter database db comp 1') + tdSql.query('show databases') + tdSql.checkData(0,14,1) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data") + print('comp = 1') + input("please check disk usage for taosd. After checking, press enter") + + ##test result + # 2021/06/02 comp=2:13M comp=1:57M comp=0:399M. Test past + # each row entered is identical Tester - Baosheng Chang + + def stop(self): + tdSql.close() + tdLog.debug("%s alter block manual check finish" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/queryInsertValue.py b/tests/pytest/query/queryInsertValue.py index 856801b4ee162a35e1e4e4b864860180960a1432..a6b2a88008a8f61a910b5bc6dfa7e41433da1758 100644 --- a/tests/pytest/query/queryInsertValue.py +++ b/tests/pytest/query/queryInsertValue.py @@ -45,7 +45,7 @@ class TDTestCase: tdSql.query("select * from st") tdSql.checkRows(1) - tdSql.execute("alter table st add column length int") + tdSql.execute("alter table st add column len int") tdSql.execute("insert into t1 values(now, 1, 2)") tdSql.query("select last(*) from st") tdSql.checkData(0, 2, 2); diff --git a/tests/pytest/query/queryJoin.py b/tests/pytest/query/queryJoin.py index 59e01615b40d423f53e9b9b493d51277e15ff797..cd50a7bf452966306e6811e90802d9d160bfa68b 100644 --- a/tests/pytest/query/queryJoin.py +++ b/tests/pytest/query/queryJoin.py @@ -176,7 +176,15 @@ class TDTestCase: tdSql.error("select count(join_mt0.c1), first(join_mt0.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2 order by join_mt0.t1 desc slimit 3") tdSql.error("select count(join_mt0.c1), first(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2, join_mt1.t1 order by join_mt0.ts desc, join_mt1.ts asc limit 10;") tdSql.error("select join_mt1.c1,join_mt0.c1 from join_mt1,join_mt0 where join_mt1.ts = join_mt0.ts and join_mt1.t1 = join_mt0.t1 order by t") - + #TD-4458 join on database which using precision us + tdSql.execute("create database test_join_us precision 'us'") + tdSql.execute("use test_join_us") + ts = 1538548685000000 + for i in range(2): + tdSql.execute("create table t%d (ts timestamp, i int)"%i) + tdSql.execute("insert into t%d values(%d,11)(%d,12)"%(i,ts,ts+1)) + tdSql.query("select t1.ts from t0,t1 where t0.ts = t1.ts") + tdSql.checkData(0,0,'2018-10-03 14:38:05.000000') def stop(self): tdSql.close() diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json new file mode 100644 index 0000000000000000000000000000000000000000..3ac8882699b11e62aa7486b6076f99b1c5b005d2 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json new file mode 100644 index 0000000000000000000000000000000000000000..ffa1c91b82db978bc14392126edbf6972bcf2481 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json new file mode 100644 index 0000000000000000000000000000000000000000..a6ac674dd724db8647671114b8eb5290a0803044 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 32766, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 3, + "precision": "ms", + "keep": 3650, + "minRows": 1000, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 500, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rows": 10000, + "childtable_limit": 10, + "childtable_offset":100, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2019-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/manual_block2.json b/tests/pytest/tools/taosdemoAllTest/manual_block2.json new file mode 100644 index 0000000000000000000000000000000000000000..434159159b4dfe942af1c334fd9520d81214e6cb --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/manual_block2.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 32766, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "childtable_count": 500, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100000, + "childtable_limit": 500, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 5ecc4d70b293e131ae5037c3e1bc556f9e933a19..638a9c49b9b8cfe0864e4a158d3bb9ffe0b7985f 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -238,10 +238,12 @@ class TDTestCase: tdSql.execute("use dbtest123") tdSql.query("select col2 from stb0") tdSql.checkData(0, 0, 2147483647) - tdSql.query("select t1 from stb1") - tdSql.checkData(0, 0, -127) - tdSql.query("select t2 from stb1") - tdSql.checkData(1, 0, 126) + tdSql.query("select * from stb1 where t1=-127") + tdSql.checkRows(20) + tdSql.query("select * from stb1 where t2=127") + tdSql.checkRows(10) + tdSql.query("select * from stb1 where t2=126") + tdSql.checkRows(10) # insert: test interlace parament os.system("%staosdemo -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath) @@ -252,6 +254,42 @@ class TDTestCase: tdSql.checkData(0, 0, 15000) + # # insert: auto_create + + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json " % binPath) # drop = no, child_table_exists, auto_create_table varies + tdSql.execute('use db') + tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(0) + tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(0) + tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(0) + + tdSql.execute('drop database if exists db') + os.system("%staosdemo -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies + tdSql.execute('use db') + tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(20) + os.system("rm -rf ./insert_res.txt") os.system("rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql") diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim index 170ba21c28b7ff4a79a8f2375dc1d36ba91e6120..c3bb23855fceb877c1ed39c01524231d27edb4f4 100644 --- a/tests/script/general/db/alter_option.sim +++ b/tests/script/general/db/alter_option.sim @@ -129,8 +129,8 @@ sql alter database db keep 20 sql_error alter database db keep 10 sql_error alter database db keep 9 sql_error alter database db keep 1 -sql alter database db keep 0 -sql alter database db keep -1 +sql_error alter database db keep 0 +sql_error alter database db keep -1 sql_error alter database db keep 365001 print ============== step cache diff --git a/tests/script/general/db/topic1.sim b/tests/script/general/db/topic1.sim index 42613405afda7580003f58ae82f950880d60de62..2b4cce5e64bf7076eeb2f0f0e3c1dfbaa224b116 100644 --- a/tests/script/general/db/topic1.sim +++ b/tests/script/general/db/topic1.sim @@ -385,8 +385,8 @@ sql alter database db keep 20 sql_error alter database db keep 10 sql_error alter database db keep 9 sql_error alter database db keep 1 -sql alter database db keep 0 -sql alter database db keep -1 +sql_error alter database db keep 0 +sql_error alter database db keep -1 sql_error alter database db keep 365001 sql_error alter topic db keep 40 diff --git a/tests/script/general/parser/alter_column.sim b/tests/script/general/parser/alter_column.sim new file mode 100644 index 0000000000000000000000000000000000000000..fe109352d12ba42a5c9fe318766764a850132abf --- /dev/null +++ b/tests/script/general/parser/alter_column.sim @@ -0,0 +1,118 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/exec.sh -n dnode1 -s start +sleep 100 +sql connect + +$dbPrefix = m_alt_db +$tbPrefix = m_alt_tb +$mtPrefix = m_alt_mt +$tbNum = 10 +$rowNum = 5 +$totalNum = $tbNum * $rowNum +$ts0 = 1537146000000 +$delta = 600000 +print ========== alter.sim +$i = 0 +$db = $dbPrefix . $i +$mt = $mtPrefix . $i + +sql drop database if exists $db +sql create database $db +sql use $db +##### alter table test, simeplest case +sql create table tb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) +sql insert into tb values (now, 1, "1", "1") +sql alter table tb modify column c2 binary(20); +if $rows != 0 then + return -1 +endi +sql alter table tb modify column c3 nchar(20); +if $rows != 0 then + return -1 +endi + + +sql create stable stb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) tags(id1 int, id2 binary(10), id3 nchar(10)) +sql create table tb1 using stb tags(1, "a", "b") +sql insert into tb1 values (now, 1, "1", "1") +sql alter stable stb modify column c2 binary(20); +if $rows != 0 then + return -1 +endi +sql alter table stb modify column c2 binary(30); +if $rows != 0 then + return -1 +endi +sql alter stable stb modify column c3 nchar(20); +if $rows != 0 then + return -1 +endi +sql alter table stb modify column c3 nchar(30); +if $rows != 0 then + return -1 +endi + +sql alter table stb modify tag id2 binary(11); +if $rows != 0 then + return -1 +endi +sql alter stable stb modify tag id2 binary(11); +if $rows != 0 then + return -1 +endi +sql alter table stb modify tag id3 nchar(11); +if $rows != 0 then + return -1 +endi +sql alter stable stb modify tag id3 nchar(11); +if $rows != 0 then + return -1 +endi + +##### ILLEGAL OPERATIONS + +# try dropping columns that are defined in metric +sql_error alter table tb modify column c1 binary(10); +sql_error alter table tb modify column c1 double; +sql_error alter table tb modify column c2 int; +sql_error alter table tb modify column c2 binary(10); +sql_error alter table tb modify column c2 binary(9); +sql_error alter table tb modify column c2 binary(-9); +sql_error alter table tb modify column c2 binary(0); +sql_error alter table tb modify column c2 binary(17000); +sql_error alter table tb modify column c2 nchar(30); +sql_error alter table tb modify column c3 double; +sql_error alter table tb modify column c3 nchar(10); +sql_error alter table tb modify column c3 nchar(0); +sql_error alter table tb modify column c3 nchar(-1); +sql_error alter table tb modify column c3 binary(80); +sql_error alter table tb modify column c3 nchar(17000); +sql_error alter table tb modify column c3 nchar(100), c2 binary(30); +sql_error alter table tb modify column c1 nchar(100), c2 binary(30); +sql_error alter stable tb modify column c2 binary(30); +sql_error alter table tb modify tag c2 binary(30); +sql_error alter table stb modify tag id2 binary(10); +sql_error alter table stb modify tag id2 nchar(30); +sql_error alter stable stb modify tag id2 binary(10); +sql_error alter stable stb modify tag id2 nchar(30); +sql_error alter table stb modify tag id3 nchar(10); +sql_error alter table stb modify tag id3 binary(30); +sql_error alter stable stb modify tag id3 nchar(10); +sql_error alter stable stb modify tag id3 binary(30); +sql_error alter stable stb modify tag id1 binary(30); +sql_error alter stable stb modify tag c1 binary(30); + + +sql_error alter table tb1 modify column c2 binary(30); +sql_error alter table tb1 modify column c3 nchar(30); +sql_error alter table tb1 modify tag id2 binary(30); +sql_error alter table tb1 modify tag id3 nchar(30); +sql_error alter stable tb1 modify tag id2 binary(30); +sql_error alter stable tb1 modify tag id3 nchar(30); +sql_error alter stable tb1 modify column c2 binary(30); + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/test-all.sh b/tests/test-all.sh index 47e5de6aa0bd9821f6c30ba0dce6c03952f0a8a6..6e7963e787ca8a3593418be1af31bdbca58d6fd3 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -233,6 +233,10 @@ totalExampleFailed=0 if [ "${OS}" == "Linux" ]; then corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern` + if [ -z "$corepath" ];then + echo "/coredump/core_%e_%p_%t" > /proc/sys/kernel/core_pattern || echo "Permission denied" + corepath="/coredump/" + fi fi if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then