diff --git a/cmake/cmake.define b/cmake/cmake.define index 639ae9ca3fd780a98d18969400f7c214dca01485..b89860e29f7251c47cd343d2e012d375b582b703 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -1,5 +1,15 @@ cmake_minimum_required(VERSION 3.16) +if (NOT DEFINED TD_GRANT) + SET(TD_GRANT FALSE) +endif() +if (NOT DEFINED TD_USB_DONGLE) + SET(TD_USB_DONGLE FALSE) +endif() +IF (TD_GRANT) + ADD_DEFINITIONS(-D_GRANT) +ENDIF () + IF ("${BUILD_TOOLS}" STREQUAL "") IF (TD_LINUX) IF (TD_ARM_32) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index acb99caffc5b6ab48fb9fdffc237bf1749d5a869..54bb83d244a3a2398db36985176dcc17ce9729ba 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,5 +1,6 @@ add_executable(tmq "") add_executable(tstream "") +add_executable(demoapi "") target_sources(tmq PRIVATE @@ -10,6 +11,12 @@ target_sources(tstream PRIVATE "src/tstream.c" ) + +target_sources(demoapi + PRIVATE + "src/demoapi.c" +) + target_link_libraries(tmq taos ) @@ -18,6 +25,10 @@ target_link_libraries(tstream taos ) +target_link_libraries(demoapi + taos +) + target_include_directories(tmq PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) @@ -26,5 +37,11 @@ target_include_directories(tstream PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) +target_include_directories(demoapi + PUBLIC "${TD_SOURCE_DIR}/include/client" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + SET_TARGET_PROPERTIES(tmq PROPERTIES OUTPUT_NAME tmq) SET_TARGET_PROPERTIES(tstream PROPERTIES OUTPUT_NAME tstream) +SET_TARGET_PROPERTIES(demoapi PROPERTIES OUTPUT_NAME demoapi) diff --git a/example/src/demoapi.c b/example/src/demoapi.c new file mode 100644 index 0000000000000000000000000000000000000000..ede13b4bb8bcfbe90810d5bad252219ba0c251a4 --- /dev/null +++ b/example/src/demoapi.c @@ -0,0 +1,197 @@ +// C api call sequence demo +// to compile: gcc -o apidemo apidemo.c -ltaos + +#include +#include +#include +#include +#include +#include + +#include "taos.h" + +#define debugPrint(fmt, ...) \ + do { if (g_args.debug_print || g_args.verbose_print) \ + fprintf(stdout, "DEBG: "fmt, __VA_ARGS__); } while(0) + +#define warnPrint(fmt, ...) \ + do { fprintf(stderr, "\033[33m"); \ + fprintf(stderr, "WARN: "fmt, __VA_ARGS__); \ + fprintf(stderr, "\033[0m"); } while(0) + +#define errorPrint(fmt, ...) \ + do { fprintf(stderr, "\033[31m"); \ + fprintf(stderr, "ERROR: "fmt, __VA_ARGS__); \ + fprintf(stderr, "\033[0m"); } while(0) + +#define okPrint(fmt, ...) \ + do { fprintf(stderr, "\033[32m"); \ + fprintf(stderr, "OK: "fmt, __VA_ARGS__); \ + fprintf(stderr, "\033[0m"); } while(0) + +int64_t g_num_of_tb = 2; +int64_t g_num_of_rec = 2; + +static struct argp_option options[] = { + {"tables", 't', "NUMBER", 0, "Number of child tables, default is 10000."}, + {"records", 'n', "NUMBER", 0, + "Number of records for each table, default is 10000."}, + {0}}; + +static error_t parse_opt(int key, char *arg, struct argp_state *state) { + switch (key) { + case 't': + g_num_of_tb = atoll(arg); + break; + + case 'n': + g_num_of_rec = atoll(arg); + break; + } + + return 0; +} + +static struct argp argp = {options, parse_opt, "", ""}; + +static void prepare_data(TAOS* taos) { + TAOS_RES *res; + res = taos_query(taos, "drop database if exists test;"); + taos_free_result(res); + usleep(100000); + + res = taos_query(taos, "create database test;"); + taos_free_result(res); + usleep(100000); + taos_select_db(taos, "test"); + + res = taos_query(taos, "create table meters(ts timestamp, f float, n int, b binary(20)) tags(area int, localtion binary(20));"); + taos_free_result(res); + + char command[1024] = {0}; + for (int64_t i = 0; i < g_num_of_tb; i ++) { + sprintf(command, "create table t%"PRId64" using meters tags(%"PRId64", '%s');", + i, i, (i%2)?"beijing":"shanghai"); + res = taos_query(taos, command); + taos_free_result(res); + + int64_t j = 0; + int64_t total = 0; + int64_t affected; + for (; j < g_num_of_rec -1; j ++) { + sprintf(command, "insert into t%"PRId64" values(%" PRId64 ", %f, %"PRId64", '%c%d')", + i, 1650000000000+j, (float)j, j, 'a'+(int)j%10, rand()); + res = taos_query(taos, command); + if ((res) && (0 == taos_errno(res))) { + affected = taos_affected_rows(res); + total += affected; + } else { + errorPrint("%s() LN%d: %s\n", + __func__, __LINE__, taos_errstr(res)); + } + taos_free_result(res); + } + sprintf(command, "insert into t%"PRId64" values(%" PRId64 ", NULL, NULL, NULL)", + i, 1650000000000+j+1); + res = taos_query(taos, command); + if ((res) && (0 == taos_errno(res))) { + affected = taos_affected_rows(res); + total += affected; + } else { + errorPrint("%s() LN%d: %s\n", + __func__, __LINE__, taos_errstr(res)); + } + taos_free_result(res); + + printf("insert %"PRId64" records into t%"PRId64", total affected rows: %"PRId64"\n", j, i, total); + } +} + +static int print_result(TAOS_RES* res, int block) { + int64_t num_rows = 0; + TAOS_ROW row = NULL; + int num_fields = taos_num_fields(res); + TAOS_FIELD* fields = taos_fetch_fields(res); + + if (block) { + warnPrint("%s() LN%d, call taos_fetch_block()\n", __func__, __LINE__); + int rows = 0; + while ((rows = taos_fetch_block(res, &row))) { + num_rows += rows; + } + } else { + warnPrint("%s() LN%d, call taos_fetch_rows()\n", __func__, __LINE__); + while ((row = taos_fetch_row(res))) { + char temp[256] = {0}; + taos_print_row(temp, row, fields, num_fields); + puts(temp); + num_rows ++; + } + } + + return num_rows; +} + +static void verify_query(TAOS* taos) { + // TODO: select count(tbname) from stable once stable query work + char command[1024] = {0}; + + for (int64_t i = 0; i < g_num_of_tb; i++) { + sprintf(command, "select * from t%"PRId64"", i); + TAOS_RES* res = taos_query(taos, command); + + if (res) { + if (0 == taos_errno(res)) { + int field_count = taos_field_count(res); + printf("field_count: %d\n", field_count); + int* lengths = taos_fetch_lengths(res); + if (lengths) { + for (int c = 0; c < field_count; c++) { + printf("length of column %d is %d\n", c, lengths[c]); + } + } else { + errorPrint("%s() LN%d: t%"PRId64"'s lengths is NULL\n", + __func__, __LINE__, i); + } + + int64_t rows = print_result(res, i % 2); + printf("rows is: %"PRId64"\n", rows); + + } else { + errorPrint("%s() LN%d: %s\n", + __func__, __LINE__, taos_errstr(res)); + } + } else { + errorPrint("%s() LN%d: %s\n", + __func__, __LINE__, taos_errstr(res)); + } + } +} + +int main(int argc, char *argv[]) { + const char* host = "127.0.0.1"; + const char* user = "root"; + const char* passwd = "taosdata"; + + argp_parse(&argp, argc, argv, 0, 0, NULL); + 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); + + prepare_data(taos); + + verify_query(taos); + + taos_close(taos); + printf("done\n"); + + return 0; +} + diff --git a/example/src/tmq.c b/example/src/tmq.c index ca80c8fe5a12fcf11d8c90088ec399d47b708756..85dea5b3826dc08bb92ea7928e11ca4cad0d6a23 100644 --- a/example/src/tmq.c +++ b/example/src/tmq.c @@ -19,8 +19,8 @@ #include #include "taos.h" -static int running = 1; -static void msg_process(tmq_message_t* message) { tmqShowMsg(message); } +static int running = 1; +/*static void msg_process(tmq_message_t* message) { tmqShowMsg(message); }*/ int32_t init_env() { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -166,11 +166,11 @@ void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) { int32_t cnt = 0; /*clock_t startTime = clock();*/ while (running) { - tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 500); + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 500); if (tmqmessage) { cnt++; - printf("get data\n"); - msg_process(tmqmessage); + /*printf("get data\n");*/ + /*msg_process(tmqmessage);*/ tmq_message_destroy(tmqmessage); /*} else {*/ /*break;*/ @@ -198,9 +198,9 @@ void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) { } while (running) { - tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 1000); + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 1000); if (tmqmessage) { - msg_process(tmqmessage); + /*msg_process(tmqmessage);*/ tmq_message_destroy(tmqmessage); if ((++msg_count % MIN_COMMIT_COUNT) == 0) tmq_commit(tmq, NULL, 0); @@ -226,10 +226,10 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics) { int32_t skipLogNum = 0; clock_t startTime = clock(); while (running) { - tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 500); + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 500); if (tmqmessage) { batchCnt++; - skipLogNum += tmqGetSkipLogNum(tmqmessage); + /*skipLogNum += tmqGetSkipLogNum(tmqmessage);*/ /*msg_process(tmqmessage);*/ tmq_message_destroy(tmqmessage); } else { diff --git a/include/client/taos.h b/include/client/taos.h index d3856d432e76a5a9667b0b22f5710509b0c01ba8..87948e7824f5ad5cee93d211d702ab3e834704de 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -30,7 +30,7 @@ typedef void **TAOS_ROW; #if 0 typedef void TAOS_STREAM; #endif -typedef void TAOS_SUB; +typedef void TAOS_SUB; // Data type definition #define TSDB_DATA_TYPE_NULL 0 // 1 bytes @@ -138,13 +138,13 @@ typedef enum { #define RET_MSG_LENGTH 1024 typedef struct setConfRet { SET_CONF_RET_CODE retCode; - char retMsg[RET_MSG_LENGTH]; + char retMsg[RET_MSG_LENGTH]; } setConfRet; -DLL_EXPORT void taos_cleanup(void); -DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...); -DLL_EXPORT setConfRet taos_set_config(const char *config); -DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port); +DLL_EXPORT void taos_cleanup(void); +DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...); +DLL_EXPORT setConfRet taos_set_config(const char *config); +DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port); DLL_EXPORT TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen, const char *db, int dbLen, uint16_t port); DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port); @@ -152,34 +152,34 @@ DLL_EXPORT void taos_close(TAOS *taos); const char *taos_data_type(int type); -DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos); -DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length); -DLL_EXPORT int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags); -DLL_EXPORT int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name); -DLL_EXPORT int taos_stmt_set_sub_tbname(TAOS_STMT *stmt, const char *name); - -DLL_EXPORT int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert); -DLL_EXPORT int taos_stmt_num_params(TAOS_STMT *stmt, int *nums); -DLL_EXPORT int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes); -DLL_EXPORT int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind); -DLL_EXPORT int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind); -DLL_EXPORT int taos_stmt_bind_single_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind, int colIdx); -DLL_EXPORT int taos_stmt_add_batch(TAOS_STMT *stmt); -DLL_EXPORT int taos_stmt_execute(TAOS_STMT *stmt); -DLL_EXPORT TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt); -DLL_EXPORT int taos_stmt_close(TAOS_STMT *stmt); -DLL_EXPORT char *taos_stmt_errstr(TAOS_STMT *stmt); -DLL_EXPORT int taos_stmt_affected_rows(TAOS_STMT *stmt); - -DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql); -DLL_EXPORT TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen); - -DLL_EXPORT TAOS_ROW taos_fetch_row(TAOS_RES *res); -DLL_EXPORT int taos_result_precision(TAOS_RES *res); // get the time precision of result -DLL_EXPORT void taos_free_result(TAOS_RES *res); -DLL_EXPORT int taos_field_count(TAOS_RES *res); -DLL_EXPORT int taos_num_fields(TAOS_RES *res); -DLL_EXPORT int taos_affected_rows(TAOS_RES *res); +DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos); +DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length); +DLL_EXPORT int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_BIND *tags); +DLL_EXPORT int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name); +DLL_EXPORT int taos_stmt_set_sub_tbname(TAOS_STMT *stmt, const char *name); + +DLL_EXPORT int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert); +DLL_EXPORT int taos_stmt_num_params(TAOS_STMT *stmt, int *nums); +DLL_EXPORT int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes); +DLL_EXPORT int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind); +DLL_EXPORT int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind); +DLL_EXPORT int taos_stmt_bind_single_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind, int colIdx); +DLL_EXPORT int taos_stmt_add_batch(TAOS_STMT *stmt); +DLL_EXPORT int taos_stmt_execute(TAOS_STMT *stmt); +DLL_EXPORT TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt); +DLL_EXPORT int taos_stmt_close(TAOS_STMT *stmt); +DLL_EXPORT char *taos_stmt_errstr(TAOS_STMT *stmt); +DLL_EXPORT int taos_stmt_affected_rows(TAOS_STMT *stmt); + +DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql); +DLL_EXPORT TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen); + +DLL_EXPORT TAOS_ROW taos_fetch_row(TAOS_RES *res); +DLL_EXPORT int taos_result_precision(TAOS_RES *res); // get the time precision of result +DLL_EXPORT void taos_free_result(TAOS_RES *res); +DLL_EXPORT int taos_field_count(TAOS_RES *res); +DLL_EXPORT int taos_num_fields(TAOS_RES *res); +DLL_EXPORT int taos_affected_rows(TAOS_RES *res); DLL_EXPORT TAOS_FIELD *taos_fetch_fields(TAOS_RES *res); DLL_EXPORT int taos_select_db(TAOS *taos, const char *db); @@ -188,14 +188,14 @@ DLL_EXPORT void taos_stop_query(TAOS_RES *res); DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int* numOfRows, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int* numOfRows, void** pData); +DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); +DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData); DLL_EXPORT int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex); DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); DLL_EXPORT void taos_reset_current_db(TAOS *taos); -DLL_EXPORT int *taos_fetch_lengths(TAOS_RES *res); -DLL_EXPORT TAOS_ROW *taos_result_block(TAOS_RES *res); +DLL_EXPORT int *taos_fetch_lengths(TAOS_RES *res); +DLL_EXPORT TAOS_ROW *taos_result_block(TAOS_RES *res); DLL_EXPORT const char *taos_get_server_info(TAOS *taos); DLL_EXPORT const char *taos_get_client_info(); @@ -237,9 +237,9 @@ typedef struct tmq_t tmq_t; typedef struct tmq_topic_vgroup_t tmq_topic_vgroup_t; typedef struct tmq_topic_vgroup_list_t tmq_topic_vgroup_list_t; -typedef struct tmq_conf_t tmq_conf_t; -typedef struct tmq_list_t tmq_list_t; -typedef struct tmq_message_t tmq_message_t; +typedef struct tmq_conf_t tmq_conf_t; +typedef struct tmq_list_t tmq_list_t; +// typedef struct tmq_message_t tmq_message_t; typedef void(tmq_commit_cb(tmq_t *, tmq_resp_err_t, tmq_topic_vgroup_list_t *, void *param)); @@ -259,7 +259,7 @@ DLL_EXPORT const char *tmq_err2str(tmq_resp_err_t); DLL_EXPORT tmq_resp_err_t tmq_subscribe(tmq_t *tmq, tmq_list_t *topic_list); DLL_EXPORT tmq_resp_err_t tmq_unsubscribe(tmq_t *tmq); DLL_EXPORT tmq_resp_err_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics); -DLL_EXPORT tmq_message_t *tmq_consumer_poll(tmq_t *tmq, int64_t blocking_time); +DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t blocking_time); DLL_EXPORT tmq_resp_err_t tmq_consumer_close(tmq_t *tmq); #if 0 DLL_EXPORT tmq_resp_err_t tmq_assign(tmq_t* tmq, const tmq_topic_vgroup_list_t* vgroups); @@ -268,8 +268,8 @@ DLL_EXPORT tmq_resp_err_t tmq_assignment(tmq_t* tmq, tmq_topic_vgroup_list_t** v DLL_EXPORT tmq_resp_err_t tmq_commit(tmq_t *tmq, const tmq_topic_vgroup_list_t *offsets, int32_t async); #if 0 DLL_EXPORT tmq_resp_err_t tmq_commit_message(tmq_t* tmq, const tmq_message_t* tmqmessage, int32_t async); -#endif DLL_EXPORT tmq_resp_err_t tmq_seek(tmq_t *tmq, const tmq_topic_vgroup_t *offset); +#endif /* ----------------------TMQ CONFIGURATION INTERFACE---------------------- */ enum tmq_conf_res_t { @@ -285,21 +285,24 @@ DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf); DLL_EXPORT void tmq_conf_set_offset_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb); +#if 0 // temporary used function for demo only void tmqShowMsg(tmq_message_t *tmq_message); int32_t tmqGetSkipLogNum(tmq_message_t *tmq_message); +#endif /* -------------------------TMQ MSG HANDLE INTERFACE---------------------- */ +DLL_EXPORT char *tmq_get_topic_name(TAOS_RES *res); +DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res); +#if 0 DLL_EXPORT TAOS_ROW tmq_get_row(tmq_message_t *message); -DLL_EXPORT char *tmq_get_topic_name(tmq_message_t *message); -DLL_EXPORT int32_t tmq_get_vgroup_id(tmq_message_t *message); DLL_EXPORT int64_t tmq_get_request_offset(tmq_message_t *message); DLL_EXPORT int64_t tmq_get_response_offset(tmq_message_t *message); DLL_EXPORT TAOS_FIELD *tmq_get_fields(tmq_t *tmq, const char *topic); DLL_EXPORT int32_t tmq_field_count(tmq_t *tmq, const char *topic); -DLL_EXPORT void tmq_message_destroy(tmq_message_t *tmq_message); - +#endif +DLL_EXPORT void tmq_message_destroy(TAOS_RES *res); /* --------------------TMPORARY INTERFACE FOR TESTING--------------------- */ #if 0 DLL_EXPORT TAOS_RES *tmq_create_topic(TAOS *taos, const char *name, const char *sql, int sqlLen); @@ -308,7 +311,7 @@ DLL_EXPORT TAOS_RES *tmq_create_topic(TAOS *taos, const char *name, const char * DLL_EXPORT TAOS_RES *tmq_create_stream(TAOS *taos, const char *streamName, const char *tbName, const char *sql); /* ------------------------------ TMQ END -------------------------------- */ -#if 1 // Shuduo: temporary enable for app build +#if 1 // Shuduo: temporary enable for app build typedef void (*TAOS_SUBSCRIBE_CALLBACK)(TAOS_SUB *tsub, TAOS_RES *res, void *param, int code); #endif diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 18323e00b682647e27c34e389486a2cfc0b730ba..6f933c663eba534250bc9cb77cfd545212551dd8 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -199,11 +199,11 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows); int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows); -void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows); -void blockDataCleanup(SSDataBlock* pDataBlock); - -size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize); +void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows); +void blockDataCleanup(SSDataBlock* pDataBlock); +size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize); +void* blockDataDestroy(SSDataBlock* pBlock); int32_t blockDataTrimFirstNRows(SSDataBlock* pBlock, size_t n); @@ -211,6 +211,10 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock); void blockDebugShowData(const SArray* dataBlocks); +static FORCE_INLINE int32_t blockGetEncodeSize(const SSDataBlock* pBlock) { + return blockDataGetSerialMetaSize(pBlock) + blockDataGetSize(pBlock); +} + static FORCE_INLINE int32_t blockCompressColData(SColumnInfoData* pColRes, int32_t numOfRows, char* data, int8_t compressed) { int32_t colSize = colDataGetLength(pColRes, numOfRows); diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 6d821e65b40e46eb905d87f0fca40ebafdf9f06f..f14125ccf5e41b6faf9b8d87fb7f36703816a24e 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -485,7 +485,7 @@ typedef struct { char intervalUnit; char slidingUnit; char - offsetUnit; // TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration. + offsetUnit; // TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration. int8_t precision; int64_t interval; int64_t sliding; @@ -2021,6 +2021,7 @@ typedef struct { static FORCE_INLINE int32_t taosEncodeSSchema(void** buf, const SSchema* pSchema) { int32_t tlen = 0; tlen += taosEncodeFixedI8(buf, pSchema->type); + tlen += taosEncodeFixedI8(buf, pSchema->index); tlen += taosEncodeFixedI32(buf, pSchema->bytes); tlen += taosEncodeFixedI16(buf, pSchema->colId); tlen += taosEncodeString(buf, pSchema->name); @@ -2029,6 +2030,7 @@ static FORCE_INLINE int32_t taosEncodeSSchema(void** buf, const SSchema* pSchema static FORCE_INLINE void* taosDecodeSSchema(void* buf, SSchema* pSchema) { buf = taosDecodeFixedI8(buf, &pSchema->type); + buf = taosDecodeFixedI8(buf, &pSchema->index); buf = taosDecodeFixedI32(buf, &pSchema->bytes); buf = taosDecodeFixedI16(buf, &pSchema->colId); buf = taosDecodeStringTo(buf, pSchema->name); @@ -2037,6 +2039,7 @@ static FORCE_INLINE void* taosDecodeSSchema(void* buf, SSchema* pSchema) { static FORCE_INLINE int32_t tEncodeSSchema(SCoder* pEncoder, const SSchema* pSchema) { if (tEncodeI8(pEncoder, pSchema->type) < 0) return -1; + if (tEncodeI8(pEncoder, pSchema->index) < 0) return -1; if (tEncodeI32(pEncoder, pSchema->bytes) < 0) return -1; if (tEncodeI16(pEncoder, pSchema->colId) < 0) return -1; if (tEncodeCStr(pEncoder, pSchema->name) < 0) return -1; @@ -2045,6 +2048,7 @@ static FORCE_INLINE int32_t tEncodeSSchema(SCoder* pEncoder, const SSchema* pSch static FORCE_INLINE int32_t tDecodeSSchema(SCoder* pDecoder, SSchema* pSchema) { if (tDecodeI8(pDecoder, &pSchema->type) < 0) return -1; + if (tDecodeI8(pDecoder, &pSchema->index) < 0) return -1; if (tDecodeI32(pDecoder, &pSchema->bytes) < 0) return -1; if (tDecodeI16(pDecoder, &pSchema->colId) < 0) return -1; if (tDecodeCStrTo(pDecoder, pSchema->name) < 0) return -1; @@ -2385,6 +2389,53 @@ typedef struct { SArray* pBlockData; // SArray } SMqPollRsp; +typedef struct { + SMqRspHead head; + int64_t reqOffset; + int64_t rspOffset; + int32_t skipLogNum; + int32_t dataLen; + SArray* blockPos; // beginning pos for each SRetrieveTableRsp + void* blockData; // serialized batched SRetrieveTableRsp +} SMqPollRspV2; + +static FORCE_INLINE int32_t tEncodeSMqPollRspV2(void** buf, const SMqPollRspV2* pRsp) { + int32_t tlen = 0; + tlen += taosEncodeFixedI64(buf, pRsp->reqOffset); + tlen += taosEncodeFixedI64(buf, pRsp->rspOffset); + tlen += taosEncodeFixedI32(buf, pRsp->skipLogNum); + tlen += taosEncodeFixedI32(buf, pRsp->dataLen); + if (pRsp->dataLen != 0) { + int32_t sz = taosArrayGetSize(pRsp->blockPos); + tlen += taosEncodeFixedI32(buf, sz); + for (int32_t i = 0; i < sz; i++) { + int32_t blockPos = *(int32_t*)taosArrayGet(pRsp->blockPos, i); + tlen += taosEncodeFixedI32(buf, blockPos); + } + tlen += taosEncodeBinary(buf, pRsp->blockData, pRsp->dataLen); + } + return tlen; +} + +static FORCE_INLINE void* tDecodeSMqPollRspV2(const void* buf, SMqPollRspV2* pRsp) { + buf = taosDecodeFixedI64(buf, &pRsp->reqOffset); + buf = taosDecodeFixedI64(buf, &pRsp->rspOffset); + buf = taosDecodeFixedI32(buf, &pRsp->skipLogNum); + buf = taosDecodeFixedI32(buf, &pRsp->dataLen); + if (pRsp->dataLen != 0) { + int32_t sz; + buf = taosDecodeFixedI32(buf, &sz); + pRsp->blockPos = taosArrayInit(sz, sizeof(int32_t)); + for (int32_t i = 0; i < sz; i++) { + int32_t blockPos; + buf = taosDecodeFixedI32(buf, &blockPos); + taosArrayPush(pRsp->blockPos, &blockPos); + } + buf = taosDecodeBinary(buf, &pRsp->blockData, pRsp->dataLen); + } + return (void*)buf; +} + typedef struct { SMqRspHead head; char cgroup[TSDB_CGROUP_LEN]; diff --git a/include/common/ttime.h b/include/common/ttime.h index 306f54bedb2f5609dc2f1e48d47f483e2d9f0d0f..15450c31ca09998cc7ce22853872eff718917a25 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -64,6 +64,7 @@ char getPrecisionUnit(int32_t precision); int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision); int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit); +int32_t convertStringToTimestamp(int16_t type, char *inputData, int64_t timePrec, int64_t *timeVal); void taosFormatUtcTime(char *buf, int32_t bufLen, int64_t time, int32_t precision); diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 3eb43c35e15a739ea4a33a634b52ee9490ea4cb9..f5b9c23ee67cb63f45c6afea0c33a1be1ae82280 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -140,88 +140,89 @@ #define TK_APPS 122 #define TK_CONNECTIONS 123 #define TK_LICENCE 124 -#define TK_QUERIES 125 -#define TK_SCORES 126 -#define TK_TOPICS 127 -#define TK_VARIABLES 128 -#define TK_BNODES 129 -#define TK_SNODES 130 -#define TK_LIKE 131 -#define TK_INDEX 132 -#define TK_FULLTEXT 133 -#define TK_FUNCTION 134 -#define TK_INTERVAL 135 -#define TK_TOPIC 136 -#define TK_AS 137 -#define TK_DESC 138 -#define TK_DESCRIBE 139 -#define TK_RESET 140 -#define TK_QUERY 141 -#define TK_EXPLAIN 142 -#define TK_ANALYZE 143 -#define TK_VERBOSE 144 -#define TK_NK_BOOL 145 -#define TK_RATIO 146 -#define TK_COMPACT 147 -#define TK_VNODES 148 -#define TK_IN 149 -#define TK_OUTPUTTYPE 150 -#define TK_AGGREGATE 151 -#define TK_BUFSIZE 152 -#define TK_STREAM 153 -#define TK_INTO 154 -#define TK_KILL 155 -#define TK_CONNECTION 156 -#define TK_MERGE 157 -#define TK_VGROUP 158 -#define TK_REDISTRIBUTE 159 -#define TK_SPLIT 160 -#define TK_SYNCDB 161 -#define TK_NULL 162 -#define TK_FIRST 163 -#define TK_LAST 164 -#define TK_NOW 165 -#define TK_ROWTS 166 -#define TK_TBNAME 167 -#define TK_QSTARTTS 168 -#define TK_QENDTS 169 -#define TK_WSTARTTS 170 -#define TK_WENDTS 171 -#define TK_WDURATION 172 -#define TK_BETWEEN 173 -#define TK_IS 174 -#define TK_NK_LT 175 -#define TK_NK_GT 176 -#define TK_NK_LE 177 -#define TK_NK_GE 178 -#define TK_NK_NE 179 -#define TK_MATCH 180 -#define TK_NMATCH 181 -#define TK_JOIN 182 -#define TK_INNER 183 -#define TK_SELECT 184 -#define TK_DISTINCT 185 -#define TK_WHERE 186 -#define TK_PARTITION 187 -#define TK_BY 188 -#define TK_SESSION 189 -#define TK_STATE_WINDOW 190 -#define TK_SLIDING 191 -#define TK_FILL 192 -#define TK_VALUE 193 -#define TK_NONE 194 -#define TK_PREV 195 -#define TK_LINEAR 196 -#define TK_NEXT 197 -#define TK_GROUP 198 -#define TK_HAVING 199 -#define TK_ORDER 200 -#define TK_SLIMIT 201 -#define TK_SOFFSET 202 -#define TK_LIMIT 203 -#define TK_OFFSET 204 -#define TK_ASC 205 -#define TK_NULLS 206 +#define TK_GRANTS 125 +#define TK_QUERIES 126 +#define TK_SCORES 127 +#define TK_TOPICS 128 +#define TK_VARIABLES 129 +#define TK_BNODES 130 +#define TK_SNODES 131 +#define TK_LIKE 132 +#define TK_INDEX 133 +#define TK_FULLTEXT 134 +#define TK_FUNCTION 135 +#define TK_INTERVAL 136 +#define TK_TOPIC 137 +#define TK_AS 138 +#define TK_DESC 139 +#define TK_DESCRIBE 140 +#define TK_RESET 141 +#define TK_QUERY 142 +#define TK_EXPLAIN 143 +#define TK_ANALYZE 144 +#define TK_VERBOSE 145 +#define TK_NK_BOOL 146 +#define TK_RATIO 147 +#define TK_COMPACT 148 +#define TK_VNODES 149 +#define TK_IN 150 +#define TK_OUTPUTTYPE 151 +#define TK_AGGREGATE 152 +#define TK_BUFSIZE 153 +#define TK_STREAM 154 +#define TK_INTO 155 +#define TK_KILL 156 +#define TK_CONNECTION 157 +#define TK_MERGE 158 +#define TK_VGROUP 159 +#define TK_REDISTRIBUTE 160 +#define TK_SPLIT 161 +#define TK_SYNCDB 162 +#define TK_NULL 163 +#define TK_FIRST 164 +#define TK_LAST 165 +#define TK_NOW 166 +#define TK_ROWTS 167 +#define TK_TBNAME 168 +#define TK_QSTARTTS 169 +#define TK_QENDTS 170 +#define TK_WSTARTTS 171 +#define TK_WENDTS 172 +#define TK_WDURATION 173 +#define TK_BETWEEN 174 +#define TK_IS 175 +#define TK_NK_LT 176 +#define TK_NK_GT 177 +#define TK_NK_LE 178 +#define TK_NK_GE 179 +#define TK_NK_NE 180 +#define TK_MATCH 181 +#define TK_NMATCH 182 +#define TK_JOIN 183 +#define TK_INNER 184 +#define TK_SELECT 185 +#define TK_DISTINCT 186 +#define TK_WHERE 187 +#define TK_PARTITION 188 +#define TK_BY 189 +#define TK_SESSION 190 +#define TK_STATE_WINDOW 191 +#define TK_SLIDING 192 +#define TK_FILL 193 +#define TK_VALUE 194 +#define TK_NONE 195 +#define TK_PREV 196 +#define TK_LINEAR 197 +#define TK_NEXT 198 +#define TK_GROUP 199 +#define TK_HAVING 200 +#define TK_ORDER 201 +#define TK_SLIMIT 202 +#define TK_SOFFSET 203 +#define TK_LIMIT 204 +#define TK_OFFSET 205 +#define TK_ASC 206 +#define TK_NULLS 207 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 9d1b2c9ea07ad10c4ac167747d21c20b88b03c4c..148a9f77d6081596332ac1dc4244e86317d69427 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -85,8 +85,8 @@ typedef enum EFunctionType { // conversion function FUNCTION_TYPE_CAST = 2000, FUNCTION_TYPE_TO_ISO8601, + FUNCTION_TYPE_TO_UNIXTIMESTAMP, FUNCTION_TYPE_TO_JSON, - FUNCTION_TYPE_UNIXTIMESTAMP, // date and time function FUNCTION_TYPE_NOW = 2500, diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index 3c5b164648bd50f18b2616ec96896ceac606eb6a..10b4866a965a47aafc03232c9f73168c30d6f597 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -31,8 +31,8 @@ pNode will be freed in API; */ int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes); -/* -pDst need to freed in caller +/* +pDst need to freed in caller */ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst); @@ -73,6 +73,12 @@ int32_t substrFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu /* Conversion functions */ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +/* Time related functions */ +int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); + bool getTimePseudoFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); int32_t winStartTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); diff --git a/include/os/osDir.h b/include/os/osDir.h index d3597cab36aa27e19360f290ec841c54a3e96ccd..e7da54bf548ff4da95e800e0beccdda9e13c4df7 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -38,6 +38,7 @@ typedef struct TdDirEntry *TdDirEntryPtr; void taosRemoveDir(const char *dirname); bool taosDirExist(char *dirname); int32_t taosMkDir(const char *dirname); +int32_t taosMulMkDir(const char *dirname); void taosRemoveOldFiles(const char *dirname, int32_t keepDays); int32_t taosExpandDir(const char *dirname, char *outname, int32_t maxlen); int32_t taosRealPath(char *dirname, int32_t maxlen); diff --git a/include/os/osFile.h b/include/os/osFile.h index 89b58cdd65b22ab926e479d3d3d111ff6b4460ff..36ca6fb8bb507cb604aca8399011960f9a14ca1d 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -79,7 +79,7 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset) int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count); void taosFprintfFile(TdFilePtr pFile, const char *format, ...); -int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict__ ptrBuf); +int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict ptrBuf); int32_t taosEOFFile(TdFilePtr pFile); diff --git a/include/os/osSystem.h b/include/os/osSystem.h index 15959a2d8c690813d777577075a373dfc501637f..33b0a46ee91f706242a1279a3a42567e51621d92 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -29,6 +29,13 @@ extern "C" { #define tcgetattr TCGETATTR_FUNC_TAOS_FORBID #endif +typedef struct TdCmd *TdCmdPtr; + +TdCmdPtr taosOpenCmd(const char *cmd); +int64_t taosGetLineCmd(TdCmdPtr pCmd, char ** __restrict ptrBuf); +int32_t taosEOFCmd(TdCmdPtr pCmd); +int64_t taosCloseCmd(TdCmdPtr *ppCmd); + void* taosLoadDll(const char* filename); void* taosLoadSym(void* handle, char* name); void taosCloseDll(void* handle); diff --git a/include/util/tdef.h b/include/util/tdef.h index 246c3e2eaab44ed78d06eea102a09ebbb415fac9..f7ff0a111287d5f21cd8b3eba083e9bfac3777a5 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -94,6 +94,11 @@ extern const int32_t TYPE_BYTES[15]; #define TSDB_TIME_PRECISION_MICRO_STR "us" #define TSDB_TIME_PRECISION_NANO_STR "ns" +#define TSDB_TIME_PRECISION_SEC_DIGITS 10 +#define TSDB_TIME_PRECISION_MILLI_DIGITS 13 +#define TSDB_TIME_PRECISION_MICRO_DIGITS 16 +#define TSDB_TIME_PRECISION_NANO_DIGITS 19 + #define TSDB_INFORMATION_SCHEMA_DB "information_schema" #define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" #define TSDB_INS_TABLE_DNODES "dnodes" diff --git a/packaging/install.sh b/packaging/install.sh index 3aae074af55ada32ecee1a8033b71217c706d301..c9748d223b9a36057397e07dbf4c6fd27a90693c 100755 --- a/packaging/install.sh +++ b/packaging/install.sh @@ -157,7 +157,7 @@ function install_main_path() { ${csudo} mkdir -p ${install_main_dir}/cfg ${csudo} mkdir -p ${install_main_dir}/bin ${csudo} mkdir -p ${install_main_dir}/connector - ${csudo} mkdir -p ${install_main_dir}/driver + ${csudo} mkdir -p ${install_main_dir}/lib ${csudo} mkdir -p ${install_main_dir}/examples ${csudo} mkdir -p ${install_main_dir}/include ${csudo} mkdir -p ${install_main_dir}/init.d @@ -198,6 +198,10 @@ function install_lib() { # Remove links ${csudo} rm -f ${lib_link_dir}/libtaos.* || : ${csudo} rm -f ${lib64_link_dir}/libtaos.* || : + ${csudo} rm -f ${lib_link_dir}/libtdb.* || : + ${csudo} rm -f ${lib64_link_dir}/libtdb.* || : + + ${csudo} cp -rf ${script_dir}/lib/* ${install_main_dir}/lib && ${csudo} chmod 777 ${install_main_dir}/lib/* ${csudo} ln -s ${install_main_dir}/lib/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 185b5824d956908aed375bd5efd629da21892a29..b7d88c277bfffaccf16bfcc2baf70c604e3b1dcc 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -194,12 +194,12 @@ enum { #define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) #define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) -typedef struct SMqRspObj { +typedef struct { int8_t resType; char* topic; - void* vg; SArray* res; // SArray int32_t resIter; + int32_t vgId; } SMqRspObj; typedef struct SRequestObj { diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 040ddde63099be572f3d3facf2b947cb52124235..c93260be374b416d682632721d7fa4219806c2e8 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -465,7 +465,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { return 0; } - doFetchRow(pRequest, false, false); + doFetchRow(pRequest, false, true); SReqResultInfo *pResultInfo = &pRequest->body.resInfo; diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index dbe78782f5dd66284167a89fb731d944ab519fa0..ea31170b1ffebfd039db8eabb858672912cf02da 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -27,11 +27,22 @@ struct tmq_message_t { SMqPollRsp msg; char* topic; - void* vg; SArray* res; // SArray + int32_t vgId; int32_t resIter; }; +typedef struct { + int8_t tmqRspType; + int32_t epoch; +} SMqRspWrapper; + +typedef struct { + int8_t tmqRspType; + int32_t epoch; + SMqCMGetSubEpRsp msg; +} SMqAskEpRspWrapper; + struct tmq_list_t { SArray container; }; @@ -118,6 +129,14 @@ typedef struct { TAOS_FIELD* fields; } SMqClientTopic; +typedef struct { + int8_t tmqRspType; + int32_t epoch; + SMqClientVg* vgHandle; + SMqClientTopic* topicHandle; + SMqPollRspV2 msg; +} SMqPollRspWrapper; + typedef struct { tmq_t* tmq; tsem_t rspSem; @@ -133,10 +152,10 @@ typedef struct { typedef struct { tmq_t* tmq; SMqClientVg* pVg; + SMqClientTopic* pTopic; int32_t epoch; int32_t vgId; tsem_t rspSem; - tmq_message_t** msg; int32_t sync; } SMqPollCbParam; @@ -244,7 +263,7 @@ static int32_t tmqMakeTopicVgKey(char* dst, const char* topicName, int32_t vg) { } void tmqClearUnhandleMsg(tmq_t* tmq) { - tmq_message_t* msg = NULL; + SMqRspWrapper* msg = NULL; while (1) { taosGetQitem(tmq->qall, (void**)&msg); if (msg) @@ -777,7 +796,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) { return buf; } - +#if 0 int32_t tmqGetSkipLogNum(tmq_message_t* tmq_message) { if (tmq_message == NULL) return 0; SMqPollRsp* pRsp = &tmq_message->msg; @@ -827,11 +846,13 @@ void tmqShowMsg(tmq_message_t* tmq_message) { } } } +#endif int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { /*printf("recv poll\n");*/ SMqPollCbParam* pParam = (SMqPollCbParam*)param; SMqClientVg* pVg = pParam->pVg; + SMqClientTopic* pTopic = pParam->pTopic; tmq_t* tmq = pParam->tmq; if (code != 0) { tscWarn("msg discard from vg %d, epoch %d, code:%x", pParam->vgId, pParam->epoch, code); @@ -874,18 +895,22 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { #endif /*SMqConsumeRsp* pRsp = taosMemoryCalloc(1, sizeof(SMqConsumeRsp));*/ - tmq_message_t* pRsp = taosAllocateQitem(sizeof(tmq_message_t)); - if (pRsp == NULL) { + /*tmq_message_t* pRsp = taosAllocateQitem(sizeof(tmq_message_t));*/ + SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper)); + if (pRspWrapper == NULL) { tscWarn("msg discard from vg %d, epoch %d since out of memory", pParam->vgId, pParam->epoch); goto CREATE_MSG_FAIL; } - memcpy(pRsp, pMsg->pData, sizeof(SMqRspHead)); - tDecodeSMqPollRsp(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), &pRsp->msg); - /*pRsp->iter.curBlock = 0;*/ - /*pRsp->iter.curRow = 0;*/ + pRspWrapper->tmqRspType = TMQ_MSG_TYPE__POLL_RSP; + pRspWrapper->vgHandle = pVg; + pRspWrapper->topicHandle = pTopic; + /*memcpy(pRsp, pMsg->pData, sizeof(SMqRspHead));*/ + memcpy(&pRspWrapper->msg, pMsg->pData, sizeof(SMqRspHead)); + tDecodeSMqPollRspV2(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), &pRspWrapper->msg); // TODO: alloc mem /*pRsp->*/ /*printf("rsp commit off:%ld rsp off:%ld has data:%d\n", pRsp->committedOffset, pRsp->rspOffset, pRsp->numOfTopics);*/ + #if 0 if (pRsp->msg.numOfTopics == 0) { /*printf("no data\n");*/ @@ -894,11 +919,10 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { } #endif - tscDebug("consumer %ld recv poll: vg %d, req offset %ld, rsp offset %ld", tmq->consumerId, pParam->pVg->vgId, - pRsp->msg.reqOffset, pRsp->msg.rspOffset); + tscDebug("consumer %ld recv poll: vg %d, req offset %ld, rsp offset %ld", tmq->consumerId, pVg->vgId, + pRspWrapper->msg.reqOffset, pRspWrapper->msg.rspOffset); - pRsp->vg = pParam->pVg; - taosWriteQitem(tmq->mqueue, pRsp); + taosWriteQitem(tmq->mqueue, pRspWrapper); atomic_add_fetch_32(&tmq->readyRequest, 1); /*tsem_post(&tmq->rspSem);*/ return 0; @@ -1015,16 +1039,19 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) { } tDeleteSMqCMGetSubEpRsp(&rsp); } else { - SMqCMGetSubEpRsp* pRsp = taosAllocateQitem(sizeof(SMqCMGetSubEpRsp)); - if (pRsp == NULL) { + /*SMqCMGetSubEpRsp* pRsp = taosAllocateQitem(sizeof(SMqCMGetSubEpRsp));*/ + SMqAskEpRspWrapper* pWrapper = taosAllocateQitem(sizeof(SMqAskEpRspWrapper)); + if (pWrapper == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = -1; goto END; } - memcpy(pRsp, pMsg->pData, sizeof(SMqRspHead)); - tDecodeSMqCMGetSubEpRsp(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pRsp); + pWrapper->tmqRspType = TMQ_MSG_TYPE__EP_RSP; + pWrapper->epoch = head->epoch; + memcpy(&pWrapper->msg, pMsg->pData, sizeof(SMqRspHead)); + tDecodeSMqCMGetSubEpRsp(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), &pWrapper->msg); - taosWriteQitem(tmq->mqueue, pRsp); + taosWriteQitem(tmq->mqueue, pWrapper); /*tsem_post(&tmq->rspSem);*/ } @@ -1152,6 +1179,25 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blockingTime, SMqClientTo return pReq; } +SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper) { + SMqRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqRspObj)); + pRspObj->resType = RES_TYPE__TMQ; + pRspObj->topic = strdup(pWrapper->topicHandle->topicName); + pRspObj->resIter = -1; + pRspObj->vgId = pWrapper->vgHandle->vgId; + SMqPollRspV2* pRsp = &pWrapper->msg; + int32_t blockNum = taosArrayGetSize(pRsp->blockPos); + pRspObj->res = taosArrayInit(blockNum, sizeof(SReqResultInfo)); + for (int32_t i = 0; i < blockNum; i++) { + int32_t pos = *(int32_t*)taosArrayGet(pRsp->blockPos, i); + SRetrieveTableRsp* pRetrieve = POINTER_SHIFT(pRsp->blockData, pos); + SReqResultInfo resInfo; + setQueryResultFromRsp(&resInfo, pRetrieve, true); + taosArrayPush(pRspObj->res, &resInfo); + } + return pRspObj; +} + #if 0 tmq_message_t* tmqSyncPollImpl(tmq_t* tmq, int64_t blockingTime) { tmq_message_t* msg = NULL; @@ -1258,6 +1304,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) { } pParam->tmq = tmq; pParam->pVg = pVg; + pParam->pTopic = pTopic; pParam->vgId = pVg->vgId; pParam->epoch = tmq->epoch; pParam->sync = 0; @@ -1296,13 +1343,13 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) { return 0; } -// return -int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspHead* rspHead, bool* pReset) { - if (rspHead->mqMsgType == TMQ_MSG_TYPE__EP_RSP) { +int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset) { + if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__EP_RSP) { /*printf("ep %d %d\n", rspMsg->head.epoch, tmq->epoch);*/ - if (rspHead->epoch > atomic_load_32(&tmq->epoch)) { - SMqCMGetSubEpRsp* rspMsg = (SMqCMGetSubEpRsp*)rspHead; - tmqUpdateEp(tmq, rspHead->epoch, rspMsg); + if (rspWrapper->epoch > atomic_load_32(&tmq->epoch)) { + SMqAskEpRspWrapper* pEpRspWrapper = (SMqAskEpRspWrapper*)rspWrapper; + SMqCMGetSubEpRsp* rspMsg = &pEpRspWrapper->msg; + tmqUpdateEp(tmq, rspWrapper->epoch, rspMsg); /*tmqClearUnhandleMsg(tmq);*/ *pReset = true; } else { @@ -1314,41 +1361,43 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspHead* rspHead, bool* pReset) { return 0; } -tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfReset) { +SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfReset) { while (1) { - SMqRspHead* rspHead = NULL; - taosGetQitem(tmq->qall, (void**)&rspHead); - if (rspHead == NULL) { + SMqRspWrapper* rspWrapper = NULL; + taosGetQitem(tmq->qall, (void**)&rspWrapper); + if (rspWrapper == NULL) { taosReadAllQitems(tmq->mqueue, tmq->qall); - taosGetQitem(tmq->qall, (void**)&rspHead); - if (rspHead == NULL) return NULL; + taosGetQitem(tmq->qall, (void**)&rspWrapper); + if (rspWrapper == NULL) return NULL; } - if (rspHead->mqMsgType == TMQ_MSG_TYPE__POLL_RSP) { - tmq_message_t* rspMsg = (tmq_message_t*)rspHead; + if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_RSP) { + SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)rspWrapper; atomic_sub_fetch_32(&tmq->readyRequest, 1); /*printf("handle poll rsp %d\n", rspMsg->head.mqMsgType);*/ - if (rspMsg->msg.head.epoch == atomic_load_32(&tmq->epoch)) { + if (pollRspWrapper->msg.head.epoch == atomic_load_32(&tmq->epoch)) { /*printf("epoch match\n");*/ - SMqClientVg* pVg = rspMsg->vg; + SMqClientVg* pVg = pollRspWrapper->vgHandle; /*printf("vg %d offset %ld up to %ld\n", pVg->vgId, pVg->currentOffset, rspMsg->msg.rspOffset);*/ - pVg->currentOffset = rspMsg->msg.rspOffset; + pVg->currentOffset = pollRspWrapper->msg.rspOffset; atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); - if (rspMsg->msg.numOfTopics == 0) { - taosFreeQitem(rspMsg); - rspHead = NULL; + if (pollRspWrapper->msg.dataLen == 0) { + taosFreeQitem(pollRspWrapper); + rspWrapper = NULL; continue; } - return rspMsg; + // build msg + SMqRspObj* pRsp = tmqBuildRspFromWrapper(pollRspWrapper); + return pRsp; } else { /*printf("epoch mismatch\n");*/ - taosFreeQitem(rspMsg); + taosFreeQitem(pollRspWrapper); } } else { /*printf("handle ep rsp %d\n", rspMsg->head.mqMsgType);*/ bool reset = false; - tmqHandleNoPollRsp(tmq, rspHead, &reset); - taosFreeQitem(rspHead); + tmqHandleNoPollRsp(tmq, rspWrapper, &reset); + taosFreeQitem(rspWrapper); if (pollIfReset && reset) { tscDebug("consumer %ld reset and repoll", tmq->consumerId); tmqPollImpl(tmq, blockingTime); @@ -1382,17 +1431,17 @@ tmq_message_t* tmq_consumer_poll_v1(tmq_t* tmq, int64_t blocking_time) { } #endif -tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) { - tmq_message_t* rspMsg; - int64_t startTime = taosGetTimestampMs(); +TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) { + SMqRspObj* rspObj; + int64_t startTime = taosGetTimestampMs(); // TODO: put into another thread or delayed queue int64_t status = atomic_load_64(&tmq->status); tmqAskEp(tmq, status == TMQ_CONSUMER_STATUS__INIT); - rspMsg = tmqHandleAllRsp(tmq, blocking_time, false); - if (rspMsg) { - return rspMsg; + rspObj = tmqHandleAllRsp(tmq, blocking_time, false); + if (rspObj) { + return (TAOS_RES*)rspObj; } while (1) { @@ -1402,9 +1451,9 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) { /*tsem_wait(&tmq->rspSem);*/ - rspMsg = tmqHandleAllRsp(tmq, blocking_time, false); - if (rspMsg) { - return rspMsg; + rspObj = tmqHandleAllRsp(tmq, blocking_time, false); + if (rspObj) { + return (TAOS_RES*)rspObj; } if (blocking_time != 0) { int64_t endTime = taosGetTimestampMs(); @@ -1546,6 +1595,7 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* tmq_topic_v } #endif +#if 0 void tmq_message_destroy(tmq_message_t* tmq_message) { if (tmq_message == NULL) return; SMqPollRsp* pRsp = &tmq_message->msg; @@ -1553,6 +1603,7 @@ void tmq_message_destroy(tmq_message_t* tmq_message) { /*taosMemoryFree(tmq_message);*/ taosFreeQitem(tmq_message); } +#endif tmq_resp_err_t tmq_consumer_close(tmq_t* tmq) { return TMQ_RESP_ERR__SUCCESS; } @@ -1563,4 +1614,27 @@ const char* tmq_err2str(tmq_resp_err_t err) { return "fail"; } -char* tmq_get_topic_name(tmq_message_t* message) { return "not implemented yet"; } +char* tmq_get_topic_name(TAOS_RES* res) { + if (TD_RES_TMQ(res)) { + SMqRspObj* pRspObj = (SMqRspObj*)res; + return pRspObj->topic; + } else { + return NULL; + } +} + +int32_t tmq_get_vgroup_id(TAOS_RES* res) { + if (TD_RES_TMQ(res)) { + SMqRspObj* pRspObj = (SMqRspObj*)res; + return pRspObj->vgId; + } else { + return -1; + } +} + +void tmq_message_destroy(TAOS_RES* res) { + if (res == NULL) return; + if (TD_RES_TMQ(res)) { + SMqRspObj* pRspObj = (SMqRspObj*)res; + } +} diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index df4433e6e41c87b28761711b185c4919b663cfcf..58bc7235a1a14f1be58ca88d0d08f500f4c78092 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -616,7 +616,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32); - if (taosMkDir(tsLogDir) != 0) { + if (taosMulMkDir(tsLogDir) != 0) { uError("failed to create dir:%s since %s", tsLogDir, terrstr()); cfgCleanup(pCfg); return -1; diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index a65352f2b919f85894996193796f4d2efde15b16..1baf393e9a215c9e18cd2208c28a6163a501564b 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -406,7 +406,31 @@ int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char default: { return -1; } - } + } +} + +int32_t convertStringToTimestamp(int16_t type, char *inputData, int64_t timePrec, int64_t *timeVal) { + int32_t charLen = varDataLen(inputData); + char *newColData; + if (type == TSDB_DATA_TYPE_BINARY) { + newColData = taosMemoryCalloc(1, charLen + 1); + memcpy(newColData, varDataVal(inputData), charLen); + taosParseTime(newColData, timeVal, charLen, (int32_t)timePrec, 0); + taosMemoryFree(newColData); + } else if (type == TSDB_DATA_TYPE_NCHAR) { + newColData = taosMemoryCalloc(1, charLen / TSDB_NCHAR_SIZE + 1); + int len = taosUcs4ToMbs((TdUcs4 *)varDataVal(inputData), charLen, newColData); + if (len < 0){ + taosMemoryFree(newColData); + return TSDB_CODE_FAILED; + } + newColData[len] = 0; + taosParseTime(newColData, timeVal, len + 1, (int32_t)timePrec, 0); + taosMemoryFree(newColData); + } else { + return TSDB_CODE_FAILED; + } + return TSDB_CODE_SUCCESS; } static int32_t getDuration(int64_t val, char unit, int64_t* result, int32_t timePrecision) { diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index f4987734628d7947724d67bdd0746927dc80c8bf..8fb4b02479866a23aaabc76568488a62522a673b 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -20,9 +20,17 @@ add_executable(taosd ${EXEC_SRC}) target_include_directories( taosd PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" + PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/impl/inc" ) target_link_libraries(taosd dnode) +IF (TD_GRANT) + TARGET_LINK_LIBRARIES(taosd grant) +ENDIF () +IF (TD_USB_DONGLE) + TARGET_LINK_LIBRARIES(taosd usb_dongle) +ENDIF () + if(${BUILD_TEST}) add_subdirectory(test) endif(${BUILD_TEST}) diff --git a/source/dnode/mgmt/exe/dndMain.c b/source/dnode/mgmt/exe/dndMain.c index 997c56f9fb10f63b67bf858de4b76a1efedaaa4c..80c431fe369c21b81525e402e49f7592766f1c6f 100644 --- a/source/dnode/mgmt/exe/dndMain.c +++ b/source/dnode/mgmt/exe/dndMain.c @@ -16,6 +16,7 @@ #define _DEFAULT_SOURCE #include "dndInt.h" #include "tconfig.h" +#include "mndGrant.h" static struct { bool dumpConfig; @@ -90,8 +91,7 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) { } static void dndGenerateGrant() { - // grantParseParameter(); - printf("this feature is not implemented yet\n"); + grantParseParameter(); } static void dndPrintVersion() { diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 341dbf6135ed82caec7230268d124b0dc12020c7..8cb5e2a528fa52430d07d47f691a1c5a493a55ac 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -9,6 +9,13 @@ target_link_libraries( mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser ) +IF (TD_GRANT) + TARGET_LINK_LIBRARIES(mnode grant) +ENDIF () +IF (TD_USB_DONGLE) + TARGET_LINK_LIBRARIES(mnode usb_dongle) +ENDIF () + if(${BUILD_TEST}) add_subdirectory(test) endif(${BUILD_TEST}) diff --git a/include/common/tgrant.h b/source/dnode/mnode/impl/inc/mndGrant.h similarity index 92% rename from include/common/tgrant.h rename to source/dnode/mnode/impl/inc/mndGrant.h index 962af0ddc4b431313871e8d46f3c58c609da2479..ad3dc7f79d2d9925e223880bde05560f1587fb11 100644 --- a/include/common/tgrant.h +++ b/source/dnode/mnode/impl/inc/mndGrant.h @@ -36,8 +36,8 @@ typedef enum { TSDB_GRANT_CPU_CORES, } EGrantType; -int32_t grantInit(); -void grantCleanUp(); +int32_t mndInitGrant(); +void mndCleanupGrant(); void grantParseParameter(); int32_t grantCheck(EGrantType grant); void grantReset(EGrantType grant, uint64_t value); diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c new file mode 100644 index 0000000000000000000000000000000000000000..37f87142e6a4a999a9d86d9b2e2190fc8265ff63 --- /dev/null +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -0,0 +1,31 @@ +/* + * 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 . + */ + +#define _DEFAULT_SOURCE +#ifndef _GRANT +#include "os.h" +#include "taoserror.h" +#include "mndGrant.h" +#include "mndInt.h" + +int32_t mndInitGrant(SMnode *pMnode) { return TSDB_CODE_SUCCESS; } +void mndCleanupGrant() {} +void grantParseParameter() { mError("can't parsed parameter k"); } +int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; } +void grantReset(EGrantType grant, uint64_t value) {} +void grantAdd(EGrantType grant, uint64_t value) {} +void grantRestore(EGrantType grant, uint64_t value) {} + +#endif \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mnode.c b/source/dnode/mnode/impl/src/mnode.c index 5a1780530c257cc7c37ac11cbcd1f40db383481d..cad6396338f28e2b0d8dc8922478c30d70101c8e 100644 --- a/source/dnode/mnode/impl/src/mnode.c +++ b/source/dnode/mnode/impl/src/mnode.c @@ -40,6 +40,7 @@ #include "mndUser.h" #include "mndVgroup.h" #include "mndQuery.h" +#include "mndGrant.h" #define MQ_TIMER_MS 3000 #define TRNAS_TIMER_MS 6000 @@ -197,6 +198,7 @@ static int32_t mndInitSteps(SMnode *pMnode, bool deploy) { if (mndAllocStep(pMnode, "mnode-qnode", mndInitBnode, mndCleanupBnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-dnode", mndInitDnode, mndCleanupDnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-user", mndInitUser, mndCleanupUser) != 0) return -1; + if (mndAllocStep(pMnode, "mnode-grant", mndInitGrant, mndCleanupGrant) != 0) return -1; if (mndAllocStep(pMnode, "mnode-auth", mndInitAuth, mndCleanupAuth) != 0) return -1; if (mndAllocStep(pMnode, "mnode-acct", mndInitAcct, mndCleanupAcct) != 0) return -1; if (mndAllocStep(pMnode, "mnode-stream", mndInitStream, mndCleanupStream) != 0) return -1; diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index bd2e4213d574ec3d4086038b0e8776d266f91071..4b8aa5dfaf4cd5d08cb0c20ba9d9da50b66cf1b0 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -30,6 +30,7 @@ target_sources( # tsdb # "src/tsdb/tsdbBDBImpl.c" + "src/tsdb/tsdbTDBImpl.c" "src/tsdb/tsdbCommit.c" "src/tsdb/tsdbCompact.c" "src/tsdb/tsdbFile.c" @@ -40,7 +41,7 @@ target_sources( "src/tsdb/tsdbRead.c" "src/tsdb/tsdbReadImpl.c" "src/tsdb/tsdbScan.c" - # "src/tsdb/tsdbSma.c" + "src/tsdb/tsdbSma.c" "src/tsdb/tsdbWrite.c" # tq diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 113501a26b41fba6846a3299e13a946189e36188..aab835b958c92578aab28bf1178924aff1999b56 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -357,7 +357,7 @@ STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid); STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid); SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline); STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver); -STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid); +void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode); STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid); SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup); int metaGetTbNum(SMeta *pMeta); @@ -369,8 +369,8 @@ void metaCloseCtbCurosr(SMCtbCursor *pCtbCur); tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur); SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid); -void metaCloseSmaCurosr(SMSmaCursor *pSmaCur); -const char *metaSmaCursorNext(SMSmaCursor *pSmaCur); +void metaCloseSmaCursor(SMSmaCursor *pSmaCur); +int64_t metaSmaCursorNext(SMSmaCursor *pSmaCur); // Options void metaOptionsInit(SMetaCfg *pMetaCfg); diff --git a/source/dnode/vnode/src/inc/tsdbSma.h b/source/dnode/vnode/src/inc/tsdbSma.h new file mode 100644 index 0000000000000000000000000000000000000000..ce03fa7c678b888e6374cb23ba060f463e1c39c6 --- /dev/null +++ b/source/dnode/vnode/src/inc/tsdbSma.h @@ -0,0 +1,68 @@ +/* + * 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 . + */ + +#ifndef _TD_VNODE_TSDB_SMA_H_ +#define _TD_VNODE_TSDB_SMA_H_ + +#include "tdbInt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SSmaKey SSmaKey; + +struct SSmaKey { + TSKEY skey; + int64_t groupId; +}; + + +typedef struct SDBFile SDBFile; + +struct SDBFile { + int32_t fid; + TDB *pDB; + char *path; +}; + +int32_t tsdbOpenDBEnv(TENV **ppEnv, const char *path); +int32_t tsdbCloseDBEnv(TENV *pEnv); +int32_t tsdbOpenDBF(TENV *pEnv, SDBFile *pDBF); +int32_t tsdbCloseDBF(SDBFile *pDBF); +int32_t tsdbSaveSmaToDB(SDBFile *pDBF, void *pKey, int32_t keyLen, void *pVal, int32_t valLen, TXN *txn); +void *tsdbGetSmaDataByKey(SDBFile *pDBF, const void *pKey, int32_t keyLen, int32_t *valLen); + +void tsdbDestroySmaEnv(SSmaEnv *pSmaEnv); +void *tsdbFreeSmaEnv(SSmaEnv *pSmaEnv); +#if 0 +int32_t tsdbGetTSmaStatus(STsdb *pTsdb, STSma *param, void *result); +int32_t tsdbRemoveTSmaData(STsdb *pTsdb, STSma *param, STimeWindow *pWin); +#endif + +// internal func +static FORCE_INLINE int32_t tsdbEncodeTSmaKey(int64_t groupId, TSKEY tsKey, void **pData) { + int32_t len = 0; + len += taosEncodeFixedI64(pData, tsKey); + len += taosEncodeFixedI64(pData, groupId); + return len; +} + + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_TSDB_SMA_H_*/ \ No newline at end of file diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 6e1f00f93190c2220a0961e3ba491e69764d255e..29a45723c473bab2fba35cffcdf5851db99e225e 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -220,6 +220,8 @@ void smaHandleRes(void* pVnode, int64_t smaId, const SArray* data); #include "tq.h" +#include "tsdbSma.h" + #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/meta/metaBDBImpl.c b/source/dnode/vnode/src/meta/metaBDBImpl.c index caa101b5d064ef1cc636fe9e29c7a5dd6137ac85..a8270f746d029e1a16132b62aceb8aec0d5a5c7c 100644 --- a/source/dnode/vnode/src/meta/metaBDBImpl.c +++ b/source/dnode/vnode/src/meta/metaBDBImpl.c @@ -667,7 +667,7 @@ STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid) { return pTbCfg; } -STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) { +void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode) { STSma * pCfg = NULL; SMetaDB *pDB = pMeta->pDB; DBT key = {0}; @@ -920,7 +920,7 @@ SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) { return pCur; } -void metaCloseSmaCurosr(SMSmaCursor *pCur) { +void metaCloseSmaCursor(SMSmaCursor *pCur) { if (pCur) { if (pCur->pCur) { pCur->pCur->close(pCur->pCur); @@ -930,7 +930,8 @@ void metaCloseSmaCurosr(SMSmaCursor *pCur) { } } -const char *metaSmaCursorNext(SMSmaCursor *pCur) { +int64_t metaSmaCursorNext(SMSmaCursor *pCur) { +#if 0 DBT skey = {0}; DBT pkey = {0}; DBT pval = {0}; @@ -946,6 +947,8 @@ const char *metaSmaCursorNext(SMSmaCursor *pCur) { } else { return NULL; } +#endif + return 0; } STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) { @@ -972,7 +975,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) { ++pSW->number; STSma *tptr = (STSma *)taosMemoryRealloc(pSW->tSma, pSW->number * sizeof(STSma)); if (tptr == NULL) { - metaCloseSmaCurosr(pCur); + metaCloseSmaCursor(pCur); tdDestroyTSmaWrapper(pSW); taosMemoryFreeClear(pSW); return NULL; @@ -980,7 +983,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) { pSW->tSma = tptr; pBuf = pval.data; if (tDecodeTSma(pBuf, pSW->tSma + pSW->number - 1) == NULL) { - metaCloseSmaCurosr(pCur); + metaCloseSmaCursor(pCur); tdDestroyTSmaWrapper(pSW); taosMemoryFreeClear(pSW); return NULL; @@ -990,8 +993,8 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) { break; } - metaCloseSmaCurosr(pCur); - + metaCloseSmaCursor(pCur); + return pSW; } @@ -1004,7 +1007,7 @@ SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup) { int ret; // TODO: lock? - ret = pDB->pCtbIdx->cursor(pDB->pSmaIdx, NULL, &pCur, 0); + ret = pDB->pSmaIdx->cursor(pDB->pSmaIdx, NULL, &pCur, 0); if (ret != 0) { return NULL; } diff --git a/source/dnode/vnode/src/meta/metaTDBImpl.c b/source/dnode/vnode/src/meta/metaTDBImpl.c index c78691e7c25099d3e96bac5f7412aba9ac7da230..6f218ad72b7308d1a16d90612dc466583631c35e 100644 --- a/source/dnode/vnode/src/meta/metaTDBImpl.c +++ b/source/dnode/vnode/src/meta/metaTDBImpl.c @@ -22,22 +22,28 @@ typedef struct SPoolMem { struct SPoolMem *next; } SPoolMem; +#define META_TDB_SMA_TEST + static SPoolMem *openPool(); static void clearPool(SPoolMem *pPool); static void closePool(SPoolMem *pPool); -static void *poolMalloc(void *arg, size_t size); +static void * poolMalloc(void *arg, size_t size); static void poolFree(void *arg, void *ptr); struct SMetaDB { TXN txn; - TENV *pEnv; - TDB *pTbDB; - TDB *pSchemaDB; - TDB *pNameIdx; - TDB *pStbIdx; - TDB *pNtbIdx; - TDB *pCtbIdx; + TENV * pEnv; + TDB * pTbDB; + TDB * pSchemaDB; + TDB * pNameIdx; + TDB * pStbIdx; + TDB * pNtbIdx; + TDB * pCtbIdx; SPoolMem *pPool; +#ifdef META_TDB_SMA_TEST + TDB *pSmaDB; + TDB *pSmaIdx; +#endif }; typedef struct __attribute__((__packed__)) { @@ -46,7 +52,7 @@ typedef struct __attribute__((__packed__)) { } SSchemaDbKey; typedef struct { - char *name; + char * name; tb_uid_t uid; } SNameIdxKey; @@ -55,6 +61,11 @@ typedef struct { tb_uid_t uid; } SCtbIdxKey; +typedef struct { + tb_uid_t uid; + int64_t smaUid; +} SSmaIdxKey; + static int metaEncodeTbInfo(void **buf, STbCfg *pTbCfg); static void *metaDecodeTbInfo(void *buf, STbCfg *pTbCfg); static int metaEncodeSchema(void **buf, SSchemaWrapper *pSW); @@ -115,6 +126,17 @@ static inline int metaCtbIdxCmpr(const void *arg1, int len1, const void *arg2, i return metaUidCmpr(&pKey1->uid, sizeof(tb_uid_t), &pKey2->uid, sizeof(tb_uid_t)); } +static inline int metaSmaIdxCmpr(const void *arg1, int len1, const void *arg2, int len2) { + int c; + SSmaIdxKey *pKey1 = (SSmaIdxKey *)arg1; + SSmaIdxKey *pKey2 = (SSmaIdxKey *)arg2; + + c = metaUidCmpr(arg1, sizeof(tb_uid_t), arg2, sizeof(tb_uid_t)); + if (c) return c; + + return metaUidCmpr(&pKey1->smaUid, sizeof(int64_t), &pKey2->smaUid, sizeof(int64_t)); +} + int metaOpenDB(SMeta *pMeta) { SMetaDB *pMetaDb; int ret; @@ -143,6 +165,15 @@ int metaOpenDB(SMeta *pMeta) { return -1; } +#ifdef META_TDB_SMA_TEST + ret = tdbDbOpen("sma.db", sizeof(int64_t), TDB_VARIANT_LEN, metaUidCmpr, pMetaDb->pEnv, &(pMetaDb->pSmaDB)); + if (ret < 0) { + // TODO + ASSERT(0); + return -1; + } +#endif + // open schema DB ret = tdbDbOpen("schema.db", sizeof(SSchemaDbKey), TDB_VARIANT_LEN, metaSchemaKeyCmpr, pMetaDb->pEnv, &(pMetaDb->pSchemaDB)); @@ -180,6 +211,15 @@ int metaOpenDB(SMeta *pMeta) { return -1; } +#ifdef META_TDB_SMA_TEST + ret = tdbDbOpen("sma.idx", sizeof(SSmaIdxKey), 0, metaSmaIdxCmpr, pMetaDb->pEnv, &(pMetaDb->pSmaIdx)); + if (ret < 0) { + // TODO + ASSERT(0); + return -1; + } +#endif + pMetaDb->pPool = openPool(); tdbTxnOpen(&pMetaDb->txn, 0, poolMalloc, poolFree, pMetaDb->pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); tdbBegin(pMetaDb->pEnv, NULL); @@ -193,10 +233,16 @@ void metaCloseDB(SMeta *pMeta) { tdbCommit(pMeta->pDB->pEnv, &pMeta->pDB->txn); tdbTxnClose(&pMeta->pDB->txn); clearPool(pMeta->pDB->pPool); +#ifdef META_TDB_SMA_TEST + tdbDbClose(pMeta->pDB->pSmaIdx); +#endif tdbDbClose(pMeta->pDB->pCtbIdx); tdbDbClose(pMeta->pDB->pNtbIdx); tdbDbClose(pMeta->pDB->pStbIdx); tdbDbClose(pMeta->pDB->pNameIdx); +#ifdef META_TDB_SMA_TEST + tdbDbClose(pMeta->pDB->pSmaDB); +#endif tdbDbClose(pMeta->pDB->pSchemaDB); tdbDbClose(pMeta->pDB->pTbDB); taosMemoryFree(pMeta->pDB); @@ -205,14 +251,14 @@ void metaCloseDB(SMeta *pMeta) { int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { tb_uid_t uid; - SMetaDB *pMetaDb; - void *pKey; - void *pVal; + SMetaDB * pMetaDb; + void * pKey; + void * pVal; int kLen; int vLen; int ret; char buf[512]; - void *pBuf; + void * pBuf; SCtbIdxKey ctbIdxKey; SSchemaDbKey schemaDbKey; SSchemaWrapper schemaWrapper; @@ -329,11 +375,11 @@ int metaRemoveTableFromDb(SMeta *pMeta, tb_uid_t uid) { STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid) { int ret; SMetaDB *pMetaDb = pMeta->pDB; - void *pKey; - void *pVal; + void * pKey; + void * pVal; int kLen; int vLen; - STbCfg *pTbCfg; + STbCfg * pTbCfg; // Fetch pKey = &uid; @@ -385,14 +431,14 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo } static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline, bool isGetEx) { - void *pKey; - void *pVal; + void * pKey; + void * pVal; int kLen; int vLen; int ret; SSchemaDbKey schemaDbKey; SSchemaWrapper *pSchemaWrapper; - void *pBuf; + void * pBuf; // fetch schemaDbKey.uid = uid; @@ -419,9 +465,9 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) { tb_uid_t quid; SSchemaWrapper *pSW; STSchemaBuilder sb; - SSchemaEx *pSchema; - STSchema *pTSchema; - STbCfg *pTbCfg; + SSchemaEx * pSchema; + STSchema * pTSchema; + STbCfg * pTbCfg; pTbCfg = metaGetTbInfoByUid(pMeta, uid); if (pTbCfg->type == META_CHILD_TABLE) { @@ -452,7 +498,7 @@ struct SMTbCursor { SMTbCursor *metaOpenTbCursor(SMeta *pMeta) { SMTbCursor *pTbCur = NULL; - SMetaDB *pDB = pMeta->pDB; + SMetaDB * pDB = pMeta->pDB; pTbCur = (SMTbCursor *)taosMemoryCalloc(1, sizeof(*pTbCur)); if (pTbCur == NULL) { @@ -474,12 +520,12 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) { } char *metaTbCursorNext(SMTbCursor *pTbCur) { - void *pKey = NULL; - void *pVal = NULL; + void * pKey = NULL; + void * pVal = NULL; int kLen; int vLen; int ret; - void *pBuf; + void * pBuf; STbCfg tbCfg; for (;;) { @@ -491,7 +537,6 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) { taosMemoryFree(tbCfg.name); taosMemoryFree(tbCfg.stbCfg.pTagSchema); continue; - ; } else if (tbCfg.type == META_CHILD_TABLE) { kvRowFree(tbCfg.ctbCfg.pTag); } @@ -503,17 +548,17 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) { } struct SMCtbCursor { - TDBC *pCur; + TDBC * pCur; tb_uid_t suid; - void *pKey; - void *pVal; + void * pKey; + void * pVal; int kLen; int vLen; }; SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid) { SMCtbCursor *pCtbCur = NULL; - SMetaDB *pDB = pMeta->pDB; + SMetaDB * pDB = pMeta->pDB; int ret; pCtbCur = (SMCtbCursor *)taosMemoryCalloc(1, sizeof(*pCtbCur)); @@ -566,51 +611,326 @@ int metaGetTbNum(SMeta *pMeta) { return 0; } +struct SMSmaCursor { + TDBC *pCur; + tb_uid_t uid; + void *pKey; + void *pVal; + int kLen; + int vLen; +}; + STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) { // TODO - ASSERT(0); - return NULL; + // ASSERT(0); + // return NULL; +#ifdef META_TDB_SMA_TEST + STSmaWrapper *pSW = NULL; + + pSW = taosMemoryCalloc(1, sizeof(*pSW)); + if (pSW == NULL) { + return NULL; + } + + SMSmaCursor *pCur = metaOpenSmaCursor(pMeta, uid); + if (pCur == NULL) { + taosMemoryFree(pSW); + return NULL; + } + + void *pBuf = NULL; + SSmaIdxKey *pSmaIdxKey = NULL; + + while (true) { + // TODO: lock during iterate? + if (tdbDbNext(pCur->pCur, &pCur->pKey, &pCur->kLen, NULL, &pCur->vLen) == 0) { + pSmaIdxKey = pCur->pKey; + ASSERT(pSmaIdxKey != NULL); + + void *pSmaVal = metaGetSmaInfoByIndex(pMeta, pSmaIdxKey->smaUid, false); + + if (pSmaVal == NULL) { + tsdbWarn("no tsma exists for indexUid: %" PRIi64, pSmaIdxKey->smaUid); + continue; + } + + + ++pSW->number; + STSma *tptr = (STSma *)taosMemoryRealloc(pSW->tSma, pSW->number * sizeof(STSma)); + if (tptr == NULL) { + TDB_FREE(pSmaVal); + metaCloseSmaCursor(pCur); + tdDestroyTSmaWrapper(pSW); + taosMemoryFreeClear(pSW); + return NULL; + } + pSW->tSma = tptr; + pBuf = pSmaVal; + if (tDecodeTSma(pBuf, pSW->tSma + pSW->number - 1) == NULL) { + TDB_FREE(pSmaVal); + metaCloseSmaCursor(pCur); + tdDestroyTSmaWrapper(pSW); + taosMemoryFreeClear(pSW); + return NULL; + } + TDB_FREE(pSmaVal); + continue; + } + break; + } + + metaCloseSmaCursor(pCur); + + return pSW; + +#endif } int metaRemoveSmaFromDb(SMeta *pMeta, int64_t indexUid) { // TODO ASSERT(0); +#ifndef META_TDB_SMA_TEST + DBT key = {0}; + + key.data = (void *)indexName; + key.size = strlen(indexName); + + metaDBWLock(pMeta->pDB); + // TODO: No guarantee of consistence. + // Use transaction or DB->sync() for some guarantee. + pMeta->pDB->pSmaDB->del(pMeta->pDB->pSmaDB, NULL, &key, 0); + metaDBULock(pMeta->pDB); +#endif return 0; } int metaSaveSmaToDB(SMeta *pMeta, STSma *pSmaCfg) { // TODO - ASSERT(0); + // ASSERT(0); + +#ifdef META_TDB_SMA_TEST + int32_t ret = 0; + SMetaDB *pMetaDb = pMeta->pDB; + void *pBuf = NULL, *qBuf = NULL; + void *key = {0}, *val = {0}; + + // save sma info + int32_t len = tEncodeTSma(NULL, pSmaCfg); + pBuf = taosMemoryCalloc(1, len); + if (pBuf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + key = (void *)&pSmaCfg->indexUid; + qBuf = pBuf; + tEncodeTSma(&qBuf, pSmaCfg); + val = pBuf; + + int32_t kLen = sizeof(pSmaCfg->indexUid); + int32_t vLen = POINTER_DISTANCE(qBuf, pBuf); + + ret = tdbDbInsert(pMeta->pDB->pSmaDB, key, kLen, val, vLen, &pMetaDb->txn); + if (ret < 0) { + taosMemoryFreeClear(pBuf); + return -1; + } + + // add sma idx + SSmaIdxKey smaIdxKey; + smaIdxKey.uid = pSmaCfg->tableUid; + smaIdxKey.smaUid = pSmaCfg->indexUid; + key = &smaIdxKey; + kLen = sizeof(smaIdxKey); + val = NULL; + vLen = 0; + + ret = tdbDbInsert(pMeta->pDB->pSmaIdx, key, kLen, val, vLen, &pMetaDb->txn); + if (ret < 0) { + taosMemoryFreeClear(pBuf); + return -1; + } + + // release + taosMemoryFreeClear(pBuf); + + if (pMeta->pDB->pPool->size > 0) { + metaCommit(pMeta); + } + +#endif return 0; } -STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) { +void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode) { // TODO - ASSERT(0); - return NULL; + // ASSERT(0); + // return NULL; +#ifdef META_TDB_SMA_TEST + SMetaDB *pDB = pMeta->pDB; + void *pKey = NULL; + void *pVal = NULL; + int kLen = 0; + int vLen = 0; + int ret = -1; + + // Set key + pKey = (void *)&indexUid; + kLen = sizeof(indexUid); + + // Query + ret = tdbDbGet(pDB->pSmaDB, pKey, kLen, &pVal, &vLen); + if (ret != 0 || !pVal) { + return NULL; + } + + if (!isDecode) { + // return raw value + return pVal; + } + + // Decode + STSma *pCfg = (STSma *)taosMemoryCalloc(1, sizeof(STSma)); + if (pCfg == NULL) { + taosMemoryFree(pVal); + return NULL; + } + + void *pBuf = pVal; + if (tDecodeTSma(pBuf, pCfg) == NULL) { + tdDestroyTSma(pCfg); + taosMemoryFree(pCfg); + TDB_FREE(pVal); + return NULL; + } + + TDB_FREE(pVal); + return pCfg; +#endif } -const char *metaSmaCursorNext(SMSmaCursor *pCur) { +/** + * @brief + * + * @param pMeta + * @param uid 0 means iterate all uids. + * @return SMSmaCursor* + */ +SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) { // TODO - ASSERT(0); - return NULL; + // ASSERT(0); + // return NULL; +#ifdef META_TDB_SMA_TEST + SMSmaCursor *pCur = NULL; + SMetaDB *pDB = pMeta->pDB; + int ret; + + pCur = (SMSmaCursor *)taosMemoryCalloc(1, sizeof(*pCur)); + if (pCur == NULL) { + return NULL; + } + + pCur->uid = uid; + ret = tdbDbcOpen(pDB->pSmaIdx, &(pCur->pCur)); + if ((ret != 0) || (pCur->pCur == NULL)) { + taosMemoryFree(pCur); + return NULL; + } + + if (uid != 0) { + // TODO: move to the specific uid + } + + return pCur; +#endif } -void metaCloseSmaCurosr(SMSmaCursor *pCur) { +/** + * @brief + * + * @param pCur + * @return int64_t smaIndexUid + */ +int64_t metaSmaCursorNext(SMSmaCursor *pCur) { // TODO - ASSERT(0); + // ASSERT(0); + // return NULL; +#ifdef META_TDB_SMA_TEST + int ret; + void *pBuf; + SSmaIdxKey *smaIdxKey; + + ret = tdbDbNext(pCur->pCur, &pCur->pKey, &pCur->kLen, &pCur->pVal, &pCur->vLen); + if (ret < 0) { + return 0; + } + smaIdxKey = pCur->pKey; + return smaIdxKey->smaUid; +#endif } -SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup) { +void metaCloseSmaCursor(SMSmaCursor *pCur) { // TODO - // ASSERT(0); // comment this line to pass CI - return NULL; + // ASSERT(0); +#ifdef META_TDB_SMA_TEST + if (pCur) { + if (pCur->pCur) { + tdbDbcClose(pCur->pCur); + } + + taosMemoryFree(pCur); + } +#endif } -SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) { +SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup) { // TODO - ASSERT(0); - return NULL; + // ASSERT(0); // comment this line to pass CI + // return NULL: +#ifdef META_TDB_SMA_TEST + SArray *pUids = NULL; + SMetaDB *pDB = pMeta->pDB; + void *pKey; + + // TODO: lock? + SMSmaCursor *pCur = metaOpenSmaCursor(pMeta, 0); + if (pCur == NULL) { + return NULL; + } + // TODO: lock? + + SSmaIdxKey *pSmaIdxKey = NULL; + tb_uid_t uid = 0; + while (true) { + // TODO: lock during iterate? + if (tdbDbNext(pCur->pCur, &pCur->pKey, &pCur->kLen, NULL, &pCur->vLen) == 0) { + ASSERT(pSmaIdxKey != NULL); + pSmaIdxKey = pCur->pKey; + + if (pSmaIdxKey->uid == 0 || pSmaIdxKey->uid == uid) { + continue; + } + uid = pSmaIdxKey->uid; + + if (!pUids) { + pUids = taosArrayInit(16, sizeof(tb_uid_t)); + if (!pUids) { + metaCloseSmaCursor(pCur); + return NULL; + } + } + + taosArrayPush(pUids, &uid); + + continue; + } + break; + } + + metaCloseSmaCursor(pCur); + + return pUids; +#endif } static int metaEncodeSchema(void **buf, SSchemaWrapper *pSW) { @@ -621,6 +941,7 @@ static int metaEncodeSchema(void **buf, SSchemaWrapper *pSW) { for (int i = 0; i < pSW->nCols; i++) { pSchema = pSW->pSchema + i; tlen += taosEncodeFixedI8(buf, pSchema->type); + tlen += taosEncodeFixedI8(buf, pSchema->index); tlen += taosEncodeFixedI16(buf, pSchema->colId); tlen += taosEncodeFixedI32(buf, pSchema->bytes); tlen += taosEncodeString(buf, pSchema->name); @@ -637,6 +958,7 @@ static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW) { for (int i = 0; i < pSW->nCols; i++) { pSchema = pSW->pSchema + i; buf = taosDecodeFixedI8(buf, &pSchema->type); + buf = taosSkipFixedLen(buf, sizeof(int8_t)); buf = taosDecodeFixedI16(buf, &pSchema->colId); buf = taosDecodeFixedI32(buf, &pSchema->bytes); buf = taosDecodeStringTo(buf, pSchema->name); @@ -781,7 +1103,7 @@ static void closePool(SPoolMem *pPool) { } static void *poolMalloc(void *arg, size_t size) { - void *ptr = NULL; + void * ptr = NULL; SPoolMem *pPool = (SPoolMem *)arg; SPoolMem *pMem; diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 0d4acd4594e3bbe546fbba47ecd042ed8fd1eef4..bee61f4d40cd0a835bfe6afe75ae3616a7df0773 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -82,9 +82,9 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t versi memcpy(data, msg, msgLen); if (msgType == TDMT_VND_SUBMIT) { - // if (tsdbUpdateSmaWindow(pTq->pVnode->pTsdb, msg) != 0) { - // return -1; - // } + if (tsdbUpdateSmaWindow(pTq->pVnode->pTsdb, msg) != 0) { + return -1; + } } SRpcMsg req = { @@ -255,7 +255,7 @@ int32_t tqDeserializeConsumer(STQ* pTq, const STqSerializedHead* pHead, STqConsu return 0; } - +#if 0 int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { SMqPollReq* pReq = pMsg->pCont; int64_t consumerId = pReq->consumerId; @@ -433,6 +433,205 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { return 0; } +#endif + +int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { + SMqPollReq* pReq = pMsg->pCont; + int64_t consumerId = pReq->consumerId; + int64_t fetchOffset; + int64_t blockingTime = pReq->blockingTime; + int32_t reqEpoch = pReq->epoch; + + if (pReq->currentOffset == TMQ_CONF__RESET_OFFSET__EARLIEAST) { + fetchOffset = 0; + } else if (pReq->currentOffset == TMQ_CONF__RESET_OFFSET__LATEST) { + fetchOffset = walGetLastVer(pTq->pWal); + } else { + fetchOffset = pReq->currentOffset + 1; + } + + vDebug("tmq poll: consumer %ld (epoch %d) recv poll req in vg %d, req %ld %ld", consumerId, pReq->epoch, + pTq->pVnode->vgId, pReq->currentOffset, fetchOffset); + + SMqPollRspV2 rspV2 = {0}; + rspV2.dataLen = 0; + + STqConsumer* pConsumer = tqHandleGet(pTq->tqMeta, consumerId); + if (pConsumer == NULL) { + vWarn("tmq poll: consumer %ld (epoch %d) not found in vg %d", consumerId, pReq->epoch, pTq->pVnode->vgId); + pMsg->pCont = NULL; + pMsg->contLen = 0; + pMsg->code = -1; + tmsgSendRsp(pMsg); + return 0; + } + + int32_t consumerEpoch = atomic_load_32(&pConsumer->epoch); + while (consumerEpoch < reqEpoch) { + consumerEpoch = atomic_val_compare_exchange_32(&pConsumer->epoch, consumerEpoch, reqEpoch); + } + + STqTopic* pTopic = NULL; + int32_t topicSz = taosArrayGetSize(pConsumer->topics); + for (int32_t i = 0; i < topicSz; i++) { + STqTopic* topic = taosArrayGet(pConsumer->topics, i); + // TODO race condition + ASSERT(pConsumer->consumerId == consumerId); + if (strcmp(topic->topicName, pReq->topic) == 0) { + pTopic = topic; + break; + } + } + if (pTopic == NULL) { + vWarn("tmq poll: consumer %ld (epoch %d) topic %s not found in vg %d", consumerId, pReq->epoch, pReq->topic, + pTq->pVnode->vgId); + pMsg->pCont = NULL; + pMsg->contLen = 0; + pMsg->code = -1; + tmsgSendRsp(pMsg); + return 0; + } + + vDebug("poll topic %s from consumer %ld (epoch %d) vg %d", pTopic->topicName, consumerId, pReq->epoch, + pTq->pVnode->vgId); + + rspV2.reqOffset = pReq->currentOffset; + rspV2.skipLogNum = 0; + + while (1) { + /*if (fetchOffset > walGetLastVer(pTq->pWal) || walReadWithHandle(pTopic->pReadhandle, fetchOffset) < 0) {*/ + // TODO + consumerEpoch = atomic_load_32(&pConsumer->epoch); + if (consumerEpoch > reqEpoch) { + vDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, found new consumer epoch %d discard req epoch %d", + consumerId, pReq->epoch, pTq->pVnode->vgId, fetchOffset, consumerEpoch, reqEpoch); + break; + } + SWalReadHead* pHead; + if (walReadWithHandle_s(pTopic->pReadhandle, fetchOffset, &pHead) < 0) { + // TODO: no more log, set timer to wait blocking time + // if data inserted during waiting, launch query and + // response to user + vDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, no more log to return", consumerId, pReq->epoch, + pTq->pVnode->vgId, fetchOffset); + break; + } + vDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d", consumerId, pReq->epoch, + pTq->pVnode->vgId, fetchOffset, pHead->msgType); + /*int8_t pos = fetchOffset % TQ_BUFFER_SIZE;*/ + /*pHead = pTopic->pReadhandle->pHead;*/ + if (pHead->msgType == TDMT_VND_SUBMIT) { + SSubmitReq* pCont = (SSubmitReq*)&pHead->body; + qTaskInfo_t task = pTopic->buffer.output[workerId].task; + ASSERT(task); + qSetStreamInput(task, pCont, STREAM_DATA_TYPE_SUBMIT_BLOCK); + SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock)); + while (1) { + SSDataBlock* pDataBlock = NULL; + uint64_t ts; + if (qExecTask(task, &pDataBlock, &ts) < 0) { + ASSERT(false); + } + if (pDataBlock == NULL) { + /*pos = fetchOffset % TQ_BUFFER_SIZE;*/ + break; + } + + taosArrayPush(pRes, pDataBlock); + } + + if (taosArrayGetSize(pRes) == 0) { + vDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d skip log %ld since not wanted", consumerId, + pReq->epoch, pTq->pVnode->vgId, fetchOffset); + fetchOffset++; + rspV2.skipLogNum++; + taosArrayDestroy(pRes); + continue; + } + rspV2.rspOffset = fetchOffset; + + int32_t blockSz = taosArrayGetSize(pRes); + int32_t tlen = 0; + for (int32_t i = 0; i < blockSz; i++) { + SSDataBlock* pBlock = taosArrayGet(pRes, i); + tlen += sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); + } + + void* data = taosMemoryMalloc(tlen); + if (data == NULL) { + pMsg->code = -1; + taosMemoryFree(pHead); + } + + rspV2.blockData = data; + + void* dataBlockBuf = data; + int32_t pos; + for (int32_t i = 0; i < blockSz; i++) { + pos = 0; + SSDataBlock* pBlock = taosArrayGet(pRes, i); + blockCompressEncode(pBlock, dataBlockBuf, &pos, pBlock->info.numOfCols, false); + taosArrayPush(rspV2.blockPos, &rspV2.dataLen); + rspV2.dataLen += pos; + dataBlockBuf = POINTER_SHIFT(dataBlockBuf, pos); + } + + int32_t msgLen = sizeof(SMqRspHead) + tEncodeSMqPollRspV2(NULL, &rspV2); + void* buf = rpcMallocCont(msgLen); + + ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP; + ((SMqRspHead*)buf)->epoch = pReq->epoch; + ((SMqRspHead*)buf)->consumerId = consumerId; + + void* msgBodyBuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); + tEncodeSMqPollRspV2(&msgBodyBuf, &rspV2); + + /*rsp.pBlockData = pRes;*/ + + /*taosArrayDestroyEx(rsp.pBlockData, (void (*)(void*))tDeleteSSDataBlock);*/ + pMsg->pCont = buf; + pMsg->contLen = tlen; + pMsg->code = 0; + vDebug("vg %d offset %ld msgType %d from consumer %ld (epoch %d) actual rsp", pTq->pVnode->vgId, fetchOffset, + pHead->msgType, consumerId, pReq->epoch); + tmsgSendRsp(pMsg); + taosMemoryFree(pHead); + return 0; + } else { + taosMemoryFree(pHead); + fetchOffset++; + rspV2.skipLogNum++; + } + } + + /*if (blockingTime != 0) {*/ + /*tqAddClientPusher(pTq->tqPushMgr, pMsg, consumerId, blockingTime);*/ + /*} else {*/ + + rspV2.rspOffset = fetchOffset - 1; + + int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqPollRspV2(NULL, &rspV2); + void* buf = rpcMallocCont(tlen); + if (buf == NULL) { + pMsg->code = -1; + return -1; + } + ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP; + ((SMqRspHead*)buf)->epoch = pReq->epoch; + ((SMqRspHead*)buf)->consumerId = consumerId; + + void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); + tEncodeSMqPollRspV2(&abuf, &rspV2); + pMsg->pCont = buf; + pMsg->contLen = tlen; + pMsg->code = 0; + tmsgSendRsp(pMsg); + vDebug("vg %d offset %ld from consumer %ld (epoch %d) not rsp", pTq->pVnode->vgId, fetchOffset, consumerId, + pReq->epoch); + /*}*/ + + return 0; +} int32_t tqProcessRebReq(STQ* pTq, char* msg) { SMqMVRebReq req = {0}; diff --git a/source/dnode/vnode/src/tsdb/tsdbSma.c b/source/dnode/vnode/src/tsdb/tsdbSma.c index 07b7d6216543b957d517d4833bf51010f487ba66..bfdad836f13ed6c8f07f7581076067622c8a5f81 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSma.c +++ b/source/dnode/vnode/src/tsdb/tsdbSma.c @@ -38,6 +38,29 @@ typedef enum { SMA_STORAGE_LEVEL_DFILESET = 1 // use days of TS data e.g. vnode${N}/tsdb/tsma/sma_index_uid/v2f1906.tsma } ESmaStorageLevel; +typedef struct SPoolMem { + int64_t size; + struct SPoolMem *prev; + struct SPoolMem *next; +} SPoolMem; + +struct SSmaEnv { + TdThreadRwlock lock; + TXN txn; + SPoolMem *pPool; + SDiskID did; + TENV *dbEnv; // TODO: If it's better to put it in smaIndex level? + char *path; // relative path + SSmaStat *pStat; +}; + +#define SMA_ENV_LOCK(env) ((env)->lock) +#define SMA_ENV_DID(env) ((env)->did) +#define SMA_ENV_ENV(env) ((env)->dbEnv) +#define SMA_ENV_PATH(env) ((env)->path) +#define SMA_ENV_STAT(env) ((env)->pStat) +#define SMA_ENV_STAT_ITEMS(env) ((env)->pStat->smaStatItems) + typedef struct { STsdb *pTsdb; SDBFile dFile; @@ -104,7 +127,8 @@ static void tsdbDestroyTSmaWriteH(STSmaWriteH *pSmaH); static int32_t tsdbInitTSmaReadH(STSmaReadH *pSmaH, STsdb *pTsdb, int64_t interval, int8_t intervalUnit); static int32_t tsdbGetSmaStorageLevel(int64_t interval, int8_t intervalUnit); static int32_t tsdbSetRSmaDataFile(STSmaWriteH *pSmaH, int32_t fid); -static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, uint32_t keyLen, void *pData, uint32_t dataLen); +static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyLen, void *pData, int32_t dataLen, + TXN *txn); static int64_t tsdbGetIntervalByPrecision(int64_t interval, uint8_t intervalUnit, int8_t precision, bool adjusted); static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLevel); static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, int64_t indexUid, int32_t fid); @@ -117,9 +141,121 @@ static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, const char *msg); // mgmt interface static int32_t tsdbDropTSmaDataImpl(STsdb *pTsdb, int64_t indexUid); +// Pool Memory +static SPoolMem *openPool(); +static void clearPool(SPoolMem *pPool); +static void closePool(SPoolMem *pPool); +static void *poolMalloc(void *arg, size_t size); +static void poolFree(void *arg, void *ptr); + +static int tsdbSmaBeginCommit(SSmaEnv *pEnv); +static int tsdbSmaEndCommit(SSmaEnv *pEnv); + // implementation -static FORCE_INLINE int16_t tsdbTSmaAdd(STsdb *pTsdb, int16_t n) { return atomic_add_fetch_16(&REPO_TSMA_NUM(pTsdb), n); } -static FORCE_INLINE int16_t tsdbTSmaSub(STsdb *pTsdb, int16_t n) { return atomic_sub_fetch_16(&REPO_TSMA_NUM(pTsdb), n); } +static FORCE_INLINE int16_t tsdbTSmaAdd(STsdb *pTsdb, int16_t n) { + return atomic_add_fetch_16(&REPO_TSMA_NUM(pTsdb), n); +} +static FORCE_INLINE int16_t tsdbTSmaSub(STsdb *pTsdb, int16_t n) { + return atomic_sub_fetch_16(&REPO_TSMA_NUM(pTsdb), n); +} + +static FORCE_INLINE int32_t tsdbRLockSma(SSmaEnv *pEnv) { + int code = taosThreadRwlockRdlock(&(pEnv->lock)); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(code); + return -1; + } + return 0; +} + +static FORCE_INLINE int32_t tsdbWLockSma(SSmaEnv *pEnv) { + int code = taosThreadRwlockWrlock(&(pEnv->lock)); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(code); + return -1; + } + return 0; +} + +static FORCE_INLINE int32_t tsdbUnLockSma(SSmaEnv *pEnv) { + int code = taosThreadRwlockUnlock(&(pEnv->lock)); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(code); + return -1; + } + return 0; +} + +static SPoolMem *openPool() { + SPoolMem *pPool = (SPoolMem *)tdbOsMalloc(sizeof(*pPool)); + + pPool->prev = pPool->next = pPool; + pPool->size = 0; + + return pPool; +} + +static void clearPool(SPoolMem *pPool) { + if (!pPool) return; + + SPoolMem *pMem; + + do { + pMem = pPool->next; + + if (pMem == pPool) break; + + pMem->next->prev = pMem->prev; + pMem->prev->next = pMem->next; + pPool->size -= pMem->size; + + tdbOsFree(pMem); + } while (1); + + assert(pPool->size == 0); +} + +static void closePool(SPoolMem *pPool) { + if (pPool) { + clearPool(pPool); + tdbOsFree(pPool); + } +} + +static void *poolMalloc(void *arg, size_t size) { + void *ptr = NULL; + SPoolMem *pPool = (SPoolMem *)arg; + SPoolMem *pMem; + + pMem = (SPoolMem *)tdbOsMalloc(sizeof(*pMem) + size); + if (pMem == NULL) { + assert(0); + } + + pMem->size = sizeof(*pMem) + size; + pMem->next = pPool->next; + pMem->prev = pPool; + + pPool->next->prev = pMem; + pPool->next = pMem; + pPool->size += pMem->size; + + ptr = (void *)(&pMem[1]); + return ptr; +} + +static void poolFree(void *arg, void *ptr) { + SPoolMem *pPool = (SPoolMem *)arg; + SPoolMem *pMem; + + pMem = &(((SPoolMem *)ptr)[-1]); + + pMem->next->prev = pMem->prev; + pMem->prev->next = pMem->next; + pPool->size -= pMem->size; + + tdbOsFree(pMem); +} int32_t tsdbInitSma(STsdb *pTsdb) { // tSma @@ -213,7 +349,12 @@ static SSmaEnv *tsdbNewSmaEnv(const STsdb *pTsdb, const char *path, SDiskID did) char aname[TSDB_FILENAME_LEN] = {0}; tfsAbsoluteName(pTsdb->pTfs, did, path, aname); - if (tsdbOpenBDBEnv(&pEnv->dbEnv, aname) != TSDB_CODE_SUCCESS) { + if (tsdbOpenDBEnv(&pEnv->dbEnv, aname) != TSDB_CODE_SUCCESS) { + tsdbFreeSmaEnv(pEnv); + return NULL; + } + + if ((pEnv->pPool = openPool()) == NULL) { tsdbFreeSmaEnv(pEnv); return NULL; } @@ -248,7 +389,8 @@ void tsdbDestroySmaEnv(SSmaEnv *pSmaEnv) { taosMemoryFreeClear(pSmaEnv->pStat); taosMemoryFreeClear(pSmaEnv->path); taosThreadRwlockDestroy(&(pSmaEnv->lock)); - tsdbCloseBDBEnv(pSmaEnv->dbEnv); + tsdbCloseDBEnv(pSmaEnv->dbEnv); + closePool(pSmaEnv->pPool); } } @@ -414,7 +556,7 @@ static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t } // cache smaMeta - STSma *pSma = metaGetSmaInfoByIndex(pTsdb->pMeta, indexUid); + STSma *pSma = metaGetSmaInfoByIndex(pTsdb->pMeta, indexUid, true); if (pSma == NULL) { terrno = TSDB_CODE_TDB_NO_SMA_INDEX_IN_META; taosHashCleanup(pItem->expiredWindows); @@ -498,10 +640,6 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg) { return TSDB_CODE_FAILED; } -#ifndef TSDB_SMA_TEST - TSKEY expiredWindows[SMA_TEST_EXPIRED_WINDOW_SIZE]; -#endif - // Firstly, assume that tSma can only be created on super table/normal table. // getActiveTimeWindow @@ -563,6 +701,10 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg) { TSKEY winSKey = taosTimeTruncate(TD_ROW_KEY(row), &interval, interval.precision); tsdbSetExpiredWindow(pTsdb, pItemsHash, pTSma->indexUid, winSKey); + + // TODO: release only when suid changes. + tdDestroyTSmaWrapper(pSW); + taosMemoryFreeClear(pSW); } } @@ -676,10 +818,12 @@ static int32_t tsdbGetSmaStorageLevel(int64_t interval, int8_t intervalUnit) { * @param dataLen * @return int32_t */ -static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, uint32_t keyLen, void *pData, uint32_t dataLen) { +static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyLen, void *pData, int32_t dataLen, + TXN *txn) { SDBFile *pDBFile = &pSmaH->dFile; + // TODO: insert sma data blocks into B+Tree(TDB) - if (tsdbSaveSmaToDB(pDBFile, smaKey, keyLen, pData, dataLen) != 0) { + if (tsdbSaveSmaToDB(pDBFile, smaKey, keyLen, pData, dataLen, txn) != 0) { tsdbWarn("vgId:%d insert sma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 " fail", REPO_ID(pSmaH->pTsdb), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen); return TSDB_CODE_FAILED; @@ -826,6 +970,30 @@ static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLe return daysPerFile; } +static int tsdbSmaBeginCommit(SSmaEnv *pEnv) { + TXN *pTxn = &pEnv->txn; + // start a new txn + tdbTxnOpen(pTxn, 0, poolMalloc, poolFree, pEnv->pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + if (tdbBegin(pEnv->dbEnv, pTxn) != 0) { + tsdbWarn("tsdbSma tdb restart txn fail"); + return -1; + } + return 0; +} + +static int tsdbSmaEndCommit(SSmaEnv *pEnv) { + TXN *pTxn = &pEnv->txn; + + // Commit current txn + if (tdbCommit(pEnv->dbEnv, pTxn) != 0) { + tsdbWarn("tsdbSma tdb commit fail"); + return -1; + } + tdbTxnClose(pTxn); + clearPool(pEnv->pPool); + return 0; +} + /** * @brief Insert/Update Time-range-wise SMA data. * - If interval < SMA_STORAGE_SPLIT_HOURS(e.g. 24), save the SMA data as a part of DFileSet to e.g. @@ -911,14 +1079,10 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char int64_t groupId = pDataBlock->info.groupId; for (int32_t j = 0; j < rows; ++j) { printf("|"); - TSKEY skey = 1649295200000; // TSKEY_INITIAL_VAL; // the start key of TS window by interval + TSKEY skey = TSKEY_INITIAL_VAL; // the start key of TS window by interval void *pSmaKey = &smaKey; bool isStartKey = false; - { - // just for debugging - isStartKey = true; - tsdbEncodeTSmaKey(groupId, skey, &pSmaKey); - } + int32_t tlen = 0; // reset the len pDataBuf = &dataBuf; // reset the buf for (int32_t k = 0; k < colNum; ++k) { @@ -929,7 +1093,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char if (!isStartKey) { isStartKey = true; skey = *(TSKEY *)var; - printf("==> skey = %" PRIi64 " groupId = %" PRIi64 "|", skey, groupId); + printf("= skey %" PRIi64 " groupId = %" PRIi64 "|", skey, groupId); tsdbEncodeTSmaKey(groupId, skey, &pSmaKey); } else { printf(" %" PRIi64 " |", *(int64_t *)var); @@ -1010,6 +1174,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char // TODO: tsdbStartTSmaCommit(); if (fid != tSmaH.dFile.fid) { if (tSmaH.dFile.fid != TSDB_IVLD_FID) { + tsdbSmaEndCommit(pEnv); tsdbCloseDBF(&tSmaH.dFile); } tsdbSetTSmaDataFile(&tSmaH, indexUid, fid); @@ -1020,12 +1185,14 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char tsdbUnRefSmaStat(pTsdb, pStat); return TSDB_CODE_FAILED; } + tsdbSmaBeginCommit(pEnv); } - if (tsdbInsertTSmaBlocks(&tSmaH, &smaKey, SMA_KEY_LEN, dataBuf, tlen) != 0) { + if (tsdbInsertTSmaBlocks(&tSmaH, &smaKey, SMA_KEY_LEN, dataBuf, tlen, &pEnv->txn) != 0) { tsdbWarn("vgId:%d insert tSma data blocks fail for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64 " since %s", REPO_ID(pTsdb), indexUid, skey, groupId, tstrerror(terrno)); + tsdbSmaEndCommit(pEnv); tsdbDestroyTSmaWriteH(&tSmaH); tsdbUnRefSmaStat(pTsdb, pStat); return TSDB_CODE_FAILED; @@ -1044,9 +1211,10 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char printf("\n"); } } - + tsdbSmaEndCommit(pEnv); // TODO: not commit for every insert tsdbDestroyTSmaWriteH(&tSmaH); tsdbUnRefSmaStat(pTsdb, pStat); + return TSDB_CODE_SUCCESS; } @@ -1370,8 +1538,8 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, tsdbDebug("vgId:%d get sma data from %s: smaKey %" PRIx64 "-%" PRIx64 ", keyLen %d", REPO_ID(pTsdb), tReadH.dFile.path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), SMA_KEY_LEN); - void *result = NULL; - uint32_t valueSize = 0; + void *result = NULL; + int32_t valueSize = 0; if ((result = tsdbGetSmaDataByKey(&tReadH.dFile, smaKey, SMA_KEY_LEN, &valueSize)) == NULL) { tsdbWarn("vgId:%d get sma data failed from smaIndex %" PRIi64 ", smaKey %" PRIx64 "-%" PRIx64 " since %s", REPO_ID(pTsdb), indexUid, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), tstrerror(terrno)); @@ -1422,7 +1590,7 @@ int32_t tsdbCreateTSma(STsdb *pTsdb, char *pMsg) { return -1; } tsdbDebug("vgId:%d TDMT_VND_CREATE_SMA msg received for %s:%" PRIi64, REPO_ID(pTsdb), vCreateSmaReq.tSma.indexName, - vCreateSmaReq.tSma.indexUid); + vCreateSmaReq.tSma.indexUid); // record current timezone of server side vCreateSmaReq.tSma.timezoneInt = tsTimezone; @@ -1464,7 +1632,7 @@ int32_t tsdbDropTSma(STsdb *pTsdb, char *pMsg) { return -1; } - tsdbTSmaSub(pTsdb, 1); + tsdbTSmaSub(pTsdb, 1); // TODO: return directly or go on follow steps? return TSDB_CODE_SUCCESS; diff --git a/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c b/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c new file mode 100644 index 0000000000000000000000000000000000000000..519ecd3fa06952609c522f4ef937b8b953bc1948 --- /dev/null +++ b/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c @@ -0,0 +1,137 @@ +/* + * 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 . + */ + +#define ALLOW_FORBID_FUNC + +#include "vnodeInt.h" + +int32_t tsdbOpenDBEnv(TENV **ppEnv, const char *path) { + int ret = 0; + + if (path == NULL) return -1; + + ret = tdbEnvOpen(path, 4096, 256, ppEnv); // use as param + + if (ret != 0) { + tsdbError("Failed to create tsdb db env, ret = %d", ret); + return -1; + } + + return 0; +} + +int32_t tsdbCloseDBEnv(TENV *pEnv) { return tdbEnvClose(pEnv); } + +static inline int tsdbSmaKeyCmpr(const void *arg1, int len1, const void *arg2, int len2) { + const SSmaKey *pKey1 = (const SSmaKey *)arg1; + const SSmaKey *pKey2 = (const SSmaKey *)arg2; + + ASSERT(len1 == len2 && len1 == sizeof(SSmaKey)); + + if (pKey1->skey < pKey2->skey) { + return -1; + } else if (pKey1->skey > pKey2->skey) { + return 1; + } + if (pKey1->groupId < pKey2->groupId) { + return -1; + } else if (pKey1->groupId > pKey2->groupId) { + return 1; + } + + return 0; +} + +static int32_t tsdbOpenDBDb(TDB **ppDB, TENV *pEnv, const char *pFName) { + int ret; + FKeyComparator compFunc; + + // Create a database + compFunc = tsdbSmaKeyCmpr; + ret = tdbDbOpen(pFName, TDB_VARIANT_LEN, TDB_VARIANT_LEN, compFunc, pEnv, ppDB); + + return 0; +} + +static int32_t tsdbCloseDBDb(TDB *pDB) { return tdbDbClose(pDB); } + +int32_t tsdbOpenDBF(TENV *pEnv, SDBFile *pDBF) { + // TEnv is shared by a group of SDBFile + if (!pEnv || !pDBF) { + terrno = TSDB_CODE_INVALID_PTR; + return -1; + } + + // Open DBF + if (tsdbOpenDBDb(&(pDBF->pDB), pEnv, pDBF->path) < 0) { + terrno = TSDB_CODE_TDB_INIT_FAILED; + tsdbCloseDBDb(pDBF->pDB); + return -1; + } + + return 0; +} + +int32_t tsdbCloseDBF(SDBFile *pDBF) { + int32_t ret = 0; + if (pDBF->pDB) { + ret = tsdbCloseDBDb(pDBF->pDB); + pDBF->pDB = NULL; + } + taosMemoryFreeClear(pDBF->path); + return ret; +} + +int32_t tsdbSaveSmaToDB(SDBFile *pDBF, void *pKey, int32_t keyLen, void *pVal, int32_t valLen, TXN *txn) { + int32_t ret; + + ret = tdbDbInsert(pDBF->pDB, pKey, keyLen, pVal, valLen, txn); + if (ret < 0) { + tsdbError("Failed to create insert sma data into db, ret = %d", ret); + return -1; + } + + return 0; +} + +void *tsdbGetSmaDataByKey(SDBFile *pDBF, const void *pKey, int32_t keyLen, int32_t *valLen) { + void *result; + void *pVal; + int ret; + + ret = tdbDbGet(pDBF->pDB, pKey, keyLen, &pVal, valLen); + + if (ret < 0) { + tsdbError("Failed to get sma data from db, ret = %d", ret); + return NULL; + } + + ASSERT(*valLen >= 0); + + result = taosMemoryMalloc(*valLen); + + if (result == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + // TODO: lock? + // TODO: Would the key/value be destoryed during return the data? + // TODO: How about the key is updated while value length is changed? The original value buffer would be freed + // automatically? + memcpy(result, pVal, *valLen); + + return result; +} \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index bf2260c51cbaff653f12468745efa8a9206e69f4..0449319dc26f0bafdba44ba535ec747549c17ec8 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -19,7 +19,7 @@ void smaHandleRes(void *pVnode, int64_t smaId, const SArray *data) { // TODO // blockDebugShowData(data); - // tsdbInsertTSmaData(((SVnode *)pVnode)->pTsdb, smaId, (const char *)data); + tsdbInsertTSmaData(((SVnode *)pVnode)->pTsdb, smaId, (const char *)data); } void vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) { @@ -232,9 +232,9 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { tdDestroyTSma(&vCreateSmaReq.tSma); // TODO: return directly or go on follow steps? #endif - // if (tsdbCreateTSma(pVnode->pTsdb, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { - // // TODO - // } + if (tsdbCreateTSma(pVnode->pTsdb, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { + // TODO + } // } break; // case TDMT_VND_CANCEL_SMA: { // timeRangeSMA // } break; diff --git a/source/dnode/vnode/test/tsdbSmaTest.cpp b/source/dnode/vnode/test/tsdbSmaTest.cpp index 6a4adfe4f8e33dfdc0f2c421af28beed783442f1..da874716f2c7b6e8e25712af6cb01121a693758c 100644 --- a/source/dnode/vnode/test/tsdbSmaTest.cpp +++ b/source/dnode/vnode/test/tsdbSmaTest.cpp @@ -210,7 +210,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { // get value by indexName STSma *qSmaCfg = NULL; - qSmaCfg = metaGetSmaInfoByIndex(pMeta, indexUid1); + qSmaCfg = metaGetSmaInfoByIndex(pMeta, indexUid1, true); assert(qSmaCfg != NULL); printf("name1 = %s\n", qSmaCfg->indexName); printf("timezone1 = %" PRIi8 "\n", qSmaCfg->timezoneInt); @@ -221,7 +221,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { tdDestroyTSma(qSmaCfg); taosMemoryFreeClear(qSmaCfg); - qSmaCfg = metaGetSmaInfoByIndex(pMeta, indexUid2); + qSmaCfg = metaGetSmaInfoByIndex(pMeta, indexUid2, true); assert(qSmaCfg != NULL); printf("name2 = %s\n", qSmaCfg->indexName); printf("timezone2 = %" PRIi8 "\n", qSmaCfg->timezoneInt); @@ -233,11 +233,12 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { taosMemoryFreeClear(qSmaCfg); // get index name by table uid +#if 0 SMSmaCursor *pSmaCur = metaOpenSmaCursor(pMeta, tbUid); assert(pSmaCur != NULL); uint32_t indexCnt = 0; while (1) { - const char *indexName = metaSmaCursorNext(pSmaCur); + const char *indexName = (const char *)metaSmaCursorNext(pSmaCur); if (indexName == NULL) { break; } @@ -245,8 +246,8 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { ++indexCnt; } EXPECT_EQ(indexCnt, nCntTSma); - metaCloseSmaCurosr(pSmaCur); - + metaCloseSmaCursor(pSmaCur); +#endif // get wrapper by table uid STSmaWrapper *pSW = metaGetSmaInfoByTable(pMeta, tbUid); assert(pSW != NULL); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index b85579e781e8844b9773711a47734fd2a32cc0d0..e897bc8892e594368cc8a1b1d9a0f33d91f03c46 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -92,7 +92,7 @@ static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput, return false; } - pBuf->allocSize = sizeof(SRetrieveTableRsp) + blockDataGetSerialMetaSize(pInput->pData) + blockDataGetSize(pInput->pData); + pBuf->allocSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pInput->pData); pBuf->pData = taosMemoryMalloc(pBuf->allocSize); if (pBuf->pData == NULL) { diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index ab5a02c438ba7975a73718e15fa34b7c477dd67d..624a2953c935997c5c35708a21dbe223c29db62a 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -22,7 +22,7 @@ extern "C" { #include "functionMgt.h" -#define FUNCTION_NAME_MAX_LENGTH 16 +#define FUNCTION_NAME_MAX_LENGTH 32 #define FUNC_MGT_FUNC_CLASSIFICATION_MASK(n) (1 << n) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 4e877250144780236e86d4a41baf6101b5e0480d..27067fc966288943aaf074f38ecf27a71b1a5be3 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -393,6 +393,46 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .sprocessFunc = castFunction, .finalizeFunc = NULL }, + { + .name = "to_iso8601", + .type = FUNCTION_TYPE_TO_ISO8601, + .classification = FUNC_MGT_SCALAR_FUNC, + .checkFunc = checkAndGetResultType, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = toISO8601Function, + .finalizeFunc = NULL + }, + { + .name = "to_unixtimestamp", + .type = FUNCTION_TYPE_TO_UNIXTIMESTAMP, + .classification = FUNC_MGT_SCALAR_FUNC, + .checkFunc = checkAndGetResultType, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = toUnixtimestampFunction, + .finalizeFunc = NULL + }, + { + .name = "timetruncate", + .type = FUNCTION_TYPE_TIMETRUNCATE, + .classification = FUNC_MGT_SCALAR_FUNC, + .checkFunc = checkAndGetResultType, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = timeTruncateFunction, + .finalizeFunc = NULL + }, + { + .name = "timediff", + .type = FUNCTION_TYPE_TIMEDIFF, + .classification = FUNC_MGT_SCALAR_FUNC, + .checkFunc = checkAndGetResultType, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = timeDiffFunction, + .finalizeFunc = NULL + }, { .name = "_rowts", .type = FUNCTION_TYPE_ROWTS, @@ -609,6 +649,22 @@ int32_t checkAndGetResultType(SFunctionNode* pFunc) { pFunc->node.resType = (SDataType) { .bytes = paraBytes, .type = paraType}; break; } + case FUNCTION_TYPE_TO_ISO8601: { + pFunc->node.resType = (SDataType) { .bytes = 64, .type = TSDB_DATA_TYPE_BINARY}; + break; + } + case FUNCTION_TYPE_TO_UNIXTIMESTAMP: { + pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + break; + } + case FUNCTION_TYPE_TIMETRUNCATE: { + pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; + break; + } + case FUNCTION_TYPE_TIMEDIFF: { + pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + break; + } case FUNCTION_TYPE_TBNAME: { // todo diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index fe3b7cb8a092476d502fee707bdee3bd76925c0f..975036575de0a57ac3e038812599a3308e9df940 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -95,7 +95,6 @@ static void dataTypeCopy(const SDataType* pSrc, SDataType* pDst) { static void exprNodeCopy(const SExprNode* pSrc, SExprNode* pDst) { dataTypeCopy(&pSrc->resType, &pDst->resType); COPY_CHAR_ARRAY_FIELD(aliasName); - // CLONE_NODE_LIST_FIELD(pAssociationList); } static SNode* columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) { @@ -222,15 +221,19 @@ static SVgroupsInfo* vgroupsInfoClone(const SVgroupsInfo* pSrc) { } static SNode* logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) { + COPY_ALL_SCALAR_FIELDS; COPY_BASE_OBJECT_FIELD(node, logicNodeCopy); CLONE_NODE_LIST_FIELD(pScanCols); CLONE_OBJECT_FIELD(pMeta, tableMetaClone); CLONE_OBJECT_FIELD(pVgroupList, vgroupsInfoClone); - COPY_SCALAR_FIELD(scanType); - COPY_SCALAR_FIELD(scanFlag); - COPY_SCALAR_FIELD(scanRange); - COPY_SCALAR_FIELD(tableName); - COPY_SCALAR_FIELD(showRewrite); + CLONE_NODE_LIST_FIELD(pDynamicScanFuncs); + return (SNode*)pDst; +} + +static SNode* logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) { + COPY_ALL_SCALAR_FIELDS; + COPY_BASE_OBJECT_FIELD(node, logicNodeCopy); + CLONE_NODE_FIELD(pOnConditions); return (SNode*)pDst; } @@ -263,15 +266,8 @@ static SNode* logicExchangeCopy(const SExchangeLogicNode* pSrc, SExchangeLogicNo static SNode* logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* pDst) { COPY_ALL_SCALAR_FIELDS; COPY_BASE_OBJECT_FIELD(node, logicNodeCopy); - // COPY_SCALAR_FIELD(winType); CLONE_NODE_LIST_FIELD(pFuncs); - // COPY_SCALAR_FIELD(interval); - // COPY_SCALAR_FIELD(offset); - // COPY_SCALAR_FIELD(sliding); - // COPY_SCALAR_FIELD(intervalUnit); - // COPY_SCALAR_FIELD(slidingUnit); CLONE_NODE_FIELD(pFill); - // COPY_SCALAR_FIELD(sessionGap); CLONE_NODE_FIELD(pTspk); return (SNode*)pDst; } @@ -360,6 +356,8 @@ SNodeptr nodesCloneNode(const SNodeptr pNode) { return downstreamSourceCopy((const SDownstreamSourceNode*)pNode, (SDownstreamSourceNode*)pDst); case QUERY_NODE_LOGIC_PLAN_SCAN: return logicScanCopy((const SScanLogicNode*)pNode, (SScanLogicNode*)pDst); + case QUERY_NODE_LOGIC_PLAN_JOIN: + return logicJoinCopy((const SJoinLogicNode*)pNode, (SJoinLogicNode*)pDst); case QUERY_NODE_LOGIC_PLAN_AGG: return logicAggCopy((const SAggLogicNode*)pNode, (SAggLogicNode*)pDst); case QUERY_NODE_LOGIC_PLAN_PROJECT: diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index e459f0463491e8a8b4220c9786cad383584707e7..1c565ddd37b9c4142121cea55c8f94f595a1b0ac 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -158,6 +158,16 @@ SNodeptr nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_FUNCTIONS_STMT: case QUERY_NODE_SHOW_INDEXES_STMT: case QUERY_NODE_SHOW_STREAMS_STMT: + case QUERY_NODE_SHOW_APPS_STMT: + case QUERY_NODE_SHOW_CONNECTIONS_STMT: + case QUERY_NODE_SHOW_LICENCE_STMT: + case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: + case QUERY_NODE_SHOW_CREATE_TABLE_STMT: + case QUERY_NODE_SHOW_CREATE_STABLE_STMT: + case QUERY_NODE_SHOW_QUERIES_STMT: + case QUERY_NODE_SHOW_SCORES_STMT: + case QUERY_NODE_SHOW_TOPICS_STMT: + case QUERY_NODE_SHOW_VARIABLE_STMT: case QUERY_NODE_SHOW_BNODES_STMT: case QUERY_NODE_SHOW_SNODES_STMT: return makeNode(type, sizeof(SShowStmt)); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 18bea4736c9c2ca253a8db4e64618fa9761b8d8f..94aec0e744db52a35b730d9378ed3490992e642a 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -79,13 +79,13 @@ alter_account_option ::= USERS literal. alter_account_option ::= CONNS literal. { } alter_account_option ::= STATE literal. { } -/************************************************ create/alter/drop/show user *****************************************/ +/************************************************ create/alter/drop user **********************************************/ cmd ::= CREATE USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B); } cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B); } cmd ::= ALTER USER user_name(A) PRIVILEGE NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PRIVILEGES, &B); } cmd ::= DROP USER user_name(A). { pCxt->pRootNode = createDropUserStmt(pCxt, &A); } -/************************************************ create/drop/alter/show dnode ****************************************/ +/************************************************ create/drop/alter dnode *********************************************/ cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); } cmd ::= CREATE DNODE dnode_host_name(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B); } cmd ::= DROP DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A); } @@ -124,7 +124,7 @@ cmd ::= DROP SNODE ON DNODE NK_INTEGER(A). cmd ::= CREATE MNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &A); } cmd ::= DROP MNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &A); } -/************************************************ create/drop/show/use database ***************************************/ +/************************************************ create/drop/use database ********************************************/ cmd ::= CREATE DATABASE not_exists_opt(A) db_name(B) db_options(C). { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C); } cmd ::= DROP DATABASE exists_opt(A) db_name(B). { pCxt->pRootNode = createDropDatabaseStmt(pCxt, A, &B); } cmd ::= USE db_name(A). { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &A); } @@ -332,6 +332,7 @@ cmd ::= SHOW ACCOUNTS. cmd ::= SHOW APPS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } cmd ::= SHOW CONNECTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } cmd ::= SHOW LICENCE. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } +cmd ::= SHOW GRANTS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } cmd ::= SHOW CREATE DATABASE db_name(A). { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &A); } cmd ::= SHOW CREATE TABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, A); } cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, A); } diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index c31ec92bdeb3986df3314e9c99d4559cc043e4ce..ead3ec90ad3e1394afaf27a241e543c0db7759e2 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -143,7 +143,7 @@ static int32_t rewriteConditionForFromTable(SCalcConstContext* pCxt, SNode* pTab if (TSDB_CODE_SUCCESS == pCxt->code) { pCxt->code = rewriteConditionForFromTable(pCxt, pJoin->pRight); } - if (TSDB_CODE_SUCCESS == pCxt->code) { + if (TSDB_CODE_SUCCESS == pCxt->code && NULL != pJoin->pOnCond) { pCxt->code = rewriteCondition(pCxt, &pJoin->pOnCond); } } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index daeb98b3e61024a9c8f393850e6700c827431bc7..5c2f10f810df14ae078c31f3f01734d2faa1c44d 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -80,6 +80,7 @@ static SKeyword keywordTable[] = { {"FSYNC", TK_FSYNC}, {"FUNCTION", TK_FUNCTION}, {"FUNCTIONS", TK_FUNCTIONS}, + {"GRANTS", TK_GRANTS}, {"GROUP", TK_GROUP}, {"HAVING", TK_HAVING}, {"IF", TK_IF}, @@ -131,10 +132,10 @@ static SKeyword keywordTable[] = { {"PRECISION", TK_PRECISION}, {"PRIVILEGE", TK_PRIVILEGE}, {"PREV", TK_PREV}, - {"_QENDTS", TK_QENDTS}, + {"_QENDTS", TK_QENDTS}, {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, - {"_QSTARTTS", TK_QSTARTTS}, + {"_QSTARTTS", TK_QSTARTTS}, {"QTIME", TK_QTIME}, {"QUERIES", TK_QUERIES}, {"QUERY", TK_QUERY}, @@ -144,7 +145,7 @@ static SKeyword keywordTable[] = { {"RESET", TK_RESET}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, - {"_ROWTS", TK_ROWTS}, + {"_ROWTS", TK_ROWTS}, {"SCORES", TK_SCORES}, {"SELECT", TK_SELECT}, {"SESSION", TK_SESSION}, @@ -163,7 +164,7 @@ static SKeyword keywordTable[] = { {"STATE", TK_STATE}, {"STATE_WINDOW", TK_STATE_WINDOW}, {"STORAGE", TK_STORAGE}, - {"STREAM", TK_STREAM}, + {"STREAM", TK_STREAM}, {"STREAMS", TK_STREAMS}, {"STREAM_MODE", TK_STREAM_MODE}, {"SYNCDB", TK_SYNCDB}, @@ -192,8 +193,8 @@ static SKeyword keywordTable[] = { {"VGROUPS", TK_VGROUPS}, {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, - {"_WDURATION", TK_WDURATION}, - {"_WENDTS", TK_WENDTS}, + {"_WDURATION", TK_WDURATION}, + {"_WENDTS", TK_WENDTS}, {"WHERE", TK_WHERE}, {"_WSTARTTS", TK_WSTARTTS}, // {"ID", TK_ID}, @@ -221,7 +222,6 @@ static SKeyword keywordTable[] = { // {"UMINUS", TK_UMINUS}, // {"UPLUS", TK_UPLUS}, // {"BITNOT", TK_BITNOT}, - // {"GRANTS", TK_GRANTS}, // {"DOT", TK_DOT}, // {"CTIME", TK_CTIME}, // {"LP", TK_LP}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index acf465bfa56006374a6b52b55c099efc2481fbd9..b3947b872e2afa5dffecb40150213310abd7804a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -762,7 +762,7 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) { size_t nums = taosArrayGetSize(pTables); for (size_t i = 0; i < nums; ++i) { STableNode* pTable = taosArrayGetP(pTables, i); - int32_t code = createColumnNodeByTable(pCxt, pTable, *pCols); + int32_t code = createColumnNodeByTable(pCxt, pTable, *pCols); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -829,11 +829,39 @@ static int32_t createFirstLastAllCols(STranslateContext* pCxt, SFunctionNode* pS return TSDB_CODE_SUCCESS; } +static bool isTableStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { + *pOutput = nodesMakeList(); + if (NULL == *pOutput) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); + } + bool foundTable = false; + SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel); + size_t nums = taosArrayGetSize(pTables); + for (size_t i = 0; i < nums; ++i) { + STableNode* pTable = taosArrayGetP(pTables, i); + if (0 == strcmp(pTable->tableAlias, pCol->tableAlias)) { + int32_t code = createColumnNodeByTable(pCxt, pTable, *pOutput); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + foundTable = true; + break; + } + } + if (!foundTable) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pCol->tableAlias); + } + return TSDB_CODE_SUCCESS; +} + static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pProjectionList) { // select * ... return createAllColumns(pCxt, &pSelect->pProjectionList); } else { - // todo : t.* SNode* pNode = NULL; WHERE_EACH(pNode, pSelect->pProjectionList) { if (isFirstLastStar(pNode)) { @@ -844,6 +872,14 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { INSERT_LIST(pSelect->pProjectionList, pFuncs); ERASE_NODE(pSelect->pProjectionList); continue; + } else if (isTableStar(pNode)) { + SNodeList* pCols = NULL; + if (TSDB_CODE_SUCCESS != createTableAllCols(pCxt, (SColumnNode*)pNode, &pCols)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + INSERT_LIST(pSelect->pProjectionList, pCols); + ERASE_NODE(pSelect->pProjectionList); + continue; } WHERE_NEXT; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a8f764f0e166a158a7590afde11570025026b2f6..610f6b92633ee44af1da5119bb732b8363d820c6 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -100,24 +100,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 313 +#define YYNOCODE 314 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SToken yy21; - bool yy173; - EOrder yy256; - EFillMode yy268; - SDataType yy288; - SAlterOption yy289; - EJoinType yy440; - EOperatorType yy468; - SNodeList* yy476; - ENullOrder yy525; - SNode* yy564; - int32_t yy620; + ENullOrder yy69; + SNode* yy140; + EFillMode yy174; + SAlterOption yy181; + SNodeList* yy220; + EJoinType yy224; + EOrder yy238; + SToken yy253; + bool yy273; + SDataType yy368; + EOperatorType yy480; + int32_t yy528; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,18 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 547 -#define YYNRULE 409 -#define YYNRULE_WITH_ACTION 409 -#define YYNTOKEN 207 -#define YY_MAX_SHIFT 546 -#define YY_MIN_SHIFTREDUCE 806 -#define YY_MAX_SHIFTREDUCE 1214 -#define YY_ERROR_ACTION 1215 -#define YY_ACCEPT_ACTION 1216 -#define YY_NO_ACTION 1217 -#define YY_MIN_REDUCE 1218 -#define YY_MAX_REDUCE 1626 +#define YYNSTATE 548 +#define YYNRULE 410 +#define YYNTOKEN 208 +#define YY_MAX_SHIFT 547 +#define YY_MIN_SHIFTREDUCE 807 +#define YY_MAX_SHIFTREDUCE 1216 +#define YY_ERROR_ACTION 1217 +#define YY_ACCEPT_ACTION 1218 +#define YY_NO_ACTION 1219 +#define YY_MIN_REDUCE 1220 +#define YY_MAX_REDUCE 1629 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -210,481 +209,483 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1529) +#define YY_ACTTAB_COUNT (1533) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 25, 194, 1478, 1327, 257, 449, 1494, 462, 269, 312, - /* 10 */ 277, 1427, 30, 28, 1474, 1481, 310, 1418, 1420, 1454, - /* 20 */ 266, 1478, 1050, 274, 429, 32, 31, 29, 27, 26, - /* 30 */ 1511, 21, 1338, 1474, 1480, 306, 461, 445, 1048, 238, - /* 40 */ 1478, 32, 31, 29, 27, 26, 1072, 448, 23, 100, - /* 50 */ 11, 1465, 1474, 1480, 1494, 289, 433, 1055, 32, 31, - /* 60 */ 29, 27, 26, 30, 28, 1157, 1605, 228, 1495, 1496, - /* 70 */ 1500, 266, 216, 1050, 1, 1368, 30, 28, 1511, 131, - /* 80 */ 1558, 137, 98, 1603, 266, 445, 1050, 1605, 1171, 1048, - /* 90 */ 52, 431, 127, 1551, 1552, 448, 1556, 543, 1555, 1465, - /* 100 */ 131, 11, 1048, 96, 1603, 1073, 1216, 50, 1055, 1049, - /* 110 */ 49, 1333, 380, 379, 11, 70, 1495, 1496, 1500, 1544, - /* 120 */ 461, 1055, 347, 1543, 1540, 1, 1219, 932, 485, 484, - /* 130 */ 483, 936, 482, 938, 939, 481, 941, 478, 1, 947, - /* 140 */ 475, 949, 950, 472, 469, 1051, 488, 84, 543, 1329, - /* 150 */ 83, 82, 81, 80, 79, 78, 77, 76, 75, 282, - /* 160 */ 1049, 543, 1054, 1074, 1075, 1101, 1102, 1103, 1104, 1105, - /* 170 */ 1106, 1107, 1108, 1049, 12, 1050, 462, 1070, 164, 30, - /* 180 */ 28, 117, 371, 1230, 132, 311, 382, 266, 376, 1050, - /* 190 */ 1605, 1048, 381, 405, 1465, 97, 1051, 377, 375, 157, - /* 200 */ 378, 1338, 155, 131, 373, 1048, 305, 1603, 304, 1051, - /* 210 */ 1055, 396, 461, 1054, 1074, 1075, 1101, 1102, 1103, 1104, - /* 220 */ 1105, 1106, 1107, 1108, 1055, 419, 1054, 1074, 1075, 1101, - /* 230 */ 1102, 1103, 1104, 1105, 1106, 1107, 1108, 406, 462, 1181, - /* 240 */ 132, 7, 1605, 30, 28, 447, 132, 72, 1074, 1075, - /* 250 */ 543, 266, 462, 1050, 368, 131, 894, 30, 28, 1603, - /* 260 */ 1076, 319, 1049, 1338, 543, 266, 12, 1050, 1605, 1048, - /* 270 */ 416, 1179, 1180, 1182, 1183, 896, 1049, 1338, 52, 424, - /* 280 */ 420, 131, 1494, 1048, 132, 1603, 84, 1605, 1055, 83, - /* 290 */ 82, 81, 80, 79, 78, 77, 76, 75, 1051, 1334, - /* 300 */ 1604, 333, 1055, 65, 1603, 7, 1511, 32, 31, 29, - /* 310 */ 27, 26, 1051, 445, 1511, 1054, 118, 101, 1241, 7, - /* 320 */ 1296, 445, 423, 448, 1330, 1494, 1316, 1465, 543, 1054, - /* 330 */ 1074, 1075, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, - /* 340 */ 1049, 132, 543, 119, 1495, 1496, 1500, 141, 140, 1511, - /* 350 */ 237, 132, 1070, 422, 1049, 462, 445, 122, 497, 326, - /* 360 */ 462, 1558, 338, 1465, 320, 1071, 448, 429, 1378, 346, - /* 370 */ 1465, 339, 1385, 265, 1240, 347, 1051, 189, 256, 1554, - /* 380 */ 1338, 434, 1618, 1383, 59, 1338, 229, 1495, 1496, 1500, - /* 390 */ 1051, 499, 100, 1054, 1074, 1075, 1101, 1102, 1103, 1104, - /* 400 */ 1105, 1106, 1107, 1108, 843, 1331, 842, 1054, 1074, 1075, - /* 410 */ 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 462, 1465, - /* 420 */ 30, 28, 1385, 1385, 844, 98, 1239, 1335, 266, 271, - /* 430 */ 1050, 1267, 114, 1419, 1383, 128, 1551, 1552, 1415, 1556, - /* 440 */ 29, 27, 26, 1338, 337, 139, 1048, 332, 331, 330, - /* 450 */ 329, 328, 1485, 325, 324, 323, 322, 318, 317, 316, - /* 460 */ 315, 314, 313, 462, 1483, 1055, 32, 31, 29, 27, - /* 470 */ 26, 1465, 459, 539, 538, 32, 31, 29, 27, 26, - /* 480 */ 250, 1323, 1, 519, 518, 517, 516, 281, 1338, 515, - /* 490 */ 514, 513, 102, 508, 507, 506, 505, 504, 503, 502, - /* 500 */ 501, 108, 1494, 462, 241, 543, 164, 511, 115, 462, - /* 510 */ 371, 300, 72, 241, 449, 270, 1341, 1049, 460, 374, - /* 520 */ 1428, 1325, 251, 115, 249, 248, 1511, 370, 1338, 1089, - /* 530 */ 1218, 1340, 373, 445, 1338, 842, 276, 1120, 32, 31, - /* 540 */ 29, 27, 26, 448, 115, 404, 1120, 1465, 9, 8, - /* 550 */ 1558, 366, 1340, 1051, 93, 92, 91, 90, 89, 88, - /* 560 */ 87, 86, 85, 225, 1495, 1496, 1500, 1314, 1553, 1122, - /* 570 */ 1054, 1074, 1075, 1101, 1102, 1103, 1104, 1105, 1106, 1107, - /* 580 */ 1108, 387, 1164, 279, 462, 1121, 1385, 1126, 1072, 462, - /* 590 */ 116, 115, 278, 208, 1121, 222, 395, 1383, 280, 1340, - /* 600 */ 1238, 1089, 868, 1125, 1237, 6, 1236, 220, 1270, 1338, - /* 610 */ 166, 22, 1125, 390, 1338, 1385, 497, 500, 384, 1310, - /* 620 */ 142, 869, 1133, 1494, 165, 1235, 1384, 24, 264, 1115, - /* 630 */ 1116, 1117, 1118, 1119, 1123, 1124, 24, 264, 1115, 1116, - /* 640 */ 1117, 1118, 1119, 1123, 1124, 1465, 1077, 1511, 1156, 1465, - /* 650 */ 42, 1465, 1234, 41, 445, 32, 31, 29, 27, 26, - /* 660 */ 382, 1233, 376, 106, 448, 1321, 381, 408, 1465, 97, - /* 670 */ 1465, 377, 375, 433, 378, 512, 510, 1494, 1232, 1229, - /* 680 */ 1228, 1227, 436, 67, 68, 1495, 1496, 1500, 1544, 1226, - /* 690 */ 273, 272, 240, 1540, 394, 9, 8, 1465, 1225, 1224, - /* 700 */ 1063, 1511, 1563, 1152, 1605, 1223, 1465, 392, 432, 1222, - /* 710 */ 48, 47, 309, 1221, 136, 297, 1056, 131, 448, 303, - /* 720 */ 437, 1603, 1465, 1465, 1465, 1465, 1465, 246, 1494, 295, - /* 730 */ 299, 291, 287, 133, 1465, 1055, 440, 444, 69, 1495, - /* 740 */ 1496, 1500, 1544, 1465, 1465, 1152, 259, 1540, 126, 169, - /* 750 */ 1465, 546, 1511, 44, 1465, 1231, 132, 1178, 1465, 432, - /* 760 */ 190, 159, 446, 175, 158, 213, 412, 1571, 95, 448, - /* 770 */ 64, 1494, 1257, 1465, 535, 463, 531, 527, 523, 212, - /* 780 */ 61, 161, 163, 1494, 160, 162, 487, 1059, 1252, 69, - /* 790 */ 1495, 1496, 1500, 1544, 383, 1511, 1494, 259, 1540, 126, - /* 800 */ 1250, 1297, 445, 1213, 1214, 66, 417, 1511, 206, 191, - /* 810 */ 385, 342, 448, 178, 445, 33, 1465, 180, 1572, 1127, - /* 820 */ 1511, 403, 388, 1064, 448, 1379, 33, 445, 1465, 1155, - /* 830 */ 1085, 1494, 231, 1495, 1496, 1500, 184, 448, 458, 1058, - /* 840 */ 1067, 1465, 365, 1494, 69, 1495, 1496, 1500, 1544, 1112, - /* 850 */ 1574, 438, 259, 1540, 1617, 1511, 1512, 70, 1495, 1496, - /* 860 */ 1500, 1544, 445, 1578, 430, 411, 1541, 1511, 171, 441, - /* 870 */ 1057, 193, 448, 1070, 445, 2, 1465, 33, 284, 435, - /* 880 */ 245, 1017, 197, 1034, 448, 168, 199, 94, 1465, 894, - /* 890 */ 247, 454, 69, 1495, 1496, 1500, 1544, 1026, 214, 288, - /* 900 */ 259, 1540, 1617, 1494, 69, 1495, 1496, 1500, 1544, 138, - /* 910 */ 1061, 1601, 259, 1540, 1617, 104, 321, 152, 429, 205, - /* 920 */ 125, 106, 1417, 1562, 327, 925, 364, 1511, 360, 356, - /* 930 */ 352, 151, 44, 467, 445, 335, 920, 953, 104, 1494, - /* 940 */ 340, 1060, 957, 100, 448, 334, 336, 1081, 1465, 341, - /* 950 */ 1494, 1080, 32, 31, 29, 27, 26, 53, 344, 144, - /* 960 */ 149, 1079, 433, 1511, 70, 1495, 1496, 1500, 1544, 343, - /* 970 */ 445, 345, 443, 1540, 1511, 105, 98, 147, 51, 963, - /* 980 */ 448, 445, 348, 429, 1465, 106, 187, 1551, 428, 962, - /* 990 */ 427, 448, 104, 1605, 150, 1465, 107, 1078, 413, 367, - /* 1000 */ 232, 1495, 1496, 1500, 1494, 369, 131, 1328, 100, 1494, - /* 1010 */ 1603, 233, 1495, 1496, 1500, 154, 148, 1324, 121, 156, - /* 1020 */ 145, 74, 372, 397, 109, 110, 1326, 1322, 1511, 111, - /* 1030 */ 112, 255, 425, 1511, 398, 445, 407, 143, 1494, 399, - /* 1040 */ 445, 98, 400, 1077, 170, 448, 173, 418, 409, 1465, - /* 1050 */ 448, 129, 1551, 1552, 1465, 1556, 1575, 263, 1585, 452, - /* 1060 */ 410, 1055, 1511, 1584, 1494, 119, 1495, 1496, 1500, 445, - /* 1070 */ 233, 1495, 1496, 1500, 176, 415, 5, 179, 1211, 448, - /* 1080 */ 258, 421, 1565, 1465, 426, 414, 267, 99, 1511, 4, - /* 1090 */ 1076, 1152, 1559, 124, 183, 445, 34, 185, 260, 233, - /* 1100 */ 1495, 1496, 1500, 442, 1619, 448, 1494, 439, 17, 1465, - /* 1110 */ 456, 1494, 186, 1526, 1426, 450, 192, 1494, 455, 1602, - /* 1120 */ 451, 1620, 1425, 201, 268, 234, 1495, 1496, 1500, 215, - /* 1130 */ 1511, 457, 203, 58, 1339, 1511, 60, 445, 217, 465, - /* 1140 */ 494, 1511, 445, 1311, 211, 1210, 542, 448, 445, 1315, - /* 1150 */ 40, 1465, 448, 223, 224, 219, 1465, 1459, 448, 1494, - /* 1160 */ 221, 1458, 1465, 283, 1455, 285, 286, 226, 1495, 1496, - /* 1170 */ 1500, 1494, 235, 1495, 1496, 1500, 1044, 1045, 227, 1495, - /* 1180 */ 1496, 1500, 134, 1511, 1494, 290, 1453, 1452, 292, 293, - /* 1190 */ 445, 294, 296, 1451, 298, 1511, 1442, 135, 301, 302, - /* 1200 */ 448, 1313, 445, 1029, 1465, 1028, 1436, 1435, 1511, 308, - /* 1210 */ 209, 307, 448, 1494, 493, 445, 1465, 1434, 1433, 1000, - /* 1220 */ 236, 1495, 1496, 1500, 1410, 448, 1409, 1408, 1407, 1465, - /* 1230 */ 1406, 1405, 1508, 1495, 1496, 1500, 495, 1511, 1404, 1494, - /* 1240 */ 1403, 1402, 1401, 1400, 445, 1507, 1495, 1496, 1500, 1399, - /* 1250 */ 1398, 1397, 1396, 1395, 448, 492, 491, 490, 1465, 489, - /* 1260 */ 103, 1394, 209, 1511, 1393, 1494, 493, 1392, 1391, 1390, - /* 1270 */ 445, 1389, 1388, 1494, 243, 1495, 1496, 1500, 1002, 1387, - /* 1280 */ 448, 1386, 1269, 1450, 1465, 1444, 1432, 1423, 495, 1511, - /* 1290 */ 146, 1317, 1268, 1266, 350, 861, 445, 1511, 349, 1494, - /* 1300 */ 1506, 1495, 1496, 1500, 445, 351, 448, 492, 491, 490, - /* 1310 */ 1465, 489, 1264, 353, 448, 1262, 354, 355, 1465, 359, - /* 1320 */ 1260, 363, 357, 1511, 358, 362, 244, 1495, 1496, 1500, - /* 1330 */ 445, 1249, 361, 1248, 242, 1495, 1496, 1500, 1245, 1319, - /* 1340 */ 448, 1494, 73, 970, 1465, 968, 153, 1318, 511, 893, - /* 1350 */ 1258, 892, 891, 1253, 890, 887, 886, 252, 253, 1251, - /* 1360 */ 239, 1495, 1496, 1500, 386, 1511, 509, 254, 389, 1244, - /* 1370 */ 391, 1243, 445, 393, 71, 1449, 43, 167, 1036, 1443, - /* 1380 */ 401, 1431, 448, 113, 1430, 402, 1465, 1422, 123, 172, - /* 1390 */ 14, 15, 37, 54, 1483, 174, 177, 3, 33, 38, - /* 1400 */ 182, 35, 230, 1495, 1496, 1500, 56, 1177, 120, 10, - /* 1410 */ 188, 181, 1199, 8, 20, 19, 1198, 1170, 55, 1113, - /* 1420 */ 261, 1203, 1421, 1202, 1149, 453, 36, 1148, 262, 202, - /* 1430 */ 204, 16, 1204, 466, 1065, 275, 470, 1087, 1086, 13, - /* 1440 */ 18, 198, 130, 196, 473, 1175, 200, 195, 61, 931, - /* 1450 */ 45, 57, 476, 479, 965, 959, 875, 540, 961, 1482, - /* 1460 */ 541, 544, 39, 882, 881, 468, 207, 954, 951, 948, - /* 1470 */ 471, 1265, 859, 474, 464, 942, 940, 477, 480, 496, - /* 1480 */ 900, 880, 879, 878, 877, 876, 895, 62, 897, 872, - /* 1490 */ 871, 870, 46, 63, 867, 866, 498, 486, 865, 210, - /* 1500 */ 1263, 864, 520, 521, 946, 525, 945, 944, 943, 522, - /* 1510 */ 524, 526, 1261, 528, 529, 1259, 530, 532, 533, 534, - /* 1520 */ 1247, 536, 537, 1246, 1242, 1052, 964, 218, 545, + /* 0 */ 463, 25, 194, 52, 257, 306, 1497, 9, 8, 72, + /* 10 */ 277, 388, 30, 28, 463, 274, 369, 1421, 1423, 270, + /* 20 */ 266, 1481, 1052, 310, 1336, 1340, 396, 115, 1072, 1481, + /* 30 */ 1514, 1497, 1481, 1477, 1483, 1342, 1608, 446, 1050, 1340, + /* 40 */ 166, 1477, 1484, 391, 1477, 1483, 462, 449, 385, 131, + /* 50 */ 11, 1468, 406, 1606, 165, 1514, 312, 1057, 29, 27, + /* 60 */ 26, 348, 446, 30, 28, 1159, 463, 119, 1498, 1499, + /* 70 */ 1503, 266, 449, 1052, 1, 72, 1468, 30, 28, 265, + /* 80 */ 42, 1135, 375, 41, 462, 266, 238, 1052, 1497, 1050, + /* 90 */ 1331, 1340, 229, 1498, 1499, 1503, 407, 544, 540, 539, + /* 100 */ 1075, 11, 462, 1050, 450, 435, 1621, 269, 1057, 1051, + /* 110 */ 1430, 463, 1514, 381, 380, 11, 30, 28, 430, 446, + /* 120 */ 311, 117, 1057, 1232, 266, 1, 1052, 1608, 1608, 449, + /* 130 */ 513, 511, 1243, 1468, 430, 1468, 1340, 1124, 12, 1, + /* 140 */ 131, 1607, 1050, 100, 1606, 1606, 1053, 1318, 544, 70, + /* 150 */ 1498, 1499, 1503, 1547, 420, 1128, 12, 1546, 1543, 100, + /* 160 */ 1051, 1057, 544, 1056, 1076, 1077, 1103, 1104, 1105, 1106, + /* 170 */ 1107, 1108, 1109, 1110, 1051, 463, 98, 1468, 7, 22, + /* 180 */ 1242, 30, 28, 448, 319, 132, 128, 1554, 1555, 266, + /* 190 */ 1559, 1052, 98, 132, 118, 132, 348, 1053, 1298, 1387, + /* 200 */ 1340, 544, 129, 1554, 1555, 256, 1559, 1050, 425, 421, + /* 210 */ 1385, 1053, 1074, 1051, 1056, 1076, 1077, 1103, 1104, 1105, + /* 220 */ 1106, 1107, 1108, 1109, 1110, 1468, 1057, 1221, 1056, 1076, + /* 230 */ 1077, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 305, + /* 240 */ 844, 304, 843, 7, 1076, 1077, 9, 8, 84, 132, + /* 250 */ 1053, 83, 82, 81, 80, 79, 78, 77, 76, 75, + /* 260 */ 845, 32, 31, 29, 27, 26, 544, 1056, 1076, 1077, + /* 270 */ 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1051, 132, + /* 280 */ 424, 1418, 52, 30, 28, 237, 65, 1072, 139, 132, + /* 290 */ 383, 266, 377, 1052, 327, 96, 382, 339, 1241, 97, + /* 300 */ 101, 378, 376, 1335, 379, 216, 340, 1332, 1370, 1050, + /* 310 */ 32, 31, 29, 27, 26, 1053, 84, 1566, 1154, 83, + /* 320 */ 82, 81, 80, 79, 78, 77, 76, 75, 1057, 1220, + /* 330 */ 334, 1183, 1056, 1076, 1077, 1103, 1104, 1105, 1106, 1107, + /* 340 */ 1108, 1109, 1110, 1468, 1078, 7, 164, 445, 241, 137, + /* 350 */ 372, 895, 498, 93, 92, 91, 90, 89, 88, 87, + /* 360 */ 86, 85, 417, 1181, 1182, 1184, 1185, 501, 544, 1312, + /* 370 */ 897, 1079, 374, 1091, 250, 50, 141, 140, 49, 338, + /* 380 */ 1051, 1122, 333, 332, 331, 330, 329, 430, 326, 325, + /* 390 */ 324, 323, 322, 318, 317, 316, 315, 314, 313, 463, + /* 400 */ 164, 30, 28, 489, 372, 1561, 463, 450, 320, 266, + /* 410 */ 1561, 1052, 100, 1431, 1387, 347, 251, 1053, 249, 248, + /* 420 */ 271, 371, 1514, 1558, 1340, 1385, 374, 1050, 1557, 446, + /* 430 */ 1123, 1340, 1215, 1216, 1056, 1076, 1077, 1103, 1104, 1105, + /* 440 */ 1106, 1107, 1108, 1109, 1110, 98, 1057, 1269, 1127, 32, + /* 450 */ 31, 29, 27, 26, 432, 127, 1554, 1555, 1317, 1559, + /* 460 */ 1114, 423, 189, 1, 1073, 32, 31, 29, 27, 26, + /* 470 */ 1561, 59, 24, 264, 1117, 1118, 1119, 1120, 1121, 1125, + /* 480 */ 1126, 32, 31, 29, 27, 26, 544, 241, 1556, 175, + /* 490 */ 1166, 157, 1333, 122, 155, 1158, 1074, 1240, 1051, 520, + /* 500 */ 519, 518, 517, 281, 1380, 516, 515, 514, 102, 509, + /* 510 */ 508, 507, 506, 505, 504, 503, 502, 108, 159, 209, + /* 520 */ 1122, 158, 500, 494, 933, 486, 485, 484, 937, 483, + /* 530 */ 939, 940, 482, 942, 479, 1053, 948, 476, 950, 951, + /* 540 */ 473, 470, 1468, 1239, 1173, 496, 116, 1329, 1218, 1316, + /* 550 */ 6, 222, 1056, 1076, 1077, 1103, 1104, 1105, 1106, 1107, + /* 560 */ 1108, 1109, 1110, 220, 493, 492, 491, 21, 490, 1123, + /* 570 */ 161, 437, 23, 160, 843, 1238, 142, 32, 31, 29, + /* 580 */ 27, 26, 32, 31, 29, 27, 26, 1127, 1468, 115, + /* 590 */ 367, 1325, 1213, 152, 1272, 1327, 125, 1343, 498, 463, + /* 600 */ 463, 282, 365, 397, 361, 357, 353, 151, 1337, 460, + /* 610 */ 1387, 24, 264, 1117, 1118, 1119, 1120, 1121, 1125, 1126, + /* 620 */ 1468, 1422, 1323, 169, 1340, 1340, 297, 276, 447, 463, + /* 630 */ 273, 272, 1608, 53, 1608, 115, 149, 1237, 461, 67, + /* 640 */ 1065, 299, 1497, 1342, 1457, 131, 383, 131, 377, 1606, + /* 650 */ 163, 1606, 382, 162, 1340, 97, 1058, 378, 376, 1212, + /* 660 */ 379, 32, 31, 29, 27, 26, 1514, 48, 47, 309, + /* 670 */ 1387, 136, 405, 446, 512, 1057, 303, 1157, 300, 1259, + /* 680 */ 289, 1386, 1468, 449, 246, 1497, 295, 1468, 291, 287, + /* 690 */ 133, 1154, 434, 148, 279, 121, 106, 145, 1497, 1236, + /* 700 */ 409, 384, 115, 68, 1498, 1499, 1503, 1547, 488, 1514, + /* 710 */ 1342, 240, 1543, 132, 143, 464, 433, 32, 31, 29, + /* 720 */ 27, 26, 1514, 1608, 1091, 395, 449, 1061, 463, 446, + /* 730 */ 1468, 1235, 1234, 1299, 441, 438, 131, 208, 393, 449, + /* 740 */ 1606, 1497, 463, 1468, 1468, 1231, 69, 1498, 1499, 1503, + /* 750 */ 1547, 280, 1387, 1340, 259, 1543, 126, 1254, 278, 119, + /* 760 */ 1498, 1499, 1503, 1385, 1066, 1514, 547, 1340, 190, 436, + /* 770 */ 430, 1233, 433, 1230, 413, 1574, 1468, 1468, 1060, 386, + /* 780 */ 213, 1069, 449, 95, 1052, 1252, 1468, 1229, 1228, 536, + /* 790 */ 1468, 532, 528, 524, 212, 100, 1227, 44, 1622, 1226, + /* 800 */ 1050, 1180, 69, 1498, 1499, 1503, 1547, 389, 191, 178, + /* 810 */ 259, 1543, 126, 180, 434, 1225, 1224, 418, 1468, 1057, + /* 820 */ 66, 1223, 33, 206, 1497, 33, 1129, 1059, 98, 1087, + /* 830 */ 343, 1575, 1468, 1468, 1488, 1381, 404, 64, 187, 1554, + /* 840 */ 429, 1468, 428, 114, 1468, 1608, 1486, 61, 1514, 1063, + /* 850 */ 44, 1497, 33, 459, 921, 446, 1019, 366, 131, 544, + /* 860 */ 1468, 1468, 1606, 184, 1577, 449, 1468, 439, 442, 1468, + /* 870 */ 197, 1051, 94, 104, 199, 1514, 455, 205, 1497, 106, + /* 880 */ 1515, 412, 446, 926, 171, 69, 1498, 1499, 1503, 1547, + /* 890 */ 431, 2, 449, 259, 1543, 1620, 1468, 193, 1062, 1036, + /* 900 */ 1072, 168, 1514, 468, 1581, 869, 104, 954, 1053, 446, + /* 910 */ 958, 284, 69, 1498, 1499, 1503, 1547, 288, 245, 449, + /* 920 */ 259, 1543, 1620, 1468, 870, 1056, 105, 895, 1497, 247, + /* 930 */ 964, 1604, 106, 104, 1028, 214, 963, 107, 321, 69, + /* 940 */ 1498, 1499, 1503, 1547, 1420, 138, 328, 259, 1543, 1620, + /* 950 */ 336, 335, 1514, 1497, 337, 1083, 341, 342, 1565, 446, + /* 960 */ 1082, 344, 144, 1081, 345, 346, 1080, 147, 51, 449, + /* 970 */ 349, 150, 368, 1468, 398, 399, 370, 1514, 434, 1330, + /* 980 */ 1497, 154, 411, 400, 446, 1326, 255, 74, 401, 228, + /* 990 */ 1498, 1499, 1503, 156, 449, 373, 109, 408, 1468, 110, + /* 1000 */ 1328, 1324, 111, 112, 1514, 1079, 1497, 170, 173, 1608, + /* 1010 */ 419, 446, 1588, 410, 70, 1498, 1499, 1503, 1547, 453, + /* 1020 */ 1057, 449, 131, 1544, 5, 1468, 1606, 1578, 183, 176, + /* 1030 */ 1514, 416, 1497, 1587, 179, 1568, 258, 446, 422, 427, + /* 1040 */ 1497, 70, 1498, 1499, 1503, 1547, 415, 449, 1154, 444, + /* 1050 */ 1543, 1468, 4, 99, 414, 1078, 1514, 1562, 34, 260, + /* 1060 */ 443, 186, 440, 446, 1514, 17, 1429, 233, 1498, 1499, + /* 1070 */ 1503, 446, 124, 449, 1497, 1529, 451, 1468, 185, 452, + /* 1080 */ 456, 449, 203, 1428, 268, 1468, 201, 1497, 263, 58, + /* 1090 */ 457, 458, 1341, 232, 1498, 1499, 1503, 1623, 1514, 1497, + /* 1100 */ 192, 233, 1498, 1499, 1503, 446, 1605, 466, 215, 1313, + /* 1110 */ 60, 1514, 495, 217, 211, 449, 543, 40, 446, 1468, + /* 1120 */ 219, 223, 267, 1514, 224, 426, 221, 1462, 449, 1461, + /* 1130 */ 446, 283, 1468, 1497, 1458, 233, 1498, 1499, 1503, 285, + /* 1140 */ 449, 286, 1046, 1047, 1468, 134, 290, 1456, 225, 1498, + /* 1150 */ 1499, 1503, 292, 293, 294, 1455, 296, 1514, 1454, 1497, + /* 1160 */ 231, 1498, 1499, 1503, 446, 1445, 298, 135, 301, 302, + /* 1170 */ 1031, 1030, 1439, 1438, 449, 307, 308, 1437, 1468, 103, + /* 1180 */ 1002, 1413, 1412, 1514, 1436, 1497, 1411, 1410, 1409, 1408, + /* 1190 */ 446, 1407, 1406, 1405, 234, 1498, 1499, 1503, 1404, 1403, + /* 1200 */ 449, 1402, 1401, 1400, 1468, 1004, 1391, 1390, 1389, 1514, + /* 1210 */ 1497, 1399, 1398, 1397, 1396, 1395, 446, 1394, 1393, 1392, + /* 1220 */ 226, 1498, 1499, 1503, 1388, 1271, 449, 1453, 1447, 1435, + /* 1230 */ 1468, 1426, 1319, 146, 1514, 1497, 862, 1270, 1268, 352, + /* 1240 */ 1266, 446, 350, 356, 1497, 351, 235, 1498, 1499, 1503, + /* 1250 */ 1264, 449, 1262, 360, 354, 1468, 355, 359, 1251, 1514, + /* 1260 */ 358, 362, 363, 1250, 1247, 1321, 446, 969, 1514, 1320, + /* 1270 */ 1260, 227, 1498, 1499, 1503, 446, 449, 364, 73, 1497, + /* 1280 */ 1468, 971, 894, 252, 893, 449, 892, 891, 1255, 1468, + /* 1290 */ 253, 888, 887, 1253, 387, 254, 236, 1498, 1499, 1503, + /* 1300 */ 390, 1246, 392, 1514, 512, 1511, 1498, 1499, 1503, 1245, + /* 1310 */ 446, 153, 510, 1497, 394, 71, 1452, 167, 43, 1038, + /* 1320 */ 449, 1446, 113, 1434, 1468, 402, 1433, 1425, 172, 14, + /* 1330 */ 54, 3, 403, 1486, 177, 37, 35, 1514, 33, 15, + /* 1340 */ 1510, 1498, 1499, 1503, 446, 38, 1179, 1497, 10, 120, + /* 1350 */ 181, 19, 188, 1172, 449, 182, 1497, 55, 1468, 56, + /* 1360 */ 20, 1151, 1497, 1201, 8, 1150, 1206, 36, 130, 174, + /* 1370 */ 123, 1514, 1200, 16, 243, 1498, 1499, 1503, 446, 261, + /* 1380 */ 1514, 1315, 1205, 1204, 262, 195, 1514, 446, 449, 1089, + /* 1390 */ 1497, 13, 1468, 446, 1088, 196, 18, 449, 1424, 1177, + /* 1400 */ 202, 1468, 1115, 449, 198, 200, 45, 1468, 1509, 1498, + /* 1410 */ 1499, 1503, 57, 61, 1514, 454, 1497, 244, 1498, 1499, + /* 1420 */ 1503, 446, 1485, 242, 1498, 1499, 1503, 204, 207, 1067, + /* 1430 */ 39, 449, 465, 955, 467, 1468, 952, 275, 469, 471, + /* 1440 */ 1514, 472, 209, 949, 474, 475, 494, 446, 943, 477, + /* 1450 */ 478, 239, 1498, 1499, 1503, 941, 480, 449, 481, 947, + /* 1460 */ 932, 1468, 946, 62, 945, 944, 487, 966, 496, 46, + /* 1470 */ 962, 63, 960, 860, 497, 499, 901, 230, 1498, 1499, + /* 1480 */ 1503, 965, 883, 210, 882, 881, 880, 493, 492, 491, + /* 1490 */ 879, 490, 878, 877, 876, 896, 898, 873, 872, 871, + /* 1500 */ 868, 867, 866, 865, 1267, 521, 522, 1265, 1263, 523, + /* 1510 */ 526, 525, 527, 529, 530, 1261, 534, 533, 1249, 531, + /* 1520 */ 535, 537, 538, 1248, 1244, 541, 542, 1219, 1054, 1219, + /* 1530 */ 546, 218, 545, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 276, 277, 255, 235, 238, 251, 210, 216, 254, 216, - /* 10 */ 243, 257, 12, 13, 267, 268, 225, 250, 251, 0, - /* 20 */ 20, 255, 22, 238, 216, 12, 13, 14, 15, 16, - /* 30 */ 234, 2, 241, 267, 268, 260, 20, 241, 38, 246, - /* 40 */ 255, 12, 13, 14, 15, 16, 20, 251, 2, 241, - /* 50 */ 50, 255, 267, 268, 210, 36, 260, 57, 12, 13, - /* 60 */ 14, 15, 16, 12, 13, 14, 291, 271, 272, 273, - /* 70 */ 274, 20, 227, 22, 74, 230, 12, 13, 234, 304, - /* 80 */ 269, 47, 274, 308, 20, 241, 22, 291, 75, 38, - /* 90 */ 218, 283, 284, 285, 286, 251, 288, 97, 287, 255, - /* 100 */ 304, 50, 38, 231, 308, 20, 207, 73, 57, 109, - /* 110 */ 76, 239, 220, 221, 50, 271, 272, 273, 274, 275, - /* 120 */ 20, 57, 49, 279, 280, 74, 0, 88, 89, 90, - /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 74, 100, - /* 140 */ 101, 102, 103, 104, 105, 145, 85, 21, 97, 210, - /* 150 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 260, - /* 160 */ 109, 97, 162, 163, 164, 165, 166, 167, 168, 169, - /* 170 */ 170, 171, 172, 109, 74, 22, 216, 20, 61, 12, - /* 180 */ 13, 209, 65, 211, 184, 225, 52, 20, 54, 22, - /* 190 */ 291, 38, 58, 216, 255, 61, 145, 63, 64, 78, - /* 200 */ 66, 241, 81, 304, 87, 38, 144, 308, 146, 145, - /* 210 */ 57, 260, 20, 162, 163, 164, 165, 166, 167, 168, - /* 220 */ 169, 170, 171, 172, 57, 135, 162, 163, 164, 165, - /* 230 */ 166, 167, 168, 169, 170, 171, 172, 260, 216, 162, - /* 240 */ 184, 74, 291, 12, 13, 14, 184, 225, 163, 164, - /* 250 */ 97, 20, 216, 22, 232, 304, 38, 12, 13, 308, - /* 260 */ 20, 225, 109, 241, 97, 20, 74, 22, 291, 38, - /* 270 */ 193, 194, 195, 196, 197, 57, 109, 241, 218, 189, - /* 280 */ 190, 304, 210, 38, 184, 308, 21, 291, 57, 24, - /* 290 */ 25, 26, 27, 28, 29, 30, 31, 32, 145, 239, - /* 300 */ 304, 67, 57, 215, 308, 74, 234, 12, 13, 14, - /* 310 */ 15, 16, 145, 241, 234, 162, 219, 229, 210, 74, - /* 320 */ 223, 241, 20, 251, 236, 210, 0, 255, 97, 162, - /* 330 */ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - /* 340 */ 109, 184, 97, 271, 272, 273, 274, 113, 114, 234, - /* 350 */ 18, 184, 20, 273, 109, 216, 241, 233, 49, 27, - /* 360 */ 216, 269, 30, 255, 225, 20, 251, 216, 244, 225, - /* 370 */ 255, 39, 234, 258, 210, 49, 145, 137, 240, 287, - /* 380 */ 241, 309, 310, 245, 215, 241, 271, 272, 273, 274, - /* 390 */ 145, 57, 241, 162, 163, 164, 165, 166, 167, 168, - /* 400 */ 169, 170, 171, 172, 20, 236, 22, 162, 163, 164, - /* 410 */ 165, 166, 167, 168, 169, 170, 171, 172, 216, 255, - /* 420 */ 12, 13, 234, 234, 40, 274, 210, 225, 20, 240, - /* 430 */ 22, 0, 137, 245, 245, 284, 285, 286, 241, 288, - /* 440 */ 14, 15, 16, 241, 112, 248, 38, 115, 116, 117, - /* 450 */ 118, 119, 74, 121, 122, 123, 124, 125, 126, 127, - /* 460 */ 128, 129, 130, 216, 86, 57, 12, 13, 14, 15, - /* 470 */ 16, 255, 225, 213, 214, 12, 13, 14, 15, 16, - /* 480 */ 35, 235, 74, 52, 53, 54, 55, 56, 241, 58, - /* 490 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - /* 500 */ 69, 70, 210, 216, 50, 97, 61, 71, 234, 216, - /* 510 */ 65, 75, 225, 50, 251, 226, 242, 109, 225, 232, - /* 520 */ 257, 235, 77, 234, 79, 80, 234, 82, 241, 75, - /* 530 */ 0, 242, 87, 241, 241, 22, 226, 83, 12, 13, - /* 540 */ 14, 15, 16, 251, 234, 263, 83, 255, 1, 2, - /* 550 */ 269, 38, 242, 145, 24, 25, 26, 27, 28, 29, - /* 560 */ 30, 31, 32, 271, 272, 273, 274, 0, 287, 131, - /* 570 */ 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - /* 580 */ 172, 4, 14, 226, 216, 131, 234, 149, 20, 216, - /* 590 */ 18, 234, 240, 225, 131, 23, 19, 245, 225, 242, - /* 600 */ 210, 75, 38, 149, 210, 43, 210, 35, 0, 241, - /* 610 */ 33, 173, 149, 36, 241, 234, 49, 222, 41, 224, - /* 620 */ 48, 57, 75, 210, 47, 210, 245, 173, 174, 175, - /* 630 */ 176, 177, 178, 179, 180, 181, 173, 174, 175, 176, - /* 640 */ 177, 178, 179, 180, 181, 255, 20, 234, 4, 255, - /* 650 */ 73, 255, 210, 76, 241, 12, 13, 14, 15, 16, - /* 660 */ 52, 210, 54, 71, 251, 235, 58, 75, 255, 61, - /* 670 */ 255, 63, 64, 260, 66, 220, 221, 210, 210, 210, - /* 680 */ 210, 210, 3, 111, 271, 272, 273, 274, 275, 210, - /* 690 */ 12, 13, 279, 280, 21, 1, 2, 255, 210, 210, - /* 700 */ 22, 234, 182, 183, 291, 210, 255, 34, 241, 210, - /* 710 */ 138, 139, 140, 210, 142, 141, 38, 304, 251, 147, - /* 720 */ 71, 308, 255, 255, 255, 255, 255, 155, 210, 157, - /* 730 */ 156, 159, 160, 161, 255, 57, 71, 50, 271, 272, - /* 740 */ 273, 274, 275, 255, 255, 183, 279, 280, 281, 235, - /* 750 */ 255, 19, 234, 71, 255, 211, 184, 75, 255, 241, - /* 760 */ 293, 78, 235, 137, 81, 33, 299, 300, 36, 251, - /* 770 */ 74, 210, 0, 255, 42, 97, 44, 45, 46, 47, - /* 780 */ 84, 78, 78, 210, 81, 81, 235, 109, 0, 271, - /* 790 */ 272, 273, 274, 275, 22, 234, 210, 279, 280, 281, - /* 800 */ 0, 223, 241, 163, 164, 73, 302, 234, 76, 311, - /* 810 */ 22, 251, 251, 71, 241, 71, 255, 75, 300, 75, - /* 820 */ 234, 251, 22, 145, 251, 244, 71, 241, 255, 185, - /* 830 */ 75, 210, 271, 272, 273, 274, 296, 251, 106, 38, - /* 840 */ 162, 255, 213, 210, 271, 272, 273, 274, 275, 162, - /* 850 */ 270, 202, 279, 280, 281, 234, 234, 271, 272, 273, - /* 860 */ 274, 275, 241, 290, 289, 133, 280, 234, 136, 204, - /* 870 */ 38, 305, 251, 20, 241, 292, 255, 71, 216, 200, - /* 880 */ 266, 75, 71, 151, 251, 153, 75, 71, 255, 38, - /* 890 */ 220, 75, 271, 272, 273, 274, 275, 143, 261, 36, - /* 900 */ 279, 280, 281, 210, 271, 272, 273, 274, 275, 120, - /* 910 */ 109, 290, 279, 280, 281, 71, 216, 33, 216, 75, - /* 920 */ 36, 71, 216, 290, 249, 75, 42, 234, 44, 45, - /* 930 */ 46, 47, 71, 71, 241, 131, 75, 75, 71, 210, - /* 940 */ 216, 109, 75, 241, 251, 247, 247, 20, 255, 265, - /* 950 */ 210, 20, 12, 13, 14, 15, 16, 73, 241, 218, - /* 960 */ 76, 20, 260, 234, 271, 272, 273, 274, 275, 259, - /* 970 */ 241, 252, 279, 280, 234, 71, 274, 218, 218, 75, - /* 980 */ 251, 241, 216, 216, 255, 71, 284, 285, 286, 75, - /* 990 */ 288, 251, 71, 291, 218, 255, 75, 20, 258, 212, - /* 1000 */ 271, 272, 273, 274, 210, 234, 304, 234, 241, 210, - /* 1010 */ 308, 271, 272, 273, 274, 234, 132, 234, 134, 234, - /* 1020 */ 136, 216, 220, 241, 234, 234, 234, 234, 234, 234, - /* 1030 */ 234, 212, 303, 234, 265, 241, 259, 153, 210, 152, - /* 1040 */ 241, 274, 264, 20, 215, 251, 215, 192, 241, 255, - /* 1050 */ 251, 284, 285, 286, 255, 288, 270, 258, 301, 191, - /* 1060 */ 252, 57, 234, 301, 210, 271, 272, 273, 274, 241, - /* 1070 */ 271, 272, 273, 274, 256, 255, 199, 256, 138, 251, - /* 1080 */ 255, 255, 298, 255, 198, 187, 258, 241, 234, 186, - /* 1090 */ 20, 183, 269, 295, 297, 241, 120, 294, 206, 271, - /* 1100 */ 272, 273, 274, 203, 310, 251, 210, 201, 74, 255, - /* 1110 */ 253, 210, 282, 278, 256, 255, 306, 210, 134, 307, - /* 1120 */ 255, 312, 256, 241, 255, 271, 272, 273, 274, 230, - /* 1130 */ 234, 252, 215, 215, 241, 234, 74, 241, 216, 237, - /* 1140 */ 220, 234, 241, 224, 215, 205, 212, 251, 241, 0, - /* 1150 */ 262, 255, 251, 228, 228, 217, 255, 0, 251, 210, - /* 1160 */ 208, 0, 255, 64, 0, 38, 158, 271, 272, 273, - /* 1170 */ 274, 210, 271, 272, 273, 274, 38, 38, 271, 272, - /* 1180 */ 273, 274, 38, 234, 210, 158, 0, 0, 38, 38, - /* 1190 */ 241, 158, 38, 0, 38, 234, 0, 74, 149, 148, - /* 1200 */ 251, 0, 241, 109, 255, 145, 0, 0, 234, 141, - /* 1210 */ 61, 53, 251, 210, 65, 241, 255, 0, 0, 86, - /* 1220 */ 271, 272, 273, 274, 0, 251, 0, 0, 0, 255, - /* 1230 */ 0, 0, 271, 272, 273, 274, 87, 234, 0, 210, - /* 1240 */ 0, 0, 0, 0, 241, 271, 272, 273, 274, 0, - /* 1250 */ 0, 0, 0, 0, 251, 106, 107, 108, 255, 110, - /* 1260 */ 120, 0, 61, 234, 0, 210, 65, 0, 0, 0, - /* 1270 */ 241, 0, 0, 210, 271, 272, 273, 274, 22, 0, - /* 1280 */ 251, 0, 0, 0, 255, 0, 0, 0, 87, 234, - /* 1290 */ 43, 0, 0, 0, 36, 51, 241, 234, 38, 210, - /* 1300 */ 271, 272, 273, 274, 241, 43, 251, 106, 107, 108, - /* 1310 */ 255, 110, 0, 38, 251, 0, 36, 43, 255, 43, - /* 1320 */ 0, 43, 38, 234, 36, 36, 271, 272, 273, 274, - /* 1330 */ 241, 0, 38, 0, 271, 272, 273, 274, 0, 0, - /* 1340 */ 251, 210, 83, 38, 255, 22, 81, 0, 71, 38, - /* 1350 */ 0, 38, 38, 0, 38, 38, 38, 22, 22, 0, - /* 1360 */ 271, 272, 273, 274, 39, 234, 71, 22, 38, 0, - /* 1370 */ 22, 0, 241, 22, 20, 0, 137, 154, 38, 0, - /* 1380 */ 22, 0, 251, 150, 0, 137, 255, 0, 134, 43, - /* 1390 */ 188, 188, 137, 74, 86, 132, 75, 71, 71, 71, - /* 1400 */ 71, 182, 271, 272, 273, 274, 4, 75, 74, 188, - /* 1410 */ 86, 74, 38, 2, 71, 74, 38, 75, 74, 162, - /* 1420 */ 38, 38, 0, 38, 75, 135, 71, 75, 38, 43, - /* 1430 */ 132, 71, 75, 38, 22, 38, 38, 75, 75, 74, - /* 1440 */ 74, 74, 86, 75, 38, 75, 74, 86, 84, 22, - /* 1450 */ 74, 74, 38, 38, 38, 22, 22, 22, 38, 86, - /* 1460 */ 21, 21, 74, 38, 38, 74, 86, 75, 75, 75, - /* 1470 */ 74, 0, 51, 74, 85, 75, 75, 74, 74, 50, - /* 1480 */ 57, 38, 38, 38, 38, 38, 38, 74, 57, 38, - /* 1490 */ 38, 38, 74, 74, 38, 38, 72, 87, 38, 71, - /* 1500 */ 0, 38, 38, 36, 99, 36, 99, 99, 99, 43, - /* 1510 */ 38, 43, 0, 38, 36, 0, 43, 38, 36, 43, - /* 1520 */ 0, 38, 37, 0, 0, 22, 109, 22, 20, 313, - /* 1530 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1540 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1550 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1560 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1570 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1580 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1590 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1600 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1610 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1620 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1630 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1640 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1650 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1660 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1670 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1680 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1690 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1700 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1710 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1720 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 1730 */ 313, 313, 313, 313, 313, 313, + /* 0 */ 217, 277, 278, 219, 239, 261, 211, 1, 2, 226, + /* 10 */ 244, 4, 12, 13, 217, 239, 233, 251, 252, 227, + /* 20 */ 20, 256, 22, 226, 240, 242, 19, 235, 20, 256, + /* 30 */ 235, 211, 256, 268, 269, 243, 292, 242, 38, 242, + /* 40 */ 33, 268, 269, 36, 268, 269, 20, 252, 41, 305, + /* 50 */ 50, 256, 217, 309, 47, 235, 217, 57, 14, 15, + /* 60 */ 16, 49, 242, 12, 13, 14, 217, 272, 273, 274, + /* 70 */ 275, 20, 252, 22, 74, 226, 256, 12, 13, 259, + /* 80 */ 73, 75, 233, 76, 20, 20, 247, 22, 211, 38, + /* 90 */ 211, 242, 272, 273, 274, 275, 261, 97, 214, 215, + /* 100 */ 20, 50, 20, 38, 252, 310, 311, 255, 57, 109, + /* 110 */ 258, 217, 235, 221, 222, 50, 12, 13, 217, 242, + /* 120 */ 226, 210, 57, 212, 20, 74, 22, 292, 292, 252, + /* 130 */ 221, 222, 211, 256, 217, 256, 242, 132, 74, 74, + /* 140 */ 305, 305, 38, 242, 309, 309, 146, 0, 97, 272, + /* 150 */ 273, 274, 275, 276, 136, 150, 74, 280, 281, 242, + /* 160 */ 109, 57, 97, 163, 164, 165, 166, 167, 168, 169, + /* 170 */ 170, 171, 172, 173, 109, 217, 275, 256, 74, 174, + /* 180 */ 211, 12, 13, 14, 226, 185, 285, 286, 287, 20, + /* 190 */ 289, 22, 275, 185, 220, 185, 49, 146, 224, 235, + /* 200 */ 242, 97, 285, 286, 287, 241, 289, 38, 190, 191, + /* 210 */ 246, 146, 20, 109, 163, 164, 165, 166, 167, 168, + /* 220 */ 169, 170, 171, 172, 173, 256, 57, 0, 163, 164, + /* 230 */ 165, 166, 167, 168, 169, 170, 171, 172, 173, 145, + /* 240 */ 20, 147, 22, 74, 164, 165, 1, 2, 21, 185, + /* 250 */ 146, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 260 */ 40, 12, 13, 14, 15, 16, 97, 163, 164, 165, + /* 270 */ 166, 167, 168, 169, 170, 171, 172, 173, 109, 185, + /* 280 */ 20, 242, 219, 12, 13, 18, 216, 20, 249, 185, + /* 290 */ 52, 20, 54, 22, 27, 232, 58, 30, 211, 61, + /* 300 */ 230, 63, 64, 240, 66, 228, 39, 237, 231, 38, + /* 310 */ 12, 13, 14, 15, 16, 146, 21, 183, 184, 24, + /* 320 */ 25, 26, 27, 28, 29, 30, 31, 32, 57, 0, + /* 330 */ 67, 163, 163, 164, 165, 166, 167, 168, 169, 170, + /* 340 */ 171, 172, 173, 256, 20, 74, 61, 50, 50, 47, + /* 350 */ 65, 38, 49, 24, 25, 26, 27, 28, 29, 30, + /* 360 */ 31, 32, 194, 195, 196, 197, 198, 223, 97, 225, + /* 370 */ 57, 20, 87, 75, 35, 73, 113, 114, 76, 112, + /* 380 */ 109, 83, 115, 116, 117, 118, 119, 217, 121, 122, + /* 390 */ 123, 124, 125, 126, 127, 128, 129, 130, 131, 217, + /* 400 */ 61, 12, 13, 85, 65, 270, 217, 252, 226, 20, + /* 410 */ 270, 22, 242, 258, 235, 226, 77, 146, 79, 80, + /* 420 */ 241, 82, 235, 288, 242, 246, 87, 38, 288, 242, + /* 430 */ 132, 242, 164, 165, 163, 164, 165, 166, 167, 168, + /* 440 */ 169, 170, 171, 172, 173, 275, 57, 0, 150, 12, + /* 450 */ 13, 14, 15, 16, 284, 285, 286, 287, 0, 289, + /* 460 */ 163, 274, 138, 74, 20, 12, 13, 14, 15, 16, + /* 470 */ 270, 216, 174, 175, 176, 177, 178, 179, 180, 181, + /* 480 */ 182, 12, 13, 14, 15, 16, 97, 50, 288, 138, + /* 490 */ 14, 78, 237, 234, 81, 4, 20, 211, 109, 52, + /* 500 */ 53, 54, 55, 56, 245, 58, 59, 60, 61, 62, + /* 510 */ 63, 64, 65, 66, 67, 68, 69, 70, 78, 61, + /* 520 */ 83, 81, 57, 65, 88, 89, 90, 91, 92, 93, + /* 530 */ 94, 95, 96, 97, 98, 146, 100, 101, 102, 103, + /* 540 */ 104, 105, 256, 211, 75, 87, 18, 236, 208, 0, + /* 550 */ 43, 23, 163, 164, 165, 166, 167, 168, 169, 170, + /* 560 */ 171, 172, 173, 35, 106, 107, 108, 2, 110, 132, + /* 570 */ 78, 3, 2, 81, 22, 211, 48, 12, 13, 14, + /* 580 */ 15, 16, 12, 13, 14, 15, 16, 150, 256, 235, + /* 590 */ 38, 236, 139, 33, 0, 236, 36, 243, 49, 217, + /* 600 */ 217, 261, 42, 261, 44, 45, 46, 47, 226, 226, + /* 610 */ 235, 174, 175, 176, 177, 178, 179, 180, 181, 182, + /* 620 */ 256, 246, 236, 236, 242, 242, 142, 227, 236, 217, + /* 630 */ 12, 13, 292, 73, 292, 235, 76, 211, 226, 111, + /* 640 */ 22, 157, 211, 243, 0, 305, 52, 305, 54, 309, + /* 650 */ 78, 309, 58, 81, 242, 61, 38, 63, 64, 206, + /* 660 */ 66, 12, 13, 14, 15, 16, 235, 139, 140, 141, + /* 670 */ 235, 143, 264, 242, 71, 57, 148, 186, 75, 0, + /* 680 */ 36, 246, 256, 252, 156, 211, 158, 256, 160, 161, + /* 690 */ 162, 184, 261, 133, 227, 135, 71, 137, 211, 211, + /* 700 */ 75, 22, 235, 272, 273, 274, 275, 276, 236, 235, + /* 710 */ 243, 280, 281, 185, 154, 97, 242, 12, 13, 14, + /* 720 */ 15, 16, 235, 292, 75, 21, 252, 109, 217, 242, + /* 730 */ 256, 211, 211, 224, 71, 71, 305, 226, 34, 252, + /* 740 */ 309, 211, 217, 256, 256, 211, 272, 273, 274, 275, + /* 750 */ 276, 226, 235, 242, 280, 281, 282, 0, 241, 272, + /* 760 */ 273, 274, 275, 246, 146, 235, 19, 242, 294, 201, + /* 770 */ 217, 212, 242, 211, 300, 301, 256, 256, 38, 22, + /* 780 */ 33, 163, 252, 36, 22, 0, 256, 211, 211, 42, + /* 790 */ 256, 44, 45, 46, 47, 242, 211, 71, 311, 211, + /* 800 */ 38, 75, 272, 273, 274, 275, 276, 22, 312, 71, + /* 810 */ 280, 281, 282, 75, 261, 211, 211, 303, 256, 57, + /* 820 */ 73, 211, 71, 76, 211, 71, 75, 38, 275, 75, + /* 830 */ 252, 301, 256, 256, 74, 245, 252, 74, 285, 286, + /* 840 */ 287, 256, 289, 138, 256, 292, 86, 84, 235, 109, + /* 850 */ 71, 211, 71, 106, 75, 242, 75, 214, 305, 97, + /* 860 */ 256, 256, 309, 297, 271, 252, 256, 203, 205, 256, + /* 870 */ 71, 109, 71, 71, 75, 235, 75, 75, 211, 71, + /* 880 */ 235, 134, 242, 75, 137, 272, 273, 274, 275, 276, + /* 890 */ 290, 293, 252, 280, 281, 282, 256, 306, 109, 152, + /* 900 */ 20, 154, 235, 71, 291, 38, 71, 75, 146, 242, + /* 910 */ 75, 217, 272, 273, 274, 275, 276, 36, 267, 252, + /* 920 */ 280, 281, 282, 256, 57, 163, 71, 38, 211, 221, + /* 930 */ 75, 291, 71, 71, 144, 262, 75, 75, 217, 272, + /* 940 */ 273, 274, 275, 276, 217, 120, 250, 280, 281, 282, + /* 950 */ 132, 248, 235, 211, 248, 20, 217, 266, 291, 242, + /* 960 */ 20, 260, 219, 20, 242, 253, 20, 219, 219, 252, + /* 970 */ 217, 219, 213, 256, 242, 266, 235, 235, 261, 235, + /* 980 */ 211, 235, 253, 153, 242, 235, 213, 217, 265, 272, + /* 990 */ 273, 274, 275, 235, 252, 221, 235, 260, 256, 235, + /* 1000 */ 235, 235, 235, 235, 235, 20, 211, 216, 216, 292, + /* 1010 */ 193, 242, 302, 242, 272, 273, 274, 275, 276, 192, + /* 1020 */ 57, 252, 305, 281, 200, 256, 309, 271, 298, 257, + /* 1030 */ 235, 256, 211, 302, 257, 299, 256, 242, 256, 199, + /* 1040 */ 211, 272, 273, 274, 275, 276, 188, 252, 184, 280, + /* 1050 */ 281, 256, 187, 242, 259, 20, 235, 270, 120, 207, + /* 1060 */ 204, 283, 202, 242, 235, 74, 257, 272, 273, 274, + /* 1070 */ 275, 242, 296, 252, 211, 279, 256, 256, 295, 256, + /* 1080 */ 135, 252, 216, 257, 256, 256, 242, 211, 259, 216, + /* 1090 */ 254, 253, 242, 272, 273, 274, 275, 313, 235, 211, + /* 1100 */ 307, 272, 273, 274, 275, 242, 308, 238, 231, 225, + /* 1110 */ 74, 235, 221, 217, 216, 252, 213, 263, 242, 256, + /* 1120 */ 218, 229, 259, 235, 229, 304, 209, 0, 252, 0, + /* 1130 */ 242, 64, 256, 211, 0, 272, 273, 274, 275, 38, + /* 1140 */ 252, 159, 38, 38, 256, 38, 159, 0, 272, 273, + /* 1150 */ 274, 275, 38, 38, 159, 0, 38, 235, 0, 211, + /* 1160 */ 272, 273, 274, 275, 242, 0, 38, 74, 150, 149, + /* 1170 */ 109, 146, 0, 0, 252, 53, 142, 0, 256, 120, + /* 1180 */ 86, 0, 0, 235, 0, 211, 0, 0, 0, 0, + /* 1190 */ 242, 0, 0, 0, 272, 273, 274, 275, 0, 0, + /* 1200 */ 252, 0, 0, 0, 256, 22, 0, 0, 0, 235, + /* 1210 */ 211, 0, 0, 0, 0, 0, 242, 0, 0, 0, + /* 1220 */ 272, 273, 274, 275, 0, 0, 252, 0, 0, 0, + /* 1230 */ 256, 0, 0, 43, 235, 211, 51, 0, 0, 43, + /* 1240 */ 0, 242, 38, 43, 211, 36, 272, 273, 274, 275, + /* 1250 */ 0, 252, 0, 43, 38, 256, 36, 36, 0, 235, + /* 1260 */ 38, 38, 36, 0, 0, 0, 242, 22, 235, 0, + /* 1270 */ 0, 272, 273, 274, 275, 242, 252, 43, 83, 211, + /* 1280 */ 256, 38, 38, 22, 38, 252, 38, 38, 0, 256, + /* 1290 */ 22, 38, 38, 0, 39, 22, 272, 273, 274, 275, + /* 1300 */ 38, 0, 22, 235, 71, 272, 273, 274, 275, 0, + /* 1310 */ 242, 81, 71, 211, 22, 20, 0, 155, 138, 38, + /* 1320 */ 252, 0, 151, 0, 256, 22, 0, 0, 43, 189, + /* 1330 */ 74, 71, 138, 86, 75, 138, 183, 235, 71, 189, + /* 1340 */ 272, 273, 274, 275, 242, 71, 75, 211, 189, 74, + /* 1350 */ 74, 74, 86, 75, 252, 71, 211, 74, 256, 4, + /* 1360 */ 71, 75, 211, 38, 2, 75, 75, 71, 86, 133, + /* 1370 */ 135, 235, 38, 71, 272, 273, 274, 275, 242, 38, + /* 1380 */ 235, 0, 38, 38, 38, 86, 235, 242, 252, 75, + /* 1390 */ 211, 74, 256, 242, 75, 75, 74, 252, 0, 75, + /* 1400 */ 43, 256, 163, 252, 74, 74, 74, 256, 272, 273, + /* 1410 */ 274, 275, 74, 84, 235, 136, 211, 272, 273, 274, + /* 1420 */ 275, 242, 86, 272, 273, 274, 275, 133, 86, 22, + /* 1430 */ 74, 252, 85, 75, 38, 256, 75, 38, 74, 38, + /* 1440 */ 235, 74, 61, 75, 38, 74, 65, 242, 75, 38, + /* 1450 */ 74, 272, 273, 274, 275, 75, 38, 252, 74, 99, + /* 1460 */ 22, 256, 99, 74, 99, 99, 87, 38, 87, 74, + /* 1470 */ 38, 74, 22, 51, 50, 72, 57, 272, 273, 274, + /* 1480 */ 275, 109, 38, 71, 38, 38, 38, 106, 107, 108, + /* 1490 */ 38, 110, 38, 38, 22, 38, 57, 38, 38, 38, + /* 1500 */ 38, 38, 38, 38, 0, 38, 36, 0, 0, 43, + /* 1510 */ 36, 38, 43, 38, 36, 0, 36, 38, 0, 43, + /* 1520 */ 43, 38, 37, 0, 0, 22, 21, 314, 22, 314, + /* 1530 */ 20, 22, 21, 314, 314, 314, 314, 314, 314, 314, + /* 1540 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1550 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1560 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1570 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1580 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1590 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1600 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1610 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1620 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1630 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1640 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1650 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1660 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1670 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1680 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1690 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1700 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1710 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1720 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1730 */ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, + /* 1740 */ 314, }; -#define YY_SHIFT_COUNT (546) +#define YY_SHIFT_COUNT (547) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (1524) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 572, 0, 51, 64, 64, 64, 64, 167, 64, 64, - /* 10 */ 245, 408, 100, 231, 245, 245, 245, 245, 245, 245, - /* 20 */ 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - /* 30 */ 245, 245, 245, 245, 192, 192, 192, 157, 678, 678, - /* 40 */ 62, 16, 16, 56, 678, 85, 85, 16, 16, 16, - /* 50 */ 16, 16, 16, 73, 26, 302, 56, 26, 16, 16, - /* 60 */ 26, 16, 26, 26, 26, 16, 309, 332, 454, 463, - /* 70 */ 463, 265, 445, 153, 134, 153, 153, 153, 153, 153, - /* 80 */ 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - /* 90 */ 153, 153, 153, 153, 85, 384, 326, 218, 240, 240, - /* 100 */ 240, 567, 218, 345, 26, 26, 26, 61, 334, 39, - /* 110 */ 39, 39, 39, 39, 39, 39, 732, 126, 608, 940, - /* 120 */ 77, 85, 117, 85, 90, 513, 626, 520, 562, 520, - /* 130 */ 568, 679, 644, 853, 863, 851, 754, 853, 853, 789, - /* 140 */ 804, 804, 853, 927, 931, 73, 345, 941, 73, 73, - /* 150 */ 853, 73, 977, 26, 26, 26, 26, 26, 26, 26, - /* 160 */ 26, 26, 26, 26, 851, 853, 977, 345, 927, 887, - /* 170 */ 931, 309, 345, 941, 309, 1023, 855, 868, 1004, 855, - /* 180 */ 868, 1004, 1004, 877, 886, 898, 903, 908, 345, 1070, - /* 190 */ 976, 892, 900, 906, 1034, 26, 868, 1004, 1004, 868, - /* 200 */ 1004, 984, 345, 941, 309, 61, 309, 345, 1062, 851, - /* 210 */ 334, 853, 309, 977, 1529, 1529, 1529, 1529, 1529, 431, - /* 220 */ 884, 530, 577, 1149, 1201, 13, 29, 46, 526, 295, - /* 230 */ 643, 643, 643, 643, 643, 643, 643, 34, 234, 426, - /* 240 */ 547, 438, 426, 426, 426, 19, 574, 436, 121, 683, - /* 250 */ 703, 704, 772, 788, 800, 673, 592, 682, 742, 694, - /* 260 */ 640, 649, 665, 744, 687, 755, 378, 806, 811, 816, - /* 270 */ 844, 850, 801, 832, 861, 862, 867, 904, 914, 921, - /* 280 */ 696, 564, 1157, 1161, 1099, 1164, 1127, 1008, 1138, 1139, - /* 290 */ 1144, 1027, 1186, 1150, 1151, 1033, 1187, 1154, 1193, 1156, - /* 300 */ 1196, 1123, 1049, 1051, 1094, 1060, 1206, 1207, 1158, 1068, - /* 310 */ 1217, 1218, 1133, 1224, 1226, 1227, 1228, 1230, 1231, 1238, - /* 320 */ 1240, 1241, 1242, 1243, 1249, 1250, 1251, 1252, 1140, 1253, - /* 330 */ 1261, 1264, 1267, 1268, 1269, 1256, 1271, 1272, 1279, 1281, - /* 340 */ 1282, 1283, 1285, 1286, 1287, 1247, 1291, 1244, 1292, 1293, - /* 350 */ 1260, 1258, 1262, 1312, 1275, 1280, 1274, 1315, 1284, 1288, - /* 360 */ 1276, 1320, 1294, 1289, 1278, 1331, 1333, 1338, 1339, 1259, - /* 370 */ 1265, 1305, 1277, 1323, 1347, 1311, 1313, 1314, 1316, 1295, - /* 380 */ 1277, 1317, 1318, 1350, 1335, 1353, 1336, 1325, 1359, 1345, - /* 390 */ 1330, 1369, 1348, 1371, 1351, 1354, 1375, 1239, 1223, 1340, - /* 400 */ 1379, 1233, 1358, 1248, 1254, 1381, 1384, 1255, 1387, 1319, - /* 410 */ 1346, 1263, 1326, 1327, 1202, 1321, 1328, 1332, 1334, 1337, - /* 420 */ 1341, 1342, 1329, 1308, 1344, 1343, 1203, 1349, 1352, 1324, - /* 430 */ 1219, 1355, 1356, 1357, 1360, 1221, 1402, 1374, 1378, 1382, - /* 440 */ 1383, 1385, 1390, 1411, 1257, 1361, 1362, 1363, 1365, 1366, - /* 450 */ 1368, 1370, 1367, 1372, 1290, 1376, 1422, 1386, 1298, 1377, - /* 460 */ 1364, 1373, 1380, 1412, 1388, 1389, 1392, 1395, 1397, 1391, - /* 470 */ 1393, 1398, 1396, 1394, 1406, 1399, 1400, 1414, 1403, 1401, - /* 480 */ 1415, 1404, 1405, 1407, 1408, 1409, 1427, 1410, 1413, 1416, - /* 490 */ 1417, 1418, 1419, 1420, 1277, 1433, 1421, 1429, 1423, 1424, - /* 500 */ 1428, 1425, 1426, 1443, 1444, 1445, 1446, 1447, 1434, 1431, - /* 510 */ 1295, 1448, 1277, 1451, 1452, 1453, 1456, 1457, 1460, 1463, - /* 520 */ 1471, 1464, 1467, 1466, 1500, 1472, 1469, 1468, 1512, 1475, - /* 530 */ 1478, 1473, 1515, 1479, 1482, 1476, 1520, 1483, 1485, 1523, - /* 540 */ 1524, 1435, 1439, 1503, 1505, 1440, 1508, + /* 0 */ 528, 0, 51, 65, 65, 65, 65, 104, 65, 65, + /* 10 */ 271, 389, 64, 169, 271, 271, 271, 271, 271, 271, + /* 20 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 30 */ 271, 271, 271, 271, 82, 82, 82, 8, 618, 618, + /* 40 */ 94, 26, 26, 10, 618, 80, 80, 26, 26, 26, + /* 50 */ 26, 26, 26, 12, 192, 260, 10, 192, 26, 26, + /* 60 */ 192, 26, 192, 192, 192, 26, 303, 267, 298, 437, + /* 70 */ 437, 295, 339, 762, 238, 762, 762, 762, 762, 762, + /* 80 */ 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, + /* 90 */ 762, 762, 762, 762, 80, 220, 147, 313, 324, 324, + /* 100 */ 324, 549, 313, 444, 192, 192, 192, 318, 465, 436, + /* 110 */ 436, 436, 436, 436, 436, 436, 747, 227, 594, 453, + /* 120 */ 168, 80, 285, 80, 18, 552, 351, 134, 507, 134, + /* 130 */ 476, 568, 491, 880, 881, 889, 790, 880, 880, 825, + /* 140 */ 818, 818, 880, 935, 940, 12, 444, 943, 12, 12, + /* 150 */ 880, 12, 946, 192, 192, 192, 192, 192, 192, 192, + /* 160 */ 192, 192, 192, 192, 889, 880, 946, 444, 935, 830, + /* 170 */ 940, 303, 444, 943, 303, 985, 817, 827, 963, 817, + /* 180 */ 827, 963, 963, 824, 840, 858, 865, 864, 444, 1035, + /* 190 */ 938, 852, 856, 860, 991, 192, 827, 963, 963, 827, + /* 200 */ 963, 945, 444, 943, 303, 318, 303, 444, 1036, 889, + /* 210 */ 465, 880, 303, 946, 1533, 1533, 1533, 1533, 1533, 447, + /* 220 */ 560, 329, 7, 458, 1381, 469, 565, 570, 649, 705, + /* 230 */ 249, 249, 249, 249, 249, 249, 249, 302, 263, 44, + /* 240 */ 6, 5, 44, 44, 44, 644, 484, 603, 413, 440, + /* 250 */ 492, 572, 679, 757, 785, 704, 625, 726, 738, 245, + /* 260 */ 268, 664, 663, 751, 297, 754, 760, 781, 799, 801, + /* 270 */ 802, 808, 740, 789, 779, 832, 835, 855, 861, 862, + /* 280 */ 763, 867, 1127, 1129, 1067, 1134, 1101, 982, 1104, 1105, + /* 290 */ 1107, 987, 1147, 1114, 1115, 995, 1155, 1118, 1158, 1128, + /* 300 */ 1165, 1093, 1018, 1020, 1061, 1025, 1172, 1173, 1122, 1034, + /* 310 */ 1177, 1184, 1094, 1181, 1182, 1186, 1187, 1188, 1189, 1191, + /* 320 */ 1192, 1193, 1198, 1199, 1201, 1202, 1203, 1211, 1212, 1059, + /* 330 */ 1213, 1214, 1215, 1217, 1218, 1219, 1183, 1206, 1207, 1208, + /* 340 */ 1224, 1225, 1227, 1228, 1229, 1231, 1190, 1232, 1185, 1237, + /* 350 */ 1238, 1204, 1209, 1196, 1240, 1216, 1220, 1200, 1250, 1222, + /* 360 */ 1221, 1210, 1252, 1223, 1226, 1234, 1258, 1263, 1264, 1265, + /* 370 */ 1195, 1230, 1243, 1233, 1245, 1269, 1244, 1246, 1248, 1249, + /* 380 */ 1241, 1233, 1253, 1254, 1270, 1261, 1288, 1268, 1255, 1293, + /* 390 */ 1273, 1262, 1301, 1280, 1309, 1292, 1295, 1316, 1180, 1162, + /* 400 */ 1281, 1321, 1171, 1303, 1194, 1235, 1323, 1326, 1197, 1327, + /* 410 */ 1256, 1285, 1236, 1260, 1267, 1140, 1259, 1274, 1271, 1275, + /* 420 */ 1276, 1277, 1278, 1284, 1247, 1283, 1289, 1150, 1286, 1290, + /* 430 */ 1266, 1153, 1296, 1282, 1291, 1302, 1159, 1355, 1325, 1334, + /* 440 */ 1341, 1344, 1345, 1346, 1362, 1239, 1299, 1314, 1319, 1317, + /* 450 */ 1322, 1320, 1324, 1330, 1331, 1279, 1332, 1398, 1357, 1294, + /* 460 */ 1338, 1329, 1336, 1342, 1407, 1356, 1347, 1358, 1396, 1399, + /* 470 */ 1364, 1361, 1401, 1367, 1368, 1406, 1371, 1373, 1411, 1376, + /* 480 */ 1380, 1418, 1384, 1360, 1363, 1365, 1366, 1438, 1379, 1389, + /* 490 */ 1429, 1372, 1395, 1397, 1432, 1233, 1450, 1422, 1424, 1419, + /* 500 */ 1403, 1412, 1444, 1446, 1447, 1448, 1452, 1454, 1455, 1472, + /* 510 */ 1439, 1241, 1457, 1233, 1459, 1460, 1461, 1462, 1463, 1464, + /* 520 */ 1465, 1504, 1467, 1470, 1466, 1507, 1473, 1474, 1469, 1508, + /* 530 */ 1475, 1478, 1476, 1515, 1479, 1480, 1477, 1518, 1483, 1485, + /* 540 */ 1523, 1524, 1503, 1505, 1506, 1509, 1511, 1510, }; #define YY_REDUCE_COUNT (218) #define YY_REDUCE_MIN (-276) -#define YY_REDUCE_MAX (1131) +#define YY_REDUCE_MAX (1205) static const short yy_reduce_ofst[] = { - /* 0 */ -101, 413, 467, 518, 573, 621, 633, -204, -156, 693, - /* 10 */ 72, 586, 702, 115, 740, 729, 794, 799, 828, 292, - /* 20 */ 561, 854, 896, 901, 907, 949, 961, 974, 1003, 1029, - /* 30 */ 1055, 1063, 1089, 1131, -192, 151, 767, -23, -234, -215, - /* 40 */ -225, 22, 287, -49, -253, -246, -233, -209, -40, 36, - /* 50 */ 139, 144, 202, -128, 138, 80, -4, 289, 247, 293, - /* 60 */ 189, 368, 310, 352, 357, 373, 88, -207, -276, -276, - /* 70 */ -276, -28, 124, -61, 97, 108, 164, 216, 390, 394, - /* 80 */ 396, 415, 442, 451, 468, 469, 470, 471, 479, 488, - /* 90 */ 489, 495, 499, 503, 263, 260, 60, -108, -189, 92, - /* 100 */ 281, 169, 455, 197, 274, 188, 381, -155, 395, -232, - /* 110 */ 246, 286, 430, 514, 527, 551, 282, 544, 578, 498, - /* 120 */ 504, 560, 581, 570, 540, 629, 580, 575, 575, 575, - /* 130 */ 622, 566, 583, 662, 614, 670, 637, 700, 706, 675, - /* 140 */ 698, 699, 724, 684, 710, 741, 717, 719, 759, 760, - /* 150 */ 766, 776, 787, 771, 773, 781, 783, 785, 790, 791, - /* 160 */ 792, 793, 795, 796, 802, 805, 819, 782, 769, 778, - /* 170 */ 777, 829, 807, 808, 831, 786, 757, 818, 820, 762, - /* 180 */ 821, 825, 826, 784, 797, 798, 803, 575, 846, 823, - /* 190 */ 830, 809, 812, 810, 835, 622, 858, 860, 865, 866, - /* 200 */ 869, 857, 882, 879, 917, 899, 918, 893, 902, 920, - /* 210 */ 919, 922, 929, 934, 888, 925, 926, 938, 952, + /* 0 */ 340, 431, 474, 530, 613, 640, 667, 717, -123, 769, + /* 10 */ -205, 742, 553, -180, 795, 821, 487, 829, 863, 876, + /* 20 */ 888, 922, 948, 974, 999, 1024, 1033, 1068, 1102, 1136, + /* 30 */ 1145, 1151, 1179, 1205, 170, -99, -83, -165, -235, -224, + /* 40 */ -256, -217, -151, 342, -227, -148, -234, -203, -106, -42, + /* 50 */ 182, 189, 382, 63, -36, 187, -164, -208, 383, 412, + /* 60 */ 179, 511, 400, 517, 467, 525, 70, -161, -276, -276, + /* 70 */ -276, -89, 259, -121, -26, -79, -31, 87, 286, 332, + /* 80 */ 364, 426, 488, 520, 521, 534, 562, 576, 577, 585, + /* 90 */ 588, 604, 605, 610, 155, -116, -216, -108, 135, 140, + /* 100 */ 200, 255, -91, 39, 354, 375, 435, 77, 144, 311, + /* 110 */ 355, 359, 386, 387, 392, 472, 408, 559, 509, 496, + /* 120 */ 514, 578, 590, 584, 566, 643, 593, 600, 600, 600, + /* 130 */ 645, 591, 598, 694, 651, 708, 673, 721, 727, 696, + /* 140 */ 703, 706, 739, 691, 701, 743, 722, 712, 748, 749, + /* 150 */ 753, 752, 759, 741, 744, 746, 750, 758, 761, 764, + /* 160 */ 765, 766, 767, 768, 774, 770, 773, 732, 709, 723, + /* 170 */ 737, 791, 771, 729, 792, 756, 710, 772, 775, 731, + /* 180 */ 777, 780, 782, 736, 730, 776, 783, 600, 811, 787, + /* 190 */ 778, 784, 798, 793, 796, 645, 809, 820, 823, 826, + /* 200 */ 828, 836, 844, 838, 866, 877, 873, 850, 869, 891, + /* 210 */ 884, 896, 898, 903, 854, 892, 895, 902, 917, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 10 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 20 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 30 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 40 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 50 */ 1215, 1215, 1215, 1274, 1215, 1215, 1215, 1215, 1215, 1215, - /* 60 */ 1215, 1215, 1215, 1215, 1215, 1215, 1272, 1411, 1215, 1546, - /* 70 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 80 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 90 */ 1215, 1215, 1215, 1215, 1215, 1215, 1274, 1215, 1557, 1557, - /* 100 */ 1557, 1272, 1215, 1215, 1215, 1215, 1215, 1367, 1215, 1215, - /* 110 */ 1215, 1215, 1215, 1215, 1215, 1215, 1445, 1215, 1215, 1621, - /* 120 */ 1215, 1215, 1320, 1215, 1581, 1215, 1573, 1549, 1563, 1550, - /* 130 */ 1215, 1606, 1566, 1215, 1215, 1215, 1437, 1215, 1215, 1416, - /* 140 */ 1413, 1413, 1215, 1215, 1215, 1274, 1215, 1215, 1274, 1274, - /* 150 */ 1215, 1274, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 160 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1447, - /* 170 */ 1215, 1272, 1215, 1215, 1272, 1215, 1588, 1586, 1215, 1588, - /* 180 */ 1586, 1215, 1215, 1600, 1596, 1579, 1577, 1563, 1215, 1215, - /* 190 */ 1215, 1624, 1612, 1608, 1215, 1215, 1586, 1215, 1215, 1586, - /* 200 */ 1215, 1424, 1215, 1215, 1272, 1215, 1272, 1215, 1336, 1215, - /* 210 */ 1215, 1215, 1272, 1215, 1439, 1370, 1370, 1275, 1220, 1215, - /* 220 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1509, - /* 230 */ 1510, 1599, 1598, 1509, 1523, 1522, 1521, 1215, 1215, 1504, - /* 240 */ 1215, 1215, 1505, 1503, 1502, 1215, 1215, 1215, 1215, 1215, - /* 250 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1547, - /* 260 */ 1215, 1609, 1613, 1215, 1215, 1215, 1484, 1215, 1215, 1215, - /* 270 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 280 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 290 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 300 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 310 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 320 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 330 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 340 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 350 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 360 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 370 */ 1215, 1215, 1381, 1215, 1215, 1215, 1215, 1215, 1215, 1301, - /* 380 */ 1300, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 390 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 400 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 410 */ 1215, 1215, 1570, 1580, 1215, 1215, 1215, 1215, 1215, 1215, - /* 420 */ 1215, 1215, 1215, 1484, 1215, 1597, 1215, 1556, 1552, 1215, - /* 430 */ 1215, 1548, 1215, 1215, 1607, 1215, 1215, 1215, 1215, 1215, - /* 440 */ 1215, 1215, 1215, 1542, 1215, 1215, 1215, 1215, 1215, 1215, - /* 450 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 460 */ 1215, 1483, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1364, - /* 470 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 480 */ 1215, 1215, 1349, 1347, 1346, 1345, 1215, 1342, 1215, 1215, - /* 490 */ 1215, 1215, 1215, 1215, 1372, 1215, 1215, 1215, 1215, 1215, - /* 500 */ 1295, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 510 */ 1286, 1215, 1285, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 520 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 530 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, - /* 540 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, + /* 0 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 10 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 20 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 30 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 40 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 50 */ 1217, 1217, 1217, 1276, 1217, 1217, 1217, 1217, 1217, 1217, + /* 60 */ 1217, 1217, 1217, 1217, 1217, 1217, 1274, 1414, 1217, 1549, + /* 70 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 80 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 90 */ 1217, 1217, 1217, 1217, 1217, 1217, 1276, 1217, 1560, 1560, + /* 100 */ 1560, 1274, 1217, 1217, 1217, 1217, 1217, 1369, 1217, 1217, + /* 110 */ 1217, 1217, 1217, 1217, 1217, 1217, 1448, 1217, 1217, 1624, + /* 120 */ 1217, 1217, 1322, 1217, 1584, 1217, 1576, 1552, 1566, 1553, + /* 130 */ 1217, 1609, 1569, 1217, 1217, 1217, 1440, 1217, 1217, 1419, + /* 140 */ 1416, 1416, 1217, 1217, 1217, 1276, 1217, 1217, 1276, 1276, + /* 150 */ 1217, 1276, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 160 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1450, + /* 170 */ 1217, 1274, 1217, 1217, 1274, 1217, 1591, 1589, 1217, 1591, + /* 180 */ 1589, 1217, 1217, 1603, 1599, 1582, 1580, 1566, 1217, 1217, + /* 190 */ 1217, 1627, 1615, 1611, 1217, 1217, 1589, 1217, 1217, 1589, + /* 200 */ 1217, 1427, 1217, 1217, 1274, 1217, 1274, 1217, 1338, 1217, + /* 210 */ 1217, 1217, 1274, 1217, 1442, 1372, 1372, 1277, 1222, 1217, + /* 220 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1512, + /* 230 */ 1513, 1602, 1601, 1512, 1526, 1525, 1524, 1217, 1217, 1507, + /* 240 */ 1217, 1217, 1508, 1506, 1505, 1217, 1217, 1217, 1217, 1217, + /* 250 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1550, + /* 260 */ 1217, 1612, 1616, 1217, 1217, 1217, 1487, 1217, 1217, 1217, + /* 270 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 280 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 290 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 300 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 310 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 320 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 330 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 340 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 350 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 360 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 370 */ 1217, 1217, 1217, 1383, 1217, 1217, 1217, 1217, 1217, 1217, + /* 380 */ 1303, 1302, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 390 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 400 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 410 */ 1217, 1217, 1217, 1573, 1583, 1217, 1217, 1217, 1217, 1217, + /* 420 */ 1217, 1217, 1217, 1217, 1487, 1217, 1600, 1217, 1559, 1555, + /* 430 */ 1217, 1217, 1551, 1217, 1217, 1610, 1217, 1217, 1217, 1217, + /* 440 */ 1217, 1217, 1217, 1217, 1545, 1217, 1217, 1217, 1217, 1217, + /* 450 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 460 */ 1217, 1217, 1486, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 470 */ 1366, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 480 */ 1217, 1217, 1217, 1351, 1349, 1348, 1347, 1217, 1344, 1217, + /* 490 */ 1217, 1217, 1217, 1217, 1217, 1374, 1217, 1217, 1217, 1217, + /* 500 */ 1217, 1297, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 510 */ 1217, 1288, 1217, 1287, 1217, 1217, 1217, 1217, 1217, 1217, + /* 520 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 530 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, + /* 540 */ 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217, }; /********** End of lemon-generated parsing tables *****************************/ @@ -916,194 +917,195 @@ static const char *const yyTokenName[] = { /* 122 */ "APPS", /* 123 */ "CONNECTIONS", /* 124 */ "LICENCE", - /* 125 */ "QUERIES", - /* 126 */ "SCORES", - /* 127 */ "TOPICS", - /* 128 */ "VARIABLES", - /* 129 */ "BNODES", - /* 130 */ "SNODES", - /* 131 */ "LIKE", - /* 132 */ "INDEX", - /* 133 */ "FULLTEXT", - /* 134 */ "FUNCTION", - /* 135 */ "INTERVAL", - /* 136 */ "TOPIC", - /* 137 */ "AS", - /* 138 */ "DESC", - /* 139 */ "DESCRIBE", - /* 140 */ "RESET", - /* 141 */ "QUERY", - /* 142 */ "EXPLAIN", - /* 143 */ "ANALYZE", - /* 144 */ "VERBOSE", - /* 145 */ "NK_BOOL", - /* 146 */ "RATIO", - /* 147 */ "COMPACT", - /* 148 */ "VNODES", - /* 149 */ "IN", - /* 150 */ "OUTPUTTYPE", - /* 151 */ "AGGREGATE", - /* 152 */ "BUFSIZE", - /* 153 */ "STREAM", - /* 154 */ "INTO", - /* 155 */ "KILL", - /* 156 */ "CONNECTION", - /* 157 */ "MERGE", - /* 158 */ "VGROUP", - /* 159 */ "REDISTRIBUTE", - /* 160 */ "SPLIT", - /* 161 */ "SYNCDB", - /* 162 */ "NULL", - /* 163 */ "FIRST", - /* 164 */ "LAST", - /* 165 */ "NOW", - /* 166 */ "ROWTS", - /* 167 */ "TBNAME", - /* 168 */ "QSTARTTS", - /* 169 */ "QENDTS", - /* 170 */ "WSTARTTS", - /* 171 */ "WENDTS", - /* 172 */ "WDURATION", - /* 173 */ "BETWEEN", - /* 174 */ "IS", - /* 175 */ "NK_LT", - /* 176 */ "NK_GT", - /* 177 */ "NK_LE", - /* 178 */ "NK_GE", - /* 179 */ "NK_NE", - /* 180 */ "MATCH", - /* 181 */ "NMATCH", - /* 182 */ "JOIN", - /* 183 */ "INNER", - /* 184 */ "SELECT", - /* 185 */ "DISTINCT", - /* 186 */ "WHERE", - /* 187 */ "PARTITION", - /* 188 */ "BY", - /* 189 */ "SESSION", - /* 190 */ "STATE_WINDOW", - /* 191 */ "SLIDING", - /* 192 */ "FILL", - /* 193 */ "VALUE", - /* 194 */ "NONE", - /* 195 */ "PREV", - /* 196 */ "LINEAR", - /* 197 */ "NEXT", - /* 198 */ "GROUP", - /* 199 */ "HAVING", - /* 200 */ "ORDER", - /* 201 */ "SLIMIT", - /* 202 */ "SOFFSET", - /* 203 */ "LIMIT", - /* 204 */ "OFFSET", - /* 205 */ "ASC", - /* 206 */ "NULLS", - /* 207 */ "cmd", - /* 208 */ "account_options", - /* 209 */ "alter_account_options", - /* 210 */ "literal", - /* 211 */ "alter_account_option", - /* 212 */ "user_name", - /* 213 */ "dnode_endpoint", - /* 214 */ "dnode_host_name", - /* 215 */ "not_exists_opt", - /* 216 */ "db_name", - /* 217 */ "db_options", - /* 218 */ "exists_opt", - /* 219 */ "alter_db_options", - /* 220 */ "integer_list", - /* 221 */ "variable_list", - /* 222 */ "retention_list", - /* 223 */ "alter_db_option", - /* 224 */ "retention", - /* 225 */ "full_table_name", - /* 226 */ "column_def_list", - /* 227 */ "tags_def_opt", - /* 228 */ "table_options", - /* 229 */ "multi_create_clause", - /* 230 */ "tags_def", - /* 231 */ "multi_drop_clause", - /* 232 */ "alter_table_clause", - /* 233 */ "alter_table_options", - /* 234 */ "column_name", - /* 235 */ "type_name", - /* 236 */ "create_subtable_clause", - /* 237 */ "specific_tags_opt", - /* 238 */ "literal_list", - /* 239 */ "drop_table_clause", - /* 240 */ "col_name_list", - /* 241 */ "table_name", - /* 242 */ "column_def", - /* 243 */ "func_name_list", - /* 244 */ "alter_table_option", - /* 245 */ "col_name", - /* 246 */ "db_name_cond_opt", - /* 247 */ "like_pattern_opt", - /* 248 */ "table_name_cond", - /* 249 */ "from_db_opt", - /* 250 */ "func_name", - /* 251 */ "function_name", - /* 252 */ "index_name", - /* 253 */ "index_options", - /* 254 */ "func_list", - /* 255 */ "duration_literal", - /* 256 */ "sliding_opt", - /* 257 */ "func", - /* 258 */ "expression_list", - /* 259 */ "topic_name", - /* 260 */ "query_expression", - /* 261 */ "analyze_opt", - /* 262 */ "explain_options", - /* 263 */ "agg_func_opt", - /* 264 */ "bufsize_opt", - /* 265 */ "stream_name", - /* 266 */ "dnode_list", - /* 267 */ "signed", - /* 268 */ "signed_literal", - /* 269 */ "table_alias", - /* 270 */ "column_alias", - /* 271 */ "expression", - /* 272 */ "pseudo_column", - /* 273 */ "column_reference", - /* 274 */ "subquery", - /* 275 */ "predicate", - /* 276 */ "compare_op", - /* 277 */ "in_op", - /* 278 */ "in_predicate_value", - /* 279 */ "boolean_value_expression", - /* 280 */ "boolean_primary", - /* 281 */ "common_expression", - /* 282 */ "from_clause", - /* 283 */ "table_reference_list", - /* 284 */ "table_reference", - /* 285 */ "table_primary", - /* 286 */ "joined_table", - /* 287 */ "alias_opt", - /* 288 */ "parenthesized_joined_table", - /* 289 */ "join_type", - /* 290 */ "search_condition", - /* 291 */ "query_specification", - /* 292 */ "set_quantifier_opt", - /* 293 */ "select_list", - /* 294 */ "where_clause_opt", - /* 295 */ "partition_by_clause_opt", - /* 296 */ "twindow_clause_opt", - /* 297 */ "group_by_clause_opt", - /* 298 */ "having_clause_opt", - /* 299 */ "select_sublist", - /* 300 */ "select_item", - /* 301 */ "fill_opt", - /* 302 */ "fill_mode", - /* 303 */ "group_by_list", - /* 304 */ "query_expression_body", - /* 305 */ "order_by_clause_opt", - /* 306 */ "slimit_clause_opt", - /* 307 */ "limit_clause_opt", - /* 308 */ "query_primary", - /* 309 */ "sort_specification_list", - /* 310 */ "sort_specification", - /* 311 */ "ordering_specification_opt", - /* 312 */ "null_ordering_opt", + /* 125 */ "GRANTS", + /* 126 */ "QUERIES", + /* 127 */ "SCORES", + /* 128 */ "TOPICS", + /* 129 */ "VARIABLES", + /* 130 */ "BNODES", + /* 131 */ "SNODES", + /* 132 */ "LIKE", + /* 133 */ "INDEX", + /* 134 */ "FULLTEXT", + /* 135 */ "FUNCTION", + /* 136 */ "INTERVAL", + /* 137 */ "TOPIC", + /* 138 */ "AS", + /* 139 */ "DESC", + /* 140 */ "DESCRIBE", + /* 141 */ "RESET", + /* 142 */ "QUERY", + /* 143 */ "EXPLAIN", + /* 144 */ "ANALYZE", + /* 145 */ "VERBOSE", + /* 146 */ "NK_BOOL", + /* 147 */ "RATIO", + /* 148 */ "COMPACT", + /* 149 */ "VNODES", + /* 150 */ "IN", + /* 151 */ "OUTPUTTYPE", + /* 152 */ "AGGREGATE", + /* 153 */ "BUFSIZE", + /* 154 */ "STREAM", + /* 155 */ "INTO", + /* 156 */ "KILL", + /* 157 */ "CONNECTION", + /* 158 */ "MERGE", + /* 159 */ "VGROUP", + /* 160 */ "REDISTRIBUTE", + /* 161 */ "SPLIT", + /* 162 */ "SYNCDB", + /* 163 */ "NULL", + /* 164 */ "FIRST", + /* 165 */ "LAST", + /* 166 */ "NOW", + /* 167 */ "ROWTS", + /* 168 */ "TBNAME", + /* 169 */ "QSTARTTS", + /* 170 */ "QENDTS", + /* 171 */ "WSTARTTS", + /* 172 */ "WENDTS", + /* 173 */ "WDURATION", + /* 174 */ "BETWEEN", + /* 175 */ "IS", + /* 176 */ "NK_LT", + /* 177 */ "NK_GT", + /* 178 */ "NK_LE", + /* 179 */ "NK_GE", + /* 180 */ "NK_NE", + /* 181 */ "MATCH", + /* 182 */ "NMATCH", + /* 183 */ "JOIN", + /* 184 */ "INNER", + /* 185 */ "SELECT", + /* 186 */ "DISTINCT", + /* 187 */ "WHERE", + /* 188 */ "PARTITION", + /* 189 */ "BY", + /* 190 */ "SESSION", + /* 191 */ "STATE_WINDOW", + /* 192 */ "SLIDING", + /* 193 */ "FILL", + /* 194 */ "VALUE", + /* 195 */ "NONE", + /* 196 */ "PREV", + /* 197 */ "LINEAR", + /* 198 */ "NEXT", + /* 199 */ "GROUP", + /* 200 */ "HAVING", + /* 201 */ "ORDER", + /* 202 */ "SLIMIT", + /* 203 */ "SOFFSET", + /* 204 */ "LIMIT", + /* 205 */ "OFFSET", + /* 206 */ "ASC", + /* 207 */ "NULLS", + /* 208 */ "cmd", + /* 209 */ "account_options", + /* 210 */ "alter_account_options", + /* 211 */ "literal", + /* 212 */ "alter_account_option", + /* 213 */ "user_name", + /* 214 */ "dnode_endpoint", + /* 215 */ "dnode_host_name", + /* 216 */ "not_exists_opt", + /* 217 */ "db_name", + /* 218 */ "db_options", + /* 219 */ "exists_opt", + /* 220 */ "alter_db_options", + /* 221 */ "integer_list", + /* 222 */ "variable_list", + /* 223 */ "retention_list", + /* 224 */ "alter_db_option", + /* 225 */ "retention", + /* 226 */ "full_table_name", + /* 227 */ "column_def_list", + /* 228 */ "tags_def_opt", + /* 229 */ "table_options", + /* 230 */ "multi_create_clause", + /* 231 */ "tags_def", + /* 232 */ "multi_drop_clause", + /* 233 */ "alter_table_clause", + /* 234 */ "alter_table_options", + /* 235 */ "column_name", + /* 236 */ "type_name", + /* 237 */ "create_subtable_clause", + /* 238 */ "specific_tags_opt", + /* 239 */ "literal_list", + /* 240 */ "drop_table_clause", + /* 241 */ "col_name_list", + /* 242 */ "table_name", + /* 243 */ "column_def", + /* 244 */ "func_name_list", + /* 245 */ "alter_table_option", + /* 246 */ "col_name", + /* 247 */ "db_name_cond_opt", + /* 248 */ "like_pattern_opt", + /* 249 */ "table_name_cond", + /* 250 */ "from_db_opt", + /* 251 */ "func_name", + /* 252 */ "function_name", + /* 253 */ "index_name", + /* 254 */ "index_options", + /* 255 */ "func_list", + /* 256 */ "duration_literal", + /* 257 */ "sliding_opt", + /* 258 */ "func", + /* 259 */ "expression_list", + /* 260 */ "topic_name", + /* 261 */ "query_expression", + /* 262 */ "analyze_opt", + /* 263 */ "explain_options", + /* 264 */ "agg_func_opt", + /* 265 */ "bufsize_opt", + /* 266 */ "stream_name", + /* 267 */ "dnode_list", + /* 268 */ "signed", + /* 269 */ "signed_literal", + /* 270 */ "table_alias", + /* 271 */ "column_alias", + /* 272 */ "expression", + /* 273 */ "pseudo_column", + /* 274 */ "column_reference", + /* 275 */ "subquery", + /* 276 */ "predicate", + /* 277 */ "compare_op", + /* 278 */ "in_op", + /* 279 */ "in_predicate_value", + /* 280 */ "boolean_value_expression", + /* 281 */ "boolean_primary", + /* 282 */ "common_expression", + /* 283 */ "from_clause", + /* 284 */ "table_reference_list", + /* 285 */ "table_reference", + /* 286 */ "table_primary", + /* 287 */ "joined_table", + /* 288 */ "alias_opt", + /* 289 */ "parenthesized_joined_table", + /* 290 */ "join_type", + /* 291 */ "search_condition", + /* 292 */ "query_specification", + /* 293 */ "set_quantifier_opt", + /* 294 */ "select_list", + /* 295 */ "where_clause_opt", + /* 296 */ "partition_by_clause_opt", + /* 297 */ "twindow_clause_opt", + /* 298 */ "group_by_clause_opt", + /* 299 */ "having_clause_opt", + /* 300 */ "select_sublist", + /* 301 */ "select_item", + /* 302 */ "fill_opt", + /* 303 */ "fill_mode", + /* 304 */ "group_by_list", + /* 305 */ "query_expression_body", + /* 306 */ "order_by_clause_opt", + /* 307 */ "slimit_clause_opt", + /* 308 */ "limit_clause_opt", + /* 309 */ "query_primary", + /* 310 */ "sort_specification_list", + /* 311 */ "sort_specification", + /* 312 */ "ordering_specification_opt", + /* 313 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1295,231 +1297,232 @@ static const char *const yyRuleName[] = { /* 181 */ "cmd ::= SHOW APPS", /* 182 */ "cmd ::= SHOW CONNECTIONS", /* 183 */ "cmd ::= SHOW LICENCE", - /* 184 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 185 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 186 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 187 */ "cmd ::= SHOW QUERIES", - /* 188 */ "cmd ::= SHOW SCORES", - /* 189 */ "cmd ::= SHOW TOPICS", - /* 190 */ "cmd ::= SHOW VARIABLES", - /* 191 */ "cmd ::= SHOW BNODES", - /* 192 */ "cmd ::= SHOW SNODES", - /* 193 */ "db_name_cond_opt ::=", - /* 194 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 195 */ "like_pattern_opt ::=", - /* 196 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 197 */ "table_name_cond ::= table_name", - /* 198 */ "from_db_opt ::=", - /* 199 */ "from_db_opt ::= FROM db_name", - /* 200 */ "func_name_list ::= func_name", - /* 201 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 202 */ "func_name ::= function_name", - /* 203 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 204 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 205 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 206 */ "index_options ::=", - /* 207 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 208 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 209 */ "func_list ::= func", - /* 210 */ "func_list ::= func_list NK_COMMA func", - /* 211 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 212 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 213 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 214 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 215 */ "cmd ::= DESC full_table_name", - /* 216 */ "cmd ::= DESCRIBE full_table_name", - /* 217 */ "cmd ::= RESET QUERY CACHE", - /* 218 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 219 */ "analyze_opt ::=", - /* 220 */ "analyze_opt ::= ANALYZE", - /* 221 */ "explain_options ::=", - /* 222 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 223 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 224 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 225 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 226 */ "cmd ::= DROP FUNCTION function_name", - /* 227 */ "agg_func_opt ::=", - /* 228 */ "agg_func_opt ::= AGGREGATE", - /* 229 */ "bufsize_opt ::=", - /* 230 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 231 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", - /* 232 */ "cmd ::= DROP STREAM stream_name", - /* 233 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 234 */ "cmd ::= KILL QUERY NK_INTEGER", - /* 235 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 236 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 237 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 238 */ "dnode_list ::= DNODE NK_INTEGER", - /* 239 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 240 */ "cmd ::= SYNCDB db_name REPLICA", - /* 241 */ "cmd ::= query_expression", - /* 242 */ "literal ::= NK_INTEGER", - /* 243 */ "literal ::= NK_FLOAT", - /* 244 */ "literal ::= NK_STRING", - /* 245 */ "literal ::= NK_BOOL", - /* 246 */ "literal ::= TIMESTAMP NK_STRING", - /* 247 */ "literal ::= duration_literal", - /* 248 */ "literal ::= NULL", - /* 249 */ "duration_literal ::= NK_VARIABLE", - /* 250 */ "signed ::= NK_INTEGER", - /* 251 */ "signed ::= NK_PLUS NK_INTEGER", - /* 252 */ "signed ::= NK_MINUS NK_INTEGER", - /* 253 */ "signed ::= NK_FLOAT", - /* 254 */ "signed ::= NK_PLUS NK_FLOAT", - /* 255 */ "signed ::= NK_MINUS NK_FLOAT", - /* 256 */ "signed_literal ::= signed", - /* 257 */ "signed_literal ::= NK_STRING", - /* 258 */ "signed_literal ::= NK_BOOL", - /* 259 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 260 */ "signed_literal ::= duration_literal", - /* 261 */ "signed_literal ::= NULL", - /* 262 */ "literal_list ::= signed_literal", - /* 263 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 264 */ "db_name ::= NK_ID", - /* 265 */ "table_name ::= NK_ID", - /* 266 */ "column_name ::= NK_ID", - /* 267 */ "function_name ::= NK_ID", - /* 268 */ "function_name ::= FIRST", - /* 269 */ "function_name ::= LAST", - /* 270 */ "table_alias ::= NK_ID", - /* 271 */ "column_alias ::= NK_ID", - /* 272 */ "user_name ::= NK_ID", - /* 273 */ "index_name ::= NK_ID", - /* 274 */ "topic_name ::= NK_ID", - /* 275 */ "stream_name ::= NK_ID", - /* 276 */ "expression ::= literal", - /* 277 */ "expression ::= pseudo_column", - /* 278 */ "expression ::= column_reference", - /* 279 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 280 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 281 */ "expression ::= function_name NK_LP expression AS type_name NK_RP", - /* 282 */ "expression ::= subquery", - /* 283 */ "expression ::= NK_LP expression NK_RP", - /* 284 */ "expression ::= NK_PLUS expression", - /* 285 */ "expression ::= NK_MINUS expression", - /* 286 */ "expression ::= expression NK_PLUS expression", - /* 287 */ "expression ::= expression NK_MINUS expression", - /* 288 */ "expression ::= expression NK_STAR expression", - /* 289 */ "expression ::= expression NK_SLASH expression", - /* 290 */ "expression ::= expression NK_REM expression", - /* 291 */ "expression_list ::= expression", - /* 292 */ "expression_list ::= expression_list NK_COMMA expression", - /* 293 */ "column_reference ::= column_name", - /* 294 */ "column_reference ::= table_name NK_DOT column_name", - /* 295 */ "pseudo_column ::= NOW", - /* 296 */ "pseudo_column ::= ROWTS", - /* 297 */ "pseudo_column ::= TBNAME", - /* 298 */ "pseudo_column ::= QSTARTTS", - /* 299 */ "pseudo_column ::= QENDTS", - /* 300 */ "pseudo_column ::= WSTARTTS", - /* 301 */ "pseudo_column ::= WENDTS", - /* 302 */ "pseudo_column ::= WDURATION", - /* 303 */ "predicate ::= expression compare_op expression", - /* 304 */ "predicate ::= expression BETWEEN expression AND expression", - /* 305 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 306 */ "predicate ::= expression IS NULL", - /* 307 */ "predicate ::= expression IS NOT NULL", - /* 308 */ "predicate ::= expression in_op in_predicate_value", - /* 309 */ "compare_op ::= NK_LT", - /* 310 */ "compare_op ::= NK_GT", - /* 311 */ "compare_op ::= NK_LE", - /* 312 */ "compare_op ::= NK_GE", - /* 313 */ "compare_op ::= NK_NE", - /* 314 */ "compare_op ::= NK_EQ", - /* 315 */ "compare_op ::= LIKE", - /* 316 */ "compare_op ::= NOT LIKE", - /* 317 */ "compare_op ::= MATCH", - /* 318 */ "compare_op ::= NMATCH", - /* 319 */ "in_op ::= IN", - /* 320 */ "in_op ::= NOT IN", - /* 321 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 322 */ "boolean_value_expression ::= boolean_primary", - /* 323 */ "boolean_value_expression ::= NOT boolean_primary", - /* 324 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 325 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 326 */ "boolean_primary ::= predicate", - /* 327 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 328 */ "common_expression ::= expression", - /* 329 */ "common_expression ::= boolean_value_expression", - /* 330 */ "from_clause ::= FROM table_reference_list", - /* 331 */ "table_reference_list ::= table_reference", - /* 332 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 333 */ "table_reference ::= table_primary", - /* 334 */ "table_reference ::= joined_table", - /* 335 */ "table_primary ::= table_name alias_opt", - /* 336 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 337 */ "table_primary ::= subquery alias_opt", - /* 338 */ "table_primary ::= parenthesized_joined_table", - /* 339 */ "alias_opt ::=", - /* 340 */ "alias_opt ::= table_alias", - /* 341 */ "alias_opt ::= AS table_alias", - /* 342 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 343 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 344 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 345 */ "join_type ::=", - /* 346 */ "join_type ::= INNER", - /* 347 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 348 */ "set_quantifier_opt ::=", - /* 349 */ "set_quantifier_opt ::= DISTINCT", - /* 350 */ "set_quantifier_opt ::= ALL", - /* 351 */ "select_list ::= NK_STAR", - /* 352 */ "select_list ::= select_sublist", - /* 353 */ "select_sublist ::= select_item", - /* 354 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 355 */ "select_item ::= common_expression", - /* 356 */ "select_item ::= common_expression column_alias", - /* 357 */ "select_item ::= common_expression AS column_alias", - /* 358 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 359 */ "where_clause_opt ::=", - /* 360 */ "where_clause_opt ::= WHERE search_condition", - /* 361 */ "partition_by_clause_opt ::=", - /* 362 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 363 */ "twindow_clause_opt ::=", - /* 364 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 365 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 366 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 367 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 368 */ "sliding_opt ::=", - /* 369 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 370 */ "fill_opt ::=", - /* 371 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 372 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 373 */ "fill_mode ::= NONE", - /* 374 */ "fill_mode ::= PREV", - /* 375 */ "fill_mode ::= NULL", - /* 376 */ "fill_mode ::= LINEAR", - /* 377 */ "fill_mode ::= NEXT", - /* 378 */ "group_by_clause_opt ::=", - /* 379 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 380 */ "group_by_list ::= expression", - /* 381 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 382 */ "having_clause_opt ::=", - /* 383 */ "having_clause_opt ::= HAVING search_condition", - /* 384 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 385 */ "query_expression_body ::= query_primary", - /* 386 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 387 */ "query_primary ::= query_specification", - /* 388 */ "order_by_clause_opt ::=", - /* 389 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 390 */ "slimit_clause_opt ::=", - /* 391 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 392 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 393 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 394 */ "limit_clause_opt ::=", - /* 395 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 396 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 397 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 398 */ "subquery ::= NK_LP query_expression NK_RP", - /* 399 */ "search_condition ::= common_expression", - /* 400 */ "sort_specification_list ::= sort_specification", - /* 401 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 402 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 403 */ "ordering_specification_opt ::=", - /* 404 */ "ordering_specification_opt ::= ASC", - /* 405 */ "ordering_specification_opt ::= DESC", - /* 406 */ "null_ordering_opt ::=", - /* 407 */ "null_ordering_opt ::= NULLS FIRST", - /* 408 */ "null_ordering_opt ::= NULLS LAST", + /* 184 */ "cmd ::= SHOW GRANTS", + /* 185 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 186 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 187 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 188 */ "cmd ::= SHOW QUERIES", + /* 189 */ "cmd ::= SHOW SCORES", + /* 190 */ "cmd ::= SHOW TOPICS", + /* 191 */ "cmd ::= SHOW VARIABLES", + /* 192 */ "cmd ::= SHOW BNODES", + /* 193 */ "cmd ::= SHOW SNODES", + /* 194 */ "db_name_cond_opt ::=", + /* 195 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 196 */ "like_pattern_opt ::=", + /* 197 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 198 */ "table_name_cond ::= table_name", + /* 199 */ "from_db_opt ::=", + /* 200 */ "from_db_opt ::= FROM db_name", + /* 201 */ "func_name_list ::= func_name", + /* 202 */ "func_name_list ::= func_name_list NK_COMMA col_name", + /* 203 */ "func_name ::= function_name", + /* 204 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 205 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", + /* 206 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", + /* 207 */ "index_options ::=", + /* 208 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", + /* 209 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", + /* 210 */ "func_list ::= func", + /* 211 */ "func_list ::= func_list NK_COMMA func", + /* 212 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 213 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 214 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", + /* 215 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 216 */ "cmd ::= DESC full_table_name", + /* 217 */ "cmd ::= DESCRIBE full_table_name", + /* 218 */ "cmd ::= RESET QUERY CACHE", + /* 219 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 220 */ "analyze_opt ::=", + /* 221 */ "analyze_opt ::= ANALYZE", + /* 222 */ "explain_options ::=", + /* 223 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 224 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 225 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 226 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 227 */ "cmd ::= DROP FUNCTION function_name", + /* 228 */ "agg_func_opt ::=", + /* 229 */ "agg_func_opt ::= AGGREGATE", + /* 230 */ "bufsize_opt ::=", + /* 231 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 232 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", + /* 233 */ "cmd ::= DROP STREAM stream_name", + /* 234 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 235 */ "cmd ::= KILL QUERY NK_INTEGER", + /* 236 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 237 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 238 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 239 */ "dnode_list ::= DNODE NK_INTEGER", + /* 240 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 241 */ "cmd ::= SYNCDB db_name REPLICA", + /* 242 */ "cmd ::= query_expression", + /* 243 */ "literal ::= NK_INTEGER", + /* 244 */ "literal ::= NK_FLOAT", + /* 245 */ "literal ::= NK_STRING", + /* 246 */ "literal ::= NK_BOOL", + /* 247 */ "literal ::= TIMESTAMP NK_STRING", + /* 248 */ "literal ::= duration_literal", + /* 249 */ "literal ::= NULL", + /* 250 */ "duration_literal ::= NK_VARIABLE", + /* 251 */ "signed ::= NK_INTEGER", + /* 252 */ "signed ::= NK_PLUS NK_INTEGER", + /* 253 */ "signed ::= NK_MINUS NK_INTEGER", + /* 254 */ "signed ::= NK_FLOAT", + /* 255 */ "signed ::= NK_PLUS NK_FLOAT", + /* 256 */ "signed ::= NK_MINUS NK_FLOAT", + /* 257 */ "signed_literal ::= signed", + /* 258 */ "signed_literal ::= NK_STRING", + /* 259 */ "signed_literal ::= NK_BOOL", + /* 260 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 261 */ "signed_literal ::= duration_literal", + /* 262 */ "signed_literal ::= NULL", + /* 263 */ "literal_list ::= signed_literal", + /* 264 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 265 */ "db_name ::= NK_ID", + /* 266 */ "table_name ::= NK_ID", + /* 267 */ "column_name ::= NK_ID", + /* 268 */ "function_name ::= NK_ID", + /* 269 */ "function_name ::= FIRST", + /* 270 */ "function_name ::= LAST", + /* 271 */ "table_alias ::= NK_ID", + /* 272 */ "column_alias ::= NK_ID", + /* 273 */ "user_name ::= NK_ID", + /* 274 */ "index_name ::= NK_ID", + /* 275 */ "topic_name ::= NK_ID", + /* 276 */ "stream_name ::= NK_ID", + /* 277 */ "expression ::= literal", + /* 278 */ "expression ::= pseudo_column", + /* 279 */ "expression ::= column_reference", + /* 280 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 281 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 282 */ "expression ::= function_name NK_LP expression AS type_name NK_RP", + /* 283 */ "expression ::= subquery", + /* 284 */ "expression ::= NK_LP expression NK_RP", + /* 285 */ "expression ::= NK_PLUS expression", + /* 286 */ "expression ::= NK_MINUS expression", + /* 287 */ "expression ::= expression NK_PLUS expression", + /* 288 */ "expression ::= expression NK_MINUS expression", + /* 289 */ "expression ::= expression NK_STAR expression", + /* 290 */ "expression ::= expression NK_SLASH expression", + /* 291 */ "expression ::= expression NK_REM expression", + /* 292 */ "expression_list ::= expression", + /* 293 */ "expression_list ::= expression_list NK_COMMA expression", + /* 294 */ "column_reference ::= column_name", + /* 295 */ "column_reference ::= table_name NK_DOT column_name", + /* 296 */ "pseudo_column ::= NOW", + /* 297 */ "pseudo_column ::= ROWTS", + /* 298 */ "pseudo_column ::= TBNAME", + /* 299 */ "pseudo_column ::= QSTARTTS", + /* 300 */ "pseudo_column ::= QENDTS", + /* 301 */ "pseudo_column ::= WSTARTTS", + /* 302 */ "pseudo_column ::= WENDTS", + /* 303 */ "pseudo_column ::= WDURATION", + /* 304 */ "predicate ::= expression compare_op expression", + /* 305 */ "predicate ::= expression BETWEEN expression AND expression", + /* 306 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 307 */ "predicate ::= expression IS NULL", + /* 308 */ "predicate ::= expression IS NOT NULL", + /* 309 */ "predicate ::= expression in_op in_predicate_value", + /* 310 */ "compare_op ::= NK_LT", + /* 311 */ "compare_op ::= NK_GT", + /* 312 */ "compare_op ::= NK_LE", + /* 313 */ "compare_op ::= NK_GE", + /* 314 */ "compare_op ::= NK_NE", + /* 315 */ "compare_op ::= NK_EQ", + /* 316 */ "compare_op ::= LIKE", + /* 317 */ "compare_op ::= NOT LIKE", + /* 318 */ "compare_op ::= MATCH", + /* 319 */ "compare_op ::= NMATCH", + /* 320 */ "in_op ::= IN", + /* 321 */ "in_op ::= NOT IN", + /* 322 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 323 */ "boolean_value_expression ::= boolean_primary", + /* 324 */ "boolean_value_expression ::= NOT boolean_primary", + /* 325 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 326 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 327 */ "boolean_primary ::= predicate", + /* 328 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 329 */ "common_expression ::= expression", + /* 330 */ "common_expression ::= boolean_value_expression", + /* 331 */ "from_clause ::= FROM table_reference_list", + /* 332 */ "table_reference_list ::= table_reference", + /* 333 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 334 */ "table_reference ::= table_primary", + /* 335 */ "table_reference ::= joined_table", + /* 336 */ "table_primary ::= table_name alias_opt", + /* 337 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 338 */ "table_primary ::= subquery alias_opt", + /* 339 */ "table_primary ::= parenthesized_joined_table", + /* 340 */ "alias_opt ::=", + /* 341 */ "alias_opt ::= table_alias", + /* 342 */ "alias_opt ::= AS table_alias", + /* 343 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 344 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 345 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 346 */ "join_type ::=", + /* 347 */ "join_type ::= INNER", + /* 348 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 349 */ "set_quantifier_opt ::=", + /* 350 */ "set_quantifier_opt ::= DISTINCT", + /* 351 */ "set_quantifier_opt ::= ALL", + /* 352 */ "select_list ::= NK_STAR", + /* 353 */ "select_list ::= select_sublist", + /* 354 */ "select_sublist ::= select_item", + /* 355 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 356 */ "select_item ::= common_expression", + /* 357 */ "select_item ::= common_expression column_alias", + /* 358 */ "select_item ::= common_expression AS column_alias", + /* 359 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 360 */ "where_clause_opt ::=", + /* 361 */ "where_clause_opt ::= WHERE search_condition", + /* 362 */ "partition_by_clause_opt ::=", + /* 363 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 364 */ "twindow_clause_opt ::=", + /* 365 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 366 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 367 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 368 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 369 */ "sliding_opt ::=", + /* 370 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 371 */ "fill_opt ::=", + /* 372 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 373 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 374 */ "fill_mode ::= NONE", + /* 375 */ "fill_mode ::= PREV", + /* 376 */ "fill_mode ::= NULL", + /* 377 */ "fill_mode ::= LINEAR", + /* 378 */ "fill_mode ::= NEXT", + /* 379 */ "group_by_clause_opt ::=", + /* 380 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 381 */ "group_by_list ::= expression", + /* 382 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 383 */ "having_clause_opt ::=", + /* 384 */ "having_clause_opt ::= HAVING search_condition", + /* 385 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 386 */ "query_expression_body ::= query_primary", + /* 387 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 388 */ "query_primary ::= query_specification", + /* 389 */ "order_by_clause_opt ::=", + /* 390 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 391 */ "slimit_clause_opt ::=", + /* 392 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 393 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 395 */ "limit_clause_opt ::=", + /* 396 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 397 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 399 */ "subquery ::= NK_LP query_expression NK_RP", + /* 400 */ "search_condition ::= common_expression", + /* 401 */ "sort_specification_list ::= sort_specification", + /* 402 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 403 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 404 */ "ordering_specification_opt ::=", + /* 405 */ "ordering_specification_opt ::= ASC", + /* 406 */ "ordering_specification_opt ::= DESC", + /* 407 */ "null_ordering_opt ::=", + /* 408 */ "null_ordering_opt ::= NULLS FIRST", + /* 409 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1646,156 +1649,156 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 207: /* cmd */ - case 210: /* literal */ - case 217: /* db_options */ - case 219: /* alter_db_options */ - case 224: /* retention */ - case 225: /* full_table_name */ - case 228: /* table_options */ - case 232: /* alter_table_clause */ - case 233: /* alter_table_options */ - case 236: /* create_subtable_clause */ - case 239: /* drop_table_clause */ - case 242: /* column_def */ - case 245: /* col_name */ - case 246: /* db_name_cond_opt */ - case 247: /* like_pattern_opt */ - case 248: /* table_name_cond */ - case 249: /* from_db_opt */ - case 250: /* func_name */ - case 253: /* index_options */ - case 255: /* duration_literal */ - case 256: /* sliding_opt */ - case 257: /* func */ - case 260: /* query_expression */ - case 262: /* explain_options */ - case 267: /* signed */ - case 268: /* signed_literal */ - case 271: /* expression */ - case 272: /* pseudo_column */ - case 273: /* column_reference */ - case 274: /* subquery */ - case 275: /* predicate */ - case 278: /* in_predicate_value */ - case 279: /* boolean_value_expression */ - case 280: /* boolean_primary */ - case 281: /* common_expression */ - case 282: /* from_clause */ - case 283: /* table_reference_list */ - case 284: /* table_reference */ - case 285: /* table_primary */ - case 286: /* joined_table */ - case 288: /* parenthesized_joined_table */ - case 290: /* search_condition */ - case 291: /* query_specification */ - case 294: /* where_clause_opt */ - case 296: /* twindow_clause_opt */ - case 298: /* having_clause_opt */ - case 300: /* select_item */ - case 301: /* fill_opt */ - case 304: /* query_expression_body */ - case 306: /* slimit_clause_opt */ - case 307: /* limit_clause_opt */ - case 308: /* query_primary */ - case 310: /* sort_specification */ + case 208: /* cmd */ + case 211: /* literal */ + case 218: /* db_options */ + case 220: /* alter_db_options */ + case 225: /* retention */ + case 226: /* full_table_name */ + case 229: /* table_options */ + case 233: /* alter_table_clause */ + case 234: /* alter_table_options */ + case 237: /* create_subtable_clause */ + case 240: /* drop_table_clause */ + case 243: /* column_def */ + case 246: /* col_name */ + case 247: /* db_name_cond_opt */ + case 248: /* like_pattern_opt */ + case 249: /* table_name_cond */ + case 250: /* from_db_opt */ + case 251: /* func_name */ + case 254: /* index_options */ + case 256: /* duration_literal */ + case 257: /* sliding_opt */ + case 258: /* func */ + case 261: /* query_expression */ + case 263: /* explain_options */ + case 268: /* signed */ + case 269: /* signed_literal */ + case 272: /* expression */ + case 273: /* pseudo_column */ + case 274: /* column_reference */ + case 275: /* subquery */ + case 276: /* predicate */ + case 279: /* in_predicate_value */ + case 280: /* boolean_value_expression */ + case 281: /* boolean_primary */ + case 282: /* common_expression */ + case 283: /* from_clause */ + case 284: /* table_reference_list */ + case 285: /* table_reference */ + case 286: /* table_primary */ + case 287: /* joined_table */ + case 289: /* parenthesized_joined_table */ + case 291: /* search_condition */ + case 292: /* query_specification */ + case 295: /* where_clause_opt */ + case 297: /* twindow_clause_opt */ + case 299: /* having_clause_opt */ + case 301: /* select_item */ + case 302: /* fill_opt */ + case 305: /* query_expression_body */ + case 307: /* slimit_clause_opt */ + case 308: /* limit_clause_opt */ + case 309: /* query_primary */ + case 311: /* sort_specification */ { - nodesDestroyNode((yypminor->yy564)); + nodesDestroyNode((yypminor->yy140)); } break; - case 208: /* account_options */ - case 209: /* alter_account_options */ - case 211: /* alter_account_option */ - case 264: /* bufsize_opt */ + case 209: /* account_options */ + case 210: /* alter_account_options */ + case 212: /* alter_account_option */ + case 265: /* bufsize_opt */ { } break; - case 212: /* user_name */ - case 213: /* dnode_endpoint */ - case 214: /* dnode_host_name */ - case 216: /* db_name */ - case 234: /* column_name */ - case 241: /* table_name */ - case 251: /* function_name */ - case 252: /* index_name */ - case 259: /* topic_name */ - case 265: /* stream_name */ - case 269: /* table_alias */ - case 270: /* column_alias */ - case 287: /* alias_opt */ + case 213: /* user_name */ + case 214: /* dnode_endpoint */ + case 215: /* dnode_host_name */ + case 217: /* db_name */ + case 235: /* column_name */ + case 242: /* table_name */ + case 252: /* function_name */ + case 253: /* index_name */ + case 260: /* topic_name */ + case 266: /* stream_name */ + case 270: /* table_alias */ + case 271: /* column_alias */ + case 288: /* alias_opt */ { } break; - case 215: /* not_exists_opt */ - case 218: /* exists_opt */ - case 261: /* analyze_opt */ - case 263: /* agg_func_opt */ - case 292: /* set_quantifier_opt */ + case 216: /* not_exists_opt */ + case 219: /* exists_opt */ + case 262: /* analyze_opt */ + case 264: /* agg_func_opt */ + case 293: /* set_quantifier_opt */ { } break; - case 220: /* integer_list */ - case 221: /* variable_list */ - case 222: /* retention_list */ - case 226: /* column_def_list */ - case 227: /* tags_def_opt */ - case 229: /* multi_create_clause */ - case 230: /* tags_def */ - case 231: /* multi_drop_clause */ - case 237: /* specific_tags_opt */ - case 238: /* literal_list */ - case 240: /* col_name_list */ - case 243: /* func_name_list */ - case 254: /* func_list */ - case 258: /* expression_list */ - case 266: /* dnode_list */ - case 293: /* select_list */ - case 295: /* partition_by_clause_opt */ - case 297: /* group_by_clause_opt */ - case 299: /* select_sublist */ - case 303: /* group_by_list */ - case 305: /* order_by_clause_opt */ - case 309: /* sort_specification_list */ + case 221: /* integer_list */ + case 222: /* variable_list */ + case 223: /* retention_list */ + case 227: /* column_def_list */ + case 228: /* tags_def_opt */ + case 230: /* multi_create_clause */ + case 231: /* tags_def */ + case 232: /* multi_drop_clause */ + case 238: /* specific_tags_opt */ + case 239: /* literal_list */ + case 241: /* col_name_list */ + case 244: /* func_name_list */ + case 255: /* func_list */ + case 259: /* expression_list */ + case 267: /* dnode_list */ + case 294: /* select_list */ + case 296: /* partition_by_clause_opt */ + case 298: /* group_by_clause_opt */ + case 300: /* select_sublist */ + case 304: /* group_by_list */ + case 306: /* order_by_clause_opt */ + case 310: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy476)); + nodesDestroyList((yypminor->yy220)); } break; - case 223: /* alter_db_option */ - case 244: /* alter_table_option */ + case 224: /* alter_db_option */ + case 245: /* alter_table_option */ { } break; - case 235: /* type_name */ + case 236: /* type_name */ { } break; - case 276: /* compare_op */ - case 277: /* in_op */ + case 277: /* compare_op */ + case 278: /* in_op */ { } break; - case 289: /* join_type */ + case 290: /* join_type */ { } break; - case 302: /* fill_mode */ + case 303: /* fill_mode */ { } break; - case 311: /* ordering_specification_opt */ + case 312: /* ordering_specification_opt */ { } break; - case 312: /* null_ordering_opt */ + case 313: /* null_ordering_opt */ { } @@ -1923,18 +1926,15 @@ static YYACTIONTYPE yy_find_shift_action( do{ i = yy_shift_ofst[stateno]; assert( i>=0 ); - assert( i<=YY_ACTTAB_COUNT ); - assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); + /* assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); */ assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; - assert( i<(int)YY_NLOOKAHEAD ); - if( yy_lookahead[i]!=iLookAhead ){ + if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - assert( iLookAhead %s\n", @@ -1949,8 +1949,16 @@ static YYACTIONTYPE yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); - if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1964,7 +1972,6 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && iyytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; + yysize = yyRuleInfo[yyruleno].nrhs; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -3000,11 +2595,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,208,&yymsp[0].minor); + yy_destructor(yypParser,209,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,209,&yymsp[0].minor); + yy_destructor(yypParser,210,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3018,20 +2613,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,208,&yymsp[-2].minor); +{ yy_destructor(yypParser,209,&yymsp[-2].minor); { } - yy_destructor(yypParser,210,&yymsp[0].minor); + yy_destructor(yypParser,211,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,211,&yymsp[0].minor); +{ yy_destructor(yypParser,212,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,209,&yymsp[-1].minor); +{ yy_destructor(yypParser,210,&yymsp[-1].minor); { } - yy_destructor(yypParser,211,&yymsp[0].minor); + yy_destructor(yypParser,212,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3045,31 +2640,31 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,210,&yymsp[0].minor); + yy_destructor(yypParser,211,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy21, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy253, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy21, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy253, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy21, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy253, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy21); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy253); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy21, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy253, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy21, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy253, &yymsp[0].minor.yy0); } break; case 30: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy21); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy253); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3086,20 +2681,20 @@ static YYACTIONTYPE yy_reduce( case 36: /* dnode_endpoint ::= NK_STRING */ case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); - case 264: /* db_name ::= NK_ID */ yytestcase(yyruleno==264); - case 265: /* table_name ::= NK_ID */ yytestcase(yyruleno==265); - case 266: /* column_name ::= NK_ID */ yytestcase(yyruleno==266); - case 267: /* function_name ::= NK_ID */ yytestcase(yyruleno==267); - case 268: /* function_name ::= FIRST */ yytestcase(yyruleno==268); - case 269: /* function_name ::= LAST */ yytestcase(yyruleno==269); - case 270: /* table_alias ::= NK_ID */ yytestcase(yyruleno==270); - case 271: /* column_alias ::= NK_ID */ yytestcase(yyruleno==271); - case 272: /* user_name ::= NK_ID */ yytestcase(yyruleno==272); - case 273: /* index_name ::= NK_ID */ yytestcase(yyruleno==273); - case 274: /* topic_name ::= NK_ID */ yytestcase(yyruleno==274); - case 275: /* stream_name ::= NK_ID */ yytestcase(yyruleno==275); -{ yylhsminor.yy21 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy21 = yylhsminor.yy21; + case 265: /* db_name ::= NK_ID */ yytestcase(yyruleno==265); + case 266: /* table_name ::= NK_ID */ yytestcase(yyruleno==266); + case 267: /* column_name ::= NK_ID */ yytestcase(yyruleno==267); + case 268: /* function_name ::= NK_ID */ yytestcase(yyruleno==268); + case 269: /* function_name ::= FIRST */ yytestcase(yyruleno==269); + case 270: /* function_name ::= LAST */ yytestcase(yyruleno==270); + case 271: /* table_alias ::= NK_ID */ yytestcase(yyruleno==271); + case 272: /* column_alias ::= NK_ID */ yytestcase(yyruleno==272); + case 273: /* user_name ::= NK_ID */ yytestcase(yyruleno==273); + case 274: /* index_name ::= NK_ID */ yytestcase(yyruleno==274); + case 275: /* topic_name ::= NK_ID */ yytestcase(yyruleno==275); + case 276: /* stream_name ::= NK_ID */ yytestcase(yyruleno==276); +{ yylhsminor.yy253 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy253 = yylhsminor.yy253; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3132,408 +2727,408 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 49: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy21, yymsp[0].minor.yy564); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy273, &yymsp[-1].minor.yy253, yymsp[0].minor.yy140); } break; case 50: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy21); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy253); } break; case 51: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy21); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy253); } break; case 52: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy21, yymsp[0].minor.yy564); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy253, yymsp[0].minor.yy140); } break; case 53: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy173 = true; } +{ yymsp[-2].minor.yy273 = true; } break; case 54: /* not_exists_opt ::= */ case 56: /* exists_opt ::= */ yytestcase(yyruleno==56); - case 219: /* analyze_opt ::= */ yytestcase(yyruleno==219); - case 227: /* agg_func_opt ::= */ yytestcase(yyruleno==227); - case 348: /* set_quantifier_opt ::= */ yytestcase(yyruleno==348); -{ yymsp[1].minor.yy173 = false; } + case 220: /* analyze_opt ::= */ yytestcase(yyruleno==220); + case 228: /* agg_func_opt ::= */ yytestcase(yyruleno==228); + case 349: /* set_quantifier_opt ::= */ yytestcase(yyruleno==349); +{ yymsp[1].minor.yy273 = false; } break; case 55: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy173 = true; } +{ yymsp[-1].minor.yy273 = true; } break; case 57: /* db_options ::= */ -{ yymsp[1].minor.yy564 = createDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy140 = createDatabaseOptions(pCxt); } break; case 58: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 59: /* db_options ::= db_options CACHE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 60: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 61: /* db_options ::= db_options COMP NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 62: /* db_options ::= db_options DAYS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 63: /* db_options ::= db_options DAYS NK_VARIABLE */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 64: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 65: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 66: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 67: /* db_options ::= db_options KEEP integer_list */ case 68: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==68); -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pKeep = yymsp[0].minor.yy476; yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pKeep = yymsp[0].minor.yy220; yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 69: /* db_options ::= db_options PRECISION NK_STRING */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 70: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 71: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 72: /* db_options ::= db_options TTL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 73: /* db_options ::= db_options WAL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 74: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 75: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 76: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 77: /* db_options ::= db_options RETENTIONS retention_list */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy564)->pRetentions = yymsp[0].minor.yy476; yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy140)->pRetentions = yymsp[0].minor.yy220; yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 78: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy564 = createDatabaseOptions(pCxt); yylhsminor.yy564 = setDatabaseAlterOption(pCxt, yylhsminor.yy564, &yymsp[0].minor.yy289); } - yymsp[0].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createDatabaseOptions(pCxt); yylhsminor.yy140 = setDatabaseAlterOption(pCxt, yylhsminor.yy140, &yymsp[0].minor.yy181); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; case 79: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy564 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy564, &yymsp[0].minor.yy289); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy140, &yymsp[0].minor.yy181); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; case 80: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy289.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 81: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy289.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 82: /* alter_db_option ::= KEEP integer_list */ case 83: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==83); -{ yymsp[-1].minor.yy289.type = DB_OPTION_KEEP; yymsp[-1].minor.yy289.pList = yymsp[0].minor.yy476; } +{ yymsp[-1].minor.yy181.type = DB_OPTION_KEEP; yymsp[-1].minor.yy181.pList = yymsp[0].minor.yy220; } break; case 84: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy289.type = DB_OPTION_WAL; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = DB_OPTION_WAL; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 85: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy289.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 86: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy289.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 87: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy289.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 88: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy476 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy476 = yylhsminor.yy476; +{ yylhsminor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 89: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 239: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==239); -{ yylhsminor.yy476 = addNodeToList(pCxt, yymsp[-2].minor.yy476, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy476 = yylhsminor.yy476; + case 240: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==240); +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 90: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy476 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy476 = yylhsminor.yy476; +{ yylhsminor.yy220 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 91: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy476 = addNodeToList(pCxt, yymsp[-2].minor.yy476, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy476 = yylhsminor.yy476; +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 92: /* retention_list ::= retention */ case 112: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==112); case 115: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==115); case 122: /* column_def_list ::= column_def */ yytestcase(yyruleno==122); case 165: /* col_name_list ::= col_name */ yytestcase(yyruleno==165); - case 200: /* func_name_list ::= func_name */ yytestcase(yyruleno==200); - case 209: /* func_list ::= func */ yytestcase(yyruleno==209); - case 262: /* literal_list ::= signed_literal */ yytestcase(yyruleno==262); - case 353: /* select_sublist ::= select_item */ yytestcase(yyruleno==353); - case 400: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==400); -{ yylhsminor.yy476 = createNodeList(pCxt, yymsp[0].minor.yy564); } - yymsp[0].minor.yy476 = yylhsminor.yy476; + case 201: /* func_name_list ::= func_name */ yytestcase(yyruleno==201); + case 210: /* func_list ::= func */ yytestcase(yyruleno==210); + case 263: /* literal_list ::= signed_literal */ yytestcase(yyruleno==263); + case 354: /* select_sublist ::= select_item */ yytestcase(yyruleno==354); + case 401: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==401); +{ yylhsminor.yy220 = createNodeList(pCxt, yymsp[0].minor.yy140); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 93: /* retention_list ::= retention_list NK_COMMA retention */ case 123: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==123); case 166: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==166); - case 201: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==201); - case 210: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==210); - case 263: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==263); - case 354: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==354); - case 401: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==401); -{ yylhsminor.yy476 = addNodeToList(pCxt, yymsp[-2].minor.yy476, yymsp[0].minor.yy564); } - yymsp[-2].minor.yy476 = yylhsminor.yy476; + case 202: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==202); + case 211: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==211); + case 264: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==264); + case 355: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==355); + case 402: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==402); +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 94: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy564 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 95: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 97: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==97); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy564, yymsp[-3].minor.yy476, yymsp[-1].minor.yy476, yymsp[0].minor.yy564); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy273, yymsp[-5].minor.yy140, yymsp[-3].minor.yy220, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } break; case 96: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy476); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy220); } break; case 98: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy476); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy220); } break; case 99: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy564); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy273, yymsp[0].minor.yy140); } break; case 100: /* cmd ::= ALTER TABLE alter_table_clause */ case 101: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==101); - case 241: /* cmd ::= query_expression */ yytestcase(yyruleno==241); -{ pCxt->pRootNode = yymsp[0].minor.yy564; } + case 242: /* cmd ::= query_expression */ yytestcase(yyruleno==242); +{ pCxt->pRootNode = yymsp[0].minor.yy140; } break; case 102: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy564 = createAlterTableOption(pCxt, yymsp[-1].minor.yy564, yymsp[0].minor.yy564); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableOption(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; case 103: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy564 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy564, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy21, yymsp[0].minor.yy288); } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy253, yymsp[0].minor.yy368); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 104: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy564 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy564, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy21); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy253); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; case 105: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy564 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy564, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy21, yymsp[0].minor.yy288); } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy253, yymsp[0].minor.yy368); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 106: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy564 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy564, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy21, &yymsp[0].minor.yy21); } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy253, &yymsp[0].minor.yy253); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 107: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy564 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy564, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy21, yymsp[0].minor.yy288); } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy253, yymsp[0].minor.yy368); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 108: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy564 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy564, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy21); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy253); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; case 109: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy564 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy564, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy21, yymsp[0].minor.yy288); } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy253, yymsp[0].minor.yy368); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 110: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy564 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy564, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy21, &yymsp[0].minor.yy21); } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy253, &yymsp[0].minor.yy253); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 111: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy564 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy564, &yymsp[-2].minor.yy21, yymsp[0].minor.yy564); } - yymsp[-5].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy140, &yymsp[-2].minor.yy253, yymsp[0].minor.yy140); } + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; case 113: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 116: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==116); -{ yylhsminor.yy476 = addNodeToList(pCxt, yymsp[-1].minor.yy476, yymsp[0].minor.yy564); } - yymsp[-1].minor.yy476 = yylhsminor.yy476; +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } + yymsp[-1].minor.yy220 = yylhsminor.yy220; break; case 114: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy564 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy173, yymsp[-7].minor.yy564, yymsp[-5].minor.yy564, yymsp[-4].minor.yy476, yymsp[-1].minor.yy476); } - yymsp[-8].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy273, yymsp[-7].minor.yy140, yymsp[-5].minor.yy140, yymsp[-4].minor.yy220, yymsp[-1].minor.yy220); } + yymsp[-8].minor.yy140 = yylhsminor.yy140; break; case 117: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy564 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy564); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createDropTableClause(pCxt, yymsp[-1].minor.yy273, yymsp[0].minor.yy140); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; case 118: /* specific_tags_opt ::= */ case 149: /* tags_def_opt ::= */ yytestcase(yyruleno==149); - case 361: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==361); - case 378: /* group_by_clause_opt ::= */ yytestcase(yyruleno==378); - case 388: /* order_by_clause_opt ::= */ yytestcase(yyruleno==388); -{ yymsp[1].minor.yy476 = NULL; } + case 362: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==362); + case 379: /* group_by_clause_opt ::= */ yytestcase(yyruleno==379); + case 389: /* order_by_clause_opt ::= */ yytestcase(yyruleno==389); +{ yymsp[1].minor.yy220 = NULL; } break; case 119: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy476 = yymsp[-1].minor.yy476; } +{ yymsp[-2].minor.yy220 = yymsp[-1].minor.yy220; } break; case 120: /* full_table_name ::= table_name */ -{ yylhsminor.yy564 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy21, NULL); } - yymsp[0].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy253, NULL); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; case 121: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy564 = createRealTableNode(pCxt, &yymsp[-2].minor.yy21, &yymsp[0].minor.yy21, NULL); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-2].minor.yy253, &yymsp[0].minor.yy253, NULL); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 124: /* column_def ::= column_name type_name */ -{ yylhsminor.yy564 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy21, yymsp[0].minor.yy288, NULL); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy253, yymsp[0].minor.yy368, NULL); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; case 125: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy564 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy21, yymsp[-2].minor.yy288, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy253, yymsp[-2].minor.yy368, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; case 126: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 127: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 128: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 129: /* type_name ::= INT */ case 130: /* type_name ::= INTEGER */ yytestcase(yyruleno==130); -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_INT); } break; case 131: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 132: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 133: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 134: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy288 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy368 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 135: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 136: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy288 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy368 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 137: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy288 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy368 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 138: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy288 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy368 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 139: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy288 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy368 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 140: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy288 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy368 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 141: /* type_name ::= JSON */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 142: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy288 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy368 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 143: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 144: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 145: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy288 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy368 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 146: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy288 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy368 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 147: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy288 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy368 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 148: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy288 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy368 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 150: /* tags_def_opt ::= tags_def */ - case 352: /* select_list ::= select_sublist */ yytestcase(yyruleno==352); -{ yylhsminor.yy476 = yymsp[0].minor.yy476; } - yymsp[0].minor.yy476 = yylhsminor.yy476; + case 353: /* select_list ::= select_sublist */ yytestcase(yyruleno==353); +{ yylhsminor.yy220 = yymsp[0].minor.yy220; } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 151: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy476 = yymsp[-1].minor.yy476; } +{ yymsp[-3].minor.yy220 = yymsp[-1].minor.yy220; } break; case 152: /* table_options ::= */ -{ yymsp[1].minor.yy564 = createTableOptions(pCxt); } +{ yymsp[1].minor.yy140 = createTableOptions(pCxt); } break; case 153: /* table_options ::= table_options COMMENT NK_STRING */ -{ ((STableOptions*)yymsp[-2].minor.yy564)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((STableOptions*)yymsp[-2].minor.yy140)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 154: /* table_options ::= table_options KEEP integer_list */ -{ ((STableOptions*)yymsp[-2].minor.yy564)->pKeep = yymsp[0].minor.yy476; yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((STableOptions*)yymsp[-2].minor.yy140)->pKeep = yymsp[0].minor.yy220; yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 155: /* table_options ::= table_options TTL NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy564)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((STableOptions*)yymsp[-2].minor.yy140)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 156: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy564)->pSma = yymsp[-1].minor.yy476; yylhsminor.yy564 = yymsp[-4].minor.yy564; } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ ((STableOptions*)yymsp[-4].minor.yy140)->pSma = yymsp[-1].minor.yy220; yylhsminor.yy140 = yymsp[-4].minor.yy140; } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 157: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy564)->pFuncs = yymsp[-1].minor.yy476; yylhsminor.yy564 = yymsp[-4].minor.yy564; } - yymsp[-4].minor.yy564 = yylhsminor.yy564; +{ ((STableOptions*)yymsp[-4].minor.yy140)->pFuncs = yymsp[-1].minor.yy220; yylhsminor.yy140 = yymsp[-4].minor.yy140; } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; case 158: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ ((STableOptions*)yymsp[-2].minor.yy564)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((STableOptions*)yymsp[-2].minor.yy140)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 159: /* table_options ::= table_options DELAY NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy564)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy564 = yymsp[-2].minor.yy564; } - yymsp[-2].minor.yy564 = yylhsminor.yy564; +{ ((STableOptions*)yymsp[-2].minor.yy140)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 160: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy564 = createTableOptions(pCxt); yylhsminor.yy564 = setTableAlterOption(pCxt, yylhsminor.yy564, &yymsp[0].minor.yy289); } - yymsp[0].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createTableOptions(pCxt); yylhsminor.yy140 = setTableAlterOption(pCxt, yylhsminor.yy140, &yymsp[0].minor.yy181); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; case 161: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy564 = setTableAlterOption(pCxt, yymsp[-1].minor.yy564, &yymsp[0].minor.yy289); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = setTableAlterOption(pCxt, yymsp[-1].minor.yy140, &yymsp[0].minor.yy181); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; case 162: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy289.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 163: /* alter_table_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy289.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy289.pList = yymsp[0].minor.yy476; } +{ yymsp[-1].minor.yy181.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy181.pList = yymsp[0].minor.yy220; } break; case 164: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy289.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy289.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy181.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy181.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 167: /* col_name ::= column_name */ -{ yylhsminor.yy564 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy564 = yylhsminor.yy564; +{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy253); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; case 168: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } @@ -3545,13 +3140,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; case 171: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy564, yymsp[0].minor.yy564); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } break; case 172: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy564, yymsp[0].minor.yy564); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } break; case 173: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy564, NULL); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy140, NULL); } break; case 174: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } @@ -3566,7 +3161,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; case 178: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy564, yymsp[0].minor.yy564); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; case 179: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } @@ -3581,644 +3176,645 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } break; case 183: /* cmd ::= SHOW LICENCE */ + case 184: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==184); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; - case 184: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy21); } + case 185: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy253); } break; - case 185: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy564); } + case 186: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy140); } break; - case 186: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy564); } + case 187: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy140); } break; - case 187: /* cmd ::= SHOW QUERIES */ + case 188: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } break; - case 188: /* cmd ::= SHOW SCORES */ + case 189: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } break; - case 189: /* cmd ::= SHOW TOPICS */ + case 190: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); } break; - case 190: /* cmd ::= SHOW VARIABLES */ + case 191: /* cmd ::= SHOW VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } break; - case 191: /* cmd ::= SHOW BNODES */ + case 192: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT, NULL, NULL); } break; - case 192: /* cmd ::= SHOW SNODES */ + case 193: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT, NULL, NULL); } break; - case 193: /* db_name_cond_opt ::= */ - case 198: /* from_db_opt ::= */ yytestcase(yyruleno==198); -{ yymsp[1].minor.yy564 = createDefaultDatabaseCondValue(pCxt); } + case 194: /* db_name_cond_opt ::= */ + case 199: /* from_db_opt ::= */ yytestcase(yyruleno==199); +{ yymsp[1].minor.yy140 = createDefaultDatabaseCondValue(pCxt); } break; - case 194: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy21); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + case 195: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy253); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 195: /* like_pattern_opt ::= */ - case 206: /* index_options ::= */ yytestcase(yyruleno==206); - case 359: /* where_clause_opt ::= */ yytestcase(yyruleno==359); - case 363: /* twindow_clause_opt ::= */ yytestcase(yyruleno==363); - case 368: /* sliding_opt ::= */ yytestcase(yyruleno==368); - case 370: /* fill_opt ::= */ yytestcase(yyruleno==370); - case 382: /* having_clause_opt ::= */ yytestcase(yyruleno==382); - case 390: /* slimit_clause_opt ::= */ yytestcase(yyruleno==390); - case 394: /* limit_clause_opt ::= */ yytestcase(yyruleno==394); -{ yymsp[1].minor.yy564 = NULL; } + case 196: /* like_pattern_opt ::= */ + case 207: /* index_options ::= */ yytestcase(yyruleno==207); + case 360: /* where_clause_opt ::= */ yytestcase(yyruleno==360); + case 364: /* twindow_clause_opt ::= */ yytestcase(yyruleno==364); + case 369: /* sliding_opt ::= */ yytestcase(yyruleno==369); + case 371: /* fill_opt ::= */ yytestcase(yyruleno==371); + case 383: /* having_clause_opt ::= */ yytestcase(yyruleno==383); + case 391: /* slimit_clause_opt ::= */ yytestcase(yyruleno==391); + case 395: /* limit_clause_opt ::= */ yytestcase(yyruleno==395); +{ yymsp[1].minor.yy140 = NULL; } break; - case 196: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 197: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 197: /* table_name_cond ::= table_name */ -{ yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy564 = yylhsminor.yy564; + case 198: /* table_name_cond ::= table_name */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy253); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 199: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy21); } + case 200: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy253); } break; - case 202: /* func_name ::= function_name */ -{ yylhsminor.yy564 = createFunctionNode(pCxt, &yymsp[0].minor.yy21, NULL); } - yymsp[0].minor.yy564 = yylhsminor.yy564; + case 203: /* func_name ::= function_name */ +{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy253, NULL); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 203: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy21, &yymsp[-1].minor.yy21, NULL, yymsp[0].minor.yy564); } + case 204: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy273, &yymsp[-3].minor.yy253, &yymsp[-1].minor.yy253, NULL, yymsp[0].minor.yy140); } break; - case 204: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy21, &yymsp[-3].minor.yy21, yymsp[-1].minor.yy476, NULL); } + case 205: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy273, &yymsp[-5].minor.yy253, &yymsp[-3].minor.yy253, yymsp[-1].minor.yy220, NULL); } break; - case 205: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy21, &yymsp[0].minor.yy21); } + case 206: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy253, &yymsp[0].minor.yy253); } break; - case 207: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy564 = createIndexOption(pCxt, yymsp[-6].minor.yy476, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), NULL, yymsp[0].minor.yy564); } + case 208: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ +{ yymsp[-8].minor.yy140 = createIndexOption(pCxt, yymsp[-6].minor.yy220, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), NULL, yymsp[0].minor.yy140); } break; - case 208: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy564 = createIndexOption(pCxt, yymsp[-8].minor.yy476, releaseRawExprNode(pCxt, yymsp[-4].minor.yy564), releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), yymsp[0].minor.yy564); } + case 209: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ +{ yymsp[-10].minor.yy140 = createIndexOption(pCxt, yymsp[-8].minor.yy220, releaseRawExprNode(pCxt, yymsp[-4].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), yymsp[0].minor.yy140); } break; - case 211: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy564 = createFunctionNode(pCxt, &yymsp[-3].minor.yy21, yymsp[-1].minor.yy476); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; + case 212: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[-3].minor.yy253, yymsp[-1].minor.yy220); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 212: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy21, yymsp[0].minor.yy564, NULL); } + case 213: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy253, yymsp[0].minor.yy140, NULL); } break; - case 213: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy21, NULL, &yymsp[0].minor.yy21); } + case 214: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy253, NULL, &yymsp[0].minor.yy253); } break; - case 214: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy21); } + case 215: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy253); } break; - case 215: /* cmd ::= DESC full_table_name */ - case 216: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==216); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy564); } + case 216: /* cmd ::= DESC full_table_name */ + case 217: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==217); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy140); } break; - case 217: /* cmd ::= RESET QUERY CACHE */ + case 218: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 218: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy564, yymsp[0].minor.yy564); } + case 219: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy273, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 220: /* analyze_opt ::= ANALYZE */ - case 228: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==228); - case 349: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==349); -{ yymsp[0].minor.yy173 = true; } + case 221: /* analyze_opt ::= ANALYZE */ + case 229: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==229); + case 350: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==350); +{ yymsp[0].minor.yy273 = true; } break; - case 221: /* explain_options ::= */ -{ yymsp[1].minor.yy564 = createDefaultExplainOptions(pCxt); } + case 222: /* explain_options ::= */ +{ yymsp[1].minor.yy140 = createDefaultExplainOptions(pCxt); } break; - case 222: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy564 = setExplainVerbose(pCxt, yymsp[-2].minor.yy564, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 223: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy140 = setExplainVerbose(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 223: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy564 = setExplainRatio(pCxt, yymsp[-2].minor.yy564, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 224: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy140 = setExplainRatio(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 224: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy476); } + case 225: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy220); } break; - case 225: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy173, &yymsp[-5].minor.yy21, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy288, yymsp[0].minor.yy620); } + case 226: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy273, &yymsp[-5].minor.yy253, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy368, yymsp[0].minor.yy528); } break; - case 226: /* cmd ::= DROP FUNCTION function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy21); } + case 227: /* cmd ::= DROP FUNCTION function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy253); } break; - case 229: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy620 = 0; } + case 230: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy528 = 0; } break; - case 230: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy620 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 231: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy528 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 231: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy21, &yymsp[-2].minor.yy21, yymsp[0].minor.yy564); } + case 232: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy253, &yymsp[-2].minor.yy253, yymsp[0].minor.yy140); } break; - case 232: /* cmd ::= DROP STREAM stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy21); } + case 233: /* cmd ::= DROP STREAM stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy253); } break; - case 233: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 234: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 234: /* cmd ::= KILL QUERY NK_INTEGER */ + case 235: /* cmd ::= KILL QUERY NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); } break; - case 235: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 236: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 236: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy476); } + case 237: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy220); } break; - case 237: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 238: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 238: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy476 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - break; - case 240: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy21); } - break; - case 242: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 243: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 244: /* literal ::= NK_STRING */ -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 245: /* literal ::= NK_BOOL */ -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 246: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; - break; - case 247: /* literal ::= duration_literal */ - case 256: /* signed_literal ::= signed */ yytestcase(yyruleno==256); - case 276: /* expression ::= literal */ yytestcase(yyruleno==276); - case 277: /* expression ::= pseudo_column */ yytestcase(yyruleno==277); - case 278: /* expression ::= column_reference */ yytestcase(yyruleno==278); - case 282: /* expression ::= subquery */ yytestcase(yyruleno==282); - case 322: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==322); - case 326: /* boolean_primary ::= predicate */ yytestcase(yyruleno==326); - case 328: /* common_expression ::= expression */ yytestcase(yyruleno==328); - case 329: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==329); - case 331: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==331); - case 333: /* table_reference ::= table_primary */ yytestcase(yyruleno==333); - case 334: /* table_reference ::= joined_table */ yytestcase(yyruleno==334); - case 338: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==338); - case 385: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==385); - case 387: /* query_primary ::= query_specification */ yytestcase(yyruleno==387); -{ yylhsminor.yy564 = yymsp[0].minor.yy564; } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 248: /* literal ::= NULL */ -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 249: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 250: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 251: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - break; - case 252: /* signed ::= NK_MINUS NK_INTEGER */ + case 239: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + break; + case 241: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy253); } + break; + case 243: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 244: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 245: /* literal ::= NK_STRING */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 246: /* literal ::= NK_BOOL */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 247: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; + break; + case 248: /* literal ::= duration_literal */ + case 257: /* signed_literal ::= signed */ yytestcase(yyruleno==257); + case 277: /* expression ::= literal */ yytestcase(yyruleno==277); + case 278: /* expression ::= pseudo_column */ yytestcase(yyruleno==278); + case 279: /* expression ::= column_reference */ yytestcase(yyruleno==279); + case 283: /* expression ::= subquery */ yytestcase(yyruleno==283); + case 323: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==323); + case 327: /* boolean_primary ::= predicate */ yytestcase(yyruleno==327); + case 329: /* common_expression ::= expression */ yytestcase(yyruleno==329); + case 330: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==330); + case 332: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==332); + case 334: /* table_reference ::= table_primary */ yytestcase(yyruleno==334); + case 335: /* table_reference ::= joined_table */ yytestcase(yyruleno==335); + case 339: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==339); + case 386: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==386); + case 388: /* query_primary ::= query_specification */ yytestcase(yyruleno==388); +{ yylhsminor.yy140 = yymsp[0].minor.yy140; } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 249: /* literal ::= NULL */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 250: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 251: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 252: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 253: /* 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; - yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 253: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy564 = yylhsminor.yy564; + case 254: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 254: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 255: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 255: /* signed ::= NK_MINUS NK_FLOAT */ + case 256: /* 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; - yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 257: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy564 = yylhsminor.yy564; + case 258: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 258: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy564 = yylhsminor.yy564; + case 259: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 259: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 260: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 260: /* signed_literal ::= duration_literal */ - case 355: /* select_item ::= common_expression */ yytestcase(yyruleno==355); - case 399: /* search_condition ::= common_expression */ yytestcase(yyruleno==399); -{ yylhsminor.yy564 = releaseRawExprNode(pCxt, yymsp[0].minor.yy564); } - yymsp[0].minor.yy564 = yylhsminor.yy564; + case 261: /* signed_literal ::= duration_literal */ + case 356: /* select_item ::= common_expression */ yytestcase(yyruleno==356); + case 400: /* search_condition ::= common_expression */ yytestcase(yyruleno==400); +{ yylhsminor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 261: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 262: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 279: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy21, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy21, yymsp[-1].minor.yy476)); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; + case 280: /* expression ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy253, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy253, yymsp[-1].minor.yy220)); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 280: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy21, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy21, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; + case 281: /* expression ::= function_name NK_LP NK_STAR NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy253, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy253, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 281: /* expression ::= function_name NK_LP expression AS type_name NK_RP */ + case 282: /* expression ::= function_name NK_LP expression AS type_name NK_RP */ { - SNodeList *p = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy564)); - p = addValueNodeFromTypeToList(pCxt, yymsp[-1].minor.yy288, p); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy21, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-5].minor.yy21, p)); + SNodeList *p = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140)); + p = addValueNodeFromTypeToList(pCxt, yymsp[-1].minor.yy368, p); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy253, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-5].minor.yy253, p)); } - yymsp[-5].minor.yy564 = yylhsminor.yy564; + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; - case 283: /* expression ::= NK_LP expression NK_RP */ - case 327: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==327); -{ yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy564)); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 284: /* expression ::= NK_LP expression NK_RP */ + case 328: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==328); +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 284: /* expression ::= NK_PLUS expression */ + case 285: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy564)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 285: /* expression ::= NK_MINUS expression */ + case 286: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy564), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 286: /* expression ::= expression NK_PLUS expression */ + case 287: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 287: /* expression ::= expression NK_MINUS expression */ + case 288: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 288: /* expression ::= expression NK_STAR expression */ + case 289: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 289: /* expression ::= expression NK_SLASH expression */ + case 290: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 290: /* expression ::= expression NK_REM expression */ + case 291: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; - break; - case 291: /* expression_list ::= expression */ -{ yylhsminor.yy476 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy564)); } - yymsp[0].minor.yy476 = yylhsminor.yy476; - break; - case 292: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy476 = addNodeToList(pCxt, yymsp[-2].minor.yy476, releaseRawExprNode(pCxt, yymsp[0].minor.yy564)); } - yymsp[-2].minor.yy476 = yylhsminor.yy476; - break; - case 293: /* column_reference ::= column_name */ -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy21, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy21)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 294: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy21, &yymsp[0].minor.yy21, createColumnNode(pCxt, &yymsp[-2].minor.yy21, &yymsp[0].minor.yy21)); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; - break; - case 295: /* pseudo_column ::= NOW */ - case 296: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==296); - case 297: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==297); - case 298: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==298); - case 299: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==299); - case 300: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==300); - case 301: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==301); - case 302: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==302); -{ yylhsminor.yy564 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy564 = yylhsminor.yy564; - break; - case 303: /* predicate ::= expression compare_op expression */ - case 308: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==308); + yymsp[-2].minor.yy140 = yylhsminor.yy140; + break; + case 292: /* expression_list ::= expression */ +{ yylhsminor.yy220 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + yymsp[0].minor.yy220 = yylhsminor.yy220; + break; + case 293: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; + break; + case 294: /* column_reference ::= column_name */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy253, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy253)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 295: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy253, &yymsp[0].minor.yy253, createColumnNode(pCxt, &yymsp[-2].minor.yy253, &yymsp[0].minor.yy253)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; + break; + case 296: /* pseudo_column ::= NOW */ + case 297: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==297); + case 298: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==298); + case 299: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==299); + case 300: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==300); + case 301: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==301); + case 302: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==302); + case 303: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==303); +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; + break; + case 304: /* predicate ::= expression compare_op expression */ + case 309: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==309); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy468, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy480, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 304: /* predicate ::= expression BETWEEN expression AND expression */ + case 305: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy564), releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-4].minor.yy564 = yylhsminor.yy564; + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; - case 305: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 306: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[-5].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-5].minor.yy564 = yylhsminor.yy564; + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; - case 306: /* predicate ::= expression IS NULL */ + case 307: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), NULL)); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 307: /* predicate ::= expression IS NOT NULL */ + case 308: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy564), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL)); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 309: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy468 = OP_TYPE_LOWER_THAN; } + case 310: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy480 = OP_TYPE_LOWER_THAN; } break; - case 310: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy468 = OP_TYPE_GREATER_THAN; } + case 311: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy480 = OP_TYPE_GREATER_THAN; } break; - case 311: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy468 = OP_TYPE_LOWER_EQUAL; } + case 312: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy480 = OP_TYPE_LOWER_EQUAL; } break; - case 312: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy468 = OP_TYPE_GREATER_EQUAL; } + case 313: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy480 = OP_TYPE_GREATER_EQUAL; } break; - case 313: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy468 = OP_TYPE_NOT_EQUAL; } + case 314: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy480 = OP_TYPE_NOT_EQUAL; } break; - case 314: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy468 = OP_TYPE_EQUAL; } + case 315: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy480 = OP_TYPE_EQUAL; } break; - case 315: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy468 = OP_TYPE_LIKE; } + case 316: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy480 = OP_TYPE_LIKE; } break; - case 316: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy468 = OP_TYPE_NOT_LIKE; } + case 317: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy480 = OP_TYPE_NOT_LIKE; } break; - case 317: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy468 = OP_TYPE_MATCH; } + case 318: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy480 = OP_TYPE_MATCH; } break; - case 318: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy468 = OP_TYPE_NMATCH; } + case 319: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy480 = OP_TYPE_NMATCH; } break; - case 319: /* in_op ::= IN */ -{ yymsp[0].minor.yy468 = OP_TYPE_IN; } + case 320: /* in_op ::= IN */ +{ yymsp[0].minor.yy480 = OP_TYPE_IN; } break; - case 320: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy468 = OP_TYPE_NOT_IN; } + case 321: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy480 = OP_TYPE_NOT_IN; } break; - case 321: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy476)); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 322: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 323: /* boolean_value_expression ::= NOT boolean_primary */ + case 324: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy564), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 324: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 325: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 325: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 326: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy564); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564); - yylhsminor.yy564 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 330: /* from_clause ::= FROM table_reference_list */ - case 360: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==360); - case 383: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==383); -{ yymsp[-1].minor.yy564 = yymsp[0].minor.yy564; } + case 331: /* from_clause ::= FROM table_reference_list */ + case 361: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==361); + case 384: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==384); +{ yymsp[-1].minor.yy140 = yymsp[0].minor.yy140; } break; - case 332: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy564 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy564, yymsp[0].minor.yy564, NULL); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 333: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy140 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, NULL); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 335: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy564 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy21, &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + case 336: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy253, &yymsp[0].minor.yy253); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 336: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy564 = createRealTableNode(pCxt, &yymsp[-3].minor.yy21, &yymsp[-1].minor.yy21, &yymsp[0].minor.yy21); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; + case 337: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-3].minor.yy253, &yymsp[-1].minor.yy253, &yymsp[0].minor.yy253); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 337: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy564 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy564), &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + case 338: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy140 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy253); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 339: /* alias_opt ::= */ -{ yymsp[1].minor.yy21 = nil_token; } + case 340: /* alias_opt ::= */ +{ yymsp[1].minor.yy253 = nil_token; } break; - case 340: /* alias_opt ::= table_alias */ -{ yylhsminor.yy21 = yymsp[0].minor.yy21; } - yymsp[0].minor.yy21 = yylhsminor.yy21; + case 341: /* alias_opt ::= table_alias */ +{ yylhsminor.yy253 = yymsp[0].minor.yy253; } + yymsp[0].minor.yy253 = yylhsminor.yy253; break; - case 341: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy21 = yymsp[0].minor.yy21; } + case 342: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy253 = yymsp[0].minor.yy253; } break; - case 342: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 343: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==343); -{ yymsp[-2].minor.yy564 = yymsp[-1].minor.yy564; } + case 343: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 344: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==344); +{ yymsp[-2].minor.yy140 = yymsp[-1].minor.yy140; } break; - case 344: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy564 = createJoinTableNode(pCxt, yymsp[-4].minor.yy440, yymsp[-5].minor.yy564, yymsp[-2].minor.yy564, yymsp[0].minor.yy564); } - yymsp[-5].minor.yy564 = yylhsminor.yy564; + case 345: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy140 = createJoinTableNode(pCxt, yymsp[-4].minor.yy224, yymsp[-5].minor.yy140, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; - case 345: /* join_type ::= */ -{ yymsp[1].minor.yy440 = JOIN_TYPE_INNER; } + case 346: /* join_type ::= */ +{ yymsp[1].minor.yy224 = JOIN_TYPE_INNER; } break; - case 346: /* join_type ::= INNER */ -{ yymsp[0].minor.yy440 = JOIN_TYPE_INNER; } + case 347: /* join_type ::= INNER */ +{ yymsp[0].minor.yy224 = JOIN_TYPE_INNER; } break; - case 347: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 348: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-8].minor.yy564 = createSelectStmt(pCxt, yymsp[-7].minor.yy173, yymsp[-6].minor.yy476, yymsp[-5].minor.yy564); - yymsp[-8].minor.yy564 = addWhereClause(pCxt, yymsp[-8].minor.yy564, yymsp[-4].minor.yy564); - yymsp[-8].minor.yy564 = addPartitionByClause(pCxt, yymsp[-8].minor.yy564, yymsp[-3].minor.yy476); - yymsp[-8].minor.yy564 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy564, yymsp[-2].minor.yy564); - yymsp[-8].minor.yy564 = addGroupByClause(pCxt, yymsp[-8].minor.yy564, yymsp[-1].minor.yy476); - yymsp[-8].minor.yy564 = addHavingClause(pCxt, yymsp[-8].minor.yy564, yymsp[0].minor.yy564); + yymsp[-8].minor.yy140 = createSelectStmt(pCxt, yymsp[-7].minor.yy273, yymsp[-6].minor.yy220, yymsp[-5].minor.yy140); + yymsp[-8].minor.yy140 = addWhereClause(pCxt, yymsp[-8].minor.yy140, yymsp[-4].minor.yy140); + yymsp[-8].minor.yy140 = addPartitionByClause(pCxt, yymsp[-8].minor.yy140, yymsp[-3].minor.yy220); + yymsp[-8].minor.yy140 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy140, yymsp[-2].minor.yy140); + yymsp[-8].minor.yy140 = addGroupByClause(pCxt, yymsp[-8].minor.yy140, yymsp[-1].minor.yy220); + yymsp[-8].minor.yy140 = addHavingClause(pCxt, yymsp[-8].minor.yy140, yymsp[0].minor.yy140); } break; - case 350: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy173 = false; } + case 351: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy273 = false; } break; - case 351: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy476 = NULL; } + case 352: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy220 = NULL; } break; - case 356: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy564 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy564), &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy564 = yylhsminor.yy564; + case 357: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy253); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 357: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy564 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), &yymsp[0].minor.yy21); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 358: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), &yymsp[0].minor.yy253); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 358: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy564 = createColumnNode(pCxt, &yymsp[-2].minor.yy21, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 359: /* select_item ::= table_name NK_DOT NK_STAR */ +{ yylhsminor.yy140 = createColumnNode(pCxt, &yymsp[-2].minor.yy253, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 362: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 379: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==379); - case 389: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==389); -{ yymsp[-2].minor.yy476 = yymsp[0].minor.yy476; } + case 363: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 380: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==380); + case 390: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==390); +{ yymsp[-2].minor.yy220 = yymsp[0].minor.yy220; } break; - case 364: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy564 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy564), releaseRawExprNode(pCxt, yymsp[-1].minor.yy564)); } + case 365: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy140 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } break; - case 365: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy564 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy564)); } + case 366: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy140 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } break; - case 366: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy564 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy564), NULL, yymsp[-1].minor.yy564, yymsp[0].minor.yy564); } + case 367: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 367: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy564 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy564), releaseRawExprNode(pCxt, yymsp[-3].minor.yy564), yymsp[-1].minor.yy564, yymsp[0].minor.yy564); } + case 368: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 369: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy564 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy564); } + case 370: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy140 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy140); } break; - case 371: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy564 = createFillNode(pCxt, yymsp[-1].minor.yy268, NULL); } + case 372: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy140 = createFillNode(pCxt, yymsp[-1].minor.yy174, NULL); } break; - case 372: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy564 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy476)); } + case 373: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } break; - case 373: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy268 = FILL_MODE_NONE; } + case 374: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy174 = FILL_MODE_NONE; } break; - case 374: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy268 = FILL_MODE_PREV; } + case 375: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy174 = FILL_MODE_PREV; } break; - case 375: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy268 = FILL_MODE_NULL; } + case 376: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy174 = FILL_MODE_NULL; } break; - case 376: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy268 = FILL_MODE_LINEAR; } + case 377: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy174 = FILL_MODE_LINEAR; } break; - case 377: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy268 = FILL_MODE_NEXT; } + case 378: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy174 = FILL_MODE_NEXT; } break; - case 380: /* group_by_list ::= expression */ -{ yylhsminor.yy476 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); } - yymsp[0].minor.yy476 = yylhsminor.yy476; + case 381: /* group_by_list ::= expression */ +{ yylhsminor.yy220 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; - case 381: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy476 = addNodeToList(pCxt, yymsp[-2].minor.yy476, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy564))); } - yymsp[-2].minor.yy476 = yylhsminor.yy476; + case 382: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; - case 384: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 385: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy564 = addOrderByClause(pCxt, yymsp[-3].minor.yy564, yymsp[-2].minor.yy476); - yylhsminor.yy564 = addSlimitClause(pCxt, yylhsminor.yy564, yymsp[-1].minor.yy564); - yylhsminor.yy564 = addLimitClause(pCxt, yylhsminor.yy564, yymsp[0].minor.yy564); + yylhsminor.yy140 = addOrderByClause(pCxt, yymsp[-3].minor.yy140, yymsp[-2].minor.yy220); + yylhsminor.yy140 = addSlimitClause(pCxt, yylhsminor.yy140, yymsp[-1].minor.yy140); + yylhsminor.yy140 = addLimitClause(pCxt, yylhsminor.yy140, yymsp[0].minor.yy140); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 386: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy564 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy564, yymsp[0].minor.yy564); } - yymsp[-3].minor.yy564 = yylhsminor.yy564; + case 387: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 391: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 395: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==395); -{ yymsp[-1].minor.yy564 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 392: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 396: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==396); +{ yymsp[-1].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 392: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 396: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==396); -{ yymsp[-3].minor.yy564 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 393: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 397: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==397); +{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 393: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 397: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==397); -{ yymsp[-3].minor.yy564 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==398); +{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 398: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy564 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy564); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 399: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy140); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 402: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy564 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy564), yymsp[-1].minor.yy256, yymsp[0].minor.yy525); } - yymsp[-2].minor.yy564 = yylhsminor.yy564; + case 403: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy140 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), yymsp[-1].minor.yy238, yymsp[0].minor.yy69); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 403: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy256 = ORDER_ASC; } + case 404: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy238 = ORDER_ASC; } break; - case 404: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy256 = ORDER_ASC; } + case 405: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy238 = ORDER_ASC; } break; - case 405: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy256 = ORDER_DESC; } + case 406: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy238 = ORDER_DESC; } break; - case 406: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy525 = NULL_ORDER_DEFAULT; } + case 407: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy69 = NULL_ORDER_DEFAULT; } break; - case 407: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy525 = NULL_ORDER_FIRST; } + case 408: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy69 = NULL_ORDER_FIRST; } break; - case 408: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy525 = NULL_ORDER_LAST; } + case 409: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy69 = NULL_ORDER_LAST; } break; default: break; /********** End reduce actions ************************************************/ }; - assert( yyrulenonode.pConditions) { + SNodeList* pMultiTableCond = NULL; + SNodeList* pSingleTableCond = NULL; + int32_t code = cpdPartitionCondition(pJoin, &pMultiTableCond, &pSingleTableCond); + if (TSDB_CODE_SUCCESS == code && NULL != pMultiTableCond) { + code = cpdPushJoinCondToOnCond(pCxt, pJoin, pMultiTableCond); + } + if (TSDB_CODE_SUCCESS == code && NULL != pSingleTableCond) { + code = cpdPushJoinCondToChildren(pCxt, pJoin, pSingleTableCond); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t cpdPushAggCondition(SOptimizeContext* pCxt, SAggLogicNode* pAgg) { + // todo + return TSDB_CODE_SUCCESS; +} + +static int32_t cpdPushCondition(SOptimizeContext* pCxt, SLogicNode* pLogicNode) { + int32_t code = TSDB_CODE_SUCCESS; + switch (nodeType(pLogicNode)) { + case QUERY_NODE_LOGIC_PLAN_SCAN: + code = cpdOptimizeScanCondition(pCxt, (SScanLogicNode*)pLogicNode); + break; + case QUERY_NODE_LOGIC_PLAN_JOIN: + code = cpdPushJoinCondition(pCxt, (SJoinLogicNode*)pLogicNode); + break; + case QUERY_NODE_LOGIC_PLAN_AGG: + code = cpdPushAggCondition(pCxt, (SAggLogicNode*)pLogicNode); + break; + default: + break; + } + if (TSDB_CODE_SUCCESS == code) { + SNode* pChild = NULL; + FOREACH(pChild, pLogicNode->pChildren) { + code = cpdPushCondition(pCxt, (SLogicNode*)pChild); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + } + return code; +} + +static int32_t cpdOptimize(SOptimizeContext* pCxt, SLogicNode* pLogicNode) { + return cpdPushCondition(pCxt, pLogicNode); +} + static const SOptimizeRule optimizeRuleSet[] = { - { .pName = "OptimizeScanData", .optimizeFunc = osdOptimize } + { .pName = "OptimizeScanData", .optimizeFunc = osdOptimize }, + { .pName = "ConditionPushDown", .optimizeFunc = cpdOptimize } }; static const int32_t optimizeRuleNum = (sizeof(optimizeRuleSet) / sizeof(SOptimizeRule)); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 3bdbc0b908cd1511c0ef88ff7917299cb1f52151..8459f4bebaced1bf67e754b96e6c03fc24cba2f1 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -492,58 +492,25 @@ static int32_t createScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubplan, return TSDB_CODE_FAILED; } -static int32_t createColFromDataBlockDesc(SDataBlockDescNode* pDesc, SNodeList* pCols) { - SNode* pNode; - FOREACH(pNode, pDesc->pSlots) { - SSlotDescNode* pSlot = (SSlotDescNode*)pNode; - SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); - if (NULL == pCol) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pCol->node.resType = pSlot->dataType; - pCol->dataBlockId = pDesc->dataBlockId; - pCol->slotId = pSlot->slotId; - pCol->colId = -1; - int32_t code = nodesListStrictAppend(pCols, pCol); - if (TSDB_CODE_SUCCESS != code) { - return code; - } - } - return TSDB_CODE_SUCCESS; -} - -static int32_t createJoinOutputCols(SPhysiPlanContext* pCxt, SDataBlockDescNode* pLeftDesc, SDataBlockDescNode* pRightDesc, SNodeList** pList) { - SNodeList* pCols = nodesMakeList(); - if (NULL == pCols) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - int32_t code = createColFromDataBlockDesc(pLeftDesc, pCols); - if (TSDB_CODE_SUCCESS == code) { - code = createColFromDataBlockDesc(pRightDesc, pCols); - } - - if (TSDB_CODE_SUCCESS == code) { - *pList = pCols; - } else { - nodesDestroyList(pCols); - } - - return code; -} - static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SJoinLogicNode* pJoinLogicNode, SPhysiNode** pPhyNode) { SJoinPhysiNode* pJoin = (SJoinPhysiNode*)makePhysiNode(pCxt, getPrecision(pChildren), (SLogicNode*)pJoinLogicNode, QUERY_NODE_PHYSICAL_PLAN_JOIN); if (NULL == pJoin) { return TSDB_CODE_OUT_OF_MEMORY; } - SDataBlockDescNode* pLeftDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc; - SDataBlockDescNode* pRightDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 1))->pOutputDataBlockDesc; + int32_t code = TSDB_CODE_SUCCESS; - int32_t code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pOnConditions, &pJoin->pOnConditions); + pJoin->joinType = pJoinLogicNode->joinType; + if (NULL != pJoinLogicNode->pOnConditions) { + SDataBlockDescNode* pLeftDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc; + SDataBlockDescNode* pRightDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 1))->pOutputDataBlockDesc; + code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pOnConditions, &pJoin->pOnConditions); + } if (TSDB_CODE_SUCCESS == code) { - code = createJoinOutputCols(pCxt, pLeftDesc, pRightDesc, &pJoin->pTargets); + pJoin->pTargets = nodesCloneList(pJoinLogicNode->node.pTargets); + if (NULL == pJoin->pTargets) { + code = TSDB_CODE_OUT_OF_MEMORY; + } } if (TSDB_CODE_SUCCESS == code) { code = addDataBlockSlots(pCxt, pJoin->pTargets, pJoin->node.pOutputDataBlockDesc); diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index ad1a8c01c89839e9b76e58e9c940ed35e959a05b..0b21052955a6cb6609f2e838444e121714274373 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -190,6 +190,7 @@ int32_t splitLogicPlan(SPlanContext* pCxt, SLogicNode* pLogicNode, SLogicSubplan pSubplan->subplanType = SUBPLAN_TYPE_SCAN; } pSubplan->id.queryId = pCxt->queryId; + pSubplan->id.groupId = 1; setLogicNodeParent(pSubplan->pNode); int32_t code = applySplitRule(pSubplan); diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 51267d5825609fb522e96cb4819a5f711a379a3c..fd0084c01ecd8ae830ba615cfa26d2d490fcf68e 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -150,7 +150,7 @@ private: SQuery* query_; }; -TEST_F(PlannerTest, simple) { +TEST_F(PlannerTest, selectBasic) { setDatabase("root", "test"); bind("SELECT * FROM t1"); @@ -164,14 +164,27 @@ TEST_F(PlannerTest, selectConstant) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, stSimple) { +TEST_F(PlannerTest, selectStableBasic) { setDatabase("root", "test"); bind("SELECT * FROM st1"); ASSERT_TRUE(run()); } -TEST_F(PlannerTest, groupBy) { +TEST_F(PlannerTest, selectJoin) { + setDatabase("root", "test"); + + bind("SELECT * FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts"); + ASSERT_TRUE(run()); + + bind("SELECT * FROM st1s1 t1 join st1s2 t2 on t1.ts = t2.ts where t1.c1 > t2.c1"); + ASSERT_TRUE(run()); + + bind("SELECT t1.* FROM st1s1 t1 join st1s2 t2 on t1.ts = t2.ts where t1.c1 > t2.c1"); + ASSERT_TRUE(run()); +} + +TEST_F(PlannerTest, selectGroupBy) { setDatabase("root", "test"); bind("SELECT count(*) FROM t1"); @@ -187,14 +200,14 @@ TEST_F(PlannerTest, groupBy) { // ASSERT_TRUE(run()); } -TEST_F(PlannerTest, subquery) { +TEST_F(PlannerTest, selectSubquery) { setDatabase("root", "test"); bind("SELECT count(*) FROM (SELECT c1 + c3 a, c1 + count(*) b FROM t1 where c2 = 'abc' GROUP BY c1, c3) where a > 100 group by b"); ASSERT_TRUE(run()); } -TEST_F(PlannerTest, interval) { +TEST_F(PlannerTest, selectInterval) { setDatabase("root", "test"); bind("SELECT count(*) FROM t1 interval(10s)"); @@ -210,14 +223,14 @@ TEST_F(PlannerTest, interval) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, sessionWindow) { +TEST_F(PlannerTest, selectSessionWindow) { setDatabase("root", "test"); bind("SELECT count(*) FROM t1 session(ts, 10s)"); ASSERT_TRUE(run()); } -TEST_F(PlannerTest, stateWindow) { +TEST_F(PlannerTest, selectStateWindow) { setDatabase("root", "test"); bind("SELECT count(*) FROM t1 state_window(c1)"); @@ -227,7 +240,7 @@ TEST_F(PlannerTest, stateWindow) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, partitionBy) { +TEST_F(PlannerTest, selectPartitionBy) { setDatabase("root", "test"); bind("SELECT * FROM t1 partition by c1"); @@ -243,7 +256,7 @@ TEST_F(PlannerTest, partitionBy) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, orderBy) { +TEST_F(PlannerTest, selectOrderBy) { setDatabase("root", "test"); bind("SELECT c1 FROM t1 order by c1"); @@ -259,7 +272,7 @@ TEST_F(PlannerTest, orderBy) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, groupByOrderBy) { +TEST_F(PlannerTest, selectGroupByOrderBy) { setDatabase("root", "test"); bind("select count(*), sum(c1) from t1 order by sum(c1)"); @@ -269,7 +282,7 @@ TEST_F(PlannerTest, groupByOrderBy) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, distinct) { +TEST_F(PlannerTest, selectDistinct) { setDatabase("root", "test"); bind("SELECT distinct c1 FROM t1"); @@ -282,7 +295,7 @@ TEST_F(PlannerTest, distinct) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, limit) { +TEST_F(PlannerTest, selectLimit) { setDatabase("root", "test"); bind("SELECT * FROM t1 limit 2"); @@ -295,7 +308,7 @@ TEST_F(PlannerTest, limit) { ASSERT_TRUE(run()); } -TEST_F(PlannerTest, slimit) { +TEST_F(PlannerTest, selectSlimit) { setDatabase("root", "test"); bind("SELECT * FROM t1 partition by c1 slimit 2"); diff --git a/source/libs/scalar/inc/sclInt.h b/source/libs/scalar/inc/sclInt.h index 58b62bb05e40ff80f50a59601fd1256eb4cc00e3..3d59ffd93d7ac7e59ac1aa9e81023f3d2cb30636 100644 --- a/source/libs/scalar/inc/sclInt.h +++ b/source/libs/scalar/inc/sclInt.h @@ -46,8 +46,9 @@ typedef struct SScalarCtx { int32_t doConvertDataType(SValueNode* pValueNode, SScalarParam* out); SColumnInfoData* createColumnInfoData(SDataType* pType, int32_t numOfRows); -#define GET_PARAM_TYPE(_c) ((_c)->columnData->info.type) -#define GET_PARAM_BYTES(_c) ((_c)->columnData->info.bytes) +#define GET_PARAM_TYPE(_c) ((_c)->columnData->info.type) +#define GET_PARAM_BYTES(_c) ((_c)->columnData->info.bytes) +#define GET_PARAM_PRECISON(_c) ((_c)->columnData->info.precision) void sclFreeParam(SScalarParam *param); diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 7b861f9b7979f87630aaa3d4668b6a301b023ac2..db62a6b33d6baaf60b4cc0c0fa0eda8bf641ef53 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1,6 +1,7 @@ #include "function.h" #include "scalar.h" #include "tdatablock.h" +#include "ttime.h" #include "sclInt.h" #include "sclvector.h" @@ -801,6 +802,446 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp return TSDB_CODE_SUCCESS; } +int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + int32_t type = GET_PARAM_TYPE(pInput); + if (type != TSDB_DATA_TYPE_BIGINT && type != TSDB_DATA_TYPE_TIMESTAMP) { + return TSDB_CODE_FAILED; + } + + if (inputNum != 1) { + return TSDB_CODE_FAILED; + } + + char *input = pInput[0].columnData->pData; + for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { + if (colDataIsNull_s(pInput[0].columnData, i)) { + colDataAppendNULL(pOutput->columnData, i); + continue; + } + + char fraction[20] = {0}; + bool hasFraction = false; + NUM_TO_STRING(type, input, sizeof(fraction), fraction); + int32_t tsDigits = (int32_t)strlen(fraction); + + char buf[64] = {0}; + int64_t timeVal; + GET_TYPED_DATA(timeVal, int64_t, type, input); + if (tsDigits > TSDB_TIME_PRECISION_SEC_DIGITS) { + if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal / 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / (1000 * 1000); + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / (1000 * 1000 * 1000); + } else { + assert(0); + } + hasFraction = true; + memmove(fraction, fraction + TSDB_TIME_PRECISION_SEC_DIGITS, TSDB_TIME_PRECISION_SEC_DIGITS); + } + + struct tm *tmInfo = localtime((const time_t *)&timeVal); + strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S%z", tmInfo); + int32_t len = (int32_t)strlen(buf); + + if (hasFraction) { + int32_t fracLen = (int32_t)strlen(fraction) + 1; + char *tzInfo = strchr(buf, '+'); + if (tzInfo) { + memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo)); + } else { + tzInfo = strchr(buf, '-'); + memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo)); + } + + char tmp[32]; + sprintf(tmp, ".%s", fraction); + memcpy(tzInfo, tmp, fracLen); + len += fracLen; + } + + memmove(buf + VARSTR_HEADER_SIZE, buf, len); + varDataSetLen(buf, len); + + colDataAppend(pOutput->columnData, i, buf, false); + input += tDataTypes[type].bytes; + } + + pOutput->numOfRows = pInput->numOfRows; + + return TSDB_CODE_SUCCESS; +} + +int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + int32_t type = GET_PARAM_TYPE(pInput); + int32_t timePrec = GET_PARAM_PRECISON(pInput); + if (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR) { + return TSDB_CODE_FAILED; + } + + if (inputNum != 1) { + return TSDB_CODE_FAILED; + } + + char *input = pInput[0].columnData->pData + pInput[0].columnData->varmeta.offset[0]; + for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { + if (colDataIsNull_s(pInput[0].columnData, i)) { + colDataAppendNULL(pOutput->columnData, i); + continue; + } + + int64_t timeVal = 0; + convertStringToTimestamp(type, input, timePrec, &timeVal); + + colDataAppend(pOutput->columnData, i, (char *)&timeVal, false); + input += varDataTLen(input); + } + + pOutput->numOfRows = pInput->numOfRows; + + return TSDB_CODE_SUCCESS; +} + +int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + int32_t type = GET_PARAM_TYPE(&pInput[0]); + int32_t timePrec = GET_PARAM_PRECISON(&pInput[0]); + if (inputNum != 2) { + return TSDB_CODE_FAILED; + } + + if (type != TSDB_DATA_TYPE_BIGINT && type != TSDB_DATA_TYPE_TIMESTAMP && + type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR) { + return TSDB_CODE_FAILED; + } + + if (GET_PARAM_TYPE(&pInput[1]) != TSDB_DATA_TYPE_BIGINT) { //time_unit + return TSDB_CODE_FAILED; + } + + int64_t timeUnit, timeVal = 0; + GET_TYPED_DATA(timeUnit, int64_t, GET_PARAM_TYPE(&pInput[1]), pInput[1].columnData->pData); + + int64_t factor = (timePrec == TSDB_TIME_PRECISION_MILLI) ? 1000 : + (timePrec == TSDB_TIME_PRECISION_MICRO ? 1000000 : 1000000000); + + char *input = NULL; + if (IS_VAR_DATA_TYPE(type)) { + input = pInput[0].columnData->pData + pInput[0].columnData->varmeta.offset[0]; + } else { + input = pInput[0].columnData->pData; + } + + for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { + if (colDataIsNull_s(pInput[0].columnData, i)) { + colDataAppendNULL(pOutput->columnData, i); + continue; + } + + if (IS_VAR_DATA_TYPE(type)) { /* datetime format strings */ + convertStringToTimestamp(type, input, TSDB_TIME_PRECISION_NANO, &timeVal); + //If converted value is less than 10digits in second, use value in second instead + int64_t timeValSec = timeVal / 1000000000; + if (timeValSec < 1000000000) { + timeVal = timeValSec; + } + } else if (type == TSDB_DATA_TYPE_BIGINT) { /* unix timestamp */ + GET_TYPED_DATA(timeVal, int64_t, type, input); + } else if (type == TSDB_DATA_TYPE_TIMESTAMP) { /* timestamp column*/ + GET_TYPED_DATA(timeVal, int64_t, type, input); + int64_t timeValSec = timeVal / factor; + if (timeValSec < 1000000000) { + timeVal = timeValSec; + } + } + + char buf[20] = {0}; + NUM_TO_STRING(TSDB_DATA_TYPE_BIGINT, &timeVal, sizeof(buf), buf); + int32_t tsDigits = (int32_t)strlen(buf); + timeUnit = timeUnit * 1000 / factor; + + switch (timeUnit) { + case 0: { /* 1u */ + if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000 * 1000; + //} else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + // //timeVal = timeVal / 1000; + } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { + timeVal = timeVal * factor; + } else { + timeVal = timeVal * 1; + } + break; + } + case 1: { /* 1a */ + if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal * 1; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / 1000 * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000000 * 1000000; + } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS){ + timeVal = timeVal * factor; + } else { + assert(0); + } + break; + } + case 1000: { /* 1s */ + if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal / 1000 * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / 1000000 * 1000000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000000000 * 1000000000; + } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { + timeVal = timeVal * factor; + } else { + assert(0); + } + break; + } + case 60000: { /* 1m */ + if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal / 1000 / 60 * 60 * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / 1000000 / 60 * 60 * 1000000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000000000 / 60 * 60 * 1000000000; + } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { + timeVal = timeVal * factor / factor / 60 * 60 * factor; + } else { + assert(0); + } + break; + } + case 3600000: { /* 1h */ + if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal / 1000 / 3600 * 3600 * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / 1000000 / 3600 * 3600 * 1000000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000000000 / 3600 * 3600 * 1000000000; + } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { + timeVal = timeVal * factor / factor / 3600 * 3600 * factor; + } else { + assert(0); + } + break; + } + case 86400000: { /* 1d */ + if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal / 1000 / 86400 * 86400 * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / 1000000 / 86400 * 86400 * 1000000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000000000 / 86400 * 86400 * 1000000000; + } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { + timeVal = timeVal * factor / factor / 86400* 86400 * factor; + } else { + assert(0); + } + break; + } + case 604800000: { /* 1w */ + if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal / 1000 / 604800 * 604800 * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / 1000000 / 604800 * 604800 * 1000000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000000000 / 604800 * 604800 * 1000000000; + } else if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { + timeVal = timeVal * factor / factor / 604800 * 604800* factor; + } else { + assert(0); + } + break; + } + default: { + timeVal = timeVal * 1; + break; + } + } + + //truncate the timestamp to db precision + switch (timePrec) { + case TSDB_TIME_PRECISION_MILLI: { + if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal / 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000000; + } + break; + } + case TSDB_TIME_PRECISION_MICRO: { + if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal = timeVal / 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal * 1000; + } + break; + } + case TSDB_TIME_PRECISION_NANO: { + if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal = timeVal * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal = timeVal * 1000000; + } + break; + } + } + + colDataAppend(pOutput->columnData, i, (char *)&timeVal, false); + if (IS_VAR_DATA_TYPE(type)) { + input += varDataTLen(input); + } else { + input += tDataTypes[type].bytes; + } + } + + pOutput->numOfRows = pInput->numOfRows; + + return TSDB_CODE_SUCCESS; +} + +int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + if (inputNum != 2 && inputNum != 3) { + return TSDB_CODE_FAILED; + } + + int32_t timePrec = GET_PARAM_PRECISON(&pInput[0]); + int64_t timeUnit = -1, timeVal[2] = {0}; + if (inputNum == 3) { + if (GET_PARAM_TYPE(&pInput[2]) != TSDB_DATA_TYPE_BIGINT) { + return TSDB_CODE_FAILED; + } + GET_TYPED_DATA(timeUnit, int64_t, GET_PARAM_TYPE(&pInput[2]), pInput[2].columnData->pData); + } + + char *input[2]; + for (int32_t k = 0; k < 2; ++k) { + int32_t type = GET_PARAM_TYPE(&pInput[k]); + if (type != TSDB_DATA_TYPE_BIGINT && type != TSDB_DATA_TYPE_TIMESTAMP && + type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR) { + return TSDB_CODE_FAILED; + } + + if (IS_VAR_DATA_TYPE(type)) { + input[k] = pInput[k].columnData->pData + pInput[k].columnData->varmeta.offset[0]; + } else { + input[k] = pInput[k].columnData->pData; + } + } + + for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { + for (int32_t k = 0; k < 2; ++k) { + if (colDataIsNull_s(pInput[0].columnData, i)) { + colDataAppendNULL(pOutput->columnData, i); + continue; + } + + int32_t type = GET_PARAM_TYPE(&pInput[k]); + if (IS_VAR_DATA_TYPE(type)) { /* datetime format strings */ + convertStringToTimestamp(type, input[k], TSDB_TIME_PRECISION_NANO, &timeVal[k]); + } else if (type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_TIMESTAMP) { /* unix timestamp or ts column*/ + GET_TYPED_DATA(timeVal[k], int64_t, type, input[k]); + if (type == TSDB_DATA_TYPE_TIMESTAMP) { + int64_t factor = (timePrec == TSDB_TIME_PRECISION_MILLI) ? 1000 : + (timePrec == TSDB_TIME_PRECISION_MICRO ? 1000000 : 1000000000); + int64_t timeValSec = timeVal[k] / factor; + if (timeValSec < 1000000000) { + timeVal[k] = timeValSec; + } + } + + char buf[20] = {0}; + NUM_TO_STRING(TSDB_DATA_TYPE_BIGINT, &timeVal[k], sizeof(buf), buf); + int32_t tsDigits = (int32_t)strlen(buf); + if (tsDigits <= TSDB_TIME_PRECISION_SEC_DIGITS) { + timeVal[k] = timeVal[k] * 1000000000; + } else if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) { + timeVal[k] = timeVal[k] * 1000000; + } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { + timeVal[k] = timeVal[k] * 1000; + } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { + timeVal[k] = timeVal[k]; + } + } + + if (pInput[k].numOfRows != 1) { + if (IS_VAR_DATA_TYPE(type)) { + input[k] += varDataTLen(input[k]); + } else { + input[k] += tDataTypes[type].bytes; + } + } + } + + int64_t result = (timeVal[0] >= timeVal[1]) ? (timeVal[0] - timeVal[1]) : + (timeVal[1] - timeVal[0]); + + if (timeUnit < 0) { // if no time unit given use db precision + switch(timePrec) { + case TSDB_TIME_PRECISION_MILLI: { + result = result / 1000000; + break; + } + case TSDB_TIME_PRECISION_MICRO: { + result = result / 1000; + break; + } + case TSDB_TIME_PRECISION_NANO: { + result = result / 1; + break; + } + } + } else { + int64_t factor = (timePrec == TSDB_TIME_PRECISION_MILLI) ? 1000 : + (timePrec == TSDB_TIME_PRECISION_MICRO ? 1000000 : 1000000000); + timeUnit = timeUnit * 1000 / factor; + switch(timeUnit) { + case 0: { /* 1u */ + result = result / 1000; + break; + } + case 1: { /* 1a */ + result = result / 1000000; + break; + } + case 1000: { /* 1s */ + result = result / 1000000000; + break; + } + case 60000: { /* 1m */ + result = result / 1000000000 / 60; + break; + } + case 3600000: { /* 1h */ + result = result / 1000000000 / 3600; + break; + } + case 86400000: { /* 1d */ + result = result / 1000000000 / 86400; + break; + } + case 604800000: { /* 1w */ + result = result / 1000000000 / 604800; + break; + } + default: { + break; + } + } + } + + colDataAppend(pOutput->columnData, i, (char *)&result, false); + } + + pOutput->numOfRows = pInput->numOfRows; + + return TSDB_CODE_SUCCESS; +} + int32_t atanFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { return doScalarFunctionUnique(pInput, inputNum, pOutput, atan); } diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 9df749bec76f13e386ec874913eb797dc75c315d..8a95635ddc6a4cb8d6bba41061e1e31a8654ef0e 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1196,21 +1196,22 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { return -1; } - // TODO: vLen may be zero - pVal = TDB_REALLOC(*ppVal, cd.vLen); - if (pVal == NULL) { - TDB_FREE(pKey); - return -1; - } - *ppKey = pKey; - *ppVal = pVal; - *kLen = cd.kLen; - *vLen = cd.vLen; - memcpy(pKey, cd.pKey, cd.kLen); - memcpy(pVal, cd.pVal, cd.vLen); + + if (ppVal) { + // TODO: vLen may be zero + pVal = TDB_REALLOC(*ppVal, cd.vLen); + if (pVal == NULL) { + TDB_FREE(pKey); + return -1; + } + + *ppVal = pVal; + *vLen = cd.vLen; + memcpy(pVal, cd.pVal, cd.vLen); + } ret = tdbBtcMoveToNext(pBtc); if (ret < 0) { diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index b4058b3c0ed3218694e24ad6ce429064d329ff03..a955fb3b0a88d53beae43e49ed03df735388c0d2 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -76,6 +76,47 @@ int32_t taosMkDir(const char *dirname) { return code; } +int32_t taosMulMkDir(const char *dirname) { + if (dirname == NULL) return -1; + char *temp = strdup(dirname); + char *pos = temp; + int32_t code = 0; + + if (strncmp(temp, "/", 1) == 0) { + pos += 1; + } else if (strncmp(temp, "./", 2) == 0) { + pos += 2; + } + + for ( ; *pos != '\0'; pos++) { + if (*pos == '/') { + *pos = '\0'; + code = mkdir(temp, 0755); + if (code < 0 && errno != EEXIST) { + free(temp); + return code; + } + *pos = '/'; + } + } + + if (*(pos - 1) != '/') { + code = mkdir(temp, 0755); + if (code < 0 && errno != EEXIST) { + free(temp); + return code; + } + } + free(temp); + + // int32_t code = mkdir(dirname, 0755); + if (code < 0 && errno == EEXIST) { + return 0; + } + + return code; +} + void taosRemoveOldFiles(const char *dirname, int32_t keepDays) { DIR *dir = opendir(dirname); if (dir == NULL) return; diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 4bd6b9e5cdb5b0b86ebcb7985a0f7349672495e7..4b55d4912cba3157186b3a6aaf557e964866a4ca 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -768,7 +768,7 @@ int32_t taosUmaskFile(int32_t maskVal) { } int32_t taosGetErrorFile(TdFilePtr pFile) { return errno; } -int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict__ ptrBuf) { +int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) { if (pFile == NULL) { return -1; } diff --git a/source/os/src/osSystem.c b/source/os/src/osSystem.c index a36b3d41d032387d7f6730371d62eabd8052ebfe..665f6370e1c35e17c3fdef1f66217ffd3095c3e1 100644 --- a/source/os/src/osSystem.c +++ b/source/os/src/osSystem.c @@ -29,6 +29,8 @@ struct termios oldtio; #endif +typedef struct FILE TdCmd; + void* taosLoadDll(const char* filename) { #if defined(WINDOWS) return NULL; @@ -178,3 +180,33 @@ void resetTerminalMode() { } #endif } + +TdCmdPtr taosOpenCmd(const char *cmd) { + if (cmd == NULL) return NULL; + return (TdCmdPtr)popen(cmd, "r"); +} + +int64_t taosGetLineCmd(TdCmdPtr pCmd, char ** __restrict ptrBuf) { + if (pCmd == NULL) { + return -1; + } + + size_t len = 0; + return getline(ptrBuf, &len, (FILE*)pCmd); +} + +int32_t taosEOFCmd(TdCmdPtr pCmd) { + if (pCmd == NULL) { + return 0; + } + return feof((FILE*)pCmd); +} + +int64_t taosCloseCmd(TdCmdPtr *ppCmd) { + if (ppCmd == NULL || *ppCmd == NULL) { + return 0; + } + pclose((FILE*)(*ppCmd)); + *ppCmd = NULL; + return 0; +} diff --git a/tests/pytest/insert/binary.py b/tests/pytest/insert/binary.py index 0cbb7876c6194041a160f8fee7271f0c76d3b90c..ffd1d6cb8cb716dabf0e5299d070cf8d7d73daf4 100644 --- a/tests/pytest/insert/binary.py +++ b/tests/pytest/insert/binary.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import platform import sys from util.log import * from util.cases import * @@ -13,6 +14,23 @@ class TDTestCase: tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) + def getPath(self, tool="taos"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + paths = [] + for root, dirs, files in os.walk(projPath): + if ((tool) in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + paths.append(os.path.join(root, tool)) + break + return paths[0] + def run(self): tdSql.prepare() @@ -53,16 +71,27 @@ class TDTestCase: tdLog.info("tdSql.checkData(0, 0, '34567')") tdSql.checkData(0, 0, '34567') tdLog.info("insert into tb values (now+4a, \"'';\")") - config_dir = subprocess.check_output(str("ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"), stderr=subprocess.STDOUT, shell=True).decode('utf-8').replace('\n', '') - result = ''.join(os.popen(r"""taos -s "insert into db.tb values (now+4a, \"'';\")" -c %s"""%(config_dir)).readlines()) - if "Query OK" not in result: tdLog.exit("err:insert '';") - tdLog.info('drop database db') - tdSql.execute('drop database db') - tdLog.info('show databases') - tdSql.query('show databases') - tdLog.info('tdSql.checkRow(0)') - tdSql.checkRows(0) -# convert end + + if platform.system() == "Linux": + config_dir = subprocess.check_output( + str("ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"), + stderr=subprocess.STDOUT, + shell=True).decode('utf-8').replace( + '\n', + '') + + binPath = self.getPath("taos") + if (binPath == ""): + tdLog.exit("taos not found!") + else: + tdLog.info("taos found: %s" % binPath) + + result = ''.join( + os.popen( + r"""%s -s "insert into db.tb values (now+4a, \"'';\")" -c %s""" % + (binPath, (config_dir))).readlines()) + if "Query OK" not in result: + tdLog.exit("err:insert '';") def stop(self): tdSql.close() diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index c5c041be91719f7385e623ffa78e99fa9b6e8ff7..730937333b75dab96f2678b5894fd6fe0e3eb79d 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -59,6 +59,15 @@ ./test.sh -f tsim/tmq/oneTopic.sim ./test.sh -f tsim/tmq/multiTopic.sim +./test.sh -f tsim/tmq/mainConsumerInMultiTopic.sim +./test.sh -f tsim/tmq/mainConsumerInOneTopic.sim + +#fail ./test.sh -f tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim +#fail ./test.sh -f tsim/tmq/main2Con1Cgrp1TopicFrStb.sim +./test.sh -f tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim +./test.sh -f tsim/tmq/main2Con1Cgrp2TopicFrStb.sim + + # --- stable ./test.sh -f tsim/stable/disk.sim ./test.sh -f tsim/stable/dnode3.sim @@ -80,4 +89,7 @@ ./test.sh -f tsim/qnode/basic1.sim -m ./test.sh -f tsim/mnode/basic1.sim -m +# --- sma +./test.sh -f tsim/sma/tsmaCreateInsertData.sim + #======================b1-end=============== diff --git a/tests/script/tmp/back.sim b/tests/script/tmp/back.sim new file mode 100644 index 0000000000000000000000000000000000000000..9202e90594bc3bed6e4b63f2ac1f863af91620be --- /dev/null +++ b/tests/script/tmp/back.sim @@ -0,0 +1,6 @@ +sql connect +$x = 1 +begin: + sql insert into db.tb values(now, $x ) -x begin + $x = $x + 1 +goto begin diff --git a/tests/script/tmp/data.sim b/tests/script/tmp/data.sim new file mode 100644 index 0000000000000000000000000000000000000000..faac5b28289099c4050579f51099cfda716ad887 --- /dev/null +++ b/tests/script/tmp/data.sim @@ -0,0 +1,14 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create database db +sql create table db.tb (ts timestamp, i int) +sql insert into db.tb values(now, 1) + +print ======== start back +run_back tmp/back.sim + +sleep 2000 +return -1 diff --git a/tests/script/tsim/query/complex_group.sim b/tests/script/tsim/query/complex_group.sim index 3a1ec523fe8f449fc884e8e3867dadde32898715..d6ce26b69a05e404fc8b60907285d1a47178f376 100644 --- a/tests/script/tsim/query/complex_group.sim +++ b/tests/script/tsim/query/complex_group.sim @@ -97,167 +97,167 @@ print ================ query 1 group by filter sql select count(*) from ct3 group by c1 print ====> sql : select count(*) from ct3 group by c1 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c2 print ====> sql : select count(*) from ct3 group by c2 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c3 print ====> sql : select count(*) from ct3 group by c3 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c4 print ====> sql : select count(*) from ct3 group by c4 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c5 print ====> sql : select count(*) from ct3 group by c5 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c6 print ====> sql : select count(*) from ct3 group by c6 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c7 print ====> sql : select count(*) from ct3 group by c7 print ====> rows: $rows -if $rows != 2 then +if $rows != 3 then return -1 endi sql select count(*) from ct3 group by c8 print ====> sql : select count(*) from ct3 group by c8 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c9 print ====> sql : select count(*) from ct3 group by c9 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c10 print ====> sql : select count(*) from ct3 group by c10 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi print ================ query 2 complex with group by sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select abs(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select acos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select asin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select atan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select ceil(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select cos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select floor(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select log(c1,10) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select pow(c1,3) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select round(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select round(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select sqrt(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select sin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select tan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 @@ -307,170 +307,170 @@ print ================ query 1 group by filter sql select count(*) from ct3 group by c1 print ====> sql : select count(*) from ct3 group by c1 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c2 print ====> sql : select count(*) from ct3 group by c2 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c3 print ====> sql : select count(*) from ct3 group by c3 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c4 print ====> sql : select count(*) from ct3 group by c4 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c5 print ====> sql : select count(*) from ct3 group by c5 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c6 print ====> sql : select count(*) from ct3 group by c6 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c7 print ====> sql : select count(*) from ct3 group by c7 print ====> rows: $rows -if $rows != 2 then +if $rows != 3 then return -1 endi sql select count(*) from ct3 group by c8 print ====> sql : select count(*) from ct3 group by c8 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c9 print ====> sql : select count(*) from ct3 group by c9 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi sql select count(*) from ct3 group by c10 print ====> sql : select count(*) from ct3 group by c10 print ====> rows: $rows -if $rows != 8 then +if $rows != 9 then return -1 endi print ================ query 2 complex with group by sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select abs(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select acos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select asin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select atan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select ceil(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select cos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select floor(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select log(c1,10) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select pow(c1,3) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select round(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select round(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select sqrt(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select sin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 -print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 +sql select tan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 +print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -#system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/query/complex_having.sim b/tests/script/tsim/query/complex_having.sim index 009a106311794a429995e0ddfdf39cdc5eceda66..10283153d89c1cd6839db0b1cdc24b7f562fd623 100644 --- a/tests/script/tsim/query/complex_having.sim +++ b/tests/script/tsim/query/complex_having.sim @@ -77,9 +77,9 @@ sql insert into ct4 values ( '2022-05-21 01:01:01.000', NULL, NULL, NULL, NULL, print ================ start query ====================== print ================ query 1 having condition -sql_error select c1 from ct1 group by c1 having count(c1) -sql_error select c1 from ct4 group by c1 having count(c1) -sql_error select count(c1) from ct1 group by c1 having count(c1) +sql select c1 from ct1 group by c1 having count(c1) +sql select c1 from ct4 group by c1 having count(c1) +sql select count(c1) from ct1 group by c1 having count(c1) sql select sum(c1) ,count(c7) from ct4 group by c7 having count(c7) > 1 ; print ====> sql : select sum(c1) ,count(c7) from ct4 group by c7 having count(c7) > 1 ; @@ -98,22 +98,22 @@ endi sql select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 2 and sum(c1) > 2 ; print ====> sql : select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 2 and sum(c1) > 2 ; print ====> rows: $rows -if $rows != 2 then +if $rows != 7 then return -1 endi sql select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 1 or sum(c1) > 2 ; print ====> sql : select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 1 or sum(c1) > 2 ; print ====> rows: $rows -if $rows != 2 then +if $rows != 7 then return -1 endi print ================ query 1 complex with having condition -sql select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) < 1 limit 1 offset 1 -print ====> sql : select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) < 1 limit 1 offset 1 +sql select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) > 1 limit 1 offset 0 +print ====> sql : select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) > 1 limit 1 offset 0 print ====> rows: $rows if $rows != 1 then return -1 @@ -250,9 +250,9 @@ if $data00 != 20 then endi print ================ query 1 having condition -sql_error select c1 from ct1 group by c1 having count(c1) -sql_error select c1 from ct4 group by c1 having count(c1) -sql_error select count(c1) from ct1 group by c1 having count(c1) +sql select c1 from ct1 group by c1 having count(c1) +sql select c1 from ct4 group by c1 having count(c1) +sql select count(c1) from ct1 group by c1 having count(c1) sql select sum(c1) ,count(c7) from ct4 group by c7 having count(c7) > 1 ; print ====> sql : select sum(c1) ,count(c7) from ct4 group by c7 having count(c7) > 1 ; @@ -271,22 +271,22 @@ endi sql select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 2 and sum(c1) > 2 ; print ====> sql : select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 2 and sum(c1) > 2 ; print ====> rows: $rows -if $rows != 2 then +if $rows != 7 then return -1 endi sql select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 1 or sum(c1) > 2 ; print ====> sql : select sum(c1) ,count(c1) from ct4 group by c1 having count(c7) < 1 or sum(c1) > 2 ; print ====> rows: $rows -if $rows != 2 then +if $rows != 7 then return -1 endi print ================ query 1 complex with having condition -sql select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) < 1 limit 1 offset 1 -print ====> sql : select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) < 1 limit 1 offset 1 +sql select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) > 1 limit 1 offset 0 +print ====> sql : select count(c1) from ct4 where c1 > 2 group by c7 having count(c1) > 1 limit 1 offset 0 print ====> rows: $rows if $rows != 1 then return -1 diff --git a/tests/script/tsim/query/complex_where.sim b/tests/script/tsim/query/complex_where.sim index 7a5de85a3c39cc8cffcba644125a321ea5e2f619..312c1d98ed1d5bdb189612de5293e7d2967a1309 100644 --- a/tests/script/tsim/query/complex_where.sim +++ b/tests/script/tsim/query/complex_where.sim @@ -192,14 +192,14 @@ if $data01 != 1 then return -1 endi -sql select c1 from stb1 where stb1 > 5 and c1 <= 6 +sql select c1 from stb1 where c1 > 5 and c1 <= 6 print ====> sql : select c1 from stb1 where c1 > 5 and c1 <= 6 print ====> rows: $rows print ====> rows0: $data00 -if $rows != 4 then +if $rows != 3 then return -1 endi -if $data01 != 6 then +if $data00 != 6 then return -1 endi @@ -210,7 +210,7 @@ print ====> rows0: $data00 if $rows != 32 then return -1 endi -if $data01 != 1 then +if $data00 != 1 then return -1 endi @@ -221,7 +221,7 @@ print ====> rows0: $data00 if $rows != 17 then return -1 endi -if $data01 != 5 then +if $data00 != 5 then return -1 endi @@ -240,7 +240,7 @@ if $rows != 12 then return -1 endi -sql_error select c1 from stb1 where c7 between false and true +sql select c1 from stb1 where c7 between false and true sql select c1 from stb1 where c1 in (1,2,3) print ====> sql : select c1 from stb1 where c1 in (1,2,3) @@ -272,98 +272,98 @@ endi print ================ query 2 complex with where -sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select count(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select abs(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select acos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select asin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select atan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select ceil(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select cos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select floor(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select log(c1,10) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select pow(c1,3) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select round(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select sqrt(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select sin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select tan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then @@ -510,14 +510,14 @@ if $data01 != 1 then return -1 endi -sql select c1 from stb1 where stb1 > 5 and c1 <= 6 +sql select c1 from stb1 where c1 > 5 and c1 <= 6 print ====> sql : select c1 from stb1 where c1 > 5 and c1 <= 6 print ====> rows: $rows print ====> rows0: $data00 -if $rows != 4 then +if $rows != 3 then return -1 endi -if $data01 != 6 then +if $data00 != 6 then return -1 endi @@ -528,7 +528,7 @@ print ====> rows0: $data00 if $rows != 32 then return -1 endi -if $data01 != 1 then +if $data00 != 1 then return -1 endi @@ -539,7 +539,7 @@ print ====> rows0: $data00 if $rows != 17 then return -1 endi -if $data01 != 5 then +if $data00 != 5 then return -1 endi @@ -558,7 +558,7 @@ if $rows != 12 then return -1 endi -sql_error select c1 from stb1 where c7 between false and true +sql select c1 from stb1 where c7 between false and true sql select c1 from stb1 where c1 in (1,2,3) print ====> sql : select c1 from stb1 where c1 in (1,2,3) @@ -590,98 +590,98 @@ endi print ================ query 2 complex with where -sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select count(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select abs(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select acos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select asin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select atan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select ceil(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select cos(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select floor(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select log(c1,10) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select pow(c1,3) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select round(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select sqrt(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select sin(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then return -1 endi -sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1 +sql select tan(c1) from ct3 where c1 > 2 group by c1 limit 1 offset 1 print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2 print ====> rows: $rows if $rows != 1 then diff --git a/tests/script/tsim/show/basic.sim b/tests/script/tsim/show/basic.sim index cc926861422518d4cfb5fffcd5f2f9d273950f22..ab6329a96eb9dbf79b8097f61783402150cd8376 100644 --- a/tests/script/tsim/show/basic.sim +++ b/tests/script/tsim/show/basic.sim @@ -28,8 +28,8 @@ sql connect # select */column from information_schema.xxxx; xxxx include: # dnodes, mnodes, modules, qnodes, -# user_databases, user_functions, user_indexes, user_stables, user_streams, -# user_tables, user_table_distributed, user_users, vgroups, +# user_databases, user_functions, user_indexes, user_stables, user_streams, +# user_tables, user_table_distributed, user_users, vgroups, print =============== add dnode2 into cluster sql create dnode $hostname port 7200 diff --git a/tests/script/tsim/sma/tsmaCreateInsertData.sim b/tests/script/tsim/sma/tsmaCreateInsertData.sim new file mode 100644 index 0000000000000000000000000000000000000000..9fc3700da182b892dea697e26649a2133278c91d --- /dev/null +++ b/tests/script/tsim/sma/tsmaCreateInsertData.sim @@ -0,0 +1,48 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print =============== create database +sql create database d1 +sql show databases +if $rows != 2 then + return -1 +endi + +print $data00 $data01 $data02 + +sql use d1 + +print =============== create super table, include column type for count/sum/min/max/first +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +sql create table ct1 using stb tags(1000) + +sql show tables +if $rows != 1 then + return -1 +endi + +print =============== insert data, mode1: one row one table in sql +sql insert into ct1 values(now+0s, 10, 2.0, 3.0) +sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) + + +print =============== create sma index from super table +sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(5m,10s) sliding(2m) +print $data00 $data01 $data02 $data03 + +print =============== trigger stream to execute sma aggr task and insert sma data into sma store +sql insert into ct1 values(now+5s, 20, 20.0, 30.0) +#=================================================================== + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/consumerMain.sim b/tests/script/tsim/tmq/consumerMain.sim deleted file mode 100644 index 51b90971fd76a3e61d6d8baaab4f0776757dd5c2..0000000000000000000000000000000000000000 --- a/tests/script/tsim/tmq/consumerMain.sim +++ /dev/null @@ -1,267 +0,0 @@ -#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 -# scene1: vgroups=1, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb -# scene2: vgroups=1, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb -# scene3: vgroups=4, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb -# scene4: vgroups=4, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb -# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN -# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; -# -# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). -# -######## ######## ######## ######## ######## ######## ######## ######## ######## ######## -######## This test case include scene1 and scene3 -######## ######## ######## ######## ######## ######## ######## ######## ######## ######## - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - -sql connect - -$loop_cnt = 0 -$vgroups = 1 -$dbNamme = d0 -loop_vgroups: -print =============== create database $dbNamme vgroups $vgroups -sql create database $dbNamme vgroups $vgroups -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 - -if $loop_cnt == 0 then - if $rows != 2 then - return -1 - endi - if $data02 != 1 then # vgroups - print vgroups: $data02 - return -1 - endi -else - if $rows != 3 then - return -1 - endi - if $data00 == d1 then - if $data02 != 4 then # vgroups - print vgroups: $data02 - return -1 - endi - else - if $data12 != 4 then # vgroups - print vgroups: $data12 - return -1 - endi - endi -endi - -sql use $dbNamme - -print =============== create super table -sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) - -sql show stables -if $rows != 1 then - return -1 -endi - -print =============== create child table -$tbPrefix = ct -$tbNum = 2 - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using stb tags( $i ) - $i = $i + 1 -endw - -print =============== create normal table -sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) - -print =============== create multi topics. notes: now only support: -print =============== 1. columns from stb/ctb/ntb; 2. * from ctb/ntb; 3. function from stb/ctb/ntb -print =============== will support: * from stb - -sql create topic topic_stb_column as select ts, c1, c3 from stb -#sql create topic topic_stb_all as select * from stb -sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb - -sql create topic topic_ctb_column as select ts, c1, c3 from ct0 -sql create topic topic_ctb_all as select * from ct0 -sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 - -sql create topic topic_ntb_column as select ts, c1, c3 from ntb -sql create topic topic_ntb_all as select * from ntb -sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb - -sql show tables -if $rows != 3 then - return -1 -endi - -print =============== run_back insert data - -if $loop_cnt == 0 then - run_back tsim/tmq/insertDataV1.sim -else - run_back tsim/tmq/insertDataV4.sim -endi - -sleep 1000 - -#$rowNum = 1000 -#$tstart = 1640966400000 # 2022-01-01 00:00:00.000 -# -#$i = 0 -#while $i < $tbNum -# $tb = $tbPrefix . $i -# -# $x = 0 -# while $x < $rowNum -# $c = $x / 10 -# $c = $c * 10 -# $c = $x - $c -# -# $binary = ' . binary -# $binary = $binary . $c -# $binary = $binary . ' -# -# sql insert into $tb values ($tstart , $c , $x , $binary ) -# sql insert into ntb values ($tstart , $c , $x , $binary ) -# $tstart = $tstart + 1 -# $x = $x + 1 -# endw -# -# $i = $i + 1 -# $tstart = 1640966400000 -#endw - -#root@trd02 /home $ tmq_sim --help -# -c Configuration directory, default is -# -d The name of the database for cosumer, no default -# -t The topic string for cosumer, no default -# -k The key-value string for cosumer, no default -# -g showMsgFlag, default is 0 -# - -$consumeDelay = 5000 -$expectConsumeMsgCnt = 1000 -print expectConsumeMsgCnt: $expectConsumeMsgCnt, consumeDelay: $consumeDelay - -# supported key: -# group.id: -# enable.auto.commit: -# auto.offset.reset: -# td.connect.ip: -# td.connect.user:root -# td.connect.pass:taosdata -# td.connect.port:6030 -# td.connect.db:db - -$expect_result = @{consume success: @ -$expect_result = $expect_result . $expectConsumeMsgCnt -$expect_result = $expect_result . @, @ -$expect_result = $expect_result . 0} -print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -if $system_content >= $expect_result then - return -1 -endi - -#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -#print cmd result----> $system_content -##if $system_content != @{consume success: 10000, 0}@ then -#if $system_content != $expect_result then -# return -1 -#endi - -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -#if $system_content != @{consume success: 10000, 0}@ then -if $system_content >= $expect_result then - return -1 -endi - -$expect_result = @{consume success: @ -$expect_result = $expect_result . $rowNum -$expect_result = $expect_result . @, @ -$expect_result = $expect_result . 0} -print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -if $system_content >= $expect_result then - return -1 -endi - -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -if $system_content >= $expect_result then - return -1 -endi - -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -if $system_content >= $expect_result then - return -1 -endi - -$expect_result = @{consume success: @ -$expect_result = $expect_result . $totalMsgCnt -$expect_result = $expect_result . @, @ -$expect_result = $expect_result . 0} -print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -if $system_content >= $expect_result then - return -1 -endi - -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -if $system_content >= $expect_result then - return -1 -endi - -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd result----> $system_content -if $system_content >= $expect_result then - return -1 -endi - -if $loop_cnt == 0 then - $loop_cnt = 1 - $vgroups = 4 - $dbNamme = d1 - goto loop_vgroups -endi - - -#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/insertDataV1.sim b/tests/script/tsim/tmq/insertDataV1.sim index a349c55dbdd9facc451e8bba3d91fae9a2110736..0df74d53f860b2b3db55e7957b111c0d5e818e89 100644 --- a/tests/script/tsim/tmq/insertDataV1.sim +++ b/tests/script/tsim/tmq/insertDataV1.sim @@ -22,23 +22,19 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $c = $x / 10 - $c = $c * 10 - $c = $x - $c - $binary = ' . binary - $binary = $binary . $c + $binary = $binary . $i $binary = $binary . ' - #print ====> insert into $tb values ($tstart , $c , $x , $binary ) - #print ====> insert into ntb values ($tstart , $c , $x , $binary ) - sql insert into $tb values ($tstart , $c , $x , $binary ) - sql insert into ntb values ($tstart , $c , $x , $binary ) + #print ====> insert into $tb values ($tstart , $i , $x , $binary ) + #print ====> insert into ntb values ($tstart , $i , $x , $binary ) + sql insert into $tb values ($tstart , $i , $x , $binary ) + sql insert into ntb values ($tstart , 999 , 999 , 'binary-ntb' ) $tstart = $tstart + 1 $x = $x + 1 endw - #print ====> insert rows: $rowNum into $tb and ntb + print ====> insert rows: $rowNum into $tb and ntb $i = $i + 1 # $tstart = 1640966400000 diff --git a/tests/script/tsim/tmq/insertDataV4.sim b/tests/script/tsim/tmq/insertDataV4.sim index 72c1358e7f30e750ef0f3bbba8d15bf27513dbb2..dbd52f56b8b79afceafe3c9faede8ebe99bc94a3 100644 --- a/tests/script/tsim/tmq/insertDataV4.sim +++ b/tests/script/tsim/tmq/insertDataV4.sim @@ -22,18 +22,14 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $c = $x / 10 - $c = $c * 10 - $c = $x - $c - $binary = ' . binary - $binary = $binary . $c + $binary = $binary . $i $binary = $binary . ' - #print ====> insert into $tb values ($tstart , $c , $x , $binary ) - #print ====> insert into ntb values ($tstart , $c , $x , $binary ) - sql insert into $tb values ($tstart , $c , $x , $binary ) - sql insert into ntb values ($tstart , $c , $x , $binary ) + #print ====> insert into $tb values ($tstart , $i , $x , $binary ) + #print ====> insert into ntb values ($tstart , $i , $x , $binary ) + sql insert into $tb values ($tstart , $i , $x , $binary ) + sql insert into ntb values ($tstart , 999 , 999 , 'binary-ntb' ) $tstart = $tstart + 1 $x = $x + 1 endw diff --git a/tests/script/tsim/tmq/insertFixedDataV2.sim b/tests/script/tsim/tmq/insertFixedDataV2.sim new file mode 100644 index 0000000000000000000000000000000000000000..a93be3e5a678fd1ba0880b871c186cc334717f27 --- /dev/null +++ b/tests/script/tsim/tmq/insertFixedDataV2.sim @@ -0,0 +1,51 @@ + +sql connect + +print ================ insert data +$dbNamme = d0 +$tbPrefix = ct +$tbNum = 10 +$rowNum = 100 +$tstart = 1640966400000 # 2022-01-01 00:00:00.000 + +$loopInsertNum = 10 + +sql use $dbNamme + +$loopIndex = 0 + +loop_insert: +print ====> loop $loopIndex insert +$loopIndex = $loopIndex + 1 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + + $x = 0 + while $x < $rowNum + $binary = ' . binary + $binary = $binary . $i + $binary = $binary . ' + + #print ====> insert into $tb values ($tstart , $i , $x , $binary ) + #print ====> insert into ntb values ($tstart , $i , $x , $binary ) + sql insert into $tb values ($tstart , $i , $x , $binary ) + sql insert into ntb values ($tstart , 999 , 999 , 'binary-ntb' ) + $tstart = $tstart + 1 + $x = $x + 1 + endw + + #print ====> insert rows: $rowNum into $tb and ntb + + $i = $i + 1 +# $tstart = 1640966400000 +endw + + +if $loopIndex < $loopInsertNum then + goto loop_insert +endi + +print ====> insert data end =========== + diff --git a/tests/script/tsim/tmq/insertFixedDataV4.sim b/tests/script/tsim/tmq/insertFixedDataV4.sim new file mode 100644 index 0000000000000000000000000000000000000000..9f7f86747f8bc88c1fe9fa2f4a3810588f6b8691 --- /dev/null +++ b/tests/script/tsim/tmq/insertFixedDataV4.sim @@ -0,0 +1,51 @@ + +sql connect + +print ================ insert data +$dbNamme = d1 +$tbPrefix = ct +$tbNum = 10 +$rowNum = 100 +$tstart = 1640966400000 # 2022-01-01 00:00:00.000 + +$loopInsertNum = 10 + +sql use $dbNamme + +$loopIndex = 0 + +loop_insert: +print ====> loop $loopIndex insert +$loopIndex = $loopIndex + 1 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + + $x = 0 + while $x < $rowNum + $binary = ' . binary + $binary = $binary . $i + $binary = $binary . ' + + #print ====> insert into $tb values ($tstart , $i , $x , $binary ) + #print ====> insert into ntb values ($tstart , $i , $x , $binary ) + sql insert into $tb values ($tstart , $i , $x , $binary ) + sql insert into ntb values ($tstart , 999 , 999 , 'binary-ntb' ) + $tstart = $tstart + 1 + $x = $x + 1 + endw + + #print ====> insert rows: $rowNum into $tb and ntb + + $i = $i + 1 +# $tstart = 1640966400000 +endw + + +if $loopIndex < $loopInsertNum then + goto loop_insert +endi + +print ====> insert data end =========== + diff --git a/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim new file mode 100644 index 0000000000000000000000000000000000000000..c301219ad60f901f85baae6c7cc98c531d22bfd5 --- /dev/null +++ b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim @@ -0,0 +1,265 @@ +#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 +# scene1: vgroups=2, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene2: vgroups=2, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene3: vgroups=4, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene4: vgroups=4, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN +# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; +# +# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). +# +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## +######## This test case include scene1 and scene3 +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 1 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready +endi + +sql connect + +$loop_cnt = 0 +$vgroups = 2 +$dbNamme = d0 +loop_vgroups: +print =============== create database $dbNamme vgroups $vgroups +sql create database $dbNamme vgroups $vgroups +sql show databases +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 + +if $loop_cnt == 0 then + if $rows != 2 then + return -1 + endi + if $data02 != 2 then # vgroups + print vgroups: $data02 + return -1 + endi +else + if $rows != 3 then + return -1 + endi + if $data00 == d1 then + if $data02 != 4 then # vgroups + print vgroups: $data02 + return -1 + endi + else + if $data12 != 4 then # vgroups + print vgroups: $data12 + return -1 + endi + endi +endi + +sql use $dbNamme + +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +$tbPrefix = ct +$tbNum = 100 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $i = $i + 1 +endw + +print =============== create normal table +sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) + +print =============== create topics from child table + +sql create topic topic_ctb_column as select ts, c1, c3 from ct0 +sql create topic topic_ctb_all as select * from ct0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 + +#sql create topic topic_ntb_column as select ts, c1, c3 from ntb +#sql create topic topic_ntb_all as select * from ntb +#sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb + +sql show tables +if $rows != 101 then + return -1 +endi + +print =============== run_back insert data + +if $loop_cnt == 0 then + run_back tsim/tmq/insertFixedDataV2.sim +else + run_back tsim/tmq/insertFixedDataV4.sim +endi + +#sleep 1000 + +#$rowNum = 1000 +#$tstart = 1640966400000 # 2022-01-01 00:00:00.000 +# +#$i = 0 +#while $i < $tbNum +# $tb = $tbPrefix . $i +# +# $x = 0 +# while $x < $rowNum +# $c = $x / 10 +# $c = $c * 10 +# $c = $x - $c +# +# $binary = ' . binary +# $binary = $binary . $c +# $binary = $binary . ' +# +# sql insert into $tb values ($tstart , $c , $x , $binary ) +# sql insert into ntb values ($tstart , $c , $x , $binary ) +# $tstart = $tstart + 1 +# $x = $x + 1 +# endw +# +# $i = $i + 1 +# $tstart = 1640966400000 +#endw + +#root@trd02 /home $ tmq_sim --help +# -c Configuration directory, default is +# -d The name of the database for cosumer, no default +# -t The topic string for cosumer, no default +# -k The key-value string for cosumer, no default +# -g showMsgFlag, default is 0 +# + +$tbNum = 10 +$consumeDelay = 10 +$expectMsgCntFromCtb = 300 +$expectMsgCntFromStb = $expectMsgCntFromCtb * $tbNum +print consumeDelay: $consumeDelay +print insert data child num: $tbNum +print expectMsgCntFromCtb: $expectMsgCntFromCtb +print expectMsgCntFromStb: $expectMsgCntFromStb + +# supported key: +# group.id: +# enable.auto.commit: +# auto.offset.reset: +# td.connect.ip: +# td.connect.user:root +# td.connect.pass:taosdata +# td.connect.port:6030 +# td.connect.db:db + +$expect_result = @{consume success: @ +$expect_result = $expect_result . $rowNum +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 0 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 0 +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 0 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 0 +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 0 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 0 +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $totalMsgCnt +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $expectConsumeMsgCnt +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +##print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +##system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +##print cmd result----> $system_content +###if $system_content != @{consume success: 10000, 0}@ then +##if $system_content != success then +## return -1 +##endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#print cmd result----> $system_content +##if $system_content != @{consume success: 10000, 0}@ then +#if $system_content != success then +# return -1 +#endi + +if $loop_cnt == 0 then + $loop_cnt = 1 + $vgroups = 4 + $dbNamme = d1 + goto loop_vgroups +endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim new file mode 100644 index 0000000000000000000000000000000000000000..0f38a8b58be548f73d78524ad042920a5708aef3 --- /dev/null +++ b/tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim @@ -0,0 +1,270 @@ +#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 +# scene1: vgroups=2, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene2: vgroups=2, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene3: vgroups=4, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene4: vgroups=4, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN +# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; +# +# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). +# +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## +######## This test case include scene1 and scene3 +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 1 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready +endi + +sql connect + +$loop_cnt = 0 +$vgroups = 2 +$dbNamme = d0 +loop_vgroups: +print =============== create database $dbNamme vgroups $vgroups +sql create database $dbNamme vgroups $vgroups +sql show databases +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 + +if $loop_cnt == 0 then + if $rows != 2 then + return -1 + endi + if $data02 != 2 then # vgroups + print vgroups: $data02 + return -1 + endi +else + if $rows != 3 then + return -1 + endi + if $data00 == d1 then + if $data02 != 4 then # vgroups + print vgroups: $data02 + return -1 + endi + else + if $data12 != 4 then # vgroups + print vgroups: $data12 + return -1 + endi + endi +endi + +sql use $dbNamme + +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +$tbPrefix = ct +$tbNum = 100 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $i = $i + 1 +endw + +print =============== create normal table +sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) + +print =============== create multi topics. notes: now only support: +print =============== 1. columns from stb/ctb/ntb; 2. * from ctb/ntb; 3. function from stb/ctb/ntb +print =============== will support: * from stb + +sql create topic topic_stb_column as select ts, c1, c3 from stb +#sql create topic topic_stb_all as select * from stb +sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb + +sql create topic topic_ctb_column as select ts, c1, c3 from ct0 +sql create topic topic_ctb_all as select * from ct0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 + +sql create topic topic_ntb_column as select ts, c1, c3 from ntb +sql create topic topic_ntb_all as select * from ntb +sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb + +sql show tables +if $rows != 101 then + return -1 +endi + +print =============== run_back insert data + +if $loop_cnt == 0 then + run_back tsim/tmq/insertFixedDataV2.sim +else + run_back tsim/tmq/insertFixedDataV4.sim +endi + +#sleep 1000 + +#$rowNum = 1000 +#$tstart = 1640966400000 # 2022-01-01 00:00:00.000 +# +#$i = 0 +#while $i < $tbNum +# $tb = $tbPrefix . $i +# +# $x = 0 +# while $x < $rowNum +# $c = $x / 10 +# $c = $c * 10 +# $c = $x - $c +# +# $binary = ' . binary +# $binary = $binary . $c +# $binary = $binary . ' +# +# sql insert into $tb values ($tstart , $c , $x , $binary ) +# sql insert into ntb values ($tstart , $c , $x , $binary ) +# $tstart = $tstart + 1 +# $x = $x + 1 +# endw +# +# $i = $i + 1 +# $tstart = 1640966400000 +#endw + +#root@trd02 /home $ tmq_sim --help +# -c Configuration directory, default is +# -d The name of the database for cosumer, no default +# -t The topic string for cosumer, no default +# -k The key-value string for cosumer, no default +# -g showMsgFlag, default is 0 +# + +$tbNum = 10 +$consumeDelay = 10 +$expectMsgCntFromCtb = 300 +$expectMsgCntFromStb = $expectMsgCntFromCtb * $tbNum +print consumeDelay: $consumeDelay +print insert data child num: $tbNum +print expectMsgCntFromCtb: $expectMsgCntFromCtb +print expectMsgCntFromStb: $expectMsgCntFromStb + +# supported key: +# group.id: +# enable.auto.commit: +# auto.offset.reset: +# td.connect.ip: +# td.connect.user:root +# td.connect.pass:taosdata +# td.connect.port:6030 +# td.connect.db:db + +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $rowNum +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $totalMsgCnt +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi + +$expect_result = @{consume success: @ +$expect_result = $expect_result . $expectConsumeMsgCnt +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#print cmd result----> $system_content +##if $system_content != @{consume success: 10000, 0}@ then +#if $system_content != success then +# return -1 +#endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +print cmd result----> $system_content +#if $system_content != @{consume success: 10000, 0}@ then +if $system_content != success then + return -1 +endi +if $loop_cnt == 0 then + $loop_cnt = 1 + $vgroups = 4 + $dbNamme = d1 + goto loop_vgroups +endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim new file mode 100644 index 0000000000000000000000000000000000000000..99d1c6e44212af8befedb93ae8bf19e9139f1e19 --- /dev/null +++ b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim @@ -0,0 +1,265 @@ +#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 +# scene1: vgroups=2, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene2: vgroups=2, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene3: vgroups=4, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene4: vgroups=4, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN +# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; +# +# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). +# +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## +######## This test case include scene1 and scene3 +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 1 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready +endi + +sql connect + +$loop_cnt = 0 +$vgroups = 2 +$dbNamme = d0 +loop_vgroups: +print =============== create database $dbNamme vgroups $vgroups +sql create database $dbNamme vgroups $vgroups +sql show databases +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 + +if $loop_cnt == 0 then + if $rows != 2 then + return -1 + endi + if $data02 != 2 then # vgroups + print vgroups: $data02 + return -1 + endi +else + if $rows != 3 then + return -1 + endi + if $data00 == d1 then + if $data02 != 4 then # vgroups + print vgroups: $data02 + return -1 + endi + else + if $data12 != 4 then # vgroups + print vgroups: $data12 + return -1 + endi + endi +endi + +sql use $dbNamme + +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +$tbPrefix = ct +$tbNum = 100 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $i = $i + 1 +endw + +print =============== create normal table +sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) + +print =============== create topics from child table + +sql create topic topic_ctb_column as select ts, c1, c3 from ct0 +sql create topic topic_ctb_all as select * from ct0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 + +#sql create topic topic_ntb_column as select ts, c1, c3 from ntb +#sql create topic topic_ntb_all as select * from ntb +#sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb + +sql show tables +if $rows != 101 then + return -1 +endi + +print =============== run_back insert data + +if $loop_cnt == 0 then + run_back tsim/tmq/insertFixedDataV2.sim +else + run_back tsim/tmq/insertFixedDataV4.sim +endi + +#sleep 1000 + +#$rowNum = 1000 +#$tstart = 1640966400000 # 2022-01-01 00:00:00.000 +# +#$i = 0 +#while $i < $tbNum +# $tb = $tbPrefix . $i +# +# $x = 0 +# while $x < $rowNum +# $c = $x / 10 +# $c = $c * 10 +# $c = $x - $c +# +# $binary = ' . binary +# $binary = $binary . $c +# $binary = $binary . ' +# +# sql insert into $tb values ($tstart , $c , $x , $binary ) +# sql insert into ntb values ($tstart , $c , $x , $binary ) +# $tstart = $tstart + 1 +# $x = $x + 1 +# endw +# +# $i = $i + 1 +# $tstart = 1640966400000 +#endw + +#root@trd02 /home $ tmq_sim --help +# -c Configuration directory, default is +# -d The name of the database for cosumer, no default +# -t The topic string for cosumer, no default +# -k The key-value string for cosumer, no default +# -g showMsgFlag, default is 0 +# + +$tbNum = 10 +$consumeDelay = 10 +$expectMsgCntFromCtb = 300 +$expectMsgCntFromStb = $expectMsgCntFromCtb * $tbNum +print consumeDelay: $consumeDelay +print insert data child num: $tbNum +print expectMsgCntFromCtb: $expectMsgCntFromCtb +print expectMsgCntFromStb: $expectMsgCntFromStb + +# supported key: +# group.id: +# enable.auto.commit: +# auto.offset.reset: +# td.connect.ip: +# td.connect.user:root +# td.connect.pass:taosdata +# td.connect.port:6030 +# td.connect.db:db + +$expect_result = @{consume success: @ +$expect_result = $expect_result . $rowNum +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $totalMsgCnt +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb -j 1 +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $expectConsumeMsgCnt +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +##print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +##system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +##print cmd result----> $system_content +###if $system_content != @{consume success: 10000, 0}@ then +##if $system_content != success then +## return -1 +##endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#print cmd result----> $system_content +##if $system_content != @{consume success: 10000, 0}@ then +#if $system_content != success then +# return -1 +#endi + +if $loop_cnt == 0 then + $loop_cnt = 1 + $vgroups = 4 + $dbNamme = d1 + goto loop_vgroups +endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim new file mode 100644 index 0000000000000000000000000000000000000000..76ad75aead51cc1f7c7474862997c263003e7698 --- /dev/null +++ b/tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim @@ -0,0 +1,270 @@ +#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 +# scene1: vgroups=2, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene2: vgroups=2, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene3: vgroups=4, one topic for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene4: vgroups=4, multi topics for two consumers, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN +# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; +# +# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). +# +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## +######## This test case include scene1 and scene3 +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 1 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready +endi + +sql connect + +$loop_cnt = 0 +$vgroups = 2 +$dbNamme = d0 +loop_vgroups: +print =============== create database $dbNamme vgroups $vgroups +sql create database $dbNamme vgroups $vgroups +sql show databases +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 + +if $loop_cnt == 0 then + if $rows != 2 then + return -1 + endi + if $data02 != 2 then # vgroups + print vgroups: $data02 + return -1 + endi +else + if $rows != 3 then + return -1 + endi + if $data00 == d1 then + if $data02 != 4 then # vgroups + print vgroups: $data02 + return -1 + endi + else + if $data12 != 4 then # vgroups + print vgroups: $data12 + return -1 + endi + endi +endi + +sql use $dbNamme + +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +$tbPrefix = ct +$tbNum = 100 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $i = $i + 1 +endw + +print =============== create normal table +sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) + +print =============== create multi topics. notes: now only support: +print =============== 1. columns from stb/ctb/ntb; 2. * from ctb/ntb; 3. function from stb/ctb/ntb +print =============== will support: * from stb + +sql create topic topic_stb_column as select ts, c1, c3 from stb +#sql create topic topic_stb_all as select * from stb +sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb + +sql create topic topic_ctb_column as select ts, c1, c3 from ct0 +sql create topic topic_ctb_all as select * from ct0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 + +sql create topic topic_ntb_column as select ts, c1, c3 from ntb +sql create topic topic_ntb_all as select * from ntb +sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb + +sql show tables +if $rows != 101 then + return -1 +endi + +print =============== run_back insert data + +if $loop_cnt == 0 then + run_back tsim/tmq/insertFixedDataV2.sim +else + run_back tsim/tmq/insertFixedDataV4.sim +endi + +#sleep 1000 + +#$rowNum = 1000 +#$tstart = 1640966400000 # 2022-01-01 00:00:00.000 +# +#$i = 0 +#while $i < $tbNum +# $tb = $tbPrefix . $i +# +# $x = 0 +# while $x < $rowNum +# $c = $x / 10 +# $c = $c * 10 +# $c = $x - $c +# +# $binary = ' . binary +# $binary = $binary . $c +# $binary = $binary . ' +# +# sql insert into $tb values ($tstart , $c , $x , $binary ) +# sql insert into ntb values ($tstart , $c , $x , $binary ) +# $tstart = $tstart + 1 +# $x = $x + 1 +# endw +# +# $i = $i + 1 +# $tstart = 1640966400000 +#endw + +#root@trd02 /home $ tmq_sim --help +# -c Configuration directory, default is +# -d The name of the database for cosumer, no default +# -t The topic string for cosumer, no default +# -k The key-value string for cosumer, no default +# -g showMsgFlag, default is 0 +# + +$tbNum = 10 +$consumeDelay = 10 +$expectMsgCntFromCtb = 300 +$expectMsgCntFromStb = $expectMsgCntFromCtb * $tbNum +print consumeDelay: $consumeDelay +print insert data child num: $tbNum +print expectMsgCntFromCtb: $expectMsgCntFromCtb +print expectMsgCntFromStb: $expectMsgCntFromStb + +# supported key: +# group.id: +# enable.auto.commit: +# auto.offset.reset: +# td.connect.ip: +# td.connect.user:root +# td.connect.pass:taosdata +# td.connect.port:6030 +# td.connect.db:db + +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $rowNum +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_column" -k1 "group.id:tg2" -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_all" -k1 "group.id:tg2" -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ctb_function" -k1 "group.id:tg2" -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#$expect_result = @{consume success: @ +#$expect_result = $expect_result . $totalMsgCnt +#$expect_result = $expect_result . @, @ +#$expect_result = $expect_result . 0} +#print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_column" -k1 "group.id:tg2" -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_all" -k1 "group.id:tg2" -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi +# +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_ntb_function" -k1 "group.id:tg2" -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +#print cmd result----> $system_content +#if $system_content != success then +# return -1 +#endi + +$expect_result = @{consume success: @ +$expect_result = $expect_result . $expectMsgCntFromStb +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb -j 1 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_function" -k1 "group.id:tg2" -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb -j 1 +print cmd result----> $system_content +if $system_content != success then + return -1 +endi + +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb -j 1 +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_all" -k1 "group.id:tg2" -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb -j 1 +#print cmd result----> $system_content +##if $system_content != @{consume success: 10000, 0}@ then +#if $system_content != success then +# return -1 +#endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb -j 1 +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t1 "topic_stb_column" -k1 "group.id:tg2" -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb -j 1 +print cmd result----> $system_content +#if $system_content != @{consume success: 10000, 0}@ then +if $system_content != success then + return -1 +endi +if $loop_cnt == 0 then + $loop_cnt = 1 + $vgroups = 4 + $dbNamme = d1 + goto loop_vgroups +endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim b/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim index 0df7a8ba57de9a25e75d079fe6898af0e99e1b9f..095809abe9428cba878fb9b2f4f7b0cdcb55d7df 100644 --- a/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim +++ b/tests/script/tsim/tmq/mainConsumerInMultiTopic.sim @@ -120,9 +120,9 @@ endi print =============== run_back insert data if $loop_cnt == 0 then - run_back tsim/tmq/insertDataV1.sim + run_back tsim/tmq/insertFixedDataV2.sim else - run_back tsim/tmq/insertDataV4.sim + run_back tsim/tmq/insertFixedDataV4.sim endi #sleep 1000 @@ -162,9 +162,16 @@ endi # -g showMsgFlag, default is 0 # -$consumeDelay = 50 -$consumeMsgCntFromTopic = 1000 -print consumeMsgCntFromTopic: $consumeMsgCntFromTopic , consumeDelay: $consumeDelay +$tbNum = 10 +$consumeDelay = 5 +$expectMsgCntFromCtb = 1000 +$expectMsgCntFromNtb = 1000 +$expectMsgCntFromStb = $expectMsgCntFromCtb * $tbNum +print consumeDelay: $consumeDelay +print insert data child num: $tbNum +print expectMsgCntFromCtb: $expectMsgCntFromCtb +print expectMsgCntFromStb: $expectMsgCntFromStb + # supported key: # group.id: @@ -177,49 +184,50 @@ print consumeMsgCntFromTopic: $consumeMsgCntFromTopic , consumeDelay: $consumeDe # td.connect.db:db $numOfTopics = 2 -$expectConsumeMsgCnt = $consumeMsgCntFromTopic * $numOfTopics +$expectMsgCntFromStb = $expectMsgCntFromStb * $numOfTopics $expect_result = @{consume success: @ -$expect_result = $expect_result . $expectConsumeMsgCnt +$expect_result = $expect_result . $expectMsgCntFromStb $expect_result = $expect_result . @, @ $expect_result = $expect_result . 0} print expect_result----> $expect_result -#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function, topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function, topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function, topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function, topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb print cmd result----> $system_content #if $system_content != @{consume success: 20000, 0}@ then -if $system_content < $expect_result then +if $system_content != $expect_result then return -1 endi $numOfTopics = 3 -$expectConsumeMsgCnt = $consumeMsgCntFromTopic * $numOfTopics +$expectMsgCntFromCtb = $expectMsgCntFromCtb * $numOfTopics $expect_result = @{consume success: @ -$expect_result = $expect_result . $expectConsumeMsgCnt +$expect_result = $expect_result . $expectMsgCntFromCtb $expect_result = $expect_result . @, @ $expect_result = $expect_result . 0} print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column, topic_ctb_function, topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column, topic_ctb_function, topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column, topic_ctb_function, topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column, topic_ctb_function, topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb print cmd result----> $system_content #if $system_content != @{consume success: 300, 0}@ then -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi $numOfTopics = 3 -$expectConsumeMsgCnt = $consumeMsgCntFromTopic * $numOfTopics +$expectMsgCntFromNtb = $expectMsgCntFromNtb * $tbNum +$expectMsgCntFromNtb = $expectMsgCntFromNtb * $numOfTopics $expect_result = @{consume success: @ -$expect_result = $expect_result . $expectConsumeMsgCnt +$expect_result = $expect_result . $expectMsgCntFromNtb $expect_result = $expect_result . @, @ $expect_result = $expect_result . 0} print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column, topic_ntb_all, topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column, topic_ntb_all, topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column, topic_ntb_all, topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromNtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column, topic_ntb_all, topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromNtb print cmd result----> $system_content #if $system_content != @{consume success: 30000, 0}@ then -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi diff --git a/tests/script/tsim/tmq/mainConsumerInOneTopic.sim b/tests/script/tsim/tmq/mainConsumerInOneTopic.sim index b9a867921e79d7323c59e6759381b2f70d39baf5..fc20e2db2398f39a8cad5fd500e46e1103acc1f1 100644 --- a/tests/script/tsim/tmq/mainConsumerInOneTopic.sim +++ b/tests/script/tsim/tmq/mainConsumerInOneTopic.sim @@ -120,9 +120,9 @@ endi print =============== run_back insert data if $loop_cnt == 0 then - run_back tsim/tmq/insertDataV1.sim + run_back tsim/tmq/insertFixedDataV2.sim else - run_back tsim/tmq/insertDataV4.sim + run_back tsim/tmq/insertFixedDataV4.sim endi #sleep 1000 @@ -162,9 +162,15 @@ endi # -g showMsgFlag, default is 0 # -$consumeDelay = 50 -$expectConsumeMsgCnt = 1000 -print expectConsumeMsgCnt: $expectConsumeMsgCnt , consumeDelay: $consumeDelay +$tbNum = 10 +$consumeDelay = 5 +$expectMsgCntFromCtb = 1000 +$expectMsgCntFromStb = $expectMsgCntFromCtb * $tbNum +print consumeDelay: $consumeDelay +print insert data child num: $tbNum +print expectMsgCntFromCtb: $expectMsgCntFromCtb +print expectMsgCntFromStb: $expectMsgCntFromStb + # supported key: # group.id: @@ -177,82 +183,82 @@ print expectConsumeMsgCnt: $expectConsumeMsgCnt , consumeDelay: $consumeDelay # td.connect.db:db $expect_result = @{consume success: @ -$expect_result = $expect_result . $expectConsumeMsgCnt +$expect_result = $expect_result . $expectMsgCntFromStb $expect_result = $expect_result . @, @ $expect_result = $expect_result . 0} print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb print cmd result----> $system_content -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi -#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb #print cmd result----> $system_content ##if $system_content != @{consume success: 10000, 0}@ then -#if $system_content < $expectConsumeMsgCnt then +#if $system_content != $expect_result then # return -1 #endi -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromStb print cmd result----> $system_content #if $system_content != @{consume success: 10000, 0}@ then -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi $expect_result = @{consume success: @ -$expect_result = $expect_result . $rowNum +$expect_result = $expect_result . $expectMsgCntFromCtb $expect_result = $expect_result . @, @ $expect_result = $expect_result . 0} print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb print cmd result----> $system_content -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb print cmd result----> $system_content -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb print cmd result----> $system_content -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi $expect_result = @{consume success: @ -$expect_result = $expect_result . $totalMsgCnt +$expect_result = $expect_result . $expectMsgCntFromStb $expect_result = $expect_result . @, @ $expect_result = $expect_result . 0} print expect_result----> $expect_result -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb print cmd result----> $system_content -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb print cmd result----> $system_content -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi -print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt -system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectConsumeMsgCnt +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" -y $consumeDelay -m $expectMsgCntFromCtb print cmd result----> $system_content -if $system_content < $expectConsumeMsgCnt then +if $system_content != $expect_result then return -1 endi diff --git a/tests/test/c/tmqDemo.c b/tests/test/c/tmqDemo.c index 45a9d31f4cf09eb82f0962aba21c10335b1dd4b3..756893f217474731c3e87e700309aaec1355f4c0 100644 --- a/tests/test/c/tmqDemo.c +++ b/tests/test/c/tmqDemo.c @@ -195,7 +195,7 @@ void parseArgument(int32_t argc, char *argv[]) { } static int running = 1; -static void msg_process(tmq_message_t* message) { tmqShowMsg(message); } +/*static void msg_process(tmq_message_t* message) { tmqShowMsg(message); }*/ // calc dir size (not include itself 4096Byte) int64_t getDirectorySize(char *dir) @@ -363,9 +363,9 @@ void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) { } while (running) { - tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 1); + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 1); if (tmqmessage) { - msg_process(tmqmessage); + /*msg_process(tmqmessage);*/ tmq_message_destroy(tmqmessage); if ((++msg_count % MIN_COMMIT_COUNT) == 0) tmq_commit(tmq, NULL, 0); @@ -392,12 +392,12 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics, int32_t totalMsgs, int64_t walLog int32_t skipLogNum = 0; int64_t startTime = taosGetTimestampUs(); while (running) { - tmq_message_t* tmqmessage = tmq_consumer_poll(tmq, 3000); + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 3000); if (tmqmessage) { batchCnt++; - skipLogNum += tmqGetSkipLogNum(tmqmessage); + /*skipLogNum += tmqGetSkipLogNum(tmqmessage);*/ if (0 != g_stConfInfo.showMsgFlag) { - msg_process(tmqmessage); + /*msg_process(tmqmessage);*/ } tmq_message_destroy(tmqmessage); } else { diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index dc375dd35a68cbac2efedfd10404a31b1711da79..86d0bef1a95992ecdd712ddd39ff35f1747e5d60 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -13,51 +13,65 @@ * along with this program. If not, see . */ -// clang-format off - #include +#include #include +#include #include -#include #include #include +#include #include -#include -#include #include "taos.h" #include "taoserror.h" #include "tlog.h" -#define GREEN "\033[1;32m" -#define NC "\033[0m" +#define GREEN "\033[1;32m" +#define NC "\033[0m" #define min(a, b) (((a) < (b)) ? (a) : (b)) -#define MAX_SQL_STR_LEN (1024 * 1024) -#define MAX_ROW_STR_LEN (16 * 1024) +#define MAX_SQL_STR_LEN (1024 * 1024) +#define MAX_ROW_STR_LEN (16 * 1024) typedef struct { - // input from argvs - char dbName[32]; - char topicString[256]; - char keyString[1024]; - int32_t showMsgFlag; - int32_t consumeDelay; // unit s - int32_t consumeMsgCnt; - - // save result after parse agrvs - int32_t numOfTopic; - char topics[32][64]; + int32_t expectMsgCnt; + int32_t consumeMsgCnt; + TdThread thread; +} SThreadInfo; + +typedef struct { + // input from argvs + char dbName[32]; + char topicString[256]; + char keyString[1024]; + char topicString1[256]; + char keyString1[1024]; + int32_t showMsgFlag; + int32_t consumeDelay; // unit s + int32_t consumeMsgCnt; + int32_t checkMode; + + // save result after parse agrvs + int32_t numOfTopic; + char topics[32][64]; + + int32_t numOfKey; + char key[32][64]; + char value[32][64]; + + int32_t numOfTopic1; + char topics1[32][64]; - int32_t numOfKey; - char key[32][64]; - char value[32][64]; + int32_t numOfKey1; + char key1[32][64]; + char value1[32][64]; } SConfInfo; static SConfInfo g_stConfInfo; -//char* g_pRowValue = NULL; -//TdFilePtr g_fp = NULL; +// char* g_pRowValue = NULL; +// TdFilePtr g_fp = NULL; static void printHelp() { char indent[10] = " "; @@ -71,22 +85,27 @@ static void printHelp() { printf("%s%s%s\n", indent, indent, "The topic string for cosumer, no default "); printf("%s%s\n", indent, "-k"); printf("%s%s%s\n", indent, indent, "The key-value string for cosumer, no default "); + printf("%s%s\n", indent, "-t1"); + printf("%s%s%s\n", indent, indent, "The topic1 string for cosumer, no default "); + printf("%s%s\n", indent, "-k1"); + printf("%s%s%s\n", indent, indent, "The key1-value1 string for cosumer, no default "); printf("%s%s\n", indent, "-g"); printf("%s%s%s%d\n", indent, indent, "showMsgFlag, default is ", g_stConfInfo.showMsgFlag); printf("%s%s\n", indent, "-y"); printf("%s%s%s%d\n", indent, indent, "consume delay, default is s", g_stConfInfo.consumeDelay); printf("%s%s\n", indent, "-m"); printf("%s%s%s%d\n", indent, indent, "consume msg count, default is s", g_stConfInfo.consumeMsgCnt); + printf("%s%s\n", indent, "-j"); + printf("%s%s%s%d\n", indent, indent, "check mode, default is s", g_stConfInfo.checkMode); exit(EXIT_SUCCESS); } -void parseArgument(int32_t argc, char *argv[]) { - +void parseArgument(int32_t argc, char* argv[]) { memset(&g_stConfInfo, 0, sizeof(SConfInfo)); - g_stConfInfo.showMsgFlag = 0; - g_stConfInfo.consumeDelay = 8000; + g_stConfInfo.showMsgFlag = 0; + g_stConfInfo.consumeDelay = 8000; g_stConfInfo.consumeMsgCnt = 0; - + for (int32_t i = 1; i < argc; i++) { if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { printHelp(); @@ -99,15 +118,21 @@ void parseArgument(int32_t argc, char *argv[]) { strcpy(g_stConfInfo.topicString, argv[++i]); } else if (strcmp(argv[i], "-k") == 0) { strcpy(g_stConfInfo.keyString, argv[++i]); + } else if (strcmp(argv[i], "-t1") == 0) { + strcpy(g_stConfInfo.topicString1, argv[++i]); + } else if (strcmp(argv[i], "-k1") == 0) { + strcpy(g_stConfInfo.keyString1, argv[++i]); } else if (strcmp(argv[i], "-g") == 0) { g_stConfInfo.showMsgFlag = atol(argv[++i]); } else if (strcmp(argv[i], "-y") == 0) { g_stConfInfo.consumeDelay = atol(argv[++i]); } else if (strcmp(argv[i], "-m") == 0) { g_stConfInfo.consumeMsgCnt = atol(argv[++i]); + } else if (strcmp(argv[i], "-j") == 0) { + g_stConfInfo.checkMode = atol(argv[++i]); } else { printf("%s unknow para: %s %s", GREEN, argv[++i], NC); - exit(-1); + exit(-1); } } @@ -117,64 +142,89 @@ void parseArgument(int32_t argc, char *argv[]) { pPrint("%s topicString:%s %s", GREEN, g_stConfInfo.topicString, NC); pPrint("%s keyString:%s %s", GREEN, g_stConfInfo.keyString, NC); pPrint("%s showMsgFlag:%d %s", GREEN, g_stConfInfo.showMsgFlag, NC); -#endif +#endif } -void splitStr(char **arr, char *str, const char *del) { - char *s = strtok(str, del); - while(s != NULL) { +void splitStr(char** arr, char* str, const char* del) { + char* s = strtok(str, del); + while (s != NULL) { *arr++ = s; s = strtok(NULL, del); } } -void ltrim(char *str) -{ - if (str == NULL || *str == '\0') - { - return; - } - int len = 0; - char *p = str; - while (*p != '\0' && isspace(*p)) - { - ++p; ++len; - } - memmove(str, p, strlen(str) - len + 1); - //return str; +void ltrim(char* str) { + if (str == NULL || *str == '\0') { + return; + } + int len = 0; + char* p = str; + while (*p != '\0' && isspace(*p)) { + ++p; + ++len; + } + memmove(str, p, strlen(str) - len + 1); + // return str; } - void parseInputString() { - //printf("topicString: %s\n", g_stConfInfo.topicString); - //printf("keyString: %s\n\n", g_stConfInfo.keyString); + // printf("topicString: %s\n", g_stConfInfo.topicString); + // printf("keyString: %s\n\n", g_stConfInfo.keyString); - char *token; + char* token; const char delim[2] = ","; const char ch = ':'; token = strtok(g_stConfInfo.topicString, delim); + while (token != NULL) { + // printf("%s\n", token ); + strcpy(g_stConfInfo.topics[g_stConfInfo.numOfTopic], token); + ltrim(g_stConfInfo.topics[g_stConfInfo.numOfTopic]); + // printf("%s\n", g_stConfInfo.topics[g_stConfInfo.numOfTopic]); + g_stConfInfo.numOfTopic++; + + token = strtok(NULL, delim); + } + + token = strtok(g_stConfInfo.topicString1, delim); while(token != NULL) { //printf("%s\n", token ); - strcpy(g_stConfInfo.topics[g_stConfInfo.numOfTopic], token); - ltrim(g_stConfInfo.topics[g_stConfInfo.numOfTopic]); + strcpy(g_stConfInfo.topics1[g_stConfInfo.numOfTopic1], token); + ltrim(g_stConfInfo.topics1[g_stConfInfo.numOfTopic1]); //printf("%s\n", g_stConfInfo.topics[g_stConfInfo.numOfTopic]); - g_stConfInfo.numOfTopic++; + g_stConfInfo.numOfTopic1++; token = strtok(NULL, delim); } token = strtok(g_stConfInfo.keyString, delim); + while (token != NULL) { + // printf("%s\n", token ); + { + char* pstr = token; + ltrim(pstr); + char* ret = strchr(pstr, ch); + memcpy(g_stConfInfo.key[g_stConfInfo.numOfKey], pstr, ret - pstr); + strcpy(g_stConfInfo.value[g_stConfInfo.numOfKey], ret + 1); + // printf("key: %s, value: %s\n", g_stConfInfo.key[g_stConfInfo.numOfKey], + // g_stConfInfo.value[g_stConfInfo.numOfKey]); + g_stConfInfo.numOfKey++; + } + + token = strtok(NULL, delim); + } + + token = strtok(g_stConfInfo.keyString1, delim); while(token != NULL) { //printf("%s\n", token ); { char* pstr = token; ltrim(pstr); char *ret = strchr(pstr, ch); - memcpy(g_stConfInfo.key[g_stConfInfo.numOfKey], pstr, ret-pstr); - strcpy(g_stConfInfo.value[g_stConfInfo.numOfKey], ret+1); + memcpy(g_stConfInfo.key1[g_stConfInfo.numOfKey1], pstr, ret-pstr); + strcpy(g_stConfInfo.value1[g_stConfInfo.numOfKey1], ret+1); //printf("key: %s, value: %s\n", g_stConfInfo.key[g_stConfInfo.numOfKey], g_stConfInfo.value[g_stConfInfo.numOfKey]); - g_stConfInfo.numOfKey++; + g_stConfInfo.numOfKey1++; } token = strtok(NULL, delim); @@ -182,26 +232,25 @@ void parseInputString() { } -static int running = 1; -static void msg_process(tmq_message_t* message) { tmqShowMsg(message); } - +static int running = 1; +/*static void msg_process(tmq_message_t* message) { tmqShowMsg(message); }*/ -int queryDB(TAOS *taos, char *command) { - TAOS_RES *pRes = taos_query(taos, command); - int code = taos_errno(pRes); - //if ((code != 0) && (code != TSDB_CODE_RPC_AUTH_REQUIRED)) { - if (code != 0) { - pError("failed to reason:%s, sql: %s", tstrerror(code), command); - taos_free_result(pRes); - return -1; - } - taos_free_result(pRes); - return 0 ; +int queryDB(TAOS* taos, char* command) { + TAOS_RES* pRes = taos_query(taos, command); + int code = taos_errno(pRes); + // if ((code != 0) && (code != TSDB_CODE_RPC_AUTH_REQUIRED)) { + if (code != 0) { + pError("failed to reason:%s, sql: %s", tstrerror(code), command); + taos_free_result(pRes); + return -1; + } + taos_free_result(pRes); + return 0; } tmq_t* build_consumer() { char sqlStr[1024] = {0}; - + TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); assert(pConn != NULL); @@ -209,13 +258,13 @@ tmq_t* build_consumer() { TAOS_RES* pRes = taos_query(pConn, sqlStr); if (taos_errno(pRes) != 0) { printf("error in use db, reason:%s\n", taos_errstr(pRes)); - taos_free_result(pRes); - exit(-1); + taos_free_result(pRes); + exit(-1); } taos_free_result(pRes); tmq_conf_t* conf = tmq_conf_new(); - //tmq_conf_set(conf, "group.id", "tg2"); + // tmq_conf_set(conf, "group.id", "tg2"); for (int32_t i = 0; i < g_stConfInfo.numOfKey; i++) { tmq_conf_set(conf, g_stConfInfo.key[i], g_stConfInfo.value[i]); } @@ -225,13 +274,47 @@ tmq_t* build_consumer() { tmq_list_t* build_topic_list() { tmq_list_t* topic_list = tmq_list_new(); - //tmq_list_append(topic_list, "test_stb_topic_1"); + // tmq_list_append(topic_list, "test_stb_topic_1"); for (int32_t i = 0; i < g_stConfInfo.numOfTopic; i++) { tmq_list_append(topic_list, g_stConfInfo.topics[i]); } return topic_list; } + +tmq_t* build_consumer_x() { + char sqlStr[1024] = {0}; + + TAOS* pConn = taos_connect(NULL, "root", "taosdata", NULL, 0); + assert(pConn != NULL); + + sprintf(sqlStr, "use %s", g_stConfInfo.dbName); + TAOS_RES* pRes = taos_query(pConn, sqlStr); + if (taos_errno(pRes) != 0) { + printf("error in use db, reason:%s\n", taos_errstr(pRes)); + taos_free_result(pRes); + exit(-1); + } + taos_free_result(pRes); + + tmq_conf_t* conf = tmq_conf_new(); + //tmq_conf_set(conf, "group.id", "tg2"); + for (int32_t i = 0; i < g_stConfInfo.numOfKey1; i++) { + tmq_conf_set(conf, g_stConfInfo.key1[i], g_stConfInfo.value1[i]); + } + tmq_t* tmq = tmq_consumer_new(pConn, conf, NULL, 0); + return tmq; +} + +tmq_list_t* build_topic_list_x() { + tmq_list_t* topic_list = tmq_list_new(); + //tmq_list_append(topic_list, "test_stb_topic_1"); + for (int32_t i = 0; i < g_stConfInfo.numOfTopic1; i++) { + tmq_list_append(topic_list, g_stConfInfo.topics1[i]); + } + return topic_list; +} + void loop_consume(tmq_t* tmq) { tmq_resp_err_t err; @@ -239,21 +322,21 @@ void loop_consume(tmq_t* tmq) { int32_t totalRows = 0; int32_t skipLogNum = 0; while (running) { - tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 8000); + TAOS_RES* tmqMsg = tmq_consumer_poll(tmq, 8000); if (tmqMsg) { - totalMsgs++; + totalMsgs++; - #if 0 +#if 0 TAOS_ROW row; while (NULL != (row = tmq_get_row(tmqMsg))) { totalRows++; } - #endif - - skipLogNum += tmqGetSkipLogNum(tmqMsg); - if (0 != g_stConfInfo.showMsgFlag) { - msg_process(tmqMsg); - } +#endif + + /*skipLogNum += tmqGetSkipLogNum(tmqMsg);*/ + if (0 != g_stConfInfo.showMsgFlag) { + /*msg_process(tmqMsg);*/ + } tmq_message_destroy(tmqMsg); } else { break; @@ -263,40 +346,41 @@ void loop_consume(tmq_t* tmq) { err = tmq_consumer_close(tmq); if (err) { printf("tmq_consumer_close() fail, reason: %s\n", tmq_err2str(err)); - exit(-1); + exit(-1); } - + printf("{consume success: %d, %d}", totalMsgs, totalRows); } - -void parallel_consume(tmq_t* tmq) { +int32_t parallel_consume(tmq_t* tmq, int threadLable) { tmq_resp_err_t err; int32_t totalMsgs = 0; int32_t totalRows = 0; int32_t skipLogNum = 0; while (running) { - tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, g_stConfInfo.consumeDelay * 1000); + TAOS_RES* tmqMsg = tmq_consumer_poll(tmq, g_stConfInfo.consumeDelay * 1000); if (tmqMsg) { - totalMsgs++; + totalMsgs++; + + //printf("threadFlag: %d, totalMsgs: %d\n", threadLable, totalMsgs); #if 0 TAOS_ROW row; while (NULL != (row = tmq_get_row(tmqMsg))) { totalRows++; } - #endif - - skipLogNum += tmqGetSkipLogNum(tmqMsg); - if (0 != g_stConfInfo.showMsgFlag) { - msg_process(tmqMsg); - } +#endif + + /*skipLogNum += tmqGetSkipLogNum(tmqMsg);*/ + if (0 != g_stConfInfo.showMsgFlag) { + /*msg_process(tmqMsg);*/ + } tmq_message_destroy(tmqMsg); - if (totalMsgs >= g_stConfInfo.consumeMsgCnt) { + if (totalMsgs >= g_stConfInfo.consumeMsgCnt) { break; - } + } } else { break; } @@ -305,32 +389,84 @@ void parallel_consume(tmq_t* tmq) { err = tmq_consumer_close(tmq); if (err) { printf("tmq_consumer_close() fail, reason: %s\n", tmq_err2str(err)); - exit(-1); + exit(-1); + } + + //printf("%d", totalMsgs); // output to sim for check result + return totalMsgs; +} + + +void *threadFunc(void *param) { + int32_t totalMsgs = 0; + + SThreadInfo *pInfo = (SThreadInfo *)param; + + tmq_t* tmq = build_consumer_x(); + tmq_list_t* topic_list = build_topic_list_x(); + if ((NULL == tmq) || (NULL == topic_list)){ + return NULL; } - printf("%d", totalMsgs); // output to sim for check result + tmq_resp_err_t err = tmq_subscribe(tmq, topic_list); + if (err) { + printf("tmq_subscribe() fail, reason: %s\n", tmq_err2str(err)); + exit(-1); + } + + //if (0 == g_stConfInfo.consumeMsgCnt) { + // loop_consume(tmq); + //} else { + pInfo->consumeMsgCnt = parallel_consume(tmq, 1); + //} + + err = tmq_unsubscribe(tmq); + if (err) { + printf("tmq_unsubscribe() fail, reason: %s\n", tmq_err2str(err)); + pInfo->consumeMsgCnt = -1; + return NULL; + } + + return NULL; } -int main(int32_t argc, char *argv[]) { + +int main(int32_t argc, char* argv[]) { parseArgument(argc, argv); parseInputString(); - - tmq_t* tmq = build_consumer(); + + int32_t numOfThreads = 1; + TdThreadAttr thattr; + taosThreadAttrInit(&thattr); + taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE); + SThreadInfo *pInfo = (SThreadInfo *)taosMemoryCalloc(numOfThreads, sizeof(SThreadInfo)); + + if (g_stConfInfo.numOfTopic1) { + // pthread_create one thread to consume + for (int32_t i = 0; i < numOfThreads; ++i) { + pInfo[i].expectMsgCnt = 0; + pInfo[i].consumeMsgCnt = 0; + taosThreadCreate(&(pInfo[i].thread), &thattr, threadFunc, (void *)(pInfo + i)); + } + } + + int32_t totalMsgs = 0; + tmq_t* tmq = build_consumer(); tmq_list_t* topic_list = build_topic_list(); - if ((NULL == tmq) || (NULL == topic_list)){ + if ((NULL == tmq) || (NULL == topic_list)) { return -1; } - + tmq_resp_err_t err = tmq_subscribe(tmq, topic_list); if (err) { printf("tmq_subscribe() fail, reason: %s\n", tmq_err2str(err)); exit(-1); } - if (0 == g_stConfInfo.consumeMsgCnt) { + if (0 == g_stConfInfo.numOfTopic1) { loop_consume(tmq); } else { - parallel_consume(tmq); + totalMsgs = parallel_consume(tmq, 0); } err = tmq_unsubscribe(tmq); @@ -339,6 +475,27 @@ int main(int32_t argc, char *argv[]) { exit(-1); } + if (g_stConfInfo.numOfTopic1) { + for (int32_t i = 0; i < numOfThreads; i++) { + taosThreadJoin(pInfo[i].thread, NULL); + } + + //printf("consumer: %d, cosumer1: %d\n", totalMsgs, pInfo->consumeMsgCnt); + if (0 == g_stConfInfo.checkMode) { + if ((totalMsgs + pInfo->consumeMsgCnt) == g_stConfInfo.consumeMsgCnt) { + printf("success"); + } else { + printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } + } else if (1 == g_stConfInfo.checkMode) { + if ((totalMsgs == g_stConfInfo.consumeMsgCnt) && (pInfo->consumeMsgCnt == g_stConfInfo.consumeMsgCnt)) { + printf("success"); + } else { + printf("fail, consumer msg cnt: %d, %d", totalMsgs, pInfo->consumeMsgCnt); + } + } + } + return 0; } diff --git a/tests/tsim/src/simSystem.c b/tests/tsim/src/simSystem.c index eb5fb682642dce2601167f671370d9a2320c3b8b..5bbcceada5591454c6dcb639d6ee22112baf6073 100644 --- a/tests/tsim/src/simSystem.c +++ b/tests/tsim/src/simSystem.c @@ -80,24 +80,24 @@ SScript *simProcessCallOver(SScript *script) { simExecSuccess = false; simInfo("script:" FAILED_PREFIX "%s" FAILED_POSTFIX ", " FAILED_PREFIX "failed" FAILED_POSTFIX ", error:%s", script->fileName, script->error); - return NULL; } else { simExecSuccess = true; simInfo("script:" SUCCESS_PREFIX "%s" SUCCESS_POSTFIX ", " SUCCESS_PREFIX "success" SUCCESS_POSTFIX, script->fileName); - simCloseTaosdConnect(script); - simScriptSucced++; - simScriptPos--; - - simFreeScript(script); - if (simScriptPos == -1) { - simInfo("----------------------------------------------------------------------"); - simInfo("Simulation Test Done, " SUCCESS_PREFIX "%d" SUCCESS_POSTFIX " Passed:\n", simScriptSucced); - return NULL; - } + } - return simScriptList[simScriptPos]; + simCloseTaosdConnect(script); + simScriptSucced++; + simScriptPos--; + simFreeScript(script); + + if (simScriptPos == -1 && simExecSuccess) { + simInfo("----------------------------------------------------------------------"); + simInfo("Simulation Test Done, " SUCCESS_PREFIX "%d" SUCCESS_POSTFIX " Passed:\n", simScriptSucced); + return NULL; } + + return simScriptList[simScriptPos]; } else { simDebug("script:%s, is stopped", script->fileName); simFreeScript(script);