diff --git a/cmake/cmake.define b/cmake/cmake.define index e34785cba6..7410c92525 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -123,21 +123,37 @@ ELSE () SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k") ENDIF () - IF (TD_INTEL_64 OR TD_INTEL_32) - ADD_DEFINITIONS("-msse4.2") - IF("${FMA_SUPPORT}" MATCHES "true") - MESSAGE(STATUS "fma function supported") - ADD_DEFINITIONS("-mfma") - ELSE () - MESSAGE(STATUS "fma function NOT supported") - ENDIF() + INCLUDE(CheckCCompilerFlag) + IF (("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "AppleClang")) + SET(COMPILER_SUPPORT_SSE42 true) + MESSAGE(STATUS "Always enable sse4.2 for Clang/AppleClang") + ELSE() + CHECK_C_COMPILER_FLAG("-msse4.2" COMPILER_SUPPORT_SSE42) + ENDIF() - IF("${SIMD_SUPPORT}" MATCHES "true") - ADD_DEFINITIONS("-mavx -mavx2") - MESSAGE(STATUS "SIMD instructions (AVX/AVX2) is ACTIVATED") - ELSE() - MESSAGE(STATUS "SIMD instruction (AVX/AVX2)is NOT ACTIVATED") + CHECK_C_COMPILER_FLAG("-mfma" COMPILER_SUPPORT_FMA) + CHECK_C_COMPILER_FLAG("-mavx" COMPILER_SUPPORT_AVX) + CHECK_C_COMPILER_FLAG("-mavx2" COMPILER_SUPPORT_AVX2) + + IF (COMPILER_SUPPORT_SSE42) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") + ENDIF() + IF (COMPILER_SUPPORT_FMA) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") + ENDIF() + + IF ("${SIMD_SUPPORT}" MATCHES "true") + IF (COMPILER_SUPPORT_AVX) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") ENDIF() - ENDIF () + IF (COMPILER_SUPPORT_AVX2) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2") + ENDIF() + MESSAGE(STATUS "SIMD instructions (AVX/AVX2) is ACTIVATED") + ENDIF() ENDIF () diff --git a/cmake/cmake.platform b/cmake/cmake.platform index 711d74fa4c..a4bfcaf609 100644 --- a/cmake/cmake.platform +++ b/cmake/cmake.platform @@ -147,7 +147,7 @@ ELSE () ENDIF () ENDIF () -MESSAGE(STATUS "platform arch:" ${PLATFORM_ARCH_STR}) +MESSAGE(STATUS "Platform arch:" ${PLATFORM_ARCH_STR}) MESSAGE("C Compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID}, ${CMAKE_C_COMPILER_VERSION})") MESSAGE("CXX Compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_C_COMPILER_ID}, ${CMAKE_CXX_COMPILER_VERSION})") diff --git a/cmake/cmake.version b/cmake/cmake.version index 9faa7c75dd..b4084bd095 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.1.8") + SET(TD_VER_NUMBER "3.0.2.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index d702b9967e..75679a8ff5 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG 0dfad5b + GIT_TAG 566540d SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 4abd9e86a6..7247200fe7 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG ac69142 + GIT_TAG 4a4027c SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/docs/en/20-third-party/11-kafka.md b/docs/en/20-third-party/11-kafka.md index 6720af8bf8..3e8f7c295d 100644 --- a/docs/en/20-third-party/11-kafka.md +++ b/docs/en/20-third-party/11-kafka.md @@ -76,7 +76,7 @@ Development: false ### Install from source code ``` -git clone https://github.com:taosdata/kafka-connect-tdengine.git +git clone https://github.com/taosdata/kafka-connect-tdengine.git cd kafka-connect-tdengine mvn clean package unzip -d $CONFLUENT_HOME/share/java/ target/components/packages/taosdata-kafka-connect-tdengine-*.zip diff --git a/docs/zh/20-third-party/11-kafka.md b/docs/zh/20-third-party/11-kafka.md index 1172f4fbc5..cc2247f25e 100644 --- a/docs/zh/20-third-party/11-kafka.md +++ b/docs/zh/20-third-party/11-kafka.md @@ -79,7 +79,7 @@ Development: false ### 从源码安装 ``` -git clone https://github.com:taosdata/kafka-connect-tdengine.git +git clone https://github.com/taosdata/kafka-connect-tdengine.git cd kafka-connect-tdengine mvn clean package unzip -d $CONFLUENT_HOME/share/java/ target/components/packages/taosdata-kafka-connect-tdengine-*.zip diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt index 37edc739e4..e14c4e60d9 100644 --- a/examples/c/CMakeLists.txt +++ b/examples/c/CMakeLists.txt @@ -3,19 +3,13 @@ PROJECT(TDengine) IF (TD_LINUX) INCLUDE_DIRECTORIES(. ${TD_SOURCE_DIR}/src/inc ${TD_SOURCE_DIR}/src/client/inc ${TD_SOURCE_DIR}/inc) AUX_SOURCE_DIRECTORY(. SRC) - # ADD_EXECUTABLE(demo apitest.c) - #TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread ) - #ADD_EXECUTABLE(sml schemaless.c) - #TARGET_LINK_LIBRARIES(sml taos_static trpc tutil pthread ) - #ADD_EXECUTABLE(subscribe subscribe.c) - #TARGET_LINK_LIBRARIES(subscribe taos_static trpc tutil pthread ) - #ADD_EXECUTABLE(epoll epoll.c) - #TARGET_LINK_LIBRARIES(epoll taos_static trpc tutil pthread lua) add_executable(tmq "") add_executable(stream_demo "") - add_executable(demoapi "") - add_executable(api_reqid "") + add_executable(schemaless "") + add_executable(prepare "") + add_executable(demo "") + add_executable(asyncdemo "") target_sources(tmq PRIVATE @@ -27,16 +21,25 @@ IF (TD_LINUX) "stream_demo.c" ) - target_sources(demoapi + target_sources(schemaless PRIVATE - "demoapi.c" + "schemaless.c" ) - target_sources(api_reqid + target_sources(prepare PRIVATE - "api_with_reqid_test.c" + "prepare.c" ) + target_sources(demo + PRIVATE + "demo.c" + ) + + target_sources(asyncdemo + PRIVATE + "asyncdemo.c" + ) target_link_libraries(tmq taos_static @@ -46,46 +49,30 @@ IF (TD_LINUX) taos_static ) - target_link_libraries(demoapi + target_link_libraries(schemaless taos_static ) - target_link_libraries(api_reqid + target_link_libraries(prepare taos_static ) - - target_include_directories(tmq - PUBLIC "${TD_SOURCE_DIR}/include/os" - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" + target_link_libraries(demo + taos_static ) - target_include_directories(stream_demo - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" - ) - - target_include_directories(demoapi - PUBLIC "${TD_SOURCE_DIR}/include/client" - PUBLIC "${TD_SOURCE_DIR}/include/os" - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" - ) - - target_include_directories(api_reqid - PUBLIC "${TD_SOURCE_DIR}/include/client" - PUBLIC "${TD_SOURCE_DIR}/include/os" - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" + target_link_libraries(asyncdemo + taos_static ) SET_TARGET_PROPERTIES(tmq PROPERTIES OUTPUT_NAME tmq) SET_TARGET_PROPERTIES(stream_demo PROPERTIES OUTPUT_NAME stream_demo) - SET_TARGET_PROPERTIES(demoapi PROPERTIES OUTPUT_NAME demoapi) - SET_TARGET_PROPERTIES(api_reqid PROPERTIES OUTPUT_NAME api_reqid) + SET_TARGET_PROPERTIES(schemaless PROPERTIES OUTPUT_NAME schemaless) + SET_TARGET_PROPERTIES(prepare PROPERTIES OUTPUT_NAME prepare) + SET_TARGET_PROPERTIES(demo PROPERTIES OUTPUT_NAME demo) + SET_TARGET_PROPERTIES(asyncdemo PROPERTIES OUTPUT_NAME asyncdemo) ENDIF () IF (TD_DARWIN) INCLUDE_DIRECTORIES(. ${TD_SOURCE_DIR}/src/inc ${TD_SOURCE_DIR}/src/client/inc ${TD_SOURCE_DIR}/inc) AUX_SOURCE_DIRECTORY(. SRC) - #ADD_EXECUTABLE(demo demo.c) - #TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread lua) - #ADD_EXECUTABLE(epoll epoll.c) - #TARGET_LINK_LIBRARIES(epoll taos_static trpc tutil pthread lua) ENDIF () diff --git a/examples/c/apitest.c b/examples/c/apitest.c deleted file mode 100644 index c179acaf4e..0000000000 --- a/examples/c/apitest.c +++ /dev/null @@ -1,1948 +0,0 @@ -// sample code to verify all TDengine API -// to compile: gcc -o apitest apitest.c -ltaos - -#include "cJSON.h" -#include "taoserror.h" - -#include -#include -#include -#include -#include "../../../include/client/taos.h" - -static void prepare_data(TAOS* taos) { - TAOS_RES* result; - result = taos_query(taos, "drop database if exists test;"); - taos_free_result(result); - usleep(100000); - result = taos_query(taos, "create database test precision 'us';"); - taos_free_result(result); - usleep(100000); - taos_select_db(taos, "test"); - - result = taos_query(taos, "create table meters(ts timestamp, a int) tags(area int);"); - taos_free_result(result); - - result = taos_query(taos, "create table t0 using meters tags(0);"); - taos_free_result(result); - result = taos_query(taos, "create table t1 using meters tags(1);"); - taos_free_result(result); - result = taos_query(taos, "create table t2 using meters tags(2);"); - taos_free_result(result); - result = taos_query(taos, "create table t3 using meters tags(3);"); - taos_free_result(result); - result = taos_query(taos, "create table t4 using meters tags(4);"); - taos_free_result(result); - result = taos_query(taos, "create table t5 using meters tags(5);"); - taos_free_result(result); - result = taos_query(taos, "create table t6 using meters tags(6);"); - taos_free_result(result); - result = taos_query(taos, "create table t7 using meters tags(7);"); - taos_free_result(result); - result = taos_query(taos, "create table t8 using meters tags(8);"); - taos_free_result(result); - result = taos_query(taos, "create table t9 using meters tags(9);"); - taos_free_result(result); - - result = taos_query(taos, - "insert into t0 values('2020-01-01 00:00:00.000', 0)" - " ('2020-01-01 00:01:00.000', 0)" - " ('2020-01-01 00:02:00.000', 0)" - " t1 values('2020-01-01 00:00:00.000', 0)" - " ('2020-01-01 00:01:00.000', 0)" - " ('2020-01-01 00:02:00.000', 0)" - " ('2020-01-01 00:03:00.000', 0)" - " t2 values('2020-01-01 00:00:00.000', 0)" - " ('2020-01-01 00:01:00.000', 0)" - " ('2020-01-01 00:01:01.000', 0)" - " ('2020-01-01 00:01:02.000', 0)" - " t3 values('2020-01-01 00:01:02.000', 0)" - " t4 values('2020-01-01 00:01:02.000', 0)" - " t5 values('2020-01-01 00:01:02.000', 0)" - " t6 values('2020-01-01 00:01:02.000', 0)" - " t7 values('2020-01-01 00:01:02.000', 0)" - " t8 values('2020-01-01 00:01:02.000', 0)" - " t9 values('2020-01-01 00:01:02.000', 0)"); - int affected = taos_affected_rows(result); - if (affected != 18) { - printf("\033[31m%d rows affected by last insert statement, but it should be 18\033[0m\n", affected); - } - taos_free_result(result); - // super tables subscription - usleep(1000000); -} - -static int print_result(TAOS_RES* res, int blockFetch) { - TAOS_ROW row = NULL; - int num_fields = taos_num_fields(res); - TAOS_FIELD* fields = taos_fetch_fields(res); - int nRows = 0; - - if (blockFetch) { - int rows = 0; - while ((rows = taos_fetch_block(res, &row))) { - // for (int i = 0; i < rows; i++) { - // char temp[256]; - // taos_print_row(temp, row + i, fields, num_fields); - // puts(temp); - // } - nRows += rows; - } - } else { - while ((row = taos_fetch_row(res))) { - char temp[256] = {0}; - taos_print_row(temp, row, fields, num_fields); - puts(temp); - nRows++; - } - } - - printf("%d rows consumed.\n", nRows); - return nRows; -} - -static void check_row_count(int line, TAOS_RES* res, int expected) { - int actual = print_result(res, expected % 2); - if (actual != expected) { - printf("\033[31mline %d: row count mismatch, expected: %d, actual: %d\033[0m\n", line, expected, actual); - } else { - printf("line %d: %d rows consumed as expected\n", line, actual); - } -} - -static void verify_query(TAOS* taos) { - prepare_data(taos); - - int code = taos_load_table_info(taos, "t0,t1,t2,t3,t4,t5,t6,t7,t8,t9"); - if (code != 0) { - printf("\033[31mfailed to load table info: 0x%08x\033[0m\n", code); - } - - code = taos_validate_sql(taos, "select * from nonexisttable"); - if (code == 0) { - printf("\033[31mimpossible, the table does not exists\033[0m\n"); - } - - code = taos_validate_sql(taos, "select * from meters"); - if (code != 0) { - printf("\033[31mimpossible, the table does exists: 0x%08x\033[0m\n", code); - } - - TAOS_RES* res = taos_query_with_reqid(taos, "select * from meters", genReqid()); - check_row_count(__LINE__, res, 18); - printf("result precision is: %d\n", taos_result_precision(res)); - int c = taos_field_count(res); - printf("field count is: %d\n", c); - int* lengths = taos_fetch_lengths(res); - for (int i = 0; i < c; i++) { - printf("length of column %d is %d\n", i, lengths[i]); - } - taos_free_result(res); - - res = taos_query_with_reqid(taos, "select * from t0", genReqid()); - check_row_count(__LINE__, res, 3); - taos_free_result(res); - - res = taos_query_with_reqid(taos, "select * from nonexisttable", genReqid()); - code = taos_errno(res); - printf("code=%d, error msg=%s\n", code, taos_errstr(res)); - taos_free_result(res); - - res = taos_query_with_reqid(taos, "select * from meters", genReqid()); - taos_stop_query(res); - taos_free_result(res); -} - -void subscribe_callback(TAOS_SUB* tsub, TAOS_RES* res, void* param, int code) { - int rows = print_result(res, *(int*)param); - printf("%d rows consumed in subscribe_callback\n", rows); -} - -static void verify_subscribe(TAOS* taos) { - prepare_data(taos); - - TAOS_SUB* tsub = taos_subscribe(taos, 0, "test", "select * from meters;", NULL, NULL, 0); - TAOS_RES* res = taos_consume(tsub); - check_row_count(__LINE__, res, 18); - - res = taos_consume(tsub); - check_row_count(__LINE__, res, 0); - - TAOS_RES* result; - result = taos_query(taos, "insert into t0 values('2020-01-01 00:02:00.001', 0);"); - taos_free_result(result); - result = taos_query(taos, "insert into t8 values('2020-01-01 00:01:03.000', 0);"); - taos_free_result(result); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 2); - - result = taos_query(taos, "insert into t2 values('2020-01-01 00:01:02.001', 0);"); - taos_free_result(result); - result = taos_query(taos, "insert into t1 values('2020-01-01 00:03:00.001', 0);"); - taos_free_result(result); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 2); - - result = taos_query(taos, "insert into t1 values('2020-01-01 00:03:00.002', 0);"); - taos_free_result(result); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 1); - - // keep progress information and restart subscription - taos_unsubscribe(tsub, 1); - result = taos_query(taos, "insert into t0 values('2020-01-01 00:04:00.000', 0);"); - taos_free_result(result); - tsub = taos_subscribe(taos, 1, "test", "select * from meters;", NULL, NULL, 0); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 24); - - // keep progress information and continue previous subscription - taos_unsubscribe(tsub, 1); - tsub = taos_subscribe(taos, 0, "test", "select * from meters;", NULL, NULL, 0); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 0); - - // don't keep progress information and continue previous subscription - taos_unsubscribe(tsub, 0); - tsub = taos_subscribe(taos, 0, "test", "select * from meters;", NULL, NULL, 0); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 24); - - // single meter subscription - - taos_unsubscribe(tsub, 0); - tsub = taos_subscribe(taos, 0, "test", "select * from t0;", NULL, NULL, 0); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 5); - - res = taos_consume(tsub); - check_row_count(__LINE__, res, 0); - - result = taos_query(taos, "insert into t0 values('2020-01-01 00:04:00.001', 0);"); - taos_free_result(result); - res = taos_consume(tsub); - check_row_count(__LINE__, res, 1); - - taos_unsubscribe(tsub, 0); - - int blockFetch = 0; - tsub = taos_subscribe(taos, 1, "test", "select * from meters;", subscribe_callback, &blockFetch, 1000); - usleep(2000000); - result = taos_query(taos, "insert into t0 values('2020-01-01 00:05:00.001', 0);"); - taos_free_result(result); - usleep(2000000); - taos_unsubscribe(tsub, 0); -} - -void verify_prepare(TAOS* taos) { - TAOS_RES* result = taos_query(taos, "drop database if exists test;"); - taos_free_result(result); - - usleep(100000); - result = taos_query(taos, "create database test;"); - - int code = taos_errno(result); - if (code != 0) { - printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result)); - taos_free_result(result); - return; - } - - taos_free_result(result); - - usleep(100000); - taos_select_db(taos, "test"); - - // create table - const char* sql = - "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin " - "binary(40), blob nchar(10))"; - result = taos_query_with_reqid(taos, sql, genReqid()); - code = taos_errno(result); - if (code != 0) { - printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result)); - taos_free_result(result); - return; - } - taos_free_result(result); - - // insert 10 records - struct { - int64_t ts; - int8_t b; - int8_t v1; - int16_t v2; - int32_t v4; - int64_t v8; - float f4; - double f8; - char bin[40]; - char blob[80]; - } v = {0}; - - TAOS_STMT* stmt = taos_stmt_init(taos); - TAOS_BIND params[10]; - params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; - params[0].buffer_length = sizeof(v.ts); - params[0].buffer = &v.ts; - params[0].length = ¶ms[0].buffer_length; - params[0].is_null = NULL; - - params[1].buffer_type = TSDB_DATA_TYPE_BOOL; - params[1].buffer_length = sizeof(v.b); - params[1].buffer = &v.b; - params[1].length = ¶ms[1].buffer_length; - params[1].is_null = NULL; - - params[2].buffer_type = TSDB_DATA_TYPE_TINYINT; - params[2].buffer_length = sizeof(v.v1); - params[2].buffer = &v.v1; - params[2].length = ¶ms[2].buffer_length; - params[2].is_null = NULL; - - params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT; - params[3].buffer_length = sizeof(v.v2); - params[3].buffer = &v.v2; - params[3].length = ¶ms[3].buffer_length; - params[3].is_null = NULL; - - params[4].buffer_type = TSDB_DATA_TYPE_INT; - params[4].buffer_length = sizeof(v.v4); - params[4].buffer = &v.v4; - params[4].length = ¶ms[4].buffer_length; - params[4].is_null = NULL; - - params[5].buffer_type = TSDB_DATA_TYPE_BIGINT; - params[5].buffer_length = sizeof(v.v8); - params[5].buffer = &v.v8; - params[5].length = ¶ms[5].buffer_length; - params[5].is_null = NULL; - - params[6].buffer_type = TSDB_DATA_TYPE_FLOAT; - params[6].buffer_length = sizeof(v.f4); - params[6].buffer = &v.f4; - params[6].length = ¶ms[6].buffer_length; - params[6].is_null = NULL; - - params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE; - params[7].buffer_length = sizeof(v.f8); - params[7].buffer = &v.f8; - params[7].length = ¶ms[7].buffer_length; - params[7].is_null = NULL; - - params[8].buffer_type = TSDB_DATA_TYPE_BINARY; - params[8].buffer_length = sizeof(v.bin); - params[8].buffer = v.bin; - params[8].length = ¶ms[8].buffer_length; - params[8].is_null = NULL; - - strcpy(v.blob, "一二三四五六七八九十"); - params[9].buffer_type = TSDB_DATA_TYPE_NCHAR; - params[9].buffer_length = strlen(v.blob); - params[9].buffer = v.blob; - params[9].length = ¶ms[9].buffer_length; - params[9].is_null = NULL; - - int is_null = 1; - - sql = "insert into m1 values(?,?,?,?,?,?,?,?,?,?)"; - code = taos_stmt_prepare(stmt, sql, 0); - if (code != 0) { - printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - v.ts = 1591060628000; - for (int i = 0; i < 10; ++i) { - v.ts += 1; - for (int j = 1; j < 10; ++j) { - params[j].is_null = ((i == j) ? &is_null : 0); - } - v.b = (int8_t)i % 2; - v.v1 = (int8_t)i; - v.v2 = (int16_t)(i * 2); - v.v4 = (int32_t)(i * 4); - v.v8 = (int64_t)(i * 8); - v.f4 = (float)(i * 40); - v.f8 = (double)(i * 80); - for (int j = 0; j < sizeof(v.bin); ++j) { - v.bin[j] = (char)(i + '0'); - } - - taos_stmt_bind_param(stmt, params); - taos_stmt_add_batch(stmt); - } - if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - taos_stmt_close(stmt); - - // query the records - stmt = taos_stmt_init(taos); - taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0); - v.v1 = 5; - v.v2 = 15; - taos_stmt_bind_param(stmt, params + 2); - if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - result = taos_stmt_use_result(stmt); - - TAOS_ROW row; - int rows = 0; - int num_fields = taos_num_fields(result); - TAOS_FIELD* fields = taos_fetch_fields(result); - - // fetch the records row by row - while ((row = taos_fetch_row(result))) { - char temp[256] = {0}; - rows++; - taos_print_row(temp, row, fields, num_fields); - printf("%s\n", temp); - } - - taos_free_result(result); - taos_stmt_close(stmt); -} - -void verify_prepare2(TAOS* taos) { - TAOS_RES* result = taos_query(taos, "drop database if exists test;"); - taos_free_result(result); - usleep(100000); - result = taos_query(taos, "create database test;"); - - int code = taos_errno(result); - if (code != 0) { - printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result)); - taos_free_result(result); - return; - } - taos_free_result(result); - - usleep(100000); - taos_select_db(taos, "test"); - - // create table - const char* sql = - "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin " - "binary(40), blob nchar(10))"; - result = taos_query(taos, sql); - code = taos_errno(result); - if (code != 0) { - printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result)); - taos_free_result(result); - return; - } - taos_free_result(result); - - // insert 10 records - struct { - int64_t ts[10]; - int8_t b[10]; - int8_t v1[10]; - int16_t v2[10]; - int32_t v4[10]; - int64_t v8[10]; - float f4[10]; - double f8[10]; - char bin[10][40]; - char blob[10][80]; - } v; - - int32_t* t8_len = malloc(sizeof(int32_t) * 10); - int32_t* t16_len = malloc(sizeof(int32_t) * 10); - int32_t* t32_len = malloc(sizeof(int32_t) * 10); - int32_t* t64_len = malloc(sizeof(int32_t) * 10); - int32_t* float_len = malloc(sizeof(int32_t) * 10); - int32_t* double_len = malloc(sizeof(int32_t) * 10); - int32_t* bin_len = malloc(sizeof(int32_t) * 10); - int32_t* blob_len = malloc(sizeof(int32_t) * 10); - - TAOS_STMT* stmt = taos_stmt_init(taos); - TAOS_MULTI_BIND params[10]; - char is_null[10] = {0}; - - params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; - params[0].buffer_length = sizeof(v.ts[0]); - params[0].buffer = v.ts; - params[0].length = t64_len; - params[0].is_null = is_null; - params[0].num = 10; - - params[1].buffer_type = TSDB_DATA_TYPE_BOOL; - params[1].buffer_length = sizeof(v.b[0]); - params[1].buffer = v.b; - params[1].length = t8_len; - params[1].is_null = is_null; - params[1].num = 10; - - params[2].buffer_type = TSDB_DATA_TYPE_TINYINT; - params[2].buffer_length = sizeof(v.v1[0]); - params[2].buffer = v.v1; - params[2].length = t8_len; - params[2].is_null = is_null; - params[2].num = 10; - - params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT; - params[3].buffer_length = sizeof(v.v2[0]); - params[3].buffer = v.v2; - params[3].length = t16_len; - params[3].is_null = is_null; - params[3].num = 10; - - params[4].buffer_type = TSDB_DATA_TYPE_INT; - params[4].buffer_length = sizeof(v.v4[0]); - params[4].buffer = v.v4; - params[4].length = t32_len; - params[4].is_null = is_null; - params[4].num = 10; - - params[5].buffer_type = TSDB_DATA_TYPE_BIGINT; - params[5].buffer_length = sizeof(v.v8[0]); - params[5].buffer = v.v8; - params[5].length = t64_len; - params[5].is_null = is_null; - params[5].num = 10; - - params[6].buffer_type = TSDB_DATA_TYPE_FLOAT; - params[6].buffer_length = sizeof(v.f4[0]); - params[6].buffer = v.f4; - params[6].length = float_len; - params[6].is_null = is_null; - params[6].num = 10; - - params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE; - params[7].buffer_length = sizeof(v.f8[0]); - params[7].buffer = v.f8; - params[7].length = double_len; - params[7].is_null = is_null; - params[7].num = 10; - - params[8].buffer_type = TSDB_DATA_TYPE_BINARY; - params[8].buffer_length = sizeof(v.bin[0]); - params[8].buffer = v.bin; - params[8].length = bin_len; - params[8].is_null = is_null; - params[8].num = 10; - - params[9].buffer_type = TSDB_DATA_TYPE_NCHAR; - params[9].buffer_length = sizeof(v.blob[0]); - params[9].buffer = v.blob; - params[9].length = blob_len; - params[9].is_null = is_null; - params[9].num = 10; - - sql = "insert into ? (ts, b, v1, v2, v4, v8, f4, f8, bin, blob) values(?,?,?,?,?,?,?,?,?,?)"; - code = taos_stmt_prepare(stmt, sql, 0); - if (code != 0) { - printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - code = taos_stmt_set_tbname(stmt, "m1"); - if (code != 0) { - printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - int64_t ts = 1591060628000; - for (int i = 0; i < 10; ++i) { - v.ts[i] = ts++; - is_null[i] = 0; - - v.b[i] = (int8_t)i % 2; - v.v1[i] = (int8_t)i; - v.v2[i] = (int16_t)(i * 2); - v.v4[i] = (int32_t)(i * 4); - v.v8[i] = (int64_t)(i * 8); - v.f4[i] = (float)(i * 40); - v.f8[i] = (double)(i * 80); - for (int j = 0; j < sizeof(v.bin[0]); ++j) { - v.bin[i][j] = (char)(i + '0'); - } - strcpy(v.blob[i], "一二三四五六七八九十"); - - t8_len[i] = sizeof(int8_t); - t16_len[i] = sizeof(int16_t); - t32_len[i] = sizeof(int32_t); - t64_len[i] = sizeof(int64_t); - float_len[i] = sizeof(float); - double_len[i] = sizeof(double); - bin_len[i] = sizeof(v.bin[0]); - blob_len[i] = (int32_t)strlen(v.blob[i]); - } - - taos_stmt_bind_param_batch(stmt, params); - taos_stmt_add_batch(stmt); - - if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - taos_stmt_close(stmt); - - // query the records - stmt = taos_stmt_init(taos); - taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0); - TAOS_BIND qparams[2]; - - int8_t v1 = 5; - int16_t v2 = 15; - qparams[0].buffer_type = TSDB_DATA_TYPE_TINYINT; - qparams[0].buffer_length = sizeof(v1); - qparams[0].buffer = &v1; - qparams[0].length = &qparams[0].buffer_length; - qparams[0].is_null = NULL; - - qparams[1].buffer_type = TSDB_DATA_TYPE_SMALLINT; - qparams[1].buffer_length = sizeof(v2); - qparams[1].buffer = &v2; - qparams[1].length = &qparams[1].buffer_length; - qparams[1].is_null = NULL; - - taos_stmt_bind_param(stmt, qparams); - if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - result = taos_stmt_use_result(stmt); - - TAOS_ROW row; - int rows = 0; - int num_fields = taos_num_fields(result); - TAOS_FIELD* fields = taos_fetch_fields(result); - - // fetch the records row by row - while ((row = taos_fetch_row(result))) { - char temp[256] = {0}; - rows++; - taos_print_row(temp, row, fields, num_fields); - printf("%s\n", temp); - } - - taos_free_result(result); - taos_stmt_close(stmt); - - free(t8_len); - free(t16_len); - free(t32_len); - free(t64_len); - free(float_len); - free(double_len); - free(bin_len); - free(blob_len); -} - -void verify_prepare3(TAOS* taos) { - TAOS_RES* result = taos_query(taos, "drop database if exists test;"); - taos_free_result(result); - usleep(100000); - result = taos_query(taos, "create database test;"); - - int code = taos_errno(result); - if (code != 0) { - printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result)); - taos_free_result(result); - return; - } - taos_free_result(result); - - usleep(100000); - taos_select_db(taos, "test"); - - // create table - const char* sql = - "create stable st1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin " - "binary(40), blob nchar(10)) tags (id1 int, id2 binary(40))"; - result = taos_query(taos, sql); - code = taos_errno(result); - if (code != 0) { - printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result)); - taos_free_result(result); - return; - } - taos_free_result(result); - - TAOS_BIND tags[2]; - - int32_t id1 = 1; - char id2[40] = "abcdefghijklmnopqrstuvwxyz0123456789"; - uintptr_t id2_len = strlen(id2); - - tags[0].buffer_type = TSDB_DATA_TYPE_INT; - tags[0].buffer_length = sizeof(int); - tags[0].buffer = &id1; - tags[0].length = NULL; - tags[0].is_null = NULL; - - tags[1].buffer_type = TSDB_DATA_TYPE_BINARY; - tags[1].buffer_length = sizeof(id2); - tags[1].buffer = id2; - tags[1].length = &id2_len; - tags[1].is_null = NULL; - - // insert 10 records - struct { - int64_t ts[10]; - int8_t b[10]; - int8_t v1[10]; - int16_t v2[10]; - int32_t v4[10]; - int64_t v8[10]; - float f4[10]; - double f8[10]; - char bin[10][40]; - char blob[10][80]; - } v; - - int32_t* t8_len = malloc(sizeof(int32_t) * 10); - int32_t* t16_len = malloc(sizeof(int32_t) * 10); - int32_t* t32_len = malloc(sizeof(int32_t) * 10); - int32_t* t64_len = malloc(sizeof(int32_t) * 10); - int32_t* float_len = malloc(sizeof(int32_t) * 10); - int32_t* double_len = malloc(sizeof(int32_t) * 10); - int32_t* bin_len = malloc(sizeof(int32_t) * 10); - int32_t* blob_len = malloc(sizeof(int32_t) * 10); - - TAOS_STMT* stmt = taos_stmt_init(taos); - TAOS_MULTI_BIND params[10]; - char is_null[10] = {0}; - - params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; - params[0].buffer_length = sizeof(v.ts[0]); - params[0].buffer = v.ts; - params[0].length = t64_len; - params[0].is_null = is_null; - params[0].num = 10; - - params[1].buffer_type = TSDB_DATA_TYPE_BOOL; - params[1].buffer_length = sizeof(v.b[0]); - params[1].buffer = v.b; - params[1].length = t8_len; - params[1].is_null = is_null; - params[1].num = 10; - - params[2].buffer_type = TSDB_DATA_TYPE_TINYINT; - params[2].buffer_length = sizeof(v.v1[0]); - params[2].buffer = v.v1; - params[2].length = t8_len; - params[2].is_null = is_null; - params[2].num = 10; - - params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT; - params[3].buffer_length = sizeof(v.v2[0]); - params[3].buffer = v.v2; - params[3].length = t16_len; - params[3].is_null = is_null; - params[3].num = 10; - - params[4].buffer_type = TSDB_DATA_TYPE_INT; - params[4].buffer_length = sizeof(v.v4[0]); - params[4].buffer = v.v4; - params[4].length = t32_len; - params[4].is_null = is_null; - params[4].num = 10; - - params[5].buffer_type = TSDB_DATA_TYPE_BIGINT; - params[5].buffer_length = sizeof(v.v8[0]); - params[5].buffer = v.v8; - params[5].length = t64_len; - params[5].is_null = is_null; - params[5].num = 10; - - params[6].buffer_type = TSDB_DATA_TYPE_FLOAT; - params[6].buffer_length = sizeof(v.f4[0]); - params[6].buffer = v.f4; - params[6].length = float_len; - params[6].is_null = is_null; - params[6].num = 10; - - params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE; - params[7].buffer_length = sizeof(v.f8[0]); - params[7].buffer = v.f8; - params[7].length = double_len; - params[7].is_null = is_null; - params[7].num = 10; - - params[8].buffer_type = TSDB_DATA_TYPE_BINARY; - params[8].buffer_length = sizeof(v.bin[0]); - params[8].buffer = v.bin; - params[8].length = bin_len; - params[8].is_null = is_null; - params[8].num = 10; - - params[9].buffer_type = TSDB_DATA_TYPE_NCHAR; - params[9].buffer_length = sizeof(v.blob[0]); - params[9].buffer = v.blob; - params[9].length = blob_len; - params[9].is_null = is_null; - params[9].num = 10; - - sql = "insert into ? using st1 tags(?,?) values(?,?,?,?,?,?,?,?,?,?)"; - code = taos_stmt_prepare(stmt, sql, 0); - if (code != 0) { - printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - code = taos_stmt_set_tbname_tags(stmt, "m1", tags); - if (code != 0) { - printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - int64_t ts = 1591060628000; - for (int i = 0; i < 10; ++i) { - v.ts[i] = ts++; - is_null[i] = 0; - - v.b[i] = (int8_t)i % 2; - v.v1[i] = (int8_t)i; - v.v2[i] = (int16_t)(i * 2); - v.v4[i] = (int32_t)(i * 4); - v.v8[i] = (int64_t)(i * 8); - v.f4[i] = (float)(i * 40); - v.f8[i] = (double)(i * 80); - for (int j = 0; j < sizeof(v.bin[0]); ++j) { - v.bin[i][j] = (char)(i + '0'); - } - strcpy(v.blob[i], "一二三四五六七八九十"); - - t8_len[i] = sizeof(int8_t); - t16_len[i] = sizeof(int16_t); - t32_len[i] = sizeof(int32_t); - t64_len[i] = sizeof(int64_t); - float_len[i] = sizeof(float); - double_len[i] = sizeof(double); - bin_len[i] = sizeof(v.bin[0]); - blob_len[i] = (int32_t)strlen(v.blob[i]); - } - - taos_stmt_bind_param_batch(stmt, params); - taos_stmt_add_batch(stmt); - - if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - taos_stmt_close(stmt); - - // query the records - stmt = taos_stmt_init(taos); - taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0); - - TAOS_BIND qparams[2]; - - int8_t v1 = 5; - int16_t v2 = 15; - qparams[0].buffer_type = TSDB_DATA_TYPE_TINYINT; - qparams[0].buffer_length = sizeof(v1); - qparams[0].buffer = &v1; - qparams[0].length = &qparams[0].buffer_length; - qparams[0].is_null = NULL; - - qparams[1].buffer_type = TSDB_DATA_TYPE_SMALLINT; - qparams[1].buffer_length = sizeof(v2); - qparams[1].buffer = &v2; - qparams[1].length = &qparams[1].buffer_length; - qparams[1].is_null = NULL; - - taos_stmt_bind_param(stmt, qparams); - if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); - taos_stmt_close(stmt); - return; - } - - result = taos_stmt_use_result(stmt); - - TAOS_ROW row; - int rows = 0; - int num_fields = taos_num_fields(result); - TAOS_FIELD* fields = taos_fetch_fields(result); - - // fetch the records row by row - while ((row = taos_fetch_row(result))) { - char temp[256] = {0}; - rows++; - taos_print_row(temp, row, fields, num_fields); - printf("%s\n", temp); - } - - taos_free_result(result); - taos_stmt_close(stmt); - - free(t8_len); - free(t16_len); - free(t32_len); - free(t64_len); - free(float_len); - free(double_len); - free(bin_len); - free(blob_len); -} - -void retrieve_callback(void* param, TAOS_RES* tres, int numOfRows) { - if (numOfRows > 0) { - printf("%d rows async retrieved\n", numOfRows); - taos_fetch_rows_a(tres, retrieve_callback, param); - } else { - if (numOfRows < 0) { - printf("\033[31masync retrieve failed, code: %d\033[0m\n", numOfRows); - } else { - printf("async retrieve completed\n"); - } - taos_free_result(tres); - } -} - -void select_callback(void* param, TAOS_RES* tres, int code) { - if (code == 0 && tres) { - taos_fetch_rows_a(tres, retrieve_callback, param); - } else { - printf("\033[31masync select failed, code: %d\033[0m\n", code); - } -} - -void verify_async(TAOS* taos) { - prepare_data(taos); - taos_query_a(taos, "select * from meters", select_callback, NULL); - usleep(1000000); -} - -void stream_callback(void* param, TAOS_RES* res, TAOS_ROW row) { - if (res == NULL || row == NULL) { - return; - } - - int num_fields = taos_num_fields(res); - TAOS_FIELD* fields = taos_fetch_fields(res); - - printf("got one row from stream_callback\n"); - char temp[256] = {0}; - taos_print_row(temp, row, fields, num_fields); - puts(temp); -} - -void verify_stream(TAOS* taos) { - prepare_data(taos); - TAOS_STREAM* strm = - taos_open_stream(taos, "select count(*) from meters interval(1m)", stream_callback, 0, NULL, NULL); - printf("waiting for stream data\n"); - usleep(100000); - TAOS_RES* result = taos_query(taos, "insert into t0 values(now, 0)(now+5s,1)(now+10s, 2);"); - taos_free_result(result); - usleep(200000000); - taos_close_stream(strm); -} - -int32_t verify_schema_less(TAOS* taos) { - TAOS_RES* result; - result = taos_query(taos, "drop database if exists test;"); - taos_free_result(result); - usleep(100000); - result = taos_query(taos, "create database test precision 'us' update 1;"); - taos_free_result(result); - usleep(100000); - - taos_select_db(taos, "test"); - result = taos_query(taos, "create stable ste(ts timestamp, f int) tags(t1 bigint)"); - taos_free_result(result); - usleep(100000); - - int code = 0; - - char* lines[] = { - "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", - "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns", - "ste,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532ns", - "st,t1=4i64,t2=5f64,t3=\"t4\" c1=3i64,c3=L\"passitagain\",c2=true,c4=5f64 1626006833642000000ns", - "ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532ns", - "ste,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532ns", - "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 " - "1626006933640000000ns", - "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 " - "1626006933640000000ns", - "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 " - "1626006933641000000ns"}; - - code = taos_insert_lines(taos, lines, sizeof(lines) / sizeof(char*)); - - char* lines2[] = { - "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", - "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns"}; - code = taos_insert_lines(taos, &lines2[0], 1); - code = taos_insert_lines(taos, &lines2[1], 1); - - char* lines3[] = { - "sth,t1=4i64,t2=5f64,t4=5f64,ID=\"childtable\" c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 " - "1626006933641ms", - "sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654ms"}; - code = taos_insert_lines(taos, lines3, 2); - - char* lines4[] = {"st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", - "dgtyqodr,t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"}; - code = taos_insert_lines(taos, lines4, 2); - - char* lines5[] = { - "zqlbgs,id=\"zqlbgs_39302_21680\",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11." - "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" " - "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" - "\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000ns", - "zqlbgs,t9=f,id=\"zqlbgs_39302_21680\",t0=f,t1=127i8,t11=127i8,t2=32767i16,t3=2147483647i32,t4=" - "9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\",t10=" - "L\"ncharTagValue\" " - "c10=f,c0=f,c1=127i8,c12=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22." - "123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64,c11=L\"ncharColValue\" 1626006833639000000ns"}; - code = taos_insert_lines(taos, &lines5[0], 1); - code = taos_insert_lines(taos, &lines5[1], 1); - - char* lines6[] = {"st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", - "dgtyqodr,t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"}; - code = taos_insert_lines(taos, lines6, 2); - return (code); -} - -void verify_telnet_insert(TAOS* taos) { - TAOS_RES* result; - - result = taos_query(taos, "drop database if exists db;"); - taos_free_result(result); - usleep(100000); - result = taos_query(taos, "create database db precision 'ms';"); - taos_free_result(result); - usleep(100000); - - (void)taos_select_db(taos, "db"); - int32_t code = 0; - - /* metric */ - char* lines0[] = { - "stb0_0 1626006833639000000ns 4i8 host=\"host0\",interface=\"eth0\"", - "stb0_1 1626006833639000000ns 4i8 host=\"host0\",interface=\"eth0\"", - "stb0_2 1626006833639000000ns 4i8 host=\"host0\",interface=\"eth0\"", - }; - code = taos_insert_telnet_lines(taos, lines0, 3); - if (code) { - printf("lines0 code: %d, %s.\n", code, tstrerror(code)); - } - - /* timestamp */ - char* lines1[] = { - "stb1 1626006833s 1i8 host=\"host0\"", "stb1 1626006833639000000ns 2i8 host=\"host0\"", - "stb1 1626006833640000us 3i8 host=\"host0\"", "stb1 1626006833641123 4i8 host=\"host0\"", - "stb1 1626006833651ms 5i8 host=\"host0\"", "stb1 0 6i8 host=\"host0\"", - }; - code = taos_insert_telnet_lines(taos, lines1, 6); - if (code) { - printf("lines1 code: %d, %s.\n", code, tstrerror(code)); - } - - /* metric value */ - // tinyin - char* lines2_0[] = {"stb2_0 1626006833651ms -127i8 host=\"host0\"", "stb2_0 1626006833652ms 127i8 host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_0, 2); - if (code) { - printf("lines2_0 code: %d, %s.\n", code, tstrerror(code)); - } - - // smallint - char* lines2_1[] = {"stb2_1 1626006833651ms -32767i16 host=\"host0\"", - "stb2_1 1626006833652ms 32767i16 host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_1, 2); - if (code) { - printf("lines2_1 code: %d, %s.\n", code, tstrerror(code)); - } - - // int - char* lines2_2[] = {"stb2_2 1626006833651ms -2147483647i32 host=\"host0\"", - "stb2_2 1626006833652ms 2147483647i32 host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_2, 2); - if (code) { - printf("lines2_2 code: %d, %s.\n", code, tstrerror(code)); - } - - // bigint - char* lines2_3[] = {"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"", - "stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_3, 2); - if (code) { - printf("lines2_3 code: %d, %s.\n", code, tstrerror(code)); - } - - // float - char* lines2_4[] = { - "stb2_4 1626006833610ms 3f32 host=\"host0\"", "stb2_4 1626006833620ms -3f32 host=\"host0\"", - "stb2_4 1626006833630ms 3.4f32 host=\"host0\"", "stb2_4 1626006833640ms -3.4f32 host=\"host0\"", - "stb2_4 1626006833650ms 3.4E10f32 host=\"host0\"", "stb2_4 1626006833660ms -3.4e10f32 host=\"host0\"", - "stb2_4 1626006833670ms 3.4E+2f32 host=\"host0\"", "stb2_4 1626006833680ms -3.4e-2f32 host=\"host0\"", - "stb2_4 1626006833690ms 3.15 host=\"host0\"", "stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"", - "stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_4, 11); - if (code) { - printf("lines2_4 code: %d, %s.\n", code, tstrerror(code)); - } - - // double - char* lines2_5[] = { - "stb2_5 1626006833610ms 3f64 host=\"host0\"", "stb2_5 1626006833620ms -3f64 host=\"host0\"", - "stb2_5 1626006833630ms 3.4f64 host=\"host0\"", "stb2_5 1626006833640ms -3.4f64 host=\"host0\"", - "stb2_5 1626006833650ms 3.4E10f64 host=\"host0\"", "stb2_5 1626006833660ms -3.4e10f64 host=\"host0\"", - "stb2_5 1626006833670ms 3.4E+2f64 host=\"host0\"", "stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"", - "stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"", "stb2_5 1626006833700ms -1.7E308f64 host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_5, 10); - if (code) { - printf("lines2_5 code: %d, %s.\n", code, tstrerror(code)); - } - - // bool - char* lines2_6[] = {"stb2_6 1626006833610ms t host=\"host0\"", "stb2_6 1626006833620ms T host=\"host0\"", - "stb2_6 1626006833630ms true host=\"host0\"", "stb2_6 1626006833640ms True host=\"host0\"", - "stb2_6 1626006833650ms TRUE host=\"host0\"", "stb2_6 1626006833660ms f host=\"host0\"", - "stb2_6 1626006833670ms F host=\"host0\"", "stb2_6 1626006833680ms false host=\"host0\"", - "stb2_6 1626006833690ms False host=\"host0\"", "stb2_6 1626006833700ms FALSE host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_6, 10); - if (code) { - printf("lines2_6 code: %d, %s.\n", code, tstrerror(code)); - } - - // binary - char* lines2_7[] = {"stb2_7 1626006833610ms \"binary_val.!@#$%^&*\" host=\"host0\"", - "stb2_7 1626006833620ms \"binary_val.:;,./?|+-=\" host=\"host0\"", - "stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\""}; - code = taos_insert_telnet_lines(taos, lines2_7, 3); - if (code) { - printf("lines2_7 code: %d, %s.\n", code, tstrerror(code)); - } - - // nchar - char* lines2_8[] = { - "stb2_8 1626006833610ms L\"nchar_val数值一\" host=\"host0\"", - "stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\"", - }; - code = taos_insert_telnet_lines(taos, lines2_8, 2); - if (code) { - printf("lines2_8 code: %d, %s.\n", code, tstrerror(code)); - } - - /* tags */ - // tag value types - char* lines3_0[] = { - "stb3_0 1626006833610ms 1 " - "t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=3.4E38f32,t6=1.7E308f64,t7=true,t8=\"binary_" - "val_1\",t9=L\"标签值1\"", - "stb3_0 1626006833610ms 2 " - "t1=-127i8,t2=-32767i16,t3=-2147483647i32,t4=-9223372036854775807i64,t5=-3.4E38f32,t6=-1.7E308f64,t7=false,t8=" - "\"binary_val_2\",t9=L\"标签值2\""}; - code = taos_insert_telnet_lines(taos, lines3_0, 2); - if (code) { - printf("lines3_0 code: %d, %s.\n", code, tstrerror(code)); - } - - // tag ID as child table name - char* lines3_1[] = {"stb3_1 1626006833610ms 1 id=\"child_table1\",host=\"host1\"", - "stb3_1 1626006833610ms 2 host=\"host2\",iD=\"child_table2\"", - "stb3_1 1626006833610ms 3 ID=\"child_table3\",host=\"host3\""}; - code = taos_insert_telnet_lines(taos, lines3_1, 3); - if (code) { - printf("lines3_1 code: %d, %s.\n", code, tstrerror(code)); - } - - return; -} - -void verify_json_insert(TAOS* taos) { - TAOS_RES* result; - - result = taos_query(taos, "drop database if exists db;"); - taos_free_result(result); - usleep(100000); - result = taos_query(taos, "create database db precision 'ms';"); - taos_free_result(result); - usleep(100000); - - (void)taos_select_db(taos, "db"); - int32_t code = 0; - - char* message = - "{ \ - \"metric\":\"cpu_load_0\", \ - \"timestamp\": 1626006833610123, \ - \"value\": 55.5, \ - \"tags\": \ - { \ - \"host\": \"ubuntu\", \ - \"interface1\": \"eth0\", \ - \"Id\": \"tb0\" \ - } \ - }"; - - code = taos_insert_json_payload(taos, message); - if (code) { - printf("payload_0 code: %d, %s.\n", code, tstrerror(code)); - } - - char* message1 = - "[ \ - { \ - \"metric\":\"cpu_load_1\", \ - \"timestamp\": 1626006833610123, \ - \"value\": 55.5, \ - \"tags\": \ - { \ - \"host\": \"ubuntu\", \ - \"interface\": \"eth1\", \ - \"Id\": \"tb1\" \ - } \ - }, \ - { \ - \"metric\":\"cpu_load_2\", \ - \"timestamp\": 1626006833610123, \ - \"value\": 55.5, \ - \"tags\": \ - { \ - \"host\": \"ubuntu\", \ - \"interface\": \"eth2\", \ - \"Id\": \"tb2\" \ - } \ - } \ - ]"; - - code = taos_insert_json_payload(taos, message1); - if (code) { - printf("payload_1 code: %d, %s.\n", code, tstrerror(code)); - } - - char* message2 = - "[ \ - { \ - \"metric\":\"cpu_load_3\", \ - \"timestamp\": \ - { \ - \"value\": 1626006833610123, \ - \"type\": \"us\" \ - }, \ - \"value\": \ - { \ - \"value\": 55, \ - \"type\": \"int\" \ - }, \ - \"tags\": \ - { \ - \"host\": \ - { \ - \"value\": \"ubuntu\", \ - \"type\": \"binary\" \ - }, \ - \"interface\": \ - { \ - \"value\": \"eth3\", \ - \"type\": \"nchar\" \ - }, \ - \"ID\": \"tb3\", \ - \"port\": \ - { \ - \"value\": 4040, \ - \"type\": \"int\" \ - } \ - } \ - }, \ - { \ - \"metric\":\"cpu_load_4\", \ - \"timestamp\": 1626006833610123, \ - \"value\": 66.6, \ - \"tags\": \ - { \ - \"host\": \"ubuntu\", \ - \"interface\": \"eth4\", \ - \"Id\": \"tb4\" \ - } \ - } \ - ]"; - code = taos_insert_json_payload(taos, message2); - if (code) { - printf("payload_2 code: %d, %s.\n", code, tstrerror(code)); - } - - cJSON *payload, *tags; - char* payload_str; - - /* Default format */ - // number - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb0_0"); - cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); - cJSON_AddNumberToObject(payload, "value", 10); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload0_0 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // true - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb0_1"); - cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); - cJSON_AddTrueToObject(payload, "value"); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload0_1 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // false - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb0_2"); - cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); - cJSON_AddFalseToObject(payload, "value"); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload0_2 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // string - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb0_3"); - cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); - cJSON_AddStringToObject(payload, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload0_3 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // timestamp 0 -> current time - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb0_4"); - cJSON_AddNumberToObject(payload, "timestamp", 0); - cJSON_AddNumberToObject(payload, "value", 123); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload0_4 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // ID - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb0_5"); - cJSON_AddNumberToObject(payload, "timestamp", 0); - cJSON_AddNumberToObject(payload, "value", 123); - tags = cJSON_CreateObject(); - cJSON_AddStringToObject(tags, "ID", "tb0_5"); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddStringToObject(tags, "iD", "tb000"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddStringToObject(tags, "id", "tb555"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload0_5 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - /* Nested format */ - // timestamp - cJSON* timestamp; - // seconds - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb1_0"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - cJSON_AddNumberToObject(payload, "value", 10); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload1_0 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // milleseconds - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb1_1"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833610); - cJSON_AddStringToObject(timestamp, "type", "ms"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - cJSON_AddNumberToObject(payload, "value", 10); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload1_1 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // microseconds - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb1_2"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833610123); - cJSON_AddStringToObject(timestamp, "type", "us"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - cJSON_AddNumberToObject(payload, "value", 10); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload1_2 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // nanoseconds - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb1_3"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833610123321); - cJSON_AddStringToObject(timestamp, "type", "ns"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - cJSON_AddNumberToObject(payload, "value", 10); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload1_3 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // now - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb1_4"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 0); - cJSON_AddStringToObject(timestamp, "type", "ns"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - cJSON_AddNumberToObject(payload, "value", 10); - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload1_4 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // metric value - cJSON* metric_val; - // bool - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_0"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddTrueToObject(metric_val, "value"); - cJSON_AddStringToObject(metric_val, "type", "bool"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_0 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // tinyint - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_1"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddNumberToObject(metric_val, "value", 127); - cJSON_AddStringToObject(metric_val, "type", "tinyint"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_1 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // smallint - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_2"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddNumberToObject(metric_val, "value", 32767); - cJSON_AddStringToObject(metric_val, "type", "smallint"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_2 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // int - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_3"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddNumberToObject(metric_val, "value", 2147483647); - cJSON_AddStringToObject(metric_val, "type", "int"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_3 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // bigint - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_4"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddNumberToObject(metric_val, "value", 9223372036854775807); - cJSON_AddStringToObject(metric_val, "type", "bigint"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_4 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // float - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_5"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddNumberToObject(metric_val, "value", 11.12345); - cJSON_AddStringToObject(metric_val, "type", "float"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_5 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // double - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_6"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddNumberToObject(metric_val, "value", 22.123456789); - cJSON_AddStringToObject(metric_val, "type", "double"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_6 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // binary - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_7"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddStringToObject(metric_val, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddStringToObject(metric_val, "type", "binary"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_7 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // nchar - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb2_8"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddStringToObject(metric_val, "value", "你好"); - cJSON_AddStringToObject(metric_val, "type", "nchar"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - cJSON_AddTrueToObject(tags, "t1"); - cJSON_AddFalseToObject(tags, "t2"); - cJSON_AddNumberToObject(tags, "t3", 10); - cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); - cJSON_AddItemToObject(payload, "tags", tags); - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload2_8 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); - - // tag value - cJSON* tag; - - payload = cJSON_CreateObject(); - cJSON_AddStringToObject(payload, "metric", "stb3_0"); - - timestamp = cJSON_CreateObject(); - cJSON_AddNumberToObject(timestamp, "value", 1626006833); - cJSON_AddStringToObject(timestamp, "type", "s"); - cJSON_AddItemToObject(payload, "timestamp", timestamp); - - metric_val = cJSON_CreateObject(); - cJSON_AddStringToObject(metric_val, "value", "hello"); - cJSON_AddStringToObject(metric_val, "type", "nchar"); - cJSON_AddItemToObject(payload, "value", metric_val); - - tags = cJSON_CreateObject(); - - tag = cJSON_CreateObject(); - cJSON_AddTrueToObject(tag, "value"); - cJSON_AddStringToObject(tag, "type", "bool"); - cJSON_AddItemToObject(tags, "t1", tag); - - tag = cJSON_CreateObject(); - cJSON_AddFalseToObject(tag, "value"); - cJSON_AddStringToObject(tag, "type", "bool"); - cJSON_AddItemToObject(tags, "t2", tag); - - tag = cJSON_CreateObject(); - cJSON_AddNumberToObject(tag, "value", 127); - cJSON_AddStringToObject(tag, "type", "tinyint"); - cJSON_AddItemToObject(tags, "t3", tag); - - tag = cJSON_CreateObject(); - cJSON_AddNumberToObject(tag, "value", 32767); - cJSON_AddStringToObject(tag, "type", "smallint"); - cJSON_AddItemToObject(tags, "t4", tag); - - tag = cJSON_CreateObject(); - cJSON_AddNumberToObject(tag, "value", 2147483647); - cJSON_AddStringToObject(tag, "type", "int"); - cJSON_AddItemToObject(tags, "t5", tag); - - tag = cJSON_CreateObject(); - cJSON_AddNumberToObject(tag, "value", 9223372036854775807); - cJSON_AddStringToObject(tag, "type", "bigint"); - cJSON_AddItemToObject(tags, "t6", tag); - - tag = cJSON_CreateObject(); - cJSON_AddNumberToObject(tag, "value", 11.12345); - cJSON_AddStringToObject(tag, "type", "float"); - cJSON_AddItemToObject(tags, "t7", tag); - - tag = cJSON_CreateObject(); - cJSON_AddNumberToObject(tag, "value", 22.1234567890); - cJSON_AddStringToObject(tag, "type", "double"); - cJSON_AddItemToObject(tags, "t8", tag); - - tag = cJSON_CreateObject(); - cJSON_AddStringToObject(tag, "value", "binary_val"); - cJSON_AddStringToObject(tag, "type", "binary"); - cJSON_AddItemToObject(tags, "t9", tag); - - tag = cJSON_CreateObject(); - cJSON_AddStringToObject(tag, "value", "你好"); - cJSON_AddStringToObject(tag, "type", "nchar"); - cJSON_AddItemToObject(tags, "t10", tag); - - cJSON_AddItemToObject(payload, "tags", tags); - - payload_str = cJSON_Print(payload); - // printf("%s\n", payload_str); - - code = taos_insert_json_payload(taos, payload_str); - if (code) { - printf("payload3_0 code: %d, %s.\n", code, tstrerror(code)); - } - free(payload_str); - cJSON_Delete(payload); -} - -int main(int argc, char* argv[]) { - const char* host = "127.0.0.1"; - const char* user = "root"; - const char* passwd = "taosdata"; - - taos_options(TSDB_OPTION_TIMEZONE, "GMT-8"); - TAOS* taos = taos_connect(host, user, passwd, "", 0); - if (taos == NULL) { - printf("\033[31mfailed to connect to db, reason:%s\033[0m\n", taos_errstr(taos)); - exit(1); - } - - char* info = taos_get_server_info(taos); - printf("server info: %s\n", info); - info = taos_get_client_info(taos); - printf("client info: %s\n", info); - - printf("************ verify schema-less *************\n"); - verify_schema_less(taos); - - printf("************ verify telnet-insert *************\n"); - verify_telnet_insert(taos); - - printf("************ verify json-insert *************\n"); - verify_json_insert(taos); - - printf("************ verify query *************\n"); - verify_query(taos); - - printf("********* verify async query **********\n"); - verify_async(taos); - - printf("*********** verify subscribe ************\n"); - verify_subscribe(taos); - - printf("************ verify prepare *************\n"); - verify_prepare(taos); - - printf("************ verify prepare2 *************\n"); - verify_prepare2(taos); - printf("************ verify prepare3 *************\n"); - verify_prepare3(taos); - - printf("************ verify stream *************\n"); - verify_stream(taos); - printf("done\n"); - taos_close(taos); - taos_cleanup(); -} diff --git a/examples/c/asyncdemo.c b/examples/c/asyncdemo.c index 07e61b871e..83d217769b 100644 --- a/examples/c/asyncdemo.c +++ b/examples/c/asyncdemo.c @@ -23,8 +23,8 @@ #include #include #include - -#include "../../../include/client/taos.h" +#include +#include "taos.h" int points = 5; int numOfTables = 3; @@ -230,7 +230,7 @@ void taos_insert_call_back(void *param, TAOS_RES *tres, int code) if (tablesInsertProcessed >= numOfTables) { gettimeofday(&systemTime, NULL); et = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - printf("%lld mseconds to insert %d data points\n", (et - st) / 1000, points*numOfTables); + printf("%" PRId64 " mseconds to insert %d data points\n", (et - st) / 1000, points*numOfTables); } } @@ -267,7 +267,7 @@ void taos_retrieve_call_back(void *param, TAOS_RES *tres, int numOfRows) if (tablesSelectProcessed >= numOfTables) { gettimeofday(&systemTime, NULL); et = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - printf("%lld mseconds to query %d data rows\n", (et - st) / 1000, points * numOfTables); + printf("%" PRId64 " mseconds to query %d data rows\n", (et - st) / 1000, points * numOfTables); } taos_free_result(tres); diff --git a/examples/c/demo.c b/examples/c/demo.c index c3d9a5e96a..2eda8cd811 100644 --- a/examples/c/demo.c +++ b/examples/c/demo.c @@ -20,7 +20,7 @@ #include #include #include -#include "../../../include/client/taos.h" // TAOS header file +#include "taos.h" // TAOS header file static void queryDB(TAOS *taos, char *command) { int i; diff --git a/examples/c/epoll.c b/examples/c/epoll.c deleted file mode 100644 index 284268ac43..0000000000 --- a/examples/c/epoll.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -// how to use to do a pressure-test upon eok -// tester: cat /dev/urandom | nc -c -// testee: ./debug/build/bin/epoll -l > /dev/null -// compare against: nc -l > /dev/null -// monitor and compare : glances - -#ifdef __APPLE__ -#include "osEok.h" -#else // __APPLE__ -#include -#endif // __APPLE__ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define D(fmt, ...) fprintf(stderr, "%s[%d]%s(): " fmt "\n", basename(__FILE__), __LINE__, __func__, ##__VA_ARGS__) -#define A(statement, fmt, ...) do { \ - if (statement) break; \ - fprintf(stderr, "%s[%d]%s(): assert [%s] failed: %d[%s]: " fmt "\n", \ - basename(__FILE__), __LINE__, __func__, \ - #statement, errno, strerror(errno), \ - ##__VA_ARGS__); \ - abort(); \ -} while (0) - -#define E(fmt, ...) do { \ - fprintf(stderr, "%s[%d]%s(): %d[%s]: " fmt "\n", \ - basename(__FILE__), __LINE__, __func__, \ - errno, strerror(errno), \ - ##__VA_ARGS__); \ -} while (0) - -#include "os.h" - -typedef struct ep_s ep_t; -struct ep_s { - int ep; - - pthread_mutex_t lock; - int sv[2]; // 0 for read, 1 for write; - pthread_t thread; - - volatile unsigned int stopping:1; - volatile unsigned int waiting:1; - volatile unsigned int wakenup:1; -}; - -static int ep_dummy = 0; - -static ep_t* ep_create(void); -static void ep_destroy(ep_t *ep); -static void* routine(void* arg); -static int open_listen(unsigned short port); - -typedef struct fde_s fde_t; -struct fde_s { - int skt; - void (*on_event)(ep_t *ep, struct epoll_event *events, fde_t *client); -}; - -static void listen_event(ep_t *ep, struct epoll_event *ev, fde_t *client); -static void null_event(ep_t *ep, struct epoll_event *ev, fde_t *client); - -#define usage(arg0, fmt, ...) do { \ - if (fmt[0]) { \ - fprintf(stderr, "" fmt "\n", ##__VA_ARGS__); \ - } \ - fprintf(stderr, "usage:\n"); \ - fprintf(stderr, " %s -l : specify listenning port\n", arg0); \ -} while (0) - -int main(int argc, char *argv[]) { - char *prg = basename(argv[0]); - if (argc==1) { - usage(prg, ""); - return 0; - } - ep_t* ep = ep_create(); - A(ep, "failed"); - for (int i=1; i=argc) { - usage(prg, "expecting after -l, but got nothing"); - return 1; // confirmed potential leakage - } - arg = argv[i]; - int port = atoi(arg); - int skt = open_listen(port); - if (skt==-1) continue; - fde_t *client = (fde_t*)calloc(1, sizeof(*client)); - if (!client) { - E("out of memory"); - close(skt); - continue; - } - client->skt = skt; - client->on_event = listen_event; - struct epoll_event ev = {0}; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLRDHUP; - ev.data.ptr = client; - A(0==epoll_ctl(ep->ep, EPOLL_CTL_ADD, skt, &ev), ""); - continue; - } - usage(prg, "unknown argument: [%s]", arg); - return 1; - } - char *line = NULL; - size_t linecap = 0; - ssize_t linelen; - while ((linelen = getline(&line, &linecap, stdin)) > 0) { - line[strlen(line)-1] = '\0'; - if (0==strcmp(line, "exit")) break; - if (0==strcmp(line, "quit")) break; - if (line==strstr(line, "close")) { - int fd = 0; - sscanf(line, "close %d", &fd); - if (fd<=2) { - fprintf(stderr, "fd [%d] invalid\n", fd); - continue; - } - A(0==epoll_ctl(ep->ep, EPOLL_CTL_DEL, fd, NULL), ""); - continue; - } - if (strlen(line)==0) continue; - fprintf(stderr, "unknown cmd:[%s]\n", line); - } - ep_destroy(ep); - D(""); - return 0; -} - -ep_t* ep_create(void) { - ep_t *ep = (ep_t*)calloc(1, sizeof(*ep)); - A(ep, "out of memory"); - A(-1!=(ep->ep = epoll_create(1)), ""); - ep->sv[0] = -1; - ep->sv[1] = -1; - A(0==socketpair(AF_LOCAL, SOCK_STREAM, 0, ep->sv), ""); - A(0==pthread_mutex_init(&ep->lock, NULL), ""); - A(0==pthread_mutex_lock(&ep->lock), ""); - struct epoll_event ev = {0}; - ev.events = EPOLLIN; - ev.data.ptr = &ep_dummy; - A(0==epoll_ctl(ep->ep, EPOLL_CTL_ADD, ep->sv[0], &ev), ""); - A(0==pthread_create(&ep->thread, NULL, routine, ep), ""); - A(0==pthread_mutex_unlock(&ep->lock), ""); - return ep; -} - -static void ep_destroy(ep_t *ep) { - A(ep, "invalid argument"); - ep->stopping = 1; - A(1==send(ep->sv[1], "1", 1, 0), ""); - A(0==pthread_join(ep->thread, NULL), ""); - A(0==pthread_mutex_destroy(&ep->lock), ""); - A(0==close(ep->sv[0]), ""); - A(0==close(ep->sv[1]), ""); - A(0==close(ep->ep), ""); - free(ep); -} - -static void* routine(void* arg) { - A(arg, "invalid argument"); - ep_t *ep = (ep_t*)arg; - - while (!ep->stopping) { - struct epoll_event evs[10]; - memset(evs, 0, sizeof(evs)); - - A(0==pthread_mutex_lock(&ep->lock), ""); - A(ep->waiting==0, "internal logic error"); - ep->waiting = 1; - A(0==pthread_mutex_unlock(&ep->lock), ""); - - int r = epoll_wait(ep->ep, evs, sizeof(evs)/sizeof(evs[0]), -1); - A(r>0, "indefinite epoll_wait shall not timeout:[%d]", r); - - A(0==pthread_mutex_lock(&ep->lock), ""); - A(ep->waiting==1, "internal logic error"); - ep->waiting = 0; - A(0==pthread_mutex_unlock(&ep->lock), ""); - - for (int i=0; idata.ptr == &ep_dummy) { - char c = '\0'; - A(1==recv(ep->sv[0], &c, 1, 0), "internal logic error"); - A(0==pthread_mutex_lock(&ep->lock), ""); - ep->wakenup = 0; - A(0==pthread_mutex_unlock(&ep->lock), ""); - continue; - } - A(ev->data.ptr, "internal logic error"); - fde_t *client = (fde_t*)ev->data.ptr; - client->on_event(ep, ev, client); - continue; - } - } - return NULL; -} - -static int open_listen(unsigned short port) { - int r = 0; - int skt = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (skt==-1) { - E("socket() failed"); - return -1; - } - do { - struct sockaddr_in si = {0}; - si.sin_family = AF_INET; - si.sin_addr.s_addr = inet_addr("0.0.0.0"); - si.sin_port = htons(port); - r = bind(skt, (struct sockaddr*)&si, sizeof(si)); - if (r) { - E("bind(%u) failed", port); - break; - } - r = listen(skt, 100); - if (r) { - E("listen() failed"); - break; - } - memset(&si, 0, sizeof(si)); - socklen_t len = sizeof(si); - r = getsockname(skt, (struct sockaddr *)&si, &len); - if (r) { - E("getsockname() failed"); - } - A(len==sizeof(si), "internal logic error"); - D("listenning at: %d", ntohs(si.sin_port)); - return skt; - } while (0); - close(skt); - return -1; -} - -static void listen_event(ep_t *ep, struct epoll_event *ev, fde_t *client) { - A(ev->events & EPOLLIN, "internal logic error"); - struct sockaddr_in si = {0}; - socklen_t silen = sizeof(si); - int skt = accept(client->skt, (struct sockaddr*)&si, &silen); - A(skt!=-1, "internal logic error"); - fde_t *server = (fde_t*)calloc(1, sizeof(*server)); - if (!server) { - close(skt); - return; - } - server->skt = skt; - server->on_event = null_event; - struct epoll_event ee = {0}; - ee.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLRDHUP; - ee.data.ptr = server; - A(0==epoll_ctl(ep->ep, EPOLL_CTL_ADD, skt, &ee), ""); -} - -static void null_event(ep_t *ep, struct epoll_event *ev, fde_t *client) { - if (ev->events & EPOLLIN) { - char buf[8192]; - int n = recv(client->skt, buf, sizeof(buf), 0); - A(n>=0 && n<=sizeof(buf), "internal logic error:[%d]", n); - A(n==fwrite(buf, 1, n, stdout), "internal logic error"); - } - if (ev->events & (EPOLLERR | EPOLLHUP | EPOLLRDHUP)) { - A(0==pthread_mutex_lock(&ep->lock), ""); - A(0==epoll_ctl(ep->ep, EPOLL_CTL_DEL, client->skt, NULL), ""); - A(0==pthread_mutex_unlock(&ep->lock), ""); - close(client->skt); - client->skt = -1; - client->on_event = NULL; - free(client); - } -} - diff --git a/examples/c/makefile b/examples/c/makefile index c85eb4adc5..244d13fad7 100644 --- a/examples/c/makefile +++ b/examples/c/makefile @@ -7,22 +7,21 @@ LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \ -Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \ -Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 \ - -I../../../deps/cJson/inc + -I/usr/local/include/cjson all: $(TARGET) exe: gcc $(CFLAGS) ./asyncdemo.c -o $(ROOT)asyncdemo $(LFLAGS) gcc $(CFLAGS) ./demo.c -o $(ROOT)demo $(LFLAGS) gcc $(CFLAGS) ./prepare.c -o $(ROOT)prepare $(LFLAGS) - gcc $(CFLAGS) ./stream.c -o $(ROOT)stream $(LFLAGS) - gcc $(CFLAGS) ./subscribe.c -o $(ROOT)subscribe $(LFLAGS) - gcc $(CFLAGS) ./apitest.c -o $(ROOT)apitest $(LFLAGS) + gcc $(CFLAGS) ./stream_demo.c -o $(ROOT)stream_demo $(LFLAGS) + gcc $(CFLAGS) ./tmq.c -o $(ROOT)tmq $(LFLAGS) + gcc $(CFLAGS) ./schemaless.c -o $(ROOT)schemaless $(LFLAGS) clean: rm $(ROOT)asyncdemo rm $(ROOT)demo rm $(ROOT)prepare - rm $(ROOT)batchprepare - rm $(ROOT)stream - rm $(ROOT)subscribe - rm $(ROOT)apitest + rm $(ROOT)stream_demo + rm $(ROOT)tmq + rm $(ROOT)schemaless diff --git a/examples/c/prepare.c b/examples/c/prepare.c index f0341cfe12..4f05b6fb4c 100644 --- a/examples/c/prepare.c +++ b/examples/c/prepare.c @@ -4,7 +4,7 @@ #include #include #include -#include "../../../include/client/taos.h" +#include "taos.h" void taosMsleep(int mseconds); @@ -70,70 +70,89 @@ int main(int argc, char *argv[]) char blob[80]; } v = {0}; + int32_t boolLen = sizeof(int8_t); + int32_t sintLen = sizeof(int16_t); + int32_t intLen = sizeof(int32_t); + int32_t bintLen = sizeof(int64_t); + int32_t floatLen = sizeof(float); + int32_t doubleLen = sizeof(double); + int32_t binLen = sizeof(v.bin); + int32_t ncharLen = 30; + stmt = taos_stmt_init(taos); - TAOS_BIND params[10]; + TAOS_MULTI_BIND params[10]; params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; params[0].buffer_length = sizeof(v.ts); params[0].buffer = &v.ts; - params[0].length = ¶ms[0].buffer_length; + params[0].length = &bintLen; params[0].is_null = NULL; + params[0].num = 1; params[1].buffer_type = TSDB_DATA_TYPE_BOOL; params[1].buffer_length = sizeof(v.b); params[1].buffer = &v.b; - params[1].length = ¶ms[1].buffer_length; + params[1].length = &boolLen; params[1].is_null = NULL; + params[1].num = 1; params[2].buffer_type = TSDB_DATA_TYPE_TINYINT; params[2].buffer_length = sizeof(v.v1); params[2].buffer = &v.v1; - params[2].length = ¶ms[2].buffer_length; + params[2].length = &boolLen; params[2].is_null = NULL; + params[2].num = 1; params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT; params[3].buffer_length = sizeof(v.v2); params[3].buffer = &v.v2; - params[3].length = ¶ms[3].buffer_length; + params[3].length = &sintLen; params[3].is_null = NULL; + params[3].num = 1; params[4].buffer_type = TSDB_DATA_TYPE_INT; params[4].buffer_length = sizeof(v.v4); params[4].buffer = &v.v4; - params[4].length = ¶ms[4].buffer_length; + params[4].length = &intLen; params[4].is_null = NULL; + params[4].num = 1; params[5].buffer_type = TSDB_DATA_TYPE_BIGINT; params[5].buffer_length = sizeof(v.v8); params[5].buffer = &v.v8; - params[5].length = ¶ms[5].buffer_length; + params[5].length = &bintLen; params[5].is_null = NULL; + params[5].num = 1; params[6].buffer_type = TSDB_DATA_TYPE_FLOAT; params[6].buffer_length = sizeof(v.f4); params[6].buffer = &v.f4; - params[6].length = ¶ms[6].buffer_length; + params[6].length = &floatLen; params[6].is_null = NULL; + params[6].num = 1; params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE; params[7].buffer_length = sizeof(v.f8); params[7].buffer = &v.f8; - params[7].length = ¶ms[7].buffer_length; + params[7].length = &doubleLen; params[7].is_null = NULL; + params[7].num = 1; params[8].buffer_type = TSDB_DATA_TYPE_BINARY; params[8].buffer_length = sizeof(v.bin); params[8].buffer = v.bin; - params[8].length = ¶ms[8].buffer_length; + params[8].length = &binLen; params[8].is_null = NULL; + params[8].num = 1; strcpy(v.blob, "一二三四五六七八九十"); params[9].buffer_type = TSDB_DATA_TYPE_NCHAR; - params[9].buffer_length = strlen(v.blob); + params[9].buffer_length = sizeof(v.blob); params[9].buffer = v.blob; - params[9].length = ¶ms[9].buffer_length; + params[9].length = &ncharLen; params[9].is_null = NULL; + params[9].num = 1; - int is_null = 1; + char is_null = 1; sql = "insert into m1 values(?,?,?,?,?,?,?,?,?,?)"; code = taos_stmt_prepare(stmt, sql, 0); @@ -153,7 +172,7 @@ int main(int argc, char *argv[]) v.v8 = (int64_t)(i * 8); v.f4 = (float)(i * 40); v.f8 = (double)(i * 80); - for (int j = 0; j < sizeof(v.bin) - 1; ++j) { + for (int j = 0; j < sizeof(v.bin); ++j) { v.bin[j] = (char)(i + '0'); } diff --git a/examples/c/schemaless.c b/examples/c/schemaless.c index 99aa361b0a..328a663ae7 100644 --- a/examples/c/schemaless.c +++ b/examples/c/schemaless.c @@ -1,32 +1,17 @@ -#include "../../../include/client/taos.h" -#include "os.h" -#include "taoserror.h" - +#include "taos.h" #include #include #include #include #include +#include +#include + int numSuperTables = 8; int numChildTables = 4; int numRowsPerChildTable = 2048; -void shuffle(char**lines, size_t n) -{ - if (n > 1) - { - size_t i; - for (i = 0; i < n - 1; i++) - { - size_t j = i + taosRand() / (RAND_MAX / (n - i) + 1); - char* t = lines[j]; - lines[j] = lines[i]; - lines[i] = t; - } - } -} - static int64_t getTimeInUs() { struct timeval systemTime; gettimeofday(&systemTime, NULL); @@ -46,7 +31,7 @@ int main(int argc, char* argv[]) { exit(1); } - char* info = taos_get_server_info(taos); + const char* info = taos_get_server_info(taos); printf("server info: %s\n", info); info = taos_get_client_info(taos); printf("client info: %s\n", info); @@ -61,9 +46,10 @@ int main(int argc, char* argv[]) { time_t ct = time(0); int64_t ts = ct * 1000; - char* lineFormat = "sta%d,t0=true,t1=127i8,t2=32767i16,t3=%di32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=254u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" %lldms"; + char* lineFormat = "sta%d,t0=true,t1=127i8,t2=32767i16,t3=%di32,t4=9223372036854775807i64,t9=11.12345f32,t10=22.123456789f64,t11=\"binaryTagValue\",t12=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=254u8,c6=32770u16,c7=2147483699u32,c8=9223372036854775899u64,c9=11.12345f32,c10=22.123456789f64,c11=\"binaryValue\",c12=L\"ncharValue\" %" PRId64; - char** lines = calloc(numSuperTables * numChildTables * numRowsPerChildTable, sizeof(char*)); + int lineNum = numSuperTables * numChildTables * numRowsPerChildTable; + char** lines = calloc((size_t)lineNum, sizeof(char*)); int l = 0; for (int i = 0; i < numSuperTables; ++i) { for (int j = 0; j < numChildTables; ++j) { @@ -75,13 +61,13 @@ int main(int argc, char* argv[]) { } } } - //shuffle(lines, numSuperTables * numChildTables * numRowsPerChildTable); printf("%s\n", "begin taos_insert_lines"); int64_t begin = getTimeInUs(); - int32_t code = taos_insert_lines(taos, lines, numSuperTables * numChildTables * numRowsPerChildTable); + TAOS_RES *res = taos_schemaless_insert(taos, lines, lineNum, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); int64_t end = getTimeInUs(); - printf("code: %d, %s. time used: %"PRId64"\n", code, tstrerror(code), end-begin); + printf("code: %s. time used: %" PRId64 "\n", taos_errstr(res), end-begin); + taos_free_result(res); return 0; } diff --git a/examples/c/stream_demo.c b/examples/c/stream_demo.c index 46c8297fba..46107c7e13 100644 --- a/examples/c/stream_demo.c +++ b/examples/c/stream_demo.c @@ -108,10 +108,13 @@ int32_t create_stream() { } int main(int argc, char* argv[]) { - int code; if (argc > 1) { printf("env init\n"); - code = init_env(); + int code = init_env(); + if (code) { + return code; + } + } create_stream(); } diff --git a/examples/c/tmq.c b/examples/c/tmq.c index 1147671ea1..71e571d4dd 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -21,9 +21,6 @@ #include "taos.h" static int running = 1; -static char dbName[64] = "tmqdb"; -static char stbName[64] = "stb"; -static char topicName[64] = "topicname"; static int32_t msg_process(TAOS_RES* msg) { char buf[1024]; @@ -43,7 +40,7 @@ static int32_t msg_process(TAOS_RES* msg) { TAOS_FIELD* fields = taos_fetch_fields(msg); int32_t numOfFields = taos_field_count(msg); - int32_t* length = taos_fetch_lengths(msg); + //int32_t* length = taos_fetch_lengths(msg); int32_t precision = taos_result_precision(msg); rows++; taos_print_row(buf, row, fields, numOfFields); @@ -62,6 +59,13 @@ static int32_t init_env() { TAOS_RES* pRes; // drop database if exists printf("create database\n"); + pRes = taos_query(pConn, "drop topic topicname"); + if (taos_errno(pRes) != 0) { + printf("error in drop tmqdb, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + pRes = taos_query(pConn, "drop database if exists tmqdb"); if (taos_errno(pRes) != 0) { printf("error in drop tmqdb, reason:%s\n", taos_errstr(pRes)); @@ -249,7 +253,7 @@ int main(int argc, char* argv[]) { tmq_t* tmq = build_consumer(); if (NULL == tmq) { - fprintf(stderr, "%% build_consumer() fail!\n"); + fprintf(stderr, "build_consumer() fail!\n"); return -1; } @@ -259,7 +263,7 @@ int main(int argc, char* argv[]) { } if ((code = tmq_subscribe(tmq, topic_list))) { - fprintf(stderr, "%% Failed to tmq_subscribe(): %s\n", tmq_err2str(code)); + fprintf(stderr, "Failed to tmq_subscribe(): %s\n", tmq_err2str(code)); } tmq_list_destroy(topic_list); @@ -267,9 +271,9 @@ int main(int argc, char* argv[]) { code = tmq_consumer_close(tmq); if (code) { - fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code)); + fprintf(stderr, "Failed to close consumer: %s\n", tmq_err2str(code)); } else { - fprintf(stderr, "%% Consumer closed\n"); + fprintf(stderr, "Consumer closed\n"); } return 0; diff --git a/include/client/taos.h b/include/client/taos.h index 69774b750f..379363c51d 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -149,7 +149,7 @@ DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port); DLL_EXPORT void taos_close(TAOS *taos); -const char *taos_data_type(int type); +DLL_EXPORT const char *taos_data_type(int type); DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos); DLL_EXPORT TAOS_STMT *taos_stmt_init_with_reqid(TAOS *taos, int64_t reqid); diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 6ec3d5db10..f74795a250 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -195,6 +195,7 @@ typedef struct SDataBlockInfo { uint32_t capacity; SBlockID id; int16_t hasVarCol; + int16_t dataLoad; // denote if the data is loaded or not // TODO: optimize and remove following int64_t version; // used for stream, and need serialization diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index fc630cfdc0..0192bbf486 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -94,242 +94,242 @@ #define TK_TSDB_PAGESIZE 76 #define TK_PRECISION 77 #define TK_REPLICA 78 -#define TK_STRICT 79 -#define TK_VGROUPS 80 -#define TK_SINGLE_STABLE 81 -#define TK_RETENTIONS 82 -#define TK_SCHEMALESS 83 -#define TK_WAL_LEVEL 84 -#define TK_WAL_FSYNC_PERIOD 85 -#define TK_WAL_RETENTION_PERIOD 86 -#define TK_WAL_RETENTION_SIZE 87 -#define TK_WAL_ROLL_PERIOD 88 -#define TK_WAL_SEGMENT_SIZE 89 -#define TK_STT_TRIGGER 90 -#define TK_TABLE_PREFIX 91 -#define TK_TABLE_SUFFIX 92 -#define TK_NK_COLON 93 -#define TK_MAX_SPEED 94 -#define TK_TABLE 95 -#define TK_NK_LP 96 -#define TK_NK_RP 97 -#define TK_STABLE 98 -#define TK_ADD 99 -#define TK_COLUMN 100 -#define TK_MODIFY 101 -#define TK_RENAME 102 -#define TK_TAG 103 -#define TK_SET 104 -#define TK_NK_EQ 105 -#define TK_USING 106 -#define TK_TAGS 107 -#define TK_COMMENT 108 -#define TK_BOOL 109 -#define TK_TINYINT 110 -#define TK_SMALLINT 111 -#define TK_INT 112 -#define TK_INTEGER 113 -#define TK_BIGINT 114 -#define TK_FLOAT 115 -#define TK_DOUBLE 116 -#define TK_BINARY 117 -#define TK_TIMESTAMP 118 -#define TK_NCHAR 119 -#define TK_UNSIGNED 120 -#define TK_JSON 121 -#define TK_VARCHAR 122 -#define TK_MEDIUMBLOB 123 -#define TK_BLOB 124 -#define TK_VARBINARY 125 -#define TK_DECIMAL 126 -#define TK_MAX_DELAY 127 -#define TK_WATERMARK 128 -#define TK_ROLLUP 129 -#define TK_TTL 130 -#define TK_SMA 131 -#define TK_DELETE_MARK 132 -#define TK_FIRST 133 -#define TK_LAST 134 -#define TK_SHOW 135 -#define TK_PRIVILEGES 136 -#define TK_DATABASES 137 -#define TK_TABLES 138 -#define TK_STABLES 139 -#define TK_MNODES 140 -#define TK_QNODES 141 -#define TK_FUNCTIONS 142 -#define TK_INDEXES 143 -#define TK_ACCOUNTS 144 -#define TK_APPS 145 -#define TK_CONNECTIONS 146 -#define TK_LICENCES 147 -#define TK_GRANTS 148 -#define TK_QUERIES 149 -#define TK_SCORES 150 -#define TK_TOPICS 151 -#define TK_VARIABLES 152 -#define TK_CLUSTER 153 -#define TK_BNODES 154 -#define TK_SNODES 155 -#define TK_TRANSACTIONS 156 -#define TK_DISTRIBUTED 157 -#define TK_CONSUMERS 158 -#define TK_SUBSCRIPTIONS 159 -#define TK_VNODES 160 -#define TK_LIKE 161 -#define TK_TBNAME 162 -#define TK_QTAGS 163 -#define TK_AS 164 -#define TK_INDEX 165 -#define TK_FUNCTION 166 -#define TK_INTERVAL 167 -#define TK_TOPIC 168 -#define TK_WITH 169 -#define TK_META 170 -#define TK_CONSUMER 171 -#define TK_GROUP 172 -#define TK_DESC 173 -#define TK_DESCRIBE 174 -#define TK_RESET 175 -#define TK_QUERY 176 -#define TK_CACHE 177 -#define TK_EXPLAIN 178 -#define TK_ANALYZE 179 -#define TK_VERBOSE 180 -#define TK_NK_BOOL 181 -#define TK_RATIO 182 -#define TK_NK_FLOAT 183 -#define TK_OUTPUTTYPE 184 -#define TK_AGGREGATE 185 -#define TK_BUFSIZE 186 -#define TK_STREAM 187 -#define TK_INTO 188 -#define TK_TRIGGER 189 -#define TK_AT_ONCE 190 -#define TK_WINDOW_CLOSE 191 -#define TK_IGNORE 192 -#define TK_EXPIRED 193 -#define TK_FILL_HISTORY 194 -#define TK_SUBTABLE 195 -#define TK_KILL 196 -#define TK_CONNECTION 197 -#define TK_TRANSACTION 198 -#define TK_BALANCE 199 -#define TK_VGROUP 200 -#define TK_MERGE 201 -#define TK_REDISTRIBUTE 202 -#define TK_SPLIT 203 -#define TK_DELETE 204 -#define TK_INSERT 205 -#define TK_NULL 206 -#define TK_NK_QUESTION 207 -#define TK_NK_ARROW 208 -#define TK_ROWTS 209 -#define TK_QSTART 210 -#define TK_QEND 211 -#define TK_QDURATION 212 -#define TK_WSTART 213 -#define TK_WEND 214 -#define TK_WDURATION 215 -#define TK_IROWTS 216 -#define TK_CAST 217 -#define TK_NOW 218 -#define TK_TODAY 219 -#define TK_TIMEZONE 220 -#define TK_CLIENT_VERSION 221 -#define TK_SERVER_VERSION 222 -#define TK_SERVER_STATUS 223 -#define TK_CURRENT_USER 224 -#define TK_COUNT 225 -#define TK_LAST_ROW 226 -#define TK_CASE 227 -#define TK_END 228 -#define TK_WHEN 229 -#define TK_THEN 230 -#define TK_ELSE 231 -#define TK_BETWEEN 232 -#define TK_IS 233 -#define TK_NK_LT 234 -#define TK_NK_GT 235 -#define TK_NK_LE 236 -#define TK_NK_GE 237 -#define TK_NK_NE 238 -#define TK_MATCH 239 -#define TK_NMATCH 240 -#define TK_CONTAINS 241 -#define TK_IN 242 -#define TK_JOIN 243 -#define TK_INNER 244 -#define TK_SELECT 245 -#define TK_DISTINCT 246 -#define TK_WHERE 247 -#define TK_PARTITION 248 -#define TK_BY 249 -#define TK_SESSION 250 -#define TK_STATE_WINDOW 251 -#define TK_SLIDING 252 -#define TK_FILL 253 -#define TK_VALUE 254 -#define TK_NONE 255 -#define TK_PREV 256 -#define TK_LINEAR 257 -#define TK_NEXT 258 -#define TK_HAVING 259 -#define TK_RANGE 260 -#define TK_EVERY 261 -#define TK_ORDER 262 -#define TK_SLIMIT 263 -#define TK_SOFFSET 264 -#define TK_LIMIT 265 -#define TK_OFFSET 266 -#define TK_ASC 267 -#define TK_NULLS 268 -#define TK_ABORT 269 -#define TK_AFTER 270 -#define TK_ATTACH 271 -#define TK_BEFORE 272 -#define TK_BEGIN 273 -#define TK_BITAND 274 -#define TK_BITNOT 275 -#define TK_BITOR 276 -#define TK_BLOCKS 277 -#define TK_CHANGE 278 -#define TK_COMMA 279 -#define TK_COMPACT 280 -#define TK_CONCAT 281 -#define TK_CONFLICT 282 -#define TK_COPY 283 -#define TK_DEFERRED 284 -#define TK_DELIMITERS 285 -#define TK_DETACH 286 -#define TK_DIVIDE 287 -#define TK_DOT 288 -#define TK_EACH 289 -#define TK_FAIL 290 -#define TK_FILE 291 -#define TK_FOR 292 -#define TK_GLOB 293 -#define TK_ID 294 -#define TK_IMMEDIATE 295 -#define TK_IMPORT 296 -#define TK_INITIALLY 297 -#define TK_INSTEAD 298 -#define TK_ISNULL 299 -#define TK_KEY 300 -#define TK_MODULES 301 -#define TK_NK_BITNOT 302 -#define TK_NK_SEMI 303 -#define TK_NOTNULL 304 -#define TK_OF 305 -#define TK_PLUS 306 -#define TK_PRIVILEGE 307 -#define TK_RAISE 308 -#define TK_REPLACE 309 -#define TK_RESTRICT 310 -#define TK_ROW 311 -#define TK_SEMI 312 -#define TK_STAR 313 -#define TK_STATEMENT 314 +#define TK_VGROUPS 79 +#define TK_SINGLE_STABLE 80 +#define TK_RETENTIONS 81 +#define TK_SCHEMALESS 82 +#define TK_WAL_LEVEL 83 +#define TK_WAL_FSYNC_PERIOD 84 +#define TK_WAL_RETENTION_PERIOD 85 +#define TK_WAL_RETENTION_SIZE 86 +#define TK_WAL_ROLL_PERIOD 87 +#define TK_WAL_SEGMENT_SIZE 88 +#define TK_STT_TRIGGER 89 +#define TK_TABLE_PREFIX 90 +#define TK_TABLE_SUFFIX 91 +#define TK_NK_COLON 92 +#define TK_MAX_SPEED 93 +#define TK_TABLE 94 +#define TK_NK_LP 95 +#define TK_NK_RP 96 +#define TK_STABLE 97 +#define TK_ADD 98 +#define TK_COLUMN 99 +#define TK_MODIFY 100 +#define TK_RENAME 101 +#define TK_TAG 102 +#define TK_SET 103 +#define TK_NK_EQ 104 +#define TK_USING 105 +#define TK_TAGS 106 +#define TK_COMMENT 107 +#define TK_BOOL 108 +#define TK_TINYINT 109 +#define TK_SMALLINT 110 +#define TK_INT 111 +#define TK_INTEGER 112 +#define TK_BIGINT 113 +#define TK_FLOAT 114 +#define TK_DOUBLE 115 +#define TK_BINARY 116 +#define TK_TIMESTAMP 117 +#define TK_NCHAR 118 +#define TK_UNSIGNED 119 +#define TK_JSON 120 +#define TK_VARCHAR 121 +#define TK_MEDIUMBLOB 122 +#define TK_BLOB 123 +#define TK_VARBINARY 124 +#define TK_DECIMAL 125 +#define TK_MAX_DELAY 126 +#define TK_WATERMARK 127 +#define TK_ROLLUP 128 +#define TK_TTL 129 +#define TK_SMA 130 +#define TK_DELETE_MARK 131 +#define TK_FIRST 132 +#define TK_LAST 133 +#define TK_SHOW 134 +#define TK_PRIVILEGES 135 +#define TK_DATABASES 136 +#define TK_TABLES 137 +#define TK_STABLES 138 +#define TK_MNODES 139 +#define TK_QNODES 140 +#define TK_FUNCTIONS 141 +#define TK_INDEXES 142 +#define TK_ACCOUNTS 143 +#define TK_APPS 144 +#define TK_CONNECTIONS 145 +#define TK_LICENCES 146 +#define TK_GRANTS 147 +#define TK_QUERIES 148 +#define TK_SCORES 149 +#define TK_TOPICS 150 +#define TK_VARIABLES 151 +#define TK_CLUSTER 152 +#define TK_BNODES 153 +#define TK_SNODES 154 +#define TK_TRANSACTIONS 155 +#define TK_DISTRIBUTED 156 +#define TK_CONSUMERS 157 +#define TK_SUBSCRIPTIONS 158 +#define TK_VNODES 159 +#define TK_LIKE 160 +#define TK_TBNAME 161 +#define TK_QTAGS 162 +#define TK_AS 163 +#define TK_INDEX 164 +#define TK_FUNCTION 165 +#define TK_INTERVAL 166 +#define TK_TOPIC 167 +#define TK_WITH 168 +#define TK_META 169 +#define TK_CONSUMER 170 +#define TK_GROUP 171 +#define TK_DESC 172 +#define TK_DESCRIBE 173 +#define TK_RESET 174 +#define TK_QUERY 175 +#define TK_CACHE 176 +#define TK_EXPLAIN 177 +#define TK_ANALYZE 178 +#define TK_VERBOSE 179 +#define TK_NK_BOOL 180 +#define TK_RATIO 181 +#define TK_NK_FLOAT 182 +#define TK_OUTPUTTYPE 183 +#define TK_AGGREGATE 184 +#define TK_BUFSIZE 185 +#define TK_STREAM 186 +#define TK_INTO 187 +#define TK_TRIGGER 188 +#define TK_AT_ONCE 189 +#define TK_WINDOW_CLOSE 190 +#define TK_IGNORE 191 +#define TK_EXPIRED 192 +#define TK_FILL_HISTORY 193 +#define TK_SUBTABLE 194 +#define TK_KILL 195 +#define TK_CONNECTION 196 +#define TK_TRANSACTION 197 +#define TK_BALANCE 198 +#define TK_VGROUP 199 +#define TK_MERGE 200 +#define TK_REDISTRIBUTE 201 +#define TK_SPLIT 202 +#define TK_DELETE 203 +#define TK_INSERT 204 +#define TK_NULL 205 +#define TK_NK_QUESTION 206 +#define TK_NK_ARROW 207 +#define TK_ROWTS 208 +#define TK_QSTART 209 +#define TK_QEND 210 +#define TK_QDURATION 211 +#define TK_WSTART 212 +#define TK_WEND 213 +#define TK_WDURATION 214 +#define TK_IROWTS 215 +#define TK_CAST 216 +#define TK_NOW 217 +#define TK_TODAY 218 +#define TK_TIMEZONE 219 +#define TK_CLIENT_VERSION 220 +#define TK_SERVER_VERSION 221 +#define TK_SERVER_STATUS 222 +#define TK_CURRENT_USER 223 +#define TK_COUNT 224 +#define TK_LAST_ROW 225 +#define TK_CASE 226 +#define TK_END 227 +#define TK_WHEN 228 +#define TK_THEN 229 +#define TK_ELSE 230 +#define TK_BETWEEN 231 +#define TK_IS 232 +#define TK_NK_LT 233 +#define TK_NK_GT 234 +#define TK_NK_LE 235 +#define TK_NK_GE 236 +#define TK_NK_NE 237 +#define TK_MATCH 238 +#define TK_NMATCH 239 +#define TK_CONTAINS 240 +#define TK_IN 241 +#define TK_JOIN 242 +#define TK_INNER 243 +#define TK_SELECT 244 +#define TK_DISTINCT 245 +#define TK_WHERE 246 +#define TK_PARTITION 247 +#define TK_BY 248 +#define TK_SESSION 249 +#define TK_STATE_WINDOW 250 +#define TK_SLIDING 251 +#define TK_FILL 252 +#define TK_VALUE 253 +#define TK_NONE 254 +#define TK_PREV 255 +#define TK_LINEAR 256 +#define TK_NEXT 257 +#define TK_HAVING 258 +#define TK_RANGE 259 +#define TK_EVERY 260 +#define TK_ORDER 261 +#define TK_SLIMIT 262 +#define TK_SOFFSET 263 +#define TK_LIMIT 264 +#define TK_OFFSET 265 +#define TK_ASC 266 +#define TK_NULLS 267 +#define TK_ABORT 268 +#define TK_AFTER 269 +#define TK_ATTACH 270 +#define TK_BEFORE 271 +#define TK_BEGIN 272 +#define TK_BITAND 273 +#define TK_BITNOT 274 +#define TK_BITOR 275 +#define TK_BLOCKS 276 +#define TK_CHANGE 277 +#define TK_COMMA 278 +#define TK_COMPACT 279 +#define TK_CONCAT 280 +#define TK_CONFLICT 281 +#define TK_COPY 282 +#define TK_DEFERRED 283 +#define TK_DELIMITERS 284 +#define TK_DETACH 285 +#define TK_DIVIDE 286 +#define TK_DOT 287 +#define TK_EACH 288 +#define TK_FAIL 289 +#define TK_FILE 290 +#define TK_FOR 291 +#define TK_GLOB 292 +#define TK_ID 293 +#define TK_IMMEDIATE 294 +#define TK_IMPORT 295 +#define TK_INITIALLY 296 +#define TK_INSTEAD 297 +#define TK_ISNULL 298 +#define TK_KEY 299 +#define TK_MODULES 300 +#define TK_NK_BITNOT 301 +#define TK_NK_SEMI 302 +#define TK_NOTNULL 303 +#define TK_OF 304 +#define TK_PLUS 305 +#define TK_PRIVILEGE 306 +#define TK_RAISE 307 +#define TK_REPLACE 308 +#define TK_RESTRICT 309 +#define TK_ROW 310 +#define TK_SEMI 311 +#define TK_STAR 312 +#define TK_STATEMENT 313 +#define TK_STRICT 314 #define TK_STRING 315 #define TK_TIMES 316 #define TK_UPDATE 317 diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index 6154882756..a95db86d3f 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -211,6 +211,8 @@ int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, const SName* pTableName, STab int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists); +int32_t catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta); + /** * Force refresh DB's local cached vgroup info. * @param pCtg (input, got with catalogGetHandle) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 4cf4800472..a13d203889 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -230,7 +230,7 @@ int64_t syncOpen(SSyncInfo* pSyncInfo); int32_t syncStart(int64_t rid); void syncStop(int64_t rid); void syncPreStop(int64_t rid); -int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak); +int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak, int64_t* seq); int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg); int32_t syncReconfig(int64_t rid, SSyncCfg* pCfg); int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex); @@ -240,6 +240,7 @@ int32_t syncStepDown(int64_t rid, SyncTerm newTerm); bool syncIsReadyForRead(int64_t rid); bool syncSnapshotSending(int64_t rid); bool syncSnapshotRecving(int64_t rid); +int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq); SSyncState syncGetState(int64_t rid); void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet); diff --git a/include/libs/transport/trpc.h b/include/libs/transport/trpc.h index 87f753e6aa..de3c2a9f52 100644 --- a/include/libs/transport/trpc.h +++ b/include/libs/transport/trpc.h @@ -77,14 +77,12 @@ typedef void (*RpcDfp)(void *ahandle); typedef struct SRpcInit { char localFqdn[TSDB_FQDN_LEN]; - uint16_t localPort; // local port - char *label; // for debug purpose - int32_t numOfThreads; // number of threads to handle connections - int32_t sessions; // number of sessions allowed - int8_t connType; // TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS - int32_t idleTime; // milliseconds, 0 means idle timer is disabled - int32_t retryLimit; // retry limit - int32_t retryInterval; // retry interval ms + uint16_t localPort; // local port + char *label; // for debug purpose + int32_t numOfThreads; // number of threads to handle connections + int32_t sessions; // number of sessions allowed + int8_t connType; // TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS + int32_t idleTime; // milliseconds, 0 means idle timer is disabled int32_t retryMinInterval; // retry init interval int32_t retryStepFactor; // retry interval factor diff --git a/include/os/osDir.h b/include/os/osDir.h index 40012f8141..73871602c5 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -62,6 +62,7 @@ int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen); bool taosIsDir(const char *dirname); char *taosDirName(char *dirname); char *taosDirEntryBaseName(char *dirname); +void taosGetCwd(char *buf, int32_t len); TdDirPtr taosOpenDir(const char *dirname); TdDirEntryPtr taosReadDir(TdDirPtr pDir); diff --git a/include/os/osEnv.h b/include/os/osEnv.h index a3bd209693..533d989ffc 100644 --- a/include/os/osEnv.h +++ b/include/os/osEnv.h @@ -36,7 +36,7 @@ extern int64_t tsStreamMax; extern float tsNumOfCores; extern int64_t tsTotalMemoryKB; extern char *tsProcPath; -extern char tsSIMDEnable; +extern char tsSIMDBuiltins; extern char tsSSE42Enable; extern char tsAVXEnable; extern char tsAVX2Enable; diff --git a/include/os/osSystem.h b/include/os/osSystem.h index 31ec513fca..8f1f5c58d5 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -62,8 +62,11 @@ void taosResetTerminalMode(); taosMemoryFree(strings); \ } #else -#define taosPrintTrace(flags, level, dflag) \ - {} +#define taosPrintTrace(flags, level, dflag) \ + { \ + taosPrintLog(flags, level, dflag, \ + "backtrace not implemented on windows, so detailed stack information cannot be printed"); \ + } #endif #ifdef __cplusplus diff --git a/include/util/tdef.h b/include/util/tdef.h index 58c8c1b51a..e1d421a399 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -307,8 +307,9 @@ typedef enum ELogicConditionType { #define TSDB_MIN_DURATION_PER_FILE 60 // unit minute #define TSDB_MAX_DURATION_PER_FILE (3650 * 1440) #define TSDB_DEFAULT_DURATION_PER_FILE (10 * 1440) -#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute -#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. +#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute +#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. +#define TSDB_MAX_KEEP_NS (365 * 292 * 1440) // data in db to be reserved. #define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years #define TSDB_MIN_MINROWS_FBLOCK 10 #define TSDB_MAX_MINROWS_FBLOCK 1000 @@ -336,7 +337,7 @@ typedef enum ELogicConditionType { #define TSDB_DB_STRICT_ON_STR "on" #define TSDB_DB_STRICT_OFF 0 #define TSDB_DB_STRICT_ON 1 -#define TSDB_DEFAULT_DB_STRICT TSDB_DB_STRICT_OFF +#define TSDB_DEFAULT_DB_STRICT TSDB_DB_STRICT_ON #define TSDB_CACHE_MODEL_STR_LEN sizeof(TSDB_CACHE_MODEL_LAST_VALUE_STR) #define TSDB_CACHE_MODEL_NONE_STR "none" #define TSDB_CACHE_MODEL_LAST_ROW_STR "last_row" @@ -496,6 +497,9 @@ enum { // sort page size by default #define DEFAULT_PAGESIZE 4096 +#define VNODE_TIMEOUT_SEC 60 +#define MNODE_TIMEOUT_SEC 10 + #ifdef __cplusplus } #endif diff --git a/include/util/tlog.h b/include/util/tlog.h index b6a389b6d9..e6ef7f388f 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -83,8 +83,8 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons #endif ; -bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); -#define ASSERTS(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) +bool taosAssert(bool condition, const char *file, int32_t line, const char *format, ...); +#define ASSERTS(condition, ...) taosAssert(condition, __FILE__, __LINE__, __VA_ARGS__) #define ASSERT(condition) ASSERTS(condition, "assert info not provided") // clang-format off diff --git a/include/util/tqueue.h b/include/util/tqueue.h index 8b46bbd064..1f6b205cdf 100644 --- a/include/util/tqueue.h +++ b/include/util/tqueue.h @@ -65,6 +65,7 @@ typedef struct STaosQnode { STaosQnode *next; STaosQueue *queue; int64_t timestamp; + int64_t dataSize; int32_t size; int8_t itype; int8_t reserved[3]; @@ -103,7 +104,7 @@ typedef struct STaosQall { STaosQueue *taosOpenQueue(); void taosCloseQueue(STaosQueue *queue); void taosSetQueueFp(STaosQueue *queue, FItem itemFp, FItems itemsFp); -void *taosAllocateQitem(int32_t size, EQItype itype); +void *taosAllocateQitem(int32_t size, EQItype itype, int64_t dataSize); void taosFreeQitem(void *pItem); void taosWriteQitem(STaosQueue *queue, void *pItem); int32_t taosReadQitem(STaosQueue *queue, void **ppItem); diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index 4e32e9ad8f..edec338c55 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -187,7 +187,7 @@ if [[ $productName == "TDengine" ]]; then git clone --depth 1 https://github.com/taosdata/taos-connector-dotnet ${install_dir}/connector/dotnet rm -rf ${install_dir}/connector/dotnet/.git ||: # cp -r ${connector_dir}/nodejs ${install_dir}/connector - git clone --depth 1 https://github.com/taosdata/libtaos-rs ${install_dir}/connector/rust + git clone --depth 1 https://github.com/taosdata/taos-connector-rust ${install_dir}/connector/rust rm -rf ${install_dir}/connector/rust/.git ||: fi fi diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 2776683a24..4169bed3eb 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -318,7 +318,7 @@ if [ "$verMode" == "cluster" ] || [ "$verMode" == "cloud" ]; then git clone --depth 1 https://github.com/taosdata/taos-connector-dotnet ${install_dir}/connector/dotnet rm -rf ${install_dir}/connector/dotnet/.git ||: - git clone --depth 1 https://github.com/taosdata/libtaos-rs ${install_dir}/connector/rust + git clone --depth 1 https://github.com/taosdata/taos-connector-rust ${install_dir}/connector/rust rm -rf ${install_dir}/connector/rust/.git ||: # cp -r ${connector_dir}/python ${install_dir}/connector @@ -379,4 +379,4 @@ if [ -n "${taostools_bin_files}" ]; then fi fi -cd ${curr_dir} \ No newline at end of file +cd ${curr_dir} diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index c694a6c1a0..2cb337fc4c 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -146,8 +146,7 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) { rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.compressSize = tsCompressMsgSize; rpcInit.dfp = destroyAhandle; - rpcInit.retryLimit = tsRpcRetryLimit; - rpcInit.retryInterval = tsRpcRetryInterval; + rpcInit.retryMinInterval = tsRedirectPeriod; rpcInit.retryStepFactor = tsRedirectFactor; rpcInit.retryMaxInterval = tsRedirectMaxPeriod; @@ -232,7 +231,7 @@ void destroyTscObj(void *pObj) { pTscObj->pAppInfo->numOfConns); // In any cases, we should not free app inst here. Or an race condition rises. - /*int64_t connNum = */atomic_sub_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); + /*int64_t connNum = */ atomic_sub_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); taosThreadMutexDestroy(&pTscObj->mutex); taosMemoryFree(pTscObj); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index e6584f4a00..807c752873 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -190,8 +190,9 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, (*pRequest)->body.param = param; STscObj* pTscObj = (*pRequest)->pTscObj; - if (taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self, - sizeof((*pRequest)->self))) { + int32_t err = taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self, + sizeof((*pRequest)->self)); + if (err) { tscError("%" PRId64 " failed to add to request container, reqId:0x%" PRIx64 ", conn:%" PRId64 ", %s", (*pRequest)->self, (*pRequest)->requestId, pTscObj->id, sql); @@ -1645,7 +1646,8 @@ int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols) { static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, int32_t numOfRows) { char* p = (char*)pResultInfo->pData; - // | version | total length | total rows | total columns | flag seg| block group id | column schema | each column length | + // | version | total length | total rows | total columns | flag seg| block group id | column schema | each column + // length | int32_t len = getVersion1BlockMetaSize(p, numOfCols); int32_t* colLength = (int32_t*)(p + len); len += sizeof(int32_t) * numOfCols; @@ -1971,8 +1973,6 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.compressSize = tsCompressMsgSize; rpcInit.user = "_dnd"; - rpcInit.retryLimit = tsRpcRetryLimit; - rpcInit.retryInterval = tsRpcRetryInterval; clientRpc = rpcOpen(&rpcInit); if (clientRpc == NULL) { @@ -2294,14 +2294,14 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly); tsem_wait(¶m->sem); - SRequestObj *pRequest = NULL; + SRequestObj* pRequest = NULL; if (param->pRequest != NULL) { param->pRequest->syncQuery = true; pRequest = param->pRequest; } else { taosMemoryFree(param); } - + return pRequest; } @@ -2317,13 +2317,13 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid); tsem_wait(¶m->sem); - SRequestObj *pRequest = NULL; + SRequestObj* pRequest = NULL; if (param->pRequest != NULL) { param->pRequest->syncQuery = true; pRequest = param->pRequest; } else { taosMemoryFree(param); } - + return pRequest; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 333cfa3dfd..87f5e5fa40 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -802,7 +802,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c tstrerror(code)); if (code == TSDB_CODE_SUCCESS) { - pWrapper->pCatalogReq->forceUpdate = false; + //pWrapper->pCatalogReq->forceUpdate = false; code = qContinueParseSql(pWrapper->pParseCtx, pWrapper->pCatalogReq, pResultMeta, pQuery); } @@ -883,6 +883,11 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { if (pRequest->retry++ > REQUEST_TOTAL_EXEC_TIMES) { code = pRequest->prevCode; + terrno = code; + pRequest->code = code; + tscDebug("call sync query cb with code: %s", tstrerror(code)); + pRequest->body.queryFp(pRequest->body.param, pRequest, code); + return; } if (TSDB_CODE_SUCCESS == code) { @@ -933,6 +938,17 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); destorySqlCallbackWrapper(pWrapper); + qDestroyQuery(pRequest->pQuery); + pRequest->pQuery = NULL; + + if (NEED_CLIENT_HANDLE_ERROR(code)) { + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, + pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); + pRequest->prevCode = code; + doAsyncQuery(pRequest, true); + return; + } + terrno = code; pRequest->code = code; pRequest->body.queryFp(pRequest->body.param, pRequest, code); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index d94a049722..350ecdd373 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -691,7 +691,7 @@ void tmqAssignAskEpTask(void* param, void* tmrId) { int64_t refId = *(int64_t*)param; tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId); if (tmq != NULL) { - int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM); + int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM, 0); *pTaskType = TMQ_DELAYED_TASK__ASK_EP; taosWriteQitem(tmq->delayedTask, pTaskType); tsem_post(&tmq->rspSem); @@ -703,7 +703,7 @@ void tmqAssignDelayedCommitTask(void* param, void* tmrId) { int64_t refId = *(int64_t*)param; tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId); if (tmq != NULL) { - int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM); + int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM, 0); *pTaskType = TMQ_DELAYED_TASK__COMMIT; taosWriteQitem(tmq->delayedTask, pTaskType); tsem_post(&tmq->rspSem); @@ -715,7 +715,7 @@ void tmqAssignDelayedReportTask(void* param, void* tmrId) { int64_t refId = *(int64_t*)param; tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId); if (tmq != NULL) { - int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM); + int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM, 0); *pTaskType = TMQ_DELAYED_TASK__REPORT; taosWriteQitem(tmq->delayedTask, pTaskType); tsem_post(&tmq->rspSem); @@ -1171,7 +1171,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { goto CREATE_MSG_FAIL; } if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { - SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM); + SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { tscWarn("msg discard from vgId:%d, epoch %d since out of memory", vgId, epoch); goto CREATE_MSG_FAIL; @@ -1204,7 +1204,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { // handle meta rsp int8_t rspType = ((SMqRspHead*)pMsg->pData)->mqMsgType; - SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM); + SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); @@ -1394,7 +1394,7 @@ int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) { tmqUpdateEp(tmq, head->epoch, &rsp); tDeleteSMqAskEpRsp(&rsp); } else { - SMqAskEpRspWrapper* pWrapper = taosAllocateQitem(sizeof(SMqAskEpRspWrapper), DEF_QITEM); + SMqAskEpRspWrapper* pWrapper = taosAllocateQitem(sizeof(SMqAskEpRspWrapper), DEF_QITEM, 0); if (pWrapper == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = -1; diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index dfd0b68039..2b43229b83 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -358,7 +358,11 @@ size_t blockDataGetNumOfCols(const SSDataBlock* pBlock) { return taosArrayGetSiz size_t blockDataGetNumOfRows(const SSDataBlock* pBlock) { return pBlock->info.rows; } int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex) { - if (pDataBlock == NULL || pDataBlock->info.rows <= 0) { + if (pDataBlock->info.rows > 0) { +// ASSERT(pDataBlock->info.dataLoad == 1); + } + + if (pDataBlock == NULL || pDataBlock->info.rows <= 0 || pDataBlock->info.dataLoad == 0) { return 0; } @@ -1157,13 +1161,14 @@ void blockDataEmpty(SSDataBlock* pDataBlock) { } pInfo->rows = 0; + pInfo->dataLoad = 0; pInfo->window.ekey = 0; pInfo->window.skey = 0; } // todo temporarily disable it static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows, bool clearPayload) { - ASSERT(numOfRows > 0 /*&& pBlockInfo->capacity >= pBlockInfo->rows*/); + ASSERT(numOfRows > 0); if (numOfRows <= pBlockInfo->capacity) { return TSDB_CODE_SUCCESS; } @@ -1220,7 +1225,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* return TSDB_CODE_SUCCESS; } -void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) { +void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) { pColumn->hasNull = false; if (IS_VAR_DATA_TYPE(pColumn->info.type)) { @@ -1946,9 +1951,9 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) int32_t len = 0; len += snprintf(dumpBuf + len, size - len, "===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%" PRId64 - "|rows:%d|version:%" PRIu64 "\n", + "|rows:%d|version:%" PRIu64 "|cal start:%" PRIu64 "|cal end:%" PRIu64 "\n", flag, (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.id.groupId, - pDataBlock->info.id.uid, pDataBlock->info.rows, pDataBlock->info.version); + pDataBlock->info.id.uid, pDataBlock->info.rows, pDataBlock->info.version, pDataBlock->info.calWin.skey, pDataBlock->info.calWin.ekey); if (len >= size - 1) return dumpBuf; for (int32_t j = 0; j < rows; j++) { @@ -2427,6 +2432,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { pStart += colLen[i]; } + pBlock->info.dataLoad = 1; pBlock->info.rows = numOfRows; ASSERT(pStart - pData == dataLen); return pStart; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 7e9b28939b..f57d59fb41 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -180,8 +180,6 @@ int32_t tsUptimeInterval = 300; // seconds char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits char tsUdfdLdLibPath[512] = ""; -int32_t tsRpcRetryLimit = 100; -int32_t tsRpcRetryInterval = 15; #ifndef _STORAGE int32_t taosSetTfsCfg(SConfig *pCfg) { SConfigItem *pItem = cfgGetItem(pCfg, "dataDir"); @@ -203,7 +201,9 @@ int32_t taosSetTfsCfg(SConfig *pCfg) { int32_t taosSetTfsCfg(SConfig *pCfg); #endif -struct SConfig *taosGetCfg() { return tsCfg; } +struct SConfig *taosGetCfg() { + return tsCfg; +} static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile, char *apolloUrl) { @@ -313,8 +313,6 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1; if (cfgAddInt32(pCfg, "smlBatchSize", tsSmlBatchSize, 1, INT32_MAX, true) != 0) return -1; if (cfgAddInt32(pCfg, "maxMemUsedByInsert", tsMaxMemUsedByInsert, 1, INT32_MAX, true) != 0) return -1; - if (cfgAddInt32(pCfg, "rpcRetryLimit", tsRpcRetryLimit, 1, 100000, 0) != 0) return -1; - if (cfgAddInt32(pCfg, "rpcRetryInterval", tsRpcRetryInterval, 1, 100000, 0) != 0) return -1; if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, 0) != 0) return -1; tsNumOfTaskQueueThreads = tsNumOfCores / 2; @@ -341,7 +339,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "AVX", tsAVXEnable, 0) != 0) return -1; if (cfgAddBool(pCfg, "AVX2", tsAVX2Enable, 0) != 0) return -1; if (cfgAddBool(pCfg, "FMA", tsFMAEnable, 0) != 0) return -1; - if (cfgAddBool(pCfg, "SIMD-Supported", tsSIMDEnable, 0) != 0) return -1; + if (cfgAddBool(pCfg, "SIMD-builtins", tsSIMDBuiltins, 0) != 0) return -1; if (cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, 1) != 0) return -1; if (cfgAddInt64(pCfg, "streamMax", tsStreamMax, 0, INT64_MAX, 1) != 0) return -1; @@ -457,9 +455,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1; if (cfgAddString(pCfg, "udfdLdLibPath", tsUdfdLdLibPath, 0) != 0) return -1; - if (cfgAddInt32(pCfg, "rpcRetryLimit", tsRpcRetryLimit, 1, 100000, 0) != 0) return -1; - if (cfgAddInt32(pCfg, "rpcRetryInterval", tsRpcRetryInterval, 1, 100000, 0) != 0) return -1; - GRANT_CFG_ADD; return 0; } @@ -674,8 +669,6 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval; tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval; - tsRpcRetryLimit = cfgGetItem(pCfg, "rpcRetryLimit")->i32; - tsRpcRetryInterval = cfgGetItem(pCfg, "rpcRetryInterval")->i32; tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; return 0; } @@ -738,10 +731,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tstrncpy(tsTelemServer, cfgGetItem(pCfg, "telemetryServer")->str, TSDB_FQDN_LEN); tsTelemPort = (uint16_t)cfgGetItem(pCfg, "telemetryPort")->i32; - tsElectInterval = cfgGetItem(pCfg, "syncElectInterval")->i32; - tsHeartbeatInterval = cfgGetItem(pCfg, "syncHeartbeatInterval")->i32; - tsHeartbeatTimeout = cfgGetItem(pCfg, "syncHeartbeatTimeout")->i32; - tsTransPullupInterval = cfgGetItem(pCfg, "transPullupInterval")->i32; tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32; tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; @@ -761,9 +750,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { if (tsQueryBufferSize >= 0) { tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL; } - - tsRpcRetryLimit = cfgGetItem(pCfg, "rpcRetryLimit")->i32; - tsRpcRetryInterval = cfgGetItem(pCfg, "rpcRetryInterval")->i32; GRANT_CFG_GET; return 0; } diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 6963803df0..a8103351b4 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -17,6 +17,7 @@ #include "dmMgmt.h" #include "mnode.h" #include "tconfig.h" +#include "tglobal.h" // clang-format off #define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'." @@ -45,9 +46,30 @@ static struct { SArray *pArgs; // SConfigPair } global = {0}; -static void dmStopDnode(int signum, void *info, void *ctx) { dmStop(); } +static void dmSetDebugFlag(int32_t signum, void *sigInfo, void *context) { taosSetAllDebugFlag(143, true); } +static void dmSetAssert(int32_t signum, void *sigInfo, void *context) { tsAssert = 1; } + +static void dmStopDnode(int signum, void *sigInfo, void *context) { + // taosIgnSignal(SIGUSR1); + // taosIgnSignal(SIGUSR2); + taosIgnSignal(SIGTERM); + taosIgnSignal(SIGHUP); + taosIgnSignal(SIGINT); + taosIgnSignal(SIGABRT); + taosIgnSignal(SIGBREAK); + + dInfo("shut down signal is %d", signum); +#ifndef WINDOWS + dInfo("sender PID:%d cmdline:%s", ((siginfo_t *)sigInfo)->si_pid, + taosGetCmdlineByPID(((siginfo_t *)sigInfo)->si_pid)); +#endif + + dmStop(); +} static void dmSetSignalHandle() { + taosSetSignal(SIGUSR1, dmSetDebugFlag); + taosSetSignal(SIGUSR2, dmSetAssert); taosSetSignal(SIGTERM, dmStopDnode); taosSetSignal(SIGHUP, dmStopDnode); taosSetSignal(SIGINT, dmStopDnode); @@ -105,6 +127,19 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { return 0; } +static void dmPrintArgs(int32_t argc, char const *argv[]) { + char path[1024] = {0}; + taosGetCwd(path, sizeof(path)); + + char args[1024] = {0}; + int32_t arglen = snprintf(args, sizeof(args), "%s", argv[0]); + for (int32_t i = 1; i < argc; ++i) { + arglen = arglen + snprintf(args + arglen, sizeof(args) - arglen, " %s", argv[i]); + } + + dInfo("startup path:%s args:%s", path, args); +} + static void dmGenerateGrant() { mndGenerateMachineCode(); } static void dmPrintVersion() { @@ -194,6 +229,8 @@ int mainWindows(int argc, char **argv) { return -1; } + dmPrintArgs(argc, argv); + if (taosInitCfg(configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0) != 0) { dError("failed to start since read config error"); taosCloseLog(); diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index a7ad983b0c..39eeeb32ea 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -103,7 +103,12 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { tSerializeSStatusReq(pHead, contLen, &req); tFreeSStatusReq(&req); - SRpcMsg rpcMsg = {.pCont = pHead, .contLen = contLen, .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527}; + SRpcMsg rpcMsg = {.pCont = pHead, + .contLen = contLen, + .msgType = TDMT_MND_STATUS, + .info.ahandle = (void *)0x9527, + .info.refId = 0, + .info.noResp = 0}; SRpcMsg rpcRsp = {0}; dTrace("send status req to mnode, dnodeVer:%" PRId64 " statusSeq:%d", req.dnodeVer, req.statusSeq); @@ -150,7 +155,8 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) { SServerStatusRsp statusRsp = {0}; SMonMloadInfo minfo = {0}; (*pMgmt->getMnodeLoadsFp)(&minfo); - if (minfo.isMnode && (minfo.load.syncState == TAOS_SYNC_STATE_ERROR || minfo.load.syncState == TAOS_SYNC_STATE_OFFLINE)) { + if (minfo.isMnode && + (minfo.load.syncState == TAOS_SYNC_STATE_ERROR || minfo.load.syncState == TAOS_SYNC_STATE_OFFLINE)) { pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED; snprintf(pStatus->details, sizeof(pStatus->details), "mnode sync state is %s", syncStr(minfo.load.syncState)); return; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index 30ef7b9542..80c040a5e8 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -20,7 +20,9 @@ static void *dmStatusThreadFp(void *param) { SDnodeMgmt *pMgmt = param; int64_t lastTime = taosGetTimestampMs(); setThreadName("dnode-status"); - + + const static int16_t TRIM_FREQ = 30; + int32_t trimCount = 0; while (1) { taosMsleep(200); if (pMgmt->pData->dropped || pMgmt->pData->stopped) break; @@ -28,9 +30,13 @@ static void *dmStatusThreadFp(void *param) { int64_t curTime = taosGetTimestampMs(); float interval = (curTime - lastTime) / 1000.0f; if (interval >= tsStatusInterval) { - taosMemoryTrim(0); dmSendStatusReq(pMgmt); lastTime = curTime; + + trimCount = (trimCount + 1) % TRIM_FREQ; + if (trimCount == 0) { + taosMemoryTrim(0); + } } } diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c index 857fbcbce5..095857825d 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c @@ -159,12 +159,12 @@ int32_t mmPutMsgToQueue(SMnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { } if (pWorker == NULL) return -1; - SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM); + SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM, pRpc->contLen); if (pMsg == NULL) return -1; memcpy(pMsg, pRpc, sizeof(SRpcMsg)); pRpc->pCont = NULL; - dTrace("msg:%p, is created and will put into %s queue, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType)); + dTrace("msg:%p, is created and will put into %s queue, type:%s len:%d", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType), pRpc->contLen); int32_t code = mmPutMsgToWorker(pMgmt, pWorker, pMsg); if (code != 0) { dTrace("msg:%p, is freed", pMsg); diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmWorker.c b/source/dnode/mgmt/mgmt_qnode/src/qmWorker.c index 3e5ad65db7..28da0f9c5f 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmWorker.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmWorker.c @@ -58,19 +58,19 @@ int32_t qmPutNodeMsgToFetchQueue(SQnodeMgmt *pMgmt, SRpcMsg *pMsg) { } int32_t qmPutRpcMsgToQueue(SQnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { - SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM); + SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM, pRpc->contLen); if (pMsg == NULL) return -1; memcpy(pMsg, pRpc, sizeof(SRpcMsg)); pRpc->pCont = NULL; switch (qtype) { case QUERY_QUEUE: - dTrace("msg:%p, is created and will put into qnode-query queue", pMsg); + dTrace("msg:%p, is created and will put into qnode-query queue, len:%d", pMsg, pRpc->contLen); taosWriteQitem(pMgmt->queryWorker.queue, pMsg); return 0; case READ_QUEUE: case FETCH_QUEUE: - dTrace("msg:%p, is created and will put into qnode-fetch queue", pMsg); + dTrace("msg:%p, is created and will put into qnode-fetch queue, len:%d", pMsg, pRpc->contLen); taosWriteQitem(pMgmt->fetchWorker.queue, pMsg); return 0; default: diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 2e66aeae37..9bd5be5201 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -130,7 +130,7 @@ void smStopWorker(SSnodeMgmt *pMgmt) { } int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { - SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM); + SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM, pRpc->contLen); if (pMsg == NULL) { rpcFreeCont(pRpc->pCont); pRpc->pCont = NULL; @@ -139,8 +139,8 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { SSnode *pSnode = pMgmt->pSnode; if (pSnode == NULL) { - dError("msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), - TMSG_INFO(pMsg->msgType), qtype); + dError("msg:%p failed to put into snode queue since %s, type:%s qtype:%d len:%d", pMsg, terrstr(), + TMSG_INFO(pMsg->msgType), qtype, pRpc->contLen); taosFreeQitem(pMsg); rpcFreeCont(pRpc->pCont); pRpc->pCont = NULL; diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index b38dc19361..b5c554e0ca 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -38,6 +38,8 @@ typedef struct SVnodeMgmt { TdThreadRwlock lock; SVnodesStat state; STfs *pTfs; + TdThread thread; + bool stop; } SVnodeMgmt; typedef struct { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 07ebd72379..313a88fc5c 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -334,6 +334,62 @@ static void vmCleanup(SVnodeMgmt *pMgmt) { taosMemoryFree(pMgmt); } +static void vmCheckSyncTimeout(SVnodeMgmt *pMgmt) { + int32_t numOfVnodes = 0; + SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); + + for (int32_t i = 0; i < numOfVnodes; ++i) { + SVnodeObj *pVnode = ppVnodes[i]; + vnodeSyncCheckTimeout(pVnode->pImpl); + vmReleaseVnode(pMgmt, pVnode); + } + + if (ppVnodes != NULL) { + taosMemoryFree(ppVnodes); + } +} + +static void *vmThreadFp(void *param) { + SVnodeMgmt *pMgmt = param; + int64_t lastTime = 0; + setThreadName("vnode-timer"); + + while (1) { + lastTime++; + taosMsleep(100); + if (pMgmt->stop) break; + if (lastTime % 10 != 0) continue; + + int64_t sec = lastTime / 10; + if (sec % (VNODE_TIMEOUT_SEC / 2) == 0) { + vmCheckSyncTimeout(pMgmt); + } + } + + return NULL; +} + +static int32_t vmInitTimer(SVnodeMgmt *pMgmt) { + TdThreadAttr thAttr; + taosThreadAttrInit(&thAttr); + taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); + if (taosThreadCreate(&pMgmt->thread, &thAttr, vmThreadFp, pMgmt) != 0) { + dError("failed to create vnode timer thread since %s", strerror(errno)); + return -1; + } + + taosThreadAttrDestroy(&thAttr); + return 0; +} + +static void vmCleanupTimer(SVnodeMgmt *pMgmt) { + pMgmt->stop = true; + if (taosCheckPthreadValid(pMgmt->thread)) { + taosThreadJoin(pMgmt->thread, NULL); + taosThreadClear(&pMgmt->thread); + } +} + static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { int32_t code = -1; @@ -510,12 +566,10 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { taosMemoryFree(ppVnodes); } - return 0; + return vmInitTimer(pMgmt); } -static void vmStop(SVnodeMgmt *pMgmt) { - // process inside the vnode -} +static void vmStop(SVnodeMgmt *pMgmt) { vmCleanupTimer(pMgmt); } SMgmtFunc vmGetMgmtFunc() { SMgmtFunc mgmtFunc = {0}; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 08ea880b97..7e3915f3d1 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -233,7 +233,7 @@ int32_t vmPutMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { } int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { - SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM); + SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM, pRpc->contLen); if (pMsg == NULL) { rpcFreeCont(pRpc->pCont); pRpc->pCont = NULL; @@ -241,7 +241,7 @@ int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { } SMsgHead *pHead = pRpc->pCont; - dTrace("vgId:%d, msg:%p is created, type:%s", pHead->vgId, pMsg, TMSG_INFO(pRpc->msgType)); + dTrace("vgId:%d, msg:%p is created, type:%s len:%d", pHead->vgId, pMsg, TMSG_INFO(pRpc->msgType), pRpc->contLen); pHead->contLen = htonl(pHead->contLen); pHead->vgId = htonl(pHead->vgId); diff --git a/source/dnode/mgmt/node_mgmt/src/dmNodes.c b/source/dnode/mgmt/node_mgmt/src/dmNodes.c index 6893e486bb..981797834a 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmNodes.c +++ b/source/dnode/mgmt/node_mgmt/src/dmNodes.c @@ -149,10 +149,13 @@ int32_t dmRunDnode(SDnode *pDnode) { return 0; } - if (count == 0) osUpdate(); - - count %= 10; - count++; + if (count == 10) { + osUpdate(); + count = 0; + } else { + count++; + } + taosMsleep(100); } } diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 99f8bd002a..5e1dcc6353 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -141,11 +141,12 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { } pRpc->info.wrapper = pWrapper; - pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM); + pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM, pRpc->contLen); if (pMsg == NULL) goto _OVER; memcpy(pMsg, pRpc, sizeof(SRpcMsg)); - dGTrace("msg:%p, is created, type:%s handle:%p", pMsg, TMSG_INFO(pRpc->msgType), pMsg->info.handle); + dGTrace("msg:%p, is created, type:%s handle:%p len:%d", pMsg, TMSG_INFO(pRpc->msgType), pMsg->info.handle, + pRpc->contLen); code = dmProcessNodeMsg(pWrapper, pMsg); @@ -258,8 +259,6 @@ int32_t dmInitClient(SDnode *pDnode) { rpcInit.rfp = rpcRfp; rpcInit.compressSize = tsCompressMsgSize; - rpcInit.retryLimit = tsRpcRetryLimit; - rpcInit.retryInterval = tsRpcRetryInterval; rpcInit.retryMinInterval = tsRedirectPeriod; rpcInit.retryStepFactor = tsRedirectFactor; rpcInit.retryMaxInterval = tsRedirectMaxPeriod; diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index a0f3c98f83..785ecc2bf5 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -84,14 +84,16 @@ typedef struct { } STelemMgmt; typedef struct { - tsem_t syncSem; - int64_t sync; - int32_t errCode; - int32_t transId; - SRWLatch lock; - int8_t selfIndex; - int8_t numOfReplicas; - SReplica replicas[TSDB_MAX_REPLICA]; + tsem_t syncSem; + int64_t sync; + int32_t errCode; + int32_t transId; + int32_t transSec; + int64_t transSeq; + TdThreadMutex lock; + int8_t selfIndex; + int8_t numOfReplicas; + SReplica replicas[TSDB_MAX_REPLICA]; } SSyncMgmt; typedef struct { diff --git a/source/dnode/mnode/impl/inc/mndSync.h b/source/dnode/mnode/impl/inc/mndSync.h index 993efbcd08..1f9a698a8a 100644 --- a/source/dnode/mnode/impl/inc/mndSync.h +++ b/source/dnode/mnode/impl/inc/mndSync.h @@ -26,6 +26,7 @@ int32_t mndInitSync(SMnode *pMnode); void mndCleanupSync(SMnode *pMnode); bool mndIsLeader(SMnode *pMnode); int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId); +void mndSyncCheckTimeout(SMnode *pMnode); void mndSyncStart(SMnode *pMnode); void mndSyncStop(SMnode *pMnode); diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h index 2372fa30e5..07066d2251 100644 --- a/source/dnode/mnode/impl/inc/mndTrans.h +++ b/source/dnode/mnode/impl/inc/mndTrans.h @@ -75,6 +75,7 @@ void mndTransSetCb(STrans *pTrans, ETrnFunc startFunc, ETrnFunc stopFunc, voi void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbname); void mndTransSetSerial(STrans *pTrans); void mndTransSetOper(STrans *pTrans, EOperType oper); +int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans); int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans); int32_t mndTransProcessRsp(SRpcMsg *pRsp); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 373a653b51..37e2c35225 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -554,11 +554,6 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { goto SUBSCRIBE_OVER; } - if (mndCheckDbPrivilegeByName(pMnode, pMsg->info.conn.user, MND_OPER_READ_DB, pTopic->db) != 0) { - mndReleaseTopic(pMnode, pTopic); - goto SUBSCRIBE_OVER; - } - if (mndCheckTopicPrivilege(pMnode, pMsg->info.conn.user, MND_OPER_SUBSCRIBE, pTopic) != 0) { mndReleaseTopic(pMnode, pTopic); goto SUBSCRIBE_OVER; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 43155124c1..0715556da2 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -776,6 +776,8 @@ static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *p int32_t code = -1; mndTransSetDbName(pTrans, pOld->name, NULL); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) return -1; + if (mndSetAlterDbRedoLogs(pMnode, pTrans, pOld, pNew) != 0) goto _OVER; if (mndSetAlterDbCommitLogs(pMnode, pTrans, pOld, pNew) != 0) goto _OVER; if (mndSetAlterDbRedoActions(pMnode, pTrans, pOld, pNew) != 0) goto _OVER; @@ -835,12 +837,14 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { + if (terrno != 0) code = terrno; mError("db:%s, failed to alter since %s", alterReq.db, terrstr()); } mndReleaseDb(pMnode, pDb); taosArrayDestroy(dbObj.cfg.pRetensions); + terrno = code; return code; } @@ -1183,7 +1187,8 @@ int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUs int32_t numOfTable = mndGetDBTableNum(pDb, pMnode); - if (pReq == NULL || pReq->vgVersion < pDb->vgVersion || pReq->dbId != pDb->uid || numOfTable != pReq->numOfTable || pReq->stateTs < pDb->stateTs) { + if (pReq == NULL || pReq->vgVersion < pDb->vgVersion || pReq->dbId != pDb->uid || numOfTable != pReq->numOfTable || + pReq->stateTs < pDb->stateTs) { mndBuildDBVgroupInfo(pDb, pMnode, pRsp->pVgroupInfos); } @@ -1298,21 +1303,22 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, SUseDbRsp usedbRsp = {0}; - if ((0 == strcasecmp(pDbVgVersion->dbFName, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcasecmp(pDbVgVersion->dbFName, TSDB_PERFORMANCE_SCHEMA_DB)))) { + if ((0 == strcasecmp(pDbVgVersion->dbFName, TSDB_INFORMATION_SCHEMA_DB) || + (0 == strcasecmp(pDbVgVersion->dbFName, TSDB_PERFORMANCE_SCHEMA_DB)))) { memcpy(usedbRsp.db, pDbVgVersion->dbFName, TSDB_DB_FNAME_LEN); int32_t vgVersion = mndGetGlobalVgroupVersion(pMnode); if (pDbVgVersion->vgVersion < vgVersion) { usedbRsp.pVgroupInfos = taosArrayInit(10, sizeof(SVgroupInfo)); - + mndBuildDBVgroupInfo(NULL, pMnode, usedbRsp.pVgroupInfos); usedbRsp.vgVersion = vgVersion++; } else { usedbRsp.vgVersion = pDbVgVersion->vgVersion; } usedbRsp.vgNum = taosArrayGetSize(usedbRsp.pVgroupInfos); - + taosArrayPush(batchUseRsp.pArray, &usedbRsp); - + continue; } @@ -1328,7 +1334,7 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, int32_t numOfTable = mndGetDBTableNum(pDb, pMnode); - if (pDbVgVersion->vgVersion >= pDb->vgVersion && numOfTable == pDbVgVersion->numOfTable && + if (pDbVgVersion->vgVersion >= pDb->vgVersion && numOfTable == pDbVgVersion->numOfTable && pDbVgVersion->stateTs == pDb->stateTs) { mTrace("db:%s, valid dbinfo, vgVersion:%d stateTs:%" PRId64 " numOfTables:%d, not changed vgVersion:%d stateTs:%" PRId64 " numOfTables:%d", diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 0538d70101..5772864ba8 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -672,6 +672,7 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) { snprintf(ep, TSDB_EP_LEN, "%s:%d", createReq.fqdn, createReq.port); pDnode = mndAcquireDnodeByEp(pMnode, ep); if (pDnode != NULL) { + terrno = TSDB_CODE_MND_DNODE_ALREADY_EXIST; goto _OVER; } diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index eb6742a564..117a9f5e67 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -101,6 +101,7 @@ static void *mndBuildCheckpointTickMsg(int32_t *pContLen, int64_t sec) { } static void mndPullupTrans(SMnode *pMnode) { + mTrace("pullup trans msg"); int32_t contLen = 0; void *pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { @@ -110,6 +111,7 @@ static void mndPullupTrans(SMnode *pMnode) { } static void mndPullupTtl(SMnode *pMnode) { + mTrace("pullup ttl"); int32_t contLen = 0; void *pReq = mndBuildTimerMsg(&contLen); SRpcMsg rpcMsg = {.msgType = TDMT_MND_TTL_TIMER, .pCont = pReq, .contLen = contLen}; @@ -117,6 +119,7 @@ static void mndPullupTtl(SMnode *pMnode) { } static void mndCalMqRebalance(SMnode *pMnode) { + mTrace("calc mq rebalance"); int32_t contLen = 0; void *pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { @@ -143,6 +146,7 @@ static void mndStreamCheckpointTick(SMnode *pMnode, int64_t sec) { } static void mndPullupTelem(SMnode *pMnode) { + mTrace("pullup telem msg"); int32_t contLen = 0; void *pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { @@ -152,6 +156,7 @@ static void mndPullupTelem(SMnode *pMnode) { } static void mndPullupGrant(SMnode *pMnode) { + mTrace("pullup grant msg"); int32_t contLen = 0; void *pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { @@ -162,6 +167,7 @@ static void mndPullupGrant(SMnode *pMnode) { } static void mndIncreaseUpTime(SMnode *pMnode) { + mTrace("increate uptime"); int32_t contLen = 0; void *pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { @@ -213,6 +219,9 @@ static void mndSetVgroupOffline(SMnode *pMnode, int32_t dnodeId, int64_t curMs) } static void mndCheckDnodeOffline(SMnode *pMnode) { + mTrace("check dnode offline"); + if (mndAcquireRpc(pMnode) != 0) return; + SSdb *pSdb = pMnode->pSdb; int64_t curMs = taosGetTimestampMs(); @@ -230,6 +239,8 @@ static void mndCheckDnodeOffline(SMnode *pMnode) { sdbRelease(pSdb, pDnode); } + + mndReleaseRpc(pMnode); } static void *mndThreadFp(void *param) { @@ -277,6 +288,10 @@ static void *mndThreadFp(void *param) { if (sec % (tsStatusInterval * 5) == 0) { mndCheckDnodeOffline(pMnode); } + + if (sec % (MNODE_TIMEOUT_SEC / 2) == 0) { + mndSyncCheckTimeout(pMnode); + } } return NULL; diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index fe76ba31d7..ffc357b2e8 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -769,7 +769,7 @@ static int32_t mndRetrieveQueries(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p } int32_t numOfQueries = taosArrayGetSize(pConn->pQueries); - for (int32_t i = 0; i < numOfQueries; ++i) { + for (int32_t i = 0; i < numOfQueries && numOfRows < rows; ++i) { SQueryDesc *pQuery = taosArrayGet(pConn->pQueries, i); cols = 0; diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 7cba69ed50..c96faddc4c 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -78,35 +78,38 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta SSdbRaw *pRaw = pMsg->pCont; int32_t transId = sdbGetIdFromRaw(pMnode->pSdb, pRaw); - pMgmt->errCode = pMeta->code; mInfo("trans:%d, is proposed, saved:%d code:0x%x, apply index:%" PRId64 " term:%" PRIu64 " config:%" PRId64 - " role:%s raw:%p", + " role:%s raw:%p sec:%d seq:%" PRId64, transId, pMgmt->transId, pMeta->code, pMeta->index, pMeta->term, pMeta->lastConfigIndex, syncStr(pMeta->state), - pRaw); + pRaw, pMgmt->transSec, pMgmt->transSeq); - if (pMgmt->errCode == 0) { + if (pMeta->code == 0) { sdbWriteWithoutFree(pMnode->pSdb, pRaw); sdbSetApplyInfo(pMnode->pSdb, pMeta->index, pMeta->term, pMeta->lastConfigIndex); } - taosWLockLatch(&pMgmt->lock); + taosThreadMutexLock(&pMgmt->lock); + pMgmt->errCode = pMeta->code; + if (transId <= 0) { - taosWUnLockLatch(&pMgmt->lock); - mError("trans:%d, invalid commit msg", transId); + taosThreadMutexUnlock(&pMgmt->lock); + mError("trans:%d, invalid commit msg, cache transId:%d seq:%" PRId64, transId, pMgmt->transId, pMgmt->transSeq); } else if (transId == pMgmt->transId) { if (pMgmt->errCode != 0) { mError("trans:%d, failed to propose since %s, post sem", transId, tstrerror(pMgmt->errCode)); } else { - mInfo("trans:%d, is proposed and post sem", transId); + mInfo("trans:%d, is proposed and post sem, seq:%" PRId64, transId, pMgmt->transSeq); } pMgmt->transId = 0; + pMgmt->transSec = 0; + pMgmt->transSeq = 0; tsem_post(&pMgmt->syncSem); - taosWUnLockLatch(&pMgmt->lock); + taosThreadMutexUnlock(&pMgmt->lock); } else { - taosWUnLockLatch(&pMgmt->lock); + taosThreadMutexUnlock(&pMgmt->lock); STrans *pTrans = mndAcquireTrans(pMnode, transId); if (pTrans != NULL) { - mInfo("trans:%d, execute in mnode which not leader", transId); + mInfo("trans:%d, execute in mnode which not leader or sync timeout", transId); mndTransExecute(pMnode, pTrans); mndReleaseTrans(pMnode, pTrans); // sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); @@ -149,9 +152,13 @@ void mndRestoreFinish(const SSyncFSM *pFsm) { SMnode *pMnode = pFsm->data; if (!pMnode->deploy) { - mInfo("vgId:1, sync restore finished, and will handle outstanding transactions"); - mndTransPullup(pMnode); - mndSetRestored(pMnode, true); + if (!pMnode->restored) { + mInfo("vgId:1, sync restore finished, and will handle outstanding transactions"); + mndTransPullup(pMnode); + mndSetRestored(pMnode, true); + } else { + mInfo("vgId:1, sync restore finished, repeat call"); + } } else { mInfo("vgId:1, sync restore finished"); } @@ -194,18 +201,20 @@ int32_t mndSnapshotDoWrite(const SSyncFSM *pFsm, void *pWriter, void *pBuf, int3 } static void mndBecomeFollower(const SSyncFSM *pFsm) { - SMnode *pMnode = pFsm->data; + SMnode *pMnode = pFsm->data; + SSyncMgmt *pMgmt = &pMnode->syncMgmt; mInfo("vgId:1, become follower"); - taosWLockLatch(&pMnode->syncMgmt.lock); - if (pMnode->syncMgmt.transId != 0) { - mInfo("vgId:1, become follower and post sem, trans:%d, failed to propose since not leader", - pMnode->syncMgmt.transId); - pMnode->syncMgmt.transId = 0; - pMnode->syncMgmt.errCode = TSDB_CODE_SYN_NOT_LEADER; - tsem_post(&pMnode->syncMgmt.syncSem); + taosThreadMutexLock(&pMgmt->lock); + if (pMgmt->transId != 0) { + mInfo("vgId:1, become follower and post sem, trans:%d, failed to propose since not leader", pMgmt->transId); + pMgmt->transId = 0; + pMgmt->transSec = 0; + pMgmt->transSeq = 0; + pMgmt->errCode = TSDB_CODE_SYN_NOT_LEADER; + tsem_post(&pMgmt->syncSem); } - taosWUnLockLatch(&pMnode->syncMgmt.lock); + taosThreadMutexUnlock(&pMgmt->lock); } static void mndBecomeLeader(const SSyncFSM *pFsm) { @@ -261,8 +270,10 @@ SSyncFSM *mndSyncMakeFsm(SMnode *pMnode) { int32_t mndInitSync(SMnode *pMnode) { SSyncMgmt *pMgmt = &pMnode->syncMgmt; - taosInitRWLatch(&pMgmt->lock); + taosThreadMutexInit(&pMgmt->lock, NULL); pMgmt->transId = 0; + pMgmt->transSec = 0; + pMgmt->transSeq = 0; SSyncInfo syncInfo = { .snapshotStrategy = SYNC_STRATEGY_STANDARD_SNAPSHOT, @@ -309,12 +320,38 @@ void mndCleanupSync(SMnode *pMnode) { mInfo("mnode-sync is stopped, id:%" PRId64, pMgmt->sync); tsem_destroy(&pMgmt->syncSem); + taosThreadMutexDestroy(&pMgmt->lock); memset(pMgmt, 0, sizeof(SSyncMgmt)); } +void mndSyncCheckTimeout(SMnode *pMnode) { + mTrace("check sync timeout"); + SSyncMgmt *pMgmt = &pMnode->syncMgmt; + taosThreadMutexLock(&pMgmt->lock); + if (pMgmt->transId != 0) { + int32_t curSec = taosGetTimestampSec(); + int32_t delta = curSec - pMgmt->transSec; + if (delta > MNODE_TIMEOUT_SEC) { + mError("trans:%d, failed to propose since timeout, start:%d cur:%d delta:%d seq:%" PRId64, pMgmt->transId, + pMgmt->transSec, curSec, delta, pMgmt->transSeq); + pMgmt->transId = 0; + pMgmt->transSec = 0; + pMgmt->transSeq = 0; + terrno = TSDB_CODE_SYN_TIMEOUT; + pMgmt->errCode = TSDB_CODE_SYN_TIMEOUT; + tsem_post(&pMgmt->syncSem); + } else { + mDebug("trans:%d, waiting for sync confirm, start:%d cur:%d delta:%d seq:%" PRId64, pMgmt->transId, + pMgmt->transSec, curSec, curSec - pMgmt->transSec, pMgmt->transSeq); + } + } else { + // mTrace("check sync timeout msg, no trans waiting for confirm"); + } + taosThreadMutexUnlock(&pMgmt->lock); +} + int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) { SSyncMgmt *pMgmt = &pMnode->syncMgmt; - pMgmt->errCode = 0; SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)}; if (req.contLen <= 0) return -1; @@ -323,35 +360,42 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) { if (req.pCont == NULL) return -1; memcpy(req.pCont, pRaw, req.contLen); - taosWLockLatch(&pMgmt->lock); + taosThreadMutexLock(&pMgmt->lock); + pMgmt->errCode = 0; + if (pMgmt->transId != 0) { mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId); - taosWUnLockLatch(&pMgmt->lock); + taosThreadMutexUnlock(&pMgmt->lock); terrno = TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED; - return -1; + return terrno; } mInfo("trans:%d, will be proposed", transId); pMgmt->transId = transId; - taosWUnLockLatch(&pMgmt->lock); + pMgmt->transSec = taosGetTimestampSec(); - int32_t code = syncPropose(pMgmt->sync, &req, false); + int64_t seq = 0; + int32_t code = syncPropose(pMgmt->sync, &req, false, &seq); if (code == 0) { - mInfo("trans:%d, is proposing and wait sem", pMgmt->transId); + mInfo("trans:%d, is proposing and wait sem, seq:%" PRId64, transId, seq); + pMgmt->transSeq = seq; + taosThreadMutexUnlock(&pMgmt->lock); tsem_wait(&pMgmt->syncSem); } else if (code > 0) { mInfo("trans:%d, confirm at once since replica is 1, continue execute", transId); - taosWLockLatch(&pMgmt->lock); pMgmt->transId = 0; - taosWUnLockLatch(&pMgmt->lock); + pMgmt->transSec = 0; + pMgmt->transSeq = 0; + taosThreadMutexUnlock(&pMgmt->lock); sdbWriteWithoutFree(pMnode->pSdb, pRaw); sdbSetApplyInfo(pMnode->pSdb, req.info.conn.applyIndex, req.info.conn.applyTerm, SYNC_INDEX_INVALID); code = 0; } else { mError("trans:%d, failed to proposed since %s", transId, terrstr()); - taosWLockLatch(&pMgmt->lock); pMgmt->transId = 0; - taosWUnLockLatch(&pMgmt->lock); + pMgmt->transSec = 0; + pMgmt->transSeq = 0; + taosThreadMutexUnlock(&pMgmt->lock); if (terrno == 0) { terrno = TSDB_CODE_APP_ERROR; } @@ -365,7 +409,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) { } terrno = pMgmt->errCode; - return pMgmt->errCode; + return terrno; } void mndSyncStart(SMnode *pMnode) { @@ -378,13 +422,17 @@ void mndSyncStart(SMnode *pMnode) { } void mndSyncStop(SMnode *pMnode) { - taosWLockLatch(&pMnode->syncMgmt.lock); - if (pMnode->syncMgmt.transId != 0) { - mInfo("vgId:1, is stopped and post sem, trans:%d", pMnode->syncMgmt.transId); - pMnode->syncMgmt.transId = 0; - tsem_post(&pMnode->syncMgmt.syncSem); + SSyncMgmt *pMgmt = &pMnode->syncMgmt; + + taosThreadMutexLock(&pMgmt->lock); + if (pMgmt->transId != 0) { + mInfo("vgId:1, is stopped and post sem, trans:%d", pMgmt->transId); + pMgmt->transId = 0; + pMgmt->transSec = 0; + pMgmt->errCode = TSDB_CODE_APP_IS_STOPPING; + tsem_post(&pMgmt->syncSem); } - taosWUnLockLatch(&pMnode->syncMgmt.lock); + taosThreadMutexUnlock(&pMgmt->lock); } bool mndIsLeader(SMnode *pMnode) { diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 4b11884050..42037304b9 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -838,7 +838,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { return conflict; } -int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { +int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) { if (pTrans->conflict == TRN_CONFLICT_DB || pTrans->conflict == TRN_CONFLICT_DB_INSIDE) { if (strlen(pTrans->dbname) == 0 && strlen(pTrans->stbname) == 0) { terrno = TSDB_CODE_MND_TRANS_CONFLICT; @@ -853,6 +853,14 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { return -1; } + return 0; +} + +int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { + if (mndTrancCheckConflict(pMnode, pTrans) != 0) { + return -1; + } + if (taosArrayGetSize(pTrans->commitActions) <= 0) { terrno = TSDB_CODE_MND_TRANS_CLOG_IS_NULL; mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -1027,6 +1035,7 @@ int32_t mndTransProcessRsp(SRpcMsg *pRsp) { if (pAction != NULL) { pAction->msgReceived = 1; pAction->errCode = pRsp->code; + pTrans->lastErrorNo = pRsp->code; } mInfo("trans:%d, %s:%d response is received, code:0x%x, accept:0x%x retry:0x%x", transId, mndTransStr(pAction->stage), @@ -1238,7 +1247,7 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans) if (numOfActions == 0) return code; if (pTrans->redoActionPos >= numOfActions) return code; - mInfo("trans:%d, execute %d actions serial", pTrans->id, numOfActions); + mInfo("trans:%d, execute %d actions serial, current redoAction:%d", pTrans->id, numOfActions, pTrans->redoActionPos); for (int32_t action = pTrans->redoActionPos; action < numOfActions; ++action) { STransAction *pAction = taosArrayGet(pTrans->redoActions, pTrans->redoActionPos); @@ -1289,13 +1298,16 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans) } else if (code == TSDB_CODE_ACTION_IN_PROGRESS) { mInfo("trans:%d, %s:%d is in progress and wait it finish", pTrans->id, mndTransStr(pAction->stage), pAction->id); break; - } else if (code == pAction->retryCode) { + } else if (code == pAction->retryCode || code == TSDB_CODE_SYN_PROPOSE_NOT_READY || + code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_SYN_NOT_LEADER) { mInfo("trans:%d, %s:%d receive code:0x%x and retry", pTrans->id, mndTransStr(pAction->stage), pAction->id, code); + pTrans->lastErrorNo = code; taosMsleep(300); action--; continue; } else { terrno = code; + pTrans->lastErrorNo = code; pTrans->code = code; mInfo("trans:%d, %s:%d receive code:0x%x and wait another schedule, failedTimes:%d", pTrans->id, mndTransStr(pAction->stage), pAction->id, code, pTrans->failedTimes); diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index a6e52caf1f..4a6f0d14da 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -507,7 +507,7 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup for (int32_t v = 0; v < pVgroup->replica; ++v) { SVnodeGid *pVgid = &pVgroup->vnodeGid[v]; SDnodeObj *pDnode = taosArrayGet(pArray, v); - if (pDnode == NULL || pDnode->numOfVnodes > pDnode->numOfSupportVnodes) { + if (pDnode == NULL || pDnode->numOfVnodes >= pDnode->numOfSupportVnodes) { terrno = TSDB_CODE_MND_NO_ENOUGH_DNODES; return -1; } @@ -891,7 +891,7 @@ static int32_t mndAddVnodeToVgroup(SMnode *pMnode, STrans *pTrans, SVgObj *pVgro } if (used) continue; - if (pDnode == NULL || pDnode->numOfVnodes > pDnode->numOfSupportVnodes) { + if (pDnode == NULL || pDnode->numOfVnodes >= pDnode->numOfSupportVnodes) { terrno = TSDB_CODE_MND_NO_ENOUGH_DNODES; return -1; } diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 99260ffefd..540f0c3127 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -54,6 +54,7 @@ int32_t vnodeAlter(const char *path, SAlterVnodeReplicaReq *pReq, STfs *pTfs); void vnodeDestroy(const char *path, STfs *pTfs); SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb); void vnodePreClose(SVnode *pVnode); +void vnodeSyncCheckTimeout(SVnode* pVnode); void vnodeClose(SVnode *pVnode); int32_t vnodeStart(SVnode *pVnode); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 8cf212cb1d..094468c666 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -344,7 +344,12 @@ struct SVnode { bool blocked; bool restored; tsem_t syncSem; + int32_t blockSec; + int64_t blockSeq; SQHandle* pQuery; +#if 0 + SRpcHandleInfo blockInfo; +#endif }; #define TD_VID(PVNODE) ((PVNODE)->config.vgId) diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 0ed68dce95..37dcec4f85 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -32,9 +32,9 @@ typedef struct SMetaStbStatsEntry { } SMetaStbStatsEntry; typedef struct STagFilterResEntry { - uint64_t suid; // uid for super table - SList list; // the linked list of md5 digest, extracted from the serialized tag query condition - uint32_t qTimes;// queried times for current super table + uint64_t suid; // uid for super table + SList list; // the linked list of md5 digest, extracted from the serialized tag query condition + uint32_t qTimes; // queried times for current super table } STagFilterResEntry; struct SMetaCache { @@ -126,13 +126,14 @@ int32_t metaCacheOpen(SMeta* pMeta) { goto _err2; } - pCache->sTagFilterResCache.pUidResCache = taosLRUCacheInit(5*1024*1024, -1, 0.5); + pCache->sTagFilterResCache.pUidResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5); if (pCache->sTagFilterResCache.pUidResCache == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _err2; } - pCache->sTagFilterResCache.pTableEntry = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK); + pCache->sTagFilterResCache.pTableEntry = + taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK); if (pCache->sTagFilterResCache.pTableEntry == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _err2; @@ -419,7 +420,8 @@ int32_t metaStatsCacheGet(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo) { return code; } -int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray* pList1, bool* acquireRes) { +int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray* pList1, + bool* acquireRes) { uint64_t* pBuf = pMeta->pCache->sTagFilterResCache.keyBuf; // generate the composed key for LRU cache @@ -428,8 +430,8 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK pBuf[0] = suid; memcpy(&pBuf[1], pKey, keyLen); - int32_t len = keyLen + sizeof(uint64_t); - LRUHandle *pHandle = taosLRUCacheLookup(pCache, pBuf, len); + int32_t len = keyLen + sizeof(uint64_t); + LRUHandle* pHandle = taosLRUCacheLookup(pCache, pBuf, len); if (pHandle == NULL) { *acquireRes = 0; return TSDB_CODE_SUCCESS; @@ -439,7 +441,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK *acquireRes = 1; const char* p = taosLRUCacheValue(pMeta->pCache->sTagFilterResCache.pUidResCache, pHandle); - int32_t size = *(int32_t*) p; + int32_t size = *(int32_t*)p; taosArrayAddBatch(pList1, p + sizeof(int32_t), size); (*pEntry)->qTimes += 1; @@ -467,12 +469,15 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK // remove the keys, of which query uid lists have been replaced already. size_t s = taosArrayGetSize(pList); - for(int32_t i = 0; i < s; ++i) { + for (int32_t i = 0; i < s; ++i) { SListNode** p1 = taosArrayGet(pList, i); tdListPopNode(&(*pEntry)->list, *p1); + taosMemoryFree(*p1); } - (*pEntry)->qTimes = 0; // reset the query times + (*pEntry)->qTimes = 0; // reset the query times + + taosArrayDestroy(pList); } } @@ -487,7 +492,8 @@ static void freePayload(const void* key, size_t keyLen, void* value) { } // check both the payload size and selectivity ratio -int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload, int32_t payloadLen, double selectivityRatio) { +int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload, + int32_t payloadLen, double selectivityRatio) { if (selectivityRatio > tsSelectivityRatio) { metaDebug("vgId:%d, suid:%" PRIu64 " failed to add to uid list cache, due to selectivity ratio %.2f less than threshold %.2f", @@ -525,9 +531,10 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int ASSERT(sizeof(uint64_t) + keyLen == 24); // add to cache. - taosLRUCacheInsert(pCache, pBuf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, TAOS_LRU_PRIORITY_LOW); - metaDebug("vgId:%d, suid:%"PRIu64" list cache added into cache, total:%d, tables:%d", TD_VID(pMeta->pVnode), - suid, (int32_t) taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry)); + taosLRUCacheInsert(pCache, pBuf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, + TAOS_LRU_PRIORITY_LOW); + metaDebug("vgId:%d, suid:%" PRIu64 " list cache added into cache, total:%d, tables:%d", TD_VID(pMeta->pVnode), suid, + (int32_t)taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry)); return TSDB_CODE_SUCCESS; } @@ -539,7 +546,7 @@ int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) { return TSDB_CODE_SUCCESS; } - int32_t keyLen = sizeof(uint64_t) * 3; + int32_t keyLen = sizeof(uint64_t) * 3; uint64_t p[3] = {0}; p[0] = suid; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 0b00f036de..722a93137c 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -549,8 +549,8 @@ int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) { } static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME) { - int64_t ttlDays; - int64_t ctime; + int64_t ttlDays = 0; + int64_t ctime = 0; if (pME->type == TSDB_CHILD_TABLE) { ctime = pME->ctbEntry.ctime; ttlDays = pME->ctbEntry.ttlDays; @@ -1353,6 +1353,10 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) { goto end; } + if (stbEntry.stbEntry.schemaTag.pSchema == NULL) { + goto end; + } + pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0]; STagVal tagVal = {.cid = pTagColumn->colId}; diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 6bd2ae3435..ba99e5515d 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -763,7 +763,7 @@ static int32_t tdExecuteRSmaImplAsync(SSma *pSma, const void *pMsg, int32_t inpu tb_uid_t suid) { const SSubmitReq *pReq = (const SSubmitReq *)pMsg; - void *qItem = taosAllocateQitem(pReq->header.contLen, DEF_QITEM); + void *qItem = taosAllocateQitem(pReq->header.contLen, DEF_QITEM, 0); if (!qItem) { return TSDB_CODE_FAILED; } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 356cbd6332..4a941b3c20 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -1271,7 +1271,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) { qDebug("delete req enqueue stream task: %d, ver: %" PRId64, pTask->taskId, ver); if (!failed) { - SStreamRefDataBlock* pRefBlock = taosAllocateQitem(sizeof(SStreamRefDataBlock), DEF_QITEM); + SStreamRefDataBlock* pRefBlock = taosAllocateQitem(sizeof(SStreamRefDataBlock), DEF_QITEM, 0); pRefBlock->type = STREAM_INPUT__REF_DATA_BLOCK; pRefBlock->pBlock = pDelBlock; pRefBlock->dataRef = pRef; @@ -1303,7 +1303,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) { } #if 0 - SStreamDataBlock* pStreamBlock = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); + SStreamDataBlock* pStreamBlock = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0); pStreamBlock->type = STREAM_INPUT__DATA_BLOCK; pStreamBlock->blocks = taosArrayInit(0, sizeof(SSDataBlock)); SSDataBlock block = {0}; diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index c3a4cefc66..46b31bc5b0 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -533,6 +533,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { pBlock->info.id.uid = pReader->msgIter.uid; pBlock->info.rows = pReader->msgIter.numOfRows; pBlock->info.version = pReader->pMsg->version; + pBlock->info.dataLoad = 1; while ((row = tGetSubmitBlkNext(&pReader->blkIter)) != NULL) { tdSTSRowIterReset(&iter, row); diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 7309ea3407..5b09ce5eb6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -952,12 +952,17 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs SArray *pDelIdxArray = taosArrayInit(32, sizeof(SDelIdx)); code = tsdbReadDelIdx(pDelFReader, pDelIdxArray); - if (code) goto _err; + if (code) { + taosArrayDestroy(pDelIdxArray); + tsdbDelFReaderClose(&pDelFReader); + goto _err; + } SDelIdx *delIdx = taosArraySearch(pDelIdxArray, &(SDelIdx){.suid = suid, .uid = uid}, tCmprDelIdx, TD_EQ); code = getTableDelSkyline(pMem, pIMem, pDelFReader, delIdx, pIter->pSkyline); if (code) { + taosArrayDestroy(pDelIdxArray); tsdbDelFReaderClose(&pDelFReader); goto _err; } diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 72d9c4f69e..7dc839773f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -962,6 +962,7 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { } } + pDFileSet->diskId = pSet->diskId; goto _exit; } } diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 01fbcf657f..ad264b8bb3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -121,7 +121,7 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) { return &pInfo->blockData[1]; } - if (pIter->pSttBlk == NULL) { + if (pIter->pSttBlk == NULL || pInfo->pSchema == NULL) { return NULL; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 3ec4f63c30..24a614800e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -1143,6 +1143,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn i += 1; } + pResBlock->info.dataLoad = 1; pResBlock->info.rows = dumpedRows; pDumpInfo->rowIndex += step * dumpedRows; @@ -2538,6 +2539,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { _end: pResBlock->info.id.uid = (pBlockScanInfo != NULL) ? pBlockScanInfo->uid : 0; + pResBlock->info.dataLoad = 1; blockDataUpdateTsWindow(pResBlock, pReader->suppInfo.slotId[0]); setComposedBlockFlag(pReader, true); @@ -2790,7 +2792,8 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) { while (1) { // load the last data block of current table STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)pStatus->pTableIter; - bool hasVal = initLastBlockReader(pLastBlockReader, pScanInfo, pReader); + + bool hasVal = initLastBlockReader(pLastBlockReader, pScanInfo, pReader); if (!hasVal) { bool hasNexTable = moveToNextTable(pOrderedCheckInfo, pStatus); if (!hasNexTable) { @@ -3129,7 +3132,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32 return false; } else if (pKey->ts == last->ts) { TSDBKEY* prev = taosArrayGet(pDelList, num - 2); - return (prev->version >= pKey->version); + return (prev->version >= pKey->version && prev->version <= pVerRange->maxVer && prev->version >= pVerRange->minVer); } } else { TSDBKEY* pCurrent = taosArrayGet(pDelList, *index); @@ -3621,6 +3624,7 @@ int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* i += 1; } + pBlock->info.dataLoad = 1; pBlock->info.rows += 1; pScanInfo->lastKey = pTSRow->ts; return TSDB_CODE_SUCCESS; @@ -3668,6 +3672,7 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S i += 1; } + pResBlock->info.dataLoad = 1; pResBlock->info.rows += 1; return TSDB_CODE_SUCCESS; } @@ -3823,6 +3828,8 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL } // NOTE: the endVersion in pCond is the data version not schema version, so pCond->endVersion is not correct here. + // no valid error code set in metaGetTbTSchema, so let's set the error code here. + // we should proceed in case of tmq processing. if (pCond->suid != 0) { pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, -1, 1); if (pReader->pSchema == NULL) { @@ -3840,7 +3847,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL updateBlockSMAInfo(pReader->pSchema, &pReader->suppInfo); } - STsdbReader* p = (pReader->innerReader[0] != NULL)? pReader->innerReader[0]:pReader; + STsdbReader* p = (pReader->innerReader[0] != NULL) ? pReader->innerReader[0] : pReader; pReader->status.pTableMap = createDataBlockScanInfo(p, &pReader->blockInfoBuf, pTableList, numOfTables); if (pReader->status.pTableMap == NULL) { tsdbReaderClose(p); @@ -3888,10 +3895,11 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL tsdbDebug("%p total numOfTable:%d in this query %s", pReader, numOfTables, pReader->idStr); return code; - _err: +_err: tsdbError("failed to create data reader, code:%s %s", tstrerror(code), idstr); + tsdbReaderClose(pReader); return code; - } +} void tsdbReaderClose(STsdbReader* pReader) { if (pReader == NULL) { diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index f4bdeeb387..8be4904349 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -155,7 +155,7 @@ static int32_t tsdbSnapReadOpenFile(STsdbSnapReader* pReader) { if (rowVer >= pReader->sver && rowVer <= pReader->ever) { pIter->rInfo.suid = pIter->bData.suid; - pIter->rInfo.uid = pIter->bData.uid; + pIter->rInfo.uid = pIter->bData.uid ? pIter->bData.uid : pIter->bData.aUid[pIter->iRow]; pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow); goto _add_iter; } @@ -179,16 +179,14 @@ _err: return code; } -static SRowInfo* tsdbSnapGetRow(STsdbSnapReader* pReader) { return pReader->pIter ? &pReader->pIter->rInfo : NULL; } - static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { int32_t code = 0; if (pReader->pIter) { - SFDataIter* pIter = pReader->pIter; - + SFDataIter* pIter = NULL; while (true) { _find_row: + pIter = pReader->pIter; for (pIter->iRow++; pIter->iRow < pIter->bData.nRow; pIter->iRow++) { int64_t rowVer = pIter->bData.aVersion[pIter->iRow]; @@ -224,6 +222,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { } pReader->pIter = NULL; + break; } else if (pIter->type == SNAP_STT_FILE_ITER) { for (pIter->iSttBlk++; pIter->iSttBlk < taosArrayGetSize(pIter->aSttBlk); pIter->iSttBlk++) { SSttBlk* pSttBlk = (SSttBlk*)taosArrayGet(pIter->aSttBlk, pIter->iSttBlk); @@ -238,6 +237,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { } pReader->pIter = NULL; + break; } else { ASSERT(0); } @@ -269,6 +269,20 @@ _err: return code; } +static SRowInfo* tsdbSnapGetRow(STsdbSnapReader* pReader) { + if (pReader->pIter) { + return &pReader->pIter->rInfo; + } else { + tsdbSnapNextRow(pReader); + + if (pReader->pIter) { + return &pReader->pIter->rInfo; + } else { + return NULL; + } + } +} + static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) { int32_t code = 0; @@ -1356,7 +1370,7 @@ _exit: taosMemoryFree(pWriter); } } else { - tsdbDebug("vgId:%d, tsdb snapshot writer open for %s succeed", TD_VID(pTsdb->pVnode), pTsdb->path); + tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); *ppWriter = pWriter; } return code; @@ -1421,7 +1435,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) { for (int32_t iBuf = 0; iBuf < sizeof(pWriter->aBuf) / sizeof(uint8_t*); iBuf++) { tFree(pWriter->aBuf[iBuf]); } - tsdbInfo("vgId:%d, vnode snapshot tsdb writer close for %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path); + tsdbInfo("vgId:%d %s done", TD_VID(pWriter->pTsdb->pVnode), __func__); taosMemoryFree(pWriter); *ppWriter = NULL; return code; diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index aa215a852f..2c23646db1 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -22,32 +22,21 @@ static inline bool vnodeIsMsgWeak(tmsg_t type) { return false; } static inline void vnodeWaitBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) { const STraceId *trace = &pMsg->info.traceId; - vGTrace("vgId:%d, msg:%p wait block, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType)); + vGTrace("vgId:%d, msg:%p wait block, type:%s sec:%d seq:%" PRId64, pVnode->config.vgId, pMsg, + TMSG_INFO(pMsg->msgType), pVnode->blockSec, pVnode->blockSeq); tsem_wait(&pVnode->syncSem); } -static inline void vnodeWaitBlockMsgOld(SVnode *pVnode, const SRpcMsg *pMsg) { - if (vnodeIsMsgBlock(pMsg->msgType)) { - const STraceId *trace = &pMsg->info.traceId; - taosThreadMutexLock(&pVnode->lock); - if (!pVnode->blocked) { - vGTrace("vgId:%d, msg:%p wait block, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType)); - pVnode->blocked = true; - taosThreadMutexUnlock(&pVnode->lock); - tsem_wait(&pVnode->syncSem); - } else { - taosThreadMutexUnlock(&pVnode->lock); - } - } -} - static inline void vnodePostBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) { if (vnodeIsMsgBlock(pMsg->msgType)) { const STraceId *trace = &pMsg->info.traceId; taosThreadMutexLock(&pVnode->lock); if (pVnode->blocked) { - vGTrace("vgId:%d, msg:%p post block, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType)); + vGTrace("vgId:%d, msg:%p post block, type:%s sec:%d seq:%" PRId64, pVnode->config.vgId, pMsg, + TMSG_INFO(pMsg->msgType), pVnode->blockSec, pVnode->blockSeq); pVnode->blocked = false; + pVnode->blockSec = 0; + pVnode->blockSeq = 0; tsem_post(&pVnode->syncSem); } taosThreadMutexUnlock(&pVnode->lock); @@ -217,12 +206,19 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) #else static int32_t inline vnodeProposeMsg(SVnode *pVnode, SRpcMsg *pMsg, bool isWeak) { + int64_t seq = 0; + taosThreadMutexLock(&pVnode->lock); - int32_t code = syncPropose(pVnode->sync, pMsg, isWeak); + int32_t code = syncPropose(pVnode->sync, pMsg, isWeak, &seq); bool wait = (code == 0 && vnodeIsMsgBlock(pMsg->msgType)); if (wait) { ASSERT(!pVnode->blocked); pVnode->blocked = true; + pVnode->blockSec = taosGetTimestampSec(); + pVnode->blockSeq = seq; +#if 0 + pVnode->blockInfo = pMsg->info; +#endif } taosThreadMutexUnlock(&pVnode->lock); @@ -289,12 +285,15 @@ void vnodeApplyWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { for (int32_t i = 0; i < numOfMsgs; ++i) { if (taosGetQitem(qall, (void **)&pMsg) == 0) continue; const STraceId *trace = &pMsg->info.traceId; - vGTrace("vgId:%d, msg:%p get from vnode-apply queue, type:%s handle:%p index:%" PRId64, vgId, pMsg, - TMSG_INFO(pMsg->msgType), pMsg->info.handle, pMsg->info.conn.applyIndex); if (vnodeIsMsgBlock(pMsg->msgType)) { - vTrace("vgId:%d, blocking msg obtained from apply-queue. index:%" PRId64 ", term: %" PRId64 ", type: %s", vgId, - pMsg->info.conn.applyIndex, pMsg->info.conn.applyTerm, TMSG_INFO(pMsg->msgType)); + vGTrace("vgId:%d, msg:%p get from vnode-apply queue, type:%s handle:%p index:%" PRId64 + ", blocking msg obtained sec:%d seq:%" PRId64, + vgId, pMsg, TMSG_INFO(pMsg->msgType), pMsg->info.handle, pMsg->info.conn.applyIndex, pVnode->blockSec, + pVnode->blockSeq); + } else { + vGTrace("vgId:%d, msg:%p get from vnode-apply queue, type:%s handle:%p index:%" PRId64, vgId, pMsg, + TMSG_INFO(pMsg->msgType), pMsg->info.handle, pMsg->info.conn.applyIndex); } SRpcMsg rsp = {.code = pMsg->code, .info = pMsg->info}; @@ -621,6 +620,32 @@ void vnodeSyncClose(SVnode *pVnode) { syncStop(pVnode->sync); } +void vnodeSyncCheckTimeout(SVnode *pVnode) { + vTrace("vgId:%d, check sync timeout msg", pVnode->config.vgId); + taosThreadMutexLock(&pVnode->lock); + if (pVnode->blocked) { + int32_t curSec = taosGetTimestampSec(); + int32_t delta = curSec - pVnode->blockSec; + if (delta > VNODE_TIMEOUT_SEC) { + vError("vgId:%d, failed to propose since timeout and post block, start:%d cur:%d delta:%d seq:%" PRId64, + pVnode->config.vgId, pVnode->blockSec, curSec, delta, pVnode->blockSeq); + if (syncSendTimeoutRsp(pVnode->sync, pVnode->blockSeq) != 0) { +#if 0 + SRpcMsg rpcMsg = {.code = TSDB_CODE_SYN_TIMEOUT, .info = pVnode->blockInfo}; + vError("send timeout response since its applyed, seq:%" PRId64 " handle:%p ahandle:%p", pVnode->blockSeq, + rpcMsg.info.handle, rpcMsg.info.ahandle); + rpcSendResponse(&rpcMsg); +#endif + } + pVnode->blocked = false; + pVnode->blockSec = 0; + pVnode->blockSeq = 0; + tsem_post(&pVnode->syncSem); + } + } + taosThreadMutexUnlock(&pVnode->lock); +} + bool vnodeIsRoleLeader(SVnode *pVnode) { SSyncState state = syncGetState(pVnode->sync); return state.state == TAOS_SYNC_STATE_LEADER; diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index c435c46d46..6e072a9630 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -798,6 +798,9 @@ SName* ctgGetFetchName(SArray* pNames, SCtgFetch* pFetch); int32_t ctgdGetOneHandle(SCatalog **pHandle); int ctgVgInfoComp(const void* lp, const void* rp); int32_t ctgMakeVgArray(SDBVgInfo* dbInfo); +int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb); +int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName); +void ctgReleaseVgMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache); extern SCatalogMgmt gCtgMgmt; extern SCtgDebug gCTGDebug; diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 1b9bf7f99c..e9e0bae8d7 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -551,6 +551,35 @@ _return: CTG_RET(code); } +int32_t ctgGetCachedTbVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta) { + int32_t code = 0; + char db[TSDB_DB_FNAME_LEN] = {0}; + tNameGetFullDbName(pTableName, db); + SCtgDBCache *dbCache = NULL; + SCtgTbCache *tbCache = NULL; + + CTG_ERR_RET(ctgAcquireVgMetaFromCache(pCtg, db, pTableName->tname, &dbCache, &tbCache)); + + if (NULL == dbCache || NULL == tbCache) { + *pTableMeta = NULL; + return TSDB_CODE_SUCCESS; + } + + CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, dbCache->vgCache.vgInfo, pTableName, pVgroup)); + + SCtgTbMetaCtx ctx = {0}; + ctx.pName = (SName*)pTableName; + ctx.flag = CTG_FLAG_UNKNOWN_STB; + CTG_ERR_JRET(ctgCopyTbMeta(pCtg, &ctx, &dbCache, &tbCache, pTableMeta, db)); + +_return: + + ctgReleaseVgMetaToCache(pCtg, dbCache, tbCache); + + CTG_RET(code); +} + + int32_t ctgRemoveTbMeta(SCatalog* pCtg, SName* pTableName) { int32_t code = 0; @@ -1118,6 +1147,13 @@ int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableName, CTG_API_LEAVE(ctgGetTbHashVgroup(pCtg, NULL, pTableName, pVgroup, exists)); } +int32_t catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta) { + CTG_API_ENTER(); + + CTG_API_LEAVE(ctgGetCachedTbVgMeta(pCtg, pTableName, pVgroup, pTableMeta)); +} + + #if 0 int32_t catalogGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalogReq* pReq, SMetaData* pRsp) { CTG_API_ENTER(); diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index f41058584f..94ee295fe4 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -130,7 +130,7 @@ void ctgReleaseVgInfoToCache(SCatalog *pCtg, SCtgDBCache *dbCache) { } void ctgReleaseTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache) { - if (pCache) { + if (pCache && dbCache) { CTG_UNLOCK(CTG_READ, &pCache->metaLock); taosHashRelease(dbCache->tbCache, pCache); } @@ -151,6 +151,18 @@ void ctgReleaseTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache } } +void ctgReleaseVgMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache) { + if (pCache && dbCache) { + CTG_UNLOCK(CTG_READ, &pCache->metaLock); + taosHashRelease(dbCache->tbCache, pCache); + } + + if (dbCache) { + ctgRUnlockVgInfo(dbCache); + ctgReleaseDBCache(pCtg, dbCache); + } +} + int32_t ctgAcquireVgInfoFromCache(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache) { SCtgDBCache *dbCache = NULL; ctgAcquireDBCache(pCtg, dbFName, &dbCache); @@ -226,6 +238,75 @@ _return: return TSDB_CODE_SUCCESS; } +int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb) { + SCtgDBCache *dbCache = NULL; + SCtgTbCache *tbCache = NULL; + bool vgInCache = false; + + ctgAcquireDBCache(pCtg, dbFName, &dbCache); + if (NULL == dbCache) { + ctgDebug("db %s not in cache", dbFName); + CTG_CACHE_STAT_INC(numOfVgMiss, 1); + goto _return; + } + + ctgRLockVgInfo(pCtg, dbCache, &vgInCache); + if (!vgInCache) { + ctgDebug("vgInfo of db %s not in cache", dbFName); + CTG_CACHE_STAT_INC(numOfVgMiss, 1); + goto _return; + } + + *pDb = dbCache; + + CTG_CACHE_STAT_INC(numOfVgHit, 1); + + ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName); + + tbCache = taosHashAcquire(dbCache->tbCache, tbName, strlen(tbName)); + if (NULL == tbCache) { + ctgDebug("tb %s not in cache, dbFName:%s", tbName, dbFName); + CTG_CACHE_STAT_INC(numOfMetaMiss, 1); + goto _return; + } + + CTG_LOCK(CTG_READ, &tbCache->metaLock); + if (NULL == tbCache->pMeta) { + ctgDebug("tb %s meta not in cache, dbFName:%s", tbName, dbFName); + CTG_CACHE_STAT_INC(numOfMetaMiss, 1); + goto _return; + } + + *pTb = tbCache; + + ctgDebug("tb %s meta got in cache, dbFName:%s", tbName, dbFName); + + CTG_CACHE_STAT_INC(numOfMetaHit, 1); + + return TSDB_CODE_SUCCESS; + +_return: + + if (tbCache) { + CTG_UNLOCK(CTG_READ, &tbCache->metaLock); + taosHashRelease(dbCache->tbCache, tbCache); + } + + if (vgInCache) { + ctgRUnlockVgInfo(dbCache); + } + + if (dbCache) { + ctgReleaseDBCache(pCtg, dbCache); + } + + *pDb = NULL; + *pTb = NULL; + + return TSDB_CODE_SUCCESS; +} + + /* int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgDBCache **pDb, SCtgTbCache **pTb) { SCtgDBCache *dbCache = NULL; @@ -378,6 +459,78 @@ int32_t ctgTbMetaExistInCache(SCatalog *pCtg, char *dbFName, char *tbName, int32 return TSDB_CODE_SUCCESS; } +int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName) { + SCtgDBCache *dbCache = *pDb; + SCtgTbCache *tbCache = *pTb; + STableMeta *tbMeta = tbCache->pMeta; + ctx->tbInfo.inCache = true; + ctx->tbInfo.dbId = dbCache->dbId; + ctx->tbInfo.suid = tbMeta->suid; + ctx->tbInfo.tbType = tbMeta->tableType; + + if (tbMeta->tableType != TSDB_CHILD_TABLE) { + int32_t metaSize = CTG_META_SIZE(tbMeta); + *pTableMeta = taosMemoryCalloc(1, metaSize); + if (NULL == *pTableMeta) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + memcpy(*pTableMeta, tbMeta, metaSize); + + ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", ctx->pName->tname, tbMeta->tableType, dbFName); + return TSDB_CODE_SUCCESS; + } + + // PROCESS FOR CHILD TABLE + + int32_t metaSize = sizeof(SCTableMeta); + *pTableMeta = taosMemoryCalloc(1, metaSize); + if (NULL == *pTableMeta) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + memcpy(*pTableMeta, tbMeta, metaSize); + + //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); + + if (tbCache) { + CTG_UNLOCK(CTG_READ, &tbCache->metaLock); + taosHashRelease(dbCache->tbCache, tbCache); + *pTb = NULL; + } + + ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", ctx->pName->tname, + ctx->tbInfo.tbType, dbFName); + + ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, ctx->tbInfo.suid, &tbCache); + if (NULL == tbCache) { + taosMemoryFreeClear(*pTableMeta); + *pDb = NULL; + ctgDebug("stb 0x%" PRIx64 " meta not in cache", ctx->tbInfo.suid); + return TSDB_CODE_SUCCESS; + } + + *pTb = tbCache; + + STableMeta *stbMeta = tbCache->pMeta; + if (stbMeta->suid != ctx->tbInfo.suid) { + ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid 0x%" PRIx64, stbMeta->suid, ctx->tbInfo.suid); + taosMemoryFreeClear(*pTableMeta); + CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); + } + + metaSize = CTG_META_SIZE(stbMeta); + *pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize); + if (NULL == *pTableMeta) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + memcpy(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta)); + + return TSDB_CODE_SUCCESS; +} + + int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) { int32_t code = 0; SCtgDBCache *dbCache = NULL; @@ -397,70 +550,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta ** return TSDB_CODE_SUCCESS; } - STableMeta *tbMeta = tbCache->pMeta; - ctx->tbInfo.inCache = true; - ctx->tbInfo.dbId = dbCache->dbId; - ctx->tbInfo.suid = tbMeta->suid; - ctx->tbInfo.tbType = tbMeta->tableType; - - if (tbMeta->tableType != TSDB_CHILD_TABLE) { - int32_t metaSize = CTG_META_SIZE(tbMeta); - *pTableMeta = taosMemoryCalloc(1, metaSize); - if (NULL == *pTableMeta) { - ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); - } - - memcpy(*pTableMeta, tbMeta, metaSize); - - ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", ctx->pName->tname, tbMeta->tableType, dbFName); - return TSDB_CODE_SUCCESS; - } - - // PROCESS FOR CHILD TABLE - - int32_t metaSize = sizeof(SCTableMeta); - *pTableMeta = taosMemoryCalloc(1, metaSize); - if (NULL == *pTableMeta) { - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); - } - - memcpy(*pTableMeta, tbMeta, metaSize); - - //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - - if (tbCache) { - CTG_UNLOCK(CTG_READ, &tbCache->metaLock); - taosHashRelease(dbCache->tbCache, tbCache); - } - - ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", ctx->pName->tname, - ctx->tbInfo.tbType, dbFName); - - ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, ctx->tbInfo.suid, &tbCache); - if (NULL == tbCache) { - //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - taosMemoryFreeClear(*pTableMeta); - ctgDebug("stb 0x%" PRIx64 " meta not in cache", ctx->tbInfo.suid); - return TSDB_CODE_SUCCESS; - } - - STableMeta *stbMeta = tbCache->pMeta; - if (stbMeta->suid != ctx->tbInfo.suid) { - ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid 0x%" PRIx64, stbMeta->suid, ctx->tbInfo.suid); - CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); - } - - metaSize = CTG_META_SIZE(stbMeta); - *pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize); - if (NULL == *pTableMeta) { - ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); - } - - memcpy(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta)); + CTG_ERR_JRET(ctgCopyTbMeta(pCtg, ctx, &dbCache, &tbCache, pTableMeta, dbFName)); ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); @@ -1638,7 +1728,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { } if (dbInfo->vgVersion < 0 || taosHashGetSize(dbInfo->vgHash) <= 0) { - ctgError("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d", dbFName, dbInfo->vgHash, + ctgDebug("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d", dbFName, dbInfo->vgHash, dbInfo->vgVersion, taosHashGetSize(dbInfo->vgHash)); CTG_ERR_JRET(TSDB_CODE_APP_ERROR); } diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index 12fb449238..eff7a5ef93 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -133,7 +133,7 @@ static int32_t getStatus(SDataDeleterHandle* pDeleter) { static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue) { SDataDeleterHandle* pDeleter = (SDataDeleterHandle*)pHandle; - SDataDeleterBuf* pBuf = taosAllocateQitem(sizeof(SDataDeleterBuf), DEF_QITEM); + SDataDeleterBuf* pBuf = taosAllocateQitem(sizeof(SDataDeleterBuf), DEF_QITEM, 0); if (NULL == pBuf) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index c45226e02b..c2fa438c80 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -126,7 +126,7 @@ static int32_t getStatus(SDataDispatchHandle* pDispatcher) { static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue) { SDataDispatchHandle* pDispatcher = (SDataDispatchHandle*)pHandle; - SDataDispatchBuf* pBuf = taosAllocateQitem(sizeof(SDataDispatchBuf), DEF_QITEM); + SDataDispatchBuf* pBuf = taosAllocateQitem(sizeof(SDataDispatchBuf), DEF_QITEM, 0); if (NULL == pBuf) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 8423b77906..4103ca82dc 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -510,6 +510,7 @@ int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, char* pData, SArray* pCo blockDataEnsureCapacity(pRes, pBlock->info.rows); // data from mnode + pRes->info.dataLoad = 1; pRes->info.rows = pBlock->info.rows; relocateColumnData(pRes, pColList, pBlock->pDataBlock, false); blockDataDestroy(pBlock); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 043cc396b5..1c80eff685 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1080,7 +1080,7 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS qDebug("%s result generated, rows:%d, groupId:%" PRIu64, GET_TASKID(pTaskInfo), pBlock->info.rows, pBlock->info.id.groupId); - + pBlock->info.dataLoad = 1; blockDataUpdateTsWindow(pBlock, 0); return 0; } @@ -2546,6 +2546,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat pBlock->info.rows += pRow->numOfRows; releaseOutputBuf(pState, &key, pRow); } + pBlock->info.dataLoad = 1; blockDataUpdateTsWindow(pBlock, 0); return TSDB_CODE_SUCCESS; } @@ -2635,6 +2636,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta } } + pBlock->info.dataLoad = 1; pBlock->info.rows += pRow->numOfRows; // saveSessionDiscBuf(pState, pKey, pVal, size); releaseOutputBuf(pState, NULL, pRow); diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 2cd1bd7dec..59266dad7e 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -314,7 +314,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) { } int32_t rowIndex = j - num; - applyAggFunctionOnPartialTuples(pTaskInfo, pCtx, NULL, rowIndex, num, pBlock->info.rows, pOperator->exprSupp.numOfExprs); + applyAggFunctionOnPartialTuples(pTaskInfo, pCtx, NULL, rowIndex, num, pBlock->info.rows, + pOperator->exprSupp.numOfExprs); // assign the group keys or user input constant values if required doAssignGroupKeys(pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.rows, rowIndex); @@ -331,7 +332,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) { } int32_t rowIndex = pBlock->info.rows - num; - applyAggFunctionOnPartialTuples(pTaskInfo, pCtx, NULL, rowIndex, num, pBlock->info.rows, pOperator->exprSupp.numOfExprs); + applyAggFunctionOnPartialTuples(pTaskInfo, pCtx, NULL, rowIndex, num, pBlock->info.rows, + pOperator->exprSupp.numOfExprs); doAssignGroupKeys(pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.rows, rowIndex); } } @@ -469,8 +471,8 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* initResultRowInfo(&pInfo->binfo.resultRowInfo); setOperatorInfo(pOperator, "GroupbyAggOperator", 0, true, OP_NOT_OPENED, pInfo, pTaskInfo); - pOperator->fpSet = - createOperatorFpSet(optrDummyOpenFn, hashGroupbyAggregate, NULL, destroyGroupOperatorInfo, optrDefaultBufFn, NULL); + pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, hashGroupbyAggregate, NULL, destroyGroupOperatorInfo, + optrDefaultBufFn, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -696,6 +698,7 @@ static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) { pInfo->pageIndex += 1; releaseBufPage(pInfo->pBuf, page); + pInfo->binfo.pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->binfo.pRes, 0); pInfo->binfo.pRes->info.id.groupId = pGroupInfo->groupId; @@ -776,6 +779,12 @@ static void destroyPartitionOperatorInfo(void* param) { taosArrayDestroy(pInfo->pGroupColVals); taosMemoryFree(pInfo->keyBuf); + + int32_t size = taosArrayGetSize(pInfo->sortedGroupArray); + for (int32_t i = 0; i < size; i++) { + SDataGroupInfo* pGp = taosArrayGet(pInfo->sortedGroupArray, i); + taosArrayDestroy(pGp->pPageList); + } taosArrayDestroy(pInfo->sortedGroupArray); void* pGroupIter = taosHashIterate(pInfo->pGroupSet, NULL); @@ -850,7 +859,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition pOperator->exprSupp.numOfExprs = numOfCols; pOperator->exprSupp.pExprInfo = pExprInfo; - pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, hashPartition, NULL, destroyPartitionOperatorInfo, optrDefaultBufFn, NULL); + pOperator->fpSet = + createOperatorFpSet(optrDummyOpenFn, hashPartition, NULL, destroyPartitionOperatorInfo, optrDefaultBufFn, NULL); code = appendDownstream(pOperator, &downstream, 1); return pOperator; @@ -951,6 +961,8 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { } taosArrayDestroy(pParInfo->rowIds); pParInfo->rowIds = NULL; + pDest->info.dataLoad = 1; + blockDataUpdateTsWindow(pDest, pInfo->tsColIndex); pDest->info.id.groupId = pParInfo->groupId; pOperator->resultInfo.totalRows += pDest->info.rows; @@ -1141,8 +1153,8 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = numOfCols; pOperator->exprSupp.pExprInfo = pExprInfo; - pOperator->fpSet = - createOperatorFpSet(optrDummyOpenFn, doStreamHashPartition, NULL, destroyStreamPartitionOperatorInfo, optrDefaultBufFn, NULL); + pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamHashPartition, NULL, + destroyStreamPartitionOperatorInfo, optrDefaultBufFn, NULL); initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup); code = appendDownstream(pOperator, &downstream, 1); diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index d460af971c..8a097a23ce 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -87,11 +87,11 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t } int32_t numOfCols = 0; - SSDataBlock* pResBlock = createDataBlockFromDescNode(pJoinNode->node.pOutputDataBlockDesc); + pInfo->pRes = createDataBlockFromDescNode(pJoinNode->node.pOutputDataBlockDesc); + SExprInfo* pExprInfo = createExprInfo(pJoinNode->pTargets, NULL, &numOfCols); initResultSizeInfo(&pOperator->resultInfo, 4096); - - pInfo->pRes = pResBlock; + blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); setOperatorInfo(pOperator, "MergeJoinOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.pExprInfo = pExprInfo; @@ -401,6 +401,7 @@ static void doMergeJoinImpl(struct SOperatorInfo* pOperator, SSDataBlock* pRes) // the pDataBlock are always the same one, no need to call this again pRes->info.rows = nrows; + pRes->info.dataLoad = 1; if (pRes->info.rows >= pOperator->resultInfo.threshold) { break; } @@ -412,7 +413,7 @@ SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator) { SSDataBlock* pRes = pJoinInfo->pRes; blockDataCleanup(pRes); - blockDataEnsureCapacity(pRes, 4096); + while (true) { int32_t numOfRowsBefore = pRes->info.rows; doMergeJoinImpl(pOperator, pRes); diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 65bb40b195..8e81a00098 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -654,6 +654,7 @@ static void setPseudoOutputColInfo(SSDataBlock* pResult, SqlFunctionCtx* pCtx, S int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, int32_t numOfOutput, SArray* pPseudoList) { setPseudoOutputColInfo(pResult, pCtx, pPseudoList); + pResult->info.dataLoad = 1; if (pSrcBlock == NULL) { for (int32_t k = 0; k < numOfOutput; ++k) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index eae2ff3c72..d074ceede8 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -110,9 +110,9 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn if (order == TSDB_ORDER_ASC) { w = getAlignQueryTimeWindow(pInterval, pInterval->precision, pBlockInfo->window.skey); - assert(w.ekey >= pBlockInfo->window.skey); + ASSERT(w.ekey >= pBlockInfo->window.skey); - if (TMAX(w.skey, pBlockInfo->window.skey) <= TMIN(w.ekey, pBlockInfo->window.ekey)) { + if (w.ekey < pBlockInfo->window.ekey) { return true; } @@ -122,16 +122,16 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn break; } - assert(w.ekey > pBlockInfo->window.ekey); + ASSERT(w.ekey > pBlockInfo->window.ekey); if (TMAX(w.skey, pBlockInfo->window.skey) <= pBlockInfo->window.ekey) { return true; } } } else { w = getAlignQueryTimeWindow(pInterval, pInterval->precision, pBlockInfo->window.ekey); - assert(w.skey <= pBlockInfo->window.ekey); + ASSERT(w.skey <= pBlockInfo->window.ekey); - if (TMAX(w.skey, pBlockInfo->window.skey) <= TMIN(w.ekey, pBlockInfo->window.ekey)) { + if (w.skey > pBlockInfo->window.skey) { return true; } @@ -1342,6 +1342,7 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, } pDestBlock->info.type = STREAM_CLEAR; pDestBlock->info.version = pSrcBlock->info.version; + pDestBlock->info.dataLoad = 1; blockDataUpdateTsWindow(pDestBlock, 0); return code; } @@ -1450,6 +1451,7 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock } if (out && pInfo->pUpdateDataRes->info.rows > 0) { pInfo->pUpdateDataRes->info.version = pBlock->info.version; + pInfo->pUpdateDataRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pUpdateDataRes, 0); pInfo->pUpdateDataRes->info.type = pInfo->partitionSup.needCalc ? STREAM_DELETE_DATA : STREAM_CLEAR; } @@ -1512,6 +1514,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); } + pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); blockDataFreeRes((SSDataBlock*)pBlock); @@ -1793,6 +1796,7 @@ FETCH_NEXT_BLOCK: // TODO move into scan pBlock->info.calWin.skey = INT64_MIN; pBlock->info.calWin.ekey = INT64_MAX; + pBlock->info.dataLoad = 1; blockDataUpdateTsWindow(pBlock, 0); switch (pBlock->info.type) { case STREAM_NORMAL: @@ -1970,6 +1974,7 @@ FETCH_NEXT_BLOCK: } doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); + pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); if (pBlockInfo->rows > 0 || pInfo->pUpdateDataRes->info.rows > 0) { diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 005b794f0b..7ac007b7cb 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -105,6 +105,7 @@ void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle) { } } + pBlock->info.dataLoad = 1; pBlock->info.rows += 1; } @@ -698,6 +699,7 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData pInfo->limitInfo.numOfOutputRows += p->info.rows; pDataBlock->info.rows = p->info.rows; pDataBlock->info.id.groupId = pInfo->groupId; + pDataBlock->info.dataLoad = 1; } qDebug("%s get sorted block, groupId:0x%" PRIx64 " rows:%d", GET_TASKID(pTaskInfo), pDataBlock->info.id.groupId, diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 072a96fa83..a82dc13318 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -49,10 +49,10 @@ static void doKeepPrevRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock if (!colDataIsNull_s(pColInfoData, rowIndex)) { pkey->isNull = false; char* val = colDataGetData(pColInfoData, rowIndex); - if (!IS_VAR_DATA_TYPE(pkey->type)) { - memcpy(pkey->pData, val, pkey->bytes); - } else { + if (IS_VAR_DATA_TYPE(pkey->type)) { memcpy(pkey->pData, val, varDataLen(val)); + } else { + memcpy(pkey->pData, val, pkey->bytes); } } else { pkey->isNull = true; @@ -91,20 +91,37 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, pSliceInfo->tsCol.slotId); SFillLinearInfo* pLinearInfo = taosArrayGet(pSliceInfo->pLinearInfo, i); + + if (!IS_MATHABLE_TYPE(pColInfoData->info.type)) { + continue; + } + // null value is represented by using key = INT64_MIN for now. // TODO: optimize to ignore null values for linear interpolation. if (!pLinearInfo->isStartSet) { if (!colDataIsNull_s(pColInfoData, rowIndex)) { - ASSERT(IS_MATHABLE_TYPE(pColInfoData->info.type)); pLinearInfo->start.key = *(int64_t*)colDataGetData(pTsCol, rowIndex); - memcpy(pLinearInfo->start.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes); + char* p = colDataGetData(pColInfoData, rowIndex); + if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { + ASSERT(varDataTLen(p) <= pColInfoData->info.bytes); + memcpy(pLinearInfo->start.val, p, varDataTLen(p)); + } else { + memcpy(pLinearInfo->start.val, p, pLinearInfo->bytes); + } } pLinearInfo->isStartSet = true; } else if (!pLinearInfo->isEndSet) { if (!colDataIsNull_s(pColInfoData, rowIndex)) { pLinearInfo->end.key = *(int64_t*)colDataGetData(pTsCol, rowIndex); - memcpy(pLinearInfo->end.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes); + + char* p = colDataGetData(pColInfoData, rowIndex); + if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { + ASSERT(varDataTLen(p) <= pColInfoData->info.bytes); + memcpy(pLinearInfo->end.val, p, varDataTLen(p)); + } else { + memcpy(pLinearInfo->end.val, p, pLinearInfo->bytes); + } } pLinearInfo->isEndSet = true; } else { @@ -113,7 +130,15 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo if (!colDataIsNull_s(pColInfoData, rowIndex)) { pLinearInfo->end.key = *(int64_t*)colDataGetData(pTsCol, rowIndex); - memcpy(pLinearInfo->end.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes); + + char* p = colDataGetData(pColInfoData, rowIndex); + if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { + ASSERT(varDataTLen(p) <= pColInfoData->info.bytes); + memcpy(pLinearInfo->end.val, p, varDataTLen(p)); + } else { + memcpy(pLinearInfo->end.val, p, pLinearInfo->bytes); + } + } else { pLinearInfo->end.key = INT64_MIN; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index d9a011a892..ca64fd135e 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -23,6 +23,7 @@ #include "ttime.h" #define IS_FINAL_OP(op) ((op)->isFinal) +#define DEAULT_DELETE_MARK (1000LL * 60LL * 60LL * 24LL * 365LL * 10LL); typedef struct SSessionAggOperatorInfo { SOptrBasicInfo binfo; @@ -56,6 +57,7 @@ typedef enum SResultTsInterpType { typedef struct SPullWindowInfo { STimeWindow window; uint64_t groupId; + STimeWindow calWin; } SPullWindowInfo; typedef struct SOpenWindowInfo { @@ -793,17 +795,18 @@ int32_t comparePullWinKey(void* pKey, void* data, int32_t index) { SArray* res = (SArray*)data; SPullWindowInfo* pos = taosArrayGet(res, index); SPullWindowInfo* pData = (SPullWindowInfo*)pKey; - if (pData->window.skey == pos->window.skey) { - if (pData->groupId > pos->groupId) { - return 1; - } else if (pData->groupId < pos->groupId) { - return -1; - } - return 0; - } else if (pData->window.skey > pos->window.skey) { + if (pData->groupId > pos->groupId) { return 1; + } else if (pData->groupId < pos->groupId) { + return -1; } - return -1; + + if (pData->window.skey > pos->window.ekey) { + return 1; + } else if (pData->window.ekey < pos->window.skey) { + return -1; + } + return 0; } static int32_t savePullWindow(SPullWindowInfo* pPullInfo, SArray* pPullWins) { @@ -812,10 +815,16 @@ static int32_t savePullWindow(SPullWindowInfo* pPullInfo, SArray* pPullWins) { if (index == -1) { index = 0; } else { - if (comparePullWinKey(pPullInfo, pPullWins, index) > 0) { - index++; - } else { + int32_t code = comparePullWinKey(pPullInfo, pPullWins, index); + if (code == 0) { + SPullWindowInfo* pos = taosArrayGet(pPullWins ,index); + pos->window.skey = TMIN(pos->window.skey, pPullInfo->window.skey); + pos->window.ekey = TMAX(pos->window.ekey, pPullInfo->window.ekey); + pos->calWin.skey = TMIN(pos->calWin.skey, pPullInfo->calWin.skey); + pos->calWin.ekey = TMAX(pos->calWin.ekey, pPullInfo->calWin.ekey); return TSDB_CODE_SUCCESS; + } else if (code > 0 ){ + index++; } } if (taosArrayInsert(pPullWins, index, pPullInfo) == NULL) { @@ -863,19 +872,20 @@ static void removeResults(SArray* pWins, SHashObj* pUpdatedMap) { int32_t compareWinRes(void* pKey, void* data, int32_t index) { SArray* res = (SArray*)data; - SWinKey* pos = taosArrayGet(res, index); - SResKeyPos* pData = (SResKeyPos*)pKey; - if (*(int64_t*)pData->key == pos->ts) { - if (pData->groupId > pos->groupId) { - return 1; - } else if (pData->groupId < pos->groupId) { - return -1; - } - return 0; - } else if (*(int64_t*)pData->key > pos->ts) { + SWinKey* pDataPos = taosArrayGet(res, index); + SResKeyPos* pRKey = (SResKeyPos*)pKey; + if (pRKey->groupId > pDataPos->groupId) { return 1; + } else if (pRKey->groupId < pDataPos->groupId) { + return -1; } - return -1; + + if (*(int64_t*)pRKey->key > pDataPos->ts) { + return 1; + } else if (*(int64_t*)pRKey->key < pDataPos->ts){ + return -1; + } + return 0; } static void removeDeleteResults(SHashObj* pUpdatedMap, SArray* pDelWins) { @@ -1027,9 +1037,10 @@ SResultRowPosition addToOpenWindowList(SResultRowInfo* pResultRowInfo, const SRe int64_t* extractTsCol(SSDataBlock* pBlock, const SIntervalAggOperatorInfo* pInfo) { TSKEY* tsCols = NULL; - if (pBlock->pDataBlock != NULL) { + if (pBlock->pDataBlock != NULL && pBlock->info.dataLoad == 1) { SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); tsCols = (int64_t*)pColDataInfo->pData; + ASSERT(tsCols[0] != 0); // no data in primary ts if (tsCols[0] == 0 && tsCols[pBlock->info.rows - 1] == 0) { @@ -1073,8 +1084,6 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { // the pDataBlock are always the same one, no need to call this again setInputDataBlock(pSup, pBlock, pInfo->inputOrder, scanFlag, true); - blockDataUpdateTsWindow(pBlock, pInfo->primaryTsIndex); - hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, scanFlag); } @@ -1400,19 +1409,21 @@ static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) { int32_t compareWinKey(void* pKey, void* data, int32_t index) { SArray* res = (SArray*)data; - SWinKey* pos = taosArrayGet(res, index); - SWinKey* pData = (SWinKey*)pKey; - if (pData->ts == pos->ts) { - if (pData->groupId > pos->groupId) { - return 1; - } else if (pData->groupId < pos->groupId) { - return -1; - } - return 0; - } else if (pData->ts > pos->ts) { + SWinKey* pDataPos = taosArrayGet(res, index); + SWinKey* pWKey = (SWinKey*)pKey; + + if (pWKey->groupId > pDataPos->groupId) { return 1; + } else if (pWKey->groupId < pDataPos->groupId) { + return -1; } - return -1; + + if (pWKey->ts > pDataPos->ts) { + return 1; + } else if (pWKey->ts < pDataPos->ts) { + return -1; + } + return 0; } static int32_t closeStreamIntervalWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SInterval* pInterval, @@ -2252,8 +2263,8 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB colDataAppend(pStartTs, pBlock->info.rows, (const char*)&pWin->window.skey, false); colDataAppend(pEndTs, pBlock->info.rows, (const char*)&pWin->window.ekey, false); colDataAppend(pGroupId, pBlock->info.rows, (const char*)&pWin->groupId, false); - colDataAppend(pCalStartTs, pBlock->info.rows, (const char*)&pWin->window.skey, false); - colDataAppend(pCalEndTs, pBlock->info.rows, (const char*)&pWin->window.ekey, false); + colDataAppend(pCalStartTs, pBlock->info.rows, (const char*)&pWin->calWin.skey, false); + colDataAppend(pCalEndTs, pBlock->info.rows, (const char*)&pWin->calWin.ekey, false); pBlock->info.rows++; } if ((*pIndex) == size) { @@ -2263,27 +2274,33 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB blockDataUpdateTsWindow(pBlock, 0); } -void processPullOver(SSDataBlock* pBlock, SHashObj* pMap) { +void processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SInterval* pInterval) { SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* tsData = (TSKEY*)pStartCol->pData; + SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); + TSKEY* tsEndData = (TSKEY*)pEndCol->pData; SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* groupIdData = (uint64_t*)pGroupCol->pData; int32_t chId = getChildIndex(pBlock); for (int32_t i = 0; i < pBlock->info.rows; i++) { - SWinKey winRes = {.ts = tsData[i], .groupId = groupIdData[i]}; - void* chIds = taosHashGet(pMap, &winRes, sizeof(SWinKey)); - if (chIds) { - SArray* chArray = *(SArray**)chIds; - int32_t index = taosArraySearchIdx(chArray, &chId, compareInt32Val, TD_EQ); - if (index != -1) { - qDebug("===stream===window %" PRId64 " delete child id %d", winRes.ts, chId); - taosArrayRemove(chArray, index); - if (taosArrayGetSize(chArray) == 0) { - // pull data is over - taosArrayDestroy(chArray); - taosHashRemove(pMap, &winRes, sizeof(SWinKey)); + TSKEY winTs = tsData[i]; + while (winTs < tsEndData[i]) { + SWinKey winRes = {.ts = winTs, .groupId = groupIdData[i]}; + void* chIds = taosHashGet(pMap, &winRes, sizeof(SWinKey)); + if (chIds) { + SArray* chArray = *(SArray**)chIds; + int32_t index = taosArraySearchIdx(chArray, &chId, compareInt32Val, TD_EQ); + if (index != -1) { + qDebug("===stream===window %" PRId64 " delete child id %d", winRes.ts, chId); + taosArrayRemove(chArray, index); + if (taosArrayGetSize(chArray) == 0) { + // pull data is over + taosArrayDestroy(chArray); + taosHashRemove(pMap, &winRes, sizeof(SWinKey)); + } } } + winTs = taosTimeAdd(winTs, pInterval->sliding, pInterval->slidingUnit, pInterval->precision); } } } @@ -2296,12 +2313,13 @@ static void addRetriveWindow(SArray* wins, SStreamIntervalOperatorInfo* pInfo) { if (needDeleteWindowBuf(&nextWin, &pInfo->twAggSup) && !pInfo->ignoreExpiredData) { void* chIds = taosHashGet(pInfo->pPullDataMap, winKey, sizeof(SWinKey)); if (!chIds) { - SPullWindowInfo pull = {.window = nextWin, .groupId = winKey->groupId}; + SPullWindowInfo pull = {.window = nextWin, .groupId = winKey->groupId, .calWin.skey = nextWin.skey, .calWin.ekey = nextWin.skey}; // add pull data request - savePullWindow(&pull, pInfo->pPullWins); - int32_t size1 = taosArrayGetSize(pInfo->pChildren); - addPullWindow(pInfo->pPullDataMap, winKey, size1); - qDebug("===stream===prepare retrive for delete %" PRId64 ", size:%d", winKey->ts, size1); + if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { + int32_t size1 = taosArrayGetSize(pInfo->pChildren); + addPullWindow(pInfo->pPullDataMap, winKey, size1); + qDebug("===stream===prepare retrive for delete %" PRId64 ", size:%d", winKey->ts, size1); + } } } } @@ -2371,12 +2389,13 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p }; void* chIds = taosHashGet(pInfo->pPullDataMap, &winRes, sizeof(SWinKey)); if (isDeletedStreamWindow(&nextWin, groupId, pInfo->pState, &pInfo->twAggSup) && !chIds) { - SPullWindowInfo pull = {.window = nextWin, .groupId = groupId}; + SPullWindowInfo pull = {.window = nextWin, .groupId = groupId, .calWin.skey = nextWin.skey, .calWin.ekey = nextWin.skey}; // add pull data request - savePullWindow(&pull, pInfo->pPullWins); - int32_t size = taosArrayGetSize(pInfo->pChildren); - addPullWindow(pInfo->pPullDataMap, &winRes, size); - qDebug("===stream===prepare retrive %" PRId64 ", size:%d", winRes.ts, size); + if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { + int32_t size = taosArrayGetSize(pInfo->pChildren); + addPullWindow(pInfo->pPullDataMap, &winRes, size); + qDebug("===stream===prepare retrive %" PRId64 ", size:%d", winRes.ts, size); + } } else { int32_t index = -1; SArray* chArray = NULL; @@ -2557,7 +2576,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { } continue; } else if (pBlock->info.type == STREAM_PULL_OVER && IS_FINAL_OP(pInfo)) { - processPullOver(pBlock, pInfo->pPullDataMap); + processPullOver(pBlock, pInfo->pPullDataMap, &pInfo->interval); continue; } @@ -2635,6 +2654,15 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { return NULL; } +int64_t getDeleteMark(SIntervalPhysiNode* pIntervalPhyNode) { + if (pIntervalPhyNode->window.deleteMark <= 0) { + return DEAULT_DELETE_MARK; + } + int64_t deleteMark = TMAX(pIntervalPhyNode->window.deleteMark,pIntervalPhyNode->window.watermark); + deleteMark = TMAX(deleteMark, pIntervalPhyNode->interval); + return deleteMark; +} + SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, int32_t numOfChild) { SIntervalPhysiNode* pIntervalPhyNode = (SIntervalPhysiNode*)pPhyNode; @@ -2656,9 +2684,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, .calTrigger = pIntervalPhyNode->window.triggerType, .maxTs = INT64_MIN, .minTs = INT64_MAX, - // for test 315360000000 - .deleteMark = 1000LL * 60LL * 60LL * 24LL * 365LL * 10LL, - // .deleteMark = INT64_MAX, + .deleteMark = getDeleteMark(pIntervalPhyNode), .deleteMarkSaved = 0, .calTriggerSaved = 0, }; @@ -4802,7 +4828,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys .calTrigger = pIntervalPhyNode->window.triggerType, .maxTs = INT64_MIN, .minTs = INT64_MAX, - .deleteMark = INT64_MAX, + .deleteMark = getDeleteMark(pIntervalPhyNode), }; ASSERT(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY); diff --git a/source/libs/executor/test/executorTests.cpp b/source/libs/executor/test/executorTests.cpp index 1c42163349..2efd06f440 100644 --- a/source/libs/executor/test/executorTests.cpp +++ b/source/libs/executor/test/executorTests.cpp @@ -166,6 +166,7 @@ SSDataBlock* get2ColsDummyBlock(SOperatorInfo* pOperator) { pInfo->current += 1; + pBlock->info.dataLoad = 1; blockDataUpdateTsWindow(pBlock, 0); return pBlock; } diff --git a/source/libs/function/src/detail/tavgfunction.c b/source/libs/function/src/detail/tavgfunction.c index 1c74d22a82..60bf30d8ed 100644 --- a/source/libs/function/src/detail/tavgfunction.c +++ b/source/libs/function/src/detail/tavgfunction.c @@ -514,7 +514,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { numOfElem = pInput->numOfRows; pAvgRes->count += pInput->numOfRows; - bool simdAvailable = tsAVXEnable && tsSIMDEnable && (numOfRows > THRESHOLD_SIZE); + bool simdAvailable = tsAVXEnable && tsSIMDBuiltins && (numOfRows > THRESHOLD_SIZE); switch(type) { case TSDB_DATA_TYPE_UTINYINT: diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c index b2cb36cba0..cb5cea3cc8 100644 --- a/source/libs/function/src/detail/tminmax.c +++ b/source/libs/function/src/detail/tminmax.c @@ -369,7 +369,7 @@ static int32_t findFirstValPosition(const SColumnInfoData* pCol, int32_t start, static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc, bool signVal) { // AVX2 version to speedup the loop - if (tsAVX2Enable && tsSIMDEnable) { + if (tsAVX2Enable && tsSIMDBuiltins) { pBuf->v = i8VectorCmpAVX2(data, numOfRows, isMinFunc, signVal); } else { if (!pBuf->assign) { @@ -403,7 +403,7 @@ static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SM static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc, bool signVal) { // AVX2 version to speedup the loop - if (tsAVX2Enable && tsSIMDEnable) { + if (tsAVX2Enable && tsSIMDBuiltins) { pBuf->v = i16VectorCmpAVX2(data, numOfRows, isMinFunc, signVal); } else { if (!pBuf->assign) { @@ -437,7 +437,7 @@ static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, S static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc, bool signVal) { // AVX2 version to speedup the loop - if (tsAVX2Enable && tsSIMDEnable) { + if (tsAVX2Enable && tsSIMDBuiltins) { pBuf->v = i32VectorCmpAVX2(data, numOfRows, isMinFunc, signVal); } else { if (!pBuf->assign) { @@ -500,7 +500,7 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo float* val = (float*)&pBuf->v; // AVX version to speedup the loop - if (tsAVXEnable && tsSIMDEnable) { + if (tsAVXEnable && tsSIMDBuiltins) { *val = floatVectorCmpAVX(pData, numOfRows, isMinFunc); } else { if (!pBuf->assign) { @@ -530,7 +530,7 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR double* val = (double*)&pBuf->v; // AVX version to speedup the loop - if (tsAVXEnable && tsSIMDEnable) { + if (tsAVXEnable && tsSIMDBuiltins) { *val = (double)doubleVectorCmpAVX(pData, numOfRows, isMinFunc); } else { if (!pBuf->assign) { diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index d45d60d50e..157ee08f15 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -364,15 +364,18 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) { assert(pSlot->info.data->num >= pBucket->elemPerPage && pSlot->info.size > 0); // keep the pointer in memory + setBufPageDirty(pSlot->info.data, true); releaseBufPage(pBucket->pBuffer, pSlot->info.data); pSlot->info.data = NULL; } - SArray *pPageIdList = (SArray *)taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId)); - if (pPageIdList == NULL) { - SArray *pList = taosArrayInit(4, sizeof(int32_t)); - taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pList, POINTER_BYTES); - pPageIdList = pList; + SArray *pPageIdList; + void *p = taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId)); + if (p == NULL) { + pPageIdList = taosArrayInit(4, sizeof(int32_t)); + taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pPageIdList, POINTER_BYTES); + } else { + pPageIdList = *(SArray **)p; } pSlot->info.data = getNewBufPage(pBucket->pBuffer, &pageId); @@ -495,15 +498,16 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction) resetSlotInfo(pMemBucket); int32_t groupId = getGroupId(pMemBucket->numOfSlots, i, pMemBucket->times - 1); - SArray* list = taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId)); + SArray* list = *(SArray **)taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId)); ASSERT(list != NULL && list->size > 0); for (int32_t f = 0; f < list->size; ++f) { - SPageInfo *pgInfo = *(SPageInfo **)taosArrayGet(list, f); - SFilePage *pg = getBufPage(pMemBucket->pBuffer, getPageId(pgInfo)); + int32_t *pageId = taosArrayGet(list, f); + SFilePage *pg = getBufPage(pMemBucket->pBuffer, *pageId); tMemBucketPut(pMemBucket, pg->data, (int32_t)pg->num); - releaseBufPageInfo(pMemBucket->pBuffer, pgInfo); + setBufPageDirty(pg, true); + releaseBufPage(pMemBucket->pBuffer, pg); } return getPercentileImpl(pMemBucket, count - num, fraction); diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 32e57565d4..0b309bc8f5 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -837,9 +837,34 @@ int32_t convertUdfColumnToDataBlock(SUdfColumn *udfCol, SSDataBlock *block) { } int32_t convertScalarParamToDataBlock(SScalarParam *input, int32_t numOfCols, SSDataBlock *output) { - output->info.rows = input->numOfRows; + int32_t numOfRows = 0; + for (int32_t i = 0; i < numOfCols; ++i) { + numOfRows = (input[i].numOfRows > numOfRows) ? input[i].numOfRows : numOfRows; + } + output->info.rows = numOfRows; output->pDataBlock = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); for (int32_t i = 0; i < numOfCols; ++i) { + if ((input+i)->numOfRows < numOfRows) { + SColumnInfoData* pColInfoData = (input+i)->columnData; + int32_t startRow = (input+i)->numOfRows; + int32_t expandRows = numOfRows - startRow; + colInfoDataEnsureCapacity(pColInfoData, numOfRows, false); + bool isNull = colDataIsNull_s(pColInfoData, (input+i)->numOfRows - 1); + if (isNull) { + colDataAppendNNULL(pColInfoData, startRow, expandRows); + } else { + char* src = colDataGetData(pColInfoData, (input + i)->numOfRows - 1); + int32_t bytes = pColInfoData->info.bytes; + char* data = taosMemoryMalloc(bytes); + memcpy(data, src, bytes); + for (int j = 0; j < expandRows; ++j) { + colDataAppend(pColInfoData, startRow+j, data, false); + } + //colDataAppendNItems(pColInfoData, startRow, data, expandRows); + taosMemoryFree(data); + } + } + taosArrayPush(output->pDataBlock, (input + i)->columnData); if (IS_VAR_DATA_TYPE((input + i)->columnData->info.type)) { diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 2f3db636c8..40c75ce6ba 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -28,39 +28,46 @@ #include "tmsg.h" #include "trpc.h" #include "tmisce.h" -// clang-foramt on +// clang-format on typedef struct SUdfdContext { - uv_loop_t * loop; + uv_loop_t *loop; uv_pipe_t ctrlPipe; uv_signal_t intrSignal; char listenPipeName[PATH_MAX + UDF_LISTEN_PIPE_NAME_LEN + 2]; uv_pipe_t listeningPipe; - void * clientRpc; + void *clientRpc; SCorEpSet mgmtEp; uv_mutex_t udfsMutex; - SHashObj * udfsHash; + SHashObj *udfsHash; - SArray* residentFuncs; + SArray *residentFuncs; bool printVersion; } SUdfdContext; SUdfdContext global; +struct SUdfdUvConn; +struct SUvUdfWork; + typedef struct SUdfdUvConn { uv_stream_t *client; - char * inputBuf; + char *inputBuf; int32_t inputLen; int32_t inputCap; int32_t inputTotal; + + struct SUvUdfWork *pWorkList; // head of work list } SUdfdUvConn; typedef struct SUvUdfWork { - uv_stream_t *client; + SUdfdUvConn *conn; uv_buf_t input; uv_buf_t output; + + struct SUvUdfWork *pWorkNext; } SUvUdfWork; typedef enum { UDF_STATE_INIT = 0, UDF_STATE_LOADING, UDF_STATE_READY, UDF_STATE_UNLOADING } EUdfState; @@ -70,7 +77,7 @@ typedef struct SUdf { EUdfState state; uv_mutex_t lock; uv_cond_t condReady; - bool resident; + bool resident; char name[TSDB_FUNC_NAME_LEN + 1]; int8_t funcType; @@ -107,7 +114,7 @@ typedef enum EUdfdRpcReqRspType { typedef struct SUdfdRpcSendRecvInfo { EUdfdRpcReqRspType rpcType; int32_t code; - void * param; + void *param; uv_sem_t resultSem; } SUdfdRpcSendRecvInfo; @@ -178,7 +185,7 @@ void udfdProcessSetupRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { fnInfo("setup request. seq num: %" PRId64 ", udf name: %s", request->seqNum, request->setup.udfName); SUdfSetupRequest *setup = &request->setup; int32_t code = TSDB_CODE_SUCCESS; - SUdf * udf = NULL; + SUdf *udf = NULL; uv_mutex_lock(&global.udfsMutex); SUdf **udfInHash = taosHashGet(global.udfsHash, request->setup.udfName, strlen(request->setup.udfName)); if (udfInHash) { @@ -193,7 +200,7 @@ void udfdProcessSetupRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { uv_cond_init(&udfNew->condReady); udf = udfNew; - SUdf** pUdf = &udf; + SUdf **pUdf = &udf; taosHashPut(global.udfsHash, request->setup.udfName, strlen(request->setup.udfName), pUdf, POINTER_BYTES); uv_mutex_unlock(&global.udfsMutex); } @@ -207,7 +214,7 @@ void udfdProcessSetupRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { } udf->resident = false; for (int32_t i = 0; i < taosArrayGetSize(global.residentFuncs); ++i) { - char* funcName = taosArrayGet(global.residentFuncs, i); + char *funcName = taosArrayGet(global.residentFuncs, i); if (strcmp(setup->udfName, funcName) == 0) { udf->resident = true; break; @@ -248,11 +255,12 @@ void udfdProcessSetupRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { SUdfCallRequest *call = &request->call; - fnDebug("call request. call type %d, handle: %" PRIx64 ", seq num %" PRId64 , call->callType, call->udfHandle, request->seqNum); - SUdfcFuncHandle * handle = (SUdfcFuncHandle *)(call->udfHandle); - SUdf * udf = handle->udf; + fnDebug("call request. call type %d, handle: %" PRIx64 ", seq num %" PRId64, call->callType, call->udfHandle, + request->seqNum); + SUdfcFuncHandle *handle = (SUdfcFuncHandle *)(call->udfHandle); + SUdf *udf = handle->udf; SUdfResponse response = {0}; - SUdfResponse * rsp = &response; + SUdfResponse *rsp = &response; SUdfCallResponse *subRsp = &rsp->callRsp; int32_t code = TSDB_CODE_SUCCESS; @@ -352,7 +360,7 @@ void udfdProcessTeardownRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { SUdfTeardownRequest *teardown = &request->teardown; fnInfo("teardown. seq number: %" PRId64 ", handle:%" PRIx64, request->seqNum, teardown->udfHandle); SUdfcFuncHandle *handle = (SUdfcFuncHandle *)(teardown->udfHandle); - SUdf * udf = handle->udf; + SUdf *udf = handle->udf; bool unloadUdf = false; int32_t code = TSDB_CODE_SUCCESS; @@ -409,15 +417,14 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { if (msgInfo->rpcType == UDFD_RPC_MNODE_CONNECT) { SConnectRsp connectRsp = {0}; tDeserializeSConnectRsp(pMsg->pCont, pMsg->contLen, &connectRsp); - + int32_t now = taosGetTimestampSec(); int32_t delta = abs(now - connectRsp.svrTimestamp); if (delta > 900) { msgInfo->code = TSDB_CODE_TIME_UNSYNCED; goto _return; } - - + if (connectRsp.epSet.numOfEps == 0) { msgInfo->code = TSDB_CODE_APP_ERROR; goto _return; @@ -434,7 +441,7 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { goto _return; } SFuncInfo *pFuncInfo = (SFuncInfo *)taosArrayGet(retrieveRsp.pFuncInfos, 0); - SUdf * udf = msgInfo->param; + SUdf *udf = msgInfo->param; udf->funcType = pFuncInfo->funcType; udf->scriptType = pFuncInfo->scriptType; udf->outputType = pFuncInfo->outputType; @@ -487,7 +494,7 @@ int32_t udfdFillUdfInfoFromMNode(void *clientRpc, char *udfName, SUdf *udf) { taosArrayPush(retrieveReq.pFuncNames, udfName); int32_t contLen = tSerializeSRetrieveFuncReq(NULL, 0, &retrieveReq); - void * pReq = rpcMallocCont(contLen); + void *pReq = rpcMallocCont(contLen); tSerializeSRetrieveFuncReq(pReq, contLen, &retrieveReq); taosArrayDestroy(retrieveReq.pFuncNames); @@ -522,7 +529,7 @@ int32_t udfdConnectToMnode() { connReq.startTime = taosGetTimestampMs(); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connReq); - void * pReq = rpcMallocCont(contLen); + void *pReq = rpcMallocCont(contLen); tSerializeSConnectReq(pReq, contLen, &connReq); SUdfdRpcSendRecvInfo *msgInfo = taosMemoryCalloc(1, sizeof(SUdfdRpcSendRecvInfo)); @@ -589,7 +596,7 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { strncpy(finishFuncName, processFuncName, sizeof(finishFuncName)); strncat(finishFuncName, finishSuffix, strlen(finishSuffix)); uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggFinishFunc)); - char mergeFuncName[TSDB_FUNC_NAME_LEN + 6] = {0}; + char mergeFuncName[TSDB_FUNC_NAME_LEN + 6] = {0}; char *mergeSuffix = "_merge"; strncpy(mergeFuncName, processFuncName, sizeof(mergeFuncName)); strncat(mergeFuncName, mergeSuffix, strlen(mergeSuffix)); @@ -601,9 +608,10 @@ static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { - if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || msgType == TDMT_SCH_MERGE_FETCH) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || + msgType == TDMT_SCH_MERGE_FETCH) { return false; - } + } return true; } else { return false; @@ -663,7 +671,7 @@ int32_t udfdOpenClientRpc() { rpcInit.parent = &global; rpcInit.rfp = udfdRpcRfp; rpcInit.compressSize = tsCompressMsgSize; - + global.clientRpc = rpcOpen(&rpcInit); if (global.clientRpc == NULL) { fnError("failed to init dnode rpc client"); @@ -684,6 +692,17 @@ void udfdOnWrite(uv_write_t *req, int status) { if (status < 0) { fnError("udfd send response error, length: %zu code: %s", work->output.len, uv_err_name(status)); } + // remove work from the connection work list + if (work->conn != NULL) { + SUvUdfWork **ppWork; + for (ppWork = &work->conn->pWorkList; *ppWork && (*ppWork != work); ppWork = &((*ppWork)->pWorkNext)) { + } + if (*ppWork == work) { + *ppWork = work->pWorkNext; + } else { + fnError("work not in conn any more"); + } + } taosMemoryFree(work->output.base); taosMemoryFree(work); taosMemoryFree(req); @@ -692,10 +711,11 @@ void udfdOnWrite(uv_write_t *req, int status) { void udfdSendResponse(uv_work_t *work, int status) { SUvUdfWork *udfWork = (SUvUdfWork *)(work->data); - uv_write_t *write_req = taosMemoryMalloc(sizeof(uv_write_t)); - write_req->data = udfWork; - uv_write(write_req, udfWork->client, &udfWork->output, 1, udfdOnWrite); - + if (udfWork->conn != NULL) { + uv_write_t *write_req = taosMemoryMalloc(sizeof(uv_write_t)); + write_req->data = udfWork; + uv_write(write_req, udfWork->conn->client, &udfWork->output, 1, udfdOnWrite); + } taosMemoryFree(work); } @@ -716,8 +736,8 @@ void udfdAllocBuffer(uv_handle_t *handle, size_t suggestedSize, uv_buf_t *buf) { buf->len = 0; } } else if (ctx->inputTotal == -1 && ctx->inputLen < msgHeadSize) { - buf->base = ctx->inputBuf + ctx->inputLen; - buf->len = msgHeadSize - ctx->inputLen; + buf->base = ctx->inputBuf + ctx->inputLen; + buf->len = msgHeadSize - ctx->inputLen; } else { ctx->inputCap = ctx->inputTotal > ctx->inputCap ? ctx->inputTotal : ctx->inputCap; void *inputBuf = taosMemoryRealloc(ctx->inputBuf, ctx->inputCap); @@ -744,10 +764,15 @@ bool isUdfdUvMsgComplete(SUdfdUvConn *pipe) { } void udfdHandleRequest(SUdfdUvConn *conn) { - uv_work_t * work = taosMemoryMalloc(sizeof(uv_work_t)); + char *inputBuf = conn->inputBuf; + int32_t inputLen = conn->inputLen; + + uv_work_t *work = taosMemoryMalloc(sizeof(uv_work_t)); SUvUdfWork *udfWork = taosMemoryMalloc(sizeof(SUvUdfWork)); - udfWork->client = conn->client; - udfWork->input = uv_buf_init(conn->inputBuf, conn->inputLen); + udfWork->conn = conn; + udfWork->pWorkNext = conn->pWorkList; + conn->pWorkList = udfWork; + udfWork->input = uv_buf_init(inputBuf, inputLen); conn->inputBuf = NULL; conn->inputLen = 0; conn->inputCap = 0; @@ -758,13 +783,19 @@ void udfdHandleRequest(SUdfdUvConn *conn) { void udfdPipeCloseCb(uv_handle_t *pipe) { SUdfdUvConn *conn = pipe->data; + SUvUdfWork* pWork = conn->pWorkList; + while (pWork != NULL) { + pWork->conn = NULL; + pWork = pWork->pWorkNext; + } + taosMemoryFree(conn->client); taosMemoryFree(conn->inputBuf); taosMemoryFree(conn); } void udfdPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { - fnDebug("udf read %zd bytes from client", nread); + fnDebug("udfd read %zd bytes from client", nread); if (nread == 0) return; SUdfdUvConn *conn = client->data; @@ -780,10 +811,10 @@ void udfdPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { } if (nread < 0) { - fnError("Receive error %s", uv_err_name(nread)); if (nread == UV_EOF) { - // TODO check more when close + fnInfo("udfd pipe read EOF"); } else { + fnError("Receive error %s", uv_err_name(nread)); } udfdUvHandleError(conn); } @@ -799,6 +830,7 @@ void udfdOnNewConnection(uv_stream_t *server, int status) { uv_pipe_init(global.loop, client, 0); if (uv_accept(server, (uv_stream_t *)client) == 0) { SUdfdUvConn *ctx = taosMemoryMalloc(sizeof(SUdfdUvConn)); + ctx->pWorkList = NULL; ctx->client = (uv_stream_t *)client; ctx->inputBuf = 0; ctx->inputLen = 0; @@ -891,7 +923,7 @@ static int32_t udfdUvInit() { } global.loop = loop; - if (tsStartUdfd) { // udfd is started by taosd, which shall exit when taosd exit + if (tsStartUdfd) { // udfd is started by taosd, which shall exit when taosd exit uv_pipe_init(global.loop, &global.ctrlPipe, 1); uv_pipe_open(&global.ctrlPipe, 0); uv_read_start((uv_stream_t *)&global.ctrlPipe, udfdCtrlAllocBufCb, udfdCtrlReadCb); @@ -966,10 +998,10 @@ int32_t udfdInitResidentFuncs() { } global.residentFuncs = taosArrayInit(2, TSDB_FUNC_NAME_LEN); - char* pSave = tsUdfdResFuncs; - char* token; + char *pSave = tsUdfdResFuncs; + char *token; while ((token = strtok_r(pSave, ",", &pSave)) != NULL) { - char func[TSDB_FUNC_NAME_LEN+1] = {0}; + char func[TSDB_FUNC_NAME_LEN + 1] = {0}; strncpy(func, token, TSDB_FUNC_NAME_LEN); fnInfo("udfd add resident function %s", func); taosArrayPush(global.residentFuncs, func); @@ -980,10 +1012,10 @@ int32_t udfdInitResidentFuncs() { int32_t udfdDeinitResidentFuncs() { for (int32_t i = 0; i < taosArrayGetSize(global.residentFuncs); ++i) { - char* funcName = taosArrayGet(global.residentFuncs, i); - SUdf** udfInHash = taosHashGet(global.udfsHash, funcName, strlen(funcName)); + char *funcName = taosArrayGet(global.residentFuncs, i); + SUdf **udfInHash = taosHashGet(global.udfsHash, funcName, strlen(funcName)); if (udfInHash) { - SUdf* udf = *udfInHash; + SUdf *udf = *udfInHash; if (udf->destroyFunc) { (udf->destroyFunc)(); } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index b060f7fc83..212a1c92b5 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -194,7 +194,7 @@ db_options(A) ::= db_options(B) PAGESIZE NK_INTEGER(C). db_options(A) ::= db_options(B) TSDB_PAGESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TSDB_PAGESIZE, &C); } db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); } db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); } -db_options(A) ::= db_options(B) STRICT NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STRICT, &C); } +//db_options(A) ::= db_options(B) STRICT NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STRICT, &C); } db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_VGROUPS, &C); } db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLE_STABLE, &C); } db_options(A) ::= db_options(B) RETENTIONS retention_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_RETENTIONS, C); } @@ -232,7 +232,7 @@ alter_db_option(A) ::= KEEP integer_list(B). alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; } alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } -alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; } +//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; } alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; } @@ -1067,5 +1067,5 @@ null_ordering_opt(A) ::= NULLS FIRST. null_ordering_opt(A) ::= NULLS LAST. { A = NULL_ORDER_LAST; } %fallback ABORT AFTER ATTACH BEFORE BEGIN BITAND BITNOT BITOR BLOCKS CHANGE COMMA COMPACT CONCAT CONFLICT COPY DEFERRED DELIMITERS DETACH DIVIDE DOT EACH END FAIL - FILE FOR GLOB ID IMMEDIATE IMPORT INITIALLY INSTEAD ISNULL KEY MODULES NK_BITNOT NK_SEMI NOTNULL OF PLUS PRIVILEGE RAISE REPLACE RESTRICT ROW SEMI STAR STATEMENT STRING - TIMES UPDATE VALUES VARIABLE VIEW WAL. + FILE FOR GLOB ID IMMEDIATE IMPORT INITIALLY INSTEAD ISNULL KEY MODULES NK_BITNOT NK_SEMI NOTNULL OF PLUS PRIVILEGE RAISE REPLACE RESTRICT ROW SEMI STAR STATEMENT + STRICT STRING TIMES UPDATE VALUES VARIABLE VIEW WAL. diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 59545d8fbc..36420599b3 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -563,7 +563,8 @@ static int32_t parseTagValue(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt static void buildCreateTbReq(SVnodeModifOpStmt* pStmt, STag* pTag, SArray* pTagName) { insBuildCreateTbReq(&pStmt->createTblReq, pStmt->targetTableName.tname, pTag, pStmt->pTableMeta->suid, - pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, + TSDB_DEFAULT_TABLE_TTL); } static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf) { @@ -829,6 +830,44 @@ static int32_t getTableVgroup(SParseContext* pCxt, SVnodeModifOpStmt* pStmt, boo return code; } +static int32_t getTableMetaAndVgroupImpl(SParseContext* pCxt, SVnodeModifOpStmt* pStmt, bool* pMissCache) { + SVgroupInfo vg; + int32_t code = catalogGetCachedTableVgMeta(pCxt->pCatalog, &pStmt->targetTableName, &vg, &pStmt->pTableMeta); + if (TSDB_CODE_SUCCESS == code) { + if (NULL != pStmt->pTableMeta) { + code = taosHashPut(pStmt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)); + } + *pMissCache = (NULL == pStmt->pTableMeta); + } + return code; +} + +static int32_t getTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt, bool* pMissCache) { + SParseContext* pComCxt = pCxt->pComCxt; + int32_t code = TSDB_CODE_SUCCESS; + if (pComCxt->async) { + code = getTableMetaAndVgroupImpl(pComCxt, pStmt, pMissCache); + } else { + code = getTableMeta(pCxt, &pStmt->targetTableName, false, &pStmt->pTableMeta, pMissCache); + if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) { + code = getTableVgroup(pCxt->pComCxt, pStmt, false, &pCxt->missCache); + } + } + return code; +} + +static int32_t collectUseTable(const SName* pName, SHashObj* pTable) { + char fullName[TSDB_TABLE_FNAME_LEN]; + tNameExtractFullName(pName, fullName); + return taosHashPut(pTable, fullName, strlen(fullName), pName, sizeof(SName)); +} + +static int32_t collectUseDatabase(const SName* pName, SHashObj* pDbs) { + char dbFName[TSDB_DB_FNAME_LEN] = {0}; + tNameGetFullDbName(pName, dbFName); + return taosHashPut(pDbs, dbFName, strlen(dbFName), dbFName, sizeof(dbFName)); +} + static int32_t getTargetTableSchema(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt) { if (pCxt->forceUpdate) { pCxt->missCache = true; @@ -836,12 +875,24 @@ static int32_t getTargetTableSchema(SInsertParseContext* pCxt, SVnodeModifOpStmt } int32_t code = checkAuth(pCxt->pComCxt, &pStmt->targetTableName, &pCxt->missCache); +#if 0 if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) { code = getTableMeta(pCxt, &pStmt->targetTableName, false, &pStmt->pTableMeta, &pCxt->missCache); } if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) { code = getTableVgroup(pCxt->pComCxt, pStmt, false, &pCxt->missCache); } +#else + if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) { + code = getTableMetaAndVgroup(pCxt, pStmt, &pCxt->missCache); + } +#endif + if (TSDB_CODE_SUCCESS == code && !pCxt->pComCxt->async) { + code = collectUseDatabase(&pStmt->targetTableName, pStmt->pDbFNameHashObj); + if (TSDB_CODE_SUCCESS == code) { + code = collectUseTable(&pStmt->targetTableName, pStmt->pTableNameHashObj); + } + } return code; } @@ -862,6 +913,12 @@ static int32_t getUsingTableSchema(SInsertParseContext* pCxt, SVnodeModifOpStmt* if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) { code = getTableVgroup(pCxt->pComCxt, pStmt, true, &pCxt->missCache); } + if (TSDB_CODE_SUCCESS == code && !pCxt->pComCxt->async) { + code = collectUseDatabase(&pStmt->usingTableName, pStmt->pDbFNameHashObj); + if (TSDB_CODE_SUCCESS == code) { + code = collectUseTable(&pStmt->usingTableName, pStmt->pTableNameHashObj); + } + } return code; } @@ -933,11 +990,10 @@ static int32_t getTableDataBlocks(SInsertParseContext* pCxt, SVnodeModifOpStmt* if (pStmt->usingTableProcessing) { pStmt->pTableMeta->uid = 0; } - - return insGetDataBlockFromList(pStmt->pTableBlockHashObj, &uid, sizeof(pStmt->pTableMeta->uid), - TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), - getTableInfo(pStmt->pTableMeta).rowSize, pStmt->pTableMeta, pDataBuf, NULL, - &pStmt->createTblReq); + + return insGetDataBlockFromList( + pStmt->pTableBlockHashObj, &uid, sizeof(pStmt->pTableMeta->uid), TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), + getTableInfo(pStmt->pTableMeta).rowSize, pStmt->pTableMeta, pDataBuf, NULL, &pStmt->createTblReq); } char tbFName[TSDB_TABLE_FNAME_LEN]; tNameExtractFullName(&pStmt->targetTableName, tbFName); @@ -1540,8 +1596,9 @@ static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt) memcpy(tags, &pCxt->tags, sizeof(pCxt->tags)); SStmtCallback* pStmtCb = pCxt->pComCxt->pStmtCb; - int32_t code = (*pStmtCb->setInfoFn)(pStmtCb->pStmt, pStmt->pTableMeta, tags, &pStmt->targetTableName, pStmt->usingTableProcessing, - pStmt->pVgroupsHashObj, pStmt->pTableBlockHashObj, pStmt->usingTableName.tname); + int32_t code = (*pStmtCb->setInfoFn)(pStmtCb->pStmt, pStmt->pTableMeta, tags, &pStmt->targetTableName, + pStmt->usingTableProcessing, pStmt->pVgroupsHashObj, pStmt->pTableBlockHashObj, + pStmt->usingTableName.tname); memset(&pCxt->tags, 0, sizeof(pCxt->tags)); pStmt->pVgroupsHashObj = NULL; @@ -1776,16 +1833,25 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR static int32_t setRefreshMate(SQuery* pQuery) { SVnodeModifOpStmt* pStmt = (SVnodeModifOpStmt*)pQuery->pRoot; - SName* pTable = taosHashIterate(pStmt->pTableNameHashObj, NULL); - while (NULL != pTable) { - taosArrayPush(pQuery->pTableList, pTable); - pTable = taosHashIterate(pStmt->pTableNameHashObj, pTable); + + if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) { + taosArrayDestroy(pQuery->pTableList); + pQuery->pTableList = taosArrayInit(taosHashGetSize(pStmt->pTableNameHashObj), sizeof(SName)); + SName* pTable = taosHashIterate(pStmt->pTableNameHashObj, NULL); + while (NULL != pTable) { + taosArrayPush(pQuery->pTableList, pTable); + pTable = taosHashIterate(pStmt->pTableNameHashObj, pTable); + } } - char* pDb = taosHashIterate(pStmt->pDbFNameHashObj, NULL); - while (NULL != pDb) { - taosArrayPush(pQuery->pDbList, pDb); - pDb = taosHashIterate(pStmt->pDbFNameHashObj, pDb); + if (taosHashGetSize(pStmt->pDbFNameHashObj) > 0) { + taosArrayDestroy(pQuery->pDbList); + pQuery->pDbList = taosArrayInit(taosHashGetSize(pStmt->pDbFNameHashObj), TSDB_DB_FNAME_LEN); + char* pDb = taosHashIterate(pStmt->pDbFNameHashObj, NULL); + while (NULL != pDb) { + taosArrayPush(pQuery->pDbList, pDb); + pDb = taosHashIterate(pStmt->pDbFNameHashObj, pDb); + } } return TSDB_CODE_SUCCESS; @@ -1899,29 +1965,28 @@ static int32_t buildInsertCatalogReq(SInsertParseContext* pCxt, SVnodeModifOpStm } static int32_t setNextStageInfo(SInsertParseContext* pCxt, SQuery* pQuery, SCatalogReq* pCatalogReq) { + SVnodeModifOpStmt* pStmt = (SVnodeModifOpStmt*)pQuery->pRoot; if (pCxt->missCache) { - parserDebug("0x%" PRIx64 " %d rows have been inserted before cache miss", pCxt->pComCxt->requestId, - ((SVnodeModifOpStmt*)pQuery->pRoot)->totalRowsNum); + parserDebug("0x%" PRIx64 " %d rows of %d tables have been inserted before cache miss", pCxt->pComCxt->requestId, + pStmt->totalRowsNum, pStmt->totalTbNum); pQuery->execStage = QUERY_EXEC_STAGE_PARSE; - return buildInsertCatalogReq(pCxt, (SVnodeModifOpStmt*)pQuery->pRoot, pCatalogReq); + return buildInsertCatalogReq(pCxt, pStmt, pCatalogReq); } - parserDebug("0x%" PRIx64 " %d rows have been inserted", pCxt->pComCxt->requestId, - ((SVnodeModifOpStmt*)pQuery->pRoot)->totalRowsNum); + parserDebug("0x%" PRIx64 " %d rows of %d tables have been inserted", pCxt->pComCxt->requestId, pStmt->totalRowsNum, + pStmt->totalTbNum); pQuery->execStage = QUERY_EXEC_STAGE_SCHEDULE; return TSDB_CODE_SUCCESS; } int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatalogReq, const SMetaData* pMetaData) { - SInsertParseContext context = { - .pComCxt = pCxt, - .msg = {.buf = pCxt->pMsg, .len = pCxt->msgLen}, - .missCache = false, - .usingDuplicateTable = false, - .forceUpdate = (NULL != pCatalogReq ? pCatalogReq->forceUpdate : false) - }; + SInsertParseContext context = {.pComCxt = pCxt, + .msg = {.buf = pCxt->pMsg, .len = pCxt->msgLen}, + .missCache = false, + .usingDuplicateTable = false, + .forceUpdate = (NULL != pCatalogReq ? pCatalogReq->forceUpdate : false)}; int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 85a4e70124..d4feef6cb4 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2837,7 +2837,7 @@ static int32_t rewriteProjectAlias(SNodeList* pProjectionList) { return TSDB_CODE_SUCCESS; } -static int32_t checkProjectAlias(STranslateContext* pCxt, SNodeList* pProjectionList) { +static int32_t checkProjectAlias(STranslateContext* pCxt, SNodeList* pProjectionList, SHashObj** pOutput) { SHashObj* pUserAliasSet = taosHashInit(LIST_LENGTH(pProjectionList), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); SNode* pProject = NULL; @@ -2849,13 +2849,17 @@ static int32_t checkProjectAlias(STranslateContext* pCxt, SNodeList* pProjection } taosHashPut(pUserAliasSet, pExpr->userAlias, strlen(pExpr->userAlias), &pExpr, POINTER_BYTES); } - taosHashCleanup(pUserAliasSet); + if (NULL == pOutput) { + taosHashCleanup(pUserAliasSet); + } else { + *pOutput = pUserAliasSet; + } return TSDB_CODE_SUCCESS; } static int32_t translateProjectionList(STranslateContext* pCxt, SSelectStmt* pSelect) { if (pSelect->isSubquery) { - return checkProjectAlias(pCxt, pSelect->pProjectionList); + return checkProjectAlias(pCxt, pSelect->pProjectionList, NULL); } return rewriteProjectAlias(pSelect->pProjectionList); } @@ -3879,12 +3883,16 @@ static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOpt pOptions->keep[2] = getBigintFromValueNode((SValueNode*)nodesListGetNode(pOptions->pKeep, 2)); } + int64_t tsdbMaxKeep = TSDB_MAX_KEEP; + if (pOptions->precision == TSDB_TIME_PRECISION_NANO) { + tsdbMaxKeep = TSDB_MAX_KEEP_NS; + } + if (pOptions->keep[0] < TSDB_MIN_KEEP || pOptions->keep[1] < TSDB_MIN_KEEP || pOptions->keep[2] < TSDB_MIN_KEEP || - pOptions->keep[0] > TSDB_MAX_KEEP || pOptions->keep[1] > TSDB_MAX_KEEP || pOptions->keep[2] > TSDB_MAX_KEEP) { + pOptions->keep[0] > tsdbMaxKeep || pOptions->keep[1] > tsdbMaxKeep || pOptions->keep[2] > tsdbMaxKeep) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option keep: %" PRId64 ", %" PRId64 ", %" PRId64 " valid range: [%dm, %dm]", - pOptions->keep[0], pOptions->keep[1], pOptions->keep[2], TSDB_MIN_KEEP, - TSDB_MAX_KEEP); + pOptions->keep[0], pOptions->keep[1], pOptions->keep[2], TSDB_MIN_KEEP, tsdbMaxKeep); } if (!((pOptions->keep[0] <= pOptions->keep[1]) && (pOptions->keep[1] <= pOptions->keep[2]))) { @@ -4036,7 +4044,10 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName TSDB_MAX_MINROWS_FBLOCK); } if (TSDB_CODE_SUCCESS == code) { - code = checkDbKeepOption(pCxt, pOptions); + code = checkDbPrecisionOption(pCxt, pOptions); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbKeepOption(pCxt, pOptions); // use precision } if (TSDB_CODE_SUCCESS == code) { code = checkDbRangeOption(pCxt, "pages", pOptions->pages, TSDB_MIN_PAGES_PER_VNODE, TSDB_MAX_PAGES_PER_VNODE); @@ -4049,9 +4060,6 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName code = checkDbRangeOption(pCxt, "tsdbPagesize", pOptions->tsdbPageSize, TSDB_MIN_TSDB_PAGESIZE, TSDB_MAX_TSDB_PAGESIZE); } - if (TSDB_CODE_SUCCESS == code) { - code = checkDbPrecisionOption(pCxt, pOptions); - } if (TSDB_CODE_SUCCESS == code) { code = checkDbEnumOption(pCxt, "replications", pOptions->replica, TSDB_MIN_DB_REPLICA, TSDB_MAX_DB_REPLICA); } @@ -5499,9 +5507,24 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) { tNameGetFullDbName(&name, pDbFName); } -static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { - SSelectStmt* pSelect = (SSelectStmt*)pStmt; - SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); +static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len) { + if (NULL == taosHashGet(pUserAliasSet, "_wstart", strlen("_wstart"))) { + snprintf(aliasName, len, "%s", "_wstart"); + return; + } + if (NULL == taosHashGet(pUserAliasSet, "ts", strlen("ts"))) { + snprintf(aliasName, len, "%s", "ts"); + return; + } + do { + taosRandStr(aliasName, len - 1); + aliasName[len - 1] = '\0'; + } while (NULL != taosHashGet(pUserAliasSet, aliasName, strlen(aliasName))); + return; +} + +static int32_t addWstartTsToCreateStreamQueryImpl(SSelectStmt* pSelect, SHashObj* pUserAliasSet) { + SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); if (NULL == pSelect->pWindow || (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_wstart", ((SFunctionNode*)pProj)->functionName))) { return TSDB_CODE_SUCCESS; @@ -5511,7 +5534,7 @@ static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { return TSDB_CODE_OUT_OF_MEMORY; } strcpy(pFunc->functionName, "_wstart"); - strcpy(pFunc->node.aliasName, pFunc->functionName); + getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName)); int32_t code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode((SNode*)pFunc); @@ -5519,6 +5542,17 @@ static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { return code; } +static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt) { + SSelectStmt* pSelect = (SSelectStmt*)pStmt; + SHashObj* pUserAliasSet = NULL; + int32_t code = checkProjectAlias(pCxt, pSelect->pProjectionList, &pUserAliasSet); + if (TSDB_CODE_SUCCESS == code) { + code = addWstartTsToCreateStreamQueryImpl(pSelect, pUserAliasSet); + } + taosHashCleanup(pUserAliasSet); + return code; +} + static int32_t addTagsToCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SSelectStmt* pSelect) { if (NULL == pStmt->pTags) { return TSDB_CODE_SUCCESS; @@ -5621,7 +5655,7 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SSelectStmt* pSelect) { static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { pCxt->createStream = true; - int32_t code = addWstartTsToCreateStreamQuery(pStmt->pQuery); + int32_t code = addWstartTsToCreateStreamQuery(pCxt, pStmt->pQuery); if (TSDB_CODE_SUCCESS == code) { code = addSubtableInfoToCreateStreamQuery(pCxt, pStmt); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index b4d4a3457e..a1ebe0ac32 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 710 -#define YYNRULE 540 +#define YYNSTATE 708 +#define YYNRULE 538 #define YYNTOKEN 322 -#define YY_MAX_SHIFT 709 -#define YY_MIN_SHIFTREDUCE 1052 -#define YY_MAX_SHIFTREDUCE 1591 -#define YY_ERROR_ACTION 1592 -#define YY_ACCEPT_ACTION 1593 -#define YY_NO_ACTION 1594 -#define YY_MIN_REDUCE 1595 -#define YY_MAX_REDUCE 2134 +#define YY_MAX_SHIFT 707 +#define YY_MIN_SHIFTREDUCE 1048 +#define YY_MAX_SHIFTREDUCE 1585 +#define YY_ERROR_ACTION 1586 +#define YY_ACCEPT_ACTION 1587 +#define YY_NO_ACTION 1588 +#define YY_MIN_REDUCE 1589 +#define YY_MAX_REDUCE 2126 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,694 +216,736 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2410) +#define YY_ACTTAB_COUNT (2706) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1950, 458, 157, 459, 1631, 566, 167, 1703, 467, 2105, - /* 10 */ 459, 1631, 43, 41, 1522, 365, 1651, 2110, 1796, 1798, - /* 20 */ 360, 2105, 1373, 1595, 565, 173, 598, 332, 1850, 2106, - /* 30 */ 567, 1968, 1741, 1452, 405, 1371, 1664, 2109, 514, 581, - /* 40 */ 52, 2106, 2108, 1933, 1919, 399, 614, 122, 121, 120, - /* 50 */ 119, 118, 117, 116, 115, 114, 464, 1750, 1447, 597, - /* 60 */ 36, 35, 460, 16, 42, 40, 39, 38, 37, 1949, - /* 70 */ 1379, 1929, 1935, 1984, 318, 597, 100, 1951, 618, 1953, - /* 80 */ 1954, 613, 608, 608, 258, 597, 1526, 546, 170, 1938, - /* 90 */ 2037, 2105, 1398, 476, 354, 2033, 12, 2052, 1462, 1950, - /* 100 */ 1933, 513, 512, 511, 1398, 1968, 2111, 173, 175, 128, - /* 110 */ 507, 2106, 567, 560, 506, 505, 2063, 158, 706, 1607, - /* 120 */ 504, 510, 58, 2049, 85, 561, 503, 598, 1929, 1935, - /* 130 */ 1968, 1398, 1085, 1454, 1455, 1104, 1593, 1103, 615, 608, - /* 140 */ 2110, 123, 1846, 1919, 2105, 614, 43, 41, 497, 1558, - /* 150 */ 210, 46, 559, 181, 360, 1727, 1373, 1399, 1750, 1950, - /* 160 */ 2109, 46, 1428, 1437, 2106, 2107, 1105, 1452, 1949, 1371, - /* 170 */ 598, 1087, 1984, 1090, 1091, 100, 1951, 618, 1953, 1954, - /* 180 */ 613, 1374, 608, 1372, 123, 134, 62, 141, 2008, 2037, - /* 190 */ 1968, 502, 1447, 354, 2033, 33, 274, 16, 581, 375, - /* 200 */ 1398, 1750, 652, 1919, 1379, 614, 1377, 1378, 1398, 1427, - /* 210 */ 1430, 1431, 1432, 1433, 1434, 1435, 1436, 610, 606, 1445, - /* 220 */ 1446, 1448, 1449, 1450, 1451, 1453, 1456, 2, 1949, 97, - /* 230 */ 12, 2110, 1984, 1950, 1429, 100, 1951, 618, 1953, 1954, - /* 240 */ 613, 546, 608, 132, 1397, 2105, 1429, 170, 1400, 2037, - /* 250 */ 556, 1742, 706, 354, 2033, 42, 40, 39, 38, 37, - /* 260 */ 2111, 173, 9, 650, 1968, 2106, 567, 1454, 1455, 1797, - /* 270 */ 1798, 176, 615, 1309, 1310, 2064, 58, 1919, 58, 614, - /* 280 */ 43, 41, 146, 145, 647, 646, 645, 143, 360, 1400, - /* 290 */ 1373, 58, 1399, 1950, 509, 508, 1428, 1437, 1618, 578, - /* 300 */ 176, 1452, 1949, 1371, 457, 598, 1984, 462, 1637, 100, - /* 310 */ 1951, 618, 1953, 1954, 613, 1374, 608, 1372, 225, 178, - /* 320 */ 643, 2012, 169, 2037, 1968, 1581, 1447, 354, 2033, 1483, - /* 330 */ 131, 16, 615, 562, 557, 1790, 1750, 1919, 1379, 614, - /* 340 */ 1377, 1378, 1919, 1427, 1430, 1431, 1432, 1433, 1434, 1435, - /* 350 */ 1436, 610, 606, 1445, 1446, 1448, 1449, 1450, 1451, 1453, - /* 360 */ 1456, 2, 1949, 9, 12, 1950, 1984, 677, 675, 100, - /* 370 */ 1951, 618, 1953, 1954, 613, 398, 608, 397, 82, 320, - /* 380 */ 58, 2125, 531, 2037, 529, 80, 706, 354, 2033, 255, - /* 390 */ 2045, 577, 257, 124, 576, 441, 1968, 2105, 2071, 127, - /* 400 */ 30, 1454, 1455, 541, 612, 1256, 1257, 406, 1745, 1919, - /* 410 */ 1488, 614, 565, 173, 43, 41, 1457, 2106, 567, 585, - /* 420 */ 407, 1379, 360, 1725, 1373, 176, 47, 176, 1846, 351, - /* 430 */ 1428, 1437, 1861, 257, 1949, 1452, 185, 1371, 1984, 183, - /* 440 */ 176, 310, 1951, 618, 1953, 1954, 613, 650, 608, 1374, - /* 450 */ 2003, 1372, 466, 189, 188, 462, 1637, 36, 35, 664, - /* 460 */ 1447, 42, 40, 39, 38, 37, 146, 145, 647, 646, - /* 470 */ 645, 143, 1379, 77, 1377, 1378, 76, 1427, 1430, 1431, - /* 480 */ 1432, 1433, 1434, 1435, 1436, 610, 606, 1445, 1446, 1448, - /* 490 */ 1449, 1450, 1451, 1453, 1456, 2, 598, 1617, 44, 598, - /* 500 */ 1739, 1950, 1803, 513, 512, 511, 1398, 598, 1803, 353, - /* 510 */ 403, 128, 507, 404, 1735, 364, 506, 505, 1801, 1616, - /* 520 */ 706, 413, 504, 510, 1801, 352, 363, 1750, 503, 176, - /* 530 */ 1750, 650, 1968, 155, 155, 1454, 1455, 1104, 1750, 1103, - /* 540 */ 615, 1919, 1752, 1752, 527, 1919, 1538, 614, 43, 41, - /* 550 */ 146, 145, 647, 646, 645, 143, 360, 525, 1373, 523, - /* 560 */ 1737, 1950, 598, 1919, 1428, 1437, 394, 1173, 1105, 1452, - /* 570 */ 1949, 1371, 598, 578, 1984, 176, 427, 100, 1951, 618, - /* 580 */ 1953, 1954, 613, 1374, 608, 1372, 428, 396, 392, 2010, - /* 590 */ 1733, 2037, 1968, 1750, 1447, 354, 2033, 226, 230, 9, - /* 600 */ 615, 7, 1175, 1750, 131, 1919, 1379, 614, 1377, 1378, - /* 610 */ 80, 1427, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 610, - /* 620 */ 606, 1445, 1446, 1448, 1449, 1450, 1451, 1453, 1456, 2, - /* 630 */ 1949, 167, 44, 1746, 1984, 366, 605, 100, 1951, 618, - /* 640 */ 1953, 1954, 613, 155, 608, 265, 266, 1615, 1429, 2125, - /* 650 */ 264, 2037, 1752, 1851, 706, 354, 2033, 1614, 1950, 1728, - /* 660 */ 1350, 1351, 580, 171, 2045, 2046, 2099, 129, 2050, 1454, - /* 670 */ 1455, 36, 35, 6, 29, 42, 40, 39, 38, 37, - /* 680 */ 36, 35, 43, 41, 42, 40, 39, 38, 37, 1968, - /* 690 */ 360, 1919, 1373, 91, 598, 598, 2077, 615, 1428, 1437, - /* 700 */ 1613, 1919, 1919, 1452, 614, 1371, 1803, 25, 474, 475, - /* 710 */ 39, 38, 37, 329, 600, 1743, 2009, 1374, 602, 1372, - /* 720 */ 2009, 476, 1801, 609, 155, 1750, 1750, 1949, 1447, 227, - /* 730 */ 1612, 1984, 1780, 1753, 159, 1951, 618, 1953, 1954, 613, - /* 740 */ 1379, 608, 1377, 1378, 1919, 1427, 1430, 1431, 1432, 1433, - /* 750 */ 1434, 1435, 1436, 610, 606, 1445, 1446, 1448, 1449, 1450, - /* 760 */ 1451, 1453, 1456, 2, 36, 35, 12, 1950, 42, 40, - /* 770 */ 39, 38, 37, 1846, 1919, 547, 2074, 566, 1548, 1473, - /* 780 */ 317, 2105, 1396, 2052, 187, 598, 642, 1611, 706, 435, - /* 790 */ 1610, 1609, 448, 1596, 1606, 447, 565, 173, 1968, 1747, - /* 800 */ 1726, 2106, 567, 1454, 1455, 1605, 615, 1608, 1604, 2048, - /* 810 */ 419, 1919, 449, 614, 113, 421, 1750, 112, 111, 110, - /* 820 */ 109, 108, 107, 106, 105, 104, 553, 1546, 1547, 1549, - /* 830 */ 1550, 1919, 1428, 1437, 1919, 1919, 532, 665, 1919, 1720, - /* 840 */ 1984, 598, 598, 306, 1951, 618, 1953, 1954, 613, 1919, - /* 850 */ 608, 1374, 1919, 1372, 1603, 139, 367, 333, 1661, 36, - /* 860 */ 35, 1519, 652, 42, 40, 39, 38, 37, 2109, 409, - /* 870 */ 1401, 1401, 1750, 1750, 2052, 1602, 1377, 1378, 1515, 1427, - /* 880 */ 1430, 1431, 1432, 1433, 1434, 1435, 1436, 610, 606, 1445, - /* 890 */ 1446, 1448, 1449, 1450, 1451, 1453, 1456, 2, 1919, 445, - /* 900 */ 2047, 1704, 440, 439, 438, 437, 434, 433, 432, 431, - /* 910 */ 430, 426, 425, 424, 423, 334, 416, 415, 414, 1919, - /* 920 */ 411, 410, 331, 683, 682, 681, 680, 370, 144, 679, - /* 930 */ 678, 135, 673, 672, 671, 670, 669, 668, 667, 666, - /* 940 */ 148, 662, 661, 660, 369, 368, 657, 656, 655, 654, - /* 950 */ 653, 156, 1601, 1600, 598, 1599, 294, 36, 35, 357, - /* 960 */ 356, 42, 40, 39, 38, 37, 1598, 1950, 542, 1387, - /* 970 */ 292, 66, 598, 133, 65, 644, 2008, 252, 1794, 1401, - /* 980 */ 1452, 51, 1380, 36, 35, 1750, 582, 42, 40, 39, - /* 990 */ 38, 37, 193, 454, 452, 585, 1919, 1919, 1968, 1919, - /* 1000 */ 11, 10, 337, 1750, 648, 1447, 615, 1794, 1862, 554, - /* 1010 */ 1919, 1919, 325, 614, 182, 235, 573, 1379, 1213, 640, - /* 1020 */ 639, 638, 1217, 637, 1219, 1220, 636, 1222, 633, 58, - /* 1030 */ 1228, 630, 1230, 1231, 627, 624, 1949, 209, 288, 598, - /* 1040 */ 1984, 1780, 1803, 100, 1951, 618, 1953, 1954, 613, 649, - /* 1050 */ 608, 584, 1794, 269, 1481, 2125, 216, 2037, 1802, 214, - /* 1060 */ 211, 354, 2033, 709, 338, 604, 336, 335, 99, 499, - /* 1070 */ 1750, 246, 2056, 501, 598, 162, 1906, 281, 1373, 1090, - /* 1080 */ 1091, 493, 489, 485, 481, 208, 2057, 1515, 593, 1833, - /* 1090 */ 598, 1371, 166, 546, 501, 500, 1495, 2105, 699, 695, - /* 1100 */ 691, 687, 279, 1518, 595, 1750, 74, 73, 402, 578, - /* 1110 */ 1482, 180, 2111, 173, 67, 570, 500, 2106, 567, 598, - /* 1120 */ 1382, 1750, 81, 234, 382, 206, 1379, 569, 1388, 316, - /* 1130 */ 1383, 1969, 390, 596, 388, 384, 380, 377, 374, 98, - /* 1140 */ 131, 48, 272, 3, 137, 1381, 125, 371, 1588, 60, - /* 1150 */ 1750, 1855, 113, 1391, 1393, 112, 111, 110, 109, 108, - /* 1160 */ 107, 106, 105, 104, 75, 606, 1445, 1446, 1448, 1449, - /* 1170 */ 1450, 1451, 239, 218, 706, 594, 217, 1950, 176, 45, - /* 1180 */ 598, 32, 358, 1476, 1477, 1478, 1479, 1480, 1484, 1485, - /* 1190 */ 1486, 1487, 205, 199, 275, 204, 1644, 1642, 472, 172, - /* 1200 */ 2045, 2046, 1545, 129, 2050, 1950, 220, 222, 1968, 219, - /* 1210 */ 221, 1750, 260, 262, 197, 50, 615, 140, 516, 519, - /* 1220 */ 545, 1919, 142, 614, 233, 241, 1590, 1591, 1940, 1344, - /* 1230 */ 96, 229, 1320, 11, 10, 1632, 1968, 1374, 574, 1372, - /* 1240 */ 93, 422, 1587, 144, 615, 1133, 1949, 658, 1950, 1919, - /* 1250 */ 1984, 614, 2067, 100, 1951, 618, 1953, 1954, 613, 60, - /* 1260 */ 608, 45, 1377, 1378, 83, 601, 267, 2037, 1385, 1153, - /* 1270 */ 590, 354, 2033, 1791, 1949, 271, 1950, 1942, 1984, 1968, - /* 1280 */ 1134, 101, 1951, 618, 1953, 1954, 613, 615, 608, 579, - /* 1290 */ 254, 31, 1919, 1384, 614, 2037, 1206, 36, 35, 2036, - /* 1300 */ 2033, 42, 40, 39, 38, 37, 251, 1968, 45, 622, - /* 1310 */ 1, 142, 1489, 4, 1438, 615, 144, 1949, 659, 1950, - /* 1320 */ 1919, 1984, 614, 1638, 101, 1951, 618, 1953, 1954, 613, - /* 1330 */ 376, 608, 126, 381, 330, 571, 142, 1950, 2037, 1337, - /* 1340 */ 1151, 282, 603, 2033, 186, 616, 408, 1401, 1856, 1984, - /* 1350 */ 1968, 443, 101, 1951, 618, 1953, 1954, 613, 612, 608, - /* 1360 */ 412, 287, 1234, 1919, 1238, 614, 2037, 417, 1968, 1245, - /* 1370 */ 324, 2033, 701, 1396, 429, 1848, 615, 436, 442, 444, - /* 1380 */ 1950, 1919, 190, 614, 450, 1243, 451, 453, 1949, 147, - /* 1390 */ 455, 1402, 1984, 518, 456, 310, 1951, 618, 1953, 1954, - /* 1400 */ 613, 611, 608, 599, 2002, 465, 1949, 1404, 528, 468, - /* 1410 */ 1984, 1968, 1403, 160, 1951, 618, 1953, 1954, 613, 615, - /* 1420 */ 608, 196, 224, 469, 1919, 198, 614, 1405, 1937, 470, - /* 1430 */ 201, 473, 471, 1950, 1107, 203, 477, 521, 1896, 1933, - /* 1440 */ 78, 1937, 515, 79, 496, 533, 498, 223, 494, 1949, - /* 1450 */ 207, 495, 1933, 1984, 1950, 102, 101, 1951, 618, 1953, - /* 1460 */ 1954, 613, 228, 608, 1968, 568, 2126, 1929, 1935, 343, - /* 1470 */ 2037, 319, 615, 535, 1740, 2034, 213, 1919, 608, 614, - /* 1480 */ 1929, 1935, 355, 373, 64, 1968, 1736, 63, 215, 149, - /* 1490 */ 1895, 608, 150, 615, 372, 1738, 1734, 151, 1919, 152, - /* 1500 */ 614, 536, 1949, 543, 283, 231, 1984, 550, 1950, 159, - /* 1510 */ 1951, 618, 1953, 1954, 613, 555, 608, 537, 540, 237, - /* 1520 */ 588, 2068, 578, 1949, 2078, 546, 552, 1984, 344, 2105, - /* 1530 */ 304, 1951, 618, 1953, 1954, 613, 546, 608, 240, 1968, - /* 1540 */ 2105, 558, 5, 551, 2111, 173, 564, 615, 548, 2106, - /* 1550 */ 567, 2075, 1919, 131, 614, 2111, 173, 549, 248, 2059, - /* 1560 */ 2106, 567, 1950, 36, 35, 245, 345, 42, 40, 39, - /* 1570 */ 38, 37, 250, 1515, 563, 575, 572, 1949, 130, 1950, - /* 1580 */ 2128, 1984, 249, 2083, 160, 1951, 618, 1953, 1954, 613, - /* 1590 */ 2082, 608, 163, 1968, 247, 1400, 583, 259, 349, 2104, - /* 1600 */ 253, 615, 2053, 348, 284, 1950, 1919, 586, 614, 587, - /* 1610 */ 1968, 1867, 174, 2045, 2046, 359, 129, 2050, 615, 591, - /* 1620 */ 1866, 1865, 350, 1919, 88, 614, 285, 592, 286, 57, - /* 1630 */ 90, 1949, 92, 1950, 1751, 1984, 1968, 2127, 311, 1951, - /* 1640 */ 618, 1953, 1954, 613, 615, 608, 2018, 1795, 1949, 1919, - /* 1650 */ 1721, 614, 1984, 289, 620, 311, 1951, 618, 1953, 1954, - /* 1660 */ 613, 278, 608, 702, 1968, 703, 705, 49, 298, 361, - /* 1670 */ 291, 312, 615, 313, 1949, 302, 1950, 1919, 1984, 614, - /* 1680 */ 293, 295, 1951, 618, 1953, 1954, 613, 1913, 608, 321, - /* 1690 */ 322, 1912, 1950, 71, 1911, 1910, 72, 1907, 378, 379, - /* 1700 */ 1365, 1366, 1949, 179, 383, 1905, 1984, 1968, 385, 311, - /* 1710 */ 1951, 618, 1953, 1954, 613, 615, 608, 386, 387, 154, - /* 1720 */ 1919, 1904, 614, 1968, 389, 1903, 1902, 391, 393, 1901, - /* 1730 */ 1340, 615, 1339, 395, 1878, 534, 1919, 1877, 614, 400, - /* 1740 */ 401, 1876, 1875, 1950, 1841, 1949, 1300, 1840, 1838, 1984, - /* 1750 */ 136, 1837, 296, 1951, 618, 1953, 1954, 613, 1836, 608, - /* 1760 */ 1839, 1949, 1835, 1834, 1832, 1984, 1831, 1830, 297, 1951, - /* 1770 */ 618, 1953, 1954, 613, 1968, 608, 184, 546, 418, 1829, - /* 1780 */ 420, 2105, 615, 1828, 1827, 1826, 1950, 1919, 1825, 614, - /* 1790 */ 1824, 1823, 1822, 1821, 1820, 1819, 2111, 173, 1818, 1817, - /* 1800 */ 1816, 2106, 567, 1950, 1815, 1814, 1813, 138, 1812, 1811, - /* 1810 */ 1810, 1809, 1949, 1808, 1807, 1806, 1984, 1968, 1302, 303, - /* 1820 */ 1951, 618, 1953, 1954, 613, 615, 608, 1805, 1804, 446, - /* 1830 */ 1919, 1666, 614, 191, 1968, 1665, 1181, 1663, 192, 1627, - /* 1840 */ 1093, 168, 615, 1092, 194, 1626, 69, 1919, 1891, 614, - /* 1850 */ 1939, 1885, 195, 1874, 1873, 1949, 1950, 70, 200, 1984, - /* 1860 */ 202, 1858, 307, 1951, 618, 1953, 1954, 613, 461, 608, - /* 1870 */ 463, 1729, 1949, 1950, 1662, 1660, 1984, 478, 479, 299, - /* 1880 */ 1951, 618, 1953, 1954, 613, 480, 608, 1968, 1126, 1658, - /* 1890 */ 482, 483, 1656, 486, 1654, 615, 484, 487, 488, 490, - /* 1900 */ 1919, 492, 614, 1641, 1968, 1640, 1623, 1731, 491, 1249, - /* 1910 */ 1730, 1250, 615, 1172, 1171, 1170, 1169, 1919, 1168, 614, - /* 1920 */ 212, 59, 1163, 1165, 1950, 1949, 674, 1652, 676, 1984, - /* 1930 */ 1164, 1162, 308, 1951, 618, 1953, 1954, 613, 339, 608, - /* 1940 */ 1645, 1950, 1949, 340, 1643, 341, 1984, 517, 520, 300, - /* 1950 */ 1951, 618, 1953, 1954, 613, 1968, 608, 1622, 1621, 522, - /* 1960 */ 524, 1620, 1357, 615, 526, 103, 1355, 1950, 1919, 1354, - /* 1970 */ 614, 530, 1968, 24, 1890, 1884, 1346, 538, 1872, 1870, - /* 1980 */ 615, 17, 14, 2110, 1950, 1919, 53, 614, 1560, 18, - /* 1990 */ 56, 243, 28, 1949, 26, 236, 539, 1984, 1968, 232, - /* 2000 */ 309, 1951, 618, 1953, 1954, 613, 615, 608, 342, 153, - /* 2010 */ 1949, 1919, 238, 614, 1984, 1968, 1544, 301, 1951, 618, - /* 2020 */ 1953, 1954, 613, 615, 608, 161, 544, 1537, 1919, 244, - /* 2030 */ 614, 242, 27, 1940, 84, 1950, 1949, 61, 19, 1575, - /* 2040 */ 1984, 1574, 346, 314, 1951, 618, 1953, 1954, 613, 1580, - /* 2050 */ 608, 1581, 1579, 1949, 1578, 347, 1512, 1984, 256, 1511, - /* 2060 */ 315, 1951, 618, 1953, 1954, 613, 1968, 608, 55, 164, - /* 2070 */ 1871, 1869, 1868, 20, 615, 589, 1857, 263, 1950, 1919, - /* 2080 */ 261, 614, 1542, 15, 54, 268, 86, 87, 89, 273, - /* 2090 */ 93, 270, 10, 21, 1950, 1464, 8, 1463, 1987, 1389, - /* 2100 */ 1442, 607, 165, 177, 1949, 1440, 34, 1474, 1984, 1968, - /* 2110 */ 1439, 1962, 1951, 618, 1953, 1954, 613, 615, 608, 13, - /* 2120 */ 1420, 22, 1919, 1412, 614, 1968, 617, 23, 619, 1235, - /* 2130 */ 621, 362, 623, 615, 1232, 625, 626, 628, 1919, 629, - /* 2140 */ 614, 1229, 1223, 631, 1221, 1950, 632, 1949, 634, 635, - /* 2150 */ 1227, 1984, 1212, 1226, 1961, 1951, 618, 1953, 1954, 613, - /* 2160 */ 641, 608, 94, 1949, 276, 95, 1225, 1984, 1244, 68, - /* 2170 */ 1960, 1951, 618, 1953, 1954, 613, 1968, 608, 1224, 1240, - /* 2180 */ 1124, 651, 1159, 1158, 615, 1157, 1156, 1155, 1950, 1919, - /* 2190 */ 1154, 614, 1179, 1152, 1150, 1149, 1148, 663, 277, 1146, - /* 2200 */ 1145, 1144, 1143, 1142, 1141, 1950, 1140, 1139, 1176, 1174, - /* 2210 */ 1136, 1135, 1132, 1131, 1949, 1130, 1659, 1129, 1984, 1968, - /* 2220 */ 684, 326, 1951, 618, 1953, 1954, 613, 615, 608, 686, - /* 2230 */ 1657, 685, 1919, 688, 614, 689, 1968, 1655, 690, 692, - /* 2240 */ 693, 694, 1653, 696, 615, 697, 698, 1639, 700, 1919, - /* 2250 */ 1082, 614, 1619, 280, 704, 708, 1375, 1949, 1950, 1594, - /* 2260 */ 290, 1984, 707, 1594, 327, 1951, 618, 1953, 1954, 613, - /* 2270 */ 1594, 608, 1594, 1594, 1949, 1950, 1594, 1594, 1984, 1594, - /* 2280 */ 1594, 323, 1951, 618, 1953, 1954, 613, 1594, 608, 1968, - /* 2290 */ 1594, 1594, 1594, 1594, 1594, 1594, 1594, 615, 1594, 1594, - /* 2300 */ 1594, 1594, 1919, 1594, 614, 1594, 1968, 1594, 1594, 1594, - /* 2310 */ 1594, 1594, 1594, 1594, 615, 1594, 1594, 1594, 1594, 1919, - /* 2320 */ 1594, 614, 1594, 1594, 1594, 1594, 1950, 1949, 1594, 1594, - /* 2330 */ 1594, 1984, 1594, 1594, 328, 1951, 618, 1953, 1954, 613, - /* 2340 */ 1594, 608, 1594, 1594, 616, 1594, 1594, 1594, 1984, 1594, - /* 2350 */ 1594, 306, 1951, 618, 1953, 1954, 613, 1968, 608, 1594, - /* 2360 */ 1594, 1594, 1594, 1594, 1594, 615, 1594, 1594, 1594, 1594, - /* 2370 */ 1919, 1594, 614, 1594, 1594, 1594, 1594, 1594, 1594, 1594, - /* 2380 */ 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1594, - /* 2390 */ 1594, 1594, 1594, 1594, 1594, 1949, 1594, 1594, 1594, 1984, - /* 2400 */ 1594, 1594, 305, 1951, 618, 1953, 1954, 613, 1594, 608, + /* 0 */ 458, 1795, 459, 1625, 1838, 1733, 1587, 467, 353, 459, + /* 10 */ 1625, 1632, 43, 41, 1516, 181, 1925, 1793, 1731, 399, + /* 20 */ 360, 62, 1367, 36, 35, 1081, 1960, 42, 40, 39, + /* 30 */ 38, 37, 167, 1446, 559, 1365, 1658, 42, 40, 39, + /* 40 */ 38, 37, 36, 35, 1921, 1927, 42, 40, 39, 38, + /* 50 */ 37, 33, 274, 332, 1842, 607, 464, 577, 1441, 25, + /* 60 */ 699, 545, 460, 16, 1083, 2097, 1086, 1087, 597, 375, + /* 70 */ 1373, 365, 596, 558, 1788, 1790, 597, 1942, 97, 1373, + /* 80 */ 2103, 173, 123, 43, 41, 2098, 566, 1929, 131, 497, + /* 90 */ 52, 360, 132, 1367, 596, 12, 560, 325, 1925, 1742, + /* 100 */ 1734, 512, 511, 510, 1446, 352, 1365, 1742, 1960, 128, + /* 110 */ 506, 545, 58, 155, 505, 2097, 580, 704, 1392, 504, + /* 120 */ 509, 1911, 1744, 613, 405, 503, 1921, 1927, 343, 1441, + /* 130 */ 2103, 173, 1448, 1449, 16, 2098, 566, 607, 1475, 457, + /* 140 */ 158, 1373, 462, 1631, 577, 1696, 1941, 172, 2037, 2038, + /* 150 */ 1976, 129, 2042, 100, 1943, 617, 1945, 1946, 612, 565, + /* 160 */ 607, 1422, 1431, 2097, 318, 170, 12, 2029, 476, 46, + /* 170 */ 466, 354, 2025, 462, 1631, 131, 265, 266, 564, 173, + /* 180 */ 1368, 264, 1366, 2098, 566, 175, 337, 526, 704, 1393, + /* 190 */ 1929, 36, 35, 2055, 1476, 42, 40, 39, 38, 37, + /* 200 */ 524, 1925, 522, 1448, 1449, 1371, 1372, 1513, 1421, 1424, + /* 210 */ 1425, 1426, 1427, 1428, 1429, 1430, 609, 605, 1439, 1440, + /* 220 */ 1442, 1443, 1444, 1445, 1447, 1450, 2, 58, 58, 1921, + /* 230 */ 1927, 355, 1422, 1431, 255, 2037, 576, 2101, 124, 575, + /* 240 */ 607, 80, 2097, 1789, 1790, 596, 47, 338, 1392, 336, + /* 250 */ 335, 1368, 499, 1366, 1542, 127, 501, 564, 173, 1303, + /* 260 */ 1304, 176, 2098, 566, 1737, 32, 358, 1470, 1471, 1472, + /* 270 */ 1473, 1474, 1478, 1479, 1480, 1481, 1371, 1372, 500, 1421, + /* 280 */ 1424, 1425, 1426, 1427, 1428, 1429, 1430, 609, 605, 1439, + /* 290 */ 1440, 1442, 1443, 1444, 1445, 1447, 1450, 2, 1612, 9, + /* 300 */ 43, 41, 552, 1540, 1541, 1543, 1544, 1838, 360, 584, + /* 310 */ 1367, 398, 1393, 397, 1100, 157, 1099, 1601, 183, 351, + /* 320 */ 46, 1446, 1853, 1365, 1207, 639, 638, 637, 1211, 636, + /* 330 */ 1213, 1214, 635, 1216, 632, 1590, 1222, 629, 1224, 1225, + /* 340 */ 626, 623, 1911, 1520, 169, 1101, 1441, 1086, 1087, 1392, + /* 350 */ 2102, 16, 2044, 555, 2097, 597, 113, 1782, 1373, 112, + /* 360 */ 111, 110, 109, 108, 107, 106, 105, 104, 394, 178, + /* 370 */ 2101, 43, 41, 1451, 2098, 2100, 176, 176, 2041, 360, + /* 380 */ 185, 1367, 1589, 12, 1942, 9, 1742, 7, 226, 396, + /* 390 */ 392, 577, 1446, 113, 1365, 176, 112, 111, 110, 109, + /* 400 */ 108, 107, 106, 105, 104, 704, 122, 121, 120, 119, + /* 410 */ 118, 117, 116, 115, 114, 1960, 77, 1441, 363, 76, + /* 420 */ 1448, 1449, 131, 614, 1250, 1251, 155, 1611, 1911, 1373, + /* 430 */ 613, 39, 38, 37, 1391, 1744, 561, 556, 227, 36, + /* 440 */ 35, 1772, 597, 42, 40, 39, 38, 37, 1512, 1422, + /* 450 */ 1431, 1344, 1345, 1941, 44, 167, 403, 1976, 225, 1795, + /* 460 */ 100, 1943, 617, 1945, 1946, 612, 329, 607, 1368, 176, + /* 470 */ 1366, 1911, 2117, 1742, 2029, 1793, 704, 1843, 354, 2025, + /* 480 */ 1167, 174, 2037, 2038, 441, 129, 2042, 233, 1610, 2063, + /* 490 */ 1423, 1448, 1449, 1371, 1372, 568, 1421, 1424, 1425, 1426, + /* 500 */ 1427, 1428, 1429, 1430, 609, 605, 1439, 1440, 1442, 1443, + /* 510 */ 1444, 1445, 1447, 1450, 2, 1169, 651, 597, 82, 320, + /* 520 */ 1422, 1431, 530, 707, 528, 91, 83, 512, 511, 510, + /* 530 */ 565, 123, 1911, 642, 2097, 128, 506, 281, 502, 1368, + /* 540 */ 505, 1366, 189, 188, 9, 504, 509, 1735, 1742, 564, + /* 550 */ 173, 503, 166, 1720, 2098, 566, 11, 10, 697, 693, + /* 560 */ 689, 685, 279, 663, 1371, 1372, 80, 1421, 1424, 1425, + /* 570 */ 1426, 1427, 1428, 1429, 1430, 609, 605, 1439, 1440, 1442, + /* 580 */ 1443, 1444, 1445, 1447, 1450, 2, 43, 41, 2102, 1738, + /* 590 */ 133, 1930, 2097, 2000, 360, 211, 1367, 1392, 98, 1609, + /* 600 */ 1718, 272, 1925, 1582, 649, 1727, 1942, 1446, 2101, 1365, + /* 610 */ 162, 1608, 2098, 2099, 572, 476, 493, 489, 485, 481, + /* 620 */ 208, 2044, 577, 146, 145, 646, 645, 644, 143, 258, + /* 630 */ 1921, 1927, 1441, 1795, 593, 508, 507, 1960, 675, 673, + /* 640 */ 364, 607, 1729, 1911, 1373, 614, 1100, 2040, 1099, 1793, + /* 650 */ 1911, 1489, 613, 131, 155, 1911, 81, 43, 41, 206, + /* 660 */ 1367, 210, 651, 1745, 2102, 360, 58, 1367, 85, 44, + /* 670 */ 1725, 260, 58, 1365, 230, 1941, 583, 1101, 1446, 1976, + /* 680 */ 1365, 1394, 100, 1943, 617, 1945, 1946, 612, 1338, 607, + /* 690 */ 229, 704, 134, 608, 141, 2000, 2029, 1581, 1456, 2044, + /* 700 */ 354, 2025, 569, 1441, 1392, 1394, 1448, 1449, 1373, 1838, + /* 710 */ 597, 579, 171, 2037, 2038, 1373, 129, 2042, 545, 540, + /* 720 */ 187, 1607, 2097, 641, 404, 2039, 205, 199, 1606, 204, + /* 730 */ 597, 1392, 472, 1477, 584, 1422, 1431, 2103, 173, 29, + /* 740 */ 12, 1742, 2098, 566, 413, 36, 35, 1854, 197, 42, + /* 750 */ 40, 39, 38, 37, 1368, 704, 1366, 1575, 1605, 2069, + /* 760 */ 144, 1742, 704, 36, 35, 1911, 1602, 42, 40, 39, + /* 770 */ 38, 37, 1911, 1604, 599, 1395, 2001, 1448, 1449, 1371, + /* 780 */ 1372, 1898, 1421, 1424, 1425, 1426, 1427, 1428, 1429, 1430, + /* 790 */ 609, 605, 1439, 1440, 1442, 1443, 1444, 1445, 1447, 1450, + /* 800 */ 2, 317, 1911, 1390, 30, 1603, 1422, 1431, 597, 597, + /* 810 */ 435, 366, 51, 448, 1482, 176, 447, 1911, 1368, 155, + /* 820 */ 1366, 176, 427, 428, 257, 1368, 1655, 1366, 1744, 382, + /* 830 */ 1600, 419, 1599, 449, 1598, 573, 421, 1597, 1596, 1742, + /* 840 */ 1742, 2049, 1509, 1371, 1372, 1423, 1595, 1395, 257, 1911, + /* 850 */ 1371, 1372, 553, 1421, 1424, 1425, 1426, 1427, 1428, 1429, + /* 860 */ 1430, 609, 605, 1439, 1440, 1442, 1443, 1444, 1445, 1447, + /* 870 */ 1450, 2, 1423, 601, 1911, 2001, 1911, 333, 1911, 36, + /* 880 */ 35, 1911, 1911, 42, 40, 39, 38, 37, 1719, 409, + /* 890 */ 1911, 681, 680, 679, 678, 370, 1697, 677, 676, 135, + /* 900 */ 671, 670, 669, 668, 667, 666, 665, 148, 661, 660, + /* 910 */ 659, 369, 368, 656, 655, 654, 653, 652, 235, 445, + /* 920 */ 1594, 570, 440, 439, 438, 437, 434, 433, 432, 431, + /* 930 */ 430, 426, 425, 424, 423, 334, 416, 415, 414, 517, + /* 940 */ 411, 410, 331, 156, 643, 36, 35, 1786, 294, 42, + /* 950 */ 40, 39, 38, 37, 527, 1717, 597, 1593, 1942, 6, + /* 960 */ 597, 252, 292, 66, 1911, 31, 65, 1552, 224, 209, + /* 970 */ 474, 36, 35, 1395, 475, 42, 40, 39, 38, 37, + /* 980 */ 597, 1592, 597, 520, 193, 454, 452, 1742, 514, 1960, + /* 990 */ 182, 1742, 597, 223, 1739, 649, 139, 580, 664, 501, + /* 1000 */ 1712, 1911, 1911, 373, 613, 246, 541, 647, 1795, 1825, + /* 1010 */ 1786, 1742, 597, 1742, 146, 145, 646, 645, 644, 143, + /* 1020 */ 58, 500, 67, 1742, 1794, 1911, 581, 1941, 48, 64, + /* 1030 */ 3, 1976, 63, 1532, 100, 1943, 617, 1945, 1946, 612, + /* 1040 */ 137, 607, 125, 1742, 648, 545, 170, 1786, 2029, 2097, + /* 1050 */ 36, 35, 354, 2025, 42, 40, 39, 38, 37, 99, + /* 1060 */ 406, 1942, 649, 597, 2103, 173, 357, 356, 288, 2098, + /* 1070 */ 566, 1772, 75, 407, 2056, 216, 1381, 269, 214, 597, + /* 1080 */ 1376, 146, 145, 646, 645, 644, 143, 1446, 218, 1374, + /* 1090 */ 1375, 217, 1960, 592, 1742, 1645, 1638, 74, 73, 402, + /* 1100 */ 614, 597, 180, 220, 1942, 1911, 219, 613, 1961, 60, + /* 1110 */ 1742, 222, 1441, 239, 221, 594, 234, 513, 515, 1932, + /* 1120 */ 316, 604, 597, 390, 1373, 388, 384, 380, 377, 374, + /* 1130 */ 1941, 371, 1742, 597, 1976, 1960, 595, 100, 1943, 617, + /* 1140 */ 1945, 1946, 612, 614, 607, 597, 1636, 275, 1911, 2117, + /* 1150 */ 613, 2029, 45, 1742, 372, 354, 2025, 1584, 1585, 367, + /* 1160 */ 422, 1539, 1942, 1509, 1742, 241, 2091, 1934, 518, 176, + /* 1170 */ 50, 603, 262, 1941, 140, 544, 1742, 1976, 142, 1626, + /* 1180 */ 100, 1943, 617, 1945, 1946, 612, 1847, 607, 657, 11, + /* 1190 */ 10, 658, 2117, 1960, 2029, 144, 545, 60, 354, 2025, + /* 1200 */ 2097, 614, 2059, 45, 1314, 154, 1911, 96, 613, 2048, + /* 1210 */ 1148, 1783, 45, 1146, 621, 2103, 173, 93, 142, 533, + /* 1220 */ 2098, 566, 578, 1942, 267, 254, 589, 1379, 4, 251, + /* 1230 */ 271, 1941, 376, 1129, 1382, 1976, 1377, 1378, 100, 1943, + /* 1240 */ 617, 1945, 1946, 612, 381, 607, 144, 1200, 1, 1483, + /* 1250 */ 2004, 1942, 2029, 126, 1960, 1432, 354, 2025, 330, 1385, + /* 1260 */ 1387, 545, 614, 1467, 287, 2097, 1228, 1911, 1130, 613, + /* 1270 */ 1232, 605, 1439, 1440, 1442, 1443, 1444, 1445, 1331, 186, + /* 1280 */ 2103, 173, 1960, 142, 282, 2098, 566, 408, 1395, 1848, + /* 1290 */ 614, 412, 1941, 443, 1390, 1911, 1976, 613, 1239, 100, + /* 1300 */ 1943, 617, 1945, 1946, 612, 1237, 607, 417, 429, 450, + /* 1310 */ 1840, 2002, 1942, 2029, 436, 442, 444, 354, 2025, 451, + /* 1320 */ 1941, 190, 1396, 453, 1976, 455, 456, 100, 1943, 617, + /* 1330 */ 1945, 1946, 612, 465, 607, 147, 1398, 468, 469, 600, + /* 1340 */ 196, 2029, 198, 1960, 1397, 354, 2025, 470, 1399, 201, + /* 1350 */ 471, 614, 473, 203, 78, 79, 1911, 477, 613, 207, + /* 1360 */ 1103, 496, 494, 495, 498, 1942, 103, 1732, 535, 1888, + /* 1370 */ 319, 1887, 534, 213, 532, 1728, 283, 215, 149, 150, + /* 1380 */ 542, 1941, 2075, 228, 1730, 1976, 1726, 151, 101, 1943, + /* 1390 */ 617, 1945, 1946, 612, 231, 607, 1960, 152, 2074, 554, + /* 1400 */ 587, 5, 2029, 539, 614, 2051, 2028, 2025, 549, 1911, + /* 1410 */ 245, 613, 563, 548, 2060, 2070, 550, 551, 1942, 536, + /* 1420 */ 344, 557, 345, 547, 2120, 574, 237, 571, 163, 247, + /* 1430 */ 248, 240, 253, 250, 1941, 1509, 1394, 130, 1976, 249, + /* 1440 */ 582, 101, 1943, 617, 1945, 1946, 612, 2096, 607, 1960, + /* 1450 */ 2045, 348, 259, 284, 585, 2029, 586, 614, 1859, 602, + /* 1460 */ 2025, 1942, 1911, 1858, 613, 285, 1857, 350, 590, 88, + /* 1470 */ 591, 286, 90, 1743, 57, 92, 619, 2010, 289, 1787, + /* 1480 */ 700, 278, 321, 1713, 313, 701, 322, 615, 298, 703, + /* 1490 */ 49, 1976, 1960, 1905, 101, 1943, 617, 1945, 1946, 612, + /* 1500 */ 611, 607, 312, 1904, 291, 1911, 71, 613, 2029, 293, + /* 1510 */ 302, 1903, 324, 2025, 1902, 72, 1899, 378, 1942, 379, + /* 1520 */ 1359, 1360, 179, 1897, 383, 385, 386, 1896, 387, 389, + /* 1530 */ 1941, 1895, 1894, 391, 1976, 1942, 1893, 310, 1943, 617, + /* 1540 */ 1945, 1946, 612, 610, 607, 598, 1994, 393, 1334, 1960, + /* 1550 */ 395, 1333, 1870, 1869, 400, 1868, 401, 614, 1867, 1294, + /* 1560 */ 1833, 1942, 1911, 1832, 613, 1830, 1960, 191, 136, 1829, + /* 1570 */ 1828, 1831, 1827, 1826, 614, 1824, 1823, 1822, 184, 1911, + /* 1580 */ 418, 613, 1821, 420, 1820, 1819, 1818, 1941, 138, 1805, + /* 1590 */ 1804, 1976, 1960, 1817, 159, 1943, 617, 1945, 1946, 612, + /* 1600 */ 614, 607, 1816, 1815, 1941, 1911, 1814, 613, 1976, 1813, + /* 1610 */ 1812, 160, 1943, 617, 1945, 1946, 612, 1811, 607, 1810, + /* 1620 */ 1809, 1942, 1808, 1807, 1806, 1803, 1802, 1801, 1800, 1296, + /* 1630 */ 1941, 446, 1797, 1796, 1976, 546, 2066, 101, 1943, 617, + /* 1640 */ 1945, 1946, 612, 1942, 607, 1799, 1798, 1175, 1660, 1659, + /* 1650 */ 192, 2029, 1960, 1657, 1621, 194, 2026, 69, 168, 1620, + /* 1660 */ 614, 1089, 1931, 567, 2118, 1911, 1883, 613, 461, 1088, + /* 1670 */ 195, 1877, 1866, 70, 1960, 200, 463, 202, 1865, 1850, + /* 1680 */ 1721, 1656, 614, 1654, 1652, 478, 479, 1911, 483, 613, + /* 1690 */ 1941, 1650, 482, 486, 1976, 480, 1648, 159, 1943, 617, + /* 1700 */ 1945, 1946, 612, 1122, 607, 1635, 484, 1942, 487, 488, + /* 1710 */ 490, 491, 1941, 492, 1634, 1617, 1976, 1723, 212, 304, + /* 1720 */ 1943, 617, 1945, 1946, 612, 1244, 607, 1722, 1942, 1243, + /* 1730 */ 672, 674, 1166, 1165, 1164, 1163, 1160, 1159, 1960, 2067, + /* 1740 */ 1158, 59, 1646, 1157, 339, 1639, 614, 340, 1637, 1616, + /* 1750 */ 341, 1911, 1615, 613, 516, 519, 521, 1614, 523, 1960, + /* 1760 */ 525, 102, 1882, 562, 349, 1349, 1348, 614, 53, 1351, + /* 1770 */ 529, 1942, 1911, 1876, 613, 1340, 1941, 24, 153, 1864, + /* 1780 */ 1976, 537, 1862, 160, 1943, 617, 1945, 1946, 612, 2102, + /* 1790 */ 607, 17, 14, 244, 56, 243, 18, 1941, 538, 1554, + /* 1800 */ 1932, 1976, 1960, 61, 311, 1943, 617, 1945, 1946, 612, + /* 1810 */ 611, 607, 543, 28, 26, 1911, 232, 613, 19, 236, + /* 1820 */ 1569, 161, 1942, 1568, 342, 238, 346, 15, 1538, 242, + /* 1830 */ 27, 1573, 1531, 1574, 84, 1863, 2119, 1572, 1942, 1575, + /* 1840 */ 1941, 347, 256, 54, 1976, 55, 164, 310, 1943, 617, + /* 1850 */ 1945, 1946, 612, 1960, 607, 1861, 1995, 1506, 359, 1505, + /* 1860 */ 1860, 614, 20, 1849, 261, 263, 1911, 1536, 613, 1960, + /* 1870 */ 268, 86, 588, 87, 361, 270, 89, 614, 273, 10, + /* 1880 */ 21, 1468, 1911, 93, 613, 1979, 1383, 165, 1436, 1458, + /* 1890 */ 1434, 1941, 1942, 8, 177, 1976, 1457, 1414, 311, 1943, + /* 1900 */ 617, 1945, 1946, 612, 606, 607, 34, 1941, 1433, 13, + /* 1910 */ 22, 1976, 1406, 1942, 311, 1943, 617, 1945, 1946, 612, + /* 1920 */ 23, 607, 1229, 1960, 618, 620, 362, 622, 624, 1226, + /* 1930 */ 627, 614, 625, 630, 1223, 1217, 1911, 628, 613, 631, + /* 1940 */ 616, 1215, 633, 634, 1960, 1206, 1221, 1220, 1219, 1218, + /* 1950 */ 640, 94, 614, 276, 1238, 1234, 1942, 1911, 1120, 613, + /* 1960 */ 95, 531, 68, 650, 1154, 1976, 1153, 1152, 306, 1943, + /* 1970 */ 617, 1945, 1946, 612, 1151, 607, 1150, 1942, 1149, 1147, + /* 1980 */ 1173, 1145, 1941, 1144, 1143, 1141, 1976, 1960, 662, 295, + /* 1990 */ 1943, 617, 1945, 1946, 612, 614, 607, 277, 1140, 1139, + /* 2000 */ 1911, 1138, 613, 1137, 1136, 1135, 1170, 1168, 1960, 1132, + /* 2010 */ 1131, 1128, 1127, 1126, 1653, 1125, 614, 682, 1651, 683, + /* 2020 */ 1942, 1911, 684, 613, 686, 1941, 687, 1649, 690, 1976, + /* 2030 */ 1647, 688, 296, 1943, 617, 1945, 1946, 612, 1942, 607, + /* 2040 */ 692, 694, 691, 695, 696, 1633, 1941, 698, 1078, 1613, + /* 2050 */ 1976, 1960, 702, 297, 1943, 617, 1945, 1946, 612, 614, + /* 2060 */ 607, 280, 1369, 290, 1911, 705, 613, 1588, 706, 1960, + /* 2070 */ 1588, 1588, 1588, 1588, 1588, 1588, 1588, 614, 1588, 1588, + /* 2080 */ 1588, 1588, 1911, 1588, 613, 1588, 1588, 1588, 1588, 1941, + /* 2090 */ 1588, 1588, 1588, 1976, 1588, 1588, 303, 1943, 617, 1945, + /* 2100 */ 1946, 612, 1942, 607, 1588, 1588, 1588, 1941, 1588, 1588, + /* 2110 */ 1588, 1976, 1588, 1588, 307, 1943, 617, 1945, 1946, 612, + /* 2120 */ 1588, 607, 1588, 1942, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2130 */ 1588, 1588, 1588, 1960, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2140 */ 1588, 614, 1588, 1588, 1588, 1588, 1911, 1588, 613, 1588, + /* 2150 */ 1588, 1588, 1588, 1588, 1960, 1588, 1588, 1588, 1588, 1588, + /* 2160 */ 1588, 1588, 614, 1588, 1588, 1588, 1942, 1911, 1588, 613, + /* 2170 */ 1588, 1941, 1588, 1588, 1588, 1976, 1588, 1588, 299, 1943, + /* 2180 */ 617, 1945, 1946, 612, 1942, 607, 1588, 1588, 1588, 1588, + /* 2190 */ 1588, 1588, 1941, 1588, 1588, 1588, 1976, 1960, 1588, 308, + /* 2200 */ 1943, 617, 1945, 1946, 612, 614, 607, 1588, 1588, 1588, + /* 2210 */ 1911, 1588, 613, 1588, 1588, 1960, 1588, 1588, 1588, 1588, + /* 2220 */ 1588, 1588, 1588, 614, 1588, 1588, 1588, 1942, 1911, 1588, + /* 2230 */ 613, 1588, 1588, 1588, 1588, 1941, 1588, 1588, 1588, 1976, + /* 2240 */ 1588, 1588, 300, 1943, 617, 1945, 1946, 612, 1588, 607, + /* 2250 */ 1588, 1588, 1588, 1941, 1588, 1588, 1588, 1976, 1960, 1588, + /* 2260 */ 309, 1943, 617, 1945, 1946, 612, 614, 607, 1588, 1588, + /* 2270 */ 1942, 1911, 1588, 613, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2280 */ 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1942, 1588, 1588, + /* 2290 */ 1588, 1588, 1588, 1588, 1588, 1588, 1941, 1588, 1588, 1588, + /* 2300 */ 1976, 1960, 1588, 301, 1943, 617, 1945, 1946, 612, 614, + /* 2310 */ 607, 1588, 1588, 1942, 1911, 1588, 613, 1588, 1960, 1588, + /* 2320 */ 1588, 1588, 1588, 1588, 1588, 1588, 614, 1588, 1588, 1588, + /* 2330 */ 1588, 1911, 1588, 613, 1588, 1588, 1588, 1588, 1588, 1941, + /* 2340 */ 1588, 1588, 1588, 1976, 1960, 1588, 314, 1943, 617, 1945, + /* 2350 */ 1946, 612, 614, 607, 1588, 1588, 1941, 1911, 1588, 613, + /* 2360 */ 1976, 1588, 1588, 315, 1943, 617, 1945, 1946, 612, 1588, + /* 2370 */ 607, 1588, 1942, 1588, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2380 */ 1588, 1588, 1941, 1588, 1588, 1588, 1976, 1588, 1588, 1954, + /* 2390 */ 1943, 617, 1945, 1946, 612, 1588, 607, 1588, 1588, 1588, + /* 2400 */ 1588, 1588, 1588, 1960, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2410 */ 1588, 614, 1588, 1588, 1588, 1942, 1911, 1588, 613, 1588, + /* 2420 */ 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2430 */ 1588, 1588, 1588, 1942, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2440 */ 1588, 1941, 1588, 1588, 1588, 1976, 1960, 1588, 1953, 1943, + /* 2450 */ 617, 1945, 1946, 612, 614, 607, 1588, 1588, 1588, 1911, + /* 2460 */ 1588, 613, 1588, 1588, 1960, 1588, 1588, 1588, 1588, 1588, + /* 2470 */ 1588, 1588, 614, 1588, 1588, 1588, 1588, 1911, 1588, 613, + /* 2480 */ 1588, 1588, 1588, 1588, 1941, 1588, 1588, 1588, 1976, 1588, + /* 2490 */ 1588, 1952, 1943, 617, 1945, 1946, 612, 1942, 607, 1588, + /* 2500 */ 1588, 1588, 1941, 1588, 1588, 1588, 1976, 1588, 1588, 326, + /* 2510 */ 1943, 617, 1945, 1946, 612, 1588, 607, 1588, 1942, 1588, + /* 2520 */ 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1960, 1588, + /* 2530 */ 1588, 1588, 1588, 1588, 1588, 1588, 614, 1588, 1588, 1588, + /* 2540 */ 1588, 1911, 1588, 613, 1588, 1588, 1588, 1588, 1588, 1960, + /* 2550 */ 1588, 1588, 1588, 1588, 1588, 1588, 1588, 614, 1588, 1588, + /* 2560 */ 1588, 1942, 1911, 1588, 613, 1588, 1941, 1588, 1588, 1588, + /* 2570 */ 1976, 1588, 1588, 327, 1943, 617, 1945, 1946, 612, 1942, + /* 2580 */ 607, 1588, 1588, 1588, 1588, 1588, 1588, 1941, 1588, 1588, + /* 2590 */ 1588, 1976, 1960, 1588, 323, 1943, 617, 1945, 1946, 612, + /* 2600 */ 614, 607, 1588, 1588, 1588, 1911, 1588, 613, 1588, 1588, + /* 2610 */ 1960, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 614, 1588, + /* 2620 */ 1588, 1588, 1942, 1911, 1588, 613, 1588, 1588, 1588, 1588, + /* 2630 */ 1941, 1588, 1588, 1588, 1976, 1588, 1588, 328, 1943, 617, + /* 2640 */ 1945, 1946, 612, 1588, 607, 1588, 1588, 1588, 615, 1588, + /* 2650 */ 1588, 1588, 1976, 1960, 1588, 306, 1943, 617, 1945, 1946, + /* 2660 */ 612, 614, 607, 1588, 1588, 1588, 1911, 1588, 613, 1588, + /* 2670 */ 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2680 */ 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, 1588, + /* 2690 */ 1588, 1941, 1588, 1588, 1588, 1976, 1588, 1588, 305, 1943, + /* 2700 */ 617, 1945, 1946, 612, 1588, 607, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 325, 329, 340, 331, 332, 427, 356, 345, 329, 431, - /* 10 */ 331, 332, 12, 13, 14, 367, 0, 427, 370, 371, - /* 20 */ 20, 431, 22, 0, 446, 447, 333, 377, 378, 451, - /* 30 */ 452, 356, 358, 33, 333, 35, 0, 447, 22, 364, - /* 40 */ 347, 451, 452, 369, 369, 385, 371, 24, 25, 26, - /* 50 */ 27, 28, 29, 30, 31, 32, 14, 364, 58, 20, - /* 60 */ 8, 9, 20, 63, 12, 13, 14, 15, 16, 394, - /* 70 */ 70, 397, 398, 398, 373, 20, 401, 402, 403, 404, - /* 80 */ 405, 406, 408, 408, 58, 20, 14, 427, 413, 358, - /* 90 */ 415, 431, 20, 62, 419, 420, 96, 400, 14, 325, - /* 100 */ 369, 65, 66, 67, 20, 356, 446, 447, 433, 73, - /* 110 */ 74, 451, 452, 364, 78, 79, 441, 324, 118, 326, - /* 120 */ 84, 85, 96, 426, 98, 20, 90, 333, 397, 398, - /* 130 */ 356, 20, 4, 133, 134, 20, 322, 22, 364, 408, - /* 140 */ 427, 347, 364, 369, 431, 371, 12, 13, 354, 97, - /* 150 */ 35, 96, 403, 375, 20, 0, 22, 20, 364, 325, - /* 160 */ 447, 96, 162, 163, 451, 452, 51, 33, 394, 35, - /* 170 */ 333, 43, 398, 45, 46, 401, 402, 403, 404, 405, - /* 180 */ 406, 181, 408, 183, 347, 411, 4, 413, 414, 415, - /* 190 */ 356, 354, 58, 419, 420, 416, 417, 63, 364, 385, - /* 200 */ 20, 364, 62, 369, 70, 371, 206, 207, 20, 209, + /* 0 */ 329, 356, 331, 332, 364, 358, 322, 329, 363, 331, + /* 10 */ 332, 0, 12, 13, 14, 375, 369, 372, 357, 385, + /* 20 */ 20, 4, 22, 8, 9, 4, 356, 12, 13, 14, + /* 30 */ 15, 16, 356, 33, 364, 35, 0, 12, 13, 14, + /* 40 */ 15, 16, 8, 9, 397, 398, 12, 13, 14, 15, + /* 50 */ 16, 416, 417, 377, 378, 408, 14, 333, 58, 44, + /* 60 */ 49, 427, 20, 63, 43, 431, 45, 46, 333, 385, + /* 70 */ 70, 367, 20, 403, 370, 371, 333, 325, 337, 70, + /* 80 */ 446, 447, 347, 12, 13, 451, 452, 358, 364, 354, + /* 90 */ 347, 20, 351, 22, 20, 95, 20, 63, 369, 364, + /* 100 */ 359, 65, 66, 67, 33, 348, 35, 364, 356, 73, + /* 110 */ 74, 427, 95, 356, 78, 431, 364, 117, 20, 83, + /* 120 */ 84, 369, 365, 371, 333, 89, 397, 398, 399, 58, + /* 130 */ 446, 447, 132, 133, 63, 451, 452, 408, 104, 330, + /* 140 */ 340, 70, 333, 334, 333, 345, 394, 423, 424, 425, + /* 150 */ 398, 427, 428, 401, 402, 403, 404, 405, 406, 427, + /* 160 */ 408, 161, 162, 431, 373, 413, 95, 415, 62, 95, + /* 170 */ 330, 419, 420, 333, 334, 364, 126, 127, 446, 447, + /* 180 */ 180, 131, 182, 451, 452, 433, 37, 21, 117, 20, + /* 190 */ 358, 8, 9, 441, 160, 12, 13, 14, 15, 16, + /* 200 */ 34, 369, 36, 132, 133, 205, 206, 4, 208, 209, /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 394, 337, - /* 230 */ 96, 3, 398, 325, 162, 401, 402, 403, 404, 405, - /* 240 */ 406, 427, 408, 351, 20, 431, 162, 413, 20, 415, - /* 250 */ 167, 359, 118, 419, 420, 12, 13, 14, 15, 16, - /* 260 */ 446, 447, 229, 108, 356, 451, 452, 133, 134, 370, - /* 270 */ 371, 245, 364, 162, 163, 441, 96, 369, 96, 371, - /* 280 */ 12, 13, 127, 128, 129, 130, 131, 132, 20, 20, - /* 290 */ 22, 96, 20, 325, 342, 343, 162, 163, 325, 333, - /* 300 */ 245, 33, 394, 35, 330, 333, 398, 333, 334, 401, - /* 310 */ 402, 403, 404, 405, 406, 181, 408, 183, 128, 347, - /* 320 */ 107, 413, 355, 415, 356, 97, 58, 419, 420, 161, - /* 330 */ 364, 63, 364, 250, 251, 368, 364, 369, 70, 371, - /* 340 */ 206, 207, 369, 209, 210, 211, 212, 213, 214, 215, - /* 350 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - /* 360 */ 226, 227, 394, 229, 96, 325, 398, 342, 343, 401, - /* 370 */ 402, 403, 404, 405, 406, 180, 408, 182, 188, 189, - /* 380 */ 96, 413, 192, 415, 194, 339, 118, 419, 420, 423, - /* 390 */ 424, 425, 164, 427, 428, 80, 356, 431, 430, 353, - /* 400 */ 232, 133, 134, 389, 364, 133, 134, 22, 362, 369, - /* 410 */ 242, 371, 446, 447, 12, 13, 14, 451, 452, 371, - /* 420 */ 35, 70, 20, 0, 22, 245, 96, 245, 364, 381, - /* 430 */ 162, 163, 384, 164, 394, 33, 58, 35, 398, 375, - /* 440 */ 245, 401, 402, 403, 404, 405, 406, 108, 408, 181, - /* 450 */ 410, 183, 330, 138, 139, 333, 334, 8, 9, 70, - /* 460 */ 58, 12, 13, 14, 15, 16, 127, 128, 129, 130, - /* 470 */ 131, 132, 70, 95, 206, 207, 98, 209, 210, 211, - /* 480 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - /* 490 */ 222, 223, 224, 225, 226, 227, 333, 325, 96, 333, - /* 500 */ 357, 325, 356, 65, 66, 67, 20, 333, 356, 363, - /* 510 */ 347, 73, 74, 347, 357, 363, 78, 79, 372, 325, - /* 520 */ 118, 347, 84, 85, 372, 348, 348, 364, 90, 245, - /* 530 */ 364, 108, 356, 356, 356, 133, 134, 20, 364, 22, - /* 540 */ 364, 369, 365, 365, 21, 369, 97, 371, 12, 13, - /* 550 */ 127, 128, 129, 130, 131, 132, 20, 34, 22, 36, - /* 560 */ 357, 325, 333, 369, 162, 163, 176, 35, 51, 33, - /* 570 */ 394, 35, 333, 333, 398, 245, 347, 401, 402, 403, - /* 580 */ 404, 405, 406, 181, 408, 183, 347, 197, 198, 413, - /* 590 */ 357, 415, 356, 364, 58, 419, 420, 127, 357, 229, - /* 600 */ 364, 231, 70, 364, 364, 369, 70, 371, 206, 207, - /* 610 */ 339, 209, 210, 211, 212, 213, 214, 215, 216, 217, - /* 620 */ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - /* 630 */ 394, 356, 96, 362, 398, 348, 63, 401, 402, 403, - /* 640 */ 404, 405, 406, 356, 408, 127, 128, 325, 162, 413, - /* 650 */ 132, 415, 365, 378, 118, 419, 420, 325, 325, 0, - /* 660 */ 190, 191, 422, 423, 424, 425, 430, 427, 428, 133, - /* 670 */ 134, 8, 9, 39, 2, 12, 13, 14, 15, 16, - /* 680 */ 8, 9, 12, 13, 12, 13, 14, 15, 16, 356, - /* 690 */ 20, 369, 22, 337, 333, 333, 379, 364, 162, 163, - /* 700 */ 325, 369, 369, 33, 371, 35, 356, 44, 347, 347, - /* 710 */ 14, 15, 16, 363, 412, 359, 414, 181, 412, 183, - /* 720 */ 414, 62, 372, 357, 356, 364, 364, 394, 58, 349, - /* 730 */ 325, 398, 352, 365, 401, 402, 403, 404, 405, 406, - /* 740 */ 70, 408, 206, 207, 369, 209, 210, 211, 212, 213, - /* 750 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - /* 760 */ 224, 225, 226, 227, 8, 9, 96, 325, 12, 13, - /* 770 */ 14, 15, 16, 364, 369, 442, 443, 427, 206, 206, - /* 780 */ 18, 431, 20, 400, 375, 333, 357, 325, 118, 27, - /* 790 */ 325, 325, 30, 0, 325, 33, 446, 447, 356, 347, - /* 800 */ 0, 451, 452, 133, 134, 325, 364, 326, 325, 426, - /* 810 */ 48, 369, 50, 371, 21, 53, 364, 24, 25, 26, - /* 820 */ 27, 28, 29, 30, 31, 32, 254, 255, 256, 257, - /* 830 */ 258, 369, 162, 163, 369, 369, 394, 344, 369, 346, - /* 840 */ 398, 333, 333, 401, 402, 403, 404, 405, 406, 369, - /* 850 */ 408, 181, 369, 183, 325, 347, 347, 95, 0, 8, - /* 860 */ 9, 4, 62, 12, 13, 14, 15, 16, 3, 107, - /* 870 */ 20, 20, 364, 364, 400, 325, 206, 207, 244, 209, - /* 880 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 890 */ 220, 221, 222, 223, 224, 225, 226, 227, 369, 137, - /* 900 */ 426, 345, 140, 141, 142, 143, 144, 145, 146, 147, - /* 910 */ 148, 149, 150, 151, 152, 153, 154, 155, 156, 369, - /* 920 */ 158, 159, 160, 65, 66, 67, 68, 69, 44, 71, - /* 930 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - /* 940 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - /* 950 */ 92, 18, 325, 325, 333, 325, 23, 8, 9, 12, - /* 960 */ 13, 12, 13, 14, 15, 16, 325, 325, 347, 22, - /* 970 */ 37, 38, 333, 411, 41, 366, 414, 455, 369, 20, - /* 980 */ 33, 97, 35, 8, 9, 364, 347, 12, 13, 14, - /* 990 */ 15, 16, 59, 60, 61, 371, 369, 369, 356, 369, - /* 1000 */ 1, 2, 37, 364, 366, 58, 364, 369, 384, 444, - /* 1010 */ 369, 369, 63, 371, 164, 164, 44, 70, 109, 110, - /* 1020 */ 111, 112, 113, 114, 115, 116, 117, 118, 119, 96, - /* 1030 */ 121, 122, 123, 124, 125, 126, 394, 335, 349, 333, - /* 1040 */ 398, 352, 356, 401, 402, 403, 404, 405, 406, 366, - /* 1050 */ 408, 385, 369, 347, 105, 413, 100, 415, 372, 103, - /* 1060 */ 33, 419, 420, 19, 99, 118, 101, 102, 135, 104, - /* 1070 */ 364, 438, 430, 108, 333, 48, 0, 33, 22, 45, - /* 1080 */ 46, 54, 55, 56, 57, 58, 243, 244, 347, 0, - /* 1090 */ 333, 35, 48, 427, 108, 130, 97, 431, 54, 55, - /* 1100 */ 56, 57, 58, 246, 347, 364, 173, 174, 175, 333, - /* 1110 */ 161, 178, 446, 447, 107, 44, 130, 451, 452, 333, - /* 1120 */ 35, 364, 95, 164, 48, 98, 70, 262, 181, 196, - /* 1130 */ 183, 356, 199, 347, 201, 202, 203, 204, 205, 95, - /* 1140 */ 364, 42, 98, 44, 42, 35, 44, 335, 173, 44, - /* 1150 */ 364, 379, 21, 206, 207, 24, 25, 26, 27, 28, - /* 1160 */ 29, 30, 31, 32, 157, 218, 219, 220, 221, 222, - /* 1170 */ 223, 224, 44, 100, 118, 131, 103, 325, 245, 44, - /* 1180 */ 333, 232, 233, 234, 235, 236, 237, 238, 239, 240, - /* 1190 */ 241, 242, 165, 166, 347, 168, 0, 0, 171, 423, - /* 1200 */ 424, 425, 97, 427, 428, 325, 100, 100, 356, 103, - /* 1210 */ 103, 364, 168, 44, 187, 164, 364, 44, 22, 22, - /* 1220 */ 169, 369, 44, 371, 58, 97, 133, 134, 47, 185, - /* 1230 */ 96, 187, 97, 1, 2, 332, 356, 181, 266, 183, - /* 1240 */ 106, 152, 267, 44, 364, 35, 394, 13, 325, 369, - /* 1250 */ 398, 371, 379, 401, 402, 403, 404, 405, 406, 44, - /* 1260 */ 408, 44, 206, 207, 98, 413, 97, 415, 183, 35, - /* 1270 */ 97, 419, 420, 368, 394, 97, 325, 96, 398, 356, - /* 1280 */ 70, 401, 402, 403, 404, 405, 406, 364, 408, 429, - /* 1290 */ 448, 2, 369, 183, 371, 415, 97, 8, 9, 419, - /* 1300 */ 420, 12, 13, 14, 15, 16, 421, 356, 44, 44, - /* 1310 */ 432, 44, 97, 247, 97, 364, 44, 394, 13, 325, - /* 1320 */ 369, 398, 371, 0, 401, 402, 403, 404, 405, 406, - /* 1330 */ 396, 408, 44, 48, 395, 264, 44, 325, 415, 179, - /* 1340 */ 35, 387, 419, 420, 42, 394, 376, 20, 379, 398, - /* 1350 */ 356, 161, 401, 402, 403, 404, 405, 406, 364, 408, - /* 1360 */ 376, 97, 97, 369, 97, 371, 415, 374, 356, 97, - /* 1370 */ 419, 420, 49, 20, 333, 333, 364, 376, 374, 374, - /* 1380 */ 325, 369, 333, 371, 94, 97, 341, 333, 394, 97, - /* 1390 */ 333, 20, 398, 4, 327, 401, 402, 403, 404, 405, - /* 1400 */ 406, 407, 408, 409, 410, 327, 394, 20, 19, 391, - /* 1410 */ 398, 356, 20, 401, 402, 403, 404, 405, 406, 364, - /* 1420 */ 408, 339, 33, 371, 369, 339, 371, 20, 358, 334, - /* 1430 */ 339, 334, 386, 325, 52, 339, 333, 48, 369, 369, - /* 1440 */ 339, 358, 53, 339, 327, 195, 356, 58, 336, 394, - /* 1450 */ 339, 336, 369, 398, 325, 333, 401, 402, 403, 404, - /* 1460 */ 405, 406, 337, 408, 356, 453, 454, 397, 398, 399, - /* 1470 */ 415, 327, 364, 393, 356, 420, 356, 369, 408, 371, - /* 1480 */ 397, 398, 399, 385, 95, 356, 356, 98, 356, 356, - /* 1490 */ 369, 408, 356, 364, 385, 356, 356, 356, 369, 356, - /* 1500 */ 371, 186, 394, 333, 391, 337, 398, 369, 325, 401, - /* 1510 */ 402, 403, 404, 405, 406, 253, 408, 390, 371, 382, - /* 1520 */ 252, 379, 333, 394, 379, 427, 369, 398, 369, 431, - /* 1530 */ 401, 402, 403, 404, 405, 406, 427, 408, 382, 356, - /* 1540 */ 431, 369, 259, 261, 446, 447, 172, 364, 248, 451, - /* 1550 */ 452, 443, 369, 364, 371, 446, 447, 260, 435, 440, - /* 1560 */ 451, 452, 325, 8, 9, 439, 268, 12, 13, 14, - /* 1570 */ 15, 16, 396, 244, 445, 265, 263, 394, 364, 325, - /* 1580 */ 456, 398, 434, 437, 401, 402, 403, 404, 405, 406, - /* 1590 */ 437, 408, 437, 356, 436, 20, 333, 337, 361, 450, - /* 1600 */ 449, 364, 400, 334, 382, 325, 369, 369, 371, 369, - /* 1610 */ 356, 369, 423, 424, 425, 361, 427, 428, 364, 166, - /* 1620 */ 369, 369, 369, 369, 337, 371, 382, 380, 352, 96, - /* 1630 */ 337, 394, 96, 325, 364, 398, 356, 454, 401, 402, - /* 1640 */ 403, 404, 405, 406, 364, 408, 418, 369, 394, 369, - /* 1650 */ 346, 371, 398, 333, 360, 401, 402, 403, 404, 405, - /* 1660 */ 406, 337, 408, 36, 356, 328, 327, 388, 350, 361, - /* 1670 */ 338, 350, 364, 392, 394, 350, 325, 369, 398, 371, - /* 1680 */ 323, 401, 402, 403, 404, 405, 406, 0, 408, 383, - /* 1690 */ 383, 0, 325, 188, 0, 0, 42, 0, 35, 200, - /* 1700 */ 35, 35, 394, 35, 200, 0, 398, 356, 35, 401, - /* 1710 */ 402, 403, 404, 405, 406, 364, 408, 35, 200, 164, - /* 1720 */ 369, 0, 371, 356, 200, 0, 0, 35, 22, 0, - /* 1730 */ 183, 364, 181, 35, 0, 385, 369, 0, 371, 177, - /* 1740 */ 176, 0, 0, 325, 0, 394, 47, 0, 0, 398, - /* 1750 */ 42, 0, 401, 402, 403, 404, 405, 406, 0, 408, - /* 1760 */ 0, 394, 0, 0, 0, 398, 0, 0, 401, 402, - /* 1770 */ 403, 404, 405, 406, 356, 408, 152, 427, 35, 0, - /* 1780 */ 152, 431, 364, 0, 0, 0, 325, 369, 0, 371, - /* 1790 */ 0, 0, 0, 0, 0, 0, 446, 447, 0, 0, - /* 1800 */ 0, 451, 452, 325, 0, 0, 0, 42, 0, 0, - /* 1810 */ 0, 0, 394, 0, 0, 0, 398, 356, 22, 401, - /* 1820 */ 402, 403, 404, 405, 406, 364, 408, 0, 0, 136, - /* 1830 */ 369, 0, 371, 58, 356, 0, 35, 0, 58, 0, - /* 1840 */ 14, 44, 364, 14, 42, 0, 39, 369, 0, 371, - /* 1850 */ 47, 0, 40, 0, 0, 394, 325, 39, 39, 398, - /* 1860 */ 172, 0, 401, 402, 403, 404, 405, 406, 47, 408, - /* 1870 */ 47, 0, 394, 325, 0, 0, 398, 35, 48, 401, - /* 1880 */ 402, 403, 404, 405, 406, 39, 408, 356, 64, 0, - /* 1890 */ 35, 48, 0, 35, 0, 364, 39, 48, 39, 35, - /* 1900 */ 369, 39, 371, 0, 356, 0, 0, 0, 48, 22, - /* 1910 */ 0, 35, 364, 35, 35, 22, 35, 369, 35, 371, - /* 1920 */ 103, 105, 22, 35, 325, 394, 44, 0, 44, 398, - /* 1930 */ 35, 35, 401, 402, 403, 404, 405, 406, 22, 408, - /* 1940 */ 0, 325, 394, 22, 0, 22, 398, 50, 35, 401, - /* 1950 */ 402, 403, 404, 405, 406, 356, 408, 0, 0, 35, - /* 1960 */ 35, 0, 97, 364, 22, 20, 35, 325, 369, 35, - /* 1970 */ 371, 193, 356, 96, 0, 0, 35, 22, 0, 0, - /* 1980 */ 364, 44, 249, 3, 325, 369, 164, 371, 97, 249, - /* 1990 */ 44, 44, 44, 394, 96, 96, 164, 398, 356, 166, - /* 2000 */ 401, 402, 403, 404, 405, 406, 364, 408, 164, 184, - /* 2010 */ 394, 369, 97, 371, 398, 356, 97, 401, 402, 403, - /* 2020 */ 404, 405, 406, 364, 408, 96, 170, 97, 369, 47, - /* 2030 */ 371, 96, 96, 47, 96, 325, 394, 3, 44, 35, - /* 2040 */ 398, 35, 35, 401, 402, 403, 404, 405, 406, 97, - /* 2050 */ 408, 97, 35, 394, 35, 35, 97, 398, 47, 97, - /* 2060 */ 401, 402, 403, 404, 405, 406, 356, 408, 44, 47, - /* 2070 */ 0, 0, 0, 96, 364, 167, 0, 96, 325, 369, - /* 2080 */ 97, 371, 97, 249, 243, 96, 96, 39, 96, 47, - /* 2090 */ 106, 165, 2, 44, 325, 228, 230, 228, 96, 22, - /* 2100 */ 97, 96, 47, 47, 394, 97, 96, 206, 398, 356, - /* 2110 */ 97, 401, 402, 403, 404, 405, 406, 364, 408, 96, - /* 2120 */ 22, 96, 369, 97, 371, 356, 208, 96, 107, 97, - /* 2130 */ 35, 35, 96, 364, 97, 35, 96, 35, 369, 96, - /* 2140 */ 371, 97, 97, 35, 97, 325, 96, 394, 35, 96, - /* 2150 */ 120, 398, 22, 120, 401, 402, 403, 404, 405, 406, - /* 2160 */ 108, 408, 96, 394, 44, 96, 120, 398, 35, 96, - /* 2170 */ 401, 402, 403, 404, 405, 406, 356, 408, 120, 22, - /* 2180 */ 64, 63, 35, 35, 364, 35, 35, 35, 325, 369, - /* 2190 */ 35, 371, 70, 35, 35, 35, 35, 93, 44, 35, - /* 2200 */ 35, 22, 35, 22, 35, 325, 35, 35, 70, 35, - /* 2210 */ 35, 35, 35, 35, 394, 22, 0, 35, 398, 356, - /* 2220 */ 35, 401, 402, 403, 404, 405, 406, 364, 408, 39, - /* 2230 */ 0, 48, 369, 35, 371, 48, 356, 0, 39, 35, - /* 2240 */ 48, 39, 0, 35, 364, 48, 39, 0, 35, 369, - /* 2250 */ 35, 371, 0, 22, 21, 20, 22, 394, 325, 457, - /* 2260 */ 22, 398, 21, 457, 401, 402, 403, 404, 405, 406, - /* 2270 */ 457, 408, 457, 457, 394, 325, 457, 457, 398, 457, - /* 2280 */ 457, 401, 402, 403, 404, 405, 406, 457, 408, 356, - /* 2290 */ 457, 457, 457, 457, 457, 457, 457, 364, 457, 457, - /* 2300 */ 457, 457, 369, 457, 371, 457, 356, 457, 457, 457, - /* 2310 */ 457, 457, 457, 457, 364, 457, 457, 457, 457, 369, - /* 2320 */ 457, 371, 457, 457, 457, 457, 325, 394, 457, 457, - /* 2330 */ 457, 398, 457, 457, 401, 402, 403, 404, 405, 406, - /* 2340 */ 457, 408, 457, 457, 394, 457, 457, 457, 398, 457, - /* 2350 */ 457, 401, 402, 403, 404, 405, 406, 356, 408, 457, - /* 2360 */ 457, 457, 457, 457, 457, 364, 457, 457, 457, 457, - /* 2370 */ 369, 457, 371, 457, 457, 457, 457, 457, 457, 457, - /* 2380 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2390 */ 457, 457, 457, 457, 457, 394, 457, 457, 457, 398, - /* 2400 */ 457, 457, 401, 402, 403, 404, 405, 406, 457, 408, - /* 2410 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, + /* 220 */ 220, 221, 222, 223, 224, 225, 226, 95, 95, 397, + /* 230 */ 398, 399, 161, 162, 423, 424, 425, 3, 427, 428, + /* 240 */ 408, 339, 431, 370, 371, 20, 95, 98, 20, 100, + /* 250 */ 101, 180, 103, 182, 205, 353, 107, 446, 447, 161, + /* 260 */ 162, 244, 451, 452, 362, 231, 232, 233, 234, 235, + /* 270 */ 236, 237, 238, 239, 240, 241, 205, 206, 129, 208, + /* 280 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + /* 290 */ 219, 220, 221, 222, 223, 224, 225, 226, 325, 228, + /* 300 */ 12, 13, 253, 254, 255, 256, 257, 364, 20, 371, + /* 310 */ 22, 179, 20, 181, 20, 324, 22, 326, 375, 381, + /* 320 */ 95, 33, 384, 35, 108, 109, 110, 111, 112, 113, + /* 330 */ 114, 115, 116, 117, 118, 0, 120, 121, 122, 123, + /* 340 */ 124, 125, 369, 14, 355, 51, 58, 45, 46, 20, + /* 350 */ 427, 63, 400, 166, 431, 333, 21, 368, 70, 24, + /* 360 */ 25, 26, 27, 28, 29, 30, 31, 32, 175, 347, + /* 370 */ 447, 12, 13, 14, 451, 452, 244, 244, 426, 20, + /* 380 */ 58, 22, 0, 95, 325, 228, 364, 230, 126, 196, + /* 390 */ 197, 333, 33, 21, 35, 244, 24, 25, 26, 27, + /* 400 */ 28, 29, 30, 31, 32, 117, 24, 25, 26, 27, + /* 410 */ 28, 29, 30, 31, 32, 356, 94, 58, 348, 97, + /* 420 */ 132, 133, 364, 364, 132, 133, 356, 325, 369, 70, + /* 430 */ 371, 14, 15, 16, 20, 365, 249, 250, 349, 8, + /* 440 */ 9, 352, 333, 12, 13, 14, 15, 16, 245, 161, + /* 450 */ 162, 189, 190, 394, 95, 356, 347, 398, 127, 356, + /* 460 */ 401, 402, 403, 404, 405, 406, 363, 408, 180, 244, + /* 470 */ 182, 369, 413, 364, 415, 372, 117, 378, 419, 420, + /* 480 */ 35, 423, 424, 425, 79, 427, 428, 58, 325, 430, + /* 490 */ 161, 132, 133, 205, 206, 261, 208, 209, 210, 211, + /* 500 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + /* 510 */ 222, 223, 224, 225, 226, 70, 62, 333, 187, 188, + /* 520 */ 161, 162, 191, 19, 193, 337, 97, 65, 66, 67, + /* 530 */ 427, 347, 369, 106, 431, 73, 74, 33, 354, 180, + /* 540 */ 78, 182, 137, 138, 228, 83, 84, 359, 364, 446, + /* 550 */ 447, 89, 48, 0, 451, 452, 1, 2, 54, 55, + /* 560 */ 56, 57, 58, 70, 205, 206, 339, 208, 209, 210, + /* 570 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + /* 580 */ 221, 222, 223, 224, 225, 226, 12, 13, 427, 362, + /* 590 */ 411, 358, 431, 414, 20, 33, 22, 20, 94, 325, + /* 600 */ 0, 97, 369, 172, 107, 357, 325, 33, 447, 35, + /* 610 */ 48, 325, 451, 452, 44, 62, 54, 55, 56, 57, + /* 620 */ 58, 400, 333, 126, 127, 128, 129, 130, 131, 58, + /* 630 */ 397, 398, 58, 356, 130, 342, 343, 356, 342, 343, + /* 640 */ 363, 408, 357, 369, 70, 364, 20, 426, 22, 372, + /* 650 */ 369, 96, 371, 364, 356, 369, 94, 12, 13, 97, + /* 660 */ 22, 35, 62, 365, 3, 20, 95, 22, 97, 95, + /* 670 */ 357, 167, 95, 35, 357, 394, 385, 51, 33, 398, + /* 680 */ 35, 20, 401, 402, 403, 404, 405, 406, 184, 408, + /* 690 */ 186, 117, 411, 357, 413, 414, 415, 266, 14, 400, + /* 700 */ 419, 420, 44, 58, 20, 20, 132, 133, 70, 364, + /* 710 */ 333, 422, 423, 424, 425, 70, 427, 428, 427, 389, + /* 720 */ 375, 325, 431, 357, 347, 426, 164, 165, 325, 167, + /* 730 */ 333, 20, 170, 160, 371, 161, 162, 446, 447, 2, + /* 740 */ 95, 364, 451, 452, 347, 8, 9, 384, 186, 12, + /* 750 */ 13, 14, 15, 16, 180, 117, 182, 96, 325, 379, + /* 760 */ 44, 364, 117, 8, 9, 369, 326, 12, 13, 14, + /* 770 */ 15, 16, 369, 325, 412, 20, 414, 132, 133, 205, + /* 780 */ 206, 0, 208, 209, 210, 211, 212, 213, 214, 215, + /* 790 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + /* 800 */ 226, 18, 369, 20, 231, 325, 161, 162, 333, 333, + /* 810 */ 27, 348, 96, 30, 241, 244, 33, 369, 180, 356, + /* 820 */ 182, 244, 347, 347, 163, 180, 0, 182, 365, 48, + /* 830 */ 325, 48, 325, 50, 325, 265, 53, 325, 325, 364, + /* 840 */ 364, 242, 243, 205, 206, 161, 325, 20, 163, 369, + /* 850 */ 205, 206, 444, 208, 209, 210, 211, 212, 213, 214, + /* 860 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + /* 870 */ 225, 226, 161, 412, 369, 414, 369, 94, 369, 8, + /* 880 */ 9, 369, 369, 12, 13, 14, 15, 16, 0, 106, + /* 890 */ 369, 65, 66, 67, 68, 69, 345, 71, 72, 73, + /* 900 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + /* 910 */ 84, 85, 86, 87, 88, 89, 90, 91, 163, 136, + /* 920 */ 325, 263, 139, 140, 141, 142, 143, 144, 145, 146, + /* 930 */ 147, 148, 149, 150, 151, 152, 153, 154, 155, 4, + /* 940 */ 157, 158, 159, 18, 366, 8, 9, 369, 23, 12, + /* 950 */ 13, 14, 15, 16, 19, 0, 333, 325, 325, 39, + /* 960 */ 333, 455, 37, 38, 369, 2, 41, 96, 33, 335, + /* 970 */ 347, 8, 9, 20, 347, 12, 13, 14, 15, 16, + /* 980 */ 333, 325, 333, 48, 59, 60, 61, 364, 53, 356, + /* 990 */ 163, 364, 333, 58, 347, 107, 347, 364, 344, 107, + /* 1000 */ 346, 369, 369, 385, 371, 438, 347, 366, 356, 0, + /* 1010 */ 369, 364, 333, 364, 126, 127, 128, 129, 130, 131, + /* 1020 */ 95, 129, 106, 364, 372, 369, 347, 394, 42, 94, + /* 1030 */ 44, 398, 97, 96, 401, 402, 403, 404, 405, 406, + /* 1040 */ 42, 408, 44, 364, 366, 427, 413, 369, 415, 431, + /* 1050 */ 8, 9, 419, 420, 12, 13, 14, 15, 16, 134, + /* 1060 */ 22, 325, 107, 333, 446, 447, 12, 13, 349, 451, + /* 1070 */ 452, 352, 156, 35, 441, 99, 22, 347, 102, 333, + /* 1080 */ 35, 126, 127, 128, 129, 130, 131, 33, 99, 35, + /* 1090 */ 35, 102, 356, 347, 364, 0, 0, 172, 173, 174, + /* 1100 */ 364, 333, 177, 99, 325, 369, 102, 371, 356, 44, + /* 1110 */ 364, 99, 58, 44, 102, 347, 163, 22, 22, 47, + /* 1120 */ 195, 63, 333, 198, 70, 200, 201, 202, 203, 204, + /* 1130 */ 394, 335, 364, 333, 398, 356, 347, 401, 402, 403, + /* 1140 */ 404, 405, 406, 364, 408, 333, 0, 347, 369, 413, + /* 1150 */ 371, 415, 44, 364, 385, 419, 420, 132, 133, 347, + /* 1160 */ 151, 96, 325, 243, 364, 96, 430, 95, 22, 244, + /* 1170 */ 163, 117, 44, 394, 44, 168, 364, 398, 44, 332, + /* 1180 */ 401, 402, 403, 404, 405, 406, 379, 408, 13, 1, + /* 1190 */ 2, 13, 413, 356, 415, 44, 427, 44, 419, 420, + /* 1200 */ 431, 364, 379, 44, 96, 163, 369, 95, 371, 430, + /* 1210 */ 35, 368, 44, 35, 44, 446, 447, 105, 44, 385, + /* 1220 */ 451, 452, 429, 325, 96, 448, 96, 182, 246, 421, + /* 1230 */ 96, 394, 396, 35, 180, 398, 182, 182, 401, 402, + /* 1240 */ 403, 404, 405, 406, 48, 408, 44, 96, 432, 96, + /* 1250 */ 413, 325, 415, 44, 356, 96, 419, 420, 395, 205, + /* 1260 */ 206, 427, 364, 205, 96, 431, 96, 369, 70, 371, + /* 1270 */ 96, 217, 218, 219, 220, 221, 222, 223, 178, 42, + /* 1280 */ 446, 447, 356, 44, 387, 451, 452, 376, 20, 379, + /* 1290 */ 364, 376, 394, 160, 20, 369, 398, 371, 96, 401, + /* 1300 */ 402, 403, 404, 405, 406, 96, 408, 374, 333, 93, + /* 1310 */ 333, 413, 325, 415, 376, 374, 374, 419, 420, 341, + /* 1320 */ 394, 333, 20, 333, 398, 333, 327, 401, 402, 403, + /* 1330 */ 404, 405, 406, 327, 408, 96, 20, 391, 371, 413, + /* 1340 */ 339, 415, 339, 356, 20, 419, 420, 334, 20, 339, + /* 1350 */ 386, 364, 334, 339, 339, 339, 369, 333, 371, 339, + /* 1360 */ 52, 327, 336, 336, 356, 325, 333, 356, 185, 369, + /* 1370 */ 327, 369, 393, 356, 194, 356, 391, 356, 356, 356, + /* 1380 */ 333, 394, 437, 337, 356, 398, 356, 356, 401, 402, + /* 1390 */ 403, 404, 405, 406, 337, 408, 356, 356, 437, 252, + /* 1400 */ 251, 258, 415, 371, 364, 440, 419, 420, 369, 369, + /* 1410 */ 439, 371, 171, 259, 379, 379, 260, 369, 325, 390, + /* 1420 */ 369, 369, 267, 247, 456, 264, 382, 262, 437, 436, + /* 1430 */ 435, 382, 449, 396, 394, 243, 20, 364, 398, 434, + /* 1440 */ 333, 401, 402, 403, 404, 405, 406, 450, 408, 356, + /* 1450 */ 400, 334, 337, 382, 369, 415, 369, 364, 369, 419, + /* 1460 */ 420, 325, 369, 369, 371, 382, 369, 369, 165, 337, + /* 1470 */ 380, 352, 337, 364, 95, 95, 360, 418, 333, 369, + /* 1480 */ 36, 337, 383, 346, 392, 328, 383, 394, 350, 327, + /* 1490 */ 388, 398, 356, 0, 401, 402, 403, 404, 405, 406, + /* 1500 */ 364, 408, 350, 0, 338, 369, 187, 371, 415, 323, + /* 1510 */ 350, 0, 419, 420, 0, 42, 0, 35, 325, 199, + /* 1520 */ 35, 35, 35, 0, 199, 35, 35, 0, 199, 199, + /* 1530 */ 394, 0, 0, 35, 398, 325, 0, 401, 402, 403, + /* 1540 */ 404, 405, 406, 407, 408, 409, 410, 22, 182, 356, + /* 1550 */ 35, 180, 0, 0, 176, 0, 175, 364, 0, 47, + /* 1560 */ 0, 325, 369, 0, 371, 0, 356, 58, 42, 0, + /* 1570 */ 0, 0, 0, 0, 364, 0, 0, 0, 151, 369, + /* 1580 */ 35, 371, 0, 151, 0, 0, 0, 394, 42, 0, + /* 1590 */ 0, 398, 356, 0, 401, 402, 403, 404, 405, 406, + /* 1600 */ 364, 408, 0, 0, 394, 369, 0, 371, 398, 0, + /* 1610 */ 0, 401, 402, 403, 404, 405, 406, 0, 408, 0, + /* 1620 */ 0, 325, 0, 0, 0, 0, 0, 0, 0, 22, + /* 1630 */ 394, 135, 0, 0, 398, 442, 443, 401, 402, 403, + /* 1640 */ 404, 405, 406, 325, 408, 0, 0, 35, 0, 0, + /* 1650 */ 58, 415, 356, 0, 0, 42, 420, 39, 44, 0, + /* 1660 */ 364, 14, 47, 453, 454, 369, 0, 371, 47, 14, + /* 1670 */ 40, 0, 0, 39, 356, 39, 47, 171, 0, 0, + /* 1680 */ 0, 0, 364, 0, 0, 35, 48, 369, 48, 371, + /* 1690 */ 394, 0, 35, 35, 398, 39, 0, 401, 402, 403, + /* 1700 */ 404, 405, 406, 64, 408, 0, 39, 325, 48, 39, + /* 1710 */ 35, 48, 394, 39, 0, 0, 398, 0, 102, 401, + /* 1720 */ 402, 403, 404, 405, 406, 35, 408, 0, 325, 22, + /* 1730 */ 44, 44, 35, 35, 35, 35, 35, 35, 356, 443, + /* 1740 */ 22, 104, 0, 35, 22, 0, 364, 22, 0, 0, + /* 1750 */ 22, 369, 0, 371, 50, 35, 35, 0, 35, 356, + /* 1760 */ 22, 20, 0, 445, 361, 35, 35, 364, 163, 96, + /* 1770 */ 192, 325, 369, 0, 371, 35, 394, 95, 183, 0, + /* 1780 */ 398, 22, 0, 401, 402, 403, 404, 405, 406, 3, + /* 1790 */ 408, 44, 248, 47, 44, 44, 248, 394, 163, 96, + /* 1800 */ 47, 398, 356, 3, 401, 402, 403, 404, 405, 406, + /* 1810 */ 364, 408, 169, 44, 95, 369, 165, 371, 44, 95, + /* 1820 */ 35, 95, 325, 35, 163, 96, 35, 248, 96, 95, + /* 1830 */ 95, 35, 96, 96, 95, 0, 454, 35, 325, 96, + /* 1840 */ 394, 35, 47, 242, 398, 44, 47, 401, 402, 403, + /* 1850 */ 404, 405, 406, 356, 408, 0, 410, 96, 361, 96, + /* 1860 */ 0, 364, 95, 0, 96, 95, 369, 96, 371, 356, + /* 1870 */ 95, 95, 166, 39, 361, 164, 95, 364, 47, 2, + /* 1880 */ 44, 205, 369, 105, 371, 95, 22, 47, 96, 227, + /* 1890 */ 96, 394, 325, 229, 47, 398, 227, 22, 401, 402, + /* 1900 */ 403, 404, 405, 406, 95, 408, 95, 394, 96, 95, + /* 1910 */ 95, 398, 96, 325, 401, 402, 403, 404, 405, 406, + /* 1920 */ 95, 408, 96, 356, 106, 35, 35, 95, 35, 96, + /* 1930 */ 35, 364, 95, 35, 96, 96, 369, 95, 371, 95, + /* 1940 */ 207, 96, 35, 95, 356, 22, 119, 119, 119, 119, + /* 1950 */ 107, 95, 364, 44, 35, 22, 325, 369, 64, 371, + /* 1960 */ 95, 394, 95, 63, 35, 398, 35, 35, 401, 402, + /* 1970 */ 403, 404, 405, 406, 35, 408, 35, 325, 35, 35, + /* 1980 */ 70, 35, 394, 35, 35, 35, 398, 356, 92, 401, + /* 1990 */ 402, 403, 404, 405, 406, 364, 408, 44, 35, 35, + /* 2000 */ 369, 22, 371, 35, 35, 35, 70, 35, 356, 35, + /* 2010 */ 35, 35, 35, 22, 0, 35, 364, 35, 0, 48, + /* 2020 */ 325, 369, 39, 371, 35, 394, 48, 0, 35, 398, + /* 2030 */ 0, 39, 401, 402, 403, 404, 405, 406, 325, 408, + /* 2040 */ 39, 35, 48, 48, 39, 0, 394, 35, 35, 0, + /* 2050 */ 398, 356, 21, 401, 402, 403, 404, 405, 406, 364, + /* 2060 */ 408, 22, 22, 22, 369, 21, 371, 457, 20, 356, + /* 2070 */ 457, 457, 457, 457, 457, 457, 457, 364, 457, 457, + /* 2080 */ 457, 457, 369, 457, 371, 457, 457, 457, 457, 394, + /* 2090 */ 457, 457, 457, 398, 457, 457, 401, 402, 403, 404, + /* 2100 */ 405, 406, 325, 408, 457, 457, 457, 394, 457, 457, + /* 2110 */ 457, 398, 457, 457, 401, 402, 403, 404, 405, 406, + /* 2120 */ 457, 408, 457, 325, 457, 457, 457, 457, 457, 457, + /* 2130 */ 457, 457, 457, 356, 457, 457, 457, 457, 457, 457, + /* 2140 */ 457, 364, 457, 457, 457, 457, 369, 457, 371, 457, + /* 2150 */ 457, 457, 457, 457, 356, 457, 457, 457, 457, 457, + /* 2160 */ 457, 457, 364, 457, 457, 457, 325, 369, 457, 371, + /* 2170 */ 457, 394, 457, 457, 457, 398, 457, 457, 401, 402, + /* 2180 */ 403, 404, 405, 406, 325, 408, 457, 457, 457, 457, + /* 2190 */ 457, 457, 394, 457, 457, 457, 398, 356, 457, 401, + /* 2200 */ 402, 403, 404, 405, 406, 364, 408, 457, 457, 457, + /* 2210 */ 369, 457, 371, 457, 457, 356, 457, 457, 457, 457, + /* 2220 */ 457, 457, 457, 364, 457, 457, 457, 325, 369, 457, + /* 2230 */ 371, 457, 457, 457, 457, 394, 457, 457, 457, 398, + /* 2240 */ 457, 457, 401, 402, 403, 404, 405, 406, 457, 408, + /* 2250 */ 457, 457, 457, 394, 457, 457, 457, 398, 356, 457, + /* 2260 */ 401, 402, 403, 404, 405, 406, 364, 408, 457, 457, + /* 2270 */ 325, 369, 457, 371, 457, 457, 457, 457, 457, 457, + /* 2280 */ 457, 457, 457, 457, 457, 457, 457, 325, 457, 457, + /* 2290 */ 457, 457, 457, 457, 457, 457, 394, 457, 457, 457, + /* 2300 */ 398, 356, 457, 401, 402, 403, 404, 405, 406, 364, + /* 2310 */ 408, 457, 457, 325, 369, 457, 371, 457, 356, 457, + /* 2320 */ 457, 457, 457, 457, 457, 457, 364, 457, 457, 457, + /* 2330 */ 457, 369, 457, 371, 457, 457, 457, 457, 457, 394, + /* 2340 */ 457, 457, 457, 398, 356, 457, 401, 402, 403, 404, + /* 2350 */ 405, 406, 364, 408, 457, 457, 394, 369, 457, 371, + /* 2360 */ 398, 457, 457, 401, 402, 403, 404, 405, 406, 457, + /* 2370 */ 408, 457, 325, 457, 457, 457, 457, 457, 457, 457, + /* 2380 */ 457, 457, 394, 457, 457, 457, 398, 457, 457, 401, + /* 2390 */ 402, 403, 404, 405, 406, 457, 408, 457, 457, 457, + /* 2400 */ 457, 457, 457, 356, 457, 457, 457, 457, 457, 457, + /* 2410 */ 457, 364, 457, 457, 457, 325, 369, 457, 371, 457, /* 2420 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2430 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2440 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2450 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2460 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2470 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2480 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2490 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2500 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2510 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2520 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2530 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2540 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2550 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2560 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2570 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, - /* 2580 */ 457, 457, 457, 457, 457, + /* 2430 */ 457, 457, 457, 325, 457, 457, 457, 457, 457, 457, + /* 2440 */ 457, 394, 457, 457, 457, 398, 356, 457, 401, 402, + /* 2450 */ 403, 404, 405, 406, 364, 408, 457, 457, 457, 369, + /* 2460 */ 457, 371, 457, 457, 356, 457, 457, 457, 457, 457, + /* 2470 */ 457, 457, 364, 457, 457, 457, 457, 369, 457, 371, + /* 2480 */ 457, 457, 457, 457, 394, 457, 457, 457, 398, 457, + /* 2490 */ 457, 401, 402, 403, 404, 405, 406, 325, 408, 457, + /* 2500 */ 457, 457, 394, 457, 457, 457, 398, 457, 457, 401, + /* 2510 */ 402, 403, 404, 405, 406, 457, 408, 457, 325, 457, + /* 2520 */ 457, 457, 457, 457, 457, 457, 457, 457, 356, 457, + /* 2530 */ 457, 457, 457, 457, 457, 457, 364, 457, 457, 457, + /* 2540 */ 457, 369, 457, 371, 457, 457, 457, 457, 457, 356, + /* 2550 */ 457, 457, 457, 457, 457, 457, 457, 364, 457, 457, + /* 2560 */ 457, 325, 369, 457, 371, 457, 394, 457, 457, 457, + /* 2570 */ 398, 457, 457, 401, 402, 403, 404, 405, 406, 325, + /* 2580 */ 408, 457, 457, 457, 457, 457, 457, 394, 457, 457, + /* 2590 */ 457, 398, 356, 457, 401, 402, 403, 404, 405, 406, + /* 2600 */ 364, 408, 457, 457, 457, 369, 457, 371, 457, 457, + /* 2610 */ 356, 457, 457, 457, 457, 457, 457, 457, 364, 457, + /* 2620 */ 457, 457, 325, 369, 457, 371, 457, 457, 457, 457, + /* 2630 */ 394, 457, 457, 457, 398, 457, 457, 401, 402, 403, + /* 2640 */ 404, 405, 406, 457, 408, 457, 457, 457, 394, 457, + /* 2650 */ 457, 457, 398, 356, 457, 401, 402, 403, 404, 405, + /* 2660 */ 406, 364, 408, 457, 457, 457, 369, 457, 371, 457, + /* 2670 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, + /* 2680 */ 457, 457, 457, 457, 457, 457, 457, 457, 457, 457, + /* 2690 */ 457, 394, 457, 457, 457, 398, 457, 457, 401, 402, + /* 2700 */ 403, 404, 405, 406, 457, 408, }; -#define YY_SHIFT_COUNT (709) +#define YY_SHIFT_COUNT (707) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2252) +#define YY_SHIFT_MAX (2049) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 933, 0, 134, 0, 268, 268, 268, 268, 268, 268, - /* 10 */ 268, 268, 268, 402, 536, 536, 670, 536, 536, 536, - /* 20 */ 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, - /* 30 */ 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, - /* 40 */ 536, 536, 536, 536, 536, 536, 55, 180, 65, 195, - /* 50 */ 26, 284, 330, 284, 65, 65, 947, 947, 284, 947, - /* 60 */ 947, 182, 284, 39, 39, 128, 128, 111, 272, 42, - /* 70 */ 42, 39, 39, 39, 39, 39, 39, 39, 39, 39, - /* 80 */ 39, 31, 39, 39, 105, 39, 137, 39, 39, 188, - /* 90 */ 39, 39, 188, 39, 188, 188, 188, 39, 140, 762, - /* 100 */ 949, 949, 438, 1131, 1056, 1056, 1056, 1056, 1056, 1056, - /* 110 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 120 */ 1056, 1056, 1056, 965, 228, 111, 272, 659, 532, 269, - /* 130 */ 269, 269, 800, 370, 370, 532, 224, 224, 224, 213, - /* 140 */ 137, 33, 188, 351, 188, 351, 351, 213, 389, 909, - /* 150 */ 909, 909, 909, 909, 909, 909, 1044, 36, 793, 851, - /* 160 */ 975, 572, 115, 83, 72, 84, 517, 850, 1034, 986, - /* 170 */ 959, 843, 634, 865, 843, 1099, 857, 486, 1066, 1285, - /* 180 */ 1160, 1302, 1327, 1302, 1190, 1353, 1353, 1302, 1190, 1190, - /* 190 */ 1290, 1353, 1353, 1353, 1371, 1371, 1387, 31, 137, 31, - /* 200 */ 1392, 1407, 31, 1392, 31, 31, 31, 1353, 31, 1382, - /* 210 */ 1382, 1371, 188, 188, 188, 188, 188, 188, 188, 188, - /* 220 */ 188, 188, 188, 1353, 1371, 351, 351, 1250, 1387, 140, - /* 230 */ 1315, 137, 140, 1353, 1327, 1327, 351, 1262, 1268, 351, - /* 240 */ 1262, 1268, 351, 351, 188, 1283, 1374, 1262, 1282, 1297, - /* 250 */ 1300, 1066, 1298, 1310, 1313, 1329, 224, 1575, 1353, 1392, - /* 260 */ 140, 1268, 351, 351, 351, 351, 351, 1268, 351, 1453, - /* 270 */ 140, 213, 140, 224, 1533, 1536, 351, 389, 1353, 140, - /* 280 */ 1627, 1371, 2410, 2410, 2410, 2410, 2410, 2410, 2410, 2410, - /* 290 */ 2410, 858, 1027, 23, 1389, 52, 663, 449, 155, 672, - /* 300 */ 1289, 1555, 423, 756, 756, 756, 756, 756, 756, 756, - /* 310 */ 756, 756, 339, 190, 243, 243, 390, 378, 315, 523, - /* 320 */ 470, 518, 518, 696, 999, 168, 696, 696, 696, 884, - /* 330 */ 1076, 385, 1102, 1007, 1089, 956, 1073, 1106, 1107, 16, - /* 340 */ 1196, 1197, 1166, 1105, 1128, 1093, 1071, 972, 1051, 1135, - /* 350 */ 1169, 1173, 1178, 1199, 1232, 1215, 1085, 1110, 573, 1217, - /* 360 */ 1181, 1264, 1265, 1267, 1272, 1288, 1292, 1134, 1234, 1305, - /* 370 */ 1210, 1323, 1687, 1691, 1505, 1694, 1695, 1654, 1697, 1663, - /* 380 */ 1499, 1665, 1666, 1668, 1504, 1705, 1673, 1682, 1518, 1721, - /* 390 */ 1524, 1725, 1692, 1726, 1706, 1729, 1698, 1547, 1551, 1734, - /* 400 */ 1737, 1562, 1564, 1741, 1742, 1699, 1744, 1747, 1748, 1708, - /* 410 */ 1751, 1758, 1760, 1762, 1763, 1764, 1766, 1767, 1624, 1743, - /* 420 */ 1779, 1628, 1783, 1784, 1785, 1788, 1790, 1791, 1792, 1793, - /* 430 */ 1794, 1795, 1798, 1799, 1800, 1804, 1805, 1765, 1806, 1808, - /* 440 */ 1809, 1810, 1811, 1796, 1813, 1814, 1815, 1693, 1827, 1828, - /* 450 */ 1801, 1831, 1775, 1835, 1780, 1837, 1839, 1802, 1807, 1797, - /* 460 */ 1803, 1826, 1821, 1829, 1823, 1845, 1812, 1818, 1848, 1851, - /* 470 */ 1853, 1819, 1688, 1854, 1861, 1871, 1824, 1874, 1875, 1842, - /* 480 */ 1830, 1846, 1889, 1855, 1843, 1857, 1892, 1858, 1849, 1859, - /* 490 */ 1894, 1864, 1860, 1862, 1903, 1905, 1906, 1907, 1816, 1817, - /* 500 */ 1876, 1887, 1910, 1878, 1879, 1893, 1881, 1883, 1882, 1884, - /* 510 */ 1888, 1895, 1900, 1896, 1927, 1916, 1940, 1921, 1897, 1944, - /* 520 */ 1923, 1913, 1957, 1924, 1958, 1925, 1961, 1942, 1945, 1931, - /* 530 */ 1934, 1778, 1865, 1877, 1974, 1822, 1941, 1975, 1825, 1955, - /* 540 */ 1832, 1833, 1978, 1979, 1844, 1856, 1980, 1937, 1733, 1898, - /* 550 */ 1891, 1899, 1915, 1946, 1919, 1929, 1935, 1936, 1930, 1947, - /* 560 */ 1982, 1986, 1938, 1948, 1740, 1952, 1954, 2034, 1994, 1834, - /* 570 */ 2004, 2006, 2007, 2017, 2019, 2020, 1959, 1962, 2011, 1841, - /* 580 */ 2024, 2022, 2070, 2071, 2072, 1977, 1983, 1985, 1981, 1989, - /* 590 */ 1908, 1990, 2076, 2048, 1926, 1992, 1984, 1803, 2042, 2049, - /* 600 */ 1867, 1866, 1869, 2090, 2077, 1901, 2002, 2003, 2005, 2008, - /* 610 */ 2010, 2013, 2055, 2023, 2025, 2056, 2026, 2098, 1918, 2031, - /* 620 */ 2021, 2032, 2095, 2096, 2036, 2037, 2100, 2040, 2044, 2102, - /* 630 */ 2043, 2045, 2108, 2050, 2047, 2113, 2053, 2030, 2033, 2046, - /* 640 */ 2058, 2130, 2052, 2066, 2120, 2069, 2133, 2073, 2120, 2120, - /* 650 */ 2157, 2116, 2118, 2147, 2148, 2150, 2151, 2152, 2155, 2158, - /* 660 */ 2159, 2160, 2161, 2122, 2104, 2154, 2164, 2165, 2179, 2167, - /* 670 */ 2181, 2169, 2171, 2172, 2138, 1882, 2174, 1884, 2175, 2176, - /* 680 */ 2177, 2178, 2193, 2182, 2216, 2185, 2183, 2190, 2230, 2198, - /* 690 */ 2187, 2199, 2237, 2204, 2192, 2202, 2242, 2208, 2197, 2207, - /* 700 */ 2247, 2213, 2215, 2252, 2231, 2233, 2234, 2238, 2241, 2235, + /* 0 */ 925, 0, 71, 0, 288, 288, 288, 288, 288, 288, + /* 10 */ 288, 288, 288, 359, 574, 574, 645, 574, 574, 574, + /* 20 */ 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, + /* 30 */ 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, + /* 40 */ 574, 574, 574, 574, 574, 574, 225, 577, 74, 132, + /* 50 */ 571, 133, 151, 133, 74, 74, 1054, 1054, 133, 1054, + /* 60 */ 1054, 17, 133, 52, 52, 21, 21, 98, 292, 42, + /* 70 */ 42, 52, 52, 52, 52, 52, 52, 52, 52, 52, + /* 80 */ 52, 106, 52, 52, 76, 52, 169, 52, 52, 228, + /* 90 */ 52, 52, 228, 52, 228, 228, 228, 52, 454, 783, + /* 100 */ 34, 34, 372, 462, 638, 638, 638, 638, 638, 638, + /* 110 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, + /* 120 */ 638, 638, 638, 149, 661, 98, 292, 553, 445, 685, + /* 130 */ 685, 685, 600, 157, 157, 445, 414, 414, 414, 427, + /* 140 */ 169, 316, 228, 9, 228, 9, 9, 427, 493, 216, + /* 150 */ 216, 216, 216, 216, 216, 216, 504, 335, 36, 755, + /* 160 */ 431, 49, 626, 187, 329, 684, 294, 827, 302, 892, + /* 170 */ 953, 599, 920, 234, 599, 986, 203, 711, 982, 1196, + /* 180 */ 1100, 1237, 1268, 1237, 1133, 1274, 1274, 1237, 1133, 1133, + /* 190 */ 1216, 1274, 1274, 1274, 1302, 1302, 1316, 106, 169, 106, + /* 200 */ 1324, 1328, 106, 1324, 106, 106, 106, 1274, 106, 1308, + /* 210 */ 1308, 1302, 228, 228, 228, 228, 228, 228, 228, 228, + /* 220 */ 228, 228, 228, 1274, 1302, 9, 9, 1180, 1316, 454, + /* 230 */ 1183, 169, 454, 1274, 1268, 1268, 9, 1147, 1149, 9, + /* 240 */ 1147, 1149, 9, 9, 228, 1143, 1241, 1147, 1156, 1154, + /* 250 */ 1176, 982, 1155, 1161, 1165, 1192, 414, 1416, 1274, 1324, + /* 260 */ 454, 1149, 9, 9, 9, 9, 9, 1149, 9, 1303, + /* 270 */ 454, 427, 454, 414, 1379, 1380, 9, 493, 1274, 454, + /* 280 */ 1444, 1302, 2706, 2706, 2706, 2706, 2706, 2706, 2706, 2706, + /* 290 */ 2706, 826, 562, 382, 935, 871, 15, 937, 888, 737, + /* 300 */ 963, 1042, 955, 183, 183, 183, 183, 183, 183, 183, + /* 310 */ 183, 183, 497, 331, 25, 25, 193, 322, 405, 166, + /* 320 */ 262, 50, 50, 417, 555, 573, 417, 417, 417, 716, + /* 330 */ 781, 1038, 998, 916, 1009, 976, 989, 1004, 1012, 1095, + /* 340 */ 1096, 1146, 429, 1065, 1069, 1025, 658, 570, 1007, 1108, + /* 350 */ 1128, 1130, 1134, 1151, 1188, 1153, 1045, 1055, 1058, 1159, + /* 360 */ 1072, 1168, 1170, 1174, 1202, 1209, 1239, 1112, 1175, 1178, + /* 370 */ 1198, 11, 1493, 1503, 1319, 1511, 1514, 1473, 1516, 1482, + /* 380 */ 1320, 1485, 1486, 1487, 1325, 1523, 1490, 1491, 1329, 1527, + /* 390 */ 1330, 1531, 1498, 1532, 1525, 1536, 1515, 1366, 1371, 1552, + /* 400 */ 1553, 1378, 1381, 1555, 1558, 1512, 1560, 1563, 1565, 1526, + /* 410 */ 1569, 1570, 1571, 1572, 1573, 1575, 1576, 1577, 1427, 1545, + /* 420 */ 1582, 1432, 1584, 1585, 1586, 1593, 1602, 1603, 1606, 1609, + /* 430 */ 1610, 1617, 1619, 1620, 1622, 1623, 1624, 1546, 1589, 1590, + /* 440 */ 1625, 1626, 1627, 1607, 1628, 1645, 1646, 1496, 1632, 1633, + /* 450 */ 1612, 1648, 1509, 1649, 1592, 1653, 1654, 1613, 1618, 1614, + /* 460 */ 1615, 1647, 1621, 1655, 1629, 1659, 1630, 1634, 1666, 1671, + /* 470 */ 1672, 1636, 1506, 1678, 1679, 1680, 1639, 1681, 1683, 1650, + /* 480 */ 1638, 1656, 1684, 1657, 1640, 1667, 1691, 1658, 1660, 1670, + /* 490 */ 1696, 1675, 1663, 1674, 1705, 1714, 1715, 1717, 1637, 1616, + /* 500 */ 1690, 1707, 1727, 1697, 1698, 1699, 1700, 1686, 1687, 1701, + /* 510 */ 1702, 1718, 1708, 1742, 1722, 1745, 1725, 1704, 1748, 1728, + /* 520 */ 1720, 1749, 1721, 1752, 1723, 1757, 1738, 1741, 1730, 1731, + /* 530 */ 1578, 1673, 1682, 1762, 1605, 1740, 1773, 1595, 1759, 1635, + /* 540 */ 1651, 1779, 1782, 1661, 1643, 1786, 1747, 1544, 1719, 1703, + /* 550 */ 1724, 1729, 1750, 1732, 1726, 1734, 1735, 1736, 1751, 1746, + /* 560 */ 1753, 1739, 1769, 1548, 1737, 1743, 1800, 1774, 1579, 1785, + /* 570 */ 1788, 1791, 1796, 1802, 1806, 1761, 1763, 1795, 1601, 1801, + /* 580 */ 1799, 1835, 1855, 1860, 1767, 1768, 1771, 1770, 1775, 1706, + /* 590 */ 1776, 1863, 1834, 1711, 1781, 1778, 1615, 1831, 1836, 1662, + /* 600 */ 1664, 1669, 1877, 1864, 1676, 1790, 1792, 1809, 1794, 1811, + /* 610 */ 1812, 1840, 1814, 1815, 1847, 1816, 1875, 1733, 1825, 1818, + /* 620 */ 1826, 1890, 1891, 1832, 1833, 1893, 1837, 1838, 1895, 1842, + /* 630 */ 1839, 1898, 1844, 1845, 1907, 1848, 1827, 1828, 1829, 1830, + /* 640 */ 1923, 1843, 1856, 1909, 1865, 1919, 1867, 1909, 1909, 1933, + /* 650 */ 1894, 1900, 1929, 1931, 1932, 1939, 1941, 1943, 1944, 1946, + /* 660 */ 1948, 1949, 1910, 1896, 1953, 1950, 1963, 1964, 1979, 1968, + /* 670 */ 1969, 1970, 1936, 1686, 1972, 1687, 1974, 1975, 1976, 1977, + /* 680 */ 1991, 1980, 2014, 1982, 1971, 1983, 2018, 1989, 1978, 1992, + /* 690 */ 2027, 1993, 1994, 2001, 2030, 2006, 1995, 2005, 2045, 2012, + /* 700 */ 2013, 2049, 2039, 2031, 2040, 2041, 2044, 2048, }; #define YY_REDUCE_COUNT (290) -#define YY_REDUCE_MIN (-422) -#define YY_REDUCE_MAX (2001) +#define YY_REDUCE_MIN (-366) +#define YY_REDUCE_MAX (2297) static const short yy_reduce_ofst[] = { - /* 0 */ -186, -325, -226, -166, -32, 236, 642, -92, 176, 852, - /* 10 */ 880, 923, 951, 994, 333, 1012, 1055, 1108, 1129, 1183, - /* 20 */ 1237, 40, 1254, 1308, 442, 1280, 1351, 1367, 1418, 1461, - /* 30 */ 1478, 1531, 1548, 1599, 1616, 1642, 1659, 1710, 1753, 1769, - /* 40 */ 1820, 1863, 1880, 1933, 1950, 2001, -34, 350, 240, -340, - /* 50 */ 666, 1098, 1109, 1350, 776, 1189, 1070, 1083, -422, -326, - /* 60 */ -269, -410, -287, -206, -163, -328, -321, -350, -352, -26, - /* 70 */ 122, -307, -28, 163, 166, 174, 229, 239, 361, 362, - /* 80 */ 452, 46, 508, 621, -251, 639, 48, 706, 741, 177, - /* 90 */ 757, 786, 146, 847, 178, 152, 287, 509, -108, -299, - /* 100 */ -221, -221, -338, -207, -27, 172, 194, 322, 332, 375, - /* 110 */ 405, 462, 465, 466, 469, 480, 483, 529, 550, 627, - /* 120 */ 628, 630, 641, -33, -303, 275, -101, 271, -48, -303, - /* 130 */ 383, 474, 356, 302, 306, 25, -222, 64, 409, 380, - /* 140 */ 624, 562, 368, 609, 686, 638, 683, 689, 493, 143, - /* 150 */ 157, 203, 233, 241, 366, 429, 14, 556, 481, 317, - /* 160 */ 522, 565, 702, 633, 775, 775, 812, 772, 903, 905, - /* 170 */ 873, 860, 860, 842, 860, 885, 878, 775, 934, 939, - /* 180 */ 954, 970, 969, 984, 993, 1041, 1042, 1001, 1004, 1005, - /* 190 */ 1045, 1049, 1054, 1057, 1067, 1078, 1018, 1082, 1052, 1086, - /* 200 */ 1095, 1046, 1091, 1097, 1096, 1101, 1104, 1103, 1111, 1112, - /* 210 */ 1115, 1117, 1090, 1118, 1120, 1130, 1132, 1133, 1136, 1139, - /* 220 */ 1140, 1141, 1143, 1122, 1144, 1069, 1121, 1080, 1113, 1125, - /* 230 */ 1127, 1147, 1168, 1170, 1142, 1145, 1138, 1146, 1137, 1157, - /* 240 */ 1153, 1156, 1159, 1172, 775, 1119, 1126, 1155, 1158, 1123, - /* 250 */ 1148, 1176, 1124, 1149, 1151, 860, 1214, 1202, 1263, 1269, - /* 260 */ 1260, 1222, 1238, 1240, 1242, 1251, 1252, 1244, 1253, 1247, - /* 270 */ 1287, 1276, 1293, 1270, 1228, 1294, 1278, 1304, 1320, 1324, - /* 280 */ 1337, 1339, 1279, 1281, 1306, 1307, 1318, 1321, 1325, 1332, - /* 290 */ 1357, + /* 0 */ -316, -248, 281, 633, 59, 736, 779, 837, 898, 926, + /* 10 */ 987, 1040, 1093, 1136, 1193, 1210, 1236, 1296, 1318, 1382, + /* 20 */ 1403, 1446, 1497, 1513, 1567, 1588, 1631, 1652, 1695, 1713, + /* 30 */ 1777, 1798, 1841, 1859, 1902, 1945, 1962, 1988, 2047, 2090, + /* 40 */ 2108, 2172, 2193, 2236, 2254, 2297, -189, 103, 289, -366, + /* 50 */ 291, 618, 769, 834, -276, 58, -271, -168, -268, -353, + /* 60 */ 233, -77, 161, -265, 184, -329, -322, -324, -296, -191, + /* 70 */ -160, -257, 22, 109, 377, 397, 475, 476, 623, 627, + /* 80 */ 647, -98, 649, 659, -330, 679, -62, 730, 746, -243, + /* 90 */ 768, 789, -355, 800, 70, 277, 463, 812, -259, -209, + /* 100 */ -365, -365, -9, -200, -27, 102, 163, 274, 286, 396, + /* 110 */ 403, 433, 448, 480, 505, 507, 509, 512, 513, 521, + /* 120 */ 595, 632, 656, -11, -48, 99, -127, 227, 293, -48, + /* 130 */ 221, 299, 188, 362, 461, 296, -360, -57, 345, 89, + /* 140 */ 363, 179, 298, 578, 652, 641, 678, 719, 654, -339, + /* 150 */ 248, 285, 313, 317, 336, 366, 330, 440, 551, 380, + /* 160 */ 506, 408, 634, 567, 752, 752, 796, 807, 847, 843, + /* 170 */ 823, 793, 793, 777, 793, 808, 816, 752, 836, 863, + /* 180 */ 897, 911, 910, 915, 933, 975, 977, 938, 941, 942, + /* 190 */ 978, 988, 990, 992, 999, 1006, 946, 1001, 967, 1003, + /* 200 */ 1013, 964, 1010, 1018, 1014, 1015, 1016, 1024, 1020, 1026, + /* 210 */ 1027, 1034, 1008, 1011, 1017, 1019, 1021, 1022, 1023, 1028, + /* 220 */ 1030, 1031, 1041, 1033, 1043, 1000, 1002, 979, 985, 1046, + /* 230 */ 1029, 1032, 1057, 1047, 1035, 1036, 1039, 945, 1044, 1048, + /* 240 */ 961, 1049, 1051, 1052, 752, 965, 971, 991, 993, 995, + /* 250 */ 1005, 1037, 968, 997, 983, 793, 1073, 1050, 1107, 1117, + /* 260 */ 1115, 1071, 1085, 1087, 1089, 1094, 1097, 1083, 1098, 1090, + /* 270 */ 1132, 1119, 1135, 1109, 1059, 1116, 1110, 1137, 1145, 1144, + /* 280 */ 1157, 1162, 1102, 1092, 1099, 1103, 1138, 1152, 1160, 1166, + /* 290 */ 1186, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 10 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 20 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 30 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 40 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 50 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 60 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1849, 1592, 1592, - /* 70 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 80 */ 1592, 1670, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 90 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1668, 1842, - /* 100 */ 2039, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 110 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 120 */ 1592, 1592, 1592, 1592, 2051, 1592, 1592, 1670, 1592, 2051, - /* 130 */ 2051, 2051, 1668, 2011, 2011, 1592, 1592, 1592, 1592, 1779, - /* 140 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1779, 1592, 1592, - /* 150 */ 1592, 1592, 1592, 1592, 1592, 1592, 1886, 1592, 1592, 2076, - /* 160 */ 2129, 1592, 1592, 2079, 1592, 1592, 1592, 1854, 1592, 1732, - /* 170 */ 2066, 2043, 2057, 2113, 2044, 2041, 2060, 1592, 2070, 1592, - /* 180 */ 1879, 1847, 1592, 1847, 1844, 1592, 1592, 1847, 1844, 1844, - /* 190 */ 1723, 1592, 1592, 1592, 1592, 1592, 1592, 1670, 1592, 1670, - /* 200 */ 1592, 1592, 1670, 1592, 1670, 1670, 1670, 1592, 1670, 1649, - /* 210 */ 1649, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 220 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1899, 1592, 1668, - /* 230 */ 1888, 1592, 1668, 1592, 1592, 1592, 1592, 2086, 2084, 1592, - /* 240 */ 2086, 2084, 1592, 1592, 1592, 2098, 2094, 2086, 2102, 2100, - /* 250 */ 2072, 2070, 2132, 2119, 2115, 2057, 1592, 1592, 1592, 1592, - /* 260 */ 1668, 2084, 1592, 1592, 1592, 1592, 1592, 2084, 1592, 1592, - /* 270 */ 1668, 1592, 1668, 1592, 1592, 1748, 1592, 1592, 1592, 1668, - /* 280 */ 1624, 1592, 1881, 1892, 1864, 1864, 1782, 1782, 1782, 1671, - /* 290 */ 1597, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 300 */ 1592, 1592, 1592, 2097, 2096, 1967, 1592, 2015, 2014, 2013, - /* 310 */ 2004, 1966, 1744, 1592, 1965, 1964, 1592, 1592, 1592, 1592, - /* 320 */ 1592, 1860, 1859, 1958, 1592, 1592, 1959, 1957, 1956, 1592, - /* 330 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 340 */ 1592, 1592, 1592, 1592, 1592, 1592, 2116, 2120, 1592, 1592, - /* 350 */ 1592, 1592, 1592, 1592, 2040, 1592, 1592, 1592, 1592, 1592, - /* 360 */ 1941, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 370 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 380 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 390 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 400 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 410 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 420 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 430 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 440 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 450 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1629, - /* 460 */ 1946, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 470 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 480 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 490 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 500 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1710, 1709, - /* 510 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 520 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 530 */ 1592, 1592, 1949, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 540 */ 1592, 1592, 1592, 1592, 1592, 1592, 2112, 2073, 1592, 1592, - /* 550 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 560 */ 1592, 1941, 1592, 2095, 1592, 1592, 2110, 1592, 2114, 1592, - /* 570 */ 1592, 1592, 1592, 1592, 1592, 1592, 2050, 2046, 1592, 1592, - /* 580 */ 2042, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 590 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1940, 1592, 2001, - /* 600 */ 1592, 1592, 1592, 2035, 1592, 1592, 1986, 1592, 1592, 1592, - /* 610 */ 1592, 1592, 1592, 1592, 1592, 1592, 1949, 1592, 1952, 1592, - /* 620 */ 1592, 1592, 1592, 1592, 1776, 1592, 1592, 1592, 1592, 1592, - /* 630 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1761, 1759, 1758, - /* 640 */ 1757, 1592, 1754, 1592, 1789, 1592, 1592, 1592, 1785, 1784, - /* 650 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 660 */ 1592, 1592, 1592, 1592, 1592, 1690, 1592, 1592, 1592, 1592, - /* 670 */ 1592, 1592, 1592, 1592, 1592, 1681, 1592, 1680, 1592, 1592, - /* 680 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 690 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, - /* 700 */ 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, 1592, + /* 0 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 10 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 20 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 30 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 40 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 50 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 60 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1841, 1586, 1586, + /* 70 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 80 */ 1586, 1664, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 90 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1662, 1834, + /* 100 */ 2031, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 110 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 120 */ 1586, 1586, 1586, 1586, 2043, 1586, 1586, 1664, 1586, 2043, + /* 130 */ 2043, 2043, 1662, 2003, 2003, 1586, 1586, 1586, 1586, 1771, + /* 140 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1771, 1586, 1586, + /* 150 */ 1586, 1586, 1586, 1586, 1586, 1586, 1878, 1586, 1586, 2068, + /* 160 */ 2121, 1586, 1586, 2071, 1586, 1586, 1586, 1846, 1586, 1724, + /* 170 */ 2058, 2035, 2049, 2105, 2036, 2033, 2052, 1586, 2062, 1586, + /* 180 */ 1871, 1839, 1586, 1839, 1836, 1586, 1586, 1839, 1836, 1836, + /* 190 */ 1715, 1586, 1586, 1586, 1586, 1586, 1586, 1664, 1586, 1664, + /* 200 */ 1586, 1586, 1664, 1586, 1664, 1664, 1664, 1586, 1664, 1643, + /* 210 */ 1643, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 220 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1891, 1586, 1662, + /* 230 */ 1880, 1586, 1662, 1586, 1586, 1586, 1586, 2078, 2076, 1586, + /* 240 */ 2078, 2076, 1586, 1586, 1586, 2090, 2086, 2078, 2094, 2092, + /* 250 */ 2064, 2062, 2124, 2111, 2107, 2049, 1586, 1586, 1586, 1586, + /* 260 */ 1662, 2076, 1586, 1586, 1586, 1586, 1586, 2076, 1586, 1586, + /* 270 */ 1662, 1586, 1662, 1586, 1586, 1740, 1586, 1586, 1586, 1662, + /* 280 */ 1618, 1586, 1873, 1884, 1856, 1856, 1774, 1774, 1774, 1665, + /* 290 */ 1591, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 300 */ 1586, 1586, 1586, 2089, 2088, 1959, 1586, 2007, 2006, 2005, + /* 310 */ 1996, 1958, 1736, 1586, 1957, 1956, 1586, 1586, 1586, 1586, + /* 320 */ 1586, 1852, 1851, 1950, 1586, 1586, 1951, 1949, 1948, 1586, + /* 330 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 340 */ 1586, 1586, 1586, 1586, 1586, 1586, 2108, 2112, 1586, 1586, + /* 350 */ 1586, 1586, 1586, 1586, 2032, 1586, 1586, 1586, 1586, 1586, + /* 360 */ 1933, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 370 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 380 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 390 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 400 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 410 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 420 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 430 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 440 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 450 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1623, + /* 460 */ 1938, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 470 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 480 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 490 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 500 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1703, 1702, 1586, + /* 510 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 520 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 530 */ 1586, 1941, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 540 */ 1586, 1586, 1586, 1586, 1586, 2104, 2065, 1586, 1586, 1586, + /* 550 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 560 */ 1933, 1586, 2087, 1586, 1586, 2102, 1586, 2106, 1586, 1586, + /* 570 */ 1586, 1586, 1586, 1586, 1586, 2042, 2038, 1586, 1586, 2034, + /* 580 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 590 */ 1586, 1586, 1586, 1586, 1586, 1586, 1932, 1586, 1993, 1586, + /* 600 */ 1586, 1586, 2027, 1586, 1586, 1978, 1586, 1586, 1586, 1586, + /* 610 */ 1586, 1586, 1586, 1586, 1586, 1941, 1586, 1944, 1586, 1586, + /* 620 */ 1586, 1586, 1586, 1768, 1586, 1586, 1586, 1586, 1586, 1586, + /* 630 */ 1586, 1586, 1586, 1586, 1586, 1586, 1753, 1751, 1750, 1749, + /* 640 */ 1586, 1746, 1586, 1781, 1586, 1586, 1586, 1777, 1776, 1586, + /* 650 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 660 */ 1586, 1586, 1586, 1586, 1683, 1586, 1586, 1586, 1586, 1586, + /* 670 */ 1586, 1586, 1586, 1675, 1586, 1674, 1586, 1586, 1586, 1586, + /* 680 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 690 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, + /* 700 */ 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1002,7 +1044,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* TSDB_PAGESIZE => nothing */ 0, /* PRECISION => nothing */ 0, /* REPLICA => nothing */ - 0, /* STRICT => nothing */ 0, /* VGROUPS => nothing */ 0, /* SINGLE_STABLE => nothing */ 0, /* RETENTIONS => nothing */ @@ -1151,7 +1192,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ 0, /* CASE => nothing */ - 269, /* END => ABORT */ + 268, /* END => ABORT */ 0, /* WHEN => nothing */ 0, /* THEN => nothing */ 0, /* ELSE => nothing */ @@ -1193,58 +1234,59 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 269, /* AFTER => ABORT */ - 269, /* ATTACH => ABORT */ - 269, /* BEFORE => ABORT */ - 269, /* BEGIN => ABORT */ - 269, /* BITAND => ABORT */ - 269, /* BITNOT => ABORT */ - 269, /* BITOR => ABORT */ - 269, /* BLOCKS => ABORT */ - 269, /* CHANGE => ABORT */ - 269, /* COMMA => ABORT */ - 269, /* COMPACT => ABORT */ - 269, /* CONCAT => ABORT */ - 269, /* CONFLICT => ABORT */ - 269, /* COPY => ABORT */ - 269, /* DEFERRED => ABORT */ - 269, /* DELIMITERS => ABORT */ - 269, /* DETACH => ABORT */ - 269, /* DIVIDE => ABORT */ - 269, /* DOT => ABORT */ - 269, /* EACH => ABORT */ - 269, /* FAIL => ABORT */ - 269, /* FILE => ABORT */ - 269, /* FOR => ABORT */ - 269, /* GLOB => ABORT */ - 269, /* ID => ABORT */ - 269, /* IMMEDIATE => ABORT */ - 269, /* IMPORT => ABORT */ - 269, /* INITIALLY => ABORT */ - 269, /* INSTEAD => ABORT */ - 269, /* ISNULL => ABORT */ - 269, /* KEY => ABORT */ - 269, /* MODULES => ABORT */ - 269, /* NK_BITNOT => ABORT */ - 269, /* NK_SEMI => ABORT */ - 269, /* NOTNULL => ABORT */ - 269, /* OF => ABORT */ - 269, /* PLUS => ABORT */ - 269, /* PRIVILEGE => ABORT */ - 269, /* RAISE => ABORT */ - 269, /* REPLACE => ABORT */ - 269, /* RESTRICT => ABORT */ - 269, /* ROW => ABORT */ - 269, /* SEMI => ABORT */ - 269, /* STAR => ABORT */ - 269, /* STATEMENT => ABORT */ - 269, /* STRING => ABORT */ - 269, /* TIMES => ABORT */ - 269, /* UPDATE => ABORT */ - 269, /* VALUES => ABORT */ - 269, /* VARIABLE => ABORT */ - 269, /* VIEW => ABORT */ - 269, /* WAL => ABORT */ + 268, /* AFTER => ABORT */ + 268, /* ATTACH => ABORT */ + 268, /* BEFORE => ABORT */ + 268, /* BEGIN => ABORT */ + 268, /* BITAND => ABORT */ + 268, /* BITNOT => ABORT */ + 268, /* BITOR => ABORT */ + 268, /* BLOCKS => ABORT */ + 268, /* CHANGE => ABORT */ + 268, /* COMMA => ABORT */ + 268, /* COMPACT => ABORT */ + 268, /* CONCAT => ABORT */ + 268, /* CONFLICT => ABORT */ + 268, /* COPY => ABORT */ + 268, /* DEFERRED => ABORT */ + 268, /* DELIMITERS => ABORT */ + 268, /* DETACH => ABORT */ + 268, /* DIVIDE => ABORT */ + 268, /* DOT => ABORT */ + 268, /* EACH => ABORT */ + 268, /* FAIL => ABORT */ + 268, /* FILE => ABORT */ + 268, /* FOR => ABORT */ + 268, /* GLOB => ABORT */ + 268, /* ID => ABORT */ + 268, /* IMMEDIATE => ABORT */ + 268, /* IMPORT => ABORT */ + 268, /* INITIALLY => ABORT */ + 268, /* INSTEAD => ABORT */ + 268, /* ISNULL => ABORT */ + 268, /* KEY => ABORT */ + 268, /* MODULES => ABORT */ + 268, /* NK_BITNOT => ABORT */ + 268, /* NK_SEMI => ABORT */ + 268, /* NOTNULL => ABORT */ + 268, /* OF => ABORT */ + 268, /* PLUS => ABORT */ + 268, /* PRIVILEGE => ABORT */ + 268, /* RAISE => ABORT */ + 268, /* REPLACE => ABORT */ + 268, /* RESTRICT => ABORT */ + 268, /* ROW => ABORT */ + 268, /* SEMI => ABORT */ + 268, /* STAR => ABORT */ + 268, /* STATEMENT => ABORT */ + 268, /* STRICT => ABORT */ + 268, /* STRING => ABORT */ + 268, /* TIMES => ABORT */ + 268, /* UPDATE => ABORT */ + 268, /* VALUES => ABORT */ + 268, /* VARIABLE => ABORT */ + 268, /* VIEW => ABORT */ + 268, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1411,242 +1453,242 @@ static const char *const yyTokenName[] = { /* 76 */ "TSDB_PAGESIZE", /* 77 */ "PRECISION", /* 78 */ "REPLICA", - /* 79 */ "STRICT", - /* 80 */ "VGROUPS", - /* 81 */ "SINGLE_STABLE", - /* 82 */ "RETENTIONS", - /* 83 */ "SCHEMALESS", - /* 84 */ "WAL_LEVEL", - /* 85 */ "WAL_FSYNC_PERIOD", - /* 86 */ "WAL_RETENTION_PERIOD", - /* 87 */ "WAL_RETENTION_SIZE", - /* 88 */ "WAL_ROLL_PERIOD", - /* 89 */ "WAL_SEGMENT_SIZE", - /* 90 */ "STT_TRIGGER", - /* 91 */ "TABLE_PREFIX", - /* 92 */ "TABLE_SUFFIX", - /* 93 */ "NK_COLON", - /* 94 */ "MAX_SPEED", - /* 95 */ "TABLE", - /* 96 */ "NK_LP", - /* 97 */ "NK_RP", - /* 98 */ "STABLE", - /* 99 */ "ADD", - /* 100 */ "COLUMN", - /* 101 */ "MODIFY", - /* 102 */ "RENAME", - /* 103 */ "TAG", - /* 104 */ "SET", - /* 105 */ "NK_EQ", - /* 106 */ "USING", - /* 107 */ "TAGS", - /* 108 */ "COMMENT", - /* 109 */ "BOOL", - /* 110 */ "TINYINT", - /* 111 */ "SMALLINT", - /* 112 */ "INT", - /* 113 */ "INTEGER", - /* 114 */ "BIGINT", - /* 115 */ "FLOAT", - /* 116 */ "DOUBLE", - /* 117 */ "BINARY", - /* 118 */ "TIMESTAMP", - /* 119 */ "NCHAR", - /* 120 */ "UNSIGNED", - /* 121 */ "JSON", - /* 122 */ "VARCHAR", - /* 123 */ "MEDIUMBLOB", - /* 124 */ "BLOB", - /* 125 */ "VARBINARY", - /* 126 */ "DECIMAL", - /* 127 */ "MAX_DELAY", - /* 128 */ "WATERMARK", - /* 129 */ "ROLLUP", - /* 130 */ "TTL", - /* 131 */ "SMA", - /* 132 */ "DELETE_MARK", - /* 133 */ "FIRST", - /* 134 */ "LAST", - /* 135 */ "SHOW", - /* 136 */ "PRIVILEGES", - /* 137 */ "DATABASES", - /* 138 */ "TABLES", - /* 139 */ "STABLES", - /* 140 */ "MNODES", - /* 141 */ "QNODES", - /* 142 */ "FUNCTIONS", - /* 143 */ "INDEXES", - /* 144 */ "ACCOUNTS", - /* 145 */ "APPS", - /* 146 */ "CONNECTIONS", - /* 147 */ "LICENCES", - /* 148 */ "GRANTS", - /* 149 */ "QUERIES", - /* 150 */ "SCORES", - /* 151 */ "TOPICS", - /* 152 */ "VARIABLES", - /* 153 */ "CLUSTER", - /* 154 */ "BNODES", - /* 155 */ "SNODES", - /* 156 */ "TRANSACTIONS", - /* 157 */ "DISTRIBUTED", - /* 158 */ "CONSUMERS", - /* 159 */ "SUBSCRIPTIONS", - /* 160 */ "VNODES", - /* 161 */ "LIKE", - /* 162 */ "TBNAME", - /* 163 */ "QTAGS", - /* 164 */ "AS", - /* 165 */ "INDEX", - /* 166 */ "FUNCTION", - /* 167 */ "INTERVAL", - /* 168 */ "TOPIC", - /* 169 */ "WITH", - /* 170 */ "META", - /* 171 */ "CONSUMER", - /* 172 */ "GROUP", - /* 173 */ "DESC", - /* 174 */ "DESCRIBE", - /* 175 */ "RESET", - /* 176 */ "QUERY", - /* 177 */ "CACHE", - /* 178 */ "EXPLAIN", - /* 179 */ "ANALYZE", - /* 180 */ "VERBOSE", - /* 181 */ "NK_BOOL", - /* 182 */ "RATIO", - /* 183 */ "NK_FLOAT", - /* 184 */ "OUTPUTTYPE", - /* 185 */ "AGGREGATE", - /* 186 */ "BUFSIZE", - /* 187 */ "STREAM", - /* 188 */ "INTO", - /* 189 */ "TRIGGER", - /* 190 */ "AT_ONCE", - /* 191 */ "WINDOW_CLOSE", - /* 192 */ "IGNORE", - /* 193 */ "EXPIRED", - /* 194 */ "FILL_HISTORY", - /* 195 */ "SUBTABLE", - /* 196 */ "KILL", - /* 197 */ "CONNECTION", - /* 198 */ "TRANSACTION", - /* 199 */ "BALANCE", - /* 200 */ "VGROUP", - /* 201 */ "MERGE", - /* 202 */ "REDISTRIBUTE", - /* 203 */ "SPLIT", - /* 204 */ "DELETE", - /* 205 */ "INSERT", - /* 206 */ "NULL", - /* 207 */ "NK_QUESTION", - /* 208 */ "NK_ARROW", - /* 209 */ "ROWTS", - /* 210 */ "QSTART", - /* 211 */ "QEND", - /* 212 */ "QDURATION", - /* 213 */ "WSTART", - /* 214 */ "WEND", - /* 215 */ "WDURATION", - /* 216 */ "IROWTS", - /* 217 */ "CAST", - /* 218 */ "NOW", - /* 219 */ "TODAY", - /* 220 */ "TIMEZONE", - /* 221 */ "CLIENT_VERSION", - /* 222 */ "SERVER_VERSION", - /* 223 */ "SERVER_STATUS", - /* 224 */ "CURRENT_USER", - /* 225 */ "COUNT", - /* 226 */ "LAST_ROW", - /* 227 */ "CASE", - /* 228 */ "END", - /* 229 */ "WHEN", - /* 230 */ "THEN", - /* 231 */ "ELSE", - /* 232 */ "BETWEEN", - /* 233 */ "IS", - /* 234 */ "NK_LT", - /* 235 */ "NK_GT", - /* 236 */ "NK_LE", - /* 237 */ "NK_GE", - /* 238 */ "NK_NE", - /* 239 */ "MATCH", - /* 240 */ "NMATCH", - /* 241 */ "CONTAINS", - /* 242 */ "IN", - /* 243 */ "JOIN", - /* 244 */ "INNER", - /* 245 */ "SELECT", - /* 246 */ "DISTINCT", - /* 247 */ "WHERE", - /* 248 */ "PARTITION", - /* 249 */ "BY", - /* 250 */ "SESSION", - /* 251 */ "STATE_WINDOW", - /* 252 */ "SLIDING", - /* 253 */ "FILL", - /* 254 */ "VALUE", - /* 255 */ "NONE", - /* 256 */ "PREV", - /* 257 */ "LINEAR", - /* 258 */ "NEXT", - /* 259 */ "HAVING", - /* 260 */ "RANGE", - /* 261 */ "EVERY", - /* 262 */ "ORDER", - /* 263 */ "SLIMIT", - /* 264 */ "SOFFSET", - /* 265 */ "LIMIT", - /* 266 */ "OFFSET", - /* 267 */ "ASC", - /* 268 */ "NULLS", - /* 269 */ "ABORT", - /* 270 */ "AFTER", - /* 271 */ "ATTACH", - /* 272 */ "BEFORE", - /* 273 */ "BEGIN", - /* 274 */ "BITAND", - /* 275 */ "BITNOT", - /* 276 */ "BITOR", - /* 277 */ "BLOCKS", - /* 278 */ "CHANGE", - /* 279 */ "COMMA", - /* 280 */ "COMPACT", - /* 281 */ "CONCAT", - /* 282 */ "CONFLICT", - /* 283 */ "COPY", - /* 284 */ "DEFERRED", - /* 285 */ "DELIMITERS", - /* 286 */ "DETACH", - /* 287 */ "DIVIDE", - /* 288 */ "DOT", - /* 289 */ "EACH", - /* 290 */ "FAIL", - /* 291 */ "FILE", - /* 292 */ "FOR", - /* 293 */ "GLOB", - /* 294 */ "ID", - /* 295 */ "IMMEDIATE", - /* 296 */ "IMPORT", - /* 297 */ "INITIALLY", - /* 298 */ "INSTEAD", - /* 299 */ "ISNULL", - /* 300 */ "KEY", - /* 301 */ "MODULES", - /* 302 */ "NK_BITNOT", - /* 303 */ "NK_SEMI", - /* 304 */ "NOTNULL", - /* 305 */ "OF", - /* 306 */ "PLUS", - /* 307 */ "PRIVILEGE", - /* 308 */ "RAISE", - /* 309 */ "REPLACE", - /* 310 */ "RESTRICT", - /* 311 */ "ROW", - /* 312 */ "SEMI", - /* 313 */ "STAR", - /* 314 */ "STATEMENT", + /* 79 */ "VGROUPS", + /* 80 */ "SINGLE_STABLE", + /* 81 */ "RETENTIONS", + /* 82 */ "SCHEMALESS", + /* 83 */ "WAL_LEVEL", + /* 84 */ "WAL_FSYNC_PERIOD", + /* 85 */ "WAL_RETENTION_PERIOD", + /* 86 */ "WAL_RETENTION_SIZE", + /* 87 */ "WAL_ROLL_PERIOD", + /* 88 */ "WAL_SEGMENT_SIZE", + /* 89 */ "STT_TRIGGER", + /* 90 */ "TABLE_PREFIX", + /* 91 */ "TABLE_SUFFIX", + /* 92 */ "NK_COLON", + /* 93 */ "MAX_SPEED", + /* 94 */ "TABLE", + /* 95 */ "NK_LP", + /* 96 */ "NK_RP", + /* 97 */ "STABLE", + /* 98 */ "ADD", + /* 99 */ "COLUMN", + /* 100 */ "MODIFY", + /* 101 */ "RENAME", + /* 102 */ "TAG", + /* 103 */ "SET", + /* 104 */ "NK_EQ", + /* 105 */ "USING", + /* 106 */ "TAGS", + /* 107 */ "COMMENT", + /* 108 */ "BOOL", + /* 109 */ "TINYINT", + /* 110 */ "SMALLINT", + /* 111 */ "INT", + /* 112 */ "INTEGER", + /* 113 */ "BIGINT", + /* 114 */ "FLOAT", + /* 115 */ "DOUBLE", + /* 116 */ "BINARY", + /* 117 */ "TIMESTAMP", + /* 118 */ "NCHAR", + /* 119 */ "UNSIGNED", + /* 120 */ "JSON", + /* 121 */ "VARCHAR", + /* 122 */ "MEDIUMBLOB", + /* 123 */ "BLOB", + /* 124 */ "VARBINARY", + /* 125 */ "DECIMAL", + /* 126 */ "MAX_DELAY", + /* 127 */ "WATERMARK", + /* 128 */ "ROLLUP", + /* 129 */ "TTL", + /* 130 */ "SMA", + /* 131 */ "DELETE_MARK", + /* 132 */ "FIRST", + /* 133 */ "LAST", + /* 134 */ "SHOW", + /* 135 */ "PRIVILEGES", + /* 136 */ "DATABASES", + /* 137 */ "TABLES", + /* 138 */ "STABLES", + /* 139 */ "MNODES", + /* 140 */ "QNODES", + /* 141 */ "FUNCTIONS", + /* 142 */ "INDEXES", + /* 143 */ "ACCOUNTS", + /* 144 */ "APPS", + /* 145 */ "CONNECTIONS", + /* 146 */ "LICENCES", + /* 147 */ "GRANTS", + /* 148 */ "QUERIES", + /* 149 */ "SCORES", + /* 150 */ "TOPICS", + /* 151 */ "VARIABLES", + /* 152 */ "CLUSTER", + /* 153 */ "BNODES", + /* 154 */ "SNODES", + /* 155 */ "TRANSACTIONS", + /* 156 */ "DISTRIBUTED", + /* 157 */ "CONSUMERS", + /* 158 */ "SUBSCRIPTIONS", + /* 159 */ "VNODES", + /* 160 */ "LIKE", + /* 161 */ "TBNAME", + /* 162 */ "QTAGS", + /* 163 */ "AS", + /* 164 */ "INDEX", + /* 165 */ "FUNCTION", + /* 166 */ "INTERVAL", + /* 167 */ "TOPIC", + /* 168 */ "WITH", + /* 169 */ "META", + /* 170 */ "CONSUMER", + /* 171 */ "GROUP", + /* 172 */ "DESC", + /* 173 */ "DESCRIBE", + /* 174 */ "RESET", + /* 175 */ "QUERY", + /* 176 */ "CACHE", + /* 177 */ "EXPLAIN", + /* 178 */ "ANALYZE", + /* 179 */ "VERBOSE", + /* 180 */ "NK_BOOL", + /* 181 */ "RATIO", + /* 182 */ "NK_FLOAT", + /* 183 */ "OUTPUTTYPE", + /* 184 */ "AGGREGATE", + /* 185 */ "BUFSIZE", + /* 186 */ "STREAM", + /* 187 */ "INTO", + /* 188 */ "TRIGGER", + /* 189 */ "AT_ONCE", + /* 190 */ "WINDOW_CLOSE", + /* 191 */ "IGNORE", + /* 192 */ "EXPIRED", + /* 193 */ "FILL_HISTORY", + /* 194 */ "SUBTABLE", + /* 195 */ "KILL", + /* 196 */ "CONNECTION", + /* 197 */ "TRANSACTION", + /* 198 */ "BALANCE", + /* 199 */ "VGROUP", + /* 200 */ "MERGE", + /* 201 */ "REDISTRIBUTE", + /* 202 */ "SPLIT", + /* 203 */ "DELETE", + /* 204 */ "INSERT", + /* 205 */ "NULL", + /* 206 */ "NK_QUESTION", + /* 207 */ "NK_ARROW", + /* 208 */ "ROWTS", + /* 209 */ "QSTART", + /* 210 */ "QEND", + /* 211 */ "QDURATION", + /* 212 */ "WSTART", + /* 213 */ "WEND", + /* 214 */ "WDURATION", + /* 215 */ "IROWTS", + /* 216 */ "CAST", + /* 217 */ "NOW", + /* 218 */ "TODAY", + /* 219 */ "TIMEZONE", + /* 220 */ "CLIENT_VERSION", + /* 221 */ "SERVER_VERSION", + /* 222 */ "SERVER_STATUS", + /* 223 */ "CURRENT_USER", + /* 224 */ "COUNT", + /* 225 */ "LAST_ROW", + /* 226 */ "CASE", + /* 227 */ "END", + /* 228 */ "WHEN", + /* 229 */ "THEN", + /* 230 */ "ELSE", + /* 231 */ "BETWEEN", + /* 232 */ "IS", + /* 233 */ "NK_LT", + /* 234 */ "NK_GT", + /* 235 */ "NK_LE", + /* 236 */ "NK_GE", + /* 237 */ "NK_NE", + /* 238 */ "MATCH", + /* 239 */ "NMATCH", + /* 240 */ "CONTAINS", + /* 241 */ "IN", + /* 242 */ "JOIN", + /* 243 */ "INNER", + /* 244 */ "SELECT", + /* 245 */ "DISTINCT", + /* 246 */ "WHERE", + /* 247 */ "PARTITION", + /* 248 */ "BY", + /* 249 */ "SESSION", + /* 250 */ "STATE_WINDOW", + /* 251 */ "SLIDING", + /* 252 */ "FILL", + /* 253 */ "VALUE", + /* 254 */ "NONE", + /* 255 */ "PREV", + /* 256 */ "LINEAR", + /* 257 */ "NEXT", + /* 258 */ "HAVING", + /* 259 */ "RANGE", + /* 260 */ "EVERY", + /* 261 */ "ORDER", + /* 262 */ "SLIMIT", + /* 263 */ "SOFFSET", + /* 264 */ "LIMIT", + /* 265 */ "OFFSET", + /* 266 */ "ASC", + /* 267 */ "NULLS", + /* 268 */ "ABORT", + /* 269 */ "AFTER", + /* 270 */ "ATTACH", + /* 271 */ "BEFORE", + /* 272 */ "BEGIN", + /* 273 */ "BITAND", + /* 274 */ "BITNOT", + /* 275 */ "BITOR", + /* 276 */ "BLOCKS", + /* 277 */ "CHANGE", + /* 278 */ "COMMA", + /* 279 */ "COMPACT", + /* 280 */ "CONCAT", + /* 281 */ "CONFLICT", + /* 282 */ "COPY", + /* 283 */ "DEFERRED", + /* 284 */ "DELIMITERS", + /* 285 */ "DETACH", + /* 286 */ "DIVIDE", + /* 287 */ "DOT", + /* 288 */ "EACH", + /* 289 */ "FAIL", + /* 290 */ "FILE", + /* 291 */ "FOR", + /* 292 */ "GLOB", + /* 293 */ "ID", + /* 294 */ "IMMEDIATE", + /* 295 */ "IMPORT", + /* 296 */ "INITIALLY", + /* 297 */ "INSTEAD", + /* 298 */ "ISNULL", + /* 299 */ "KEY", + /* 300 */ "MODULES", + /* 301 */ "NK_BITNOT", + /* 302 */ "NK_SEMI", + /* 303 */ "NOTNULL", + /* 304 */ "OF", + /* 305 */ "PLUS", + /* 306 */ "PRIVILEGE", + /* 307 */ "RAISE", + /* 308 */ "REPLACE", + /* 309 */ "RESTRICT", + /* 310 */ "ROW", + /* 311 */ "SEMI", + /* 312 */ "STAR", + /* 313 */ "STATEMENT", + /* 314 */ "STRICT", /* 315 */ "STRING", /* 316 */ "TIMES", /* 317 */ "UPDATE", @@ -1888,454 +1930,452 @@ static const char *const yyRuleName[] = { /* 89 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", /* 90 */ "db_options ::= db_options PRECISION NK_STRING", /* 91 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 92 */ "db_options ::= db_options STRICT NK_STRING", - /* 93 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 94 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 95 */ "db_options ::= db_options RETENTIONS retention_list", - /* 96 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 97 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 98 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 99 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 100 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 101 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 102 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 103 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 104 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 105 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 106 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER", - /* 107 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER", - /* 108 */ "alter_db_options ::= alter_db_option", - /* 109 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 110 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 111 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 112 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 113 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 114 */ "alter_db_option ::= KEEP integer_list", - /* 115 */ "alter_db_option ::= KEEP variable_list", - /* 116 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 117 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 118 */ "alter_db_option ::= STRICT NK_STRING", - /* 119 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 120 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 121 */ "integer_list ::= NK_INTEGER", - /* 122 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 123 */ "variable_list ::= NK_VARIABLE", - /* 124 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 125 */ "retention_list ::= retention", - /* 126 */ "retention_list ::= retention_list NK_COMMA retention", - /* 127 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 128 */ "speed_opt ::=", - /* 129 */ "speed_opt ::= MAX_SPEED NK_INTEGER", - /* 130 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 131 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 132 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 133 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 134 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 135 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 136 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 137 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 138 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 139 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 140 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 141 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 142 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 143 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 144 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 145 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 146 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 147 */ "multi_create_clause ::= create_subtable_clause", - /* 148 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 149 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", - /* 150 */ "multi_drop_clause ::= drop_table_clause", - /* 151 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 152 */ "drop_table_clause ::= exists_opt full_table_name", - /* 153 */ "specific_cols_opt ::=", - /* 154 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 155 */ "full_table_name ::= table_name", - /* 156 */ "full_table_name ::= db_name NK_DOT table_name", - /* 157 */ "column_def_list ::= column_def", - /* 158 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 159 */ "column_def ::= column_name type_name", - /* 160 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 161 */ "type_name ::= BOOL", - /* 162 */ "type_name ::= TINYINT", - /* 163 */ "type_name ::= SMALLINT", - /* 164 */ "type_name ::= INT", - /* 165 */ "type_name ::= INTEGER", - /* 166 */ "type_name ::= BIGINT", - /* 167 */ "type_name ::= FLOAT", - /* 168 */ "type_name ::= DOUBLE", - /* 169 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 170 */ "type_name ::= TIMESTAMP", - /* 171 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 172 */ "type_name ::= TINYINT UNSIGNED", - /* 173 */ "type_name ::= SMALLINT UNSIGNED", - /* 174 */ "type_name ::= INT UNSIGNED", - /* 175 */ "type_name ::= BIGINT UNSIGNED", - /* 176 */ "type_name ::= JSON", - /* 177 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 178 */ "type_name ::= MEDIUMBLOB", - /* 179 */ "type_name ::= BLOB", - /* 180 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 181 */ "type_name ::= DECIMAL", - /* 182 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 183 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 184 */ "tags_def_opt ::=", - /* 185 */ "tags_def_opt ::= tags_def", - /* 186 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 187 */ "table_options ::=", - /* 188 */ "table_options ::= table_options COMMENT NK_STRING", - /* 189 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 190 */ "table_options ::= table_options WATERMARK duration_list", - /* 191 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 192 */ "table_options ::= table_options TTL NK_INTEGER", - /* 193 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 194 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 195 */ "alter_table_options ::= alter_table_option", - /* 196 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 197 */ "alter_table_option ::= COMMENT NK_STRING", - /* 198 */ "alter_table_option ::= TTL NK_INTEGER", - /* 199 */ "duration_list ::= duration_literal", - /* 200 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 201 */ "rollup_func_list ::= rollup_func_name", - /* 202 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 203 */ "rollup_func_name ::= function_name", - /* 204 */ "rollup_func_name ::= FIRST", - /* 205 */ "rollup_func_name ::= LAST", - /* 206 */ "col_name_list ::= col_name", - /* 207 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 208 */ "col_name ::= column_name", - /* 209 */ "cmd ::= SHOW DNODES", - /* 210 */ "cmd ::= SHOW USERS", - /* 211 */ "cmd ::= SHOW USER PRIVILEGES", - /* 212 */ "cmd ::= SHOW DATABASES", - /* 213 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 214 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 215 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 216 */ "cmd ::= SHOW MNODES", - /* 217 */ "cmd ::= SHOW QNODES", - /* 218 */ "cmd ::= SHOW FUNCTIONS", - /* 219 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 220 */ "cmd ::= SHOW STREAMS", - /* 221 */ "cmd ::= SHOW ACCOUNTS", - /* 222 */ "cmd ::= SHOW APPS", - /* 223 */ "cmd ::= SHOW CONNECTIONS", - /* 224 */ "cmd ::= SHOW LICENCES", - /* 225 */ "cmd ::= SHOW GRANTS", - /* 226 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 227 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 228 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 229 */ "cmd ::= SHOW QUERIES", - /* 230 */ "cmd ::= SHOW SCORES", - /* 231 */ "cmd ::= SHOW TOPICS", - /* 232 */ "cmd ::= SHOW VARIABLES", - /* 233 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 234 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 235 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 236 */ "cmd ::= SHOW BNODES", - /* 237 */ "cmd ::= SHOW SNODES", - /* 238 */ "cmd ::= SHOW CLUSTER", - /* 239 */ "cmd ::= SHOW TRANSACTIONS", - /* 240 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 241 */ "cmd ::= SHOW CONSUMERS", - /* 242 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 243 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 244 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 245 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 246 */ "cmd ::= SHOW VNODES NK_STRING", - /* 247 */ "db_name_cond_opt ::=", - /* 248 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 249 */ "like_pattern_opt ::=", - /* 250 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 251 */ "table_name_cond ::= table_name", - /* 252 */ "from_db_opt ::=", - /* 253 */ "from_db_opt ::= FROM db_name", - /* 254 */ "tag_list_opt ::=", - /* 255 */ "tag_list_opt ::= tag_item", - /* 256 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 257 */ "tag_item ::= TBNAME", - /* 258 */ "tag_item ::= QTAGS", - /* 259 */ "tag_item ::= column_name", - /* 260 */ "tag_item ::= column_name column_alias", - /* 261 */ "tag_item ::= column_name AS column_alias", - /* 262 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", - /* 263 */ "cmd ::= DROP INDEX exists_opt full_table_name", - /* 264 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 265 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", - /* 266 */ "func_list ::= func", - /* 267 */ "func_list ::= func_list NK_COMMA func", - /* 268 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 269 */ "sma_stream_opt ::=", - /* 270 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 271 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 272 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 273 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 274 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 275 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 276 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 277 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 278 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 279 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 280 */ "cmd ::= DESC full_table_name", - /* 281 */ "cmd ::= DESCRIBE full_table_name", - /* 282 */ "cmd ::= RESET QUERY CACHE", - /* 283 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 284 */ "analyze_opt ::=", - /* 285 */ "analyze_opt ::= ANALYZE", - /* 286 */ "explain_options ::=", - /* 287 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 288 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 289 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 290 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 291 */ "agg_func_opt ::=", - /* 292 */ "agg_func_opt ::= AGGREGATE", - /* 293 */ "bufsize_opt ::=", - /* 294 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 295 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", - /* 296 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 297 */ "stream_options ::=", - /* 298 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 299 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 300 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 301 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 302 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 303 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 304 */ "subtable_opt ::=", - /* 305 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 306 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 307 */ "cmd ::= KILL QUERY NK_STRING", - /* 308 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 309 */ "cmd ::= BALANCE VGROUP", - /* 310 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 311 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 312 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 313 */ "dnode_list ::= DNODE NK_INTEGER", - /* 314 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 315 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 316 */ "cmd ::= query_or_subquery", - /* 317 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 318 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", - /* 319 */ "literal ::= NK_INTEGER", - /* 320 */ "literal ::= NK_FLOAT", - /* 321 */ "literal ::= NK_STRING", - /* 322 */ "literal ::= NK_BOOL", - /* 323 */ "literal ::= TIMESTAMP NK_STRING", - /* 324 */ "literal ::= duration_literal", - /* 325 */ "literal ::= NULL", - /* 326 */ "literal ::= NK_QUESTION", - /* 327 */ "duration_literal ::= NK_VARIABLE", - /* 328 */ "signed ::= NK_INTEGER", - /* 329 */ "signed ::= NK_PLUS NK_INTEGER", - /* 330 */ "signed ::= NK_MINUS NK_INTEGER", - /* 331 */ "signed ::= NK_FLOAT", - /* 332 */ "signed ::= NK_PLUS NK_FLOAT", - /* 333 */ "signed ::= NK_MINUS NK_FLOAT", - /* 334 */ "signed_literal ::= signed", - /* 335 */ "signed_literal ::= NK_STRING", - /* 336 */ "signed_literal ::= NK_BOOL", - /* 337 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 338 */ "signed_literal ::= duration_literal", - /* 339 */ "signed_literal ::= NULL", - /* 340 */ "signed_literal ::= literal_func", - /* 341 */ "signed_literal ::= NK_QUESTION", - /* 342 */ "literal_list ::= signed_literal", - /* 343 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 344 */ "db_name ::= NK_ID", - /* 345 */ "table_name ::= NK_ID", - /* 346 */ "column_name ::= NK_ID", - /* 347 */ "function_name ::= NK_ID", - /* 348 */ "table_alias ::= NK_ID", - /* 349 */ "column_alias ::= NK_ID", - /* 350 */ "user_name ::= NK_ID", - /* 351 */ "topic_name ::= NK_ID", - /* 352 */ "stream_name ::= NK_ID", - /* 353 */ "cgroup_name ::= NK_ID", - /* 354 */ "expr_or_subquery ::= expression", - /* 355 */ "expression ::= literal", - /* 356 */ "expression ::= pseudo_column", - /* 357 */ "expression ::= column_reference", - /* 358 */ "expression ::= function_expression", - /* 359 */ "expression ::= case_when_expression", - /* 360 */ "expression ::= NK_LP expression NK_RP", - /* 361 */ "expression ::= NK_PLUS expr_or_subquery", - /* 362 */ "expression ::= NK_MINUS expr_or_subquery", - /* 363 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 364 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 365 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 366 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 367 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 368 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 369 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 370 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 371 */ "expression_list ::= expr_or_subquery", - /* 372 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 373 */ "column_reference ::= column_name", - /* 374 */ "column_reference ::= table_name NK_DOT column_name", - /* 375 */ "pseudo_column ::= ROWTS", - /* 376 */ "pseudo_column ::= TBNAME", - /* 377 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 378 */ "pseudo_column ::= QSTART", - /* 379 */ "pseudo_column ::= QEND", - /* 380 */ "pseudo_column ::= QDURATION", - /* 381 */ "pseudo_column ::= WSTART", - /* 382 */ "pseudo_column ::= WEND", - /* 383 */ "pseudo_column ::= WDURATION", - /* 384 */ "pseudo_column ::= IROWTS", - /* 385 */ "pseudo_column ::= QTAGS", - /* 386 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 387 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 388 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 389 */ "function_expression ::= literal_func", - /* 390 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 391 */ "literal_func ::= NOW", - /* 392 */ "noarg_func ::= NOW", - /* 393 */ "noarg_func ::= TODAY", - /* 394 */ "noarg_func ::= TIMEZONE", - /* 395 */ "noarg_func ::= DATABASE", - /* 396 */ "noarg_func ::= CLIENT_VERSION", - /* 397 */ "noarg_func ::= SERVER_VERSION", - /* 398 */ "noarg_func ::= SERVER_STATUS", - /* 399 */ "noarg_func ::= CURRENT_USER", - /* 400 */ "noarg_func ::= USER", - /* 401 */ "star_func ::= COUNT", - /* 402 */ "star_func ::= FIRST", - /* 403 */ "star_func ::= LAST", - /* 404 */ "star_func ::= LAST_ROW", - /* 405 */ "star_func_para_list ::= NK_STAR", - /* 406 */ "star_func_para_list ::= other_para_list", - /* 407 */ "other_para_list ::= star_func_para", - /* 408 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 409 */ "star_func_para ::= expr_or_subquery", - /* 410 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 411 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 412 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 413 */ "when_then_list ::= when_then_expr", - /* 414 */ "when_then_list ::= when_then_list when_then_expr", - /* 415 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 416 */ "case_when_else_opt ::=", - /* 417 */ "case_when_else_opt ::= ELSE common_expression", - /* 418 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 419 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 420 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 421 */ "predicate ::= expr_or_subquery IS NULL", - /* 422 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 423 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 424 */ "compare_op ::= NK_LT", - /* 425 */ "compare_op ::= NK_GT", - /* 426 */ "compare_op ::= NK_LE", - /* 427 */ "compare_op ::= NK_GE", - /* 428 */ "compare_op ::= NK_NE", - /* 429 */ "compare_op ::= NK_EQ", - /* 430 */ "compare_op ::= LIKE", - /* 431 */ "compare_op ::= NOT LIKE", - /* 432 */ "compare_op ::= MATCH", - /* 433 */ "compare_op ::= NMATCH", - /* 434 */ "compare_op ::= CONTAINS", - /* 435 */ "in_op ::= IN", - /* 436 */ "in_op ::= NOT IN", - /* 437 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 438 */ "boolean_value_expression ::= boolean_primary", - /* 439 */ "boolean_value_expression ::= NOT boolean_primary", - /* 440 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 441 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 442 */ "boolean_primary ::= predicate", - /* 443 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 444 */ "common_expression ::= expr_or_subquery", - /* 445 */ "common_expression ::= boolean_value_expression", - /* 446 */ "from_clause_opt ::=", - /* 447 */ "from_clause_opt ::= FROM table_reference_list", - /* 448 */ "table_reference_list ::= table_reference", - /* 449 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 450 */ "table_reference ::= table_primary", - /* 451 */ "table_reference ::= joined_table", - /* 452 */ "table_primary ::= table_name alias_opt", - /* 453 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 454 */ "table_primary ::= subquery alias_opt", - /* 455 */ "table_primary ::= parenthesized_joined_table", - /* 456 */ "alias_opt ::=", - /* 457 */ "alias_opt ::= table_alias", - /* 458 */ "alias_opt ::= AS table_alias", - /* 459 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 460 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 461 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 462 */ "join_type ::=", - /* 463 */ "join_type ::= INNER", - /* 464 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 465 */ "set_quantifier_opt ::=", - /* 466 */ "set_quantifier_opt ::= DISTINCT", - /* 467 */ "set_quantifier_opt ::= ALL", - /* 468 */ "select_list ::= select_item", - /* 469 */ "select_list ::= select_list NK_COMMA select_item", - /* 470 */ "select_item ::= NK_STAR", - /* 471 */ "select_item ::= common_expression", - /* 472 */ "select_item ::= common_expression column_alias", - /* 473 */ "select_item ::= common_expression AS column_alias", - /* 474 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 475 */ "where_clause_opt ::=", - /* 476 */ "where_clause_opt ::= WHERE search_condition", - /* 477 */ "partition_by_clause_opt ::=", - /* 478 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 479 */ "partition_list ::= partition_item", - /* 480 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 481 */ "partition_item ::= expr_or_subquery", - /* 482 */ "partition_item ::= expr_or_subquery column_alias", - /* 483 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 484 */ "twindow_clause_opt ::=", - /* 485 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 486 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 487 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 488 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 489 */ "sliding_opt ::=", - /* 490 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 491 */ "fill_opt ::=", - /* 492 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 493 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 494 */ "fill_mode ::= NONE", - /* 495 */ "fill_mode ::= PREV", - /* 496 */ "fill_mode ::= NULL", - /* 497 */ "fill_mode ::= LINEAR", - /* 498 */ "fill_mode ::= NEXT", - /* 499 */ "group_by_clause_opt ::=", - /* 500 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 501 */ "group_by_list ::= expr_or_subquery", - /* 502 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 503 */ "having_clause_opt ::=", - /* 504 */ "having_clause_opt ::= HAVING search_condition", - /* 505 */ "range_opt ::=", - /* 506 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 507 */ "every_opt ::=", - /* 508 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 509 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 510 */ "query_simple ::= query_specification", - /* 511 */ "query_simple ::= union_query_expression", - /* 512 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 513 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 514 */ "query_simple_or_subquery ::= query_simple", - /* 515 */ "query_simple_or_subquery ::= subquery", - /* 516 */ "query_or_subquery ::= query_expression", - /* 517 */ "query_or_subquery ::= subquery", - /* 518 */ "order_by_clause_opt ::=", - /* 519 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 520 */ "slimit_clause_opt ::=", - /* 521 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 522 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 523 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 524 */ "limit_clause_opt ::=", - /* 525 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 526 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 527 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 528 */ "subquery ::= NK_LP query_expression NK_RP", - /* 529 */ "subquery ::= NK_LP subquery NK_RP", - /* 530 */ "search_condition ::= common_expression", - /* 531 */ "sort_specification_list ::= sort_specification", - /* 532 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 533 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 534 */ "ordering_specification_opt ::=", - /* 535 */ "ordering_specification_opt ::= ASC", - /* 536 */ "ordering_specification_opt ::= DESC", - /* 537 */ "null_ordering_opt ::=", - /* 538 */ "null_ordering_opt ::= NULLS FIRST", - /* 539 */ "null_ordering_opt ::= NULLS LAST", + /* 92 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 93 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 94 */ "db_options ::= db_options RETENTIONS retention_list", + /* 95 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 96 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", + /* 97 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", + /* 98 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", + /* 99 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 100 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", + /* 101 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 102 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", + /* 103 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", + /* 104 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", + /* 105 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER", + /* 106 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER", + /* 107 */ "alter_db_options ::= alter_db_option", + /* 108 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 109 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 110 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 111 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 112 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", + /* 113 */ "alter_db_option ::= KEEP integer_list", + /* 114 */ "alter_db_option ::= KEEP variable_list", + /* 115 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 116 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 117 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", + /* 118 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", + /* 119 */ "integer_list ::= NK_INTEGER", + /* 120 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 121 */ "variable_list ::= NK_VARIABLE", + /* 122 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 123 */ "retention_list ::= retention", + /* 124 */ "retention_list ::= retention_list NK_COMMA retention", + /* 125 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 126 */ "speed_opt ::=", + /* 127 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 128 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 129 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 130 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 131 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 132 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 133 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 134 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 135 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 136 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 137 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 138 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 139 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 140 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 141 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 142 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 143 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 144 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 145 */ "multi_create_clause ::= create_subtable_clause", + /* 146 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 147 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", + /* 148 */ "multi_drop_clause ::= drop_table_clause", + /* 149 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 150 */ "drop_table_clause ::= exists_opt full_table_name", + /* 151 */ "specific_cols_opt ::=", + /* 152 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 153 */ "full_table_name ::= table_name", + /* 154 */ "full_table_name ::= db_name NK_DOT table_name", + /* 155 */ "column_def_list ::= column_def", + /* 156 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 157 */ "column_def ::= column_name type_name", + /* 158 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 159 */ "type_name ::= BOOL", + /* 160 */ "type_name ::= TINYINT", + /* 161 */ "type_name ::= SMALLINT", + /* 162 */ "type_name ::= INT", + /* 163 */ "type_name ::= INTEGER", + /* 164 */ "type_name ::= BIGINT", + /* 165 */ "type_name ::= FLOAT", + /* 166 */ "type_name ::= DOUBLE", + /* 167 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 168 */ "type_name ::= TIMESTAMP", + /* 169 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 170 */ "type_name ::= TINYINT UNSIGNED", + /* 171 */ "type_name ::= SMALLINT UNSIGNED", + /* 172 */ "type_name ::= INT UNSIGNED", + /* 173 */ "type_name ::= BIGINT UNSIGNED", + /* 174 */ "type_name ::= JSON", + /* 175 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 176 */ "type_name ::= MEDIUMBLOB", + /* 177 */ "type_name ::= BLOB", + /* 178 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 179 */ "type_name ::= DECIMAL", + /* 180 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 181 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 182 */ "tags_def_opt ::=", + /* 183 */ "tags_def_opt ::= tags_def", + /* 184 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 185 */ "table_options ::=", + /* 186 */ "table_options ::= table_options COMMENT NK_STRING", + /* 187 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 188 */ "table_options ::= table_options WATERMARK duration_list", + /* 189 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 190 */ "table_options ::= table_options TTL NK_INTEGER", + /* 191 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 192 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 193 */ "alter_table_options ::= alter_table_option", + /* 194 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 195 */ "alter_table_option ::= COMMENT NK_STRING", + /* 196 */ "alter_table_option ::= TTL NK_INTEGER", + /* 197 */ "duration_list ::= duration_literal", + /* 198 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 199 */ "rollup_func_list ::= rollup_func_name", + /* 200 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 201 */ "rollup_func_name ::= function_name", + /* 202 */ "rollup_func_name ::= FIRST", + /* 203 */ "rollup_func_name ::= LAST", + /* 204 */ "col_name_list ::= col_name", + /* 205 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 206 */ "col_name ::= column_name", + /* 207 */ "cmd ::= SHOW DNODES", + /* 208 */ "cmd ::= SHOW USERS", + /* 209 */ "cmd ::= SHOW USER PRIVILEGES", + /* 210 */ "cmd ::= SHOW DATABASES", + /* 211 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 212 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 213 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 214 */ "cmd ::= SHOW MNODES", + /* 215 */ "cmd ::= SHOW QNODES", + /* 216 */ "cmd ::= SHOW FUNCTIONS", + /* 217 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 218 */ "cmd ::= SHOW STREAMS", + /* 219 */ "cmd ::= SHOW ACCOUNTS", + /* 220 */ "cmd ::= SHOW APPS", + /* 221 */ "cmd ::= SHOW CONNECTIONS", + /* 222 */ "cmd ::= SHOW LICENCES", + /* 223 */ "cmd ::= SHOW GRANTS", + /* 224 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 225 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 226 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 227 */ "cmd ::= SHOW QUERIES", + /* 228 */ "cmd ::= SHOW SCORES", + /* 229 */ "cmd ::= SHOW TOPICS", + /* 230 */ "cmd ::= SHOW VARIABLES", + /* 231 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 232 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 233 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 234 */ "cmd ::= SHOW BNODES", + /* 235 */ "cmd ::= SHOW SNODES", + /* 236 */ "cmd ::= SHOW CLUSTER", + /* 237 */ "cmd ::= SHOW TRANSACTIONS", + /* 238 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 239 */ "cmd ::= SHOW CONSUMERS", + /* 240 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 241 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 242 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 243 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 244 */ "cmd ::= SHOW VNODES NK_STRING", + /* 245 */ "db_name_cond_opt ::=", + /* 246 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 247 */ "like_pattern_opt ::=", + /* 248 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 249 */ "table_name_cond ::= table_name", + /* 250 */ "from_db_opt ::=", + /* 251 */ "from_db_opt ::= FROM db_name", + /* 252 */ "tag_list_opt ::=", + /* 253 */ "tag_list_opt ::= tag_item", + /* 254 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 255 */ "tag_item ::= TBNAME", + /* 256 */ "tag_item ::= QTAGS", + /* 257 */ "tag_item ::= column_name", + /* 258 */ "tag_item ::= column_name column_alias", + /* 259 */ "tag_item ::= column_name AS column_alias", + /* 260 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", + /* 261 */ "cmd ::= DROP INDEX exists_opt full_table_name", + /* 262 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 263 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", + /* 264 */ "func_list ::= func", + /* 265 */ "func_list ::= func_list NK_COMMA func", + /* 266 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 267 */ "sma_stream_opt ::=", + /* 268 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 269 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 270 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 271 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 272 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 273 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 274 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 275 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 276 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 277 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 278 */ "cmd ::= DESC full_table_name", + /* 279 */ "cmd ::= DESCRIBE full_table_name", + /* 280 */ "cmd ::= RESET QUERY CACHE", + /* 281 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 282 */ "analyze_opt ::=", + /* 283 */ "analyze_opt ::= ANALYZE", + /* 284 */ "explain_options ::=", + /* 285 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 286 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 287 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 288 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 289 */ "agg_func_opt ::=", + /* 290 */ "agg_func_opt ::= AGGREGATE", + /* 291 */ "bufsize_opt ::=", + /* 292 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 293 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", + /* 294 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 295 */ "stream_options ::=", + /* 296 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 297 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 298 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 299 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 300 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 301 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 302 */ "subtable_opt ::=", + /* 303 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 304 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 305 */ "cmd ::= KILL QUERY NK_STRING", + /* 306 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 307 */ "cmd ::= BALANCE VGROUP", + /* 308 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 309 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 310 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 311 */ "dnode_list ::= DNODE NK_INTEGER", + /* 312 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 313 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 314 */ "cmd ::= query_or_subquery", + /* 315 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 316 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", + /* 317 */ "literal ::= NK_INTEGER", + /* 318 */ "literal ::= NK_FLOAT", + /* 319 */ "literal ::= NK_STRING", + /* 320 */ "literal ::= NK_BOOL", + /* 321 */ "literal ::= TIMESTAMP NK_STRING", + /* 322 */ "literal ::= duration_literal", + /* 323 */ "literal ::= NULL", + /* 324 */ "literal ::= NK_QUESTION", + /* 325 */ "duration_literal ::= NK_VARIABLE", + /* 326 */ "signed ::= NK_INTEGER", + /* 327 */ "signed ::= NK_PLUS NK_INTEGER", + /* 328 */ "signed ::= NK_MINUS NK_INTEGER", + /* 329 */ "signed ::= NK_FLOAT", + /* 330 */ "signed ::= NK_PLUS NK_FLOAT", + /* 331 */ "signed ::= NK_MINUS NK_FLOAT", + /* 332 */ "signed_literal ::= signed", + /* 333 */ "signed_literal ::= NK_STRING", + /* 334 */ "signed_literal ::= NK_BOOL", + /* 335 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 336 */ "signed_literal ::= duration_literal", + /* 337 */ "signed_literal ::= NULL", + /* 338 */ "signed_literal ::= literal_func", + /* 339 */ "signed_literal ::= NK_QUESTION", + /* 340 */ "literal_list ::= signed_literal", + /* 341 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 342 */ "db_name ::= NK_ID", + /* 343 */ "table_name ::= NK_ID", + /* 344 */ "column_name ::= NK_ID", + /* 345 */ "function_name ::= NK_ID", + /* 346 */ "table_alias ::= NK_ID", + /* 347 */ "column_alias ::= NK_ID", + /* 348 */ "user_name ::= NK_ID", + /* 349 */ "topic_name ::= NK_ID", + /* 350 */ "stream_name ::= NK_ID", + /* 351 */ "cgroup_name ::= NK_ID", + /* 352 */ "expr_or_subquery ::= expression", + /* 353 */ "expression ::= literal", + /* 354 */ "expression ::= pseudo_column", + /* 355 */ "expression ::= column_reference", + /* 356 */ "expression ::= function_expression", + /* 357 */ "expression ::= case_when_expression", + /* 358 */ "expression ::= NK_LP expression NK_RP", + /* 359 */ "expression ::= NK_PLUS expr_or_subquery", + /* 360 */ "expression ::= NK_MINUS expr_or_subquery", + /* 361 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 362 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 363 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 364 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 365 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 366 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 367 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 368 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 369 */ "expression_list ::= expr_or_subquery", + /* 370 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 371 */ "column_reference ::= column_name", + /* 372 */ "column_reference ::= table_name NK_DOT column_name", + /* 373 */ "pseudo_column ::= ROWTS", + /* 374 */ "pseudo_column ::= TBNAME", + /* 375 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 376 */ "pseudo_column ::= QSTART", + /* 377 */ "pseudo_column ::= QEND", + /* 378 */ "pseudo_column ::= QDURATION", + /* 379 */ "pseudo_column ::= WSTART", + /* 380 */ "pseudo_column ::= WEND", + /* 381 */ "pseudo_column ::= WDURATION", + /* 382 */ "pseudo_column ::= IROWTS", + /* 383 */ "pseudo_column ::= QTAGS", + /* 384 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 385 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 386 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 387 */ "function_expression ::= literal_func", + /* 388 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 389 */ "literal_func ::= NOW", + /* 390 */ "noarg_func ::= NOW", + /* 391 */ "noarg_func ::= TODAY", + /* 392 */ "noarg_func ::= TIMEZONE", + /* 393 */ "noarg_func ::= DATABASE", + /* 394 */ "noarg_func ::= CLIENT_VERSION", + /* 395 */ "noarg_func ::= SERVER_VERSION", + /* 396 */ "noarg_func ::= SERVER_STATUS", + /* 397 */ "noarg_func ::= CURRENT_USER", + /* 398 */ "noarg_func ::= USER", + /* 399 */ "star_func ::= COUNT", + /* 400 */ "star_func ::= FIRST", + /* 401 */ "star_func ::= LAST", + /* 402 */ "star_func ::= LAST_ROW", + /* 403 */ "star_func_para_list ::= NK_STAR", + /* 404 */ "star_func_para_list ::= other_para_list", + /* 405 */ "other_para_list ::= star_func_para", + /* 406 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 407 */ "star_func_para ::= expr_or_subquery", + /* 408 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 409 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 410 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 411 */ "when_then_list ::= when_then_expr", + /* 412 */ "when_then_list ::= when_then_list when_then_expr", + /* 413 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 414 */ "case_when_else_opt ::=", + /* 415 */ "case_when_else_opt ::= ELSE common_expression", + /* 416 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 417 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 418 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 419 */ "predicate ::= expr_or_subquery IS NULL", + /* 420 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 421 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 422 */ "compare_op ::= NK_LT", + /* 423 */ "compare_op ::= NK_GT", + /* 424 */ "compare_op ::= NK_LE", + /* 425 */ "compare_op ::= NK_GE", + /* 426 */ "compare_op ::= NK_NE", + /* 427 */ "compare_op ::= NK_EQ", + /* 428 */ "compare_op ::= LIKE", + /* 429 */ "compare_op ::= NOT LIKE", + /* 430 */ "compare_op ::= MATCH", + /* 431 */ "compare_op ::= NMATCH", + /* 432 */ "compare_op ::= CONTAINS", + /* 433 */ "in_op ::= IN", + /* 434 */ "in_op ::= NOT IN", + /* 435 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 436 */ "boolean_value_expression ::= boolean_primary", + /* 437 */ "boolean_value_expression ::= NOT boolean_primary", + /* 438 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 439 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 440 */ "boolean_primary ::= predicate", + /* 441 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 442 */ "common_expression ::= expr_or_subquery", + /* 443 */ "common_expression ::= boolean_value_expression", + /* 444 */ "from_clause_opt ::=", + /* 445 */ "from_clause_opt ::= FROM table_reference_list", + /* 446 */ "table_reference_list ::= table_reference", + /* 447 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 448 */ "table_reference ::= table_primary", + /* 449 */ "table_reference ::= joined_table", + /* 450 */ "table_primary ::= table_name alias_opt", + /* 451 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 452 */ "table_primary ::= subquery alias_opt", + /* 453 */ "table_primary ::= parenthesized_joined_table", + /* 454 */ "alias_opt ::=", + /* 455 */ "alias_opt ::= table_alias", + /* 456 */ "alias_opt ::= AS table_alias", + /* 457 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 458 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 459 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 460 */ "join_type ::=", + /* 461 */ "join_type ::= INNER", + /* 462 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 463 */ "set_quantifier_opt ::=", + /* 464 */ "set_quantifier_opt ::= DISTINCT", + /* 465 */ "set_quantifier_opt ::= ALL", + /* 466 */ "select_list ::= select_item", + /* 467 */ "select_list ::= select_list NK_COMMA select_item", + /* 468 */ "select_item ::= NK_STAR", + /* 469 */ "select_item ::= common_expression", + /* 470 */ "select_item ::= common_expression column_alias", + /* 471 */ "select_item ::= common_expression AS column_alias", + /* 472 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 473 */ "where_clause_opt ::=", + /* 474 */ "where_clause_opt ::= WHERE search_condition", + /* 475 */ "partition_by_clause_opt ::=", + /* 476 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 477 */ "partition_list ::= partition_item", + /* 478 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 479 */ "partition_item ::= expr_or_subquery", + /* 480 */ "partition_item ::= expr_or_subquery column_alias", + /* 481 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 482 */ "twindow_clause_opt ::=", + /* 483 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 484 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 485 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 486 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 487 */ "sliding_opt ::=", + /* 488 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 489 */ "fill_opt ::=", + /* 490 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 491 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 492 */ "fill_mode ::= NONE", + /* 493 */ "fill_mode ::= PREV", + /* 494 */ "fill_mode ::= NULL", + /* 495 */ "fill_mode ::= LINEAR", + /* 496 */ "fill_mode ::= NEXT", + /* 497 */ "group_by_clause_opt ::=", + /* 498 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 499 */ "group_by_list ::= expr_or_subquery", + /* 500 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 501 */ "having_clause_opt ::=", + /* 502 */ "having_clause_opt ::= HAVING search_condition", + /* 503 */ "range_opt ::=", + /* 504 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 505 */ "every_opt ::=", + /* 506 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 507 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 508 */ "query_simple ::= query_specification", + /* 509 */ "query_simple ::= union_query_expression", + /* 510 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 511 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 512 */ "query_simple_or_subquery ::= query_simple", + /* 513 */ "query_simple_or_subquery ::= subquery", + /* 514 */ "query_or_subquery ::= query_expression", + /* 515 */ "query_or_subquery ::= subquery", + /* 516 */ "order_by_clause_opt ::=", + /* 517 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 518 */ "slimit_clause_opt ::=", + /* 519 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 520 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 521 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 522 */ "limit_clause_opt ::=", + /* 523 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 524 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 525 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 526 */ "subquery ::= NK_LP query_expression NK_RP", + /* 527 */ "subquery ::= NK_LP subquery NK_RP", + /* 528 */ "search_condition ::= common_expression", + /* 529 */ "sort_specification_list ::= sort_specification", + /* 530 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 531 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 532 */ "ordering_specification_opt ::=", + /* 533 */ "ordering_specification_opt ::= ASC", + /* 534 */ "ordering_specification_opt ::= DESC", + /* 535 */ "null_ordering_opt ::=", + /* 536 */ "null_ordering_opt ::= NULLS FIRST", + /* 537 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3039,454 +3079,452 @@ static const struct { { 338, -3 }, /* (89) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ { 338, -3 }, /* (90) db_options ::= db_options PRECISION NK_STRING */ { 338, -3 }, /* (91) db_options ::= db_options REPLICA NK_INTEGER */ - { 338, -3 }, /* (92) db_options ::= db_options STRICT NK_STRING */ - { 338, -3 }, /* (93) db_options ::= db_options VGROUPS NK_INTEGER */ - { 338, -3 }, /* (94) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 338, -3 }, /* (95) db_options ::= db_options RETENTIONS retention_list */ - { 338, -3 }, /* (96) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 338, -3 }, /* (97) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - { 338, -3 }, /* (98) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - { 338, -3 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { 338, -4 }, /* (100) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - { 338, -3 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { 338, -4 }, /* (102) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - { 338, -3 }, /* (103) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { 338, -3 }, /* (104) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { 338, -3 }, /* (105) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - { 338, -3 }, /* (106) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ - { 338, -3 }, /* (107) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ - { 340, -1 }, /* (108) alter_db_options ::= alter_db_option */ - { 340, -2 }, /* (109) alter_db_options ::= alter_db_options alter_db_option */ - { 345, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ - { 345, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ - { 345, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 345, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 345, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ - { 345, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ - { 345, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ - { 345, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ - { 345, -2 }, /* (118) alter_db_option ::= STRICT NK_STRING */ - { 345, -2 }, /* (119) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 345, -2 }, /* (120) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 342, -1 }, /* (121) integer_list ::= NK_INTEGER */ - { 342, -3 }, /* (122) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 343, -1 }, /* (123) variable_list ::= NK_VARIABLE */ - { 343, -3 }, /* (124) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 344, -1 }, /* (125) retention_list ::= retention */ - { 344, -3 }, /* (126) retention_list ::= retention_list NK_COMMA retention */ - { 346, -3 }, /* (127) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 341, 0 }, /* (128) speed_opt ::= */ - { 341, -2 }, /* (129) speed_opt ::= MAX_SPEED NK_INTEGER */ - { 322, -9 }, /* (130) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 322, -3 }, /* (131) cmd ::= CREATE TABLE multi_create_clause */ - { 322, -9 }, /* (132) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 322, -3 }, /* (133) cmd ::= DROP TABLE multi_drop_clause */ - { 322, -4 }, /* (134) cmd ::= DROP STABLE exists_opt full_table_name */ - { 322, -3 }, /* (135) cmd ::= ALTER TABLE alter_table_clause */ - { 322, -3 }, /* (136) cmd ::= ALTER STABLE alter_table_clause */ - { 354, -2 }, /* (137) alter_table_clause ::= full_table_name alter_table_options */ - { 354, -5 }, /* (138) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 354, -4 }, /* (139) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 354, -5 }, /* (140) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 354, -5 }, /* (141) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 354, -5 }, /* (142) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 354, -4 }, /* (143) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 354, -5 }, /* (144) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 354, -5 }, /* (145) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 354, -6 }, /* (146) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 351, -1 }, /* (147) multi_create_clause ::= create_subtable_clause */ - { 351, -2 }, /* (148) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 359, -10 }, /* (149) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - { 353, -1 }, /* (150) multi_drop_clause ::= drop_table_clause */ - { 353, -2 }, /* (151) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 362, -2 }, /* (152) drop_table_clause ::= exists_opt full_table_name */ - { 360, 0 }, /* (153) specific_cols_opt ::= */ - { 360, -3 }, /* (154) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 347, -1 }, /* (155) full_table_name ::= table_name */ - { 347, -3 }, /* (156) full_table_name ::= db_name NK_DOT table_name */ - { 348, -1 }, /* (157) column_def_list ::= column_def */ - { 348, -3 }, /* (158) column_def_list ::= column_def_list NK_COMMA column_def */ - { 365, -2 }, /* (159) column_def ::= column_name type_name */ - { 365, -4 }, /* (160) column_def ::= column_name type_name COMMENT NK_STRING */ - { 357, -1 }, /* (161) type_name ::= BOOL */ - { 357, -1 }, /* (162) type_name ::= TINYINT */ - { 357, -1 }, /* (163) type_name ::= SMALLINT */ - { 357, -1 }, /* (164) type_name ::= INT */ - { 357, -1 }, /* (165) type_name ::= INTEGER */ - { 357, -1 }, /* (166) type_name ::= BIGINT */ - { 357, -1 }, /* (167) type_name ::= FLOAT */ - { 357, -1 }, /* (168) type_name ::= DOUBLE */ - { 357, -4 }, /* (169) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 357, -1 }, /* (170) type_name ::= TIMESTAMP */ - { 357, -4 }, /* (171) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 357, -2 }, /* (172) type_name ::= TINYINT UNSIGNED */ - { 357, -2 }, /* (173) type_name ::= SMALLINT UNSIGNED */ - { 357, -2 }, /* (174) type_name ::= INT UNSIGNED */ - { 357, -2 }, /* (175) type_name ::= BIGINT UNSIGNED */ - { 357, -1 }, /* (176) type_name ::= JSON */ - { 357, -4 }, /* (177) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 357, -1 }, /* (178) type_name ::= MEDIUMBLOB */ - { 357, -1 }, /* (179) type_name ::= BLOB */ - { 357, -4 }, /* (180) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 357, -1 }, /* (181) type_name ::= DECIMAL */ - { 357, -4 }, /* (182) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 357, -6 }, /* (183) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 349, 0 }, /* (184) tags_def_opt ::= */ - { 349, -1 }, /* (185) tags_def_opt ::= tags_def */ - { 352, -4 }, /* (186) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 350, 0 }, /* (187) table_options ::= */ - { 350, -3 }, /* (188) table_options ::= table_options COMMENT NK_STRING */ - { 350, -3 }, /* (189) table_options ::= table_options MAX_DELAY duration_list */ - { 350, -3 }, /* (190) table_options ::= table_options WATERMARK duration_list */ - { 350, -5 }, /* (191) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 350, -3 }, /* (192) table_options ::= table_options TTL NK_INTEGER */ - { 350, -5 }, /* (193) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 350, -3 }, /* (194) table_options ::= table_options DELETE_MARK duration_list */ - { 355, -1 }, /* (195) alter_table_options ::= alter_table_option */ - { 355, -2 }, /* (196) alter_table_options ::= alter_table_options alter_table_option */ - { 368, -2 }, /* (197) alter_table_option ::= COMMENT NK_STRING */ - { 368, -2 }, /* (198) alter_table_option ::= TTL NK_INTEGER */ - { 366, -1 }, /* (199) duration_list ::= duration_literal */ - { 366, -3 }, /* (200) duration_list ::= duration_list NK_COMMA duration_literal */ - { 367, -1 }, /* (201) rollup_func_list ::= rollup_func_name */ - { 367, -3 }, /* (202) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 370, -1 }, /* (203) rollup_func_name ::= function_name */ - { 370, -1 }, /* (204) rollup_func_name ::= FIRST */ - { 370, -1 }, /* (205) rollup_func_name ::= LAST */ - { 363, -1 }, /* (206) col_name_list ::= col_name */ - { 363, -3 }, /* (207) col_name_list ::= col_name_list NK_COMMA col_name */ - { 372, -1 }, /* (208) col_name ::= column_name */ - { 322, -2 }, /* (209) cmd ::= SHOW DNODES */ - { 322, -2 }, /* (210) cmd ::= SHOW USERS */ - { 322, -3 }, /* (211) cmd ::= SHOW USER PRIVILEGES */ - { 322, -2 }, /* (212) cmd ::= SHOW DATABASES */ - { 322, -4 }, /* (213) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 322, -4 }, /* (214) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 322, -3 }, /* (215) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 322, -2 }, /* (216) cmd ::= SHOW MNODES */ - { 322, -2 }, /* (217) cmd ::= SHOW QNODES */ - { 322, -2 }, /* (218) cmd ::= SHOW FUNCTIONS */ - { 322, -5 }, /* (219) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 322, -2 }, /* (220) cmd ::= SHOW STREAMS */ - { 322, -2 }, /* (221) cmd ::= SHOW ACCOUNTS */ - { 322, -2 }, /* (222) cmd ::= SHOW APPS */ - { 322, -2 }, /* (223) cmd ::= SHOW CONNECTIONS */ - { 322, -2 }, /* (224) cmd ::= SHOW LICENCES */ - { 322, -2 }, /* (225) cmd ::= SHOW GRANTS */ - { 322, -4 }, /* (226) cmd ::= SHOW CREATE DATABASE db_name */ - { 322, -4 }, /* (227) cmd ::= SHOW CREATE TABLE full_table_name */ - { 322, -4 }, /* (228) cmd ::= SHOW CREATE STABLE full_table_name */ - { 322, -2 }, /* (229) cmd ::= SHOW QUERIES */ - { 322, -2 }, /* (230) cmd ::= SHOW SCORES */ - { 322, -2 }, /* (231) cmd ::= SHOW TOPICS */ - { 322, -2 }, /* (232) cmd ::= SHOW VARIABLES */ - { 322, -3 }, /* (233) cmd ::= SHOW CLUSTER VARIABLES */ - { 322, -3 }, /* (234) cmd ::= SHOW LOCAL VARIABLES */ - { 322, -5 }, /* (235) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - { 322, -2 }, /* (236) cmd ::= SHOW BNODES */ - { 322, -2 }, /* (237) cmd ::= SHOW SNODES */ - { 322, -2 }, /* (238) cmd ::= SHOW CLUSTER */ - { 322, -2 }, /* (239) cmd ::= SHOW TRANSACTIONS */ - { 322, -4 }, /* (240) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 322, -2 }, /* (241) cmd ::= SHOW CONSUMERS */ - { 322, -2 }, /* (242) cmd ::= SHOW SUBSCRIPTIONS */ - { 322, -5 }, /* (243) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 322, -7 }, /* (244) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { 322, -3 }, /* (245) cmd ::= SHOW VNODES NK_INTEGER */ - { 322, -3 }, /* (246) cmd ::= SHOW VNODES NK_STRING */ - { 373, 0 }, /* (247) db_name_cond_opt ::= */ - { 373, -2 }, /* (248) db_name_cond_opt ::= db_name NK_DOT */ - { 374, 0 }, /* (249) like_pattern_opt ::= */ - { 374, -2 }, /* (250) like_pattern_opt ::= LIKE NK_STRING */ - { 375, -1 }, /* (251) table_name_cond ::= table_name */ - { 376, 0 }, /* (252) from_db_opt ::= */ - { 376, -2 }, /* (253) from_db_opt ::= FROM db_name */ - { 377, 0 }, /* (254) tag_list_opt ::= */ - { 377, -1 }, /* (255) tag_list_opt ::= tag_item */ - { 377, -3 }, /* (256) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - { 378, -1 }, /* (257) tag_item ::= TBNAME */ - { 378, -1 }, /* (258) tag_item ::= QTAGS */ - { 378, -1 }, /* (259) tag_item ::= column_name */ - { 378, -2 }, /* (260) tag_item ::= column_name column_alias */ - { 378, -3 }, /* (261) tag_item ::= column_name AS column_alias */ - { 322, -8 }, /* (262) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ - { 322, -4 }, /* (263) cmd ::= DROP INDEX exists_opt full_table_name */ - { 380, -10 }, /* (264) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 380, -12 }, /* (265) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 381, -1 }, /* (266) func_list ::= func */ - { 381, -3 }, /* (267) func_list ::= func_list NK_COMMA func */ - { 384, -4 }, /* (268) func ::= function_name NK_LP expression_list NK_RP */ - { 383, 0 }, /* (269) sma_stream_opt ::= */ - { 383, -3 }, /* (270) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { 383, -3 }, /* (271) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { 383, -3 }, /* (272) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { 322, -6 }, /* (273) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 322, -7 }, /* (274) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 322, -9 }, /* (275) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 322, -7 }, /* (276) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 322, -9 }, /* (277) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 322, -4 }, /* (278) cmd ::= DROP TOPIC exists_opt topic_name */ - { 322, -7 }, /* (279) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 322, -2 }, /* (280) cmd ::= DESC full_table_name */ - { 322, -2 }, /* (281) cmd ::= DESCRIBE full_table_name */ - { 322, -3 }, /* (282) cmd ::= RESET QUERY CACHE */ - { 322, -4 }, /* (283) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 387, 0 }, /* (284) analyze_opt ::= */ - { 387, -1 }, /* (285) analyze_opt ::= ANALYZE */ - { 388, 0 }, /* (286) explain_options ::= */ - { 388, -3 }, /* (287) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 388, -3 }, /* (288) explain_options ::= explain_options RATIO NK_FLOAT */ - { 322, -10 }, /* (289) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 322, -4 }, /* (290) cmd ::= DROP FUNCTION exists_opt function_name */ - { 389, 0 }, /* (291) agg_func_opt ::= */ - { 389, -1 }, /* (292) agg_func_opt ::= AGGREGATE */ - { 390, 0 }, /* (293) bufsize_opt ::= */ - { 390, -2 }, /* (294) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 322, -11 }, /* (295) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ - { 322, -4 }, /* (296) cmd ::= DROP STREAM exists_opt stream_name */ - { 392, 0 }, /* (297) stream_options ::= */ - { 392, -3 }, /* (298) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 392, -3 }, /* (299) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 392, -4 }, /* (300) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 392, -3 }, /* (301) stream_options ::= stream_options WATERMARK duration_literal */ - { 392, -4 }, /* (302) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 392, -3 }, /* (303) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { 393, 0 }, /* (304) subtable_opt ::= */ - { 393, -4 }, /* (305) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 322, -3 }, /* (306) cmd ::= KILL CONNECTION NK_INTEGER */ - { 322, -3 }, /* (307) cmd ::= KILL QUERY NK_STRING */ - { 322, -3 }, /* (308) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 322, -2 }, /* (309) cmd ::= BALANCE VGROUP */ - { 322, -4 }, /* (310) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 322, -4 }, /* (311) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 322, -3 }, /* (312) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 395, -2 }, /* (313) dnode_list ::= DNODE NK_INTEGER */ - { 395, -3 }, /* (314) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 322, -4 }, /* (315) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 322, -1 }, /* (316) cmd ::= query_or_subquery */ - { 322, -7 }, /* (317) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 322, -4 }, /* (318) cmd ::= INSERT INTO full_table_name query_or_subquery */ - { 325, -1 }, /* (319) literal ::= NK_INTEGER */ - { 325, -1 }, /* (320) literal ::= NK_FLOAT */ - { 325, -1 }, /* (321) literal ::= NK_STRING */ - { 325, -1 }, /* (322) literal ::= NK_BOOL */ - { 325, -2 }, /* (323) literal ::= TIMESTAMP NK_STRING */ - { 325, -1 }, /* (324) literal ::= duration_literal */ - { 325, -1 }, /* (325) literal ::= NULL */ - { 325, -1 }, /* (326) literal ::= NK_QUESTION */ - { 369, -1 }, /* (327) duration_literal ::= NK_VARIABLE */ - { 397, -1 }, /* (328) signed ::= NK_INTEGER */ - { 397, -2 }, /* (329) signed ::= NK_PLUS NK_INTEGER */ - { 397, -2 }, /* (330) signed ::= NK_MINUS NK_INTEGER */ - { 397, -1 }, /* (331) signed ::= NK_FLOAT */ - { 397, -2 }, /* (332) signed ::= NK_PLUS NK_FLOAT */ - { 397, -2 }, /* (333) signed ::= NK_MINUS NK_FLOAT */ - { 358, -1 }, /* (334) signed_literal ::= signed */ - { 358, -1 }, /* (335) signed_literal ::= NK_STRING */ - { 358, -1 }, /* (336) signed_literal ::= NK_BOOL */ - { 358, -2 }, /* (337) signed_literal ::= TIMESTAMP NK_STRING */ - { 358, -1 }, /* (338) signed_literal ::= duration_literal */ - { 358, -1 }, /* (339) signed_literal ::= NULL */ - { 358, -1 }, /* (340) signed_literal ::= literal_func */ - { 358, -1 }, /* (341) signed_literal ::= NK_QUESTION */ - { 399, -1 }, /* (342) literal_list ::= signed_literal */ - { 399, -3 }, /* (343) literal_list ::= literal_list NK_COMMA signed_literal */ - { 333, -1 }, /* (344) db_name ::= NK_ID */ - { 364, -1 }, /* (345) table_name ::= NK_ID */ - { 356, -1 }, /* (346) column_name ::= NK_ID */ - { 371, -1 }, /* (347) function_name ::= NK_ID */ - { 400, -1 }, /* (348) table_alias ::= NK_ID */ - { 379, -1 }, /* (349) column_alias ::= NK_ID */ - { 327, -1 }, /* (350) user_name ::= NK_ID */ - { 334, -1 }, /* (351) topic_name ::= NK_ID */ - { 391, -1 }, /* (352) stream_name ::= NK_ID */ - { 386, -1 }, /* (353) cgroup_name ::= NK_ID */ - { 401, -1 }, /* (354) expr_or_subquery ::= expression */ - { 394, -1 }, /* (355) expression ::= literal */ - { 394, -1 }, /* (356) expression ::= pseudo_column */ - { 394, -1 }, /* (357) expression ::= column_reference */ - { 394, -1 }, /* (358) expression ::= function_expression */ - { 394, -1 }, /* (359) expression ::= case_when_expression */ - { 394, -3 }, /* (360) expression ::= NK_LP expression NK_RP */ - { 394, -2 }, /* (361) expression ::= NK_PLUS expr_or_subquery */ - { 394, -2 }, /* (362) expression ::= NK_MINUS expr_or_subquery */ - { 394, -3 }, /* (363) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 394, -3 }, /* (364) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 394, -3 }, /* (365) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 394, -3 }, /* (366) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 394, -3 }, /* (367) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 394, -3 }, /* (368) expression ::= column_reference NK_ARROW NK_STRING */ - { 394, -3 }, /* (369) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 394, -3 }, /* (370) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 361, -1 }, /* (371) expression_list ::= expr_or_subquery */ - { 361, -3 }, /* (372) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 403, -1 }, /* (373) column_reference ::= column_name */ - { 403, -3 }, /* (374) column_reference ::= table_name NK_DOT column_name */ - { 402, -1 }, /* (375) pseudo_column ::= ROWTS */ - { 402, -1 }, /* (376) pseudo_column ::= TBNAME */ - { 402, -3 }, /* (377) pseudo_column ::= table_name NK_DOT TBNAME */ - { 402, -1 }, /* (378) pseudo_column ::= QSTART */ - { 402, -1 }, /* (379) pseudo_column ::= QEND */ - { 402, -1 }, /* (380) pseudo_column ::= QDURATION */ - { 402, -1 }, /* (381) pseudo_column ::= WSTART */ - { 402, -1 }, /* (382) pseudo_column ::= WEND */ - { 402, -1 }, /* (383) pseudo_column ::= WDURATION */ - { 402, -1 }, /* (384) pseudo_column ::= IROWTS */ - { 402, -1 }, /* (385) pseudo_column ::= QTAGS */ - { 404, -4 }, /* (386) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 404, -4 }, /* (387) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 404, -6 }, /* (388) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 404, -1 }, /* (389) function_expression ::= literal_func */ - { 398, -3 }, /* (390) literal_func ::= noarg_func NK_LP NK_RP */ - { 398, -1 }, /* (391) literal_func ::= NOW */ - { 408, -1 }, /* (392) noarg_func ::= NOW */ - { 408, -1 }, /* (393) noarg_func ::= TODAY */ - { 408, -1 }, /* (394) noarg_func ::= TIMEZONE */ - { 408, -1 }, /* (395) noarg_func ::= DATABASE */ - { 408, -1 }, /* (396) noarg_func ::= CLIENT_VERSION */ - { 408, -1 }, /* (397) noarg_func ::= SERVER_VERSION */ - { 408, -1 }, /* (398) noarg_func ::= SERVER_STATUS */ - { 408, -1 }, /* (399) noarg_func ::= CURRENT_USER */ - { 408, -1 }, /* (400) noarg_func ::= USER */ - { 406, -1 }, /* (401) star_func ::= COUNT */ - { 406, -1 }, /* (402) star_func ::= FIRST */ - { 406, -1 }, /* (403) star_func ::= LAST */ - { 406, -1 }, /* (404) star_func ::= LAST_ROW */ - { 407, -1 }, /* (405) star_func_para_list ::= NK_STAR */ - { 407, -1 }, /* (406) star_func_para_list ::= other_para_list */ - { 409, -1 }, /* (407) other_para_list ::= star_func_para */ - { 409, -3 }, /* (408) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 410, -1 }, /* (409) star_func_para ::= expr_or_subquery */ - { 410, -3 }, /* (410) star_func_para ::= table_name NK_DOT NK_STAR */ - { 405, -4 }, /* (411) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 405, -5 }, /* (412) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 411, -1 }, /* (413) when_then_list ::= when_then_expr */ - { 411, -2 }, /* (414) when_then_list ::= when_then_list when_then_expr */ - { 414, -4 }, /* (415) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 412, 0 }, /* (416) case_when_else_opt ::= */ - { 412, -2 }, /* (417) case_when_else_opt ::= ELSE common_expression */ - { 415, -3 }, /* (418) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 415, -5 }, /* (419) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 415, -6 }, /* (420) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 415, -3 }, /* (421) predicate ::= expr_or_subquery IS NULL */ - { 415, -4 }, /* (422) predicate ::= expr_or_subquery IS NOT NULL */ - { 415, -3 }, /* (423) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 416, -1 }, /* (424) compare_op ::= NK_LT */ - { 416, -1 }, /* (425) compare_op ::= NK_GT */ - { 416, -1 }, /* (426) compare_op ::= NK_LE */ - { 416, -1 }, /* (427) compare_op ::= NK_GE */ - { 416, -1 }, /* (428) compare_op ::= NK_NE */ - { 416, -1 }, /* (429) compare_op ::= NK_EQ */ - { 416, -1 }, /* (430) compare_op ::= LIKE */ - { 416, -2 }, /* (431) compare_op ::= NOT LIKE */ - { 416, -1 }, /* (432) compare_op ::= MATCH */ - { 416, -1 }, /* (433) compare_op ::= NMATCH */ - { 416, -1 }, /* (434) compare_op ::= CONTAINS */ - { 417, -1 }, /* (435) in_op ::= IN */ - { 417, -2 }, /* (436) in_op ::= NOT IN */ - { 418, -3 }, /* (437) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 419, -1 }, /* (438) boolean_value_expression ::= boolean_primary */ - { 419, -2 }, /* (439) boolean_value_expression ::= NOT boolean_primary */ - { 419, -3 }, /* (440) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 419, -3 }, /* (441) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 420, -1 }, /* (442) boolean_primary ::= predicate */ - { 420, -3 }, /* (443) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 413, -1 }, /* (444) common_expression ::= expr_or_subquery */ - { 413, -1 }, /* (445) common_expression ::= boolean_value_expression */ - { 421, 0 }, /* (446) from_clause_opt ::= */ - { 421, -2 }, /* (447) from_clause_opt ::= FROM table_reference_list */ - { 422, -1 }, /* (448) table_reference_list ::= table_reference */ - { 422, -3 }, /* (449) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 423, -1 }, /* (450) table_reference ::= table_primary */ - { 423, -1 }, /* (451) table_reference ::= joined_table */ - { 424, -2 }, /* (452) table_primary ::= table_name alias_opt */ - { 424, -4 }, /* (453) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 424, -2 }, /* (454) table_primary ::= subquery alias_opt */ - { 424, -1 }, /* (455) table_primary ::= parenthesized_joined_table */ - { 426, 0 }, /* (456) alias_opt ::= */ - { 426, -1 }, /* (457) alias_opt ::= table_alias */ - { 426, -2 }, /* (458) alias_opt ::= AS table_alias */ - { 428, -3 }, /* (459) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 428, -3 }, /* (460) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 425, -6 }, /* (461) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 429, 0 }, /* (462) join_type ::= */ - { 429, -1 }, /* (463) join_type ::= INNER */ - { 431, -12 }, /* (464) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 432, 0 }, /* (465) set_quantifier_opt ::= */ - { 432, -1 }, /* (466) set_quantifier_opt ::= DISTINCT */ - { 432, -1 }, /* (467) set_quantifier_opt ::= ALL */ - { 433, -1 }, /* (468) select_list ::= select_item */ - { 433, -3 }, /* (469) select_list ::= select_list NK_COMMA select_item */ - { 441, -1 }, /* (470) select_item ::= NK_STAR */ - { 441, -1 }, /* (471) select_item ::= common_expression */ - { 441, -2 }, /* (472) select_item ::= common_expression column_alias */ - { 441, -3 }, /* (473) select_item ::= common_expression AS column_alias */ - { 441, -3 }, /* (474) select_item ::= table_name NK_DOT NK_STAR */ - { 396, 0 }, /* (475) where_clause_opt ::= */ - { 396, -2 }, /* (476) where_clause_opt ::= WHERE search_condition */ - { 434, 0 }, /* (477) partition_by_clause_opt ::= */ - { 434, -3 }, /* (478) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 442, -1 }, /* (479) partition_list ::= partition_item */ - { 442, -3 }, /* (480) partition_list ::= partition_list NK_COMMA partition_item */ - { 443, -1 }, /* (481) partition_item ::= expr_or_subquery */ - { 443, -2 }, /* (482) partition_item ::= expr_or_subquery column_alias */ - { 443, -3 }, /* (483) partition_item ::= expr_or_subquery AS column_alias */ - { 438, 0 }, /* (484) twindow_clause_opt ::= */ - { 438, -6 }, /* (485) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 438, -4 }, /* (486) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 438, -6 }, /* (487) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 438, -8 }, /* (488) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 382, 0 }, /* (489) sliding_opt ::= */ - { 382, -4 }, /* (490) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 437, 0 }, /* (491) fill_opt ::= */ - { 437, -4 }, /* (492) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 437, -6 }, /* (493) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 444, -1 }, /* (494) fill_mode ::= NONE */ - { 444, -1 }, /* (495) fill_mode ::= PREV */ - { 444, -1 }, /* (496) fill_mode ::= NULL */ - { 444, -1 }, /* (497) fill_mode ::= LINEAR */ - { 444, -1 }, /* (498) fill_mode ::= NEXT */ - { 439, 0 }, /* (499) group_by_clause_opt ::= */ - { 439, -3 }, /* (500) group_by_clause_opt ::= GROUP BY group_by_list */ - { 445, -1 }, /* (501) group_by_list ::= expr_or_subquery */ - { 445, -3 }, /* (502) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 440, 0 }, /* (503) having_clause_opt ::= */ - { 440, -2 }, /* (504) having_clause_opt ::= HAVING search_condition */ - { 435, 0 }, /* (505) range_opt ::= */ - { 435, -6 }, /* (506) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 436, 0 }, /* (507) every_opt ::= */ - { 436, -4 }, /* (508) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 446, -4 }, /* (509) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 447, -1 }, /* (510) query_simple ::= query_specification */ - { 447, -1 }, /* (511) query_simple ::= union_query_expression */ - { 451, -4 }, /* (512) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 451, -3 }, /* (513) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 452, -1 }, /* (514) query_simple_or_subquery ::= query_simple */ - { 452, -1 }, /* (515) query_simple_or_subquery ::= subquery */ - { 385, -1 }, /* (516) query_or_subquery ::= query_expression */ - { 385, -1 }, /* (517) query_or_subquery ::= subquery */ - { 448, 0 }, /* (518) order_by_clause_opt ::= */ - { 448, -3 }, /* (519) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 449, 0 }, /* (520) slimit_clause_opt ::= */ - { 449, -2 }, /* (521) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 449, -4 }, /* (522) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 449, -4 }, /* (523) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 450, 0 }, /* (524) limit_clause_opt ::= */ - { 450, -2 }, /* (525) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 450, -4 }, /* (526) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 450, -4 }, /* (527) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 427, -3 }, /* (528) subquery ::= NK_LP query_expression NK_RP */ - { 427, -3 }, /* (529) subquery ::= NK_LP subquery NK_RP */ - { 430, -1 }, /* (530) search_condition ::= common_expression */ - { 453, -1 }, /* (531) sort_specification_list ::= sort_specification */ - { 453, -3 }, /* (532) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 454, -3 }, /* (533) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 455, 0 }, /* (534) ordering_specification_opt ::= */ - { 455, -1 }, /* (535) ordering_specification_opt ::= ASC */ - { 455, -1 }, /* (536) ordering_specification_opt ::= DESC */ - { 456, 0 }, /* (537) null_ordering_opt ::= */ - { 456, -2 }, /* (538) null_ordering_opt ::= NULLS FIRST */ - { 456, -2 }, /* (539) null_ordering_opt ::= NULLS LAST */ + { 338, -3 }, /* (92) db_options ::= db_options VGROUPS NK_INTEGER */ + { 338, -3 }, /* (93) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 338, -3 }, /* (94) db_options ::= db_options RETENTIONS retention_list */ + { 338, -3 }, /* (95) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 338, -3 }, /* (96) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + { 338, -3 }, /* (97) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + { 338, -3 }, /* (98) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 338, -4 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 338, -3 }, /* (100) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 338, -4 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 338, -3 }, /* (102) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 338, -3 }, /* (103) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 338, -3 }, /* (104) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + { 338, -3 }, /* (105) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + { 338, -3 }, /* (106) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + { 340, -1 }, /* (107) alter_db_options ::= alter_db_option */ + { 340, -2 }, /* (108) alter_db_options ::= alter_db_options alter_db_option */ + { 345, -2 }, /* (109) alter_db_option ::= BUFFER NK_INTEGER */ + { 345, -2 }, /* (110) alter_db_option ::= CACHEMODEL NK_STRING */ + { 345, -2 }, /* (111) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 345, -2 }, /* (112) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 345, -2 }, /* (113) alter_db_option ::= KEEP integer_list */ + { 345, -2 }, /* (114) alter_db_option ::= KEEP variable_list */ + { 345, -2 }, /* (115) alter_db_option ::= PAGES NK_INTEGER */ + { 345, -2 }, /* (116) alter_db_option ::= REPLICA NK_INTEGER */ + { 345, -2 }, /* (117) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 345, -2 }, /* (118) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 342, -1 }, /* (119) integer_list ::= NK_INTEGER */ + { 342, -3 }, /* (120) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 343, -1 }, /* (121) variable_list ::= NK_VARIABLE */ + { 343, -3 }, /* (122) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 344, -1 }, /* (123) retention_list ::= retention */ + { 344, -3 }, /* (124) retention_list ::= retention_list NK_COMMA retention */ + { 346, -3 }, /* (125) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 341, 0 }, /* (126) speed_opt ::= */ + { 341, -2 }, /* (127) speed_opt ::= MAX_SPEED NK_INTEGER */ + { 322, -9 }, /* (128) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 322, -3 }, /* (129) cmd ::= CREATE TABLE multi_create_clause */ + { 322, -9 }, /* (130) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 322, -3 }, /* (131) cmd ::= DROP TABLE multi_drop_clause */ + { 322, -4 }, /* (132) cmd ::= DROP STABLE exists_opt full_table_name */ + { 322, -3 }, /* (133) cmd ::= ALTER TABLE alter_table_clause */ + { 322, -3 }, /* (134) cmd ::= ALTER STABLE alter_table_clause */ + { 354, -2 }, /* (135) alter_table_clause ::= full_table_name alter_table_options */ + { 354, -5 }, /* (136) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 354, -4 }, /* (137) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 354, -5 }, /* (138) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 354, -5 }, /* (139) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 354, -5 }, /* (140) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 354, -4 }, /* (141) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 354, -5 }, /* (142) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 354, -5 }, /* (143) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 354, -6 }, /* (144) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 351, -1 }, /* (145) multi_create_clause ::= create_subtable_clause */ + { 351, -2 }, /* (146) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 359, -10 }, /* (147) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + { 353, -1 }, /* (148) multi_drop_clause ::= drop_table_clause */ + { 353, -2 }, /* (149) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 362, -2 }, /* (150) drop_table_clause ::= exists_opt full_table_name */ + { 360, 0 }, /* (151) specific_cols_opt ::= */ + { 360, -3 }, /* (152) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 347, -1 }, /* (153) full_table_name ::= table_name */ + { 347, -3 }, /* (154) full_table_name ::= db_name NK_DOT table_name */ + { 348, -1 }, /* (155) column_def_list ::= column_def */ + { 348, -3 }, /* (156) column_def_list ::= column_def_list NK_COMMA column_def */ + { 365, -2 }, /* (157) column_def ::= column_name type_name */ + { 365, -4 }, /* (158) column_def ::= column_name type_name COMMENT NK_STRING */ + { 357, -1 }, /* (159) type_name ::= BOOL */ + { 357, -1 }, /* (160) type_name ::= TINYINT */ + { 357, -1 }, /* (161) type_name ::= SMALLINT */ + { 357, -1 }, /* (162) type_name ::= INT */ + { 357, -1 }, /* (163) type_name ::= INTEGER */ + { 357, -1 }, /* (164) type_name ::= BIGINT */ + { 357, -1 }, /* (165) type_name ::= FLOAT */ + { 357, -1 }, /* (166) type_name ::= DOUBLE */ + { 357, -4 }, /* (167) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 357, -1 }, /* (168) type_name ::= TIMESTAMP */ + { 357, -4 }, /* (169) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 357, -2 }, /* (170) type_name ::= TINYINT UNSIGNED */ + { 357, -2 }, /* (171) type_name ::= SMALLINT UNSIGNED */ + { 357, -2 }, /* (172) type_name ::= INT UNSIGNED */ + { 357, -2 }, /* (173) type_name ::= BIGINT UNSIGNED */ + { 357, -1 }, /* (174) type_name ::= JSON */ + { 357, -4 }, /* (175) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 357, -1 }, /* (176) type_name ::= MEDIUMBLOB */ + { 357, -1 }, /* (177) type_name ::= BLOB */ + { 357, -4 }, /* (178) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 357, -1 }, /* (179) type_name ::= DECIMAL */ + { 357, -4 }, /* (180) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 357, -6 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 349, 0 }, /* (182) tags_def_opt ::= */ + { 349, -1 }, /* (183) tags_def_opt ::= tags_def */ + { 352, -4 }, /* (184) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 350, 0 }, /* (185) table_options ::= */ + { 350, -3 }, /* (186) table_options ::= table_options COMMENT NK_STRING */ + { 350, -3 }, /* (187) table_options ::= table_options MAX_DELAY duration_list */ + { 350, -3 }, /* (188) table_options ::= table_options WATERMARK duration_list */ + { 350, -5 }, /* (189) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 350, -3 }, /* (190) table_options ::= table_options TTL NK_INTEGER */ + { 350, -5 }, /* (191) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 350, -3 }, /* (192) table_options ::= table_options DELETE_MARK duration_list */ + { 355, -1 }, /* (193) alter_table_options ::= alter_table_option */ + { 355, -2 }, /* (194) alter_table_options ::= alter_table_options alter_table_option */ + { 368, -2 }, /* (195) alter_table_option ::= COMMENT NK_STRING */ + { 368, -2 }, /* (196) alter_table_option ::= TTL NK_INTEGER */ + { 366, -1 }, /* (197) duration_list ::= duration_literal */ + { 366, -3 }, /* (198) duration_list ::= duration_list NK_COMMA duration_literal */ + { 367, -1 }, /* (199) rollup_func_list ::= rollup_func_name */ + { 367, -3 }, /* (200) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 370, -1 }, /* (201) rollup_func_name ::= function_name */ + { 370, -1 }, /* (202) rollup_func_name ::= FIRST */ + { 370, -1 }, /* (203) rollup_func_name ::= LAST */ + { 363, -1 }, /* (204) col_name_list ::= col_name */ + { 363, -3 }, /* (205) col_name_list ::= col_name_list NK_COMMA col_name */ + { 372, -1 }, /* (206) col_name ::= column_name */ + { 322, -2 }, /* (207) cmd ::= SHOW DNODES */ + { 322, -2 }, /* (208) cmd ::= SHOW USERS */ + { 322, -3 }, /* (209) cmd ::= SHOW USER PRIVILEGES */ + { 322, -2 }, /* (210) cmd ::= SHOW DATABASES */ + { 322, -4 }, /* (211) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 322, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 322, -3 }, /* (213) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 322, -2 }, /* (214) cmd ::= SHOW MNODES */ + { 322, -2 }, /* (215) cmd ::= SHOW QNODES */ + { 322, -2 }, /* (216) cmd ::= SHOW FUNCTIONS */ + { 322, -5 }, /* (217) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 322, -2 }, /* (218) cmd ::= SHOW STREAMS */ + { 322, -2 }, /* (219) cmd ::= SHOW ACCOUNTS */ + { 322, -2 }, /* (220) cmd ::= SHOW APPS */ + { 322, -2 }, /* (221) cmd ::= SHOW CONNECTIONS */ + { 322, -2 }, /* (222) cmd ::= SHOW LICENCES */ + { 322, -2 }, /* (223) cmd ::= SHOW GRANTS */ + { 322, -4 }, /* (224) cmd ::= SHOW CREATE DATABASE db_name */ + { 322, -4 }, /* (225) cmd ::= SHOW CREATE TABLE full_table_name */ + { 322, -4 }, /* (226) cmd ::= SHOW CREATE STABLE full_table_name */ + { 322, -2 }, /* (227) cmd ::= SHOW QUERIES */ + { 322, -2 }, /* (228) cmd ::= SHOW SCORES */ + { 322, -2 }, /* (229) cmd ::= SHOW TOPICS */ + { 322, -2 }, /* (230) cmd ::= SHOW VARIABLES */ + { 322, -3 }, /* (231) cmd ::= SHOW CLUSTER VARIABLES */ + { 322, -3 }, /* (232) cmd ::= SHOW LOCAL VARIABLES */ + { 322, -5 }, /* (233) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + { 322, -2 }, /* (234) cmd ::= SHOW BNODES */ + { 322, -2 }, /* (235) cmd ::= SHOW SNODES */ + { 322, -2 }, /* (236) cmd ::= SHOW CLUSTER */ + { 322, -2 }, /* (237) cmd ::= SHOW TRANSACTIONS */ + { 322, -4 }, /* (238) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 322, -2 }, /* (239) cmd ::= SHOW CONSUMERS */ + { 322, -2 }, /* (240) cmd ::= SHOW SUBSCRIPTIONS */ + { 322, -5 }, /* (241) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 322, -7 }, /* (242) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + { 322, -3 }, /* (243) cmd ::= SHOW VNODES NK_INTEGER */ + { 322, -3 }, /* (244) cmd ::= SHOW VNODES NK_STRING */ + { 373, 0 }, /* (245) db_name_cond_opt ::= */ + { 373, -2 }, /* (246) db_name_cond_opt ::= db_name NK_DOT */ + { 374, 0 }, /* (247) like_pattern_opt ::= */ + { 374, -2 }, /* (248) like_pattern_opt ::= LIKE NK_STRING */ + { 375, -1 }, /* (249) table_name_cond ::= table_name */ + { 376, 0 }, /* (250) from_db_opt ::= */ + { 376, -2 }, /* (251) from_db_opt ::= FROM db_name */ + { 377, 0 }, /* (252) tag_list_opt ::= */ + { 377, -1 }, /* (253) tag_list_opt ::= tag_item */ + { 377, -3 }, /* (254) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + { 378, -1 }, /* (255) tag_item ::= TBNAME */ + { 378, -1 }, /* (256) tag_item ::= QTAGS */ + { 378, -1 }, /* (257) tag_item ::= column_name */ + { 378, -2 }, /* (258) tag_item ::= column_name column_alias */ + { 378, -3 }, /* (259) tag_item ::= column_name AS column_alias */ + { 322, -8 }, /* (260) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + { 322, -4 }, /* (261) cmd ::= DROP INDEX exists_opt full_table_name */ + { 380, -10 }, /* (262) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 380, -12 }, /* (263) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + { 381, -1 }, /* (264) func_list ::= func */ + { 381, -3 }, /* (265) func_list ::= func_list NK_COMMA func */ + { 384, -4 }, /* (266) func ::= function_name NK_LP expression_list NK_RP */ + { 383, 0 }, /* (267) sma_stream_opt ::= */ + { 383, -3 }, /* (268) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + { 383, -3 }, /* (269) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + { 383, -3 }, /* (270) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + { 322, -6 }, /* (271) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 322, -7 }, /* (272) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 322, -9 }, /* (273) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 322, -7 }, /* (274) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 322, -9 }, /* (275) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 322, -4 }, /* (276) cmd ::= DROP TOPIC exists_opt topic_name */ + { 322, -7 }, /* (277) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 322, -2 }, /* (278) cmd ::= DESC full_table_name */ + { 322, -2 }, /* (279) cmd ::= DESCRIBE full_table_name */ + { 322, -3 }, /* (280) cmd ::= RESET QUERY CACHE */ + { 322, -4 }, /* (281) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 387, 0 }, /* (282) analyze_opt ::= */ + { 387, -1 }, /* (283) analyze_opt ::= ANALYZE */ + { 388, 0 }, /* (284) explain_options ::= */ + { 388, -3 }, /* (285) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 388, -3 }, /* (286) explain_options ::= explain_options RATIO NK_FLOAT */ + { 322, -10 }, /* (287) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 322, -4 }, /* (288) cmd ::= DROP FUNCTION exists_opt function_name */ + { 389, 0 }, /* (289) agg_func_opt ::= */ + { 389, -1 }, /* (290) agg_func_opt ::= AGGREGATE */ + { 390, 0 }, /* (291) bufsize_opt ::= */ + { 390, -2 }, /* (292) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 322, -11 }, /* (293) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ + { 322, -4 }, /* (294) cmd ::= DROP STREAM exists_opt stream_name */ + { 392, 0 }, /* (295) stream_options ::= */ + { 392, -3 }, /* (296) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 392, -3 }, /* (297) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 392, -4 }, /* (298) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 392, -3 }, /* (299) stream_options ::= stream_options WATERMARK duration_literal */ + { 392, -4 }, /* (300) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 392, -3 }, /* (301) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + { 393, 0 }, /* (302) subtable_opt ::= */ + { 393, -4 }, /* (303) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 322, -3 }, /* (304) cmd ::= KILL CONNECTION NK_INTEGER */ + { 322, -3 }, /* (305) cmd ::= KILL QUERY NK_STRING */ + { 322, -3 }, /* (306) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 322, -2 }, /* (307) cmd ::= BALANCE VGROUP */ + { 322, -4 }, /* (308) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 322, -4 }, /* (309) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 322, -3 }, /* (310) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 395, -2 }, /* (311) dnode_list ::= DNODE NK_INTEGER */ + { 395, -3 }, /* (312) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 322, -4 }, /* (313) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 322, -1 }, /* (314) cmd ::= query_or_subquery */ + { 322, -7 }, /* (315) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 322, -4 }, /* (316) cmd ::= INSERT INTO full_table_name query_or_subquery */ + { 325, -1 }, /* (317) literal ::= NK_INTEGER */ + { 325, -1 }, /* (318) literal ::= NK_FLOAT */ + { 325, -1 }, /* (319) literal ::= NK_STRING */ + { 325, -1 }, /* (320) literal ::= NK_BOOL */ + { 325, -2 }, /* (321) literal ::= TIMESTAMP NK_STRING */ + { 325, -1 }, /* (322) literal ::= duration_literal */ + { 325, -1 }, /* (323) literal ::= NULL */ + { 325, -1 }, /* (324) literal ::= NK_QUESTION */ + { 369, -1 }, /* (325) duration_literal ::= NK_VARIABLE */ + { 397, -1 }, /* (326) signed ::= NK_INTEGER */ + { 397, -2 }, /* (327) signed ::= NK_PLUS NK_INTEGER */ + { 397, -2 }, /* (328) signed ::= NK_MINUS NK_INTEGER */ + { 397, -1 }, /* (329) signed ::= NK_FLOAT */ + { 397, -2 }, /* (330) signed ::= NK_PLUS NK_FLOAT */ + { 397, -2 }, /* (331) signed ::= NK_MINUS NK_FLOAT */ + { 358, -1 }, /* (332) signed_literal ::= signed */ + { 358, -1 }, /* (333) signed_literal ::= NK_STRING */ + { 358, -1 }, /* (334) signed_literal ::= NK_BOOL */ + { 358, -2 }, /* (335) signed_literal ::= TIMESTAMP NK_STRING */ + { 358, -1 }, /* (336) signed_literal ::= duration_literal */ + { 358, -1 }, /* (337) signed_literal ::= NULL */ + { 358, -1 }, /* (338) signed_literal ::= literal_func */ + { 358, -1 }, /* (339) signed_literal ::= NK_QUESTION */ + { 399, -1 }, /* (340) literal_list ::= signed_literal */ + { 399, -3 }, /* (341) literal_list ::= literal_list NK_COMMA signed_literal */ + { 333, -1 }, /* (342) db_name ::= NK_ID */ + { 364, -1 }, /* (343) table_name ::= NK_ID */ + { 356, -1 }, /* (344) column_name ::= NK_ID */ + { 371, -1 }, /* (345) function_name ::= NK_ID */ + { 400, -1 }, /* (346) table_alias ::= NK_ID */ + { 379, -1 }, /* (347) column_alias ::= NK_ID */ + { 327, -1 }, /* (348) user_name ::= NK_ID */ + { 334, -1 }, /* (349) topic_name ::= NK_ID */ + { 391, -1 }, /* (350) stream_name ::= NK_ID */ + { 386, -1 }, /* (351) cgroup_name ::= NK_ID */ + { 401, -1 }, /* (352) expr_or_subquery ::= expression */ + { 394, -1 }, /* (353) expression ::= literal */ + { 394, -1 }, /* (354) expression ::= pseudo_column */ + { 394, -1 }, /* (355) expression ::= column_reference */ + { 394, -1 }, /* (356) expression ::= function_expression */ + { 394, -1 }, /* (357) expression ::= case_when_expression */ + { 394, -3 }, /* (358) expression ::= NK_LP expression NK_RP */ + { 394, -2 }, /* (359) expression ::= NK_PLUS expr_or_subquery */ + { 394, -2 }, /* (360) expression ::= NK_MINUS expr_or_subquery */ + { 394, -3 }, /* (361) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 394, -3 }, /* (362) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 394, -3 }, /* (363) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 394, -3 }, /* (364) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 394, -3 }, /* (365) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 394, -3 }, /* (366) expression ::= column_reference NK_ARROW NK_STRING */ + { 394, -3 }, /* (367) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 394, -3 }, /* (368) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 361, -1 }, /* (369) expression_list ::= expr_or_subquery */ + { 361, -3 }, /* (370) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 403, -1 }, /* (371) column_reference ::= column_name */ + { 403, -3 }, /* (372) column_reference ::= table_name NK_DOT column_name */ + { 402, -1 }, /* (373) pseudo_column ::= ROWTS */ + { 402, -1 }, /* (374) pseudo_column ::= TBNAME */ + { 402, -3 }, /* (375) pseudo_column ::= table_name NK_DOT TBNAME */ + { 402, -1 }, /* (376) pseudo_column ::= QSTART */ + { 402, -1 }, /* (377) pseudo_column ::= QEND */ + { 402, -1 }, /* (378) pseudo_column ::= QDURATION */ + { 402, -1 }, /* (379) pseudo_column ::= WSTART */ + { 402, -1 }, /* (380) pseudo_column ::= WEND */ + { 402, -1 }, /* (381) pseudo_column ::= WDURATION */ + { 402, -1 }, /* (382) pseudo_column ::= IROWTS */ + { 402, -1 }, /* (383) pseudo_column ::= QTAGS */ + { 404, -4 }, /* (384) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 404, -4 }, /* (385) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 404, -6 }, /* (386) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 404, -1 }, /* (387) function_expression ::= literal_func */ + { 398, -3 }, /* (388) literal_func ::= noarg_func NK_LP NK_RP */ + { 398, -1 }, /* (389) literal_func ::= NOW */ + { 408, -1 }, /* (390) noarg_func ::= NOW */ + { 408, -1 }, /* (391) noarg_func ::= TODAY */ + { 408, -1 }, /* (392) noarg_func ::= TIMEZONE */ + { 408, -1 }, /* (393) noarg_func ::= DATABASE */ + { 408, -1 }, /* (394) noarg_func ::= CLIENT_VERSION */ + { 408, -1 }, /* (395) noarg_func ::= SERVER_VERSION */ + { 408, -1 }, /* (396) noarg_func ::= SERVER_STATUS */ + { 408, -1 }, /* (397) noarg_func ::= CURRENT_USER */ + { 408, -1 }, /* (398) noarg_func ::= USER */ + { 406, -1 }, /* (399) star_func ::= COUNT */ + { 406, -1 }, /* (400) star_func ::= FIRST */ + { 406, -1 }, /* (401) star_func ::= LAST */ + { 406, -1 }, /* (402) star_func ::= LAST_ROW */ + { 407, -1 }, /* (403) star_func_para_list ::= NK_STAR */ + { 407, -1 }, /* (404) star_func_para_list ::= other_para_list */ + { 409, -1 }, /* (405) other_para_list ::= star_func_para */ + { 409, -3 }, /* (406) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 410, -1 }, /* (407) star_func_para ::= expr_or_subquery */ + { 410, -3 }, /* (408) star_func_para ::= table_name NK_DOT NK_STAR */ + { 405, -4 }, /* (409) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 405, -5 }, /* (410) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 411, -1 }, /* (411) when_then_list ::= when_then_expr */ + { 411, -2 }, /* (412) when_then_list ::= when_then_list when_then_expr */ + { 414, -4 }, /* (413) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 412, 0 }, /* (414) case_when_else_opt ::= */ + { 412, -2 }, /* (415) case_when_else_opt ::= ELSE common_expression */ + { 415, -3 }, /* (416) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 415, -5 }, /* (417) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 415, -6 }, /* (418) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 415, -3 }, /* (419) predicate ::= expr_or_subquery IS NULL */ + { 415, -4 }, /* (420) predicate ::= expr_or_subquery IS NOT NULL */ + { 415, -3 }, /* (421) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 416, -1 }, /* (422) compare_op ::= NK_LT */ + { 416, -1 }, /* (423) compare_op ::= NK_GT */ + { 416, -1 }, /* (424) compare_op ::= NK_LE */ + { 416, -1 }, /* (425) compare_op ::= NK_GE */ + { 416, -1 }, /* (426) compare_op ::= NK_NE */ + { 416, -1 }, /* (427) compare_op ::= NK_EQ */ + { 416, -1 }, /* (428) compare_op ::= LIKE */ + { 416, -2 }, /* (429) compare_op ::= NOT LIKE */ + { 416, -1 }, /* (430) compare_op ::= MATCH */ + { 416, -1 }, /* (431) compare_op ::= NMATCH */ + { 416, -1 }, /* (432) compare_op ::= CONTAINS */ + { 417, -1 }, /* (433) in_op ::= IN */ + { 417, -2 }, /* (434) in_op ::= NOT IN */ + { 418, -3 }, /* (435) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 419, -1 }, /* (436) boolean_value_expression ::= boolean_primary */ + { 419, -2 }, /* (437) boolean_value_expression ::= NOT boolean_primary */ + { 419, -3 }, /* (438) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 419, -3 }, /* (439) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 420, -1 }, /* (440) boolean_primary ::= predicate */ + { 420, -3 }, /* (441) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 413, -1 }, /* (442) common_expression ::= expr_or_subquery */ + { 413, -1 }, /* (443) common_expression ::= boolean_value_expression */ + { 421, 0 }, /* (444) from_clause_opt ::= */ + { 421, -2 }, /* (445) from_clause_opt ::= FROM table_reference_list */ + { 422, -1 }, /* (446) table_reference_list ::= table_reference */ + { 422, -3 }, /* (447) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 423, -1 }, /* (448) table_reference ::= table_primary */ + { 423, -1 }, /* (449) table_reference ::= joined_table */ + { 424, -2 }, /* (450) table_primary ::= table_name alias_opt */ + { 424, -4 }, /* (451) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 424, -2 }, /* (452) table_primary ::= subquery alias_opt */ + { 424, -1 }, /* (453) table_primary ::= parenthesized_joined_table */ + { 426, 0 }, /* (454) alias_opt ::= */ + { 426, -1 }, /* (455) alias_opt ::= table_alias */ + { 426, -2 }, /* (456) alias_opt ::= AS table_alias */ + { 428, -3 }, /* (457) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 428, -3 }, /* (458) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 425, -6 }, /* (459) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 429, 0 }, /* (460) join_type ::= */ + { 429, -1 }, /* (461) join_type ::= INNER */ + { 431, -12 }, /* (462) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 432, 0 }, /* (463) set_quantifier_opt ::= */ + { 432, -1 }, /* (464) set_quantifier_opt ::= DISTINCT */ + { 432, -1 }, /* (465) set_quantifier_opt ::= ALL */ + { 433, -1 }, /* (466) select_list ::= select_item */ + { 433, -3 }, /* (467) select_list ::= select_list NK_COMMA select_item */ + { 441, -1 }, /* (468) select_item ::= NK_STAR */ + { 441, -1 }, /* (469) select_item ::= common_expression */ + { 441, -2 }, /* (470) select_item ::= common_expression column_alias */ + { 441, -3 }, /* (471) select_item ::= common_expression AS column_alias */ + { 441, -3 }, /* (472) select_item ::= table_name NK_DOT NK_STAR */ + { 396, 0 }, /* (473) where_clause_opt ::= */ + { 396, -2 }, /* (474) where_clause_opt ::= WHERE search_condition */ + { 434, 0 }, /* (475) partition_by_clause_opt ::= */ + { 434, -3 }, /* (476) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 442, -1 }, /* (477) partition_list ::= partition_item */ + { 442, -3 }, /* (478) partition_list ::= partition_list NK_COMMA partition_item */ + { 443, -1 }, /* (479) partition_item ::= expr_or_subquery */ + { 443, -2 }, /* (480) partition_item ::= expr_or_subquery column_alias */ + { 443, -3 }, /* (481) partition_item ::= expr_or_subquery AS column_alias */ + { 438, 0 }, /* (482) twindow_clause_opt ::= */ + { 438, -6 }, /* (483) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 438, -4 }, /* (484) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 438, -6 }, /* (485) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 438, -8 }, /* (486) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 382, 0 }, /* (487) sliding_opt ::= */ + { 382, -4 }, /* (488) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 437, 0 }, /* (489) fill_opt ::= */ + { 437, -4 }, /* (490) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 437, -6 }, /* (491) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 444, -1 }, /* (492) fill_mode ::= NONE */ + { 444, -1 }, /* (493) fill_mode ::= PREV */ + { 444, -1 }, /* (494) fill_mode ::= NULL */ + { 444, -1 }, /* (495) fill_mode ::= LINEAR */ + { 444, -1 }, /* (496) fill_mode ::= NEXT */ + { 439, 0 }, /* (497) group_by_clause_opt ::= */ + { 439, -3 }, /* (498) group_by_clause_opt ::= GROUP BY group_by_list */ + { 445, -1 }, /* (499) group_by_list ::= expr_or_subquery */ + { 445, -3 }, /* (500) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 440, 0 }, /* (501) having_clause_opt ::= */ + { 440, -2 }, /* (502) having_clause_opt ::= HAVING search_condition */ + { 435, 0 }, /* (503) range_opt ::= */ + { 435, -6 }, /* (504) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 436, 0 }, /* (505) every_opt ::= */ + { 436, -4 }, /* (506) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 446, -4 }, /* (507) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 447, -1 }, /* (508) query_simple ::= query_specification */ + { 447, -1 }, /* (509) query_simple ::= union_query_expression */ + { 451, -4 }, /* (510) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 451, -3 }, /* (511) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 452, -1 }, /* (512) query_simple_or_subquery ::= query_simple */ + { 452, -1 }, /* (513) query_simple_or_subquery ::= subquery */ + { 385, -1 }, /* (514) query_or_subquery ::= query_expression */ + { 385, -1 }, /* (515) query_or_subquery ::= subquery */ + { 448, 0 }, /* (516) order_by_clause_opt ::= */ + { 448, -3 }, /* (517) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 449, 0 }, /* (518) slimit_clause_opt ::= */ + { 449, -2 }, /* (519) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 449, -4 }, /* (520) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 449, -4 }, /* (521) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 450, 0 }, /* (522) limit_clause_opt ::= */ + { 450, -2 }, /* (523) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 450, -4 }, /* (524) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 450, -4 }, /* (525) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 427, -3 }, /* (526) subquery ::= NK_LP query_expression NK_RP */ + { 427, -3 }, /* (527) subquery ::= NK_LP subquery NK_RP */ + { 430, -1 }, /* (528) search_condition ::= common_expression */ + { 453, -1 }, /* (529) sort_specification_list ::= sort_specification */ + { 453, -3 }, /* (530) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 454, -3 }, /* (531) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 455, 0 }, /* (532) ordering_specification_opt ::= */ + { 455, -1 }, /* (533) ordering_specification_opt ::= ASC */ + { 455, -1 }, /* (534) ordering_specification_opt ::= DESC */ + { 456, 0 }, /* (535) null_ordering_opt ::= */ + { 456, -2 }, /* (536) null_ordering_opt ::= NULLS FIRST */ + { 456, -2 }, /* (537) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3679,7 +3717,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy199 = yylhsminor.yy199; break; case 42: /* priv_level ::= topic_name */ - case 457: /* alias_opt ::= table_alias */ yytestcase(yyruleno==457); + case 455: /* alias_opt ::= table_alias */ yytestcase(yyruleno==455); { yylhsminor.yy199 = yymsp[0].minor.yy199; } yymsp[0].minor.yy199 = yylhsminor.yy199; break; @@ -3710,44 +3748,44 @@ static YYACTIONTYPE yy_reduce( case 51: /* dnode_endpoint ::= NK_STRING */ case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 344: /* db_name ::= NK_ID */ yytestcase(yyruleno==344); - case 345: /* table_name ::= NK_ID */ yytestcase(yyruleno==345); - case 346: /* column_name ::= NK_ID */ yytestcase(yyruleno==346); - case 347: /* function_name ::= NK_ID */ yytestcase(yyruleno==347); - case 348: /* table_alias ::= NK_ID */ yytestcase(yyruleno==348); - case 349: /* column_alias ::= NK_ID */ yytestcase(yyruleno==349); - case 350: /* user_name ::= NK_ID */ yytestcase(yyruleno==350); - case 351: /* topic_name ::= NK_ID */ yytestcase(yyruleno==351); - case 352: /* stream_name ::= NK_ID */ yytestcase(yyruleno==352); - case 353: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==353); - case 392: /* noarg_func ::= NOW */ yytestcase(yyruleno==392); - case 393: /* noarg_func ::= TODAY */ yytestcase(yyruleno==393); - case 394: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==394); - case 395: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==395); - case 396: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==396); - case 397: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==397); - case 398: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==398); - case 399: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==399); - case 400: /* noarg_func ::= USER */ yytestcase(yyruleno==400); - case 401: /* star_func ::= COUNT */ yytestcase(yyruleno==401); - case 402: /* star_func ::= FIRST */ yytestcase(yyruleno==402); - case 403: /* star_func ::= LAST */ yytestcase(yyruleno==403); - case 404: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==404); + case 342: /* db_name ::= NK_ID */ yytestcase(yyruleno==342); + case 343: /* table_name ::= NK_ID */ yytestcase(yyruleno==343); + case 344: /* column_name ::= NK_ID */ yytestcase(yyruleno==344); + case 345: /* function_name ::= NK_ID */ yytestcase(yyruleno==345); + case 346: /* table_alias ::= NK_ID */ yytestcase(yyruleno==346); + case 347: /* column_alias ::= NK_ID */ yytestcase(yyruleno==347); + case 348: /* user_name ::= NK_ID */ yytestcase(yyruleno==348); + case 349: /* topic_name ::= NK_ID */ yytestcase(yyruleno==349); + case 350: /* stream_name ::= NK_ID */ yytestcase(yyruleno==350); + case 351: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==351); + case 390: /* noarg_func ::= NOW */ yytestcase(yyruleno==390); + case 391: /* noarg_func ::= TODAY */ yytestcase(yyruleno==391); + case 392: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==392); + case 393: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==393); + case 394: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==394); + case 395: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==395); + case 396: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==396); + case 397: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==397); + case 398: /* noarg_func ::= USER */ yytestcase(yyruleno==398); + case 399: /* star_func ::= COUNT */ yytestcase(yyruleno==399); + case 400: /* star_func ::= FIRST */ yytestcase(yyruleno==400); + case 401: /* star_func ::= LAST */ yytestcase(yyruleno==401); + case 402: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==402); { yylhsminor.yy199 = yymsp[0].minor.yy0; } yymsp[0].minor.yy199 = yylhsminor.yy199; break; case 54: /* force_opt ::= */ case 73: /* not_exists_opt ::= */ yytestcase(yyruleno==73); case 75: /* exists_opt ::= */ yytestcase(yyruleno==75); - case 284: /* analyze_opt ::= */ yytestcase(yyruleno==284); - case 291: /* agg_func_opt ::= */ yytestcase(yyruleno==291); - case 465: /* set_quantifier_opt ::= */ yytestcase(yyruleno==465); + case 282: /* analyze_opt ::= */ yytestcase(yyruleno==282); + case 289: /* agg_func_opt ::= */ yytestcase(yyruleno==289); + case 463: /* set_quantifier_opt ::= */ yytestcase(yyruleno==463); { yymsp[1].minor.yy397 = false; } break; case 55: /* force_opt ::= FORCE */ - case 285: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==285); - case 292: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==292); - case 466: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==466); + case 283: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==283); + case 290: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==290); + case 464: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==464); { yymsp[0].minor.yy397 = true; } break; case 56: /* cmd ::= ALTER LOCAL NK_STRING */ @@ -3861,39 +3899,35 @@ static YYACTIONTYPE yy_reduce( { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 92: /* db_options ::= db_options STRICT NK_STRING */ -{ yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy148 = yylhsminor.yy148; - break; - case 93: /* db_options ::= db_options VGROUPS NK_INTEGER */ + case 92: /* db_options ::= db_options VGROUPS NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 94: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + case 93: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 95: /* db_options ::= db_options RETENTIONS retention_list */ + case 94: /* db_options ::= db_options RETENTIONS retention_list */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_RETENTIONS, yymsp[0].minor.yy404); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 96: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ + case 95: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 97: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ + case 96: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_WAL, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 98: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + case 97: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + case 98: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 100: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -3901,11 +3935,11 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + case 100: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 102: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -3913,735 +3947,732 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 103: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + case 102: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 104: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + case 103: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 105: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ + case 104: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 106: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + case 105: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 107: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + case 106: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ { yylhsminor.yy148 = setDatabaseOption(pCxt, yymsp[-2].minor.yy148, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 108: /* alter_db_options ::= alter_db_option */ + case 107: /* alter_db_options ::= alter_db_option */ { yylhsminor.yy148 = createAlterDatabaseOptions(pCxt); yylhsminor.yy148 = setAlterDatabaseOption(pCxt, yylhsminor.yy148, &yymsp[0].minor.yy123); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 109: /* alter_db_options ::= alter_db_options alter_db_option */ + case 108: /* alter_db_options ::= alter_db_options alter_db_option */ { yylhsminor.yy148 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy148, &yymsp[0].minor.yy123); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 110: /* alter_db_option ::= BUFFER NK_INTEGER */ + case 109: /* alter_db_option ::= BUFFER NK_INTEGER */ { yymsp[-1].minor.yy123.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 111: /* alter_db_option ::= CACHEMODEL NK_STRING */ + case 110: /* alter_db_option ::= CACHEMODEL NK_STRING */ { yymsp[-1].minor.yy123.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 112: /* alter_db_option ::= CACHESIZE NK_INTEGER */ + case 111: /* alter_db_option ::= CACHESIZE NK_INTEGER */ { yymsp[-1].minor.yy123.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 113: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + case 112: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ { yymsp[-1].minor.yy123.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 114: /* alter_db_option ::= KEEP integer_list */ - case 115: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==115); + case 113: /* alter_db_option ::= KEEP integer_list */ + case 114: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==114); { yymsp[-1].minor.yy123.type = DB_OPTION_KEEP; yymsp[-1].minor.yy123.pList = yymsp[0].minor.yy404; } break; - case 116: /* alter_db_option ::= PAGES NK_INTEGER */ + case 115: /* alter_db_option ::= PAGES NK_INTEGER */ { yymsp[-1].minor.yy123.type = DB_OPTION_PAGES; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 117: /* alter_db_option ::= REPLICA NK_INTEGER */ + case 116: /* alter_db_option ::= REPLICA NK_INTEGER */ { yymsp[-1].minor.yy123.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 118: /* alter_db_option ::= STRICT NK_STRING */ -{ yymsp[-1].minor.yy123.type = DB_OPTION_STRICT; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } - break; - case 119: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ + case 117: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ { yymsp[-1].minor.yy123.type = DB_OPTION_WAL; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 120: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ + case 118: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ { yymsp[-1].minor.yy123.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 121: /* integer_list ::= NK_INTEGER */ + case 119: /* integer_list ::= NK_INTEGER */ { yylhsminor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy404 = yylhsminor.yy404; break; - case 122: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 314: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==314); + case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 312: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==312); { yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy404 = yylhsminor.yy404; break; - case 123: /* variable_list ::= NK_VARIABLE */ + case 121: /* variable_list ::= NK_VARIABLE */ { yylhsminor.yy404 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy404 = yylhsminor.yy404; break; - case 124: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + case 122: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ { yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy404 = yylhsminor.yy404; break; - case 125: /* retention_list ::= retention */ - case 147: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==147); - case 150: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==150); - case 157: /* column_def_list ::= column_def */ yytestcase(yyruleno==157); - case 201: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==201); - case 206: /* col_name_list ::= col_name */ yytestcase(yyruleno==206); - case 255: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==255); - case 266: /* func_list ::= func */ yytestcase(yyruleno==266); - case 342: /* literal_list ::= signed_literal */ yytestcase(yyruleno==342); - case 407: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==407); - case 413: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==413); - case 468: /* select_list ::= select_item */ yytestcase(yyruleno==468); - case 479: /* partition_list ::= partition_item */ yytestcase(yyruleno==479); - case 531: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==531); + case 123: /* retention_list ::= retention */ + case 145: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==145); + case 148: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==148); + case 155: /* column_def_list ::= column_def */ yytestcase(yyruleno==155); + case 199: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==199); + case 204: /* col_name_list ::= col_name */ yytestcase(yyruleno==204); + case 253: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==253); + case 264: /* func_list ::= func */ yytestcase(yyruleno==264); + case 340: /* literal_list ::= signed_literal */ yytestcase(yyruleno==340); + case 405: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==405); + case 411: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==411); + case 466: /* select_list ::= select_item */ yytestcase(yyruleno==466); + case 477: /* partition_list ::= partition_item */ yytestcase(yyruleno==477); + case 529: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==529); { yylhsminor.yy404 = createNodeList(pCxt, yymsp[0].minor.yy148); } yymsp[0].minor.yy404 = yylhsminor.yy404; break; - case 126: /* retention_list ::= retention_list NK_COMMA retention */ - case 158: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==158); - case 202: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==202); - case 207: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==207); - case 256: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==256); - case 267: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==267); - case 343: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==343); - case 408: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==408); - case 469: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==469); - case 480: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==480); - case 532: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==532); + case 124: /* retention_list ::= retention_list NK_COMMA retention */ + case 156: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==156); + case 200: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==200); + case 205: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==205); + case 254: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==254); + case 265: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==265); + case 341: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==341); + case 406: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==406); + case 467: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==467); + case 478: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==478); + case 530: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==530); { yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, yymsp[0].minor.yy148); } yymsp[-2].minor.yy404 = yylhsminor.yy404; break; - case 127: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + case 125: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ { yylhsminor.yy148 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 128: /* speed_opt ::= */ - case 293: /* bufsize_opt ::= */ yytestcase(yyruleno==293); + case 126: /* speed_opt ::= */ + case 291: /* bufsize_opt ::= */ yytestcase(yyruleno==291); { yymsp[1].minor.yy706 = 0; } break; - case 129: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 294: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==294); + case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 292: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==292); { yymsp[-1].minor.yy706 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 130: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 132: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==132); + case 128: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 130: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==130); { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy397, yymsp[-5].minor.yy148, yymsp[-3].minor.yy404, yymsp[-1].minor.yy404, yymsp[0].minor.yy148); } break; - case 131: /* cmd ::= CREATE TABLE multi_create_clause */ + case 129: /* cmd ::= CREATE TABLE multi_create_clause */ { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy404); } break; - case 133: /* cmd ::= DROP TABLE multi_drop_clause */ + case 131: /* cmd ::= DROP TABLE multi_drop_clause */ { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy404); } break; - case 134: /* cmd ::= DROP STABLE exists_opt full_table_name */ + case 132: /* cmd ::= DROP STABLE exists_opt full_table_name */ { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy397, yymsp[0].minor.yy148); } break; - case 135: /* cmd ::= ALTER TABLE alter_table_clause */ - case 316: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==316); + case 133: /* cmd ::= ALTER TABLE alter_table_clause */ + case 314: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==314); { pCxt->pRootNode = yymsp[0].minor.yy148; } break; - case 136: /* cmd ::= ALTER STABLE alter_table_clause */ + case 134: /* cmd ::= ALTER STABLE alter_table_clause */ { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy148); } break; - case 137: /* alter_table_clause ::= full_table_name alter_table_options */ + case 135: /* alter_table_clause ::= full_table_name alter_table_options */ { yylhsminor.yy148 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy148, yymsp[0].minor.yy148); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 138: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + case 136: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ { yylhsminor.yy148 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy148, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy199, yymsp[0].minor.yy530); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 139: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ + case 137: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ { yylhsminor.yy148 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy148, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy199); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 140: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + case 138: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ { yylhsminor.yy148 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy148, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy199, yymsp[0].minor.yy530); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 141: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + case 139: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ { yylhsminor.yy148 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy148, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy199, &yymsp[0].minor.yy199); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 142: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + case 140: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ { yylhsminor.yy148 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy148, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy199, yymsp[0].minor.yy530); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 143: /* alter_table_clause ::= full_table_name DROP TAG column_name */ + case 141: /* alter_table_clause ::= full_table_name DROP TAG column_name */ { yylhsminor.yy148 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy148, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy199); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 144: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + case 142: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ { yylhsminor.yy148 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy148, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy199, yymsp[0].minor.yy530); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 145: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + case 143: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ { yylhsminor.yy148 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy148, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy199, &yymsp[0].minor.yy199); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 146: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + case 144: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ { yylhsminor.yy148 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy148, &yymsp[-2].minor.yy199, yymsp[0].minor.yy148); } yymsp[-5].minor.yy148 = yylhsminor.yy148; break; - case 148: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 151: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==151); - case 414: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==414); + case 146: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 149: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==149); + case 412: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==412); { yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-1].minor.yy404, yymsp[0].minor.yy148); } yymsp[-1].minor.yy404 = yylhsminor.yy404; break; - case 149: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + case 147: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ { yylhsminor.yy148 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy397, yymsp[-8].minor.yy148, yymsp[-6].minor.yy148, yymsp[-5].minor.yy404, yymsp[-2].minor.yy404, yymsp[0].minor.yy148); } yymsp[-9].minor.yy148 = yylhsminor.yy148; break; - case 152: /* drop_table_clause ::= exists_opt full_table_name */ + case 150: /* drop_table_clause ::= exists_opt full_table_name */ { yylhsminor.yy148 = createDropTableClause(pCxt, yymsp[-1].minor.yy397, yymsp[0].minor.yy148); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 153: /* specific_cols_opt ::= */ - case 184: /* tags_def_opt ::= */ yytestcase(yyruleno==184); - case 254: /* tag_list_opt ::= */ yytestcase(yyruleno==254); - case 477: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==477); - case 499: /* group_by_clause_opt ::= */ yytestcase(yyruleno==499); - case 518: /* order_by_clause_opt ::= */ yytestcase(yyruleno==518); + case 151: /* specific_cols_opt ::= */ + case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182); + case 252: /* tag_list_opt ::= */ yytestcase(yyruleno==252); + case 475: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==475); + case 497: /* group_by_clause_opt ::= */ yytestcase(yyruleno==497); + case 516: /* order_by_clause_opt ::= */ yytestcase(yyruleno==516); { yymsp[1].minor.yy404 = NULL; } break; - case 154: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ { yymsp[-2].minor.yy404 = yymsp[-1].minor.yy404; } break; - case 155: /* full_table_name ::= table_name */ + case 153: /* full_table_name ::= table_name */ { yylhsminor.yy148 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy199, NULL); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 156: /* full_table_name ::= db_name NK_DOT table_name */ + case 154: /* full_table_name ::= db_name NK_DOT table_name */ { yylhsminor.yy148 = createRealTableNode(pCxt, &yymsp[-2].minor.yy199, &yymsp[0].minor.yy199, NULL); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 159: /* column_def ::= column_name type_name */ + case 157: /* column_def ::= column_name type_name */ { yylhsminor.yy148 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy199, yymsp[0].minor.yy530, NULL); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 160: /* column_def ::= column_name type_name COMMENT NK_STRING */ + case 158: /* column_def ::= column_name type_name COMMENT NK_STRING */ { yylhsminor.yy148 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy199, yymsp[-2].minor.yy530, &yymsp[0].minor.yy0); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 161: /* type_name ::= BOOL */ + case 159: /* type_name ::= BOOL */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 162: /* type_name ::= TINYINT */ + case 160: /* type_name ::= TINYINT */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 163: /* type_name ::= SMALLINT */ + case 161: /* type_name ::= SMALLINT */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 164: /* type_name ::= INT */ - case 165: /* type_name ::= INTEGER */ yytestcase(yyruleno==165); + case 162: /* type_name ::= INT */ + case 163: /* type_name ::= INTEGER */ yytestcase(yyruleno==163); { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 166: /* type_name ::= BIGINT */ + case 164: /* type_name ::= BIGINT */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 167: /* type_name ::= FLOAT */ + case 165: /* type_name ::= FLOAT */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 168: /* type_name ::= DOUBLE */ + case 166: /* type_name ::= DOUBLE */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 169: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + case 167: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy530 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 170: /* type_name ::= TIMESTAMP */ + case 168: /* type_name ::= TIMESTAMP */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 171: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + case 169: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy530 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 172: /* type_name ::= TINYINT UNSIGNED */ + case 170: /* type_name ::= TINYINT UNSIGNED */ { yymsp[-1].minor.yy530 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 173: /* type_name ::= SMALLINT UNSIGNED */ + case 171: /* type_name ::= SMALLINT UNSIGNED */ { yymsp[-1].minor.yy530 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 174: /* type_name ::= INT UNSIGNED */ + case 172: /* type_name ::= INT UNSIGNED */ { yymsp[-1].minor.yy530 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 175: /* type_name ::= BIGINT UNSIGNED */ + case 173: /* type_name ::= BIGINT UNSIGNED */ { yymsp[-1].minor.yy530 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 176: /* type_name ::= JSON */ + case 174: /* type_name ::= JSON */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 177: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + case 175: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy530 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 178: /* type_name ::= MEDIUMBLOB */ + case 176: /* type_name ::= MEDIUMBLOB */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 179: /* type_name ::= BLOB */ + case 177: /* type_name ::= BLOB */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 180: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + case 178: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy530 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 181: /* type_name ::= DECIMAL */ + case 179: /* type_name ::= DECIMAL */ { yymsp[0].minor.yy530 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 182: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + case 180: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy530 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 183: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy530 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 185: /* tags_def_opt ::= tags_def */ - case 406: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==406); + case 183: /* tags_def_opt ::= tags_def */ + case 404: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==404); { yylhsminor.yy404 = yymsp[0].minor.yy404; } yymsp[0].minor.yy404 = yylhsminor.yy404; break; - case 186: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 184: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ { yymsp[-3].minor.yy404 = yymsp[-1].minor.yy404; } break; - case 187: /* table_options ::= */ + case 185: /* table_options ::= */ { yymsp[1].minor.yy148 = createDefaultTableOptions(pCxt); } break; - case 188: /* table_options ::= table_options COMMENT NK_STRING */ + case 186: /* table_options ::= table_options COMMENT NK_STRING */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-2].minor.yy148, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 189: /* table_options ::= table_options MAX_DELAY duration_list */ + case 187: /* table_options ::= table_options MAX_DELAY duration_list */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-2].minor.yy148, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy404); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 190: /* table_options ::= table_options WATERMARK duration_list */ + case 188: /* table_options ::= table_options WATERMARK duration_list */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-2].minor.yy148, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy404); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 191: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + case 189: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-4].minor.yy148, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy404); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 192: /* table_options ::= table_options TTL NK_INTEGER */ + case 190: /* table_options ::= table_options TTL NK_INTEGER */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-2].minor.yy148, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 193: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + case 191: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-4].minor.yy148, TABLE_OPTION_SMA, yymsp[-1].minor.yy404); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 194: /* table_options ::= table_options DELETE_MARK duration_list */ + case 192: /* table_options ::= table_options DELETE_MARK duration_list */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-2].minor.yy148, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy404); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 195: /* alter_table_options ::= alter_table_option */ + case 193: /* alter_table_options ::= alter_table_option */ { yylhsminor.yy148 = createAlterTableOptions(pCxt); yylhsminor.yy148 = setTableOption(pCxt, yylhsminor.yy148, yymsp[0].minor.yy123.type, &yymsp[0].minor.yy123.val); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 196: /* alter_table_options ::= alter_table_options alter_table_option */ + case 194: /* alter_table_options ::= alter_table_options alter_table_option */ { yylhsminor.yy148 = setTableOption(pCxt, yymsp[-1].minor.yy148, yymsp[0].minor.yy123.type, &yymsp[0].minor.yy123.val); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 197: /* alter_table_option ::= COMMENT NK_STRING */ + case 195: /* alter_table_option ::= COMMENT NK_STRING */ { yymsp[-1].minor.yy123.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 198: /* alter_table_option ::= TTL NK_INTEGER */ + case 196: /* alter_table_option ::= TTL NK_INTEGER */ { yymsp[-1].minor.yy123.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy123.val = yymsp[0].minor.yy0; } break; - case 199: /* duration_list ::= duration_literal */ - case 371: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==371); + case 197: /* duration_list ::= duration_literal */ + case 369: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==369); { yylhsminor.yy404 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy148)); } yymsp[0].minor.yy404 = yylhsminor.yy404; break; - case 200: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 372: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==372); + case 198: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 370: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==370); { yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, releaseRawExprNode(pCxt, yymsp[0].minor.yy148)); } yymsp[-2].minor.yy404 = yylhsminor.yy404; break; - case 203: /* rollup_func_name ::= function_name */ + case 201: /* rollup_func_name ::= function_name */ { yylhsminor.yy148 = createFunctionNode(pCxt, &yymsp[0].minor.yy199, NULL); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 204: /* rollup_func_name ::= FIRST */ - case 205: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==205); - case 258: /* tag_item ::= QTAGS */ yytestcase(yyruleno==258); + case 202: /* rollup_func_name ::= FIRST */ + case 203: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==203); + case 256: /* tag_item ::= QTAGS */ yytestcase(yyruleno==256); { yylhsminor.yy148 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 208: /* col_name ::= column_name */ - case 259: /* tag_item ::= column_name */ yytestcase(yyruleno==259); + case 206: /* col_name ::= column_name */ + case 257: /* tag_item ::= column_name */ yytestcase(yyruleno==257); { yylhsminor.yy148 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy199); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 209: /* cmd ::= SHOW DNODES */ + case 207: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 210: /* cmd ::= SHOW USERS */ + case 208: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 211: /* cmd ::= SHOW USER PRIVILEGES */ + case 209: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 212: /* cmd ::= SHOW DATABASES */ + case 210: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 213: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + case 211: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy148, yymsp[0].minor.yy148, OP_TYPE_LIKE); } break; - case 214: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + case 212: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy148, yymsp[0].minor.yy148, OP_TYPE_LIKE); } break; - case 215: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ + case 213: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy148, NULL, OP_TYPE_LIKE); } break; - case 216: /* cmd ::= SHOW MNODES */ + case 214: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 217: /* cmd ::= SHOW QNODES */ + case 215: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 218: /* cmd ::= SHOW FUNCTIONS */ + case 216: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 219: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + case 217: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy148, yymsp[-1].minor.yy148, OP_TYPE_EQUAL); } break; - case 220: /* cmd ::= SHOW STREAMS */ + case 218: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 221: /* cmd ::= SHOW ACCOUNTS */ + case 219: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 222: /* cmd ::= SHOW APPS */ + case 220: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 223: /* cmd ::= SHOW CONNECTIONS */ + case 221: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 224: /* cmd ::= SHOW LICENCES */ - case 225: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==225); + case 222: /* cmd ::= SHOW LICENCES */ + case 223: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==223); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 226: /* cmd ::= SHOW CREATE DATABASE db_name */ + case 224: /* cmd ::= SHOW CREATE DATABASE db_name */ { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy199); } break; - case 227: /* cmd ::= SHOW CREATE TABLE full_table_name */ + case 225: /* cmd ::= SHOW CREATE TABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy148); } break; - case 228: /* cmd ::= SHOW CREATE STABLE full_table_name */ + case 226: /* cmd ::= SHOW CREATE STABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy148); } break; - case 229: /* cmd ::= SHOW QUERIES */ + case 227: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 230: /* cmd ::= SHOW SCORES */ + case 228: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 231: /* cmd ::= SHOW TOPICS */ + case 229: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 232: /* cmd ::= SHOW VARIABLES */ - case 233: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==233); + case 230: /* cmd ::= SHOW VARIABLES */ + case 231: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==231); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 234: /* cmd ::= SHOW LOCAL VARIABLES */ + case 232: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 235: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + case 233: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy148); } break; - case 236: /* cmd ::= SHOW BNODES */ + case 234: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 237: /* cmd ::= SHOW SNODES */ + case 235: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 238: /* cmd ::= SHOW CLUSTER */ + case 236: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 239: /* cmd ::= SHOW TRANSACTIONS */ + case 237: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 240: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + case 238: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy148); } break; - case 241: /* cmd ::= SHOW CONSUMERS */ + case 239: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 242: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 240: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 243: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + case 241: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy148, yymsp[-1].minor.yy148, OP_TYPE_EQUAL); } break; - case 244: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + case 242: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy148, yymsp[0].minor.yy148, yymsp[-3].minor.yy404); } break; - case 245: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 243: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 246: /* cmd ::= SHOW VNODES NK_STRING */ + case 244: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 247: /* db_name_cond_opt ::= */ - case 252: /* from_db_opt ::= */ yytestcase(yyruleno==252); + case 245: /* db_name_cond_opt ::= */ + case 250: /* from_db_opt ::= */ yytestcase(yyruleno==250); { yymsp[1].minor.yy148 = createDefaultDatabaseCondValue(pCxt); } break; - case 248: /* db_name_cond_opt ::= db_name NK_DOT */ + case 246: /* db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy148 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy199); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 249: /* like_pattern_opt ::= */ - case 304: /* subtable_opt ::= */ yytestcase(yyruleno==304); - case 416: /* case_when_else_opt ::= */ yytestcase(yyruleno==416); - case 446: /* from_clause_opt ::= */ yytestcase(yyruleno==446); - case 475: /* where_clause_opt ::= */ yytestcase(yyruleno==475); - case 484: /* twindow_clause_opt ::= */ yytestcase(yyruleno==484); - case 489: /* sliding_opt ::= */ yytestcase(yyruleno==489); - case 491: /* fill_opt ::= */ yytestcase(yyruleno==491); - case 503: /* having_clause_opt ::= */ yytestcase(yyruleno==503); - case 505: /* range_opt ::= */ yytestcase(yyruleno==505); - case 507: /* every_opt ::= */ yytestcase(yyruleno==507); - case 520: /* slimit_clause_opt ::= */ yytestcase(yyruleno==520); - case 524: /* limit_clause_opt ::= */ yytestcase(yyruleno==524); + case 247: /* like_pattern_opt ::= */ + case 302: /* subtable_opt ::= */ yytestcase(yyruleno==302); + case 414: /* case_when_else_opt ::= */ yytestcase(yyruleno==414); + case 444: /* from_clause_opt ::= */ yytestcase(yyruleno==444); + case 473: /* where_clause_opt ::= */ yytestcase(yyruleno==473); + case 482: /* twindow_clause_opt ::= */ yytestcase(yyruleno==482); + case 487: /* sliding_opt ::= */ yytestcase(yyruleno==487); + case 489: /* fill_opt ::= */ yytestcase(yyruleno==489); + case 501: /* having_clause_opt ::= */ yytestcase(yyruleno==501); + case 503: /* range_opt ::= */ yytestcase(yyruleno==503); + case 505: /* every_opt ::= */ yytestcase(yyruleno==505); + case 518: /* slimit_clause_opt ::= */ yytestcase(yyruleno==518); + case 522: /* limit_clause_opt ::= */ yytestcase(yyruleno==522); { yymsp[1].minor.yy148 = NULL; } break; - case 250: /* like_pattern_opt ::= LIKE NK_STRING */ + case 248: /* like_pattern_opt ::= LIKE NK_STRING */ { yymsp[-1].minor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 251: /* table_name_cond ::= table_name */ + case 249: /* table_name_cond ::= table_name */ { yylhsminor.yy148 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy199); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 253: /* from_db_opt ::= FROM db_name */ + case 251: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy148 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy199); } break; - case 257: /* tag_item ::= TBNAME */ + case 255: /* tag_item ::= TBNAME */ { yylhsminor.yy148 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 260: /* tag_item ::= column_name column_alias */ + case 258: /* tag_item ::= column_name column_alias */ { yylhsminor.yy148 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy199), &yymsp[0].minor.yy199); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 261: /* tag_item ::= column_name AS column_alias */ + case 259: /* tag_item ::= column_name AS column_alias */ { yylhsminor.yy148 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy199), &yymsp[0].minor.yy199); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 262: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + case 260: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy397, yymsp[-3].minor.yy148, yymsp[-1].minor.yy148, NULL, yymsp[0].minor.yy148); } break; - case 263: /* cmd ::= DROP INDEX exists_opt full_table_name */ + case 261: /* cmd ::= DROP INDEX exists_opt full_table_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy397, yymsp[0].minor.yy148); } break; - case 264: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + case 262: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-9].minor.yy148 = createIndexOption(pCxt, yymsp[-7].minor.yy404, releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), NULL, yymsp[-1].minor.yy148, yymsp[0].minor.yy148); } break; - case 265: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + case 263: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-11].minor.yy148 = createIndexOption(pCxt, yymsp[-9].minor.yy404, releaseRawExprNode(pCxt, yymsp[-5].minor.yy148), releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), yymsp[-1].minor.yy148, yymsp[0].minor.yy148); } break; - case 268: /* func ::= function_name NK_LP expression_list NK_RP */ + case 266: /* func ::= function_name NK_LP expression_list NK_RP */ { yylhsminor.yy148 = createFunctionNode(pCxt, &yymsp[-3].minor.yy199, yymsp[-1].minor.yy404); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 269: /* sma_stream_opt ::= */ - case 297: /* stream_options ::= */ yytestcase(yyruleno==297); + case 267: /* sma_stream_opt ::= */ + case 295: /* stream_options ::= */ yytestcase(yyruleno==295); { yymsp[1].minor.yy148 = createStreamOptions(pCxt); } break; - case 270: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - case 301: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==301); + case 268: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 299: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==299); { ((SStreamOptions*)yymsp[-2].minor.yy148)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy148); yylhsminor.yy148 = yymsp[-2].minor.yy148; } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 271: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + case 269: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy148)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy148); yylhsminor.yy148 = yymsp[-2].minor.yy148; } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 272: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + case 270: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy148)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy148); yylhsminor.yy148 = yymsp[-2].minor.yy148; } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 273: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + case 271: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy397, &yymsp[-2].minor.yy199, yymsp[0].minor.yy148); } break; - case 274: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + case 272: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy397, &yymsp[-3].minor.yy199, &yymsp[0].minor.yy199, false); } break; - case 275: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + case 273: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy397, &yymsp[-5].minor.yy199, &yymsp[0].minor.yy199, true); } break; - case 276: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + case 274: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy397, &yymsp[-3].minor.yy199, yymsp[0].minor.yy148, false); } break; - case 277: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + case 275: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy397, &yymsp[-5].minor.yy199, yymsp[0].minor.yy148, true); } break; - case 278: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 276: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy397, &yymsp[0].minor.yy199); } break; - case 279: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + case 277: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy397, &yymsp[-2].minor.yy199, &yymsp[0].minor.yy199); } break; - case 280: /* cmd ::= DESC full_table_name */ - case 281: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==281); + case 278: /* cmd ::= DESC full_table_name */ + case 279: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==279); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy148); } break; - case 282: /* cmd ::= RESET QUERY CACHE */ + case 280: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 283: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 281: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy397, yymsp[-1].minor.yy148, yymsp[0].minor.yy148); } break; - case 286: /* explain_options ::= */ + case 284: /* explain_options ::= */ { yymsp[1].minor.yy148 = createDefaultExplainOptions(pCxt); } break; - case 287: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 285: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy148 = setExplainVerbose(pCxt, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 288: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 286: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy148 = setExplainRatio(pCxt, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 289: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + case 287: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy397, yymsp[-8].minor.yy397, &yymsp[-5].minor.yy199, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy530, yymsp[0].minor.yy706); } break; - case 290: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 288: /* cmd ::= DROP FUNCTION exists_opt function_name */ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy397, &yymsp[0].minor.yy199); } break; - case 295: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ + case 293: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy397, &yymsp[-7].minor.yy199, yymsp[-4].minor.yy148, yymsp[-6].minor.yy148, yymsp[-3].minor.yy404, yymsp[-2].minor.yy148, yymsp[0].minor.yy148); } break; - case 296: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 294: /* cmd ::= DROP STREAM exists_opt stream_name */ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy397, &yymsp[0].minor.yy199); } break; - case 298: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 296: /* stream_options ::= stream_options TRIGGER AT_ONCE */ { ((SStreamOptions*)yymsp[-2].minor.yy148)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy148 = yymsp[-2].minor.yy148; } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 299: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + case 297: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ { ((SStreamOptions*)yymsp[-2].minor.yy148)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy148 = yymsp[-2].minor.yy148; } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 300: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 298: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-3].minor.yy148)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy148)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy148); yylhsminor.yy148 = yymsp[-3].minor.yy148; } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 302: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + case 300: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ { ((SStreamOptions*)yymsp[-3].minor.yy148)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy148 = yymsp[-3].minor.yy148; } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 303: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + case 301: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ { ((SStreamOptions*)yymsp[-2].minor.yy148)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy148 = yymsp[-2].minor.yy148; } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 305: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 490: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==490); - case 508: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==508); + case 303: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 488: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==488); + case 506: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==506); { yymsp[-3].minor.yy148 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy148); } break; - case 306: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 304: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 307: /* cmd ::= KILL QUERY NK_STRING */ + case 305: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 308: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 306: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 309: /* cmd ::= BALANCE VGROUP */ + case 307: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 310: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 308: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 311: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + case 309: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy404); } break; - case 312: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 310: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 313: /* dnode_list ::= DNODE NK_INTEGER */ + case 311: /* dnode_list ::= DNODE NK_INTEGER */ { yymsp[-1].minor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 315: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ + case 313: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy148, yymsp[0].minor.yy148); } break; - case 317: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + case 315: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy148, yymsp[-2].minor.yy404, yymsp[0].minor.yy148); } break; - case 318: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ + case 316: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy148, NULL, yymsp[0].minor.yy148); } break; - case 319: /* literal ::= NK_INTEGER */ + case 317: /* literal ::= NK_INTEGER */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 320: /* literal ::= NK_FLOAT */ + case 318: /* literal ::= NK_FLOAT */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 321: /* literal ::= NK_STRING */ + case 319: /* literal ::= NK_STRING */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 322: /* literal ::= NK_BOOL */ + case 320: /* literal ::= NK_BOOL */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 323: /* literal ::= TIMESTAMP NK_STRING */ + case 321: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 324: /* literal ::= duration_literal */ - case 334: /* signed_literal ::= signed */ yytestcase(yyruleno==334); - case 354: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==354); - case 355: /* expression ::= literal */ yytestcase(yyruleno==355); - case 356: /* expression ::= pseudo_column */ yytestcase(yyruleno==356); - case 357: /* expression ::= column_reference */ yytestcase(yyruleno==357); - case 358: /* expression ::= function_expression */ yytestcase(yyruleno==358); - case 359: /* expression ::= case_when_expression */ yytestcase(yyruleno==359); - case 389: /* function_expression ::= literal_func */ yytestcase(yyruleno==389); - case 438: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==438); - case 442: /* boolean_primary ::= predicate */ yytestcase(yyruleno==442); - case 444: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==444); - case 445: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==445); - case 448: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==448); - case 450: /* table_reference ::= table_primary */ yytestcase(yyruleno==450); - case 451: /* table_reference ::= joined_table */ yytestcase(yyruleno==451); - case 455: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==455); - case 510: /* query_simple ::= query_specification */ yytestcase(yyruleno==510); - case 511: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==511); - case 514: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==514); - case 516: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==516); + case 322: /* literal ::= duration_literal */ + case 332: /* signed_literal ::= signed */ yytestcase(yyruleno==332); + case 352: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==352); + case 353: /* expression ::= literal */ yytestcase(yyruleno==353); + case 354: /* expression ::= pseudo_column */ yytestcase(yyruleno==354); + case 355: /* expression ::= column_reference */ yytestcase(yyruleno==355); + case 356: /* expression ::= function_expression */ yytestcase(yyruleno==356); + case 357: /* expression ::= case_when_expression */ yytestcase(yyruleno==357); + case 387: /* function_expression ::= literal_func */ yytestcase(yyruleno==387); + case 436: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==436); + case 440: /* boolean_primary ::= predicate */ yytestcase(yyruleno==440); + case 442: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==442); + case 443: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==443); + case 446: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==446); + case 448: /* table_reference ::= table_primary */ yytestcase(yyruleno==448); + case 449: /* table_reference ::= joined_table */ yytestcase(yyruleno==449); + case 453: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==453); + case 508: /* query_simple ::= query_specification */ yytestcase(yyruleno==508); + case 509: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==509); + case 512: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==512); + case 514: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==514); { yylhsminor.yy148 = yymsp[0].minor.yy148; } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 325: /* literal ::= NULL */ + case 323: /* literal ::= NULL */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 326: /* literal ::= NK_QUESTION */ + case 324: /* literal ::= NK_QUESTION */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 327: /* duration_literal ::= NK_VARIABLE */ + case 325: /* duration_literal ::= NK_VARIABLE */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 328: /* signed ::= NK_INTEGER */ + case 326: /* signed ::= NK_INTEGER */ { yylhsminor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 329: /* signed ::= NK_PLUS NK_INTEGER */ + case 327: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 330: /* signed ::= NK_MINUS NK_INTEGER */ + case 328: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -4649,14 +4680,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 331: /* signed ::= NK_FLOAT */ + case 329: /* signed ::= NK_FLOAT */ { yylhsminor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 332: /* signed ::= NK_PLUS NK_FLOAT */ + case 330: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 333: /* signed ::= NK_MINUS NK_FLOAT */ + case 331: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -4664,57 +4695,57 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 335: /* signed_literal ::= NK_STRING */ + case 333: /* signed_literal ::= NK_STRING */ { yylhsminor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 336: /* signed_literal ::= NK_BOOL */ + case 334: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 337: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 335: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 338: /* signed_literal ::= duration_literal */ - case 340: /* signed_literal ::= literal_func */ yytestcase(yyruleno==340); - case 409: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==409); - case 471: /* select_item ::= common_expression */ yytestcase(yyruleno==471); - case 481: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==481); - case 515: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==515); - case 517: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==517); - case 530: /* search_condition ::= common_expression */ yytestcase(yyruleno==530); + case 336: /* signed_literal ::= duration_literal */ + case 338: /* signed_literal ::= literal_func */ yytestcase(yyruleno==338); + case 407: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==407); + case 469: /* select_item ::= common_expression */ yytestcase(yyruleno==469); + case 479: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==479); + case 513: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==513); + case 515: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==515); + case 528: /* search_condition ::= common_expression */ yytestcase(yyruleno==528); { yylhsminor.yy148 = releaseRawExprNode(pCxt, yymsp[0].minor.yy148); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 339: /* signed_literal ::= NULL */ + case 337: /* signed_literal ::= NULL */ { yylhsminor.yy148 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 341: /* signed_literal ::= NK_QUESTION */ + case 339: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy148 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 360: /* expression ::= NK_LP expression NK_RP */ - case 443: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==443); - case 529: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==529); + case 358: /* expression ::= NK_LP expression NK_RP */ + case 441: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==441); + case 527: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==527); { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy148)); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 361: /* expression ::= NK_PLUS expr_or_subquery */ + case 359: /* expression ::= NK_PLUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy148)); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 362: /* expression ::= NK_MINUS expr_or_subquery */ + case 360: /* expression ::= NK_MINUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy148), NULL)); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 363: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 361: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4722,7 +4753,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 364: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 362: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4730,7 +4761,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 365: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 363: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4738,7 +4769,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 366: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 364: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4746,7 +4777,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 367: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 365: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4754,14 +4785,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 368: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 366: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); yylhsminor.yy148 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy148), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 369: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 367: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4769,7 +4800,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 370: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 368: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4777,70 +4808,70 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 373: /* column_reference ::= column_name */ + case 371: /* column_reference ::= column_name */ { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy199, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy199)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 374: /* column_reference ::= table_name NK_DOT column_name */ + case 372: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy199, &yymsp[0].minor.yy199, createColumnNode(pCxt, &yymsp[-2].minor.yy199, &yymsp[0].minor.yy199)); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 375: /* pseudo_column ::= ROWTS */ - case 376: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==376); - case 378: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==378); - case 379: /* pseudo_column ::= QEND */ yytestcase(yyruleno==379); - case 380: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==380); - case 381: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==381); - case 382: /* pseudo_column ::= WEND */ yytestcase(yyruleno==382); - case 383: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==383); - case 384: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==384); - case 385: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==385); - case 391: /* literal_func ::= NOW */ yytestcase(yyruleno==391); + case 373: /* pseudo_column ::= ROWTS */ + case 374: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==374); + case 376: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==376); + case 377: /* pseudo_column ::= QEND */ yytestcase(yyruleno==377); + case 378: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==378); + case 379: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==379); + case 380: /* pseudo_column ::= WEND */ yytestcase(yyruleno==380); + case 381: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==381); + case 382: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==382); + case 383: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==383); + case 389: /* literal_func ::= NOW */ yytestcase(yyruleno==389); { yylhsminor.yy148 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 377: /* pseudo_column ::= table_name NK_DOT TBNAME */ + case 375: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy199, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy199)))); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 386: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 387: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==387); + case 384: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 385: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==385); { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy199, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy199, yymsp[-1].minor.yy404)); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 388: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 386: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), yymsp[-1].minor.yy530)); } yymsp[-5].minor.yy148 = yylhsminor.yy148; break; - case 390: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 388: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy199, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy199, NULL)); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 405: /* star_func_para_list ::= NK_STAR */ + case 403: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy404 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy404 = yylhsminor.yy404; break; - case 410: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 474: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==474); + case 408: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 472: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==472); { yylhsminor.yy148 = createColumnNode(pCxt, &yymsp[-2].minor.yy199, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 411: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ + case 409: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy404, yymsp[-1].minor.yy148)); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 412: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + case 410: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), yymsp[-2].minor.yy404, yymsp[-1].minor.yy148)); } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 415: /* when_then_expr ::= WHEN common_expression THEN common_expression */ + case 413: /* when_then_expr ::= WHEN common_expression THEN common_expression */ { yymsp[-3].minor.yy148 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy148), releaseRawExprNode(pCxt, yymsp[0].minor.yy148)); } break; - case 417: /* case_when_else_opt ::= ELSE common_expression */ + case 415: /* case_when_else_opt ::= ELSE common_expression */ { yymsp[-1].minor.yy148 = releaseRawExprNode(pCxt, yymsp[0].minor.yy148); } break; - case 418: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 423: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==423); + case 416: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 421: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==421); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4848,7 +4879,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 419: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 417: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4856,7 +4887,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy148 = yylhsminor.yy148; break; - case 420: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 418: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4864,71 +4895,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy148 = yylhsminor.yy148; break; - case 421: /* predicate ::= expr_or_subquery IS NULL */ + case 419: /* predicate ::= expr_or_subquery IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); yylhsminor.yy148 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy148), NULL)); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 422: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 420: /* predicate ::= expr_or_subquery IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy148); yylhsminor.yy148 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), NULL)); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 424: /* compare_op ::= NK_LT */ + case 422: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy20 = OP_TYPE_LOWER_THAN; } break; - case 425: /* compare_op ::= NK_GT */ + case 423: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy20 = OP_TYPE_GREATER_THAN; } break; - case 426: /* compare_op ::= NK_LE */ + case 424: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy20 = OP_TYPE_LOWER_EQUAL; } break; - case 427: /* compare_op ::= NK_GE */ + case 425: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy20 = OP_TYPE_GREATER_EQUAL; } break; - case 428: /* compare_op ::= NK_NE */ + case 426: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy20 = OP_TYPE_NOT_EQUAL; } break; - case 429: /* compare_op ::= NK_EQ */ + case 427: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy20 = OP_TYPE_EQUAL; } break; - case 430: /* compare_op ::= LIKE */ + case 428: /* compare_op ::= LIKE */ { yymsp[0].minor.yy20 = OP_TYPE_LIKE; } break; - case 431: /* compare_op ::= NOT LIKE */ + case 429: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy20 = OP_TYPE_NOT_LIKE; } break; - case 432: /* compare_op ::= MATCH */ + case 430: /* compare_op ::= MATCH */ { yymsp[0].minor.yy20 = OP_TYPE_MATCH; } break; - case 433: /* compare_op ::= NMATCH */ + case 431: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy20 = OP_TYPE_NMATCH; } break; - case 434: /* compare_op ::= CONTAINS */ + case 432: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy20 = OP_TYPE_JSON_CONTAINS; } break; - case 435: /* in_op ::= IN */ + case 433: /* in_op ::= IN */ { yymsp[0].minor.yy20 = OP_TYPE_IN; } break; - case 436: /* in_op ::= NOT IN */ + case 434: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy20 = OP_TYPE_NOT_IN; } break; - case 437: /* in_predicate_value ::= NK_LP literal_list NK_RP */ + case 435: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 439: /* boolean_value_expression ::= NOT boolean_primary */ + case 437: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy148), NULL)); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 440: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 438: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4936,7 +4967,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 441: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 439: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy148); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy148); @@ -4944,48 +4975,48 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 447: /* from_clause_opt ::= FROM table_reference_list */ - case 476: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==476); - case 504: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==504); + case 445: /* from_clause_opt ::= FROM table_reference_list */ + case 474: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==474); + case 502: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==502); { yymsp[-1].minor.yy148 = yymsp[0].minor.yy148; } break; - case 449: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 447: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy148 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy148, yymsp[0].minor.yy148, NULL); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 452: /* table_primary ::= table_name alias_opt */ + case 450: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy148 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy199, &yymsp[0].minor.yy199); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 453: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 451: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy148 = createRealTableNode(pCxt, &yymsp[-3].minor.yy199, &yymsp[-1].minor.yy199, &yymsp[0].minor.yy199); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 454: /* table_primary ::= subquery alias_opt */ + case 452: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy148 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy148), &yymsp[0].minor.yy199); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 456: /* alias_opt ::= */ + case 454: /* alias_opt ::= */ { yymsp[1].minor.yy199 = nil_token; } break; - case 458: /* alias_opt ::= AS table_alias */ + case 456: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy199 = yymsp[0].minor.yy199; } break; - case 459: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 460: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==460); + case 457: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 458: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==458); { yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148; } break; - case 461: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 459: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy148 = createJoinTableNode(pCxt, yymsp[-4].minor.yy470, yymsp[-5].minor.yy148, yymsp[-2].minor.yy148, yymsp[0].minor.yy148); } yymsp[-5].minor.yy148 = yylhsminor.yy148; break; - case 462: /* join_type ::= */ + case 460: /* join_type ::= */ { yymsp[1].minor.yy470 = JOIN_TYPE_INNER; } break; - case 463: /* join_type ::= INNER */ + case 461: /* join_type ::= INNER */ { yymsp[0].minor.yy470 = JOIN_TYPE_INNER; } break; - case 464: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 462: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { yymsp[-11].minor.yy148 = createSelectStmt(pCxt, yymsp[-10].minor.yy397, yymsp[-9].minor.yy404, yymsp[-8].minor.yy148); yymsp[-11].minor.yy148 = addWhereClause(pCxt, yymsp[-11].minor.yy148, yymsp[-7].minor.yy148); @@ -4998,73 +5029,73 @@ static YYACTIONTYPE yy_reduce( yymsp[-11].minor.yy148 = addFillClause(pCxt, yymsp[-11].minor.yy148, yymsp[-3].minor.yy148); } break; - case 467: /* set_quantifier_opt ::= ALL */ + case 465: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy397 = false; } break; - case 470: /* select_item ::= NK_STAR */ + case 468: /* select_item ::= NK_STAR */ { yylhsminor.yy148 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy148 = yylhsminor.yy148; break; - case 472: /* select_item ::= common_expression column_alias */ - case 482: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==482); + case 470: /* select_item ::= common_expression column_alias */ + case 480: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==480); { yylhsminor.yy148 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy148), &yymsp[0].minor.yy199); } yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 473: /* select_item ::= common_expression AS column_alias */ - case 483: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==483); + case 471: /* select_item ::= common_expression AS column_alias */ + case 481: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==481); { yylhsminor.yy148 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy148), &yymsp[0].minor.yy199); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 478: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 500: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==500); - case 519: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==519); + case 476: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 498: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==498); + case 517: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==517); { yymsp[-2].minor.yy404 = yymsp[0].minor.yy404; } break; - case 485: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 483: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy148 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), releaseRawExprNode(pCxt, yymsp[-1].minor.yy148)); } break; - case 486: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + case 484: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy148 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy148)); } break; - case 487: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 485: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy148 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), NULL, yymsp[-1].minor.yy148, yymsp[0].minor.yy148); } break; - case 488: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 486: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy148 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy148), releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), yymsp[-1].minor.yy148, yymsp[0].minor.yy148); } break; - case 492: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 490: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy148 = createFillNode(pCxt, yymsp[-1].minor.yy334, NULL); } break; - case 493: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 491: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy148 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); } break; - case 494: /* fill_mode ::= NONE */ + case 492: /* fill_mode ::= NONE */ { yymsp[0].minor.yy334 = FILL_MODE_NONE; } break; - case 495: /* fill_mode ::= PREV */ + case 493: /* fill_mode ::= PREV */ { yymsp[0].minor.yy334 = FILL_MODE_PREV; } break; - case 496: /* fill_mode ::= NULL */ + case 494: /* fill_mode ::= NULL */ { yymsp[0].minor.yy334 = FILL_MODE_NULL; } break; - case 497: /* fill_mode ::= LINEAR */ + case 495: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy334 = FILL_MODE_LINEAR; } break; - case 498: /* fill_mode ::= NEXT */ + case 496: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy334 = FILL_MODE_NEXT; } break; - case 501: /* group_by_list ::= expr_or_subquery */ + case 499: /* group_by_list ::= expr_or_subquery */ { yylhsminor.yy404 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy148))); } yymsp[0].minor.yy404 = yylhsminor.yy404; break; - case 502: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + case 500: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ { yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy148))); } yymsp[-2].minor.yy404 = yylhsminor.yy404; break; - case 506: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + case 504: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ { yymsp[-5].minor.yy148 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy148), releaseRawExprNode(pCxt, yymsp[-1].minor.yy148)); } break; - case 509: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 507: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy148 = addOrderByClause(pCxt, yymsp[-3].minor.yy148, yymsp[-2].minor.yy404); yylhsminor.yy148 = addSlimitClause(pCxt, yylhsminor.yy148, yymsp[-1].minor.yy148); @@ -5072,50 +5103,50 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 512: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + case 510: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ { yylhsminor.yy148 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy148, yymsp[0].minor.yy148); } yymsp[-3].minor.yy148 = yylhsminor.yy148; break; - case 513: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + case 511: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ { yylhsminor.yy148 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy148, yymsp[0].minor.yy148); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 521: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 525: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==525); + case 519: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 523: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==523); { yymsp[-1].minor.yy148 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 522: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 526: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==526); + case 520: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 524: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==524); { yymsp[-3].minor.yy148 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 523: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 527: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==527); + case 521: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 525: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==525); { yymsp[-3].minor.yy148 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 528: /* subquery ::= NK_LP query_expression NK_RP */ + case 526: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy148 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy148); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 533: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + case 531: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ { yylhsminor.yy148 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy148), yymsp[-1].minor.yy898, yymsp[0].minor.yy499); } yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 534: /* ordering_specification_opt ::= */ + case 532: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy898 = ORDER_ASC; } break; - case 535: /* ordering_specification_opt ::= ASC */ + case 533: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy898 = ORDER_ASC; } break; - case 536: /* ordering_specification_opt ::= DESC */ + case 534: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy898 = ORDER_DESC; } break; - case 537: /* null_ordering_opt ::= */ + case 535: /* null_ordering_opt ::= */ { yymsp[1].minor.yy499 = NULL_ORDER_DEFAULT; } break; - case 538: /* null_ordering_opt ::= NULLS FIRST */ + case 536: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy499 = NULL_ORDER_FIRST; } break; - case 539: /* null_ordering_opt ::= NULLS LAST */ + case 537: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy499 = NULL_ORDER_LAST; } break; default: diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index cc51beb842..ae702ec02f 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -248,6 +248,13 @@ int32_t __catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableNam return code; } +int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta) { + int32_t code = g_mockCatalogService->catalogGetTableMeta(pTableName, pTableMeta, true); + if (code) return code; + code = g_mockCatalogService->catalogGetTableHashVgroup(pTableName, pVgroup, true); + return code; +} + int32_t __catalogGetTableDistVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, SArray** pVgList) { return g_mockCatalogService->catalogGetTableDistVgInfo(pTableName, pVgList); @@ -316,6 +323,7 @@ void initMetaDataEnv() { stub.set(catalogGetCachedSTableMeta, __catalogGetCachedTableMeta); stub.set(catalogGetTableHashVgroup, __catalogGetTableHashVgroup); stub.set(catalogGetCachedTableHashVgroup, __catalogGetCachedTableHashVgroup); + stub.set(catalogGetCachedTableVgMeta, __catalogGetCachedTableVgMeta); stub.set(catalogGetTableDistVgInfo, __catalogGetTableDistVgInfo); stub.set(catalogGetDBVgVersion, __catalogGetDBVgVersion); stub.set(catalogGetDBVgList, __catalogGetDBVgList); diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 334d12b95f..17d02c1cce 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -48,7 +48,7 @@ TEST_F(ParserInitialCTest, createAccount) { * | PRECISION {'ms' | 'us' | 'ns'} * | REPLICA value * | RETENTIONS ingestion_duration:keep_duration ... - * | STRICT {'off' | 'on'} + * | STRICT {'off' | 'on'} // not support * | WAL_LEVEL value * | VGROUPS value * | SINGLE_STABLE {0 | 1} @@ -216,7 +216,7 @@ TEST_F(ParserInitialCTest, createDatabase) { addDbRetentionFunc(15 * MILLISECOND_PER_SECOND, 7 * MILLISECOND_PER_DAY, TIME_UNIT_SECOND, TIME_UNIT_DAY); addDbRetentionFunc(1 * MILLISECOND_PER_MINUTE, 21 * MILLISECOND_PER_DAY, TIME_UNIT_MINUTE, TIME_UNIT_DAY); addDbRetentionFunc(15 * MILLISECOND_PER_MINUTE, 500 * MILLISECOND_PER_DAY, TIME_UNIT_MINUTE, TIME_UNIT_DAY); - setDbStrictaFunc(1); + // setDbStrictaFunc(1); setDbWalLevelFunc(2); setDbVgroupsFunc(100); setDbSingleStableFunc(1); @@ -244,7 +244,7 @@ TEST_F(ParserInitialCTest, createDatabase) { "PRECISION 'ns' " "REPLICA 3 " "RETENTIONS 15s:7d,1m:21d,15m:500d " - "STRICT 'on' " + // "STRICT 'on' " "WAL_LEVEL 2 " "VGROUPS 100 " "SINGLE_STABLE 1 " diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index af361323a7..eb6091d605 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -31,7 +31,7 @@ extern "C" { #define QW_DEFAULT_SCHEDULER_NUMBER 100 #define QW_DEFAULT_TASK_NUMBER 10000 -#define QW_DEFAULT_SCH_TASK_NUMBER 10000 +#define QW_DEFAULT_SCH_TASK_NUMBER 500 #define QW_DEFAULT_SHORT_RUN_TIMES 2 #define QW_DEFAULT_HEARTBEAT_MSEC 5000 #define QW_SCH_TIMEOUT_MSEC 180000 @@ -247,7 +247,7 @@ typedef struct SQWorkerMgmt { #define QW_ERR_RET(c) \ do { \ - int32_t _code = (c); \ + int32_t _code = (c); \ if (_code != TSDB_CODE_SUCCESS) { \ terrno = _code; \ return _code; \ @@ -255,7 +255,7 @@ typedef struct SQWorkerMgmt { } while (0) #define QW_RET(c) \ do { \ - int32_t _code = (c); \ + int32_t _code = (c); \ if (_code != TSDB_CODE_SUCCESS) { \ terrno = _code; \ } \ @@ -263,7 +263,7 @@ typedef struct SQWorkerMgmt { } while (0) #define QW_ERR_JRET(c) \ do { \ - code = (c); \ + code = (c); \ if (code != TSDB_CODE_SUCCESS) { \ terrno = code; \ goto _return; \ diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index ce3b493638..fdd2775daa 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -74,6 +74,8 @@ int32_t qwAddSchedulerImpl(SQWorker *mgmt, uint64_t sId, int32_t rwType) { SQWSchStatus newSch = {0}; newSch.tasksHash = taosHashInit(mgmt->cfg.maxSchTaskNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + newSch.hbBrokenTs = taosGetTimestampMs(); + if (NULL == newSch.tasksHash) { QW_SCH_ELOG("taosHashInit %d failed", mgmt->cfg.maxSchTaskNum); QW_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); @@ -281,7 +283,7 @@ void qwFreeTaskHandle(qTaskInfo_t *taskHandle) { int32_t qwKillTaskHandle(SQWTaskCtx *ctx, int32_t rspCode) { int32_t code = 0; - + // Note: free/kill may in RC qTaskInfo_t taskHandle = atomic_load_ptr(&ctx->taskHandle); if (taskHandle && atomic_val_compare_exchange_ptr(&ctx->taskHandle, taskHandle, NULL)) { @@ -463,6 +465,8 @@ void qwDestroyImpl(void *pMgmt) { int8_t nodeType = mgmt->nodeType; int32_t nodeId = mgmt->nodeId; + int32_t taskCount = 0; + int32_t schStatusCount = 0; qDebug("start to destroy qworker, type:%d, id:%d, handle:%p", nodeType, nodeId, mgmt); taosTmrStop(mgmt->hbTimer); @@ -472,6 +476,7 @@ void qwDestroyImpl(void *pMgmt) { uint64_t qId, tId; int32_t eId; void *pIter = taosHashIterate(mgmt->ctxHash, NULL); + while (pIter) { SQWTaskCtx *ctx = (SQWTaskCtx *)pIter; void *key = taosHashGetKey(pIter, NULL); @@ -480,6 +485,7 @@ void qwDestroyImpl(void *pMgmt) { qwFreeTaskCtx(ctx); QW_TASK_DLOG_E("task ctx freed"); pIter = taosHashIterate(mgmt->ctxHash, pIter); + taskCount++; } taosHashCleanup(mgmt->ctxHash); @@ -487,7 +493,9 @@ void qwDestroyImpl(void *pMgmt) { while (pIter) { SQWSchStatus *sch = (SQWSchStatus *)pIter; qwDestroySchStatus(sch); + pIter = taosHashIterate(mgmt->schHash, pIter); + schStatusCount++; } taosHashCleanup(mgmt->schHash); @@ -499,7 +507,8 @@ void qwDestroyImpl(void *pMgmt) { qwCloseRef(); - qDebug("qworker destroyed, type:%d, id:%d, handle:%p", nodeType, nodeId, mgmt); + qDebug("qworker destroyed, type:%d, id:%d, handle:%p, taskCount:%d, schStatusCount: %d", nodeType, nodeId, mgmt, + taskCount, schStatusCount); } int32_t qwOpenRef(void) { diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index c5db4105d7..81f73b1226 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -8,9 +8,9 @@ #include "qwMsg.h" #include "tcommon.h" #include "tdatablock.h" +#include "tglobal.h" #include "tmsg.h" #include "tname.h" -#include "tglobal.h" SQWorkerMgmt gQwMgmt = { .lock = 0, @@ -117,7 +117,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { if (queryStop) { *queryStop = true; } - + return TSDB_CODE_SUCCESS; } @@ -275,7 +275,7 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, QW_ERR_RET(code); } - QW_TASK_DLOG("no more data in sink and query end, fetched blocks %d rows %"PRId64, pOutput->numOfBlocks, + QW_TASK_DLOG("no more data in sink and query end, fetched blocks %d rows %" PRId64, pOutput->numOfBlocks, pOutput->numOfRows); qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC); @@ -327,12 +327,14 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, } if (0 == ctx->level) { - QW_TASK_DLOG("task fetched blocks %d rows %"PRId64", level %d", pOutput->numOfBlocks, pOutput->numOfRows, ctx->level); + QW_TASK_DLOG("task fetched blocks %d rows %" PRId64 ", level %d", pOutput->numOfBlocks, pOutput->numOfRows, + ctx->level); break; } if (pOutput->numOfRows >= QW_MIN_RES_ROWS) { - QW_TASK_DLOG("task fetched blocks %d rows %" PRId64 " reaches the min rows", pOutput->numOfBlocks, pOutput->numOfRows); + QW_TASK_DLOG("task fetched blocks %d rows %" PRId64 " reaches the min rows", pOutput->numOfBlocks, + pOutput->numOfRows); break; } } @@ -538,7 +540,7 @@ _return: SQWMsg qwMsg = {.msgType = ctx->msgType, .connInfo = ctx->ctrlConnInfo}; qwDbgSimulateRedirect(&qwMsg, ctx, &rsped); qwDbgSimulateDead(QW_FPARAMS(), ctx, &rsped); - if (!rsped) { + if (!rsped) { qwSendQueryRsp(QW_FPARAMS(), input->msgType + 1, ctx, code, false); } } @@ -650,8 +652,8 @@ _return: code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL); if (QUERY_RSP_POLICY_QUICK == tsQueryRspPolicy && ctx != NULL && QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) { - void *rsp = NULL; - int32_t dataLen = 0; + void *rsp = NULL; + int32_t dataLen = 0; SOutputData sOutput = {0}; if (qwGetQueryResFromSink(QW_FPARAMS(), ctx, &dataLen, &rsp, &sOutput)) { return TSDB_CODE_SUCCESS; @@ -671,8 +673,8 @@ _return: qwBuildAndSendFetchRsp(ctx->fetchType, &qwMsg->connInfo, rsp, dataLen, code); rsp = NULL; - QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, - tstrerror(code), dataLen); + QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), + dataLen); } } @@ -689,7 +691,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { do { ctx = NULL; - + QW_ERR_JRET(qwHandlePrePhaseEvents(QW_FPARAMS(), QW_PHASE_PRE_CQUERY, &input, NULL)); QW_ERR_JRET(qwGetTaskCtx(QW_FPARAMS(), &ctx)); @@ -748,7 +750,8 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { } QW_LOCK(QW_WRITE, &ctx->lock); - if ((queryStop && (0 == atomic_load_8((int8_t *)&ctx->queryContinue))) || code || 0 == atomic_load_8((int8_t *)&ctx->queryContinue)) { + if ((queryStop && (0 == atomic_load_8((int8_t *)&ctx->queryContinue))) || code || + 0 == atomic_load_8((int8_t *)&ctx->queryContinue)) { // Note: query is not running anymore QW_SET_PHASE(ctx, 0); QW_UNLOCK(QW_WRITE, &ctx->lock); @@ -1176,7 +1179,7 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) { QW_DLOG("start to stop all tasks, taskNum:%d", taosHashGetSize(mgmt->ctxHash)); uint64_t qId, tId; - int32_t eId; + int32_t eId; void *pIter = taosHashIterate(mgmt->ctxHash, NULL); while (pIter) { SQWTaskCtx *ctx = (SQWTaskCtx *)pIter; @@ -1186,7 +1189,7 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) { QW_LOCK(QW_WRITE, &ctx->lock); QW_TASK_DLOG_E("start to force stop task"); - + if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP) || QW_EVENT_PROCESSED(ctx, QW_EVENT_DROP)) { QW_TASK_WLOG_E("task already dropping"); QW_UNLOCK(QW_WRITE, &ctx->lock); @@ -1194,7 +1197,7 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) { pIter = taosHashIterate(mgmt->ctxHash, pIter); continue; } - + if (QW_QUERY_RUNNING(ctx)) { qwKillTaskHandle(ctx, TSDB_CODE_VND_STOPPED); } else if (!QW_EVENT_PROCESSED(ctx, QW_EVENT_DROP)) { diff --git a/source/libs/scheduler/src/schStatus.c b/source/libs/scheduler/src/schStatus.c index 66d58c95d1..4c16a81a05 100644 --- a/source/libs/scheduler/src/schStatus.c +++ b/source/libs/scheduler/src/schStatus.c @@ -64,7 +64,7 @@ _return: int32_t schHandleOpBeginEvent(int64_t jobId, SSchJob** job, SCH_OP_TYPE type, SSchedulerReq* pReq) { SSchJob* pJob = schAcquireJob(jobId); if (NULL == pJob) { - qWarn("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, jobId); + qDebug("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, jobId); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 1926c26dc9..7cd5e957b6 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -157,7 +157,7 @@ void schedulerFreeJob(int64_t *jobId, int32_t errCode) { SSchJob *pJob = schAcquireJob(*jobId); if (NULL == pJob) { - qWarn("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); + qDebug("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); return; } diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index 79549675a3..5b542dd54b 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -56,7 +56,7 @@ void streamSchedByTimer(void* param, void* tmrId) { } if (atomic_load_8(&pTask->triggerStatus) == TASK_TRIGGER_STATUS__ACTIVE) { - SStreamTrigger* trigger = taosAllocateQitem(sizeof(SStreamTrigger), DEF_QITEM); + SStreamTrigger* trigger = taosAllocateQitem(sizeof(SStreamTrigger), DEF_QITEM, 0); if (trigger == NULL) return; trigger->type = STREAM_INPUT__GET_RES; trigger->pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); @@ -112,7 +112,7 @@ int32_t streamSchedExec(SStreamTask* pTask) { } int32_t streamTaskEnqueue(SStreamTask* pTask, const SStreamDispatchReq* pReq, SRpcMsg* pRsp) { - SStreamDataBlock* pData = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); + SStreamDataBlock* pData = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0); int8_t status; // enqueue @@ -150,7 +150,7 @@ int32_t streamTaskEnqueue(SStreamTask* pTask, const SStreamDispatchReq* pReq, SR } int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pRsp) { - SStreamDataBlock* pData = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); + SStreamDataBlock* pData = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0); int8_t status = TASK_INPUT_STATUS__NORMAL; // enqueue diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 2fea5b9eca..6cc684dddf 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -67,7 +67,7 @@ int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock } SStreamDataSubmit* streamDataSubmitNew(SSubmitReq* pReq) { - SStreamDataSubmit* pDataSubmit = (SStreamDataSubmit*)taosAllocateQitem(sizeof(SStreamDataSubmit), DEF_QITEM); + SStreamDataSubmit* pDataSubmit = (SStreamDataSubmit*)taosAllocateQitem(sizeof(SStreamDataSubmit), DEF_QITEM, 0); if (pDataSubmit == NULL) return NULL; pDataSubmit->dataRef = (int32_t*)taosMemoryMalloc(sizeof(int32_t)); if (pDataSubmit->dataRef == NULL) goto FAIL; @@ -81,7 +81,7 @@ FAIL: } SStreamMergedSubmit* streamMergedSubmitNew() { - SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)taosAllocateQitem(sizeof(SStreamMergedSubmit), DEF_QITEM); + SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)taosAllocateQitem(sizeof(SStreamMergedSubmit), DEF_QITEM, 0); if (pMerged == NULL) return NULL; pMerged->reqs = taosArrayInit(0, sizeof(void*)); pMerged->dataRefs = taosArrayInit(0, sizeof(void*)); @@ -107,7 +107,7 @@ static FORCE_INLINE void streamDataSubmitRefInc(SStreamDataSubmit* pDataSubmit) } SStreamDataSubmit* streamSubmitRefClone(SStreamDataSubmit* pSubmit) { - SStreamDataSubmit* pSubmitClone = taosAllocateQitem(sizeof(SStreamDataSubmit), DEF_QITEM); + SStreamDataSubmit* pSubmitClone = taosAllocateQitem(sizeof(SStreamDataSubmit), DEF_QITEM, 0); if (pSubmitClone == NULL) { return NULL; } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index d20c2902f5..20608a6cf3 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -127,7 +127,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { taosArrayDestroy(pRes); break; } - SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); + SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0); if (qRes == NULL) { taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -235,7 +235,7 @@ int32_t streamExecForAll(SStreamTask* pTask) { qDebug("stream task %d exec end", pTask->taskId); if (taosArrayGetSize(pRes) != 0) { - SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); + SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0); if (qRes == NULL) { taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); streamFreeQitem(input); diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index dee0bf95c7..a5524ffbde 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -215,7 +215,7 @@ int32_t syncNodeStart(SSyncNode* pSyncNode); int32_t syncNodeStartStandBy(SSyncNode* pSyncNode); void syncNodeClose(SSyncNode* pSyncNode); void syncNodePreClose(SSyncNode* pSyncNode); -int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak); +int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_t *seq); int32_t syncNodeRestore(SSyncNode* pSyncNode); void syncHbTimerDataFree(SSyncHbTimerData* pData); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 6ed9fa66ea..d6ce77193a 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -151,7 +151,7 @@ int32_t syncReconfig(int64_t rid, SSyncCfg* pNewCfg) { } syncNodeStartHeartbeatTimer(pSyncNode); - syncNodeReplicate(pSyncNode); + // syncNodeReplicate(pSyncNode); } syncNodeRelease(pSyncNode); @@ -218,6 +218,26 @@ int32_t syncLeaderTransfer(int64_t rid) { return ret; } +int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq) { + SSyncNode* pNode = syncNodeAcquire(rid); + if (pNode == NULL) return -1; + + SRpcMsg rpcMsg = {0}; + int32_t ret = syncRespMgrGetAndDel(pNode->pSyncRespMgr, seq, &rpcMsg.info); + rpcMsg.code = TSDB_CODE_SYN_TIMEOUT; + + syncNodeRelease(pNode); + if (ret == 1) { + sInfo("send timeout response, seq:%" PRId64 " handle:%p ahandle:%p", seq, rpcMsg.info.handle, + rpcMsg.info.ahandle); + rpcSendResponse(&rpcMsg); + return 0; + } else { + sInfo("no rpcinfo to send timeout response, seq:%" PRId64, seq); + return -1; + } +} + SyncIndex syncMinMatchIndex(SSyncNode* pSyncNode) { SyncIndex minMatchIndex = SYNC_INDEX_INVALID; @@ -538,7 +558,7 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) { pMsg->newLeaderId.vgId = pSyncNode->vgId; pMsg->newNodeInfo = newLeader; - int32_t ret = syncNodePropose(pSyncNode, &rpcMsg, false); + int32_t ret = syncNodePropose(pSyncNode, &rpcMsg, false, NULL); rpcFreeCont(rpcMsg.pCont); return ret; } @@ -670,19 +690,19 @@ void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet) { syncNodeRelease(pSyncNode); } -int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak) { +int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak, int64_t* seq) { SSyncNode* pSyncNode = syncNodeAcquire(rid); if (pSyncNode == NULL) { sError("sync propose error"); return -1; } - int32_t ret = syncNodePropose(pSyncNode, pMsg, isWeak); + int32_t ret = syncNodePropose(pSyncNode, pMsg, isWeak, seq); syncNodeRelease(pSyncNode); return ret; } -int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) { +int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_t* seq) { if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { terrno = TSDB_CODE_SYN_NOT_LEADER; sNError(pSyncNode, "sync propose not leader, %s, type:%s", syncStr(pSyncNode->state), TMSG_INFO(pMsg->msgType)); @@ -739,6 +759,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) { (void)syncRespMgrDel(pSyncNode->pSyncRespMgr, seqNum); } + if (seq != NULL) *seq = seqNum; return code; } } @@ -1839,7 +1860,8 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { #endif // close receiver - if (snapshotReceiverIsStart(pSyncNode->pNewNodeReceiver)) { + if (pSyncNode != NULL && pSyncNode->pNewNodeReceiver != NULL && + snapshotReceiverIsStart(pSyncNode->pNewNodeReceiver)) { snapshotReceiverForceStop(pSyncNode->pNewNodeReceiver); } diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 7bd8d75dd1..88727351c6 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -594,6 +594,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { int count = 0; int64_t firstIndex = -1; SyncTerm term = -1; + int64_t batchSize = TMAX(1, pMgr->size >> (4 + pMgr->retryBackoff)); for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { int64_t pos = index % pMgr->size; @@ -620,7 +621,10 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { retried = true; if (firstIndex == -1) firstIndex = index; - count++; + + if (batchSize <= count++) { + break; + } } ret = 0; @@ -800,8 +804,9 @@ int32_t syncLogReplMgrReplicateProbeOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode int32_t syncLogReplMgrReplicateAttemptedOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { ASSERT(pMgr->restored); + SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; - int32_t batchSize = TMAX(1, pMgr->size / 20); + int32_t batchSize = TMAX(1, pMgr->size >> (4 + pMgr->retryBackoff)); int32_t count = 0; int64_t nowMs = taosGetMonoTimestampMs(); int64_t limit = pMgr->size >> 1; diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 42deb2c20a..540f40a4c0 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -345,6 +345,8 @@ bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver) { return pReceive void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { // force close, abandon incomplete data if (pReceiver->pWriter != NULL) { + // event log + sRTrace(pReceiver, "snapshot receiver force stop"); int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); ASSERT(ret == 0); @@ -354,7 +356,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { pReceiver->start = false; // event log - sRTrace(pReceiver, "snapshot receiver force stop"); + // sRTrace(pReceiver, "snapshot receiver force stop"); } int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { @@ -675,6 +677,7 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs sNTrace(pSyncNode, "snapshot receiver finish waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, pMsg->startTime); taosMsleep(10); + timeNow = taosGetTimestampMs(); } int32_t code = snapshotReceiverFinish(pReceiver, pMsg); diff --git a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp index 057f2ea6dd..7a5d0777bb 100644 --- a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp +++ b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp @@ -337,7 +337,7 @@ int main(int argc, char** argv) { if (alreadySend < writeRecordNum) { SRpcMsg* pRpcMsg = createRpcMsg(alreadySend, writeRecordNum, myIndex); - int32_t ret = syncPropose(rid, pRpcMsg, false); + int32_t ret = syncPropose(rid, pRpcMsg, false, NULL); if (ret == -1 && terrno == TSDB_CODE_SYN_NOT_LEADER) { sTrace("%s value%d write not leader", s, alreadySend); } else { diff --git a/source/libs/sync/test/syncConfigChangeTest.cpp b/source/libs/sync/test/syncConfigChangeTest.cpp index bab3d2236f..f35a23b15b 100644 --- a/source/libs/sync/test/syncConfigChangeTest.cpp +++ b/source/libs/sync/test/syncConfigChangeTest.cpp @@ -249,7 +249,7 @@ int main(int argc, char** argv) { if (alreadySend < writeRecordNum) { SRpcMsg* pRpcMsg = createRpcMsg(alreadySend, writeRecordNum, myIndex); - int32_t ret = syncPropose(rid, pRpcMsg, false); + int32_t ret = syncPropose(rid, pRpcMsg, false, NULL); if (ret == -1 && terrno == TSDB_CODE_SYN_NOT_LEADER) { sTrace("%s value%d write not leader", s, alreadySend); } else { diff --git a/source/libs/sync/test/syncReplicateTest.cpp b/source/libs/sync/test/syncReplicateTest.cpp index 4a82bba15d..22132eb01f 100644 --- a/source/libs/sync/test/syncReplicateTest.cpp +++ b/source/libs/sync/test/syncReplicateTest.cpp @@ -189,7 +189,7 @@ int main(int argc, char** argv) { if (alreadySend < writeRecordNum) { SRpcMsg* pRpcMsg = createRpcMsg(alreadySend, writeRecordNum, myIndex); - int32_t ret = syncPropose(rid, pRpcMsg, false); + int32_t ret = syncPropose(rid, pRpcMsg, false, NULL); if (ret == -1 && terrno == TSDB_CODE_SYN_NOT_LEADER) { sTrace("%s value%d write not leader", s, alreadySend); } else { diff --git a/source/libs/sync/test/syncTestTool.cpp b/source/libs/sync/test/syncTestTool.cpp index 8c486df118..4bc2e92d0c 100644 --- a/source/libs/sync/test/syncTestTool.cpp +++ b/source/libs/sync/test/syncTestTool.cpp @@ -396,7 +396,7 @@ int main(int argc, char** argv) { if (alreadySend < writeRecordNum) { SRpcMsg* pRpcMsg = createRpcMsg(alreadySend, writeRecordNum, myIndex); - int32_t ret = syncPropose(rid, pRpcMsg, false); + int32_t ret = syncPropose(rid, pRpcMsg, false, NULL); if (ret == -1 && terrno == TSDB_CODE_SYN_NOT_LEADER) { sTrace("%s value%d write not leader, leaderTransferWait:%d", simpleStr, alreadySend, leaderTransferWait); } else { diff --git a/source/libs/sync/test/sync_test_lib/src/syncIO.c b/source/libs/sync/test/sync_test_lib/src/syncIO.c index 415fecd9f2..4b305f823f 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncIO.c +++ b/source/libs/sync/test/sync_test_lib/src/syncIO.c @@ -97,7 +97,7 @@ int32_t syncIOEqMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) { syncRpcMsgLog2(logBuf, pMsg); SRpcMsg *pTemp; - pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM); + pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM, 0); memcpy(pTemp, pMsg, sizeof(SRpcMsg)); STaosQueue *pMsgQ = gSyncIO->pMsgQ; @@ -381,7 +381,7 @@ static void syncIOProcessRequest(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet) { syncRpcMsgLog2((char *)"==syncIOProcessRequest==", pMsg); SSyncIO *io = pParent; SRpcMsg *pTemp; - pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM); + pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM, 0); memcpy(pTemp, pMsg, sizeof(SRpcMsg)); taosWriteQitem(io->pMsgQ, pTemp); } @@ -441,7 +441,7 @@ static void syncIOTickQ(void *param, void *tmrId) { SRpcMsg rpcMsg; syncPingReply2RpcMsg(pMsg, &rpcMsg); SRpcMsg *pTemp; - pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM); + pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM, 0); memcpy(pTemp, &rpcMsg, sizeof(SRpcMsg)); syncRpcMsgLog2((char *)"==syncIOTickQ==", &rpcMsg); taosWriteQitem(io->pMsgQ, pTemp); diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h index c728e29641..10a99bb1fa 100644 --- a/source/libs/tdb/inc/tdb.h +++ b/source/libs/tdb/inc/tdb.h @@ -81,6 +81,8 @@ void tdbFree(void *); typedef struct hashset_st *hashset_t; +void hashset_destroy(hashset_t set); + struct STxn { int flags; int64_t txnId; diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 8c62f89b64..5c1f264460 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -110,6 +110,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg ret = tdbBegin(pEnv, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); if (ret < 0) { + tdbOsFree(pBt); return -1; } @@ -119,6 +120,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg ret = tdbPagerFetchPage(pPager, &pgno, &pPage, tdbBtreeInitPage, &zArg, txn); if (ret < 0) { tdbAbort(pEnv, txn); + tdbOsFree(pBt); return -1; } @@ -126,6 +128,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg if (ret < 0) { tdbError("failed to write page since %s", terrstr()); tdbAbort(pEnv, txn); + tdbOsFree(pBt); return -1; } @@ -138,6 +141,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg ret = tdbTbInsert(pPager->pEnv->pMainDb, tbname, strlen(tbname) + 1, &pBt->info, sizeof(pBt->info), txn); if (ret < 0) { tdbAbort(pEnv, txn); + tdbOsFree(pBt); return -1; } } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index f638ec25a3..648e99d6a5 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -379,9 +379,6 @@ int tdbPagerPostCommit(SPager *pPager, TXN *pTxn) { return -1; } - if (pTxn->jPageSet) { - hashset_destroy(pTxn->jPageSet); - } // pPager->inTran = 0; return 0; @@ -549,8 +546,6 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) { return -1; } - hashset_destroy(pTxn->jPageSet); - // pPager->inTran = 0; return 0; @@ -725,14 +720,16 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage pgno = TDB_PAGE_PGNO(pPage); - tdbTrace("tdbttl init pager:%p, pgno:%d, loadPage:%d, size:%d", pPager, pgno, loadPage, pPager->dbOrigSize); + tdbTrace("tdb/pager:%p, pgno:%d, loadPage:%d, size:%d", pPager, pgno, loadPage, pPager->dbOrigSize); if (loadPage && pgno <= pPager->dbOrigSize) { init = 1; nRead = tdbOsPRead(pPager->fd, pPage->pData, pPage->pageSize, ((i64)pPage->pageSize) * (pgno - 1)); - tdbTrace("tdbttl pager:%p, pgno:%d, nRead:%" PRId64, pPager, pgno, nRead); + tdbTrace("tdb/pager:%p, pgno:%d, nRead:%" PRId64, pPager, pgno, nRead); if (nRead < pPage->pageSize) { ASSERT(0); + tdbError("tdb/pager:%p, pgno:%d, nRead:%" PRId64 "pgSize:%" PRId32, pPager, pgno, nRead, pPage->pageSize); + TDB_UNLOCK_PAGE(pPage); return -1; } } else { @@ -922,6 +919,8 @@ int tdbPagerRestoreJournals(SPager *pPager, SBTree *pBt) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { if (tdbPagerRestore(pPager, pBt, name) < 0) { + tdbCloseDir(&pDir); + tdbError("failed to restore file due to %s. jFileName:%s", strerror(errno), name); return -1; } @@ -946,6 +945,8 @@ int tdbPagerRollback(SPager *pPager) { if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { if (tdbOsRemove(name) < 0 && errno != ENOENT) { + tdbCloseDir(&pDir); + tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), name); terrno = TAOS_SYSTEM_ERROR(errno); return -1; diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index 77c87d18f2..055d9c7f98 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -30,6 +30,11 @@ int tdbTxnOpen(TXN *pTxn, int64_t txnid, void *(*xMalloc)(void *, size_t), void int tdbTxnClose(TXN *pTxn) { if (pTxn) { + if (pTxn->jPageSet) { + hashset_destroy(pTxn->jPageSet); + pTxn->jPageSet = NULL; + } + tdbOsFree(pTxn); } diff --git a/source/libs/transport/inc/transportInt.h b/source/libs/transport/inc/transportInt.h index 57aba67b1d..2db4a72795 100644 --- a/source/libs/transport/inc/transportInt.h +++ b/source/libs/transport/inc/transportInt.h @@ -47,10 +47,8 @@ typedef struct { char label[TSDB_LABEL_LEN]; char user[TSDB_UNI_LEN]; // meter ID - int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size - int8_t encryption; // encrypt or not - int32_t retryLimit; // retry limit - int32_t retryInterval; // retry interval ms + int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size + int8_t encryption; // encrypt or not int32_t retryMinInterval; // retry init interval int32_t retryStepFactor; // retry interval factor diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index 0eac12f7c5..55c3c61b05 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -47,9 +47,11 @@ void* rpcOpen(const SRpcInit* pInit) { } pRpc->compressSize = pInit->compressSize; + if (pRpc->compressSize < 0) { + pRpc->compressSize = -1; + } + pRpc->encryption = pInit->encryption; - pRpc->retryLimit = pInit->retryLimit; - pRpc->retryInterval = pInit->retryInterval; pRpc->retryMinInterval = pInit->retryMinInterval; // retry init interval pRpc->retryStepFactor = pInit->retryStepFactor; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 50594f1a5a..0736b763a5 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -285,6 +285,7 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) { } destroyCmsg(msg); } + memset(&conn->ctx, 0, sizeof(conn->ctx)); } bool cliMaySendCachedMsg(SCliConn* conn) { if (!transQueueEmpty(&conn->cliMsgs)) { @@ -589,6 +590,7 @@ static void addConnToPool(void* pool, SCliConn* conn) { } static int32_t allocConnRef(SCliConn* conn, bool update) { if (update) { + transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); conn->refId = -1; } @@ -602,6 +604,7 @@ static int32_t allocConnRef(SCliConn* conn, bool update) { static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { if (update) { + transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); conn->refId = -1; } @@ -697,6 +700,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { tTrace("%s conn %p remove from conn pool", CONN_GET_INST_LABEL(conn), conn); QUEUE_REMOVE(&conn->q); QUEUE_INIT(&conn->q); + transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); conn->refId = -1; @@ -731,6 +735,7 @@ static void cliDestroy(uv_handle_t* handle) { conn->timer = NULL; } + transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); taosMemoryFree(conn->ip); taosMemoryFree(conn->stream); @@ -952,7 +957,6 @@ static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) { SCliConn* conn = exh->handle; transReleaseExHandle(transGetRefMgt(), refId); - tDebug("%s conn %p start to release to inst", CONN_GET_INST_LABEL(conn), conn); if (T_REF_VAL_GET(conn) == 2) { @@ -1052,9 +1056,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { cliMayCvtFqdnToIp(&pCtx->epSet, &pThrd->cvtAddr); - char tbuf[256] = {0}; - EPSET_DEBUG_STR(&pCtx->epSet, tbuf); - if (!EPSET_IS_VALID(&pCtx->epSet)) { tError("invalid epset"); destroyCmsg(pMsg); @@ -1493,18 +1494,35 @@ FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) { bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) { bool noDelay = true; if (hasEpSet == false) { - // assert(pResp->contLen == 0); if (pResp->contLen == 0) { if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { noDelay = false; } else { EPSET_FORWARD_INUSE(&pCtx->epSet); } - } else { - if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { - noDelay = false; + } else if (pResp->contLen != 0) { + SEpSet epSet; + int32_t valid = tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epSet); + if (valid < 0) { + tDebug("get invalid epset, epset equal, continue"); + if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { + noDelay = false; + } else { + EPSET_FORWARD_INUSE(&pCtx->epSet); + } } else { - EPSET_FORWARD_INUSE(&pCtx->epSet); + if (!transEpSetIsEqual(&pCtx->epSet, &epSet)) { + tDebug("epset not equal, retry new epset"); + pCtx->epSet = epSet; + noDelay = false; + } else { + if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { + noDelay = false; + } else { + tDebug("epset equal, continue"); + EPSET_FORWARD_INUSE(&pCtx->epSet); + } + } } } } else { @@ -1556,6 +1574,9 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { pCtx->retryStep = 0; pCtx->retryInit = true; pCtx->retryCode = TSDB_CODE_SUCCESS; + + // already retry, not use handle specified by app; + pMsg->msg.info.handle = 0; } if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) { @@ -1584,7 +1605,7 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { addConnToPool(pThrd->pool, pConn); } else if (code == TSDB_CODE_SYN_RESTORING) { tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen); - noDelay = cliResetEpset(pCtx, pResp, false); + noDelay = cliResetEpset(pCtx, pResp, true); addConnToPool(pThrd->pool, pConn); transFreeMsg(pResp->pCont); } else { @@ -1608,9 +1629,9 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { pCtx->retryNextInterval = pCtx->retryMaxInterval; } - if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) { - return false; - } + // if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) { + // return false; + // } } else { pCtx->retryNextInterval = 0; pCtx->epsetRetryCnt++; diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index ad8d57c97a..09f9a78ab8 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -282,6 +282,9 @@ void transCtxCleanup(STransCtx* ctx) { } void transCtxMerge(STransCtx* dst, STransCtx* src) { + if (src->args == NULL || src->freeFunc == NULL) { + return; + } if (dst->args == NULL) { dst->args = src->args; dst->brokenVal = src->brokenVal; diff --git a/source/libs/transport/test/svrBench.c b/source/libs/transport/test/svrBench.c index 464559c1e0..4e2395b17b 100644 --- a/source/libs/transport/test/svrBench.c +++ b/source/libs/transport/test/svrBench.c @@ -128,7 +128,7 @@ void *processShellMsg(void *arg) { void processRequestMsg(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet) { SRpcMsg *pTemp; - pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM); + pTemp = taosAllocateQitem(sizeof(SRpcMsg), DEF_QITEM, 0); memcpy(pTemp, pMsg, sizeof(SRpcMsg)); int32_t idx = balance % multiQ->numOfThread; diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index d219873b5a..331d241745 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -394,8 +394,8 @@ char *taosDirEntryBaseName(char *name) { char *pPoint = strrchr(name, '/'); if (pPoint != NULL) { if (*(pPoint + 1) == '\0') { - *pPoint = '\0'; - return taosDirEntryBaseName(name); + *pPoint = '\0'; + return taosDirEntryBaseName(name); } return pPoint + 1; } @@ -497,3 +497,12 @@ int32_t taosCloseDir(TdDirPtr *ppDir) { return 0; #endif } + +void taosGetCwd(char *buf, int32_t len) { +#if !defined(WINDOWS) + char *unused __attribute__((unused)); + unused = getcwd(buf, len - 1); +#else + strncpy(buf, "not implemented on windows", len - 1); +#endif +} diff --git a/source/os/src/osEnv.c b/source/os/src/osEnv.c index 7063d1f574..c4627ffb75 100644 --- a/source/os/src/osEnv.c +++ b/source/os/src/osEnv.c @@ -37,7 +37,7 @@ float tsNumOfCores = 0; int64_t tsTotalMemoryKB = 0; char *tsProcPath = NULL; -char tsSIMDEnable = 0; +char tsSIMDBuiltins = 0; char tsSSE42Enable = 0; char tsAVXEnable = 0; char tsAVX2Enable = 0; diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index e28abf131d..704b1b9738 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -97,6 +97,7 @@ LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS exception); #include #include +#include #else @@ -275,34 +276,34 @@ int32_t taosGetEmail(char *email, int32_t maxLen) { #endif } + + int32_t taosGetOsReleaseName(char *releaseName, int32_t maxLen) { #ifdef WINDOWS snprintf(releaseName, maxLen, "Windows"); return 0; #elif defined(_TD_DARWIN_64) - char line[1024]; - size_t size = 0; - int32_t code = -1; + char osversion[32]; + size_t osversion_len = sizeof(osversion) - 1; + int osversion_name[] = { CTL_KERN, KERN_OSRELEASE }; - TdFilePtr pFile = taosOpenFile("/etc/os-release", TD_FILE_READ | TD_FILE_STREAM); - if (pFile == NULL) return false; - - while ((size = taosGetsFile(pFile, sizeof(line), line)) != -1) { - line[size - 1] = '\0'; - if (strncmp(line, "PRETTY_NAME", 11) == 0) { - const char *p = strchr(line, '=') + 1; - if (*p == '"') { - p++; - line[size - 2] = 0; - } - tstrncpy(releaseName, p, maxLen); - code = 0; - break; - } + if (sysctl(osversion_name, 2, osversion, &osversion_len, NULL, 0) == -1) { + return -1; } - taosCloseFile(&pFile); - return code; + uint32_t major, minor; + if (sscanf(osversion, "%u.%u", &major, &minor) != 2) { + return -1; + } + if (major >= 20) { + major -= 9; // macOS 11 and newer + sprintf(releaseName, "macOS %u.%u", major, minor); + } else { + major -= 4; // macOS 10.1.1 and newer + sprintf(releaseName, "macOS 10.%d.%d", major, minor); + } + + return 0; #else char line[1024]; size_t size = 0; @@ -484,11 +485,11 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma) { #ifdef _TD_X86_ // Since the compiler is not support avx/avx2 instructions, the global variables always need to be // set to be false -#if __AVX__ || __AVX2__ - tsSIMDEnable = true; -#else - tsSIMDEnable = false; -#endif +//#if __AVX__ || __AVX2__ +// tsSIMDBuiltins = true; +//#else +// tsSIMDBuiltins = false; +//#endif uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index cea08e46fe..747187254f 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -780,7 +780,7 @@ cmp_end: return ret; } -bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...) { +bool taosAssert(bool condition, const char *file, int32_t line, const char *format, ...) { if (condition) return false; const char *flags = "UTL FATAL "; @@ -801,7 +801,7 @@ bool taosAssertLog(bool condition, const char *file, int32_t line, const char *f taosPrintTrace(flags, level, dflag); if (tsAssert) { - taosCloseLog(); + // taosCloseLog(); taosMsleep(300); #ifdef NDEBUG diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c index 0f992184b5..42b6358893 100644 --- a/source/util/src/tqueue.c +++ b/source/util/src/tqueue.c @@ -109,20 +109,24 @@ int64_t taosQueueMemorySize(STaosQueue *queue) { return memOfItems; } -void *taosAllocateQitem(int32_t size, EQItype itype) { +void *taosAllocateQitem(int32_t size, EQItype itype, int64_t dataSize) { STaosQnode *pNode = taosMemoryCalloc(1, sizeof(STaosQnode) + size); if (pNode == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } + pNode->dataSize = dataSize; pNode->size = size; pNode->itype = itype; pNode->timestamp = taosGetTimestampUs(); if (itype == RPC_QITEM) { - int64_t alloced = atomic_add_fetch_64(&tsRpcQueueMemoryUsed, size); + int64_t alloced = atomic_add_fetch_64(&tsRpcQueueMemoryUsed, size + dataSize); if (alloced > tsRpcQueueMemoryAllowed) { + uError("failed to alloc qitem, size:%" PRId64 " alloc:%" PRId64 " allowed:%" PRId64, size + dataSize, alloced, + tsRpcQueueMemoryUsed); + atomic_sub_fetch_64(&tsRpcQueueMemoryUsed, size + dataSize); taosMemoryFree(pNode); terrno = TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE; return NULL; @@ -139,8 +143,8 @@ void taosFreeQitem(void *pItem) { if (pItem == NULL) return; STaosQnode *pNode = (STaosQnode *)((char *)pItem - sizeof(STaosQnode)); - if (pNode->itype > 0) { - int64_t alloced = atomic_sub_fetch_64(&tsRpcQueueMemoryUsed, pNode->size); + if (pNode->itype == RPC_QITEM) { + int64_t alloced = atomic_sub_fetch_64(&tsRpcQueueMemoryUsed, pNode->size + pNode->dataSize); uTrace("item:%p, node:%p is freed, alloc:%" PRId64, pItem, pNode, alloced); } else { uTrace("item:%p, node:%p is freed", pItem, pNode); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 28ba7ea60f..5361ba356f 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -10,6 +10,7 @@ ,,y,script,./test.sh -f tsim/user/password.sim ,,y,script,./test.sh -f tsim/user/privilege_db.sim ,,y,script,./test.sh -f tsim/user/privilege_sysinfo.sim +,,y,script,./test.sh -f tsim/user/privilege_topic.sim ,,y,script,./test.sh -f tsim/db/alter_option.sim ,,y,script,./test.sh -f tsim/db/alter_replica_13.sim ,,y,script,./test.sh -f tsim/db/alter_replica_31.sim @@ -173,6 +174,7 @@ ,,y,script,./test.sh -f tsim/query/scalarNull.sim ,,y,script,./test.sh -f tsim/query/session.sim ,,y,script,./test.sh -f tsim/query/udf.sim +,,y,script,./test.sh -f tsim/query/udf_with_const.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim ,,y,script,./test.sh -f tsim/mnode/basic1.sim @@ -1037,4 +1039,4 @@ ,,n,docs-examples-test,bash node.sh ,,n,docs-examples-test,bash csharp.sh ,,n,docs-examples-test,bash jdbc.sh -,,n,docs-examples-test,bash go.sh +#,,n,docs-examples-test,bash go.sh diff --git a/examples/c/api_with_reqid_test.c b/tests/script/api/api_with_reqid_test.c similarity index 100% rename from examples/c/api_with_reqid_test.c rename to tests/script/api/api_with_reqid_test.c diff --git a/tests/script/api/apitest.c b/tests/script/api/apitest.c new file mode 100644 index 0000000000..7280522021 --- /dev/null +++ b/tests/script/api/apitest.c @@ -0,0 +1,936 @@ +// sample code to verify all TDengine API +// to compile: gcc -o apitest apitest.c -ltaos + +#include "cJSON.h" +#include "taoserror.h" + +#include +#include +#include +#include +#include "../../include/client/taos.h" + +static int64_t count = 10000; + +int64_t genReqid() { + count += 100; + return count; +} + +static void prepare_data(TAOS* taos) { + TAOS_RES* result; + result = taos_query(taos, "drop database if exists test;"); + taos_free_result(result); + usleep(100000); + result = taos_query(taos, "create database test precision 'us';"); + taos_free_result(result); + usleep(100000); + taos_select_db(taos, "test"); + + result = taos_query(taos, "create table meters(ts timestamp, a int) tags(area int);"); + taos_free_result(result); + + result = taos_query(taos, "create table t0 using meters tags(0);"); + taos_free_result(result); + result = taos_query(taos, "create table t1 using meters tags(1);"); + taos_free_result(result); + result = taos_query(taos, "create table t2 using meters tags(2);"); + taos_free_result(result); + result = taos_query(taos, "create table t3 using meters tags(3);"); + taos_free_result(result); + result = taos_query(taos, "create table t4 using meters tags(4);"); + taos_free_result(result); + result = taos_query(taos, "create table t5 using meters tags(5);"); + taos_free_result(result); + result = taos_query(taos, "create table t6 using meters tags(6);"); + taos_free_result(result); + result = taos_query(taos, "create table t7 using meters tags(7);"); + taos_free_result(result); + result = taos_query(taos, "create table t8 using meters tags(8);"); + taos_free_result(result); + result = taos_query(taos, "create table t9 using meters tags(9);"); + taos_free_result(result); + + result = taos_query(taos, + "insert into t0 values('2020-01-01 00:00:00.000', 0)" + " ('2020-01-01 00:01:00.000', 0)" + " ('2020-01-01 00:02:00.000', 0)" + " t1 values('2020-01-01 00:00:00.000', 0)" + " ('2020-01-01 00:01:00.000', 0)" + " ('2020-01-01 00:02:00.000', 0)" + " ('2020-01-01 00:03:00.000', 0)" + " t2 values('2020-01-01 00:00:00.000', 0)" + " ('2020-01-01 00:01:00.000', 0)" + " ('2020-01-01 00:01:01.000', 0)" + " ('2020-01-01 00:01:02.000', 0)" + " t3 values('2020-01-01 00:01:02.000', 0)" + " t4 values('2020-01-01 00:01:02.000', 0)" + " t5 values('2020-01-01 00:01:02.000', 0)" + " t6 values('2020-01-01 00:01:02.000', 0)" + " t7 values('2020-01-01 00:01:02.000', 0)" + " t8 values('2020-01-01 00:01:02.000', 0)" + " t9 values('2020-01-01 00:01:02.000', 0)"); + int affected = taos_affected_rows(result); + if (affected != 18) { + printf("\033[31m%d rows affected by last insert statement, but it should be 18\033[0m\n", affected); + } + taos_free_result(result); + // super tables subscription + usleep(1000000); +} + +static int print_result(TAOS_RES* res, int blockFetch) { + TAOS_ROW row = NULL; + int num_fields = taos_num_fields(res); + TAOS_FIELD* fields = taos_fetch_fields(res); + int nRows = 0; + + if (blockFetch) { + int rows = 0; + while ((rows = taos_fetch_block(res, &row))) { + // for (int i = 0; i < rows; i++) { + // char temp[256]; + // taos_print_row(temp, row + i, fields, num_fields); + // puts(temp); + // } + nRows += rows; + } + } else { + while ((row = taos_fetch_row(res))) { + char temp[256] = {0}; + taos_print_row(temp, row, fields, num_fields); + puts(temp); + nRows++; + } + } + + printf("%d rows consumed.\n", nRows); + return nRows; +} + +static void check_row_count(int line, TAOS_RES* res, int expected) { + int actual = print_result(res, expected % 2); + if (actual != expected) { + printf("\033[31mline %d: row count mismatch, expected: %d, actual: %d\033[0m\n", line, expected, actual); + } else { + printf("line %d: %d rows consumed as expected\n", line, actual); + } +} + +static void verify_query(TAOS* taos) { + prepare_data(taos); + + int code = taos_load_table_info(taos, "t0,t1,t2,t3,t4,t5,t6,t7,t8,t9"); + if (code != 0) { + printf("\033[31mfailed to load table info: 0x%08x\033[0m\n", code); + } + + code = taos_validate_sql(taos, "select * from nonexisttable"); + if (code == 0) { + printf("\033[31mimpossible, the table does not exists\033[0m\n"); + } + + code = taos_validate_sql(taos, "select * from meters"); + if (code != 0) { + printf("\033[31mimpossible, the table does exists: 0x%08x\033[0m\n", code); + } + + TAOS_RES* res = taos_query_with_reqid(taos, "select * from meters", genReqid()); + check_row_count(__LINE__, res, 18); + printf("result precision is: %d\n", taos_result_precision(res)); + int c = taos_field_count(res); + printf("field count is: %d\n", c); + int* lengths = taos_fetch_lengths(res); + for (int i = 0; i < c; i++) { + printf("length of column %d is %d\n", i, lengths[i]); + } + taos_free_result(res); + + res = taos_query_with_reqid(taos, "select * from t0", genReqid()); + check_row_count(__LINE__, res, 3); + taos_free_result(res); + + res = taos_query_with_reqid(taos, "select * from nonexisttable", genReqid()); + code = taos_errno(res); + printf("code=%d, error msg=%s\n", code, taos_errstr(res)); + taos_free_result(res); + + res = taos_query_with_reqid(taos, "select * from meters", genReqid()); + taos_stop_query(res); + taos_free_result(res); +} + +void subscribe_callback(TAOS_SUB* tsub, TAOS_RES* res, void* param, int code) { + int rows = print_result(res, *(int*)param); + printf("%d rows consumed in subscribe_callback\n", rows); +} + +void verify_prepare(TAOS* taos) { + TAOS_RES* result = taos_query(taos, "drop database if exists test;"); + taos_free_result(result); + + usleep(100000); + result = taos_query(taos, "create database test;"); + + int code = taos_errno(result); + if (code != 0) { + printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result)); + taos_free_result(result); + return; + } + + taos_free_result(result); + + usleep(100000); + taos_select_db(taos, "test"); + + // create table + const char* sql = + "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin " + "binary(40), blob nchar(10))"; + result = taos_query_with_reqid(taos, sql, genReqid()); + code = taos_errno(result); + if (code != 0) { + printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + + // insert 10 records + struct { + int64_t ts; + int8_t b; + int8_t v1; + int16_t v2; + int32_t v4; + int64_t v8; + float f4; + double f8; + char bin[40]; + char blob[80]; + } v = {0}; + + int32_t boolLen = sizeof(int8_t); + int32_t sintLen = sizeof(int16_t); + int32_t intLen = sizeof(int32_t); + int32_t bintLen = sizeof(int64_t); + int32_t floatLen = sizeof(float); + int32_t doubleLen = sizeof(double); + int32_t binLen = sizeof(v.bin); + int32_t ncharLen = 30; + TAOS_STMT* stmt = taos_stmt_init(taos); + TAOS_MULTI_BIND params[10]; + params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; + params[0].buffer_length = sizeof(v.ts); + params[0].buffer = &v.ts; + params[0].length = &bintLen; + params[0].is_null = NULL; + params[0].num = 1; + + params[1].buffer_type = TSDB_DATA_TYPE_BOOL; + params[1].buffer_length = sizeof(v.b); + params[1].buffer = &v.b; + params[1].length = &boolLen; + params[1].is_null = NULL; + params[1].num = 1; + + params[2].buffer_type = TSDB_DATA_TYPE_TINYINT; + params[2].buffer_length = sizeof(v.v1); + params[2].buffer = &v.v1; + params[2].length = &boolLen; + params[2].is_null = NULL; + params[2].num = 1; + + params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT; + params[3].buffer_length = sizeof(v.v2); + params[3].buffer = &v.v2; + params[3].length = &sintLen; + params[3].is_null = NULL; + params[3].num = 1; + + params[4].buffer_type = TSDB_DATA_TYPE_INT; + params[4].buffer_length = sizeof(v.v4); + params[4].buffer = &v.v4; + params[4].length = &intLen; + params[4].is_null = NULL; + params[4].num = 1; + + params[5].buffer_type = TSDB_DATA_TYPE_BIGINT; + params[5].buffer_length = sizeof(v.v8); + params[5].buffer = &v.v8; + params[5].length = &bintLen; + params[5].is_null = NULL; + params[5].num = 1; + + params[6].buffer_type = TSDB_DATA_TYPE_FLOAT; + params[6].buffer_length = sizeof(v.f4); + params[6].buffer = &v.f4; + params[6].length = &floatLen; + params[6].is_null = NULL; + params[6].num = 1; + + params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE; + params[7].buffer_length = sizeof(v.f8); + params[7].buffer = &v.f8; + params[7].length = &doubleLen; + params[7].is_null = NULL; + params[7].num = 1; + + params[8].buffer_type = TSDB_DATA_TYPE_BINARY; + params[8].buffer_length = sizeof(v.bin); + params[8].buffer = v.bin; + params[8].length = &binLen; + params[8].is_null = NULL; + params[8].num = 1; + + strcpy(v.blob, "一二三四五六七八九十"); + params[9].buffer_type = TSDB_DATA_TYPE_NCHAR; + params[9].buffer_length = sizeof(v.blob); + params[9].buffer = v.blob; + params[9].length = &ncharLen; + params[9].is_null = NULL; + params[9].num = 1; + + char is_null = 1; + + sql = "insert into m1 values(?,?,?,?,?,?,?,?,?,?)"; + code = taos_stmt_prepare(stmt, sql, 0); + if (code != 0) { + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + v.ts = 1591060628000; + for (int i = 0; i < 10; ++i) { + v.ts += 1; + for (int j = 1; j < 10; ++j) { + params[j].is_null = ((i == j) ? &is_null : 0); + } + v.b = (int8_t)i % 2; + v.v1 = (int8_t)i; + v.v2 = (int16_t)(i * 2); + v.v4 = (int32_t)(i * 4); + v.v8 = (int64_t)(i * 8); + v.f4 = (float)(i * 40); + v.f8 = (double)(i * 80); + for (int j = 0; j < sizeof(v.bin); ++j) { + v.bin[j] = (char)(i + '0'); + } + + taos_stmt_bind_param(stmt, params); + taos_stmt_add_batch(stmt); + } + if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + taos_stmt_close(stmt); + + // query the records + stmt = taos_stmt_init(taos); + taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0); + v.v1 = 5; + v.v2 = 15; + taos_stmt_bind_param(stmt, params + 2); + if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + result = taos_stmt_use_result(stmt); + + TAOS_ROW row; + int rows = 0; + int num_fields = taos_num_fields(result); + TAOS_FIELD* fields = taos_fetch_fields(result); + + // fetch the records row by row + while ((row = taos_fetch_row(result))) { + char temp[256] = {0}; + rows++; + taos_print_row(temp, row, fields, num_fields); + printf("%s\n", temp); + } + + taos_free_result(result); + taos_stmt_close(stmt); +} + +void verify_prepare2(TAOS* taos) { + TAOS_RES* result = taos_query(taos, "drop database if exists test;"); + taos_free_result(result); + usleep(100000); + result = taos_query(taos, "create database test;"); + + int code = taos_errno(result); + if (code != 0) { + printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + + usleep(100000); + taos_select_db(taos, "test"); + + // create table + const char* sql = + "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin " + "binary(40), blob nchar(10))"; + result = taos_query(taos, sql); + code = taos_errno(result); + if (code != 0) { + printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + + // insert 10 records + struct { + int64_t ts[10]; + int8_t b[10]; + int8_t v1[10]; + int16_t v2[10]; + int32_t v4[10]; + int64_t v8[10]; + float f4[10]; + double f8[10]; + char bin[10][40]; + char blob[10][80]; + } v; + + int32_t* t8_len = malloc(sizeof(int32_t) * 10); + int32_t* t16_len = malloc(sizeof(int32_t) * 10); + int32_t* t32_len = malloc(sizeof(int32_t) * 10); + int32_t* t64_len = malloc(sizeof(int32_t) * 10); + int32_t* float_len = malloc(sizeof(int32_t) * 10); + int32_t* double_len = malloc(sizeof(int32_t) * 10); + int32_t* bin_len = malloc(sizeof(int32_t) * 10); + int32_t* blob_len = malloc(sizeof(int32_t) * 10); + + TAOS_STMT* stmt = taos_stmt_init(taos); + TAOS_MULTI_BIND params[10]; + char is_null[10] = {0}; + + params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; + params[0].buffer_length = sizeof(v.ts[0]); + params[0].buffer = v.ts; + params[0].length = t64_len; + params[0].is_null = is_null; + params[0].num = 10; + + params[1].buffer_type = TSDB_DATA_TYPE_BOOL; + params[1].buffer_length = sizeof(v.b[0]); + params[1].buffer = v.b; + params[1].length = t8_len; + params[1].is_null = is_null; + params[1].num = 10; + + params[2].buffer_type = TSDB_DATA_TYPE_TINYINT; + params[2].buffer_length = sizeof(v.v1[0]); + params[2].buffer = v.v1; + params[2].length = t8_len; + params[2].is_null = is_null; + params[2].num = 10; + + params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT; + params[3].buffer_length = sizeof(v.v2[0]); + params[3].buffer = v.v2; + params[3].length = t16_len; + params[3].is_null = is_null; + params[3].num = 10; + + params[4].buffer_type = TSDB_DATA_TYPE_INT; + params[4].buffer_length = sizeof(v.v4[0]); + params[4].buffer = v.v4; + params[4].length = t32_len; + params[4].is_null = is_null; + params[4].num = 10; + + params[5].buffer_type = TSDB_DATA_TYPE_BIGINT; + params[5].buffer_length = sizeof(v.v8[0]); + params[5].buffer = v.v8; + params[5].length = t64_len; + params[5].is_null = is_null; + params[5].num = 10; + + params[6].buffer_type = TSDB_DATA_TYPE_FLOAT; + params[6].buffer_length = sizeof(v.f4[0]); + params[6].buffer = v.f4; + params[6].length = float_len; + params[6].is_null = is_null; + params[6].num = 10; + + params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE; + params[7].buffer_length = sizeof(v.f8[0]); + params[7].buffer = v.f8; + params[7].length = double_len; + params[7].is_null = is_null; + params[7].num = 10; + + params[8].buffer_type = TSDB_DATA_TYPE_BINARY; + params[8].buffer_length = sizeof(v.bin[0]); + params[8].buffer = v.bin; + params[8].length = bin_len; + params[8].is_null = is_null; + params[8].num = 10; + + params[9].buffer_type = TSDB_DATA_TYPE_NCHAR; + params[9].buffer_length = sizeof(v.blob[0]); + params[9].buffer = v.blob; + params[9].length = blob_len; + params[9].is_null = is_null; + params[9].num = 10; + + sql = "insert into ? (ts, b, v1, v2, v4, v8, f4, f8, bin, blob) values(?,?,?,?,?,?,?,?,?,?)"; + code = taos_stmt_prepare(stmt, sql, 0); + if (code != 0) { + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + code = taos_stmt_set_tbname(stmt, "m1"); + if (code != 0) { + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + int64_t ts = 1591060628000; + for (int i = 0; i < 10; ++i) { + v.ts[i] = ts++; + is_null[i] = 0; + + v.b[i] = (int8_t)i % 2; + v.v1[i] = (int8_t)i; + v.v2[i] = (int16_t)(i * 2); + v.v4[i] = (int32_t)(i * 4); + v.v8[i] = (int64_t)(i * 8); + v.f4[i] = (float)(i * 40); + v.f8[i] = (double)(i * 80); + for (int j = 0; j < sizeof(v.bin[0]); ++j) { + v.bin[i][j] = (char)(i + '0'); + } + strcpy(v.blob[i], "一二三四五六七八九十"); + + t8_len[i] = sizeof(int8_t); + t16_len[i] = sizeof(int16_t); + t32_len[i] = sizeof(int32_t); + t64_len[i] = sizeof(int64_t); + float_len[i] = sizeof(float); + double_len[i] = sizeof(double); + bin_len[i] = sizeof(v.bin[0]); + blob_len[i] = (int32_t)strlen(v.blob[i]); + } + + taos_stmt_bind_param_batch(stmt, params); + taos_stmt_add_batch(stmt); + + if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + taos_stmt_close(stmt); + + // query the records + stmt = taos_stmt_init(taos); + taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0); + TAOS_MULTI_BIND qparams[2]; + + int8_t v1 = 5; + int16_t v2 = 15; + int32_t tinyLen = sizeof(v1); + int32_t smallLen = sizeof(v2); + + qparams[0].buffer_type = TSDB_DATA_TYPE_TINYINT; + qparams[0].buffer_length = sizeof(v1); + qparams[0].buffer = &v1; + qparams[0].length = &tinyLen; + qparams[0].is_null = NULL; + qparams[0].num = 1; + + qparams[1].buffer_type = TSDB_DATA_TYPE_SMALLINT; + qparams[1].buffer_length = sizeof(v2); + qparams[1].buffer = &v2; + qparams[1].length = &smallLen; + qparams[1].is_null = NULL; + qparams[1].num = 1; + + taos_stmt_bind_param(stmt, qparams); + if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + result = taos_stmt_use_result(stmt); + + TAOS_ROW row; + int rows = 0; + int num_fields = taos_num_fields(result); + TAOS_FIELD* fields = taos_fetch_fields(result); + + // fetch the records row by row + while ((row = taos_fetch_row(result))) { + char temp[256] = {0}; + rows++; + taos_print_row(temp, row, fields, num_fields); + printf("%s\n", temp); + } + + taos_free_result(result); + taos_stmt_close(stmt); + + free(t8_len); + free(t16_len); + free(t32_len); + free(t64_len); + free(float_len); + free(double_len); + free(bin_len); + free(blob_len); +} + +void verify_prepare3(TAOS* taos) { + TAOS_RES* result = taos_query(taos, "drop database if exists test;"); + taos_free_result(result); + usleep(100000); + result = taos_query(taos, "create database test;"); + + int code = taos_errno(result); + if (code != 0) { + printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + + usleep(100000); + taos_select_db(taos, "test"); + + // create table + const char* sql = + "create stable st1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin " + "binary(40), blob nchar(10)) tags (id1 int, id2 binary(40))"; + result = taos_query(taos, sql); + code = taos_errno(result); + if (code != 0) { + printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + + TAOS_MULTI_BIND tags[2]; + + int32_t id1 = 1; + char id2[40] = "abcdefghijklmnopqrstuvwxyz0123456789"; + int32_t id2_len = (int32_t)strlen(id2); + + tags[0].buffer_type = TSDB_DATA_TYPE_INT; + tags[0].buffer_length = sizeof(int); + tags[0].buffer = &id1; + tags[0].length = NULL; + tags[0].is_null = NULL; + tags[0].num = 1; + + tags[1].buffer_type = TSDB_DATA_TYPE_BINARY; + tags[1].buffer_length = sizeof(id2); + tags[1].buffer = id2; + tags[1].length = &id2_len; + tags[1].is_null = NULL; + tags[1].num = 1; + + // insert 10 records + struct { + int64_t ts[10]; + int8_t b[10]; + int8_t v1[10]; + int16_t v2[10]; + int32_t v4[10]; + int64_t v8[10]; + float f4[10]; + double f8[10]; + char bin[10][40]; + char blob[10][80]; + } v; + + int32_t* t8_len = malloc(sizeof(int32_t) * 10); + int32_t* t16_len = malloc(sizeof(int32_t) * 10); + int32_t* t32_len = malloc(sizeof(int32_t) * 10); + int32_t* t64_len = malloc(sizeof(int32_t) * 10); + int32_t* float_len = malloc(sizeof(int32_t) * 10); + int32_t* double_len = malloc(sizeof(int32_t) * 10); + int32_t* bin_len = malloc(sizeof(int32_t) * 10); + int32_t* blob_len = malloc(sizeof(int32_t) * 10); + + TAOS_STMT* stmt = taos_stmt_init(taos); + TAOS_MULTI_BIND params[10]; + char is_null[10] = {0}; + + params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; + params[0].buffer_length = sizeof(v.ts[0]); + params[0].buffer = v.ts; + params[0].length = t64_len; + params[0].is_null = is_null; + params[0].num = 10; + + params[1].buffer_type = TSDB_DATA_TYPE_BOOL; + params[1].buffer_length = sizeof(v.b[0]); + params[1].buffer = v.b; + params[1].length = t8_len; + params[1].is_null = is_null; + params[1].num = 10; + + params[2].buffer_type = TSDB_DATA_TYPE_TINYINT; + params[2].buffer_length = sizeof(v.v1[0]); + params[2].buffer = v.v1; + params[2].length = t8_len; + params[2].is_null = is_null; + params[2].num = 10; + + params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT; + params[3].buffer_length = sizeof(v.v2[0]); + params[3].buffer = v.v2; + params[3].length = t16_len; + params[3].is_null = is_null; + params[3].num = 10; + + params[4].buffer_type = TSDB_DATA_TYPE_INT; + params[4].buffer_length = sizeof(v.v4[0]); + params[4].buffer = v.v4; + params[4].length = t32_len; + params[4].is_null = is_null; + params[4].num = 10; + + params[5].buffer_type = TSDB_DATA_TYPE_BIGINT; + params[5].buffer_length = sizeof(v.v8[0]); + params[5].buffer = v.v8; + params[5].length = t64_len; + params[5].is_null = is_null; + params[5].num = 10; + + params[6].buffer_type = TSDB_DATA_TYPE_FLOAT; + params[6].buffer_length = sizeof(v.f4[0]); + params[6].buffer = v.f4; + params[6].length = float_len; + params[6].is_null = is_null; + params[6].num = 10; + + params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE; + params[7].buffer_length = sizeof(v.f8[0]); + params[7].buffer = v.f8; + params[7].length = double_len; + params[7].is_null = is_null; + params[7].num = 10; + + params[8].buffer_type = TSDB_DATA_TYPE_BINARY; + params[8].buffer_length = sizeof(v.bin[0]); + params[8].buffer = v.bin; + params[8].length = bin_len; + params[8].is_null = is_null; + params[8].num = 10; + + params[9].buffer_type = TSDB_DATA_TYPE_NCHAR; + params[9].buffer_length = sizeof(v.blob[0]); + params[9].buffer = v.blob; + params[9].length = blob_len; + params[9].is_null = is_null; + params[9].num = 10; + + sql = "insert into ? using st1 tags(?,?) values(?,?,?,?,?,?,?,?,?,?)"; + code = taos_stmt_prepare(stmt, sql, 0); + if (code != 0) { + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + code = taos_stmt_set_tbname_tags(stmt, "m1", tags); + if (code != 0) { + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + int64_t ts = 1591060628000; + for (int i = 0; i < 10; ++i) { + v.ts[i] = ts++; + is_null[i] = 0; + + v.b[i] = (int8_t)i % 2; + v.v1[i] = (int8_t)i; + v.v2[i] = (int16_t)(i * 2); + v.v4[i] = (int32_t)(i * 4); + v.v8[i] = (int64_t)(i * 8); + v.f4[i] = (float)(i * 40); + v.f8[i] = (double)(i * 80); + for (int j = 0; j < sizeof(v.bin[0]); ++j) { + v.bin[i][j] = (char)(i + '0'); + } + strcpy(v.blob[i], "一二三四五六七八九十"); + + t8_len[i] = sizeof(int8_t); + t16_len[i] = sizeof(int16_t); + t32_len[i] = sizeof(int32_t); + t64_len[i] = sizeof(int64_t); + float_len[i] = sizeof(float); + double_len[i] = sizeof(double); + bin_len[i] = sizeof(v.bin[0]); + blob_len[i] = (int32_t)strlen(v.blob[i]); + } + + taos_stmt_bind_param_batch(stmt, params); + taos_stmt_add_batch(stmt); + + if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + taos_stmt_close(stmt); + + // query the records + stmt = taos_stmt_init(taos); + taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0); + + TAOS_MULTI_BIND qparams[2]; + + int8_t v1 = 5; + int16_t v2 = 15; + int32_t tinyLen = sizeof(v1); + int32_t smallLen = sizeof(v2); + + qparams[0].buffer_type = TSDB_DATA_TYPE_TINYINT; + qparams[0].buffer_length = sizeof(v1); + qparams[0].buffer = &v1; + qparams[0].length = &tinyLen; + qparams[0].is_null = NULL; + qparams[0].num = 1; + + qparams[1].buffer_type = TSDB_DATA_TYPE_SMALLINT; + qparams[1].buffer_length = sizeof(v2); + qparams[1].buffer = &v2; + qparams[1].length = &smallLen; + qparams[1].is_null = NULL; + qparams[1].num = 1; + + taos_stmt_bind_param(stmt, qparams); + if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; + } + + result = taos_stmt_use_result(stmt); + + TAOS_ROW row; + int rows = 0; + int num_fields = taos_num_fields(result); + TAOS_FIELD* fields = taos_fetch_fields(result); + + // fetch the records row by row + while ((row = taos_fetch_row(result))) { + char temp[256] = {0}; + rows++; + taos_print_row(temp, row, fields, num_fields); + printf("%s\n", temp); + } + + taos_free_result(result); + taos_stmt_close(stmt); + + free(t8_len); + free(t16_len); + free(t32_len); + free(t64_len); + free(float_len); + free(double_len); + free(bin_len); + free(blob_len); +} + +void retrieve_callback(void* param, TAOS_RES* tres, int numOfRows) { + if (numOfRows > 0) { + printf("%d rows async retrieved\n", numOfRows); + taos_fetch_rows_a(tres, retrieve_callback, param); + } else { + if (numOfRows < 0) { + printf("\033[31masync retrieve failed, code: %d\033[0m\n", numOfRows); + } else { + printf("async retrieve completed\n"); + } + taos_free_result(tres); + } +} + +void select_callback(void* param, TAOS_RES* tres, int code) { + if (code == 0 && tres) { + taos_fetch_rows_a(tres, retrieve_callback, param); + } else { + printf("\033[31masync select failed, code: %d\033[0m\n", code); + } +} + +void verify_async(TAOS* taos) { + prepare_data(taos); + taos_query_a(taos, "select * from meters", select_callback, NULL); + usleep(1000000); +} + +void stream_callback(void* param, TAOS_RES* res, TAOS_ROW row) { + if (res == NULL || row == NULL) { + return; + } + + int num_fields = taos_num_fields(res); + TAOS_FIELD* fields = taos_fetch_fields(res); + + printf("got one row from stream_callback\n"); + char temp[256] = {0}; + taos_print_row(temp, row, fields, num_fields); + puts(temp); +} + +int main(int argc, char* argv[]) { + const char* host = "127.0.0.1"; + const char* user = "root"; + const char* passwd = "taosdata"; + + taos_options(TSDB_OPTION_TIMEZONE, "GMT-8"); + TAOS* taos = taos_connect(host, user, passwd, "", 0); + if (taos == NULL) { + printf("\033[31mfailed to connect to db, reason:%s\033[0m\n", taos_errstr(taos)); + exit(1); + } + + const char* info = taos_get_server_info(taos); + printf("server info: %s\n", info); + info = taos_get_client_info(taos); + printf("client info: %s\n", info); + + printf("************ verify query *************\n"); + verify_query(taos); + + printf("********* verify async query **********\n"); + verify_async(taos); + + printf("************ verify prepare *************\n"); + verify_prepare(taos); + + printf("************ verify prepare2 *************\n"); + verify_prepare2(taos); + printf("************ verify prepare3 *************\n"); + verify_prepare3(taos); + + printf("done\n"); + taos_close(taos); + taos_cleanup(); +} diff --git a/examples/c/demoapi.c b/tests/script/api/demoapi.c similarity index 99% rename from examples/c/demoapi.c rename to tests/script/api/demoapi.c index 18f1b5a059..6c060a6325 100644 --- a/examples/c/demoapi.c +++ b/tests/script/api/demoapi.c @@ -21,7 +21,6 @@ #ifndef WINDOWS #include #endif -#include "osSleep.h" #include "taos.h" #define debugPrint(fmt, ...) \ @@ -81,11 +80,9 @@ static void prepare_data(TAOS* taos) { TAOS_RES *res; res = taos_query(taos, "drop database if exists test;"); taos_free_result(res); - taosMsleep(100); res = taos_query(taos, "create database test;"); taos_free_result(res); - taosMsleep(100); if (taos_select_db(taos, "test")) { errorPrint("%s() LN%d: taos_select_db() failed\n", __func__, __LINE__); diff --git a/tests/script/sh/compile_udf.sh b/tests/script/sh/compile_udf.sh index c7148d7d7d..5265e5a99b 100755 --- a/tests/script/sh/compile_udf.sh +++ b/tests/script/sh/compile_udf.sh @@ -1,10 +1,11 @@ set +e -rm -rf /tmp/udf/libbitand.so /tmp/udf/libsqrsum.so +rm -rf /tmp/udf/libbitand.so /tmp/udf/libsqrsum.so /tmp/udf/libgpd.so mkdir -p /tmp/udf echo "compile udf bit_and and sqr_sum" gcc -fPIC -shared sh/bit_and.c -I../../include/libs/function/ -I../../include/client -I../../include/util -o /tmp/udf/libbitand.so gcc -fPIC -shared sh/l2norm.c -I../../include/libs/function/ -I../../include/client -I../../include/util -o /tmp/udf/libl2norm.so +gcc -fPIC -shared sh/gpd.c -I../../include/libs/function/ -I../../include/client -I../../include/util -o /tmp/udf/libgpd.so echo "debug show /tmp/udf/*.so" ls /tmp/udf/*.so diff --git a/tests/script/sh/gpd.c b/tests/script/sh/gpd.c index 8d69bacb5e..2259efa64a 100644 --- a/tests/script/sh/gpd.c +++ b/tests/script/sh/gpd.c @@ -12,13 +12,10 @@ TAOS* taos = NULL; DLL_EXPORT int32_t gpd_init() { - taos = taos_connect("localhost", "root", "taosdata", "", 7100); return 0; } DLL_EXPORT int32_t gpd_destroy() { - taos_close(taos); - taos_cleanup(); return 0; } @@ -32,43 +29,18 @@ DLL_EXPORT int32_t gpd(SUdfDataBlock* block, SUdfColumn *resultCol) { SUdfColumnData *resultData = &resultCol->colData; resultData->numOfRows = block->numOfRows; for (int32_t i = 0; i < resultData->numOfRows; ++i) { - int j = 0; - for (; j < block->numOfCols; ++j) { - if (udfColDataIsNull(block->udfCols[j], i)) { - udfColDataSetNull(resultCol, i); - break; - } - } - if ( j == block->numOfCols) { - int32_t luckyNum = 88; - udfColDataSet(resultCol, i, (char *)&luckyNum, false); - } + int64_t* calc_ts = (int64_t*)udfColDataGetData(block->udfCols[0], i); + char* varTbname = udfColDataGetData(block->udfCols[1], i); + char* varDbname = udfColDataGetData(block->udfCols[2], i); + + char dbName[256] = {0}; + char tblName[256] = {0}; + memcpy(dbName, varDataVal(varDbname), varDataLen(varDbname)); + memcpy(tblName, varDataVal(varTbname), varDataLen(varTbname)); + printf("%s, %s\n", dbName, tblName); + int32_t result = 0; + udfColDataSet(resultCol, i, (char*)&result, false); } - TAOS_RES* res = taos_query(taos, "create database if not exists gpd"); - if (taos_errno(res) != 0) { - char* errstr = taos_errstr(res); - } - res = taos_query(taos, "create table gpd.st (ts timestamp, f int) tags(t int)"); - if (taos_errno(res) != 0) { - char* errstr = taos_errstr(res); - } - taos_query(taos, "insert into gpd.t using gpd.st tags(1) values(now, 1) "); - if (taos_errno(res) != 0) { - char* errstr = taos_errstr(res); - } - - taos_query(taos, "select * from gpd.t"); - if (taos_errno(res) != 0) { - char* errstr = taos_errstr(res); - } - - //to simulate actual processing delay by udf -#ifdef LINUX - usleep(1 * 1000); // usleep takes sleep time in us (1 millionth of a second) -#endif -#ifdef WINDOWS - Sleep(1); -#endif return 0; } diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index 63018aea8c..f4392fbca4 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -69,7 +69,7 @@ endi if $data4_db != 3 then # replica return -1 endi -if $data5_db != off then # strict +if $data5_db != on then # strict return -1 endi if $data6_db != 345600m then # duration diff --git a/tests/script/tsim/db/create_all_options.sim b/tests/script/tsim/db/create_all_options.sim index 7012fbac6c..382cc986e2 100644 --- a/tests/script/tsim/db/create_all_options.sim +++ b/tests/script/tsim/db/create_all_options.sim @@ -89,7 +89,7 @@ if $data4_db != 1 then # replica print expect 1, actual: $data4_db return -1 endi -if $data5_db != off then # strict +if $data5_db != on then # strict return -1 endi if $data6_db != 14400m then # duration diff --git a/tests/script/tsim/dnode/balance2.sim b/tests/script/tsim/dnode/balance2.sim index f677d3925c..3f5a42d4d3 100644 --- a/tests/script/tsim/dnode/balance2.sim +++ b/tests/script/tsim/dnode/balance2.sim @@ -4,11 +4,11 @@ system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 5 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 5 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 5 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 5 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 5 print ========== step1 system sh/exec.sh -n dnode1 -s start diff --git a/tests/script/tsim/query/udf_with_const.sim b/tests/script/tsim/query/udf_with_const.sim new file mode 100644 index 0000000000..7a2a3389bd --- /dev/null +++ b/tests/script/tsim/query/udf_with_const.sim @@ -0,0 +1,45 @@ +system_content printf %OS% +if $system_content == Windows_NT then + return 0; +endi + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c udf -v 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ======== step1 udf +system sh/compile_udf.sh +sql create database udf vgroups 3; +sql use udf; + +sql create table t (ts timestamp, f int); +sql insert into t values(now, 1)(now+1s, 2)(now+2s,3)(now+3s,4)(now+4s,5)(now+5s,6)(now+6s,7); + +system_content printf %OS% +if $system_content == Windows_NT then + return 0; +endi + +if $system_content == Windows_NT then + sql create function gpd as 'C:\\Windows\\Temp\\gpd.dll' outputtype int bufSize 8; +else + sql create function gpd as '/tmp/udf/libgpd.so' outputtype int bufSize 8; +endi +sql show functions; +if $rows != 1 then + return -1 +endi + +sql select gpd(ts, tbname, 'detail') from t; +if $rows != 7 then + return -1 +endi +print $data00 $data10 +if $data00 != @0@ then + return -1 +endi +sql drop function gpd; + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index bb2ea42383..7bf10df637 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -792,4 +792,46 @@ if $rows != 1 then goto loop17 endi +#for TS-2242 +sql create database test5 vgroups 1; +sql use test5; +sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); +sql create table ts1 using st tags(1,1,1); +sql create stream streams5 trigger at_once into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; +sql create stream streams6 trigger at_once into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ; + +sql_error create stream streams7 trigger at_once into streamt7 as select _wstart, count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; +sql_error create stream streams8 trigger at_once into streamt8 as select count(*), _wstart, _wstart, _wend, max(a) from ts1 interval(10s) ; +sql_error create stream streams9 trigger at_once into streamt9 as select _wstart as ts, count(*), _wstart as ts, _wend, max(a) from ts1 interval(10s) ; + +sql insert into ts1 values(1648791211000,1,2,3); + +print ====== test _wstart + +$loop_count = 0 + +loop17: + +sleep 200 +sql select * from streamt5; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 1 then + print =====rows=$rows + goto loop17 +endi + +sql select * from streamt6; + +if $rows != 1 then + print =====rows=$rows + goto loop17 +endi + +print ====== test _wstart end + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/drop_stream.sim b/tests/script/tsim/stream/drop_stream.sim index 817780ca59..1a474bd9ae 100644 --- a/tests/script/tsim/stream/drop_stream.sim +++ b/tests/script/tsim/stream/drop_stream.sim @@ -219,7 +219,7 @@ sql drop database test; print ========== interval\session\state window -sql CREATE DATABASE test1 BUFFER 96 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 STRICT 'off' WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0; +sql CREATE DATABASE test1 BUFFER 96 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0; sql use test1; sql CREATE STABLE st (time TIMESTAMP, ca DOUBLE, cb DOUBLE, cc int) TAGS (ta VARCHAR(10) ); diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 49e22db1b1..c9a1ddd922 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -461,7 +461,7 @@ sql insert into t2 values(1648791213004,4,10,10,4.1); $loop_count = 0 loop2: -sleep 100 +sleep 200 $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -519,7 +519,7 @@ print step 6 $loop_count = 0 loop3: -# sleep 300 +sleep 300 $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -618,6 +618,60 @@ if $data41 != 2 then goto loop4 endi +sql insert into t1 values(1648791343003,4,4,4,3.1); +sql insert into t1 values(1648791213004,4,5,5,4.1); + +loop5: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt3; + +# row 0 +if $rows != 7 then + print =====rows=$rows + goto loop5 +endi + +if $data01 != 4 then + print =====data01=$data01 + goto loop5 +endi + +if $data11 != 6 then + print =====data11=$data11 + goto loop5 +endi + +if $data21 != 4 then + print =====data21=$data21 + goto loop5 +endi + +if $data31 != 4 then + print =====data31=$data31 + goto loop5 +endi + +if $data41 != 2 then + print =====data41=$data41 + goto loop5 +endi + +if $data51 != 1 then + print =====data51=$data51 + goto loop5 +endi + +if $data61 != 1 then + print =====data61=$data61 + goto loop5 +endi + $loop_all = $loop_all + 1 print ============loop_all=$loop_all diff --git a/tests/script/tsim/user/privilege_topic.sim b/tests/script/tsim/user/privilege_topic.sim new file mode 100644 index 0000000000..9ce5bebec3 --- /dev/null +++ b/tests/script/tsim/user/privilege_topic.sim @@ -0,0 +1,156 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print =============== create db +sql create database root_d1 vgroups 1; +sql create database root_d2 vgroups 1; +sql create database root_d3 vgroups 1; + +sql show user privileges +if $rows != 1 then + return -1 +endi +if $data(root)[1] != all then + return -1 +endi +if $data(root)[2] != all then + return -1 +endi + +print =============== create users +sql create user user1 PASS 'taosdata' +sql create user user2 PASS 'taosdata' +sql create user user3 PASS 'taosdata' +sql create user user4 PASS 'taosdata' +sql create user user5 PASS 'taosdata' +sql create user user6 PASS 'taosdata' +sql alter user user1 sysinfo 0 + +sql select * from information_schema.ins_users +if $rows != 7 then + return -1 +endi + +sql GRANT read ON root_d1.* to user1; +sql GRANT write ON root_d2.* to user2; +sql GRANT read ON root_d3.* to user3; +sql GRANT write ON root_d3.* to user3; + +sql show user privileges +if $rows != 5 then + return -1 +endi +if $data(user1)[1] != read then + return -1 +endi +if $data(user1)[2] != root_d1 then + return -1 +endi +if $data(user2)[1] != write then + return -1 +endi +if $data(user2)[2] != root_d2 then + return -1 +endi + +print =============== create topis +sql use root_d1 +sql create table root_d1_stb (ts timestamp, i int) tags (j int) +sql create topic root_d1_topic1 as select ts, i from root_d1_stb +sql create topic root_d1_topic2 as select ts, i from root_d1_stb +sql create topic root_d1_topic3 as select ts, i from root_d1_stb +sql create topic root_d1_topic4 as select ts, i from root_d1_stb + +sql show user privileges +if $rows != 5 then + return -1 +endi + +sql GRANT subscribe ON root_d1_topic1 TO user4 +sql GRANT subscribe ON root_d1_topic2 TO user5 +sql GRANT subscribe ON root_d1_topic3 TO user6 +sql show user privileges +if $rows != 8 then + return -1 +endi + +if $data(user4)[1] != subscribe then + return -1 +endi +if $data(user4)[2] != root_d1_topic1 then + return -1 +endi +if $data(user5)[1] != subscribe then + return -1 +endi +if $data(user5)[2] != root_d1_topic2 then + return -1 +endi +if $data(user6)[1] != subscribe then + return -1 +endi +if $data(user6)[2] != root_d1_topic3 then + return -1 +endi + +sql REVOKE subscribe ON root_d1_topic3 from user6 +sql show user privileges +if $rows != 7 then + return -1 +endi +if $data(user4)[1] != subscribe then + return -1 +endi +if $data(user4)[2] != root_d1_topic1 then + return -1 +endi +if $data(user5)[1] != subscribe then + return -1 +endi +if $data(user5)[2] != root_d1_topic2 then + return -1 +endi + +print =============== repeat revoke/grant or invalid revoke/grant +sql GRANT subscribe ON root_d1_topic1 to user4 +sql GRANT subscribe ON root_d1_topic2 to user4 +sql GRANT subscribe ON root_d1_topic3 to user4 +sql GRANT subscribe ON root_d1_topic1 to user5 +sql GRANT subscribe ON root_d1_topic2 to user5 +sql GRANT subscribe ON root_d1_topic3 to user5 +sql GRANT subscribe ON root_d1_topic1 to user6 +sql GRANT subscribe ON root_d1_topic2 to user6 +sql GRANT subscribe ON root_d1_topic3 to user6 +sql REVOKE subscribe ON root_d1_topic1 from user4 +sql REVOKE subscribe ON root_d1_topic2 from user4 +sql REVOKE subscribe ON root_d1_topic3 from user4 +sql REVOKE subscribe ON root_d1_topic1 from user5 +sql REVOKE subscribe ON root_d1_topic2 from user5 +sql REVOKE subscribe ON root_d1_topic3 from user5 +sql REVOKE subscribe ON root_d1_topic1 from user6 +sql REVOKE subscribe ON root_d1_topic2 from user6 +sql REVOKE subscribe ON root_d1_topic3 from user6 + +print =============== invalid revoke/grant +sql_error GRANT subscribe ON root_d1_topicx from user5 +sql_error REVOKE subscribe ON root_d1_topicx from user5 + +print =============== check +sql GRANT subscribe ON root_d1_topic1 TO user4 +sql GRANT subscribe ON root_d1_topic2 TO user5 +sql GRANT subscribe ON root_d1_topic3 TO user6 +sql show user privileges +if $rows != 8 then + return -1 +endi + +print =============== re connect +print user u1 login +sql close +sql connect user1 + +sql_error show user privileges + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/vnode/stable_balance_replica1.sim b/tests/script/tsim/vnode/stable_balance_replica1.sim index f124979397..84190a3be0 100644 --- a/tests/script/tsim/vnode/stable_balance_replica1.sim +++ b/tests/script/tsim/vnode/stable_balance_replica1.sim @@ -3,10 +3,10 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 5 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 5 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 5 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 5 $dbPrefix = br1_db $tbPrefix = br1_tb diff --git a/tests/system-test/6-cluster/5dnode1mnode.py b/tests/system-test/6-cluster/5dnode1mnode.py index b576b37a4d..d0157ec7c7 100644 --- a/tests/system-test/6-cluster/5dnode1mnode.py +++ b/tests/system-test/6-cluster/5dnode1mnode.py @@ -125,7 +125,7 @@ class TDTestCase: tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') tdSql.query('select * from information_schema.ins_databases;') - tdSql.checkData(2,5,'off') + tdSql.checkData(2,5,'on') tdSql.error("alter database db strict 'off'") # tdSql.execute('alter database db strict 'on'') # tdSql.query('select * from information_schema.ins_databases;') diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index 94bb909e29..add3ccc51f 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -223,7 +223,7 @@ void shellRunSingleCommandWebsocketImp(char *command) { if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) { - fprintf(stderr, "TDengine server is down, will try to reconnect\n"); + fprintf(stderr, "TDengine server is disconnected, will try to reconnect\n"); shell.ws_conn = NULL; } ws_free_result(res);