From 441a150d6615bb89cfa1d285ac0f7bbf2d4eb190 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 23 May 2024 17:35:54 +0800 Subject: [PATCH 01/44] optimize tmq snapshot meta --- include/client/taos.h | 1 + include/common/tcommon.h | 1 + include/common/tmsg.h | 14 ++ include/libs/executor/executor.h | 2 +- include/util/tencode.h | 1 + source/client/inc/clientInt.h | 15 +- source/client/src/clientMain.c | 34 +++-- source/client/src/clientRawBlockWrite.c | 181 ++++++++++++++++++------ source/client/src/clientTmq.c | 64 +++++++-- source/common/src/tmsg.c | 52 +++++++ source/dnode/vnode/src/inc/tq.h | 2 +- source/dnode/vnode/src/tq/tqScan.c | 8 +- source/dnode/vnode/src/tq/tqUtil.c | 50 ++++++- source/libs/executor/inc/querytask.h | 2 +- source/libs/executor/src/executor.c | 4 +- source/libs/executor/src/scanoperator.c | 77 +++++++--- utils/test/c/tmq_taosx_ci.c | 1 + 17 files changed, 399 insertions(+), 110 deletions(-) diff --git a/include/client/taos.h b/include/client/taos.h index 45dc85f6d9..66b5b92869 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -283,6 +283,7 @@ typedef enum tmq_res_t { TMQ_RES_DATA = 1, TMQ_RES_TABLE_META = 2, TMQ_RES_METADATA = 3, + TMQ_RES_BATCH_TABLE_META = 4, } tmq_res_t; typedef struct tmq_topic_assignment { diff --git a/include/common/tcommon.h b/include/common/tcommon.h index d28477ae40..a5a805ff40 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -144,6 +144,7 @@ enum { TMQ_MSG_TYPE__EP_RSP, TMQ_MSG_TYPE__POLL_DATA_META_RSP, TMQ_MSG_TYPE__WALINFO_RSP, + TMQ_MSG_TYPE__POLL_BATCH_META_RSP, }; enum { diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 3ed6b40d4d..1657a17ff0 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -3978,6 +3978,20 @@ int32_t tEncodeSTaosxRsp(SEncoder* pEncoder, const void* pRsp); int32_t tDecodeSTaosxRsp(SDecoder* pDecoder, void* pRsp); void tDeleteSTaosxRsp(void* pRsp); +typedef struct SMqBatchMetaRsp { + SMqRspHead head; // not serialize + STqOffsetVal rspOffset; + SArray* batchMetaLen; + SArray* batchMetaReq; + void* pMetaBuff; // not serialize + uint32_t metaBuffLen; // not serialize +} SMqBatchMetaRsp; + +int32_t tEncodeMqBatchMetaRsp(SEncoder* pEncoder, const SMqBatchMetaRsp* pRsp); +int32_t tDecodeMqBatchMetaRsp(SDecoder* pDecoder, SMqBatchMetaRsp* pRsp); +int32_t tSemiDecodeMqBatchMetaRsp(SDecoder* pDecoder, SMqBatchMetaRsp* pRsp); +void tDeleteMqBatchMetaRsp(SMqBatchMetaRsp* pRsp); + typedef struct { SMqRspHead head; char cgroup[TSDB_CGROUP_LEN]; diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index fe20639c77..9b557500f0 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -201,7 +201,7 @@ void qStreamSetSourceExcluded(qTaskInfo_t tinfo, int8_t sourceExcluded); void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset); -SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); +SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); const SSchemaWrapper* qExtractSchemaFromTask(qTaskInfo_t tinfo); diff --git a/include/util/tencode.h b/include/util/tencode.h index 596fa2b4d3..b8da040689 100644 --- a/include/util/tencode.h +++ b/include/util/tencode.h @@ -77,6 +77,7 @@ typedef struct { #define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos) #define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE)) #define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE)) +#define TD_CODER_REMAIN_CAPACITY(CODER) ((CODER)->size - (CODER)->pos) #define tEncodeSize(E, S, SIZE, RET) \ do { \ diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 9507472df0..577b7d7ac4 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -44,6 +44,7 @@ enum { RES_TYPE__TMQ, RES_TYPE__TMQ_META, RES_TYPE__TMQ_METADATA, + RES_TYPE__TMQ_BATCH_META, }; #define SHOW_VARIABLES_RESULT_COLS 3 @@ -51,10 +52,11 @@ enum { #define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE) -#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) -#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) -#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) -#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA) +#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) +#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) +#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) +#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA) +#define TD_RES_TMQ_BATCH_META(res) (*(int8_t*)res == RES_TYPE__TMQ_BATCH_META) typedef struct SAppInstInfo SAppInstInfo; @@ -241,6 +243,11 @@ typedef struct { STaosxRsp rsp; } SMqTaosxRspObj; +typedef struct { + SMqRspObjCommon common; + SMqBatchMetaRsp rsp; +} SMqBatchMetaRspObj; + typedef struct SReqRelInfo { uint64_t userRefId; uint64_t prevRefId; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index ba7f65c52b..da5da044a7 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -301,7 +301,7 @@ void taos_close(TAOS *taos) { } int taos_errno(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return terrno; } @@ -313,7 +313,7 @@ int taos_errno(TAOS_RES *res) { } const char *taos_errstr(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return (const char *)tstrerror(terrno); } @@ -354,6 +354,10 @@ void taos_free_result(TAOS_RES *res) { SMqMetaRspObj *pRspObj = (SMqMetaRspObj *)res; tDeleteMqMetaRsp(&pRspObj->metaRsp); taosMemoryFree(pRspObj); + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj *pBtRspObj = (SMqBatchMetaRspObj *)res; + tDeleteMqBatchMetaRsp(&pBtRspObj->rsp); + taosMemoryFree(pBtRspObj); } } @@ -371,7 +375,7 @@ void taos_kill_query(TAOS *taos) { } int taos_field_count(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -382,7 +386,7 @@ int taos_field_count(TAOS_RES *res) { int taos_num_fields(TAOS_RES *res) { return taos_field_count(res); } TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) { - if (taos_num_fields(res) == 0 || TD_RES_TMQ_META(res)) { + if (taos_num_fields(res) == 0 || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return NULL; } @@ -437,7 +441,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { pResultInfo->current += 1; return pResultInfo->row; } - } else if (TD_RES_TMQ_META(res)) { + } else if (TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return NULL; } else { // assert to avoid un-initialization error @@ -548,7 +552,7 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) } int *taos_fetch_lengths(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return NULL; } @@ -557,7 +561,7 @@ int *taos_fetch_lengths(TAOS_RES *res) { } TAOS_ROW *taos_result_block(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { terrno = TSDB_CODE_INVALID_PARA; return NULL; } @@ -625,7 +629,7 @@ const char *taos_get_client_info() { return version; } // return int32_t int taos_affected_rows(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) { + if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -636,7 +640,7 @@ int taos_affected_rows(TAOS_RES *res) { // return int64_t int64_t taos_affected_rows64(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) { + if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -646,7 +650,7 @@ int64_t taos_affected_rows64(TAOS_RES *res) { } int taos_result_precision(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return TSDB_TIME_PRECISION_MILLI; } @@ -686,7 +690,7 @@ int taos_select_db(TAOS *taos, const char *db) { } void taos_stop_query(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) { + if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return; } @@ -694,7 +698,7 @@ void taos_stop_query(TAOS_RES *res) { } bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return true; } SReqResultInfo *pResultInfo = tscGetCurResInfo(res); @@ -719,7 +723,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) { } int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -761,7 +765,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { *numOfRows = 0; *pData = NULL; - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -797,7 +801,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { } int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index c5069d46aa..a37cd99360 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -26,6 +26,8 @@ #define LOG_ID_TAG "connId:0x%" PRIx64 ",reqId:0x%" PRIx64 #define LOG_ID_VALUE *(int64_t*)taos, pRequest->requestId +static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen); + static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); } static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, @@ -2025,38 +2027,81 @@ end: return code; } +static char* processSimpleMeta(SMqMetaRsp* pMetaRsp) { + if (pMetaRsp->resMsgType == TDMT_VND_CREATE_STB) { + return processCreateStb(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_ALTER_STB) { + return processAlterStb(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DROP_STB) { + return processDropSTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_CREATE_TABLE) { + return processCreateTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_ALTER_TABLE) { + return processAlterTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DROP_TABLE) { + return processDropTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DROP_TABLE) { + return processDropTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DELETE) { + return processDeleteTable(pMetaRsp); + } + + return NULL; +} +static char* processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp) { + SDecoder coder; + SMqBatchMetaRsp rsp = {0}; + tDecoderInit(&coder, pMsgRsp->pMetaBuff, pMsgRsp->metaBuffLen); + if (tDecodeMqBatchMetaRsp(&coder, &rsp) < 0) { + goto _end; + } + + int64_t fullSize = 0; + int32_t num = taosArrayGetSize(rsp.batchMetaReq); + SArray* strArray = taosArrayInit(num, POINTER_BYTES); + for (int32_t i = 0; i < num; i++) { + int32_t len = *(int32_t*)taosArrayGet(rsp.batchMetaLen, i); + void* tmpBuf = taosArrayGetP(rsp.batchMetaReq, i); + SDecoder metaCoder = {0}; + SMqMetaRsp metaRsp = {0}; + tDecoderInit(&metaCoder, POINTER_SHIFT(tmpBuf, sizeof(SMqRspHead)), len - sizeof(SMqRspHead)); + if(tDecodeMqMetaRsp(&metaCoder, &metaRsp) < 0 ) { + goto _end; + } + char* subStr = processSimpleMeta(&metaRsp); + tDeleteMqMetaRsp(&metaRsp); + fullSize += strlen(subStr); + taosArrayPush(strArray, &subStr); + } + + char* buf = (char*)taosMemoryCalloc(1, fullSize + num + 1); + for (int32_t i = 0; i < num; i++) { + char* subStr = taosArrayGetP(strArray, i); + strcat(buf, subStr); + strcat(buf, "\n"); + } + +_end: + return NULL; +} + char* tmq_get_json_meta(TAOS_RES* res) { if (res == NULL) return NULL; uDebug("tmq_get_json_meta res:%p", res); - if (!TD_RES_TMQ_META(res) && !TD_RES_TMQ_METADATA(res)) { + if (!TD_RES_TMQ_META(res) && !TD_RES_TMQ_METADATA(res) && !TD_RES_TMQ_BATCH_META(res)) { return NULL; } if (TD_RES_TMQ_METADATA(res)) { SMqTaosxRspObj* pMetaDataRspObj = (SMqTaosxRspObj*)res; return processAutoCreateTable(&pMetaDataRspObj->rsp); + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj* pBatchMetaRspObj = (SMqBatchMetaRspObj*)res; + return processBatchMetaToJson(&pBatchMetaRspObj->rsp); } SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; - if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_STB) { - return processCreateStb(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_STB) { - return processAlterStb(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_STB) { - return processDropSTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_TABLE) { - return processCreateTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_TABLE) { - return processAlterTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { - return processDropTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { - return processDropTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DELETE) { - return processDeleteTable(&pMetaRspObj->metaRsp); - } - - return NULL; + return processSimpleMeta(&pMetaRspObj->metaRsp); } void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); } @@ -2147,6 +2192,12 @@ int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data* raw) { } raw->raw_type = RES_TYPE__TMQ_METADATA; uDebug("tmq get raw type metadata:%p", raw); + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj* pBtMetaRspObj = (SMqBatchMetaRspObj*)res; + raw->raw = pBtMetaRspObj->rsp.pMetaBuff; + raw->raw_len = pBtMetaRspObj->rsp.metaBuffLen; + raw->raw_type = RES_TYPE__TMQ_BATCH_META; + uDebug("tmq get raw batch meta:%p", raw); } else { uError("tmq get raw error type:%d", *(int8_t*)res); terrno = TSDB_CODE_TMQ_INVALID_MSG; @@ -2163,32 +2214,74 @@ void tmq_free_raw(tmq_raw_data raw) { memset(terrMsg, 0, ERR_MSG_LEN); } +static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) { + if (type == TDMT_VND_CREATE_STB) { + return taosCreateStb(taos, buf, len); + } else if (type == TDMT_VND_ALTER_STB) { + return taosCreateStb(taos, buf, len); + } else if (type == TDMT_VND_DROP_STB) { + return taosDropStb(taos, buf, len); + } else if (type == TDMT_VND_CREATE_TABLE) { + return taosCreateTable(taos, buf, len); + } else if (type == TDMT_VND_ALTER_TABLE) { + return taosAlterTable(taos, buf, len); + } else if (type == TDMT_VND_DROP_TABLE) { + return taosDropTable(taos, buf, len); + } else if (type == TDMT_VND_DELETE) { + return taosDeleteData(taos, buf, len); + } else if (type == RES_TYPE__TMQ) { + return tmqWriteRawDataImpl(taos, buf, len); + } else if (type == RES_TYPE__TMQ_METADATA) { + return tmqWriteRawMetaDataImpl(taos, buf, len); + } else if (type == RES_TYPE__TMQ_BATCH_META) { + return tmqWriteBatchMetaDataImpl(taos, buf, len); + } + return TSDB_CODE_INVALID_PARA; +} + int32_t tmq_write_raw(TAOS* taos, tmq_raw_data raw) { if (!taos) { - goto end; + return TSDB_CODE_INVALID_PARA; } - if (raw.raw_type == TDMT_VND_CREATE_STB) { - return taosCreateStb(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_ALTER_STB) { - return taosCreateStb(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_DROP_STB) { - return taosDropStb(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_CREATE_TABLE) { - return taosCreateTable(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_ALTER_TABLE) { - return taosAlterTable(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_DROP_TABLE) { - return taosDropTable(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_DELETE) { - return taosDeleteData(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == RES_TYPE__TMQ) { - return tmqWriteRawDataImpl(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == RES_TYPE__TMQ_METADATA) { - return tmqWriteRawMetaDataImpl(taos, raw.raw, raw.raw_len); - } - -end: - terrno = TSDB_CODE_INVALID_PARA; - return terrno; + return writeRawImpl(taos, raw.raw, raw.raw_len, raw.raw_type); +} + +static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen) { + if (taos == NULL || meta == NULL) { + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + SMqBatchMetaRsp rsp = {0}; + SDecoder coder; + int32_t code = TSDB_CODE_SUCCESS; + + // decode and process req + tDecoderInit(&coder, meta, metaLen); + if (tDecodeMqBatchMetaRsp(&coder, &rsp) < 0) { + code = TSDB_CODE_INVALID_PARA; + goto _end; + } + int32_t num = taosArrayGetSize(rsp.batchMetaReq); + for (int32_t i = 0; i < num; i++) { + int32_t len = *(int32_t*)taosArrayGet(rsp.batchMetaLen, i); + void* tmpBuf = taosArrayGetP(rsp.batchMetaReq, i); + SDecoder metaCoder = {0}; + SMqMetaRsp metaRsp = {0}; + tDecoderInit(&metaCoder, POINTER_SHIFT(tmpBuf, sizeof(SMqRspHead)), len - sizeof(SMqRspHead)); + if (tDecodeMqMetaRsp(&metaCoder, &metaRsp) < 0) { + code = TSDB_CODE_INVALID_PARA; + goto _end; + } + code = writeRawImpl(taos, metaRsp.metaRsp, metaRsp.metaRspLen, metaRsp.resMsgType); + tDeleteMqMetaRsp(&metaRsp); + if (code != TSDB_CODE_SUCCESS) { + goto _end; + } + } + +_end: + tDeleteMqBatchMetaRsp(&rsp); + errno = code; + return code; } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 3141e21f26..df08a66bd3 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -171,9 +171,10 @@ typedef struct { uint64_t reqId; SEpSet* pEpset; union { - SMqDataRsp dataRsp; - SMqMetaRsp metaRsp; - STaosxRsp taosxRsp; + SMqDataRsp dataRsp; + SMqMetaRsp metaRsp; + STaosxRsp taosxRsp; + SMqBatchMetaRsp batchMetaRsp; }; } SMqPollRspWrapper; @@ -635,6 +636,11 @@ static void asyncCommitFromResult(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_c pTopicName = pRspObj->common.topic; vgId = pRspObj->common.vgId; offsetVal = pRspObj->rsp.common.rspOffset; + } else if (TD_RES_TMQ_BATCH_META(pRes)) { + SMqBatchMetaRspObj* pBtRspObj = (SMqBatchMetaRspObj*)pRes; + pTopicName = pBtRspObj->common.topic; + vgId = pBtRspObj->common.vgId; + offsetVal = pBtRspObj->rsp.rspOffset; } else { code = TSDB_CODE_TMQ_INVALID_MSG; goto end; @@ -934,7 +940,11 @@ static void tmqFreeRspWrapper(SMqRspWrapper* rspWrapper) { SMqPollRspWrapper* pRsp = (SMqPollRspWrapper*)rspWrapper; taosMemoryFreeClear(pRsp->pEpset); tDeleteSTaosxRsp(&pRsp->taosxRsp); - } + } else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { + SMqPollRspWrapper* pRsp = (SMqPollRspWrapper*)rspWrapper; + taosMemoryFreeClear(pRsp->pEpset); + tDeleteMqBatchMetaRsp(&pRsp->batchMetaRsp); + } } void tmqClearUnhandleMsg(tmq_t* tmq) { @@ -1418,6 +1428,17 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } tDecoderClear(&decoder); memcpy(&pRspWrapper->taosxRsp, pMsg->pData, sizeof(SMqRspHead)); + } else if (rspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { + SDecoder decoder; + tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); + if(tSemiDecodeMqBatchMetaRsp(&decoder, &pRspWrapper->batchMetaRsp) < 0){ + tDecoderClear(&decoder); + taosReleaseRef(tmqMgmt.rsetId, refId); + code = TSDB_CODE_OUT_OF_MEMORY; + goto FAIL; + } + tDecoderClear(&decoder); + memcpy(&pRspWrapper->batchMetaRsp, pMsg->pData, sizeof(SMqRspHead)); } else { // invalid rspType tscError("consumer:0x%" PRIx64 " invalid rsp msg received, type:%d ignored", tmq->consumerId, rspType); } @@ -1616,6 +1637,19 @@ SMqMetaRspObj* tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { return pRspObj; } +SMqBatchMetaRspObj* tmqBuildBatchMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { + SMqBatchMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqBatchMetaRspObj)); + if(pRspObj == NULL) { + return NULL; + } + pRspObj->common.resType = RES_TYPE__TMQ_BATCH_META; + tstrncpy(pRspObj->common.topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN); + tstrncpy(pRspObj->common.db, pWrapper->topicHandle->db, TSDB_DB_FNAME_LEN); + pRspObj->common.vgId = pWrapper->vgHandle->vgId; + + memcpy(&pRspObj->rsp, &pWrapper->batchMetaRsp, sizeof(SMqBatchMetaRsp)); + return pRspObj; +} void changeByteEndian(char* pData){ char* p = pData; @@ -1972,7 +2006,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tmqFreeRspWrapper(pRspWrapper); taosFreeQitem(pRspWrapper); } - } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_META_RSP) { + } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_META_RSP || pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; int32_t consumerEpoch = atomic_load_32(&tmq->epoch); @@ -1995,7 +2029,12 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { updateVgInfo(pVg, &pollRspWrapper->metaRsp.rspOffset, &pollRspWrapper->metaRsp.rspOffset, pollRspWrapper->metaRsp.head.walsver, pollRspWrapper->metaRsp.head.walever, tmq->consumerId, true); // build rsp - SMqMetaRspObj* pRsp = tmqBuildMetaRspFromWrapper(pollRspWrapper); + void* pRsp = NULL; + if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_META_RSP) { + pRsp = tmqBuildMetaRspFromWrapper(pollRspWrapper); + } else { + pRsp = tmqBuildBatchMetaRspFromWrapper(pollRspWrapper); + } taosFreeQitem(pRspWrapper); taosWUnLockLatch(&tmq->lock); return pRsp; @@ -2217,6 +2256,8 @@ tmq_res_t tmq_get_res_type(TAOS_RES* res) { return TMQ_RES_TABLE_META; } else if (TD_RES_TMQ_METADATA(res)) { return TMQ_RES_METADATA; + } else if (TD_RES_TMQ_BATCH_META(res)) { + return TMQ_RES_BATCH_TABLE_META; } else { return TMQ_RES_INVALID; } @@ -2226,7 +2267,7 @@ const char* tmq_get_topic_name(TAOS_RES* res) { if (res == NULL) { return NULL; } - if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { + if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return strchr(((SMqRspObjCommon*)res)->topic, '.') + 1; } else if (TD_RES_TMQ_META(res)) { SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; @@ -2241,7 +2282,7 @@ const char* tmq_get_db_name(TAOS_RES* res) { return NULL; } - if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { + if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return strchr(((SMqRspObjCommon*)res)->db, '.') + 1; } else if (TD_RES_TMQ_META(res)) { SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; @@ -2255,7 +2296,7 @@ int32_t tmq_get_vgroup_id(TAOS_RES* res) { if (res == NULL) { return -1; } - if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { + if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return ((SMqRspObjCommon*)res)->vgId; } else if (TD_RES_TMQ_META(res)) { SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; @@ -2282,6 +2323,11 @@ int64_t tmq_get_vgroup_offset(TAOS_RES* res) { if (pRspObj->metaRsp.rspOffset.type == TMQ_OFFSET__LOG) { return pRspObj->metaRsp.rspOffset.version; } + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj* pBtRspObj = (SMqBatchMetaRspObj*)res; + if (pBtRspObj->rsp.rspOffset.type == TMQ_OFFSET__LOG) { + return pBtRspObj->rsp.rspOffset.version; + } } else { tscError("invalid tmq type:%d", *(int8_t*)res); } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index b7d1417451..3f76d03289 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -10557,3 +10557,55 @@ void tFreeFetchTtlExpiredTbsRsp(void *p) { SVFetchTtlExpiredTbsRsp *pRsp = p; taosArrayDestroy(pRsp->pExpiredTbs); } + +int32_t tEncodeMqBatchMetaRsp(SEncoder *pEncoder, const SMqBatchMetaRsp *pRsp) { + if (tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset) < 0) return -1; + + int32_t size = taosArrayGetSize(pRsp->batchMetaReq); + if (tEncodeI32(pEncoder, size) < 0) return -1; + if (size > 0) { + for (int32_t i = 0; i < size; i++) { + void *pMetaReq = taosArrayGetP(pRsp->batchMetaReq, i); + int32_t metaLen = *(int32_t *)taosArrayGet(pRsp->batchMetaLen, i); + if (tEncodeBinary(pEncoder, pMetaReq, metaLen) < 0) return -1; + } + } + return 0; +} + +int32_t tDecodeMqBatchMetaRsp(SDecoder *pDecoder, SMqBatchMetaRsp *pRsp) { + int32_t size = 0; + if (tDecodeI32(pDecoder, &size) < 0) return -1; + if (size > 0) { + pRsp->batchMetaReq = taosArrayInit(size, POINTER_BYTES); + pRsp->batchMetaLen = taosArrayInit(size, sizeof(int32_t)); + for (int32_t i = 0; i < size; i++) { + void *pCreate = NULL; + uint64_t len = 0; + if (tDecodeBinaryAlloc(pDecoder, &pCreate, &len) < 0) return -1; + int32_t l = (int32_t)len; + taosArrayPush(pRsp->batchMetaReq, &pCreate); + taosArrayPush(pRsp->batchMetaLen, &l); + } + } + return 0; +} + +int32_t tSemiDecodeMqBatchMetaRsp(SDecoder *pDecoder, SMqBatchMetaRsp *pRsp) { + if (tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset) < 0) return -1; + if (pDecoder->size < pDecoder->pos) { + return -1; + } + pRsp->metaBuffLen = TD_CODER_REMAIN_CAPACITY(pDecoder); + pRsp->pMetaBuff = taosMemoryCalloc(1, pRsp->metaBuffLen); + memcpy(pRsp->pMetaBuff, TD_CODER_CURRENT(pDecoder), pRsp->metaBuffLen); + return 0; +} + +void tDeleteMqBatchMetaRsp(SMqBatchMetaRsp *pRsp) { + taosMemoryFreeClear(pRsp->pMetaBuff); + taosArrayDestroyP(pRsp->batchMetaReq, taosMemoryFree); + taosArrayDestroy(pRsp->batchMetaLen); + pRsp->batchMetaReq = NULL; + pRsp->batchMetaLen = NULL; +} diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index e2ecdca59f..08d32b2b81 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -113,7 +113,7 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle); void tqDestroyTqHandle(void* data); // tqRead -int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMetaRsp* pMetaRsp, STqOffsetVal* offset); +int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqBatchMetaRsp* pBatchMetaRsp, STqOffsetVal* offset); int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* pOffset, const SMqPollReq* pRequest); int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, uint64_t reqId); diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 08f1689f2f..b9c9595c74 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -163,7 +163,7 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* return 0; } -int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMetaRsp* pMetaRsp, STqOffsetVal* pOffset) { +int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqBatchMetaRsp* pBatchMetaRsp, STqOffsetVal* pOffset) { const STqExecHandle* pExec = &pHandle->execHandle; qTaskInfo_t task = pExec->task; @@ -218,10 +218,10 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } // get meta - SMqMetaRsp* tmp = qStreamExtractMetaMsg(task); - if (tmp->metaRspLen > 0) { + SMqBatchMetaRsp* tmp = qStreamExtractMetaMsg(task); + if (taosArrayGetSize(tmp->batchMetaReq) > 0) { qStreamExtractOffset(task, &tmp->rspOffset); - *pMetaRsp = *tmp; + *pBatchMetaRsp = *tmp; tqDebug("tmqsnap task get meta"); break; diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 28f4a19949..df7539bb69 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -17,6 +17,8 @@ static int32_t tqSendMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqMetaRsp* pRsp, int32_t vgId); +static int32_t tqSendBatchMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, + const SMqBatchMetaRsp* pRsp, int32_t vgId); int32_t tqInitDataRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) { tOffsetCopy(&pRsp->reqOffset, &pOffset); @@ -187,7 +189,6 @@ end : { } \ tDecoderClear(&decoder); - static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, STqOffsetVal* offset) { int code = 0; @@ -197,18 +198,19 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, tqInitTaosxRsp(&taosxRsp.common, *offset); if (offset->type != TMQ_OFFSET__LOG) { - if (tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, offset) < 0) { + SMqBatchMetaRsp btMetaRsp = {0}; + if (tqScanTaosx(pTq, pHandle, &taosxRsp, &btMetaRsp, offset) < 0) { code = -1; goto end; } - if (metaRsp.metaRspLen > 0) { - code = tqSendMetaPollRsp(pHandle, pMsg, pRequest, &metaRsp, vgId); + if (taosArrayGetSize(btMetaRsp.batchMetaReq) > 0) { + code = tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); tqDebug("tmq poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send meta offset type:%d,uid:%" PRId64 ",ts:%" PRId64, - pRequest->consumerId, pHandle->subKey, vgId, metaRsp.rspOffset.type, metaRsp.rspOffset.uid, - metaRsp.rspOffset.ts); - tDeleteMqMetaRsp(&metaRsp); + pRequest->consumerId, pHandle->subKey, vgId, btMetaRsp.rspOffset.type, btMetaRsp.rspOffset.uid, + btMetaRsp.rspOffset.ts); + tDeleteMqBatchMetaRsp(&btMetaRsp); goto end; } @@ -352,6 +354,40 @@ static void initMqRspHead(SMqRspHead* pMsgHead, int32_t type, int32_t epoch, int pMsgHead->walever = ever; } +int32_t tqSendBatchMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqBatchMetaRsp* pRsp, + int32_t vgId) { + int32_t len = 0; + int32_t code = 0; + tEncodeSize(tEncodeMqBatchMetaRsp, pRsp, len, code); + if (code < 0) { + return -1; + } + int32_t tlen = sizeof(SMqRspHead) + len; + void* buf = rpcMallocCont(tlen); + if (buf == NULL) { + return -1; + } + + int64_t sver = 0, ever = 0; + walReaderValidVersionRange(pHandle->execHandle.pTqReader->pWalReader, &sver, &ever); + initMqRspHead(buf, TMQ_MSG_TYPE__POLL_BATCH_META_RSP, pReq->epoch, pReq->consumerId, sver, ever); + + void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); + + SEncoder encoder = {0}; + tEncoderInit(&encoder, abuf, len); + tEncodeMqBatchMetaRsp(&encoder, pRsp); + tEncoderClear(&encoder); + + SRpcMsg resp = {.info = pMsg->info, .pCont = buf, .contLen = tlen, .code = 0}; + + tmsgSendRsp(&resp); + tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type: batch meta, offset type:%d", vgId, + pReq->consumerId, pReq->epoch, pRsp->rspOffset.type); + + return 0; +} + int32_t tqSendMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqMetaRsp* pRsp, int32_t vgId) { int32_t len = 0; diff --git a/source/libs/executor/inc/querytask.h b/source/libs/executor/inc/querytask.h index 886ce9705d..18f51df2e9 100644 --- a/source/libs/executor/inc/querytask.h +++ b/source/libs/executor/inc/querytask.h @@ -58,7 +58,7 @@ typedef struct STaskStopInfo { typedef struct { STqOffsetVal currentOffset; // for tmq - SMqMetaRsp metaRsp; // for tmq fetching meta + SMqBatchMetaRsp btMetaRsp; // for tmq fetching meta int8_t sourceExcluded; int64_t snapshotVer; SSchemaWrapper* schema; diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 2f360044c9..69be1c76c7 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1078,9 +1078,9 @@ const char* qExtractTbnameFromTask(qTaskInfo_t tinfo) { return pTaskInfo->streamInfo.tbName; } -SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { +SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - return &pTaskInfo->streamInfo.metaRsp; + return &pTaskInfo->streamInfo.btMetaRsp; } void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 110aabf9b1..72ea9afae7 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -44,6 +44,7 @@ int32_t scanDebug = 0; #define STREAM_SCAN_OP_NAME "StreamScanOperator" #define STREAM_SCAN_OP_STATE_NAME "StreamScanFillHistoryState" #define STREAM_SCAN_OP_CHECKPOINT_NAME "StreamScanOperator_Checkpoint" +#define TMQ_MAX_BATCH_SIZE 4096 typedef struct STableMergeScanExecInfo { SFileBlockLoadRecorder blockRecorder; @@ -2845,8 +2846,8 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { SStreamRawScanInfo* pInfo = pOperator->info; int32_t code = TSDB_CODE_SUCCESS; - pTaskInfo->streamInfo.metaRsp.metaRspLen = 0; // use metaRspLen !=0 to judge if data is meta - pTaskInfo->streamInfo.metaRsp.metaRsp = NULL; + pTaskInfo->streamInfo.btMetaRsp.batchMetaReq = NULL; // use batchMetaReq != NULL to judge if data is meta + pTaskInfo->streamInfo.btMetaRsp.batchMetaLen = NULL; qDebug("tmqsnap doRawScan called"); if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) { @@ -2893,28 +2894,60 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { return NULL; } else if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_META) { SSnapContext* sContext = pInfo->sContext; - void* data = NULL; - int32_t dataLen = 0; - int16_t type = 0; - int64_t uid = 0; - if (pAPI->snapshotFn.getTableInfoFromSnapshot(sContext, &data, &dataLen, &type, &uid) < 0) { - qError("tmqsnap getTableInfoFromSnapshot error"); - taosMemoryFreeClear(data); - return NULL; - } + for(int32_t i = 0; i < TMQ_MAX_BATCH_SIZE; i++) { + void* data = NULL; + int32_t dataLen = 0; + int16_t type = 0; + int64_t uid = 0; + if (pAPI->snapshotFn.getTableInfoFromSnapshot(sContext, &data, &dataLen, &type, &uid) < 0) { + qError("tmqsnap getTableInfoFromSnapshot error"); + taosMemoryFreeClear(data); + break; + } - if (!sContext->queryMeta) { // change to get data next poll request - STqOffsetVal offset = {0}; - SValue val = {0}; - tqOffsetResetToData(&offset, 0, INT64_MIN, val); - qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType); - } else { - tqOffsetResetToMeta(&pTaskInfo->streamInfo.currentOffset, uid); - pTaskInfo->streamInfo.metaRsp.resMsgType = type; - pTaskInfo->streamInfo.metaRsp.metaRspLen = dataLen; - pTaskInfo->streamInfo.metaRsp.metaRsp = data; - } + if (!sContext->queryMeta) { // change to get data next poll request + STqOffsetVal offset = {0}; + SValue val = {0}; + tqOffsetResetToData(&offset, 0, INT64_MIN, val); + qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType); + break; + } else { + tqOffsetResetToMeta(&pTaskInfo->streamInfo.currentOffset, uid); + SMqMetaRsp tmpMetaRsp = {0}; + tmpMetaRsp.resMsgType = type; + tmpMetaRsp.metaRspLen = dataLen; + tmpMetaRsp.metaRsp = data; + if (!pTaskInfo->streamInfo.btMetaRsp.batchMetaReq) { + pTaskInfo->streamInfo.btMetaRsp.batchMetaReq = taosArrayInit(4, POINTER_BYTES); + pTaskInfo->streamInfo.btMetaRsp.batchMetaLen = taosArrayInit(4, sizeof(int32_t)); + } + int32_t code = TSDB_CODE_SUCCESS; + uint32_t len = 0; + tEncodeSize(tEncodeMqMetaRsp, &tmpMetaRsp, len, code); + if (TSDB_CODE_SUCCESS != code) { + qError("tmqsnap tEncodeMqMetaRsp error"); + taosMemoryFreeClear(data); + break; + } + int32_t tLen = sizeof(SMqRspHead) + len; + void* tBuf = taosMemoryCalloc(1, tLen); + void* metaBuff = POINTER_SHIFT(tBuf, sizeof(SMqRspHead)); + SEncoder encoder = {0}; + tEncoderInit(&encoder, metaBuff, len); + code = tEncodeMqMetaRsp(&encoder, &tmpMetaRsp); + if (code < 0) { + qError("tmqsnap tEncodeMqMetaRsp error"); + tEncoderClear(&encoder); + taosMemoryFreeClear(tBuf); + taosMemoryFreeClear(data); + break; + } + taosMemoryFreeClear(data); + taosArrayPush(pTaskInfo->streamInfo.btMetaRsp.batchMetaReq, &tBuf); + taosArrayPush(pTaskInfo->streamInfo.btMetaRsp.batchMetaLen, &tLen); + } + } return NULL; } return NULL; diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index a391093609..5642b801f4 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -1138,6 +1138,7 @@ void testConsumeExcluded(int topic_type) { taos_close(pConn); return; } + taos_close(pConn); taos_free_result(pRes); } From be82e4acd2b2350c1a01f7ae2b7f5cc94cfd64b0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 24 May 2024 11:25:30 +0800 Subject: [PATCH 02/44] add log --- source/client/src/clientTmq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index df08a66bd3..1d993eef6f 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1439,6 +1439,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } tDecoderClear(&decoder); memcpy(&pRspWrapper->batchMetaRsp, pMsg->pData, sizeof(SMqRspHead)); + tscDebug("consumer:0x%" PRIx64 " recv poll batchmeta rsp, vgId:%d, reqId:0x%" PRIx64, tmq->consumerId, vgId, + requestId); } else { // invalid rspType tscError("consumer:0x%" PRIx64 " invalid rsp msg received, type:%d ignored", tmq->consumerId, rspType); } @@ -1648,6 +1650,7 @@ SMqBatchMetaRspObj* tmqBuildBatchMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) pRspObj->common.vgId = pWrapper->vgHandle->vgId; memcpy(&pRspObj->rsp, &pWrapper->batchMetaRsp, sizeof(SMqBatchMetaRsp)); + tscDebug("build batchmeta Rsp from wrapper"); return pRspObj; } From d33b2521fd87f454b084c96925cebb928ba14a90 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 24 May 2024 11:42:08 +0800 Subject: [PATCH 03/44] adj res type --- source/client/src/clientTmq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 1d993eef6f..3fbae1b774 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -2260,7 +2260,7 @@ tmq_res_t tmq_get_res_type(TAOS_RES* res) { } else if (TD_RES_TMQ_METADATA(res)) { return TMQ_RES_METADATA; } else if (TD_RES_TMQ_BATCH_META(res)) { - return TMQ_RES_BATCH_TABLE_META; + return TMQ_RES_TABLE_META; } else { return TMQ_RES_INVALID; } From 7fc2e8cc26ab977aa41c8cecedd11266cd593779 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 28 May 2024 10:17:20 +0800 Subject: [PATCH 04/44] batch meta --- source/client/src/clientRawBlockWrite.c | 12 ++++- source/client/src/clientTmq.c | 45 +++++++++++++--- source/dnode/vnode/src/tq/tqUtil.c | 68 ++++++++++++++++++++----- source/libs/executor/src/scanoperator.c | 3 +- utils/test/c/tmq_taosx_ci.c | 6 +-- 5 files changed, 107 insertions(+), 27 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index a37cd99360..d5f478d188 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -2051,6 +2051,7 @@ static char* processSimpleMeta(SMqMetaRsp* pMetaRsp) { static char* processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp) { SDecoder coder; SMqBatchMetaRsp rsp = {0}; + SArray* strArray = NULL; tDecoderInit(&coder, pMsgRsp->pMetaBuff, pMsgRsp->metaBuffLen); if (tDecodeMqBatchMetaRsp(&coder, &rsp) < 0) { goto _end; @@ -2058,7 +2059,7 @@ static char* processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp) { int64_t fullSize = 0; int32_t num = taosArrayGetSize(rsp.batchMetaReq); - SArray* strArray = taosArrayInit(num, POINTER_BYTES); + strArray = taosArrayInit(num, POINTER_BYTES); for (int32_t i = 0; i < num; i++) { int32_t len = *(int32_t*)taosArrayGet(rsp.batchMetaLen, i); void* tmpBuf = taosArrayGetP(rsp.batchMetaReq, i); @@ -2078,10 +2079,17 @@ static char* processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp) { for (int32_t i = 0; i < num; i++) { char* subStr = taosArrayGetP(strArray, i); strcat(buf, subStr); - strcat(buf, "\n"); + if (i < num - 1) { + strcat(buf, "\n"); + } } + taosArrayDestroyP(strArray, taosMemoryFree); + tDeleteMqBatchMetaRsp(&rsp); + return buf; _end: + taosArrayDestroyP(strArray, taosMemoryFree); + tDeleteMqBatchMetaRsp(&rsp); return NULL; } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 3fbae1b774..69a4503680 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -2009,7 +2009,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tmqFreeRspWrapper(pRspWrapper); taosFreeQitem(pRspWrapper); } - } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_META_RSP || pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { + } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_META_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; int32_t consumerEpoch = atomic_load_32(&tmq->epoch); @@ -2032,12 +2032,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { updateVgInfo(pVg, &pollRspWrapper->metaRsp.rspOffset, &pollRspWrapper->metaRsp.rspOffset, pollRspWrapper->metaRsp.head.walsver, pollRspWrapper->metaRsp.head.walever, tmq->consumerId, true); // build rsp - void* pRsp = NULL; - if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_META_RSP) { - pRsp = tmqBuildMetaRspFromWrapper(pollRspWrapper); - } else { - pRsp = tmqBuildBatchMetaRspFromWrapper(pollRspWrapper); - } + SMqMetaRspObj* pRsp = tmqBuildMetaRspFromWrapper(pollRspWrapper); taosFreeQitem(pRspWrapper); taosWUnLockLatch(&tmq->lock); return pRsp; @@ -2048,6 +2043,42 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tmqFreeRspWrapper(pRspWrapper); taosFreeQitem(pRspWrapper); } + } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { + SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; + int32_t consumerEpoch = atomic_load_32(&tmq->epoch); + + tscDebug("consumer:0x%" PRIx64 " process meta rsp", tmq->consumerId); + + if (pollRspWrapper->batchMetaRsp.head.epoch == consumerEpoch) { + taosWLockLatch(&tmq->lock); + SMqClientVg* pVg = getVgInfo(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId); + pollRspWrapper->vgHandle = pVg; + pollRspWrapper->topicHandle = getTopicInfo(tmq, pollRspWrapper->topicName); + if (pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL) { + tscError("consumer:0x%" PRIx64 " get vg or topic error, topic:%s vgId:%d", tmq->consumerId, + pollRspWrapper->topicName, pollRspWrapper->vgId); + tmqFreeRspWrapper(pRspWrapper); + taosFreeQitem(pRspWrapper); + taosWUnLockLatch(&tmq->lock); + return NULL; + } + + // build rsp + void* pRsp = NULL; + updateVgInfo(pVg, &pollRspWrapper->batchMetaRsp.rspOffset, &pollRspWrapper->batchMetaRsp.rspOffset, + pollRspWrapper->batchMetaRsp.head.walsver, pollRspWrapper->batchMetaRsp.head.walever, + tmq->consumerId, true); + pRsp = tmqBuildBatchMetaRspFromWrapper(pollRspWrapper); + taosFreeQitem(pRspWrapper); + taosWUnLockLatch(&tmq->lock); + return pRsp; + } else { + tscInfo("consumer:0x%" PRIx64 " vgId:%d msg discard since epoch mismatch: msg epoch %d, consumer epoch %d", + tmq->consumerId, pollRspWrapper->vgId, pollRspWrapper->batchMetaRsp.head.epoch, consumerEpoch); + setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId); + tmqFreeRspWrapper(pRspWrapper); + taosFreeQitem(pRspWrapper); + } } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_DATA_META_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; int32_t consumerEpoch = atomic_load_32(&tmq->epoch); diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index df7539bb69..88c41b99ef 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -191,14 +191,13 @@ end : { static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, STqOffsetVal* offset) { - int code = 0; - int32_t vgId = TD_VID(pTq->pVnode); - SMqMetaRsp metaRsp = {0}; - STaosxRsp taosxRsp = {0}; + int code = 0; + int32_t vgId = TD_VID(pTq->pVnode); + STaosxRsp taosxRsp = {0}; + SMqBatchMetaRsp btMetaRsp = {0}; tqInitTaosxRsp(&taosxRsp.common, *offset); if (offset->type != TMQ_OFFSET__LOG) { - SMqBatchMetaRsp btMetaRsp = {0}; if (tqScanTaosx(pTq, pHandle, &taosxRsp, &btMetaRsp, offset) < 0) { code = -1; goto end; @@ -232,11 +231,18 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, uint64_t st = taosGetTimestampMs(); int totalRows = 0; + int32_t totalMetaRows = 0; while (1) { int32_t savedEpoch = atomic_load_32(&pHandle->epoch); ASSERT(savedEpoch <= pRequest->epoch); if (tqFetchLog(pTq, pHandle, &fetchVer, pRequest->reqId) < 0) { + if (totalMetaRows > 0) { + tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); + tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); + ASSERT(totalRows == 0); + goto end; + } tqOffsetResetToLog(&taosxRsp.common.rspOffset, fetchVer); code = tqSendDataRsp( pHandle, pMsg, pRequest, &taosxRsp, @@ -270,12 +276,48 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, } } - tqDebug("fetch meta msg, ver:%" PRId64 ", type:%s", pHead->version, TMSG_INFO(pHead->msgType)); - tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer + 1); - metaRsp.resMsgType = pHead->msgType; - metaRsp.metaRspLen = pHead->bodyLen; - metaRsp.metaRsp = pHead->body; - code = tqSendMetaPollRsp(pHandle, pMsg, pRequest, &metaRsp, vgId); + tqDebug("fetch meta msg, ver:%" PRId64 ", vgId:%d, type:%s", pHead->version, vgId, TMSG_INFO(pHead->msgType)); + if (!btMetaRsp.batchMetaReq) { + btMetaRsp.batchMetaReq = taosArrayInit(4, POINTER_BYTES); + btMetaRsp.batchMetaLen = taosArrayInit(4, sizeof(int32_t)); + } + fetchVer++; + + SMqMetaRsp tmpMetaRsp = {0}; + tmpMetaRsp.resMsgType = pHead->msgType; + tmpMetaRsp.metaRspLen = pHead->bodyLen; + tmpMetaRsp.metaRsp = pHead->body; + uint32_t len = 0; + tEncodeSize(tEncodeMqMetaRsp, &tmpMetaRsp, len, code); + if (TSDB_CODE_SUCCESS != code) { + tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); + continue; + } + int32_t tLen = sizeof(SMqRspHead) + len; + void* tBuf = taosMemoryCalloc(1, tLen); + void* metaBuff = POINTER_SHIFT(tBuf, sizeof(SMqRspHead)); + SEncoder encoder = {0}; + tEncoderInit(&encoder, metaBuff, len); + code = tEncodeMqMetaRsp(&encoder, &tmpMetaRsp); + if (code < 0) { + tEncoderClear(&encoder); + tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); + continue; + } + taosArrayPush(btMetaRsp.batchMetaReq, &tBuf); + taosArrayPush(btMetaRsp.batchMetaLen, &tLen); + totalMetaRows++; + if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || (taosGetTimestampMs() - st > 1000)) { + tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); + tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); + goto end; + } + continue; + } + + if (totalMetaRows > 0) { + tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); + tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); goto end; } @@ -382,8 +424,8 @@ int32_t tqSendBatchMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SM SRpcMsg resp = {.info = pMsg->info, .pCont = buf, .contLen = tlen, .code = 0}; tmsgSendRsp(&resp); - tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type: batch meta, offset type:%d", vgId, - pReq->consumerId, pReq->epoch, pRsp->rspOffset.type); + tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type: batch meta, size:%d offset type:%d", vgId, + pReq->consumerId, pReq->epoch, taosArrayGetSize(pRsp->batchMetaReq), pRsp->rspOffset.type); return 0; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 72ea9afae7..851d2f2735 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -44,7 +44,6 @@ int32_t scanDebug = 0; #define STREAM_SCAN_OP_NAME "StreamScanOperator" #define STREAM_SCAN_OP_STATE_NAME "StreamScanFillHistoryState" #define STREAM_SCAN_OP_CHECKPOINT_NAME "StreamScanOperator_Checkpoint" -#define TMQ_MAX_BATCH_SIZE 4096 typedef struct STableMergeScanExecInfo { SFileBlockLoadRecorder blockRecorder; @@ -2894,7 +2893,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { return NULL; } else if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_META) { SSnapContext* sContext = pInfo->sContext; - for(int32_t i = 0; i < TMQ_MAX_BATCH_SIZE; i++) { + for(int32_t i = 0; i < tmqRowSize; i++) { void* data = NULL; int32_t dataLen = 0; int16_t type = 0; diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index 5642b801f4..ef2d70f54f 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -1064,7 +1064,7 @@ void testConsumeExcluded(int topic_type) { char* topic = "create topic topic_excluded with meta as database db_taosx"; pRes = taos_query(pConn, topic); if (taos_errno(pRes) != 0) { - printf("failed to create topic topic_excluded, reason:%s\n", taos_errstr(pRes)); + printf("failed to create topic topic_excluded1, reason:%s\n", taos_errstr(pRes)); taos_close(pConn); return; } @@ -1073,7 +1073,7 @@ void testConsumeExcluded(int topic_type) { char* topic = "create topic topic_excluded as select * from stt"; pRes = taos_query(pConn, topic); if (taos_errno(pRes) != 0) { - printf("failed to create topic topic_excluded, reason:%s\n", taos_errstr(pRes)); + printf("failed to create topic topic_excluded2, reason:%s\n", taos_errstr(pRes)); taos_close(pConn); return; } @@ -1115,7 +1115,7 @@ void testConsumeExcluded(int topic_type) { assert(raw.raw_type != 2 && raw.raw_type != 4 && raw.raw_type != TDMT_VND_CREATE_STB && raw.raw_type != TDMT_VND_ALTER_STB && raw.raw_type != TDMT_VND_CREATE_TABLE && raw.raw_type != TDMT_VND_ALTER_TABLE && raw.raw_type != TDMT_VND_DELETE); - assert(raw.raw_type == TDMT_VND_DROP_STB || raw.raw_type == TDMT_VND_DROP_TABLE); + assert(raw.raw_type == TDMT_VND_DROP_STB || raw.raw_type == TDMT_VND_DROP_TABLE || raw.raw_type == 5); } else if (topic_type == 2) { assert(0); } From 57bf9d10482a7a5c36bfade104540758e4ed6de4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 28 May 2024 10:56:43 +0800 Subject: [PATCH 05/44] adj log --- source/dnode/vnode/src/tq/tqUtil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 88c41b99ef..4b1ff04331 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -424,7 +424,7 @@ int32_t tqSendBatchMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SM SRpcMsg resp = {.info = pMsg->info, .pCont = buf, .contLen = tlen, .code = 0}; tmsgSendRsp(&resp); - tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type: batch meta, size:%d offset type:%d", vgId, + tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type: batch meta, size:%ld offset type:%d", vgId, pReq->consumerId, pReq->epoch, taosArrayGetSize(pRsp->batchMetaReq), pRsp->rspOffset.type); return 0; From d815bb117be31fcd233a1c204fb3827b0a9dbd31 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 28 May 2024 16:56:23 +0800 Subject: [PATCH 06/44] add json for batch meta --- include/client/taos.h | 3 +- source/client/src/clientRawBlockWrite.c | 127 +++++++++++------------- utils/test/c/tmq_taosx_ci.c | 20 +++- 3 files changed, 75 insertions(+), 75 deletions(-) diff --git a/include/client/taos.h b/include/client/taos.h index 66b5b92869..46e4e7633b 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -282,8 +282,7 @@ typedef enum tmq_res_t { TMQ_RES_INVALID = -1, TMQ_RES_DATA = 1, TMQ_RES_TABLE_META = 2, - TMQ_RES_METADATA = 3, - TMQ_RES_BATCH_TABLE_META = 4, + TMQ_RES_METADATA = 3 } tmq_res_t; typedef struct tmq_topic_assignment { diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index d5f478d188..5e6d693562 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -26,11 +26,13 @@ #define LOG_ID_TAG "connId:0x%" PRIx64 ",reqId:0x%" PRIx64 #define LOG_ID_VALUE *(int64_t*)taos, pRequest->requestId +#define TMQ_META_VERSION "1.0" + static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen); static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); } -static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, +static cJSON* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, int8_t t, SColCmprWrapper* pColCmprRow) { int8_t buildDefaultCompress = 0; if (pColCmprRow->nCols <= 0) { @@ -124,9 +126,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch } cJSON_AddItemToObject(json, "tags", tags); - string = cJSON_PrintUnformatted(json); - cJSON_Delete(json); - return string; + return json; } static int32_t setCompressOption(cJSON* json, uint32_t para) { @@ -153,7 +153,7 @@ static int32_t setCompressOption(cJSON* json, uint32_t para) { } return 0; } -static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { +static cJSON* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { SMAlterStbReq req = {0}; cJSON* json = NULL; char* string = NULL; @@ -247,18 +247,16 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { default: break; } - string = cJSON_PrintUnformatted(json); end: - cJSON_Delete(json); tFreeSMAltertbReq(&req); - return string; + return json; } -static char* processCreateStb(SMqMetaRsp* metaRsp) { +static cJSON* processCreateStb(SMqMetaRsp* metaRsp) { SVCreateStbReq req = {0}; SDecoder coder; - char* string = NULL; + cJSON* pJson = NULL; uDebug("create stable data:%p", metaRsp); // decode and process req @@ -269,17 +267,17 @@ static char* processCreateStb(SMqMetaRsp* metaRsp) { if (tDecodeSVCreateStbReq(&coder, &req) < 0) { goto _err; } - string = buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE, &req.colCmpr); + pJson = buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE, &req.colCmpr); _err: - uDebug("create stable return, sql json:%s", string); + uDebug("create stable return, sql json:%s", cJSON_PrintUnformatted(pJson)); tDecoderClear(&coder); - return string; + return pJson; } -static char* processAlterStb(SMqMetaRsp* metaRsp) { +static cJSON* processAlterStb(SMqMetaRsp* metaRsp) { SVCreateStbReq req = {0}; SDecoder coder; - char* string = NULL; + cJSON* pJson = NULL; uDebug("alter stable data:%p", metaRsp); // decode and process req @@ -290,11 +288,11 @@ static char* processAlterStb(SMqMetaRsp* metaRsp) { if (tDecodeSVCreateStbReq(&coder, &req) < 0) { goto _err; } - string = buildAlterSTableJson(req.alterOriData, req.alterOriDataLen); + pJson = buildAlterSTableJson(req.alterOriData, req.alterOriDataLen); _err: - uDebug("alter stable return, sql json:%s", string); + uDebug("alter stable return, sql json:%s", cJSON_PrintUnformatted(pJson)); tDecoderClear(&coder); - return string; + return pJson; } static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { @@ -387,7 +385,7 @@ end: taosArrayDestroy(pTagVals); } -static char* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) { +static cJSON* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) { char* string = NULL; cJSON* json = cJSON_CreateObject(); if (json == NULL) { @@ -412,16 +410,14 @@ static char* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) { cJSON_AddItemToArray(createList, create); } cJSON_AddItemToObject(json, "createList", createList); - string = cJSON_PrintUnformatted(json); - cJSON_Delete(json); - return string; + return json; } -static char* processCreateTable(SMqMetaRsp* metaRsp) { +static cJSON* processCreateTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVCreateTbBatchReq req = {0}; SVCreateTbReq* pCreateReq; - char* string = NULL; + cJSON* pJson = NULL; // decode uDebug("create table data:%p", metaRsp); void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead)); @@ -435,15 +431,15 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) { if (req.nReqs > 0) { pCreateReq = req.pReqs; if (pCreateReq->type == TSDB_CHILD_TABLE) { - string = buildCreateCTableJson(req.pReqs, req.nReqs); + pJson = buildCreateCTableJson(req.pReqs, req.nReqs); } else if (pCreateReq->type == TSDB_NORMAL_TABLE) { - string = buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, + pJson = buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, TSDB_NORMAL_TABLE, &pCreateReq->colCmpr); } } _exit: - uDebug("create table return, sql json:%s", string); + uDebug("create table return, sql json:%s", cJSON_PrintUnformatted(pJson)); for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pCreateReq = req.pReqs + iReq; taosMemoryFreeClear(pCreateReq->comment); @@ -453,7 +449,7 @@ _exit: } } tDecoderClear(&decoder); - return string; + return pJson; } static char* processAutoCreateTable(STaosxRsp* rsp) { @@ -482,7 +478,9 @@ static char* processAutoCreateTable(STaosxRsp* rsp) { goto _exit; } } - string = buildCreateCTableJson(pCreateReq, rsp->createTableNum); + cJSON* pJson = buildCreateCTableJson(pCreateReq, rsp->createTableNum); + string = cJSON_PrintUnformatted(pJson); + cJSON_Delete(pJson); _exit: uDebug("auto created table return, sql json:%s", string); for (int i = 0; i < rsp->createTableNum; i++) { @@ -497,7 +495,7 @@ _exit: return string; } -static char* processAlterTable(SMqMetaRsp* metaRsp) { +static cJSON* processAlterTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVAlterTbReq vAlterTbReq = {0}; char* string = NULL; @@ -622,19 +620,16 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { default: break; } - string = cJSON_PrintUnformatted(json); _exit: - uDebug("alter table return, sql json:%s", string); - cJSON_Delete(json); + uDebug("alter table return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); - return string; + return json; } -static char* processDropSTable(SMqMetaRsp* metaRsp) { +static cJSON* processDropSTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVDropStbReq req = {0}; - char* string = NULL; cJSON* json = NULL; uDebug("processDropSTable data:%p", metaRsp); @@ -659,18 +654,15 @@ static char* processDropSTable(SMqMetaRsp* metaRsp) { cJSON* tableName = cJSON_CreateString(req.name); cJSON_AddItemToObject(json, "tableName", tableName); - string = cJSON_PrintUnformatted(json); _exit: - uDebug("processDropSTable return, sql json:%s", string); - cJSON_Delete(json); + uDebug("processDropSTable return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); - return string; + return json; } -static char* processDeleteTable(SMqMetaRsp* metaRsp) { +static cJSON* processDeleteTable(SMqMetaRsp* metaRsp) { SDeleteRes req = {0}; SDecoder coder = {0}; cJSON* json = NULL; - char* string = NULL; uDebug("processDeleteTable data:%p", metaRsp); // decode and process req @@ -698,18 +690,15 @@ static char* processDeleteTable(SMqMetaRsp* metaRsp) { cJSON* sqlJson = cJSON_CreateString(sql); cJSON_AddItemToObject(json, "sql", sqlJson); - string = cJSON_PrintUnformatted(json); _exit: - uDebug("processDeleteTable return, sql json:%s", string); - cJSON_Delete(json); + uDebug("processDeleteTable return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&coder); - return string; + return json; } -static char* processDropTable(SMqMetaRsp* metaRsp) { +static cJSON* processDropTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVDropTbBatchReq req = {0}; - char* string = NULL; cJSON* json = NULL; uDebug("processDropTable data:%p", metaRsp); @@ -743,12 +732,10 @@ static char* processDropTable(SMqMetaRsp* metaRsp) { } cJSON_AddItemToObject(json, "tableNameList", tableNameList); - string = cJSON_PrintUnformatted(json); _exit: - uDebug("processDropTable return, json sql:%s", string); - cJSON_Delete(json); + uDebug("processDropTable return, json sql:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); - return string; + return json; } static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { @@ -1805,6 +1792,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, NULL, fields, pSW->nCols, true, err, ERR_MSG_LEN); taosMemoryFree(fields); + taosMemoryFreeClear(pTableMeta); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", tbName, err); goto end; @@ -1997,6 +1985,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, &pCreateReqDst, fields, pSW->nCols, true, err, ERR_MSG_LEN); taosMemoryFree(fields); + taosMemoryFreeClear(pTableMeta); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", tbName, err); goto end; @@ -2027,7 +2016,7 @@ end: return code; } -static char* processSimpleMeta(SMqMetaRsp* pMetaRsp) { +static cJSON* processSimpleMeta(SMqMetaRsp* pMetaRsp) { if (pMetaRsp->resMsgType == TDMT_VND_CREATE_STB) { return processCreateStb(pMetaRsp); } else if (pMetaRsp->resMsgType == TDMT_VND_ALTER_STB) { @@ -2051,15 +2040,15 @@ static char* processSimpleMeta(SMqMetaRsp* pMetaRsp) { static char* processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp) { SDecoder coder; SMqBatchMetaRsp rsp = {0}; - SArray* strArray = NULL; tDecoderInit(&coder, pMsgRsp->pMetaBuff, pMsgRsp->metaBuffLen); if (tDecodeMqBatchMetaRsp(&coder, &rsp) < 0) { goto _end; } - int64_t fullSize = 0; + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddStringToObject(pJson, "tmq_meta_version", TMQ_META_VERSION); + cJSON* pMetaArr = cJSON_CreateArray(); int32_t num = taosArrayGetSize(rsp.batchMetaReq); - strArray = taosArrayInit(num, POINTER_BYTES); for (int32_t i = 0; i < num; i++) { int32_t len = *(int32_t*)taosArrayGet(rsp.batchMetaLen, i); void* tmpBuf = taosArrayGetP(rsp.batchMetaReq, i); @@ -2069,26 +2058,19 @@ static char* processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp) { if(tDecodeMqMetaRsp(&metaCoder, &metaRsp) < 0 ) { goto _end; } - char* subStr = processSimpleMeta(&metaRsp); + cJSON* pItem = processSimpleMeta(&metaRsp); tDeleteMqMetaRsp(&metaRsp); - fullSize += strlen(subStr); - taosArrayPush(strArray, &subStr); + cJSON_AddItemToArray(pMetaArr, pItem); } - char* buf = (char*)taosMemoryCalloc(1, fullSize + num + 1); - for (int32_t i = 0; i < num; i++) { - char* subStr = taosArrayGetP(strArray, i); - strcat(buf, subStr); - if (i < num - 1) { - strcat(buf, "\n"); - } - } - taosArrayDestroyP(strArray, taosMemoryFree); + cJSON_AddItemToObject(pJson, "metas", pMetaArr); tDeleteMqBatchMetaRsp(&rsp); - return buf; + char* fullStr = cJSON_PrintUnformatted(pJson); + cJSON_Delete(pJson); + return fullStr; _end: - taosArrayDestroyP(strArray, taosMemoryFree); + cJSON_Delete(pJson); tDeleteMqBatchMetaRsp(&rsp); return NULL; } @@ -2109,7 +2091,10 @@ char* tmq_get_json_meta(TAOS_RES* res) { } SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; - return processSimpleMeta(&pMetaRspObj->metaRsp); + cJSON* pJson = processSimpleMeta(&pMetaRspObj->metaRsp); + char* string = cJSON_PrintUnformatted(pJson); + cJSON_Delete(pJson); + return string; } void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); } diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index ef2d70f54f..c1b312335f 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -18,6 +18,7 @@ #include #include #include +#include "cJSON.h" #include "taos.h" #include "tmsg.h" #include "types.h" @@ -61,8 +62,23 @@ static void msg_process(TAOS_RES* msg) { if (result) { printf("meta result: %s\n", result); if (g_fp && strcmp(result, "") != 0) { - taosFprintfFile(g_fp, result); - taosFprintfFile(g_fp, "\n"); + // RES_TYPE__TMQ_BATCH_META + if ((*(int8_t*)msg) == 5) { + cJSON* pJson = cJSON_Parse(result); + cJSON* pJsonArray = cJSON_GetObjectItem(pJson, "metas"); + int32_t num = cJSON_GetArraySize(pJsonArray); + for (int32_t i = 0; i < num; i++) { + cJSON* pJsonItem = cJSON_GetArrayItem(pJsonArray, i); + char* itemStr = cJSON_PrintUnformatted(pJsonItem); + taosFprintfFile(g_fp, itemStr); + tmq_free_json_meta(itemStr); + taosFprintfFile(g_fp, "\n"); + } + cJSON_Delete(pJson); + } else { + taosFprintfFile(g_fp, result); + taosFprintfFile(g_fp, "\n"); + } } } tmq_free_json_meta(result); From a2255ca35558af614f6acdee7f9824ce5857c2f2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 28 May 2024 18:34:37 +0800 Subject: [PATCH 07/44] add tmq param --- include/common/tmsg.h | 5 +++++ source/client/src/clientTmq.c | 11 +++++++++++ source/common/src/tmsg.c | 16 ++++++++++++++++ source/dnode/vnode/src/tq/tqUtil.c | 30 +++++++++++++++++++++++------- 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 1657a17ff0..7917222542 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2744,6 +2744,7 @@ typedef struct { int32_t autoCommitInterval; int8_t resetOffsetCfg; int8_t enableReplay; + int8_t enableBatchMeta; } SCMSubscribeReq; static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) { @@ -2764,6 +2765,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc tlen += taosEncodeFixedI32(buf, pReq->autoCommitInterval); tlen += taosEncodeFixedI8(buf, pReq->resetOffsetCfg); tlen += taosEncodeFixedI8(buf, pReq->enableReplay); + tlen += taosEncodeFixedI8(buf, pReq->enableBatchMeta); return tlen; } @@ -2788,6 +2790,7 @@ static FORCE_INLINE void* tDeserializeSCMSubscribeReq(void* buf, SCMSubscribeReq buf = taosDecodeFixedI32(buf, &pReq->autoCommitInterval); buf = taosDecodeFixedI8(buf, &pReq->resetOffsetCfg); buf = taosDecodeFixedI8(buf, &pReq->enableReplay); + buf = taosDecodeFixedI8(buf, &pReq->enableBatchMeta); return buf; } @@ -2976,6 +2979,7 @@ typedef struct { int tEncodeSVCreateTbBatchReq(SEncoder* pCoder, const SVCreateTbBatchReq* pReq); int tDecodeSVCreateTbBatchReq(SDecoder* pCoder, SVCreateTbBatchReq* pReq); +void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq* pReq); typedef struct { int32_t code; @@ -3893,6 +3897,7 @@ typedef struct { STqOffsetVal reqOffset; int8_t enableReplay; int8_t sourceExcluded; + int8_t enableBatchMeta; } SMqPollReq; int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 69a4503680..8038273b43 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -71,6 +71,7 @@ struct tmq_conf_t { char* pass; tmq_commit_cb* commitCb; void* commitCbUserParam; + int8_t enableBatchMeta; }; struct tmq_t { @@ -87,6 +88,7 @@ struct tmq_t { uint64_t consumerId; tmq_commit_cb* commitCb; void* commitCbUserParam; + int8_t enableBatchMeta; // status SRWLatch lock; @@ -269,6 +271,7 @@ tmq_conf_t* tmq_conf_new() { conf->autoCommit = true; conf->autoCommitInterval = DEFAULT_AUTO_COMMIT_INTERVAL; conf->resetOffset = TMQ_OFFSET__RESET_LATEST; + conf->enableBatchMeta = false; return conf; } @@ -398,6 +401,11 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value return TMQ_CONF_OK; } + if (strcasecmp(key, "msg.enable.batchmeta") == 0) { + conf->enableBatchMeta = (taosStr2int64(value) != 0) ? true : false; + return TMQ_CONF_OK; + } + return TMQ_CONF_UNKNOWN; } @@ -1122,6 +1130,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { pTmq->resetOffsetCfg = conf->resetOffset; pTmq->replayEnable = conf->replayEnable; pTmq->sourceExcluded = conf->sourceExcluded; + pTmq->enableBatchMeta = conf->enableBatchMeta; if (conf->replayEnable) { pTmq->autoCommit = false; } @@ -1199,6 +1208,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { req.autoCommitInterval = tmq->autoCommitInterval; req.resetOffsetCfg = tmq->resetOffsetCfg; req.enableReplay = tmq->replayEnable; + req.enableBatchMeta = tmq->enableBatchMeta; for (int32_t i = 0; i < sz; i++) { char* topic = taosArrayGetP(container, i); @@ -1623,6 +1633,7 @@ void tmqBuildConsumeReqImpl(SMqPollReq* pReq, tmq_t* tmq, int64_t timeout, SMqCl pReq->reqId = generateRequestId(); pReq->enableReplay = tmq->replayEnable; pReq->sourceExcluded = tmq->sourceExcluded; + pReq->enableBatchMeta = tmq->enableBatchMeta; } SMqMetaRspObj* tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 3f76d03289..c17c522d4f 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -7199,6 +7199,7 @@ int32_t tSerializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { pHead->vgId = htonl(pReq->head.vgId); pHead->contLen = htonl(tlen + headLen); } + if (tEncodeI8(&encoder, pReq->enableBatchMeta) < 0) return -1; return tlen + headLen; } @@ -7228,6 +7229,12 @@ int32_t tDeserializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { if (tDecodeI8(&decoder, &pReq->sourceExcluded) < 0) return -1; } + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, &pReq->enableBatchMeta) < 0) return -1; + } else { + pReq->enableBatchMeta = false; + } + tEndDecode(&decoder); tDecoderClear(&decoder); @@ -8362,6 +8369,15 @@ int tDecodeSVCreateTbBatchReq(SDecoder *pCoder, SVCreateTbBatchReq *pReq) { return 0; } +void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq* pReq) { + for (int32_t iReq = 0; iReq < pReq->nReqs; iReq++) { + SVCreateTbReq* pCreateReq = pReq->pReqs + iReq; + if (pCreateReq->type == TSDB_CHILD_TABLE) { + taosArrayDestroy(pCreateReq->ctb.tagName); + } + } +} + int tEncodeSVCreateTbRsp(SEncoder *pCoder, const SVCreateTbRsp *pRsp) { if (tStartEncode(pCoder) < 0) return -1; diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 4b1ff04331..496201e79e 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -174,7 +174,7 @@ end : { } } -#define PROCESS_EXCLUDED_MSG(TYPE, DECODE_FUNC) \ +#define PROCESS_EXCLUDED_MSG(TYPE, DECODE_FUNC, DELETE_FUNC) \ SDecoder decoder = {0};\ TYPE req = {0}; \ void* data = POINTER_SHIFT(pHead->body, sizeof(SMsgHead)); \ @@ -184,11 +184,16 @@ end : { tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d) iter log, jump meta for, vgId:%d offset %" PRId64 " msgType %d", \ pRequest->consumerId, pRequest->epoch, vgId, fetchVer, pHead->msgType); \ fetchVer++; \ + DELETE_FUNC(&req); \ tDecoderClear(&decoder); \ continue; \ } \ + DELETE_FUNC(&req); \ tDecoderClear(&decoder); +static void tDeleteCommon(void* parm) { +} + static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, STqOffsetVal* offset) { int code = 0; @@ -266,17 +271,28 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, if ((pRequest->sourceExcluded & TD_REQ_FROM_TAOX) != 0) { if (pHead->msgType == TDMT_VND_CREATE_TABLE) { - PROCESS_EXCLUDED_MSG(SVCreateTbBatchReq, tDecodeSVCreateTbBatchReq) + PROCESS_EXCLUDED_MSG(SVCreateTbBatchReq, tDecodeSVCreateTbBatchReq, tDeleteSVCreateTbBatchReq) } else if (pHead->msgType == TDMT_VND_ALTER_TABLE) { - PROCESS_EXCLUDED_MSG(SVAlterTbReq, tDecodeSVAlterTbReq) + PROCESS_EXCLUDED_MSG(SVAlterTbReq, tDecodeSVAlterTbReq, tDeleteCommon) } else if (pHead->msgType == TDMT_VND_CREATE_STB || pHead->msgType == TDMT_VND_ALTER_STB) { - PROCESS_EXCLUDED_MSG(SVCreateStbReq, tDecodeSVCreateStbReq) + PROCESS_EXCLUDED_MSG(SVCreateStbReq, tDecodeSVCreateStbReq, tDeleteCommon) } else if (pHead->msgType == TDMT_VND_DELETE) { - PROCESS_EXCLUDED_MSG(SDeleteRes, tDecodeDeleteRes) + PROCESS_EXCLUDED_MSG(SDeleteRes, tDecodeDeleteRes, tDeleteCommon) } } - tqDebug("fetch meta msg, ver:%" PRId64 ", vgId:%d, type:%s", pHead->version, vgId, TMSG_INFO(pHead->msgType)); + tqDebug("fetch meta msg, ver:%" PRId64 ", vgId:%d, type:%s, enable batch meta:%d", pHead->version, vgId, + TMSG_INFO(pHead->msgType), pRequest->enableBatchMeta); + if (!pRequest->enableBatchMeta) { + SMqMetaRsp metaRsp = {0}; + tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer + 1); + metaRsp.resMsgType = pHead->msgType; + metaRsp.metaRspLen = pHead->bodyLen; + metaRsp.metaRsp = pHead->body; + code = tqSendMetaPollRsp(pHandle, pMsg, pRequest, &metaRsp, vgId); + goto end; + } + if (!btMetaRsp.batchMetaReq) { btMetaRsp.batchMetaReq = taosArrayInit(4, POINTER_BYTES); btMetaRsp.batchMetaLen = taosArrayInit(4, sizeof(int32_t)); @@ -348,7 +364,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, } end: - + tDeleteMqBatchMetaRsp(&btMetaRsp); tDeleteSTaosxRsp(&taosxRsp); return code; } From 2cf657c76707bb5ca2920459cae3dd2fc81ab57b Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 28 May 2024 19:33:38 +0800 Subject: [PATCH 08/44] add ci --- utils/test/c/tmq_taosx_ci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index c1b312335f..51d134a463 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -33,6 +33,7 @@ typedef struct { int srcVgroups; int dstVgroups; char dir[256]; + bool btMeta; } Config; Config g_conf = {0}; @@ -600,6 +601,10 @@ tmq_t* build_consumer() { tmq_conf_set(conf, "experimental.snapshot.enable", "true"); } + if (g_conf.btMeta) { + tmq_conf_set(conf, "msg.enable.batchmeta", "true"); + } + tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); assert(tmq); @@ -1184,6 +1189,8 @@ int main(int argc, char* argv[]) { g_conf.subTable = true; } else if (strcmp(argv[i], "-onlymeta") == 0) { g_conf.meta = 1; + } else if (strcmp(argv[i], "-bt") == 0) { + g_conf.btMeta = true; } } From 7182e0948eb67a4d745a99bd270cff4cc6135aa9 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 29 May 2024 10:49:36 +0800 Subject: [PATCH 09/44] fix:[TD-30306]error in converity scan --- source/client/src/clientSml.c | 2 +- source/client/src/clientSmlTelnet.c | 2 +- source/client/src/clientTmq.c | 15 ++++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6225cf703c..6eb7abe0eb 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -939,7 +939,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SFieldWithOptions)); for (int32_t i = 0; i < pReq.numOfColumns; ++i) { SField *pField = taosArrayGet(pColumns, i); - SFieldWithOptions fieldWithOption; + SFieldWithOptions fieldWithOption = {0}; setFieldWithOptions(&fieldWithOption, pField); setDefaultOptionsForField(&fieldWithOption); taosArrayPush(pReq.pColumns, &fieldWithOption); diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index f715f32556..bc0e560178 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -233,7 +233,7 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine SSmlKv kvTs = {0}; smlBuildTsKv(&kvTs, ts); - if (needConverTime) { + if (needConverTime && info->currSTableMeta != NULL) { kvTs.i = convertTimePrecision(kvTs.i, TSDB_TIME_PRECISION_NANO, info->currSTableMeta->tableInfo.precision); } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 3141e21f26..0bc4214c09 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1344,6 +1344,12 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { goto FAIL; } + if(pMsg->pData == NULL){ + tscError("consumer:0x%" PRIx64 " msg discard from vgId:%d, since msg is NULL", tmq->consumerId, vgId); + code = TSDB_CODE_TSC_INTERNAL_ERROR; + goto FAIL; + } + SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { tscWarn("consumer:0x%" PRIx64 " msg discard from vgId:%d, since out of memory", tmq->consumerId, vgId); @@ -1356,11 +1362,6 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { goto END; } - if(pMsg->pData == NULL){ - tscError("consumer:0x%" PRIx64 " msg discard from vgId:%d, since msg is NULL", tmq->consumerId, vgId); - goto FAIL; - } - int32_t msgEpoch = ((SMqRspHead*)pMsg->pData)->epoch; int32_t clientEpoch = atomic_load_32(&tmq->epoch); if (msgEpoch < clientEpoch) { @@ -2809,8 +2810,6 @@ int64_t getCommittedFromServer(tmq_t* tmq, char* tname, int32_t vgId, SEpSet* ep int64_t transporterId = 0; code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, &transporterId, sendInfo); if (code != 0) { - taosMemoryFree(buf); - taosMemoryFree(sendInfo); tsem_destroy(&pParam->sem); taosMemoryFree(pParam); return code; @@ -3235,8 +3234,6 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_ int64_t transporterId = 0; code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); if (code != 0) { - taosMemoryFree(msg); - taosMemoryFree(sendInfo); tsem_destroy(&pParam->sem); taosMemoryFree(pParam); return code; From 444014f6ac0e88b9d4c04a5c5567e7cf8b819f20 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 29 May 2024 14:10:08 +0800 Subject: [PATCH 10/44] add ci --- tests/system-test/7-tmq/tmq_taosx.py | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index 94e9babf3c..39b9c6d34a 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -278,6 +278,19 @@ class TDTestCase: self.checkDropData(False) return + + def checkSnapshot1VgroupBtmeta(self): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -c %s -sv 1 -dv 1 -s -bt'%(buildPath, cfgPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkJson(cfgPath, "tmq_taosx_tmp_snapshot") + self.checkData() + self.checkDropData(False) + + return def checkSnapshot1VgroupTable(self): buildPath = tdCom.getBuildPath() @@ -290,6 +303,18 @@ class TDTestCase: self.checkDataTable() return + + def checkSnapshot1VgroupTableBtmeta(self): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -c %s -sv 1 -dv 1 -s -t -bt'%(buildPath, cfgPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkJson(cfgPath, "tmq_taosx_tmp_snapshot") + self.checkDataTable() + + return def checkSnapshotMultiVgroups(self): buildPath = tdCom.getBuildPath() @@ -301,6 +326,17 @@ class TDTestCase: self.checkDropData(False) return + + def checkSnapshotMultiVgroupsBtmeta(self): + buildPath = tdCom.getBuildPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -sv 2 -dv 4 -s -bt'%(buildPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkData() + self.checkDropData(False) + + return def checkSnapshotMultiVgroupsWithDropTable(self): buildPath = tdCom.getBuildPath() @@ -311,6 +347,16 @@ class TDTestCase: self.checkDropData(True) return + + def checkSnapshotMultiVgroupsWithDropTableBtmeta(self): + buildPath = tdCom.getBuildPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -sv 2 -dv 4 -s -d -bt'%(buildPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkDropData(True) + + return def consumeTest(self): tdSql.execute(f'create database if not exists d1 vgroups 1') @@ -472,6 +518,11 @@ class TDTestCase: self.checkSnapshotMultiVgroupsWithDropTable() + self.checkSnapshot1VgroupBtmeta() + self.checkSnapshot1VgroupTableBtmeta() + self.checkSnapshotMultiVgroupsBtmeta() + self.checkSnapshotMultiVgroupsWithDropTableBtmeta() + def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") From 1a6a0d31070d1143caccbe78a8c6eb279f9bb975 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 29 May 2024 16:04:37 +0800 Subject: [PATCH 11/44] fix:[TD-30323]tmq close error if consumer is cleared --- source/client/src/clientTmq.c | 5 ++++- source/dnode/mnode/impl/src/mndConsumer.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 3141e21f26..0446af3226 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1260,7 +1260,10 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { int32_t retryCnt = 0; while ((code = syncAskEp(tmq)) != 0) { if (retryCnt++ > MAX_RETRY_COUNT || code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) { - tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry more than 2 minutes", tmq->consumerId); + tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry more than 2 minutes, code:%s", tmq->consumerId, strerror(code)); + if(code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) { + code = 0; + } goto FAIL; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index c7ae941389..9278fbce11 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -662,6 +662,10 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { SMqConsumerObj *pConsumerNew = NULL; STrans *pTrans = NULL; + if(mndAcquireConsumer(pMnode, subscribe->consumerId) == NULL && taosArrayGetSize(subscribe->topicNames) == 0){ + goto _over; + } + code = checkAndSortTopic(pMnode, subscribe.topicNames); if(code != TSDB_CODE_SUCCESS){ goto _over; From 129d04a4495f1a01d390b2c8ee1e7192484a0ef1 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 29 May 2024 16:29:04 +0800 Subject: [PATCH 12/44] adj tmq param --- source/dnode/vnode/src/tq/tqUtil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 496201e79e..33e3414a7d 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -283,7 +283,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, tqDebug("fetch meta msg, ver:%" PRId64 ", vgId:%d, type:%s, enable batch meta:%d", pHead->version, vgId, TMSG_INFO(pHead->msgType), pRequest->enableBatchMeta); - if (!pRequest->enableBatchMeta) { + if (!pRequest->enableBatchMeta && !pRequest->useSnapshot) { SMqMetaRsp metaRsp = {0}; tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer + 1); metaRsp.resMsgType = pHead->msgType; From d28abdf837b4407ed184db538df33517da87dc07 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 30 May 2024 16:11:53 +0800 Subject: [PATCH 13/44] fix coverity scan problem --- include/util/tbuffer.inc | 2 +- include/util/tutil.h | 2 +- source/dnode/vnode/src/tsdb/tsdbCommit2.c | 22 ++++++------ source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c | 10 +++--- source/dnode/vnode/src/tsdb/tsdbFile2.c | 2 +- source/dnode/vnode/src/tsdb/tsdbMerge.c | 17 +++++---- source/dnode/vnode/src/tsdb/tsdbSnapInfo.c | 4 +-- source/dnode/vnode/src/tsdb/tsdbSnapshot.c | 35 ++++++++++--------- source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c | 3 +- source/dnode/vnode/src/tsdb/tsdbSttFileRW.c | 2 +- source/dnode/vnode/src/tsdb/tsdbUtil2.c | 6 ++-- 11 files changed, 58 insertions(+), 47 deletions(-) diff --git a/include/util/tbuffer.inc b/include/util/tbuffer.inc index f0137ee978..2c1405d6c5 100644 --- a/include/util/tbuffer.inc +++ b/include/util/tbuffer.inc @@ -177,7 +177,7 @@ static int32_t tBufferReaderInit(SBufferReader *reader, uint32_t offset, SBuffer } static FORCE_INLINE int32_t tBufferGet(SBufferReader *reader, uint32_t size, void *data) { - if (reader->offset < 0 || reader->offset + size > reader->buffer->size) { + if (reader->offset + size > reader->buffer->size) { return TSDB_CODE_OUT_OF_RANGE; } if (data) { diff --git a/include/util/tutil.h b/include/util/tutil.h index 54ce6fc849..c049949590 100644 --- a/include/util/tutil.h +++ b/include/util/tutil.h @@ -119,7 +119,7 @@ static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen, #define TSDB_CHECK_CODE(CODE, LINO, LABEL) \ do { \ - if ((CODE)) { \ + if (TSDB_CODE_SUCCESS != (CODE)) { \ LINO = __LINE__; \ goto LABEL; \ } \ diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index f6082e60e3..183b639550 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -212,6 +212,11 @@ _exit: return code; } +static int32_t tsdbCommitCloseReader(SCommitter2 *committer) { + TARRAY2_CLEAR(committer->sttReaderArray, tsdbSttFileReaderClose); + return 0; +} + static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { int32_t code = 0; int32_t lino = 0; @@ -256,13 +261,17 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { _exit: if (code) { + tsdbCommitCloseReader(committer); TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, code); } return code; } -static int32_t tsdbCommitCloseReader(SCommitter2 *committer) { - TARRAY2_CLEAR(committer->sttReaderArray, tsdbSttFileReaderClose); +static int32_t tsdbCommitCloseIter(SCommitter2 *committer) { + tsdbIterMergerClose(&committer->tombIterMerger); + tsdbIterMergerClose(&committer->dataIterMerger); + TARRAY2_CLEAR(committer->tombIterArray, tsdbIterClose); + TARRAY2_CLEAR(committer->dataIterArray, tsdbIterClose); return 0; } @@ -336,19 +345,12 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { _exit: if (code) { + tsdbCommitCloseIter(committer); TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, code); } return code; } -static int32_t tsdbCommitCloseIter(SCommitter2 *committer) { - tsdbIterMergerClose(&committer->tombIterMerger); - tsdbIterMergerClose(&committer->dataIterMerger); - TARRAY2_CLEAR(committer->tombIterArray, tsdbIterClose); - TARRAY2_CLEAR(committer->dataIterArray, tsdbIterClose); - return 0; -} - static int32_t tsdbCommitFileSetBegin(SCommitter2 *committer) { int32_t code = 0; int32_t lino = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c index acacf98f84..107677ce1e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c @@ -74,7 +74,7 @@ int32_t tsdbDataFileRAWReadBlockData(SDataFileRAWReader *reader, STsdbDataRAWBlo pBlock->file.stt->level = reader->config->file.stt->level; int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; - char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + char *encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbReadFile(reader->fd, pBlock->offset, pBlock->data, pBlock->dataLength, 0, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); @@ -130,7 +130,7 @@ static int32_t tsdbDataFileRAWWriterCloseCommit(SDataFileRAWWriter *writer, TFil TSDB_CHECK_CODE(code, lino, _exit); int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; - char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + char *encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; if (writer->fd) { code = tsdbFsyncFile(writer->fd, encryptAlgorithm, encryptKey); @@ -211,13 +211,13 @@ _exit: return code; } -int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *pDataBlock, - int32_t encryptAlgorithm, char* encryptKey) { +int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *pDataBlock, + int32_t encryptAlgorithm, char *encryptKey) { int32_t code = 0; int32_t lino = 0; code = tsdbWriteFile(writer->fd, writer->ctx->offset, (const uint8_t *)pDataBlock->data, pDataBlock->dataLength, - encryptAlgorithm, encryptKey); + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->ctx->offset += pDataBlock->dataLength; diff --git a/source/dnode/vnode/src/tsdb/tsdbFile2.c b/source/dnode/vnode/src/tsdb/tsdbFile2.c index cde74f5e36..7d8b0a6c8b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile2.c @@ -44,7 +44,7 @@ static const struct { }; void remove_file(const char *fname) { - taosRemoveFile(fname); + (void)taosRemoveFile(fname); tsdbInfo("file:%s is removed", fname); } diff --git a/source/dnode/vnode/src/tsdb/tsdbMerge.c b/source/dnode/vnode/src/tsdb/tsdbMerge.c index 022698b0eb..f2d4ab2cb2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMerge.c +++ b/source/dnode/vnode/src/tsdb/tsdbMerge.c @@ -90,6 +90,11 @@ _exit: return code; } +static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) { + TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFileReaderClose); + return 0; +} + static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { int32_t code = 0; int32_t lino = 0; @@ -220,8 +225,10 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { code = tsdbSttFileReaderOpen(fobj->fname, &config, &reader); TSDB_CHECK_CODE(code, lino, _exit); - code = TARRAY2_APPEND(merger->sttReaderArr, reader); - TSDB_CHECK_CODE(code, lino, _exit); + if ((code = TARRAY2_APPEND(merger->sttReaderArr, reader))) { + tsdbSttFileReaderClose(&reader); + TSDB_CHECK_CODE(code, lino, _exit); + } } } @@ -232,6 +239,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { _exit: if (code) { + tsdbMergeFileSetEndCloseReader(merger); TSDB_ERROR_LOG(TD_VID(merger->tsdb->pVnode), lino, code); } return code; @@ -375,11 +383,6 @@ static int32_t tsdbMergeFileSetEndCloseIter(SMerger *merger) { return 0; } -static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) { - TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFileReaderClose); - return 0; -} - static int32_t tsdbMergeFileSetEnd(SMerger *merger) { int32_t code = 0; int32_t lino = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c b/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c index 9dae9bdd36..bc7bf5449e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c @@ -321,10 +321,10 @@ int32_t tDeserializeTsdbFSetPartList(void* buf, int32_t bufLen, STsdbFSetPartLis if (tDecodeI64(&decoder, &r.minVer) < 0) goto _err; if (tDecodeI64(&decoder, &r.maxVer) < 0) goto _err; if (tDecodeI64(&decoder, &reserved64) < 0) goto _err; - TARRAY2_APPEND(iList, r); + if (TARRAY2_APPEND(iList, r)) goto _err; } } - TARRAY2_APPEND(pList, p); + if (TARRAY2_APPEND(pList, p)) goto _err; p = NULL; } diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 0d36f9648b..df89746c31 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -57,6 +57,20 @@ struct STsdbSnapReader { STombBlock tombBlock[1]; }; +static int32_t tsdbSnapReadFileSetCloseReader(STsdbSnapReader* reader) { + int32_t code = 0; + int32_t lino = 0; + + TARRAY2_CLEAR(reader->sttReaderArr, tsdbSttFileReaderClose); + tsdbDataFileReaderClose(&reader->dataReader); + +_exit: + if (code) { + TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); + } + return code; +} + static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) { int32_t code = 0; int32_t lino = 0; @@ -100,27 +114,16 @@ static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) { code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader); TSDB_CHECK_CODE(code, lino, _exit); - code = TARRAY2_APPEND(reader->sttReaderArr, sttReader); - TSDB_CHECK_CODE(code, lino, _exit); + if ((code = TARRAY2_APPEND(reader->sttReaderArr, sttReader))) { + tsdbSttFileReaderClose(&sttReader); + TSDB_CHECK_CODE(code, lino, _exit); + } } } _exit: if (code) { - TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); - } - return code; -} - -static int32_t tsdbSnapReadFileSetCloseReader(STsdbSnapReader* reader) { - int32_t code = 0; - int32_t lino = 0; - - TARRAY2_CLEAR(reader->sttReaderArr, tsdbSttFileReaderClose); - tsdbDataFileReaderClose(&reader->dataReader); - -_exit: - if (code) { + tsdbSnapReadFileSetCloseReader(reader); TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); } return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c b/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c index ab0575cb53..e4f48745e7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c @@ -141,6 +141,7 @@ static int32_t tsdbSnapRAWReadFileSetOpenReader(STsdbSnapRAWReader* reader) { _exit: if (code) { + tsdbSnapRAWReadFileSetCloseReader(reader); TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); } return code; @@ -546,7 +547,7 @@ static int32_t tsdbSnapRAWWriteTimeSeriesData(STsdbSnapRAWWriter* writer, STsdbD int32_t lino = 0; int32_t encryptAlgorithm = writer->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; - char* encryptKey = writer->tsdb->pVnode->config.tsdbCfg.encryptKey; + char* encryptKey = writer->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbFSetRAWWriteBlockData(writer->ctx->fsetWriter, bHdr, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c index 478778319d..f1a087e3c1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c @@ -896,7 +896,7 @@ static int32_t tsdbSttFWriterCloseAbort(SSttFileWriter *writer) { char fname[TSDB_FILENAME_LEN]; tsdbTFileName(writer->config->tsdb, writer->file, fname); tsdbCloseFile(&writer->fd); - taosRemoveFile(fname); + (void)taosRemoveFile(fname); return 0; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil2.c b/source/dnode/vnode/src/tsdb/tsdbUtil2.c index 6df0528f1c..9b88500ad1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil2.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil2.c @@ -56,7 +56,8 @@ int32_t tTombBlockGet(STombBlock *tombBlock, int32_t idx, STombRecord *record) { for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) { SBufferReader br = BUFFER_READER_INITIALIZER(sizeof(int64_t) * idx, &tombBlock->buffers[i]); - tBufferGetI64(&br, &record->data[i]); + int32_t code = tBufferGetI64(&br, &record->data[i]); + if (code) return code; } return 0; } @@ -182,7 +183,8 @@ int32_t tStatisBlockPut(STbStatisBlock *block, SRowInfo *row, int32_t maxRecords if (block->numOfRecords > 0) { int64_t lastUid; SBufferReader br = BUFFER_READER_INITIALIZER(sizeof(int64_t) * (block->numOfRecords - 1), &block->uids); - tBufferGetI64(&br, &lastUid); + int32_t code = tBufferGetI64(&br, &lastUid); + if (code) return code; if (lastUid == row->uid) { return tStatisBlockUpdate(block, row); From b9d8f63e859c4c238c5cbe79438f6026d981a3f8 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 30 May 2024 16:28:51 +0800 Subject: [PATCH 14/44] fix: memory leak --- source/common/src/tmsg.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index ef37a41fcf..de24e7047b 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5616,18 +5616,35 @@ int32_t tSerializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq * } int32_t tDeserializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq *pReq) { + int32_t code = 0; SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + if (tStartDecode(&decoder) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } - if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->compactId) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } + if (tDecodeI32(&decoder, &pReq->vgId) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } + + if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeConfigReq *pReq) { From 1821f9aae402577dda7891a3132dc29a89320343 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 30 May 2024 16:29:31 +0800 Subject: [PATCH 15/44] format --- source/common/src/tmsg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index de24e7047b..c6cf5d1037 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5630,6 +5630,7 @@ int32_t tDeserializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq code = TSDB_CODE_MSG_DECODE_ERROR; goto _exit; } + if (tDecodeI32(&decoder, &pReq->vgId) < 0) { code = TSDB_CODE_MSG_DECODE_ERROR; goto _exit; From c6407277dc27e92dee64af1abb6524d482991b23 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Thu, 30 May 2024 11:41:22 +0000 Subject: [PATCH 16/44] support add column compress --- include/common/tmsg.h | 77 ++++++++++----------- source/common/src/tmsg.c | 61 ++++++++++++++--- source/dnode/mnode/impl/src/mndStb.c | 76 ++++++++++++++------- source/dnode/vnode/src/meta/metaTable.c | 20 ++++-- source/libs/parser/inc/parAst.h | 90 ++++++++++++++----------- source/libs/parser/inc/sql.y | 2 +- source/libs/parser/src/parAstCreater.c | 29 ++++++-- source/libs/parser/src/parTranslater.c | 62 +++++++++++++---- 8 files changed, 282 insertions(+), 135 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index be2f443140..3c8f2be059 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -158,19 +158,20 @@ typedef enum _mgmt_table { TSDB_MGMT_TABLE_MAX, } EShowType; -#define TSDB_ALTER_TABLE_ADD_TAG 1 -#define TSDB_ALTER_TABLE_DROP_TAG 2 -#define TSDB_ALTER_TABLE_UPDATE_TAG_NAME 3 -#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4 -#define TSDB_ALTER_TABLE_ADD_COLUMN 5 -#define TSDB_ALTER_TABLE_DROP_COLUMN 6 -#define TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES 7 -#define TSDB_ALTER_TABLE_UPDATE_TAG_BYTES 8 -#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9 -#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10 -#define TSDB_ALTER_TABLE_ADD_TAG_INDEX 11 -#define TSDB_ALTER_TABLE_DROP_TAG_INDEX 12 -#define TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS 13 +#define TSDB_ALTER_TABLE_ADD_TAG 1 +#define TSDB_ALTER_TABLE_DROP_TAG 2 +#define TSDB_ALTER_TABLE_UPDATE_TAG_NAME 3 +#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4 +#define TSDB_ALTER_TABLE_ADD_COLUMN 5 +#define TSDB_ALTER_TABLE_DROP_COLUMN 6 +#define TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES 7 +#define TSDB_ALTER_TABLE_UPDATE_TAG_BYTES 8 +#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9 +#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10 +#define TSDB_ALTER_TABLE_ADD_TAG_INDEX 11 +#define TSDB_ALTER_TABLE_DROP_TAG_INDEX 12 +#define TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS 13 +#define TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION 14 #define TSDB_FILL_NONE 0 #define TSDB_FILL_NULL 1 @@ -2313,10 +2314,10 @@ int32_t tDeserializeSVArbHeartBeatRsp(void* buf, int32_t bufLen, SVArbHeartBeatR void tFreeSVArbHeartBeatRsp(SVArbHeartBeatRsp* pRsp); typedef struct { - char* arbToken; + char* arbToken; int64_t arbTerm; - char* member0Token; - char* member1Token; + char* member0Token; + char* member1Token; } SVArbCheckSyncReq; int32_t tSerializeSVArbCheckSyncReq(void* buf, int32_t bufLen, SVArbCheckSyncReq* pReq); @@ -2336,9 +2337,9 @@ int32_t tDeserializeSVArbCheckSyncRsp(void* buf, int32_t bufLen, SVArbCheckSyncR void tFreeSVArbCheckSyncRsp(SVArbCheckSyncRsp* pRsp); typedef struct { - char* arbToken; - int64_t arbTerm; - char* memberToken; + char* arbToken; + int64_t arbTerm; + char* memberToken; } SVArbSetAssignedLeaderReq; int32_t tSerializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq); @@ -2700,8 +2701,8 @@ typedef struct { int64_t lastTs; SArray* pVgroupVerList; // 3.3.0.0 - SArray* pCols; // array of SField - int64_t smaId; + SArray* pCols; // array of SField + int64_t smaId; } SCMCreateStreamReq; typedef struct { @@ -3569,7 +3570,7 @@ static FORCE_INLINE void tqOffsetResetToData(STqOffsetVal* pOffsetVal, int64_t u pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_DATA; pOffsetVal->uid = uid; pOffsetVal->ts = ts; - if(IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)){ + if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) { taosMemoryFree(pOffsetVal->primaryKey.pData); } pOffsetVal->primaryKey = primaryKey; @@ -3669,10 +3670,10 @@ typedef struct { char* ast; int64_t deleteMark; int64_t lastTs; - int64_t normSourceTbUid; // the Uid of source tb if its a normal table, otherwise 0 + int64_t normSourceTbUid; // the Uid of source tb if its a normal table, otherwise 0 SArray* pVgroupVerList; int8_t recursiveTsma; - char baseTsmaName[TSDB_TABLE_FNAME_LEN]; // base tsma name for recursively created tsma + char baseTsmaName[TSDB_TABLE_FNAME_LEN]; // base tsma name for recursively created tsma } SMCreateSmaReq; int32_t tSerializeSMCreateSmaReq(void* buf, int32_t bufLen, SMCreateSmaReq* pReq); @@ -3901,7 +3902,7 @@ typedef struct { int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq); int32_t tDeserializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq); -void tDestroySMqPollReq(SMqPollReq *pReq); +void tDestroySMqPollReq(SMqPollReq* pReq); typedef struct { int32_t vgId; @@ -3945,7 +3946,7 @@ typedef struct { int32_t tEncodeMqMetaRsp(SEncoder* pEncoder, const SMqMetaRsp* pRsp); int32_t tDecodeMqMetaRsp(SDecoder* pDecoder, SMqMetaRsp* pRsp); -void tDeleteMqMetaRsp(SMqMetaRsp *pRsp); +void tDeleteMqMetaRsp(SMqMetaRsp* pRsp); #define MQ_DATA_RSP_VERSION 100 @@ -4292,9 +4293,9 @@ int32_t tSerializeSViewMetaRsp(void* buf, int32_t bufLen, const SViewMetaRsp* pR int32_t tDeserializeSViewMetaRsp(void* buf, int32_t bufLen, SViewMetaRsp* pRsp); void tFreeSViewMetaRsp(SViewMetaRsp* pRsp); typedef struct { - char name[TSDB_TABLE_FNAME_LEN]; // table name or tsma name - bool fetchingWithTsmaName; // if we are fetching with tsma name -}STableTSMAInfoReq; + char name[TSDB_TABLE_FNAME_LEN]; // table name or tsma name + bool fetchingWithTsmaName; // if we are fetching with tsma name +} STableTSMAInfoReq; int32_t tSerializeTableTSMAInfoReq(void* buf, int32_t bufLen, const STableTSMAInfoReq* pReq); int32_t tDeserializeTableTSMAInfoReq(void* buf, int32_t bufLen, STableTSMAInfoReq* pReq); @@ -4317,15 +4318,15 @@ typedef struct { int32_t version; int64_t interval; int8_t unit; - SArray* pFuncs; // SArray - SArray* pTags; // SArray - SArray* pUsedCols; // SArray + SArray* pFuncs; // SArray + SArray* pTags; // SArray + SArray* pUsedCols; // SArray char* ast; int64_t streamUid; int64_t reqTs; int64_t rspTs; - int64_t delayDuration; // ms + int64_t delayDuration; // ms bool fillHistoryFinished; } STableTSMAInfo; @@ -4336,10 +4337,10 @@ void tFreeTableTSMAInfo(void* p); void tFreeAndClearTableTSMAInfo(void* p); void tFreeTableTSMAInfoRsp(STableTSMAInfoRsp* pRsp); -#define STSMAHbRsp STableTSMAInfoRsp -#define tSerializeTSMAHbRsp tSerializeTableTSMAInfoRsp +#define STSMAHbRsp STableTSMAInfoRsp +#define tSerializeTSMAHbRsp tSerializeTableTSMAInfoRsp #define tDeserializeTSMAHbRsp tDeserializeTableTSMAInfoRsp -#define tFreeTSMAHbRsp tFreeTableTSMAInfoRsp +#define tFreeTSMAHbRsp tFreeTableTSMAInfoRsp typedef struct SStreamProgressReq { int64_t streamId; @@ -4365,7 +4366,7 @@ int32_t tDeserializeSStreamProgressRsp(void* buf, int32_t bufLen, SStreamProgres typedef struct SDropCtbWithTsmaSingleVgReq { SVgroupInfo vgInfo; - SArray* pTbs; // SVDropTbReq + SArray* pTbs; // SVDropTbReq } SMDropTbReqsOnSingleVg; int32_t tEncodeSMDropTbReqOnSingleVg(SEncoder* pEncoder, const SMDropTbReqsOnSingleVg* pReq); @@ -4373,7 +4374,7 @@ int32_t tDecodeSMDropTbReqOnSingleVg(SDecoder* pDecoder, SMDropTbReqsOnSingleVg* void tFreeSMDropTbReqOnSingleVg(void* p); typedef struct SDropTbsReq { - SArray* pVgReqs; // SMDropTbReqsOnSingleVg + SArray* pVgReqs; // SMDropTbReqsOnSingleVg } SMDropTbsReq; int32_t tSerializeSMDropTbsReq(void* buf, int32_t bufLen, const SMDropTbsReq* pReq); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index ef37a41fcf..624866e396 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -768,11 +768,22 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq) if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; if (tEncodeI8(&encoder, pReq->alterType) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfFields) < 0) return -1; + + // if (pReq->alterType == ) for (int32_t i = 0; i < pReq->numOfFields; ++i) { - SField *pField = taosArrayGet(pReq->pFields, i); - if (tEncodeI8(&encoder, pField->type) < 0) return -1; - if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; - if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { + SFieldWithOptions *pField = taosArrayGet(pReq->pFields, i); + if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; + if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + if (tEncodeU32(&encoder, pField->compress) < 0) return -1; + + } else { + SField *pField = taosArrayGet(pReq->pFields, i); + if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; + if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + } } if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1; if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1; @@ -802,13 +813,28 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq } for (int32_t i = 0; i < pReq->numOfFields; ++i) { - SField field = {0}; - if (tDecodeI8(&decoder, &field.type) < 0) return -1; - if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (taosArrayPush(pReq->pFields, &field) == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; + if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { + + taosArrayDestroy(pReq->pFields); + pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SFieldWithOptions)); + SFieldWithOptions field = {0}; + if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; + if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + if (tDecodeU32(&decoder, &field.compress) < 0) return -1; + if (taosArrayPush(pReq->pFields, &field) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } else { + SField field = {0}; + if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; + if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + if (taosArrayPush(pReq->pFields, &field) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } } } @@ -8740,6 +8766,13 @@ int32_t tEncodeSVAlterTbReq(SEncoder *pEncoder, const SVAlterTbReq *pReq) { if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1; if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1; break; + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: + if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1; + if (tEncodeI8(pEncoder, pReq->type) < 0) return -1; + if (tEncodeI8(pEncoder, pReq->flags) < 0) return -1; + if (tEncodeI32v(pEncoder, pReq->bytes) < 0) return -1; + if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1; + break; default: break; } @@ -8795,6 +8828,12 @@ static int32_t tDecodeSVAlterTbReqCommon(SDecoder *pDecoder, SVAlterTbReq *pReq) if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1; if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1; break; + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: + if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1; + if (tDecodeI8(pDecoder, &pReq->type) < 0) return -1; + if (tDecodeI8(pDecoder, &pReq->flags) < 0) return -1; + if (tDecodeI32v(pDecoder, &pReq->bytes) < 0) return -1; + if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1; default: break; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 61fc180dc6..1ac9200357 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1779,7 +1779,8 @@ static int32_t mndUpdateSuperTableColumnCompress(SMnode *pMnode, const SStbObj * return 0; } -static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray *pFields, int32_t ncols) { +static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray *pFields, int32_t ncols, + int8_t withCompress) { if (pOld->numOfColumns + ncols + pOld->numOfTags > TSDB_MAX_COLUMNS) { terrno = TSDB_CODE_MND_TOO_MANY_COLUMNS; return -1; @@ -1806,29 +1807,53 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray } for (int32_t i = 0; i < ncols; i++) { - SField *pField = taosArrayGet(pFields, i); - if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) { - terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST; - return -1; + if (withCompress) { + SFieldWithOptions *pField = taosArrayGet(pFields, i); + if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST; + return -1; + } + + if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST; + return -1; + } + + SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i]; + pSchema->bytes = pField->bytes; + pSchema->type = pField->type; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + pSchema->colId = pNew->nextColId; + pNew->nextColId++; + + SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i]; + pCmpr->id = pSchema->colId; + pCmpr->alg = createDefaultColCmprByType(pSchema->type); + mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name); + } else { + SField *pField = taosArrayGet(pFields, i); + if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST; + return -1; + } + + if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST; + return -1; + } + + SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i]; + pSchema->bytes = pField->bytes; + pSchema->type = pField->type; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + pSchema->colId = pNew->nextColId; + pNew->nextColId++; + + SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i]; + pCmpr->id = pSchema->colId; + pCmpr->alg = createDefaultColCmprByType(pSchema->type); + mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name); } - - if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) { - terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST; - return -1; - } - - SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i]; - pSchema->bytes = pField->bytes; - pSchema->type = pField->type; - memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - pSchema->colId = pNew->nextColId; - pNew->nextColId++; - - SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i]; - pCmpr->id = pSchema->colId; - pCmpr->alg = createDefaultColCmprByType(pSchema->type); - - mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name); } pNew->colVer++; @@ -2461,7 +2486,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p code = mndAlterStbTagBytes(pMnode, pOld, &stbObj, pField0); break; case TSDB_ALTER_TABLE_ADD_COLUMN: - code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields); + code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields, 0); break; case TSDB_ALTER_TABLE_DROP_COLUMN: pField0 = taosArrayGet(pAlter->pFields, 0); @@ -2478,6 +2503,9 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS: code = mndUpdateSuperTableColumnCompress(pMnode, pOld, &stbObj, pAlter->pFields, pAlter->numOfFields); break; + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: + code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields, 1); + break; default: needRsp = false; terrno = TSDB_CODE_OPS_NOT_SUPPORT; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index df54591ae8..e8ce39f9fb 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -1491,6 +1491,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl SSchema tScheam; switch (pAlterTbReq->action) { case TSDB_ALTER_TABLE_ADD_COLUMN: + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: if (pColumn) { terrno = TSDB_CODE_VND_COL_ALREADY_EXISTS; goto _err; @@ -1522,10 +1523,21 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl (void)tsdbCacheNewNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type); } SSchema *pCol = &pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1]; - updataTableColCmpr(&entry.colCmpr, pCol, 1); - freeColCmpr = true; - ASSERT(entry.colCmpr.nCols == pSchema->nCols); - break; + if (pAlterTbReq->action == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { + + // if (pAlterTbReq->colCmpr.nCols != pSchema->nCols) { + // terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION; + // goto _err; + // } + // updataTableColCmpr(&entry.colCmpr, pCol, 1); + // freeColCmpr = true; + // ASSERT(entry.colCmpr.nCols == pSchema->nCols); + } else { + updataTableColCmpr(&entry.colCmpr, pCol, 1); + freeColCmpr = true; + ASSERT(entry.colCmpr.nCols == pSchema->nCols); + break; + } case TSDB_ALTER_TABLE_DROP_COLUMN: if (pColumn == NULL) { terrno = TSDB_CODE_VND_COL_NOT_EXISTS; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index e8596c4d19..90c3753ed0 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -118,44 +118,46 @@ SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode); SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode); SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode); -SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName); -SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); -SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pNode); -SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pLeft, SNode *pRight); +SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName); +SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); +SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pNode); +SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pLeft, + SNode* pRight); SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral); -SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt); -SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias); -SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2); -SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight); -SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); -SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); -SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList); -SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt); -SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList); -SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2); -SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias); -SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias); -SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, SNode* pJoinCond); -SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName); -SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset); -SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder); -SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap); -SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr); -SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond); -SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken); -SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding, - SNode* pFill); -SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset); -SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues); -SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode); -SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd); -SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint); -SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen); -SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse); +SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral); +SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); +SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); +SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt); +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); +SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias); +SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2); +SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight); +SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); +SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); +SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList); +SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt); +SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList); +SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2); +SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias); +SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias); +SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, + SNode* pJoinCond); +SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName); +SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset); +SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder); +SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap); +SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr); +SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond); +SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken); +SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding, + SNode* pFill); +SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset); +SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues); +SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode); +SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd); +SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint); +SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen); +SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse); SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere); SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList); @@ -170,7 +172,8 @@ SNode* addEveryClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pEvery); SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill); SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit); SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinOffset); -SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, SNodeList* pHint); +SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, + SNodeList* pHint); SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags); SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight); @@ -205,8 +208,12 @@ SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, S SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions); SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, SDataType dataType); -SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, - SNode* pOptions); + +SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, + SToken* pColName, SDataType dataType, SNode* pOptions); + +SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, + SToken* pColName, SNode* pOptions); SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName); SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName, SToken* pNewColName); @@ -217,7 +224,8 @@ SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind); SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type); SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName, EOperatorType tableCondType); -SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType); +SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, + EOperatorType tableCondType); SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type); SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 60e33c6f33..a5efdbdf91 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -353,7 +353,7 @@ cmd ::= ALTER STABLE alter_table_clause(A). alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); } alter_table_clause(A) ::= - full_table_name(B) ADD COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D); } + full_table_name(B) ADD COLUMN column_name(C) type_name(D) column_options(E). { A = createAlterTableAddModifyColOptions2(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D, E); } alter_table_clause(A) ::= full_table_name(B) DROP COLUMN column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_COLUMN, &C); } alter_table_clause(A) ::= full_table_name(B) MODIFY COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &C, D); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 5399aa7f09..86ce93d920 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -176,7 +176,8 @@ static bool checkDbName(SAstCreateContext* pCxt, SToken* pDbName, bool demandDb) static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) { trimEscape(pTableName); - if (NULL != pTableName && pTableName->type != TK_NK_NIL && (pTableName->n >= TSDB_TABLE_NAME_LEN || pTableName->n == 0)) { + if (NULL != pTableName && pTableName->type != TK_NK_NIL && + (pTableName->n >= TSDB_TABLE_NAME_LEN || pTableName->n == 0)) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pTableName->z); return false; } @@ -185,7 +186,8 @@ static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) { static bool checkColumnName(SAstCreateContext* pCxt, SToken* pColumnName) { trimEscape(pColumnName); - if (NULL != pColumnName && pColumnName->type != TK_NK_NIL && (pColumnName->n >= TSDB_COL_NAME_LEN || pColumnName->n == 0)) { + if (NULL != pColumnName && pColumnName->type != TK_NK_NIL && + (pColumnName->n >= TSDB_COL_NAME_LEN || pColumnName->n == 0)) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pColumnName->z); return false; } @@ -1893,6 +1895,24 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, pStmt->dataType = dataType; return createAlterTableStmtFinalize(pRealTable, pStmt); } +SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, + SToken* pColName, SDataType dataType, SNode* pOptions) { + CHECK_PARSER_STATUS(pCxt); + if (!checkColumnName(pCxt, pColName)) { + return NULL; + } + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); + CHECK_OUT_OF_MEM(pStmt); + pStmt->alterType = alterType; + COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); + pStmt->dataType = dataType; + + if (pOptions != NULL) { + pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; + } + pStmt->pColOptions = (SColumnOptions*)pOptions; + return createAlterTableStmtFinalize(pRealTable, pStmt); +} SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, SNode* pOptions) { @@ -2816,9 +2836,10 @@ SNode* createBalanceVgroupLeaderStmt(SAstCreateContext* pCxt, const SToken* pVgI return (SNode*)pStmt; } -SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken* pDbName){ +SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); - SBalanceVgroupLeaderStmt* pStmt = (SBalanceVgroupLeaderStmt*)nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_LEADER_DATABASE_STMT); + SBalanceVgroupLeaderStmt* pStmt = + (SBalanceVgroupLeaderStmt*)nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_LEADER_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); if (NULL != pDbName) { COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c9a05a348c..938c6aae9a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1003,7 +1003,7 @@ static bool isBlockTimeLineAlignedQuery(SNode* pStmt) { SNodeList* buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum) { SNodeList* pPartitionList = NULL; - SNode* pNode = NULL; + SNode* pNode = NULL; if (pOrderList->length <= nodesNum) { return NULL; } @@ -1023,7 +1023,6 @@ SNodeList* buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesN return pPartitionList; } - static bool isTimeLineAlignedQuery(SNode* pStmt) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; if (!isTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { @@ -1036,7 +1035,8 @@ static bool isTimeLineAlignedQuery(SNode* pStmt) { return true; } if (pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) { - SNodeList* pPartitionList = buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); + SNodeList* pPartitionList = + buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList); nodesDestroyList(pPartitionList); @@ -1049,7 +1049,8 @@ static bool isTimeLineAlignedQuery(SNode* pStmt) { if (QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery; if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) { - SNodeList* pPartitionList = buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); + SNodeList* pPartitionList = + buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList); nodesDestroyList(pPartitionList); @@ -6083,7 +6084,7 @@ static void resetResultTimeline(SSelectStmt* pSelect) { } } } - + pSelect->timeLineResMode = TIME_LINE_NONE; } @@ -6237,8 +6238,8 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS } snprintf(pRightExpr->aliasName, sizeof(pRightExpr->aliasName), "%s", pLeftExpr->aliasName); SNode* pProj = createSetOperProject(pSetOperator->stmtName, pLeft); - bool isLeftPrimTs = isPrimaryKeyImpl(pLeft); - bool isRightPrimTs = isPrimaryKeyImpl(pRight); + bool isLeftPrimTs = isPrimaryKeyImpl(pLeft); + bool isRightPrimTs = isPrimaryKeyImpl(pRight); if (isLeftPrimTs && isRightPrimTs) { SColumnNode* pFCol = (SColumnNode*)pProj; @@ -6288,9 +6289,9 @@ static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pS pSetOperator->timeLineFromOrderBy = true; return code; } - } + } } - + pSetOperator->timeLineResMode = TIME_LINE_NONE; } return code; @@ -8156,9 +8157,9 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* } switch (pStmt->alterType) { + case TSDB_ALTER_TABLE_ADD_COLUMN: case TSDB_ALTER_TABLE_ADD_TAG: case TSDB_ALTER_TABLE_DROP_TAG: - case TSDB_ALTER_TABLE_ADD_COLUMN: case TSDB_ALTER_TABLE_DROP_COLUMN: case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: case TSDB_ALTER_TABLE_UPDATE_TAG_BYTES: { @@ -8193,6 +8194,28 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* taosArrayPush(pAlterReq->pFields, &field); break; } + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { + taosArrayDestroy(pAlterReq->pFields); + + pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions)); + SFieldWithOptions field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)}; + // TAOS_FIELD field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)}; + strcpy(field.name, pStmt->colName); + if (pStmt->pColOptions != NULL) { + if (!checkColumnEncode(pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; + if (!checkColumnCompress(pStmt->pColOptions->compress)) return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; + if (!checkColumnLevel(pStmt->pColOptions->compressLevel)) return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; + int32_t code = setColCompressByOption(pStmt->dataType.type, columnEncodeVal(pStmt->pColOptions->encode), + columnCompressVal(pStmt->pColOptions->compress), + columnLevelVal(pStmt->pColOptions->compressLevel), false, + (uint32_t*)&field.compress); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + taosArrayPush(pAlterReq->pFields, &field); + break; + } default: break; } @@ -10642,7 +10665,7 @@ static int32_t translateBalanceVgroup(STranslateContext* pCxt, SBalanceVgroupStm static int32_t translateBalanceVgroupLeader(STranslateContext* pCxt, SBalanceVgroupLeaderStmt* pStmt) { SBalanceVgroupLeaderReq req = {0}; req.vgId = pStmt->vgId; - if(pStmt->dbName != NULL) strcpy(req.db, pStmt->dbName); + if (pStmt->dbName != NULL) strcpy(req.db, pStmt->dbName); int32_t code = buildCmdMsg(pCxt, TDMT_MND_BALANCE_VGROUP_LEADER, (FSerializeFunc)tSerializeSBalanceVgroupLeaderReq, &req); tFreeSBalanceVgroupLeaderReq(&req); @@ -11057,7 +11080,8 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm } if (TSDB_CODE_SUCCESS == code) { - pReq->deleteMark = convertTimePrecision(tsmaDataDeleteMark, TSDB_TIME_PRECISION_MILLI, pTableMeta->tableInfo.precision); + pReq->deleteMark = + convertTimePrecision(tsmaDataDeleteMark, TSDB_TIME_PRECISION_MILLI, pTableMeta->tableInfo.precision); code = getSmaIndexSql(pCxt, &pReq->sql, &pReq->sqlLen); } @@ -12857,6 +12881,11 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROW_LENGTH, TSDB_MAX_BYTES_PER_ROW); } + // only super and normal support + if (pStmt->pColOptions != NULL && TSDB_CHILD_TABLE == pTableMeta->tableType) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); + } + pReq->colName = taosStrdup(pStmt->colName); if (NULL == pReq->colName) { return TSDB_CODE_OUT_OF_MEMORY; @@ -12865,6 +12894,15 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S pReq->type = pStmt->dataType.type; pReq->flags = COL_SMA_ON; pReq->bytes = calcTypeBytes(pStmt->dataType); + if (pStmt->pColOptions != NULL) { + if (!checkColumnEncode(pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; + if (!checkColumnCompress(pStmt->pColOptions->compress)) return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; + if (!checkColumnLevel(pStmt->pColOptions->compressLevel)) return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; + int8_t code = setColCompressByOption(pReq->type, columnEncodeVal(pStmt->pColOptions->encode), + columnCompressVal(pStmt->pColOptions->compress), + columnLevelVal(pStmt->pColOptions->compressLevel), true, &pReq->compress); + } + return TSDB_CODE_SUCCESS; } From b364379671a805e413350db64755f954fbd8d3c1 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 02:31:29 +0000 Subject: [PATCH 17/44] add compress --- source/dnode/vnode/src/meta/metaTable.c | 27 +++++++++---------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index e8ce39f9fb..5bce7937bf 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -36,7 +36,7 @@ static int metaDeleteBtimeIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME); -int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add) { +int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add, uint32_t compress) { int32_t nCols = pWp->nCols; int32_t ver = pWp->version; if (add) { @@ -45,7 +45,7 @@ int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add) { SColCmpr *pCol = p + nCols; pCol->id = pSchema->colId; - pCol->alg = createDefaultColCmprByType(pSchema->type); + pCol->alg = compress; pWp->nCols = nCols + 1; pWp->version = ver; pWp->pColCmpr = p; @@ -1523,21 +1523,12 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl (void)tsdbCacheNewNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type); } SSchema *pCol = &pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1]; - if (pAlterTbReq->action == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { - - // if (pAlterTbReq->colCmpr.nCols != pSchema->nCols) { - // terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION; - // goto _err; - // } - // updataTableColCmpr(&entry.colCmpr, pCol, 1); - // freeColCmpr = true; - // ASSERT(entry.colCmpr.nCols == pSchema->nCols); - } else { - updataTableColCmpr(&entry.colCmpr, pCol, 1); - freeColCmpr = true; - ASSERT(entry.colCmpr.nCols == pSchema->nCols); - break; - } + uint32_t compress = pAlterTbReq->action == TSDB_ALTER_TABLE_ADD_COLUMN ? createDefaultColCmprByType(pCol->type) + : pAlterTbReq->compress; + updataTableColCmpr(&entry.colCmpr, pCol, 1, compress); + freeColCmpr = true; + ASSERT(entry.colCmpr.nCols == pSchema->nCols); + break; case TSDB_ALTER_TABLE_DROP_COLUMN: if (pColumn == NULL) { terrno = TSDB_CODE_VND_COL_NOT_EXISTS; @@ -1572,7 +1563,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl (void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, hasPrimayKey); } - updataTableColCmpr(&entry.colCmpr, &tScheam, 0); + updataTableColCmpr(&entry.colCmpr, &tScheam, 0, 0); ASSERT(entry.colCmpr.nCols == pSchema->nCols); break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: From a1ccf91298a666d80a298689f4ac3c6abca02fb2 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 02:47:57 +0000 Subject: [PATCH 18/44] support add column compress --- source/client/src/clientRawBlockWrite.c | 39 +++++++++++++++++++++++++ source/dnode/mnode/impl/src/mndStb.c | 2 +- source/dnode/vnode/src/meta/metaTable.c | 1 + 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index c5069d46aa..49dfdf6ad2 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -199,6 +199,26 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { } break; } + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { + SFieldWithOptions* field = taosArrayGet(req.pFields, 0); + cJSON* colName = cJSON_CreateString(field->name); + cJSON_AddItemToObject(json, "colName", colName); + cJSON* colType = cJSON_CreateNumber(field->type); + cJSON_AddItemToObject(json, "colType", colType); + + if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY || + field->type == TSDB_DATA_TYPE_GEOMETRY) { + int32_t length = field->bytes - VARSTR_HEADER_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } else if (field->type == TSDB_DATA_TYPE_NCHAR) { + int32_t length = (field->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } + setCompressOption(json, field->compress); + break; + } case TSDB_ALTER_TABLE_DROP_TAG: case TSDB_ALTER_TABLE_DROP_COLUMN: { TAOS_FIELD* field = taosArrayGet(req.pFields, 0); @@ -546,6 +566,25 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { } break; } + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { + cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); + cJSON_AddItemToObject(json, "colName", colName); + cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type); + cJSON_AddItemToObject(json, "colType", colType); + + if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_VARBINARY || + vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) { + int32_t length = vAlterTbReq.bytes - VARSTR_HEADER_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } else if (vAlterTbReq.type == TSDB_DATA_TYPE_NCHAR) { + int32_t length = (vAlterTbReq.bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } + setCompressOption(json, vAlterTbReq.compress); + break; + } case TSDB_ALTER_TABLE_DROP_COLUMN: { cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); cJSON_AddItemToObject(json, "colName", colName); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 1ac9200357..0d3affe6e5 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1828,7 +1828,7 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i]; pCmpr->id = pSchema->colId; - pCmpr->alg = createDefaultColCmprByType(pSchema->type); + pCmpr->alg = pField->compress; mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name); } else { SField *pField = taosArrayGet(pFields, i); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 5bce7937bf..2a122081b8 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -2272,6 +2272,7 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta pMeta->changed = true; switch (pReq->action) { case TSDB_ALTER_TABLE_ADD_COLUMN: + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: case TSDB_ALTER_TABLE_DROP_COLUMN: case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME: From 116409d73fe876555a44acf6c81b15f3b0718f2f Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 02:53:36 +0000 Subject: [PATCH 19/44] merge 3.0 --- include/common/ttokendef.h | 750 ++++++------ source/libs/parser/src/sql.c | 2161 +++++++++++++++++++++++++--------- 2 files changed, 1973 insertions(+), 938 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index e619edf972..0c15fd3b9d 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,381 +16,381 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_NK_COMMA 33 -#define TK_HOST 34 -#define TK_USER 35 -#define TK_ENABLE 36 -#define TK_NK_INTEGER 37 -#define TK_SYSINFO 38 -#define TK_ADD 39 -#define TK_DROP 40 -#define TK_GRANT 41 -#define TK_ON 42 -#define TK_TO 43 -#define TK_REVOKE 44 -#define TK_FROM 45 -#define TK_SUBSCRIBE 46 -#define TK_READ 47 -#define TK_WRITE 48 -#define TK_NK_DOT 49 -#define TK_WITH 50 -#define TK_ENCRYPT_KEY 51 -#define TK_DNODE 52 -#define TK_PORT 53 -#define TK_DNODES 54 -#define TK_RESTORE 55 -#define TK_NK_IPTOKEN 56 -#define TK_FORCE 57 -#define TK_UNSAFE 58 -#define TK_CLUSTER 59 -#define TK_LOCAL 60 -#define TK_QNODE 61 -#define TK_BNODE 62 -#define TK_SNODE 63 -#define TK_MNODE 64 -#define TK_VNODE 65 -#define TK_DATABASE 66 -#define TK_USE 67 -#define TK_FLUSH 68 -#define TK_TRIM 69 -#define TK_S3MIGRATE 70 -#define TK_COMPACT 71 -#define TK_IF 72 -#define TK_NOT 73 -#define TK_EXISTS 74 -#define TK_BUFFER 75 -#define TK_CACHEMODEL 76 -#define TK_CACHESIZE 77 -#define TK_COMP 78 -#define TK_DURATION 79 -#define TK_NK_VARIABLE 80 -#define TK_MAXROWS 81 -#define TK_MINROWS 82 -#define TK_KEEP 83 -#define TK_PAGES 84 -#define TK_PAGESIZE 85 -#define TK_TSDB_PAGESIZE 86 -#define TK_PRECISION 87 -#define TK_REPLICA 88 -#define TK_VGROUPS 89 -#define TK_SINGLE_STABLE 90 -#define TK_RETENTIONS 91 -#define TK_SCHEMALESS 92 -#define TK_WAL_LEVEL 93 -#define TK_WAL_FSYNC_PERIOD 94 -#define TK_WAL_RETENTION_PERIOD 95 -#define TK_WAL_RETENTION_SIZE 96 -#define TK_WAL_ROLL_PERIOD 97 -#define TK_WAL_SEGMENT_SIZE 98 -#define TK_STT_TRIGGER 99 -#define TK_TABLE_PREFIX 100 -#define TK_TABLE_SUFFIX 101 -#define TK_S3_CHUNKSIZE 102 -#define TK_S3_KEEPLOCAL 103 -#define TK_S3_COMPACT 104 -#define TK_KEEP_TIME_OFFSET 105 -#define TK_ENCRYPT_ALGORITHM 106 -#define TK_NK_COLON 107 -#define TK_BWLIMIT 108 -#define TK_START 109 -#define TK_TIMESTAMP 110 -#define TK_END 111 -#define TK_TABLE 112 -#define TK_NK_LP 113 -#define TK_NK_RP 114 -#define TK_STABLE 115 -#define TK_COLUMN 116 -#define TK_MODIFY 117 -#define TK_RENAME 118 -#define TK_TAG 119 -#define TK_SET 120 -#define TK_NK_EQ 121 -#define TK_USING 122 -#define TK_TAGS 123 -#define TK_BOOL 124 -#define TK_TINYINT 125 -#define TK_SMALLINT 126 -#define TK_INT 127 -#define TK_INTEGER 128 -#define TK_BIGINT 129 -#define TK_FLOAT 130 -#define TK_DOUBLE 131 -#define TK_BINARY 132 -#define TK_NCHAR 133 -#define TK_UNSIGNED 134 -#define TK_JSON 135 -#define TK_VARCHAR 136 -#define TK_MEDIUMBLOB 137 -#define TK_BLOB 138 -#define TK_VARBINARY 139 -#define TK_GEOMETRY 140 -#define TK_DECIMAL 141 -#define TK_COMMENT 142 -#define TK_MAX_DELAY 143 -#define TK_WATERMARK 144 -#define TK_ROLLUP 145 -#define TK_TTL 146 -#define TK_SMA 147 -#define TK_DELETE_MARK 148 -#define TK_FIRST 149 -#define TK_LAST 150 -#define TK_SHOW 151 -#define TK_PRIVILEGES 152 -#define TK_DATABASES 153 -#define TK_TABLES 154 -#define TK_STABLES 155 -#define TK_MNODES 156 -#define TK_QNODES 157 -#define TK_ARBGROUPS 158 -#define TK_FUNCTIONS 159 -#define TK_INDEXES 160 -#define TK_ACCOUNTS 161 -#define TK_APPS 162 -#define TK_CONNECTIONS 163 -#define TK_LICENCES 164 -#define TK_GRANTS 165 -#define TK_FULL 166 -#define TK_LOGS 167 -#define TK_MACHINES 168 -#define TK_ENCRYPTIONS 169 -#define TK_QUERIES 170 -#define TK_SCORES 171 -#define TK_TOPICS 172 -#define TK_VARIABLES 173 -#define TK_BNODES 174 -#define TK_SNODES 175 -#define TK_TRANSACTIONS 176 -#define TK_DISTRIBUTED 177 -#define TK_CONSUMERS 178 -#define TK_SUBSCRIPTIONS 179 -#define TK_VNODES 180 -#define TK_ALIVE 181 -#define TK_VIEWS 182 -#define TK_VIEW 183 -#define TK_COMPACTS 184 -#define TK_NORMAL 185 -#define TK_CHILD 186 -#define TK_LIKE 187 -#define TK_TBNAME 188 -#define TK_QTAGS 189 -#define TK_AS 190 -#define TK_SYSTEM 191 -#define TK_TSMA 192 -#define TK_INTERVAL 193 -#define TK_RECURSIVE 194 -#define TK_TSMAS 195 -#define TK_FUNCTION 196 -#define TK_INDEX 197 -#define TK_COUNT 198 -#define TK_LAST_ROW 199 -#define TK_META 200 -#define TK_ONLY 201 -#define TK_TOPIC 202 -#define TK_CONSUMER 203 -#define TK_GROUP 204 -#define TK_DESC 205 -#define TK_DESCRIBE 206 -#define TK_RESET 207 -#define TK_QUERY 208 -#define TK_CACHE 209 -#define TK_EXPLAIN 210 -#define TK_ANALYZE 211 -#define TK_VERBOSE 212 -#define TK_NK_BOOL 213 -#define TK_RATIO 214 -#define TK_NK_FLOAT 215 -#define TK_OUTPUTTYPE 216 -#define TK_AGGREGATE 217 -#define TK_BUFSIZE 218 -#define TK_LANGUAGE 219 -#define TK_REPLACE 220 -#define TK_STREAM 221 -#define TK_INTO 222 -#define TK_PAUSE 223 -#define TK_RESUME 224 -#define TK_PRIMARY 225 -#define TK_KEY 226 -#define TK_TRIGGER 227 -#define TK_AT_ONCE 228 -#define TK_WINDOW_CLOSE 229 -#define TK_IGNORE 230 -#define TK_EXPIRED 231 -#define TK_FILL_HISTORY 232 -#define TK_UPDATE 233 -#define TK_SUBTABLE 234 -#define TK_UNTREATED 235 -#define TK_KILL 236 -#define TK_CONNECTION 237 -#define TK_TRANSACTION 238 -#define TK_BALANCE 239 -#define TK_VGROUP 240 -#define TK_LEADER 241 -#define TK_MERGE 242 -#define TK_REDISTRIBUTE 243 -#define TK_SPLIT 244 -#define TK_DELETE 245 -#define TK_INSERT 246 -#define TK_NK_BIN 247 -#define TK_NK_HEX 248 -#define TK_NULL 249 -#define TK_NK_QUESTION 250 -#define TK_NK_ALIAS 251 -#define TK_NK_ARROW 252 -#define TK_ROWTS 253 -#define TK_QSTART 254 -#define TK_QEND 255 -#define TK_QDURATION 256 -#define TK_WSTART 257 -#define TK_WEND 258 -#define TK_WDURATION 259 -#define TK_IROWTS 260 -#define TK_ISFILLED 261 -#define TK_CAST 262 -#define TK_NOW 263 -#define TK_TODAY 264 -#define TK_TIMEZONE 265 -#define TK_CLIENT_VERSION 266 -#define TK_SERVER_VERSION 267 -#define TK_SERVER_STATUS 268 -#define TK_CURRENT_USER 269 -#define TK_CASE 270 -#define TK_WHEN 271 -#define TK_THEN 272 -#define TK_ELSE 273 -#define TK_BETWEEN 274 -#define TK_IS 275 -#define TK_NK_LT 276 -#define TK_NK_GT 277 -#define TK_NK_LE 278 -#define TK_NK_GE 279 -#define TK_NK_NE 280 -#define TK_MATCH 281 -#define TK_NMATCH 282 -#define TK_CONTAINS 283 -#define TK_IN 284 -#define TK_JOIN 285 -#define TK_INNER 286 -#define TK_LEFT 287 -#define TK_RIGHT 288 -#define TK_OUTER 289 -#define TK_SEMI 290 -#define TK_ANTI 291 -#define TK_ASOF 292 -#define TK_WINDOW 293 -#define TK_WINDOW_OFFSET 294 -#define TK_JLIMIT 295 -#define TK_SELECT 296 -#define TK_NK_HINT 297 -#define TK_DISTINCT 298 -#define TK_WHERE 299 -#define TK_PARTITION 300 -#define TK_BY 301 -#define TK_SESSION 302 -#define TK_STATE_WINDOW 303 -#define TK_EVENT_WINDOW 304 -#define TK_COUNT_WINDOW 305 -#define TK_SLIDING 306 -#define TK_FILL 307 -#define TK_VALUE 308 -#define TK_VALUE_F 309 -#define TK_NONE 310 -#define TK_PREV 311 -#define TK_NULL_F 312 -#define TK_LINEAR 313 -#define TK_NEXT 314 -#define TK_HAVING 315 -#define TK_RANGE 316 -#define TK_EVERY 317 -#define TK_ORDER 318 -#define TK_SLIMIT 319 -#define TK_SOFFSET 320 -#define TK_LIMIT 321 -#define TK_OFFSET 322 -#define TK_ASC 323 -#define TK_NULLS 324 -#define TK_ABORT 325 -#define TK_AFTER 326 -#define TK_ATTACH 327 -#define TK_BEFORE 328 -#define TK_BEGIN 329 -#define TK_BITAND 330 -#define TK_BITNOT 331 -#define TK_BITOR 332 -#define TK_BLOCKS 333 -#define TK_CHANGE 334 -#define TK_COMMA 335 -#define TK_CONCAT 336 -#define TK_CONFLICT 337 -#define TK_COPY 338 -#define TK_DEFERRED 339 -#define TK_DELIMITERS 340 -#define TK_DETACH 341 -#define TK_DIVIDE 342 -#define TK_DOT 343 -#define TK_EACH 344 -#define TK_FAIL 345 -#define TK_FILE 346 -#define TK_FOR 347 -#define TK_GLOB 348 -#define TK_ID 349 -#define TK_IMMEDIATE 350 -#define TK_IMPORT 351 -#define TK_INITIALLY 352 -#define TK_INSTEAD 353 -#define TK_ISNULL 354 -#define TK_MODULES 355 -#define TK_NK_BITNOT 356 -#define TK_NK_SEMI 357 -#define TK_NOTNULL 358 -#define TK_OF 359 -#define TK_PLUS 360 -#define TK_PRIVILEGE 361 -#define TK_RAISE 362 -#define TK_RESTRICT 363 -#define TK_ROW 364 -#define TK_STAR 365 -#define TK_STATEMENT 366 -#define TK_STRICT 367 -#define TK_STRING 368 -#define TK_TIMES 369 -#define TK_VALUES 370 -#define TK_VARIABLE 371 -#define TK_WAL 372 -#define TK_ENCODE 373 -#define TK_COMPRESS 374 -#define TK_LEVEL 375 +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_NK_COMMA 33 +#define TK_HOST 34 +#define TK_USER 35 +#define TK_ENABLE 36 +#define TK_NK_INTEGER 37 +#define TK_SYSINFO 38 +#define TK_ADD 39 +#define TK_DROP 40 +#define TK_GRANT 41 +#define TK_ON 42 +#define TK_TO 43 +#define TK_REVOKE 44 +#define TK_FROM 45 +#define TK_SUBSCRIBE 46 +#define TK_READ 47 +#define TK_WRITE 48 +#define TK_NK_DOT 49 +#define TK_WITH 50 +#define TK_ENCRYPT_KEY 51 +#define TK_DNODE 52 +#define TK_PORT 53 +#define TK_DNODES 54 +#define TK_RESTORE 55 +#define TK_NK_IPTOKEN 56 +#define TK_FORCE 57 +#define TK_UNSAFE 58 +#define TK_CLUSTER 59 +#define TK_LOCAL 60 +#define TK_QNODE 61 +#define TK_BNODE 62 +#define TK_SNODE 63 +#define TK_MNODE 64 +#define TK_VNODE 65 +#define TK_DATABASE 66 +#define TK_USE 67 +#define TK_FLUSH 68 +#define TK_TRIM 69 +#define TK_S3MIGRATE 70 +#define TK_COMPACT 71 +#define TK_IF 72 +#define TK_NOT 73 +#define TK_EXISTS 74 +#define TK_BUFFER 75 +#define TK_CACHEMODEL 76 +#define TK_CACHESIZE 77 +#define TK_COMP 78 +#define TK_DURATION 79 +#define TK_NK_VARIABLE 80 +#define TK_MAXROWS 81 +#define TK_MINROWS 82 +#define TK_KEEP 83 +#define TK_PAGES 84 +#define TK_PAGESIZE 85 +#define TK_TSDB_PAGESIZE 86 +#define TK_PRECISION 87 +#define TK_REPLICA 88 +#define TK_VGROUPS 89 +#define TK_SINGLE_STABLE 90 +#define TK_RETENTIONS 91 +#define TK_SCHEMALESS 92 +#define TK_WAL_LEVEL 93 +#define TK_WAL_FSYNC_PERIOD 94 +#define TK_WAL_RETENTION_PERIOD 95 +#define TK_WAL_RETENTION_SIZE 96 +#define TK_WAL_ROLL_PERIOD 97 +#define TK_WAL_SEGMENT_SIZE 98 +#define TK_STT_TRIGGER 99 +#define TK_TABLE_PREFIX 100 +#define TK_TABLE_SUFFIX 101 +#define TK_S3_CHUNKSIZE 102 +#define TK_S3_KEEPLOCAL 103 +#define TK_S3_COMPACT 104 +#define TK_KEEP_TIME_OFFSET 105 +#define TK_ENCRYPT_ALGORITHM 106 +#define TK_NK_COLON 107 +#define TK_BWLIMIT 108 +#define TK_START 109 +#define TK_TIMESTAMP 110 +#define TK_END 111 +#define TK_TABLE 112 +#define TK_NK_LP 113 +#define TK_NK_RP 114 +#define TK_STABLE 115 +#define TK_COLUMN 116 +#define TK_MODIFY 117 +#define TK_RENAME 118 +#define TK_TAG 119 +#define TK_SET 120 +#define TK_NK_EQ 121 +#define TK_USING 122 +#define TK_TAGS 123 +#define TK_BOOL 124 +#define TK_TINYINT 125 +#define TK_SMALLINT 126 +#define TK_INT 127 +#define TK_INTEGER 128 +#define TK_BIGINT 129 +#define TK_FLOAT 130 +#define TK_DOUBLE 131 +#define TK_BINARY 132 +#define TK_NCHAR 133 +#define TK_UNSIGNED 134 +#define TK_JSON 135 +#define TK_VARCHAR 136 +#define TK_MEDIUMBLOB 137 +#define TK_BLOB 138 +#define TK_VARBINARY 139 +#define TK_GEOMETRY 140 +#define TK_DECIMAL 141 +#define TK_COMMENT 142 +#define TK_MAX_DELAY 143 +#define TK_WATERMARK 144 +#define TK_ROLLUP 145 +#define TK_TTL 146 +#define TK_SMA 147 +#define TK_DELETE_MARK 148 +#define TK_FIRST 149 +#define TK_LAST 150 +#define TK_SHOW 151 +#define TK_PRIVILEGES 152 +#define TK_DATABASES 153 +#define TK_TABLES 154 +#define TK_STABLES 155 +#define TK_MNODES 156 +#define TK_QNODES 157 +#define TK_ARBGROUPS 158 +#define TK_FUNCTIONS 159 +#define TK_INDEXES 160 +#define TK_ACCOUNTS 161 +#define TK_APPS 162 +#define TK_CONNECTIONS 163 +#define TK_LICENCES 164 +#define TK_GRANTS 165 +#define TK_FULL 166 +#define TK_LOGS 167 +#define TK_MACHINES 168 +#define TK_ENCRYPTIONS 169 +#define TK_QUERIES 170 +#define TK_SCORES 171 +#define TK_TOPICS 172 +#define TK_VARIABLES 173 +#define TK_BNODES 174 +#define TK_SNODES 175 +#define TK_TRANSACTIONS 176 +#define TK_DISTRIBUTED 177 +#define TK_CONSUMERS 178 +#define TK_SUBSCRIPTIONS 179 +#define TK_VNODES 180 +#define TK_ALIVE 181 +#define TK_VIEWS 182 +#define TK_VIEW 183 +#define TK_COMPACTS 184 +#define TK_NORMAL 185 +#define TK_CHILD 186 +#define TK_LIKE 187 +#define TK_TBNAME 188 +#define TK_QTAGS 189 +#define TK_AS 190 +#define TK_SYSTEM 191 +#define TK_TSMA 192 +#define TK_INTERVAL 193 +#define TK_RECURSIVE 194 +#define TK_TSMAS 195 +#define TK_FUNCTION 196 +#define TK_INDEX 197 +#define TK_COUNT 198 +#define TK_LAST_ROW 199 +#define TK_META 200 +#define TK_ONLY 201 +#define TK_TOPIC 202 +#define TK_CONSUMER 203 +#define TK_GROUP 204 +#define TK_DESC 205 +#define TK_DESCRIBE 206 +#define TK_RESET 207 +#define TK_QUERY 208 +#define TK_CACHE 209 +#define TK_EXPLAIN 210 +#define TK_ANALYZE 211 +#define TK_VERBOSE 212 +#define TK_NK_BOOL 213 +#define TK_RATIO 214 +#define TK_NK_FLOAT 215 +#define TK_OUTPUTTYPE 216 +#define TK_AGGREGATE 217 +#define TK_BUFSIZE 218 +#define TK_LANGUAGE 219 +#define TK_REPLACE 220 +#define TK_STREAM 221 +#define TK_INTO 222 +#define TK_PAUSE 223 +#define TK_RESUME 224 +#define TK_PRIMARY 225 +#define TK_KEY 226 +#define TK_TRIGGER 227 +#define TK_AT_ONCE 228 +#define TK_WINDOW_CLOSE 229 +#define TK_IGNORE 230 +#define TK_EXPIRED 231 +#define TK_FILL_HISTORY 232 +#define TK_UPDATE 233 +#define TK_SUBTABLE 234 +#define TK_UNTREATED 235 +#define TK_KILL 236 +#define TK_CONNECTION 237 +#define TK_TRANSACTION 238 +#define TK_BALANCE 239 +#define TK_VGROUP 240 +#define TK_LEADER 241 +#define TK_MERGE 242 +#define TK_REDISTRIBUTE 243 +#define TK_SPLIT 244 +#define TK_DELETE 245 +#define TK_INSERT 246 +#define TK_NK_BIN 247 +#define TK_NK_HEX 248 +#define TK_NULL 249 +#define TK_NK_QUESTION 250 +#define TK_NK_ALIAS 251 +#define TK_NK_ARROW 252 +#define TK_ROWTS 253 +#define TK_QSTART 254 +#define TK_QEND 255 +#define TK_QDURATION 256 +#define TK_WSTART 257 +#define TK_WEND 258 +#define TK_WDURATION 259 +#define TK_IROWTS 260 +#define TK_ISFILLED 261 +#define TK_CAST 262 +#define TK_NOW 263 +#define TK_TODAY 264 +#define TK_TIMEZONE 265 +#define TK_CLIENT_VERSION 266 +#define TK_SERVER_VERSION 267 +#define TK_SERVER_STATUS 268 +#define TK_CURRENT_USER 269 +#define TK_CASE 270 +#define TK_WHEN 271 +#define TK_THEN 272 +#define TK_ELSE 273 +#define TK_BETWEEN 274 +#define TK_IS 275 +#define TK_NK_LT 276 +#define TK_NK_GT 277 +#define TK_NK_LE 278 +#define TK_NK_GE 279 +#define TK_NK_NE 280 +#define TK_MATCH 281 +#define TK_NMATCH 282 +#define TK_CONTAINS 283 +#define TK_IN 284 +#define TK_JOIN 285 +#define TK_INNER 286 +#define TK_LEFT 287 +#define TK_RIGHT 288 +#define TK_OUTER 289 +#define TK_SEMI 290 +#define TK_ANTI 291 +#define TK_ASOF 292 +#define TK_WINDOW 293 +#define TK_WINDOW_OFFSET 294 +#define TK_JLIMIT 295 +#define TK_SELECT 296 +#define TK_NK_HINT 297 +#define TK_DISTINCT 298 +#define TK_WHERE 299 +#define TK_PARTITION 300 +#define TK_BY 301 +#define TK_SESSION 302 +#define TK_STATE_WINDOW 303 +#define TK_EVENT_WINDOW 304 +#define TK_COUNT_WINDOW 305 +#define TK_SLIDING 306 +#define TK_FILL 307 +#define TK_VALUE 308 +#define TK_VALUE_F 309 +#define TK_NONE 310 +#define TK_PREV 311 +#define TK_NULL_F 312 +#define TK_LINEAR 313 +#define TK_NEXT 314 +#define TK_HAVING 315 +#define TK_RANGE 316 +#define TK_EVERY 317 +#define TK_ORDER 318 +#define TK_SLIMIT 319 +#define TK_SOFFSET 320 +#define TK_LIMIT 321 +#define TK_OFFSET 322 +#define TK_ASC 323 +#define TK_NULLS 324 +#define TK_ABORT 325 +#define TK_AFTER 326 +#define TK_ATTACH 327 +#define TK_BEFORE 328 +#define TK_BEGIN 329 +#define TK_BITAND 330 +#define TK_BITNOT 331 +#define TK_BITOR 332 +#define TK_BLOCKS 333 +#define TK_CHANGE 334 +#define TK_COMMA 335 +#define TK_CONCAT 336 +#define TK_CONFLICT 337 +#define TK_COPY 338 +#define TK_DEFERRED 339 +#define TK_DELIMITERS 340 +#define TK_DETACH 341 +#define TK_DIVIDE 342 +#define TK_DOT 343 +#define TK_EACH 344 +#define TK_FAIL 345 +#define TK_FILE 346 +#define TK_FOR 347 +#define TK_GLOB 348 +#define TK_ID 349 +#define TK_IMMEDIATE 350 +#define TK_IMPORT 351 +#define TK_INITIALLY 352 +#define TK_INSTEAD 353 +#define TK_ISNULL 354 +#define TK_MODULES 355 +#define TK_NK_BITNOT 356 +#define TK_NK_SEMI 357 +#define TK_NOTNULL 358 +#define TK_OF 359 +#define TK_PLUS 360 +#define TK_PRIVILEGE 361 +#define TK_RAISE 362 +#define TK_RESTRICT 363 +#define TK_ROW 364 +#define TK_STAR 365 +#define TK_STATEMENT 366 +#define TK_STRICT 367 +#define TK_STRING 368 +#define TK_TIMES 369 +#define TK_VALUES 370 +#define TK_VARIABLE 371 +#define TK_WAL 372 +#define TK_ENCODE 373 +#define TK_COMPRESS 374 +#define TK_LEVEL 375 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 52dd135cd3..226696532b 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -25,6 +25,8 @@ ** input grammar file: */ /************ Begin %include sections from the grammar ************************/ +#line 11 "sql.y" + #include #include #include @@ -40,6 +42,7 @@ #include "parAst.h" #define YYSTACKDEPTH 0 +#line 46 "sql.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ @@ -517,18 +520,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 963 +#define YYNSTATE 965 #define YYNRULE 748 #define YYNRULE_WITH_ACTION 748 #define YYNTOKEN 376 -#define YY_MAX_SHIFT 962 -#define YY_MIN_SHIFTREDUCE 1431 -#define YY_MAX_SHIFTREDUCE 2178 -#define YY_ERROR_ACTION 2179 -#define YY_ACCEPT_ACTION 2180 -#define YY_NO_ACTION 2181 -#define YY_MIN_REDUCE 2182 -#define YY_MAX_REDUCE 2929 +#define YY_MAX_SHIFT 964 +#define YY_MIN_SHIFTREDUCE 1432 +#define YY_MAX_SHIFTREDUCE 2179 +#define YY_ERROR_ACTION 2180 +#define YY_ACCEPT_ACTION 2181 +#define YY_NO_ACTION 2182 +#define YY_MIN_REDUCE 2183 +#define YY_MAX_REDUCE 2930 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -597,329 +600,329 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (3228) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 37, 338, 2538, 2705, 639, 542, 2373, 640, 2225, 190, - /* 10 */ 2680, 315, 47, 45, 2095, 2812, 803, 464, 494, 493, - /* 20 */ 469, 2183, 1916, 2535, 845, 40, 39, 2705, 66, 46, - /* 30 */ 44, 43, 42, 41, 1941, 2004, 1941, 1914, 2684, 2480, - /* 40 */ 838, 2809, 136, 1923, 2723, 135, 134, 133, 132, 131, - /* 50 */ 130, 129, 128, 127, 604, 602, 831, 409, 854, 372, - /* 60 */ 2670, 230, 840, 2368, 417, 33, 1999, 830, 2723, 800, + /* 0 */ 37, 338, 2539, 2706, 641, 544, 2374, 642, 2226, 190, + /* 10 */ 2681, 315, 47, 45, 2096, 2813, 805, 466, 496, 495, + /* 20 */ 471, 2184, 1917, 2536, 847, 40, 39, 2706, 66, 46, + /* 30 */ 44, 43, 42, 41, 1942, 2005, 1942, 1915, 2685, 2481, + /* 40 */ 840, 2810, 136, 1924, 2724, 135, 134, 133, 132, 131, + /* 50 */ 130, 129, 128, 127, 606, 604, 833, 410, 856, 372, + /* 60 */ 2671, 230, 842, 2369, 418, 33, 2000, 832, 2724, 802, /* 70 */ 155, 40, 39, 19, 301, 46, 44, 43, 42, 41, - /* 80 */ 1922, 2269, 800, 155, 2670, 210, 840, 724, 136, 2686, - /* 90 */ 2689, 135, 134, 133, 132, 131, 130, 129, 128, 127, - /* 100 */ 859, 2431, 722, 252, 720, 286, 285, 642, 2704, 2233, - /* 110 */ 959, 2743, 2812, 15, 1942, 119, 2706, 844, 2708, 2709, - /* 120 */ 839, 647, 859, 103, 640, 2225, 197, 199, 854, 2797, - /* 130 */ 644, 2139, 2704, 465, 2793, 2743, 641, 62, 2808, 405, - /* 140 */ 2706, 844, 2708, 2709, 839, 837, 859, 823, 2762, 2006, - /* 150 */ 2007, 50, 437, 218, 2511, 753, 932, 931, 930, 929, - /* 160 */ 497, 2844, 928, 927, 160, 922, 921, 920, 919, 918, - /* 170 */ 917, 916, 159, 910, 909, 908, 496, 495, 905, 904, - /* 180 */ 903, 196, 195, 902, 492, 901, 900, 899, 1977, 1987, - /* 190 */ 802, 185, 2805, 2806, 778, 153, 2810, 290, 2005, 2008, - /* 200 */ 800, 155, 1762, 1763, 192, 2805, 799, 579, 147, 798, - /* 210 */ 788, 2663, 578, 1917, 485, 1915, 2895, 9, 2895, 2099, - /* 220 */ 577, 1926, 40, 39, 737, 1941, 46, 44, 43, 42, - /* 230 */ 41, 2360, 2705, 2205, 787, 217, 787, 217, 122, 2896, - /* 240 */ 789, 2896, 789, 1689, 1690, 841, 2388, 487, 2386, 1920, - /* 250 */ 1921, 1974, 777, 1976, 1979, 1980, 1981, 1982, 1983, 1984, - /* 260 */ 1985, 1986, 836, 857, 856, 1998, 2000, 2001, 2002, 2003, - /* 270 */ 2, 47, 45, 2723, 915, 474, 414, 2344, 1939, 469, - /* 280 */ 2723, 1916, 1843, 1844, 2900, 586, 859, 429, 607, 2670, - /* 290 */ 2670, 840, 2895, 606, 2004, 60, 1914, 40, 39, 453, - /* 300 */ 2585, 46, 44, 43, 42, 41, 751, 2014, 734, 1945, - /* 310 */ 565, 2899, 608, 1941, 197, 2896, 2898, 415, 567, 1498, - /* 320 */ 322, 1497, 125, 2805, 2806, 1999, 153, 2810, 180, 545, - /* 330 */ 855, 2384, 19, 662, 322, 2033, 151, 2704, 2387, 1922, - /* 340 */ 2743, 2070, 2512, 773, 119, 2706, 844, 2708, 2709, 839, - /* 350 */ 221, 859, 1471, 776, 157, 1499, 166, 2768, 2797, 2182, - /* 360 */ 40, 39, 465, 2793, 46, 44, 43, 42, 41, 959, - /* 370 */ 438, 1478, 15, 896, 172, 171, 893, 892, 891, 169, - /* 380 */ 1945, 553, 1941, 145, 144, 143, 142, 141, 140, 139, - /* 390 */ 138, 137, 655, 1978, 1473, 1476, 1477, 535, 62, 40, - /* 400 */ 39, 2034, 534, 46, 44, 43, 42, 41, 2006, 2007, - /* 410 */ 659, 2518, 2497, 658, 594, 593, 592, 591, 590, 585, - /* 420 */ 584, 583, 582, 421, 29, 1974, 2070, 572, 571, 570, - /* 430 */ 569, 568, 562, 561, 560, 254, 555, 554, 436, 642, - /* 440 */ 854, 2233, 546, 1750, 1751, 329, 330, 1977, 1987, 1769, - /* 450 */ 328, 754, 779, 774, 767, 763, 1975, 2005, 2008, 2895, - /* 460 */ 2817, 2067, 2068, 2069, 2817, 2817, 2817, 2817, 2817, 2525, - /* 470 */ 2375, 660, 1917, 519, 1915, 62, 898, 2901, 217, 213, - /* 480 */ 738, 1978, 2896, 789, 855, 2384, 855, 2384, 36, 467, - /* 490 */ 2028, 2029, 2030, 2031, 2032, 2036, 2037, 2038, 2039, 2072, - /* 500 */ 2073, 2074, 2075, 2076, 146, 2140, 55, 376, 1920, 1921, - /* 510 */ 1974, 685, 1976, 1979, 1980, 1981, 1982, 1983, 1984, 1985, - /* 520 */ 1986, 836, 857, 856, 1998, 2000, 2001, 2002, 2003, 2, - /* 530 */ 12, 47, 45, 50, 474, 1925, 2705, 2538, 181, 469, - /* 540 */ 1946, 1916, 116, 389, 1975, 859, 2067, 2068, 2069, 803, - /* 550 */ 208, 113, 471, 598, 2004, 1589, 1914, 2170, 2535, 845, - /* 560 */ 387, 76, 649, 2577, 75, 2705, 40, 39, 452, 2585, - /* 570 */ 46, 44, 43, 42, 41, 416, 735, 2723, 841, 2070, - /* 580 */ 2235, 322, 1942, 1922, 2680, 1999, 2900, 250, 621, 619, - /* 590 */ 616, 614, 19, 2670, 2895, 840, 40, 39, 1591, 1922, - /* 600 */ 46, 44, 43, 42, 41, 2490, 2723, 706, 705, 704, - /* 610 */ 523, 1946, 2684, 2899, 696, 152, 700, 2896, 2897, 241, - /* 620 */ 699, 2538, 2670, 656, 840, 698, 703, 446, 445, 959, - /* 630 */ 912, 697, 15, 62, 98, 444, 693, 692, 691, 525, - /* 640 */ 521, 2704, 2536, 845, 2743, 597, 240, 549, 119, 2706, - /* 650 */ 844, 2708, 2709, 839, 795, 859, 855, 2384, 322, 595, - /* 660 */ 199, 2380, 2797, 2686, 2688, 466, 465, 2793, 2006, 2007, - /* 670 */ 2704, 63, 2111, 2743, 859, 2169, 146, 119, 2706, 844, - /* 680 */ 2708, 2709, 839, 690, 859, 12, 2128, 657, 2531, 2915, - /* 690 */ 183, 2797, 2194, 51, 2845, 465, 2793, 914, 2817, 2067, - /* 700 */ 2068, 2069, 2817, 2817, 2817, 2817, 2817, 1977, 1987, 35, - /* 710 */ 1944, 1789, 1790, 1928, 2180, 40, 39, 2005, 2008, 46, - /* 720 */ 44, 43, 42, 41, 2358, 86, 85, 538, 2438, 2439, - /* 730 */ 229, 2092, 1917, 2444, 1915, 46, 44, 43, 42, 41, - /* 740 */ 98, 435, 2623, 530, 528, 770, 769, 2126, 2127, 2129, - /* 750 */ 2130, 2131, 2442, 12, 289, 10, 413, 439, 288, 517, - /* 760 */ 1788, 1791, 513, 509, 505, 502, 531, 2379, 1920, 1921, - /* 770 */ 1974, 1584, 1976, 1979, 1980, 1981, 1982, 1983, 1984, 1985, - /* 780 */ 1986, 836, 857, 856, 1998, 2000, 2001, 2002, 2003, 2, - /* 790 */ 47, 45, 2009, 1498, 2705, 1497, 754, 480, 469, 236, - /* 800 */ 1916, 500, 180, 865, 2895, 889, 499, 841, 2900, 2852, - /* 810 */ 2664, 487, 2386, 2004, 1585, 1914, 322, 489, 2705, 78, - /* 820 */ 2437, 2439, 2901, 217, 1601, 1944, 2812, 2896, 789, 1499, - /* 830 */ 788, 841, 101, 2865, 636, 2723, 1941, 424, 2895, 1600, - /* 840 */ 451, 2444, 726, 634, 1999, 92, 630, 626, 91, 462, - /* 850 */ 211, 2670, 2807, 840, 829, 754, 787, 217, 1922, 2723, - /* 860 */ 2442, 2896, 789, 2895, 855, 2384, 896, 172, 171, 893, - /* 870 */ 892, 891, 169, 89, 474, 2670, 322, 840, 443, 442, - /* 880 */ 320, 2901, 217, 483, 539, 859, 2896, 789, 959, 2463, - /* 890 */ 2371, 48, 896, 172, 171, 893, 892, 891, 169, 2704, - /* 900 */ 1501, 1502, 2743, 3, 2705, 738, 119, 2706, 844, 2708, - /* 910 */ 2709, 839, 609, 859, 1916, 53, 90, 841, 2915, 2163, - /* 920 */ 2797, 855, 2384, 2704, 465, 2793, 2743, 2006, 2007, 1914, - /* 930 */ 119, 2706, 844, 2708, 2709, 839, 824, 859, 2769, 551, - /* 940 */ 2507, 540, 2915, 796, 2797, 2723, 557, 2507, 465, 2793, - /* 950 */ 472, 864, 863, 862, 855, 2384, 441, 440, 179, 687, - /* 960 */ 2444, 2670, 826, 840, 2769, 2705, 1977, 1987, 473, 2389, - /* 970 */ 855, 2384, 1922, 1478, 661, 1885, 2005, 2008, 841, 2442, - /* 980 */ 765, 689, 2366, 855, 2384, 688, 2444, 740, 2577, 297, - /* 990 */ 559, 1917, 232, 1915, 488, 320, 2120, 1476, 1477, 234, - /* 1000 */ 588, 2507, 959, 573, 1978, 2442, 2723, 479, 478, 2704, - /* 1010 */ 62, 2121, 2743, 1945, 681, 680, 187, 2706, 844, 2708, - /* 1020 */ 2709, 839, 2670, 859, 840, 2091, 2204, 1920, 1921, 1974, - /* 1030 */ 2025, 1976, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, - /* 1040 */ 836, 857, 856, 1998, 2000, 2001, 2002, 2003, 2, 47, - /* 1050 */ 45, 2705, 490, 239, 2119, 581, 580, 469, 382, 1916, - /* 1060 */ 179, 1884, 683, 682, 841, 102, 2888, 1975, 855, 2384, - /* 1070 */ 2704, 2389, 2004, 2743, 1914, 790, 2916, 119, 2706, 844, - /* 1080 */ 2708, 2709, 839, 2670, 859, 702, 701, 2705, 574, 2915, - /* 1090 */ 182, 2797, 2723, 482, 481, 465, 2793, 1605, 2318, 1817, - /* 1100 */ 841, 2203, 2829, 1999, 1650, 1917, 2388, 1915, 2670, 533, - /* 1110 */ 840, 532, 1604, 111, 14, 13, 2202, 1922, 1641, 888, - /* 1120 */ 887, 886, 1645, 885, 1647, 1648, 884, 881, 2723, 1656, - /* 1130 */ 878, 1658, 1659, 875, 872, 869, 2195, 855, 2384, 2377, - /* 1140 */ 2319, 1920, 1921, 531, 2670, 117, 840, 959, 2705, 2899, - /* 1150 */ 48, 2035, 855, 2384, 855, 2384, 2704, 575, 2670, 2743, - /* 1160 */ 2359, 841, 158, 119, 2706, 844, 2708, 2709, 839, 376, - /* 1170 */ 859, 2376, 2381, 2670, 292, 2915, 2201, 2797, 855, 2384, - /* 1180 */ 190, 465, 2793, 212, 148, 611, 2006, 2007, 1480, 2723, - /* 1190 */ 855, 2384, 2704, 322, 1940, 2743, 88, 2200, 300, 119, - /* 1200 */ 2706, 844, 2708, 2709, 839, 2670, 859, 840, 855, 2384, - /* 1210 */ 806, 2915, 2199, 2797, 494, 493, 2198, 465, 2793, 2197, - /* 1220 */ 855, 2384, 855, 2384, 1930, 1977, 1987, 2047, 333, 855, - /* 1230 */ 2384, 2586, 898, 2670, 2858, 2005, 2008, 2004, 34, 1923, - /* 1240 */ 820, 1945, 340, 1941, 1946, 43, 42, 41, 2040, 852, - /* 1250 */ 1917, 2591, 1915, 2704, 2670, 2610, 2743, 855, 2384, 771, - /* 1260 */ 119, 2706, 844, 2708, 2709, 839, 2196, 859, 1999, 2670, - /* 1270 */ 926, 924, 2772, 2670, 2797, 2193, 2670, 853, 465, 2793, - /* 1280 */ 156, 689, 1922, 2768, 2192, 688, 1920, 1921, 1974, 2272, - /* 1290 */ 1976, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 836, - /* 1300 */ 857, 856, 1998, 2000, 2001, 2002, 2003, 2, 47, 45, - /* 1310 */ 2191, 2705, 828, 291, 855, 2384, 469, 2190, 1916, 855, - /* 1320 */ 2384, 2189, 2188, 2670, 841, 308, 179, 2624, 1650, 782, - /* 1330 */ 2187, 2004, 2670, 1914, 368, 890, 792, 2390, 2435, 491, - /* 1340 */ 2186, 2670, 1641, 888, 887, 886, 1645, 885, 1647, 1648, - /* 1350 */ 835, 834, 2723, 1656, 833, 1658, 1659, 832, 872, 869, - /* 1360 */ 894, 2185, 1999, 2435, 706, 705, 704, 2670, 2670, 170, - /* 1370 */ 840, 696, 152, 700, 2670, 316, 1922, 699, 2670, 2670, - /* 1380 */ 2444, 754, 698, 703, 446, 445, 2444, 2670, 697, 2895, - /* 1390 */ 2237, 2444, 444, 693, 692, 691, 2081, 2670, 514, 807, - /* 1400 */ 895, 800, 155, 2435, 2614, 815, 959, 2901, 217, 15, - /* 1410 */ 2443, 383, 2896, 789, 2421, 1931, 2704, 1926, 2670, 2743, - /* 1420 */ 2210, 954, 223, 119, 2706, 844, 2708, 2709, 839, 277, - /* 1430 */ 859, 279, 275, 281, 278, 2770, 280, 2797, 419, 418, - /* 1440 */ 2361, 465, 2793, 950, 283, 2006, 2007, 282, 475, 162, - /* 1450 */ 54, 1934, 1936, 162, 694, 695, 507, 728, 2691, 727, - /* 1460 */ 272, 2004, 2705, 484, 791, 857, 856, 1998, 2000, 2001, - /* 1470 */ 2002, 2003, 1946, 161, 1975, 841, 2256, 191, 1582, 1580, - /* 1480 */ 2254, 2172, 2173, 1562, 1977, 1987, 679, 675, 671, 667, - /* 1490 */ 2245, 271, 1999, 2243, 2005, 2008, 207, 801, 707, 150, - /* 1500 */ 40, 39, 709, 2723, 46, 44, 43, 42, 41, 1917, - /* 1510 */ 761, 1915, 711, 2724, 49, 714, 170, 906, 49, 2670, - /* 1520 */ 200, 840, 2693, 186, 2805, 2806, 1563, 153, 2810, 327, - /* 1530 */ 1833, 2311, 77, 2310, 1841, 64, 2516, 99, 347, 346, - /* 1540 */ 269, 1554, 14, 13, 49, 1920, 1921, 1974, 2226, 1976, - /* 1550 */ 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 836, 857, - /* 1560 */ 856, 1998, 2000, 2001, 2002, 2003, 2, 2704, 49, 736, - /* 1570 */ 2743, 77, 349, 348, 119, 2706, 844, 2708, 2709, 839, - /* 1580 */ 167, 859, 731, 170, 351, 350, 825, 962, 2797, 353, - /* 1590 */ 352, 2115, 465, 2793, 2705, 2125, 74, 805, 867, 2124, - /* 1600 */ 168, 306, 2848, 374, 355, 354, 170, 841, 257, 768, - /* 1610 */ 331, 458, 775, 812, 357, 356, 2041, 268, 454, 952, - /* 1620 */ 206, 259, 266, 793, 149, 1988, 1924, 264, 653, 948, - /* 1630 */ 944, 940, 936, 167, 371, 2723, 754, 809, 498, 1907, - /* 1640 */ 516, 1883, 359, 358, 2895, 907, 256, 361, 360, 1786, - /* 1650 */ 2517, 2670, 1776, 840, 363, 362, 365, 364, 1535, 367, - /* 1660 */ 366, 343, 2901, 217, 1632, 2232, 747, 2896, 789, 1552, - /* 1670 */ 2432, 2705, 783, 477, 476, 1908, 2849, 381, 2859, 1663, - /* 1680 */ 118, 1671, 123, 344, 841, 784, 318, 1678, 713, 857, - /* 1690 */ 856, 1998, 2000, 2001, 2002, 2003, 313, 321, 2345, 2704, - /* 1700 */ 5, 1536, 2743, 725, 2705, 1676, 120, 2706, 844, 2708, - /* 1710 */ 2709, 839, 2723, 859, 173, 816, 501, 841, 506, 287, - /* 1720 */ 2797, 1939, 433, 1949, 2796, 2793, 515, 526, 2670, 527, - /* 1730 */ 840, 224, 529, 225, 2705, 1810, 716, 227, 375, 543, - /* 1740 */ 1940, 550, 238, 710, 708, 2723, 552, 841, 600, 556, - /* 1750 */ 284, 2705, 558, 563, 587, 576, 2509, 589, 613, 612, - /* 1760 */ 342, 2670, 822, 840, 841, 325, 596, 610, 599, 601, - /* 1770 */ 324, 243, 244, 615, 247, 2723, 2704, 617, 618, 2743, - /* 1780 */ 620, 637, 622, 120, 2706, 844, 2708, 2709, 839, 294, - /* 1790 */ 859, 2670, 2723, 840, 1947, 4, 72, 2797, 638, 71, - /* 1800 */ 646, 827, 2793, 645, 1927, 648, 255, 94, 2670, 842, - /* 1810 */ 840, 1942, 2743, 650, 258, 1948, 120, 2706, 844, 2708, - /* 1820 */ 2709, 839, 651, 859, 1950, 652, 739, 261, 2705, 804, - /* 1830 */ 2797, 654, 263, 1951, 428, 2793, 2532, 95, 1952, 2704, - /* 1840 */ 684, 841, 2743, 2526, 96, 2705, 184, 2706, 844, 2708, - /* 1850 */ 2709, 839, 97, 859, 663, 270, 2704, 410, 841, 2743, - /* 1860 */ 717, 718, 124, 120, 2706, 844, 2708, 2709, 839, 2723, - /* 1870 */ 859, 686, 2600, 2374, 274, 2597, 100, 2797, 2370, 276, - /* 1880 */ 754, 175, 2794, 754, 121, 2670, 2723, 840, 2895, 2372, - /* 1890 */ 2367, 2895, 176, 755, 2855, 177, 2596, 730, 377, 163, - /* 1900 */ 732, 293, 2670, 1943, 840, 2578, 2901, 217, 742, 2901, - /* 1910 */ 217, 2896, 789, 741, 2896, 789, 298, 743, 296, 749, - /* 1920 */ 746, 748, 758, 772, 810, 2705, 8, 456, 2864, 2863, - /* 1930 */ 2836, 303, 781, 2704, 307, 189, 2743, 759, 841, 757, - /* 1940 */ 184, 2706, 844, 2708, 2709, 839, 305, 859, 311, 309, - /* 1950 */ 2704, 756, 312, 2743, 2705, 310, 786, 406, 2706, 844, - /* 1960 */ 2708, 2709, 839, 459, 859, 785, 2723, 841, 2918, 794, - /* 1970 */ 797, 2816, 314, 154, 1944, 2894, 317, 2089, 2087, 203, - /* 1980 */ 323, 2813, 2670, 164, 840, 808, 378, 2546, 2856, 2545, - /* 1990 */ 1, 219, 2544, 379, 463, 2723, 813, 814, 818, 165, - /* 2000 */ 61, 336, 821, 2778, 846, 848, 850, 457, 341, 851, - /* 2010 */ 380, 2670, 110, 840, 2385, 2705, 2662, 112, 1455, 2661, - /* 2020 */ 2657, 953, 861, 2656, 2648, 384, 2647, 956, 841, 2639, - /* 2030 */ 2704, 2638, 2654, 2743, 2653, 2645, 370, 406, 2706, 844, - /* 2040 */ 2708, 2709, 839, 2644, 859, 2633, 52, 174, 2632, 2651, - /* 2050 */ 408, 2705, 958, 2650, 734, 2642, 2723, 396, 386, 2704, - /* 2060 */ 2641, 2630, 2743, 2629, 838, 2627, 399, 2706, 844, 2708, - /* 2070 */ 2709, 839, 2670, 859, 840, 420, 2626, 2436, 407, 397, - /* 2080 */ 2622, 388, 2621, 2620, 425, 83, 426, 2615, 503, 504, - /* 2090 */ 1867, 1868, 2723, 222, 2613, 508, 510, 511, 512, 1866, - /* 2100 */ 2612, 2611, 434, 2609, 518, 2608, 520, 2607, 2670, 2606, - /* 2110 */ 840, 522, 524, 1854, 2582, 226, 2581, 780, 228, 1812, - /* 2120 */ 2704, 84, 1813, 2743, 2559, 2558, 2557, 187, 2706, 844, - /* 2130 */ 2708, 2709, 839, 536, 859, 537, 2556, 2555, 2499, 541, - /* 2140 */ 2705, 1749, 2496, 544, 2495, 2489, 2486, 547, 548, 2485, - /* 2150 */ 2484, 231, 2483, 841, 235, 564, 2704, 87, 2488, 2743, - /* 2160 */ 2487, 2482, 233, 405, 2706, 844, 2708, 2709, 839, 2705, - /* 2170 */ 859, 2481, 2763, 2479, 2478, 2477, 2476, 566, 2474, 2473, - /* 2180 */ 2472, 2723, 841, 2471, 2470, 2494, 2469, 2917, 2468, 2467, - /* 2190 */ 2705, 1755, 237, 2456, 2455, 2454, 93, 2670, 2492, 840, - /* 2200 */ 2475, 2466, 2465, 841, 2464, 2462, 2461, 2460, 2459, 2458, - /* 2210 */ 2723, 2457, 2453, 2452, 2524, 2493, 2491, 2451, 2450, 2705, - /* 2220 */ 2449, 2448, 468, 2447, 242, 603, 2670, 2446, 840, 605, - /* 2230 */ 2445, 2723, 841, 2276, 245, 2275, 246, 422, 2274, 2273, - /* 2240 */ 423, 1602, 2271, 248, 1606, 2704, 2268, 2670, 2743, 840, - /* 2250 */ 2267, 470, 406, 2706, 844, 2708, 2709, 839, 249, 859, - /* 2260 */ 2723, 1598, 623, 2260, 2247, 2221, 627, 1479, 625, 631, - /* 2270 */ 2220, 635, 2580, 629, 2704, 262, 2670, 2743, 840, 253, - /* 2280 */ 624, 406, 2706, 844, 2708, 2709, 839, 633, 859, 628, - /* 2290 */ 198, 80, 632, 251, 2576, 729, 2690, 81, 2743, 2566, - /* 2300 */ 209, 2554, 401, 2706, 844, 2708, 2709, 839, 643, 859, - /* 2310 */ 260, 2553, 2530, 2705, 2523, 265, 267, 2362, 1528, 2270, - /* 2320 */ 2266, 664, 666, 665, 2704, 2264, 841, 2743, 668, 669, - /* 2330 */ 2705, 391, 2706, 844, 2708, 2709, 839, 670, 859, 2262, - /* 2340 */ 672, 673, 674, 841, 2259, 676, 678, 2705, 677, 2242, - /* 2350 */ 2240, 2241, 2239, 2217, 2723, 2364, 1682, 2363, 1683, 1588, - /* 2360 */ 841, 1587, 73, 1586, 1583, 1581, 1579, 1578, 1577, 1576, - /* 2370 */ 2670, 2723, 840, 273, 923, 1575, 925, 1572, 1570, 1571, - /* 2380 */ 2257, 447, 1569, 2255, 448, 2246, 449, 2670, 2723, 840, - /* 2390 */ 2244, 450, 2216, 2215, 2214, 715, 2213, 719, 2212, 723, - /* 2400 */ 712, 126, 721, 1848, 2670, 1850, 840, 1847, 2579, 2575, - /* 2410 */ 2705, 1852, 295, 1819, 2565, 28, 2552, 1823, 2704, 67, - /* 2420 */ 2551, 2743, 1838, 841, 733, 390, 2706, 844, 2708, 2709, - /* 2430 */ 839, 2900, 859, 56, 1821, 2704, 20, 744, 2743, 17, - /* 2440 */ 21, 760, 392, 2706, 844, 2708, 2709, 839, 57, 859, - /* 2450 */ 745, 2723, 2704, 2550, 455, 2743, 6, 299, 764, 398, - /* 2460 */ 2706, 844, 2708, 2709, 839, 22, 859, 2670, 1798, 840, - /* 2470 */ 202, 1797, 178, 750, 752, 7, 214, 32, 2691, 2082, - /* 2480 */ 30, 766, 23, 215, 2084, 2142, 302, 65, 2116, 304, - /* 2490 */ 2705, 762, 24, 2123, 2157, 188, 2529, 201, 2156, 31, - /* 2500 */ 460, 2110, 82, 841, 18, 2080, 2161, 2705, 216, 2160, - /* 2510 */ 461, 2162, 59, 319, 2163, 2704, 2064, 193, 2743, 2063, - /* 2520 */ 841, 2528, 402, 2706, 844, 2708, 2709, 839, 105, 859, - /* 2530 */ 106, 2723, 104, 2705, 2522, 326, 107, 2118, 817, 204, - /* 2540 */ 25, 811, 13, 332, 69, 2016, 841, 2670, 2723, 840, - /* 2550 */ 1932, 334, 335, 2015, 58, 11, 2026, 194, 205, 1991, - /* 2560 */ 1990, 874, 877, 1967, 2670, 880, 840, 883, 38, 16, - /* 2570 */ 2705, 2521, 1989, 26, 2723, 843, 1959, 108, 27, 70, - /* 2580 */ 339, 819, 345, 841, 847, 1993, 2178, 109, 2177, 2748, - /* 2590 */ 2670, 2747, 840, 337, 858, 2704, 68, 113, 2743, 2176, - /* 2600 */ 860, 1664, 393, 2706, 844, 2708, 2709, 839, 868, 859, - /* 2610 */ 866, 2723, 2704, 486, 1661, 2743, 870, 1660, 871, 403, - /* 2620 */ 2706, 844, 2708, 2709, 839, 873, 859, 2670, 849, 840, - /* 2630 */ 1657, 2705, 876, 1651, 879, 882, 2175, 1649, 2704, 114, - /* 2640 */ 1655, 2743, 369, 115, 841, 394, 2706, 844, 2708, 2709, - /* 2650 */ 839, 1654, 859, 1677, 2705, 79, 1653, 1673, 1652, 1526, - /* 2660 */ 897, 1566, 1565, 1564, 1561, 1558, 1557, 841, 1556, 1555, - /* 2670 */ 1553, 1551, 2723, 1550, 1549, 2704, 1596, 911, 2743, 1595, - /* 2680 */ 220, 913, 404, 2706, 844, 2708, 2709, 839, 2670, 859, - /* 2690 */ 840, 1547, 1546, 1545, 1544, 2723, 1543, 1542, 1541, 1592, - /* 2700 */ 1590, 1538, 1537, 1534, 1533, 1532, 1531, 2265, 933, 934, - /* 2710 */ 935, 2670, 2263, 840, 937, 2705, 939, 2261, 941, 2258, - /* 2720 */ 943, 945, 938, 2238, 947, 942, 949, 946, 841, 1468, - /* 2730 */ 951, 2211, 1456, 955, 2181, 373, 2704, 2236, 1918, 2743, - /* 2740 */ 2705, 957, 960, 395, 2706, 844, 2708, 2709, 839, 385, - /* 2750 */ 859, 2181, 961, 841, 2181, 2181, 2723, 2181, 2181, 2704, - /* 2760 */ 2181, 2181, 2743, 2181, 2181, 2181, 411, 2706, 844, 2708, - /* 2770 */ 2709, 839, 2670, 859, 840, 2181, 2181, 2181, 2181, 2181, - /* 2780 */ 2181, 2723, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, - /* 2790 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2670, 2181, 840, - /* 2800 */ 2181, 2705, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, - /* 2810 */ 2181, 2181, 2181, 2181, 841, 2181, 2181, 2181, 2181, 2181, - /* 2820 */ 2704, 2181, 2705, 2743, 2181, 2181, 2181, 412, 2706, 844, - /* 2830 */ 2708, 2709, 839, 2181, 859, 841, 2181, 2181, 2181, 2181, - /* 2840 */ 2181, 2181, 2723, 2181, 2181, 2704, 2181, 2181, 2743, 2181, - /* 2850 */ 2181, 2181, 2717, 2706, 844, 2708, 2709, 839, 2670, 859, - /* 2860 */ 840, 2181, 2181, 2723, 2181, 2181, 2181, 2181, 2181, 2181, - /* 2870 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2670, - /* 2880 */ 2181, 840, 2181, 2705, 2181, 2181, 2181, 2181, 2181, 2181, - /* 2890 */ 2181, 2181, 2181, 2181, 2181, 2181, 841, 2181, 2181, 2181, - /* 2900 */ 2181, 2181, 2181, 2181, 2181, 2181, 2704, 2181, 2181, 2743, - /* 2910 */ 2181, 2181, 2181, 2716, 2706, 844, 2708, 2709, 839, 2181, - /* 2920 */ 859, 2181, 2181, 2181, 2723, 2181, 2181, 2704, 2181, 2181, - /* 2930 */ 2743, 2181, 2181, 2181, 2715, 2706, 844, 2708, 2709, 839, - /* 2940 */ 2670, 859, 840, 2181, 2705, 2181, 2181, 2181, 2181, 2181, - /* 2950 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 841, 2181, 2181, - /* 2960 */ 2181, 2181, 2181, 2705, 2181, 2181, 2181, 2181, 2181, 2181, - /* 2970 */ 2181, 2181, 2181, 2181, 2181, 2181, 841, 2181, 2181, 2181, - /* 2980 */ 2181, 2181, 2181, 2181, 2181, 2723, 2181, 2181, 2704, 2181, - /* 2990 */ 2181, 2743, 2181, 2181, 2181, 430, 2706, 844, 2708, 2709, - /* 3000 */ 839, 2670, 859, 840, 2723, 2181, 2181, 2181, 2181, 2181, - /* 3010 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, - /* 3020 */ 2670, 2181, 840, 2181, 2705, 2181, 2181, 2181, 2181, 2181, - /* 3030 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 841, 2181, 2181, - /* 3040 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2704, - /* 3050 */ 2181, 2181, 2743, 2181, 2181, 2181, 431, 2706, 844, 2708, - /* 3060 */ 2709, 839, 2181, 859, 2181, 2723, 2181, 2181, 2704, 2181, - /* 3070 */ 2181, 2743, 2181, 2181, 2181, 427, 2706, 844, 2708, 2709, - /* 3080 */ 839, 2670, 859, 840, 2181, 2181, 2181, 2181, 2181, 2181, - /* 3090 */ 2181, 2181, 2181, 2705, 2181, 2181, 2181, 2181, 2181, 2181, - /* 3100 */ 2181, 2181, 2181, 2181, 2181, 2181, 841, 2181, 2705, 2181, - /* 3110 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, - /* 3120 */ 2181, 841, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2704, - /* 3130 */ 2181, 2181, 2743, 2181, 2723, 2181, 432, 2706, 844, 2708, - /* 3140 */ 2709, 839, 2181, 859, 2181, 2181, 2181, 2181, 2181, 2723, - /* 3150 */ 2670, 2181, 840, 2181, 2181, 2181, 2181, 2181, 2181, 2181, - /* 3160 */ 2181, 2181, 2181, 2181, 2181, 2670, 2181, 840, 2181, 2181, - /* 3170 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, - /* 3180 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, - /* 3190 */ 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 842, 2181, - /* 3200 */ 2181, 2743, 2181, 2181, 2181, 401, 2706, 844, 2708, 2709, - /* 3210 */ 839, 2181, 859, 2704, 2181, 2181, 2743, 2181, 2181, 2181, - /* 3220 */ 400, 2706, 844, 2708, 2709, 839, 2181, 859, + /* 80 */ 1923, 2270, 802, 155, 2671, 210, 842, 726, 136, 2687, + /* 90 */ 2690, 135, 134, 133, 132, 131, 130, 129, 128, 127, + /* 100 */ 861, 2432, 724, 252, 722, 286, 285, 644, 2705, 2234, + /* 110 */ 961, 2744, 2813, 15, 1943, 119, 2707, 846, 2709, 2710, + /* 120 */ 841, 649, 861, 103, 642, 2226, 197, 199, 856, 2798, + /* 130 */ 646, 2140, 2705, 467, 2794, 2744, 643, 62, 2809, 406, + /* 140 */ 2707, 846, 2709, 2710, 841, 839, 861, 825, 2763, 2007, + /* 150 */ 2008, 50, 439, 218, 2512, 755, 934, 933, 932, 931, + /* 160 */ 499, 2845, 930, 929, 160, 924, 923, 922, 921, 920, + /* 170 */ 919, 918, 159, 912, 911, 910, 498, 497, 907, 906, + /* 180 */ 905, 196, 195, 904, 494, 903, 902, 901, 1978, 1988, + /* 190 */ 804, 185, 2806, 2807, 780, 153, 2811, 290, 2006, 2009, + /* 200 */ 802, 155, 1763, 1764, 192, 2806, 801, 581, 147, 800, + /* 210 */ 790, 2664, 580, 1918, 487, 1916, 2896, 9, 2896, 2100, + /* 220 */ 579, 1927, 40, 39, 739, 1942, 46, 44, 43, 42, + /* 230 */ 41, 2361, 2706, 2206, 789, 217, 789, 217, 122, 2897, + /* 240 */ 791, 2897, 791, 1690, 1691, 843, 2389, 489, 2387, 1921, + /* 250 */ 1922, 1975, 779, 1977, 1980, 1981, 1982, 1983, 1984, 1985, + /* 260 */ 1986, 1987, 838, 859, 858, 1999, 2001, 2002, 2003, 2004, + /* 270 */ 2, 47, 45, 2724, 917, 476, 415, 2345, 1940, 471, + /* 280 */ 2724, 1917, 1844, 1845, 2901, 588, 861, 431, 609, 2671, + /* 290 */ 2671, 842, 2896, 608, 2005, 60, 1915, 40, 39, 455, + /* 300 */ 2586, 46, 44, 43, 42, 41, 753, 2015, 736, 1946, + /* 310 */ 567, 2900, 610, 1942, 197, 2897, 2899, 416, 569, 1499, + /* 320 */ 322, 1498, 125, 2806, 2807, 2000, 153, 2811, 180, 547, + /* 330 */ 857, 2385, 19, 664, 322, 2034, 151, 2705, 2388, 1923, + /* 340 */ 2744, 2071, 2513, 775, 119, 2707, 846, 2709, 2710, 841, + /* 350 */ 221, 861, 1472, 778, 157, 1500, 166, 2769, 2798, 2183, + /* 360 */ 40, 39, 467, 2794, 46, 44, 43, 42, 41, 961, + /* 370 */ 440, 1479, 15, 898, 172, 171, 895, 894, 893, 169, + /* 380 */ 1946, 555, 1942, 145, 144, 143, 142, 141, 140, 139, + /* 390 */ 138, 137, 657, 1979, 1474, 1477, 1478, 537, 62, 40, + /* 400 */ 39, 2035, 536, 46, 44, 43, 42, 41, 2007, 2008, + /* 410 */ 661, 2519, 2498, 660, 596, 595, 594, 593, 592, 587, + /* 420 */ 586, 585, 584, 423, 29, 1975, 2071, 574, 573, 572, + /* 430 */ 571, 570, 564, 563, 562, 254, 557, 556, 438, 644, + /* 440 */ 856, 2234, 548, 1751, 1752, 329, 330, 1978, 1988, 1770, + /* 450 */ 328, 756, 781, 776, 769, 765, 1976, 2006, 2009, 2896, + /* 460 */ 2818, 2068, 2069, 2070, 2818, 2818, 2818, 2818, 2818, 2526, + /* 470 */ 2376, 662, 1918, 521, 1916, 62, 900, 2902, 217, 213, + /* 480 */ 740, 1979, 2897, 791, 857, 2385, 857, 2385, 36, 469, + /* 490 */ 2029, 2030, 2031, 2032, 2033, 2037, 2038, 2039, 2040, 2073, + /* 500 */ 2074, 2075, 2076, 2077, 146, 2141, 55, 377, 1921, 1922, + /* 510 */ 1975, 687, 1977, 1980, 1981, 1982, 1983, 1984, 1985, 1986, + /* 520 */ 1987, 838, 859, 858, 1999, 2001, 2002, 2003, 2004, 2, + /* 530 */ 12, 47, 45, 50, 476, 1926, 2706, 2539, 181, 471, + /* 540 */ 1947, 1917, 116, 390, 1976, 861, 2068, 2069, 2070, 805, + /* 550 */ 208, 113, 473, 600, 2005, 1590, 1915, 2171, 2536, 847, + /* 560 */ 388, 76, 651, 2578, 75, 2706, 40, 39, 454, 2586, + /* 570 */ 46, 44, 43, 42, 41, 417, 737, 2724, 843, 2071, + /* 580 */ 2236, 322, 1943, 1923, 2681, 2000, 2901, 250, 623, 621, + /* 590 */ 618, 616, 19, 2671, 2896, 842, 40, 39, 1592, 1923, + /* 600 */ 46, 44, 43, 42, 41, 2491, 2724, 708, 707, 706, + /* 610 */ 525, 1947, 2685, 2900, 698, 152, 702, 2897, 2898, 241, + /* 620 */ 701, 2539, 2671, 658, 842, 700, 705, 448, 447, 961, + /* 630 */ 914, 699, 15, 62, 98, 446, 695, 694, 693, 527, + /* 640 */ 523, 2705, 2537, 847, 2744, 599, 240, 551, 119, 2707, + /* 650 */ 846, 2709, 2710, 841, 797, 861, 857, 2385, 322, 597, + /* 660 */ 199, 2381, 2798, 2687, 2689, 468, 467, 2794, 2007, 2008, + /* 670 */ 2705, 63, 2112, 2744, 861, 2170, 146, 119, 2707, 846, + /* 680 */ 2709, 2710, 841, 692, 861, 12, 2129, 659, 2532, 2916, + /* 690 */ 183, 2798, 2195, 51, 2846, 467, 2794, 916, 2818, 2068, + /* 700 */ 2069, 2070, 2818, 2818, 2818, 2818, 2818, 1978, 1988, 35, + /* 710 */ 1945, 1790, 1791, 1929, 2181, 40, 39, 2006, 2009, 46, + /* 720 */ 44, 43, 42, 41, 2359, 86, 85, 540, 2439, 2440, + /* 730 */ 229, 2093, 1918, 2445, 1916, 46, 44, 43, 42, 41, + /* 740 */ 98, 437, 2624, 532, 530, 772, 771, 2127, 2128, 2130, + /* 750 */ 2131, 2132, 2443, 12, 289, 10, 414, 441, 288, 519, + /* 760 */ 1789, 1792, 515, 511, 507, 504, 533, 2380, 1921, 1922, + /* 770 */ 1975, 1585, 1977, 1980, 1981, 1982, 1983, 1984, 1985, 1986, + /* 780 */ 1987, 838, 859, 858, 1999, 2001, 2002, 2003, 2004, 2, + /* 790 */ 47, 45, 2010, 1499, 2706, 1498, 756, 482, 471, 236, + /* 800 */ 1917, 502, 180, 867, 2896, 891, 501, 843, 2901, 2853, + /* 810 */ 2665, 489, 2387, 2005, 1586, 1915, 322, 491, 2706, 78, + /* 820 */ 2438, 2440, 2902, 217, 1602, 1945, 2813, 2897, 791, 1500, + /* 830 */ 790, 843, 101, 2866, 638, 2724, 1942, 426, 2896, 1601, + /* 840 */ 453, 2445, 728, 636, 2000, 92, 632, 628, 91, 464, + /* 850 */ 211, 2671, 2808, 842, 831, 756, 789, 217, 1923, 2724, + /* 860 */ 2443, 2897, 791, 2896, 857, 2385, 898, 172, 171, 895, + /* 870 */ 894, 893, 169, 89, 476, 2671, 322, 842, 445, 444, + /* 880 */ 320, 2902, 217, 485, 541, 861, 2897, 791, 961, 2464, + /* 890 */ 2372, 48, 898, 172, 171, 895, 894, 893, 169, 2705, + /* 900 */ 1502, 1503, 2744, 3, 2706, 740, 119, 2707, 846, 2709, + /* 910 */ 2710, 841, 611, 861, 1917, 53, 90, 843, 2916, 2164, + /* 920 */ 2798, 857, 2385, 2705, 467, 2794, 2744, 2007, 2008, 1915, + /* 930 */ 119, 2707, 846, 2709, 2710, 841, 826, 861, 2770, 553, + /* 940 */ 2508, 542, 2916, 798, 2798, 2724, 559, 2508, 467, 2794, + /* 950 */ 474, 866, 865, 864, 857, 2385, 443, 442, 179, 689, + /* 960 */ 2445, 2671, 828, 842, 2770, 2706, 1978, 1988, 475, 2390, + /* 970 */ 857, 2385, 1923, 1479, 663, 1886, 2006, 2009, 843, 2443, + /* 980 */ 767, 691, 376, 857, 2385, 690, 2445, 742, 2578, 297, + /* 990 */ 561, 1918, 232, 1916, 490, 320, 2121, 1477, 1478, 234, + /* 1000 */ 590, 2508, 961, 575, 1979, 2443, 2724, 481, 480, 2705, + /* 1010 */ 62, 2122, 2744, 1946, 683, 682, 187, 2707, 846, 2709, + /* 1020 */ 2710, 841, 2671, 861, 842, 2092, 2205, 1921, 1922, 1975, + /* 1030 */ 2026, 1977, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, + /* 1040 */ 838, 859, 858, 1999, 2001, 2002, 2003, 2004, 2, 47, + /* 1050 */ 45, 2706, 492, 239, 2120, 583, 582, 471, 383, 1917, + /* 1060 */ 179, 1885, 685, 684, 843, 102, 2889, 1976, 857, 2385, + /* 1070 */ 2705, 2390, 2005, 2744, 1915, 792, 2917, 119, 2707, 846, + /* 1080 */ 2709, 2710, 841, 2671, 861, 704, 703, 2706, 576, 2916, + /* 1090 */ 182, 2798, 2724, 484, 483, 467, 2794, 1606, 2319, 1818, + /* 1100 */ 843, 2204, 2830, 2000, 1651, 1918, 2389, 1916, 2671, 535, + /* 1110 */ 842, 534, 1605, 111, 14, 13, 2203, 1923, 1642, 890, + /* 1120 */ 889, 888, 1646, 887, 1648, 1649, 886, 883, 2724, 1657, + /* 1130 */ 880, 1659, 1660, 877, 874, 871, 2196, 857, 2385, 2378, + /* 1140 */ 2320, 1921, 1922, 533, 2671, 117, 842, 961, 2706, 2900, + /* 1150 */ 48, 2036, 857, 2385, 857, 2385, 2705, 577, 2671, 2744, + /* 1160 */ 2360, 843, 158, 119, 2707, 846, 2709, 2710, 841, 377, + /* 1170 */ 861, 2377, 2382, 2671, 292, 2916, 2202, 2798, 857, 2385, + /* 1180 */ 190, 467, 2794, 212, 148, 613, 2007, 2008, 1481, 2724, + /* 1190 */ 857, 2385, 2705, 322, 1941, 2744, 88, 2201, 300, 119, + /* 1200 */ 2707, 846, 2709, 2710, 841, 2671, 861, 842, 857, 2385, + /* 1210 */ 808, 2916, 2200, 2798, 496, 495, 2199, 467, 2794, 2198, + /* 1220 */ 857, 2385, 857, 2385, 1931, 1978, 1988, 2048, 333, 857, + /* 1230 */ 2385, 2587, 900, 2671, 2859, 2006, 2009, 2005, 34, 1924, + /* 1240 */ 822, 1946, 340, 1942, 1947, 43, 42, 41, 2041, 854, + /* 1250 */ 1918, 2592, 1916, 2705, 2671, 2611, 2744, 857, 2385, 773, + /* 1260 */ 119, 2707, 846, 2709, 2710, 841, 2197, 861, 2000, 2671, + /* 1270 */ 928, 926, 2773, 2671, 2798, 2194, 2671, 855, 467, 2794, + /* 1280 */ 156, 691, 1923, 2769, 2193, 690, 1921, 1922, 1975, 2273, + /* 1290 */ 1977, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 838, + /* 1300 */ 859, 858, 1999, 2001, 2002, 2003, 2004, 2, 47, 45, + /* 1310 */ 2192, 2706, 830, 291, 857, 2385, 471, 2191, 1917, 857, + /* 1320 */ 2385, 2190, 2189, 2671, 843, 308, 179, 2625, 1651, 784, + /* 1330 */ 2188, 2005, 2671, 1915, 368, 892, 794, 2391, 2436, 493, + /* 1340 */ 2187, 2671, 1642, 890, 889, 888, 1646, 887, 1648, 1649, + /* 1350 */ 837, 836, 2724, 1657, 835, 1659, 1660, 834, 874, 871, + /* 1360 */ 896, 2186, 2000, 2436, 708, 707, 706, 2671, 2671, 170, + /* 1370 */ 842, 698, 152, 702, 2671, 316, 1923, 701, 2671, 2671, + /* 1380 */ 2445, 756, 700, 705, 448, 447, 2445, 2671, 699, 2896, + /* 1390 */ 2238, 2445, 446, 695, 694, 693, 2082, 2671, 516, 809, + /* 1400 */ 897, 802, 155, 2436, 2615, 817, 961, 2902, 217, 15, + /* 1410 */ 2444, 384, 2897, 791, 2422, 1932, 2705, 1927, 2671, 2744, + /* 1420 */ 2211, 956, 223, 119, 2707, 846, 2709, 2710, 841, 277, + /* 1430 */ 861, 279, 275, 281, 278, 2771, 280, 2798, 421, 420, + /* 1440 */ 2362, 467, 2794, 952, 283, 2007, 2008, 282, 477, 162, + /* 1450 */ 54, 1935, 1937, 162, 696, 697, 509, 730, 2692, 729, + /* 1460 */ 272, 2005, 2706, 486, 793, 859, 858, 1999, 2001, 2002, + /* 1470 */ 2003, 2004, 1947, 161, 1976, 843, 2257, 191, 1583, 1581, + /* 1480 */ 2255, 2173, 2174, 1563, 1978, 1988, 681, 677, 673, 669, + /* 1490 */ 2246, 271, 2000, 2244, 2006, 2009, 207, 803, 709, 150, + /* 1500 */ 40, 39, 711, 2724, 46, 44, 43, 42, 41, 1918, + /* 1510 */ 763, 1916, 713, 2725, 49, 716, 170, 908, 49, 2671, + /* 1520 */ 200, 842, 2694, 186, 2806, 2807, 1564, 153, 2811, 327, + /* 1530 */ 1834, 2312, 77, 2311, 1842, 64, 2517, 99, 347, 346, + /* 1540 */ 269, 1555, 14, 13, 49, 1921, 1922, 1975, 2227, 1977, + /* 1550 */ 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 838, 859, + /* 1560 */ 858, 1999, 2001, 2002, 2003, 2004, 2, 2705, 49, 738, + /* 1570 */ 2744, 77, 349, 348, 119, 2707, 846, 2709, 2710, 841, + /* 1580 */ 167, 861, 733, 170, 351, 350, 827, 964, 2798, 353, + /* 1590 */ 352, 2116, 467, 2794, 2706, 2126, 74, 807, 869, 2125, + /* 1600 */ 168, 306, 2849, 374, 355, 354, 170, 843, 257, 770, + /* 1610 */ 331, 460, 777, 814, 357, 356, 2042, 268, 456, 954, + /* 1620 */ 206, 259, 266, 795, 149, 1989, 1925, 264, 655, 950, + /* 1630 */ 946, 942, 938, 167, 371, 2724, 756, 811, 500, 1908, + /* 1640 */ 518, 1884, 359, 358, 2896, 909, 256, 361, 360, 1787, + /* 1650 */ 2518, 2671, 1777, 842, 363, 362, 365, 364, 1536, 367, + /* 1660 */ 366, 343, 2902, 217, 1633, 2233, 749, 2897, 791, 1553, + /* 1670 */ 2433, 2706, 785, 479, 478, 1909, 2850, 382, 2860, 1664, + /* 1680 */ 118, 1672, 123, 344, 843, 786, 318, 1679, 715, 859, + /* 1690 */ 858, 1999, 2001, 2002, 2003, 2004, 313, 321, 2346, 2705, + /* 1700 */ 5, 1537, 2744, 727, 2706, 1677, 120, 2707, 846, 2709, + /* 1710 */ 2710, 841, 2724, 861, 173, 818, 503, 843, 508, 287, + /* 1720 */ 2798, 1940, 435, 1950, 2797, 2794, 517, 528, 2671, 529, + /* 1730 */ 842, 224, 531, 225, 2706, 1811, 718, 227, 375, 545, + /* 1740 */ 1941, 552, 238, 712, 710, 2724, 554, 843, 602, 558, + /* 1750 */ 284, 2706, 560, 565, 589, 578, 2510, 591, 615, 614, + /* 1760 */ 342, 2671, 824, 842, 843, 325, 598, 612, 601, 603, + /* 1770 */ 324, 243, 244, 617, 247, 2724, 2705, 619, 620, 2744, + /* 1780 */ 622, 639, 624, 120, 2707, 846, 2709, 2710, 841, 294, + /* 1790 */ 861, 2671, 2724, 842, 1948, 4, 72, 2798, 640, 71, + /* 1800 */ 648, 829, 2794, 647, 1928, 650, 255, 94, 2671, 844, + /* 1810 */ 842, 1943, 2744, 652, 258, 1949, 120, 2707, 846, 2709, + /* 1820 */ 2710, 841, 653, 861, 1951, 654, 741, 261, 2706, 806, + /* 1830 */ 2798, 656, 263, 1952, 430, 2794, 2533, 95, 1953, 2705, + /* 1840 */ 686, 843, 2744, 2527, 96, 2706, 184, 2707, 846, 2709, + /* 1850 */ 2710, 841, 97, 861, 665, 270, 2705, 411, 843, 2744, + /* 1860 */ 719, 720, 124, 120, 2707, 846, 2709, 2710, 841, 2724, + /* 1870 */ 861, 688, 2601, 2375, 274, 2598, 100, 2798, 2371, 276, + /* 1880 */ 756, 175, 2795, 756, 121, 2671, 2724, 842, 2896, 2373, + /* 1890 */ 2368, 2896, 176, 757, 2856, 177, 2597, 732, 378, 163, + /* 1900 */ 734, 293, 2671, 1944, 842, 2579, 2902, 217, 744, 2902, + /* 1910 */ 217, 2897, 791, 743, 2897, 791, 298, 745, 296, 751, + /* 1920 */ 748, 750, 760, 774, 812, 2706, 8, 458, 2865, 2864, + /* 1930 */ 2837, 303, 783, 2705, 307, 189, 2744, 761, 843, 759, + /* 1940 */ 184, 2707, 846, 2709, 2710, 841, 305, 861, 311, 309, + /* 1950 */ 2705, 758, 312, 2744, 2706, 310, 788, 407, 2707, 846, + /* 1960 */ 2709, 2710, 841, 461, 861, 787, 2724, 843, 2919, 796, + /* 1970 */ 799, 2817, 314, 154, 1945, 2895, 317, 2090, 2088, 203, + /* 1980 */ 323, 2814, 2671, 164, 842, 810, 379, 2547, 2857, 2546, + /* 1990 */ 1, 219, 2545, 380, 465, 2724, 815, 816, 820, 165, + /* 2000 */ 61, 336, 823, 2779, 848, 850, 852, 459, 341, 853, + /* 2010 */ 381, 2671, 110, 842, 2386, 2706, 2663, 112, 1456, 2662, + /* 2020 */ 2658, 955, 863, 2657, 2649, 385, 2648, 958, 843, 2640, + /* 2030 */ 2705, 2639, 2655, 2744, 2654, 2646, 370, 407, 2707, 846, + /* 2040 */ 2709, 2710, 841, 2645, 861, 2634, 52, 174, 2633, 2652, + /* 2050 */ 419, 2706, 960, 2651, 736, 2643, 2724, 397, 387, 2705, + /* 2060 */ 2642, 2631, 2744, 2630, 840, 2628, 400, 2707, 846, 2709, + /* 2070 */ 2710, 841, 2671, 861, 842, 422, 2627, 2437, 408, 398, + /* 2080 */ 409, 389, 2623, 2622, 427, 2621, 83, 2616, 505, 428, + /* 2090 */ 506, 1868, 2724, 1869, 222, 510, 2614, 512, 513, 514, + /* 2100 */ 1867, 2613, 2612, 436, 2610, 520, 2609, 522, 2671, 2608, + /* 2110 */ 842, 524, 2607, 526, 1855, 2583, 226, 782, 2582, 228, + /* 2120 */ 2705, 84, 1814, 2744, 1813, 2560, 2559, 187, 2707, 846, + /* 2130 */ 2709, 2710, 841, 2558, 861, 538, 539, 2557, 2556, 2500, + /* 2140 */ 2706, 543, 1750, 2497, 546, 2496, 2490, 549, 2487, 550, + /* 2150 */ 2486, 2485, 231, 843, 233, 2488, 2705, 2484, 87, 2744, + /* 2160 */ 2489, 2483, 2482, 406, 2707, 846, 2709, 2710, 841, 2706, + /* 2170 */ 861, 2480, 2764, 2479, 2478, 235, 566, 2477, 568, 2475, + /* 2180 */ 2474, 2724, 843, 2473, 2472, 2471, 2495, 2918, 2470, 2469, + /* 2190 */ 2706, 237, 2457, 2456, 93, 2455, 2454, 2671, 2468, 842, + /* 2200 */ 2493, 2476, 2467, 843, 2466, 2465, 2463, 2462, 2461, 2460, + /* 2210 */ 2724, 2459, 2458, 2453, 2525, 2494, 2492, 2452, 2451, 2706, + /* 2220 */ 2450, 1756, 470, 242, 2449, 605, 2671, 2448, 842, 607, + /* 2230 */ 2447, 2724, 843, 2446, 2277, 245, 2276, 424, 246, 2275, + /* 2240 */ 425, 1603, 248, 1607, 2274, 2705, 2272, 2671, 2744, 842, + /* 2250 */ 2269, 472, 407, 2707, 846, 2709, 2710, 841, 2268, 861, + /* 2260 */ 2724, 2261, 1599, 249, 627, 625, 629, 2248, 631, 633, + /* 2270 */ 2222, 1480, 2221, 635, 2705, 626, 2671, 2744, 842, 637, + /* 2280 */ 80, 407, 2707, 846, 2709, 2710, 841, 630, 861, 634, + /* 2290 */ 251, 81, 198, 2581, 2577, 731, 2691, 209, 2744, 253, + /* 2300 */ 645, 2567, 402, 2707, 846, 2709, 2710, 841, 2555, 861, + /* 2310 */ 260, 2554, 262, 2706, 265, 2531, 2524, 2363, 267, 2271, + /* 2320 */ 2267, 666, 668, 667, 2705, 2265, 843, 2744, 1529, 670, + /* 2330 */ 2706, 392, 2707, 846, 2709, 2710, 841, 671, 861, 672, + /* 2340 */ 2263, 674, 675, 843, 676, 2260, 678, 2706, 679, 680, + /* 2350 */ 2243, 2241, 2242, 2240, 2724, 2218, 2365, 1683, 1684, 2364, + /* 2360 */ 843, 73, 273, 1589, 1588, 1587, 1584, 1582, 1580, 1579, + /* 2370 */ 2671, 2724, 842, 2258, 1578, 1577, 1576, 925, 2256, 927, + /* 2380 */ 1573, 2247, 1571, 2245, 1572, 1570, 449, 2671, 2724, 842, + /* 2390 */ 450, 451, 452, 2217, 717, 2216, 714, 2215, 2214, 721, + /* 2400 */ 723, 2213, 725, 1849, 2671, 126, 842, 2580, 1851, 1848, + /* 2410 */ 2706, 2576, 1853, 28, 295, 2566, 67, 2553, 2705, 1820, + /* 2420 */ 1839, 2744, 1822, 843, 746, 391, 2707, 846, 2709, 2710, + /* 2430 */ 841, 56, 861, 2552, 2901, 2705, 20, 17, 2744, 30, + /* 2440 */ 6, 762, 393, 2707, 846, 2709, 2710, 841, 2143, 861, + /* 2450 */ 57, 2724, 2705, 457, 747, 2744, 1799, 21, 299, 399, + /* 2460 */ 2707, 846, 2709, 2710, 841, 766, 861, 2671, 1798, 842, + /* 2470 */ 7, 302, 22, 752, 754, 1824, 214, 202, 735, 178, + /* 2480 */ 32, 2117, 23, 2692, 768, 2083, 215, 764, 2085, 188, + /* 2490 */ 2706, 304, 65, 2124, 24, 2158, 2157, 201, 319, 31, + /* 2500 */ 462, 2111, 82, 843, 18, 2081, 2163, 2706, 2164, 216, + /* 2510 */ 2162, 2161, 463, 2065, 59, 2705, 193, 2551, 2744, 2530, + /* 2520 */ 843, 104, 403, 2707, 846, 2709, 2710, 841, 2064, 861, + /* 2530 */ 105, 2724, 326, 2706, 2529, 2119, 204, 106, 332, 69, + /* 2540 */ 2523, 335, 813, 819, 107, 25, 843, 2671, 2724, 842, + /* 2550 */ 13, 2017, 2016, 11, 1933, 2027, 1992, 194, 205, 1991, + /* 2560 */ 1990, 58, 1960, 876, 2671, 879, 842, 882, 885, 38, + /* 2570 */ 2706, 1968, 2522, 16, 2724, 26, 845, 27, 70, 108, + /* 2580 */ 849, 339, 109, 843, 345, 334, 1994, 868, 2179, 2749, + /* 2590 */ 2671, 2748, 842, 113, 1665, 2705, 860, 68, 2744, 821, + /* 2600 */ 862, 337, 394, 2707, 846, 2709, 2710, 841, 2178, 861, + /* 2610 */ 488, 2724, 2705, 2177, 870, 2744, 872, 1662, 873, 404, + /* 2620 */ 2707, 846, 2709, 2710, 841, 851, 861, 2671, 1661, 842, + /* 2630 */ 875, 2706, 1658, 878, 1652, 881, 2176, 1650, 2705, 884, + /* 2640 */ 1656, 2744, 114, 369, 843, 395, 2707, 846, 2709, 2710, + /* 2650 */ 841, 115, 861, 1678, 2706, 1655, 1654, 79, 1653, 1674, + /* 2660 */ 1567, 1527, 899, 1566, 1565, 1562, 1559, 843, 1558, 1557, + /* 2670 */ 1556, 1554, 2724, 1552, 1597, 2705, 1551, 1550, 2744, 1596, + /* 2680 */ 220, 913, 405, 2707, 846, 2709, 2710, 841, 2671, 861, + /* 2690 */ 842, 1548, 915, 1547, 1546, 2724, 1545, 1544, 1543, 1542, + /* 2700 */ 1593, 1591, 1539, 1538, 1535, 1534, 1533, 1532, 2266, 935, + /* 2710 */ 936, 2671, 2264, 842, 939, 2706, 2262, 937, 941, 943, + /* 2720 */ 945, 940, 2259, 944, 947, 948, 2239, 949, 843, 951, + /* 2730 */ 2237, 953, 1469, 2212, 957, 1457, 2705, 373, 959, 2744, + /* 2740 */ 2706, 1919, 386, 396, 2707, 846, 2709, 2710, 841, 962, + /* 2750 */ 861, 963, 2182, 843, 2182, 2182, 2724, 2182, 2182, 2705, + /* 2760 */ 2182, 2182, 2744, 2182, 2182, 2182, 412, 2707, 846, 2709, + /* 2770 */ 2710, 841, 2671, 861, 842, 2182, 2182, 2182, 2182, 2182, + /* 2780 */ 2182, 2724, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + /* 2790 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2671, 2182, 842, + /* 2800 */ 2182, 2706, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + /* 2810 */ 2182, 2182, 2182, 2182, 843, 2182, 2182, 2182, 2182, 2182, + /* 2820 */ 2705, 2182, 2706, 2744, 2182, 2182, 2182, 413, 2707, 846, + /* 2830 */ 2709, 2710, 841, 2182, 861, 843, 2182, 2182, 2182, 2182, + /* 2840 */ 2182, 2182, 2724, 2182, 2182, 2705, 2182, 2182, 2744, 2182, + /* 2850 */ 2182, 2182, 2718, 2707, 846, 2709, 2710, 841, 2671, 861, + /* 2860 */ 842, 2182, 2182, 2724, 2182, 2182, 2182, 2182, 2182, 2182, + /* 2870 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2671, + /* 2880 */ 2182, 842, 2182, 2706, 2182, 2182, 2182, 2182, 2182, 2182, + /* 2890 */ 2182, 2182, 2182, 2182, 2182, 2182, 843, 2182, 2182, 2182, + /* 2900 */ 2182, 2182, 2182, 2182, 2182, 2182, 2705, 2182, 2182, 2744, + /* 2910 */ 2182, 2182, 2182, 2717, 2707, 846, 2709, 2710, 841, 2182, + /* 2920 */ 861, 2182, 2182, 2182, 2724, 2182, 2182, 2705, 2182, 2182, + /* 2930 */ 2744, 2182, 2182, 2182, 2716, 2707, 846, 2709, 2710, 841, + /* 2940 */ 2671, 861, 842, 2182, 2706, 2182, 2182, 2182, 2182, 2182, + /* 2950 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 843, 2182, 2182, + /* 2960 */ 2182, 2182, 2182, 2706, 2182, 2182, 2182, 2182, 2182, 2182, + /* 2970 */ 2182, 2182, 2182, 2182, 2182, 2182, 843, 2182, 2182, 2182, + /* 2980 */ 2182, 2182, 2182, 2182, 2182, 2724, 2182, 2182, 2705, 2182, + /* 2990 */ 2182, 2744, 2182, 2182, 2182, 432, 2707, 846, 2709, 2710, + /* 3000 */ 841, 2671, 861, 842, 2724, 2182, 2182, 2182, 2182, 2182, + /* 3010 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + /* 3020 */ 2671, 2182, 842, 2182, 2706, 2182, 2182, 2182, 2182, 2182, + /* 3030 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 843, 2182, 2182, + /* 3040 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2705, + /* 3050 */ 2182, 2182, 2744, 2182, 2182, 2182, 433, 2707, 846, 2709, + /* 3060 */ 2710, 841, 2182, 861, 2182, 2724, 2182, 2182, 2705, 2182, + /* 3070 */ 2182, 2744, 2182, 2182, 2182, 429, 2707, 846, 2709, 2710, + /* 3080 */ 841, 2671, 861, 842, 2182, 2182, 2182, 2182, 2182, 2182, + /* 3090 */ 2182, 2182, 2182, 2706, 2182, 2182, 2182, 2182, 2182, 2182, + /* 3100 */ 2182, 2182, 2182, 2182, 2182, 2182, 843, 2182, 2706, 2182, + /* 3110 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + /* 3120 */ 2182, 843, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2705, + /* 3130 */ 2182, 2182, 2744, 2182, 2724, 2182, 434, 2707, 846, 2709, + /* 3140 */ 2710, 841, 2182, 861, 2182, 2182, 2182, 2182, 2182, 2724, + /* 3150 */ 2671, 2182, 842, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + /* 3160 */ 2182, 2182, 2182, 2182, 2182, 2671, 2182, 842, 2182, 2182, + /* 3170 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + /* 3180 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, + /* 3190 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 844, 2182, + /* 3200 */ 2182, 2744, 2182, 2182, 2182, 402, 2707, 846, 2709, 2710, + /* 3210 */ 841, 2182, 861, 2705, 2182, 2182, 2744, 2182, 2182, 2182, + /* 3220 */ 401, 2707, 846, 2709, 2710, 841, 2182, 861, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 506, 507, 438, 379, 386, 391, 421, 389, 390, 519, @@ -1127,77 +1130,77 @@ static const YYCODETYPE yy_lookahead[] = { /* 2020 */ 436, 38, 425, 436, 436, 391, 436, 381, 392, 436, /* 2030 */ 484, 436, 436, 487, 436, 436, 398, 491, 492, 493, /* 2040 */ 494, 495, 496, 436, 498, 436, 467, 385, 436, 436, - /* 2050 */ 476, 379, 384, 436, 483, 436, 420, 414, 399, 484, + /* 2050 */ 422, 379, 384, 436, 483, 436, 420, 414, 399, 484, /* 2060 */ 436, 436, 487, 436, 392, 436, 491, 492, 493, 494, /* 2070 */ 495, 496, 436, 498, 438, 422, 436, 436, 414, 414, - /* 2080 */ 0, 377, 0, 0, 458, 45, 458, 0, 37, 240, - /* 2090 */ 37, 37, 420, 37, 0, 240, 37, 37, 240, 37, - /* 2100 */ 0, 0, 240, 0, 37, 0, 37, 0, 436, 0, - /* 2110 */ 438, 22, 37, 235, 0, 221, 0, 542, 221, 213, - /* 2120 */ 484, 222, 215, 487, 0, 0, 0, 491, 492, 493, - /* 2130 */ 494, 495, 496, 209, 498, 208, 0, 0, 154, 49, - /* 2140 */ 379, 49, 0, 37, 0, 0, 0, 37, 52, 0, - /* 2150 */ 0, 49, 0, 392, 173, 37, 484, 45, 0, 487, - /* 2160 */ 0, 0, 49, 491, 492, 493, 494, 495, 496, 379, - /* 2170 */ 498, 0, 500, 0, 0, 0, 0, 173, 0, 0, + /* 2080 */ 476, 377, 0, 0, 458, 0, 45, 0, 37, 458, + /* 2090 */ 240, 37, 420, 37, 37, 240, 0, 37, 37, 240, + /* 2100 */ 37, 0, 0, 240, 0, 37, 0, 37, 436, 0, + /* 2110 */ 438, 22, 0, 37, 235, 0, 221, 542, 0, 221, + /* 2120 */ 484, 222, 215, 487, 213, 0, 0, 491, 492, 493, + /* 2130 */ 494, 495, 496, 0, 498, 209, 208, 0, 0, 154, + /* 2140 */ 379, 49, 49, 0, 37, 0, 0, 37, 0, 52, + /* 2150 */ 0, 0, 49, 392, 49, 0, 484, 0, 45, 487, + /* 2160 */ 0, 0, 0, 491, 492, 493, 494, 495, 496, 379, + /* 2170 */ 498, 0, 500, 0, 0, 173, 37, 0, 173, 0, /* 2180 */ 0, 420, 392, 0, 0, 0, 0, 551, 0, 0, - /* 2190 */ 379, 22, 49, 0, 0, 0, 45, 436, 0, 438, + /* 2190 */ 379, 49, 0, 0, 45, 0, 0, 436, 0, 438, /* 2200 */ 0, 0, 0, 392, 0, 0, 0, 0, 0, 0, /* 2210 */ 420, 0, 0, 0, 0, 0, 0, 0, 0, 379, - /* 2220 */ 0, 0, 461, 0, 154, 153, 436, 0, 438, 152, - /* 2230 */ 0, 420, 392, 0, 66, 0, 66, 50, 0, 0, - /* 2240 */ 50, 22, 0, 66, 22, 484, 0, 436, 487, 438, - /* 2250 */ 0, 461, 491, 492, 493, 494, 495, 496, 66, 498, - /* 2260 */ 420, 37, 37, 0, 0, 0, 37, 14, 42, 37, - /* 2270 */ 0, 37, 0, 42, 484, 204, 436, 487, 438, 43, - /* 2280 */ 52, 491, 492, 493, 494, 495, 496, 42, 498, 52, - /* 2290 */ 33, 42, 52, 45, 0, 484, 49, 42, 487, 0, - /* 2300 */ 49, 0, 491, 492, 493, 494, 495, 496, 49, 498, - /* 2310 */ 42, 0, 0, 379, 0, 49, 49, 0, 74, 0, - /* 2320 */ 0, 37, 42, 52, 484, 0, 392, 487, 37, 52, - /* 2330 */ 379, 491, 492, 493, 494, 495, 496, 42, 498, 0, - /* 2340 */ 37, 52, 42, 392, 0, 37, 42, 379, 52, 0, - /* 2350 */ 0, 0, 0, 0, 420, 0, 22, 0, 37, 22, - /* 2360 */ 392, 37, 121, 37, 37, 37, 37, 37, 37, 37, - /* 2370 */ 436, 420, 438, 119, 33, 37, 33, 37, 22, 37, - /* 2380 */ 0, 22, 37, 0, 22, 0, 22, 436, 420, 438, - /* 2390 */ 0, 22, 0, 0, 0, 37, 0, 37, 0, 22, - /* 2400 */ 54, 20, 37, 37, 436, 37, 438, 37, 0, 0, - /* 2410 */ 379, 114, 49, 37, 0, 113, 0, 220, 484, 113, - /* 2420 */ 0, 487, 226, 392, 225, 491, 492, 493, 494, 495, - /* 2430 */ 496, 3, 498, 190, 22, 484, 33, 22, 487, 301, - /* 2440 */ 33, 37, 491, 492, 493, 494, 495, 496, 190, 498, - /* 2450 */ 190, 420, 484, 0, 37, 487, 50, 196, 111, 491, - /* 2460 */ 492, 493, 494, 495, 496, 33, 498, 436, 190, 438, - /* 2470 */ 33, 190, 216, 200, 200, 50, 49, 33, 49, 80, - /* 2480 */ 113, 109, 301, 33, 37, 114, 113, 3, 114, 114, - /* 2490 */ 379, 113, 33, 114, 37, 113, 0, 113, 37, 113, - /* 2500 */ 37, 114, 113, 392, 301, 114, 37, 379, 113, 37, - /* 2510 */ 37, 114, 33, 49, 114, 484, 114, 49, 487, 114, - /* 2520 */ 392, 0, 491, 492, 493, 494, 495, 496, 42, 498, - /* 2530 */ 42, 420, 113, 379, 0, 114, 42, 114, 114, 113, - /* 2540 */ 33, 193, 2, 113, 113, 111, 392, 436, 420, 438, - /* 2550 */ 22, 197, 113, 111, 285, 272, 249, 49, 49, 114, - /* 2560 */ 114, 113, 113, 22, 436, 113, 438, 113, 113, 113, - /* 2570 */ 379, 0, 114, 113, 420, 252, 114, 42, 113, 113, - /* 2580 */ 113, 193, 49, 392, 114, 114, 22, 113, 22, 113, - /* 2590 */ 436, 113, 438, 192, 113, 484, 113, 122, 487, 22, - /* 2600 */ 123, 114, 491, 492, 493, 494, 495, 496, 113, 498, - /* 2610 */ 37, 420, 484, 37, 114, 487, 37, 114, 113, 491, - /* 2620 */ 492, 493, 494, 495, 496, 37, 498, 436, 193, 438, - /* 2630 */ 114, 379, 37, 114, 37, 37, 226, 114, 484, 113, - /* 2640 */ 134, 487, 33, 113, 392, 491, 492, 493, 494, 495, - /* 2650 */ 496, 134, 498, 37, 379, 113, 134, 22, 134, 74, - /* 2660 */ 73, 22, 37, 37, 37, 37, 37, 392, 37, 37, - /* 2670 */ 37, 37, 420, 37, 37, 484, 80, 107, 487, 80, + /* 2220 */ 0, 22, 461, 154, 0, 153, 436, 0, 438, 152, + /* 2230 */ 0, 420, 392, 0, 0, 66, 0, 50, 66, 0, + /* 2240 */ 50, 22, 66, 22, 0, 484, 0, 436, 487, 438, + /* 2250 */ 0, 461, 491, 492, 493, 494, 495, 496, 0, 498, + /* 2260 */ 420, 0, 37, 66, 42, 37, 37, 0, 42, 37, + /* 2270 */ 0, 14, 0, 42, 484, 52, 436, 487, 438, 37, + /* 2280 */ 42, 491, 492, 493, 494, 495, 496, 52, 498, 52, + /* 2290 */ 45, 42, 33, 0, 0, 484, 49, 49, 487, 43, + /* 2300 */ 49, 0, 491, 492, 493, 494, 495, 496, 0, 498, + /* 2310 */ 42, 0, 204, 379, 49, 0, 0, 0, 49, 0, + /* 2320 */ 0, 37, 42, 52, 484, 0, 392, 487, 74, 37, + /* 2330 */ 379, 491, 492, 493, 494, 495, 496, 52, 498, 42, + /* 2340 */ 0, 37, 52, 392, 42, 0, 37, 379, 52, 42, + /* 2350 */ 0, 0, 0, 0, 420, 0, 0, 22, 37, 0, + /* 2360 */ 392, 121, 119, 22, 37, 37, 37, 37, 37, 37, + /* 2370 */ 436, 420, 438, 0, 37, 37, 37, 33, 0, 33, + /* 2380 */ 37, 0, 22, 0, 37, 37, 22, 436, 420, 438, + /* 2390 */ 22, 22, 22, 0, 37, 0, 54, 0, 0, 37, + /* 2400 */ 37, 0, 22, 37, 436, 20, 438, 0, 37, 37, + /* 2410 */ 379, 0, 114, 113, 49, 0, 113, 0, 484, 37, + /* 2420 */ 226, 487, 22, 392, 22, 491, 492, 493, 494, 495, + /* 2430 */ 496, 190, 498, 0, 3, 484, 33, 301, 487, 113, + /* 2440 */ 50, 37, 491, 492, 493, 494, 495, 496, 114, 498, + /* 2450 */ 190, 420, 484, 37, 190, 487, 190, 33, 196, 491, + /* 2460 */ 492, 493, 494, 495, 496, 111, 498, 436, 190, 438, + /* 2470 */ 50, 113, 33, 200, 200, 220, 49, 33, 225, 216, + /* 2480 */ 33, 114, 301, 49, 109, 80, 33, 113, 37, 113, + /* 2490 */ 379, 114, 3, 114, 33, 37, 37, 113, 49, 113, + /* 2500 */ 37, 114, 113, 392, 301, 114, 114, 379, 114, 113, + /* 2510 */ 37, 37, 37, 114, 33, 484, 49, 0, 487, 0, + /* 2520 */ 392, 113, 491, 492, 493, 494, 495, 496, 114, 498, + /* 2530 */ 42, 420, 114, 379, 0, 114, 113, 42, 113, 113, + /* 2540 */ 0, 113, 193, 114, 42, 33, 392, 436, 420, 438, + /* 2550 */ 2, 111, 111, 272, 22, 249, 114, 49, 49, 114, + /* 2560 */ 114, 285, 114, 113, 436, 113, 438, 113, 113, 113, + /* 2570 */ 379, 22, 0, 113, 420, 113, 252, 113, 113, 42, + /* 2580 */ 114, 113, 113, 392, 49, 197, 114, 37, 22, 113, + /* 2590 */ 436, 113, 438, 122, 114, 484, 113, 113, 487, 193, + /* 2600 */ 123, 192, 491, 492, 493, 494, 495, 496, 22, 498, + /* 2610 */ 37, 420, 484, 22, 113, 487, 37, 114, 113, 491, + /* 2620 */ 492, 493, 494, 495, 496, 193, 498, 436, 114, 438, + /* 2630 */ 37, 379, 114, 37, 114, 37, 226, 114, 484, 37, + /* 2640 */ 134, 487, 113, 33, 392, 491, 492, 493, 494, 495, + /* 2650 */ 496, 113, 498, 37, 379, 134, 134, 113, 134, 22, + /* 2660 */ 22, 74, 73, 37, 37, 37, 37, 392, 37, 37, + /* 2670 */ 37, 37, 420, 37, 80, 484, 37, 37, 487, 80, /* 2680 */ 33, 107, 491, 492, 493, 494, 495, 496, 436, 498, - /* 2690 */ 438, 37, 37, 37, 22, 420, 37, 37, 37, 80, - /* 2700 */ 37, 37, 37, 37, 37, 22, 37, 0, 37, 52, - /* 2710 */ 42, 436, 0, 438, 37, 379, 42, 0, 37, 0, - /* 2720 */ 42, 37, 52, 0, 42, 52, 37, 52, 392, 37, - /* 2730 */ 22, 0, 22, 33, 554, 22, 484, 0, 22, 487, - /* 2740 */ 379, 21, 21, 491, 492, 493, 494, 495, 496, 22, - /* 2750 */ 498, 554, 20, 392, 554, 554, 420, 554, 554, 484, + /* 2690 */ 438, 37, 107, 37, 37, 420, 22, 37, 37, 37, + /* 2700 */ 80, 37, 37, 37, 37, 37, 22, 37, 0, 37, + /* 2710 */ 52, 436, 0, 438, 37, 379, 0, 42, 42, 37, + /* 2720 */ 42, 52, 0, 52, 37, 52, 0, 42, 392, 37, + /* 2730 */ 0, 22, 37, 0, 33, 22, 484, 22, 21, 487, + /* 2740 */ 379, 22, 22, 491, 492, 493, 494, 495, 496, 21, + /* 2750 */ 498, 20, 554, 392, 554, 554, 420, 554, 554, 484, /* 2760 */ 554, 554, 487, 554, 554, 554, 491, 492, 493, 494, /* 2770 */ 495, 496, 436, 498, 438, 554, 554, 554, 554, 554, /* 2780 */ 554, 420, 554, 554, 554, 554, 554, 554, 554, 554, @@ -1284,9 +1287,9 @@ static const YYCODETYPE yy_lookahead[] = { /* 3590 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, /* 3600 */ 376, 376, 376, 376, }; -#define YY_SHIFT_COUNT (962) +#define YY_SHIFT_COUNT (964) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2737) +#define YY_SHIFT_MAX (2733) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 520, 0, 259, 0, 519, 519, 519, 519, 519, 519, /* 10 */ 519, 519, 519, 519, 519, 519, 778, 1037, 1037, 1296, @@ -1326,67 +1329,67 @@ static const unsigned short int yy_shift_ofst[] = { /* 350 */ 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, /* 360 */ 503, 503, 503, 503, 503, 503, 503, 503, 1904, 503, /* 370 */ 1701, 404, 1996, 1983, 1774, 3228, 3228, 3228, 3228, 3228, - /* 380 */ 3228, 3228, 3228, 3228, 3228, 3228, 81, 1425, 359, 1684, - /* 390 */ 391, 17, 558, 63, 707, 1492, 231, 724, 588, 588, - /* 400 */ 588, 588, 588, 588, 588, 588, 588, 750, 610, 464, - /* 410 */ 66, 723, 723, 402, 733, 39, 782, 578, 760, 846, - /* 420 */ 578, 889, 802, 1075, 54, 302, 302, 1231, 1113, 964, - /* 430 */ 1231, 1231, 1231, 1404, 1255, 1336, 605, 1151, 696, 1440, - /* 440 */ 1313, 1315, 1317, 1328, 734, 1441, 1442, 1476, 1480, 1490, - /* 450 */ 1493, 1226, 1416, 1420, 8, 1477, 1481, 1485, 1487, 1332, - /* 460 */ 1303, 621, 1483, 1496, 1499, 1541, 1502, 781, 1511, 1409, - /* 470 */ 1535, 1538, 1547, 1550, 1526, 1560, 1572, 1577, 1592, 1602, - /* 480 */ 1630, 1635, 1642, 1644, 1647, 1563, 1565, 1567, 1573, 1591, - /* 490 */ 1600, 429, 1446, 498, 1589, 1504, 1632, 1621, 1390, 2080, - /* 500 */ 2082, 2083, 2040, 2087, 2051, 1849, 2053, 2054, 2056, 1855, - /* 510 */ 2094, 2059, 2060, 1858, 2062, 2100, 2101, 1862, 2103, 2067, - /* 520 */ 2105, 2069, 2107, 2089, 2109, 2075, 1878, 2114, 1894, 2116, - /* 530 */ 1897, 1899, 1907, 1906, 2124, 2125, 2126, 1924, 1927, 2136, - /* 540 */ 2137, 1984, 2090, 2092, 2142, 2106, 2144, 2145, 2110, 2096, - /* 550 */ 2146, 2102, 2149, 2112, 2150, 2152, 2158, 2113, 2160, 2161, - /* 560 */ 2171, 2173, 2174, 2175, 1981, 2118, 2176, 2004, 2178, 2179, - /* 570 */ 2180, 2183, 2184, 2185, 2186, 2188, 2189, 2198, 2200, 2201, - /* 580 */ 2202, 2204, 2205, 2206, 2207, 2208, 2209, 2211, 2143, 2193, - /* 590 */ 2151, 2194, 2195, 2212, 2213, 2214, 2215, 2216, 2217, 2218, - /* 600 */ 2169, 2220, 2070, 2221, 2072, 2223, 2077, 2227, 2230, 2219, - /* 610 */ 2187, 2222, 2190, 2233, 2168, 2235, 2170, 2224, 2238, 2177, - /* 620 */ 2239, 2192, 2242, 2246, 2225, 2228, 2226, 2250, 2229, 2237, - /* 630 */ 2231, 2263, 2232, 2240, 2245, 2264, 2234, 2265, 2248, 2249, - /* 640 */ 2257, 2247, 2251, 2253, 2259, 2270, 2236, 2255, 2272, 2294, - /* 650 */ 2299, 2301, 2268, 2071, 2311, 2247, 2266, 2312, 2247, 2267, - /* 660 */ 2314, 2317, 2244, 2319, 2320, 2284, 2271, 2280, 2325, 2291, - /* 670 */ 2277, 2295, 2339, 2303, 2289, 2300, 2344, 2308, 2296, 2304, - /* 680 */ 2349, 2350, 2351, 2352, 2353, 2355, 2241, 2254, 2321, 2334, - /* 690 */ 2357, 2337, 2324, 2326, 2327, 2328, 2329, 2330, 2331, 2332, - /* 700 */ 2338, 2341, 2343, 2340, 2342, 2356, 2345, 2380, 2359, 2383, - /* 710 */ 2362, 2385, 2364, 2346, 2390, 2369, 2358, 2392, 2393, 2394, - /* 720 */ 2360, 2396, 2365, 2398, 2377, 2381, 2366, 2368, 2370, 2297, - /* 730 */ 2302, 2408, 2243, 2196, 2199, 2306, 2197, 2247, 2363, 2409, - /* 740 */ 2258, 2376, 2412, 2414, 2256, 2415, 2260, 2261, 2416, 2420, - /* 750 */ 2278, 2273, 2281, 2274, 2428, 2403, 2138, 2367, 2371, 2373, - /* 760 */ 2374, 2404, 2417, 2378, 2406, 2347, 2425, 2372, 2375, 2407, - /* 770 */ 2432, 2379, 2382, 2384, 2386, 2387, 2437, 2427, 2429, 2389, - /* 780 */ 2444, 2181, 2399, 2391, 2450, 2395, 2447, 2397, 2400, 2484, - /* 790 */ 2459, 2203, 2457, 2461, 2463, 2469, 2472, 2473, 2402, 2405, - /* 800 */ 2464, 2269, 2479, 2468, 2453, 2496, 2419, 2486, 2421, 2423, - /* 810 */ 2426, 2430, 2348, 2431, 2521, 2488, 2354, 2534, 2424, 2439, - /* 820 */ 2388, 2494, 2401, 2507, 2434, 2283, 2442, 2540, 2528, 2307, - /* 830 */ 2445, 2446, 2448, 2449, 2452, 2454, 2455, 2458, 2508, 2456, - /* 840 */ 2460, 2509, 2462, 2541, 2323, 2465, 2466, 2571, 2470, 2467, - /* 850 */ 2435, 2535, 2474, 2475, 2247, 2533, 2476, 2478, 2471, 2481, - /* 860 */ 2483, 2477, 2564, 2566, 2577, 2410, 2487, 2573, 2576, 2495, - /* 870 */ 2500, 2579, 2505, 2503, 2588, 2448, 2516, 2595, 2449, 2519, - /* 880 */ 2597, 2452, 2523, 2598, 2454, 2506, 2517, 2522, 2524, 2526, - /* 890 */ 2609, 2530, 2616, 2542, 2609, 2609, 2635, 2585, 2587, 2639, - /* 900 */ 2625, 2626, 2627, 2628, 2629, 2631, 2632, 2633, 2634, 2636, - /* 910 */ 2637, 2596, 2570, 2599, 2574, 2647, 2654, 2655, 2656, 2672, - /* 920 */ 2659, 2660, 2661, 2619, 2341, 2663, 2343, 2664, 2665, 2666, - /* 930 */ 2667, 2683, 2669, 2707, 2671, 2657, 2668, 2712, 2677, 2670, - /* 940 */ 2674, 2717, 2681, 2673, 2678, 2719, 2684, 2675, 2682, 2723, - /* 950 */ 2689, 2737, 2708, 2692, 2731, 2710, 2700, 2713, 2720, 2716, - /* 960 */ 2727, 2721, 2732, + /* 380 */ 3228, 3228, 3228, 3228, 3228, 3228, 3228, 81, 1425, 359, + /* 390 */ 1684, 391, 17, 558, 63, 707, 1492, 231, 724, 588, + /* 400 */ 588, 588, 588, 588, 588, 588, 588, 588, 750, 610, + /* 410 */ 464, 66, 723, 723, 402, 733, 39, 782, 578, 578, + /* 420 */ 760, 846, 578, 889, 802, 1075, 54, 302, 302, 1231, + /* 430 */ 1113, 964, 1231, 1231, 1231, 1404, 1255, 1336, 605, 1151, + /* 440 */ 696, 1440, 1313, 1315, 1317, 1328, 734, 1441, 1442, 1476, + /* 450 */ 1480, 1490, 1493, 1226, 1416, 1420, 8, 1477, 1481, 1485, + /* 460 */ 1487, 1332, 1303, 621, 1483, 1496, 1499, 1541, 1502, 781, + /* 470 */ 1511, 1409, 1535, 1538, 1547, 1550, 1526, 1560, 1572, 1577, + /* 480 */ 1592, 1602, 1630, 1635, 1642, 1644, 1647, 1563, 1565, 1567, + /* 490 */ 1573, 1591, 1600, 429, 1446, 498, 1589, 1504, 1632, 1621, + /* 500 */ 1390, 2082, 2083, 2085, 2041, 2087, 2051, 1850, 2054, 2056, + /* 510 */ 2057, 1855, 2096, 2060, 2061, 1859, 2063, 2101, 2102, 1863, + /* 520 */ 2104, 2068, 2106, 2070, 2109, 2089, 2112, 2076, 1879, 2115, + /* 530 */ 1895, 2118, 1898, 1899, 1907, 1911, 2125, 2126, 2133, 1926, + /* 540 */ 1928, 2137, 2138, 1985, 2092, 2093, 2143, 2107, 2145, 2146, + /* 550 */ 2110, 2097, 2148, 2103, 2150, 2113, 2151, 2157, 2160, 2105, + /* 560 */ 2155, 2161, 2162, 2171, 2173, 2174, 2002, 2139, 2177, 2005, + /* 570 */ 2179, 2180, 2183, 2184, 2185, 2186, 2188, 2189, 2198, 2200, + /* 580 */ 2201, 2202, 2204, 2205, 2206, 2207, 2208, 2209, 2211, 2212, + /* 590 */ 2142, 2192, 2149, 2193, 2195, 2196, 2213, 2214, 2215, 2216, + /* 600 */ 2217, 2218, 2199, 2220, 2069, 2224, 2072, 2227, 2077, 2230, + /* 610 */ 2233, 2219, 2187, 2221, 2190, 2234, 2169, 2236, 2172, 2225, + /* 620 */ 2239, 2176, 2244, 2197, 2246, 2250, 2228, 2223, 2222, 2258, + /* 630 */ 2229, 2235, 2226, 2261, 2232, 2237, 2231, 2267, 2242, 2270, + /* 640 */ 2245, 2238, 2259, 2247, 2248, 2257, 2251, 2272, 2256, 2249, + /* 650 */ 2293, 2294, 2301, 2308, 2268, 2108, 2311, 2247, 2265, 2315, + /* 660 */ 2247, 2269, 2316, 2317, 2254, 2319, 2320, 2284, 2271, 2280, + /* 670 */ 2325, 2292, 2285, 2297, 2340, 2304, 2290, 2302, 2345, 2309, + /* 680 */ 2296, 2307, 2350, 2351, 2352, 2353, 2355, 2356, 2240, 2243, + /* 690 */ 2321, 2335, 2359, 2341, 2327, 2328, 2329, 2330, 2331, 2332, + /* 700 */ 2337, 2338, 2339, 2344, 2346, 2343, 2347, 2360, 2348, 2373, + /* 710 */ 2364, 2378, 2368, 2381, 2369, 2342, 2383, 2370, 2357, 2393, + /* 720 */ 2395, 2397, 2362, 2398, 2363, 2401, 2380, 2385, 2366, 2371, + /* 730 */ 2372, 2298, 2300, 2407, 2241, 2194, 2253, 2303, 2255, 2247, + /* 740 */ 2365, 2411, 2260, 2382, 2400, 2415, 2263, 2402, 2264, 2262, + /* 750 */ 2417, 2433, 2266, 2273, 2278, 2274, 2431, 2403, 2136, 2326, + /* 760 */ 2334, 2358, 2367, 2404, 2416, 2374, 2390, 2354, 2420, 2375, + /* 770 */ 2377, 2424, 2439, 2379, 2376, 2384, 2386, 2387, 2444, 2427, + /* 780 */ 2434, 2389, 2447, 2181, 2405, 2391, 2453, 2396, 2451, 2392, + /* 790 */ 2394, 2489, 2461, 2203, 2458, 2459, 2463, 2473, 2474, 2475, + /* 800 */ 2399, 2414, 2449, 2276, 2481, 2467, 2517, 2519, 2408, 2488, + /* 810 */ 2418, 2421, 2423, 2425, 2349, 2426, 2534, 2495, 2388, 2540, + /* 820 */ 2429, 2428, 2406, 2502, 2409, 2512, 2440, 2281, 2441, 2548, + /* 830 */ 2532, 2306, 2442, 2445, 2450, 2452, 2454, 2455, 2456, 2446, + /* 840 */ 2508, 2460, 2462, 2509, 2448, 2549, 2324, 2464, 2465, 2572, + /* 850 */ 2466, 2468, 2432, 2537, 2469, 2471, 2247, 2535, 2476, 2478, + /* 860 */ 2472, 2483, 2484, 2477, 2566, 2586, 2591, 2410, 2480, 2550, + /* 870 */ 2573, 2501, 2503, 2579, 2505, 2514, 2593, 2450, 2518, 2596, + /* 880 */ 2452, 2520, 2598, 2454, 2523, 2602, 2455, 2506, 2521, 2522, + /* 890 */ 2524, 2529, 2610, 2538, 2616, 2544, 2610, 2610, 2637, 2587, + /* 900 */ 2589, 2638, 2626, 2627, 2628, 2629, 2631, 2632, 2633, 2634, + /* 910 */ 2636, 2639, 2640, 2594, 2574, 2599, 2585, 2647, 2654, 2656, + /* 920 */ 2657, 2674, 2660, 2661, 2662, 2620, 2344, 2664, 2346, 2665, + /* 930 */ 2666, 2667, 2668, 2684, 2670, 2708, 2672, 2658, 2675, 2712, + /* 940 */ 2677, 2669, 2676, 2716, 2682, 2671, 2678, 2722, 2687, 2673, + /* 950 */ 2685, 2726, 2692, 2730, 2709, 2695, 2733, 2713, 2701, 2715, + /* 960 */ 2717, 2719, 2720, 2728, 2731, }; -#define YY_REDUCE_COUNT (385) +#define YY_REDUCE_COUNT (386) #define YY_REDUCE_MIN (-510) #define YY_REDUCE_MAX (2729) static const short yy_reduce_ofst[] = { @@ -1427,107 +1430,107 @@ static const short yy_reduce_ofst[] = { /* 340 */ 1555, 1559, 1610, 1594, 1614, 1622, 1580, 1583, 1584, 1587, /* 350 */ 1588, 1590, 1593, 1595, 1596, 1598, 1599, 1607, 1609, 1612, /* 360 */ 1613, 1617, 1619, 1624, 1625, 1627, 1629, 1640, 1597, 1641, - /* 370 */ 1634, 1638, 1646, 1662, 1668, 1579, 1571, 1574, 1626, 1628, - /* 380 */ 1643, 1664, 1653, 1665, 1659, 1704, + /* 370 */ 1634, 1638, 1646, 1662, 1668, 1579, 1628, 1571, 1604, 1626, + /* 380 */ 1631, 1643, 1664, 1653, 1665, 1659, 1704, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 10 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 20 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 30 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 40 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 50 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 60 */ 2547, 2179, 2179, 2503, 2179, 2179, 2179, 2179, 2179, 2179, - /* 70 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2510, 2179, - /* 80 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 90 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2280, - /* 100 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 110 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2278, 2799, - /* 120 */ 2179, 2925, 2588, 2179, 2179, 2828, 2179, 2179, 2179, 2179, - /* 130 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 140 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2811, 2179, 2179, - /* 150 */ 2251, 2251, 2179, 2811, 2811, 2811, 2771, 2771, 2278, 2179, - /* 160 */ 2179, 2280, 2179, 2590, 2179, 2179, 2179, 2179, 2179, 2179, - /* 170 */ 2179, 2179, 2179, 2420, 2209, 2179, 2179, 2179, 2179, 2179, - /* 180 */ 2179, 2573, 2179, 2179, 2857, 2803, 2804, 2919, 2179, 2860, - /* 190 */ 2822, 2179, 2817, 2179, 2179, 2179, 2179, 2515, 2179, 2847, - /* 200 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2616, 2179, 2179, - /* 210 */ 2365, 2567, 2179, 2179, 2179, 2179, 2179, 2903, 2801, 2841, - /* 220 */ 2179, 2851, 2179, 2179, 2179, 2604, 2280, 2179, 2280, 2560, - /* 230 */ 2498, 2179, 2508, 2179, 2508, 2505, 2179, 2179, 2179, 2508, - /* 240 */ 2505, 2505, 2505, 2354, 2350, 2179, 2179, 2348, 2179, 2179, - /* 250 */ 2179, 2179, 2234, 2179, 2234, 2179, 2280, 2280, 2179, 2280, - /* 260 */ 2179, 2179, 2280, 2179, 2280, 2179, 2280, 2179, 2280, 2280, - /* 270 */ 2179, 2280, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 280 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 290 */ 2179, 2602, 2583, 2179, 2278, 2179, 2571, 2569, 2179, 2278, - /* 300 */ 2851, 2179, 2179, 2873, 2868, 2873, 2868, 2887, 2883, 2873, - /* 310 */ 2892, 2889, 2853, 2851, 2834, 2830, 2922, 2909, 2905, 2179, - /* 320 */ 2179, 2839, 2837, 2179, 2278, 2278, 2868, 2179, 2179, 2179, - /* 330 */ 2179, 2868, 2179, 2179, 2278, 2179, 2179, 2278, 2179, 2179, - /* 340 */ 2179, 2179, 2278, 2179, 2278, 2179, 2179, 2179, 2179, 2179, - /* 350 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 360 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2382, 2179, - /* 370 */ 2179, 2278, 2179, 2218, 2179, 2562, 2588, 2593, 2543, 2543, - /* 380 */ 2423, 2423, 2925, 2423, 2281, 2184, 2179, 2179, 2179, 2179, - /* 390 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2886, 2885, - /* 400 */ 2722, 2179, 2775, 2774, 2773, 2764, 2721, 2378, 2179, 2179, - /* 410 */ 2179, 2720, 2719, 2179, 2179, 2179, 2179, 2369, 2179, 2179, - /* 420 */ 2391, 2179, 2179, 2179, 2179, 2534, 2533, 2713, 2179, 2179, - /* 430 */ 2714, 2712, 2711, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 440 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 450 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 460 */ 2906, 2910, 2179, 2179, 2179, 2800, 2179, 2179, 2179, 2692, - /* 470 */ 2179, 2179, 2179, 2179, 2660, 2655, 2646, 2637, 2652, 2643, - /* 480 */ 2631, 2649, 2640, 2628, 2625, 2179, 2179, 2179, 2179, 2179, - /* 490 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 500 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 510 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 520 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 530 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 540 */ 2179, 2504, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 550 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 560 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 570 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 580 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 590 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 600 */ 2179, 2179, 2179, 2179, 2179, 2179, 2519, 2179, 2179, 2179, - /* 610 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 620 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 630 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 640 */ 2223, 2699, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 650 */ 2179, 2179, 2179, 2179, 2179, 2702, 2179, 2179, 2703, 2179, - /* 660 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 670 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 680 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 690 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 700 */ 2179, 2325, 2324, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 710 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 720 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2704, - /* 730 */ 2179, 2179, 2179, 2179, 2587, 2179, 2179, 2694, 2179, 2179, - /* 740 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 750 */ 2179, 2179, 2179, 2179, 2902, 2854, 2179, 2179, 2179, 2179, - /* 760 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 770 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2692, 2179, - /* 780 */ 2884, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2900, 2179, - /* 790 */ 2904, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2810, 2806, - /* 800 */ 2179, 2179, 2802, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 810 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 820 */ 2179, 2179, 2179, 2761, 2179, 2179, 2179, 2795, 2179, 2179, - /* 830 */ 2179, 2179, 2419, 2418, 2417, 2416, 2179, 2179, 2179, 2179, - /* 840 */ 2179, 2179, 2704, 2179, 2707, 2179, 2179, 2179, 2179, 2179, - /* 850 */ 2179, 2179, 2179, 2179, 2691, 2179, 2746, 2745, 2179, 2179, - /* 860 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2413, - /* 870 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 880 */ 2179, 2179, 2179, 2179, 2179, 2397, 2395, 2394, 2393, 2179, - /* 890 */ 2430, 2179, 2179, 2179, 2426, 2425, 2179, 2179, 2179, 2179, - /* 900 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 910 */ 2179, 2179, 2179, 2179, 2179, 2299, 2179, 2179, 2179, 2179, - /* 920 */ 2179, 2179, 2179, 2179, 2291, 2179, 2290, 2179, 2179, 2179, - /* 930 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 940 */ 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, - /* 950 */ 2179, 2179, 2179, 2179, 2179, 2179, 2208, 2179, 2179, 2179, - /* 960 */ 2179, 2179, 2179, + /* 0 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 10 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 20 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 30 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 40 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 50 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 60 */ 2548, 2180, 2180, 2504, 2180, 2180, 2180, 2180, 2180, 2180, + /* 70 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2511, 2180, + /* 80 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 90 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2281, + /* 100 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 110 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2279, 2800, + /* 120 */ 2180, 2926, 2589, 2180, 2180, 2829, 2180, 2180, 2180, 2180, + /* 130 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 140 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2812, 2180, 2180, + /* 150 */ 2252, 2252, 2180, 2812, 2812, 2812, 2772, 2772, 2279, 2180, + /* 160 */ 2180, 2281, 2180, 2591, 2180, 2180, 2180, 2180, 2180, 2180, + /* 170 */ 2180, 2180, 2180, 2421, 2210, 2180, 2180, 2180, 2180, 2180, + /* 180 */ 2180, 2574, 2180, 2180, 2858, 2804, 2805, 2920, 2180, 2861, + /* 190 */ 2823, 2180, 2818, 2180, 2180, 2180, 2180, 2516, 2180, 2848, + /* 200 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2617, 2180, 2180, + /* 210 */ 2366, 2568, 2180, 2180, 2180, 2180, 2180, 2904, 2802, 2842, + /* 220 */ 2180, 2852, 2180, 2180, 2180, 2605, 2281, 2180, 2281, 2561, + /* 230 */ 2499, 2180, 2509, 2180, 2509, 2506, 2180, 2180, 2180, 2509, + /* 240 */ 2506, 2506, 2506, 2355, 2351, 2180, 2180, 2349, 2180, 2180, + /* 250 */ 2180, 2180, 2235, 2180, 2235, 2180, 2281, 2281, 2180, 2281, + /* 260 */ 2180, 2180, 2281, 2180, 2281, 2180, 2281, 2180, 2281, 2281, + /* 270 */ 2180, 2281, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 280 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 290 */ 2180, 2603, 2584, 2180, 2279, 2180, 2572, 2570, 2180, 2279, + /* 300 */ 2852, 2180, 2180, 2874, 2869, 2874, 2869, 2888, 2884, 2874, + /* 310 */ 2893, 2890, 2854, 2852, 2835, 2831, 2923, 2910, 2906, 2180, + /* 320 */ 2180, 2840, 2838, 2180, 2279, 2279, 2869, 2180, 2180, 2180, + /* 330 */ 2180, 2869, 2180, 2180, 2279, 2180, 2180, 2279, 2180, 2180, + /* 340 */ 2180, 2180, 2279, 2180, 2279, 2180, 2180, 2180, 2180, 2180, + /* 350 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 360 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2383, 2180, + /* 370 */ 2180, 2279, 2180, 2219, 2180, 2563, 2926, 2589, 2594, 2544, + /* 380 */ 2544, 2424, 2424, 2926, 2424, 2282, 2185, 2180, 2180, 2180, + /* 390 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2887, + /* 400 */ 2886, 2723, 2180, 2776, 2775, 2774, 2765, 2722, 2379, 2180, + /* 410 */ 2180, 2180, 2721, 2720, 2180, 2180, 2180, 2180, 2370, 2367, + /* 420 */ 2180, 2180, 2392, 2180, 2180, 2180, 2180, 2535, 2534, 2714, + /* 430 */ 2180, 2180, 2715, 2713, 2712, 2180, 2180, 2180, 2180, 2180, + /* 440 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 450 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 460 */ 2180, 2180, 2907, 2911, 2180, 2180, 2180, 2801, 2180, 2180, + /* 470 */ 2180, 2693, 2180, 2180, 2180, 2180, 2661, 2656, 2647, 2638, + /* 480 */ 2653, 2644, 2632, 2650, 2641, 2629, 2626, 2180, 2180, 2180, + /* 490 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 500 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 510 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 520 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 530 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 540 */ 2180, 2180, 2180, 2505, 2180, 2180, 2180, 2180, 2180, 2180, + /* 550 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 560 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 570 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 580 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 590 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 600 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2520, 2180, + /* 610 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 620 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 630 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 640 */ 2180, 2180, 2224, 2700, 2180, 2180, 2180, 2180, 2180, 2180, + /* 650 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2703, 2180, 2180, + /* 660 */ 2704, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 670 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 680 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 690 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 700 */ 2180, 2180, 2180, 2326, 2325, 2180, 2180, 2180, 2180, 2180, + /* 710 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 720 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 730 */ 2180, 2705, 2180, 2180, 2180, 2180, 2588, 2180, 2180, 2695, + /* 740 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 750 */ 2180, 2180, 2180, 2180, 2180, 2180, 2903, 2855, 2180, 2180, + /* 760 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 770 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 780 */ 2693, 2180, 2885, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 790 */ 2901, 2180, 2905, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 800 */ 2811, 2807, 2180, 2180, 2803, 2180, 2180, 2180, 2180, 2180, + /* 810 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 820 */ 2180, 2180, 2180, 2180, 2180, 2762, 2180, 2180, 2180, 2796, + /* 830 */ 2180, 2180, 2180, 2180, 2420, 2419, 2418, 2417, 2180, 2180, + /* 840 */ 2180, 2180, 2180, 2180, 2705, 2180, 2708, 2180, 2180, 2180, + /* 850 */ 2180, 2180, 2180, 2180, 2180, 2180, 2692, 2180, 2747, 2746, + /* 860 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 870 */ 2180, 2414, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 880 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2398, 2396, 2395, + /* 890 */ 2394, 2180, 2431, 2180, 2180, 2180, 2427, 2426, 2180, 2180, + /* 900 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 910 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2300, 2180, 2180, + /* 920 */ 2180, 2180, 2180, 2180, 2180, 2180, 2292, 2180, 2291, 2180, + /* 930 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 940 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, + /* 950 */ 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 2209, 2180, + /* 960 */ 2180, 2180, 2180, 2180, 2180, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2756,7 +2759,7 @@ static const char *const yyRuleName[] = { /* 181 */ "cmd ::= ALTER TABLE alter_table_clause", /* 182 */ "cmd ::= ALTER STABLE alter_table_clause", /* 183 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 184 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 184 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", /* 185 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", /* 186 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", /* 187 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", @@ -3533,7 +3536,9 @@ static void yy_destructor( case 549: /* query_simple_or_subquery */ case 551: /* sort_specification */ { +#line 7 "sql.y" nodesDestroyNode((yypminor->yy600)); +#line 3541 "sql.c" } break; case 377: /* account_options */ @@ -3543,7 +3548,9 @@ static void yy_destructor( case 462: /* with_meta */ case 471: /* bufsize_opt */ { +#line 54 "sql.y" +#line 3553 "sql.c" } break; case 381: /* ip_range_list */ @@ -3583,7 +3590,9 @@ static void yy_destructor( case 545: /* order_by_clause_opt */ case 550: /* sort_specification_list */ { +#line 85 "sql.y" nodesDestroyList((yypminor->yy748)); +#line 3595 "sql.c" } break; case 384: /* user_name */ @@ -3607,24 +3616,32 @@ static void yy_destructor( case 498: /* noarg_func */ case 516: /* alias_opt */ { +#line 1069 "sql.y" +#line 3621 "sql.c" } break; case 385: /* sysinfo_opt */ { +#line 112 "sql.y" +#line 3628 "sql.c" } break; case 386: /* privileges */ case 389: /* priv_type_list */ case 390: /* priv_type */ { +#line 121 "sql.y" +#line 3637 "sql.c" } break; case 387: /* priv_level */ { +#line 138 "sql.y" +#line 3644 "sql.c" } break; case 396: /* force_opt */ @@ -3638,66 +3655,90 @@ static void yy_destructor( case 527: /* set_quantifier_opt */ case 528: /* tag_mode_opt */ { +#line 170 "sql.y" +#line 3660 "sql.c" } break; case 409: /* alter_db_option */ case 435: /* alter_table_option */ { +#line 278 "sql.y" +#line 3668 "sql.c" } break; case 421: /* type_name */ case 432: /* type_name_default_len */ { +#line 413 "sql.y" +#line 3676 "sql.c" } break; case 440: /* db_kind_opt */ case 447: /* table_kind */ { +#line 591 "sql.y" +#line 3684 "sql.c" } break; case 441: /* table_kind_db_name_cond_opt */ { +#line 556 "sql.y" +#line 3691 "sql.c" } break; case 451: /* tsma_func_list */ { +#line 610 "sql.y" nodesDestroyNode((yypminor->yy600)); +#line 3698 "sql.c" } break; case 506: /* compare_op */ case 507: /* in_op */ { +#line 1267 "sql.y" +#line 3706 "sql.c" } break; case 519: /* join_type */ { +#line 1348 "sql.y" +#line 3713 "sql.c" } break; case 520: /* join_subtype */ { +#line 1356 "sql.y" +#line 3720 "sql.c" } break; case 541: /* fill_mode */ { +#line 1472 "sql.y" +#line 3727 "sql.c" } break; case 552: /* ordering_specification_opt */ { +#line 1557 "sql.y" +#line 3734 "sql.c" } break; case 553: /* null_ordering_opt */ { +#line 1563 "sql.y" +#line 3741 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -4170,7 +4211,7 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 376, /* (181) cmd ::= ALTER TABLE alter_table_clause */ 376, /* (182) cmd ::= ALTER STABLE alter_table_clause */ 418, /* (183) alter_table_clause ::= full_table_name alter_table_options */ - 418, /* (184) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 418, /* (184) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ 418, /* (185) alter_table_clause ::= full_table_name DROP COLUMN column_name */ 418, /* (186) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ 418, /* (187) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ @@ -4923,7 +4964,7 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (181) cmd ::= ALTER TABLE alter_table_clause */ -3, /* (182) cmd ::= ALTER STABLE alter_table_clause */ -2, /* (183) alter_table_clause ::= full_table_name alter_table_options */ - -5, /* (184) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + -6, /* (184) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -4, /* (185) alter_table_clause ::= full_table_name DROP COLUMN column_name */ -5, /* (186) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -5, /* (187) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ @@ -5529,15 +5570,21 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ +#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 5575 "sql.c" yy_destructor(yypParser,377,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ +#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 5581 "sql.c" yy_destructor(yypParser,378,&yymsp[0].minor); break; case 2: /* account_options ::= */ +#line 55 "sql.y" { } +#line 5587 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5549,18 +5596,24 @@ static YYACTIONTYPE yy_reduce( 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,377,&yymsp[-2].minor); +#line 56 "sql.y" { } +#line 5601 "sql.c" yy_destructor(yypParser,379,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ { yy_destructor(yypParser,380,&yymsp[0].minor); +#line 68 "sql.y" { } +#line 5609 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,378,&yymsp[-1].minor); +#line 69 "sql.y" { } +#line 5616 "sql.c" yy_destructor(yypParser,380,&yymsp[0].minor); } break; @@ -5574,19 +5627,27 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); +#line 73 "sql.y" { } +#line 5632 "sql.c" yy_destructor(yypParser,379,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ +#line 86 "sql.y" { yylhsminor.yy748 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5638 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ +#line 87 "sql.y" { yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5644 "sql.c" yymsp[-2].minor.yy748 = yylhsminor.yy748; break; case 26: /* white_list ::= HOST ip_range_list */ +#line 91 "sql.y" { yymsp[-1].minor.yy748 = yymsp[0].minor.yy748; } +#line 5650 "sql.c" break; case 27: /* white_list_opt ::= */ case 200: /* specific_cols_opt ::= */ yytestcase(yyruleno==200); @@ -5597,89 +5658,137 @@ static YYACTIONTYPE yy_reduce( case 671: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==671); case 701: /* group_by_clause_opt ::= */ yytestcase(yyruleno==701); case 721: /* order_by_clause_opt ::= */ yytestcase(yyruleno==721); +#line 95 "sql.y" { yymsp[1].minor.yy748 = NULL; } +#line 5663 "sql.c" break; case 28: /* white_list_opt ::= white_list */ case 239: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==239); case 409: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==409); case 579: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==579); +#line 96 "sql.y" { yylhsminor.yy748 = yymsp[0].minor.yy748; } +#line 5671 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ +#line 100 "sql.y" { pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy649, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy663); pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy748); } +#line 5680 "sql.c" break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ +#line 104 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 5685 "sql.c" break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ +#line 105 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 5690 "sql.c" break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ +#line 106 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 5695 "sql.c" break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ +#line 107 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy748); } +#line 5700 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ +#line 108 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy748); } +#line 5705 "sql.c" break; case 35: /* cmd ::= DROP USER user_name */ +#line 109 "sql.y" { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy649); } +#line 5710 "sql.c" break; case 36: /* sysinfo_opt ::= */ +#line 113 "sql.y" { yymsp[1].minor.yy663 = 1; } +#line 5715 "sql.c" break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ +#line 114 "sql.y" { yymsp[-1].minor.yy663 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5720 "sql.c" break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ +#line 117 "sql.y" { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy941, &yymsp[-3].minor.yy781, &yymsp[0].minor.yy649, yymsp[-2].minor.yy600); } +#line 5725 "sql.c" break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ +#line 118 "sql.y" { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy941, &yymsp[-3].minor.yy781, &yymsp[0].minor.yy649, yymsp[-2].minor.yy600); } +#line 5730 "sql.c" break; case 40: /* privileges ::= ALL */ +#line 122 "sql.y" { yymsp[0].minor.yy941 = PRIVILEGE_TYPE_ALL; } +#line 5735 "sql.c" break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); +#line 123 "sql.y" { yylhsminor.yy941 = yymsp[0].minor.yy941; } +#line 5741 "sql.c" yymsp[0].minor.yy941 = yylhsminor.yy941; break; case 42: /* privileges ::= SUBSCRIBE */ +#line 124 "sql.y" { yymsp[0].minor.yy941 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 5747 "sql.c" break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ +#line 129 "sql.y" { yylhsminor.yy941 = yymsp[-2].minor.yy941 | yymsp[0].minor.yy941; } +#line 5752 "sql.c" yymsp[-2].minor.yy941 = yylhsminor.yy941; break; case 45: /* priv_type ::= READ */ +#line 133 "sql.y" { yymsp[0].minor.yy941 = PRIVILEGE_TYPE_READ; } +#line 5758 "sql.c" break; case 46: /* priv_type ::= WRITE */ +#line 134 "sql.y" { yymsp[0].minor.yy941 = PRIVILEGE_TYPE_WRITE; } +#line 5763 "sql.c" break; case 47: /* priv_type ::= ALTER */ +#line 135 "sql.y" { yymsp[0].minor.yy941 = PRIVILEGE_TYPE_ALTER; } +#line 5768 "sql.c" break; case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ +#line 139 "sql.y" { yylhsminor.yy781.first = yymsp[-2].minor.yy0; yylhsminor.yy781.second = yymsp[0].minor.yy0; } +#line 5773 "sql.c" yymsp[-2].minor.yy781 = yylhsminor.yy781; break; case 49: /* priv_level ::= db_name NK_DOT NK_STAR */ +#line 140 "sql.y" { yylhsminor.yy781.first = yymsp[-2].minor.yy649; yylhsminor.yy781.second = yymsp[0].minor.yy0; } +#line 5779 "sql.c" yymsp[-2].minor.yy781 = yylhsminor.yy781; break; case 50: /* priv_level ::= db_name NK_DOT table_name */ +#line 141 "sql.y" { yylhsminor.yy781.first = yymsp[-2].minor.yy649; yylhsminor.yy781.second = yymsp[0].minor.yy649; } +#line 5785 "sql.c" yymsp[-2].minor.yy781 = yylhsminor.yy781; break; case 51: /* priv_level ::= topic_name */ +#line 142 "sql.y" { yylhsminor.yy781.first = yymsp[0].minor.yy649; yylhsminor.yy781.second = nil_token; } +#line 5791 "sql.c" yymsp[0].minor.yy781 = yylhsminor.yy781; break; case 52: /* with_opt ::= */ @@ -5701,50 +5810,78 @@ static YYACTIONTYPE yy_reduce( case 710: /* every_opt ::= */ yytestcase(yyruleno==710); case 723: /* slimit_clause_opt ::= */ yytestcase(yyruleno==723); case 727: /* limit_clause_opt ::= */ yytestcase(yyruleno==727); +#line 144 "sql.y" { yymsp[1].minor.yy600 = NULL; } +#line 5815 "sql.c" break; case 53: /* with_opt ::= WITH search_condition */ case 620: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==620); case 647: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==647); case 670: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==670); case 706: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==706); +#line 145 "sql.y" { yymsp[-1].minor.yy600 = yymsp[0].minor.yy600; } +#line 5824 "sql.c" break; case 54: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ +#line 148 "sql.y" { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } +#line 5829 "sql.c" break; case 55: /* cmd ::= CREATE DNODE dnode_endpoint */ +#line 151 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy649, NULL); } +#line 5834 "sql.c" break; case 56: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ +#line 152 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0); } +#line 5839 "sql.c" break; case 57: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ +#line 153 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy705, false); } +#line 5844 "sql.c" break; case 58: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ +#line 154 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy705, false); } +#line 5849 "sql.c" break; case 59: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ +#line 155 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy705); } +#line 5854 "sql.c" break; case 60: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ +#line 156 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy649, false, yymsp[0].minor.yy705); } +#line 5859 "sql.c" break; case 61: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ +#line 157 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } +#line 5864 "sql.c" break; case 62: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ +#line 158 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5869 "sql.c" break; case 63: /* cmd ::= ALTER ALL DNODES NK_STRING */ +#line 159 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } +#line 5874 "sql.c" break; case 64: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ +#line 160 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5879 "sql.c" break; case 65: /* cmd ::= RESTORE DNODE NK_INTEGER */ +#line 161 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } +#line 5884 "sql.c" break; case 66: /* dnode_endpoint ::= NK_STRING */ case 67: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==67); @@ -5780,7 +5917,9 @@ static YYACTIONTYPE yy_reduce( case 575: /* star_func ::= FIRST */ yytestcase(yyruleno==575); case 576: /* star_func ::= LAST */ yytestcase(yyruleno==576); case 577: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==577); +#line 165 "sql.y" { yylhsminor.yy649 = yymsp[0].minor.yy0; } +#line 5922 "sql.c" yymsp[0].minor.yy649 = yylhsminor.yy649; break; case 69: /* force_opt ::= */ @@ -5792,7 +5931,9 @@ static YYACTIONTYPE yy_reduce( case 422: /* ignore_opt ::= */ yytestcase(yyruleno==422); case 657: /* tag_mode_opt ::= */ yytestcase(yyruleno==657); case 659: /* set_quantifier_opt ::= */ yytestcase(yyruleno==659); +#line 171 "sql.y" { yymsp[1].minor.yy705 = false; } +#line 5936 "sql.c" break; case 70: /* force_opt ::= FORCE */ case 71: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==71); @@ -5800,318 +5941,486 @@ static YYACTIONTYPE yy_reduce( case 386: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==386); case 658: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==658); case 660: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==660); +#line 172 "sql.y" { yymsp[0].minor.yy705 = true; } +#line 5946 "sql.c" break; case 72: /* cmd ::= ALTER CLUSTER NK_STRING */ +#line 179 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 5951 "sql.c" break; case 73: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ +#line 180 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5956 "sql.c" break; case 74: /* cmd ::= ALTER LOCAL NK_STRING */ +#line 183 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 5961 "sql.c" break; case 75: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ +#line 184 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5966 "sql.c" break; case 76: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ +#line 187 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5971 "sql.c" break; case 77: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ +#line 188 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5976 "sql.c" break; case 78: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ +#line 189 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5981 "sql.c" break; case 79: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ +#line 192 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 5986 "sql.c" break; case 80: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ +#line 193 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 5991 "sql.c" break; case 81: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ +#line 196 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 5996 "sql.c" break; case 82: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ +#line 197 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 6001 "sql.c" break; case 83: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ +#line 200 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6006 "sql.c" break; case 84: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ +#line 201 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6011 "sql.c" break; case 85: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ +#line 202 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6016 "sql.c" break; case 86: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ +#line 205 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } +#line 6021 "sql.c" break; case 87: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +#line 208 "sql.y" { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy705, &yymsp[-1].minor.yy649, yymsp[0].minor.yy600); } +#line 6026 "sql.c" break; case 88: /* cmd ::= DROP DATABASE exists_opt db_name */ +#line 209 "sql.y" { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } +#line 6031 "sql.c" break; case 89: /* cmd ::= USE db_name */ +#line 210 "sql.y" { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } +#line 6036 "sql.c" break; case 90: /* cmd ::= ALTER DATABASE db_name alter_db_options */ +#line 211 "sql.y" { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy600); } +#line 6041 "sql.c" break; case 91: /* cmd ::= FLUSH DATABASE db_name */ +#line 212 "sql.y" { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } +#line 6046 "sql.c" break; case 92: /* cmd ::= TRIM DATABASE db_name speed_opt */ +#line 213 "sql.y" { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy756); } +#line 6051 "sql.c" break; case 93: /* cmd ::= S3MIGRATE DATABASE db_name */ +#line 214 "sql.y" { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } +#line 6056 "sql.c" break; case 94: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +#line 215 "sql.y" { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy649, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 6061 "sql.c" break; case 95: /* not_exists_opt ::= IF NOT EXISTS */ +#line 219 "sql.y" { yymsp[-2].minor.yy705 = true; } +#line 6066 "sql.c" break; case 97: /* exists_opt ::= IF EXISTS */ case 392: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==392); case 423: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==423); +#line 224 "sql.y" { yymsp[-1].minor.yy705 = true; } +#line 6073 "sql.c" break; case 99: /* db_options ::= */ +#line 227 "sql.y" { yymsp[1].minor.yy600 = createDefaultDatabaseOptions(pCxt); } +#line 6078 "sql.c" break; case 100: /* db_options ::= db_options BUFFER NK_INTEGER */ +#line 228 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } +#line 6083 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 101: /* db_options ::= db_options CACHEMODEL NK_STRING */ +#line 229 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } +#line 6089 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 102: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +#line 230 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } +#line 6095 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 103: /* db_options ::= db_options COMP NK_INTEGER */ +#line 231 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_COMP, &yymsp[0].minor.yy0); } +#line 6101 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 104: /* db_options ::= db_options DURATION NK_INTEGER */ case 105: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==105); +#line 232 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } +#line 6108 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 106: /* db_options ::= db_options MAXROWS NK_INTEGER */ +#line 234 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } +#line 6114 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 107: /* db_options ::= db_options MINROWS NK_INTEGER */ +#line 235 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } +#line 6120 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 108: /* db_options ::= db_options KEEP integer_list */ case 109: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==109); +#line 236 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_KEEP, yymsp[0].minor.yy748); } +#line 6127 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 110: /* db_options ::= db_options PAGES NK_INTEGER */ +#line 238 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } +#line 6133 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 111: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +#line 239 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6139 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 112: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +#line 240 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6145 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 113: /* db_options ::= db_options PRECISION NK_STRING */ +#line 241 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } +#line 6151 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 114: /* db_options ::= db_options REPLICA NK_INTEGER */ +#line 242 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } +#line 6157 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 115: /* db_options ::= db_options VGROUPS NK_INTEGER */ +#line 244 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } +#line 6163 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 116: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +#line 245 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } +#line 6169 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 117: /* db_options ::= db_options RETENTIONS retention_list */ +#line 246 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_RETENTIONS, yymsp[0].minor.yy748); } +#line 6175 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 118: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +#line 247 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } +#line 6181 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 119: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +#line 248 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL, &yymsp[0].minor.yy0); } +#line 6187 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 120: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +#line 249 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } +#line 6193 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 121: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +#line 250 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } +#line 6199 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 122: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 251 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &t); } +#line 6209 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 123: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +#line 256 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } +#line 6215 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 124: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 257 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &t); } +#line 6225 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 125: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +#line 262 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } +#line 6231 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 126: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +#line 263 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } +#line 6237 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 127: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +#line 264 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } +#line 6243 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 128: /* db_options ::= db_options TABLE_PREFIX signed */ +#line 265 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy600); } +#line 6249 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 129: /* db_options ::= db_options TABLE_SUFFIX signed */ +#line 266 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy600); } +#line 6255 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 130: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ +#line 267 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } +#line 6261 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 131: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 132: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==132); +#line 268 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } +#line 6268 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 133: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ +#line 270 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } +#line 6274 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 134: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ +#line 271 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } +#line 6280 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 135: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ +#line 272 "sql.y" { yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } +#line 6286 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 136: /* alter_db_options ::= alter_db_option */ +#line 274 "sql.y" { yylhsminor.yy600 = createAlterDatabaseOptions(pCxt); yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yylhsminor.yy600, &yymsp[0].minor.yy145); } +#line 6292 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 137: /* alter_db_options ::= alter_db_options alter_db_option */ +#line 275 "sql.y" { yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy600, &yymsp[0].minor.yy145); } +#line 6298 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 138: /* alter_db_option ::= BUFFER NK_INTEGER */ +#line 279 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6304 "sql.c" break; case 139: /* alter_db_option ::= CACHEMODEL NK_STRING */ +#line 280 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6309 "sql.c" break; case 140: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +#line 281 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6314 "sql.c" break; case 141: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +#line 282 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6319 "sql.c" break; case 142: /* alter_db_option ::= KEEP integer_list */ case 143: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==143); +#line 283 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_KEEP; yymsp[-1].minor.yy145.pList = yymsp[0].minor.yy748; } +#line 6325 "sql.c" break; case 144: /* alter_db_option ::= PAGES NK_INTEGER */ +#line 285 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_PAGES; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6330 "sql.c" break; case 145: /* alter_db_option ::= REPLICA NK_INTEGER */ +#line 286 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6335 "sql.c" break; case 146: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +#line 288 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_WAL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6340 "sql.c" break; case 147: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +#line 289 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6345 "sql.c" break; case 148: /* alter_db_option ::= MINROWS NK_INTEGER */ +#line 290 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6350 "sql.c" break; case 149: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ +#line 291 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6355 "sql.c" break; case 150: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 292 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yymsp[-2].minor.yy145.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy145.val = t; } +#line 6364 "sql.c" break; case 151: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ +#line 297 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6369 "sql.c" break; case 152: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 298 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yymsp[-2].minor.yy145.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy145.val = t; } +#line 6378 "sql.c" break; case 153: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 154: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==154); +#line 303 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6384 "sql.c" break; case 155: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ +#line 305 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6389 "sql.c" break; case 156: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ +#line 306 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6394 "sql.c" break; case 157: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ +#line 307 "sql.y" { yymsp[-1].minor.yy145.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6399 "sql.c" break; case 158: /* integer_list ::= NK_INTEGER */ +#line 311 "sql.y" { yylhsminor.yy748 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6404 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 159: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 437: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==437); +#line 312 "sql.y" { yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6411 "sql.c" yymsp[-2].minor.yy748 = yylhsminor.yy748; break; case 160: /* variable_list ::= NK_VARIABLE */ +#line 316 "sql.y" { yylhsminor.yy748 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6417 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 161: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +#line 317 "sql.y" { yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6423 "sql.c" yymsp[-2].minor.yy748 = yylhsminor.yy748; break; case 162: /* retention_list ::= retention */ @@ -6131,7 +6440,9 @@ static YYACTIONTYPE yy_reduce( case 662: /* select_list ::= select_item */ yytestcase(yyruleno==662); case 673: /* partition_list ::= partition_item */ yytestcase(yyruleno==673); case 734: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==734); +#line 321 "sql.y" { yylhsminor.yy748 = createNodeList(pCxt, yymsp[0].minor.yy600); } +#line 6445 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 163: /* retention_list ::= retention_list NK_COMMA retention */ @@ -6149,750 +6460,1178 @@ static YYACTIONTYPE yy_reduce( case 663: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==663); case 674: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==674); case 735: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==735); +#line 322 "sql.y" { yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, yymsp[0].minor.yy600); } +#line 6465 "sql.c" yymsp[-2].minor.yy748 = yylhsminor.yy748; break; case 164: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 165: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==165); +#line 324 "sql.y" { yylhsminor.yy600 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6472 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 166: /* speed_opt ::= */ case 387: /* bufsize_opt ::= */ yytestcase(yyruleno==387); +#line 329 "sql.y" { yymsp[1].minor.yy756 = 0; } +#line 6479 "sql.c" break; case 167: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 388: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==388); +#line 330 "sql.y" { yymsp[-1].minor.yy756 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +#line 6485 "sql.c" break; case 169: /* start_opt ::= START WITH NK_INTEGER */ case 173: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==173); +#line 333 "sql.y" { yymsp[-2].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 6491 "sql.c" break; case 170: /* start_opt ::= START WITH NK_STRING */ case 174: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==174); +#line 334 "sql.y" { yymsp[-2].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6497 "sql.c" break; case 171: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 175: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==175); +#line 335 "sql.y" { yymsp[-3].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6503 "sql.c" break; case 176: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 178: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==178); +#line 344 "sql.y" { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy705, yymsp[-5].minor.yy600, yymsp[-3].minor.yy748, yymsp[-1].minor.yy748, yymsp[0].minor.yy600); } +#line 6509 "sql.c" break; case 177: /* cmd ::= CREATE TABLE multi_create_clause */ +#line 345 "sql.y" { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy748); } +#line 6514 "sql.c" break; case 179: /* cmd ::= DROP TABLE multi_drop_clause */ +#line 348 "sql.y" { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy748); } +#line 6519 "sql.c" break; case 180: /* cmd ::= DROP STABLE exists_opt full_table_name */ +#line 349 "sql.y" { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } +#line 6524 "sql.c" break; case 181: /* cmd ::= ALTER TABLE alter_table_clause */ case 439: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==439); case 440: /* cmd ::= insert_query */ yytestcase(yyruleno==440); +#line 351 "sql.y" { pCxt->pRootNode = yymsp[0].minor.yy600; } +#line 6531 "sql.c" break; case 182: /* cmd ::= ALTER STABLE alter_table_clause */ +#line 352 "sql.y" { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy600); } +#line 6536 "sql.c" break; case 183: /* alter_table_clause ::= full_table_name alter_table_options */ +#line 354 "sql.y" { yylhsminor.yy600 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 6541 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 184: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; + case 184: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ +#line 356 "sql.y" +{ yylhsminor.yy600 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy600, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy649, yymsp[-1].minor.yy400, yymsp[0].minor.yy600); } +#line 6547 "sql.c" + yymsp[-5].minor.yy600 = yylhsminor.yy600; break; case 185: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +#line 357 "sql.y" { yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy649); } +#line 6553 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 186: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +#line 359 "sql.y" { yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } +#line 6559 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 187: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ +#line 361 "sql.y" { yylhsminor.yy600 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy649, yymsp[0].minor.yy600); } +#line 6565 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 188: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +#line 363 "sql.y" { yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } +#line 6571 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 189: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +#line 365 "sql.y" { yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } +#line 6577 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 190: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +#line 366 "sql.y" { yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy649); } +#line 6583 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 191: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +#line 368 "sql.y" { yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } +#line 6589 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 192: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +#line 370 "sql.y" { yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } +#line 6595 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 193: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ +#line 372 "sql.y" { yylhsminor.yy600 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy600, &yymsp[-2].minor.yy649, yymsp[0].minor.yy600); } +#line 6601 "sql.c" yymsp[-5].minor.yy600 = yylhsminor.yy600; break; case 195: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 587: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==587); +#line 377 "sql.y" { yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-1].minor.yy748, yymsp[0].minor.yy600); } +#line 6608 "sql.c" yymsp[-1].minor.yy748 = yylhsminor.yy748; break; case 196: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ +#line 381 "sql.y" { yylhsminor.yy600 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy705, yymsp[-8].minor.yy600, yymsp[-6].minor.yy600, yymsp[-5].minor.yy748, yymsp[-2].minor.yy748, yymsp[0].minor.yy600); } +#line 6614 "sql.c" yymsp[-9].minor.yy600 = yylhsminor.yy600; break; case 199: /* drop_table_clause ::= exists_opt full_table_name */ +#line 388 "sql.y" { yylhsminor.yy600 = createDropTableClause(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } +#line 6620 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 201: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ case 402: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==402); +#line 393 "sql.y" { yymsp[-2].minor.yy748 = yymsp[-1].minor.yy748; } +#line 6627 "sql.c" break; case 202: /* full_table_name ::= table_name */ case 343: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==343); +#line 395 "sql.y" { yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy649, NULL); } +#line 6633 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 203: /* full_table_name ::= db_name NK_DOT table_name */ case 344: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==344); +#line 396 "sql.y" { yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649, NULL); } +#line 6640 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 206: /* tag_def ::= column_name type_name */ +#line 402 "sql.y" { yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400, NULL); } +#line 6646 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 209: /* column_def ::= column_name type_name column_options */ +#line 410 "sql.y" { yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy649, yymsp[-1].minor.yy400, yymsp[0].minor.yy600); } +#line 6652 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 210: /* type_name ::= BOOL */ +#line 414 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BOOL); } +#line 6658 "sql.c" break; case 211: /* type_name ::= TINYINT */ +#line 415 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 6663 "sql.c" break; case 212: /* type_name ::= SMALLINT */ +#line 416 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 6668 "sql.c" break; case 213: /* type_name ::= INT */ case 214: /* type_name ::= INTEGER */ yytestcase(yyruleno==214); +#line 417 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_INT); } +#line 6674 "sql.c" break; case 215: /* type_name ::= BIGINT */ +#line 419 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 6679 "sql.c" break; case 216: /* type_name ::= FLOAT */ +#line 420 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 6684 "sql.c" break; case 217: /* type_name ::= DOUBLE */ +#line 421 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 6689 "sql.c" break; case 218: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +#line 422 "sql.y" { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 6694 "sql.c" break; case 219: /* type_name ::= TIMESTAMP */ +#line 423 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +#line 6699 "sql.c" break; case 220: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +#line 424 "sql.y" { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +#line 6704 "sql.c" break; case 221: /* type_name ::= TINYINT UNSIGNED */ +#line 425 "sql.y" { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +#line 6709 "sql.c" break; case 222: /* type_name ::= SMALLINT UNSIGNED */ +#line 426 "sql.y" { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +#line 6714 "sql.c" break; case 223: /* type_name ::= INT UNSIGNED */ +#line 427 "sql.y" { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UINT); } +#line 6719 "sql.c" break; case 224: /* type_name ::= BIGINT UNSIGNED */ +#line 428 "sql.y" { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +#line 6724 "sql.c" break; case 225: /* type_name ::= JSON */ +#line 429 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_JSON); } +#line 6729 "sql.c" break; case 226: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +#line 430 "sql.y" { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +#line 6734 "sql.c" break; case 227: /* type_name ::= MEDIUMBLOB */ +#line 431 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +#line 6739 "sql.c" break; case 228: /* type_name ::= BLOB */ +#line 432 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BLOB); } +#line 6744 "sql.c" break; case 229: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +#line 433 "sql.y" { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +#line 6749 "sql.c" break; case 230: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +#line 434 "sql.y" { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +#line 6754 "sql.c" break; case 231: /* type_name ::= DECIMAL */ +#line 435 "sql.y" { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6759 "sql.c" break; case 232: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +#line 436 "sql.y" { yymsp[-3].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6764 "sql.c" break; case 233: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 437 "sql.y" { yymsp[-5].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6769 "sql.c" break; case 234: /* type_name_default_len ::= BINARY */ +#line 441 "sql.y" { yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } +#line 6774 "sql.c" break; case 235: /* type_name_default_len ::= NCHAR */ +#line 442 "sql.y" { yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } +#line 6779 "sql.c" break; case 236: /* type_name_default_len ::= VARCHAR */ +#line 443 "sql.y" { yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } +#line 6784 "sql.c" break; case 237: /* type_name_default_len ::= VARBINARY */ +#line 444 "sql.y" { yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } +#line 6789 "sql.c" break; case 240: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ case 410: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==410); +#line 453 "sql.y" { yymsp[-3].minor.yy748 = yymsp[-1].minor.yy748; } +#line 6795 "sql.c" break; case 241: /* table_options ::= */ +#line 455 "sql.y" { yymsp[1].minor.yy600 = createDefaultTableOptions(pCxt); } +#line 6800 "sql.c" break; case 242: /* table_options ::= table_options COMMENT NK_STRING */ +#line 456 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } +#line 6805 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 243: /* table_options ::= table_options MAX_DELAY duration_list */ +#line 457 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy748); } +#line 6811 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 244: /* table_options ::= table_options WATERMARK duration_list */ +#line 458 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy748); } +#line 6817 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 245: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +#line 459 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy748); } +#line 6823 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 246: /* table_options ::= table_options TTL NK_INTEGER */ +#line 460 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } +#line 6829 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 247: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +#line 461 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_SMA, yymsp[-1].minor.yy748); } +#line 6835 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 248: /* table_options ::= table_options DELETE_MARK duration_list */ +#line 462 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy748); } +#line 6841 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 249: /* alter_table_options ::= alter_table_option */ +#line 464 "sql.y" { yylhsminor.yy600 = createAlterTableOptions(pCxt); yylhsminor.yy600 = setTableOption(pCxt, yylhsminor.yy600, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } +#line 6847 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 250: /* alter_table_options ::= alter_table_options alter_table_option */ +#line 465 "sql.y" { yylhsminor.yy600 = setTableOption(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } +#line 6853 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 251: /* alter_table_option ::= COMMENT NK_STRING */ +#line 469 "sql.y" { yymsp[-1].minor.yy145.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6859 "sql.c" break; case 252: /* alter_table_option ::= TTL NK_INTEGER */ +#line 470 "sql.y" { yymsp[-1].minor.yy145.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +#line 6864 "sql.c" break; case 253: /* duration_list ::= duration_literal */ case 539: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==539); +#line 474 "sql.y" { yylhsminor.yy748 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } +#line 6870 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 254: /* duration_list ::= duration_list NK_COMMA duration_literal */ case 540: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==540); +#line 475 "sql.y" { yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } +#line 6877 "sql.c" yymsp[-2].minor.yy748 = yylhsminor.yy748; break; case 257: /* rollup_func_name ::= function_name */ +#line 482 "sql.y" { yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy649, NULL); } +#line 6883 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 258: /* rollup_func_name ::= FIRST */ case 259: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==259); case 332: /* tag_item ::= QTAGS */ yytestcase(yyruleno==332); +#line 483 "sql.y" { yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6891 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 262: /* col_name ::= column_name */ case 333: /* tag_item ::= column_name */ yytestcase(yyruleno==333); +#line 491 "sql.y" { yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy649); } +#line 6898 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 263: /* cmd ::= SHOW DNODES */ +#line 494 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } +#line 6904 "sql.c" break; case 264: /* cmd ::= SHOW USERS */ +#line 495 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } +#line 6909 "sql.c" break; case 265: /* cmd ::= SHOW USER PRIVILEGES */ +#line 496 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } +#line 6914 "sql.c" break; case 266: /* cmd ::= SHOW db_kind_opt DATABASES */ +#line 497 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy245); } +#line 6922 "sql.c" break; case 267: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ +#line 501 "sql.y" { pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy125, yymsp[0].minor.yy600, OP_TYPE_LIKE); } +#line 6929 "sql.c" break; case 268: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +#line 504 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); } +#line 6934 "sql.c" break; case 269: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +#line 505 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy600, NULL, OP_TYPE_LIKE); } +#line 6939 "sql.c" break; case 270: /* cmd ::= SHOW MNODES */ +#line 506 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } +#line 6944 "sql.c" break; case 271: /* cmd ::= SHOW QNODES */ +#line 508 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } +#line 6949 "sql.c" break; case 272: /* cmd ::= SHOW ARBGROUPS */ +#line 509 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } +#line 6954 "sql.c" break; case 273: /* cmd ::= SHOW FUNCTIONS */ +#line 510 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } +#line 6959 "sql.c" break; case 274: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +#line 511 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); } +#line 6964 "sql.c" break; case 275: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +#line 512 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy649), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649), OP_TYPE_EQUAL); } +#line 6969 "sql.c" break; case 276: /* cmd ::= SHOW STREAMS */ +#line 513 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } +#line 6974 "sql.c" break; case 277: /* cmd ::= SHOW ACCOUNTS */ +#line 514 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 6979 "sql.c" break; case 278: /* cmd ::= SHOW APPS */ +#line 515 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } +#line 6984 "sql.c" break; case 279: /* cmd ::= SHOW CONNECTIONS */ +#line 516 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } +#line 6989 "sql.c" break; case 280: /* cmd ::= SHOW LICENCES */ case 281: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==281); +#line 517 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } +#line 6995 "sql.c" break; case 282: /* cmd ::= SHOW GRANTS FULL */ +#line 519 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } +#line 7000 "sql.c" break; case 283: /* cmd ::= SHOW GRANTS LOGS */ +#line 520 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } +#line 7005 "sql.c" break; case 284: /* cmd ::= SHOW CLUSTER MACHINES */ +#line 521 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } +#line 7010 "sql.c" break; case 285: /* cmd ::= SHOW CREATE DATABASE db_name */ +#line 522 "sql.y" { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } +#line 7015 "sql.c" break; case 286: /* cmd ::= SHOW CREATE TABLE full_table_name */ +#line 523 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy600); } +#line 7020 "sql.c" break; case 287: /* cmd ::= SHOW CREATE STABLE full_table_name */ +#line 524 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy600); } +#line 7026 "sql.c" break; case 288: /* cmd ::= SHOW ENCRYPTIONS */ +#line 526 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } +#line 7031 "sql.c" break; case 289: /* cmd ::= SHOW QUERIES */ +#line 527 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } +#line 7036 "sql.c" break; case 290: /* cmd ::= SHOW SCORES */ +#line 528 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } +#line 7041 "sql.c" break; case 291: /* cmd ::= SHOW TOPICS */ +#line 529 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } +#line 7046 "sql.c" break; case 292: /* cmd ::= SHOW VARIABLES */ case 293: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==293); +#line 530 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } +#line 7052 "sql.c" break; case 294: /* cmd ::= SHOW LOCAL VARIABLES */ +#line 532 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } +#line 7057 "sql.c" break; case 295: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +#line 533 "sql.y" { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy600); } +#line 7062 "sql.c" break; case 296: /* cmd ::= SHOW BNODES */ +#line 534 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } +#line 7067 "sql.c" break; case 297: /* cmd ::= SHOW SNODES */ +#line 535 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } +#line 7072 "sql.c" break; case 298: /* cmd ::= SHOW CLUSTER */ +#line 536 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } +#line 7077 "sql.c" break; case 299: /* cmd ::= SHOW TRANSACTIONS */ +#line 537 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } +#line 7082 "sql.c" break; case 300: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +#line 538 "sql.y" { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy600); } +#line 7087 "sql.c" break; case 301: /* cmd ::= SHOW CONSUMERS */ +#line 539 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } +#line 7092 "sql.c" break; case 302: /* cmd ::= SHOW SUBSCRIPTIONS */ +#line 540 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } +#line 7097 "sql.c" break; case 303: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +#line 541 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); } +#line 7102 "sql.c" break; case 304: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +#line 542 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy649), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649), OP_TYPE_EQUAL); } +#line 7107 "sql.c" break; case 305: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +#line 543 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600, yymsp[-3].minor.yy748); } +#line 7112 "sql.c" break; case 306: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +#line 544 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy649), yymsp[-4].minor.yy748); } +#line 7117 "sql.c" break; case 307: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ +#line 545 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } +#line 7122 "sql.c" break; case 308: /* cmd ::= SHOW VNODES */ +#line 546 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } +#line 7127 "sql.c" break; case 309: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +#line 548 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy600, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +#line 7132 "sql.c" break; case 310: /* cmd ::= SHOW CLUSTER ALIVE */ +#line 549 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } +#line 7137 "sql.c" break; case 311: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ +#line 550 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); } +#line 7142 "sql.c" break; case 312: /* cmd ::= SHOW CREATE VIEW full_table_name */ +#line 551 "sql.y" { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy600); } +#line 7147 "sql.c" break; case 313: /* cmd ::= SHOW COMPACTS */ +#line 552 "sql.y" { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } +#line 7152 "sql.c" break; case 314: /* cmd ::= SHOW COMPACT NK_INTEGER */ +#line 553 "sql.y" { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 7157 "sql.c" break; case 315: /* table_kind_db_name_cond_opt ::= */ +#line 557 "sql.y" { yymsp[1].minor.yy125.kind = SHOW_KIND_ALL; yymsp[1].minor.yy125.dbName = nil_token; } +#line 7162 "sql.c" break; case 316: /* table_kind_db_name_cond_opt ::= table_kind */ +#line 558 "sql.y" { yylhsminor.yy125.kind = yymsp[0].minor.yy245; yylhsminor.yy125.dbName = nil_token; } +#line 7167 "sql.c" yymsp[0].minor.yy125 = yylhsminor.yy125; break; case 317: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +#line 559 "sql.y" { yylhsminor.yy125.kind = SHOW_KIND_ALL; yylhsminor.yy125.dbName = yymsp[-1].minor.yy649; } +#line 7173 "sql.c" yymsp[-1].minor.yy125 = yylhsminor.yy125; break; case 318: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +#line 560 "sql.y" { yylhsminor.yy125.kind = yymsp[-2].minor.yy245; yylhsminor.yy125.dbName = yymsp[-1].minor.yy649; } +#line 7179 "sql.c" yymsp[-2].minor.yy125 = yylhsminor.yy125; break; case 319: /* table_kind ::= NORMAL */ +#line 564 "sql.y" { yymsp[0].minor.yy245 = SHOW_KIND_TABLES_NORMAL; } +#line 7185 "sql.c" break; case 320: /* table_kind ::= CHILD */ +#line 565 "sql.y" { yymsp[0].minor.yy245 = SHOW_KIND_TABLES_CHILD; } +#line 7190 "sql.c" break; case 321: /* db_name_cond_opt ::= */ case 326: /* from_db_opt ::= */ yytestcase(yyruleno==326); +#line 567 "sql.y" { yymsp[1].minor.yy600 = createDefaultDatabaseCondValue(pCxt); } +#line 7196 "sql.c" break; case 322: /* db_name_cond_opt ::= db_name NK_DOT */ +#line 568 "sql.y" { yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy649); } +#line 7201 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 324: /* like_pattern_opt ::= LIKE NK_STRING */ +#line 571 "sql.y" { yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7207 "sql.c" break; case 325: /* table_name_cond ::= table_name */ +#line 573 "sql.y" { yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649); } +#line 7212 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 327: /* from_db_opt ::= FROM db_name */ +#line 576 "sql.y" { yymsp[-1].minor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649); } +#line 7218 "sql.c" break; case 331: /* tag_item ::= TBNAME */ +#line 584 "sql.y" { yylhsminor.yy600 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } +#line 7223 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 334: /* tag_item ::= column_name column_alias */ +#line 587 "sql.y" { yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy649), &yymsp[0].minor.yy649); } +#line 7229 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 335: /* tag_item ::= column_name AS column_alias */ +#line 588 "sql.y" { yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy649), &yymsp[0].minor.yy649); } +#line 7235 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 336: /* db_kind_opt ::= */ +#line 592 "sql.y" { yymsp[1].minor.yy245 = SHOW_KIND_ALL; } +#line 7241 "sql.c" break; case 337: /* db_kind_opt ::= USER */ +#line 593 "sql.y" { yymsp[0].minor.yy245 = SHOW_KIND_DATABASES_USER; } +#line 7246 "sql.c" break; case 338: /* db_kind_opt ::= SYSTEM */ +#line 594 "sql.y" { yymsp[0].minor.yy245 = SHOW_KIND_DATABASES_SYSTEM; } +#line 7251 "sql.c" break; case 339: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ +#line 600 "sql.y" { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy705, &yymsp[-7].minor.yy649, yymsp[-4].minor.yy600, yymsp[-5].minor.yy600, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 7256 "sql.c" break; case 340: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ +#line 602 "sql.y" { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy705, &yymsp[-6].minor.yy649, NULL, yymsp[-4].minor.yy600, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 7261 "sql.c" break; case 341: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ +#line 603 "sql.y" { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } +#line 7266 "sql.c" break; case 342: /* cmd ::= SHOW db_name_cond_opt TSMAS */ +#line 604 "sql.y" { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy600); } +#line 7271 "sql.c" break; case 345: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ +#line 611 "sql.y" { yymsp[-3].minor.yy600 = createTSMAOptions(pCxt, yymsp[-1].minor.yy748); } +#line 7276 "sql.c" break; case 346: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +#line 615 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy705, yymsp[-3].minor.yy600, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } +#line 7281 "sql.c" break; case 347: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +#line 617 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy705, yymsp[-5].minor.yy600, yymsp[-3].minor.yy600, yymsp[-1].minor.yy748, NULL); } +#line 7286 "sql.c" break; case 348: /* cmd ::= DROP INDEX exists_opt full_index_name */ +#line 618 "sql.y" { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } +#line 7291 "sql.c" break; case 349: /* full_index_name ::= index_name */ +#line 620 "sql.y" { yylhsminor.yy600 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy649); } +#line 7296 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 350: /* full_index_name ::= db_name NK_DOT index_name */ +#line 621 "sql.y" { yylhsminor.yy600 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649); } +#line 7302 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 351: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 624 "sql.y" { yymsp[-9].minor.yy600 = createIndexOption(pCxt, yymsp[-7].minor.yy748, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 7308 "sql.c" break; case 352: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 627 "sql.y" { yymsp[-11].minor.yy600 = createIndexOption(pCxt, yymsp[-9].minor.yy748, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 7313 "sql.c" break; case 355: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +#line 634 "sql.y" { yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[-3].minor.yy649, yymsp[-1].minor.yy748); } +#line 7318 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 356: /* sma_func_name ::= function_name */ case 630: /* alias_opt ::= table_alias */ yytestcase(yyruleno==630); +#line 638 "sql.y" { yylhsminor.yy649 = yymsp[0].minor.yy649; } +#line 7325 "sql.c" yymsp[0].minor.yy649 = yylhsminor.yy649; break; case 361: /* sma_stream_opt ::= */ case 411: /* stream_options ::= */ yytestcase(yyruleno==411); +#line 644 "sql.y" { yymsp[1].minor.yy600 = createStreamOptions(pCxt); } +#line 7332 "sql.c" break; case 362: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +#line 645 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy600)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } +#line 7337 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 363: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +#line 646 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } +#line 7343 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 364: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +#line 647 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy600)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } +#line 7349 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 365: /* with_meta ::= AS */ +#line 652 "sql.y" { yymsp[0].minor.yy756 = 0; } +#line 7355 "sql.c" break; case 366: /* with_meta ::= WITH META AS */ +#line 653 "sql.y" { yymsp[-2].minor.yy756 = 1; } +#line 7360 "sql.c" break; case 367: /* with_meta ::= ONLY META AS */ +#line 654 "sql.y" { yymsp[-2].minor.yy756 = 2; } +#line 7365 "sql.c" break; case 368: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +#line 656 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy705, &yymsp[-2].minor.yy649, yymsp[0].minor.yy600); } +#line 7370 "sql.c" break; case 369: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +#line 658 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy705, &yymsp[-3].minor.yy649, &yymsp[0].minor.yy649, yymsp[-2].minor.yy756); } +#line 7375 "sql.c" break; case 370: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +#line 660 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy705, &yymsp[-4].minor.yy649, yymsp[-1].minor.yy600, yymsp[-3].minor.yy756, yymsp[0].minor.yy600); } +#line 7380 "sql.c" break; case 371: /* cmd ::= DROP TOPIC exists_opt topic_name */ +#line 662 "sql.y" { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } +#line 7385 "sql.c" break; case 372: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +#line 663 "sql.y" { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy705, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649); } +#line 7390 "sql.c" break; case 373: /* cmd ::= DESC full_table_name */ case 374: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==374); +#line 666 "sql.y" { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy600); } +#line 7396 "sql.c" break; case 375: /* cmd ::= RESET QUERY CACHE */ +#line 670 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } +#line 7401 "sql.c" break; case 376: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 377: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==377); +#line 673 "sql.y" { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy705, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 7407 "sql.c" break; case 380: /* explain_options ::= */ +#line 681 "sql.y" { yymsp[1].minor.yy600 = createDefaultExplainOptions(pCxt); } +#line 7412 "sql.c" break; case 381: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +#line 682 "sql.y" { yylhsminor.yy600 = setExplainVerbose(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } +#line 7417 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 382: /* explain_options ::= explain_options RATIO NK_FLOAT */ +#line 683 "sql.y" { yylhsminor.yy600 = setExplainRatio(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } +#line 7423 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 383: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +#line 688 "sql.y" { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy705, yymsp[-9].minor.yy705, &yymsp[-6].minor.yy649, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy400, yymsp[-1].minor.yy756, &yymsp[0].minor.yy649, yymsp[-10].minor.yy705); } +#line 7429 "sql.c" break; case 384: /* cmd ::= DROP FUNCTION exists_opt function_name */ +#line 689 "sql.y" { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } +#line 7434 "sql.c" break; case 389: /* language_opt ::= */ case 434: /* on_vgroup_id ::= */ yytestcase(yyruleno==434); +#line 703 "sql.y" { yymsp[1].minor.yy649 = nil_token; } +#line 7440 "sql.c" break; case 390: /* language_opt ::= LANGUAGE NK_STRING */ case 435: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==435); +#line 704 "sql.y" { yymsp[-1].minor.yy649 = yymsp[0].minor.yy0; } +#line 7446 "sql.c" break; case 393: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +#line 713 "sql.y" { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy705, yymsp[-2].minor.yy600, &yymsp[-1].minor.yy0, yymsp[0].minor.yy600); } +#line 7451 "sql.c" break; case 394: /* cmd ::= DROP VIEW exists_opt full_view_name */ +#line 714 "sql.y" { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } +#line 7456 "sql.c" break; case 395: /* full_view_name ::= view_name */ +#line 716 "sql.y" { yylhsminor.yy600 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy649); } +#line 7461 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 396: /* full_view_name ::= db_name NK_DOT view_name */ +#line 717 "sql.y" { yylhsminor.yy600 = createViewNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649); } +#line 7467 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 397: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +#line 722 "sql.y" { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy705, &yymsp[-8].minor.yy649, yymsp[-5].minor.yy600, yymsp[-7].minor.yy600, yymsp[-3].minor.yy748, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, yymsp[-4].minor.yy748); } +#line 7473 "sql.c" break; case 398: /* cmd ::= DROP STREAM exists_opt stream_name */ +#line 723 "sql.y" { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } +#line 7478 "sql.c" break; case 399: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +#line 724 "sql.y" { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } +#line 7483 "sql.c" break; case 400: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +#line 725 "sql.y" { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy705, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } +#line 7488 "sql.c" break; case 405: /* column_stream_def ::= column_name stream_col_options */ +#line 738 "sql.y" { yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy649, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy600); } +#line 7493 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 406: /* stream_col_options ::= */ case 743: /* column_options ::= */ yytestcase(yyruleno==743); +#line 739 "sql.y" { yymsp[1].minor.yy600 = createDefaultColumnOptions(pCxt); } +#line 7500 "sql.c" break; case 407: /* stream_col_options ::= stream_col_options PRIMARY KEY */ case 744: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==744); +#line 740 "sql.y" { yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_PRIMARYKEY, NULL); } +#line 7506 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 412: /* stream_options ::= stream_options TRIGGER AT_ONCE */ case 413: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==413); +#line 750 "sql.y" { yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } +#line 7513 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 414: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +#line 752 "sql.y" { yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-3].minor.yy600, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } +#line 7519 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 415: /* stream_options ::= stream_options WATERMARK duration_literal */ +#line 753 "sql.y" { yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } +#line 7525 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 416: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +#line 754 "sql.y" { yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-3].minor.yy600, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } +#line 7531 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 417: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +#line 755 "sql.y" { yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +#line 7537 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 418: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +#line 756 "sql.y" { yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } +#line 7543 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 419: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +#line 757 "sql.y" { yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-3].minor.yy600, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } +#line 7549 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 421: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ case 687: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==687); case 711: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==711); +#line 760 "sql.y" { yymsp[-3].minor.yy600 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy600); } +#line 7557 "sql.c" break; case 424: /* cmd ::= KILL CONNECTION NK_INTEGER */ +#line 768 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } +#line 7562 "sql.c" break; case 425: /* cmd ::= KILL QUERY NK_STRING */ +#line 769 "sql.y" { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } +#line 7567 "sql.c" break; case 426: /* cmd ::= KILL TRANSACTION NK_INTEGER */ +#line 770 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } +#line 7572 "sql.c" break; case 427: /* cmd ::= KILL COMPACT NK_INTEGER */ +#line 771 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } +#line 7577 "sql.c" break; case 428: /* cmd ::= BALANCE VGROUP */ +#line 774 "sql.y" { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } +#line 7582 "sql.c" break; case 429: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +#line 775 "sql.y" { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy649); } +#line 7587 "sql.c" break; case 430: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ +#line 776 "sql.y" { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy649); } +#line 7592 "sql.c" break; case 431: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +#line 777 "sql.y" { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 7597 "sql.c" break; case 432: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +#line 778 "sql.y" { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy748); } +#line 7602 "sql.c" break; case 433: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +#line 779 "sql.y" { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } +#line 7607 "sql.c" break; case 436: /* dnode_list ::= DNODE NK_INTEGER */ +#line 788 "sql.y" { yymsp[-1].minor.yy748 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 7612 "sql.c" break; case 438: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +#line 795 "sql.y" { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 7617 "sql.c" break; case 441: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +#line 804 "sql.y" { yymsp[-6].minor.yy600 = createInsertStmt(pCxt, yymsp[-4].minor.yy600, yymsp[-2].minor.yy748, yymsp[0].minor.yy600); } +#line 7622 "sql.c" break; case 442: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +#line 805 "sql.y" { yymsp[-3].minor.yy600 = createInsertStmt(pCxt, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } +#line 7627 "sql.c" break; case 443: /* tags_literal ::= NK_INTEGER */ case 455: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==455); case 464: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==464); +#line 808 "sql.y" { yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } +#line 7634 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 444: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ @@ -6903,12 +7642,14 @@ yymsp[0].minor.yy600); } case 466: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==466); case 474: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==474); case 475: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==475); +#line 809 "sql.y" { SToken l = yymsp[-2].minor.yy0; SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); l.n = (r.z + r.n) - l.z; yylhsminor.yy600 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy600); } +#line 7652 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 446: /* tags_literal ::= NK_PLUS NK_INTEGER */ @@ -6917,11 +7658,13 @@ yymsp[0].minor.yy600); } case 461: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==461); case 467: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==467); case 470: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==470); +#line 821 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +#line 7667 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 447: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ @@ -6936,71 +7679,97 @@ yymsp[0].minor.yy600); } case 469: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==469); case 471: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==471); case 472: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==472); +#line 826 "sql.y" { SToken l = yymsp[-3].minor.yy0; SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); l.n = (r.z + r.n) - l.z; yylhsminor.yy600 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy600); } +#line 7689 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 452: /* tags_literal ::= NK_FLOAT */ +#line 855 "sql.y" { yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } +#line 7695 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 453: /* tags_literal ::= NK_PLUS NK_FLOAT */ case 454: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==454); +#line 856 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } +#line 7706 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 473: /* tags_literal ::= NK_STRING */ +#line 962 "sql.y" { yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } +#line 7712 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 476: /* tags_literal ::= NK_BOOL */ +#line 975 "sql.y" { yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } +#line 7718 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 477: /* tags_literal ::= NULL */ +#line 976 "sql.y" { yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } +#line 7724 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 478: /* tags_literal ::= literal_func */ +#line 978 "sql.y" { yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy600); } +#line 7730 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 479: /* tags_literal ::= literal_func NK_PLUS duration_literal */ case 480: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==480); +#line 979 "sql.y" { SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); l.n = (r.z + r.n) - l.z; yylhsminor.yy600 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } +#line 7742 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 483: /* literal ::= NK_INTEGER */ +#line 998 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } +#line 7748 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 484: /* literal ::= NK_FLOAT */ +#line 999 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } +#line 7754 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 485: /* literal ::= NK_STRING */ +#line 1000 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 7760 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 486: /* literal ::= NK_BOOL */ +#line 1001 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } +#line 7766 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 487: /* literal ::= TIMESTAMP NK_STRING */ +#line 1002 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +#line 7772 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 488: /* literal ::= duration_literal */ @@ -7023,64 +7792,90 @@ yymsp[0].minor.yy600); } case 714: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==714); case 717: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==717); case 719: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==719); +#line 1003 "sql.y" { yylhsminor.yy600 = yymsp[0].minor.yy600; } +#line 7797 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 489: /* literal ::= NULL */ +#line 1004 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } +#line 7803 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 490: /* literal ::= NK_QUESTION */ +#line 1005 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 7809 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 491: /* duration_literal ::= NK_VARIABLE */ case 688: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==688); case 689: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==689); case 690: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==690); +#line 1007 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 7818 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 492: /* signed ::= NK_INTEGER */ +#line 1009 "sql.y" { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7824 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 493: /* signed ::= NK_PLUS NK_INTEGER */ +#line 1010 "sql.y" { yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7830 "sql.c" break; case 494: /* signed ::= NK_MINUS NK_INTEGER */ +#line 1011 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } +#line 7839 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 495: /* signed ::= NK_FLOAT */ +#line 1016 "sql.y" { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7845 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 496: /* signed ::= NK_PLUS NK_FLOAT */ +#line 1017 "sql.y" { yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7851 "sql.c" break; case 497: /* signed ::= NK_MINUS NK_FLOAT */ +#line 1018 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } +#line 7860 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 499: /* signed_literal ::= NK_STRING */ +#line 1025 "sql.y" { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7866 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 500: /* signed_literal ::= NK_BOOL */ +#line 1026 "sql.y" { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } +#line 7872 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 501: /* signed_literal ::= TIMESTAMP NK_STRING */ +#line 1027 "sql.y" { yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 7878 "sql.c" break; case 502: /* signed_literal ::= duration_literal */ case 504: /* signed_literal ::= literal_func */ yytestcase(yyruleno==504); @@ -7090,118 +7885,156 @@ yymsp[0].minor.yy600); } case 718: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==718); case 720: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==720); case 733: /* search_condition ::= common_expression */ yytestcase(yyruleno==733); +#line 1028 "sql.y" { yylhsminor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } +#line 7890 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 503: /* signed_literal ::= NULL */ +#line 1029 "sql.y" { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } +#line 7896 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 505: /* signed_literal ::= NK_QUESTION */ +#line 1031 "sql.y" { yylhsminor.yy600 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } +#line 7902 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 524: /* expression ::= pseudo_column */ +#line 1097 "sql.y" { yylhsminor.yy600 = yymsp[0].minor.yy600; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy600, true); } +#line 7908 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 528: /* expression ::= NK_LP expression NK_RP */ case 616: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==616); case 732: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==732); +#line 1101 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 7916 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 529: /* expression ::= NK_PLUS expr_or_subquery */ +#line 1102 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } +#line 7925 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 530: /* expression ::= NK_MINUS expr_or_subquery */ +#line 1106 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); } +#line 7934 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 531: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ +#line 1110 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 7944 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 532: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ +#line 1115 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 7954 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 533: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ +#line 1120 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 7964 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 534: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ +#line 1125 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 7974 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 535: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ +#line 1130 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 7984 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 536: /* expression ::= column_reference NK_ARROW NK_STRING */ +#line 1135 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } +#line 7993 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 537: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ +#line 1139 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8003 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 538: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ +#line 1144 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8013 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 541: /* column_reference ::= column_name */ +#line 1155 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy649, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy649)); } +#line 8019 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 542: /* column_reference ::= table_name NK_DOT column_name */ +#line 1156 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649, createColumnNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649)); } +#line 8025 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 543: /* column_reference ::= NK_ALIAS */ +#line 1157 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8031 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 544: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +#line 1158 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0)); } +#line 8037 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 545: /* pseudo_column ::= ROWTS */ @@ -7217,243 +8050,356 @@ yymsp[0].minor.yy600); } case 556: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==556); case 563: /* literal_func ::= NOW */ yytestcase(yyruleno==563); case 564: /* literal_func ::= TODAY */ yytestcase(yyruleno==564); +#line 1160 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } +#line 8055 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 547: /* pseudo_column ::= table_name NK_DOT TBNAME */ +#line 1162 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy649)))); } +#line 8061 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 557: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 558: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==558); +#line 1173 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy649, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy649, yymsp[-1].minor.yy748)); } +#line 8068 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 559: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ case 560: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==560); +#line 1176 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy400)); } +#line 8075 "sql.c" yymsp[-5].minor.yy600 = yylhsminor.yy600; break; case 562: /* literal_func ::= noarg_func NK_LP NK_RP */ +#line 1182 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy649, NULL)); } +#line 8081 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 578: /* star_func_para_list ::= NK_STAR */ +#line 1207 "sql.y" { yylhsminor.yy748 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8087 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 583: /* star_func_para ::= table_name NK_DOT NK_STAR */ case 668: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==668); +#line 1216 "sql.y" { yylhsminor.yy600 = createColumnNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0); } +#line 8094 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 584: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +#line 1219 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy748, yymsp[-1].minor.yy600)); } +#line 8100 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 585: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +#line 1221 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-2].minor.yy748, yymsp[-1].minor.yy600)); } +#line 8106 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 588: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +#line 1228 "sql.y" { yymsp[-3].minor.yy600 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } +#line 8112 "sql.c" break; case 590: /* case_when_else_opt ::= ELSE common_expression */ +#line 1231 "sql.y" { yymsp[-1].minor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } +#line 8117 "sql.c" break; case 591: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ case 596: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==596); +#line 1234 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy292, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8127 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 592: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1241 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8137 "sql.c" yymsp[-4].minor.yy600 = yylhsminor.yy600; break; case 593: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1247 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8147 "sql.c" yymsp[-5].minor.yy600 = yylhsminor.yy600; break; case 594: /* predicate ::= expr_or_subquery IS NULL */ +#line 1252 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), NULL)); } +#line 8156 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 595: /* predicate ::= expr_or_subquery IS NOT NULL */ +#line 1256 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL)); } +#line 8165 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 597: /* compare_op ::= NK_LT */ +#line 1268 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_LOWER_THAN; } +#line 8171 "sql.c" break; case 598: /* compare_op ::= NK_GT */ +#line 1269 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_GREATER_THAN; } +#line 8176 "sql.c" break; case 599: /* compare_op ::= NK_LE */ +#line 1270 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_LOWER_EQUAL; } +#line 8181 "sql.c" break; case 600: /* compare_op ::= NK_GE */ +#line 1271 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_GREATER_EQUAL; } +#line 8186 "sql.c" break; case 601: /* compare_op ::= NK_NE */ +#line 1272 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_NOT_EQUAL; } +#line 8191 "sql.c" break; case 602: /* compare_op ::= NK_EQ */ +#line 1273 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_EQUAL; } +#line 8196 "sql.c" break; case 603: /* compare_op ::= LIKE */ +#line 1274 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_LIKE; } +#line 8201 "sql.c" break; case 604: /* compare_op ::= NOT LIKE */ +#line 1275 "sql.y" { yymsp[-1].minor.yy292 = OP_TYPE_NOT_LIKE; } +#line 8206 "sql.c" break; case 605: /* compare_op ::= MATCH */ +#line 1276 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_MATCH; } +#line 8211 "sql.c" break; case 606: /* compare_op ::= NMATCH */ +#line 1277 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_NMATCH; } +#line 8216 "sql.c" break; case 607: /* compare_op ::= CONTAINS */ +#line 1278 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_JSON_CONTAINS; } +#line 8221 "sql.c" break; case 608: /* in_op ::= IN */ +#line 1282 "sql.y" { yymsp[0].minor.yy292 = OP_TYPE_IN; } +#line 8226 "sql.c" break; case 609: /* in_op ::= NOT IN */ +#line 1283 "sql.y" { yymsp[-1].minor.yy292 = OP_TYPE_NOT_IN; } +#line 8231 "sql.c" break; case 610: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +#line 1285 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy748)); } +#line 8236 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 612: /* boolean_value_expression ::= NOT boolean_primary */ +#line 1289 "sql.y" { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); } +#line 8245 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 613: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ +#line 1294 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8255 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 614: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +#line 1300 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8265 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 622: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +#line 1318 "sql.y" { yylhsminor.yy600 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, NULL); } +#line 8271 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 625: /* table_primary ::= table_name alias_opt */ +#line 1324 "sql.y" { yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } +#line 8277 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 626: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +#line 1325 "sql.y" { yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-3].minor.yy649, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } +#line 8283 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 627: /* table_primary ::= subquery alias_opt */ +#line 1326 "sql.y" { yylhsminor.yy600 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy649); } +#line 8289 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 629: /* alias_opt ::= */ +#line 1331 "sql.y" { yymsp[1].minor.yy649 = nil_token; } +#line 8295 "sql.c" break; case 631: /* alias_opt ::= AS table_alias */ +#line 1333 "sql.y" { yymsp[-1].minor.yy649 = yymsp[0].minor.yy649; } +#line 8300 "sql.c" break; case 632: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 633: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==633); +#line 1335 "sql.y" { yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600; } +#line 8306 "sql.c" break; case 634: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ +#line 1341 "sql.y" { yylhsminor.yy600 = createJoinTableNode(pCxt, yymsp[-6].minor.yy564, yymsp[-5].minor.yy758, yymsp[-7].minor.yy600, yymsp[-3].minor.yy600, yymsp[-2].minor.yy600); yylhsminor.yy600 = addWindowOffsetClause(pCxt, yylhsminor.yy600, yymsp[-1].minor.yy600); yylhsminor.yy600 = addJLimitClause(pCxt, yylhsminor.yy600, yymsp[0].minor.yy600); } +#line 8315 "sql.c" yymsp[-7].minor.yy600 = yylhsminor.yy600; break; case 635: /* join_type ::= */ +#line 1349 "sql.y" { yymsp[1].minor.yy564 = JOIN_TYPE_INNER; } +#line 8321 "sql.c" break; case 636: /* join_type ::= INNER */ +#line 1350 "sql.y" { yymsp[0].minor.yy564 = JOIN_TYPE_INNER; } +#line 8326 "sql.c" break; case 637: /* join_type ::= LEFT */ +#line 1351 "sql.y" { yymsp[0].minor.yy564 = JOIN_TYPE_LEFT; } +#line 8331 "sql.c" break; case 638: /* join_type ::= RIGHT */ +#line 1352 "sql.y" { yymsp[0].minor.yy564 = JOIN_TYPE_RIGHT; } +#line 8336 "sql.c" break; case 639: /* join_type ::= FULL */ +#line 1353 "sql.y" { yymsp[0].minor.yy564 = JOIN_TYPE_FULL; } +#line 8341 "sql.c" break; case 640: /* join_subtype ::= */ +#line 1357 "sql.y" { yymsp[1].minor.yy758 = JOIN_STYPE_NONE; } +#line 8346 "sql.c" break; case 641: /* join_subtype ::= OUTER */ +#line 1358 "sql.y" { yymsp[0].minor.yy758 = JOIN_STYPE_OUTER; } +#line 8351 "sql.c" break; case 642: /* join_subtype ::= SEMI */ +#line 1359 "sql.y" { yymsp[0].minor.yy758 = JOIN_STYPE_SEMI; } +#line 8356 "sql.c" break; case 643: /* join_subtype ::= ANTI */ +#line 1360 "sql.y" { yymsp[0].minor.yy758 = JOIN_STYPE_ANTI; } +#line 8361 "sql.c" break; case 644: /* join_subtype ::= ASOF */ +#line 1361 "sql.y" { yymsp[0].minor.yy758 = JOIN_STYPE_ASOF; } +#line 8366 "sql.c" break; case 645: /* join_subtype ::= WINDOW */ +#line 1362 "sql.y" { yymsp[0].minor.yy758 = JOIN_STYPE_WIN; } +#line 8371 "sql.c" break; case 649: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +#line 1369 "sql.y" { yymsp[-5].minor.yy600 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 8376 "sql.c" break; case 650: /* window_offset_literal ::= NK_VARIABLE */ +#line 1371 "sql.y" { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 8381 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 651: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ +#line 1372 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy600 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } +#line 8391 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 653: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ case 724: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==724); case 728: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==728); +#line 1379 "sql.y" { yymsp[-1].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 8399 "sql.c" break; case 654: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ +#line 1385 "sql.y" { yymsp[-13].minor.yy600 = createSelectStmt(pCxt, yymsp[-11].minor.yy705, yymsp[-9].minor.yy748, yymsp[-8].minor.yy600, yymsp[-12].minor.yy748); yymsp[-13].minor.yy600 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy600, yymsp[-10].minor.yy705); @@ -7466,158 +8412,245 @@ yymsp[0].minor.yy600); } yymsp[-13].minor.yy600 = addEveryClause(pCxt, yymsp[-13].minor.yy600, yymsp[-4].minor.yy600); yymsp[-13].minor.yy600 = addFillClause(pCxt, yymsp[-13].minor.yy600, yymsp[-3].minor.yy600); } +#line 8415 "sql.c" break; case 655: /* hint_list ::= */ +#line 1400 "sql.y" { yymsp[1].minor.yy748 = createHintNodeList(pCxt, NULL); } +#line 8420 "sql.c" break; case 656: /* hint_list ::= NK_HINT */ +#line 1401 "sql.y" { yylhsminor.yy748 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } +#line 8425 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 661: /* set_quantifier_opt ::= ALL */ +#line 1412 "sql.y" { yymsp[0].minor.yy705 = false; } +#line 8431 "sql.c" break; case 664: /* select_item ::= NK_STAR */ +#line 1419 "sql.y" { yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } +#line 8436 "sql.c" yymsp[0].minor.yy600 = yylhsminor.yy600; break; case 666: /* select_item ::= common_expression column_alias */ case 676: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==676); +#line 1421 "sql.y" { yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy649); } +#line 8443 "sql.c" yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 667: /* select_item ::= common_expression AS column_alias */ case 677: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==677); +#line 1422 "sql.y" { yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), &yymsp[0].minor.yy649); } +#line 8450 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 672: /* partition_by_clause_opt ::= PARTITION BY partition_list */ case 702: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==702); case 722: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==722); +#line 1431 "sql.y" { yymsp[-2].minor.yy748 = yymsp[0].minor.yy748; } +#line 8458 "sql.c" break; case 679: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +#line 1444 "sql.y" { yymsp[-5].minor.yy600 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 8463 "sql.c" break; case 680: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1445 "sql.y" { yymsp[-3].minor.yy600 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 8468 "sql.c" break; case 681: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1447 "sql.y" { yymsp[-5].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 8473 "sql.c" break; case 682: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1451 "sql.y" { yymsp[-7].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } +#line 8478 "sql.c" break; case 683: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +#line 1453 "sql.y" { yymsp[-6].minor.yy600 = createEventWindowNode(pCxt, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } +#line 8483 "sql.c" break; case 684: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +#line 1455 "sql.y" { yymsp[-3].minor.yy600 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } +#line 8488 "sql.c" break; case 685: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 1457 "sql.y" { yymsp[-5].minor.yy600 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } +#line 8493 "sql.c" break; case 692: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +#line 1467 "sql.y" { yymsp[-3].minor.yy600 = createFillNode(pCxt, yymsp[-1].minor.yy6, NULL); } +#line 8498 "sql.c" break; case 693: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +#line 1468 "sql.y" { yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy748)); } +#line 8503 "sql.c" break; case 694: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +#line 1469 "sql.y" { yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy748)); } +#line 8508 "sql.c" break; case 695: /* fill_mode ::= NONE */ +#line 1473 "sql.y" { yymsp[0].minor.yy6 = FILL_MODE_NONE; } +#line 8513 "sql.c" break; case 696: /* fill_mode ::= PREV */ +#line 1474 "sql.y" { yymsp[0].minor.yy6 = FILL_MODE_PREV; } +#line 8518 "sql.c" break; case 697: /* fill_mode ::= NULL */ +#line 1475 "sql.y" { yymsp[0].minor.yy6 = FILL_MODE_NULL; } +#line 8523 "sql.c" break; case 698: /* fill_mode ::= NULL_F */ +#line 1476 "sql.y" { yymsp[0].minor.yy6 = FILL_MODE_NULL_F; } +#line 8528 "sql.c" break; case 699: /* fill_mode ::= LINEAR */ +#line 1477 "sql.y" { yymsp[0].minor.yy6 = FILL_MODE_LINEAR; } +#line 8533 "sql.c" break; case 700: /* fill_mode ::= NEXT */ +#line 1478 "sql.y" { yymsp[0].minor.yy6 = FILL_MODE_NEXT; } +#line 8538 "sql.c" break; case 703: /* group_by_list ::= expr_or_subquery */ +#line 1487 "sql.y" { yylhsminor.yy748 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8543 "sql.c" yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 704: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +#line 1488 "sql.y" { yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } +#line 8549 "sql.c" yymsp[-2].minor.yy748 = yylhsminor.yy748; break; case 708: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +#line 1495 "sql.y" { yymsp[-5].minor.yy600 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 8555 "sql.c" break; case 709: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +#line 1497 "sql.y" { yymsp[-3].minor.yy600 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } +#line 8560 "sql.c" break; case 712: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ +#line 1504 "sql.y" { yylhsminor.yy600 = addOrderByClause(pCxt, yymsp[-3].minor.yy600, yymsp[-2].minor.yy748); yylhsminor.yy600 = addSlimitClause(pCxt, yylhsminor.yy600, yymsp[-1].minor.yy600); yylhsminor.yy600 = addLimitClause(pCxt, yylhsminor.yy600, yymsp[0].minor.yy600); } +#line 8569 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 715: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +#line 1514 "sql.y" { yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } +#line 8575 "sql.c" yymsp[-3].minor.yy600 = yylhsminor.yy600; break; case 716: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +#line 1516 "sql.y" { yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } +#line 8581 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 725: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 729: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==729); +#line 1531 "sql.y" { yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +#line 8588 "sql.c" break; case 726: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 730: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==730); +#line 1532 "sql.y" { yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +#line 8594 "sql.c" break; case 731: /* subquery ::= NK_LP query_expression NK_RP */ +#line 1540 "sql.y" { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy600); } +#line 8599 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 736: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +#line 1554 "sql.y" { yylhsminor.yy600 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), yymsp[-1].minor.yy1010, yymsp[0].minor.yy273); } +#line 8605 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 737: /* ordering_specification_opt ::= */ +#line 1558 "sql.y" { yymsp[1].minor.yy1010 = ORDER_ASC; } +#line 8611 "sql.c" break; case 738: /* ordering_specification_opt ::= ASC */ +#line 1559 "sql.y" { yymsp[0].minor.yy1010 = ORDER_ASC; } +#line 8616 "sql.c" break; case 739: /* ordering_specification_opt ::= DESC */ +#line 1560 "sql.y" { yymsp[0].minor.yy1010 = ORDER_DESC; } +#line 8621 "sql.c" break; case 740: /* null_ordering_opt ::= */ +#line 1564 "sql.y" { yymsp[1].minor.yy273 = NULL_ORDER_DEFAULT; } +#line 8626 "sql.c" break; case 741: /* null_ordering_opt ::= NULLS FIRST */ +#line 1565 "sql.y" { yymsp[-1].minor.yy273 = NULL_ORDER_FIRST; } +#line 8631 "sql.c" break; case 742: /* null_ordering_opt ::= NULLS LAST */ +#line 1566 "sql.y" { yymsp[-1].minor.yy273 = NULL_ORDER_LAST; } +#line 8636 "sql.c" break; case 745: /* column_options ::= column_options ENCODE NK_STRING */ +#line 1574 "sql.y" { yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } +#line 8641 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 746: /* column_options ::= column_options COMPRESS NK_STRING */ +#line 1575 "sql.y" { yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } +#line 8647 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 747: /* column_options ::= column_options LEVEL NK_STRING */ +#line 1576 "sql.y" { yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } +#line 8653 "sql.c" yymsp[-2].minor.yy600 = yylhsminor.yy600; break; default: @@ -7680,6 +8713,7 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ +#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -7690,6 +8724,7 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } +#line 8727 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE From b56a2b5ed1ee4a6d1551d64197384df004f38484 Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Fri, 31 May 2024 11:33:42 +0800 Subject: [PATCH 20/44] add test cases for TD-30189 --- .../community/query/subquery/subqueryBugs.py | 86 +++++++++++++++++++ tests/parallel_test/cases.task | 1 + 2 files changed, 87 insertions(+) create mode 100644 tests/army/community/query/subquery/subqueryBugs.py diff --git a/tests/army/community/query/subquery/subqueryBugs.py b/tests/army/community/query/subquery/subqueryBugs.py new file mode 100644 index 0000000000..b56f4ff1b9 --- /dev/null +++ b/tests/army/community/query/subquery/subqueryBugs.py @@ -0,0 +1,86 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import frame.etool + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * +from frame.autogen import * + + +class TDTestCase(TBase): + + def ts_30189(self): + tdLog.info("create database ts_30189") + tdSql.execute(f"create database ts_30189") + tdSql.execute(f"use ts_30189") + sqls = [ + "CREATE STABLE `demo` (`_ts` TIMESTAMP, `faev` DOUBLE) TAGS (`deviceid` VARCHAR(256))", + "CREATE TABLE demo_201000008 USING demo (deviceid) TAGS ('201000008')", + "CREATE TABLE demo_K201000258 USING demo (deviceid) TAGS ('K201000258')", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-11-30 23:59:27.255', 51412.900999999998021)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-04 23:11:28.179', 51458.900999999998021)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-04 23:12:28.180', 51458.800999999999476)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-31 23:59:36.108', 52855.400999999998021)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-11-30 23:59:00.365', 258839.234375000000000)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-28 05:00:00.381', 272188.843750000000000)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-28 05:01:00.600', 13.909012794494629)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-31 23:59:00.366', 1886.711303710937500)", + ] + tdSql.executes(sqls) + sql1 = ''' + SELECT ts, deviceid, faev FROM ( + ( + SELECT deviceid, ts, faev FROM ( + SELECT deviceid, _ts AS ts, faev, DIFF(ROUND(faev*1000)/1000) AS diff_faev + FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-12-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + PARTITION BY deviceid + ) WHERE diff_faev < 0 + ) UNION ALL + ( + SELECT deviceid, ts, faev FROM ( + SELECT deviceid, ts, faev, DIFF(ROUND(faev*1000)/1000) as diff_faev + FROM ( SELECT deviceid, _ts as ts , faev FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-12-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + ORDER BY ts desc ) PARTITION BY deviceid + ) WHERE diff_faev > 0 + ) + UNION ALL + ( + SELECT deviceid, LAST(_ts) AS ts, LAST(faev) AS faev FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-11-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + PARTITION BY deviceid INTERVAL(1n) + ) + ) order by ts + ''' + tdSql.query(sql1) + tdSql.checkRows(4) + + # run + def run(self): + tdLog.debug(f"start to excute {__file__}") + + # TS-30189 + self.ts_30189() + + + tdLog.success(f"{__file__} successfully executed") + + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 61687eeccd..12f2ee1689 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -27,6 +27,7 @@ ,,n,army,python3 ./test.py -f community/cmdline/fullopt.py ,,n,army,python3 ./test.py -f community/query/show.py -N 3 ,,n,army,python3 ./test.py -f enterprise/alter/alterConfig.py -N 3 +,,y,army,./pytest.sh python3 ./test.py -f community/query/subquery/subqueryBugs.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f community/storage/oneStageComp.py -N 3 -L 3 -D 1 ,,y,army,./pytest.sh python3 ./test.py -f community/storage/compressBasic.py -N 3 From e47069b67c2fcaa1e65d751cc1f4303f17948668 Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Fri, 31 May 2024 13:49:48 +0800 Subject: [PATCH 21/44] add test cases for TD-30188 --- .../community/query/subquery/subqueryBugs.py | 86 +++++++++++++++++++ tests/parallel_test/cases.task | 3 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 tests/army/community/query/subquery/subqueryBugs.py diff --git a/tests/army/community/query/subquery/subqueryBugs.py b/tests/army/community/query/subquery/subqueryBugs.py new file mode 100644 index 0000000000..b56f4ff1b9 --- /dev/null +++ b/tests/army/community/query/subquery/subqueryBugs.py @@ -0,0 +1,86 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import frame.etool + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * +from frame.autogen import * + + +class TDTestCase(TBase): + + def ts_30189(self): + tdLog.info("create database ts_30189") + tdSql.execute(f"create database ts_30189") + tdSql.execute(f"use ts_30189") + sqls = [ + "CREATE STABLE `demo` (`_ts` TIMESTAMP, `faev` DOUBLE) TAGS (`deviceid` VARCHAR(256))", + "CREATE TABLE demo_201000008 USING demo (deviceid) TAGS ('201000008')", + "CREATE TABLE demo_K201000258 USING demo (deviceid) TAGS ('K201000258')", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-11-30 23:59:27.255', 51412.900999999998021)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-04 23:11:28.179', 51458.900999999998021)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-04 23:12:28.180', 51458.800999999999476)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-31 23:59:36.108', 52855.400999999998021)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-11-30 23:59:00.365', 258839.234375000000000)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-28 05:00:00.381', 272188.843750000000000)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-28 05:01:00.600', 13.909012794494629)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-31 23:59:00.366', 1886.711303710937500)", + ] + tdSql.executes(sqls) + sql1 = ''' + SELECT ts, deviceid, faev FROM ( + ( + SELECT deviceid, ts, faev FROM ( + SELECT deviceid, _ts AS ts, faev, DIFF(ROUND(faev*1000)/1000) AS diff_faev + FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-12-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + PARTITION BY deviceid + ) WHERE diff_faev < 0 + ) UNION ALL + ( + SELECT deviceid, ts, faev FROM ( + SELECT deviceid, ts, faev, DIFF(ROUND(faev*1000)/1000) as diff_faev + FROM ( SELECT deviceid, _ts as ts , faev FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-12-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + ORDER BY ts desc ) PARTITION BY deviceid + ) WHERE diff_faev > 0 + ) + UNION ALL + ( + SELECT deviceid, LAST(_ts) AS ts, LAST(faev) AS faev FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-11-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + PARTITION BY deviceid INTERVAL(1n) + ) + ) order by ts + ''' + tdSql.query(sql1) + tdSql.checkRows(4) + + # run + def run(self): + tdLog.debug(f"start to excute {__file__}") + + # TS-30189 + self.ts_30189() + + + tdLog.success(f"{__file__} successfully executed") + + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 61687eeccd..8ebda24e79 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -27,7 +27,8 @@ ,,n,army,python3 ./test.py -f community/cmdline/fullopt.py ,,n,army,python3 ./test.py -f community/query/show.py -N 3 ,,n,army,python3 ./test.py -f enterprise/alter/alterConfig.py -N 3 -,,y,army,./pytest.sh python3 ./test.py -f community/storage/oneStageComp.py -N 3 -L 3 -D 1 +,,y,army,./pytest.sh python3 ./test.py -f community/query/subquery/subqueryBugs.py -N 3 -L 3 -D 1 +,,y,army,./pytest.sh python3 ./test.py -f community/storage/compressBasic.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f community/storage/compressBasic.py -N 3 # From c253ac73a99ddbe83929bd5f59a19e525307ac21 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 06:27:54 +0000 Subject: [PATCH 22/44] support add column compress --- source/common/src/tcol.c | 3 ++- source/libs/parser/src/parTranslater.c | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/common/src/tcol.c b/source/common/src/tcol.c index fc9dd1fb4c..ba36558587 100644 --- a/source/common/src/tcol.c +++ b/source/common/src/tcol.c @@ -131,6 +131,7 @@ const char* columnEncodeStr(uint8_t type) { encode = TSDB_COLUMN_ENCODE_DISABLED; break; default: + encode = TSDB_COLUMN_ENCODE_UNKNOWN; break; } return encode; @@ -157,8 +158,8 @@ const char* columnCompressStr(uint16_t type) { case TSDB_COLVAL_COMPRESS_DISABLED: compress = TSDB_COLUMN_COMPRESS_DISABLED; break; - default: + compress = TSDB_COLUMN_COMPRESS_UNKNOWN; break; } return compress; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 938c6aae9a..a2d64d4922 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8202,9 +8202,12 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* // TAOS_FIELD field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)}; strcpy(field.name, pStmt->colName); if (pStmt->pColOptions != NULL) { - if (!checkColumnEncode(pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; - if (!checkColumnCompress(pStmt->pColOptions->compress)) return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; - if (!checkColumnLevel(pStmt->pColOptions->compressLevel)) return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; + if (!checkColumnEncodeOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->encode)) + return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; + if (!checkColumnCompressOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->compress)) + return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; + if (!checkColumnLevelOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->compressLevel)) + return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; int32_t code = setColCompressByOption(pStmt->dataType.type, columnEncodeVal(pStmt->pColOptions->encode), columnCompressVal(pStmt->pColOptions->compress), columnLevelVal(pStmt->pColOptions->compressLevel), false, @@ -13049,6 +13052,7 @@ static int32_t buildAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, case TSDB_ALTER_TABLE_UPDATE_TAG_VAL: return buildUpdateTagValReq(pCxt, pStmt, pTableMeta, pReq); case TSDB_ALTER_TABLE_ADD_COLUMN: + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: return buildAddColReq(pCxt, pStmt, pTableMeta, pReq); case TSDB_ALTER_TABLE_DROP_COLUMN: return buildDropColReq(pCxt, pStmt, pTableMeta, pReq); From fd385d7c520ef11b5aba00ad4dd63c311ea34e2d Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 06:41:36 +0000 Subject: [PATCH 23/44] support add column compress --- source/libs/parser/src/parTranslater.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a2d64d4922..1c38e1bc31 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -12898,9 +12898,9 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S pReq->flags = COL_SMA_ON; pReq->bytes = calcTypeBytes(pStmt->dataType); if (pStmt->pColOptions != NULL) { - if (!checkColumnEncode(pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; - if (!checkColumnCompress(pStmt->pColOptions->compress)) return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; - if (!checkColumnLevel(pStmt->pColOptions->compressLevel)) return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; + if (!checkColumnEncodeOrSetDefault(pReq->type, pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; + if (!checkColumnCompressOrSetDefault(pReq->type, pStmt->pColOptions->compress)) return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; + if (!checkColumnLevelOrSetDefault(pReq->type, pStmt->pColOptions->compressLevel)) return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; int8_t code = setColCompressByOption(pReq->type, columnEncodeVal(pStmt->pColOptions->encode), columnCompressVal(pStmt->pColOptions->compress), columnLevelVal(pStmt->pColOptions->compressLevel), true, &pReq->compress); From b8e63fa5f4707848748a1b23f02718edc7e9e103 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 06:56:33 +0000 Subject: [PATCH 24/44] support add column compress --- tests/script/tsim/compress/compress_col.sim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/script/tsim/compress/compress_col.sim b/tests/script/tsim/compress/compress_col.sim index cc5b46fa06..ddf65b7f40 100644 --- a/tests/script/tsim/compress/compress_col.sim +++ b/tests/script/tsim/compress/compress_col.sim @@ -21,4 +21,15 @@ sql create table txx2 (ts timestamp compress 'disabled' level 'h', f int compres sql create table txx3 (ts timestamp compress 'disabled' level 'h', f int compress 'xz') sql create table txx4 (ts timestamp compress 'disabled' level 'h', f int compress 'zstd') + +sql alter table txx4 add column tt int compress 'xz' level 'h' +sql alter table txx4 drop column tt + +sql create stable sp(ts timestamp, c int) tags(t int) +sql alter table sp add column c1 int compress 'zstd' +sql alter table sp drop column c1 + +sql alter stable sp add column c1 int compress 'zstd' +sql alter stable sp drop column c1 + system sh/exec.sh -n dnode1 -s stop -x SIGINT From a77c6940da711b11eb85d3186b9e48357156c5b0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 31 May 2024 15:22:38 +0800 Subject: [PATCH 25/44] when dst table has composite primary key, need to delete result --- source/libs/executor/src/streamtimewindowoperator.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 2da9ed0353..46844a2470 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -1427,7 +1427,9 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); } - removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + if (IS_FINAL_INTERVAL_OP(pOperator) && !pInfo->destHasPrimaryKey) { + removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + } if (IS_FINAL_INTERVAL_OP(pOperator)) { closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, pInfo->pPullDataMap, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); @@ -2845,7 +2847,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { closeSessionWindow(pAggSup->pResultRows, &pInfo->twAggSup, pInfo->pStUpdated); closeChildSessionWindow(pInfo->pChildren, pInfo->twAggSup.maxTs); copyUpdateResult(&pInfo->pStUpdated, pInfo->pUpdated, sessionKeyCompareAsc); - removeSessionDeleteResults(pInfo->pStDeleted, pInfo->pUpdated); + if (!pInfo->destHasPrimaryKey) { + removeSessionDeleteResults(pInfo->pStDeleted, pInfo->pUpdated); + } if (pInfo->isHistoryOp) { getMaxTsWins(pInfo->pUpdated, pInfo->historyWins); } @@ -4131,7 +4135,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); } pOperator->status = OP_RES_TO_RETURN; - removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + if (!pInfo->destHasPrimaryKey) { + removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + } closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); if (pInfo->destHasPrimaryKey && IS_NORMAL_INTERVAL_OP(pOperator)) { From e7c8952202afe8054048d1fb2bf9223ded5054be Mon Sep 17 00:00:00 2001 From: liuyao <54liuyao@163.com> Date: Fri, 31 May 2024 16:05:32 +0800 Subject: [PATCH 26/44] Update 14-stream.md --- docs/zh/12-taos-sql/14-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md index 5691716ce8..c94df0a7ba 100644 --- a/docs/zh/12-taos-sql/14-stream.md +++ b/docs/zh/12-taos-sql/14-stream.md @@ -190,7 +190,7 @@ T3 时刻,最新事件到达,T 向后推移超过了第二个窗口关闭的 TDengine 对于过期数据提供两种处理方式,由 IGNORE EXPIRED 选项指定: -1. 重新计算,即 IGNORE EXPIRED 0:从 TSDB 中重新查找对应窗口的所有数据并重新计算得到最新结果 +1. 增量计算,即 IGNORE EXPIRED 0。 2. 直接丢弃,即 IGNORE EXPIRED 1:默认配置,忽略过期数据 From 9fb329f481c96e8ec419c477788238917aa9f9a7 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 08:08:54 +0000 Subject: [PATCH 27/44] add error --- source/libs/transport/src/transCli.c | 33 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index d0fb5cbfdb..9a29444d2d 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -200,7 +200,7 @@ static FORCE_INLINE void cliMayUpdateFqdnCache(SHashObj* cache, char* dst); // process data read from server, add decompress etc later static void cliHandleResp(SCliConn* conn); // handle except about conn -static void cliHandleExcept(SCliConn* conn); +static void cliHandleExcept(SCliConn* conn, int32_t code); static void cliReleaseUnfinishedMsg(SCliConn* conn); static void cliHandleFastFail(SCliConn* pConn, int status); @@ -571,8 +571,11 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) { if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn); transUnrefCliHandle(pConn); } -void cliHandleExcept(SCliConn* conn) { +void cliHandleExcept(SCliConn* conn, int32_t code) { tTrace("%s conn %p except ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn)); + if (code != TSDB_CODE_RPC_FQDN_ERROR) { + code = -1; + } cliHandleExceptImpl(conn, -1); } @@ -866,7 +869,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { while (transReadComplete(pBuf)) { tTrace("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn); if (pBuf->invalid) { - cliHandleExcept(conn); + cliHandleExcept(conn, -1); break; } else { cliHandleResp(conn); @@ -886,7 +889,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { tDebug("%s conn %p read error:%s, ref:%d", CONN_GET_INST_LABEL(conn), conn, uv_err_name(nread), T_REF_VAL_GET(conn)); conn->broken = true; - cliHandleExcept(conn); + cliHandleExcept(conn, -1); } } @@ -1037,7 +1040,7 @@ static void cliSendCb(uv_write_t* req, int status) { } else { if (!uv_is_closing((uv_handle_t*)&pConn->stream)) { tError("%s conn %p failed to write:%s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(status)); - cliHandleExcept(pConn); + cliHandleExcept(pConn, -1); } return; } @@ -1113,7 +1116,7 @@ void cliSend(SCliConn* pConn) { if (transQueueEmpty(&pConn->cliMsgs)) { tError("%s conn %p not msg to send", pTransInst->label, pConn); - cliHandleExcept(pConn); + cliHandleExcept(pConn, -1); return; } @@ -1186,7 +1189,7 @@ void cliSend(SCliConn* pConn) { if (status != 0) { tGError("%s conn %p failed to send msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType), uv_err_name(status)); - cliHandleExcept(pConn); + cliHandleExcept(pConn, -1); } return; _RETURN: @@ -1242,7 +1245,8 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { taosArrayPush(pThrd->timerList, &conn->timer); conn->timer = NULL; - cliHandleFastFail(conn, -1); + cliHandleFastFail(conn, terrno); + terrno = 0; return; } struct sockaddr_in addr; @@ -1304,7 +1308,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) { tDebug("%s conn %p failed to send batch msg, batch size:%d, msgLen:%d, reason:%s", CONN_GET_INST_LABEL(conn), conn, p->wLen, p->batchSize, uv_err_name(status)); - if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn); + if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn, -1); cliHandleBatchReq(nxtBatch, thrd); } else { @@ -1362,7 +1366,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { cliDestroyBatch(pConn->pBatch); pConn->pBatch = NULL; } - cliHandleExcept(pConn); + cliHandleExcept(pConn, status); } void cliConnCb(uv_connect_t* req, int status) { @@ -1653,7 +1657,8 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { taosArrayPush(pThrd->timerList, &conn->timer); conn->timer = NULL; - cliHandleExcept(conn); + cliHandleExcept(conn, terrno); + terrno = 0; return; } @@ -1667,20 +1672,20 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { if (fd == -1) { tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(TAOS_SYSTEM_ERROR(errno))); - cliHandleExcept(conn); + cliHandleExcept(conn, -1); errno = 0; return; } int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd); if (ret != 0) { tGError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret)); - cliHandleExcept(conn); + cliHandleExcept(conn, -1); return; } ret = transSetConnOption((uv_tcp_t*)conn->stream, tsKeepAliveIdle); if (ret != 0) { tGError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret)); - cliHandleExcept(conn); + cliHandleExcept(conn, -1); return; } From 426527023fd56b126a7d2765c81d50b407211971 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 31 May 2024 15:56:17 +0800 Subject: [PATCH 28/44] TD-30354: update test case --- tests/system-test/2-query/avg.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/system-test/2-query/avg.py b/tests/system-test/2-query/avg.py index dd8b38f9ea..34e4a19978 100644 --- a/tests/system-test/2-query/avg.py +++ b/tests/system-test/2-query/avg.py @@ -436,13 +436,13 @@ class TDTestCase: tdSql.execute(f"use db") tdSql.execute(f"create table db.st(ts timestamp, ibv bigint, ubv bigint unsigned) tags(area int)") # insert t1 data - tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,9223372036854775801,18446744073709551611)") - tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,8223372036854775801,17446744073709551611)") - tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,7223372036854775801,16446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now + 1s,9223372036854775801,18446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now + 2s,8223372036854775801,17446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now + 3s,7223372036854775801,16446744073709551611)") # insert t2 data - tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,9223372036854775801,18446744073709551611)") - tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,8223372036854775801,17446744073709551611)") - tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,7223372036854775801,16446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now + 1s,9223372036854775801,18446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now + 2s,8223372036854775801,17446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now + 3s,7223372036854775801,16446744073709551611)") # check single table answer tdSql.query(f"select avg(ibv), avg(ubv) from db.t1") From 2d9f81d34c4e689f32b0831c9c4be08c77be61c0 Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Fri, 31 May 2024 16:49:03 +0800 Subject: [PATCH 29/44] add verification of query date --- tests/army/community/query/subquery/subqueryBugs.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/army/community/query/subquery/subqueryBugs.py b/tests/army/community/query/subquery/subqueryBugs.py index b56f4ff1b9..8442474d40 100644 --- a/tests/army/community/query/subquery/subqueryBugs.py +++ b/tests/army/community/query/subquery/subqueryBugs.py @@ -70,6 +70,14 @@ class TDTestCase(TBase): tdSql.query(sql1) tdSql.checkRows(4) + row1 = ['2023-11-30 23:59:27.255', "201000008", 51412.900999999998021] + row2 = ['2023-12-04 23:11:28.179', "201000008", 51458.900999999998021] + row3 = ['2023-12-04 23:12:28.180', "201000008", 51458.800999999999476] + row4 = ['2023-12-31 23:59:36.108', "201000008", 52855.400999999998021] + + rows = [row1, row2, row3, row4] + tdSql.checkDataMem(sql1, rows) + # run def run(self): tdLog.debug(f"start to excute {__file__}") From e0167511c1a2c10f9c06c1c6a7ac4d17ed441adb Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 31 May 2024 17:18:25 +0800 Subject: [PATCH 30/44] use tDeleteSVCreateTbBatchReq free mem --- source/client/src/clientRawBlockWrite.c | 17 ++--------------- source/common/src/tmsg.c | 7 +++++-- source/dnode/vnode/src/tq/tqRead.c | 9 +-------- source/dnode/vnode/src/vnd/vnodeSvr.c | 7 +------ 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 5e6d693562..d8bd56985f 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -440,14 +440,7 @@ static cJSON* processCreateTable(SMqMetaRsp* metaRsp) { _exit: uDebug("create table return, sql json:%s", cJSON_PrintUnformatted(pJson)); - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFreeClear(pCreateReq->comment); - taosMemoryFreeClear(pCreateReq->sql); - if (pCreateReq->type == TSDB_CHILD_TABLE) { - taosArrayDestroy(pCreateReq->ctb.tagName); - } - } + tDeleteSVCreateTbBatchReq(&req); tDecoderClear(&decoder); return pJson; } @@ -1110,13 +1103,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { end: uDebug(LOG_ID_TAG " create table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFreeClear(pCreateReq->comment); - if (pCreateReq->type == TSDB_CHILD_TABLE) { - taosArrayDestroy(pCreateReq->ctb.tagName); - } - } + tDeleteSVCreateTbBatchReq(&req); taosHashCleanup(pVgroupHashmap); destroyRequest(pRequest); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index c17c522d4f..6bb88b7824 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -8369,11 +8369,14 @@ int tDecodeSVCreateTbBatchReq(SDecoder *pCoder, SVCreateTbBatchReq *pReq) { return 0; } -void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq* pReq) { +void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq *pReq) { for (int32_t iReq = 0; iReq < pReq->nReqs; iReq++) { - SVCreateTbReq* pCreateReq = pReq->pReqs + iReq; + SVCreateTbReq *pCreateReq = pReq->pReqs + iReq; + taosMemoryFreeClear(pCreateReq->sql); + taosMemoryFreeClear(pCreateReq->comment); if (pCreateReq->type == TSDB_CHILD_TABLE) { taosArrayDestroy(pCreateReq->ctb.tagName); + pCreateReq->ctb.tagName = NULL; } } } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 9cbe48a0b0..40b817accd 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -99,14 +99,7 @@ bool isValValidForTable(STqHandle* pHandle, SWalCont* pHead) { taosArrayDestroy(reqNew.pArray); } - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFreeClear(pCreateReq->comment); - taosMemoryFreeClear(pCreateReq->sql); - if (pCreateReq->type == TSDB_CHILD_TABLE) { - taosArrayDestroy(pCreateReq->ctb.tagName); - } - } + tDeleteSVCreateTbBatchReq(&req); } else if (msgType == TDMT_VND_ALTER_TABLE) { SVAlterTbReq req = {0}; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index cb71495e9f..3a3109862c 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1158,12 +1158,7 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, } _exit: - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFree(pCreateReq->sql); - taosMemoryFree(pCreateReq->comment); - taosArrayDestroy(pCreateReq->ctb.tagName); - } + tDeleteSVCreateTbBatchReq(&req); taosArrayDestroyEx(rsp.pArray, tFreeSVCreateTbRsp); taosArrayDestroy(tbUids); tDecoderClear(&decoder); From 9f0d6eddaeade9cbc9ea2b1d11f57fe514999d53 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 09:34:41 +0000 Subject: [PATCH 31/44] add error --- source/libs/parser/src/parAstCreater.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 86ce93d920..13c74ca881 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1907,8 +1907,12 @@ SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRea COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); pStmt->dataType = dataType; + // if pOptions is NULL, it means that the column has no options if (pOptions != NULL) { - pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; + SColumnOptions* pOption = (SColumnOptions*)pOptions; + if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) { + pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; + } } pStmt->pColOptions = (SColumnOptions*)pOptions; return createAlterTableStmtFinalize(pRealTable, pStmt); From 69e402d547998953aef833f7d86d14b01f83719e Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 10:36:30 +0000 Subject: [PATCH 32/44] add error --- source/libs/parser/src/parAstCreater.c | 18 ++++++++++++++---- source/libs/parser/src/parTranslater.c | 6 ++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 13c74ca881..00ce03cf6a 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1901,20 +1901,30 @@ SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRea if (!checkColumnName(pCxt, pColName)) { return NULL; } + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); pStmt->dataType = dataType; + pStmt->pColOptions = (SColumnOptions*)pOptions; - // if pOptions is NULL, it means that the column has no options if (pOptions != NULL) { SColumnOptions* pOption = (SColumnOptions*)pOptions; - if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) { - pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; + if (pOption->bPrimaryKey == false || pOption->commentNull == true) { + if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) { + pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; + } else { + pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + "not support alter column with option except compress"); + return NULL; + } + } else { + pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + "not support alter column with option except compress"); + return NULL; } } - pStmt->pColOptions = (SColumnOptions*)pOptions; return createAlterTableStmtFinalize(pRealTable, pStmt); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 1c38e1bc31..b6673d6219 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -12899,8 +12899,10 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S pReq->bytes = calcTypeBytes(pStmt->dataType); if (pStmt->pColOptions != NULL) { if (!checkColumnEncodeOrSetDefault(pReq->type, pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; - if (!checkColumnCompressOrSetDefault(pReq->type, pStmt->pColOptions->compress)) return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; - if (!checkColumnLevelOrSetDefault(pReq->type, pStmt->pColOptions->compressLevel)) return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; + if (!checkColumnCompressOrSetDefault(pReq->type, pStmt->pColOptions->compress)) + return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; + if (!checkColumnLevelOrSetDefault(pReq->type, pStmt->pColOptions->compressLevel)) + return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; int8_t code = setColCompressByOption(pReq->type, columnEncodeVal(pStmt->pColOptions->encode), columnCompressVal(pStmt->pColOptions->compress), columnLevelVal(pStmt->pColOptions->compressLevel), true, &pReq->compress); From ac2d9ab276461bccd5c63f9ac445de10ac9389e7 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 11:38:55 +0000 Subject: [PATCH 33/44] add error --- source/libs/parser/src/parAstCreater.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 00ce03cf6a..0e31672b24 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1911,13 +1911,13 @@ SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRea if (pOptions != NULL) { SColumnOptions* pOption = (SColumnOptions*)pOptions; - if (pOption->bPrimaryKey == false || pOption->commentNull == true) { + if (pOption->bPrimaryKey == false && pOption->commentNull == true) { if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) { pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; } else { - pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, - "not support alter column with option except compress"); - return NULL; + // pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + // "not support alter column with option except compress"); + // return NULL; } } else { pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, From ad075ef1dec28e22a640687b46c610f0c113c851 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 1 Jun 2024 16:19:17 +0800 Subject: [PATCH 34/44] fix:[TD-30323]tmq close error if consumer is cleared --- source/dnode/mnode/impl/src/mndConsumer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 9278fbce11..72a8c32056 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -662,7 +662,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { SMqConsumerObj *pConsumerNew = NULL; STrans *pTrans = NULL; - if(mndAcquireConsumer(pMnode, subscribe->consumerId) == NULL && taosArrayGetSize(subscribe->topicNames) == 0){ + if(mndAcquireConsumer(pMnode, subscribe.consumerId) == NULL && taosArrayGetSize(subscribe.topicNames) == 0){ goto _over; } From a096e2c071b9defe1e39e273f1e6b9203208a37b Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sun, 2 Jun 2024 21:28:53 +0800 Subject: [PATCH 35/44] fix:memory leak --- source/dnode/mnode/impl/src/mndConsumer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 72a8c32056..3eef2afcc1 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -662,8 +662,12 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { SMqConsumerObj *pConsumerNew = NULL; STrans *pTrans = NULL; - if(mndAcquireConsumer(pMnode, subscribe.consumerId) == NULL && taosArrayGetSize(subscribe.topicNames) == 0){ - goto _over; + if(taosArrayGetSize(subscribe.topicNames) == 0){ + SMqConsumerObj *pConsumerTmp = mndAcquireConsumer(pMnode, subscribe.consumerId); + if(pConsumerTmp == NULL){ + goto _over; + } + mndReleaseConsumer(pMnode, pConsumerTmp); } code = checkAndSortTopic(pMnode, subscribe.topicNames); From d85d3aa70e66e997074cd9b3b34255d52b77c4a4 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sun, 2 Jun 2024 22:06:52 +0800 Subject: [PATCH 36/44] fix:[TD-30306]error in converity scan --- source/client/src/clientTmq.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 0bc4214c09..7bc6a2f2e6 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -858,7 +858,10 @@ void tmqSendHbReq(void* param, void* tmrId) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); int64_t transporterId = 0; - asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); + int32_t code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); + if (code != 0) { + tscError("tmqSendHbReq asyncSendMsgToServer failed"); + } OVER: tDestroySMqHbReq(&req); @@ -1220,12 +1223,15 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(buf); goto FAIL; } SMqSubscribeCbParam param = {.rspErr = 0}; if (tsem_init(¶m.rspSem, 0, 0) != 0) { code = TSDB_CODE_TSC_INTERNAL_ERROR; + taosMemoryFree(buf); + taosMemoryFree(sendInfo); goto FAIL; } @@ -1245,10 +1251,6 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { goto FAIL; } - // avoid double free if msg is sent - buf = NULL; - sendInfo = NULL; - tsem_wait(¶m.rspSem); tsem_destroy(¶m.rspSem); @@ -1284,8 +1286,6 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { FAIL: taosArrayDestroyP(req.topicNames, taosMemoryFree); - taosMemoryFree(buf); - taosMemoryFree(sendInfo); return code; } @@ -1745,6 +1745,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p pParam = taosMemoryMalloc(sizeof(SMqPollCbParam)); if (pParam == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFreeClear(msg); goto FAIL; } @@ -1756,6 +1757,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFreeClear(msg); goto FAIL; } @@ -1782,7 +1784,6 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p return 0; FAIL: - taosMemoryFreeClear(msg); return tmqPollCb(pParam, NULL, code); } @@ -2560,6 +2561,7 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { if (tSerializeSMqAskEpReq(pReq, tlen, &req) < 0) { tscError("consumer:0x%" PRIx64 ", tSerializeSMqAskEpReq %d failed", pTmq->consumerId, tlen); code = TSDB_CODE_INVALID_PARA; + taosMemoryFree(pReq); goto FAIL; } @@ -2567,6 +2569,7 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { if (pParam == NULL) { tscError("consumer:0x%" PRIx64 ", failed to malloc subscribe param", pTmq->consumerId); code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(pReq); goto FAIL; } @@ -2577,6 +2580,7 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(pReq); goto FAIL; } @@ -2598,8 +2602,6 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { } FAIL: - taosMemoryFreeClear(pParam); - taosMemoryFreeClear(pReq); askEpCb(pParam, NULL, code); } @@ -2706,7 +2708,6 @@ static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - taosMemoryFree(pParam); return 0; } @@ -3066,6 +3067,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a sendInfo->requestId = req.reqId; sendInfo->requestObjRefId = 0; sendInfo->param = pParam; + sendInfo->paramFreeFp = taosMemoryFree; sendInfo->fp = tmqGetWalInfoCb; sendInfo->msgType = TDMT_VND_TMQ_VG_WALINFO; @@ -3077,8 +3079,6 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a tmq->consumerId, pTopic->topicName, pClientVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId); code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, &transporterId, sendInfo); if (code != 0) { - taosMemoryFree(pParam); - taosMemoryFree(msg); goto end; } } From cf9cd211f5daa4bbce9ee8dc167a613927c1d397 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 3 Jun 2024 13:36:16 +0800 Subject: [PATCH 37/44] fix: possible coredump --- source/common/src/tdataformat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 8d3db72fb5..fb97c011fa 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -383,7 +383,9 @@ static int32_t tRowBuildKVRow(SArray *aColVal, const SRowBuildScanInfo *sinfo, c if (IS_VAR_DATA_TYPE(schema->columns[i].type)) { payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid); payloadSize += tPutU32v(payload + payloadSize, colValArray[colValIndex].value.nData); - memcpy(payload + payloadSize, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); + if (colValArray[colValIndex].value.nData > 0) { + memcpy(payload + payloadSize, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); + } payloadSize += colValArray[colValIndex].value.nData; } else { payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid); From 6fcd0711447a5c8873544ba997065efdffe17f56 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Fri, 31 May 2024 10:08:15 +0000 Subject: [PATCH 38/44] fix exchange operator memory access problem --- include/os/osAtomic.h | 6 ++++++ source/libs/executor/src/exchangeoperator.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/os/osAtomic.h b/include/os/osAtomic.h index 48b7b8c56f..97bb6f53ba 100644 --- a/include/os/osAtomic.h +++ b/include/os/osAtomic.h @@ -114,6 +114,12 @@ int32_t atomic_fetch_xor_32(int32_t volatile *ptr, int32_t val); int64_t atomic_fetch_xor_64(int64_t volatile *ptr, int64_t val); void *atomic_fetch_xor_ptr(void *ptr, void *val); +#ifdef _MSC_VER +#define tmemory_barrier(order) MemoryBarrier() +#else +#define tmemory_barrier(order) __sync_synchronize() +#endif + #ifdef __cplusplus } #endif diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 06dd43e170..631a92f1be 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -93,6 +93,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn goto _error; } + tmemory_barrier(); SRetrieveTableRsp* pRsp = pDataInfo->pRsp; SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, pDataInfo->index); @@ -428,6 +429,7 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { } } + tmemory_barrier(); pSourceDataInfo->status = EX_SOURCE_DATA_READY; code = tsem_post(&pExchangeInfo->ready); if (code != TSDB_CODE_SUCCESS) { From ca7e1344e192887568b1ddd503e8ed47fb19d816 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 3 Jun 2024 15:20:05 +0800 Subject: [PATCH 39/44] adj stream count state buff --- source/libs/stream/src/streamSessionState.c | 52 ++++++++++++++------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c index 687b4bcf12..4c61e6da1d 100644 --- a/source/libs/stream/src/streamSessionState.c +++ b/source/libs/stream/src/streamSessionState.c @@ -734,6 +734,21 @@ _end: return code; } +int32_t getCountWinStateFromDisc(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen) { + SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentNext_rocksdb(pState, pKey); + int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen); + streamStateFreeCur(pCur); + if (code == TSDB_CODE_SUCCESS) { + return code; + } else { + pCur = streamStateSessionSeekKeyPrev_rocksdb(pState, pKey); + } + + code = streamStateSessionGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen); + streamStateFreeCur(pCur); + return code; +} + int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, COUNT_TYPE winCount, void** pVal, int32_t* pVLen) { SSessionKey* pWinKey = pKey; const TSKEY gap = 0; @@ -755,14 +770,13 @@ int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, C if (size == 0) { void* pFileStore = getStateFileStore(pFileState); void* pRockVal = NULL; - SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId); - code = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &pRockVal, pVLen); - streamStateFreeCur(pCur); + code = getCountWinStateFromDisc(pFileStore, pWinKey, &pRockVal, pVLen); if (code == TSDB_CODE_SUCCESS || isFlushedState(pFileState, endTs, 0)) { - qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code); + qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, + pWinKey->win.ekey, code); if (code == TSDB_CODE_SUCCESS) { int32_t valSize = *pVLen; - COUNT_TYPE* pWinStateCout = (COUNT_TYPE*)( (char*)(pRockVal) + (valSize - sizeof(COUNT_TYPE)) ); + COUNT_TYPE* pWinStateCout = (COUNT_TYPE*)((char*)(pRockVal) + (valSize - sizeof(COUNT_TYPE))); if (inSessionWindow(pWinKey, startTs, gap) || (*pWinStateCout) < winCount) { (*pVal) = createSessionWinBuff(pFileState, pWinKey, pRockVal, pVLen); goto _end; @@ -798,20 +812,24 @@ int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, C } if (index == -1) { - if (!isDeteled(pFileState, endTs)) { - void* p = NULL; - void* pFileStore = getStateFileStore(pFileState); - SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId); - int32_t code_file = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &p, pVLen); + if (!isDeteled(pFileState, endTs) && isFlushedState(pFileState, endTs, 0)) { + SSessionKey tmpKey = *pWinKey; + void* pRockVal = NULL; + void* pFileStore = getStateFileStore(pFileState); + int32_t code_file = getCountWinStateFromDisc(pFileStore, &tmpKey, &pRockVal, pVLen); if (code_file == TSDB_CODE_SUCCESS) { - (*pVal) = createSessionWinBuff(pFileState, pWinKey, p, pVLen); - code = code_file; - qDebug("===stream===1 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code_file); - streamStateFreeCur(pCur); - goto _end; + SRowBuffPos* pFirstPos = taosArrayGetP(pWinStates, 0); + SSessionKey* pFirstWinKey = (SSessionKey*)pFirstPos->pKey; + if (tmpKey.win.ekey < pFirstWinKey->win.skey) { + *pWinKey = tmpKey; + (*pVal) = createSessionWinBuff(pFileState, pWinKey, pRockVal, pVLen); + code = code_file; + qDebug("===stream===1 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, + pWinKey->win.ekey, code_file); + goto _end; + } } - taosMemoryFree(p); - streamStateFreeCur(pCur); + taosMemoryFree(pRockVal); } } From 1ad25599cac8a16d42a60e69356cab39ead893f1 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 3 Jun 2024 16:41:38 +0800 Subject: [PATCH 40/44] init delete mark --- .../libs/executor/src/streamcountwindowoperator.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 050e67e15d..857d048457 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -677,6 +677,14 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys goto _error; } + pInfo->twAggSup = (STimeWindowAggSupp){ + .waterMark = pCountNode->window.watermark, + .calTrigger = pCountNode->window.triggerType, + .maxTs = INT64_MIN, + .minTs = INT64_MAX, + .deleteMark = getDeleteMark(&pCountNode->window, 0), + }; + pInfo->primaryTsIndex = ((SColumnNode*)pCountNode->window.pTspk)->slotId; code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle, @@ -687,13 +695,6 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->streamAggSup.windowCount = pCountNode->windowCount; pInfo->streamAggSup.windowSliding = pCountNode->windowSliding; - pInfo->twAggSup = (STimeWindowAggSupp){ - .waterMark = pCountNode->window.watermark, - .calTrigger = pCountNode->window.triggerType, - .maxTs = INT64_MIN, - .minTs = INT64_MAX, - }; - initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); pInfo->binfo.pRes = pResBlock; From 5217131f500ccb65d2ca36150ce1904d91e536ad Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 3 Jun 2024 16:48:44 +0800 Subject: [PATCH 41/44] fix:[TD-30306]error in converity scan --- source/client/src/clientTmq.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 7bc6a2f2e6..13fc2ce16a 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1344,12 +1344,6 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { goto FAIL; } - if(pMsg->pData == NULL){ - tscError("consumer:0x%" PRIx64 " msg discard from vgId:%d, since msg is NULL", tmq->consumerId, vgId); - code = TSDB_CODE_TSC_INTERNAL_ERROR; - goto FAIL; - } - SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { tscWarn("consumer:0x%" PRIx64 " msg discard from vgId:%d, since out of memory", tmq->consumerId, vgId); @@ -1362,6 +1356,12 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { goto END; } + if(pMsg->pData == NULL){ + tscError("consumer:0x%" PRIx64 " msg discard from vgId:%d, since msg is NULL", tmq->consumerId, vgId); + code = TSDB_CODE_TSC_INTERNAL_ERROR; + goto END; + } + int32_t msgEpoch = ((SMqRspHead*)pMsg->pData)->epoch; int32_t clientEpoch = atomic_load_32(&tmq->epoch); if (msgEpoch < clientEpoch) { @@ -1388,7 +1388,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; - goto FAIL; + goto END; } tDecoderClear(&decoder); memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead)); @@ -1404,7 +1404,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; - goto FAIL; + goto END; } tDecoderClear(&decoder); memcpy(&pRspWrapper->metaRsp, pMsg->pData, sizeof(SMqRspHead)); @@ -1415,7 +1415,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; - goto FAIL; + goto END; } tDecoderClear(&decoder); memcpy(&pRspWrapper->taosxRsp, pMsg->pData, sizeof(SMqRspHead)); @@ -1889,8 +1889,6 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { terrno = pRspWrapper->code; tscError("consumer:0x%" PRIx64 " unexpected rsp from poll, code:%s", tmq->consumerId, tstrerror(pRspWrapper->code)); - taosFreeQitem(pRspWrapper); - return NULL; } else { if (pRspWrapper->code == TSDB_CODE_VND_INVALID_VGROUP_ID) { // for vnode transform askEp(tmq, NULL, false, true); From 111e1b2f60b5d22b6fd5107a067668e5dff622b9 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 3 Jun 2024 09:54:28 +0800 Subject: [PATCH 42/44] fix(stream): disable stream checkpoint when related fill-history task exists. --- source/dnode/mnode/impl/src/mndStream.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 48549fce42..79a04a5348 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1130,6 +1130,15 @@ static int32_t mndCheckNodeStatus(SMnode *pMnode) { ready = false; break; } + + if (pEntry->hTaskId != 0) { + mDebug("s-task:0x%" PRIx64 "-0x%x (nodeId:%d) status:%s related fill-history task:0x%" PRIx64 + " exists, checkpoint not issued", + pEntry->id.streamId, (int32_t)pEntry->id.taskId, pEntry->nodeId, streamTaskGetStatusStr(pEntry->status), + pEntry->hTaskId); + ready = false; + break; + } } taosThreadMutexUnlock(&execInfo.lock); From 91375c8ca15ce87ffaa2fd369d46df2f57a163d2 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 3 Jun 2024 19:13:14 +0800 Subject: [PATCH 43/44] fix: taosc exit issue --- include/libs/nodes/nodes.h | 2 ++ source/client/src/clientEnv.c | 43 +++++++++++++++----------- source/libs/nodes/src/nodesUtilFuncs.c | 20 ++++++++++++ 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 31091928c9..d0bf2e2dd4 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -104,6 +104,8 @@ typedef struct SNodeAllocator SNodeAllocator; int32_t nodesInitAllocatorSet(); void nodesDestroyAllocatorSet(); int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId); +int32_t nodesSimAcquireAllocator(int64_t allocatorId); +int32_t nodesSimReleaseAllocator(int64_t allocatorId); int32_t nodesAcquireAllocator(int64_t allocatorId); int32_t nodesReleaseAllocator(int64_t allocatorId); int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 439103e5c4..6406bcbcd8 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -89,24 +89,28 @@ static void deregisterRequest(SRequestObj *pRequest) { "current:%d, app current:%d", pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst); - if (pRequest->pQuery && pRequest->pQuery->pRoot) { - if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->pQuery->pRoot->type && - (0 == ((SVnodeModifyOpStmt *)pRequest->pQuery->pRoot)->sqlNodeType)) { - tscDebug("insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 - "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", - duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, - pRequest->metric.planCostUs, pRequest->metric.execCostUs); - atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration); - reqType = SLOW_LOG_TYPE_INSERT; - } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { - tscDebug("query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 - "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", - duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, - pRequest->metric.planCostUs, pRequest->metric.execCostUs); + if (TSDB_CODE_SUCCESS == nodesSimAcquireAllocator(pRequest->allocatorRefId)) { + if (pRequest->pQuery && pRequest->pQuery->pRoot) { + if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->pQuery->pRoot->type && + (0 == ((SVnodeModifyOpStmt *)pRequest->pQuery->pRoot)->sqlNodeType)) { + tscDebug("insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 + "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", + duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, + pRequest->metric.planCostUs, pRequest->metric.execCostUs); + atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration); + reqType = SLOW_LOG_TYPE_INSERT; + } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { + tscDebug("query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 + "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", + duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, + pRequest->metric.planCostUs, pRequest->metric.execCostUs); - atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration); - reqType = SLOW_LOG_TYPE_QUERY; - } + atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration); + reqType = SLOW_LOG_TYPE_QUERY; + } + } + + nodesSimReleaseAllocator(pRequest->allocatorRefId); } if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->stmtType || QUERY_NODE_INSERT_STMT == pRequest->stmtType) { @@ -491,7 +495,10 @@ void doDestroyRequest(void *p) { } taosMemoryFree(pRequest->body.interParam); - qDestroyQuery(pRequest->pQuery); + if (TSDB_CODE_SUCCESS == nodesSimAcquireAllocator(pRequest->allocatorRefId)) { + qDestroyQuery(pRequest->pQuery); + nodesSimReleaseAllocator(pRequest->allocatorRefId); + } nodesDestroyAllocator(pRequest->allocatorRefId); taosMemoryFreeClear(pRequest->effectiveUser); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index cbffcde875..beedffc4f2 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -240,6 +240,26 @@ int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAlloc return code; } +int32_t nodesSimAcquireAllocator(int64_t allocatorId) { + if (allocatorId <= 0) { + return TSDB_CODE_SUCCESS; + } + + SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId); + if (NULL == pAllocator) { + return terrno; + } + return TSDB_CODE_SUCCESS; +} + +int32_t nodesSimReleaseAllocator(int64_t allocatorId) { + if (allocatorId <= 0) { + return TSDB_CODE_SUCCESS; + } + + return taosReleaseRef(g_allocatorReqRefPool, allocatorId); +} + int32_t nodesAcquireAllocator(int64_t allocatorId) { if (allocatorId <= 0) { return TSDB_CODE_SUCCESS; From ca15176f75e0af89149f65b7a890a0706249b99f Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 3 Jun 2024 19:23:55 +0800 Subject: [PATCH 44/44] docs:[TD-30027]modify subtable rules in stream document --- docs/en/12-taos-sql/14-stream.md | 2 +- docs/zh/12-taos-sql/14-stream.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md index 3f93f69f0f..e7cefc1d7a 100644 --- a/docs/en/12-taos-sql/14-stream.md +++ b/docs/en/12-taos-sql/14-stream.md @@ -80,7 +80,7 @@ If a stream is created with PARTITION BY clause and SUBTABLE clause, the name of CREATE STREAM avg_vol_s INTO avg_vol SUBTABLE(CONCAT('new-', tname)) AS SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname tname INTERVAL(1m); ``` -IN PARTITION clause, 'tbname', representing each subtable name of source supertable, is given alias 'tname'. And 'tname' is used in SUBTABLE clause. In SUBTABLE clause, each auto created subtable will concat 'new-' and source subtable name as their name(Starting from 3.2.3.0, in order to avoid the expression in subtable being unable to distinguish between different subtables, add '_groupId' to the end of subtable name). +IN PARTITION clause, 'tbname', representing each subtable name of source supertable, is given alias 'tname'. And 'tname' is used in SUBTABLE clause. In SUBTABLE clause, each auto created subtable will concat 'new-' and source subtable name as their name(Starting from 3.2.3.0, in order to avoid the expression in subtable being unable to distinguish between different subtables, add '_stableName_groupId' to the end of subtable name). If the output length exceeds the limitation of TDengine(192), the name will be truncated. If the generated name is occupied by some other table, the creation and writing of the new subtable will be failed. diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md index c94df0a7ba..3d48116ec8 100644 --- a/docs/zh/12-taos-sql/14-stream.md +++ b/docs/zh/12-taos-sql/14-stream.md @@ -91,7 +91,7 @@ SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WIN CREATE STREAM avg_vol_s INTO avg_vol SUBTABLE(CONCAT('new-', tname)) AS SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname tname INTERVAL(1m); ``` -PARTITION 子句中,为 tbname 定义了一个别名 tname, 在PARTITION 子句中的别名可以用于 SUBTABLE 子句中的表达式计算,在上述示例中,流新创建的子表将以前缀 'new-' 连接原表名作为表名(从3.2.3.0开始,为了避免 sutable 中的表达式无法区分各个子表,即误将多个相同时间线写入一个子表,在指定的子表名后面加上 _groupId)。 +PARTITION 子句中,为 tbname 定义了一个别名 tname, 在PARTITION 子句中的别名可以用于 SUBTABLE 子句中的表达式计算,在上述示例中,流新创建的子表将以前缀 'new-' 连接原表名作为表名(从3.2.3.0开始,为了避免 sutable 中的表达式无法区分各个子表,即误将多个相同时间线写入一个子表,在指定的子表名后面加上 __stableName_groupId)。 注意,子表名的长度若超过 TDengine 的限制,将被截断。若要生成的子表名已经存在于另一超级表,由于 TDengine 的子表名是唯一的,因此对应新子表的创建以及数据的写入将会失败。