From 6bd2a329c682ce66c11c6d4f3797166aa2a4d4d8 Mon Sep 17 00:00:00 2001 From: haoranchen Date: Mon, 31 Jul 2023 10:19:23 +0800 Subject: [PATCH 001/107] Update cases.task --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 1ec5102d9b..24f968ee65 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -105,7 +105,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py -#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py +,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart.py From 7441801e9d76029e44095c700999b3de7fc071c9 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 15 Aug 2023 13:57:05 +0800 Subject: [PATCH 002/107] feat:support varbinary type --- docs/examples/c/async_query_example.c | 1 + docs/examples/c/query_example.c | 1 + docs/zh/08-connector/45-php.mdx | 1 + include/common/ttypes.h | 4 +- source/client/src/clientJniConnector.c | 1 + source/client/src/clientMain.c | 3 +- source/client/src/clientRawBlockWrite.c | 12 ++-- source/client/src/clientSml.c | 6 +- source/client/src/clientSmlJson.c | 4 +- source/client/src/clientSmlLine.c | 2 +- source/common/src/ttszip.c | 6 +- source/common/src/ttypes.c | 1 + source/common/src/tvariant.c | 13 +++-- source/dnode/mnode/impl/src/mndFunc.c | 3 +- source/dnode/mnode/impl/src/mndStb.c | 6 +- source/dnode/mnode/impl/src/mndTopic.c | 3 +- source/libs/catalog/src/ctgAsync.c | 1 + source/libs/command/src/command.c | 1 + source/libs/executor/src/sysscanoperator.c | 3 +- source/libs/executor/src/timewindowoperator.c | 2 +- source/libs/index/src/indexComm.c | 3 +- source/libs/index/src/indexJson.c | 4 +- source/libs/index/src/indexTfile.c | 4 +- source/libs/parser/src/parInsertSml.c | 6 +- source/libs/parser/src/parInsertSql.c | 23 +++++++- source/libs/parser/src/parInsertStmt.c | 2 +- source/libs/parser/src/parTokenizer.c | 1 + source/libs/parser/src/parTranslater.c | 2 +- source/libs/qcom/src/queryUtil.c | 4 +- source/libs/scalar/inc/filterInt.h | 2 +- source/libs/scalar/src/filter.c | 7 ++- source/libs/scalar/src/sclvector.c | 58 +++---------------- source/util/src/tcompare.c | 8 ++- source/util/src/thashutil.c | 1 + source/util/src/tskiplist.c | 1 + tests/script/api/batchprepare.c | 5 +- tests/script/api/passwdTest.c | 1 + tests/script/api/stmt_function.c | 1 + tools/shell/src/shellEngine.c | 3 + utils/test/c/tmqSim.c | 1 + utils/tsim/src/simExe.c | 1 + 41 files changed, 115 insertions(+), 97 deletions(-) diff --git a/docs/examples/c/async_query_example.c b/docs/examples/c/async_query_example.c index 0618c09f36..9b4b6c943e 100644 --- a/docs/examples/c/async_query_example.c +++ b/docs/examples/c/async_query_example.c @@ -78,6 +78,7 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); diff --git a/docs/examples/c/query_example.c b/docs/examples/c/query_example.c index 88c031abc6..f483371a97 100644 --- a/docs/examples/c/query_example.c +++ b/docs/examples/c/query_example.c @@ -76,6 +76,7 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); diff --git a/docs/zh/08-connector/45-php.mdx b/docs/zh/08-connector/45-php.mdx index a5c3a1a400..0f32b29bf7 100644 --- a/docs/zh/08-connector/45-php.mdx +++ b/docs/zh/08-connector/45-php.mdx @@ -143,6 +143,7 @@ phpize && ./configure --enable-swoole && make -j && make install | `TDengine\TSDB_DATA_TYPE_FLOAT` | float | | `TDengine\TSDB_DATA_TYPE_DOUBLE` | double | | `TDengine\TSDB_DATA_TYPE_BINARY` | binary | +| `TDengine\TSDB_DATA_TYPE_VARBINARY` | varbinary | | `TDengine\TSDB_DATA_TYPE_TIMESTAMP` | timestamp | | `TDengine\TSDB_DATA_TYPE_NCHAR` | nchar | | `TDengine\TSDB_DATA_TYPE_UTINYINT` | utinyint | diff --git a/include/common/ttypes.h b/include/common/ttypes.h index dd8033eb43..559983185c 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -269,8 +269,8 @@ typedef struct { (IS_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP)) #define IS_VAR_DATA_TYPE(t) \ - (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) -#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) + (((t) == TSDB_DATA_TYPE_VARCHAR) || (t) == TSDB_DATA_TYPE_VARBINARY || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) +#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR)) #define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX) #define IS_VALID_SMALLINT(_t) ((_t) >= INT16_MIN && (_t) <= INT16_MAX) diff --git a/source/client/src/clientJniConnector.c b/source/client/src/clientJniConnector.c index 4ad2d4d51f..edbc06b12b 100644 --- a/source/client/src/clientJniConnector.c +++ b/source/client/src/clientJniConnector.c @@ -580,6 +580,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn (*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble)dv); } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { memcpy(tmp, row[i], length[i]); // handle the case that terminated does not exist (*env)->CallVoidMethod(env, rowobj, g_rowdataSetStringFp, i, (*env)->NewStringUTF(env, tmp)); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e262ee04b9..64bcd6d898 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -388,10 +388,11 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); - if (fields[i].type == TSDB_DATA_TYPE_BINARY || fields[i].type == TSDB_DATA_TYPE_GEOMETRY) { + if (fields[i].type == TSDB_DATA_TYPE_BINARY || fields[i].type == TSDB_DATA_TYPE_VARBINARY || fields[i].type == TSDB_DATA_TYPE_GEOMETRY) { if (ASSERT(charLen <= fields[i].bytes && charLen >= 0)) { tscError("taos_print_row error binary. charLen:%d, fields[i].bytes:%d", charLen, fields[i].bytes); } diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index dd311db126..0b28949400 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -56,7 +56,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch cJSON_AddItemToObject(column, "name", cname); cJSON* ctype = cJSON_CreateNumber(s->type); cJSON_AddItemToObject(column, "type", ctype); - if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY|| s->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = s->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(column, "length", cbytes); @@ -77,7 +77,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch cJSON_AddItemToObject(tag, "name", tname); cJSON* ttype = cJSON_CreateNumber(s->type); cJSON_AddItemToObject(tag, "type", ttype); - if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = s->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(tag, "length", cbytes); @@ -130,7 +130,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { cJSON* colType = cJSON_CreateNumber(field->type); cJSON_AddItemToObject(json, "colType", colType); - if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) { + 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); @@ -155,7 +155,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { 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_GEOMETRY) { + 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); @@ -457,7 +457,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type); cJSON_AddItemToObject(json, "colType", colType); - if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) { + 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); @@ -478,7 +478,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { cJSON_AddItemToObject(json, "colName", colName); cJSON* colType = cJSON_CreateNumber(vAlterTbReq.colModType); cJSON_AddItemToObject(json, "colType", colType); - if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_GEOMETRY) { + if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_VARBINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = vAlterTbReq.colModBytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index ffff3df5d0..343cb9d1a3 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -627,7 +627,7 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { } } - if ((type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) && result > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { + if ((type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_GEOMETRY) && result > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { result = TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE; } else if (type == TSDB_DATA_TYPE_NCHAR && result > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { result = (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; @@ -635,7 +635,7 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { if (type == TSDB_DATA_TYPE_NCHAR) { result = result * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; - } else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_GEOMETRY) { result = result + VARSTR_HEADER_SIZE; } return result; @@ -679,7 +679,7 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool } static int32_t getBytes(uint8_t type, int32_t length) { - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { return smlFindNearestPowerOf2(length, type); } else { return tDataTypes[type].bytes; diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 76794fd187..8c53d4f68a 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -569,6 +569,8 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { static int32_t smlConvertJSONString(SSmlKv *pVal, char *typeStr, cJSON *value) { if (strcasecmp(typeStr, "binary") == 0) { pVal->type = TSDB_DATA_TYPE_BINARY; + } else if (strcasecmp(typeStr, "varbinary") == 0) { + pVal->type = TSDB_DATA_TYPE_VARBINARY; } else if (strcasecmp(typeStr, "nchar") == 0) { pVal->type = TSDB_DATA_TYPE_NCHAR; } else { @@ -577,7 +579,7 @@ static int32_t smlConvertJSONString(SSmlKv *pVal, char *typeStr, cJSON *value) { } pVal->length = strlen(value->valuestring); - if (pVal->type == TSDB_DATA_TYPE_BINARY && pVal->length > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { + if ((pVal->type == TSDB_DATA_TYPE_BINARY || pVal->type == TSDB_DATA_TYPE_VARBINARY) && pVal->length > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; } if (pVal->type == TSDB_DATA_TYPE_NCHAR && diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index 1ee2cfbedf..90869d6148 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -390,7 +390,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type}; if (tag->type == TSDB_DATA_TYPE_NCHAR) { kv.length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; - } else if (tag->type == TSDB_DATA_TYPE_BINARY) { + } else if (tag->type == TSDB_DATA_TYPE_BINARY || tag->type == TSDB_DATA_TYPE_VARBINARY) { kv.length = tag->bytes - VARSTR_HEADER_SIZE; } taosArrayPush((*tmp)->cols, &kv); diff --git a/source/common/src/ttszip.c b/source/common/src/ttszip.c index aabbff6f04..38659eea44 100644 --- a/source/common/src/ttszip.c +++ b/source/common/src/ttszip.c @@ -296,7 +296,8 @@ static void writeDataToDisk(STSBuf* pTSBuf) { metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &pBlock->tag.nType, sizeof(pBlock->tag.nType)); int32_t trueLen = pBlock->tag.nLen; - if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { + if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_VARBINARY || + pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &pBlock->tag.nLen, sizeof(pBlock->tag.nLen)); metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, pBlock->tag.pz, (size_t)pBlock->tag.nLen); } else if (pBlock->tag.nType == TSDB_DATA_TYPE_FLOAT) { @@ -378,7 +379,8 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) { // NOTE: mix types tags are not supported size_t sz = 0; - if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { + if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_VARBINARY || + pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { char* tp = taosMemoryRealloc(pBlock->tag.pz, pBlock->tag.nLen + 1); ASSERT(tp != NULL); diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index 39255cff3a..6acd2d087a 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -135,6 +135,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { *((int64_t *)val) = GET_INT64_VAL(src); break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: varDataCopy(val, src); break; diff --git a/source/common/src/tvariant.c b/source/common/src/tvariant.c index cb4a42eb10..5f2796260c 100644 --- a/source/common/src/tvariant.c +++ b/source/common/src/tvariant.c @@ -122,6 +122,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin break; } case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { // todo refactor, extract a method pVar->pz = taosMemoryCalloc(len + 1, sizeof(char)); memcpy(pVar->pz, pz, len); @@ -141,7 +142,8 @@ void taosVariantDestroy(SVariant *pVar) { if (pVar == NULL) return; if (pVar->nType == TSDB_DATA_TYPE_BINARY || pVar->nType == TSDB_DATA_TYPE_NCHAR || - pVar->nType == TSDB_DATA_TYPE_JSON || pVar->nType == TSDB_DATA_TYPE_GEOMETRY) { + pVar->nType == TSDB_DATA_TYPE_JSON || pVar->nType == TSDB_DATA_TYPE_GEOMETRY || + pVar->nType == TSDB_DATA_TYPE_VARBINARY) { taosMemoryFreeClear(pVar->pz); pVar->nLen = 0; } @@ -152,8 +154,9 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) { if (pSrc == NULL || pDst == NULL) return; pDst->nType = pSrc->nType; - if (pSrc->nType == TSDB_DATA_TYPE_BINARY || pSrc->nType == TSDB_DATA_TYPE_NCHAR || - pSrc->nType == TSDB_DATA_TYPE_JSON || pSrc->nType == TSDB_DATA_TYPE_GEOMETRY) { + if (pSrc->nType == TSDB_DATA_TYPE_BINARY ||pSrc->nType == TSDB_DATA_TYPE_VARBINARY || + pSrc->nType == TSDB_DATA_TYPE_NCHAR || pSrc->nType == TSDB_DATA_TYPE_JSON || + pSrc->nType == TSDB_DATA_TYPE_GEOMETRY) { int32_t len = pSrc->nLen + TSDB_NCHAR_SIZE; char *p = taosMemoryRealloc(pDst->pz, len); ASSERT(p); @@ -185,7 +188,8 @@ int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2) { return 1; } - if (p1->nType == TSDB_DATA_TYPE_BINARY || p1->nType == TSDB_DATA_TYPE_NCHAR || p1->nType == TSDB_DATA_TYPE_GEOMETRY) { + if (p1->nType == TSDB_DATA_TYPE_BINARY || p1->nType == TSDB_DATA_TYPE_VARBINARY || + p1->nType == TSDB_DATA_TYPE_NCHAR || p1->nType == TSDB_DATA_TYPE_GEOMETRY) { if (p1->nLen == p2->nLen) { return memcmp(p1->pz, p2->pz, p1->nLen); } else { @@ -237,6 +241,7 @@ char *taosVariantGet(SVariant *pVar, int32_t type) { case TSDB_DATA_TYPE_FLOAT: return (char *)&pVar->f; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_GEOMETRY: return (char *)pVar->pz; diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index 4ffc7a20c2..a1e5bf895a 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -562,7 +562,8 @@ static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int32_t le return msg; } - if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { + if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_VARBINARY || + type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { int32_t bytes = len > 0 ? (int32_t)(len - VARSTR_HEADER_SIZE) : len; snprintf(buf, buflen - 1, "%s(%d)", tDataTypes[type].name, type == TSDB_DATA_TYPE_NCHAR ? bytes / 4 : bytes); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 70fd74afc0..df4d4a3be7 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1478,7 +1478,8 @@ static int32_t mndAlterStbTagBytes(SMnode *pMnode, const SStbObj *pOld, SStbObj SSchema *pTag = pNew->pTags + tag; - if (!(pTag->type == TSDB_DATA_TYPE_BINARY || pTag->type == TSDB_DATA_TYPE_NCHAR || pTag->type == TSDB_DATA_TYPE_GEOMETRY)) { + if (!(pTag->type == TSDB_DATA_TYPE_BINARY || pTag->type == TSDB_DATA_TYPE_VARBINARY || + pTag->type == TSDB_DATA_TYPE_NCHAR || pTag->type == TSDB_DATA_TYPE_GEOMETRY)) { terrno = TSDB_CODE_MND_INVALID_STB_OPTION; return -1; } @@ -1598,7 +1599,8 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO } SSchema *pCol = pNew->pColumns + col; - if (!(pCol->type == TSDB_DATA_TYPE_BINARY || pCol->type == TSDB_DATA_TYPE_NCHAR || pCol->type == TSDB_DATA_TYPE_GEOMETRY)) { + if (!(pCol->type == TSDB_DATA_TYPE_BINARY || pCol->type == TSDB_DATA_TYPE_VARBINARY || + pCol->type == TSDB_DATA_TYPE_NCHAR || pCol->type == TSDB_DATA_TYPE_GEOMETRY)) { terrno = TSDB_CODE_MND_INVALID_STB_OPTION; return -1; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 621a80338d..0c8ebd83c9 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -860,7 +860,8 @@ static void schemaToJson(SSchema *schema, int32_t nCols, char *schemaJson){ cJSON* ctype = cJSON_CreateString(tDataTypes[s->type].name); cJSON_AddItemToObject(column, "type", ctype); int32_t length = 0; - if (s->type == TSDB_DATA_TYPE_BINARY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY || + s->type == TSDB_DATA_TYPE_GEOMETRY) { length = s->bytes - VARSTR_HEADER_SIZE; } else if (s->type == TSDB_DATA_TYPE_NCHAR || s->type == TSDB_DATA_TYPE_JSON) { length = (s->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index fb5ecf7ad2..5b0d1b4446 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -1051,6 +1051,7 @@ void ctgUpdateJobErrCode(SCtgJob* pJob, int32_t errCode) { atomic_store_32(&pJob->jobResCode, errCode); qDebug("QID:0x%" PRIx64 " ctg job errCode updated to %s", pJob->queryId, tstrerror(errCode)); + ASSERT(0); return; } diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 8ddf730d5a..98aab26b0d 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -48,6 +48,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe static int32_t getSchemaBytes(const SSchema* pSchema) { switch (pSchema->type) { case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: return (pSchema->bytes - VARSTR_HEADER_SIZE); case TSDB_DATA_TYPE_NCHAR: diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index a1f83dda2f..019a9f4d2c 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -400,8 +400,7 @@ static bool sysTableIsOperatorCondOnOneTable(SNode* pCond, char* condTable) { strcasecmp(nodesGetNameFromColumnNode(node->pLeft), "table_name") == 0 && nodeType(node->pRight) == QUERY_NODE_VALUE) { SValueNode* pValue = (SValueNode*)node->pRight; - if (pValue->node.resType.type == TSDB_DATA_TYPE_NCHAR || pValue->node.resType.type == TSDB_DATA_TYPE_VARCHAR || - pValue->node.resType.type == TSDB_DATA_TYPE_BINARY) { + if (pValue->node.resType.type == TSDB_DATA_TYPE_NCHAR || pValue->node.resType.type == TSDB_DATA_TYPE_VARCHAR) { char* value = nodesGetValueFromNode(pValue); strncpy(condTable, varDataVal(value), TSDB_TABLE_NAME_LEN); return true; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 3abb4f44f4..6884855ece 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -308,7 +308,7 @@ void doTimeWindowInterpolation(SArray* pPrevValues, SArray* pDataBlock, TSKEY pr pCtx[k].end.key = curTs; pCtx[k].end.val = v2; - if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR || + if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_VARBINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR || pColInfo->info.type == TSDB_DATA_TYPE_GEOMETRY) { if (prevRowIndex == -1) { // pCtx[k].start.ptr = (char*)pRuntimeEnv->prevRow[index]; diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c index a0310a9f0e..9f8c2139eb 100644 --- a/source/libs/index/src/indexComm.c +++ b/source/libs/index/src/indexComm.c @@ -76,7 +76,8 @@ char* idxInt2str(int64_t val, char* dst, int radix) { return dst - 1; } __compar_fn_t idxGetCompar(int8_t type) { - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || + type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { return (__compar_fn_t)strcmp; } return getComparFunc(type, 0); diff --git a/source/libs/index/src/indexJson.c b/source/libs/index/src/indexJson.c index 1b4f847919..09c1320667 100644 --- a/source/libs/index/src/indexJson.c +++ b/source/libs/index/src/indexJson.c @@ -24,7 +24,7 @@ int indexJsonPut(SIndexJson *index, SIndexJsonMultiTerm *terms, uint64_t uid) { SIndexJsonTerm *p = taosArrayGetP(terms, i); if (p->colType == TSDB_DATA_TYPE_BOOL) { p->colType = TSDB_DATA_TYPE_INT; - } else if (p->colType == TSDB_DATA_TYPE_VARCHAR || p->colType == TSDB_DATA_TYPE_NCHAR || + } else if (p->colType == TSDB_DATA_TYPE_VARBINARY || p->colType == TSDB_DATA_TYPE_NCHAR || p->colType == TSDB_DATA_TYPE_BINARY || p->colType == TSDB_DATA_TYPE_GEOMETRY) { // p->colType = TSDB_DATA_TYPE_NCHAR; } else { @@ -42,7 +42,7 @@ int indexJsonSearch(SIndexJson *index, SIndexJsonMultiTermQuery *tq, SArray *res SIndexJsonTerm *p = taosArrayGetP(terms, i); if (p->colType == TSDB_DATA_TYPE_BOOL) { p->colType = TSDB_DATA_TYPE_INT; - } else if (p->colType == TSDB_DATA_TYPE_VARCHAR || p->colType == TSDB_DATA_TYPE_NCHAR || + } else if (p->colType == TSDB_DATA_TYPE_VARBINARY || p->colType == TSDB_DATA_TYPE_NCHAR || p->colType == TSDB_DATA_TYPE_BINARY || p->colType == TSDB_DATA_TYPE_GEOMETRY) { // p->colType = TSDB_DATA_TYPE_NCHAR; } else { diff --git a/source/libs/index/src/indexTfile.c b/source/libs/index/src/indexTfile.c index 9b6ba40318..8f8b5c7768 100644 --- a/source/libs/index/src/indexTfile.c +++ b/source/libs/index/src/indexTfile.c @@ -545,8 +545,8 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) { int8_t colType = tw->header.colType; colType = IDX_TYPE_GET_TYPE(colType); - if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_NCHAR || - colType == TSDB_DATA_TYPE_GEOMETRY) { + if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_VARBINARY || + colType == TSDB_DATA_TYPE_NCHAR || colType == TSDB_DATA_TYPE_GEOMETRY) { fn = tfileStrCompare; } else { fn = getComparFunc(colType, 0); diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index 78b05b6df5..9bb559d441 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -134,7 +134,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem taosArrayPush(*tagName, pTagSchema->name); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || pTagSchema->type == TSDB_DATA_TYPE_VARBINARY || pTagSchema->type == TSDB_DATA_TYPE_GEOMETRY) { val.pData = (uint8_t*)kv->value; val.nData = kv->length; @@ -237,7 +237,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32 } pVal->value.pData = pUcs4; pVal->value.nData = len; - } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_VARBINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; } else { @@ -364,7 +364,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc } pVal->value.pData = pUcs4; pVal->value.nData = len; - } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_VARBINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; } else { diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 8d35674949..1000d670d8 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -477,7 +477,15 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, val->nData = pToken->n; break; } - + case TSDB_DATA_TYPE_VARBINARY: { + // Too long values will raise the invalid sql error message + if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { + return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); + } + val->pData = taosStrdup(pToken->z) + val->nData = pToken->n; + break; + } case TSDB_DATA_TYPE_GEOMETRY: { unsigned char* output = NULL; size_t size = 0; @@ -1364,6 +1372,19 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, pVal->value.nData = pToken->n; break; } + case TSDB_DATA_TYPE_VARBINARY: { + // Too long values will raise the invalid sql error message + if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { + return generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); + } + pVal->value.pData = taosMemoryMalloc(pToken->n); + if (NULL == pVal->value.pData) { + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(pVal->value.pData, pToken->z, pToken->n); + pVal->value.nData = pToken->n + break; + } case TSDB_DATA_TYPE_NCHAR: { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' int32_t len = 0; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index bcbea6cd2e..5137deca2e 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -128,7 +128,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } else { STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || pTagSchema->type == TSDB_DATA_TYPE_VARBINARY || pTagSchema->type == TSDB_DATA_TYPE_GEOMETRY) { val.pData = (uint8_t*)bind[c].buffer; val.nData = colLen; diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index ca7ac1a0b6..41f6239455 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -285,6 +285,7 @@ static SKeyword keywordTable[] = { {"_WEND", TK_WEND}, {"_WSTART", TK_WSTART}, {"ALIVE", TK_ALIVE}, + {"VARBINARY", TK_VARBINARY}, }; // clang-format on diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 38118c03f8..0ca5ae01b5 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1302,7 +1302,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } static int32_t calcTypeBytes(SDataType dt) { - if (TSDB_DATA_TYPE_BINARY == dt.type || TSDB_DATA_TYPE_GEOMETRY == dt.type) { + if (TSDB_DATA_TYPE_BINARY == dt.type || TSDB_DATA_TYPE_VARBINARY == dt.type || TSDB_DATA_TYPE_GEOMETRY == dt.type) { return dt.bytes + VARSTR_HEADER_SIZE; } else if (TSDB_DATA_TYPE_NCHAR == dt.type) { return dt.bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 38d7c9da3b..e245b6f273 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -44,7 +44,7 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen } // 2. valid length for each type - if (pSchema[i].type == TSDB_DATA_TYPE_BINARY) { + if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_VARBINARY) { if (pSchema[i].bytes > TSDB_MAX_BINARY_LEN) { return false; } @@ -300,6 +300,8 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t n = sprintf(str, "%e", GET_DOUBLE_VAL(buf)); break; + case TSDB_DATA_TYPE_VARBINARY: + sd; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h index 5fb7b0e90c..4296abb588 100644 --- a/source/libs/scalar/inc/filterInt.h +++ b/source/libs/scalar/inc/filterInt.h @@ -272,7 +272,7 @@ struct SFilterInfo { }; #define FILTER_NO_MERGE_DATA_TYPE(t) \ - ((t) == TSDB_DATA_TYPE_BINARY || (t) == TSDB_DATA_TYPE_NCHAR || (t) == TSDB_DATA_TYPE_JSON || \ + ((t) == TSDB_DATA_TYPE_BINARY || (t) == TSDB_DATA_TYPE_VARBINARY || (t) == TSDB_DATA_TYPE_NCHAR || (t) == TSDB_DATA_TYPE_JSON || \ (t) == TSDB_DATA_TYPE_GEOMETRY) #define FILTER_NO_MERGE_OPTR(o) ((o) == OP_TYPE_IS_NULL || (o) == OP_TYPE_IS_NOT_NULL || (o) == FILTER_DUMMY_EMPTY_OPTR) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 892fd588b6..e887bb8888 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -180,7 +180,8 @@ __compar_fn_t gUint64UsignCompare[] = {compareUint64Uint8, compareUint64Uint16, int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { int8_t comparFn = 0; - if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && + type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -257,6 +258,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = 5; break; + case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY: { if (optr == OP_TYPE_MATCH) { comparFn = 19; @@ -466,7 +468,7 @@ static FORCE_INLINE SFilterRangeNode *filterNewRange(SFilterRangeCtx *ctx, SFilt void *filterInitRangeCtx(int32_t type, int32_t options) { if (type > TSDB_DATA_TYPE_UBIGINT || type < TSDB_DATA_TYPE_BOOL || - type == TSDB_DATA_TYPE_BINARY || + type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { qError("not supported range type:%d", type); return NULL; @@ -1584,6 +1586,7 @@ int32_t fltConverToStr(char *str, int type, void *buf, int32_t bufSize, int32_t n = sprintf(str, "%e", GET_DOUBLE_VAL(buf)); break; + case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 0246724c5b..96a18e56d2 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -190,55 +190,6 @@ _getBigintValue_fn_t getVectorBigintValueFn(int32_t srcType) { return p; } -typedef void *(*_getValueAddr_fn_t)(void *src, int32_t index); - -void *getVectorValueAddr_TINYINT(void *src, int32_t index) { return (void *)((int8_t *)src + index); } -void *getVectorValueAddr_UTINYINT(void *src, int32_t index) { return (void *)((uint8_t *)src + index); } -void *getVectorValueAddr_SMALLINT(void *src, int32_t index) { return (void *)((int16_t *)src + index); } -void *getVectorValueAddr_USMALLINT(void *src, int32_t index) { return (void *)((uint16_t *)src + index); } -void *getVectorValueAddr_INT(void *src, int32_t index) { return (void *)((int32_t *)src + index); } -void *getVectorValueAddr_UINT(void *src, int32_t index) { return (void *)((uint32_t *)src + index); } -void *getVectorValueAddr_BIGINT(void *src, int32_t index) { return (void *)((int64_t *)src + index); } -void *getVectorValueAddr_UBIGINT(void *src, int32_t index) { return (void *)((uint64_t *)src + index); } -void *getVectorValueAddr_FLOAT(void *src, int32_t index) { return (void *)((float *)src + index); } -void *getVectorValueAddr_DOUBLE(void *src, int32_t index) { return (void *)((double *)src + index); } -void *getVectorValueAddr_default(void *src, int32_t index) { return src; } -void *getVectorValueAddr_VAR(void *src, int32_t index) { return colDataGetData((SColumnInfoData *)src, index); } - -_getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) { - _getValueAddr_fn_t p = NULL; - if (srcType == TSDB_DATA_TYPE_TINYINT) { - p = getVectorValueAddr_TINYINT; - } else if (srcType == TSDB_DATA_TYPE_UTINYINT) { - p = getVectorValueAddr_UTINYINT; - } else if (srcType == TSDB_DATA_TYPE_SMALLINT) { - p = getVectorValueAddr_SMALLINT; - } else if (srcType == TSDB_DATA_TYPE_USMALLINT) { - p = getVectorValueAddr_USMALLINT; - } else if (srcType == TSDB_DATA_TYPE_INT) { - p = getVectorValueAddr_INT; - } else if (srcType == TSDB_DATA_TYPE_UINT) { - p = getVectorValueAddr_UINT; - } else if (srcType == TSDB_DATA_TYPE_BIGINT) { - p = getVectorValueAddr_BIGINT; - } else if (srcType == TSDB_DATA_TYPE_UBIGINT) { - p = getVectorValueAddr_UBIGINT; - } else if (srcType == TSDB_DATA_TYPE_FLOAT) { - p = getVectorValueAddr_FLOAT; - } else if (srcType == TSDB_DATA_TYPE_DOUBLE) { - p = getVectorValueAddr_DOUBLE; - } else if (srcType == TSDB_DATA_TYPE_BINARY) { - p = getVectorValueAddr_VAR; - } else if (srcType == TSDB_DATA_TYPE_NCHAR) { - p = getVectorValueAddr_VAR; - }else if(srcType == TSDB_DATA_TYPE_GEOMETRY) { - p = getVectorValueAddr_VAR; - } else { - p = getVectorValueAddr_default; - } - return p; -} - static FORCE_INLINE void varToTimestamp(char *buf, SScalarParam *pOut, int32_t rowIndex, int32_t *overflow) { terrno = TSDB_CODE_SUCCESS; @@ -597,7 +548,8 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t } if (optr == OP_TYPE_LIKE || optr == OP_TYPE_NOT_LIKE || optr == OP_TYPE_MATCH || optr == OP_TYPE_NMATCH) { - if (typeLeft != TSDB_DATA_TYPE_NCHAR && typeLeft != TSDB_DATA_TYPE_BINARY && typeLeft != TSDB_DATA_TYPE_GEOMETRY) { + if (typeLeft != TSDB_DATA_TYPE_NCHAR && typeLeft != TSDB_DATA_TYPE_BINARY && + typeLeft != TSDB_DATA_TYPE_GEOMETRY && typeLeft != TSDB_DATA_TYPE_VARBINARY) { return false; } } @@ -636,13 +588,16 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t if (typeRight == TSDB_DATA_TYPE_NCHAR || typeRight == TSDB_DATA_TYPE_VARCHAR || + typeRight == TSDB_DATA_TYPE_VARBINARY || typeRight == TSDB_DATA_TYPE_GEOMETRY) { return false; } else if (typeRight != type) { convertNumberToNumber(*pRightData, pRightOut, typeRight, type); *pRightData = pRightOut; } - } else if (type == TSDB_DATA_TYPE_BINARY || typeLeft == TSDB_DATA_TYPE_GEOMETRY) { + } else if (type == TSDB_DATA_TYPE_BINARY || + type == TSDB_DATA_TYPE_VARBINARY || + type == TSDB_DATA_TYPE_GEOMETRY) { if (typeLeft == TSDB_DATA_TYPE_NCHAR) { *pLeftData = ncharTobinary(*pLeftData); *freeLeft = true; @@ -932,6 +887,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, break; } case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { return vectorConvertToVarData(&cCtx); diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 843f9c56dc..7ebe32dfaf 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -1301,7 +1301,8 @@ int32_t comparewcsPatternNMatch(const void *pLeft, const void *pRight) { __compar_fn_t getComparFunc(int32_t type, int32_t optr) { __compar_fn_t comparFn = NULL; - if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && + type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -1324,7 +1325,8 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { } } - if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && + type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -1369,6 +1371,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { comparFn = compareDoubleVal; break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_GEOMETRY: { if (optr == OP_TYPE_MATCH) { comparFn = comparestrRegexMatch; @@ -1454,6 +1457,7 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { case TSDB_DATA_TYPE_UBIGINT: return (order == TSDB_ORDER_ASC) ? compareUint64Val : compareUint64ValDesc; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_GEOMETRY: return (order == TSDB_ORDER_ASC) ? compareLenPrefixedStr : compareLenPrefixedStrDesc; case TSDB_DATA_TYPE_NCHAR: diff --git a/source/util/src/thashutil.c b/source/util/src/thashutil.c index 891c09cfb5..9d65977ff1 100644 --- a/source/util/src/thashutil.c +++ b/source/util/src/thashutil.c @@ -193,6 +193,7 @@ _hash_fn_t taosGetDefaultHashFunction(int32_t type) { fn = taosIntHash_64; break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: fn = MurmurHash3_32; diff --git a/source/util/src/tskiplist.c b/source/util/src/tskiplist.c index 6344af523f..eadd9a2413 100644 --- a/source/util/src/tskiplist.c +++ b/source/util/src/tskiplist.c @@ -376,6 +376,7 @@ void tSkipListPrint(SSkipList *pSkipList, int16_t nlevel) { fprintf(stdout, "%d: %" PRId64 " \n", id++, *(int64_t *)key); break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: fprintf(stdout, "%d: %s \n", id++, key); break; diff --git a/tests/script/api/batchprepare.c b/tests/script/api/batchprepare.c index 604d6ade89..0e3b50974a 100644 --- a/tests/script/api/batchprepare.c +++ b/tests/script/api/batchprepare.c @@ -1222,6 +1222,7 @@ int32_t bpAppendValueString(char *buf, int type, void *value, int32_t valueLen, break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: buf[*len] = '\''; @@ -1369,7 +1370,7 @@ void bpCheckColTagFields(TAOS_STMT *stmt, int32_t fieldNum, TAOS_FIELD_E* pField exit(1); } - if (pFields[i].type == TSDB_DATA_TYPE_BINARY || pFields[i].type == TSDB_DATA_TYPE_GEOMETRY) { + if (pFields[i].type == TSDB_DATA_TYPE_BINARY || pFields[i].type == TSDB_DATA_TYPE_VARBINARY || pFields[i].type == TSDB_DATA_TYPE_GEOMETRY) { if (pFields[i].bytes != (pBind[i].buffer_length + 2)) { printf("!!!%s %dth field len %d mis-match expect len %d\n", BP_BIND_TYPE_STR(type), i, pFields[i].bytes, (pBind[i].buffer_length + 2)); exit(1); @@ -2256,7 +2257,7 @@ int insertNonExistsTb(TAOS_STMT *stmt, TAOS *taos) { void bpAddWrongVarBuffLen(TAOS_MULTI_BIND* pBind) { for (int32_t i = 0; i < gCurCase->bindColNum; ++i) { - if (pBind[i].buffer_type == TSDB_DATA_TYPE_BINARY || pBind[i].buffer_type == TSDB_DATA_TYPE_NCHAR) { + if (pBind[i].buffer_type == TSDB_DATA_TYPE_BINARY || pBind[i].buffer_type == TSDB_DATA_TYPE_VARBINARY || pBind[i].buffer_type == TSDB_DATA_TYPE_NCHAR) { *pBind[i].length += 100; } } diff --git a/tests/script/api/passwdTest.c b/tests/script/api/passwdTest.c index d9cb2128ef..06d2d3455f 100644 --- a/tests/script/api/passwdTest.c +++ b/tests/script/api/passwdTest.c @@ -145,6 +145,7 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { len += sprintf(str + len, "%lf", dv); } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); diff --git a/tests/script/api/stmt_function.c b/tests/script/api/stmt_function.c index 55ab3f5631..d7d6f7d6f0 100644 --- a/tests/script/api/stmt_function.c +++ b/tests/script/api/stmt_function.c @@ -400,6 +400,7 @@ void taos_stmt_use_result_query(void *taos, char *col, int type) { params->length = ¶ms->buffer_length; break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: params->buffer_length = sizeof(v.c6); params->buffer = &v.c6; diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index e9dd067ac4..12a8807ed5 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -386,6 +386,7 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: { @@ -637,6 +638,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: shellPrintNChar(val, length, width); @@ -772,6 +774,7 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) { return TMAX(SHELL_DOUBLE_WIDTH, width); case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_GEOMETRY: if (field->bytes > shell.args.displayWidth) { return TMAX(shell.args.displayWidth, width); diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c index dd6875185f..fbfacd9eda 100644 --- a/utils/test/c/tmqSim.c +++ b/utils/test/c/tmqSim.c @@ -541,6 +541,7 @@ static void shellDumpFieldToFile(TdFilePtr pFile, const char* val, TAOS_FIELD* f } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_GEOMETRY: { diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 9a0a156717..200d3e30f2 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -751,6 +751,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { sprintf(value, "%.9lf", GET_DOUBLE_VAL(row[i])); break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: if (length[i] < 0 || length[i] > 1 << 20) { From f266d5176456e02f1959d799e7568a956f9de448 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 16 Aug 2023 19:05:07 +0800 Subject: [PATCH 003/107] feat:support varbinary type --- include/common/ttypes.h | 2 +- include/os/osString.h | 3 + source/client/src/clientImpl.c | 2 +- source/client/src/clientRawBlockWrite.c | 14 +++- source/client/src/clientSml.c | 2 +- source/common/src/tdatablock.c | 3 +- source/common/src/tdataformat.c | 1 + source/common/src/trow.c | 2 +- source/common/src/ttypes.c | 2 +- source/libs/command/src/command.c | 4 +- source/libs/executor/src/dataInserter.c | 2 +- source/libs/index/src/indexComm.c | 13 +--- source/libs/parser/src/parInsertSql.c | 57 ++++++++++++--- source/libs/parser/src/parTranslater.c | 6 ++ source/libs/qcom/src/queryUtil.c | 19 ++++- source/libs/scalar/src/filter.c | 12 +++- source/libs/scalar/src/scalar.c | 9 ++- source/libs/scalar/src/sclvector.c | 4 +- source/os/src/osString.c | 92 +++++++++++++++++++++++++ source/util/src/tcompare.c | 11 ++- tools/shell/src/shellEngine.c | 22 ++++-- 21 files changed, 234 insertions(+), 48 deletions(-) diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 559983185c..279799b172 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -269,7 +269,7 @@ typedef struct { (IS_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP)) #define IS_VAR_DATA_TYPE(t) \ - (((t) == TSDB_DATA_TYPE_VARCHAR) || (t) == TSDB_DATA_TYPE_VARBINARY || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) + (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) #define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR)) #define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX) diff --git a/include/os/osString.h b/include/os/osString.h index b609c9d351..ed64cbfe3f 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -90,6 +90,9 @@ int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix); uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix); double taosStr2Double(const char *str, char **pEnd); float taosStr2Float(const char *str, char **pEnd); +int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size); +int32_t taosAscii2Hex(const char *z, uint32_t n, void** data, uint32_t* size); +int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size); #ifdef __cplusplus } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d448dd1edf..c78ba4c4a0 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -503,7 +503,7 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t pResInfo->userFields[i].bytes = pSchema[i].bytes; pResInfo->userFields[i].type = pSchema[i].type; - if (pSchema[i].type == TSDB_DATA_TYPE_VARCHAR || pSchema[i].type == TSDB_DATA_TYPE_GEOMETRY) { + if (pSchema[i].type == TSDB_DATA_TYPE_VARCHAR || pSchema[i].type == TSDB_DATA_TYPE_VARBINARY || pSchema[i].type == TSDB_DATA_TYPE_GEOMETRY) { pResInfo->userFields[i].bytes -= VARSTR_HEADER_SIZE; } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR || pSchema[i].type == TSDB_DATA_TYPE_JSON) { pResInfo->userFields[i].bytes = (pResInfo->userFields[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 0b28949400..af6b3bcc8c 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -292,7 +292,13 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { cJSON* tvalue = NULL; if (IS_VAR_DATA_TYPE(pTagVal->type)) { - char* buf = taosMemoryCalloc(pTagVal->nData + 3, 1); + char* buf = NULL; + if(pTagVal->type == TSDB_DATA_TYPE_VARBINARY){ + buf = taosMemoryCalloc(pTagVal->nData*2 + 2 + 3, 1); + }else{ + buf = taosMemoryCalloc(pTagVal->nData + 3, 1); + } + if (!buf) goto end; dataConverToStr(buf, pTagVal->type, pTagVal->pData, pTagVal->nData, NULL); tvalue = cJSON_CreateString(buf); @@ -515,7 +521,11 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { } buf = parseTagDatatoJson(vAlterTbReq.pTagVal); } else { - buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); + if(vAlterTbReq.tagType == TSDB_DATA_TYPE_VARBINARY){ + buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); + }else{ + buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); + } dataConverToStr(buf, vAlterTbReq.tagType, vAlterTbReq.pTagVal, vAlterTbReq.nTagVal, NULL); } diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 343cb9d1a3..266368e9bc 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -596,7 +596,7 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm return TSDB_CODE_SML_INVALID_DATA; } - if (((colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_GEOMETRY) && + if (((colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_GEOMETRY) && (colField[*index].bytes - VARSTR_HEADER_SIZE) < kv->length) || (colField[*index].type == TSDB_DATA_TYPE_NCHAR && ((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) { diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 5188b1e27c..efbfa6e4e6 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1852,6 +1852,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) if (len >= size - 1) return dumpBuf; break; case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { memset(pBuf, 0, sizeof(pBuf)); char* pData = colDataGetVarData(pColInfoData, j); @@ -1951,6 +1952,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat } break; case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY ASSERT(pColInfoData->info.type == pCol->type); if (colDataIsNull_s(pColInfoData, j)) { @@ -1964,7 +1966,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat } break; } - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_DECIMAL: case TSDB_DATA_TYPE_BLOB: case TSDB_DATA_TYPE_JSON: diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 7c6939635a..7b8f0e67fb 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1146,6 +1146,7 @@ static int tTagValJsonCmprFn(const void *p1, const void *p2) { static void debugPrintTagVal(int8_t type, const void *val, int32_t vlen, const char *tag, int32_t ln) { switch (type) { + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_NCHAR: diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 039f436505..e2da4d166e 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -356,7 +356,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { } } else { varDataLen += sizeof(VarDataLenT); - if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR || pTColumn->type == TSDB_DATA_TYPE_GEOMETRY) { + if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR || pTColumn->type == TSDB_DATA_TYPE_VARBINARY || pTColumn->type == TSDB_DATA_TYPE_GEOMETRY) { varDataLen += CHAR_BYTES; if (maxVarDataLen < CHAR_BYTES + sizeof(VarDataLenT)) { maxVarDataLen = CHAR_BYTES + sizeof(VarDataLenT); diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index 6acd2d087a..8827ddc811 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -61,7 +61,7 @@ tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX] = { {TSDB_DATA_TYPE_UINT, 12, INT_BYTES, "INT UNSIGNED", 0, UINT32_MAX, tsCompressInt, tsDecompressInt}, {TSDB_DATA_TYPE_UBIGINT, 15, LONG_BYTES, "BIGINT UNSIGNED", 0, UINT64_MAX, tsCompressBigint, tsDecompressBigint}, {TSDB_DATA_TYPE_JSON, 4, TSDB_MAX_JSON_TAG_LEN, "JSON", 0, 0, tsCompressString, tsDecompressString}, - {TSDB_DATA_TYPE_VARBINARY, 9, 1, "VARBINARY", 0, 0, NULL, NULL}, // placeholder, not implemented + {TSDB_DATA_TYPE_VARBINARY, 9, 1, "VARBINARY", 0, 0, tsCompressString, tsDecompressString}, // placeholder, not implemented {TSDB_DATA_TYPE_DECIMAL, 7, 1, "DECIMAL", 0, 0, NULL, NULL}, // placeholder, not implemented {TSDB_DATA_TYPE_BLOB, 4, 1, "BLOB", 0, 0, NULL, NULL}, // placeholder, not implemented {TSDB_DATA_TYPE_MEDIUMBLOB, 10, 1, "MEDIUMBLOB", 0, 0, NULL, NULL}, // placeholder, not implemented diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 98aab26b0d..444da63a56 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -458,7 +458,7 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) { SSchema* pSchema = pCfg->pSchemas + i; char type[32]; sprintf(type, "%s", tDataTypes[pSchema->type].name); - if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { + if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); @@ -473,7 +473,7 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) { SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i; char type[32]; sprintf(type, "%s", tDataTypes[pSchema->type].name); - if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { + if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index 646964ebf4..c65dfd97d1 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -213,6 +213,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY ASSERT(pColInfoData->info.type == pCol->type); if (colDataIsNull_s(pColInfoData, j)) { @@ -226,7 +227,6 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp } break; } - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_DECIMAL: case TSDB_DATA_TYPE_BLOB: case TSDB_DATA_TYPE_JSON: diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c index 9f8c2139eb..1313221952 100644 --- a/source/libs/index/src/indexComm.c +++ b/source/libs/index/src/indexComm.c @@ -357,17 +357,13 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) { break; } case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { tlen = taosEncodeBinary(NULL, src, strlen(src)); *dst = taosMemoryCalloc(1, tlen + 1); tlen = taosEncodeBinary(dst, src, strlen(src)); break; } - case TSDB_DATA_TYPE_VARBINARY: - tlen = taosEncodeBinary(NULL, src, strlen(src)); - *dst = taosMemoryCalloc(1, tlen + 1); - tlen = taosEncodeBinary(dst, src, strlen(src)); - break; default: ASSERTS(0, "index invalid input type"); break; @@ -448,6 +444,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) { break; } case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src)); *dst = taosMemoryCalloc(1, tlen + 1); @@ -455,12 +452,6 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) { *dst = (char*)*dst - tlen; break; } - case TSDB_DATA_TYPE_VARBINARY: - tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src)); - *dst = taosMemoryCalloc(1, tlen + 1); - tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src)); - *dst = (char*)*dst - tlen; - break; default: ASSERTS(0, "index invalid input type"); break; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 1000d670d8..c58647e540 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -479,11 +479,32 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, } case TSDB_DATA_TYPE_VARBINARY: { // Too long values will raise the invalid sql error message - if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { + // Too long values will raise the invalid sql error message + void* data = NULL; + uint32_t size = 0; + if (pToken->type == TK_NK_HEX){ + if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + }else if(pToken->type == TK_NK_BIN){ + if(taosBin2Ascii(pToken->z, pToken->n, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + }else{ + size = pToken->n; + } + if (size + VARSTR_HEADER_SIZE > pSchema->bytes) { + if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ + taosMemoryFree(data); + } return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); } - val->pData = taosStrdup(pToken->z) - val->nData = pToken->n; + if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ + val->pData = data; + }else{ + val->pData = taosStrdup(pToken->z); + } + val->nData = size; break; } case TSDB_DATA_TYPE_GEOMETRY: { @@ -667,6 +688,7 @@ static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { *(double*)&pValue->typeData = pValue->datum.d; break; case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: pValue->datum.p = taosMemoryCalloc(1, pVal->nData + VARSTR_HEADER_SIZE); if (NULL == pValue->datum.p) { @@ -696,7 +718,6 @@ static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { *(uint64_t*)&pValue->typeData = pValue->datum.i; break; case TSDB_DATA_TYPE_JSON: - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_DECIMAL: case TSDB_DATA_TYPE_BLOB: case TSDB_DATA_TYPE_MEDIUMBLOB: @@ -1374,15 +1395,31 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, } case TSDB_DATA_TYPE_VARBINARY: { // Too long values will raise the invalid sql error message - if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { + void* data = NULL; + uint32_t size = 0; + if (pToken->type == TK_NK_HEX){ + if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + }else if(pToken->type == TK_NK_BIN){ + if(taosBin2Ascii(pToken->z, pToken->n, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + }else{ + size = pToken->n; + } + if (size + VARSTR_HEADER_SIZE > pSchema->bytes) { + if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ + taosMemoryFree(data); + } return generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); } - pVal->value.pData = taosMemoryMalloc(pToken->n); - if (NULL == pVal->value.pData) { - return TSDB_CODE_OUT_OF_MEMORY; + if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ + pVal->value.pData = data; + }else{ + pVal->value.pData = taosStrdup(pToken->z); } - memcpy(pVal->value.pData, pToken->z, pToken->n); - pVal->value.nData = pToken->n + pVal->value.nData = size; break; } case TSDB_DATA_TYPE_NCHAR: { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0ca5ae01b5..72d8799a85 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -4784,6 +4784,7 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN } if (TSDB_CODE_SUCCESS == code) { if ((TSDB_DATA_TYPE_VARCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || (TSDB_DATA_TYPE_NCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || (TSDB_DATA_TYPE_GEOMETRY == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN)) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); @@ -4836,6 +4837,7 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in } if (TSDB_CODE_SUCCESS == code) { if ((TSDB_DATA_TYPE_VARCHAR == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_NCHAR_LEN) || (TSDB_DATA_TYPE_GEOMETRY == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_GEOMETRY_LEN)) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); @@ -5532,6 +5534,7 @@ static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTable if (TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES == pStmt->alterType) { if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } @@ -5558,6 +5561,7 @@ static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTable } if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } @@ -8841,6 +8845,7 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S } if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } @@ -8898,6 +8903,7 @@ static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt } if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index e245b6f273..5c9c3da5f4 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -300,8 +300,23 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t n = sprintf(str, "%e", GET_DOUBLE_VAL(buf)); break; - case TSDB_DATA_TYPE_VARBINARY: - sd; + case TSDB_DATA_TYPE_VARBINARY:{ + if (bufSize < 0) { + // tscError("invalid buf size"); + return TSDB_CODE_TSC_INVALID_VALUE; + } + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(buf, bufSize, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + *str = '"'; + memcpy(str + 1, data, size); + *(str + size + 1) = '"'; + n = size + 2; + taosMemoryFree(data); + break; + } case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index e887bb8888..0efe335c3d 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -207,7 +207,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { } } - if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -258,7 +258,15 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = 5; break; - case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY:{ + if (optr == OP_TYPE_IN) { + comparFn = 8; + } else if (optr == OP_TYPE_NOT_IN) { + comparFn = 25; + } else { /* normal relational comparFn */ + comparFn = 30; + } + } case TSDB_DATA_TYPE_BINARY: { if (optr == OP_TYPE_MATCH) { comparFn = 19; diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 4eb0f0e1bc..b3f67f2c9d 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -1594,6 +1594,8 @@ static int32_t sclGetMathOperatorResType(SOperatorNode *pOp) { SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_TIMESTAMP == rdt.type) || + TSDB_DATA_TYPE_VARBINARY == ldt.type || + TSDB_DATA_TYPE_VARBINARY == rdt.type || (TSDB_DATA_TYPE_TIMESTAMP == ldt.type && (IS_VAR_DATA_TYPE(rdt.type) || IS_FLOAT_TYPE(rdt.type))) || (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && (IS_VAR_DATA_TYPE(ldt.type) || IS_FLOAT_TYPE(ldt.type)))) { return TSDB_CODE_TSC_INVALID_OPERATION; @@ -1629,7 +1631,7 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) { return TSDB_CODE_TSC_INVALID_OPERATION; } SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; - if (!IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) || + if (ldt.type == TSDB_DATA_TYPE_VARBINARY || !IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) || (!IS_STR_DATA_TYPE(rdt.type) && (rdt.type != TSDB_DATA_TYPE_NULL))) { return TSDB_CODE_TSC_INVALID_OPERATION; } @@ -1660,6 +1662,11 @@ static int32_t sclGetJsonOperatorResType(SOperatorNode *pOp) { } static int32_t sclGetBitwiseOperatorResType(SOperatorNode *pOp) { + SDataType ldt = ((SExprNode *)(pOp->pLeft))->resType; + SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; + if(TSDB_DATA_TYPE_VARBINARY == ldt.type || TSDB_DATA_TYPE_VARBINARY == rdt.type){ + return TSDB_CODE_TSC_INVALID_OPERATION; + } pOp->node.resType.type = TSDB_DATA_TYPE_BIGINT; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; return TSDB_CODE_SUCCESS; diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 96a18e56d2..ea637fd730 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -588,7 +588,6 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t if (typeRight == TSDB_DATA_TYPE_NCHAR || typeRight == TSDB_DATA_TYPE_VARCHAR || - typeRight == TSDB_DATA_TYPE_VARBINARY || typeRight == TSDB_DATA_TYPE_GEOMETRY) { return false; } else if (typeRight != type) { @@ -596,7 +595,6 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t *pRightData = pRightOut; } } else if (type == TSDB_DATA_TYPE_BINARY || - type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_GEOMETRY) { if (typeLeft == TSDB_DATA_TYPE_NCHAR) { *pLeftData = ncharTobinary(*pLeftData); @@ -1078,7 +1076,7 @@ static SColumnInfoData *vectorConvertVarToDouble(SScalarParam *pInput, int32_t * SScalarParam output = {0}; SColumnInfoData *pCol = pInput->columnData; - if (IS_VAR_DATA_TYPE(pCol->info.type) && pCol->info.type != TSDB_DATA_TYPE_JSON) { + if (IS_VAR_DATA_TYPE(pCol->info.type) && pCol->info.type != TSDB_DATA_TYPE_JSON && pCol->info.type != TSDB_DATA_TYPE_VARBINARY) { int32_t code = vectorConvertSingleCol(pInput, &output, TSDB_DATA_TYPE_DOUBLE, -1, -1); if (code != TSDB_CODE_SUCCESS) { terrno = code; diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 0f459b58cd..cb01332525 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -468,3 +468,95 @@ float taosStr2Float(const char *str, char **pEnd) { #endif return tmp; } + +int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ + n -= 2; // remove 0x + z += 2; + *size = n%2 == 0 ? n/2 : n/2 + 1; + uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); + if(tmp == NULL) return -1; + int8_t num = 0; + uint8_t *byte = tmp + *size - 1; + + for (int i = n - 1; i >= 0; i--) { + if (z[i] >= 'a') { + *byte |= ((uint8_t)(10 + (z[i] - 'a')) << (num * 4)); + } else if (z[i] >= 'A') { + *byte |= ((uint8_t)(10 + (z[i] - 'A')) << (num * 4)); + } else { + *byte |= ((uint8_t)(z[i] - '0') << (num * 4)); + } + if (num == 1) { + byte--; + num = 0; + } else { + num++; + } + } + *data = tmp; + return 0; +} + +int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ + n -= 2; // remove 0b + z += 2; + *size = n%8 == 0 ? n/8 : n/8 + 1; + uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); + if(tmp == NULL) return -1; + int8_t num = 0; + uint8_t *byte = tmp + *size - 1; + + for (int i = n - 1; i >= 0; i--) { + *byte |= ((uint8_t)(z[i] - '0') << num); + if (num == 8) { + byte--; + num = 0; + } else { + num++; + } + } + *data = tmp; + return 0; +} + +static char valueOf(uint8_t symbol) +{ + switch(symbol) + { + case 0: return '0'; + case 1: return '1'; + case 2: return '2'; + case 3: return '3'; + case 4: return '4'; + case 5: return '5'; + case 6: return '6'; + case 7: return '7'; + case 8: return '8'; + case 9: return '9'; + case 10: return 'A'; + case 11: return 'B'; + case 12: return 'C'; + case 13: return 'D'; + case 14: return 'E'; + case 15: return 'F'; + default: + { + return -1; + } + } +} + +int32_t taosAscii2Hex(const char *z, uint32_t n, void** data, uint32_t* size){ + *size = n * 2 + 2; + uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); + if(tmp == NULL) return -1; + *data = tmp; + *(tmp++) = '0'; + *(tmp++) = 'X'; + for(int i = 0; i < n; i ++){ + uint8_t val = z[i]; + tmp[i*2] = valueOf(val >> 4); + tmp[i*2 + 1] = valueOf(val & 0x0F); + } + return 0; +} diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 7ebe32dfaf..9e2fc74366 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -1370,8 +1370,16 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = compareDoubleVal; break; + case TSDB_DATA_TYPE_VARBINARY: + if (optr == OP_TYPE_IN) { + comparFn = compareChkInString; + } else if (optr == OP_TYPE_NOT_IN) { + comparFn = compareChkNotInString; + } else { /* normal relational comparFn */ + comparFn = compareLenBinaryVal; + } + break; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_GEOMETRY: { if (optr == OP_TYPE_MATCH) { comparFn = comparestrRegexMatch; @@ -1457,7 +1465,6 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { case TSDB_DATA_TYPE_UBIGINT: return (order == TSDB_ORDER_ASC) ? compareUint64Val : compareUint64ValDesc; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_GEOMETRY: return (order == TSDB_ORDER_ASC) ? compareLenPrefixedStr : compareLenPrefixedStrDesc; case TSDB_DATA_TYPE_NCHAR: diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 12a8807ed5..6a42c208c7 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -581,8 +581,9 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t return; } - int n; - char buf[TSDB_MAX_BYTES_PER_ROW]; + int n = 0; +#define LENGTH 64 + char buf[LENGTH] = {0}; switch (field->type) { case TSDB_DATA_TYPE_BOOL: shellPrintString(((((int32_t)(*((char *)val))) == 1) ? "true" : "false"), width); @@ -615,7 +616,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t if (tsEnableScience) { printf("%*.7e",width,GET_FLOAT_VAL(val)); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.7f", width, GET_FLOAT_VAL(val)); + n = snprintf(buf, LENGTH, "%*.7f", width, GET_FLOAT_VAL(val)); if (n > SHELL_FLOAT_WIDTH) { printf("%*.7e", width,GET_FLOAT_VAL(val)); @@ -626,10 +627,10 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t break; case TSDB_DATA_TYPE_DOUBLE: if (tsEnableScience) { - snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15e", width,GET_DOUBLE_VAL(val)); + snprintf(buf, LENGTH, "%*.15e", width,GET_DOUBLE_VAL(val)); printf("%s", buf); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15f", width, GET_DOUBLE_VAL(val)); + n = snprintf(buf, LENGTH, "%*.15f", width, GET_DOUBLE_VAL(val)); if (n > SHELL_DOUBLE_WIDTH) { printf("%*.15e", width, GET_DOUBLE_VAL(val)); } else { @@ -637,8 +638,17 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t } } break; + case TSDB_DATA_TYPE_VARBINARY:{ + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(val, length, &data, &size) < 0){ + break; + } + shellPrintNChar(data, size, width); + taosMemoryFree(data); + break; + } case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: shellPrintNChar(val, length, width); From dbc1b35d442d22fc67089c92909c0e080792b400 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 16 Aug 2023 19:57:01 +0800 Subject: [PATCH 004/107] feat:support varbinary type --- include/libs/function/taosudf.h | 4 ++-- source/libs/catalog/src/ctgAsync.c | 1 - source/libs/scalar/src/filter.c | 2 +- source/libs/scalar/src/sclvector.c | 2 +- tools/shell/src/shellEngine.c | 4 ++-- utils/tsim/src/simExe.c | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h index 995198bc9e..935f9f9b03 100644 --- a/include/libs/function/taosudf.h +++ b/include/libs/function/taosudf.h @@ -109,8 +109,8 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 65535 #define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE)) #define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len)) #define IS_VAR_DATA_TYPE(t) \ - (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) -#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) + (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) +#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR)) static FORCE_INLINE char *udfColDataGetData(const SUdfColumn *pColumn, int32_t row) { if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 5b0d1b4446..fb5ecf7ad2 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -1051,7 +1051,6 @@ void ctgUpdateJobErrCode(SCtgJob* pJob, int32_t errCode) { atomic_store_32(&pJob->jobResCode, errCode); qDebug("QID:0x%" PRIx64 " ctg job errCode updated to %s", pJob->queryId, tstrerror(errCode)); - ASSERT(0); return; } diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 0efe335c3d..18dbb8d056 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -1595,7 +1595,7 @@ int32_t fltConverToStr(char *str, int type, void *buf, int32_t bufSize, int32_t break; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_BINARY: +// case TSDB_DATA_TYPE_BINARY:// todovar case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index ea637fd730..a11a9f9394 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -885,7 +885,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, break; } case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY +// case TSDB_DATA_TYPE_VARBINARY //todovar case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { return vectorConvertToVarData(&cCtx); diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 8705d7ae38..f1a9a1d2bf 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -386,7 +386,7 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i } break; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY +// case TSDB_DATA_TYPE_VARBINARY todovar case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: { int32_t bufIndex = 0; @@ -779,7 +779,7 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) { return TMAX(SHELL_DOUBLE_WIDTH, width); case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: if (field->bytes > shell.args.displayWidth) { return TMAX(shell.args.displayWidth, width); diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 200d3e30f2..72b8eff27d 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -751,7 +751,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { sprintf(value, "%.9lf", GET_DOUBLE_VAL(row[i])); break; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY +// case TSDB_DATA_TYPE_VARBINARY todovar case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: if (length[i] < 0 || length[i] > 1 << 20) { From 4dcdb549c98a29f8aba4e1f743521972f6cf4190 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 17 Aug 2023 16:41:42 +0800 Subject: [PATCH 005/107] fix: get systable cols error --- source/dnode/mnode/impl/src/mndStb.c | 226 ++++++++++-------- .../0-others/information_schema.py | 8 +- 2 files changed, 132 insertions(+), 102 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 8a6bd079a4..3a60dc46e7 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -3159,137 +3159,161 @@ static int32_t buildDbColsInfoBlock(const SSDataBlock *p, const SSysTableMeta *p return numOfRows; } +#define BUILD_COL_FOR_INFO_DB 1 +#define BUILD_COL_FOR_PERF_DB 1 << 1 +#define BUILD_COL_FOR_USER_DB 1 << 2 +#define BUILD_COL_FOR_ALL_DB (BUILD_COL_FOR_INFO_DB | BUILD_COL_FOR_PERF_DB | BUILD_COL_FOR_USER_DB) -static int32_t buildSysDbColsInfo(SSDataBlock *p, char *db, char *tb) { +static int32_t buildSysDbColsInfo(SSDataBlock *p, int8_t buildWhichDBs, char *tb) { size_t size = 0; const SSysTableMeta *pSysDbTableMeta = NULL; - if (db[0] && strncmp(db, TSDB_INFORMATION_SCHEMA_DB, TSDB_DB_FNAME_LEN) != 0 && - strncmp(db, TSDB_PERFORMANCE_SCHEMA_DB, TSDB_DB_FNAME_LEN) != 0) { - return p->info.rows; + if (buildWhichDBs & BUILD_COL_FOR_INFO_DB) { + getInfosDbMeta(&pSysDbTableMeta, &size); + p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_INFORMATION_SCHEMA_DB, tb); } - getInfosDbMeta(&pSysDbTableMeta, &size); - p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_INFORMATION_SCHEMA_DB, tb); - - getPerfDbMeta(&pSysDbTableMeta, &size); - p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_PERFORMANCE_SCHEMA_DB, tb); + if (buildWhichDBs & BUILD_COL_FOR_PERF_DB) { + getPerfDbMeta(&pSysDbTableMeta, &size); + p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_PERFORMANCE_SCHEMA_DB, tb); + } return p->info.rows; } +static int8_t determineBuildColForWhichDBs(const char* db) { + int8_t buildWhichDBs; + if (!db[0]) + buildWhichDBs = BUILD_COL_FOR_ALL_DB; + else { + char *p = strchr(db, '.'); + if (p && strcmp(p + 1, TSDB_INFORMATION_SCHEMA_DB) == 0) { + buildWhichDBs = BUILD_COL_FOR_INFO_DB; + } else if (p && strcmp(p + 1, TSDB_PERFORMANCE_SCHEMA_DB) == 0) { + buildWhichDBs = BUILD_COL_FOR_PERF_DB; + } else { + buildWhichDBs = BUILD_COL_FOR_USER_DB; + } + } + return buildWhichDBs; +} + static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { + uint8_t buildWhichDBs; SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; SStbObj *pStb = NULL; - - int32_t numOfRows = 0; + + buildWhichDBs = determineBuildColForWhichDBs(pShow->db); + if (!pShow->sysDbRsp) { - numOfRows = buildSysDbColsInfo(pBlock, pShow->db, pShow->filterTb); + numOfRows = buildSysDbColsInfo(pBlock, buildWhichDBs, pShow->filterTb); mDebug("mndRetrieveStbCol get system table cols, rows:%d, db:%s", numOfRows, pShow->db); pShow->sysDbRsp = true; } - SDbObj *pDb = NULL; - if (strlen(pShow->db) > 0) { - pDb = mndAcquireDb(pMnode, pShow->db); - if (pDb == NULL) return terrno; - } - - char typeName[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; - STR_TO_VARSTR(typeName, "SUPER_TABLE"); - bool fetch = pShow->restore ? false : true; - pShow->restore = false; - while (numOfRows < rows) { - if (fetch) { - pShow->pIter = sdbFetch(pSdb, SDB_STB, pShow->pIter, (void **)&pStb); - if (pShow->pIter == NULL) break; - } else { - fetch = true; - void *pKey = taosHashGetKey(pShow->pIter, NULL); - pStb = sdbAcquire(pSdb, SDB_STB, pKey); - if (!pStb) continue; + if (buildWhichDBs & BUILD_COL_FOR_USER_DB) { + SDbObj *pDb = NULL; + if (strlen(pShow->db) > 0) { + pDb = mndAcquireDb(pMnode, pShow->db); + if (pDb == NULL && TSDB_CODE_MND_DB_NOT_EXIST != terrno && pBlock->info.rows == 0) return terrno; } - if (pDb != NULL && pStb->dbUid != pDb->uid) { - sdbRelease(pSdb, pStb); - continue; - } - - SName name = {0}; - char stbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - mndExtractTbNameFromStbFullName(pStb->name, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); - if (pShow->filterTb[0] && strncmp(pShow->filterTb, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN) != 0) { - sdbRelease(pSdb, pStb); - continue; - } - - if ((numOfRows + pStb->numOfColumns) > rows) { - pShow->restore = true; - if (numOfRows == 0) { - mError("mndRetrieveStbCol failed to get stable cols since buf:%d less than result:%d, stable name:%s, db:%s", - rows, pStb->numOfColumns, pStb->name, pStb->db); + char typeName[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_TO_VARSTR(typeName, "SUPER_TABLE"); + bool fetch = pShow->restore ? false : true; + pShow->restore = false; + while (numOfRows < rows) { + if (fetch) { + pShow->pIter = sdbFetch(pSdb, SDB_STB, pShow->pIter, (void **)&pStb); + if (pShow->pIter == NULL) break; + } else { + fetch = true; + void *pKey = taosHashGetKey(pShow->pIter, NULL); + pStb = sdbAcquire(pSdb, SDB_STB, pKey); + if (!pStb) continue; } - sdbRelease(pSdb, pStb); - break; - } - varDataSetLen(stbName, strlen(&stbName[VARSTR_HEADER_SIZE])); - - mDebug("mndRetrieveStbCol get stable cols, stable name:%s, db:%s", pStb->name, pStb->db); - - char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB); - tNameGetDbName(&name, varDataVal(db)); - varDataSetLen(db, strlen(varDataVal(db))); - - for (int i = 0; i < pStb->numOfColumns; i++) { - int32_t cols = 0; - SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)db, false); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, typeName, false); - - // col name - char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - STR_TO_VARSTR(colName, pStb->pColumns[i].name); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, colName, false); - - // col type - int8_t colType = pStb->pColumns[i].type; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - char colTypeStr[VARSTR_HEADER_SIZE + 32]; - int colTypeLen = sprintf(varDataVal(colTypeStr), "%s", tDataTypes[colType].name); - if (colType == TSDB_DATA_TYPE_VARCHAR) { - colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", - (int32_t)(pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE)); - } else if (colType == TSDB_DATA_TYPE_NCHAR) { - colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", - (int32_t)((pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); + if (pDb != NULL && pStb->dbUid != pDb->uid) { + sdbRelease(pSdb, pStb); + continue; } - varDataSetLen(colTypeStr, colTypeLen); - colDataSetVal(pColInfo, numOfRows, (char *)colTypeStr, false); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->pColumns[i].bytes, false); - while (cols < pShow->numOfColumns) { + SName name = {0}; + char stbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + mndExtractTbNameFromStbFullName(pStb->name, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); + if (pShow->filterTb[0] && strncmp(pShow->filterTb, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN) != 0) { + sdbRelease(pSdb, pStb); + continue; + } + + if ((numOfRows + pStb->numOfColumns) > rows) { + pShow->restore = true; + if (numOfRows == 0) { + mError("mndRetrieveStbCol failed to get stable cols since buf:%d less than result:%d, stable name:%s, db:%s", + rows, pStb->numOfColumns, pStb->name, pStb->db); + } + sdbRelease(pSdb, pStb); + break; + } + + varDataSetLen(stbName, strlen(&stbName[VARSTR_HEADER_SIZE])); + + mDebug("mndRetrieveStbCol get stable cols, stable name:%s, db:%s", pStb->name, pStb->db); + + char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB); + tNameGetDbName(&name, varDataVal(db)); + varDataSetLen(db, strlen(varDataVal(db))); + + for (int i = 0; i < pStb->numOfColumns; i++) { + int32_t cols = 0; + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetNULL(pColInfo, numOfRows); + colDataSetVal(pColInfo, numOfRows, (const char *)db, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, typeName, false); + + // col name + char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_TO_VARSTR(colName, pStb->pColumns[i].name); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, colName, false); + + // col type + int8_t colType = pStb->pColumns[i].type; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + char colTypeStr[VARSTR_HEADER_SIZE + 32]; + int colTypeLen = sprintf(varDataVal(colTypeStr), "%s", tDataTypes[colType].name); + if (colType == TSDB_DATA_TYPE_VARCHAR) { + colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", + (int32_t)(pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE)); + } else if (colType == TSDB_DATA_TYPE_NCHAR) { + colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", + (int32_t)((pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); + } + varDataSetLen(colTypeStr, colTypeLen); + colDataSetVal(pColInfo, numOfRows, (char *)colTypeStr, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->pColumns[i].bytes, false); + while (cols < pShow->numOfColumns) { + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetNULL(pColInfo, numOfRows); + } + numOfRows++; } - numOfRows++; + + sdbRelease(pSdb, pStb); } - sdbRelease(pSdb, pStb); - } - - if (pDb != NULL) { - mndReleaseDb(pMnode, pDb); + if (pDb != NULL) { + mndReleaseDb(pMnode, pDb); + } } pShow->numOfRows += numOfRows; diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 762361f051..fde4e52f3d 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -215,7 +215,13 @@ class TDTestCase: for t in range (2): tdSql.query(f'select * from information_schema.ins_columns where db_name="db2" and table_type=="NORMAL_TABLE"') tdSql.checkEqual(20470,len(tdSql.queryResult)) - + + tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") + tdSql.checkEqual(195, len(tdSql.queryResult)) + + tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") + tdSql.checkEqual(54, len(tdSql.queryResult)) + def ins_dnodes_check(self): tdSql.execute('drop database if exists db2') tdSql.execute('create database if not exists db2 vgroups 1 replica 1') From 42b12b1e68ca3dd60f0f90873a44255788a2cd86 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 18 Aug 2023 17:40:34 +0800 Subject: [PATCH 006/107] fix: document issues --- docs/en/12-taos-sql/06-select.md | 7 +++---- docs/zh/12-taos-sql/06-select.md | 7 +++---- docs/zh/12-taos-sql/12-distinguished.md | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) mode change 100644 => 100755 docs/en/12-taos-sql/06-select.md mode change 100644 => 100755 docs/zh/12-taos-sql/06-select.md mode change 100644 => 100755 docs/zh/12-taos-sql/12-distinguished.md diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md old mode 100644 new mode 100755 index b28d5acb18..661b4f5dea --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -167,7 +167,7 @@ The following SQL statement returns the number of subtables within the meters su SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters); ``` -In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause. For example: +In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause. **\_QSTART and \_QEND** @@ -209,8 +209,7 @@ You can perform INNER JOIN statements based on the primary key. The following co 3. For supertables, the ON condition must be equivalent to the primary key. In addition, the tag columns of the tables on which the INNER JOIN is performed must have a one-to-one relationship. You cannot specify an OR condition. 4. The tables that are included in a JOIN clause must be of the same type (supertable, standard table, or subtable). 5. You can include subqueries before and after the JOIN keyword. -6. You cannot include more than ten tables in a JOIN clause. -7. You cannot include a FILL clause and a JOIN clause in the same statement. +6. You cannot include a FILL clause and a JOIN clause in the same statement. ## GROUP BY @@ -355,7 +354,7 @@ SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) F ## JOIN -TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables. +TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables, primary key and other conditions must be combined with `AND` operator. For standard tables: diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md old mode 100644 new mode 100755 index 9560c3c4df..80966cf386 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -167,7 +167,7 @@ SELECT table_name, tag_name, tag_type, tag_value FROM information_schema.ins_tag SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters); ``` -以上两个查询å‡åªæ”¯æŒåœ¨ WHERE æ¡ä»¶å­å¥ä¸­æ·»åŠ é’ˆå¯¹æ ‡ç­¾ï¼ˆTAGS)的过滤æ¡ä»¶ã€‚例如: +以上两个查询å‡åªæ”¯æŒåœ¨ WHERE æ¡ä»¶å­å¥ä¸­æ·»åŠ é’ˆå¯¹æ ‡ç­¾ï¼ˆTAGS)的过滤æ¡ä»¶ã€‚ **\_QSTART/\_QEND** @@ -209,8 +209,7 @@ TDengine 支æŒåŸºäºŽæ—¶é—´æˆ³ä¸»é”®çš„ INNER JOIN,规则如下: 3. 对于超级表,ON æ¡ä»¶åœ¨æ—¶é—´æˆ³ä¸»é”®çš„等值æ¡ä»¶ä¹‹å¤–ï¼Œè¿˜è¦æ±‚有å¯ä»¥ä¸€ä¸€å¯¹åº”的标签列等值æ¡ä»¶ï¼Œä¸æ”¯æŒ OR æ¡ä»¶ã€‚ 4. å‚与 JOIN 计算的表åªèƒ½æ˜¯åŒä¸€ç§ç±»åž‹ï¼Œå³åªèƒ½éƒ½æ˜¯è¶…级表,或都是å­è¡¨ï¼Œæˆ–都是普通表。 5. JOIN 䏤侧凿”¯æŒå­æŸ¥è¯¢ã€‚ -6. å‚与 JOIN 的表个数上é™ä¸º 10 个。 -7. 䏿”¯æŒä¸Ž FILL å­å¥æ··åˆä½¿ç”¨ã€‚ +6. 䏿”¯æŒä¸Ž FILL å­å¥æ··åˆä½¿ç”¨ã€‚ ## GROUP BY @@ -354,7 +353,7 @@ SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) F ## JOIN å­å¥ -TDengine 支æŒåŸºäºŽæ—¶é—´æˆ³ä¸»é”®çš„å†…è¿žæŽ¥ï¼Œå³ JOIN æ¡ä»¶å¿…é¡»åŒ…å«æ—¶é—´æˆ³ä¸»é”®ã€‚åªè¦æ»¡è¶³åŸºäºŽæ—¶é—´æˆ³ä¸»é”®è¿™ä¸ªè¦æ±‚,普通表ã€å­è¡¨ã€è¶…çº§è¡¨å’Œå­æŸ¥è¯¢ä¹‹é—´å¯ä»¥éšæ„的进行内连接,且对表个数没有é™åˆ¶ã€‚ +TDengine 支æŒåŸºäºŽæ—¶é—´æˆ³ä¸»é”®çš„å†…è¿žæŽ¥ï¼Œå³ JOIN æ¡ä»¶å¿…é¡»åŒ…å«æ—¶é—´æˆ³ä¸»é”®ã€‚åªè¦æ»¡è¶³åŸºäºŽæ—¶é—´æˆ³ä¸»é”®è¿™ä¸ªè¦æ±‚,普通表ã€å­è¡¨ã€è¶…çº§è¡¨å’Œå­æŸ¥è¯¢ä¹‹é—´å¯ä»¥éšæ„的进行内连接,且对表个数没有é™åˆ¶ï¼Œå…¶å®ƒè¿žæŽ¥æ¡ä»¶ä¸Žä¸»é”®é—´å¿…须是 AND æ“作。 普通表与普通表之间的 JOIN æ“作: diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md old mode 100644 new mode 100755 index f750124049..62888cc5f7 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -31,7 +31,7 @@ select max(current) from meters partition by location interval(10m) ## 窗å£åˆ‡åˆ†æŸ¥è¯¢ -TDengine æ”¯æŒæŒ‰æ—¶é—´çª—å£åˆ‡åˆ†æ–¹å¼è¿›è¡Œèšåˆç»“果查询,比如温度传感器æ¯ç§’采集一次数æ®ï¼Œä½†éœ€æŸ¥è¯¢æ¯éš” 10 分钟的温度平å‡å€¼ã€‚è¿™ç§åœºæ™¯ä¸‹å¯ä»¥ä½¿ç”¨çª—å£å­å¥æ¥èŽ·å¾—éœ€è¦çš„æŸ¥è¯¢ç»“果。窗å£å­å¥ç”¨äºŽé’ˆå¯¹æŸ¥è¯¢çš„æ•°æ®é›†åˆæŒ‰ç…§çª—å£åˆ‡åˆ†æˆä¸ºæŸ¥è¯¢å­é›†å¹¶è¿›è¡Œèšåˆï¼Œçª—å£åŒ…嫿—¶é—´çª—å£ï¼ˆtime window)ã€çжæ€çª—å£ï¼ˆstatus window)ã€ä¼šè¯çª—å£ï¼ˆsession windowï¼‰ã€æ¡ä»¶çª—å£ï¼ˆevent window)四ç§çª—å£ã€‚其中时间窗å£åˆå¯åˆ’分为滑动时间窗å£å’Œç¿»è½¬æ—¶é—´çª—å£ã€‚ +TDengine æ”¯æŒæŒ‰æ—¶é—´çª—å£åˆ‡åˆ†æ–¹å¼è¿›è¡Œèšåˆç»“果查询,比如温度传感器æ¯ç§’采集一次数æ®ï¼Œä½†éœ€æŸ¥è¯¢æ¯éš” 10 分钟的温度平å‡å€¼ã€‚è¿™ç§åœºæ™¯ä¸‹å¯ä»¥ä½¿ç”¨çª—å£å­å¥æ¥èŽ·å¾—éœ€è¦çš„æŸ¥è¯¢ç»“果。窗å£å­å¥ç”¨äºŽé’ˆå¯¹æŸ¥è¯¢çš„æ•°æ®é›†åˆæŒ‰ç…§çª—å£åˆ‡åˆ†æˆä¸ºæŸ¥è¯¢å­é›†å¹¶è¿›è¡Œèšåˆï¼Œçª—å£åŒ…嫿—¶é—´çª—å£ï¼ˆtime window)ã€çжæ€çª—å£ï¼ˆstatus window)ã€ä¼šè¯çª—å£ï¼ˆsession window)ã€äº‹ä»¶çª—å£ï¼ˆevent window)四ç§çª—å£ã€‚其中时间窗å£åˆå¯åˆ’分为滑动时间窗å£å’Œç¿»è½¬æ—¶é—´çª—å£ã€‚ 窗å£å­å¥è¯­æ³•如下: From 4b10393c81af31e1411155f0c3c6d239cd12a446 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 18 Aug 2023 18:02:08 +0800 Subject: [PATCH 007/107] fix(stream): fix memory leak and do some internal refactor. --- include/libs/stream/tstream.h | 2 +- source/libs/stream/src/streamQueue.c | 21 ++++++++++----------- source/libs/stream/src/streamTask.c | 9 +++++++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 02bb65b762..b47288bf45 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -189,7 +189,7 @@ int32_t streamInit(); void streamCleanUp(); SStreamQueue* streamQueueOpen(int64_t cap); -void streamQueueClose(SStreamQueue* queue); +void streamQueueClose(SStreamQueue* pQueue, int32_t taskId); static FORCE_INLINE void streamQueueProcessSuccess(SStreamQueue* queue) { ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index aaf9fdec72..22e09693c8 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -35,18 +35,17 @@ FAIL: return NULL; } -void streamQueueClose(SStreamQueue* queue) { - while (1) { - void* qItem = streamQueueNextItem(queue); - if (qItem) { - streamFreeQitem(qItem); - } else { - break; - } +void streamQueueClose(SStreamQueue* pQueue, int32_t taskId) { + qDebug("s-task:0x%x free the queue:%p, items in queue:%d", taskId, pQueue->queue, taosQueueItemSize(pQueue->queue)); + + void* qItem = NULL; + while ((qItem = streamQueueNextItem(pQueue)) != NULL) { + streamFreeQitem(qItem); } - taosFreeQall(queue->qall); - taosCloseQueue(queue->queue); - taosMemoryFree(queue); + + taosFreeQall(pQueue->qall); + taosCloseQueue(pQueue->queue); + taosMemoryFree(pQueue); } #if 0 diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 9056fa8d93..eda9c1f2bb 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -220,11 +220,11 @@ void tFreeStreamTask(SStreamTask* pTask) { int32_t status = atomic_load_8((int8_t*)&(pTask->status.taskStatus)); if (pTask->inputQueue) { - streamQueueClose(pTask->inputQueue); + streamQueueClose(pTask->inputQueue, pTask->id.taskId); } if (pTask->outputInfo.queue) { - streamQueueClose(pTask->outputInfo.queue); + streamQueueClose(pTask->outputInfo.queue, pTask->id.taskId); } if (pTask->exec.qmsg) { @@ -255,6 +255,11 @@ void tFreeStreamTask(SStreamTask* pTask) { streamStateClose(pTask->pState, status == TASK_STATUS__DROPPING); } + if (pTask->msgInfo.pData != NULL) { + destroyStreamDataBlock(pTask->msgInfo.pData); + pTask->msgInfo.pData = NULL; + } + if (pTask->id.idStr != NULL) { taosMemoryFree((void*)pTask->id.idStr); } From 718bb4a8815df5fbe82fc67c1acec7c3674ed8c8 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 18 Aug 2023 22:40:04 +0800 Subject: [PATCH 008/107] fix(stream): fix the invalid free. --- source/libs/stream/src/streamDispatch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index bb32173404..3d21db2d79 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -766,6 +766,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i } streamFreeQitem(pTask->msgInfo.pData); + pTask->msgInfo.pData = NULL; return TSDB_CODE_SUCCESS; } From 72cce0825b88875e9526cfe74a7c50a3c1ff84b4 Mon Sep 17 00:00:00 2001 From: danielclow <106956386+danielclow@users.noreply.github.com> Date: Sat, 19 Aug 2023 23:17:20 +0800 Subject: [PATCH 009/107] docs: fix link in grafana doc (#22489) "...releases/tag/latest" should be "...releases/latest", which will automatically redirect to "...releases/tag/" --- docs/en/20-third-party/01-grafana.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/20-third-party/01-grafana.mdx b/docs/en/20-third-party/01-grafana.mdx index 64acefe6b8..0ccdfe7254 100644 --- a/docs/en/20-third-party/01-grafana.mdx +++ b/docs/en/20-third-party/01-grafana.mdx @@ -74,7 +74,7 @@ grafana-cli plugins install tdengine-datasource sudo -u grafana grafana-cli plugins install tdengine-datasource ``` -You can also download zip files from [GitHub](https://github.com/taosdata/grafanaplugin/releases/tag/latest) or [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) and install manually. The commands are as follows: +You can also download zip files from [GitHub](https://github.com/taosdata/grafanaplugin/releases/latest) or [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) and install manually. The commands are as follows: ```bash GF_VERSION=3.3.1 From c3e881430857b4a2515d060684caf02d82917eb2 Mon Sep 17 00:00:00 2001 From: kailixu Date: Sun, 20 Aug 2023 11:31:45 +0800 Subject: [PATCH 010/107] docs: taos api description --- docs/zh/08-connector/10-cpp.mdx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index 12bbffa4f9..cec1e685ab 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -256,6 +256,12 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) ::: +- `TAOS *taos_connect_auth(const char *host, const char *user, const char *auth, const char *db, uint16_t port)` + + åŠŸèƒ½åŒ taos_connect。除 pass 傿•°æ›¿æ¢ä¸º auth å¤–ï¼Œå…¶ä»–å‚æ•°åŒ taos_connect + + - auth: 密ç å– 32 ä½å°å†™ md5. e.g. é»˜è®¤å¯†ç  taosdata å– md5 为 dcc5bed04851fec854c035b2e40263b6 + - `char *taos_get_server_info(TAOS *taos)` èŽ·å–æœåŠ¡ç«¯ç‰ˆæœ¬ä¿¡æ¯ã€‚ @@ -272,6 +278,14 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) - 如果,len å°äºŽ 存储db需è¦çš„ç©ºé—´ï¼ˆåŒ…å«æœ€åŽçš„'\0'),返回错误,database里赋值截断的数æ®ï¼Œä»¥'\0'结尾。 - 如果,len 大于等于 存储db需è¦çš„ç©ºé—´ï¼ˆåŒ…å«æœ€åŽçš„'\0'),返回正常0,database里赋值以'\0‘结尾的dbå。 +- `int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)` + + 设置事件通知回调函数。 + + - fp 事件通知回调函数指针。函数声明:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type);其中, param ä¸ºç”¨æˆ·è‡ªå®šä¹‰å‚æ•°ï¼Œext ä¸ºæ‰©å±•å‚æ•°(ä¾èµ–事件通知类型,针对TAOS_NOTIFY_PASSVER 返回用户密ç ç‰ˆæœ¬),type 为事件通知类型。 + - param ç”¨æˆ·è‡ªå®šä¹‰å‚æ•°ã€‚ + - type 事件通知类型。å–值:1)TAOS_NOTIFY_PASSVER: ç”¨æˆ·å¯†ç æ”¹å˜ã€‚ + - `void taos_close(TAOS *taos)` 关闭连接,其中`taos`是 `taos_connect()` è¿”å›žçš„å¥æŸ„。 @@ -447,6 +461,14 @@ TDengine 的异步 API å‡é‡‡ç”¨éžé˜»å¡žè°ƒç”¨æ¨¡å¼ã€‚应用程åºå¯ä»¥ç”¨å¤š 执行准备好的语å¥ã€‚ç›®å‰ï¼Œä¸€æ¡è¯­å¥åªèƒ½æ‰§è¡Œä¸€æ¬¡ã€‚ +- `int taos_stmt_affected_rows(TAOS_STMT *stmt)` + + 获å–被所执行的 SQL 语å¥å½±å“的行数。 + +- `int taos_stmt_affected_rows_once(TAOS_STMT *stmt)` + + 获å–被所执行的 SQL 语å¥å½±å“的行数。 + - `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)` 获å–语å¥çš„结果集。结果集的使用方å¼ä¸Žéžå‚数化调用时一致,使用完æˆåŽï¼Œåº”对此结果集调用 `taos_free_result()` 以释放资æºã€‚ From 7020ac7a0f82ae61fd027e6274b3520d6db0e4c7 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sun, 20 Aug 2023 14:46:24 +0800 Subject: [PATCH 011/107] docs: refine c connector docs (#22491) * docs: fix taos_init() return type * docs: refine c interface doc --- docs/en/14-reference/03-connector/03-cpp.mdx | 19 ++++++------ docs/examples/c/multi_bind_example.c | 4 +-- docs/examples/c/stmt_example.c | 6 ++-- docs/zh/08-connector/10-cpp.mdx | 32 ++++++-------------- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx index 3e1a0f9545..d6e74e711b 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/14-reference/03-connector/03-cpp.mdx @@ -307,21 +307,20 @@ The specific functions related to the interface are as follows (see also the [pr Parse a SQL command, and bind the parsed result and parameter information to `stmt`. If the parameter length is greater than 0, use this parameter as the length of the SQL command. If it is equal to 0, the length of the SQL command will be determined automatically. -- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind)` +- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind)` Not as efficient as `taos_stmt_bind_param_batch()`, but can support non-INSERT type SQL statements. To bind parameters, bind points to an array (representing the row of data to be bound), making sure that the number and order of the elements in this array are the same as the parameters in the SQL statement. taos_bind is used similarly to MYSQL_BIND in MySQL, as defined below. ```c - typedef struct TAOS_BIND { + typedef struct TAOS_MULTI_BIND { int buffer_type; - void * buffer; - uintptr_t buffer_length; // not in use - uintptr_t * length; - int * is_null; - int is_unsigned; // not in use - int * error; // not in use - } TAOS_BIND; + void *buffer; + uintptr_t buffer_length; + uint32_t *length; + char *is_null; + int num; + } TAOS_MULTI_BIND; ``` - `int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name)` @@ -329,7 +328,7 @@ The specific functions related to the interface are as follows (see also the [pr (Available in 2.1.1.0 and later versions, only supported for replacing parameter values in INSERT statements) When the table name in the SQL command uses `? ` placeholder, you can use this function to bind a specific table name. -- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags)` +- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_MULTI_BIND* tags)` (Available in 2.1.2.0 and later versions, only supported for replacing parameter values in INSERT statements) When the table name and TAGS in the SQL command both use `? `, you can use this function to bind the specific table name and the specific TAGS value. The most typical usage scenario is an INSERT statement that uses the automatic table building function (the current version does not support specifying specific TAGS columns.) The number of columns in the TAGS parameter needs to be the same as the number of TAGS requested in the SQL command. diff --git a/docs/examples/c/multi_bind_example.c b/docs/examples/c/multi_bind_example.c index 02e6568e9e..3d0bd3ccef 100644 --- a/docs/examples/c/multi_bind_example.c +++ b/docs/examples/c/multi_bind_example.c @@ -51,7 +51,7 @@ void insertData(TAOS *taos) { int code = taos_stmt_prepare(stmt, sql, 0); checkErrorCode(stmt, code, "failed to execute taos_stmt_prepare"); // bind table name and tags - TAOS_BIND tags[2]; + TAOS_MULTI_BIND tags[2]; char *location = "California.SanFrancisco"; int groupId = 2; tags[0].buffer_type = TSDB_DATA_TYPE_BINARY; @@ -144,4 +144,4 @@ int main() { } // output: -// successfully inserted 2 rows \ No newline at end of file +// successfully inserted 2 rows diff --git a/docs/examples/c/stmt_example.c b/docs/examples/c/stmt_example.c index 28dae5f9d5..290a6bee66 100644 --- a/docs/examples/c/stmt_example.c +++ b/docs/examples/c/stmt_example.c @@ -58,7 +58,7 @@ void insertData(TAOS *taos) { int code = taos_stmt_prepare(stmt, sql, 0); checkErrorCode(stmt, code, "failed to execute taos_stmt_prepare"); // bind table name and tags - TAOS_BIND tags[2]; + TAOS_MULTI_BIND tags[2]; char* location = "California.SanFrancisco"; int groupId = 2; tags[0].buffer_type = TSDB_DATA_TYPE_BINARY; @@ -82,7 +82,7 @@ void insertData(TAOS *taos) { {1648432611749, 12.6, 218, 0.33}, }; - TAOS_BIND values[4]; + TAOS_MULTI_BIND values[4]; values[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; values[0].buffer_length = sizeof(int64_t); values[0].length = &values[0].buffer_length; @@ -138,4 +138,4 @@ int main() { // output: -// successfully inserted 2 rows \ No newline at end of file +// successfully inserted 2 rows diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index 12bbffa4f9..d23996463a 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -396,21 +396,20 @@ TDengine 的异步 API å‡é‡‡ç”¨éžé˜»å¡žè°ƒç”¨æ¨¡å¼ã€‚应用程åºå¯ä»¥ç”¨å¤š è§£æžä¸€æ¡ SQL 语å¥ï¼Œå°†è§£æžç»“æžœå’Œå‚æ•°ä¿¡æ¯ç»‘定到 stmt ä¸Šï¼Œå¦‚æžœå‚æ•° length 大于 0ï¼Œå°†ä½¿ç”¨æ­¤å‚æ•°ä½œä¸º SQL 语å¥çš„长度,如等于 0,将自动判断 SQL 语å¥çš„长度。 -- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind)` +- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind)` ä¸å¦‚ `taos_stmt_bind_param_batch()` 效率高,但å¯ä»¥æ”¯æŒéž INSERT 类型的 SQL 语å¥ã€‚ - è¿›è¡Œå‚æ•°ç»‘定,bind 指å‘一个数组(代表所è¦ç»‘定的一行数æ®ï¼‰ï¼Œéœ€ä¿è¯æ­¤æ•°ç»„中的元素数é‡å’Œé¡ºåºä¸Ž SQL 语å¥ä¸­çš„傿•°å®Œå…¨ä¸€è‡´ã€‚TAOS_BIND 的使用方法与 MySQL 中的 MYSQL_BIND 类似,具体定义如下: + è¿›è¡Œå‚æ•°ç»‘定,bind 指å‘一个数组(代表所è¦ç»‘定的一行数æ®ï¼‰ï¼Œéœ€ä¿è¯æ­¤æ•°ç»„中的元素数é‡å’Œé¡ºåºä¸Ž SQL 语å¥ä¸­çš„傿•°å®Œå…¨ä¸€è‡´ã€‚TAOS_MULTI_BIND 的使用方法与 MySQL 中的 MYSQL_BIND 类似,具体定义如下: ```c - typedef struct TAOS_BIND { + typedef struct TAOS_MULTI_BIND { int buffer_type; - void * buffer; - uintptr_t buffer_length; // not in use - uintptr_t * length; - int * is_null; - int is_unsigned; // not in use - int * error; // not in use - } TAOS_BIND; + void *buffer; + uintptr_t buffer_length; + uint32_t *length; + char *is_null; + int num; // the number of columns + } TAOS_MULTI_BIND; ``` - `int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name)` @@ -418,7 +417,7 @@ TDengine 的异步 API å‡é‡‡ç”¨éžé˜»å¡žè°ƒç”¨æ¨¡å¼ã€‚应用程åºå¯ä»¥ç”¨å¤š (2.1.1.0 版本新增,仅支æŒç”¨äºŽæ›¿æ¢ INSERT 语å¥ä¸­çš„傿•°å€¼ï¼‰ 当 SQL 语å¥ä¸­çš„表å使用了 `?` å ä½æ—¶ï¼Œå¯ä»¥ä½¿ç”¨æ­¤å‡½æ•°ç»‘定一个具体的表å。 -- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags)` +- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_MULTI_BIND* tags)` (2.1.2.0 版本新增,仅支æŒç”¨äºŽæ›¿æ¢ INSERT 语å¥ä¸­çš„傿•°å€¼ï¼‰ 当 SQL 语å¥ä¸­çš„表åå’Œ TAGS 都使用了 `?` å ä½æ—¶ï¼Œå¯ä»¥ä½¿ç”¨æ­¤å‡½æ•°ç»‘定具体的表å和具体的 TAGS å–值。最典型的使用场景是使用了自动建表功能的 INSERT 语å¥ï¼ˆç›®å‰ç‰ˆæœ¬ä¸æ”¯æŒæŒ‡å®šå…·ä½“çš„ TAGS 列)。TAGS 傿•°ä¸­çš„列数é‡éœ€è¦ä¸Ž SQL 语å¥ä¸­è¦æ±‚çš„ TAGS æ•°é‡å®Œå…¨ä¸€è‡´ã€‚ @@ -428,17 +427,6 @@ TDengine 的异步 API å‡é‡‡ç”¨éžé˜»å¡žè°ƒç”¨æ¨¡å¼ã€‚应用程åºå¯ä»¥ç”¨å¤š (2.1.1.0 版本新增,仅支æŒç”¨äºŽæ›¿æ¢ INSERT 语å¥ä¸­çš„傿•°å€¼ï¼‰ 以多列的方å¼ä¼ é€’待绑定的数æ®ï¼Œéœ€è¦ä¿è¯è¿™é‡Œä¼ é€’的数æ®åˆ—的顺åºã€åˆ—的数é‡ä¸Ž SQL 语å¥ä¸­çš„ VALUES 傿•°å®Œå…¨ä¸€è‡´ã€‚TAOS_MULTI_BIND 的具体定义如下: - ```c - typedef struct TAOS_MULTI_BIND { - int buffer_type; - void * buffer; - uintptr_t buffer_length; - uintptr_t * length; - char * is_null; - int num; // the number of columns - } TAOS_MULTI_BIND; - ``` - - `int taos_stmt_add_batch(TAOS_STMT *stmt)` 将当å‰ç»‘å®šçš„å‚æ•°åŠ å…¥æ‰¹å¤„ç†ä¸­ï¼Œè°ƒç”¨æ­¤å‡½æ•°åŽï¼Œå¯ä»¥å†æ¬¡è°ƒç”¨ `taos_stmt_bind_param()` 或 `taos_stmt_bind_param_batch()` ç»‘å®šæ–°çš„å‚æ•°ã€‚éœ€è¦æ³¨æ„ï¼Œæ­¤å‡½æ•°ä»…æ”¯æŒ INSERT/IMPORT 语å¥ï¼Œå¦‚果是 SELECT 等其他 SQL 语å¥ï¼Œå°†è¿”回错误。 From 7856dce03f6aea8b9a620fc0436ad0b4721a776b Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 21 Aug 2023 00:05:49 +0800 Subject: [PATCH 012/107] docs: taos api description --- docs/en/14-reference/03-connector/03-cpp.mdx | 22 ++++++++++++++++++++ docs/zh/08-connector/10-cpp.mdx | 16 +++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx index 3e1a0f9545..97048178e2 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/14-reference/03-connector/03-cpp.mdx @@ -168,6 +168,12 @@ The base API is used to do things like create database connections and provide a ::: +- `TAOS *taos_connect_auth(const char *host, const char *user, const char *auth, const char *db, uint16_t port)` + + The function is the same as taos_connect. Except that the pass parameter is replaced by auth, other parameters are the same as taos_connect. + + - auth: the 32-bit lowercase md5 of the raw password + - `char *taos_get_server_info(TAOS *taos)` Get server-side version information. @@ -184,6 +190,14 @@ The base API is used to do things like create database connections and provide a - If len is less than the space required to store the db (including the last '\0'), an error is returned. The truncated data assigned in the database ends with '\0'. - If len is greater than or equal to the space required to store the db (including the last '\0'), return normal 0, and assign the db name ending with '\0' in the database. +- `int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)` + + Set the event callback function. + + - fp: event callback function pointer. Declaration:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type)ï¼›Param is a user-defined parameter, ext is an extended parameter (depending on the event type, and returns the user password version for TAOS_NOTIFY_PASSVER), and type is the event type + - param: user-defined parameter + - type: event type. Value range: 1) TAOS_NOTIFY_PASSVER: User password changed + - `void taos_close(TAOS *taos)` Closes the connection, where `taos` is the handle returned by `taos_connect()`. @@ -358,6 +372,14 @@ The specific functions related to the interface are as follows (see also the [pr Execute the prepared statement. Currently, a statement can only be executed once. +- `int taos_stmt_affected_rows(TAOS_STMT *stmt)` + + Gets the number of rows affected by executing bind statements multiple times. + +- `int taos_stmt_affected_rows_once(TAOS_STMT *stmt)` + + Gets the number of rows affected by executing a bind statement once. + - `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)` Gets the result set of a statement. Use the result set in the same way as in the non-parametric call. When finished, `taos_free_result()` should be called on this result set to free resources. diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index cec1e685ab..89cf54733a 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -258,9 +258,9 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) - `TAOS *taos_connect_auth(const char *host, const char *user, const char *auth, const char *db, uint16_t port)` - åŠŸèƒ½åŒ taos_connect。除 pass 傿•°æ›¿æ¢ä¸º auth å¤–ï¼Œå…¶ä»–å‚æ•°åŒ taos_connect + åŠŸèƒ½åŒ taos_connect。除 pass 傿•°æ›¿æ¢ä¸º auth å¤–ï¼Œå…¶ä»–å‚æ•°åŒ taos_connect。 - - auth: 密ç å– 32 ä½å°å†™ md5. e.g. é»˜è®¤å¯†ç  taosdata å– md5 为 dcc5bed04851fec854c035b2e40263b6 + - auth: 原始密ç å– 32 ä½å°å†™ md5 - `char *taos_get_server_info(TAOS *taos)` @@ -280,11 +280,11 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) - `int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)` - 设置事件通知回调函数。 + 设置事件回调函数。 - - fp 事件通知回调函数指针。函数声明:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type);其中, param ä¸ºç”¨æˆ·è‡ªå®šä¹‰å‚æ•°ï¼Œext ä¸ºæ‰©å±•å‚æ•°(ä¾èµ–事件通知类型,针对TAOS_NOTIFY_PASSVER 返回用户密ç ç‰ˆæœ¬),type 为事件通知类型。 - - param ç”¨æˆ·è‡ªå®šä¹‰å‚æ•°ã€‚ - - type 事件通知类型。å–值:1)TAOS_NOTIFY_PASSVER: ç”¨æˆ·å¯†ç æ”¹å˜ã€‚ + - fp 事件回调函数指针。函数声明:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type);其中, param ä¸ºç”¨æˆ·è‡ªå®šä¹‰å‚æ•°ï¼Œext ä¸ºæ‰©å±•å‚æ•°(ä¾èµ–事件类型,针对 TAOS_NOTIFY_PASSVER 返回用户密ç ç‰ˆæœ¬),type 为事件类型 + - param ç”¨æˆ·è‡ªå®šä¹‰å‚æ•° + - type 事件类型。å–值范围:1)TAOS_NOTIFY_PASSVER: ç”¨æˆ·å¯†ç æ”¹å˜ - `void taos_close(TAOS *taos)` @@ -463,11 +463,11 @@ TDengine 的异步 API å‡é‡‡ç”¨éžé˜»å¡žè°ƒç”¨æ¨¡å¼ã€‚应用程åºå¯ä»¥ç”¨å¤š - `int taos_stmt_affected_rows(TAOS_STMT *stmt)` - 获å–被所执行的 SQL 语å¥å½±å“的行数。 + èŽ·å–æ‰§è¡Œå¤šæ¬¡ç»‘定语å¥å½±å“的行数。 - `int taos_stmt_affected_rows_once(TAOS_STMT *stmt)` - 获å–被所执行的 SQL 语å¥å½±å“的行数。 + èŽ·å–æ‰§è¡Œä¸€æ¬¡ç»‘定语å¥å½±å“的行数。 - `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)` From aec02a55be7a5c73c6c06f59a055cf85e17257c2 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Fri, 18 Aug 2023 17:16:02 +0800 Subject: [PATCH 013/107] fix: fill last group data between groups --- source/libs/executor/src/filloperator.c | 13 ++ tests/parallel_test/cases.task | 1 + tests/system-test/2-query/fill_with_group.py | 144 +++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 tests/system-test/2-query/fill_with_group.py diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 80c88a803e..be4cb8d2dc 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -64,6 +64,7 @@ typedef struct SFillOperatorInfo { static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, int32_t order); static void destroyFillOperatorInfo(void* param); static void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_t order, int32_t scanFlag); +static void fillResetPrevForNewGroup(SFillInfo* pFillInfo); static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOperatorInfo* pInfo, SResultInfo* pResultInfo, int32_t order) { @@ -84,6 +85,9 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp taosFillSetStartInfo(pInfo->pFillInfo, pInfo->pRes->info.rows, ts); taosFillSetInputDataBlock(pInfo->pFillInfo, pInfo->pRes); + if (pInfo->pFillInfo->type == TSDB_FILL_PREV || pInfo->pFillInfo->type == TSDB_FILL_LINEAR) { + fillResetPrevForNewGroup(pInfo->pFillInfo); + } int32_t numOfResultRows = pResultInfo->capacity - pResBlock->info.rows; taosFillResultDataBlock(pInfo->pFillInfo, pResBlock, numOfResultRows); @@ -122,6 +126,15 @@ void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlock, int pInfo->pRes->info.id.groupId = pBlock->info.id.groupId; } +static void fillResetPrevForNewGroup(SFillInfo* pFillInfo) { + for (int32_t colIdx = 0; colIdx < pFillInfo->numOfCols; ++colIdx) { + if (!pFillInfo->pFillCol[colIdx].notFillCol) { + SGroupKeys* key = taosArrayGet(pFillInfo->prev.pRowVal, colIdx); + key->isNull = true; + } + } +} + // todo refactor: decide the start key according to the query time range. static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, int32_t order) { if (order == TSDB_ORDER_ASC) { diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index fc08ff1b32..c3d87315f5 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -760,6 +760,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/fill_with_group.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py ,,n,system-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/insertMix.py -N 3 diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py new file mode 100644 index 0000000000..c1ea9877a2 --- /dev/null +++ b/tests/system-test/2-query/fill_with_group.py @@ -0,0 +1,144 @@ +import taos +import sys +import time +import socket +import os +import threading +import math + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +# from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.vgroups = 4 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + self.duraion = '1h' + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def create_database(self,tsql, dbName,dropFlag=1,vgroups=2,replica=1, duration:str='1d'): + if dropFlag == 1: + tsql.execute("drop database if exists %s"%(dbName)) + + tsql.execute("create database if not exists %s vgroups %d replica %d duration %s"%(dbName, vgroups, replica, duration)) + tdLog.debug("complete to create database %s"%(dbName)) + return + + def create_stable(self,tsql, paraDict): + colString = tdCom.gen_column_type_str(colname_prefix=paraDict["colPrefix"], column_elm_list=paraDict["colSchema"]) + tagString = tdCom.gen_tag_type_str(tagname_prefix=paraDict["tagPrefix"], tag_elm_list=paraDict["tagSchema"]) + sqlString = f"create table if not exists %s.%s (%s) tags (%s)"%(paraDict["dbName"], paraDict["stbName"], colString, tagString) + tdLog.debug("%s"%(sqlString)) + tsql.execute(sqlString) + return + + def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1,ctbStartIdx=0): + for i in range(ctbNum): + sqlString = "create table %s.%s%d using %s.%s tags(%d, 'tb%d', 'tb%d', %d, %d, %d)" % \ + (dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,(i+ctbStartIdx) % 5,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx) + tsql.execute(sqlString) + + tdLog.debug("complete to create %d child tables by %s.%s" %(ctbNum, dbName, stbName)) + return + + def insert_data(self,tsql,dbName,ctbPrefix,ctbNum,rowsPerTbl,batchNum,startTs,tsStep): + tdLog.debug("start to insert data ............") + tsql.execute("use %s" %dbName) + pre_insert = "insert into " + sql = pre_insert + + for i in range(ctbNum): + rowsBatched = 0 + sql += " %s%d values "%(ctbPrefix,i) + for j in range(rowsPerTbl): + if (i < ctbNum/2): + sql += "(%d, %d, %d, %d,%d,%d,%d,true,'binary%d', 'nchar%d') "%(startTs + j*tsStep, j%10, j%10, j%10, j%10, j%10, j%10, j%10, j%10) + else: + sql += "(%d, %d, NULL, %d,NULL,%d,%d,true,'binary%d', 'nchar%d') "%(startTs + j*tsStep, j%10, j%10, j%10, j%10, j%10, j%10) + rowsBatched += 1 + if ((rowsBatched == batchNum) or (j == rowsPerTbl - 1)): + tsql.execute(sql) + rowsBatched = 0 + if j < rowsPerTbl - 1: + sql = "insert into %s%d values " %(ctbPrefix,i) + else: + sql = "insert into " + if sql != pre_insert: + tsql.execute(sql) + tdLog.debug("insert data ............ [OK]") + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'test', + 'dropFlag': 1, + 'vgroups': 2, + 'stbName': 'meters', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'FLOAT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'smallint', 'count':1},{'type': 'tinyint', 'count':1},{'type': 'bool', 'count':1},{'type': 'binary', 'len':10, 'count':1},{'type': 'nchar', 'len':10, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'nchar', 'len':20, 'count':1},{'type': 'binary', 'len':20, 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'smallint', 'count':1},{'type': 'DOUBLE', 'count':1}], + 'ctbPrefix': 't', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 10000, + 'batchNum': 3000, + 'startTs': 1537146000000, + 'tsStep': 600000} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create database") + self.create_database(tsql=tdSql, dbName=paraDict["dbName"], dropFlag=paraDict["dropFlag"], vgroups=paraDict["vgroups"], replica=self.replicaVar, duration=self.duraion) + + tdLog.info("create stb") + self.create_stable(tsql=tdSql, paraDict=paraDict) + + tdLog.info("create child tables") + self.create_ctable(tsql=tdSql, dbName=paraDict["dbName"], \ + stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"],\ + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict["ctbStartIdx"]) + self.insert_data(tsql=tdSql, dbName=paraDict["dbName"],\ + ctbPrefix=paraDict["ctbPrefix"],ctbNum=paraDict["ctbNum"],\ + rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],\ + startTs=paraDict["startTs"],tsStep=paraDict["tsStep"]) + return + + def test_partition_by_with_interval_fill_prev_new_group_fill_error(self): + ## every table has 1500 rows after fill, 10 tables, total 15000 rows. + ## there is no data from 9-17 08:00:00 ~ 9-17 09:00:00, so first 60 rows of every group will be NULL, cause no prev value. + sql = "select _wstart, count(*),tbname from meters where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-18 09:00:00.000' partition by tbname interval(1m) fill(PREV) order by tbname, _wstart" + tdSql.query(sql) + for i in range(0,10): + for j in range(0,60): + tdSql.checkData(i*1500+j, 1, None) + + sql = "select _wstart, count(*),tbname from meters where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-18 09:00:00.000' partition by tbname interval(1m) fill(LINEAR) order by tbname, _wstart" + tdSql.query(sql) + for i in range(0,10): + for j in range(0,60): + tdSql.checkData(i*1500+j, 1, None) + + def run(self): + self.prepareTestEnv() + self.test_partition_by_with_interval_fill_prev_new_group_fill_error() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From 124b1e7f9ed577b16513ffffd18185b49248d643 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 21 Aug 2023 14:31:38 +0800 Subject: [PATCH 014/107] docs: add current_user() in function (#22496) --- docs/en/12-taos-sql/06-select.md | 8 +++++++- docs/en/12-taos-sql/10-function.md | 8 ++++++++ docs/zh/12-taos-sql/06-select.md | 8 +++++++- docs/zh/12-taos-sql/10-function.md | 8 ++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md index 661b4f5dea..5902dcb1df 100755 --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -7,7 +7,7 @@ description: This document describes how to query data in TDengine. ## Syntax ```sql -SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} +SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE() | CURRENT_USER() | USER() } SELECT [DISTINCT] select_list from_clause @@ -300,6 +300,12 @@ SELECT TODAY(); SELECT TIMEZONE(); ``` +### Obtain Current User + +```sql +SELECT CURRENT_USER(); +``` + ## Regular Expression ### Syntax diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index ad6d5d77fb..3e25d2d4ec 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -1275,6 +1275,14 @@ SELECT SERVER_STATUS(); **Description**: The server status. +### CURRENT_USER + +```sql +SELECT CURRENT_USER(); +``` + +**Description**: get current user. + ## Geometry Functions diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md index 80966cf386..8e122da894 100755 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -7,7 +7,7 @@ description: 查询数æ®çš„详细语法 ## 查询语法 ```sql -SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} +SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE() | CURRENT_USER() | USER() } SELECT [DISTINCT] select_list from_clause @@ -300,6 +300,12 @@ SELECT TODAY(); SELECT TIMEZONE(); ``` +### 获å–当å‰ç”¨æˆ· + +```sql +SELECT CURRENT_USER(); +``` + ## 正则表达å¼è¿‡æ»¤ ### 语法 diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 773ea67989..f0ad0c62a5 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -1266,6 +1266,14 @@ SELECT SERVER_STATUS(); **说明**:检测æœåŠ¡ç«¯æ˜¯å¦æ‰€æœ‰ dnode 都在线,如果是则返回æˆåŠŸï¼Œå¦åˆ™è¿”回无法建立连接的错误。 +### CURRENT_USER + +```sql +SELECT CURRENT_USER(); +``` + +**说明**:获å–当å‰ç”¨æˆ·ã€‚ + ## Geometry 函数 From 1d17270bb48438c6318155f712117b9575d24659 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 21 Aug 2023 16:44:45 +0800 Subject: [PATCH 015/107] update installation instruction --- packaging/tools/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index f9a11f5540..252a634a19 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -935,7 +935,7 @@ function updateProduct() { fi echo echo -e "\033[44;32;1m${productName2} is updated successfully!${NC}" - echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation and explorer features, you need to install ${clientName2}Explorer ${NC}" + echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation or explorer features, please install ${clientName2}Explorer ${NC}" else install_bin install_config @@ -1028,7 +1028,7 @@ function installProduct() { fi echo -e "\033[44;32;1m${productName2} is installed successfully!${NC}" - echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation and explorer features, you need to install ${clientName2}Explorer ${NC}" + echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation or explorer features, please install ${clientName2}Explorer ${NC}" echo else # Only install client install_bin From f4ef83b8527d67b5487ce19c6850f534faded743 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 21 Aug 2023 17:21:18 +0800 Subject: [PATCH 016/107] release 3.1.0.2 --- cmake/cmake.version | 2 +- docs/en/28-releases/01-tdengine.md | 4 ++++ docs/zh/28-releases/01-tdengine.md | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/cmake.version b/cmake/cmake.version index d5ada35dc3..ee02ef8c07 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.1.0.2.alpha") + SET(TD_VER_NUMBER "3.1.0.3.alpha") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index 31484dc1c5..ff6a36440f 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://t import Release from "/components/ReleaseV3"; +## 3.1.0.2 + + + ## 3.1.0.0 :::note IMPORTANT diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index afdf2a76d3..d316b3ab68 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x å„版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.1.0.2 + + + ## 3.1.0.0 From ac6d031e62fcda4eff8a305e5dddf69b30ac1fc7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 21 Aug 2023 17:56:35 +0800 Subject: [PATCH 017/107] fix:do not send unsubscribe msg to taosd if subscribe failed --- source/client/src/clientTmq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index b4168046f4..e861bd4b92 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -985,6 +985,10 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) { int32_t tmq_unsubscribe(tmq_t* tmq) { if(tmq == NULL) return TSDB_CODE_INVALID_PARA; + if (tmq->status != TMQ_CONSUMER_STATUS__READY) { + tscInfo("consumer:0x%" PRIx64 " not in ready state, unsubscribe it directly", tmq->consumerId); + return 0; + } if (tmq->autoCommit) { int32_t rsp = tmq_commit_sync(tmq, NULL); if (rsp != 0) { From c8a88fb70b1efff9b2f6bf4ee6b2cd00a1759b3e Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 21 Aug 2023 18:48:50 +0800 Subject: [PATCH 018/107] remove community package testing from ubuntu 16 --- packaging/MPtestJenkinsfile | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/packaging/MPtestJenkinsfile b/packaging/MPtestJenkinsfile index 0570bae191..1b2e555b88 100644 --- a/packaging/MPtestJenkinsfile +++ b/packaging/MPtestJenkinsfile @@ -114,7 +114,7 @@ pipeline { sync_source("${BRANCH_NAME}") sh ''' if [ "${verMode}" = "all" ];then - verMode="community enterprise" + verMode="enterprise" fi verModeList=${verMode} for verModeSin in ${verModeList} @@ -123,18 +123,6 @@ pipeline { bash testpackage.sh -m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar python3 checkPackageRuning.py done - ''' - - sh ''' - cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh -m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar - python3 checkPackageRuning.py - ''' - - sh ''' - cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh -m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t deb - python3 checkPackageRuning.py ''' } } From 2054640d9ee13550c688a9c98d65a923f78f5007 Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:55:35 +0800 Subject: [PATCH 019/107] Update 24-show.md --- docs/zh/12-taos-sql/24-show.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/zh/12-taos-sql/24-show.md b/docs/zh/12-taos-sql/24-show.md index 6e102e2356..b7ca9493d4 100644 --- a/docs/zh/12-taos-sql/24-show.md +++ b/docs/zh/12-taos-sql/24-show.md @@ -22,6 +22,14 @@ SHOW CLUSTER; 显示当å‰é›†ç¾¤çš„ä¿¡æ¯ +## SHOW CLUSTER ALIVE + +```sql +SHOW CLUSTER ALIVE; +``` + +查询当å‰é›†ç¾¤çš„çŠ¶æ€æ˜¯å¦å¯ç”¨ï¼Œè¿”回值: 0:ä¸å¯ç”¨ 1:完全å¯ç”¨ 2:部分å¯ç”¨ï¼ˆé›†ç¾¤ä¸­éƒ¨åˆ†èŠ‚ç‚¹ä¸‹çº¿ï¼Œä½†å…¶å®ƒèŠ‚ç‚¹ä»å¯ä»¥æ­£å¸¸ä½¿ç”¨ï¼‰ + ## SHOW CONNECTIONS ```sql From b5bd8f7c2353047ade7dc001457e40a644106781 Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:57:14 +0800 Subject: [PATCH 020/107] Update 24-show.md --- docs/en/12-taos-sql/24-show.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md index b663fbd435..7a58343f24 100644 --- a/docs/en/12-taos-sql/24-show.md +++ b/docs/en/12-taos-sql/24-show.md @@ -22,6 +22,14 @@ SHOW CLUSTER; Shows information about the current cluster. +## SHOW CLUSTER ALIVE + +```sql +SHOW CLUSTER ALIVE; +``` + +It is used to check whether the cluster is available or not. Return value: 0 means unavailable, 1 means available, 2 means partially available (some dnodes are offline, the other dnodes are available) + ## SHOW CONNECTIONS ```sql From 56626f2e764a091c0839d420939982cfb74994d4 Mon Sep 17 00:00:00 2001 From: huolibo Date: Thu, 27 Jul 2023 16:52:08 +0800 Subject: [PATCH 021/107] feat(driver): add committed assignment API for jdbc --- .../jni/com_taosdata_jdbc_tmq_TMQConnector.h | 15 +++ source/client/src/clientTmqConnector.c | 108 +++++++++++++++++- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h b/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h index 422bcd57ac..ebc4eacdf9 100644 --- a/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h +++ b/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h @@ -92,6 +92,10 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscriptionIm */ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNIEnv *, jobject, jlong, jlong); +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAllSync(JNIEnv *, jobject, jlong); + +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitOffsetSyncImp(JNIEnv *, jobject, jlong, jstring, + jint, jlong); /* * Class: com_taosdata_jdbc_tmq_TMQConnector * Method: tmqCommitAsync @@ -102,6 +106,12 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JN JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAsync(JNIEnv *, jobject, jlong, jlong, jobject); +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAllAsync(JNIEnv *, jobject, jlong, + jobject); + +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitOffsetAsync(JNIEnv *, jobject, jlong, + jstring, jint, jlong, jobject); + /* * Class: com_taosdata_jdbc_tmq_TMQConnector * Method: tmqUnsubscribeImp @@ -179,6 +189,11 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSeekImp(JNIEnv JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssignmentImp(JNIEnv *, jobject, jlong, jstring, jobject); +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp(JNIEnv *, jobject, jlong, jstring, + jint); + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqPositionImp(JNIEnv *, jobject, jlong, jstring, jint); + #ifdef __cplusplus } #endif diff --git a/source/client/src/clientTmqConnector.c b/source/client/src/clientTmqConnector.c index 6ec82aa6ef..487a86a589 100644 --- a/source/client/src/clientTmqConnector.c +++ b/source/client/src/clientTmqConnector.c @@ -291,6 +291,39 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNI TAOS_RES *res = (TAOS_RES *)jres; return tmq_commit_sync(tmq, res); } +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAllSync(JNIEnv *env, jobject jobj, jlong jtmq) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniError("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + return tmq_commit_sync(tmq, NULL); +} + +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitOffsetSyncImp(JNIEnv *env, jobject jobj, + jlong jtmq, jstring jtopic, + jint vgId, jlong offset) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int code = tmq_commit_offset_sync(tmq, topicName, vgId, offset); + if (code != TSDB_CODE_SUCCESS) { + jniError("jobj:%p, tmq commit offset error, code:%d, msg:%s", jobj, code, tmq_err2str(code)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return code; +} // deprecated JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JNIEnv *env, jobject jobj, jlong jtmq, @@ -319,6 +352,27 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAsy tmq_commit_async(tmq, res, consumer_callback, offset); } +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAllAsync(JNIEnv *env, jobject jobj, + jlong jtmq, jobject offset) { + tmqGlobalMethod(env); + tmq_t *tmq = (tmq_t *)jtmq; + + offset = (*env)->NewGlobalRef(env, offset); + tmq_commit_async(tmq, NULL, consumer_callback, offset); +} + +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitOffsetAsync(JNIEnv *env, jobject jobj, + jlong jtmq, jstring jtopic, + jint vgId, jlong offset, + jobject callback) { + tmqGlobalMethod(env); + tmq_t *tmq = (tmq_t *)jtmq; + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + callback = (*env)->NewGlobalRef(env, callback); + tmq_commit_offset_async(tmq, topicName, vgId, offset, consumer_callback, callback); +} + JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqUnsubscribeImp(JNIEnv *env, jobject jobj, jlong jtmq) { tmq_t *tmq = (tmq_t *)jtmq; @@ -497,9 +551,9 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssign int32_t res = tmq_get_topic_assignment(tmq, topicName, &pAssign, &numOfAssignment); if (res != TSDB_CODE_SUCCESS) { - (*env)->ReleaseStringUTFChars(env, jtopic, topicName); jniError("jobj:%p, tmq get topic assignment error, topic:%s, code:%d, msg:%s", jobj, topicName, res, tmq_err2str(res)); + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); tmq_free_assignment(pAssign); return (jint)res; } @@ -518,3 +572,55 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssign tmq_free_assignment(pAssign); return JNI_SUCCESS; } + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp(JNIEnv *env, jobject jobj, jlong jtmq, + jstring jtopic, jint vgId) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int64_t offset = tmq_committed(tmq, topicName, vgId); + + if (offset < JNI_SUCCESS) { + jniError("jobj:%p, tmq get committed offset error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, + vgId, offset, tmq_err2str(offset)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return (jlong)offset; +} + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqPositionImp(JNIEnv *env, jobject jobj, jlong jtmq, + jstring jtopic, jint vgId) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int64_t offset = tmq_position(tmq, topicName, vgId); + + if (offset < JNI_SUCCESS) { + jniError("jobj:%p, tmq get position error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, vgId, + offset, tmq_err2str(offset)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return (jlong)offset; +} \ No newline at end of file From dba7c68de10e9b92a2aadd93cb2474a4d423c8c3 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 22 Aug 2023 15:41:04 +0800 Subject: [PATCH 022/107] test: add test cases for timeline function used for select * union query --- tests/system-test/2-query/union.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/system-test/2-query/union.py b/tests/system-test/2-query/union.py index 82dcfe12e6..96c29a2222 100644 --- a/tests/system-test/2-query/union.py +++ b/tests/system-test/2-query/union.py @@ -231,6 +231,31 @@ class TDTestCase: tdSql.execute(f"{sqls[j+i]} union {sqls[i]}") else: tdSql.error(f"{sqls[i]} union {sqls[j+i]}") + # check union with timeline function + tdSql.query(f"select first(c1) from (select * from t1 union select * from t1 order by ts)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9) + tdSql.query(f"select last(c1) from (select * from t1 union select * from t1 order by ts desc)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 2147450880) + tdSql.query(f"select irate(c1) from (select * from t1 union select * from t1 order by ts)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.102222222222222) + tdSql.query(f"select elapsed(ts) from (select * from t1 union select * from t1 order by ts)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 46800000.000000000000000) + tdSql.query(f"select diff(c1) from (select * from t1 union select * from t1 order by ts)") + tdSql.checkRows(14) + tdSql.query(f"select derivative(c1, 1s, 0) from (select * from t1 union select * from t1 order by ts)") + tdSql.checkRows(11) + + tdSql.error(f"select first(c1) from (select * from t1 union select * from t1)") + tdSql.error(f"select last(c1) from (select * from t1 union select * from t1)") + tdSql.error(f"select irate(c1) from (select * from t1 union select * from t1)") + tdSql.error(f"select elapsed(ts) from (select * from t1 union select * from t1)") + tdSql.error(f"select diff(c1) from (select * from t1 union select * from t1)") + tdSql.error(f"select derivative(c1, 1s, 0) from (select * from t1 union select * from t1)") + def __test_error(self, dbname="db"): From 502788215b07ba0e0c7d016ecfe3e04c675a6d78 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 22 Aug 2023 17:32:36 +0800 Subject: [PATCH 023/107] fix error --- tests/system-test/2-query/union.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/system-test/2-query/union.py b/tests/system-test/2-query/union.py index 96c29a2222..e359164a4f 100644 --- a/tests/system-test/2-query/union.py +++ b/tests/system-test/2-query/union.py @@ -231,30 +231,31 @@ class TDTestCase: tdSql.execute(f"{sqls[j+i]} union {sqls[i]}") else: tdSql.error(f"{sqls[i]} union {sqls[j+i]}") + # check union with timeline function - tdSql.query(f"select first(c1) from (select * from t1 union select * from t1 order by ts)") + tdSql.query(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") tdSql.checkRows(1) tdSql.checkData(0, 0, 9) - tdSql.query(f"select last(c1) from (select * from t1 union select * from t1 order by ts desc)") + tdSql.query(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts desc)") tdSql.checkRows(1) tdSql.checkData(0, 0, 2147450880) - tdSql.query(f"select irate(c1) from (select * from t1 union select * from t1 order by ts)") + tdSql.query(f"select irate(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") tdSql.checkRows(1) tdSql.checkData(0, 0, 9.102222222222222) - tdSql.query(f"select elapsed(ts) from (select * from t1 union select * from t1 order by ts)") + tdSql.query(f"select elapsed(ts) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") tdSql.checkRows(1) tdSql.checkData(0, 0, 46800000.000000000000000) - tdSql.query(f"select diff(c1) from (select * from t1 union select * from t1 order by ts)") + tdSql.query(f"select diff(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") tdSql.checkRows(14) - tdSql.query(f"select derivative(c1, 1s, 0) from (select * from t1 union select * from t1 order by ts)") + tdSql.query(f"select derivative(c1, 1s, 0) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") tdSql.checkRows(11) - tdSql.error(f"select first(c1) from (select * from t1 union select * from t1)") - tdSql.error(f"select last(c1) from (select * from t1 union select * from t1)") - tdSql.error(f"select irate(c1) from (select * from t1 union select * from t1)") - tdSql.error(f"select elapsed(ts) from (select * from t1 union select * from t1)") - tdSql.error(f"select diff(c1) from (select * from t1 union select * from t1)") - tdSql.error(f"select derivative(c1, 1s, 0) from (select * from t1 union select * from t1)") + tdSql.error(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select irate(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select elapsed(ts) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select diff(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select derivative(c1, 1s, 0) from (select * from {dbname}.t1 union select * from {dbname}.t1)") def __test_error(self, dbname="db"): From fe4e45647ea854cfab9cbc7aabc0054ced5117c0 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 22 Aug 2023 18:29:25 +0800 Subject: [PATCH 024/107] fix: global data sink manager issue --- source/libs/executor/src/dataDeleter.c | 2 ++ source/libs/executor/src/dataDispatcher.c | 1 + source/libs/executor/src/dataInserter.c | 2 ++ source/libs/executor/src/dataSinkMgt.c | 22 ++++++++++++++-------- source/libs/executor/src/executor.c | 5 +++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index 11074b0e94..a30dc47029 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -224,6 +224,8 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) { } taosCloseQueue(pDeleter->pDataBlocks); taosThreadMutexDestroy(&pDeleter->mutex); + + taosMemoryFree(pDeleter->pManager); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 2a22656d8c..56d0ca523a 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -226,6 +226,7 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) { } taosCloseQueue(pDispatcher->pDataBlocks); taosThreadMutexDestroy(&pDispatcher->mutex); + taosMemoryFree(pDispatcher->pManager); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index 646964ebf4..f20293791b 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -395,6 +395,8 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) { taosMemoryFree(pInserter->pParam); taosHashCleanup(pInserter->pCols); taosThreadMutexDestroy(&pInserter->mutex); + + taosMemoryFree(pInserter->pManager); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/executor/src/dataSinkMgt.c b/source/libs/executor/src/dataSinkMgt.c index 3a972c1c20..f07d176440 100644 --- a/source/libs/executor/src/dataSinkMgt.c +++ b/source/libs/executor/src/dataSinkMgt.c @@ -18,12 +18,17 @@ #include "planner.h" #include "tarray.h" -static SDataSinkManager gDataSinkManager = {0}; SDataSinkStat gDataSinkStat = {0}; -int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI) { - gDataSinkManager.cfg = *cfg; - gDataSinkManager.pAPI = pAPI; +int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI, void** ppSinkManager) { + SDataSinkManager* pSinkManager = taosMemoryMalloc(sizeof(SDataSinkManager)); + if (NULL == pSinkManager) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pSinkManager->cfg = *cfg; + pSinkManager->pAPI = pAPI; + + *ppSinkManager = pSinkManager; return 0; // to avoid compiler eror } @@ -33,15 +38,16 @@ int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat) { return 0; } -int32_t dsCreateDataSinker(const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id) { +int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id) { + SDataSinkManager* pManager = pSinkManager; switch ((int)nodeType(pDataSink)) { case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: - return createDataDispatcher(&gDataSinkManager, pDataSink, pHandle); + return createDataDispatcher(pManager, pDataSink, pHandle); case QUERY_NODE_PHYSICAL_PLAN_DELETE: { - return createDataDeleter(&gDataSinkManager, pDataSink, pHandle, pParam); + return createDataDeleter(pManager, pDataSink, pHandle, pParam); } case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: { - return createDataInserter(&gDataSinkManager, pDataSink, pHandle, pParam); + return createDataInserter(pManager, pDataSink, pHandle, pParam); } } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index a6059c7c42..9f5db5d6ae 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -512,7 +512,8 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, } SDataSinkMgtCfg cfg = {.maxDataBlockNum = 500, .maxDataBlockNumPerQuery = 50}; - code = dsDataSinkMgtInit(&cfg, &(*pTask)->storageAPI); + void* pSinkManager = NULL; + code = dsDataSinkMgtInit(&cfg, &(*pTask)->storageAPI, &pSinkManager); if (code != TSDB_CODE_SUCCESS) { qError("failed to dsDataSinkMgtInit, code:%s, %s", tstrerror(code), (*pTask)->id.str); goto _error; @@ -527,7 +528,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, } // pSinkParam has been freed during create sinker. - code = dsCreateDataSinker(pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str); + code = dsCreateDataSinker(pSinkManager, pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str); } qDebug("subplan task create completed, TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, pSubplan->id.queryId); From 647b57d2641c98102d12826021bf46e870f9d847 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 22 Aug 2023 18:30:11 +0800 Subject: [PATCH 025/107] fix: assign flags during subscribe --- source/client/src/clientRawBlockWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index dd311db126..ecc586a7e9 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -687,14 +687,14 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { pReq.pColumns = taosArrayInit(req.schemaRow.nCols, sizeof(SField)); for (int32_t i = 0; i < req.schemaRow.nCols; i++) { SSchema* pSchema = req.schemaRow.pSchema + i; - SField field = {.type = pSchema->type, .bytes = pSchema->bytes}; + SField field = {.type = pSchema->type, .bytes = pSchema->bytes, .flags = pSchema->flags}; strcpy(field.name, pSchema->name); taosArrayPush(pReq.pColumns, &field); } pReq.pTags = taosArrayInit(req.schemaTag.nCols, sizeof(SField)); for (int32_t i = 0; i < req.schemaTag.nCols; i++) { SSchema* pSchema = req.schemaTag.pSchema + i; - SField field = {.type = pSchema->type, .bytes = pSchema->bytes}; + SField field = {.type = pSchema->type, .bytes = pSchema->bytes, .flags = pSchema->flags}; strcpy(field.name, pSchema->name); taosArrayPush(pReq.pTags, &field); } From 46a4dfd92ad16cd755b11ad8bee3fd815230710c Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 22 Aug 2023 18:32:52 +0800 Subject: [PATCH 026/107] fix: assign flags during subscribe --- source/client/src/clientRawBlockWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index ecc586a7e9..9fb89aad77 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -687,14 +687,14 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { pReq.pColumns = taosArrayInit(req.schemaRow.nCols, sizeof(SField)); for (int32_t i = 0; i < req.schemaRow.nCols; i++) { SSchema* pSchema = req.schemaRow.pSchema + i; - SField field = {.type = pSchema->type, .bytes = pSchema->bytes, .flags = pSchema->flags}; + SField field = {.type = pSchema->type, .flags = pSchema->flags, .bytes = pSchema->bytes}; strcpy(field.name, pSchema->name); taosArrayPush(pReq.pColumns, &field); } pReq.pTags = taosArrayInit(req.schemaTag.nCols, sizeof(SField)); for (int32_t i = 0; i < req.schemaTag.nCols; i++) { SSchema* pSchema = req.schemaTag.pSchema + i; - SField field = {.type = pSchema->type, .bytes = pSchema->bytes, .flags = pSchema->flags}; + SField field = {.type = pSchema->type, .flags = pSchema->flags, .bytes = pSchema->bytes}; strcpy(field.name, pSchema->name); taosArrayPush(pReq.pTags, &field); } From cb70861986d90be238be37ebc0ae37989cf74aa5 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 22 Aug 2023 18:40:42 +0800 Subject: [PATCH 027/107] fix: memory leak issue --- include/libs/executor/dataSinkMgt.h | 4 ++-- source/libs/executor/src/dataDeleter.c | 2 ++ source/libs/executor/src/dataDispatcher.c | 9 +++++++-- source/libs/executor/src/dataInserter.c | 24 ++++++++++++++--------- source/libs/executor/src/dataSinkMgt.c | 3 +++ source/libs/executor/src/executor.c | 17 ++++++++-------- 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/include/libs/executor/dataSinkMgt.h b/include/libs/executor/dataSinkMgt.h index 0a9037d21c..29ba019e47 100644 --- a/include/libs/executor/dataSinkMgt.h +++ b/include/libs/executor/dataSinkMgt.h @@ -59,7 +59,7 @@ typedef struct SDataSinkMgtCfg { uint32_t maxDataBlockNumPerQuery; } SDataSinkMgtCfg; -int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI); +int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI, void** ppSinkManager); typedef struct SInputData { const struct SSDataBlock* pData; @@ -83,7 +83,7 @@ typedef struct SOutputData { * @param pHandle output * @return error code */ -int32_t dsCreateDataSinker(const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id); +int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id); int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat); diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index a30dc47029..960ae14fcf 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -281,6 +281,8 @@ _end: if (deleter != NULL) { destroyDataSinker((SDataSinkHandle*)deleter); taosMemoryFree(deleter); + } else { + taosMemoryFree(pManager); } return code; } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 56d0ca523a..409ae50174 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -241,7 +241,7 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD SDataDispatchHandle* dispatcher = taosMemoryCalloc(1, sizeof(SDataDispatchHandle)); if (NULL == dispatcher) { terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_OUT_OF_MEMORY; + goto _return; } dispatcher->sink.fPut = putDataBlock; dispatcher->sink.fEndPut = endPut; @@ -258,8 +258,13 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD if (NULL == dispatcher->pDataBlocks) { taosMemoryFree(dispatcher); terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_OUT_OF_MEMORY; + goto _return; } *pHandle = dispatcher; return TSDB_CODE_SUCCESS; + +_return: + + taosMemoryFree(pManager); + return terrno; } diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index f20293791b..8a70726cc8 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -413,7 +413,7 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat if (NULL == inserter) { taosMemoryFree(pParam); terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_OUT_OF_MEMORY; + goto _return; } SQueryInserterNode* pInserterNode = (SQueryInserterNode*)pDataSink; @@ -433,23 +433,18 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat int64_t suid = 0; int32_t code = pManager->pAPI->metaFn.getTableSchema(inserter->pParam->readHandle->vnode, pInserterNode->tableId, &inserter->pSchema, &suid); if (code) { - destroyDataSinker((SDataSinkHandle*)inserter); - taosMemoryFree(inserter); - return code; + terrno = code; + goto _return; } if (pInserterNode->stableId != suid) { - destroyDataSinker((SDataSinkHandle*)inserter); - taosMemoryFree(inserter); terrno = TSDB_CODE_TDB_INVALID_TABLE_ID; - return terrno; + goto _return; } inserter->pDataBlocks = taosArrayInit(1, POINTER_BYTES); taosThreadMutexInit(&inserter->mutex, NULL); if (NULL == inserter->pDataBlocks) { - destroyDataSinker((SDataSinkHandle*)inserter); - taosMemoryFree(inserter); terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY; } @@ -473,4 +468,15 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat *pHandle = inserter; return TSDB_CODE_SUCCESS; + +_return: + + if (inserter) { + destroyDataSinker((SDataSinkHandle*)inserter); + taosMemoryFree(inserter); + } else { + taosMemoryFree(pManager); + } + + return terrno; } diff --git a/source/libs/executor/src/dataSinkMgt.c b/source/libs/executor/src/dataSinkMgt.c index f07d176440..b2cbf4c1a2 100644 --- a/source/libs/executor/src/dataSinkMgt.c +++ b/source/libs/executor/src/dataSinkMgt.c @@ -49,8 +49,11 @@ int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, D case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: { return createDataInserter(pManager, pDataSink, pHandle, pParam); } + default: + break; } + taosMemoryFree(pSinkManager); qError("invalid input node type:%d, %s", nodeType(pDataSink), id); return TSDB_CODE_QRY_INVALID_INPUT; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 9f5db5d6ae..28ee8f4b7a 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -511,19 +511,20 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, goto _error; } - SDataSinkMgtCfg cfg = {.maxDataBlockNum = 500, .maxDataBlockNumPerQuery = 50}; - void* pSinkManager = NULL; - code = dsDataSinkMgtInit(&cfg, &(*pTask)->storageAPI, &pSinkManager); - if (code != TSDB_CODE_SUCCESS) { - qError("failed to dsDataSinkMgtInit, code:%s, %s", tstrerror(code), (*pTask)->id.str); - goto _error; - } - if (handle) { + SDataSinkMgtCfg cfg = {.maxDataBlockNum = 500, .maxDataBlockNumPerQuery = 50}; + void* pSinkManager = NULL; + code = dsDataSinkMgtInit(&cfg, &(*pTask)->storageAPI, &pSinkManager); + if (code != TSDB_CODE_SUCCESS) { + qError("failed to dsDataSinkMgtInit, code:%s, %s", tstrerror(code), (*pTask)->id.str); + goto _error; + } + void* pSinkParam = NULL; code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, (*pTask), readHandle); if (code != TSDB_CODE_SUCCESS) { qError("failed to createDataSinkParam, vgId:%d, code:%s, %s", vgId, tstrerror(code), (*pTask)->id.str); + taosMemoryFree(pSinkManager); goto _error; } From 7b5fc0cc64bce6c2a32c45f66603d077c8806143 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Tue, 22 Aug 2023 18:59:30 +0800 Subject: [PATCH 028/107] TS-3851: add tdef.h into release package --- packaging/deb/DEBIAN/prerm | 1 + packaging/deb/makedeb.sh | 1 + packaging/rpm/tdengine.spec | 2 ++ packaging/tools/install.sh | 3 ++- packaging/tools/install_client.sh | 3 ++- packaging/tools/make_install.sh | 5 +++-- packaging/tools/makeclient.sh | 2 +- packaging/tools/makepkg.sh | 2 +- packaging/tools/post.sh | 3 ++- packaging/tools/preun.sh | 1 + packaging/tools/remove.sh | 1 + packaging/tools/remove_client.sh | 1 + 12 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm index 0d63115a04..a474dc4c80 100644 --- a/packaging/deb/DEBIAN/prerm +++ b/packaging/deb/DEBIAN/prerm @@ -37,6 +37,7 @@ else ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index 07819159c4..eca75ce71a 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -98,6 +98,7 @@ cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_pat cp ${compile_dir}/../include/client/taos.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/common/taosdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/util/taoserror.h ${pkg_dir}${install_home_path}/include +cp ${compile_dir}/../include/util/tdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/libs/function/taosudf.h ${pkg_dir}${install_home_path}/include [ -f ${compile_dir}/build/include/taosws.h ] && cp ${compile_dir}/build/include/taosws.h ${pkg_dir}${install_home_path}/include ||: cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index 846d17e7f6..e93af2470a 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -95,6 +95,7 @@ cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driv cp %{_compiledir}/../include/client/taos.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/common/taosdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/util/taoserror.h %{buildroot}%{homepath}/include +cp %{_compiledir}/../include/util/tdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/libs/function/taosudf.h %{buildroot}%{homepath}/include [ -f %{_compiledir}/build/include/taosws.h ] && cp %{_compiledir}/build/include/taosws.h %{buildroot}%{homepath}/include ||: #cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector @@ -217,6 +218,7 @@ if [ $1 -eq 0 ];then ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 252a634a19..408a5664a8 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -345,7 +345,7 @@ function install_jemalloc() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : @@ -353,6 +353,7 @@ function install_header() { ${csudo}ln -sf ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -sf ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -sf ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -sf ${install_main_dir}/include/tdef.h ${inc_link_dir}/tdef.h ${csudo}ln -sf ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h [ -f ${install_main_dir}/include/taosws.h ] && ${csudo}ln -sf ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h || : diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index 18ebf9dc8f..c8baab8269 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -180,10 +180,11 @@ function install_lib() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h + ${csudo}ln -s ${install_main_dir}/include/tdef.h ${inc_link_dir}/tdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 0a5f9d2668..99315b3311 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -348,9 +348,9 @@ function install_lib() { function install_header() { ${csudo}mkdir -p ${inc_link_dir} - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h ||: - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/util/tdef.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* if [ -f ${binary_dir}/build/include/taosws.h ]; then @@ -361,6 +361,7 @@ function install_header() { ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h > /dev/null 2>&1 ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h > /dev/null 2>&1 ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h > /dev/null 2>&1 + ${csudo}ln -s ${install_main_dir}/include/tdef.h ${inc_link_dir}/tdef.h > /dev/null 2>&1 ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h > /dev/null 2>&1 ${csudo}chmod 644 ${install_main_dir}/include/* diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index cd59294fe7..243efd693e 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -83,7 +83,7 @@ else wslib_files="${build_dir}/lib/libtaosws.dylib" fi -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/util/tdef.h ${code_dir}/include/libs/function/taosudf.h" wsheader_files="${build_dir}/include/taosws.h" if [ "$dbName" != "taos" ]; then diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index ad64ca431e..655629b92c 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -115,7 +115,7 @@ else lib_files="${build_dir}/lib/libtaos.so.${version}" wslib_files="${build_dir}/lib/libtaosws.so" fi -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/util/tdef.h ${code_dir}/include/libs/function/taosudf.h" wsheader_files="${build_dir}/include/taosws.h" diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index e79a10c9e9..ceaebfdc7c 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -133,12 +133,13 @@ function kill_taosd() { function install_include() { log_print "start install include from ${inc_dir} to ${inc_link_dir}" ${csudo}mkdir -p ${inc_link_dir} - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h ||: ${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${inc_dir}/tdef.h ${inc_link_dir}/tdef.h ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h [ -f ${inc_dir}/taosws.h ] && ${csudo}ln -sf ${inc_dir}/taosws.h ${inc_link_dir}/taosws.h ||: diff --git a/packaging/tools/preun.sh b/packaging/tools/preun.sh index 68f6b53c45..25f3d8ce4a 100755 --- a/packaging/tools/preun.sh +++ b/packaging/tools/preun.sh @@ -143,6 +143,7 @@ ${csudo}rm -f ${cfg_link_dir}/*.new || : ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : +${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index eca0c5e973..0e8b036f28 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -155,6 +155,7 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index 2bdb56fac2..695307254d 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -73,6 +73,7 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : } From 458fd0797690205d734dc57599c4557e7770a24d Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Fri, 18 Aug 2023 14:45:16 +0800 Subject: [PATCH 029/107] enh: ttl split flush and drop table config: 1. ttlFlushThreshold: maximum number of dirty items in memory 2. tsTtlBatchDropNum: number of tables dropped per batch 3. tsTrimVDbIntervalSec: interval of trimming db in all vgroups --- include/common/tglobal.h | 5 +- include/common/tmsg.h | 3 + include/common/tmsgdef.h | 13 +- source/common/src/tglobal.c | 43 +++++- source/common/src/tmsg.c | 30 ++++ source/dnode/mgmt/mgmt_mnode/src/mmHandle.c | 7 +- source/dnode/mnode/impl/src/mndDnode.c | 32 ++++- source/dnode/mnode/impl/src/mndMain.c | 16 ++- source/dnode/mnode/impl/src/mndStb.c | 61 ++++++-- source/dnode/vnode/src/inc/metaTtl.h | 20 +-- source/dnode/vnode/src/inc/vnodeInt.h | 5 +- source/dnode/vnode/src/meta/metaOpen.c | 2 +- source/dnode/vnode/src/meta/metaTable.c | 53 ++++--- source/dnode/vnode/src/meta/metaTtl.c | 152 ++++++++------------ source/dnode/vnode/src/vnd/vnodeSvr.c | 108 +++++++++++--- 15 files changed, 377 insertions(+), 173 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 5fd174e873..6ef2703d54 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -130,6 +130,7 @@ extern bool tsKeepColumnName; extern bool tsEnableQueryHb; extern bool tsEnableScience; extern bool tsTtlChangeOnWrite; +extern int32_t tsTtlFlushThreshold; extern int32_t tsRedirectPeriod; extern int32_t tsRedirectFactor; extern int32_t tsRedirectMaxPeriod; @@ -185,7 +186,9 @@ extern int32_t tsTransPullupInterval; extern int32_t tsMqRebalanceInterval; extern int32_t tsStreamCheckpointTickInterval; extern int32_t tsTtlUnit; -extern int32_t tsTtlPushInterval; +extern int32_t tsTtlPushIntervalSec; +extern int32_t tsTtlBatchDropNum; +extern int32_t tsTrimVDbIntervalSec; extern int32_t tsGrantHBInterval; extern int32_t tsUptimeInterval; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index c6bb599a7d..21cad322bb 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1161,6 +1161,9 @@ int32_t tDeserializeSVTrimDbReq(void* buf, int32_t bufLen, SVTrimDbReq* pReq); typedef struct { int32_t timestampSec; + int32_t ttlDropMaxCount; + int32_t nUids; + SArray* pTbUids; } SVDropTtlTableReq; int32_t tSerializeSVDropTtlTableReq(void* buf, int32_t bufLen, SVDropTtlTableReq* pReq); diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 483122b070..3be49361d2 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -89,15 +89,15 @@ enum { TD_NEW_MSG_SEG(TDMT_MND_MSG) TD_DEF_MSG_TYPE(TDMT_MND_CONNECT, "connect", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_CREATE_ACCT, "create-acct", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CREATE_ACCT, "create-acct", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_ACCT, "alter-acct", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_DROP_ACCT, "drop-acct", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_CREATE_USER, "create-user", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CREATE_USER, "create-user", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_USER, "alter-user", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_DROP_USER, "drop-user", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_GET_USER_AUTH, "get-user-auth", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_DROP_USER, "drop-user", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_GET_USER_AUTH, "get-user-auth", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_CREATE_DNODE, "create-dnode", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_DNODE, "config-dnode", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_DNODE, "config-dnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_DROP_DNODE, "drop-dnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_CREATE_MNODE, "create-mnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_MNODE, "alter-mnode", NULL, NULL) @@ -156,6 +156,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_TELEM_TIMER, "telem-tmr", SMTimerReq, SMTimerReq) TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "trans-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TTL_TIMER, "ttl-tmr", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_TRIM_DB_TIMER, "trim-db-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_GRANT_HB_TIMER, "grant-hb-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_KILL_TRANS, "kill-trans", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_KILL_QUERY, "kill-query", NULL, NULL) @@ -296,7 +297,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_SYNC_PRE_SNAPSHOT_REPLY, "sync-pre-snapshot-reply", NULL, NULL) // no longer used TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_FORCE_FOLLOWER, "sync-force-become-follower", NULL, NULL) - + TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_SCAN_HISTORY, "vnode-stream-scan-history", NULL, NULL) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index e080c2d2ec..6851fcc3a4 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -124,7 +124,6 @@ int32_t tsQueryRspPolicy = 0; int64_t tsQueryMaxConcurrentTables = 200; // unit is TSDB_TABLE_NUM_UNIT bool tsEnableQueryHb = true; bool tsEnableScience = false; // on taos-cli show float and doulbe with scientific notation if true -bool tsTtlChangeOnWrite = false; // ttl delete time changes on last write if true int32_t tsQuerySmaOptimize = 0; int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data. bool tsQueryPlannerTrace = false; @@ -225,12 +224,20 @@ bool tsStartUdfd = true; // wal int64_t tsWalFsyncDataSizeLimit = (100 * 1024 * 1024L); +// ttl +bool tsTtlChangeOnWrite = false; // if true, ttl delete time changes on last write +int32_t tsTtlFlushThreshold = 100; /* maximum number of dirty items in memory. + * if -1, flush will not be triggered by write-ops + */ +int32_t tsTtlBatchDropNum = 10000; // number of tables dropped per batch + // internal int32_t tsTransPullupInterval = 2; int32_t tsMqRebalanceInterval = 2; int32_t tsStreamCheckpointTickInterval = 1; int32_t tsTtlUnit = 86400; -int32_t tsTtlPushInterval = 3600; +int32_t tsTtlPushIntervalSec = 10; +int32_t tsTrimVDbIntervalSec = 60 * 60; // interval of trimming db in all vgroups int32_t tsGrantHBInterval = 60; int32_t tsUptimeInterval = 300; // seconds char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits @@ -605,8 +612,11 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "transPullupInterval", tsTransPullupInterval, 1, 10000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "mqRebalanceInterval", tsMqRebalanceInterval, 1, 10000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400 * 365, CFG_SCOPE_SERVER) != 0) return -1; - if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushInterval, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushIntervalSec, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "ttlBatchDropNum", tsTtlBatchDropNum, 0, INT32_MAX, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddBool(pCfg, "ttlChangeOnWrite", tsTtlChangeOnWrite, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "ttlFlushThreshold", tsTtlFlushThreshold, -1, 1000000, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "trimVDbIntervalSec", tsTrimVDbIntervalSec, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, CFG_SCOPE_SERVER) != 0) return -1; @@ -990,6 +1000,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsEnableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval; tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval; tsTtlChangeOnWrite = cfgGetItem(pCfg, "ttlChangeOnWrite")->bval; + tsTtlFlushThreshold = cfgGetItem(pCfg, "ttlFlushThreshold")->i32; tsTelemInterval = cfgGetItem(pCfg, "telemetryInterval")->i32; tstrncpy(tsTelemServer, cfgGetItem(pCfg, "telemetryServer")->str, TSDB_FQDN_LEN); tsTelemPort = (uint16_t)cfgGetItem(pCfg, "telemetryPort")->i32; @@ -999,7 +1010,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsTransPullupInterval = cfgGetItem(pCfg, "transPullupInterval")->i32; tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32; tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; - tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32; + tsTtlPushIntervalSec = cfgGetItem(pCfg, "ttlPushInterval")->i32; + tsTtlBatchDropNum = cfgGetItem(pCfg, "ttlBatchDropNum")->i32; + tsTrimVDbIntervalSec = cfgGetItem(pCfg, "trimVDbIntervalSec")->i32; tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32; tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32; @@ -1400,13 +1413,19 @@ int32_t taosApplyLocalCfg(SConfig *pCfg, char *name) { } else if (strcasecmp("ttlUnit", name) == 0) { tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; } else if (strcasecmp("ttlPushInterval", name) == 0) { - tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32; + tsTtlPushIntervalSec = cfgGetItem(pCfg, "ttlPushInterval")->i32; + } else if (strcasecmp("ttlBatchDropNum", name) == 0) { + tsTtlBatchDropNum = cfgGetItem(pCfg, "ttlBatchDropNum")->i32; + } else if (strcasecmp("trimVDbIntervalSec", name) == 0) { + tsTrimVDbIntervalSec = cfgGetItem(pCfg, "trimVDbIntervalSec")->i32; } else if (strcasecmp("tmrDebugFlag", name) == 0) { tmrDebugFlag = cfgGetItem(pCfg, "tmrDebugFlag")->i32; } else if (strcasecmp("tsdbDebugFlag", name) == 0) { tsdbDebugFlag = cfgGetItem(pCfg, "tsdbDebugFlag")->i32; } else if (strcasecmp("tqDebugFlag", name) == 0) { tqDebugFlag = cfgGetItem(pCfg, "tqDebugFlag")->i32; + } else if (strcasecmp("ttlFlushThreshold", name) == 0) { + tsTtlFlushThreshold = cfgGetItem(pCfg, "ttlFlushThreshold")->i32; } break; } @@ -1608,6 +1627,20 @@ void taosCfgDynamicOptions(const char *option, const char *value) { return; } + if (strcasecmp(option, "ttlPushInterval") == 0) { + int32_t newTtlPushInterval = atoi(value); + uInfo("ttlPushInterval set from %d to %d", tsTtlPushIntervalSec, newTtlPushInterval); + tsTtlPushIntervalSec = newTtlPushInterval; + return; + } + + if (strcasecmp(option, "ttlBatchDropNum") == 0) { + int32_t newTtlBatchDropNum = atoi(value); + uInfo("ttlBatchDropNum set from %d to %d", tsTtlBatchDropNum, newTtlBatchDropNum); + tsTtlBatchDropNum = newTtlBatchDropNum; + return; + } + const char *options[] = { "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag", "tmrDebugFlag", "uDebugFlag", diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index de76881467..27b6499497 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3179,6 +3179,12 @@ int32_t tSerializeSVDropTtlTableReq(void *buf, int32_t bufLen, SVDropTtlTableReq if (tStartEncode(&encoder) < 0) return -1; if (tEncodeI32(&encoder, pReq->timestampSec) < 0) return -1; + if (tEncodeI32(&encoder, pReq->ttlDropMaxCount) < 0) return -1; + if (tEncodeI32(&encoder, pReq->nUids) < 0) return -1; + for (int32_t i = 0; i < pReq->nUids; ++i) { + tb_uid_t *pTbUid = taosArrayGet(pReq->pTbUids, i); + if (tEncodeI64(&encoder, *pTbUid) < 0) return -1; + } tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -3192,6 +3198,30 @@ int32_t tDeserializeSVDropTtlTableReq(void *buf, int32_t bufLen, SVDropTtlTableR if (tStartDecode(&decoder) < 0) return -1; if (tDecodeI32(&decoder, &pReq->timestampSec) < 0) return -1; + pReq->ttlDropMaxCount = INT32_MAX; + pReq->nUids = 0; + pReq->pTbUids = NULL; + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI32(&decoder, &pReq->ttlDropMaxCount) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->nUids) < 0) return -1; + + if (pReq->nUids > 0) { + pReq->pTbUids = taosArrayInit(pReq->nUids, sizeof(tb_uid_t)); + if (pReq->pTbUids == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + + tb_uid_t tbUid = 0; + for (int32_t i = 0; i < pReq->nUids; ++i) { + if (tDecodeI64(&decoder, &tbUid) < 0) return -1; + if (taosArrayPush(pReq->pTbUids, &tbUid) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + } tEndDecode(&decoder); tDecoderClear(&decoder); diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 302d4dafd1..ae1b46a21d 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -33,10 +33,10 @@ int32_t mmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { return -1; } - SMnodeOpt option = {.deploy = true, .numOfReplicas = createReq.replica, - .numOfTotalReplicas = createReq.replica + createReq.learnerReplica, + SMnodeOpt option = {.deploy = true, .numOfReplicas = createReq.replica, + .numOfTotalReplicas = createReq.replica + createReq.learnerReplica, .selfIndex = -1, .lastIndex = createReq.lastIndex}; - + memcpy(option.replicas, createReq.replicas, sizeof(createReq.replicas)); for (int32_t i = 0; i < createReq.replica; ++i) { if (createReq.replicas[i].id == pInput->pData->dnodeId) { @@ -191,6 +191,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_VND_TRIM_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_SUBSCRIBE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 39285ced5d..917c6a00bc 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -1123,6 +1123,36 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { strcpy(dcfgReq.config, "keeptimeoffset"); snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); + } else if (strncasecmp(cfgReq.config, "ttlpushinterval", 14) == 0) { + int32_t optLen = strlen("ttlpushinterval"); + int32_t flag = -1; + int32_t code = mndMCfgGetValInt32(&cfgReq, optLen, &flag); + if (code < 0) return code; + + if (flag < 0 || flag > 100000) { + mError("dnode:%d, failed to config ttlPushInterval since value:%d. Valid range: [0, 100000]", cfgReq.dnodeId, + flag); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + + strcpy(dcfgReq.config, "ttlpushinterval"); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); + } else if (strncasecmp(cfgReq.config, "ttlbatchdropnum", 15) == 0) { + int32_t optLen = strlen("ttlbatchdropnum"); + int32_t flag = -1; + int32_t code = mndMCfgGetValInt32(&cfgReq, optLen, &flag); + if (code < 0) return code; + + if (flag < 0) { + mError("dnode:%d, failed to config ttlBatchDropNum since value:%d. Valid range: [0, %d]", cfgReq.dnodeId, + flag, INT32_MAX); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + + strcpy(dcfgReq.config, "ttlbatchdropnum"); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); #ifdef TD_ENTERPRISE } else if (strncasecmp(cfgReq.config, "activeCode", 10) == 0 || strncasecmp(cfgReq.config, "cActiveCode", 11) == 0) { int8_t opt = strncasecmp(cfgReq.config, "a", 1) == 0 ? DND_ACTIVE_CODE : DND_CONN_ACTIVE_CODE; @@ -1376,7 +1406,7 @@ static int32_t mndMCfgGetValInt32(SMCfgDnodeReq *pMCfgReq, int32_t opLen, int32_ return 0; _err: - mError("dnode:%d, failed to config keeptimeoffset since invalid conf:%s", pMCfgReq->dnodeId, pMCfgReq->config); + mError("dnode:%d, failed to config since invalid conf:%s", pMCfgReq->dnodeId, pMCfgReq->config); terrno = TSDB_CODE_INVALID_CFG; return -1; } diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index b28ad207ea..fd4ebf549f 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -119,6 +119,14 @@ static void mndPullupTtl(SMnode *pMnode) { tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); } +static void mndPullupTrimDb(SMnode *pMnode) { + mTrace("pullup trim"); + int32_t contLen = 0; + void *pReq = mndBuildTimerMsg(&contLen); + SRpcMsg rpcMsg = {.msgType = TDMT_MND_TRIM_DB_TIMER, .pCont = pReq, .contLen = contLen}; + tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); +} + static void mndCalMqRebalance(SMnode *pMnode) { mTrace("calc mq rebalance"); int32_t contLen = 0; @@ -255,10 +263,14 @@ static void *mndThreadFp(void *param) { if (lastTime % 10 != 0) continue; int64_t sec = lastTime / 10; - if (sec % tsTtlPushInterval == 0) { + if (sec % tsTtlPushIntervalSec == 0) { mndPullupTtl(pMnode); } + if (sec % tsTrimVDbIntervalSec == 0) { + mndPullupTrimDb(pMnode); + } + if (sec % tsTransPullupInterval == 0) { mndPullupTrans(pMnode); } @@ -661,7 +673,7 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { _OVER: if (pMsg->msgType == TDMT_MND_TMQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER || pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER || - pMsg->msgType == TDMT_MND_UPTIME_TIMER) { + pMsg->msgType == TDMT_MND_TRIM_DB_TIMER || pMsg->msgType == TDMT_MND_UPTIME_TIMER) { mTrace("timer not process since mnode restored:%d stopped:%d, sync restored:%d role:%s ", pMnode->restored, pMnode->stopped, state.restored, syncStr(state.state)); return -1; diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index c3899ec433..0d41650394 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -40,10 +40,12 @@ static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb); static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb); static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew); static int32_t mndProcessTtlTimer(SRpcMsg *pReq); +static int32_t mndProcessTrimDbTimer(SRpcMsg *pReq); static int32_t mndProcessCreateStbReq(SRpcMsg *pReq); static int32_t mndProcessAlterStbReq(SRpcMsg *pReq); static int32_t mndProcessDropStbReq(SRpcMsg *pReq); -static int32_t mndProcessDropTtltbReq(SRpcMsg *pReq); +static int32_t mndProcessDropTtltbRsp(SRpcMsg *pReq); +static int32_t mndProcessTrimDbRsp(SRpcMsg *pReq); static int32_t mndProcessTableMetaReq(SRpcMsg *pReq); static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); @@ -72,11 +74,13 @@ int32_t mndInitStb(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_ALTER_STB, mndProcessAlterStbReq); mndSetMsgHandle(pMnode, TDMT_MND_DROP_STB, mndProcessDropStbReq); mndSetMsgHandle(pMnode, TDMT_VND_CREATE_STB_RSP, mndTransProcessRsp); - mndSetMsgHandle(pMnode, TDMT_VND_DROP_TTL_TABLE_RSP, mndProcessDropTtltbReq); + mndSetMsgHandle(pMnode, TDMT_VND_DROP_TTL_TABLE_RSP, mndProcessDropTtltbRsp); + mndSetMsgHandle(pMnode, TDMT_VND_TRIM_RSP, mndProcessTrimDbRsp); mndSetMsgHandle(pMnode, TDMT_VND_ALTER_STB_RSP, mndTransProcessRsp); mndSetMsgHandle(pMnode, TDMT_VND_DROP_STB_RSP, mndTransProcessRsp); mndSetMsgHandle(pMnode, TDMT_MND_TABLE_META, mndProcessTableMetaReq); mndSetMsgHandle(pMnode, TDMT_MND_TTL_TIMER, mndProcessTtlTimer); + mndSetMsgHandle(pMnode, TDMT_MND_TRIM_DB_TIMER, mndProcessTrimDbTimer); mndSetMsgHandle(pMnode, TDMT_MND_TABLE_CFG, mndProcessTableCfgReq); // mndSetMsgHandle(pMnode, TDMT_MND_SYSTABLE_RETRIEVE, mndProcessRetrieveStbReq); @@ -919,11 +923,12 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; void *pIter = NULL; - SVDropTtlTableReq ttlReq = {.timestampSec = taosGetTimestampSec()}; - int32_t reqLen = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); - int32_t contLen = reqLen + sizeof(SMsgHead); + SVDropTtlTableReq ttlReq = { + .timestampSec = taosGetTimestampSec(), .ttlDropMaxCount = tsTtlBatchDropNum, .nUids = 0, .pTbUids = NULL}; + int32_t reqLen = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); + int32_t contLen = reqLen + sizeof(SMsgHead); - mInfo("start to process ttl timer"); + mDebug("start to process ttl timer"); while (1) { pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); @@ -936,7 +941,7 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { } pHead->contLen = htonl(contLen); pHead->vgId = htonl(pVgroup->vgId); - tSerializeSVDropTtlTableReq((char *)pHead + sizeof(SMsgHead), contLen, &ttlReq); + tSerializeSVDropTtlTableReq((char *)pHead + sizeof(SMsgHead), reqLen, &ttlReq); SRpcMsg rpcMsg = {.msgType = TDMT_VND_DROP_TTL_TABLE, .pCont = pHead, .contLen = contLen, .info = pReq->info}; SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup); @@ -944,7 +949,44 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { if (code != 0) { mError("vgId:%d, failed to send drop ttl table request to vnode since 0x%x", pVgroup->vgId, code); } else { - mInfo("vgId:%d, send drop ttl table request to vnode, time:%" PRId32, pVgroup->vgId, ttlReq.timestampSec); + mDebug("vgId:%d, send drop ttl table request to vnode, time:%" PRId32, pVgroup->vgId, ttlReq.timestampSec); + } + sdbRelease(pSdb, pVgroup); + } + + return 0; +} + +static int32_t mndProcessTrimDbTimer(SRpcMsg *pReq) { + SMnode *pMnode = pReq->info.node; + SSdb *pSdb = pMnode->pSdb; + SVgObj *pVgroup = NULL; + void *pIter = NULL; + SVTrimDbReq trimReq = {.timestamp = taosGetTimestampSec()}; + int32_t reqLen = tSerializeSVTrimDbReq(NULL, 0, &trimReq); + int32_t contLen = reqLen + sizeof(SMsgHead); + + while (1) { + pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); + if (pIter == NULL) break; + + SMsgHead *pHead = rpcMallocCont(contLen); + if (pHead == NULL) { + sdbCancelFetch(pSdb, pVgroup); + sdbRelease(pSdb, pVgroup); + continue; + } + pHead->contLen = htonl(contLen); + pHead->vgId = htonl(pVgroup->vgId); + tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), reqLen, &trimReq); + + SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen}; + SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup); + int32_t code = tmsgSendReq(&epSet, &rpcMsg); + if (code != 0) { + mError("vgId:%d, timer failed to send vnode-trim request to vnode since 0x%x", pVgroup->vgId, code); + } else { + mInfo("vgId:%d, timer send vnode-trim request to vnode, time:%d", pVgroup->vgId, trimReq.timestamp); } sdbRelease(pSdb, pVgroup); } @@ -2405,7 +2447,8 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName, return 0; } -static int32_t mndProcessDropTtltbReq(SRpcMsg *pRsp) { return 0; } +static int32_t mndProcessDropTtltbRsp(SRpcMsg *pRsp) { return 0; } +static int32_t mndProcessTrimDbRsp(SRpcMsg *pRsp) { return 0; } static int32_t mndProcessDropStbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; diff --git a/source/dnode/vnode/src/inc/metaTtl.h b/source/dnode/vnode/src/inc/metaTtl.h index 45faceb1ea..c2cd389dab 100644 --- a/source/dnode/vnode/src/inc/metaTtl.h +++ b/source/dnode/vnode/src/inc/metaTtl.h @@ -31,15 +31,14 @@ typedef enum DirtyEntryType { } DirtyEntryType; typedef struct STtlManger { - TdThreadRwlock lock; + TTB* pOldTtlIdx; // btree<{deleteTime, tuid}, NULL> - TTB* pOldTtlIdx; // btree<{deleteTime, tuid}, NULL> - - SHashObj* pTtlCache; // key: tuid, value: {ttl, ctime} - SHashObj* pDirtyUids; // dirty tuid + SHashObj* pTtlCache; // hash + SHashObj* pDirtyUids; // hash TTB* pTtlIdx; // btree<{deleteTime, tuid}, ttl> - char* logPrefix; + char* logPrefix; + int32_t flushThreshold; // max dirty entry number in memory. if -1, flush will not be triggered by write-ops } STtlManger; typedef struct { @@ -68,23 +67,24 @@ typedef struct { typedef struct { tb_uid_t uid; int64_t changeTimeMs; + TXN* pTxn; } STtlUpdCtimeCtx; typedef struct { tb_uid_t uid; int64_t changeTimeMs; int64_t ttlDays; + TXN* pTxn; } STtlUpdTtlCtx; typedef struct { tb_uid_t uid; - TXN* pTxn; int64_t ttlDays; + TXN* pTxn; } STtlDelTtlCtx; -int ttlMgrOpen(STtlManger** ppTtlMgr, TDB* pEnv, int8_t rollback, const char* logPrefix); +int ttlMgrOpen(STtlManger** ppTtlMgr, TDB* pEnv, int8_t rollback, const char* logPrefix, int32_t flushThreshold); void ttlMgrClose(STtlManger* pTtlMgr); -int ttlMgrPostOpen(STtlManger* pTtlMgr, void* pMeta); bool ttlMgrNeedUpgrade(TDB* pEnv); int ttlMgrUpgrade(STtlManger* pTtlMgr, void* pMeta); @@ -94,7 +94,7 @@ int ttlMgrDeleteTtl(STtlManger* pTtlMgr, const STtlDelTtlCtx* pDelCtx); int ttlMgrUpdateChangeTime(STtlManger* pTtlMgr, const STtlUpdCtimeCtx* pUpdCtimeCtx); int ttlMgrFlush(STtlManger* pTtlMgr, TXN* pTxn); -int ttlMgrFindExpired(STtlManger* pTtlMgr, int64_t timePointMs, SArray* pTbUids); +int ttlMgrFindExpired(STtlManger* pTtlMgr, int64_t timePointMs, SArray* pTbUids, int32_t ttlDropMaxCount); #ifdef __cplusplus } diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 50b8e625f9..be663c2be9 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -151,9 +151,10 @@ int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq, STableMetaRsp** pMetaRsp); int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids, int64_t* tbUid); int32_t metaTrimTables(SMeta* pMeta); -int metaTtlDropTable(SMeta* pMeta, int64_t timePointMs, SArray* tbUids); +void metaDropTables(SMeta* pMeta, SArray* tbUids); +int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tbUids, int32_t ttlDropMaxCount); int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp); -int metaUpdateChangeTime(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs); +int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs); SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock); STSchema* metaGetTbTSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock); int32_t metaGetTbTSchemaEx(SMeta* pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sver, STSchema** ppTSchema); diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 517d9692c7..3d445acd67 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -130,7 +130,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) { // open pTtlMgr ("ttlv1.idx") char logPrefix[128] = {0}; sprintf(logPrefix, "vgId:%d", TD_VID(pVnode)); - ret = ttlMgrOpen(&pMeta->pTtlMgr, pMeta->pEnv, 0, logPrefix); + ret = ttlMgrOpen(&pMeta->pTtlMgr, pMeta->pEnv, 0, logPrefix, tsTtlFlushThreshold); if (ret < 0) { metaError("vgId:%d, failed to open meta ttl index since %s", TD_VID(pVnode), tstrerror(terrno)); goto _err; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index f56837f759..9a298a4bb7 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -21,6 +21,7 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateTtl(SMeta *pMeta, const SMetaEntry *pME); +static int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs); static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateSuidIdx(SMeta *pMeta, const SMetaEntry *pME); @@ -842,9 +843,11 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi return 0; } -static void metaDropTables(SMeta *pMeta, SArray *tbUids) { +void metaDropTables(SMeta *pMeta, SArray *tbUids) { + if (taosArrayGetSize(tbUids) == 0) return; + metaWLock(pMeta); - for (int i = 0; i < TARRAY_SIZE(tbUids); ++i) { + for (int i = 0; i < taosArrayGetSize(tbUids); ++i) { tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUids, i); metaDropTableByUid(pMeta, uid, NULL); metaDebug("batch drop table:%" PRId64, uid); @@ -927,26 +930,23 @@ end: return code; } -int metaTtlDropTable(SMeta *pMeta, int64_t timePointMs, SArray *tbUids) { +int metaTtlFindExpired(SMeta *pMeta, int64_t timePointMs, SArray *tbUids, int32_t ttlDropMaxCount) { + metaWLock(pMeta); int ret = ttlMgrFlush(pMeta->pTtlMgr, pMeta->txn); if (ret != 0) { metaError("ttl failed to flush, ret:%d", ret); - return ret; + goto _err; } - ret = ttlMgrFindExpired(pMeta->pTtlMgr, timePointMs, tbUids); + ret = ttlMgrFindExpired(pMeta->pTtlMgr, timePointMs, tbUids, ttlDropMaxCount); if (ret != 0) { metaError("ttl failed to find expired table, ret:%d", ret); - return ret; - } - if (TARRAY_SIZE(tbUids) == 0) { - return 0; + goto _err; } - metaInfo("ttl find expired table count: %zu", TARRAY_SIZE(tbUids)); - - metaDropTables(pMeta, tbUids); - return 0; +_err: + metaULock(pMeta); + return ret; } static int metaBuildBtimeIdxKey(SBtimeIdxKey *btimeKey, const SMetaEntry *pME) { @@ -1326,10 +1326,10 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl metaSaveToSkmDb(pMeta, &entry); - metaULock(pMeta); - metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs); + metaULock(pMeta); + metaUpdateMetaRsp(uid, pAlterTbReq->tbName, pSchema, pMetaRsp); if (entry.pBuf) taosMemoryFree(entry.pBuf); @@ -1515,10 +1515,10 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid); metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid); - metaULock(pMeta); - metaUpdateChangeTime(pMeta, ctbEntry.uid, pAlterTbReq->ctimeMs); + metaULock(pMeta); + tDecoderClear(&dc1); tDecoderClear(&dc2); taosMemoryFree((void *)ctbEntry.ctbEntry.pTags); @@ -1630,10 +1630,10 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p // save to table db metaSaveToTbDb(pMeta, &entry); metaUpdateUidIdx(pMeta, &entry); - metaULock(pMeta); - metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs); + metaULock(pMeta); + tdbTbcClose(pTbDbc); tdbTbcClose(pUidIdxc); tDecoderClear(&dc); @@ -1981,7 +1981,7 @@ static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) { static int metaUpdateTtl(SMeta *pMeta, const SMetaEntry *pME) { if (pME->type != TSDB_CHILD_TABLE && pME->type != TSDB_NORMAL_TABLE) return 0; - STtlUpdTtlCtx ctx = {.uid = pME->uid}; + STtlUpdTtlCtx ctx = {.uid = pME->uid, .pTxn = pMeta->txn}; if (pME->type == TSDB_CHILD_TABLE) { ctx.ttlDays = pME->ctbEntry.ttlDays; ctx.changeTimeMs = pME->ctbEntry.btime; @@ -1993,7 +1993,7 @@ static int metaUpdateTtl(SMeta *pMeta, const SMetaEntry *pME) { return ttlMgrInsertTtl(pMeta->pTtlMgr, &ctx); } -int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { +static int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { if (!tsTtlChangeOnWrite) return 0; if (changeTimeMs <= 0) { @@ -2001,11 +2001,20 @@ int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { return TSDB_CODE_VERSION_NOT_COMPATIBLE; } - STtlUpdCtimeCtx ctx = {.uid = uid, .changeTimeMs = changeTimeMs}; + STtlUpdCtimeCtx ctx = {.uid = uid, .changeTimeMs = changeTimeMs, .pTxn = pMeta->txn}; return ttlMgrUpdateChangeTime(pMeta->pTtlMgr, &ctx); } +int metaUpdateChangeTimeWithLock(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { + if (!tsTtlChangeOnWrite) return 0; + + metaWLock(pMeta); + int ret = metaUpdateChangeTime(pMeta, uid, changeTimeMs); + metaULock(pMeta); + return ret; +} + static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) { SCtbIdxKey ctbIdxKey = {.suid = pME->ctbEntry.suid, .uid = pME->uid}; diff --git a/source/dnode/vnode/src/meta/metaTtl.c b/source/dnode/vnode/src/meta/metaTtl.c index 45f697258c..3c45982311 100644 --- a/source/dnode/vnode/src/meta/metaTtl.c +++ b/source/dnode/vnode/src/meta/metaTtl.c @@ -21,6 +21,13 @@ typedef struct { SMeta *pMeta; } SConvertData; +typedef struct { + int32_t ttlDropMaxCount; + int32_t count; + STtlIdxKeyV1 expiredKey; + SArray *pTbUids; +} STtlExpiredCtx; + static void ttlMgrCleanup(STtlManger *pTtlMgr); static int ttlMgrConvert(TTB *pOldTtlIdx, TTB *pNewTtlIdx, void *pMeta); @@ -31,15 +38,15 @@ static int ttlIdxKeyV1Cmpr(const void *pKey1, int kLen1, const void *pKey2, static int ttlMgrFillCache(STtlManger *pTtlMgr); static int32_t ttlMgrFillCacheOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, void *pTtlCache); static int32_t ttlMgrConvertOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, void *pConvertData); +static int32_t ttlMgrFindExpiredOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, + void *pExpiredInfo); -static int32_t ttlMgrWLock(STtlManger *pTtlMgr); -static int32_t ttlMgrRLock(STtlManger *pTtlMgr); -static int32_t ttlMgrULock(STtlManger *pTtlMgr); +static bool ttlMgrNeedFlush(STtlManger *pTtlMgr); const char *ttlTbname = "ttl.idx"; const char *ttlV1Tbname = "ttlv1.idx"; -int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *logPrefix) { +int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *logPrefix, int32_t flushThreshold) { int ret = TSDB_CODE_SUCCESS; int64_t startNs = taosGetTimestampNs(); @@ -55,6 +62,7 @@ int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *lo } strcpy(logBuffer, logPrefix); pTtlMgr->logPrefix = logBuffer; + pTtlMgr->flushThreshold = flushThreshold; ret = tdbTbOpen(ttlV1Tbname, TDB_VARIANT_LEN, TDB_VARIANT_LEN, ttlIdxKeyV1Cmpr, pEnv, &pTtlMgr->pTtlIdx, rollback); if (ret < 0) { @@ -66,8 +74,6 @@ int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *lo pTtlMgr->pTtlCache = taosHashInit(8192, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); pTtlMgr->pDirtyUids = taosHashInit(8192, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); - taosThreadRwlockInit(&pTtlMgr->lock, NULL); - ret = ttlMgrFillCache(pTtlMgr); if (ret < 0) { metaError("%s, failed to fill hash since %s", pTtlMgr->logPrefix, tstrerror(terrno)); @@ -130,6 +136,7 @@ int ttlMgrUpgrade(STtlManger *pTtlMgr, void *pMeta) { int64_t endNs = taosGetTimestampNs(); metaInfo("%s, ttl mgr upgrade end, hash size: %d, time consumed: %" PRId64 " ns", pTtlMgr->logPrefix, taosHashGetSize(pTtlMgr->pTtlCache), endNs - startNs); + _out: tdbTbClose(pTtlMgr->pOldTtlIdx); pTtlMgr->pOldTtlIdx = NULL; @@ -142,7 +149,6 @@ static void ttlMgrCleanup(STtlManger *pTtlMgr) { taosHashCleanup(pTtlMgr->pTtlCache); taosHashCleanup(pTtlMgr->pDirtyUids); tdbTbClose(pTtlMgr->pTtlIdx); - taosThreadRwlockDestroy(&pTtlMgr->lock); taosMemoryFree(pTtlMgr); } @@ -229,10 +235,25 @@ static int ttlMgrConvertOneEntry(const void *pKey, int keyLen, const void *pVal, } ret = 0; + _out: return ret; } +static int32_t ttlMgrFindExpiredOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, + void *pExpiredCtx) { + STtlExpiredCtx *pCtx = (STtlExpiredCtx *)pExpiredCtx; + if (pCtx->count >= pCtx->ttlDropMaxCount) return -1; + + int c = ttlIdxKeyV1Cmpr(&pCtx->expiredKey, sizeof(pCtx->expiredKey), pKey, keyLen); + if (c > 0) { + taosArrayPush(pCtx->pTbUids, &((STtlIdxKeyV1 *)pKey)->uid); + pCtx->count++; + } + + return c; +} + static int ttlMgrConvert(TTB *pOldTtlIdx, TTB *pNewTtlIdx, void *pMeta) { SMeta *meta = pMeta; @@ -255,8 +276,6 @@ int ttlMgrInsertTtl(STtlManger *pTtlMgr, const STtlUpdTtlCtx *updCtx) { STtlCacheEntry cacheEntry = {.ttlDays = updCtx->ttlDays, .changeTimeMs = updCtx->changeTimeMs}; STtlDirtyEntry dirtryEntry = {.type = ENTRY_TYPE_UPSERT}; - ttlMgrWLock(pTtlMgr); - int ret = taosHashPut(pTtlMgr->pTtlCache, &updCtx->uid, sizeof(updCtx->uid), &cacheEntry, sizeof(cacheEntry)); if (ret < 0) { metaError("%s, ttlMgr insert failed to update ttl cache since %s", pTtlMgr->logPrefix, tstrerror(terrno)); @@ -269,10 +288,13 @@ int ttlMgrInsertTtl(STtlManger *pTtlMgr, const STtlUpdTtlCtx *updCtx) { goto _out; } - ret = 0; -_out: - ttlMgrULock(pTtlMgr); + if (ttlMgrNeedFlush(pTtlMgr)) { + ttlMgrFlush(pTtlMgr, updCtx->pTxn); + } + ret = 0; + +_out: metaDebug("%s, ttl mgr insert ttl, uid: %" PRId64 ", ctime: %" PRId64 ", ttlDays: %" PRId64, pTtlMgr->logPrefix, updCtx->uid, updCtx->changeTimeMs, updCtx->ttlDays); @@ -281,7 +303,6 @@ _out: int ttlMgrDeleteTtl(STtlManger *pTtlMgr, const STtlDelTtlCtx *delCtx) { if (delCtx->ttlDays == 0) return 0; - ttlMgrWLock(pTtlMgr); STtlDirtyEntry dirtryEntry = {.type = ENTRY_TYPE_DEL}; @@ -291,18 +312,19 @@ int ttlMgrDeleteTtl(STtlManger *pTtlMgr, const STtlDelTtlCtx *delCtx) { goto _out; } - ret = 0; -_out: - ttlMgrULock(pTtlMgr); + if (ttlMgrNeedFlush(pTtlMgr)) { + ttlMgrFlush(pTtlMgr, delCtx->pTxn); + } + ret = 0; + +_out: metaDebug("%s, ttl mgr delete ttl, uid: %" PRId64, pTtlMgr->logPrefix, delCtx->uid); return ret; } int ttlMgrUpdateChangeTime(STtlManger *pTtlMgr, const STtlUpdCtimeCtx *pUpdCtimeCtx) { - ttlMgrWLock(pTtlMgr); - int ret = 0; STtlCacheEntry *oldData = taosHashGet(pTtlMgr->pTtlCache, &pUpdCtimeCtx->uid, sizeof(pUpdCtimeCtx->uid)); @@ -327,59 +349,35 @@ int ttlMgrUpdateChangeTime(STtlManger *pTtlMgr, const STtlUpdCtimeCtx *pUpdCtime goto _out; } - ret = 0; -_out: - ttlMgrULock(pTtlMgr); + if (ttlMgrNeedFlush(pTtlMgr)) { + ttlMgrFlush(pTtlMgr, pUpdCtimeCtx->pTxn); + } + ret = 0; + +_out: metaDebug("%s, ttl mgr update ctime, uid: %" PRId64 ", ctime: %" PRId64, pTtlMgr->logPrefix, pUpdCtimeCtx->uid, pUpdCtimeCtx->changeTimeMs); return ret; } -int ttlMgrFindExpired(STtlManger *pTtlMgr, int64_t timePointMs, SArray *pTbUids) { - ttlMgrRLock(pTtlMgr); +int ttlMgrFindExpired(STtlManger *pTtlMgr, int64_t timePointMs, SArray *pTbUids, int32_t ttlDropMaxCount) { + STtlIdxKeyV1 ttlKey = {.deleteTimeMs = timePointMs, .uid = INT64_MAX}; + STtlExpiredCtx expiredCtx = { + .ttlDropMaxCount = ttlDropMaxCount, .count = 0, .expiredKey = ttlKey, .pTbUids = pTbUids}; + return tdbTbTraversal(pTtlMgr->pTtlIdx, &expiredCtx, ttlMgrFindExpiredOneEntry); +} - TBC *pCur; - int ret = tdbTbcOpen(pTtlMgr->pTtlIdx, &pCur, NULL); - if (ret < 0) { - goto _out; - } - - STtlIdxKeyV1 ttlKey = {0}; - ttlKey.deleteTimeMs = timePointMs; - ttlKey.uid = INT64_MAX; - int c = 0; - tdbTbcMoveTo(pCur, &ttlKey, sizeof(ttlKey), &c); - if (c < 0) { - tdbTbcMoveToPrev(pCur); - } - - void *pKey = NULL; - int kLen = 0; - while (1) { - ret = tdbTbcPrev(pCur, &pKey, &kLen, NULL, NULL); - if (ret < 0) { - ret = 0; - break; - } - ttlKey = *(STtlIdxKeyV1 *)pKey; - taosArrayPush(pTbUids, &ttlKey.uid); - } - - tdbFree(pKey); - tdbTbcClose(pCur); - - ret = 0; -_out: - ttlMgrULock(pTtlMgr); - return ret; +static bool ttlMgrNeedFlush(STtlManger *pTtlMgr) { + return pTtlMgr->flushThreshold > 0 && taosHashGetSize(pTtlMgr->pDirtyUids) > pTtlMgr->flushThreshold; } int ttlMgrFlush(STtlManger *pTtlMgr, TXN *pTxn) { - ttlMgrWLock(pTtlMgr); + int64_t startNs = taosGetTimestampNs(); + int64_t endNs = startNs; - metaDebug("%s, ttl mgr flush start. dirty uids:%d", pTtlMgr->logPrefix, taosHashGetSize(pTtlMgr->pDirtyUids)); + metaTrace("%s, ttl mgr flush start. dirty uids:%d", pTtlMgr->logPrefix, taosHashGetSize(pTtlMgr->pDirtyUids)); int ret = -1; @@ -430,40 +428,10 @@ int ttlMgrFlush(STtlManger *pTtlMgr, TXN *pTxn) { taosHashClear(pTtlMgr->pDirtyUids); ret = 0; + _out: - ttlMgrULock(pTtlMgr); - - metaDebug("%s, ttl mgr flush end.", pTtlMgr->logPrefix); - - return ret; -} - -static int32_t ttlMgrRLock(STtlManger *pTtlMgr) { - int32_t ret = 0; - - metaTrace("%s, ttlMgr rlock %p", pTtlMgr->logPrefix, &pTtlMgr->lock); - - ret = taosThreadRwlockRdlock(&pTtlMgr->lock); - - return ret; -} - -static int32_t ttlMgrWLock(STtlManger *pTtlMgr) { - int32_t ret = 0; - - metaTrace("%s, ttlMgr wlock %p", pTtlMgr->logPrefix, &pTtlMgr->lock); - - ret = taosThreadRwlockWrlock(&pTtlMgr->lock); - - return ret; -} - -static int32_t ttlMgrULock(STtlManger *pTtlMgr) { - int32_t ret = 0; - - metaTrace("%s, ttlMgr ulock %p", pTtlMgr->logPrefix, &pTtlMgr->lock); - - ret = taosThreadRwlockUnlock(&pTtlMgr->lock); + endNs = taosGetTimestampNs(); + metaTrace("%s, ttl mgr flush end, time consumed: %" PRId64 " ns", pTtlMgr->logPrefix, endNs - startNs); return ret; } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 52c36fcb1b..a9399e4db1 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -142,6 +142,74 @@ _exit: return code; } +static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) { + int32_t code = TSDB_CODE_INVALID_MSG; + int32_t lino = 0; + + SMsgHead *pContOld = pMsg->pCont; + int32_t reqLenOld = pMsg->contLen - sizeof(SMsgHead); + + SArray *tbUids = NULL; + int64_t timestampMs = 0; + + SVDropTtlTableReq ttlReq = {0}; + if (tDeserializeSVDropTtlTableReq((char *)pContOld + sizeof(SMsgHead), reqLenOld, &ttlReq) != 0) { + code = TSDB_CODE_INVALID_MSG; + TSDB_CHECK_CODE(code, lino, _exit); + } + + { // find expired uids + tbUids = taosArrayInit(8, sizeof(int64_t)); + if (tbUids == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + timestampMs = (int64_t)ttlReq.timestampSec * 1000; + code = metaTtlFindExpired(pVnode->pMeta, timestampMs, tbUids, ttlReq.ttlDropMaxCount); + if (code != 0) { + code = TSDB_CODE_INVALID_MSG; + TSDB_CHECK_CODE(code, lino, _exit); + } + + ttlReq.nUids = taosArrayGetSize(tbUids); + ttlReq.pTbUids = tbUids; + } + + { // prepare new content + int32_t reqLenNew = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); + int32_t contLenNew = reqLenNew + sizeof(SMsgHead); + + SMsgHead *pContNew = rpcMallocCont(contLenNew); + if (pContNew == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + tSerializeSVDropTtlTableReq((char *)pContNew + sizeof(SMsgHead), reqLenNew, &ttlReq); + pContNew->contLen = htonl(reqLenNew); + pContNew->vgId = pContOld->vgId; + + rpcFreeCont(pContOld); + pMsg->pCont = pContNew; + pMsg->contLen = contLenNew; + } + + code = 0; + +_exit: + taosArrayDestroy(tbUids); + + if (code) { + vError("vgId:%d, %s:%d failed to preprocess drop ttl request since %s, msg type:%s", TD_VID(pVnode), __func__, lino, + tstrerror(code), TMSG_INFO(pMsg->msgType)); + } else { + vTrace("vgId:%d, %s done, timestampSec:%d, nUids:%d", TD_VID(pVnode), __func__, ttlReq.timestampSec, ttlReq.nUids); + } + + return code; +} + extern int64_t tsMaxKeyByPrecision[]; static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int64_t btimeMs, int64_t ctimeMs) { int32_t code = 0; @@ -371,6 +439,9 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) { case TDMT_VND_ALTER_TABLE: { code = vnodePreProcessAlterTableMsg(pVnode, pMsg); } break; + case TDMT_VND_DROP_TTL_TABLE: { + code = vnodePreProcessDropTtlMsg(pVnode, pMsg); + } break; case TDMT_VND_SUBMIT: { code = vnodePreProcessSubmitMsg(pVnode, pMsg); } break; @@ -405,10 +476,10 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg return -1; } - vDebug("vgId:%d, start to process write request %s, index:%" PRId64 ", applied:%" PRId64 - ", state.applyTerm:%" PRId64 ", conn.applyTerm:%" PRId64, - TD_VID(pVnode), TMSG_INFO(pMsg->msgType), ver, pVnode->state.applied, - pVnode->state.applyTerm, pMsg->info.conn.applyTerm); + vDebug("vgId:%d, start to process write request %s, index:%" PRId64 ", applied:%" PRId64 ", state.applyTerm:%" PRId64 + ", conn.applyTerm:%" PRId64, + TD_VID(pVnode), TMSG_INFO(pMsg->msgType), ver, pVnode->state.applied, pVnode->state.applyTerm, + pMsg->info.conn.applyTerm); ASSERT(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm); ASSERTS(pVnode->state.applied + 1 == ver, "applied:%" PRId64 ", ver:%" PRId64, pVnode->state.applied, ver); @@ -727,28 +798,27 @@ _exit: } static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp) { - SArray *tbUids = taosArrayInit(8, sizeof(int64_t)); - if (tbUids == NULL) return TSDB_CODE_OUT_OF_MEMORY; - SVDropTtlTableReq ttlReq = {0}; if (tDeserializeSVDropTtlTableReq(pReq, len, &ttlReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto end; } - vDebug("vgId:%d, drop ttl table req will be processed, time:%" PRId32, pVnode->config.vgId, ttlReq.timestampSec); - int32_t ret = metaTtlDropTable(pVnode->pMeta, (int64_t)ttlReq.timestampSec * 1000, tbUids); - if (ret != 0) { - goto end; - } - if (taosArrayGetSize(tbUids) > 0) { - tqUpdateTbUidList(pVnode->pTq, tbUids, false); + ASSERT(ttlReq.nUids == taosArrayGetSize(ttlReq.pTbUids)); + + if (ttlReq.nUids != 0) { + vInfo("vgId:%d, drop ttl table req will be processed, time:%d, ntbUids:%d", pVnode->config.vgId, + ttlReq.timestampSec, ttlReq.nUids); } - vnodeDoRetention(pVnode, ttlReq.timestampSec); + int ret = 0; + if (ttlReq.nUids > 0) { + metaDropTables(pVnode->pMeta, ttlReq.pTbUids); + tqUpdateTbUidList(pVnode->pTq, ttlReq.pTbUids, false); + } end: - taosArrayDestroy(tbUids); + taosArrayDestroy(ttlReq.pTbUids); return ret; } @@ -1482,7 +1552,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in code = tsdbInsertTableData(pVnode->pTsdb, ver, pSubmitTbData, &affectedRows); if (code) goto _exit; - code = metaUpdateChangeTime(pVnode->pMeta, pSubmitTbData->uid, pSubmitTbData->ctimeMs); + code = metaUpdateChangeTimeWithLock(pVnode->pMeta, pSubmitTbData->uid, pSubmitTbData->ctimeMs); if (code) goto _exit; pSubmitRsp->affectedRows += affectedRows; @@ -1739,7 +1809,7 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t ver, void *pRe TD_VID(pVnode), terrstr(), deleteReq.suid, uid, pOneReq->startTs, pOneReq->endTs); } - code = metaUpdateChangeTime(pVnode->pMeta, uid, deleteReq.ctimeMs); + code = metaUpdateChangeTimeWithLock(pVnode->pMeta, uid, deleteReq.ctimeMs); if (code < 0) { terrno = code; vError("vgId:%d, update change time error since %s, suid:%" PRId64 ", uid:%" PRId64 ", start ts:%" PRId64 @@ -1778,7 +1848,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in uint64_t uid = *(uint64_t *)taosArrayGet(pRes->uidList, iUid); code = tsdbDeleteTableData(pVnode->pTsdb, ver, pRes->suid, uid, pRes->skey, pRes->ekey); if (code) goto _err; - code = metaUpdateChangeTime(pVnode->pMeta, uid, pRes->ctimeMs); + code = metaUpdateChangeTimeWithLock(pVnode->pMeta, uid, pRes->ctimeMs); if (code) goto _err; } From a601cd21bd3f904f9628b40618a0b31cb488fc0e Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 23 Aug 2023 13:31:19 +0800 Subject: [PATCH 030/107] fix: alter stt_trigger bug --- source/dnode/vnode/src/tsdb/tsdbCommit2.c | 47 +++++++++++------------ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index afbe895721..d4cb63fb7b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -235,36 +235,33 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { return 0; } - ASSERT(TARRAY2_SIZE(committer->ctx->fset->lvlArr) == 1); + SSttLvl *lvl; + TARRAY2_FOREACH(committer->ctx->fset->lvlArr, lvl) { + STFileObj *fobj = NULL; + TARRAY2_FOREACH(lvl->fobjArr, fobj) { + SSttFileReader *sttReader; - SSttLvl *lvl = TARRAY2_FIRST(committer->ctx->fset->lvlArr); + SSttFileReaderConfig config = { + .tsdb = committer->tsdb, + .szPage = committer->szPage, + .file = fobj->f[0], + }; - ASSERT(lvl->level == 0); + code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader); + TSDB_CHECK_CODE(code, lino, _exit); - STFileObj *fobj = NULL; - TARRAY2_FOREACH(lvl->fobjArr, fobj) { - SSttFileReader *sttReader; + code = TARRAY2_APPEND(committer->sttReaderArray, sttReader); + TSDB_CHECK_CODE(code, lino, _exit); - SSttFileReaderConfig config = { - .tsdb = committer->tsdb, - .szPage = committer->szPage, - .file = fobj->f[0], - }; + STFileOp op = { + .optype = TSDB_FOP_REMOVE, + .fid = fobj->f->fid, + .of = fobj->f[0], + }; - code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader); - TSDB_CHECK_CODE(code, lino, _exit); - - code = TARRAY2_APPEND(committer->sttReaderArray, sttReader); - TSDB_CHECK_CODE(code, lino, _exit); - - STFileOp op = { - .optype = TSDB_FOP_REMOVE, - .fid = fobj->f->fid, - .of = fobj->f[0], - }; - - code = TARRAY2_APPEND(committer->fopArray, op); - TSDB_CHECK_CODE(code, lino, _exit); + code = TARRAY2_APPEND(committer->fopArray, op); + TSDB_CHECK_CODE(code, lino, _exit); + } } _exit: From 6b61da1a41eaeab0e56e1ec3bec40d4faf89573e Mon Sep 17 00:00:00 2001 From: liuyao <54liuyao@163.com> Date: Wed, 23 Aug 2023 15:34:46 +0800 Subject: [PATCH 031/107] reload semi session state --- source/libs/executor/src/timewindowoperator.c | 79 ++++++++++++++++--- 1 file changed, 70 insertions(+), 9 deletions(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 4f793d7064..37f737c2ce 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -3240,6 +3240,31 @@ static int32_t compactSessionWindow(SOperatorInfo* pOperator, SResultWindowInfo* return winNum; } +static void compactSessionSemiWindow(SOperatorInfo* pOperator, SResultWindowInfo* pCurWin) { + SExprSupp* pSup = &pOperator->exprSupp; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; + SStreamSessionAggOperatorInfo* pInfo = pOperator->info; + SResultRow* pCurResult = NULL; + int32_t numOfOutput = pOperator->exprSupp.numOfExprs; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + // Just look for the window behind StartIndex + while (1) { + SResultWindowInfo winInfo = {0}; + SStreamStateCur* pCur = getNextSessionWinInfo(pAggSup, NULL, pCurWin, &winInfo); + if (!IS_VALID_SESSION_WIN(winInfo) || !isInWindow(pCurWin, winInfo.sessionWin.win.skey, pAggSup->gap) || + !inWinRange(&pAggSup->winRange, &winInfo.sessionWin.win)) { + taosMemoryFree(winInfo.pOutputBuf); + pAPI->stateStore.streamStateFreeCur(pCur); + break; + } + pCurWin->sessionWin.win.ekey = TMAX(pCurWin->sessionWin.win.ekey, winInfo.sessionWin.win.ekey); + doDeleteSessionWindow(pAggSup, &winInfo.sessionWin); + pAPI->stateStore.streamStateFreeCur(pCur); + taosMemoryFree(winInfo.pOutputBuf); + } +} + int32_t saveSessionOutputBuf(SStreamAggSupporter* pAggSup, SResultWindowInfo* pWinInfo) { saveSessionDiscBuf(pAggSup->pState, &pWinInfo->sessionWin, pWinInfo->pOutputBuf, pAggSup->resultRowSize, &pAggSup->stateStore); pWinInfo->pOutputBuf = NULL; @@ -3417,9 +3442,9 @@ void doBuildDeleteDataBlock(SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlo } static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SSHashObj* pStUpdated) { - SExprSupp* pSup = &pOperator->exprSupp; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; + SExprSupp* pSup = &pOperator->exprSupp; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; int32_t size = taosArrayGetSize(pWinArray); SStreamSessionAggOperatorInfo* pInfo = pOperator->info; @@ -3446,6 +3471,7 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS int32_t code = getSessionWinBuf(pChAggSup, pCur, &childWin); if (code == TSDB_CODE_SUCCESS && !inWinRange(&pAggSup->winRange, &childWin.sessionWin.win)) { + releaseOutputBuf(pAggSup->pState, NULL, (SResultRow*)childWin.pOutputBuf, &pAggSup->stateStore); continue; } @@ -3454,6 +3480,7 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS setSessionOutputBuf(pAggSup, pWinKey->win.skey, pWinKey->win.ekey, pWinKey->groupId, &parentWin); code = initSessionOutputBuf(&parentWin, &pResult, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); if (code != TSDB_CODE_SUCCESS || pResult == NULL) { + releaseOutputBuf(pAggSup->pState, NULL, (SResultRow*)childWin.pOutputBuf, &pAggSup->stateStore); break; } } @@ -3464,7 +3491,9 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS compactFunctions(pSup->pCtx, pChild->exprSupp.pCtx, numOfOutput, pTaskInfo, &pInfo->twAggSup.timeWindowData); compactSessionWindow(pOperator, &parentWin, pStUpdated, NULL, true); saveResult(parentWin, pStUpdated); + releaseOutputBuf(pAggSup->pState, NULL, (SResultRow*)childWin.pOutputBuf, &pAggSup->stateStore); } else { + releaseOutputBuf(pAggSup->pState, NULL, (SResultRow*)childWin.pOutputBuf, &pAggSup->stateStore); break; } } @@ -3703,11 +3732,11 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { } void streamSessionReleaseState(SOperatorInfo* pOperator) { - if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION) { - SStreamSessionAggOperatorInfo* pInfo = pOperator->info; - int32_t resSize = taosArrayGetSize(pInfo->historyWins) * sizeof(SSessionKey); - pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_SESSION_OP_STATE_NAME, strlen(STREAM_SESSION_OP_STATE_NAME), pInfo->historyWins->pData, resSize); - } + SStreamSessionAggOperatorInfo* pInfo = pOperator->info; + int32_t resSize = taosArrayGetSize(pInfo->historyWins) * sizeof(SSessionKey); + pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_SESSION_OP_STATE_NAME, + strlen(STREAM_SESSION_OP_STATE_NAME), pInfo->historyWins->pData, + resSize); SOperatorInfo* downstream = pOperator->pDownstream[0]; if (downstream->fpSet.releaseStreamStateFn) { downstream->fpSet.releaseStreamStateFn(downstream); @@ -3719,6 +3748,33 @@ void resetWinRange(STimeWindow* winRange) { winRange->ekey = INT64_MAX; } +void streamSessionSemiReloadState(SOperatorInfo* pOperator) { + SStreamSessionAggOperatorInfo* pInfo = pOperator->info; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + resetWinRange(&pAggSup->winRange); + + SResultWindowInfo winInfo = {0}; + int32_t size = 0; + void* pBuf = NULL; + int32_t code = pAggSup->stateStore.streamStateGetInfo(pAggSup->pState, STREAM_SESSION_OP_STATE_NAME, + strlen(STREAM_SESSION_OP_STATE_NAME), &pBuf, &size); + int32_t num = size / sizeof(SSessionKey); + SSessionKey* pSeKeyBuf = (SSessionKey*) pBuf; + ASSERT(size == num * sizeof(SSessionKey)); + for (int32_t i = 0; i < num; i++) { + SResultWindowInfo winInfo = {0}; + setSessionOutputBuf(pAggSup, pSeKeyBuf[i].win.skey, pSeKeyBuf[i].win.ekey, pSeKeyBuf[i].groupId, &winInfo); + compactSessionSemiWindow(pOperator, &winInfo); + saveSessionOutputBuf(pAggSup, &winInfo); + } + taosMemoryFree(pBuf); + + SOperatorInfo* downstream = pOperator->pDownstream[0]; + if (downstream->fpSet.reloadStreamStateFn) { + downstream->fpSet.reloadStreamStateFn(downstream); + } +} + void streamSessionReloadState(SOperatorInfo* pOperator) { SStreamSessionAggOperatorInfo* pInfo = pOperator->info; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; @@ -3948,6 +4004,11 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { removeSessionResults(pInfo->pStDeleted, pInfo->pUpdated); tSimpleHashCleanup(pInfo->pStUpdated); pInfo->pStUpdated = NULL; + + if(pInfo->isHistoryOp) { + getMaxTsWins(pInfo->pUpdated, pInfo->historyWins); + } + initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; blockDataEnsureCapacity(pBInfo->pRes, pOperator->resultInfo.capacity); @@ -3996,8 +4057,8 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream blockDataEnsureCapacity(pInfo->pUpdateRes, 128); pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamSessionSemiAgg, NULL, destroyStreamSessionAggOperatorInfo, optrDefaultBufFn, NULL); + setOperatorStreamStateFn(pOperator, streamSessionReleaseState, streamSessionSemiReloadState); } - setOperatorStreamStateFn(pOperator, streamSessionReleaseState, streamSessionReloadState); setOperatorInfo(pOperator, name, pPhyNode->type, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->operatorType = pPhyNode->type; From f45d1c69b80f7ec1a69fcd8133526d05962d854e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 23 Aug 2023 16:17:52 +0800 Subject: [PATCH 032/107] fix: -t option and wal retention ci --- tests/system-test/0-others/walRetention.py | 38 +++++++++++----------- tools/shell/src/shellWebsocket.c | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/system-test/0-others/walRetention.py b/tests/system-test/0-others/walRetention.py index 5257b7644a..44e64ae5e7 100644 --- a/tests/system-test/0-others/walRetention.py +++ b/tests/system-test/0-others/walRetention.py @@ -161,9 +161,18 @@ class VNode : # get log size def getWalsSize(self): size = 0 + lastSize = 0 + max = -1 for walFile in self.walFiles: - size += walFile.fsize - + if self.canDelete(walFile) == False: + tdLog.info(f" calc vnode size {walFile.pathFile} size={walFile.fsize}") + size += walFile.fsize + if max < walFile.startVer: + max = walFile.startVer + lastSize = walFile.fsize + + size -= lastSize + tdLog.info(f" last file size need reduct . lastSize={lastSize}") return size # vnode @@ -183,7 +192,7 @@ class VNode : delTs = delTsLine.timestamp() for walFile in self.walFiles: mt = datetime.fromtimestamp(walFile.mtime) - info = f" {walFile.pathFile} mt={mt} line={delTsLine} start={walFile.startVer} snap={self.snapVer} end= {walFile.endVer}" + info = f" {walFile.pathFile} size={walFile.fsize} mt={mt} line={delTsLine} start={walFile.startVer} snap={self.snapVer} end= {walFile.endVer}" tdLog.info(info) if walFile.mtime < delTs and self.canDelete(walFile): # wait a moment then check file exist @@ -199,25 +208,16 @@ class VNode : if self.walSize == 0: return True + time.sleep(2) vnodeSize = self.getWalsSize() - if vnodeSize < self.walSize: - tdLog.info(f" wal size valid. {self.path} real = {vnodeSize} set = {self.walSize} ") + # need over 20% + if vnodeSize < self.walSize * 1.2: + tdLog.info(f" wal size valid. {self.path} real = {vnodeSize} set = {self.walSize} need over 20%") return True - # check valid - tdLog.info(f" wal size over set. {self.path} real = {vnodeSize} set = {self.walSize} ") - for walFile in self.walFiles: - if self.canDelete(walFile): - # wait a moment then check file exist - time.sleep(1) - if os.path.exists(walFile.pathFile): - tdLog.exit(f" wal file size over .\ - \n wal file = {walFile.pathFile}\ - \n snapVer = {self.snapVer}\ - \n real = {vnodeSize} bytes\ - \n set = {self.walSize} bytes") - return False - return True + # check over + tdLog.exit(f" wal size over set. {self.path} real = {vnodeSize} set = {self.walSize} ") + return False # insert by async diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index af7f13c69c..791e2c36ff 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -278,7 +278,7 @@ void shellRunSingleCommandWebsocketImp(char *command) { } if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { - fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); + fprintf(stderr, "Hint: use -T to increase the timeout in seconds\n"); } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) { shell.ws_conn = NULL; From 2aa47dd19101faf46e9de8136710fc118756ecda Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 23 Aug 2023 16:37:36 +0800 Subject: [PATCH 033/107] fix: walRetention modify info --- tests/system-test/0-others/walRetention.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/system-test/0-others/walRetention.py b/tests/system-test/0-others/walRetention.py index 44e64ae5e7..0fdeb84a5b 100644 --- a/tests/system-test/0-others/walRetention.py +++ b/tests/system-test/0-others/walRetention.py @@ -147,13 +147,13 @@ class VNode : if self.lastVer != -1 and ret: # first wal file ignore if walFile.startVer == self.firstVer: - tdLog.info(f" {walFile.pathFile} can del, but is first. snapVer={self.snapVer} firstVer={self.firstVer}") + tdLog.info(f" can del {walFile.pathFile}, but is first. snapVer={self.snapVer} firstVer={self.firstVer}") return False # ver in stay range smallVer = self.snapVer - self.walStayRange -1 if walFile.startVer >= smallVer: - tdLog.info(f" {walFile.pathFile} can del, but range not arrived. snapVer={self.snapVer} smallVer={smallVer}") + tdLog.info(f" can del {walFile.pathFile}, but range not arrived. snapVer={self.snapVer} smallVer={smallVer}") return False return ret @@ -165,14 +165,16 @@ class VNode : max = -1 for walFile in self.walFiles: if self.canDelete(walFile) == False: - tdLog.info(f" calc vnode size {walFile.pathFile} size={walFile.fsize}") + tdLog.info(f" calc vnode size {walFile.pathFile} size={walFile.fsize} startVer={walFile.startVer}") size += walFile.fsize if max < walFile.startVer: max = walFile.startVer lastSize = walFile.fsize - size -= lastSize - tdLog.info(f" last file size need reduct . lastSize={lastSize}") + + if lastSize > 0: + tdLog.info(f" last file size need reduct . lastSize={lastSize}") + size -= lastSize return size # vnode @@ -212,7 +214,7 @@ class VNode : vnodeSize = self.getWalsSize() # need over 20% if vnodeSize < self.walSize * 1.2: - tdLog.info(f" wal size valid. {self.path} real = {vnodeSize} set = {self.walSize} need over 20%") + tdLog.info(f" wal size valid. {self.path} real = {vnodeSize} set = {self.walSize}. allow over 20%.") return True # check over From 6a20420f0728c33165ca4e5495410f34d0cbe309 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 23 Aug 2023 16:41:29 +0800 Subject: [PATCH 034/107] feat: add minDiskFreeSize cfg --- cmake/apr-util_CMakeLists.txt.in | 2 +- include/common/tglobal.h | 1 + include/util/tdef.h | 18 +++++++++--------- source/common/src/tglobal.c | 15 ++++++++++----- source/libs/tfs/src/tfsTier.c | 6 ++++-- source/util/src/tconfig.c | 2 +- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/cmake/apr-util_CMakeLists.txt.in b/cmake/apr-util_CMakeLists.txt.in index 015084e710..a39100897b 100644 --- a/cmake/apr-util_CMakeLists.txt.in +++ b/cmake/apr-util_CMakeLists.txt.in @@ -11,7 +11,7 @@ ExternalProject_Add(aprutil-1 BUILD_IN_SOURCE TRUE BUILD_ALWAYS 1 #UPDATE_COMMAND "" - CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --with-apr=$ENV{HOME}/.cos-local.1 --without-expat + CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --with-apr=$ENV{HOME}/.cos-local.1 #CONFIGURE_COMMAND ./configure --with-apr=/usr/local/apr BUILD_COMMAND make INSTALL_COMMAND make install diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 5fd174e873..763c4ae6e7 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -161,6 +161,7 @@ extern char tsCompressor[]; // tfs extern int32_t tsDiskCfgNum; extern SDiskCfg tsDiskCfg[]; +extern int64_t tsMinDiskFreeSize; // udf extern bool tsStartUdfd; diff --git a/include/util/tdef.h b/include/util/tdef.h index 1e12f12087..e9ed47465a 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -200,7 +200,7 @@ typedef enum ELogicConditionType { #define TSDB_STREAM_NAME_LEN 193 // it is a null-terminated string #define TSDB_DB_NAME_LEN 65 #define TSDB_DB_FNAME_LEN (TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN + TSDB_NAME_DELIMITER_LEN) -#define TSDB_PRIVILEDGE_CONDITION_LEN 48*1024 +#define TSDB_PRIVILEDGE_CONDITION_LEN 48 * 1024 #define TSDB_FUNC_NAME_LEN 65 #define TSDB_FUNC_COMMENT_LEN 1024 * 1024 @@ -228,8 +228,8 @@ typedef enum ELogicConditionType { #define TSDB_MAX_SQL_SHOW_LEN 1024 #define TSDB_MAX_ALLOWED_SQL_LEN (1 * 1024 * 1024u) // sql length should be less than 1mb -#define TSDB_APP_NAME_LEN TSDB_UNI_LEN -#define TSDB_TB_COMMENT_LEN 1025 +#define TSDB_APP_NAME_LEN TSDB_UNI_LEN +#define TSDB_TB_COMMENT_LEN 1025 #define TSDB_COL_COMMENT_LEN 1025 #define TSDB_QUERY_ID_LEN 26 @@ -377,12 +377,12 @@ typedef enum ELogicConditionType { #define TSDB_MAX_STT_TRIGGER 1 #define TSDB_DEFAULT_SST_TRIGGER 1 #endif -#define TSDB_MIN_HASH_PREFIX (2 - TSDB_TABLE_NAME_LEN) -#define TSDB_MAX_HASH_PREFIX (TSDB_TABLE_NAME_LEN - 2) -#define TSDB_DEFAULT_HASH_PREFIX 0 -#define TSDB_MIN_HASH_SUFFIX (2 - TSDB_TABLE_NAME_LEN) -#define TSDB_MAX_HASH_SUFFIX (TSDB_TABLE_NAME_LEN - 2) -#define TSDB_DEFAULT_HASH_SUFFIX 0 +#define TSDB_MIN_HASH_PREFIX (2 - TSDB_TABLE_NAME_LEN) +#define TSDB_MAX_HASH_PREFIX (TSDB_TABLE_NAME_LEN - 2) +#define TSDB_DEFAULT_HASH_PREFIX 0 +#define TSDB_MIN_HASH_SUFFIX (2 - TSDB_TABLE_NAME_LEN) +#define TSDB_MAX_HASH_SUFFIX (TSDB_TABLE_NAME_LEN - 2) +#define TSDB_DEFAULT_HASH_SUFFIX 0 #define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1 #define TSDB_REP_DEF_DB_WAL_RET_PERIOD 3600 diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index e080c2d2ec..6879ea05da 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -186,6 +186,7 @@ int32_t tsCacheLazyLoadThreshold = 500; int32_t tsDiskCfgNum = 0; SDiskCfg tsDiskCfg[TFS_MAX_DISKS] = {0}; +int64_t tsMinDiskFreeSize = TFS_MIN_DISK_FREE_SIZE; // stream scheduler bool tsDeployOnSnode = true; @@ -239,8 +240,8 @@ bool tsDisableStream = false; int64_t tsStreamBufferSize = 128 * 1024 * 1024; int64_t tsCheckpointInterval = 3 * 60 * 60 * 1000; bool tsFilterScalarMode = false; -int32_t tsKeepTimeOffset = 0; // latency of data migration -int tsResolveFQDNRetryTime = 100; //seconds +int32_t tsKeepTimeOffset = 0; // latency of data migration +int tsResolveFQDNRetryTime = 100; // seconds char tsS3Endpoint[TSDB_FQDN_LEN] = ""; char tsS3AccessKey[TSDB_FQDN_LEN] = ""; @@ -305,9 +306,7 @@ int32_t taosSetS3Cfg(SConfig *pCfg) { return 0; } -struct SConfig *taosGetCfg() { - return tsCfg; -} +struct SConfig *taosGetCfg() { return tsCfg; } static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile, char *apolloUrl) { @@ -635,6 +634,11 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddString(pCfg, "s3Endpoint", tsS3Endpoint, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddString(pCfg, "s3BucketName", tsS3BucketName, CFG_SCOPE_SERVER) != 0) return -1; + // min free disk space used to check if the disk is full [50MB, 1GB] + if (cfgAddInt64(pCfg, "minDiskFreeSize", tsMinDiskFreeSize, TFS_MIN_DISK_FREE_SIZE, 1024 * 1024 * 1024, + CFG_SCOPE_SERVER) != 0) + return -1; + GRANT_CFG_ADD; return 0; } @@ -1034,6 +1038,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsMaxStreamBackendCache = cfgGetItem(pCfg, "maxStreamBackendCache")->i32; tsPQSortMemThreshold = cfgGetItem(pCfg, "pqSortMemThreshold")->i32; tsResolveFQDNRetryTime = cfgGetItem(pCfg, "resolveFQDNRetryTime")->i32; + tsMinDiskFreeSize = cfgGetItem(pCfg, "minDiskFreeSize")->i64; GRANT_CFG_GET; return 0; diff --git a/source/libs/tfs/src/tfsTier.c b/source/libs/tfs/src/tfsTier.c index 2ad021cbb5..a24e3cf021 100644 --- a/source/libs/tfs/src/tfsTier.c +++ b/source/libs/tfs/src/tfsTier.c @@ -16,6 +16,8 @@ #define _DEFAULT_SOURCE #include "tfsInt.h" +extern int64_t tsMinDiskFreeSize; + int32_t tfsInitTier(STfsTier *pTier, int32_t level) { memset(pTier, 0, sizeof(STfsTier)); @@ -114,7 +116,7 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) { if (pDisk == NULL) continue; - if (pDisk->size.avail < TFS_MIN_DISK_FREE_SIZE) continue; + if (pDisk->size.avail < tsMinDiskFreeSize) continue; retId = diskId; terrno = 0; @@ -132,7 +134,7 @@ void tfsPosNextId(STfsTier *pTier) { for (int32_t id = 1; id < pTier->ndisk; id++) { STfsDisk *pLDisk = pTier->disks[nextid]; STfsDisk *pDisk = pTier->disks[id]; - if (pDisk->size.avail > TFS_MIN_DISK_FREE_SIZE && pDisk->size.avail > pLDisk->size.avail) { + if (pDisk->size.avail > tsMinDiskFreeSize && pDisk->size.avail > pLDisk->size.avail) { nextid = id; } } diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 3681c7a423..848e977687 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -1019,7 +1019,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { code = cfgSetItem(pConfig, name, value, CFG_STYPE_APOLLO_URL); if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break; - + if (strcasecmp(name, "dataDir") == 0) { code = cfgSetTfsItem(pConfig, name, value, value2, value3, CFG_STYPE_APOLLO_URL); if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break; From 6877e33c8780faad28be232e493fa4f6907af690 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 23 Aug 2023 16:49:37 +0800 Subject: [PATCH 035/107] fix: query have error get time is last successful --- tools/shell/src/shellWebsocket.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index 791e2c36ff..ff2e5efdd4 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -373,8 +373,6 @@ void shellRunSingleCommandWebsocketImp(char *command) { } else { printf("Query interrupted, %d row(s) in set (%.6fs)\n", numOfRows, (et - st)/1E6); - printf("Execute: %.2f ms Network: %.2f ms Total: %.2f ms\n", - execute_time, net_time, total_time); } } printf("\n"); From 2d72543f69f768c83928a086d4f9d9db4bea67e6 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Wed, 23 Aug 2023 19:13:45 +0800 Subject: [PATCH 036/107] test:kill other process when start cases in windows --- tests/pytest/util/dnodes.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index e91d9d3f6b..cd873ca0f2 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -806,21 +806,33 @@ class TDDnodes: psCmd = "for /f %a in ('wmic process where \"name='taosd.exe'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): - print(processID) + print(f"pid of taosd.exe:{processID}") killCmd = "kill -9 %s > nul 2>&1" % processID os.system(killCmd) time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8").strip() + psCmd = "for /f %a in ('wmic process where \"name='tmq_sim.exe'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): - print(processID) + print(f"pid of tmq_sim.exe:{processID}") killCmd = "kill -9 %s > nul 2>&1" % processID os.system(killCmd) time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8").strip() + + psCmd = "for /f %a in ('wmic process where \"name='taosBenchmark.exe'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + while(processID): + print(f"pid of taosBenchmark.exe:{processID}") + killCmd = "kill -9 %s > nul 2>&1" % processID + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8").strip() + else: psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() From bae7bee3896fa04587c8250331dbd64e55bb690d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 23 Aug 2023 23:59:24 +0800 Subject: [PATCH 037/107] fix error --- tests/system-test/2-query/union.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/union.py b/tests/system-test/2-query/union.py index e359164a4f..9086d7754d 100644 --- a/tests/system-test/2-query/union.py +++ b/tests/system-test/2-query/union.py @@ -191,7 +191,7 @@ class TDTestCase: if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): return "BIGINT UNSIGNED" - def union_check(self): + def union_check(self, dbname = "db"): sqls = self.sql_list() for i in range(len(sqls)): tdSql.query(sqls[i]) From 7b9d14aad369f244fe6449e7bf65b4c4a4fa5afc Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 24 Aug 2023 10:34:35 +0800 Subject: [PATCH 038/107] docs: add note to csharp connector docs (#22541) * docs: fix taos_init() return type * docs: refine c interface doc * docs: add platform note to csharp connector. --- docs/en/14-reference/03-connector/09-csharp.mdx | 4 ++++ docs/zh/08-connector/40-csharp.mdx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx index 718462295a..203d44fe02 100644 --- a/docs/en/14-reference/03-connector/09-csharp.mdx +++ b/docs/en/14-reference/03-connector/09-csharp.mdx @@ -30,6 +30,10 @@ The source code of `TDengine.Connector` is hosted on [GitHub](https://github.com The supported platforms are the same as those supported by the TDengine client driver. +:::note +Please note TDengine does not support 32bit Windows any more. +::: + ## Version support Please refer to [version support list](/reference/connector#version-support) diff --git a/docs/zh/08-connector/40-csharp.mdx b/docs/zh/08-connector/40-csharp.mdx index 3a945e77fd..325c71da88 100644 --- a/docs/zh/08-connector/40-csharp.mdx +++ b/docs/zh/08-connector/40-csharp.mdx @@ -29,6 +29,10 @@ import CSAsyncQuery from "../07-develop/04-query-data/_cs_async.mdx" 支æŒçš„å¹³å°å’Œ TDengine 客户端驱动支æŒçš„å¹³å°ä¸€è‡´ã€‚ +:::note +æ³¨æ„ TDengine ä¸å†æ”¯æŒ 32 ä½ Windows å¹³å°ã€‚ +::: + ## ç‰ˆæœ¬æ”¯æŒ è¯·å‚考[版本支æŒåˆ—表](../#版本支æŒ) From dda7b5dc7e18aad05d3b47fde9c82f578e9ec064 Mon Sep 17 00:00:00 2001 From: huolibo Date: Thu, 27 Jul 2023 16:52:08 +0800 Subject: [PATCH 039/107] feat(driver): add committed assignment API for jdbc --- .../jni/com_taosdata_jdbc_tmq_TMQConnector.h | 15 +++ source/client/src/clientTmqConnector.c | 108 +++++++++++++++++- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h b/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h index 422bcd57ac..ebc4eacdf9 100644 --- a/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h +++ b/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h @@ -92,6 +92,10 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscriptionIm */ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNIEnv *, jobject, jlong, jlong); +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAllSync(JNIEnv *, jobject, jlong); + +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitOffsetSyncImp(JNIEnv *, jobject, jlong, jstring, + jint, jlong); /* * Class: com_taosdata_jdbc_tmq_TMQConnector * Method: tmqCommitAsync @@ -102,6 +106,12 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JN JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAsync(JNIEnv *, jobject, jlong, jlong, jobject); +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAllAsync(JNIEnv *, jobject, jlong, + jobject); + +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitOffsetAsync(JNIEnv *, jobject, jlong, + jstring, jint, jlong, jobject); + /* * Class: com_taosdata_jdbc_tmq_TMQConnector * Method: tmqUnsubscribeImp @@ -179,6 +189,11 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSeekImp(JNIEnv JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssignmentImp(JNIEnv *, jobject, jlong, jstring, jobject); +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp(JNIEnv *, jobject, jlong, jstring, + jint); + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqPositionImp(JNIEnv *, jobject, jlong, jstring, jint); + #ifdef __cplusplus } #endif diff --git a/source/client/src/clientTmqConnector.c b/source/client/src/clientTmqConnector.c index 6ec82aa6ef..487a86a589 100644 --- a/source/client/src/clientTmqConnector.c +++ b/source/client/src/clientTmqConnector.c @@ -291,6 +291,39 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNI TAOS_RES *res = (TAOS_RES *)jres; return tmq_commit_sync(tmq, res); } +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAllSync(JNIEnv *env, jobject jobj, jlong jtmq) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniError("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + return tmq_commit_sync(tmq, NULL); +} + +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitOffsetSyncImp(JNIEnv *env, jobject jobj, + jlong jtmq, jstring jtopic, + jint vgId, jlong offset) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int code = tmq_commit_offset_sync(tmq, topicName, vgId, offset); + if (code != TSDB_CODE_SUCCESS) { + jniError("jobj:%p, tmq commit offset error, code:%d, msg:%s", jobj, code, tmq_err2str(code)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return code; +} // deprecated JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JNIEnv *env, jobject jobj, jlong jtmq, @@ -319,6 +352,27 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAsy tmq_commit_async(tmq, res, consumer_callback, offset); } +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAllAsync(JNIEnv *env, jobject jobj, + jlong jtmq, jobject offset) { + tmqGlobalMethod(env); + tmq_t *tmq = (tmq_t *)jtmq; + + offset = (*env)->NewGlobalRef(env, offset); + tmq_commit_async(tmq, NULL, consumer_callback, offset); +} + +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitOffsetAsync(JNIEnv *env, jobject jobj, + jlong jtmq, jstring jtopic, + jint vgId, jlong offset, + jobject callback) { + tmqGlobalMethod(env); + tmq_t *tmq = (tmq_t *)jtmq; + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + callback = (*env)->NewGlobalRef(env, callback); + tmq_commit_offset_async(tmq, topicName, vgId, offset, consumer_callback, callback); +} + JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqUnsubscribeImp(JNIEnv *env, jobject jobj, jlong jtmq) { tmq_t *tmq = (tmq_t *)jtmq; @@ -497,9 +551,9 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssign int32_t res = tmq_get_topic_assignment(tmq, topicName, &pAssign, &numOfAssignment); if (res != TSDB_CODE_SUCCESS) { - (*env)->ReleaseStringUTFChars(env, jtopic, topicName); jniError("jobj:%p, tmq get topic assignment error, topic:%s, code:%d, msg:%s", jobj, topicName, res, tmq_err2str(res)); + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); tmq_free_assignment(pAssign); return (jint)res; } @@ -518,3 +572,55 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssign tmq_free_assignment(pAssign); return JNI_SUCCESS; } + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp(JNIEnv *env, jobject jobj, jlong jtmq, + jstring jtopic, jint vgId) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int64_t offset = tmq_committed(tmq, topicName, vgId); + + if (offset < JNI_SUCCESS) { + jniError("jobj:%p, tmq get committed offset error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, + vgId, offset, tmq_err2str(offset)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return (jlong)offset; +} + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqPositionImp(JNIEnv *env, jobject jobj, jlong jtmq, + jstring jtopic, jint vgId) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int64_t offset = tmq_position(tmq, topicName, vgId); + + if (offset < JNI_SUCCESS) { + jniError("jobj:%p, tmq get position error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, vgId, + offset, tmq_err2str(offset)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return (jlong)offset; +} \ No newline at end of file From a3d4d0c57e78c13d1e5806c24dadbb1ae30ae109 Mon Sep 17 00:00:00 2001 From: huolibo Date: Thu, 24 Aug 2023 10:55:41 +0800 Subject: [PATCH 040/107] fix: jni error log --- source/client/src/clientTmqConnector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientTmqConnector.c b/source/client/src/clientTmqConnector.c index 487a86a589..2bea738c23 100644 --- a/source/client/src/clientTmqConnector.c +++ b/source/client/src/clientTmqConnector.c @@ -590,7 +590,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp( int64_t offset = tmq_committed(tmq, topicName, vgId); - if (offset < JNI_SUCCESS) { + if (offset < JNI_SUCCESS && offset != -2147467247) { jniError("jobj:%p, tmq get committed offset error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, vgId, offset, tmq_err2str(offset)); } From ed70cd1f63fa876aa8c2523e348c262dd2883e40 Mon Sep 17 00:00:00 2001 From: huolibo Date: Thu, 24 Aug 2023 10:55:41 +0800 Subject: [PATCH 041/107] fix: jni error log --- source/client/src/clientTmqConnector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientTmqConnector.c b/source/client/src/clientTmqConnector.c index 487a86a589..2bea738c23 100644 --- a/source/client/src/clientTmqConnector.c +++ b/source/client/src/clientTmqConnector.c @@ -590,7 +590,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp( int64_t offset = tmq_committed(tmq, topicName, vgId); - if (offset < JNI_SUCCESS) { + if (offset < JNI_SUCCESS && offset != -2147467247) { jniError("jobj:%p, tmq get committed offset error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, vgId, offset, tmq_err2str(offset)); } From 171cf049bc75d63d42e0d0df9bff9264e1064605 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Thu, 24 Aug 2023 11:03:06 +0800 Subject: [PATCH 042/107] fix: new msg should be appended to segment tail --- include/common/tmsgdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 3be49361d2..323b2de6ba 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -65,7 +65,7 @@ enum { #define TD_NEW_MSG_SEG(TYPE) TYPE = ((TYPE##_SEG_CODE) << 8), #define TD_DEF_MSG_TYPE(TYPE, MSG, REQ, RSP) TYPE, TYPE##_RSP, -enum { +enum { // WARN: new msg should be appended to segment tail #endif TD_NEW_MSG_SEG(TDMT_DND_MSG) TD_DEF_MSG_TYPE(TDMT_DND_CREATE_MNODE, "dnode-create-mnode", NULL, NULL) @@ -156,7 +156,6 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_TELEM_TIMER, "telem-tmr", SMTimerReq, SMTimerReq) TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "trans-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TTL_TIMER, "ttl-tmr", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_TRIM_DB_TIMER, "trim-db-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_GRANT_HB_TIMER, "grant-hb-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_KILL_TRANS, "kill-trans", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_KILL_QUERY, "kill-query", NULL, NULL) @@ -183,6 +182,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_RESTORE_DNODE, "restore-dnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_PAUSE_STREAM, "pause-stream", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_RESUME_STREAM, "resume-stream", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_TRIM_DB_TIMER, "trim-db-tmr", NULL, NULL) TD_NEW_MSG_SEG(TDMT_VND_MSG) TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp) From 7ebce2814f365e721b9228d33dc974aeb06f5b5a Mon Sep 17 00:00:00 2001 From: liuyao <54liuyao@163.com> Date: Thu, 24 Aug 2023 11:18:10 +0800 Subject: [PATCH 043/107] mem leak --- source/libs/executor/src/filloperator.c | 1 + source/libs/executor/src/timewindowoperator.c | 3 +++ source/libs/stream/src/streamBackendRocksdb.c | 19 +++++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index be4cb8d2dc..bf7da7505a 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -851,6 +851,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS if (hasPrevWindow(pFillSup)) { setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; + resetFillWindow(&pFillSup->next); pFillSup->next.key = pFillSup->cur.key; pFillSup->next.pRowVal = pFillSup->cur.pRowVal; pFillInfo->preRowKey = INT64_MIN; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 37f737c2ce..16eaf0649d 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2905,6 +2905,7 @@ void destroyStreamSessionAggOperatorInfo(void* param) { SStreamSessionAggOperatorInfo* pInfo = (SStreamSessionAggOperatorInfo*)param; cleanupBasicInfo(&pInfo->binfo); destroyStreamAggSupporter(&pInfo->streamAggSup); + cleanupExprSupp(&pInfo->scalarSupp); if (pInfo->pChildren != NULL) { int32_t size = taosArrayGetSize(pInfo->pChildren); @@ -4096,6 +4097,7 @@ void destroyStreamStateOperatorInfo(void* param) { cleanupBasicInfo(&pInfo->binfo); destroyStreamAggSupporter(&pInfo->streamAggSup); cleanupGroupResInfo(&pInfo->groupResInfo); + cleanupExprSupp(&pInfo->scalarSupp); if (pInfo->pChildren != NULL) { int32_t size = taosArrayGetSize(pInfo->pChildren); for (int32_t i = 0; i < size; i++) { @@ -4109,6 +4111,7 @@ void destroyStreamStateOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); tSimpleHashCleanup(pInfo->pSeUpdated); tSimpleHashCleanup(pInfo->pSeDeleted); + pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated); taosMemoryFreeClear(param); } diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 4a0ce81e68..1981cd76b3 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -1620,19 +1620,22 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* if (len < 0) { return -1; } + + if (pVLen != NULL) *pVLen = len; + + if (pKTmp->opNum != pCur->number) { + taosMemoryFree(val); + return -1; + } + if (pKey->groupId != 0 && pKey->groupId != pKTmp->key.groupId) { + taosMemoryFree(val); + return -1; + } if (pVal != NULL) { *pVal = (char*)val; } else { taosMemoryFree(val); } - if (pVLen != NULL) *pVLen = len; - - if (pKTmp->opNum != pCur->number) { - return -1; - } - if (pKey->groupId != 0 && pKey->groupId != pKTmp->key.groupId) { - return -1; - } *pKey = pKTmp->key; return 0; } From 08fc2d1eb53f5931560ce687527ef98d2d9c908a Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 24 Aug 2023 11:29:15 +0800 Subject: [PATCH 044/107] add doc for column comment --- docs/en/12-taos-sql/03-table.md | 7 +++++-- docs/zh/12-taos-sql/03-table.md | 12 +++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/en/12-taos-sql/03-table.md b/docs/en/12-taos-sql/03-table.md index 10c44848c9..b84c17bfac 100644 --- a/docs/en/12-taos-sql/03-table.md +++ b/docs/en/12-taos-sql/03-table.md @@ -91,12 +91,15 @@ ALTER TABLE [db_name.]tb_name alter_table_clause alter_table_clause: { alter_table_options - | ADD COLUMN col_name column_type + | ADD COLUMN col_name column_definition | DROP COLUMN col_name - | MODIFY COLUMN col_name column_type + | MODIFY COLUMN col_name column_definition | RENAME COLUMN old_col_name new_col_name } +column_definition: + type_name [comment 'string_value'] + alter_table_options: alter_table_option ... diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md index 9258258263..f5540aeb63 100644 --- a/docs/zh/12-taos-sql/03-table.md +++ b/docs/zh/12-taos-sql/03-table.md @@ -23,7 +23,10 @@ create_subtable_clause: { } create_definition: - col_name column_type + col_name column_definition + +column_definition: + type_name [comment 'string_value'] table_options: table_option ... @@ -89,12 +92,15 @@ ALTER TABLE [db_name.]tb_name alter_table_clause alter_table_clause: { alter_table_options - | ADD COLUMN col_name column_type + | ADD COLUMN col_name column_definition | DROP COLUMN col_name - | MODIFY COLUMN col_name column_type + | MODIFY COLUMN col_name column_definition | RENAME COLUMN old_col_name new_col_name } +column_definition: + type_name [comment 'string_value'] + alter_table_options: alter_table_option ... From 1e108c4178bd6cc4051e2715c9d063b90b8da4ca Mon Sep 17 00:00:00 2001 From: liuyao <54liuyao@163.com> Date: Thu, 24 Aug 2023 11:34:43 +0800 Subject: [PATCH 045/107] mem leak --- source/libs/stream/src/streamBackendRocksdb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 1981cd76b3..571aca9935 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -1613,6 +1613,9 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* const char* curKey = rocksdb_iter_key(pCur->iter, (size_t*)&kLen); stateSessionKeyDecode((void*)&ktmp, (char*)curKey); + if (pVal != NULL) *pVal = NULL; + if (pVLen != NULL) *pVLen = 0; + SStateSessionKey* pKTmp = &ktmp; const char* vval = rocksdb_iter_value(pCur->iter, (size_t*)&vLen); char* val = NULL; @@ -1621,8 +1624,6 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* return -1; } - if (pVLen != NULL) *pVLen = len; - if (pKTmp->opNum != pCur->number) { taosMemoryFree(val); return -1; @@ -1631,11 +1632,14 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* taosMemoryFree(val); return -1; } + if (pVal != NULL) { *pVal = (char*)val; } else { taosMemoryFree(val); } + + if (pVLen != NULL) *pVLen = len; *pKey = pKTmp->key; return 0; } From 3c8bd57140463a8faf45db4c83fd0b3840c4ad42 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Wed, 23 Aug 2023 14:54:41 +0800 Subject: [PATCH 046/107] fix: fill operator with desc ts order returned 1 more rows --- source/libs/executor/src/filloperator.c | 1 + tests/system-test/2-query/fill_with_group.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index be4cb8d2dc..e8bdd37616 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -177,6 +177,7 @@ static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, i } // todo time window chosen problem: t or prev value? + if (t > pInfo->pFillInfo->start) t -= pInterval->sliding; taosFillUpdateStartTimestampInfo(pInfo->pFillInfo, t); } } diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py index c1ea9877a2..393102c8ed 100644 --- a/tests/system-test/2-query/fill_with_group.py +++ b/tests/system-test/2-query/fill_with_group.py @@ -130,9 +130,18 @@ class TDTestCase: for j in range(0,60): tdSql.checkData(i*1500+j, 1, None) + def test_fill_with_order_by(self): + sql = "select _wstart, _wend, count(ts), sum(c1) from meters where ts > '2018-11-25 00:00:00.000' and ts < '2018-11-26 00:00:00.00' interval(1d) fill(NULL) order by _wstart" + tdSql.query(sql) + tdSql.checkRows(1) + sql = "select _wstart, _wend, count(ts), sum(c1) from meters where ts > '2018-11-25 00:00:00.000' and ts < '2018-11-26 00:00:00.00' interval(1d) fill(NULL) order by _wstart desc" + tdSql.query(sql) + tdSql.checkRows(1) + def run(self): self.prepareTestEnv() self.test_partition_by_with_interval_fill_prev_new_group_fill_error() + self.test_fill_with_order_by() def stop(self): tdSql.close() From f36cff8d7d9346d53c529904c8b05520d49350c6 Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 24 Aug 2023 13:33:02 +0800 Subject: [PATCH 047/107] fix: taoslog file num limit on windows --- source/util/src/tlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 4a15b5b976..a431b091ec 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -384,7 +384,7 @@ static void taosGetLogFileName(char *fn) { } static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { -#ifdef WINDOWS +#ifdef WINDOWS_STASH /* * always set maxFileNum to 1 * means client log filename is unique in windows From 7fad1de84135696de20d2b0ea31aef8cc6b307e1 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 24 Aug 2023 13:38:41 +0800 Subject: [PATCH 048/107] Revert "feat: show create table, desc table with col comments" This reverts commit 16754b5ac166380677927960bed6b014fed2d48d. --- include/libs/nodes/cmdnodes.h | 9 ++++----- source/common/src/tmsg.c | 4 ++-- source/dnode/vnode/src/vnd/vnodeQuery.c | 2 +- source/libs/command/src/command.c | 23 +++-------------------- source/libs/parser/src/parTranslater.c | 4 ---- tests/system-test/0-others/show.py | 9 --------- 6 files changed, 10 insertions(+), 41 deletions(-) diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index ff02070882..78b7f1babf 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -23,11 +23,10 @@ extern "C" { #include "query.h" #include "querynodes.h" -#define DESCRIBE_RESULT_COLS 5 -#define DESCRIBE_RESULT_FIELD_LEN (TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE) -#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE) -#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE) -#define DESCRIBE_RESULT_COL_COMMENT_LEN (TSDB_COL_COMMENT_LEN) +#define DESCRIBE_RESULT_COLS 4 +#define DESCRIBE_RESULT_FIELD_LEN (TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE) +#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE) +#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE) #define SHOW_CREATE_DB_RESULT_COLS 2 #define SHOW_CREATE_DB_RESULT_FIELD1_LEN (TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 27b6499497..6131b15e53 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2327,7 +2327,7 @@ int32_t tDeserializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) } int32_t totalCols = pRsp->numOfTags + pRsp->numOfColumns; - pRsp->pSchemas = taosMemoryCalloc(totalCols, sizeof(SSchema)); + pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols); if (pRsp->pSchemas == NULL) return -1; for (int32_t i = 0; i < totalCols; ++i) { @@ -3740,7 +3740,7 @@ static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) { int32_t totalCols = pRsp->numOfTags + pRsp->numOfColumns; if (totalCols > 0) { - pRsp->pSchemas = taosMemoryCalloc(totalCols, sizeof(SSchema)); + pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols); if (pRsp->pSchemas == NULL) return -1; for (int32_t i = 0; i < totalCols; ++i) { diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 95404ee9f2..1554d58d56 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -216,7 +216,7 @@ int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { cfgRsp.numOfTags = schemaTag.nCols; cfgRsp.numOfColumns = schema.nCols; - cfgRsp.pSchemas = (SSchema *)taosMemoryCalloc(cfgRsp.numOfColumns + cfgRsp.numOfTags, sizeof(SSchema)); + cfgRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (cfgRsp.numOfColumns + cfgRsp.numOfTags)); memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols); if (schemaTag.nCols) { diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 1fa97904e4..921ec41021 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -78,10 +78,6 @@ static int32_t buildDescResultDataBlock(SSDataBlock** pOutput) { infoData = createColumnInfoData(TSDB_DATA_TYPE_VARCHAR, DESCRIBE_RESULT_NOTE_LEN, 4); code = blockDataAppendColInfo(pBlock, &infoData); } - if (TSDB_CODE_SUCCESS == code) { - infoData = createColumnInfoData(TSDB_DATA_TYPE_VARCHAR, DESCRIBE_RESULT_COL_COMMENT_LEN, 5); - code = blockDataAppendColInfo(pBlock, &infoData); - } if (TSDB_CODE_SUCCESS == code) { *pOutput = pBlock; @@ -103,9 +99,7 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, SColumnInfoData* pCol3 = taosArrayGet(pBlock->pDataBlock, 2); // Note SColumnInfoData* pCol4 = taosArrayGet(pBlock->pDataBlock, 3); - // Comment - SColumnInfoData* pCol5 = taosArrayGet(pBlock->pDataBlock, 4); - char buf[DESCRIBE_RESULT_COL_COMMENT_LEN + VARSTR_HEADER_SIZE] = {0}; + char buf[DESCRIBE_RESULT_FIELD_LEN] = {0}; for (int32_t i = 0; i < numOfRows; ++i) { if (invisibleColumn(sysInfoUser, pMeta->tableType, pMeta->schema[i].flags)) { continue; @@ -118,8 +112,6 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, colDataSetVal(pCol3, pBlock->info.rows, (const char*)&bytes, false); STR_TO_VARSTR(buf, i >= pMeta->tableInfo.numOfColumns ? "TAG" : ""); colDataSetVal(pCol4, pBlock->info.rows, buf, false); - STR_TO_VARSTR(buf, pMeta->schema[i].comment); - colDataSetVal(pCol5, pBlock->info.rows, buf, false); ++(pBlock->info.rows); } if (pBlock->info.rows <= 0) { @@ -464,19 +456,14 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) { for (int32_t i = 0; i < pCfg->numOfColumns; ++i) { SSchema* pSchema = pCfg->pSchemas + i; char type[32]; - char comments[TSDB_COL_COMMENT_LEN + 16] = {0}; sprintf(type, "%s", tDataTypes[pSchema->type].name); if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } - if (pSchema->comment[0]) { - sprintf(comments, " COMMENT '%s'", pSchema->comment); - } - *len += - sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s%s", ((i > 0) ? ", " : ""), pSchema->name, type, comments); + *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type); } } @@ -484,18 +471,14 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) { for (int32_t i = 0; i < pCfg->numOfTags; ++i) { SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i; char type[32]; - char comments[TSDB_COL_COMMENT_LEN + 16] = {0}; sprintf(type, "%s", tDataTypes[pSchema->type].name); if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } - if (pSchema->comment[0]) { - sprintf(comments, " COMMENT '%s'", pSchema->comment); - } - *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s%s", ((i > 0) ? ", " : ""), pSchema->name, type, comments); + *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type); } } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 473d177066..3288538af3 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -7699,10 +7699,6 @@ static int32_t extractDescribeResultSchema(int32_t* numOfCols, SSchema** pSchema (*pSchema)[3].bytes = DESCRIBE_RESULT_NOTE_LEN; strcpy((*pSchema)[3].name, "note"); - (*pSchema)[4].type = TSDB_DATA_TYPE_BINARY; - (*pSchema)[4].bytes = DESCRIBE_RESULT_COL_COMMENT_LEN; - strcpy((*pSchema)[4].name, "comment"); - return TSDB_CODE_SUCCESS; } diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index d9cc4895b1..864c3e8a31 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -222,15 +222,6 @@ class TDTestCase: tdSql.query('show create table super_table') create_sql = "create stable `super_table` (`ts` timestamp, `c2` int) tags (`tg` int)" tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - tdSql.query("desc normal_table") - tdSql.checkCols(5) - tdSql.checkData(0, 4, "") - - tdSql.query("desc super_table") - tdSql.checkCols(5) - tdSql.checkData(0, 4, "") - tdSql.execute("drop database comment_test_db") def alter_table_with_col_comment(self): From c2af41d0d0971e80ea0a9a8642724ffe269de2c9 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 24 Aug 2023 13:42:51 +0800 Subject: [PATCH 049/107] Revert "feat: support alter table add column with comment" This reverts commit cb027cc5c53ad481d9b401f0b742e5542770b5d9. --- include/common/tmsg.h | 3 - include/libs/nodes/cmdnodes.h | 1 - source/libs/parser/inc/parAst.h | 3 +- source/libs/parser/inc/sql.y | 8 +- source/libs/parser/src/parAstCreater.c | 12 +- source/libs/parser/src/parTranslater.c | 18 - source/libs/parser/src/sql.c | 1704 ++++++++++++------------ tests/system-test/0-others/show.py | 42 +- 8 files changed, 848 insertions(+), 943 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 21cad322bb..20a39a5fb3 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2633,9 +2633,6 @@ typedef struct { int8_t type; int8_t flags; int32_t bytes; - bool hasColComment; - char* colComment; - int32_t colCommentLen; // TSDB_ALTER_TABLE_DROP_COLUMN // TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES int8_t colModType; diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 78b7f1babf..b6c4e89a33 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -214,7 +214,6 @@ typedef struct SAlterTableStmt { char newColName[TSDB_COL_NAME_LEN]; STableOptions* pOptions; SDataType dataType; - char colComment[TSDB_COL_COMMENT_LEN]; SValueNode* pVal; } SAlterTableStmt; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index d24bb1db4f..4a6dee4fe3 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -173,7 +173,8 @@ SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNod SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables); SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable); SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions); -SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SNode* pColDefNode); +SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, + SDataType dataType); SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName); SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName, SToken* pNewColName); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 2501ae8504..a86666ec98 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -312,17 +312,17 @@ 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_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, C); } + full_table_name(B) ADD COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D); } 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_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, C); } + full_table_name(B) MODIFY COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &C, D); } alter_table_clause(A) ::= full_table_name(B) RENAME COLUMN column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &C, &D); } alter_table_clause(A) ::= - full_table_name(B) ADD TAG column_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_TAG, C); } + full_table_name(B) ADD TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_TAG, &C, D); } alter_table_clause(A) ::= full_table_name(B) DROP TAG column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_TAG, &C); } alter_table_clause(A) ::= - full_table_name(B) MODIFY TAG column_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, C); } + full_table_name(B) MODIFY TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &C, D); } alter_table_clause(A) ::= full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); } alter_table_clause(A) ::= diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index c51b442166..342c0f390e 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1457,15 +1457,17 @@ SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, return createAlterTableStmtFinalize(pRealTable, pStmt); } -SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SNode* pColDefNode) { +SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, + SDataType dataType) { CHECK_PARSER_STATUS(pCxt); - SColumnDefNode* pCol = (SColumnDefNode*)pColDefNode; + if (!checkColumnName(pCxt, pColName)) { + return NULL; + } SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; - strcpy(pStmt->colName, pCol->colName); - strcpy(pStmt->colComment, pCol->comments); - pStmt->dataType = pCol->dataType; + COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); + pStmt->dataType = dataType; return createAlterTableStmtFinalize(pRealTable, pStmt); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 3288538af3..70bd25dd2b 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8879,15 +8879,6 @@ 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->colComment[0]) { - pReq->colComment = taosStrdup(pStmt->colComment); - if (pReq->colComment == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pReq->colCommentLen = strlen(pReq->colComment); - } else { - pReq->colCommentLen = -1; - } return TSDB_CODE_SUCCESS; } @@ -8938,15 +8929,6 @@ static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt return TSDB_CODE_OUT_OF_MEMORY; } pReq->colId = pSchema->colId; - if (pStmt->colComment[0]) { - pReq->colComment = taosStrdup(pStmt->colComment); - if (pReq->colComment == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pReq->colCommentLen = strlen(pReq->colComment); - } else { - pReq->colCommentLen = -1; - } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a19b986732..bdc72592cc 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,3 +1,5 @@ +/* This file is automatically generated by Lemon from input grammar +** source file "./sql.y". */ /* ** 2000-05-29 ** @@ -22,10 +24,7 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ -#include -#include /************ Begin %include sections from the grammar ************************/ - #include #include #include @@ -42,11 +41,6 @@ #define YYSTACKDEPTH 0 /**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols -** in a format understandable to "makeheaders". This section is blank unless -** "lemon" is run with the "-m" command-line option. -***************** Begin makeheaders token definitions *************************/ -/**************** End makeheaders token definitions ***************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -140,18 +134,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 801 +#define YYNSTATE 805 #define YYNRULE 605 #define YYNRULE_WITH_ACTION 605 #define YYNTOKEN 339 -#define YY_MAX_SHIFT 800 -#define YY_MIN_SHIFTREDUCE 1183 -#define YY_MAX_SHIFTREDUCE 1787 -#define YY_ERROR_ACTION 1788 -#define YY_ACCEPT_ACTION 1789 -#define YY_NO_ACTION 1790 -#define YY_MIN_REDUCE 1791 -#define YY_MAX_REDUCE 2395 +#define YY_MAX_SHIFT 804 +#define YY_MIN_SHIFTREDUCE 1187 +#define YY_MAX_SHIFTREDUCE 1791 +#define YY_ERROR_ACTION 1792 +#define YY_ACCEPT_ACTION 1793 +#define YY_NO_ACTION 1794 +#define YY_MIN_REDUCE 1795 +#define YY_MAX_REDUCE 2399 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -218,602 +212,586 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2957) +#define YY_ACTTAB_COUNT (2797) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 736, 2202, 2180, 2091, 738, 689, 1968, 2013, 1216, 38, - /* 10 */ 304, 669, 48, 46, 1714, 392, 2188, 1946, 2088, 676, - /* 20 */ 399, 255, 1559, 41, 40, 135, 2184, 47, 45, 44, - /* 30 */ 43, 42, 573, 1640, 2022, 1557, 689, 1968, 41, 40, - /* 40 */ 2220, 2163, 47, 45, 44, 43, 42, 1218, 2021, 1221, - /* 50 */ 1222, 2170, 1241, 705, 1240, 1584, 135, 2180, 2180, 666, - /* 60 */ 144, 149, 1635, 578, 2186, 396, 533, 140, 19, 534, - /* 70 */ 1827, 1959, 2189, 451, 699, 1565, 541, 666, 144, 534, - /* 80 */ 1827, 2184, 2184, 359, 2022, 1242, 688, 2201, 629, 2237, - /* 90 */ 380, 2366, 112, 2203, 709, 2205, 2206, 704, 2020, 699, - /* 100 */ 797, 689, 1968, 15, 185, 2135, 2290, 2091, 2372, 188, - /* 110 */ 395, 2286, 2153, 2367, 655, 181, 48, 46, 346, 2186, - /* 120 */ 2186, 193, 2089, 676, 399, 190, 1559, 1669, 1375, 699, - /* 130 */ 699, 1584, 221, 2320, 367, 2074, 536, 1640, 1834, 1557, - /* 140 */ 1642, 1643, 456, 2070, 1366, 734, 733, 732, 1370, 731, - /* 150 */ 1372, 1373, 730, 727, 250, 1381, 724, 1383, 1384, 721, - /* 160 */ 718, 715, 668, 186, 2298, 2299, 1635, 142, 2303, 51, - /* 170 */ 1615, 1625, 19, 169, 223, 1803, 1641, 1644, 536, 1565, - /* 180 */ 1834, 282, 2298, 665, 1670, 136, 664, 1585, 2366, 202, - /* 190 */ 688, 1560, 125, 1558, 62, 124, 123, 122, 121, 120, - /* 200 */ 119, 118, 117, 116, 797, 653, 188, 15, 2202, 530, - /* 210 */ 2367, 655, 52, 1784, 62, 666, 144, 528, 706, 674, - /* 220 */ 524, 520, 249, 1563, 1564, 1792, 1614, 1617, 1618, 1619, - /* 230 */ 1620, 1621, 1622, 1623, 1624, 701, 697, 1633, 1634, 1636, - /* 240 */ 1637, 1638, 1639, 2, 1642, 1643, 125, 2220, 550, 124, - /* 250 */ 123, 122, 121, 120, 119, 118, 117, 116, 2170, 1791, - /* 260 */ 705, 66, 37, 397, 1664, 1665, 1666, 1667, 1668, 1672, - /* 270 */ 1673, 1674, 1675, 404, 1615, 1625, 2015, 2017, 689, 1968, - /* 280 */ 1641, 1644, 649, 134, 133, 132, 131, 130, 129, 128, - /* 290 */ 127, 126, 1530, 1531, 2201, 1560, 2237, 1558, 56, 112, - /* 300 */ 2203, 709, 2205, 2206, 704, 644, 699, 1410, 1411, 147, - /* 310 */ 1586, 155, 2261, 2290, 746, 2202, 1783, 395, 2286, 187, - /* 320 */ 2298, 2299, 1584, 142, 2303, 669, 286, 1563, 1564, 428, - /* 330 */ 1614, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 701, - /* 340 */ 697, 1633, 1634, 1636, 1637, 1638, 1639, 2, 12, 48, - /* 350 */ 46, 286, 2371, 402, 2220, 2366, 168, 399, 372, 1559, - /* 360 */ 62, 1970, 163, 184, 1909, 2170, 1814, 705, 381, 286, - /* 370 */ 1640, 286, 1557, 2370, 675, 2009, 2020, 2367, 2369, 41, - /* 380 */ 40, 496, 614, 47, 45, 44, 43, 42, 462, 2070, - /* 390 */ 1565, 1587, 666, 144, 2202, 12, 650, 645, 638, 1635, - /* 400 */ 688, 2201, 737, 2237, 703, 19, 112, 2203, 709, 2205, - /* 410 */ 2206, 704, 1565, 699, 689, 1968, 2170, 1813, 185, 756, - /* 420 */ 2290, 689, 1968, 596, 395, 2286, 548, 373, 2084, 371, - /* 430 */ 370, 2305, 575, 2220, 449, 205, 577, 797, 606, 109, - /* 440 */ 15, 450, 212, 211, 2170, 2022, 705, 2321, 1870, 689, - /* 450 */ 1968, 389, 246, 48, 46, 1645, 145, 2302, 576, 2020, - /* 460 */ 2202, 399, 284, 1559, 1960, 495, 648, 2170, 599, 464, - /* 470 */ 706, 1318, 1468, 1469, 1640, 593, 1557, 1642, 1643, 1812, - /* 480 */ 2201, 245, 2237, 51, 1811, 340, 2203, 709, 2205, 2206, - /* 490 */ 704, 702, 699, 690, 2255, 2220, 189, 2298, 2299, 2220, - /* 500 */ 142, 2303, 181, 1635, 12, 433, 10, 1615, 1625, 538, - /* 510 */ 2170, 1320, 705, 1641, 1644, 535, 1565, 286, 591, 590, - /* 520 */ 589, 70, 2075, 2371, 69, 581, 141, 585, 1560, 2170, - /* 530 */ 1558, 584, 435, 431, 2170, 675, 583, 588, 375, 374, - /* 540 */ 1586, 797, 582, 262, 49, 1810, 2201, 2202, 2237, 647, - /* 550 */ 2053, 170, 2203, 709, 2205, 2206, 704, 706, 699, 1836, - /* 560 */ 1563, 1564, 90, 1614, 1617, 1618, 1619, 1620, 1621, 1622, - /* 570 */ 1623, 1624, 701, 697, 1633, 1634, 1636, 1637, 1638, 1639, - /* 580 */ 2, 1642, 1643, 591, 590, 589, 2220, 673, 1964, 2084, - /* 590 */ 581, 141, 585, 630, 2331, 2170, 584, 2170, 691, 705, - /* 600 */ 2262, 583, 588, 375, 374, 654, 700, 582, 2366, 689, - /* 610 */ 1968, 1615, 1625, 2022, 408, 407, 628, 1641, 1644, 365, - /* 620 */ 2016, 2017, 2022, 1789, 1777, 653, 188, 2020, 394, 479, - /* 630 */ 2367, 655, 1560, 2201, 1558, 2237, 2020, 1566, 112, 2203, - /* 640 */ 709, 2205, 2206, 704, 2370, 699, 689, 1968, 295, 296, - /* 650 */ 2386, 675, 2290, 294, 41, 40, 395, 2286, 47, 45, - /* 660 */ 44, 43, 42, 258, 1563, 1564, 480, 1614, 1617, 1618, - /* 670 */ 1619, 1620, 1621, 1622, 1623, 1624, 701, 697, 1633, 1634, - /* 680 */ 1636, 1637, 1638, 1639, 2, 48, 46, 689, 1968, 2202, - /* 690 */ 30, 654, 284, 399, 2366, 1559, 414, 1585, 1944, 706, - /* 700 */ 693, 413, 2262, 684, 1742, 2084, 1640, 549, 1557, 474, - /* 710 */ 2202, 653, 188, 103, 489, 2070, 2367, 655, 473, 90, - /* 720 */ 706, 1945, 62, 2022, 689, 1968, 41, 40, 2220, 403, - /* 730 */ 47, 45, 44, 43, 42, 1635, 369, 2020, 1961, 2170, - /* 740 */ 60, 705, 1809, 629, 1965, 1963, 2366, 626, 1565, 2220, - /* 750 */ 1754, 207, 641, 640, 1740, 1741, 1743, 1744, 1745, 605, - /* 760 */ 2170, 210, 705, 2372, 188, 746, 689, 1968, 2367, 655, - /* 770 */ 393, 577, 603, 797, 601, 2201, 49, 2237, 1970, 166, - /* 780 */ 171, 2203, 709, 2205, 2206, 704, 251, 699, 1808, 48, - /* 790 */ 46, 86, 2170, 576, 85, 1569, 2201, 399, 2237, 1559, - /* 800 */ 1910, 113, 2203, 709, 2205, 2206, 704, 1804, 699, 443, - /* 810 */ 1640, 442, 1557, 1642, 1643, 2290, 2305, 1485, 1486, 2289, - /* 820 */ 2286, 445, 1753, 41, 40, 2305, 444, 47, 45, 44, - /* 830 */ 43, 42, 2334, 656, 2387, 2202, 744, 1943, 2170, 1635, - /* 840 */ 1224, 441, 2301, 1615, 1625, 706, 1583, 689, 1968, 1641, - /* 850 */ 1644, 2300, 1565, 1484, 1487, 160, 159, 741, 740, 739, - /* 860 */ 157, 402, 689, 1968, 1560, 279, 1558, 672, 629, 1970, - /* 870 */ 166, 2366, 689, 1968, 2220, 689, 1968, 797, 146, 286, - /* 880 */ 15, 2261, 259, 742, 1718, 2170, 2013, 705, 2372, 188, - /* 890 */ 1584, 642, 299, 2367, 655, 686, 1563, 1564, 2063, 1614, - /* 900 */ 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 701, 697, - /* 910 */ 1633, 1634, 1636, 1637, 1638, 1639, 2, 1642, 1643, 1730, - /* 920 */ 139, 2201, 657, 2237, 587, 586, 113, 2203, 709, 2205, - /* 930 */ 2206, 704, 743, 699, 405, 2013, 744, 454, 14, 13, - /* 940 */ 2290, 2371, 1970, 166, 2366, 2287, 1807, 1615, 1625, 689, - /* 950 */ 1968, 1329, 744, 1641, 1644, 160, 159, 741, 740, 739, - /* 960 */ 157, 1711, 2370, 237, 1328, 2191, 2367, 2368, 1560, 687, - /* 970 */ 1558, 160, 159, 741, 740, 739, 157, 689, 1968, 173, - /* 980 */ 47, 45, 44, 43, 42, 1650, 1806, 567, 563, 559, - /* 990 */ 555, 1584, 236, 1241, 273, 1240, 2170, 305, 1244, 1245, - /* 1000 */ 1563, 1564, 1867, 1614, 1617, 1618, 1619, 1620, 1621, 1622, - /* 1010 */ 1623, 1624, 701, 697, 1633, 1634, 1636, 1637, 1638, 1639, - /* 1020 */ 2, 2193, 350, 167, 1582, 382, 1242, 1805, 325, 505, - /* 1030 */ 318, 487, 91, 1999, 503, 234, 2170, 502, 34, 1587, - /* 1040 */ 1616, 1683, 322, 73, 41, 40, 72, 9, 47, 45, - /* 1050 */ 44, 43, 42, 470, 54, 504, 3, 347, 41, 40, - /* 1060 */ 472, 1908, 47, 45, 44, 43, 42, 2164, 219, 515, - /* 1070 */ 513, 510, 774, 773, 772, 771, 411, 2170, 770, 769, - /* 1080 */ 148, 764, 763, 762, 761, 760, 759, 758, 162, 754, - /* 1090 */ 753, 752, 410, 409, 749, 748, 747, 176, 175, 44, - /* 1100 */ 43, 42, 757, 233, 227, 1930, 368, 1587, 62, 36, - /* 1110 */ 232, 546, 689, 1968, 629, 41, 40, 2366, 458, 47, - /* 1120 */ 45, 44, 43, 42, 1671, 1802, 569, 568, 83, 225, - /* 1130 */ 137, 1559, 406, 1333, 2372, 188, 1584, 1801, 658, 2367, - /* 1140 */ 655, 1616, 571, 570, 1557, 1800, 1332, 111, 500, 1799, - /* 1150 */ 661, 494, 493, 492, 491, 486, 485, 484, 483, 482, - /* 1160 */ 478, 477, 476, 475, 349, 467, 466, 465, 612, 460, - /* 1170 */ 459, 366, 41, 40, 579, 2170, 47, 45, 44, 43, - /* 1180 */ 42, 248, 2202, 74, 1565, 247, 1568, 2170, 81, 80, - /* 1190 */ 448, 203, 706, 200, 2328, 2170, 1316, 1798, 1797, 2170, - /* 1200 */ 1796, 1795, 35, 768, 766, 242, 440, 438, 240, 797, - /* 1210 */ 1794, 507, 1676, 1221, 1222, 629, 670, 348, 2366, 1710, - /* 1220 */ 429, 2220, 165, 427, 423, 419, 416, 441, 1957, 166, - /* 1230 */ 1953, 166, 2170, 84, 705, 2372, 188, 1955, 166, 158, - /* 1240 */ 2367, 655, 580, 2202, 1951, 166, 93, 2170, 2170, 354, - /* 1250 */ 2170, 2170, 379, 706, 607, 2341, 1971, 166, 2156, 261, - /* 1260 */ 2170, 2310, 1703, 629, 1314, 286, 2366, 1703, 2201, 2221, - /* 1270 */ 2237, 260, 696, 112, 2203, 709, 2205, 2206, 704, 609, - /* 1280 */ 699, 608, 2220, 2372, 188, 2386, 1616, 2290, 2367, 655, - /* 1290 */ 1854, 395, 2286, 2170, 1845, 705, 1843, 158, 151, 55, - /* 1300 */ 1560, 150, 1558, 244, 158, 153, 243, 421, 152, 50, - /* 1310 */ 50, 2202, 592, 266, 94, 158, 594, 1567, 597, 1786, - /* 1320 */ 1787, 706, 50, 636, 1907, 292, 1275, 71, 156, 2201, - /* 1330 */ 158, 2237, 1563, 1564, 112, 2203, 709, 2205, 2206, 704, - /* 1340 */ 412, 699, 2079, 1828, 1571, 1837, 2386, 1833, 2290, 2010, - /* 1350 */ 2220, 64, 395, 2286, 14, 13, 2324, 1525, 50, 50, - /* 1360 */ 667, 2170, 281, 705, 1528, 713, 1276, 750, 156, 1739, - /* 1370 */ 1738, 108, 158, 268, 2202, 671, 138, 659, 156, 751, - /* 1380 */ 278, 105, 1482, 5, 706, 297, 2359, 681, 301, 1294, - /* 1390 */ 1359, 662, 415, 1, 363, 792, 420, 2201, 1590, 2237, - /* 1400 */ 2202, 1292, 112, 2203, 709, 2205, 2206, 704, 437, 699, - /* 1410 */ 706, 1677, 2309, 2220, 2386, 195, 2290, 436, 1626, 317, - /* 1420 */ 395, 2286, 196, 439, 2170, 1388, 705, 1661, 1392, 1506, - /* 1430 */ 198, 312, 1399, 455, 1583, 2202, 1397, 209, 161, 2220, - /* 1440 */ 457, 1587, 2080, 461, 463, 706, 498, 1582, 468, 488, - /* 1450 */ 2170, 481, 705, 2072, 490, 506, 497, 499, 508, 509, - /* 1460 */ 2201, 214, 2237, 511, 213, 112, 2203, 709, 2205, 2206, - /* 1470 */ 704, 1588, 699, 216, 2220, 1570, 512, 2386, 514, 2290, - /* 1480 */ 516, 531, 4, 395, 2286, 2170, 2201, 705, 2237, 532, - /* 1490 */ 539, 112, 2203, 709, 2205, 2206, 704, 540, 699, 542, - /* 1500 */ 224, 408, 407, 2386, 2202, 2290, 1585, 543, 226, 395, - /* 1510 */ 2286, 1573, 1589, 544, 706, 1591, 229, 545, 547, 231, - /* 1520 */ 551, 2201, 1640, 2237, 1566, 572, 112, 2203, 709, 2205, - /* 1530 */ 2206, 704, 2202, 699, 88, 89, 235, 114, 2265, 574, - /* 1540 */ 2290, 353, 706, 2220, 395, 2286, 2144, 1958, 239, 2141, - /* 1550 */ 611, 1635, 1954, 241, 2170, 2140, 705, 613, 1956, 1952, - /* 1560 */ 92, 313, 154, 252, 1565, 617, 618, 2202, 616, 1513, - /* 1570 */ 254, 2220, 256, 624, 621, 2325, 633, 706, 643, 679, - /* 1580 */ 639, 385, 2170, 623, 705, 2335, 646, 2340, 2339, 695, - /* 1590 */ 2201, 8, 2237, 652, 264, 112, 2203, 709, 2205, 2206, - /* 1600 */ 704, 622, 699, 2312, 272, 174, 2220, 2263, 267, 2290, - /* 1610 */ 634, 274, 632, 395, 2286, 275, 631, 2170, 2201, 705, - /* 1620 */ 2237, 277, 276, 112, 2203, 709, 2205, 2206, 704, 1703, - /* 1630 */ 699, 386, 2389, 663, 280, 692, 2365, 2290, 1586, 143, - /* 1640 */ 660, 395, 2286, 1708, 2306, 1706, 178, 287, 1592, 191, - /* 1650 */ 98, 2085, 314, 2201, 2202, 2237, 285, 315, 113, 2203, - /* 1660 */ 709, 2205, 2206, 704, 706, 699, 677, 678, 2099, 100, - /* 1670 */ 682, 2098, 2290, 61, 683, 316, 694, 2286, 102, 1969, - /* 1680 */ 1574, 2271, 1569, 104, 2202, 711, 1931, 2097, 319, 391, - /* 1690 */ 2014, 793, 796, 2220, 706, 794, 308, 328, 321, 342, - /* 1700 */ 332, 53, 323, 343, 2170, 2162, 705, 2161, 355, 2160, - /* 1710 */ 356, 78, 1577, 1579, 2157, 417, 418, 1550, 1551, 194, - /* 1720 */ 422, 2155, 424, 2220, 425, 697, 1633, 1634, 1636, 1637, - /* 1730 */ 1638, 1639, 426, 2154, 2170, 364, 705, 2152, 430, 2151, - /* 1740 */ 707, 432, 2237, 434, 1541, 113, 2203, 709, 2205, 2206, - /* 1750 */ 704, 2150, 699, 2131, 197, 2202, 2130, 199, 1509, 2290, - /* 1760 */ 79, 2112, 1508, 358, 2286, 706, 2111, 2110, 446, 447, - /* 1770 */ 2201, 2109, 2237, 2108, 1459, 170, 2203, 709, 2205, 2206, - /* 1780 */ 704, 2062, 699, 452, 453, 2059, 2058, 201, 82, 2057, - /* 1790 */ 2056, 2061, 204, 2060, 2220, 2055, 2054, 2052, 383, 2051, - /* 1800 */ 2050, 206, 2049, 469, 471, 2170, 2065, 705, 2048, 2047, - /* 1810 */ 2046, 2045, 2044, 2202, 2043, 2042, 2041, 2040, 2332, 2039, - /* 1820 */ 2038, 2037, 2036, 706, 2035, 2034, 208, 2202, 2033, 87, - /* 1830 */ 2032, 2031, 2030, 2064, 2029, 2028, 2027, 706, 2026, 2025, - /* 1840 */ 1461, 2201, 501, 2237, 2202, 2024, 341, 2203, 709, 2205, - /* 1850 */ 2206, 704, 2220, 699, 706, 2023, 384, 230, 2106, 1330, - /* 1860 */ 1873, 351, 1334, 2170, 1326, 705, 2220, 215, 1872, 217, - /* 1870 */ 1871, 352, 1869, 1866, 1865, 1858, 517, 2170, 1847, 705, - /* 1880 */ 1823, 1223, 521, 2220, 525, 519, 1822, 523, 218, 527, - /* 1890 */ 2129, 529, 518, 522, 2170, 220, 705, 2119, 182, 2201, - /* 1900 */ 526, 2237, 76, 77, 341, 2203, 709, 2205, 2206, 704, - /* 1910 */ 2107, 699, 2190, 2201, 2202, 2237, 183, 222, 334, 2203, - /* 1920 */ 709, 2205, 2206, 704, 706, 699, 537, 228, 2083, 1947, - /* 1930 */ 2201, 1268, 2237, 2202, 1868, 171, 2203, 709, 2205, 2206, - /* 1940 */ 704, 1864, 699, 703, 552, 553, 554, 1862, 556, 2202, - /* 1950 */ 557, 558, 1860, 2220, 560, 561, 562, 390, 1857, 706, - /* 1960 */ 564, 1842, 566, 651, 2170, 565, 705, 1840, 1841, 1839, - /* 1970 */ 1819, 1949, 2220, 63, 1404, 1403, 238, 1948, 1317, 1315, - /* 1980 */ 1313, 1312, 765, 2170, 1311, 705, 1310, 1304, 2220, 2388, - /* 1990 */ 1309, 1306, 398, 1855, 767, 1305, 376, 1303, 1846, 2170, - /* 2000 */ 2201, 705, 2237, 377, 1844, 341, 2203, 709, 2205, 2206, - /* 2010 */ 704, 378, 699, 598, 595, 1818, 1817, 600, 602, 2201, - /* 2020 */ 2202, 2237, 1816, 604, 340, 2203, 709, 2205, 2206, 704, - /* 2030 */ 706, 699, 615, 2256, 115, 2201, 1539, 2237, 1535, 29, - /* 2040 */ 341, 2203, 709, 2205, 2206, 704, 1537, 699, 1534, 2128, - /* 2050 */ 800, 67, 1515, 57, 1517, 2202, 2118, 1519, 619, 2220, - /* 2060 */ 2105, 620, 2104, 400, 311, 706, 257, 1494, 2371, 625, - /* 2070 */ 2170, 1493, 705, 20, 6, 31, 164, 635, 627, 1756, - /* 2080 */ 180, 21, 263, 7, 637, 2202, 22, 172, 790, 786, - /* 2090 */ 782, 778, 17, 309, 2220, 706, 265, 270, 1737, 269, - /* 2100 */ 32, 271, 2191, 1729, 1776, 2170, 2201, 705, 2237, 95, - /* 2110 */ 33, 341, 2203, 709, 2205, 2206, 704, 23, 699, 65, - /* 2120 */ 24, 1771, 2202, 1777, 2220, 1770, 387, 1775, 1774, 388, - /* 2130 */ 283, 1700, 706, 110, 1699, 2170, 302, 705, 2103, 59, - /* 2140 */ 2082, 610, 58, 2237, 177, 290, 336, 2203, 709, 2205, - /* 2150 */ 2206, 704, 18, 699, 96, 25, 97, 2081, 99, 300, - /* 2160 */ 293, 2220, 291, 1735, 298, 680, 68, 101, 303, 685, - /* 2170 */ 26, 2201, 2170, 2237, 705, 1652, 326, 2203, 709, 2205, - /* 2180 */ 2206, 704, 105, 699, 2202, 11, 1651, 13, 1575, 1662, - /* 2190 */ 2240, 179, 1630, 1628, 706, 192, 710, 1607, 712, 2202, - /* 2200 */ 1627, 1380, 698, 39, 289, 16, 27, 28, 2201, 706, - /* 2210 */ 2237, 288, 1599, 324, 2203, 709, 2205, 2206, 704, 1389, - /* 2220 */ 699, 401, 1386, 2220, 716, 714, 719, 708, 717, 722, - /* 2230 */ 253, 1385, 720, 723, 2170, 1382, 705, 1376, 2220, 725, - /* 2240 */ 1374, 728, 726, 1365, 729, 306, 1379, 1398, 106, 2170, - /* 2250 */ 2202, 705, 107, 75, 1378, 1394, 1266, 735, 1377, 1298, - /* 2260 */ 706, 745, 1297, 1296, 2202, 1295, 1293, 1291, 755, 1290, - /* 2270 */ 2201, 1289, 2237, 1324, 706, 327, 2203, 709, 2205, 2206, - /* 2280 */ 704, 307, 699, 1287, 1286, 2201, 1285, 2237, 1284, 2220, - /* 2290 */ 333, 2203, 709, 2205, 2206, 704, 1863, 699, 1283, 1282, - /* 2300 */ 2170, 1321, 705, 2220, 1281, 1319, 1278, 1277, 1274, 1273, - /* 2310 */ 1272, 1271, 775, 1861, 2170, 2202, 705, 776, 777, 779, - /* 2320 */ 781, 1859, 783, 1856, 785, 706, 787, 780, 789, 784, - /* 2330 */ 1838, 788, 791, 1213, 1815, 795, 2201, 310, 2237, 1561, - /* 2340 */ 320, 337, 2203, 709, 2205, 2206, 704, 798, 699, 799, - /* 2350 */ 2201, 1790, 2237, 1790, 2220, 329, 2203, 709, 2205, 2206, - /* 2360 */ 704, 1790, 699, 1790, 1790, 2170, 1790, 705, 1790, 1790, - /* 2370 */ 1790, 1790, 1790, 1790, 1790, 2202, 1790, 1790, 1790, 1790, - /* 2380 */ 1790, 1790, 1790, 1790, 1790, 706, 1790, 1790, 1790, 1790, - /* 2390 */ 2202, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2400 */ 706, 2201, 1790, 2237, 1790, 1790, 338, 2203, 709, 2205, - /* 2410 */ 2206, 704, 1790, 699, 2220, 1790, 1790, 1790, 1790, 1790, - /* 2420 */ 1790, 1790, 1790, 1790, 1790, 2170, 1790, 705, 1790, 2220, - /* 2430 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2440 */ 2170, 1790, 705, 1790, 1790, 1790, 1790, 1790, 2202, 1790, - /* 2450 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 706, 1790, - /* 2460 */ 1790, 2201, 1790, 2237, 1790, 2202, 330, 2203, 709, 2205, - /* 2470 */ 2206, 704, 1790, 699, 1790, 706, 2201, 1790, 2237, 2202, - /* 2480 */ 1790, 339, 2203, 709, 2205, 2206, 704, 2220, 699, 706, - /* 2490 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2170, 1790, - /* 2500 */ 705, 1790, 1790, 1790, 2220, 1790, 1790, 1790, 1790, 1790, - /* 2510 */ 1790, 1790, 1790, 1790, 1790, 2170, 2202, 705, 2220, 1790, - /* 2520 */ 1790, 1790, 1790, 1790, 1790, 1790, 706, 1790, 1790, 2170, - /* 2530 */ 1790, 705, 1790, 1790, 2201, 1790, 2237, 2202, 1790, 331, - /* 2540 */ 2203, 709, 2205, 2206, 704, 1790, 699, 706, 1790, 1790, - /* 2550 */ 1790, 2201, 1790, 2237, 1790, 2220, 344, 2203, 709, 2205, - /* 2560 */ 2206, 704, 1790, 699, 1790, 2201, 2170, 2237, 705, 1790, - /* 2570 */ 345, 2203, 709, 2205, 2206, 704, 2220, 699, 1790, 1790, - /* 2580 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2170, 1790, 705, - /* 2590 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2600 */ 1790, 1790, 2201, 2202, 2237, 1790, 1790, 2214, 2203, 709, - /* 2610 */ 2205, 2206, 704, 706, 699, 1790, 1790, 2202, 1790, 1790, - /* 2620 */ 1790, 1790, 1790, 2201, 1790, 2237, 1790, 706, 2213, 2203, - /* 2630 */ 709, 2205, 2206, 704, 2202, 699, 1790, 1790, 1790, 1790, - /* 2640 */ 1790, 1790, 2220, 1790, 706, 1790, 1790, 1790, 1790, 1790, - /* 2650 */ 1790, 1790, 1790, 2170, 1790, 705, 2220, 1790, 1790, 1790, - /* 2660 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2170, 1790, 705, - /* 2670 */ 1790, 1790, 1790, 2220, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2680 */ 1790, 1790, 1790, 1790, 2170, 1790, 705, 1790, 1790, 2201, - /* 2690 */ 1790, 2237, 1790, 1790, 2212, 2203, 709, 2205, 2206, 704, - /* 2700 */ 1790, 699, 1790, 2201, 1790, 2237, 1790, 1790, 360, 2203, - /* 2710 */ 709, 2205, 2206, 704, 1790, 699, 1790, 1790, 1790, 1790, - /* 2720 */ 2201, 1790, 2237, 1790, 1790, 361, 2203, 709, 2205, 2206, - /* 2730 */ 704, 1790, 699, 2202, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2740 */ 1790, 1790, 1790, 706, 1790, 1790, 1790, 1790, 1790, 2202, - /* 2750 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 706, - /* 2760 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2202, 1790, - /* 2770 */ 1790, 1790, 2220, 1790, 1790, 1790, 1790, 1790, 706, 1790, - /* 2780 */ 1790, 1790, 1790, 2170, 1790, 705, 1790, 1790, 2220, 1790, - /* 2790 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2170, - /* 2800 */ 1790, 705, 1790, 1790, 1790, 1790, 1790, 2220, 1790, 1790, - /* 2810 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2170, 2201, - /* 2820 */ 705, 2237, 1790, 1790, 357, 2203, 709, 2205, 2206, 704, - /* 2830 */ 1790, 699, 1790, 1790, 1790, 2201, 1790, 2237, 1790, 1790, - /* 2840 */ 362, 2203, 709, 2205, 2206, 704, 1790, 699, 1790, 1790, - /* 2850 */ 1790, 1790, 1790, 1790, 707, 1790, 2237, 1790, 2202, 336, - /* 2860 */ 2203, 709, 2205, 2206, 704, 1790, 699, 1790, 706, 1790, - /* 2870 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2880 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2890 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2220, 1790, 1790, - /* 2900 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 2170, 1790, - /* 2910 */ 705, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2920 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2930 */ 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, 1790, - /* 2940 */ 1790, 1790, 1790, 1790, 2201, 1790, 2237, 1790, 1790, 335, - /* 2950 */ 2203, 709, 2205, 2206, 704, 1790, 699, + /* 0 */ 455, 2206, 2184, 2095, 537, 693, 1972, 538, 1831, 14, + /* 10 */ 13, 673, 48, 46, 1718, 396, 2192, 1961, 2092, 680, + /* 20 */ 403, 1588, 1563, 41, 40, 135, 2188, 47, 45, 44, + /* 30 */ 43, 42, 577, 1644, 221, 1561, 693, 1972, 540, 2224, + /* 40 */ 1838, 2167, 41, 40, 1588, 350, 47, 45, 44, 43, + /* 50 */ 42, 2174, 1245, 709, 1244, 692, 135, 2184, 2184, 670, + /* 60 */ 144, 1957, 1639, 582, 2190, 400, 545, 140, 19, 538, + /* 70 */ 1831, 1963, 2193, 109, 703, 1569, 408, 670, 144, 2019, + /* 80 */ 2021, 2188, 2188, 363, 1818, 1246, 2095, 2205, 633, 2241, + /* 90 */ 145, 2370, 112, 2207, 713, 2209, 2210, 708, 1964, 703, + /* 100 */ 801, 2093, 680, 15, 185, 169, 2294, 1807, 2376, 188, + /* 110 */ 399, 2290, 1687, 2371, 659, 181, 48, 46, 692, 2190, + /* 120 */ 2190, 1590, 693, 1972, 403, 190, 1563, 1673, 1379, 703, + /* 130 */ 703, 38, 308, 2324, 2174, 371, 2078, 1644, 51, 1561, + /* 140 */ 1646, 1647, 193, 2309, 1370, 738, 737, 736, 1374, 735, + /* 150 */ 1376, 1377, 734, 731, 181, 1385, 728, 1387, 1388, 725, + /* 160 */ 722, 719, 672, 186, 2302, 2303, 1639, 142, 2307, 2306, + /* 170 */ 1619, 1629, 19, 1588, 223, 2079, 1645, 1648, 540, 1569, + /* 180 */ 1838, 286, 2302, 669, 1674, 136, 668, 1589, 2370, 693, + /* 190 */ 1972, 1564, 125, 1562, 1620, 124, 123, 122, 121, 120, + /* 200 */ 119, 118, 117, 116, 801, 657, 188, 15, 2206, 56, + /* 210 */ 2371, 659, 47, 45, 44, 43, 42, 1788, 710, 2020, + /* 220 */ 2021, 1591, 692, 1567, 1568, 1795, 1618, 1621, 1622, 1623, + /* 230 */ 1624, 1625, 1626, 1627, 1628, 705, 701, 1637, 1638, 1640, + /* 240 */ 1641, 1642, 1643, 2, 1646, 1647, 2224, 184, 678, 134, + /* 250 */ 133, 132, 131, 130, 129, 128, 127, 126, 2174, 2013, + /* 260 */ 709, 1796, 37, 401, 1668, 1669, 1670, 1671, 1672, 1676, + /* 270 */ 1677, 1678, 1679, 288, 1619, 1629, 168, 1588, 693, 1972, + /* 280 */ 1645, 1648, 125, 554, 1913, 124, 123, 122, 121, 120, + /* 290 */ 119, 118, 117, 116, 2205, 1564, 2241, 1562, 453, 112, + /* 300 */ 2207, 713, 2209, 2210, 708, 51, 703, 1414, 1415, 147, + /* 310 */ 679, 151, 2265, 2294, 2026, 2206, 1322, 399, 2290, 1793, + /* 320 */ 1787, 384, 252, 1472, 1473, 673, 251, 1567, 1568, 2024, + /* 330 */ 1618, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 705, + /* 340 */ 701, 1637, 1638, 1640, 1641, 1642, 1643, 2, 12, 48, + /* 350 */ 46, 2026, 2067, 2224, 693, 1972, 1324, 403, 393, 1563, + /* 360 */ 62, 1715, 552, 406, 2088, 2174, 2024, 709, 460, 2074, + /* 370 */ 1644, 163, 1561, 203, 454, 1220, 41, 40, 385, 1974, + /* 380 */ 47, 45, 44, 43, 42, 653, 2024, 93, 1591, 679, + /* 390 */ 358, 458, 418, 383, 2206, 611, 542, 417, 1245, 1639, + /* 400 */ 1244, 2205, 539, 2241, 707, 19, 112, 2207, 713, 2209, + /* 410 */ 2210, 708, 1569, 703, 1222, 202, 1225, 1226, 185, 1746, + /* 420 */ 2294, 2026, 41, 40, 399, 2290, 47, 45, 44, 43, + /* 430 */ 42, 1246, 2224, 2375, 466, 2074, 2025, 801, 652, 633, + /* 440 */ 15, 677, 2370, 2088, 2174, 1675, 709, 2325, 1817, 66, + /* 450 */ 1590, 2374, 449, 48, 46, 1649, 1572, 448, 30, 2376, + /* 460 */ 188, 403, 290, 1563, 2371, 659, 2224, 645, 644, 1744, + /* 470 */ 1745, 1747, 1748, 1749, 1644, 166, 1561, 1646, 1647, 62, + /* 480 */ 2205, 205, 2241, 1975, 376, 344, 2207, 713, 2209, 2210, + /* 490 */ 708, 706, 703, 694, 2259, 1722, 493, 2074, 2174, 633, + /* 500 */ 2206, 1588, 2370, 1639, 1248, 1249, 658, 1619, 1629, 2370, + /* 510 */ 710, 573, 572, 1645, 1648, 648, 1569, 290, 1758, 2376, + /* 520 */ 188, 651, 2026, 35, 2371, 659, 657, 188, 1564, 369, + /* 530 */ 1562, 2371, 659, 1680, 1781, 679, 1654, 2024, 2224, 2026, + /* 540 */ 266, 801, 1588, 210, 49, 750, 398, 2206, 62, 12, + /* 550 */ 2174, 10, 709, 377, 2024, 375, 374, 710, 579, 1840, + /* 560 */ 1567, 1568, 581, 1618, 1621, 1622, 1623, 1624, 1625, 1626, + /* 570 */ 1627, 1628, 705, 701, 1637, 1638, 1640, 1641, 1642, 1643, + /* 580 */ 2, 1646, 1647, 2057, 580, 2224, 2205, 688, 2241, 2088, + /* 590 */ 618, 113, 2207, 713, 2209, 2210, 708, 2174, 703, 709, + /* 600 */ 609, 658, 288, 90, 2370, 2294, 654, 649, 642, 2293, + /* 610 */ 2290, 1619, 1629, 607, 1575, 605, 632, 1645, 1648, 1714, + /* 620 */ 373, 657, 188, 207, 693, 1972, 2371, 659, 154, 1967, + /* 630 */ 412, 411, 1564, 2205, 1562, 2241, 290, 12, 112, 2207, + /* 640 */ 713, 2209, 2210, 708, 468, 703, 146, 1589, 34, 2265, + /* 650 */ 2390, 1620, 2294, 1570, 41, 40, 399, 2290, 47, 45, + /* 660 */ 44, 43, 42, 86, 1567, 1568, 85, 1618, 1621, 1622, + /* 670 */ 1623, 1624, 1625, 1626, 1627, 1628, 705, 701, 1637, 1638, + /* 680 */ 1640, 1641, 1642, 1643, 2, 48, 46, 2168, 55, 2206, + /* 690 */ 1949, 1563, 1620, 403, 1333, 1563, 693, 1972, 1569, 710, + /* 700 */ 2206, 397, 693, 1972, 1561, 290, 1644, 1332, 1561, 166, + /* 710 */ 710, 2026, 595, 594, 593, 741, 483, 1974, 407, 585, + /* 720 */ 141, 589, 484, 693, 1972, 588, 2024, 2224, 52, 661, + /* 730 */ 587, 592, 379, 378, 633, 1639, 586, 2370, 2224, 2174, + /* 740 */ 60, 709, 478, 553, 1569, 253, 500, 630, 1569, 1914, + /* 750 */ 2174, 477, 709, 1337, 2376, 188, 760, 41, 40, 2371, + /* 760 */ 659, 47, 45, 44, 43, 42, 1336, 1489, 1490, 801, + /* 770 */ 670, 144, 509, 801, 437, 2205, 49, 2241, 670, 144, + /* 780 */ 170, 2207, 713, 2209, 2210, 708, 2205, 703, 2241, 48, + /* 790 */ 46, 170, 2207, 713, 2209, 2210, 708, 403, 703, 1563, + /* 800 */ 1228, 439, 435, 1488, 1491, 748, 1587, 212, 211, 534, + /* 810 */ 1644, 1573, 1561, 1646, 1647, 1534, 1535, 532, 693, 1972, + /* 820 */ 528, 524, 634, 2335, 156, 155, 745, 744, 743, 153, + /* 830 */ 499, 511, 406, 1959, 2336, 748, 299, 300, 676, 1639, + /* 840 */ 166, 298, 2375, 1619, 1629, 2370, 575, 574, 1974, 1645, + /* 850 */ 1648, 1874, 1569, 1757, 156, 155, 745, 744, 743, 153, + /* 860 */ 1564, 108, 1562, 2374, 1564, 1955, 1562, 2371, 2373, 2375, + /* 870 */ 1816, 105, 2370, 62, 187, 2302, 2303, 801, 142, 2307, + /* 880 */ 15, 2206, 189, 2302, 2303, 290, 142, 2307, 591, 590, + /* 890 */ 2374, 710, 1567, 1568, 2371, 2372, 1567, 1568, 1948, 1618, + /* 900 */ 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 705, 701, + /* 910 */ 1637, 1638, 1640, 1641, 1642, 1643, 2, 1646, 1647, 2224, + /* 920 */ 2174, 595, 594, 593, 693, 1972, 693, 1972, 585, 141, + /* 930 */ 589, 2174, 1815, 709, 588, 600, 44, 43, 42, 587, + /* 940 */ 592, 379, 378, 740, 1969, 586, 255, 1619, 1629, 1814, + /* 950 */ 610, 41, 40, 1645, 1648, 47, 45, 44, 43, 42, + /* 960 */ 447, 695, 446, 2266, 250, 750, 259, 2205, 1564, 2241, + /* 970 */ 1562, 103, 113, 2207, 713, 2209, 2210, 708, 704, 703, + /* 980 */ 603, 409, 2174, 1225, 1226, 1813, 2294, 597, 1947, 166, + /* 990 */ 698, 2290, 445, 249, 616, 2309, 1965, 1974, 1812, 2174, + /* 1000 */ 1567, 1568, 1871, 1618, 1621, 1622, 1623, 1624, 1625, 1626, + /* 1010 */ 1627, 1628, 705, 701, 1637, 1638, 1640, 1641, 1642, 1643, + /* 1020 */ 2, 2305, 354, 167, 1586, 693, 1972, 1811, 329, 742, + /* 1030 */ 290, 491, 2017, 70, 507, 2174, 69, 506, 693, 1972, + /* 1040 */ 2157, 633, 326, 73, 2370, 263, 72, 1734, 2174, 1810, + /* 1050 */ 1809, 1806, 1805, 474, 1804, 508, 9, 351, 303, 1803, + /* 1060 */ 476, 2376, 188, 772, 770, 1802, 2371, 659, 219, 519, + /* 1070 */ 517, 514, 778, 777, 776, 775, 415, 2174, 774, 773, + /* 1080 */ 148, 768, 767, 766, 765, 764, 763, 762, 158, 758, + /* 1090 */ 757, 756, 414, 413, 753, 752, 751, 176, 175, 2174, + /* 1100 */ 2174, 2174, 2174, 748, 2174, 237, 372, 746, 62, 2174, + /* 1110 */ 2017, 662, 2309, 693, 1972, 2174, 1591, 747, 462, 90, + /* 1120 */ 2017, 173, 156, 155, 745, 744, 743, 153, 581, 571, + /* 1130 */ 567, 563, 559, 690, 236, 41, 40, 1801, 2304, 47, + /* 1140 */ 45, 44, 43, 42, 1800, 1968, 322, 111, 504, 2003, + /* 1150 */ 580, 498, 497, 496, 495, 490, 489, 488, 487, 486, + /* 1160 */ 482, 481, 480, 479, 353, 471, 470, 469, 674, 464, + /* 1170 */ 463, 370, 36, 2139, 91, 693, 1972, 234, 41, 40, + /* 1180 */ 693, 1972, 47, 45, 44, 43, 42, 2174, 81, 80, + /* 1190 */ 452, 700, 2206, 200, 2174, 691, 693, 1972, 1799, 697, + /* 1200 */ 309, 2266, 710, 1950, 2332, 761, 444, 442, 1934, 2314, + /* 1210 */ 1707, 583, 584, 1798, 74, 633, 410, 352, 2370, 54, + /* 1220 */ 433, 3, 254, 431, 427, 423, 420, 445, 1858, 83, + /* 1230 */ 2224, 137, 1571, 1320, 1318, 2376, 188, 665, 154, 2206, + /* 1240 */ 2371, 659, 2174, 2160, 709, 233, 227, 149, 2174, 710, + /* 1250 */ 596, 2345, 232, 550, 41, 40, 1808, 432, 47, 45, + /* 1260 */ 44, 43, 42, 2174, 84, 290, 154, 242, 265, 244, + /* 1270 */ 240, 225, 243, 613, 264, 612, 1707, 2224, 2205, 246, + /* 1280 */ 2241, 1849, 245, 112, 2207, 713, 2209, 2210, 708, 2174, + /* 1290 */ 703, 709, 425, 248, 1847, 2390, 247, 2294, 1529, 50, + /* 1300 */ 50, 399, 2290, 598, 270, 1790, 1791, 154, 50, 296, + /* 1310 */ 71, 152, 154, 14, 13, 1841, 601, 94, 64, 754, + /* 1320 */ 50, 1279, 262, 50, 717, 2205, 1532, 2241, 152, 2195, + /* 1330 */ 112, 2207, 713, 2209, 2210, 708, 154, 703, 2338, 138, + /* 1340 */ 152, 1298, 2390, 2206, 2294, 283, 1665, 646, 399, 2290, + /* 1350 */ 663, 139, 277, 710, 755, 640, 412, 411, 1912, 1743, + /* 1360 */ 1742, 1280, 1911, 2206, 272, 796, 1577, 675, 1486, 301, + /* 1370 */ 685, 305, 1363, 710, 386, 2363, 1296, 1644, 1681, 1570, + /* 1380 */ 1630, 2224, 416, 321, 1392, 2197, 2225, 2083, 1396, 1832, + /* 1390 */ 1574, 2014, 285, 2174, 1837, 709, 1403, 2328, 671, 1401, + /* 1400 */ 157, 2224, 282, 5, 1, 419, 1639, 424, 367, 1594, + /* 1410 */ 440, 441, 2206, 2174, 195, 709, 196, 198, 165, 1569, + /* 1420 */ 443, 1510, 710, 316, 2313, 1587, 459, 209, 461, 2205, + /* 1430 */ 1591, 2241, 2206, 2084, 112, 2207, 713, 2209, 2210, 708, + /* 1440 */ 465, 703, 710, 467, 699, 472, 2390, 1586, 2294, 2205, + /* 1450 */ 2224, 2241, 399, 2290, 112, 2207, 713, 2209, 2210, 708, + /* 1460 */ 502, 703, 2174, 485, 709, 492, 2390, 2076, 2294, 512, + /* 1470 */ 2224, 513, 399, 2290, 494, 501, 503, 510, 666, 214, + /* 1480 */ 213, 515, 2174, 516, 709, 216, 518, 520, 1592, 535, + /* 1490 */ 4, 536, 543, 546, 544, 1589, 547, 224, 2205, 226, + /* 1500 */ 2241, 2206, 1593, 112, 2207, 713, 2209, 2210, 708, 548, + /* 1510 */ 703, 710, 1595, 549, 229, 2390, 551, 2294, 2205, 555, + /* 1520 */ 2241, 399, 2290, 171, 2207, 713, 2209, 2210, 708, 231, + /* 1530 */ 703, 88, 576, 89, 235, 1578, 114, 1573, 578, 2224, + /* 1540 */ 357, 1962, 2148, 2145, 239, 2144, 1958, 241, 615, 92, + /* 1550 */ 2206, 2174, 617, 709, 150, 159, 160, 621, 1960, 1956, + /* 1560 */ 710, 161, 162, 317, 256, 622, 620, 1581, 1583, 258, + /* 1570 */ 1517, 260, 628, 647, 625, 637, 660, 2391, 2344, 683, + /* 1580 */ 701, 1637, 1638, 1640, 1641, 1642, 1643, 2205, 2224, 2241, + /* 1590 */ 2343, 2329, 112, 2207, 713, 2209, 2210, 708, 268, 703, + /* 1600 */ 2174, 643, 709, 626, 2269, 627, 2294, 2339, 271, 389, + /* 1610 */ 399, 2290, 650, 8, 638, 2316, 656, 635, 636, 276, + /* 1620 */ 2206, 2393, 174, 281, 278, 279, 667, 390, 664, 143, + /* 1630 */ 710, 1707, 1590, 1712, 2310, 1710, 2205, 1596, 2241, 2089, + /* 1640 */ 2206, 112, 2207, 713, 2209, 2210, 708, 291, 703, 318, + /* 1650 */ 710, 98, 178, 2267, 681, 2294, 319, 280, 2224, 399, + /* 1660 */ 2290, 682, 2103, 2102, 2101, 395, 100, 686, 1973, 102, + /* 1670 */ 2174, 191, 709, 320, 289, 61, 2275, 284, 2224, 687, + /* 1680 */ 104, 323, 2018, 2369, 715, 312, 797, 1935, 798, 800, + /* 1690 */ 2174, 325, 709, 359, 332, 346, 360, 336, 2166, 53, + /* 1700 */ 2165, 327, 2164, 78, 2161, 421, 2205, 422, 2241, 2206, + /* 1710 */ 347, 112, 2207, 713, 2209, 2210, 708, 1554, 703, 710, + /* 1720 */ 1555, 194, 426, 696, 2159, 2294, 711, 428, 2241, 399, + /* 1730 */ 2290, 113, 2207, 713, 2209, 2210, 708, 430, 703, 2158, + /* 1740 */ 429, 368, 2156, 434, 2206, 2294, 2155, 2224, 436, 362, + /* 1750 */ 2290, 2154, 438, 1545, 710, 2135, 197, 2134, 199, 2174, + /* 1760 */ 79, 709, 1513, 2116, 1512, 2115, 2114, 450, 451, 2113, + /* 1770 */ 2112, 2066, 1463, 456, 2206, 2063, 457, 201, 2062, 82, + /* 1780 */ 2061, 2060, 2224, 2065, 710, 2064, 2059, 387, 204, 2058, + /* 1790 */ 2056, 2055, 2054, 206, 2174, 2205, 709, 2241, 2053, 473, + /* 1800 */ 113, 2207, 713, 2209, 2210, 708, 475, 703, 2069, 2052, + /* 1810 */ 2051, 2206, 2224, 2050, 2294, 2049, 2048, 388, 2047, 2291, + /* 1820 */ 2046, 710, 2045, 2044, 2174, 2043, 709, 2042, 2041, 2040, + /* 1830 */ 2205, 2039, 2241, 2038, 208, 345, 2207, 713, 2209, 2210, + /* 1840 */ 708, 2206, 703, 2037, 87, 2036, 2035, 2034, 2068, 2224, + /* 1850 */ 2033, 710, 2032, 2031, 1465, 2030, 2029, 505, 2028, 2027, + /* 1860 */ 2205, 2174, 2241, 709, 1334, 345, 2207, 713, 2209, 2210, + /* 1870 */ 708, 1338, 703, 2206, 355, 1877, 215, 1876, 356, 2224, + /* 1880 */ 1875, 217, 1873, 710, 1870, 522, 1330, 1869, 526, 521, + /* 1890 */ 1862, 2174, 525, 709, 1851, 529, 218, 2205, 1827, 2241, + /* 1900 */ 533, 523, 338, 2207, 713, 2209, 2210, 708, 527, 703, + /* 1910 */ 2206, 2224, 530, 531, 220, 76, 394, 182, 2194, 1227, + /* 1920 */ 707, 1826, 77, 2174, 2133, 709, 183, 2205, 541, 2241, + /* 1930 */ 2123, 222, 171, 2207, 713, 2209, 2210, 708, 2111, 703, + /* 1940 */ 2206, 228, 230, 2110, 2087, 1951, 1872, 655, 2224, 1868, + /* 1950 */ 710, 556, 557, 558, 1272, 1866, 561, 560, 562, 2205, + /* 1960 */ 2174, 2241, 709, 619, 345, 2207, 713, 2209, 2210, 708, + /* 1970 */ 1864, 703, 564, 566, 565, 1861, 569, 568, 2224, 570, + /* 1980 */ 1846, 804, 1844, 402, 1845, 1843, 2392, 2206, 1823, 1953, + /* 1990 */ 2174, 1408, 709, 1407, 1952, 315, 2205, 710, 2241, 238, + /* 2000 */ 63, 344, 2207, 713, 2209, 2210, 708, 1321, 703, 1319, + /* 2010 */ 2260, 180, 1317, 2206, 1316, 1308, 1315, 769, 1314, 794, + /* 2020 */ 790, 786, 782, 710, 313, 2224, 2205, 1313, 2241, 1859, + /* 2030 */ 404, 345, 2207, 713, 2209, 2210, 708, 2174, 703, 709, + /* 2040 */ 771, 1310, 1309, 1307, 380, 1850, 381, 1848, 599, 382, + /* 2050 */ 602, 2224, 1822, 604, 1821, 606, 1820, 608, 115, 2132, + /* 2060 */ 1539, 1541, 1543, 2174, 110, 709, 29, 306, 1538, 57, + /* 2070 */ 67, 1519, 1521, 2205, 2206, 2241, 1523, 2122, 345, 2207, + /* 2080 */ 713, 2209, 2210, 708, 710, 703, 164, 2206, 623, 624, + /* 2090 */ 2109, 2108, 261, 629, 31, 1498, 2375, 710, 1497, 614, + /* 2100 */ 689, 2241, 20, 17, 340, 2207, 713, 2209, 2210, 708, + /* 2110 */ 631, 703, 2224, 1760, 267, 6, 7, 639, 641, 21, + /* 2120 */ 22, 269, 274, 33, 2174, 2224, 709, 1741, 275, 2195, + /* 2130 */ 65, 172, 23, 273, 1775, 293, 1733, 2174, 2206, 709, + /* 2140 */ 32, 24, 292, 95, 1774, 1780, 1781, 391, 710, 1779, + /* 2150 */ 1778, 18, 392, 1704, 2206, 1703, 2107, 287, 58, 2086, + /* 2160 */ 2205, 257, 2241, 59, 710, 330, 2207, 713, 2209, 2210, + /* 2170 */ 708, 177, 703, 2205, 96, 2241, 2224, 97, 328, 2207, + /* 2180 */ 713, 2209, 2210, 708, 294, 703, 25, 297, 2174, 295, + /* 2190 */ 709, 1739, 2224, 2085, 99, 302, 684, 68, 101, 105, + /* 2200 */ 307, 26, 11, 2206, 2174, 1656, 709, 304, 1655, 13, + /* 2210 */ 1579, 2244, 179, 710, 1611, 1634, 702, 192, 1666, 714, + /* 2220 */ 1632, 39, 716, 16, 2205, 1631, 2241, 1603, 27, 331, + /* 2230 */ 2207, 713, 2209, 2210, 708, 712, 703, 28, 405, 1393, + /* 2240 */ 2205, 2224, 2241, 718, 720, 337, 2207, 713, 2209, 2210, + /* 2250 */ 708, 1390, 703, 2174, 2206, 709, 1389, 721, 723, 726, + /* 2260 */ 729, 724, 732, 727, 710, 1386, 1380, 730, 1384, 733, + /* 2270 */ 2206, 1383, 1378, 1369, 1382, 1381, 106, 310, 739, 107, + /* 2280 */ 710, 1402, 75, 2206, 1398, 1270, 749, 1302, 1301, 2205, + /* 2290 */ 1300, 2241, 2224, 710, 341, 2207, 713, 2209, 2210, 708, + /* 2300 */ 1299, 703, 1297, 2206, 2174, 1295, 709, 1294, 2224, 1293, + /* 2310 */ 1328, 759, 311, 710, 1291, 1290, 1325, 1289, 1288, 1287, + /* 2320 */ 2174, 2224, 709, 1286, 1285, 1323, 1282, 1281, 1278, 1276, + /* 2330 */ 1277, 1867, 1275, 2174, 779, 709, 780, 781, 1865, 783, + /* 2340 */ 2205, 2224, 2241, 1863, 787, 333, 2207, 713, 2209, 2210, + /* 2350 */ 708, 784, 703, 2174, 785, 709, 2205, 788, 2241, 789, + /* 2360 */ 1860, 342, 2207, 713, 2209, 2210, 708, 791, 703, 2205, + /* 2370 */ 792, 2241, 793, 2206, 334, 2207, 713, 2209, 2210, 708, + /* 2380 */ 1842, 703, 795, 710, 1217, 1819, 314, 799, 802, 2205, + /* 2390 */ 1565, 2241, 324, 803, 343, 2207, 713, 2209, 2210, 708, + /* 2400 */ 1794, 703, 1794, 1794, 1794, 1794, 2206, 1794, 1794, 1794, + /* 2410 */ 1794, 2224, 1794, 1794, 1794, 1794, 710, 1794, 1794, 1794, + /* 2420 */ 1794, 1794, 2206, 2174, 1794, 709, 1794, 1794, 1794, 1794, + /* 2430 */ 1794, 1794, 710, 1794, 1794, 1794, 1794, 1794, 1794, 1794, + /* 2440 */ 1794, 1794, 1794, 2206, 2224, 1794, 1794, 1794, 1794, 1794, + /* 2450 */ 1794, 1794, 1794, 710, 1794, 1794, 2174, 1794, 709, 2205, + /* 2460 */ 2224, 2241, 1794, 1794, 335, 2207, 713, 2209, 2210, 708, + /* 2470 */ 1794, 703, 2174, 1794, 709, 1794, 1794, 1794, 1794, 1794, + /* 2480 */ 1794, 2224, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, + /* 2490 */ 1794, 1794, 2205, 2174, 2241, 709, 1794, 348, 2207, 713, + /* 2500 */ 2209, 2210, 708, 1794, 703, 1794, 1794, 1794, 2205, 2206, + /* 2510 */ 2241, 1794, 1794, 349, 2207, 713, 2209, 2210, 708, 710, + /* 2520 */ 703, 1794, 2206, 1794, 1794, 1794, 1794, 1794, 1794, 2205, + /* 2530 */ 1794, 2241, 710, 2206, 2218, 2207, 713, 2209, 2210, 708, + /* 2540 */ 1794, 703, 1794, 710, 1794, 1794, 2206, 2224, 1794, 1794, + /* 2550 */ 1794, 1794, 1794, 1794, 1794, 1794, 710, 1794, 1794, 2174, + /* 2560 */ 2224, 709, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, + /* 2570 */ 1794, 2224, 2174, 1794, 709, 1794, 1794, 1794, 1794, 1794, + /* 2580 */ 1794, 1794, 1794, 2174, 2224, 709, 1794, 1794, 1794, 1794, + /* 2590 */ 1794, 1794, 1794, 1794, 1794, 2205, 2174, 2241, 709, 1794, + /* 2600 */ 2217, 2207, 713, 2209, 2210, 708, 1794, 703, 2205, 1794, + /* 2610 */ 2241, 1794, 1794, 2216, 2207, 713, 2209, 2210, 708, 2205, + /* 2620 */ 703, 2241, 1794, 2206, 364, 2207, 713, 2209, 2210, 708, + /* 2630 */ 1794, 703, 2205, 710, 2241, 1794, 2206, 365, 2207, 713, + /* 2640 */ 2209, 2210, 708, 1794, 703, 1794, 710, 2206, 1794, 1794, + /* 2650 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 710, 1794, 1794, + /* 2660 */ 1794, 2224, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, + /* 2670 */ 1794, 1794, 1794, 2174, 2224, 709, 1794, 1794, 1794, 1794, + /* 2680 */ 1794, 1794, 1794, 1794, 1794, 2224, 2174, 1794, 709, 1794, + /* 2690 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 2174, 2206, 709, + /* 2700 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 710, 2205, + /* 2710 */ 1794, 2241, 1794, 1794, 361, 2207, 713, 2209, 2210, 708, + /* 2720 */ 1794, 703, 2205, 1794, 2241, 1794, 1794, 366, 2207, 713, + /* 2730 */ 2209, 2210, 708, 711, 703, 2241, 2224, 1794, 340, 2207, + /* 2740 */ 713, 2209, 2210, 708, 1794, 703, 1794, 1794, 2174, 1794, + /* 2750 */ 709, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, + /* 2760 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, + /* 2770 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, + /* 2780 */ 1794, 1794, 1794, 1794, 2205, 1794, 2241, 1794, 1794, 339, + /* 2790 */ 2207, 713, 2209, 2210, 708, 1794, 703, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 388, 342, 368, 394, 389, 351, 352, 392, 4, 448, - /* 10 */ 449, 352, 12, 13, 14, 406, 382, 0, 409, 410, - /* 20 */ 20, 388, 22, 8, 9, 371, 392, 12, 13, 14, - /* 30 */ 15, 16, 378, 33, 381, 35, 351, 352, 8, 9, - /* 40 */ 381, 412, 12, 13, 14, 15, 16, 43, 395, 45, - /* 50 */ 46, 392, 20, 394, 22, 20, 371, 368, 368, 351, - /* 60 */ 352, 44, 62, 378, 430, 431, 346, 35, 68, 349, - /* 70 */ 350, 382, 382, 351, 440, 75, 346, 351, 352, 349, - /* 80 */ 350, 392, 392, 68, 381, 53, 20, 428, 459, 430, - /* 90 */ 387, 462, 433, 434, 435, 436, 437, 438, 395, 440, - /* 100 */ 100, 351, 352, 103, 445, 376, 447, 394, 479, 480, - /* 110 */ 451, 452, 0, 484, 485, 381, 12, 13, 396, 430, - /* 120 */ 430, 371, 409, 410, 20, 466, 22, 112, 100, 440, - /* 130 */ 440, 20, 347, 474, 400, 401, 351, 33, 353, 35, - /* 140 */ 140, 141, 351, 352, 116, 117, 118, 119, 120, 121, - /* 150 */ 122, 123, 124, 125, 425, 127, 128, 129, 130, 131, - /* 160 */ 132, 133, 454, 455, 456, 457, 62, 459, 460, 103, - /* 170 */ 170, 171, 68, 341, 347, 343, 176, 177, 351, 75, - /* 180 */ 353, 455, 456, 457, 169, 459, 460, 20, 462, 398, - /* 190 */ 20, 191, 21, 193, 103, 24, 25, 26, 27, 28, - /* 200 */ 29, 30, 31, 32, 100, 479, 480, 103, 342, 49, - /* 210 */ 484, 485, 103, 183, 103, 351, 352, 57, 352, 20, - /* 220 */ 60, 61, 134, 223, 224, 0, 226, 227, 228, 229, + /* 0 */ 351, 342, 368, 394, 346, 351, 352, 349, 350, 1, + /* 10 */ 2, 352, 12, 13, 14, 406, 382, 381, 409, 410, + /* 20 */ 20, 20, 22, 8, 9, 371, 392, 12, 13, 14, + /* 30 */ 15, 16, 378, 33, 347, 35, 351, 352, 351, 380, + /* 40 */ 353, 412, 8, 9, 20, 396, 12, 13, 14, 15, + /* 50 */ 16, 392, 20, 394, 22, 20, 371, 368, 368, 351, + /* 60 */ 352, 381, 62, 378, 430, 431, 346, 35, 68, 349, + /* 70 */ 350, 382, 382, 358, 440, 75, 390, 351, 352, 393, + /* 80 */ 394, 392, 392, 68, 342, 53, 394, 428, 459, 430, + /* 90 */ 375, 462, 433, 434, 435, 436, 437, 438, 383, 440, + /* 100 */ 100, 409, 410, 103, 445, 341, 447, 343, 479, 480, + /* 110 */ 451, 452, 104, 484, 485, 380, 12, 13, 20, 430, + /* 120 */ 430, 20, 351, 352, 20, 466, 22, 112, 100, 440, + /* 130 */ 440, 448, 449, 474, 392, 400, 401, 33, 103, 35, + /* 140 */ 140, 141, 371, 432, 116, 117, 118, 119, 120, 121, + /* 150 */ 122, 123, 124, 125, 380, 127, 128, 129, 130, 131, + /* 160 */ 132, 133, 454, 455, 456, 457, 62, 459, 460, 458, + /* 170 */ 170, 171, 68, 20, 347, 401, 176, 177, 351, 75, + /* 180 */ 353, 455, 456, 457, 169, 459, 460, 20, 462, 351, + /* 190 */ 352, 191, 21, 193, 170, 24, 25, 26, 27, 28, + /* 200 */ 29, 30, 31, 32, 100, 479, 480, 103, 342, 371, + /* 210 */ 484, 485, 12, 13, 14, 15, 16, 183, 352, 393, + /* 220 */ 394, 20, 20, 223, 224, 0, 226, 227, 228, 229, /* 230 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 240 */ 240, 241, 242, 243, 140, 141, 21, 381, 67, 24, - /* 250 */ 25, 26, 27, 28, 29, 30, 31, 32, 392, 0, - /* 260 */ 394, 4, 247, 248, 249, 250, 251, 252, 253, 254, - /* 270 */ 255, 256, 257, 390, 170, 171, 393, 394, 351, 352, - /* 280 */ 176, 177, 20, 24, 25, 26, 27, 28, 29, 30, - /* 290 */ 31, 32, 204, 205, 428, 191, 430, 193, 371, 433, - /* 300 */ 434, 435, 436, 437, 438, 175, 440, 140, 141, 443, - /* 310 */ 20, 445, 446, 447, 67, 342, 286, 451, 452, 455, - /* 320 */ 456, 457, 20, 459, 460, 352, 260, 223, 224, 217, + /* 240 */ 240, 241, 242, 243, 140, 141, 380, 379, 20, 24, + /* 250 */ 25, 26, 27, 28, 29, 30, 31, 32, 392, 391, + /* 260 */ 394, 0, 247, 248, 249, 250, 251, 252, 253, 254, + /* 270 */ 255, 256, 257, 172, 170, 171, 361, 20, 351, 352, + /* 280 */ 176, 177, 21, 67, 369, 24, 25, 26, 27, 28, + /* 290 */ 29, 30, 31, 32, 428, 191, 430, 193, 371, 433, + /* 300 */ 434, 435, 436, 437, 438, 103, 440, 140, 141, 443, + /* 310 */ 351, 445, 446, 447, 380, 342, 35, 451, 452, 339, + /* 320 */ 286, 387, 135, 170, 171, 352, 139, 223, 224, 395, /* 330 */ 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, /* 340 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 12, - /* 350 */ 13, 260, 459, 372, 381, 462, 361, 20, 37, 22, - /* 360 */ 103, 380, 381, 379, 369, 392, 342, 394, 387, 260, - /* 370 */ 33, 260, 35, 480, 351, 391, 395, 484, 485, 8, - /* 380 */ 9, 84, 114, 12, 13, 14, 15, 16, 351, 352, - /* 390 */ 75, 20, 351, 352, 342, 244, 266, 267, 268, 62, - /* 400 */ 20, 428, 114, 430, 352, 68, 433, 434, 435, 436, - /* 410 */ 437, 438, 75, 440, 351, 352, 392, 342, 445, 75, - /* 420 */ 447, 351, 352, 4, 451, 452, 403, 106, 405, 108, - /* 430 */ 109, 432, 111, 381, 371, 398, 115, 100, 19, 358, - /* 440 */ 103, 371, 145, 146, 392, 381, 394, 474, 0, 351, - /* 450 */ 352, 387, 33, 12, 13, 14, 375, 458, 137, 395, - /* 460 */ 342, 20, 172, 22, 383, 168, 352, 392, 49, 371, - /* 470 */ 352, 35, 170, 171, 33, 56, 35, 140, 141, 342, - /* 480 */ 428, 62, 430, 103, 342, 433, 434, 435, 436, 437, - /* 490 */ 438, 439, 440, 441, 442, 381, 455, 456, 457, 381, - /* 500 */ 459, 460, 381, 62, 244, 186, 246, 170, 171, 14, - /* 510 */ 392, 75, 394, 176, 177, 20, 75, 260, 70, 71, - /* 520 */ 72, 102, 401, 3, 105, 77, 78, 79, 191, 392, - /* 530 */ 193, 83, 213, 214, 392, 351, 88, 89, 90, 91, - /* 540 */ 20, 100, 94, 172, 103, 342, 428, 342, 430, 435, - /* 550 */ 0, 433, 434, 435, 436, 437, 438, 352, 440, 354, - /* 560 */ 223, 224, 360, 226, 227, 228, 229, 230, 231, 232, + /* 350 */ 13, 380, 0, 380, 351, 352, 75, 20, 387, 22, + /* 360 */ 103, 4, 403, 372, 405, 392, 395, 394, 351, 352, + /* 370 */ 33, 380, 35, 172, 371, 4, 8, 9, 387, 388, + /* 380 */ 12, 13, 14, 15, 16, 20, 395, 200, 20, 351, + /* 390 */ 203, 39, 412, 206, 342, 208, 14, 417, 20, 62, + /* 400 */ 22, 428, 20, 430, 352, 68, 433, 434, 435, 436, + /* 410 */ 437, 438, 75, 440, 43, 398, 45, 46, 445, 223, + /* 420 */ 447, 380, 8, 9, 451, 452, 12, 13, 14, 15, + /* 430 */ 16, 53, 380, 3, 351, 352, 395, 100, 352, 459, + /* 440 */ 103, 403, 462, 405, 392, 169, 394, 474, 342, 4, + /* 450 */ 20, 3, 412, 12, 13, 14, 35, 417, 44, 479, + /* 460 */ 480, 20, 260, 22, 484, 485, 380, 271, 272, 273, + /* 470 */ 274, 275, 276, 277, 33, 380, 35, 140, 141, 103, + /* 480 */ 428, 398, 430, 388, 37, 433, 434, 435, 436, 437, + /* 490 */ 438, 439, 440, 441, 442, 14, 351, 352, 392, 459, + /* 500 */ 342, 20, 462, 62, 54, 55, 459, 170, 171, 462, + /* 510 */ 352, 356, 357, 176, 177, 175, 75, 260, 104, 479, + /* 520 */ 480, 435, 380, 247, 484, 485, 479, 480, 191, 387, + /* 530 */ 193, 484, 485, 257, 104, 351, 14, 395, 380, 380, + /* 540 */ 172, 100, 20, 398, 103, 67, 387, 342, 103, 244, + /* 550 */ 392, 246, 394, 106, 395, 108, 109, 352, 111, 354, + /* 560 */ 223, 224, 115, 226, 227, 228, 229, 230, 231, 232, /* 570 */ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - /* 580 */ 243, 140, 141, 70, 71, 72, 381, 403, 386, 405, - /* 590 */ 77, 78, 79, 475, 476, 392, 83, 392, 444, 394, - /* 600 */ 446, 88, 89, 90, 91, 459, 388, 94, 462, 351, - /* 610 */ 352, 170, 171, 381, 12, 13, 48, 176, 177, 387, - /* 620 */ 393, 394, 381, 339, 104, 479, 480, 395, 387, 371, - /* 630 */ 484, 485, 191, 428, 193, 430, 395, 35, 433, 434, - /* 640 */ 435, 436, 437, 438, 3, 440, 351, 352, 134, 135, - /* 650 */ 445, 351, 447, 139, 8, 9, 451, 452, 12, 13, - /* 660 */ 14, 15, 16, 418, 223, 224, 371, 226, 227, 228, + /* 580 */ 243, 140, 141, 0, 137, 380, 428, 403, 430, 405, + /* 590 */ 114, 433, 434, 435, 436, 437, 438, 392, 440, 394, + /* 600 */ 21, 459, 172, 360, 462, 447, 266, 267, 268, 451, + /* 610 */ 452, 170, 171, 34, 193, 36, 48, 176, 177, 262, + /* 620 */ 377, 479, 480, 62, 351, 352, 484, 485, 44, 386, + /* 630 */ 12, 13, 191, 428, 193, 430, 260, 244, 433, 434, + /* 640 */ 435, 436, 437, 438, 371, 440, 443, 20, 2, 446, + /* 650 */ 445, 170, 447, 35, 8, 9, 451, 452, 12, 13, + /* 660 */ 14, 15, 16, 102, 223, 224, 105, 226, 227, 228, /* 670 */ 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - /* 680 */ 239, 240, 241, 242, 243, 12, 13, 351, 352, 342, - /* 690 */ 44, 459, 172, 20, 462, 22, 412, 20, 0, 352, - /* 700 */ 444, 417, 446, 403, 223, 405, 33, 371, 35, 159, - /* 710 */ 342, 479, 480, 358, 351, 352, 484, 485, 168, 360, - /* 720 */ 352, 0, 103, 381, 351, 352, 8, 9, 381, 387, - /* 730 */ 12, 13, 14, 15, 16, 62, 377, 395, 383, 392, - /* 740 */ 172, 394, 342, 459, 371, 386, 462, 179, 75, 381, - /* 750 */ 104, 62, 271, 272, 273, 274, 275, 276, 277, 21, - /* 760 */ 392, 398, 394, 479, 480, 67, 351, 352, 484, 485, - /* 770 */ 372, 115, 34, 100, 36, 428, 103, 430, 380, 381, - /* 780 */ 433, 434, 435, 436, 437, 438, 371, 440, 342, 12, - /* 790 */ 13, 102, 392, 137, 105, 193, 428, 20, 430, 22, - /* 800 */ 369, 433, 434, 435, 436, 437, 438, 343, 440, 190, - /* 810 */ 33, 192, 35, 140, 141, 447, 432, 140, 141, 451, - /* 820 */ 452, 412, 104, 8, 9, 432, 417, 12, 13, 14, - /* 830 */ 15, 16, 402, 486, 487, 342, 115, 0, 392, 62, - /* 840 */ 14, 222, 458, 170, 171, 352, 20, 351, 352, 176, - /* 850 */ 177, 458, 75, 176, 177, 134, 135, 136, 137, 138, - /* 860 */ 139, 372, 351, 352, 191, 488, 193, 371, 459, 380, - /* 870 */ 381, 462, 351, 352, 381, 351, 352, 100, 443, 260, - /* 880 */ 103, 446, 371, 389, 14, 392, 392, 394, 479, 480, - /* 890 */ 20, 477, 371, 484, 485, 371, 223, 224, 0, 226, + /* 680 */ 239, 240, 241, 242, 243, 12, 13, 412, 104, 342, + /* 690 */ 0, 22, 170, 20, 22, 22, 351, 352, 75, 352, + /* 700 */ 342, 372, 351, 352, 35, 260, 33, 35, 35, 380, + /* 710 */ 352, 380, 70, 71, 72, 114, 371, 388, 387, 77, + /* 720 */ 78, 79, 371, 351, 352, 83, 395, 380, 103, 281, + /* 730 */ 88, 89, 90, 91, 459, 62, 94, 462, 380, 392, + /* 740 */ 172, 394, 159, 371, 75, 134, 84, 179, 75, 369, + /* 750 */ 392, 168, 394, 22, 479, 480, 75, 8, 9, 484, + /* 760 */ 485, 12, 13, 14, 15, 16, 35, 140, 141, 100, + /* 770 */ 351, 352, 100, 100, 186, 428, 103, 430, 351, 352, + /* 780 */ 433, 434, 435, 436, 437, 438, 428, 440, 430, 12, + /* 790 */ 13, 433, 434, 435, 436, 437, 438, 20, 440, 22, + /* 800 */ 14, 213, 214, 176, 177, 115, 20, 145, 146, 49, + /* 810 */ 33, 193, 35, 140, 141, 204, 205, 57, 351, 352, + /* 820 */ 60, 61, 475, 476, 134, 135, 136, 137, 138, 139, + /* 830 */ 168, 100, 372, 381, 476, 115, 134, 135, 371, 62, + /* 840 */ 380, 139, 459, 170, 171, 462, 356, 357, 388, 176, + /* 850 */ 177, 0, 75, 104, 134, 135, 136, 137, 138, 139, + /* 860 */ 191, 103, 193, 480, 191, 381, 193, 484, 485, 459, + /* 870 */ 342, 113, 462, 103, 455, 456, 457, 100, 459, 460, + /* 880 */ 103, 342, 455, 456, 457, 260, 459, 460, 365, 366, + /* 890 */ 480, 352, 223, 224, 484, 485, 223, 224, 0, 226, /* 900 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - /* 910 */ 237, 238, 239, 240, 241, 242, 243, 140, 141, 104, - /* 920 */ 355, 428, 281, 430, 365, 366, 433, 434, 435, 436, - /* 930 */ 437, 438, 389, 440, 372, 392, 115, 39, 1, 2, - /* 940 */ 447, 459, 380, 381, 462, 452, 342, 170, 171, 351, - /* 950 */ 352, 22, 115, 176, 177, 134, 135, 136, 137, 138, - /* 960 */ 139, 4, 480, 33, 35, 47, 484, 485, 191, 371, - /* 970 */ 193, 134, 135, 136, 137, 138, 139, 351, 352, 49, - /* 980 */ 12, 13, 14, 15, 16, 14, 342, 57, 58, 59, - /* 990 */ 60, 20, 62, 20, 471, 22, 392, 371, 54, 55, + /* 910 */ 237, 238, 239, 240, 241, 242, 243, 140, 141, 380, + /* 920 */ 392, 70, 71, 72, 351, 352, 351, 352, 77, 78, + /* 930 */ 79, 392, 342, 394, 83, 4, 14, 15, 16, 88, + /* 940 */ 89, 90, 91, 381, 371, 94, 371, 170, 171, 342, + /* 950 */ 19, 8, 9, 176, 177, 12, 13, 14, 15, 16, + /* 960 */ 190, 444, 192, 446, 33, 67, 381, 428, 191, 430, + /* 970 */ 193, 358, 433, 434, 435, 436, 437, 438, 381, 440, + /* 980 */ 49, 372, 392, 45, 46, 342, 447, 56, 0, 380, + /* 990 */ 451, 452, 222, 62, 412, 432, 383, 388, 342, 392, /* 1000 */ 223, 224, 0, 226, 227, 228, 229, 230, 231, 232, /* 1010 */ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - /* 1020 */ 243, 103, 18, 18, 20, 411, 53, 342, 23, 100, - /* 1030 */ 373, 27, 102, 376, 30, 105, 392, 33, 2, 20, - /* 1040 */ 170, 104, 37, 38, 8, 9, 41, 39, 12, 13, - /* 1050 */ 14, 15, 16, 49, 42, 51, 44, 52, 8, 9, - /* 1060 */ 56, 368, 12, 13, 14, 15, 16, 412, 63, 64, + /* 1020 */ 243, 458, 18, 18, 20, 351, 352, 342, 23, 389, + /* 1030 */ 260, 27, 392, 102, 30, 392, 105, 33, 351, 352, + /* 1040 */ 0, 459, 37, 38, 462, 371, 41, 104, 392, 342, + /* 1050 */ 342, 342, 342, 49, 342, 51, 39, 52, 371, 342, + /* 1060 */ 56, 479, 480, 365, 366, 342, 484, 485, 63, 64, /* 1070 */ 65, 66, 70, 71, 72, 73, 74, 392, 76, 77, /* 1080 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - /* 1090 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 14, - /* 1100 */ 15, 16, 367, 173, 174, 370, 102, 20, 103, 2, - /* 1110 */ 180, 181, 351, 352, 459, 8, 9, 462, 114, 12, - /* 1120 */ 13, 14, 15, 16, 169, 342, 356, 357, 42, 199, - /* 1130 */ 44, 22, 371, 22, 479, 480, 20, 342, 44, 484, - /* 1140 */ 485, 170, 356, 357, 35, 342, 35, 142, 144, 342, - /* 1150 */ 44, 147, 148, 149, 150, 151, 152, 153, 154, 155, + /* 1090 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 392, + /* 1100 */ 392, 392, 392, 115, 392, 33, 102, 389, 103, 392, + /* 1110 */ 392, 44, 432, 351, 352, 392, 20, 389, 114, 360, + /* 1120 */ 392, 49, 134, 135, 136, 137, 138, 139, 115, 57, + /* 1130 */ 58, 59, 60, 371, 62, 8, 9, 342, 458, 12, + /* 1140 */ 13, 14, 15, 16, 342, 386, 373, 142, 144, 376, + /* 1150 */ 137, 147, 148, 149, 150, 151, 152, 153, 154, 155, /* 1160 */ 156, 157, 158, 159, 160, 161, 162, 163, 412, 165, - /* 1170 */ 166, 167, 8, 9, 13, 392, 12, 13, 14, 15, - /* 1180 */ 16, 135, 342, 114, 75, 139, 35, 392, 183, 184, - /* 1190 */ 185, 172, 352, 188, 354, 392, 35, 342, 342, 392, - /* 1200 */ 342, 342, 247, 365, 366, 107, 201, 202, 110, 100, - /* 1210 */ 342, 100, 257, 45, 46, 459, 412, 212, 462, 262, - /* 1220 */ 215, 381, 172, 218, 219, 220, 221, 222, 380, 381, - /* 1230 */ 380, 381, 392, 164, 394, 479, 480, 380, 381, 44, - /* 1240 */ 484, 485, 13, 342, 380, 381, 200, 392, 392, 203, - /* 1250 */ 392, 392, 206, 352, 208, 354, 380, 381, 0, 172, - /* 1260 */ 392, 258, 259, 459, 35, 260, 462, 259, 428, 381, - /* 1270 */ 430, 62, 68, 433, 434, 435, 436, 437, 438, 207, - /* 1280 */ 440, 209, 381, 479, 480, 445, 170, 447, 484, 485, - /* 1290 */ 0, 451, 452, 392, 0, 394, 0, 44, 107, 104, - /* 1300 */ 191, 110, 193, 107, 44, 107, 110, 49, 110, 44, - /* 1310 */ 44, 342, 22, 44, 105, 44, 22, 35, 22, 140, - /* 1320 */ 141, 352, 44, 354, 368, 44, 35, 44, 44, 428, - /* 1330 */ 44, 430, 223, 224, 433, 434, 435, 436, 437, 438, - /* 1340 */ 355, 440, 402, 350, 193, 0, 445, 352, 447, 391, - /* 1350 */ 381, 44, 451, 452, 1, 2, 402, 104, 44, 44, - /* 1360 */ 461, 392, 481, 394, 104, 44, 75, 13, 44, 104, - /* 1370 */ 104, 103, 44, 104, 342, 104, 44, 283, 44, 13, - /* 1380 */ 453, 113, 104, 263, 352, 104, 354, 104, 104, 35, - /* 1390 */ 104, 285, 413, 465, 429, 50, 49, 428, 20, 430, - /* 1400 */ 342, 35, 433, 434, 435, 436, 437, 438, 422, 440, - /* 1410 */ 352, 104, 354, 381, 445, 427, 447, 206, 104, 104, - /* 1420 */ 451, 452, 360, 422, 392, 104, 394, 223, 104, 189, - /* 1430 */ 360, 415, 104, 352, 20, 342, 104, 42, 104, 381, - /* 1440 */ 399, 20, 402, 352, 399, 352, 169, 20, 397, 352, - /* 1450 */ 392, 351, 394, 351, 399, 99, 397, 397, 101, 364, - /* 1460 */ 428, 351, 430, 98, 363, 433, 434, 435, 436, 437, - /* 1470 */ 438, 20, 440, 351, 381, 193, 362, 445, 351, 447, - /* 1480 */ 351, 344, 48, 451, 452, 392, 428, 394, 430, 348, - /* 1490 */ 344, 433, 434, 435, 436, 437, 438, 348, 440, 422, - /* 1500 */ 360, 12, 13, 445, 342, 447, 20, 394, 360, 451, - /* 1510 */ 452, 22, 20, 353, 352, 20, 360, 414, 353, 360, - /* 1520 */ 351, 428, 33, 430, 35, 344, 433, 434, 435, 436, - /* 1530 */ 437, 438, 342, 440, 360, 360, 360, 351, 445, 381, - /* 1540 */ 447, 344, 352, 381, 451, 452, 392, 381, 381, 392, - /* 1550 */ 210, 62, 381, 381, 392, 392, 394, 426, 381, 381, - /* 1560 */ 103, 422, 424, 358, 75, 197, 421, 342, 196, 195, - /* 1570 */ 420, 381, 358, 351, 394, 402, 392, 352, 270, 269, - /* 1580 */ 392, 392, 392, 413, 394, 402, 392, 470, 470, 100, - /* 1590 */ 428, 278, 430, 182, 407, 433, 434, 435, 436, 437, - /* 1600 */ 438, 419, 440, 473, 472, 470, 381, 445, 407, 447, - /* 1610 */ 280, 469, 279, 451, 452, 468, 264, 392, 428, 394, - /* 1620 */ 430, 413, 467, 433, 434, 435, 436, 437, 438, 259, - /* 1630 */ 440, 287, 489, 284, 482, 445, 483, 447, 20, 352, - /* 1640 */ 282, 451, 452, 114, 432, 261, 353, 358, 20, 464, - /* 1650 */ 358, 405, 407, 428, 342, 430, 463, 407, 433, 434, - /* 1660 */ 435, 436, 437, 438, 352, 440, 392, 392, 392, 358, - /* 1670 */ 174, 392, 447, 103, 404, 376, 451, 452, 358, 352, - /* 1680 */ 191, 450, 193, 103, 342, 384, 370, 392, 351, 392, - /* 1690 */ 392, 36, 344, 381, 352, 345, 358, 374, 359, 374, - /* 1700 */ 374, 416, 340, 423, 392, 0, 394, 0, 408, 0, - /* 1710 */ 408, 42, 223, 224, 0, 35, 216, 35, 35, 35, - /* 1720 */ 216, 0, 35, 381, 35, 236, 237, 238, 239, 240, - /* 1730 */ 241, 242, 216, 0, 392, 216, 394, 0, 35, 0, - /* 1740 */ 428, 22, 430, 35, 211, 433, 434, 435, 436, 437, - /* 1750 */ 438, 0, 440, 0, 199, 342, 0, 199, 193, 447, - /* 1760 */ 200, 0, 191, 451, 452, 352, 0, 0, 187, 186, - /* 1770 */ 428, 0, 430, 0, 47, 433, 434, 435, 436, 437, - /* 1780 */ 438, 0, 440, 35, 49, 0, 0, 47, 42, 0, - /* 1790 */ 0, 0, 47, 0, 381, 0, 0, 0, 385, 0, - /* 1800 */ 0, 159, 0, 35, 159, 392, 0, 394, 0, 0, - /* 1810 */ 0, 0, 0, 342, 0, 0, 0, 0, 476, 0, - /* 1820 */ 0, 0, 0, 352, 0, 0, 47, 342, 0, 42, - /* 1830 */ 0, 0, 0, 0, 0, 0, 0, 352, 0, 0, - /* 1840 */ 22, 428, 143, 430, 342, 0, 433, 434, 435, 436, - /* 1850 */ 437, 438, 381, 440, 352, 0, 385, 182, 0, 22, - /* 1860 */ 0, 48, 22, 392, 35, 394, 381, 62, 0, 62, - /* 1870 */ 0, 48, 0, 0, 0, 0, 35, 392, 0, 394, - /* 1880 */ 0, 14, 35, 381, 35, 39, 0, 39, 62, 39, - /* 1890 */ 0, 35, 49, 49, 392, 42, 394, 0, 44, 428, - /* 1900 */ 49, 430, 39, 39, 433, 434, 435, 436, 437, 438, - /* 1910 */ 0, 440, 47, 428, 342, 430, 47, 40, 433, 434, - /* 1920 */ 435, 436, 437, 438, 352, 440, 47, 39, 0, 0, - /* 1930 */ 428, 69, 430, 342, 0, 433, 434, 435, 436, 437, - /* 1940 */ 438, 0, 440, 352, 35, 49, 39, 0, 35, 342, - /* 1950 */ 49, 39, 0, 381, 35, 49, 39, 385, 0, 352, - /* 1960 */ 35, 0, 39, 478, 392, 49, 394, 0, 0, 0, - /* 1970 */ 0, 0, 381, 112, 35, 22, 110, 0, 35, 35, - /* 1980 */ 35, 35, 44, 392, 35, 394, 35, 22, 381, 487, - /* 1990 */ 35, 35, 385, 0, 44, 35, 22, 35, 0, 392, - /* 2000 */ 428, 394, 430, 22, 0, 433, 434, 435, 436, 437, - /* 2010 */ 438, 22, 440, 35, 51, 0, 0, 35, 35, 428, - /* 2020 */ 342, 430, 0, 22, 433, 434, 435, 436, 437, 438, - /* 2030 */ 352, 440, 1, 442, 20, 428, 104, 430, 35, 103, - /* 2040 */ 433, 434, 435, 436, 437, 438, 35, 440, 35, 0, - /* 2050 */ 19, 103, 35, 172, 22, 342, 0, 198, 22, 381, - /* 2060 */ 0, 172, 0, 385, 33, 352, 174, 172, 3, 178, - /* 2070 */ 392, 172, 394, 44, 48, 103, 194, 101, 178, 104, - /* 2080 */ 49, 44, 103, 48, 99, 342, 44, 103, 57, 58, - /* 2090 */ 59, 60, 265, 62, 381, 352, 104, 44, 104, 103, - /* 2100 */ 103, 47, 47, 104, 104, 392, 428, 394, 430, 103, - /* 2110 */ 44, 433, 434, 435, 436, 437, 438, 265, 440, 3, - /* 2120 */ 44, 35, 342, 104, 381, 35, 35, 35, 35, 35, - /* 2130 */ 47, 104, 352, 102, 104, 392, 105, 394, 0, 44, - /* 2140 */ 0, 428, 258, 430, 47, 47, 433, 434, 435, 436, - /* 2150 */ 437, 438, 265, 440, 103, 103, 39, 0, 39, 173, - /* 2160 */ 103, 381, 104, 104, 103, 175, 103, 103, 47, 138, - /* 2170 */ 44, 428, 392, 430, 394, 101, 433, 434, 435, 436, - /* 2180 */ 437, 438, 113, 440, 342, 245, 101, 2, 22, 223, - /* 2190 */ 103, 47, 104, 104, 352, 47, 114, 22, 35, 342, - /* 2200 */ 104, 126, 103, 103, 173, 103, 103, 103, 428, 352, - /* 2210 */ 430, 180, 104, 433, 434, 435, 436, 437, 438, 104, - /* 2220 */ 440, 35, 104, 381, 35, 103, 35, 225, 103, 35, - /* 2230 */ 199, 104, 103, 103, 392, 104, 394, 104, 381, 35, - /* 2240 */ 104, 35, 103, 22, 103, 44, 126, 35, 103, 392, - /* 2250 */ 342, 394, 103, 103, 126, 22, 69, 115, 126, 35, - /* 2260 */ 352, 68, 35, 35, 342, 35, 35, 35, 97, 35, - /* 2270 */ 428, 35, 430, 75, 352, 433, 434, 435, 436, 437, - /* 2280 */ 438, 44, 440, 35, 35, 428, 35, 430, 22, 381, - /* 2290 */ 433, 434, 435, 436, 437, 438, 0, 440, 35, 35, - /* 2300 */ 392, 75, 394, 381, 35, 35, 35, 35, 35, 35, - /* 2310 */ 22, 35, 35, 0, 392, 342, 394, 49, 39, 35, - /* 2320 */ 39, 0, 35, 0, 39, 352, 35, 49, 39, 49, - /* 2330 */ 0, 49, 35, 35, 0, 21, 428, 22, 430, 22, - /* 2340 */ 22, 433, 434, 435, 436, 437, 438, 21, 440, 20, - /* 2350 */ 428, 490, 430, 490, 381, 433, 434, 435, 436, 437, - /* 2360 */ 438, 490, 440, 490, 490, 392, 490, 394, 490, 490, - /* 2370 */ 490, 490, 490, 490, 490, 342, 490, 490, 490, 490, - /* 2380 */ 490, 490, 490, 490, 490, 352, 490, 490, 490, 490, - /* 2390 */ 342, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2400 */ 352, 428, 490, 430, 490, 490, 433, 434, 435, 436, - /* 2410 */ 437, 438, 490, 440, 381, 490, 490, 490, 490, 490, - /* 2420 */ 490, 490, 490, 490, 490, 392, 490, 394, 490, 381, - /* 2430 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2440 */ 392, 490, 394, 490, 490, 490, 490, 490, 342, 490, - /* 2450 */ 490, 490, 490, 490, 490, 490, 490, 490, 352, 490, - /* 2460 */ 490, 428, 490, 430, 490, 342, 433, 434, 435, 436, - /* 2470 */ 437, 438, 490, 440, 490, 352, 428, 490, 430, 342, - /* 2480 */ 490, 433, 434, 435, 436, 437, 438, 381, 440, 352, - /* 2490 */ 490, 490, 490, 490, 490, 490, 490, 490, 392, 490, - /* 2500 */ 394, 490, 490, 490, 381, 490, 490, 490, 490, 490, - /* 2510 */ 490, 490, 490, 490, 490, 392, 342, 394, 381, 490, - /* 2520 */ 490, 490, 490, 490, 490, 490, 352, 490, 490, 392, - /* 2530 */ 490, 394, 490, 490, 428, 490, 430, 342, 490, 433, - /* 2540 */ 434, 435, 436, 437, 438, 490, 440, 352, 490, 490, - /* 2550 */ 490, 428, 490, 430, 490, 381, 433, 434, 435, 436, - /* 2560 */ 437, 438, 490, 440, 490, 428, 392, 430, 394, 490, - /* 2570 */ 433, 434, 435, 436, 437, 438, 381, 440, 490, 490, - /* 2580 */ 490, 490, 490, 490, 490, 490, 490, 392, 490, 394, - /* 2590 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2600 */ 490, 490, 428, 342, 430, 490, 490, 433, 434, 435, - /* 2610 */ 436, 437, 438, 352, 440, 490, 490, 342, 490, 490, - /* 2620 */ 490, 490, 490, 428, 490, 430, 490, 352, 433, 434, - /* 2630 */ 435, 436, 437, 438, 342, 440, 490, 490, 490, 490, - /* 2640 */ 490, 490, 381, 490, 352, 490, 490, 490, 490, 490, - /* 2650 */ 490, 490, 490, 392, 490, 394, 381, 490, 490, 490, - /* 2660 */ 490, 490, 490, 490, 490, 490, 490, 392, 490, 394, - /* 2670 */ 490, 490, 490, 381, 490, 490, 490, 490, 490, 490, - /* 2680 */ 490, 490, 490, 490, 392, 490, 394, 490, 490, 428, - /* 2690 */ 490, 430, 490, 490, 433, 434, 435, 436, 437, 438, - /* 2700 */ 490, 440, 490, 428, 490, 430, 490, 490, 433, 434, - /* 2710 */ 435, 436, 437, 438, 490, 440, 490, 490, 490, 490, - /* 2720 */ 428, 490, 430, 490, 490, 433, 434, 435, 436, 437, - /* 2730 */ 438, 490, 440, 342, 490, 490, 490, 490, 490, 490, - /* 2740 */ 490, 490, 490, 352, 490, 490, 490, 490, 490, 342, - /* 2750 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 352, - /* 2760 */ 490, 490, 490, 490, 490, 490, 490, 490, 342, 490, - /* 2770 */ 490, 490, 381, 490, 490, 490, 490, 490, 352, 490, - /* 2780 */ 490, 490, 490, 392, 490, 394, 490, 490, 381, 490, - /* 2790 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 392, - /* 2800 */ 490, 394, 490, 490, 490, 490, 490, 381, 490, 490, - /* 2810 */ 490, 490, 490, 490, 490, 490, 490, 490, 392, 428, - /* 2820 */ 394, 430, 490, 490, 433, 434, 435, 436, 437, 438, - /* 2830 */ 490, 440, 490, 490, 490, 428, 490, 430, 490, 490, - /* 2840 */ 433, 434, 435, 436, 437, 438, 490, 440, 490, 490, - /* 2850 */ 490, 490, 490, 490, 428, 490, 430, 490, 342, 433, - /* 2860 */ 434, 435, 436, 437, 438, 490, 440, 490, 352, 490, - /* 2870 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2880 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2890 */ 490, 490, 490, 490, 490, 490, 490, 381, 490, 490, - /* 2900 */ 490, 490, 490, 490, 490, 490, 490, 490, 392, 490, - /* 2910 */ 394, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2920 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2930 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, - /* 2940 */ 490, 490, 490, 490, 428, 490, 430, 490, 490, 433, - /* 2950 */ 434, 435, 436, 437, 438, 490, 440, 339, 339, 339, + /* 1170 */ 166, 167, 2, 376, 102, 351, 352, 105, 8, 9, + /* 1180 */ 351, 352, 12, 13, 14, 15, 16, 392, 183, 184, + /* 1190 */ 185, 68, 342, 188, 392, 371, 351, 352, 342, 444, + /* 1200 */ 371, 446, 352, 0, 354, 367, 201, 202, 370, 258, + /* 1210 */ 259, 13, 13, 342, 114, 459, 371, 212, 462, 42, + /* 1220 */ 215, 44, 425, 218, 219, 220, 221, 222, 0, 42, + /* 1230 */ 380, 44, 35, 35, 35, 479, 480, 44, 44, 342, + /* 1240 */ 484, 485, 392, 0, 394, 173, 174, 44, 392, 352, + /* 1250 */ 22, 354, 180, 181, 8, 9, 343, 217, 12, 13, + /* 1260 */ 14, 15, 16, 392, 164, 260, 44, 107, 172, 107, + /* 1270 */ 110, 199, 110, 207, 62, 209, 259, 380, 428, 107, + /* 1280 */ 430, 0, 110, 433, 434, 435, 436, 437, 438, 392, + /* 1290 */ 440, 394, 49, 107, 0, 445, 110, 447, 104, 44, + /* 1300 */ 44, 451, 452, 22, 44, 140, 141, 44, 44, 44, + /* 1310 */ 44, 44, 44, 1, 2, 0, 22, 105, 44, 13, + /* 1320 */ 44, 35, 418, 44, 44, 428, 104, 430, 44, 47, + /* 1330 */ 433, 434, 435, 436, 437, 438, 44, 440, 402, 44, + /* 1340 */ 44, 35, 445, 342, 447, 488, 223, 477, 451, 452, + /* 1350 */ 283, 355, 471, 352, 13, 354, 12, 13, 368, 104, + /* 1360 */ 104, 75, 368, 342, 104, 50, 22, 104, 104, 104, + /* 1370 */ 104, 104, 104, 352, 411, 354, 35, 33, 104, 35, + /* 1380 */ 104, 380, 355, 104, 104, 103, 380, 402, 104, 350, + /* 1390 */ 193, 391, 481, 392, 352, 394, 104, 402, 461, 104, + /* 1400 */ 104, 380, 453, 263, 465, 413, 62, 49, 429, 20, + /* 1410 */ 206, 422, 342, 392, 427, 394, 360, 360, 172, 75, + /* 1420 */ 422, 189, 352, 415, 354, 20, 352, 42, 399, 428, + /* 1430 */ 20, 430, 342, 402, 433, 434, 435, 436, 437, 438, + /* 1440 */ 352, 440, 352, 399, 100, 397, 445, 20, 447, 428, + /* 1450 */ 380, 430, 451, 452, 433, 434, 435, 436, 437, 438, + /* 1460 */ 169, 440, 392, 351, 394, 352, 445, 351, 447, 101, + /* 1470 */ 380, 364, 451, 452, 399, 397, 397, 99, 285, 351, + /* 1480 */ 363, 98, 392, 362, 394, 351, 351, 351, 20, 344, + /* 1490 */ 48, 348, 344, 422, 348, 20, 394, 360, 428, 360, + /* 1500 */ 430, 342, 20, 433, 434, 435, 436, 437, 438, 353, + /* 1510 */ 440, 352, 20, 414, 360, 445, 353, 447, 428, 351, + /* 1520 */ 430, 451, 452, 433, 434, 435, 436, 437, 438, 360, + /* 1530 */ 440, 360, 344, 360, 360, 191, 351, 193, 380, 380, + /* 1540 */ 344, 380, 392, 392, 380, 392, 380, 380, 210, 103, + /* 1550 */ 342, 392, 426, 394, 424, 380, 380, 197, 380, 380, + /* 1560 */ 352, 380, 380, 422, 358, 421, 196, 223, 224, 420, + /* 1570 */ 195, 358, 351, 270, 394, 392, 486, 487, 470, 269, + /* 1580 */ 236, 237, 238, 239, 240, 241, 242, 428, 380, 430, + /* 1590 */ 470, 402, 433, 434, 435, 436, 437, 438, 407, 440, + /* 1600 */ 392, 392, 394, 419, 445, 413, 447, 402, 407, 392, + /* 1610 */ 451, 452, 392, 278, 280, 473, 182, 264, 279, 472, + /* 1620 */ 342, 489, 470, 413, 469, 468, 284, 287, 282, 352, + /* 1630 */ 352, 259, 20, 114, 432, 261, 428, 20, 430, 405, + /* 1640 */ 342, 433, 434, 435, 436, 437, 438, 358, 440, 407, + /* 1650 */ 352, 358, 353, 445, 392, 447, 407, 467, 380, 451, + /* 1660 */ 452, 392, 392, 392, 392, 392, 358, 174, 352, 358, + /* 1670 */ 392, 464, 394, 376, 463, 103, 450, 482, 380, 404, + /* 1680 */ 103, 351, 392, 483, 384, 358, 36, 370, 345, 344, + /* 1690 */ 392, 359, 394, 408, 374, 374, 408, 374, 0, 416, + /* 1700 */ 0, 340, 0, 42, 0, 35, 428, 216, 430, 342, + /* 1710 */ 423, 433, 434, 435, 436, 437, 438, 35, 440, 352, + /* 1720 */ 35, 35, 216, 445, 0, 447, 428, 35, 430, 451, + /* 1730 */ 452, 433, 434, 435, 436, 437, 438, 216, 440, 0, + /* 1740 */ 35, 216, 0, 35, 342, 447, 0, 380, 22, 451, + /* 1750 */ 452, 0, 35, 211, 352, 0, 199, 0, 199, 392, + /* 1760 */ 200, 394, 193, 0, 191, 0, 0, 187, 186, 0, + /* 1770 */ 0, 0, 47, 35, 342, 0, 49, 47, 0, 42, + /* 1780 */ 0, 0, 380, 0, 352, 0, 0, 385, 47, 0, + /* 1790 */ 0, 0, 0, 159, 392, 428, 394, 430, 0, 35, + /* 1800 */ 433, 434, 435, 436, 437, 438, 159, 440, 0, 0, + /* 1810 */ 0, 342, 380, 0, 447, 0, 0, 385, 0, 452, + /* 1820 */ 0, 352, 0, 0, 392, 0, 394, 0, 0, 0, + /* 1830 */ 428, 0, 430, 0, 47, 433, 434, 435, 436, 437, + /* 1840 */ 438, 342, 440, 0, 42, 0, 0, 0, 0, 380, + /* 1850 */ 0, 352, 0, 0, 22, 0, 0, 143, 0, 0, + /* 1860 */ 428, 392, 430, 394, 22, 433, 434, 435, 436, 437, + /* 1870 */ 438, 22, 440, 342, 48, 0, 62, 0, 48, 380, + /* 1880 */ 0, 62, 0, 352, 0, 49, 35, 0, 49, 35, + /* 1890 */ 0, 392, 35, 394, 0, 35, 62, 428, 0, 430, + /* 1900 */ 35, 39, 433, 434, 435, 436, 437, 438, 39, 440, + /* 1910 */ 342, 380, 49, 39, 42, 39, 385, 44, 47, 14, + /* 1920 */ 352, 0, 39, 392, 0, 394, 47, 428, 47, 430, + /* 1930 */ 0, 40, 433, 434, 435, 436, 437, 438, 0, 440, + /* 1940 */ 342, 39, 182, 0, 0, 0, 0, 478, 380, 0, + /* 1950 */ 352, 35, 49, 39, 69, 0, 49, 35, 39, 428, + /* 1960 */ 392, 430, 394, 1, 433, 434, 435, 436, 437, 438, + /* 1970 */ 0, 440, 35, 39, 49, 0, 49, 35, 380, 39, + /* 1980 */ 0, 19, 0, 385, 0, 0, 487, 342, 0, 0, + /* 1990 */ 392, 35, 394, 22, 0, 33, 428, 352, 430, 110, + /* 2000 */ 112, 433, 434, 435, 436, 437, 438, 35, 440, 35, + /* 2010 */ 442, 49, 35, 342, 35, 22, 35, 44, 35, 57, + /* 2020 */ 58, 59, 60, 352, 62, 380, 428, 35, 430, 0, + /* 2030 */ 385, 433, 434, 435, 436, 437, 438, 392, 440, 394, + /* 2040 */ 44, 35, 35, 35, 22, 0, 22, 0, 51, 22, + /* 2050 */ 35, 380, 0, 35, 0, 35, 0, 22, 20, 0, + /* 2060 */ 35, 35, 104, 392, 102, 394, 103, 105, 35, 172, + /* 2070 */ 103, 35, 22, 428, 342, 430, 198, 0, 433, 434, + /* 2080 */ 435, 436, 437, 438, 352, 440, 194, 342, 22, 172, + /* 2090 */ 0, 0, 174, 178, 103, 172, 3, 352, 172, 428, + /* 2100 */ 138, 430, 44, 265, 433, 434, 435, 436, 437, 438, + /* 2110 */ 178, 440, 380, 104, 103, 48, 48, 101, 99, 44, + /* 2120 */ 44, 104, 44, 44, 392, 380, 394, 104, 47, 47, + /* 2130 */ 3, 103, 265, 103, 35, 173, 104, 392, 342, 394, + /* 2140 */ 103, 44, 180, 103, 35, 104, 104, 35, 352, 35, + /* 2150 */ 35, 265, 35, 104, 342, 104, 0, 47, 258, 0, + /* 2160 */ 428, 199, 430, 44, 352, 433, 434, 435, 436, 437, + /* 2170 */ 438, 47, 440, 428, 103, 430, 380, 39, 433, 434, + /* 2180 */ 435, 436, 437, 438, 47, 440, 103, 103, 392, 104, + /* 2190 */ 394, 104, 380, 0, 39, 103, 175, 103, 103, 113, + /* 2200 */ 47, 44, 245, 342, 392, 101, 394, 173, 101, 2, + /* 2210 */ 22, 103, 47, 352, 22, 104, 103, 47, 223, 114, + /* 2220 */ 104, 103, 35, 103, 428, 104, 430, 104, 103, 433, + /* 2230 */ 434, 435, 436, 437, 438, 225, 440, 103, 35, 104, + /* 2240 */ 428, 380, 430, 103, 35, 433, 434, 435, 436, 437, + /* 2250 */ 438, 104, 440, 392, 342, 394, 104, 103, 35, 35, + /* 2260 */ 35, 103, 35, 103, 352, 104, 104, 103, 126, 103, + /* 2270 */ 342, 126, 104, 22, 126, 126, 103, 44, 115, 103, + /* 2280 */ 352, 35, 103, 342, 22, 69, 68, 35, 35, 428, + /* 2290 */ 35, 430, 380, 352, 433, 434, 435, 436, 437, 438, + /* 2300 */ 35, 440, 35, 342, 392, 35, 394, 35, 380, 35, + /* 2310 */ 75, 97, 44, 352, 35, 35, 75, 35, 22, 35, + /* 2320 */ 392, 380, 394, 35, 35, 35, 35, 35, 35, 22, + /* 2330 */ 35, 0, 35, 392, 35, 394, 49, 39, 0, 35, + /* 2340 */ 428, 380, 430, 0, 35, 433, 434, 435, 436, 437, + /* 2350 */ 438, 49, 440, 392, 39, 394, 428, 49, 430, 39, + /* 2360 */ 0, 433, 434, 435, 436, 437, 438, 35, 440, 428, + /* 2370 */ 49, 430, 39, 342, 433, 434, 435, 436, 437, 438, + /* 2380 */ 0, 440, 35, 352, 35, 0, 22, 21, 21, 428, + /* 2390 */ 22, 430, 22, 20, 433, 434, 435, 436, 437, 438, + /* 2400 */ 490, 440, 490, 490, 490, 490, 342, 490, 490, 490, + /* 2410 */ 490, 380, 490, 490, 490, 490, 352, 490, 490, 490, + /* 2420 */ 490, 490, 342, 392, 490, 394, 490, 490, 490, 490, + /* 2430 */ 490, 490, 352, 490, 490, 490, 490, 490, 490, 490, + /* 2440 */ 490, 490, 490, 342, 380, 490, 490, 490, 490, 490, + /* 2450 */ 490, 490, 490, 352, 490, 490, 392, 490, 394, 428, + /* 2460 */ 380, 430, 490, 490, 433, 434, 435, 436, 437, 438, + /* 2470 */ 490, 440, 392, 490, 394, 490, 490, 490, 490, 490, + /* 2480 */ 490, 380, 490, 490, 490, 490, 490, 490, 490, 490, + /* 2490 */ 490, 490, 428, 392, 430, 394, 490, 433, 434, 435, + /* 2500 */ 436, 437, 438, 490, 440, 490, 490, 490, 428, 342, + /* 2510 */ 430, 490, 490, 433, 434, 435, 436, 437, 438, 352, + /* 2520 */ 440, 490, 342, 490, 490, 490, 490, 490, 490, 428, + /* 2530 */ 490, 430, 352, 342, 433, 434, 435, 436, 437, 438, + /* 2540 */ 490, 440, 490, 352, 490, 490, 342, 380, 490, 490, + /* 2550 */ 490, 490, 490, 490, 490, 490, 352, 490, 490, 392, + /* 2560 */ 380, 394, 490, 490, 490, 490, 490, 490, 490, 490, + /* 2570 */ 490, 380, 392, 490, 394, 490, 490, 490, 490, 490, + /* 2580 */ 490, 490, 490, 392, 380, 394, 490, 490, 490, 490, + /* 2590 */ 490, 490, 490, 490, 490, 428, 392, 430, 394, 490, + /* 2600 */ 433, 434, 435, 436, 437, 438, 490, 440, 428, 490, + /* 2610 */ 430, 490, 490, 433, 434, 435, 436, 437, 438, 428, + /* 2620 */ 440, 430, 490, 342, 433, 434, 435, 436, 437, 438, + /* 2630 */ 490, 440, 428, 352, 430, 490, 342, 433, 434, 435, + /* 2640 */ 436, 437, 438, 490, 440, 490, 352, 342, 490, 490, + /* 2650 */ 490, 490, 490, 490, 490, 490, 490, 352, 490, 490, + /* 2660 */ 490, 380, 490, 490, 490, 490, 490, 490, 490, 490, + /* 2670 */ 490, 490, 490, 392, 380, 394, 490, 490, 490, 490, + /* 2680 */ 490, 490, 490, 490, 490, 380, 392, 490, 394, 490, + /* 2690 */ 490, 490, 490, 490, 490, 490, 490, 392, 342, 394, + /* 2700 */ 490, 490, 490, 490, 490, 490, 490, 490, 352, 428, + /* 2710 */ 490, 430, 490, 490, 433, 434, 435, 436, 437, 438, + /* 2720 */ 490, 440, 428, 490, 430, 490, 490, 433, 434, 435, + /* 2730 */ 436, 437, 438, 428, 440, 430, 380, 490, 433, 434, + /* 2740 */ 435, 436, 437, 438, 490, 440, 490, 490, 392, 490, + /* 2750 */ 394, 490, 490, 490, 490, 490, 490, 490, 490, 490, + /* 2760 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, + /* 2770 */ 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, + /* 2780 */ 490, 490, 490, 490, 428, 490, 430, 490, 490, 433, + /* 2790 */ 434, 435, 436, 437, 438, 490, 440, 339, 339, 339, + /* 2800 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2810 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2820 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2830 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2840 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2850 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2860 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2870 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2880 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2890 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2900 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2910 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2920 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2930 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2940 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, + /* 2950 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, /* 2960 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, /* 2970 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, /* 2980 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, @@ -831,230 +809,214 @@ static const YYCODETYPE yy_lookahead[] = { /* 3100 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, /* 3110 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, /* 3120 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3130 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3140 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3150 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3160 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3170 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3180 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3190 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3200 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3210 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3220 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3230 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3240 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3250 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3260 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3270 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3280 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, - /* 3290 */ 339, 339, 339, 339, 339, 339, + /* 3130 */ 339, 339, 339, 339, 339, 339, }; -#define YY_SHIFT_COUNT (800) +#define YY_SHIFT_COUNT (804) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2334) +#define YY_SHIFT_MAX (2385) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 1005, 0, 104, 0, 337, 337, 337, 337, 337, 337, /* 10 */ 337, 337, 337, 337, 337, 337, 441, 673, 673, 777, /* 20 */ 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, /* 30 */ 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, /* 40 */ 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, - /* 50 */ 673, 66, 111, 619, 380, 91, 109, 91, 380, 380, - /* 60 */ 91, 1489, 91, 1489, 1489, 257, 91, 35, 677, 170, - /* 70 */ 170, 677, 4, 4, 302, 167, 495, 495, 170, 170, - /* 80 */ 170, 170, 170, 170, 170, 170, 170, 170, 199, 170, - /* 90 */ 170, 181, 35, 170, 170, 262, 35, 170, 199, 170, - /* 100 */ 199, 35, 170, 170, 35, 170, 35, 35, 35, 170, - /* 110 */ 247, 1004, 15, 15, 513, 171, 1109, 1109, 1109, 1109, - /* 120 */ 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, - /* 130 */ 1109, 1109, 1109, 1109, 1109, 321, 520, 302, 167, 944, - /* 140 */ 944, 436, 290, 290, 290, 698, 260, 260, 436, 181, - /* 150 */ 35, 35, 35, 35, 268, 151, 35, 315, 35, 315, - /* 160 */ 315, 288, 344, 28, 28, 28, 28, 2031, 448, 225, - /* 170 */ 371, 30, 481, 32, 130, 602, 602, 870, 568, 971, - /* 180 */ 973, 1019, 1168, 826, 656, 1087, 1003, 1008, 641, 1003, - /* 190 */ 1012, 957, 1116, 1120, 1347, 1378, 1211, 181, 1378, 181, - /* 200 */ 1240, 1414, 1395, 1421, 1414, 1395, 1277, 1427, 1414, 1427, - /* 210 */ 1395, 1277, 1277, 1357, 1356, 1427, 1365, 1427, 1427, 1427, - /* 220 */ 1451, 1434, 1451, 1434, 1378, 181, 1486, 181, 1492, 1495, - /* 230 */ 181, 1492, 181, 181, 181, 1427, 181, 1451, 35, 35, - /* 240 */ 35, 35, 35, 35, 35, 1427, 1451, 315, 315, 315, - /* 250 */ 1340, 1457, 1378, 247, 1368, 1372, 1486, 247, 1374, 1120, - /* 260 */ 1427, 1421, 1421, 315, 1308, 1310, 315, 1308, 1310, 315, - /* 270 */ 315, 35, 1313, 1411, 1308, 1330, 1333, 1352, 1120, 1344, - /* 280 */ 1349, 1358, 1370, 1414, 1618, 1529, 1384, 1492, 247, 247, - /* 290 */ 1628, 1310, 315, 315, 315, 315, 315, 1310, 315, 1496, - /* 300 */ 247, 288, 247, 1414, 1570, 1580, 315, 344, 1427, 247, - /* 310 */ 1655, 1451, 2957, 2957, 2957, 2957, 2957, 2957, 2957, 2957, - /* 320 */ 2957, 1002, 930, 259, 646, 419, 718, 815, 721, 1036, - /* 330 */ 1107, 1050, 837, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - /* 340 */ 1164, 1164, 821, 1046, 968, 968, 297, 160, 319, 550, - /* 350 */ 689, 929, 1111, 738, 88, 514, 514, 1085, 937, 955, - /* 360 */ 1085, 1085, 1085, 1258, 112, 1195, 898, 1086, 1069, 17, - /* 370 */ 1098, 1191, 1196, 1198, 1161, 1229, 1290, 1294, 1296, 1072, - /* 380 */ 1253, 1260, 1209, 1265, 1266, 1269, 1179, 1094, 1106, 1271, - /* 390 */ 1278, 1281, 1283, 1284, 1286, 1353, 1307, 1204, 1314, 918, - /* 400 */ 1315, 1321, 1324, 1328, 1332, 1334, 1268, 1151, 1282, 1354, - /* 410 */ 1366, 1291, 1345, 1705, 1707, 1709, 1669, 1714, 1680, 1500, - /* 420 */ 1682, 1683, 1684, 1504, 1721, 1687, 1689, 1516, 1733, 1519, - /* 430 */ 1737, 1703, 1739, 1719, 1751, 1708, 1533, 1753, 1555, 1756, - /* 440 */ 1558, 1560, 1565, 1571, 1761, 1766, 1767, 1581, 1583, 1771, - /* 450 */ 1773, 1727, 1781, 1748, 1735, 1785, 1740, 1786, 1746, 1789, - /* 460 */ 1790, 1791, 1745, 1793, 1795, 1796, 1797, 1799, 1800, 1642, - /* 470 */ 1768, 1802, 1645, 1806, 1808, 1809, 1810, 1811, 1812, 1814, - /* 480 */ 1815, 1816, 1817, 1819, 1820, 1821, 1822, 1824, 1825, 1779, - /* 490 */ 1828, 1787, 1830, 1831, 1832, 1833, 1834, 1835, 1818, 1836, - /* 500 */ 1838, 1839, 1699, 1845, 1855, 1837, 1813, 1840, 1823, 1860, - /* 510 */ 1805, 1829, 1868, 1807, 1870, 1826, 1872, 1873, 1841, 1843, - /* 520 */ 1846, 1874, 1847, 1844, 1848, 1875, 1849, 1851, 1850, 1878, - /* 530 */ 1856, 1880, 1853, 1863, 1854, 1865, 1869, 1867, 1879, 1886, - /* 540 */ 1877, 1864, 1890, 1897, 1910, 1888, 1675, 1858, 1928, 1929, - /* 550 */ 1862, 1934, 1941, 1909, 1896, 1907, 1947, 1913, 1901, 1912, - /* 560 */ 1952, 1919, 1906, 1917, 1958, 1925, 1916, 1923, 1961, 1967, - /* 570 */ 1968, 1969, 1970, 1971, 1861, 1866, 1939, 1953, 1977, 1943, - /* 580 */ 1944, 1945, 1946, 1949, 1951, 1955, 1938, 1950, 1956, 1960, - /* 590 */ 1965, 1962, 1993, 1974, 1998, 1981, 1963, 2004, 1989, 1978, - /* 600 */ 2015, 1982, 2016, 1983, 2022, 2001, 2014, 2003, 2011, 2013, - /* 610 */ 1932, 1936, 2049, 1881, 1948, 1859, 2017, 2032, 2056, 1882, - /* 620 */ 2036, 1889, 1892, 2060, 2062, 1895, 1891, 1899, 1900, 2065, - /* 630 */ 2029, 1827, 1972, 1975, 1979, 2026, 1976, 2035, 1985, 1992, - /* 640 */ 2037, 2042, 1994, 1984, 1996, 1997, 1999, 2053, 2054, 2055, - /* 650 */ 2006, 2066, 1852, 2000, 2019, 2116, 2076, 1887, 2086, 2090, - /* 660 */ 2091, 2092, 2093, 2094, 2027, 2030, 2083, 1884, 2095, 2097, - /* 670 */ 2138, 2140, 2051, 2117, 1865, 2098, 2052, 2058, 2059, 2057, - /* 680 */ 2061, 1990, 2063, 2157, 2119, 1986, 2064, 2069, 1865, 2121, - /* 690 */ 2126, 2074, 1940, 2085, 2185, 2166, 1966, 2087, 2088, 2099, - /* 700 */ 2089, 2100, 2096, 2144, 2102, 2103, 2148, 2108, 2175, 2002, - /* 710 */ 2104, 2082, 2115, 2163, 2186, 2122, 2118, 2189, 2125, 2127, - /* 720 */ 2191, 2129, 2131, 2194, 2130, 2133, 2204, 2139, 2136, 2206, - /* 730 */ 2141, 2075, 2120, 2128, 2132, 2221, 2142, 2145, 2201, 2149, - /* 740 */ 2212, 2150, 2201, 2201, 2233, 2187, 2193, 2224, 2227, 2228, - /* 750 */ 2230, 2231, 2232, 2234, 2236, 2198, 2171, 2237, 2248, 2249, - /* 760 */ 2251, 2266, 2263, 2264, 2269, 2226, 1938, 2270, 1950, 2271, - /* 770 */ 2272, 2273, 2274, 2288, 2276, 2296, 2277, 2268, 2279, 2313, - /* 780 */ 2284, 2278, 2281, 2321, 2287, 2280, 2285, 2323, 2291, 2282, - /* 790 */ 2289, 2330, 2297, 2298, 2334, 2315, 2314, 2317, 2318, 2326, - /* 800 */ 2329, + /* 50 */ 673, 202, 257, 770, 35, 376, 625, 376, 35, 35, + /* 60 */ 376, 1344, 376, 1344, 1344, 445, 376, 1, 627, 98, + /* 70 */ 98, 627, 371, 371, 153, 167, 382, 382, 98, 98, + /* 80 */ 98, 98, 98, 98, 98, 98, 98, 98, 228, 98, + /* 90 */ 98, 216, 1, 98, 98, 365, 1, 98, 228, 98, + /* 100 */ 228, 1, 98, 98, 1, 98, 1, 1, 1, 98, + /* 110 */ 478, 1004, 15, 15, 642, 171, 669, 669, 669, 669, + /* 120 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, + /* 130 */ 669, 669, 669, 669, 669, 447, 430, 153, 167, 450, + /* 140 */ 450, 281, 101, 101, 101, 898, 305, 305, 281, 216, + /* 150 */ 476, 393, 1, 623, 1, 623, 623, 601, 681, 28, + /* 160 */ 28, 28, 28, 28, 28, 28, 28, 1962, 851, 261, + /* 170 */ 368, 34, 196, 32, 340, 618, 618, 481, 568, 522, + /* 180 */ 378, 201, 938, 786, 1013, 1096, 951, 1017, 448, 951, + /* 190 */ 1177, 357, 24, 1140, 1358, 1389, 1204, 216, 1389, 216, + /* 200 */ 1232, 1405, 1385, 1410, 1405, 1385, 1291, 1427, 1405, 1427, + /* 210 */ 1385, 1291, 1291, 1368, 1378, 1427, 1383, 1427, 1427, 1427, + /* 220 */ 1468, 1442, 1468, 1442, 1389, 216, 1475, 216, 1482, 1492, + /* 230 */ 216, 1482, 216, 216, 216, 1427, 216, 1468, 1, 1, + /* 240 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1427, + /* 250 */ 1468, 623, 623, 623, 1338, 1446, 1389, 478, 1360, 1370, + /* 260 */ 1475, 478, 1375, 1140, 1427, 1410, 1410, 623, 1303, 1310, + /* 270 */ 623, 1303, 1310, 623, 623, 1, 1335, 1434, 1303, 1334, + /* 280 */ 1339, 1353, 1140, 1340, 1342, 1346, 1372, 1405, 1612, 1519, + /* 290 */ 1374, 1482, 478, 478, 1617, 1310, 623, 623, 623, 623, + /* 300 */ 623, 1310, 623, 1493, 478, 601, 478, 1405, 1572, 1577, + /* 310 */ 623, 681, 1427, 478, 1650, 1468, 2797, 2797, 2797, 2797, + /* 320 */ 2797, 2797, 2797, 2797, 2797, 1002, 1072, 225, 414, 931, + /* 330 */ 749, 943, 690, 646, 1170, 1246, 988, 1127, 1127, 1127, + /* 340 */ 1127, 1127, 1127, 1127, 1127, 1127, 720, 187, 200, 200, + /* 350 */ 662, 760, 588, 583, 561, 672, 731, 579, 611, 702, + /* 360 */ 702, 922, 8, 276, 922, 922, 922, 1243, 1040, 584, + /* 370 */ 352, 1187, 1100, 1203, 1160, 1162, 1172, 1186, 1198, 1199, + /* 380 */ 1228, 1281, 1294, 1066, 1194, 1222, 1212, 1255, 1256, 1260, + /* 390 */ 1165, 1067, 1193, 1263, 1264, 1265, 1266, 1267, 1268, 1312, + /* 400 */ 1274, 1123, 1276, 1282, 1279, 1280, 1284, 1292, 1295, 1296, + /* 410 */ 758, 421, 1197, 1306, 1341, 1286, 1315, 1698, 1700, 1702, + /* 420 */ 1661, 1704, 1670, 1491, 1682, 1685, 1686, 1506, 1724, 1692, + /* 430 */ 1705, 1521, 1739, 1525, 1742, 1708, 1746, 1726, 1751, 1717, + /* 440 */ 1542, 1755, 1557, 1757, 1559, 1560, 1569, 1573, 1763, 1765, + /* 450 */ 1766, 1580, 1582, 1769, 1770, 1725, 1771, 1738, 1727, 1775, + /* 460 */ 1730, 1778, 1737, 1780, 1781, 1783, 1741, 1785, 1786, 1789, + /* 470 */ 1790, 1791, 1792, 1634, 1764, 1798, 1647, 1808, 1809, 1810, + /* 480 */ 1813, 1815, 1816, 1818, 1820, 1822, 1823, 1825, 1827, 1828, + /* 490 */ 1829, 1831, 1833, 1787, 1843, 1802, 1845, 1846, 1847, 1848, + /* 500 */ 1850, 1852, 1832, 1853, 1855, 1856, 1714, 1858, 1859, 1842, + /* 510 */ 1826, 1849, 1830, 1875, 1814, 1851, 1877, 1819, 1880, 1834, + /* 520 */ 1882, 1884, 1854, 1836, 1862, 1887, 1857, 1839, 1869, 1890, + /* 530 */ 1860, 1863, 1874, 1894, 1865, 1898, 1872, 1876, 1873, 1871, + /* 540 */ 1879, 1905, 1881, 1921, 1891, 1883, 1924, 1930, 1938, 1902, + /* 550 */ 1760, 1943, 1944, 1945, 1885, 1946, 1949, 1916, 1903, 1914, + /* 560 */ 1955, 1922, 1907, 1919, 1970, 1937, 1925, 1934, 1975, 1942, + /* 570 */ 1927, 1940, 1980, 1982, 1984, 1985, 1988, 1989, 1888, 1889, + /* 580 */ 1956, 1971, 1994, 1972, 1974, 1977, 1979, 1981, 1983, 1992, + /* 590 */ 1973, 1996, 2006, 2007, 1993, 2008, 2029, 2022, 2045, 2024, + /* 600 */ 1997, 2047, 2027, 2015, 2052, 2018, 2054, 2020, 2056, 2035, + /* 610 */ 2038, 2025, 2026, 2033, 1958, 1963, 2059, 1897, 1967, 1878, + /* 620 */ 2036, 2050, 2077, 1892, 2066, 1917, 1918, 2090, 2091, 1923, + /* 630 */ 1915, 1926, 1932, 2093, 2058, 1838, 1991, 2009, 2011, 2067, + /* 640 */ 2016, 2068, 2019, 2017, 2075, 2076, 2023, 2028, 2030, 2037, + /* 650 */ 2032, 2078, 2081, 2082, 2040, 2079, 1867, 2041, 2042, 2127, + /* 660 */ 2097, 1886, 2099, 2109, 2112, 2114, 2115, 2117, 2049, 2051, + /* 670 */ 2110, 1900, 2119, 2124, 2156, 2159, 2071, 2138, 1871, 2137, + /* 680 */ 2083, 2085, 2087, 2084, 2092, 2021, 2094, 2193, 2155, 2034, + /* 690 */ 2095, 2086, 1871, 2153, 2157, 2104, 1957, 2107, 2207, 2188, + /* 700 */ 1995, 2108, 2111, 2113, 2116, 2118, 2121, 2165, 2120, 2125, + /* 710 */ 2170, 2123, 2192, 2010, 2134, 2105, 2135, 2187, 2203, 2140, + /* 720 */ 2147, 2209, 2154, 2152, 2223, 2158, 2161, 2224, 2160, 2162, + /* 730 */ 2225, 2164, 2168, 2227, 2166, 2142, 2145, 2148, 2149, 2251, + /* 740 */ 2163, 2173, 2233, 2176, 2246, 2179, 2233, 2233, 2262, 2216, + /* 750 */ 2218, 2252, 2253, 2255, 2265, 2267, 2270, 2272, 2274, 2235, + /* 760 */ 2214, 2268, 2279, 2280, 2282, 2296, 2284, 2288, 2289, 2241, + /* 770 */ 1973, 2290, 1996, 2291, 2292, 2293, 2295, 2307, 2297, 2331, + /* 780 */ 2299, 2287, 2298, 2338, 2304, 2302, 2315, 2343, 2309, 2308, + /* 790 */ 2320, 2360, 2332, 2321, 2333, 2380, 2347, 2349, 2385, 2364, + /* 800 */ 2366, 2368, 2370, 2367, 2373, }; -#define YY_REDUCE_COUNT (320) -#define YY_REDUCE_MIN (-439) -#define YY_REDUCE_MAX (2516) +#define YY_REDUCE_COUNT (324) +#define YY_REDUCE_MIN (-391) +#define YY_REDUCE_MAX (2356) static const short yy_reduce_ofst[] = { - /* 0 */ 284, -341, -134, -27, 205, 840, 901, 969, 1032, 1058, - /* 10 */ 1093, 1162, 1190, 368, 1225, 1312, 52, 118, 347, 493, - /* 20 */ 1342, 1413, 1471, 1485, 1502, 1572, 1591, 1607, 1678, 1713, - /* 30 */ 1743, 1780, 1842, 1857, 1908, 1922, 1973, 2033, 2048, 2106, - /* 40 */ 2123, 2137, 2174, 2195, 2261, 2275, 2292, 2391, 2407, 2426, - /* 50 */ 2516, -274, 232, 409, -292, -371, 655, 756, -136, 41, - /* 60 */ 804, -366, 146, -311, -310, -107, 482, -19, -391, -346, - /* 70 */ -315, -287, -280, -270, -266, -117, -215, -173, -250, -73, - /* 80 */ 63, 70, -209, 37, 98, 258, 295, 363, 23, 336, - /* 90 */ 373, 359, -297, 415, 511, 114, 64, 496, 184, 521, - /* 100 */ 300, 398, 524, 598, 241, 626, 489, 342, 562, 761, - /* 110 */ 81, -278, -439, -439, -5, -168, 24, 75, 137, 142, - /* 120 */ 203, 400, 446, 604, 644, 685, 783, 795, 803, 807, - /* 130 */ 855, 856, 858, 859, 868, -16, -1, 121, 227, 770, - /* 140 */ 786, 559, -1, 384, 393, 355, 154, 256, 838, 202, - /* 150 */ 848, 850, 857, 864, -271, 435, 876, -385, -347, 494, - /* 160 */ 543, 657, 735, -388, -367, 218, -388, 245, 431, 464, - /* 170 */ 430, 377, 414, 565, 523, 693, 956, 888, 614, 888, - /* 180 */ 985, 940, 993, 995, 958, 954, 899, 899, 881, 899, - /* 190 */ 927, 928, 888, 979, 965, 986, 988, 1062, 1001, 1070, - /* 200 */ 1016, 1081, 1041, 1040, 1091, 1045, 1051, 1100, 1097, 1102, - /* 210 */ 1055, 1059, 1060, 1095, 1101, 1110, 1114, 1122, 1127, 1129, - /* 220 */ 1137, 1141, 1146, 1149, 1077, 1140, 1113, 1148, 1160, 1103, - /* 230 */ 1156, 1165, 1159, 1174, 1175, 1169, 1176, 1181, 1158, 1166, - /* 240 */ 1167, 1171, 1172, 1177, 1178, 1186, 1197, 1154, 1157, 1163, - /* 250 */ 1131, 1138, 1139, 1205, 1145, 1150, 1180, 1214, 1182, 1170, - /* 260 */ 1222, 1173, 1183, 1184, 1117, 1187, 1188, 1118, 1201, 1189, - /* 270 */ 1194, 888, 1130, 1132, 1135, 1142, 1147, 1155, 1208, 1143, - /* 280 */ 1153, 1152, 899, 1287, 1212, 1185, 1193, 1293, 1289, 1292, - /* 290 */ 1246, 1245, 1274, 1275, 1276, 1279, 1295, 1250, 1297, 1270, - /* 300 */ 1311, 1299, 1320, 1327, 1231, 1301, 1298, 1316, 1337, 1338, - /* 310 */ 1350, 1348, 1285, 1280, 1300, 1302, 1323, 1325, 1326, 1339, - /* 320 */ 1362, + /* 0 */ -20, -341, -134, -27, 205, 850, 897, 1001, 1021, 1070, + /* 10 */ 1159, 1208, 1278, 158, 539, 1298, 52, 347, 1090, 1367, + /* 20 */ 358, 1402, 1432, 1469, 1499, 1531, 1568, 1598, 1645, 1671, + /* 30 */ 1732, 1745, 1796, 1812, 1861, 1912, 1928, 1941, 1961, 2031, + /* 40 */ 2064, 2080, 2101, 2167, 2180, 2191, 2204, 2281, 2294, 2305, + /* 50 */ 2356, -274, 142, 40, -292, -371, 275, 582, 419, 427, + /* 60 */ 756, -366, 47, -311, -310, 383, 410, -9, -391, -346, + /* 70 */ -315, -308, -342, -280, -265, -314, -313, -173, -229, -162, + /* 80 */ -73, 3, 17, 83, 273, 345, 351, 145, -41, 372, + /* 90 */ 573, 243, -66, 575, 674, 86, -29, 467, 38, 687, + /* 100 */ 184, 329, 762, 824, 159, 829, 460, 331, 609, 845, + /* 110 */ -285, -351, -317, -317, -85, -236, -258, 106, 528, 590, + /* 120 */ 607, 643, 656, 685, 707, 708, 709, 710, 712, 717, + /* 130 */ 723, 795, 802, 856, 871, -132, -289, -226, -174, 155, + /* 140 */ 490, 523, -289, 563, 680, 613, 517, 755, 698, 759, + /* 150 */ 797, 203, 95, 640, 41, 718, 728, 773, 838, -364, + /* 160 */ -320, 452, 484, 562, 585, 597, 562, 904, 380, 913, + /* 170 */ 936, 857, 870, 996, 881, 990, 994, 1006, 963, 1006, + /* 180 */ 1027, 985, 1039, 1042, 1000, 995, 937, 937, 911, 937, + /* 190 */ 949, 939, 1006, 992, 979, 989, 987, 1056, 998, 1057, + /* 200 */ 1008, 1074, 1029, 1031, 1088, 1044, 1048, 1112, 1113, 1116, + /* 210 */ 1075, 1078, 1079, 1107, 1117, 1128, 1121, 1134, 1135, 1136, + /* 220 */ 1145, 1143, 1148, 1146, 1071, 1137, 1102, 1139, 1156, 1099, + /* 230 */ 1154, 1163, 1169, 1171, 1173, 1168, 1174, 1188, 1158, 1161, + /* 240 */ 1164, 1166, 1167, 1175, 1176, 1178, 1179, 1181, 1182, 1185, + /* 250 */ 1196, 1150, 1151, 1153, 1126, 1130, 1141, 1206, 1144, 1149, + /* 260 */ 1180, 1213, 1184, 1192, 1221, 1189, 1205, 1183, 1108, 1191, + /* 270 */ 1209, 1120, 1201, 1217, 1220, 1006, 1142, 1147, 1152, 1155, + /* 280 */ 1157, 1190, 1210, 1132, 1200, 1195, 937, 1277, 1202, 1207, + /* 290 */ 1211, 1299, 1289, 1293, 1234, 1242, 1262, 1269, 1270, 1271, + /* 300 */ 1272, 1249, 1273, 1275, 1308, 1297, 1311, 1316, 1226, 1300, + /* 310 */ 1290, 1317, 1330, 1327, 1343, 1345, 1283, 1287, 1285, 1288, + /* 320 */ 1320, 1321, 1323, 1332, 1361, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 10 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 20 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 30 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 40 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 50 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 60 */ 2100, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 70 */ 1788, 1788, 1788, 1788, 2073, 1788, 1788, 1788, 1788, 1788, - /* 80 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 90 */ 1788, 1877, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 100 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 110 */ 1875, 2066, 2292, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 120 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 130 */ 1788, 1788, 1788, 1788, 1788, 1788, 2304, 1788, 1788, 1851, - /* 140 */ 1851, 1788, 2304, 2304, 2304, 1875, 2264, 2264, 1788, 1877, - /* 150 */ 1788, 1788, 1788, 1788, 2134, 1788, 1788, 1788, 1788, 1788, - /* 160 */ 1788, 1998, 1788, 2022, 1788, 1788, 1788, 2126, 1788, 1788, - /* 170 */ 2333, 2390, 1788, 1788, 2336, 1788, 1788, 1788, 1788, 1788, - /* 180 */ 1788, 2078, 1788, 1788, 1950, 2323, 2296, 2310, 2374, 2297, - /* 190 */ 2294, 2317, 1788, 2327, 1788, 1788, 2148, 1877, 1788, 1877, - /* 200 */ 2113, 1788, 2071, 1788, 1788, 2071, 2068, 1788, 1788, 1788, - /* 210 */ 2071, 2068, 2068, 1939, 1935, 1788, 1933, 1788, 1788, 1788, - /* 220 */ 1788, 1835, 1788, 1835, 1788, 1877, 1788, 1877, 1788, 1788, - /* 230 */ 1877, 1788, 1877, 1877, 1877, 1788, 1877, 1788, 1788, 1788, - /* 240 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 250 */ 2146, 2132, 1788, 1875, 2124, 2122, 1788, 1875, 2120, 2327, - /* 260 */ 1788, 1788, 1788, 1788, 2344, 2342, 1788, 2344, 2342, 1788, - /* 270 */ 1788, 1788, 2358, 2354, 2344, 2363, 2360, 2329, 2327, 2393, - /* 280 */ 2380, 2376, 2310, 1788, 1788, 2315, 2313, 1788, 1875, 1875, - /* 290 */ 1788, 2342, 1788, 1788, 1788, 1788, 1788, 2342, 1788, 1788, - /* 300 */ 1875, 1788, 1875, 1788, 1788, 1966, 1788, 1788, 1788, 1875, - /* 310 */ 1820, 1788, 2115, 2137, 2096, 2096, 2001, 2001, 2001, 1878, - /* 320 */ 1793, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 330 */ 1788, 1788, 1788, 2357, 2356, 2219, 1788, 2268, 2267, 2266, - /* 340 */ 2257, 2218, 1962, 1788, 2217, 2216, 1788, 1788, 1788, 1788, - /* 350 */ 1788, 1788, 1788, 1788, 1788, 2087, 2086, 2210, 1788, 1788, - /* 360 */ 2211, 2209, 2208, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 370 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 380 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 2377, 2381, 1788, - /* 390 */ 1788, 1788, 1788, 1788, 1788, 2293, 1788, 1788, 1788, 2192, - /* 400 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 410 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 420 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 430 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 440 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 450 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 460 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 470 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 480 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 490 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 500 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 510 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 520 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 530 */ 1788, 1788, 1788, 1788, 1825, 2197, 1788, 1788, 1788, 1788, - /* 540 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 550 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 560 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 570 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 580 */ 1788, 1788, 1788, 1788, 1788, 1788, 1916, 1915, 1788, 1788, - /* 590 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 600 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 610 */ 2201, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 620 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 2373, - /* 630 */ 2330, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 640 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 2192, - /* 650 */ 1788, 2355, 1788, 1788, 2371, 1788, 2375, 1788, 1788, 1788, - /* 660 */ 1788, 1788, 1788, 1788, 2303, 2299, 1788, 1788, 2295, 1788, - /* 670 */ 1788, 1788, 1788, 1788, 2200, 1788, 1788, 1788, 1788, 1788, - /* 680 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 2191, 1788, - /* 690 */ 2254, 1788, 1788, 1788, 2288, 1788, 1788, 2239, 1788, 1788, - /* 700 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 2201, 1788, 2204, - /* 710 */ 1788, 1788, 1788, 1788, 1788, 1995, 1788, 1788, 1788, 1788, - /* 720 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 730 */ 1788, 1979, 1977, 1976, 1975, 1788, 1972, 1788, 2008, 1788, - /* 740 */ 1788, 1788, 2004, 2003, 1788, 1788, 1788, 1788, 1788, 1788, - /* 750 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1896, 1788, 1788, - /* 760 */ 1788, 1788, 1788, 1788, 1788, 1788, 1888, 1788, 1887, 1788, - /* 770 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 780 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 790 */ 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, 1788, - /* 800 */ 1788, + /* 0 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 10 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 20 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 30 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 40 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 50 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 60 */ 2104, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 70 */ 1792, 1792, 1792, 1792, 2077, 1792, 1792, 1792, 1792, 1792, + /* 80 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 90 */ 1792, 1881, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 100 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 110 */ 1879, 2070, 2296, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 120 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 130 */ 1792, 1792, 1792, 1792, 1792, 1792, 2308, 1792, 1792, 1855, + /* 140 */ 1855, 1792, 2308, 2308, 2308, 1879, 2268, 2268, 1792, 1881, + /* 150 */ 2138, 1792, 1792, 1792, 1792, 1792, 1792, 2002, 1792, 1792, + /* 160 */ 1792, 1792, 1792, 2026, 1792, 1792, 1792, 2130, 1792, 1792, + /* 170 */ 2337, 2394, 1792, 1792, 2340, 1792, 1792, 1792, 1792, 1792, + /* 180 */ 1792, 2082, 1792, 1792, 1954, 2327, 2300, 2314, 2378, 2301, + /* 190 */ 2298, 2321, 1792, 2331, 1792, 1792, 2152, 1881, 1792, 1881, + /* 200 */ 2117, 1792, 2075, 1792, 1792, 2075, 2072, 1792, 1792, 1792, + /* 210 */ 2075, 2072, 2072, 1943, 1939, 1792, 1937, 1792, 1792, 1792, + /* 220 */ 1792, 1839, 1792, 1839, 1792, 1881, 1792, 1881, 1792, 1792, + /* 230 */ 1881, 1792, 1881, 1881, 1881, 1792, 1881, 1792, 1792, 1792, + /* 240 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 250 */ 1792, 1792, 1792, 1792, 2150, 2136, 1792, 1879, 2128, 2126, + /* 260 */ 1792, 1879, 2124, 2331, 1792, 1792, 1792, 1792, 2348, 2346, + /* 270 */ 1792, 2348, 2346, 1792, 1792, 1792, 2362, 2358, 2348, 2367, + /* 280 */ 2364, 2333, 2331, 2397, 2384, 2380, 2314, 1792, 1792, 2319, + /* 290 */ 2317, 1792, 1879, 1879, 1792, 2346, 1792, 1792, 1792, 1792, + /* 300 */ 1792, 2346, 1792, 1792, 1879, 1792, 1879, 1792, 1792, 1970, + /* 310 */ 1792, 1792, 1792, 1879, 1824, 1792, 2119, 2141, 2100, 2100, + /* 320 */ 2005, 2005, 2005, 1882, 1797, 1792, 1792, 1792, 1792, 1792, + /* 330 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 2361, 2360, 2223, + /* 340 */ 1792, 2272, 2271, 2270, 2261, 2222, 1966, 1792, 2221, 2220, + /* 350 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 2091, + /* 360 */ 2090, 2214, 1792, 1792, 2215, 2213, 2212, 1792, 1792, 1792, + /* 370 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 380 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 390 */ 1792, 2381, 2385, 1792, 1792, 1792, 1792, 1792, 1792, 2297, + /* 400 */ 1792, 1792, 1792, 2196, 1792, 1792, 1792, 1792, 1792, 1792, + /* 410 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 420 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 430 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 440 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 450 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 460 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 470 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 480 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 490 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 500 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 510 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 520 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 530 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1829, 2201, + /* 540 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 550 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 560 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 570 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 580 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 590 */ 1920, 1919, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 600 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 610 */ 1792, 1792, 1792, 1792, 2205, 1792, 1792, 1792, 1792, 1792, + /* 620 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 630 */ 1792, 1792, 1792, 2377, 2334, 1792, 1792, 1792, 1792, 1792, + /* 640 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 650 */ 1792, 1792, 1792, 2196, 1792, 2359, 1792, 1792, 2375, 1792, + /* 660 */ 2379, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 2307, 2303, + /* 670 */ 1792, 1792, 2299, 1792, 1792, 1792, 1792, 1792, 2204, 1792, + /* 680 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 690 */ 1792, 1792, 2195, 1792, 2258, 1792, 1792, 1792, 2292, 1792, + /* 700 */ 1792, 2243, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 710 */ 1792, 2205, 1792, 2208, 1792, 1792, 1792, 1792, 1792, 1999, + /* 720 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 730 */ 1792, 1792, 1792, 1792, 1792, 1983, 1981, 1980, 1979, 1792, + /* 740 */ 1976, 1792, 2012, 1792, 1792, 1792, 2008, 2007, 1792, 1792, + /* 750 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 760 */ 1792, 1900, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 770 */ 1892, 1792, 1891, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 780 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 790 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, + /* 800 */ 1792, 1792, 1792, 1792, 1792, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1466,6 +1428,7 @@ typedef struct yyParser yyParser; #ifndef NDEBUG #include +#include static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ @@ -1880,15 +1843,15 @@ static const char *const yyTokenName[] = { /* 377 */ "multi_drop_clause", /* 378 */ "alter_table_clause", /* 379 */ "alter_table_options", - /* 380 */ "column_def", - /* 381 */ "column_name", + /* 380 */ "column_name", + /* 381 */ "type_name", /* 382 */ "signed_literal", /* 383 */ "create_subtable_clause", /* 384 */ "specific_cols_opt", /* 385 */ "expression_list", /* 386 */ "drop_table_clause", /* 387 */ "col_name_list", - /* 388 */ "type_name", + /* 388 */ "column_def", /* 389 */ "duration_list", /* 390 */ "rollup_func_list", /* 391 */ "alter_table_option", @@ -2157,13 +2120,13 @@ static const char *const yyRuleName[] = { /* 157 */ "cmd ::= ALTER TABLE alter_table_clause", /* 158 */ "cmd ::= ALTER STABLE alter_table_clause", /* 159 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 160 */ "alter_table_clause ::= full_table_name ADD COLUMN column_def", + /* 160 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", /* 161 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 162 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_def", + /* 162 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", /* 163 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 164 */ "alter_table_clause ::= full_table_name ADD TAG column_def", + /* 164 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", /* 165 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 166 */ "alter_table_clause ::= full_table_name MODIFY TAG column_def", + /* 166 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", /* 167 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", /* 168 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", /* 169 */ "multi_create_clause ::= create_subtable_clause", @@ -2742,10 +2705,10 @@ static void yy_destructor( case 374: /* table_options */ case 378: /* alter_table_clause */ case 379: /* alter_table_options */ - case 380: /* column_def */ case 382: /* signed_literal */ case 383: /* create_subtable_clause */ case 386: /* drop_table_clause */ + case 388: /* column_def */ case 392: /* duration_literal */ case 393: /* rollup_func_name */ case 395: /* col_name */ @@ -2821,7 +2784,7 @@ static void yy_destructor( case 352: /* table_name */ case 353: /* topic_name */ case 355: /* dnode_endpoint */ - case 381: /* column_name */ + case 380: /* column_name */ case 394: /* function_name */ case 402: /* column_alias */ case 405: /* index_name */ @@ -2908,7 +2871,7 @@ static void yy_destructor( } break; - case 388: /* type_name */ + case 381: /* type_name */ { } @@ -3103,7 +3066,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); return yy_action[i]; } }while(1); @@ -3385,13 +3348,13 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 339, /* (157) cmd ::= ALTER TABLE alter_table_clause */ 339, /* (158) cmd ::= ALTER STABLE alter_table_clause */ 378, /* (159) alter_table_clause ::= full_table_name alter_table_options */ - 378, /* (160) alter_table_clause ::= full_table_name ADD COLUMN column_def */ + 378, /* (160) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ 378, /* (161) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 378, /* (162) alter_table_clause ::= full_table_name MODIFY COLUMN column_def */ + 378, /* (162) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ 378, /* (163) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 378, /* (164) alter_table_clause ::= full_table_name ADD TAG column_def */ + 378, /* (164) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ 378, /* (165) alter_table_clause ::= full_table_name DROP TAG column_name */ - 378, /* (166) alter_table_clause ::= full_table_name MODIFY TAG column_def */ + 378, /* (166) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ 378, /* (167) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ 378, /* (168) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ 375, /* (169) multi_create_clause ::= create_subtable_clause */ @@ -3406,32 +3369,32 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 371, /* (178) full_table_name ::= db_name NK_DOT table_name */ 372, /* (179) column_def_list ::= column_def */ 372, /* (180) column_def_list ::= column_def_list NK_COMMA column_def */ - 380, /* (181) column_def ::= column_name type_name */ - 380, /* (182) column_def ::= column_name type_name COMMENT NK_STRING */ - 388, /* (183) type_name ::= BOOL */ - 388, /* (184) type_name ::= TINYINT */ - 388, /* (185) type_name ::= SMALLINT */ - 388, /* (186) type_name ::= INT */ - 388, /* (187) type_name ::= INTEGER */ - 388, /* (188) type_name ::= BIGINT */ - 388, /* (189) type_name ::= FLOAT */ - 388, /* (190) type_name ::= DOUBLE */ - 388, /* (191) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 388, /* (192) type_name ::= TIMESTAMP */ - 388, /* (193) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 388, /* (194) type_name ::= TINYINT UNSIGNED */ - 388, /* (195) type_name ::= SMALLINT UNSIGNED */ - 388, /* (196) type_name ::= INT UNSIGNED */ - 388, /* (197) type_name ::= BIGINT UNSIGNED */ - 388, /* (198) type_name ::= JSON */ - 388, /* (199) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 388, /* (200) type_name ::= MEDIUMBLOB */ - 388, /* (201) type_name ::= BLOB */ - 388, /* (202) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 388, /* (203) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 388, /* (204) type_name ::= DECIMAL */ - 388, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 388, /* (206) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 388, /* (181) column_def ::= column_name type_name */ + 388, /* (182) column_def ::= column_name type_name COMMENT NK_STRING */ + 381, /* (183) type_name ::= BOOL */ + 381, /* (184) type_name ::= TINYINT */ + 381, /* (185) type_name ::= SMALLINT */ + 381, /* (186) type_name ::= INT */ + 381, /* (187) type_name ::= INTEGER */ + 381, /* (188) type_name ::= BIGINT */ + 381, /* (189) type_name ::= FLOAT */ + 381, /* (190) type_name ::= DOUBLE */ + 381, /* (191) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 381, /* (192) type_name ::= TIMESTAMP */ + 381, /* (193) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 381, /* (194) type_name ::= TINYINT UNSIGNED */ + 381, /* (195) type_name ::= SMALLINT UNSIGNED */ + 381, /* (196) type_name ::= INT UNSIGNED */ + 381, /* (197) type_name ::= BIGINT UNSIGNED */ + 381, /* (198) type_name ::= JSON */ + 381, /* (199) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 381, /* (200) type_name ::= MEDIUMBLOB */ + 381, /* (201) type_name ::= BLOB */ + 381, /* (202) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 381, /* (203) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 381, /* (204) type_name ::= DECIMAL */ + 381, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 381, /* (206) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ 373, /* (207) tags_def_opt ::= */ 373, /* (208) tags_def_opt ::= tags_def */ 376, /* (209) tags_def ::= TAGS NK_LP column_def_list NK_RP */ @@ -3626,7 +3589,7 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 431, /* (398) literal_list ::= literal_list NK_COMMA signed_literal */ 351, /* (399) db_name ::= NK_ID */ 352, /* (400) table_name ::= NK_ID */ - 381, /* (401) column_name ::= NK_ID */ + 380, /* (401) column_name ::= NK_ID */ 394, /* (402) function_name ::= NK_ID */ 432, /* (403) table_alias ::= NK_ID */ 402, /* (404) column_alias ::= NK_ID */ @@ -3995,13 +3958,13 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (157) cmd ::= ALTER TABLE alter_table_clause */ -3, /* (158) cmd ::= ALTER STABLE alter_table_clause */ -2, /* (159) alter_table_clause ::= full_table_name alter_table_options */ - -4, /* (160) alter_table_clause ::= full_table_name ADD COLUMN column_def */ + -5, /* (160) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -4, /* (161) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -4, /* (162) alter_table_clause ::= full_table_name MODIFY COLUMN column_def */ + -5, /* (162) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -5, /* (163) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -4, /* (164) alter_table_clause ::= full_table_name ADD TAG column_def */ + -5, /* (164) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -4, /* (165) alter_table_clause ::= full_table_name DROP TAG column_name */ - -4, /* (166) alter_table_clause ::= full_table_name MODIFY TAG column_def */ + -5, /* (166) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -5, /* (167) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -6, /* (168) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -1, /* (169) multi_create_clause ::= create_subtable_clause */ @@ -4469,8 +4432,9 @@ static YYACTIONTYPE yy_reduce( (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; + assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); #ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + if( yyTraceFILE ){ yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", @@ -5102,33 +5066,33 @@ static YYACTIONTYPE yy_reduce( { yylhsminor.yy952 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 160: /* alter_table_clause ::= full_table_name ADD COLUMN column_def */ -{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_ADD_COLUMN, yymsp[0].minor.yy952); } - yymsp[-3].minor.yy952 = yylhsminor.yy952; + case 160: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy169, yymsp[0].minor.yy84); } + yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 161: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ { yylhsminor.yy952 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy169); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 162: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_def */ -{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, yymsp[0].minor.yy952); } - yymsp[-3].minor.yy952 = yylhsminor.yy952; + case 162: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy169, yymsp[0].minor.yy84); } + yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 163: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ { yylhsminor.yy952 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } yymsp[-4].minor.yy952 = yylhsminor.yy952; break; - case 164: /* alter_table_clause ::= full_table_name ADD TAG column_def */ -{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_ADD_TAG, yymsp[0].minor.yy952); } - yymsp[-3].minor.yy952 = yylhsminor.yy952; + case 164: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy169, yymsp[0].minor.yy84); } + yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 165: /* alter_table_clause ::= full_table_name DROP TAG column_name */ { yylhsminor.yy952 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy169); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 166: /* alter_table_clause ::= full_table_name MODIFY TAG column_def */ -{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, yymsp[0].minor.yy952); } - yymsp[-3].minor.yy952 = yylhsminor.yy952; + case 166: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy169, yymsp[0].minor.yy84); } + yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 167: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ { yylhsminor.yy952 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index 864c3e8a31..0482a76bdd 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -215,51 +215,12 @@ class TDTestCase: tdSql.execute("use comment_test_db") tdSql.execute("create table normal_table(ts timestamp, c2 int comment 'c2 comment')") tdSql.execute("create stable super_table(ts timestamp comment 'ts', c2 int comment 'c2 comment') tags(tg int comment 'tg comment')") - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int)" tdSql.query('show create table normal_table') + create_sql = "create table `normal_table` (`ts` timestamp, `c2` int)" tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) tdSql.query('show create table super_table') create_sql = "create stable `super_table` (`ts` timestamp, `c2` int) tags (`tg` int)" tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - tdSql.execute("drop database comment_test_db") - - def alter_table_with_col_comment(self): - tdSql.execute("create database comment_test_db") - tdSql.execute("use comment_test_db") - tdSql.execute("create table normal_table(ts timestamp, c2 int comment 'c2 comment')") - tdSql.execute("create stable super_table(ts timestamp comment 'ts', c2 int comment 'c2 comment') tags(tg int comment 'tg comment')") - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int, `c3` int)" - tdSql.execute("alter table normal_table add column c3 int comment 'c3 comment'", queryTimes=1) - tdSql.query("show create table normal_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(255))" - tdSql.execute("alter table normal_table add column c4 varchar(255) comment 'c4 comment'", queryTimes=1) - tdSql.query("show create table normal_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(255), `c5` varchar(255))" - tdSql.execute("alter table normal_table add column c5 varchar(255)", queryTimes=1) - tdSql.query("show create table normal_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int, `c3` int) tags (`tg` int) sma(`ts`,`c2`)" - tdSql.execute("alter table super_table add column c3 int comment 'c3 comment'", queryTimes=1) - tdSql.query("show create table super_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(255)) tags (`tg` int) sma(`ts`,`c2`)" - tdSql.execute("alter table super_table add column c4 varchar(255) comment 'c4 comment'", queryTimes=1) - tdSql.query("show create table super_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(256)) tags (`tg` int) sma(`ts`,`c2`)" - tdSql.execute("alter table super_table modify column c4 varchar(256) comment 'c4 256 comment'", queryTimes=1) - tdSql.query("show create table super_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - tdSql.execute("drop database comment_test_db") def run(self): self.check_gitinfo() @@ -270,7 +231,6 @@ class TDTestCase: self.show_create_sysdb_sql() self.show_create_systb_sql() self.show_create_table_with_col_comment() - self.alter_table_with_col_comment() def stop(self): tdSql.close() From 366a9cc0090588b715cba5c40373827da5d6fb0c Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 24 Aug 2023 13:54:27 +0800 Subject: [PATCH 050/107] Revert "feat: support column comment" This reverts commit dcbef83deae7b18e2a9b3e0c38af81d306c9ea58. --- include/common/tmsg.h | 2 - include/common/ttokendef.h | 38 +- include/libs/nodes/cmdnodes.h | 2 +- include/util/tdef.h | 5 +- source/common/src/tmsg.c | 4 - source/dnode/mnode/impl/src/mndStb.c | 2 - source/libs/parser/inc/sql.y | 2 +- source/libs/parser/src/parTranslater.c | 2 - source/libs/parser/src/sql.c | 4635 ++++++++++++------------ tests/system-test/0-others/show.py | 13 - 10 files changed, 2337 insertions(+), 2368 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 20a39a5fb3..b6684cdd0e 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -441,7 +441,6 @@ typedef struct SField { uint8_t type; int8_t flags; int32_t bytes; - char comment[TSDB_COL_COMMENT_LEN]; } SField; typedef struct SRetention { @@ -520,7 +519,6 @@ struct SSchema { col_id_t colId; int32_t bytes; char name[TSDB_COL_NAME_LEN]; - char comment[TSDB_COL_COMMENT_LEN]; }; struct SSchema2 { diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 42b9bc8939..163c3a3d3f 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -130,25 +130,25 @@ #define TK_NK_EQ 112 #define TK_USING 113 #define TK_TAGS 114 -#define TK_COMMENT 115 -#define TK_BOOL 116 -#define TK_TINYINT 117 -#define TK_SMALLINT 118 -#define TK_INT 119 -#define TK_INTEGER 120 -#define TK_BIGINT 121 -#define TK_FLOAT 122 -#define TK_DOUBLE 123 -#define TK_BINARY 124 -#define TK_NCHAR 125 -#define TK_UNSIGNED 126 -#define TK_JSON 127 -#define TK_VARCHAR 128 -#define TK_MEDIUMBLOB 129 -#define TK_BLOB 130 -#define TK_VARBINARY 131 -#define TK_GEOMETRY 132 -#define TK_DECIMAL 133 +#define TK_BOOL 115 +#define TK_TINYINT 116 +#define TK_SMALLINT 117 +#define TK_INT 118 +#define TK_INTEGER 119 +#define TK_BIGINT 120 +#define TK_FLOAT 121 +#define TK_DOUBLE 122 +#define TK_BINARY 123 +#define TK_NCHAR 124 +#define TK_UNSIGNED 125 +#define TK_JSON 126 +#define TK_VARCHAR 127 +#define TK_MEDIUMBLOB 128 +#define TK_BLOB 129 +#define TK_VARBINARY 130 +#define TK_GEOMETRY 131 +#define TK_DECIMAL 132 +#define TK_COMMENT 133 #define TK_MAX_DELAY 134 #define TK_WATERMARK 135 #define TK_ROLLUP 136 diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index b6c4e89a33..f0a715e651 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -155,7 +155,7 @@ typedef struct SColumnDefNode { ENodeType type; char colName[TSDB_COL_NAME_LEN]; SDataType dataType; - char comments[TSDB_COL_COMMENT_LEN]; + char comments[TSDB_TB_COMMENT_LEN]; bool sma; } SColumnDefNode; diff --git a/include/util/tdef.h b/include/util/tdef.h index e9ed47465a..68a21ea4cf 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -228,9 +228,8 @@ typedef enum ELogicConditionType { #define TSDB_MAX_SQL_SHOW_LEN 1024 #define TSDB_MAX_ALLOWED_SQL_LEN (1 * 1024 * 1024u) // sql length should be less than 1mb -#define TSDB_APP_NAME_LEN TSDB_UNI_LEN -#define TSDB_TB_COMMENT_LEN 1025 -#define TSDB_COL_COMMENT_LEN 1025 +#define TSDB_APP_NAME_LEN TSDB_UNI_LEN +#define TSDB_TB_COMMENT_LEN 1025 #define TSDB_QUERY_ID_LEN 26 #define TSDB_TRANS_OPER_LEN 16 diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 6131b15e53..1431cd049a 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -534,7 +534,6 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq if (tEncodeI8(&encoder, pField->flags) < 0) return -1; if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeCStr(&encoder, pField->comment) < 0) return -1; } for (int32_t i = 0; i < pReq->numOfTags; ++i) { @@ -543,7 +542,6 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq if (tEncodeI8(&encoder, pField->flags) < 0) return -1; if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeCStr(&encoder, pField->comment) < 0) return -1; } for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { @@ -610,7 +608,6 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.comment) < 0) return -1; if (taosArrayPush(pReq->pColumns, &field) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; @@ -623,7 +620,6 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.comment) < 0) return -1; if (taosArrayPush(pReq->pTags, &field) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 0d41650394..f52ce6582b 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -839,7 +839,6 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat pSchema->bytes = pField->bytes; pSchema->flags = pField->flags; memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - memcpy(pSchema->comment, pField->comment, TSDB_COL_COMMENT_LEN); pSchema->colId = pDst->nextColId; pDst->nextColId++; } @@ -853,7 +852,6 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat SSCHMEA_SET_IDX_ON(pSchema); } memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - memcpy(pSchema->comment, pField->comment, TSDB_COL_COMMENT_LEN); pSchema->colId = pDst->nextColId; pDst->nextColId++; } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index a86666ec98..0661cc5963 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -358,7 +358,7 @@ column_def_list(A) ::= column_def(B). column_def_list(A) ::= column_def_list(B) NK_COMMA column_def(C). { A = addNodeToList(pCxt, B, C); } column_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, &B, C, NULL); } -column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); } +//column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); } %type type_name { SDataType } %destructor type_name { } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 70bd25dd2b..d593295827 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -4702,7 +4702,6 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)}; strcpy(field.name, pCol->colName); - strcpy(field.comment, pCol->comments); if (pCol->sma) { field.flags |= COL_SMA_ON; } @@ -5050,7 +5049,6 @@ static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSchem pSchema->bytes = calcTypeBytes(pCol->dataType); pSchema->flags = flags; strcpy(pSchema->name, pCol->colName); - strcpy(pSchema->comment, pCol->comments); } typedef struct SSampleAstInfo { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index bdc72592cc..05cdf10bd2 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -134,18 +134,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 805 -#define YYNRULE 605 -#define YYNRULE_WITH_ACTION 605 +#define YYNSTATE 803 +#define YYNRULE 604 +#define YYNRULE_WITH_ACTION 604 #define YYNTOKEN 339 -#define YY_MAX_SHIFT 804 -#define YY_MIN_SHIFTREDUCE 1187 -#define YY_MAX_SHIFTREDUCE 1791 -#define YY_ERROR_ACTION 1792 -#define YY_ACCEPT_ACTION 1793 -#define YY_NO_ACTION 1794 -#define YY_MIN_REDUCE 1795 -#define YY_MAX_REDUCE 2399 +#define YY_MAX_SHIFT 802 +#define YY_MIN_SHIFTREDUCE 1185 +#define YY_MAX_SHIFTREDUCE 1788 +#define YY_ERROR_ACTION 1789 +#define YY_ACCEPT_ACTION 1790 +#define YY_NO_ACTION 1791 +#define YY_MIN_REDUCE 1792 +#define YY_MAX_REDUCE 2395 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -214,286 +214,286 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (2797) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 455, 2206, 2184, 2095, 537, 693, 1972, 538, 1831, 14, - /* 10 */ 13, 673, 48, 46, 1718, 396, 2192, 1961, 2092, 680, - /* 20 */ 403, 1588, 1563, 41, 40, 135, 2188, 47, 45, 44, - /* 30 */ 43, 42, 577, 1644, 221, 1561, 693, 1972, 540, 2224, - /* 40 */ 1838, 2167, 41, 40, 1588, 350, 47, 45, 44, 43, - /* 50 */ 42, 2174, 1245, 709, 1244, 692, 135, 2184, 2184, 670, - /* 60 */ 144, 1957, 1639, 582, 2190, 400, 545, 140, 19, 538, - /* 70 */ 1831, 1963, 2193, 109, 703, 1569, 408, 670, 144, 2019, - /* 80 */ 2021, 2188, 2188, 363, 1818, 1246, 2095, 2205, 633, 2241, - /* 90 */ 145, 2370, 112, 2207, 713, 2209, 2210, 708, 1964, 703, - /* 100 */ 801, 2093, 680, 15, 185, 169, 2294, 1807, 2376, 188, - /* 110 */ 399, 2290, 1687, 2371, 659, 181, 48, 46, 692, 2190, - /* 120 */ 2190, 1590, 693, 1972, 403, 190, 1563, 1673, 1379, 703, - /* 130 */ 703, 38, 308, 2324, 2174, 371, 2078, 1644, 51, 1561, - /* 140 */ 1646, 1647, 193, 2309, 1370, 738, 737, 736, 1374, 735, - /* 150 */ 1376, 1377, 734, 731, 181, 1385, 728, 1387, 1388, 725, - /* 160 */ 722, 719, 672, 186, 2302, 2303, 1639, 142, 2307, 2306, - /* 170 */ 1619, 1629, 19, 1588, 223, 2079, 1645, 1648, 540, 1569, - /* 180 */ 1838, 286, 2302, 669, 1674, 136, 668, 1589, 2370, 693, - /* 190 */ 1972, 1564, 125, 1562, 1620, 124, 123, 122, 121, 120, - /* 200 */ 119, 118, 117, 116, 801, 657, 188, 15, 2206, 56, - /* 210 */ 2371, 659, 47, 45, 44, 43, 42, 1788, 710, 2020, - /* 220 */ 2021, 1591, 692, 1567, 1568, 1795, 1618, 1621, 1622, 1623, - /* 230 */ 1624, 1625, 1626, 1627, 1628, 705, 701, 1637, 1638, 1640, - /* 240 */ 1641, 1642, 1643, 2, 1646, 1647, 2224, 184, 678, 134, - /* 250 */ 133, 132, 131, 130, 129, 128, 127, 126, 2174, 2013, - /* 260 */ 709, 1796, 37, 401, 1668, 1669, 1670, 1671, 1672, 1676, - /* 270 */ 1677, 1678, 1679, 288, 1619, 1629, 168, 1588, 693, 1972, - /* 280 */ 1645, 1648, 125, 554, 1913, 124, 123, 122, 121, 120, - /* 290 */ 119, 118, 117, 116, 2205, 1564, 2241, 1562, 453, 112, - /* 300 */ 2207, 713, 2209, 2210, 708, 51, 703, 1414, 1415, 147, - /* 310 */ 679, 151, 2265, 2294, 2026, 2206, 1322, 399, 2290, 1793, - /* 320 */ 1787, 384, 252, 1472, 1473, 673, 251, 1567, 1568, 2024, - /* 330 */ 1618, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 705, - /* 340 */ 701, 1637, 1638, 1640, 1641, 1642, 1643, 2, 12, 48, - /* 350 */ 46, 2026, 2067, 2224, 693, 1972, 1324, 403, 393, 1563, - /* 360 */ 62, 1715, 552, 406, 2088, 2174, 2024, 709, 460, 2074, - /* 370 */ 1644, 163, 1561, 203, 454, 1220, 41, 40, 385, 1974, - /* 380 */ 47, 45, 44, 43, 42, 653, 2024, 93, 1591, 679, - /* 390 */ 358, 458, 418, 383, 2206, 611, 542, 417, 1245, 1639, - /* 400 */ 1244, 2205, 539, 2241, 707, 19, 112, 2207, 713, 2209, - /* 410 */ 2210, 708, 1569, 703, 1222, 202, 1225, 1226, 185, 1746, - /* 420 */ 2294, 2026, 41, 40, 399, 2290, 47, 45, 44, 43, - /* 430 */ 42, 1246, 2224, 2375, 466, 2074, 2025, 801, 652, 633, - /* 440 */ 15, 677, 2370, 2088, 2174, 1675, 709, 2325, 1817, 66, - /* 450 */ 1590, 2374, 449, 48, 46, 1649, 1572, 448, 30, 2376, - /* 460 */ 188, 403, 290, 1563, 2371, 659, 2224, 645, 644, 1744, - /* 470 */ 1745, 1747, 1748, 1749, 1644, 166, 1561, 1646, 1647, 62, - /* 480 */ 2205, 205, 2241, 1975, 376, 344, 2207, 713, 2209, 2210, - /* 490 */ 708, 706, 703, 694, 2259, 1722, 493, 2074, 2174, 633, - /* 500 */ 2206, 1588, 2370, 1639, 1248, 1249, 658, 1619, 1629, 2370, - /* 510 */ 710, 573, 572, 1645, 1648, 648, 1569, 290, 1758, 2376, - /* 520 */ 188, 651, 2026, 35, 2371, 659, 657, 188, 1564, 369, - /* 530 */ 1562, 2371, 659, 1680, 1781, 679, 1654, 2024, 2224, 2026, - /* 540 */ 266, 801, 1588, 210, 49, 750, 398, 2206, 62, 12, - /* 550 */ 2174, 10, 709, 377, 2024, 375, 374, 710, 579, 1840, - /* 560 */ 1567, 1568, 581, 1618, 1621, 1622, 1623, 1624, 1625, 1626, - /* 570 */ 1627, 1628, 705, 701, 1637, 1638, 1640, 1641, 1642, 1643, - /* 580 */ 2, 1646, 1647, 2057, 580, 2224, 2205, 688, 2241, 2088, - /* 590 */ 618, 113, 2207, 713, 2209, 2210, 708, 2174, 703, 709, - /* 600 */ 609, 658, 288, 90, 2370, 2294, 654, 649, 642, 2293, - /* 610 */ 2290, 1619, 1629, 607, 1575, 605, 632, 1645, 1648, 1714, - /* 620 */ 373, 657, 188, 207, 693, 1972, 2371, 659, 154, 1967, - /* 630 */ 412, 411, 1564, 2205, 1562, 2241, 290, 12, 112, 2207, - /* 640 */ 713, 2209, 2210, 708, 468, 703, 146, 1589, 34, 2265, - /* 650 */ 2390, 1620, 2294, 1570, 41, 40, 399, 2290, 47, 45, - /* 660 */ 44, 43, 42, 86, 1567, 1568, 85, 1618, 1621, 1622, - /* 670 */ 1623, 1624, 1625, 1626, 1627, 1628, 705, 701, 1637, 1638, - /* 680 */ 1640, 1641, 1642, 1643, 2, 48, 46, 2168, 55, 2206, - /* 690 */ 1949, 1563, 1620, 403, 1333, 1563, 693, 1972, 1569, 710, - /* 700 */ 2206, 397, 693, 1972, 1561, 290, 1644, 1332, 1561, 166, - /* 710 */ 710, 2026, 595, 594, 593, 741, 483, 1974, 407, 585, - /* 720 */ 141, 589, 484, 693, 1972, 588, 2024, 2224, 52, 661, - /* 730 */ 587, 592, 379, 378, 633, 1639, 586, 2370, 2224, 2174, - /* 740 */ 60, 709, 478, 553, 1569, 253, 500, 630, 1569, 1914, - /* 750 */ 2174, 477, 709, 1337, 2376, 188, 760, 41, 40, 2371, - /* 760 */ 659, 47, 45, 44, 43, 42, 1336, 1489, 1490, 801, - /* 770 */ 670, 144, 509, 801, 437, 2205, 49, 2241, 670, 144, - /* 780 */ 170, 2207, 713, 2209, 2210, 708, 2205, 703, 2241, 48, - /* 790 */ 46, 170, 2207, 713, 2209, 2210, 708, 403, 703, 1563, - /* 800 */ 1228, 439, 435, 1488, 1491, 748, 1587, 212, 211, 534, - /* 810 */ 1644, 1573, 1561, 1646, 1647, 1534, 1535, 532, 693, 1972, - /* 820 */ 528, 524, 634, 2335, 156, 155, 745, 744, 743, 153, - /* 830 */ 499, 511, 406, 1959, 2336, 748, 299, 300, 676, 1639, - /* 840 */ 166, 298, 2375, 1619, 1629, 2370, 575, 574, 1974, 1645, - /* 850 */ 1648, 1874, 1569, 1757, 156, 155, 745, 744, 743, 153, - /* 860 */ 1564, 108, 1562, 2374, 1564, 1955, 1562, 2371, 2373, 2375, - /* 870 */ 1816, 105, 2370, 62, 187, 2302, 2303, 801, 142, 2307, - /* 880 */ 15, 2206, 189, 2302, 2303, 290, 142, 2307, 591, 590, - /* 890 */ 2374, 710, 1567, 1568, 2371, 2372, 1567, 1568, 1948, 1618, - /* 900 */ 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 705, 701, - /* 910 */ 1637, 1638, 1640, 1641, 1642, 1643, 2, 1646, 1647, 2224, - /* 920 */ 2174, 595, 594, 593, 693, 1972, 693, 1972, 585, 141, - /* 930 */ 589, 2174, 1815, 709, 588, 600, 44, 43, 42, 587, - /* 940 */ 592, 379, 378, 740, 1969, 586, 255, 1619, 1629, 1814, - /* 950 */ 610, 41, 40, 1645, 1648, 47, 45, 44, 43, 42, - /* 960 */ 447, 695, 446, 2266, 250, 750, 259, 2205, 1564, 2241, - /* 970 */ 1562, 103, 113, 2207, 713, 2209, 2210, 708, 704, 703, - /* 980 */ 603, 409, 2174, 1225, 1226, 1813, 2294, 597, 1947, 166, - /* 990 */ 698, 2290, 445, 249, 616, 2309, 1965, 1974, 1812, 2174, - /* 1000 */ 1567, 1568, 1871, 1618, 1621, 1622, 1623, 1624, 1625, 1626, - /* 1010 */ 1627, 1628, 705, 701, 1637, 1638, 1640, 1641, 1642, 1643, - /* 1020 */ 2, 2305, 354, 167, 1586, 693, 1972, 1811, 329, 742, - /* 1030 */ 290, 491, 2017, 70, 507, 2174, 69, 506, 693, 1972, - /* 1040 */ 2157, 633, 326, 73, 2370, 263, 72, 1734, 2174, 1810, - /* 1050 */ 1809, 1806, 1805, 474, 1804, 508, 9, 351, 303, 1803, - /* 1060 */ 476, 2376, 188, 772, 770, 1802, 2371, 659, 219, 519, - /* 1070 */ 517, 514, 778, 777, 776, 775, 415, 2174, 774, 773, - /* 1080 */ 148, 768, 767, 766, 765, 764, 763, 762, 158, 758, - /* 1090 */ 757, 756, 414, 413, 753, 752, 751, 176, 175, 2174, - /* 1100 */ 2174, 2174, 2174, 748, 2174, 237, 372, 746, 62, 2174, - /* 1110 */ 2017, 662, 2309, 693, 1972, 2174, 1591, 747, 462, 90, - /* 1120 */ 2017, 173, 156, 155, 745, 744, 743, 153, 581, 571, - /* 1130 */ 567, 563, 559, 690, 236, 41, 40, 1801, 2304, 47, - /* 1140 */ 45, 44, 43, 42, 1800, 1968, 322, 111, 504, 2003, - /* 1150 */ 580, 498, 497, 496, 495, 490, 489, 488, 487, 486, - /* 1160 */ 482, 481, 480, 479, 353, 471, 470, 469, 674, 464, - /* 1170 */ 463, 370, 36, 2139, 91, 693, 1972, 234, 41, 40, - /* 1180 */ 693, 1972, 47, 45, 44, 43, 42, 2174, 81, 80, - /* 1190 */ 452, 700, 2206, 200, 2174, 691, 693, 1972, 1799, 697, - /* 1200 */ 309, 2266, 710, 1950, 2332, 761, 444, 442, 1934, 2314, - /* 1210 */ 1707, 583, 584, 1798, 74, 633, 410, 352, 2370, 54, - /* 1220 */ 433, 3, 254, 431, 427, 423, 420, 445, 1858, 83, - /* 1230 */ 2224, 137, 1571, 1320, 1318, 2376, 188, 665, 154, 2206, - /* 1240 */ 2371, 659, 2174, 2160, 709, 233, 227, 149, 2174, 710, - /* 1250 */ 596, 2345, 232, 550, 41, 40, 1808, 432, 47, 45, - /* 1260 */ 44, 43, 42, 2174, 84, 290, 154, 242, 265, 244, - /* 1270 */ 240, 225, 243, 613, 264, 612, 1707, 2224, 2205, 246, - /* 1280 */ 2241, 1849, 245, 112, 2207, 713, 2209, 2210, 708, 2174, - /* 1290 */ 703, 709, 425, 248, 1847, 2390, 247, 2294, 1529, 50, - /* 1300 */ 50, 399, 2290, 598, 270, 1790, 1791, 154, 50, 296, - /* 1310 */ 71, 152, 154, 14, 13, 1841, 601, 94, 64, 754, - /* 1320 */ 50, 1279, 262, 50, 717, 2205, 1532, 2241, 152, 2195, - /* 1330 */ 112, 2207, 713, 2209, 2210, 708, 154, 703, 2338, 138, - /* 1340 */ 152, 1298, 2390, 2206, 2294, 283, 1665, 646, 399, 2290, - /* 1350 */ 663, 139, 277, 710, 755, 640, 412, 411, 1912, 1743, - /* 1360 */ 1742, 1280, 1911, 2206, 272, 796, 1577, 675, 1486, 301, - /* 1370 */ 685, 305, 1363, 710, 386, 2363, 1296, 1644, 1681, 1570, - /* 1380 */ 1630, 2224, 416, 321, 1392, 2197, 2225, 2083, 1396, 1832, - /* 1390 */ 1574, 2014, 285, 2174, 1837, 709, 1403, 2328, 671, 1401, - /* 1400 */ 157, 2224, 282, 5, 1, 419, 1639, 424, 367, 1594, - /* 1410 */ 440, 441, 2206, 2174, 195, 709, 196, 198, 165, 1569, - /* 1420 */ 443, 1510, 710, 316, 2313, 1587, 459, 209, 461, 2205, - /* 1430 */ 1591, 2241, 2206, 2084, 112, 2207, 713, 2209, 2210, 708, - /* 1440 */ 465, 703, 710, 467, 699, 472, 2390, 1586, 2294, 2205, - /* 1450 */ 2224, 2241, 399, 2290, 112, 2207, 713, 2209, 2210, 708, - /* 1460 */ 502, 703, 2174, 485, 709, 492, 2390, 2076, 2294, 512, - /* 1470 */ 2224, 513, 399, 2290, 494, 501, 503, 510, 666, 214, - /* 1480 */ 213, 515, 2174, 516, 709, 216, 518, 520, 1592, 535, - /* 1490 */ 4, 536, 543, 546, 544, 1589, 547, 224, 2205, 226, - /* 1500 */ 2241, 2206, 1593, 112, 2207, 713, 2209, 2210, 708, 548, - /* 1510 */ 703, 710, 1595, 549, 229, 2390, 551, 2294, 2205, 555, - /* 1520 */ 2241, 399, 2290, 171, 2207, 713, 2209, 2210, 708, 231, - /* 1530 */ 703, 88, 576, 89, 235, 1578, 114, 1573, 578, 2224, - /* 1540 */ 357, 1962, 2148, 2145, 239, 2144, 1958, 241, 615, 92, - /* 1550 */ 2206, 2174, 617, 709, 150, 159, 160, 621, 1960, 1956, - /* 1560 */ 710, 161, 162, 317, 256, 622, 620, 1581, 1583, 258, - /* 1570 */ 1517, 260, 628, 647, 625, 637, 660, 2391, 2344, 683, - /* 1580 */ 701, 1637, 1638, 1640, 1641, 1642, 1643, 2205, 2224, 2241, - /* 1590 */ 2343, 2329, 112, 2207, 713, 2209, 2210, 708, 268, 703, - /* 1600 */ 2174, 643, 709, 626, 2269, 627, 2294, 2339, 271, 389, - /* 1610 */ 399, 2290, 650, 8, 638, 2316, 656, 635, 636, 276, - /* 1620 */ 2206, 2393, 174, 281, 278, 279, 667, 390, 664, 143, - /* 1630 */ 710, 1707, 1590, 1712, 2310, 1710, 2205, 1596, 2241, 2089, - /* 1640 */ 2206, 112, 2207, 713, 2209, 2210, 708, 291, 703, 318, - /* 1650 */ 710, 98, 178, 2267, 681, 2294, 319, 280, 2224, 399, - /* 1660 */ 2290, 682, 2103, 2102, 2101, 395, 100, 686, 1973, 102, - /* 1670 */ 2174, 191, 709, 320, 289, 61, 2275, 284, 2224, 687, - /* 1680 */ 104, 323, 2018, 2369, 715, 312, 797, 1935, 798, 800, - /* 1690 */ 2174, 325, 709, 359, 332, 346, 360, 336, 2166, 53, - /* 1700 */ 2165, 327, 2164, 78, 2161, 421, 2205, 422, 2241, 2206, - /* 1710 */ 347, 112, 2207, 713, 2209, 2210, 708, 1554, 703, 710, - /* 1720 */ 1555, 194, 426, 696, 2159, 2294, 711, 428, 2241, 399, - /* 1730 */ 2290, 113, 2207, 713, 2209, 2210, 708, 430, 703, 2158, - /* 1740 */ 429, 368, 2156, 434, 2206, 2294, 2155, 2224, 436, 362, - /* 1750 */ 2290, 2154, 438, 1545, 710, 2135, 197, 2134, 199, 2174, - /* 1760 */ 79, 709, 1513, 2116, 1512, 2115, 2114, 450, 451, 2113, - /* 1770 */ 2112, 2066, 1463, 456, 2206, 2063, 457, 201, 2062, 82, - /* 1780 */ 2061, 2060, 2224, 2065, 710, 2064, 2059, 387, 204, 2058, - /* 1790 */ 2056, 2055, 2054, 206, 2174, 2205, 709, 2241, 2053, 473, - /* 1800 */ 113, 2207, 713, 2209, 2210, 708, 475, 703, 2069, 2052, - /* 1810 */ 2051, 2206, 2224, 2050, 2294, 2049, 2048, 388, 2047, 2291, - /* 1820 */ 2046, 710, 2045, 2044, 2174, 2043, 709, 2042, 2041, 2040, - /* 1830 */ 2205, 2039, 2241, 2038, 208, 345, 2207, 713, 2209, 2210, - /* 1840 */ 708, 2206, 703, 2037, 87, 2036, 2035, 2034, 2068, 2224, - /* 1850 */ 2033, 710, 2032, 2031, 1465, 2030, 2029, 505, 2028, 2027, - /* 1860 */ 2205, 2174, 2241, 709, 1334, 345, 2207, 713, 2209, 2210, - /* 1870 */ 708, 1338, 703, 2206, 355, 1877, 215, 1876, 356, 2224, - /* 1880 */ 1875, 217, 1873, 710, 1870, 522, 1330, 1869, 526, 521, - /* 1890 */ 1862, 2174, 525, 709, 1851, 529, 218, 2205, 1827, 2241, - /* 1900 */ 533, 523, 338, 2207, 713, 2209, 2210, 708, 527, 703, - /* 1910 */ 2206, 2224, 530, 531, 220, 76, 394, 182, 2194, 1227, - /* 1920 */ 707, 1826, 77, 2174, 2133, 709, 183, 2205, 541, 2241, - /* 1930 */ 2123, 222, 171, 2207, 713, 2209, 2210, 708, 2111, 703, - /* 1940 */ 2206, 228, 230, 2110, 2087, 1951, 1872, 655, 2224, 1868, - /* 1950 */ 710, 556, 557, 558, 1272, 1866, 561, 560, 562, 2205, - /* 1960 */ 2174, 2241, 709, 619, 345, 2207, 713, 2209, 2210, 708, - /* 1970 */ 1864, 703, 564, 566, 565, 1861, 569, 568, 2224, 570, - /* 1980 */ 1846, 804, 1844, 402, 1845, 1843, 2392, 2206, 1823, 1953, - /* 1990 */ 2174, 1408, 709, 1407, 1952, 315, 2205, 710, 2241, 238, - /* 2000 */ 63, 344, 2207, 713, 2209, 2210, 708, 1321, 703, 1319, - /* 2010 */ 2260, 180, 1317, 2206, 1316, 1308, 1315, 769, 1314, 794, - /* 2020 */ 790, 786, 782, 710, 313, 2224, 2205, 1313, 2241, 1859, - /* 2030 */ 404, 345, 2207, 713, 2209, 2210, 708, 2174, 703, 709, - /* 2040 */ 771, 1310, 1309, 1307, 380, 1850, 381, 1848, 599, 382, - /* 2050 */ 602, 2224, 1822, 604, 1821, 606, 1820, 608, 115, 2132, - /* 2060 */ 1539, 1541, 1543, 2174, 110, 709, 29, 306, 1538, 57, - /* 2070 */ 67, 1519, 1521, 2205, 2206, 2241, 1523, 2122, 345, 2207, - /* 2080 */ 713, 2209, 2210, 708, 710, 703, 164, 2206, 623, 624, - /* 2090 */ 2109, 2108, 261, 629, 31, 1498, 2375, 710, 1497, 614, - /* 2100 */ 689, 2241, 20, 17, 340, 2207, 713, 2209, 2210, 708, - /* 2110 */ 631, 703, 2224, 1760, 267, 6, 7, 639, 641, 21, - /* 2120 */ 22, 269, 274, 33, 2174, 2224, 709, 1741, 275, 2195, - /* 2130 */ 65, 172, 23, 273, 1775, 293, 1733, 2174, 2206, 709, - /* 2140 */ 32, 24, 292, 95, 1774, 1780, 1781, 391, 710, 1779, - /* 2150 */ 1778, 18, 392, 1704, 2206, 1703, 2107, 287, 58, 2086, - /* 2160 */ 2205, 257, 2241, 59, 710, 330, 2207, 713, 2209, 2210, - /* 2170 */ 708, 177, 703, 2205, 96, 2241, 2224, 97, 328, 2207, - /* 2180 */ 713, 2209, 2210, 708, 294, 703, 25, 297, 2174, 295, - /* 2190 */ 709, 1739, 2224, 2085, 99, 302, 684, 68, 101, 105, - /* 2200 */ 307, 26, 11, 2206, 2174, 1656, 709, 304, 1655, 13, - /* 2210 */ 1579, 2244, 179, 710, 1611, 1634, 702, 192, 1666, 714, - /* 2220 */ 1632, 39, 716, 16, 2205, 1631, 2241, 1603, 27, 331, - /* 2230 */ 2207, 713, 2209, 2210, 708, 712, 703, 28, 405, 1393, - /* 2240 */ 2205, 2224, 2241, 718, 720, 337, 2207, 713, 2209, 2210, - /* 2250 */ 708, 1390, 703, 2174, 2206, 709, 1389, 721, 723, 726, - /* 2260 */ 729, 724, 732, 727, 710, 1386, 1380, 730, 1384, 733, - /* 2270 */ 2206, 1383, 1378, 1369, 1382, 1381, 106, 310, 739, 107, - /* 2280 */ 710, 1402, 75, 2206, 1398, 1270, 749, 1302, 1301, 2205, - /* 2290 */ 1300, 2241, 2224, 710, 341, 2207, 713, 2209, 2210, 708, - /* 2300 */ 1299, 703, 1297, 2206, 2174, 1295, 709, 1294, 2224, 1293, - /* 2310 */ 1328, 759, 311, 710, 1291, 1290, 1325, 1289, 1288, 1287, - /* 2320 */ 2174, 2224, 709, 1286, 1285, 1323, 1282, 1281, 1278, 1276, - /* 2330 */ 1277, 1867, 1275, 2174, 779, 709, 780, 781, 1865, 783, - /* 2340 */ 2205, 2224, 2241, 1863, 787, 333, 2207, 713, 2209, 2210, - /* 2350 */ 708, 784, 703, 2174, 785, 709, 2205, 788, 2241, 789, - /* 2360 */ 1860, 342, 2207, 713, 2209, 2210, 708, 791, 703, 2205, - /* 2370 */ 792, 2241, 793, 2206, 334, 2207, 713, 2209, 2210, 708, - /* 2380 */ 1842, 703, 795, 710, 1217, 1819, 314, 799, 802, 2205, - /* 2390 */ 1565, 2241, 324, 803, 343, 2207, 713, 2209, 2210, 708, - /* 2400 */ 1794, 703, 1794, 1794, 1794, 1794, 2206, 1794, 1794, 1794, - /* 2410 */ 1794, 2224, 1794, 1794, 1794, 1794, 710, 1794, 1794, 1794, - /* 2420 */ 1794, 1794, 2206, 2174, 1794, 709, 1794, 1794, 1794, 1794, - /* 2430 */ 1794, 1794, 710, 1794, 1794, 1794, 1794, 1794, 1794, 1794, - /* 2440 */ 1794, 1794, 1794, 2206, 2224, 1794, 1794, 1794, 1794, 1794, - /* 2450 */ 1794, 1794, 1794, 710, 1794, 1794, 2174, 1794, 709, 2205, - /* 2460 */ 2224, 2241, 1794, 1794, 335, 2207, 713, 2209, 2210, 708, - /* 2470 */ 1794, 703, 2174, 1794, 709, 1794, 1794, 1794, 1794, 1794, - /* 2480 */ 1794, 2224, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, - /* 2490 */ 1794, 1794, 2205, 2174, 2241, 709, 1794, 348, 2207, 713, - /* 2500 */ 2209, 2210, 708, 1794, 703, 1794, 1794, 1794, 2205, 2206, - /* 2510 */ 2241, 1794, 1794, 349, 2207, 713, 2209, 2210, 708, 710, - /* 2520 */ 703, 1794, 2206, 1794, 1794, 1794, 1794, 1794, 1794, 2205, - /* 2530 */ 1794, 2241, 710, 2206, 2218, 2207, 713, 2209, 2210, 708, - /* 2540 */ 1794, 703, 1794, 710, 1794, 1794, 2206, 2224, 1794, 1794, - /* 2550 */ 1794, 1794, 1794, 1794, 1794, 1794, 710, 1794, 1794, 2174, - /* 2560 */ 2224, 709, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, - /* 2570 */ 1794, 2224, 2174, 1794, 709, 1794, 1794, 1794, 1794, 1794, - /* 2580 */ 1794, 1794, 1794, 2174, 2224, 709, 1794, 1794, 1794, 1794, - /* 2590 */ 1794, 1794, 1794, 1794, 1794, 2205, 2174, 2241, 709, 1794, - /* 2600 */ 2217, 2207, 713, 2209, 2210, 708, 1794, 703, 2205, 1794, - /* 2610 */ 2241, 1794, 1794, 2216, 2207, 713, 2209, 2210, 708, 2205, - /* 2620 */ 703, 2241, 1794, 2206, 364, 2207, 713, 2209, 2210, 708, - /* 2630 */ 1794, 703, 2205, 710, 2241, 1794, 2206, 365, 2207, 713, - /* 2640 */ 2209, 2210, 708, 1794, 703, 1794, 710, 2206, 1794, 1794, - /* 2650 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 710, 1794, 1794, - /* 2660 */ 1794, 2224, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, - /* 2670 */ 1794, 1794, 1794, 2174, 2224, 709, 1794, 1794, 1794, 1794, - /* 2680 */ 1794, 1794, 1794, 1794, 1794, 2224, 2174, 1794, 709, 1794, - /* 2690 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 2174, 2206, 709, - /* 2700 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 710, 2205, - /* 2710 */ 1794, 2241, 1794, 1794, 361, 2207, 713, 2209, 2210, 708, - /* 2720 */ 1794, 703, 2205, 1794, 2241, 1794, 1794, 366, 2207, 713, - /* 2730 */ 2209, 2210, 708, 711, 703, 2241, 2224, 1794, 340, 2207, - /* 2740 */ 713, 2209, 2210, 708, 1794, 703, 1794, 1794, 2174, 1794, - /* 2750 */ 709, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, - /* 2760 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, - /* 2770 */ 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, - /* 2780 */ 1794, 1794, 1794, 1794, 2205, 1794, 2241, 1794, 1794, 339, - /* 2790 */ 2207, 713, 2209, 2210, 708, 1794, 703, + /* 0 */ 455, 2202, 2180, 2091, 537, 693, 1969, 538, 1828, 14, + /* 10 */ 13, 673, 48, 46, 1715, 396, 2188, 1958, 2088, 680, + /* 20 */ 403, 1585, 1560, 41, 40, 135, 2184, 47, 45, 44, + /* 30 */ 43, 42, 577, 1641, 221, 1558, 693, 1969, 540, 2220, + /* 40 */ 1835, 2163, 41, 40, 692, 350, 47, 45, 44, 43, + /* 50 */ 42, 2170, 2371, 709, 1954, 542, 135, 2180, 2180, 670, + /* 60 */ 144, 539, 1636, 582, 2186, 400, 38, 308, 19, 1587, + /* 70 */ 2091, 1960, 2189, 109, 703, 1566, 545, 670, 144, 538, + /* 80 */ 1828, 2184, 2184, 363, 181, 2089, 680, 2201, 633, 2237, + /* 90 */ 145, 2366, 112, 2203, 713, 2205, 2206, 708, 1961, 703, + /* 100 */ 799, 181, 1320, 15, 185, 2075, 2290, 397, 2372, 188, + /* 110 */ 399, 2286, 1684, 2367, 659, 166, 48, 46, 678, 2186, + /* 120 */ 2186, 371, 2074, 1971, 403, 190, 1560, 1670, 1376, 703, + /* 130 */ 703, 408, 223, 2320, 2015, 2017, 540, 1641, 1835, 1558, + /* 140 */ 1643, 1644, 1322, 1367, 738, 737, 736, 1371, 735, 1373, + /* 150 */ 1374, 734, 731, 1778, 1382, 728, 1384, 1385, 725, 722, + /* 160 */ 719, 168, 672, 186, 2298, 2299, 1636, 142, 2303, 1910, + /* 170 */ 1616, 1626, 19, 1585, 693, 1969, 1642, 1645, 169, 1566, + /* 180 */ 1804, 286, 2298, 669, 1671, 136, 668, 1586, 2366, 693, + /* 190 */ 1969, 1561, 125, 1559, 193, 124, 123, 122, 121, 120, + /* 200 */ 119, 118, 117, 116, 799, 657, 188, 15, 2202, 56, + /* 210 */ 2367, 659, 47, 45, 44, 43, 42, 1785, 710, 2016, + /* 220 */ 2017, 288, 692, 1564, 1565, 1792, 1615, 1618, 1619, 1620, + /* 230 */ 1621, 1622, 1623, 1624, 1625, 705, 701, 1634, 1635, 1637, + /* 240 */ 1638, 1639, 1640, 2, 1643, 1644, 2220, 184, 103, 134, + /* 250 */ 133, 132, 131, 130, 129, 128, 127, 126, 2170, 2009, + /* 260 */ 709, 1793, 37, 401, 1665, 1666, 1667, 1668, 1669, 1673, + /* 270 */ 1674, 1675, 1676, 1962, 1616, 1626, 1672, 554, 693, 1969, + /* 280 */ 1642, 1645, 125, 1246, 1247, 124, 123, 122, 121, 120, + /* 290 */ 119, 118, 117, 116, 2201, 1561, 2237, 1559, 453, 112, + /* 300 */ 2203, 713, 2205, 2206, 708, 51, 703, 1411, 1412, 147, + /* 310 */ 1719, 151, 2261, 2290, 2022, 2202, 1585, 399, 2286, 1790, + /* 320 */ 1784, 384, 252, 1469, 1470, 673, 251, 1564, 1565, 2020, + /* 330 */ 1615, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 705, + /* 340 */ 701, 1634, 1635, 1637, 1638, 1639, 1640, 2, 12, 48, + /* 350 */ 46, 412, 411, 2220, 35, 460, 2070, 403, 1243, 1560, + /* 360 */ 1242, 154, 692, 406, 1677, 2170, 653, 709, 466, 2070, + /* 370 */ 1641, 163, 1558, 140, 1567, 1218, 41, 40, 385, 1971, + /* 380 */ 47, 45, 44, 43, 42, 581, 2020, 93, 1588, 580, + /* 390 */ 358, 1244, 418, 383, 2202, 611, 1585, 417, 1243, 1636, + /* 400 */ 1242, 2201, 202, 2237, 707, 19, 112, 2203, 713, 2205, + /* 410 */ 2206, 708, 1566, 703, 1220, 205, 1223, 1224, 185, 1743, + /* 420 */ 2290, 55, 41, 40, 399, 2286, 47, 45, 44, 43, + /* 430 */ 42, 1244, 2220, 1586, 493, 2070, 12, 799, 10, 633, + /* 440 */ 15, 2022, 2366, 500, 2170, 51, 709, 2321, 393, 66, + /* 450 */ 748, 1815, 449, 48, 46, 1646, 2020, 448, 30, 2372, + /* 460 */ 188, 403, 376, 1560, 2367, 659, 1617, 645, 644, 1741, + /* 470 */ 1742, 1744, 1745, 1746, 1641, 253, 1558, 1643, 1644, 62, + /* 480 */ 2201, 210, 2237, 573, 572, 344, 2203, 713, 2205, 2206, + /* 490 */ 708, 706, 703, 694, 2255, 90, 609, 693, 1969, 633, + /* 500 */ 2202, 2170, 2366, 1636, 212, 211, 632, 1616, 1626, 607, + /* 510 */ 710, 605, 373, 1642, 1645, 618, 1566, 454, 1755, 2372, + /* 520 */ 188, 1964, 2022, 648, 2367, 659, 665, 499, 1561, 369, + /* 530 */ 1559, 377, 1570, 375, 374, 406, 579, 2020, 2220, 108, + /* 540 */ 266, 799, 1331, 166, 49, 1531, 1532, 2202, 62, 105, + /* 550 */ 2170, 1971, 709, 1486, 1487, 1330, 2164, 710, 581, 1837, + /* 560 */ 1564, 1565, 580, 1615, 1618, 1619, 1620, 1621, 1622, 1623, + /* 570 */ 1624, 1625, 705, 701, 1634, 1635, 1637, 1638, 1639, 1640, + /* 580 */ 2, 1643, 1644, 2053, 12, 2220, 2201, 2305, 2237, 1485, + /* 590 */ 1488, 113, 2203, 713, 2205, 2206, 708, 2170, 703, 709, + /* 600 */ 2135, 658, 290, 633, 2366, 2290, 2366, 575, 574, 2289, + /* 610 */ 2286, 1616, 1626, 2302, 654, 649, 642, 1642, 1645, 1566, + /* 620 */ 509, 657, 188, 2372, 188, 2305, 2367, 659, 2367, 659, + /* 630 */ 60, 583, 1561, 2201, 1559, 2237, 290, 630, 112, 2203, + /* 640 */ 713, 2205, 2206, 708, 1814, 703, 693, 1969, 34, 254, + /* 650 */ 2386, 2301, 2290, 1318, 41, 40, 399, 2286, 47, 45, + /* 660 */ 44, 43, 42, 679, 1564, 1565, 468, 1615, 1618, 1619, + /* 670 */ 1620, 1621, 1622, 1623, 1624, 1625, 705, 701, 1634, 1635, + /* 680 */ 1637, 1638, 1639, 1640, 2, 48, 46, 693, 1969, 2202, + /* 690 */ 534, 1560, 1946, 403, 2170, 1560, 693, 1969, 532, 710, + /* 700 */ 2202, 528, 524, 1651, 1558, 290, 1641, 483, 1558, 1585, + /* 710 */ 710, 2022, 595, 594, 593, 552, 484, 2084, 398, 585, + /* 720 */ 141, 589, 739, 693, 1969, 588, 2020, 2220, 62, 409, + /* 730 */ 587, 592, 379, 378, 1944, 1636, 586, 166, 2220, 2170, + /* 740 */ 1585, 709, 478, 553, 1566, 1971, 693, 1969, 1566, 1911, + /* 750 */ 2170, 477, 709, 2022, 693, 1969, 146, 41, 40, 2261, + /* 760 */ 407, 47, 45, 44, 43, 42, 1966, 666, 2020, 799, + /* 770 */ 670, 144, 652, 799, 255, 2201, 49, 2237, 670, 144, + /* 780 */ 170, 2203, 713, 2205, 2206, 708, 2201, 703, 2237, 48, + /* 790 */ 46, 170, 2203, 713, 2205, 2206, 708, 403, 703, 1560, + /* 800 */ 2220, 41, 40, 52, 679, 47, 45, 44, 43, 42, + /* 810 */ 1641, 1335, 1558, 1643, 1644, 746, 156, 155, 743, 742, + /* 820 */ 741, 153, 634, 2331, 1334, 746, 156, 155, 743, 742, + /* 830 */ 741, 153, 591, 590, 2332, 299, 300, 693, 1969, 1636, + /* 840 */ 298, 693, 1969, 1616, 1626, 693, 1969, 758, 1813, 1642, + /* 850 */ 1645, 1871, 1566, 1754, 1956, 651, 677, 263, 2084, 1617, + /* 860 */ 1561, 676, 1559, 2334, 1561, 303, 1559, 746, 156, 155, + /* 870 */ 743, 742, 741, 153, 187, 2298, 2299, 799, 142, 2303, + /* 880 */ 15, 2202, 189, 2298, 2299, 290, 142, 2303, 1587, 511, + /* 890 */ 1617, 710, 1564, 1565, 2305, 1952, 1564, 1565, 2170, 1615, + /* 900 */ 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 705, 701, + /* 910 */ 1634, 1635, 1637, 1638, 1639, 1640, 2, 1643, 1644, 2220, + /* 920 */ 2300, 595, 594, 593, 693, 1969, 693, 1969, 585, 141, + /* 930 */ 589, 2170, 1812, 709, 588, 600, 44, 43, 42, 587, + /* 940 */ 592, 379, 378, 679, 690, 586, 691, 1616, 1626, 1973, + /* 950 */ 610, 41, 40, 1642, 1645, 47, 45, 44, 43, 42, + /* 960 */ 290, 693, 1969, 658, 250, 165, 2366, 2201, 1561, 2237, + /* 970 */ 1559, 437, 113, 2203, 713, 2205, 2206, 708, 2370, 703, + /* 980 */ 603, 309, 2170, 657, 188, 1712, 2290, 597, 2367, 659, + /* 990 */ 698, 2286, 207, 249, 616, 688, 259, 2084, 439, 435, + /* 1000 */ 1564, 1565, 1868, 1615, 1618, 1619, 1620, 1621, 1622, 1623, + /* 1010 */ 1624, 1625, 705, 701, 1634, 1635, 1637, 1638, 1639, 1640, + /* 1020 */ 2, 9, 354, 167, 1583, 693, 1969, 1811, 329, 770, + /* 1030 */ 768, 491, 86, 70, 507, 85, 69, 506, 704, 90, + /* 1040 */ 288, 633, 326, 73, 2366, 410, 72, 1731, 1945, 1588, + /* 1050 */ 1810, 1809, 674, 474, 1808, 508, 695, 351, 2262, 2153, + /* 1060 */ 476, 2372, 188, 1807, 1806, 1965, 2367, 659, 219, 519, + /* 1070 */ 517, 514, 776, 775, 774, 773, 415, 2170, 772, 771, + /* 1080 */ 148, 766, 765, 764, 763, 762, 761, 760, 158, 756, + /* 1090 */ 755, 754, 414, 413, 751, 750, 749, 176, 175, 633, + /* 1100 */ 2170, 2170, 2366, 1805, 2170, 237, 372, 2022, 62, 62, + /* 1110 */ 697, 1588, 2262, 2170, 2170, 748, 1223, 1224, 462, 2372, + /* 1120 */ 188, 173, 2021, 1803, 2367, 659, 1802, 166, 662, 571, + /* 1130 */ 567, 563, 559, 740, 236, 1972, 2013, 1801, 41, 40, + /* 1140 */ 283, 1800, 47, 45, 44, 43, 42, 111, 504, 1799, + /* 1150 */ 1798, 498, 497, 496, 495, 490, 489, 488, 487, 486, + /* 1160 */ 482, 481, 480, 479, 353, 471, 470, 469, 1797, 464, + /* 1170 */ 463, 370, 36, 2170, 91, 1226, 2170, 234, 41, 40, + /* 1180 */ 1569, 1584, 47, 45, 44, 43, 42, 2170, 81, 80, + /* 1190 */ 452, 2170, 2202, 200, 744, 2063, 447, 2013, 446, 2170, + /* 1200 */ 2170, 203, 710, 1568, 2328, 1796, 444, 442, 1795, 262, + /* 1210 */ 2371, 745, 2371, 2366, 2013, 2366, 322, 352, 2170, 1999, + /* 1220 */ 433, 2310, 1704, 431, 427, 423, 420, 445, 445, 759, + /* 1230 */ 2220, 2370, 1931, 2370, 458, 2367, 2369, 2367, 2368, 2202, + /* 1240 */ 584, 1704, 2170, 1711, 709, 233, 227, 2156, 54, 710, + /* 1250 */ 3, 2341, 232, 550, 74, 2170, 661, 83, 2170, 137, + /* 1260 */ 154, 154, 1316, 265, 1947, 290, 290, 242, 50, 244, + /* 1270 */ 240, 225, 243, 613, 264, 612, 432, 2220, 2201, 246, + /* 1280 */ 2237, 50, 245, 112, 2203, 713, 2205, 2206, 708, 2170, + /* 1290 */ 703, 709, 1855, 1846, 1844, 2386, 425, 2290, 270, 154, + /* 1300 */ 248, 399, 2286, 247, 84, 1787, 1788, 646, 149, 50, + /* 1310 */ 296, 71, 152, 139, 596, 598, 601, 94, 154, 700, + /* 1320 */ 1526, 1529, 14, 13, 64, 2201, 50, 2237, 1740, 50, + /* 1330 */ 112, 2203, 713, 2205, 2206, 708, 2191, 703, 1572, 717, + /* 1340 */ 152, 1739, 2386, 2202, 2290, 154, 752, 138, 399, 2286, + /* 1350 */ 152, 1277, 753, 710, 1838, 640, 412, 411, 272, 675, + /* 1360 */ 277, 1571, 1909, 2202, 1908, 2221, 1574, 663, 1296, 1483, + /* 1370 */ 301, 685, 305, 710, 1294, 2359, 386, 1641, 1361, 1567, + /* 1380 */ 416, 2220, 2079, 1829, 1678, 2324, 1627, 1834, 2010, 321, + /* 1390 */ 671, 1278, 2193, 2170, 285, 709, 5, 282, 1, 1389, + /* 1400 */ 1393, 2220, 419, 367, 794, 1400, 1636, 1398, 424, 1591, + /* 1410 */ 157, 440, 2202, 2170, 441, 709, 196, 195, 198, 1566, + /* 1420 */ 443, 1507, 710, 316, 2309, 1584, 459, 209, 1588, 2201, + /* 1430 */ 461, 2237, 2202, 465, 112, 2203, 713, 2205, 2206, 708, + /* 1440 */ 2080, 703, 710, 467, 699, 502, 2386, 472, 2290, 2201, + /* 1450 */ 2220, 2237, 399, 2286, 112, 2203, 713, 2205, 2206, 708, + /* 1460 */ 1583, 703, 2170, 485, 709, 492, 2386, 2072, 2290, 512, + /* 1470 */ 2220, 513, 399, 2286, 1662, 494, 501, 503, 510, 214, + /* 1480 */ 213, 515, 2170, 516, 709, 216, 518, 520, 1589, 4, + /* 1490 */ 535, 536, 543, 1586, 547, 544, 1590, 546, 2201, 224, + /* 1500 */ 2237, 2202, 226, 112, 2203, 713, 2205, 2206, 708, 548, + /* 1510 */ 703, 710, 1592, 549, 229, 2386, 551, 2290, 2201, 576, + /* 1520 */ 2237, 399, 2286, 171, 2203, 713, 2205, 2206, 708, 231, + /* 1530 */ 703, 88, 555, 89, 235, 1575, 114, 1570, 578, 2220, + /* 1540 */ 357, 2144, 2141, 2140, 1959, 615, 239, 1955, 617, 92, + /* 1550 */ 2202, 2170, 256, 709, 317, 150, 241, 159, 160, 1957, + /* 1560 */ 710, 621, 1953, 161, 162, 622, 620, 1578, 1580, 260, + /* 1570 */ 1514, 628, 258, 2340, 625, 647, 660, 2387, 683, 637, + /* 1580 */ 701, 1634, 1635, 1637, 1638, 1639, 1640, 2201, 2220, 2237, + /* 1590 */ 643, 2325, 112, 2203, 713, 2205, 2206, 708, 268, 703, + /* 1600 */ 2170, 627, 709, 2335, 2265, 626, 2290, 2339, 8, 271, + /* 1610 */ 399, 2286, 656, 389, 650, 635, 638, 636, 390, 1704, + /* 1620 */ 2202, 667, 281, 664, 2365, 279, 2312, 276, 1587, 143, + /* 1630 */ 710, 1709, 1707, 291, 178, 2306, 2201, 98, 2237, 1593, + /* 1640 */ 2202, 112, 2203, 713, 2205, 2206, 708, 2085, 703, 681, + /* 1650 */ 710, 318, 682, 2263, 2099, 2290, 319, 280, 2220, 399, + /* 1660 */ 2286, 2098, 174, 2097, 395, 686, 278, 687, 191, 100, + /* 1670 */ 2170, 102, 709, 289, 1970, 320, 61, 104, 2220, 2271, + /* 1680 */ 2014, 715, 284, 323, 1932, 312, 795, 796, 2389, 798, + /* 1690 */ 2170, 332, 709, 347, 359, 360, 327, 346, 336, 53, + /* 1700 */ 2162, 2161, 325, 2160, 78, 2157, 2201, 421, 2237, 2202, + /* 1710 */ 422, 112, 2203, 713, 2205, 2206, 708, 1551, 703, 710, + /* 1720 */ 1552, 194, 426, 696, 2155, 2290, 711, 428, 2237, 399, + /* 1730 */ 2286, 113, 2203, 713, 2205, 2206, 708, 429, 703, 430, + /* 1740 */ 2154, 368, 2152, 434, 2202, 2290, 2151, 2220, 436, 362, + /* 1750 */ 2286, 2150, 438, 1542, 710, 2131, 197, 2130, 199, 2170, + /* 1760 */ 79, 709, 1510, 1509, 2112, 2111, 2110, 450, 451, 2109, + /* 1770 */ 2108, 2062, 1460, 456, 2202, 2059, 457, 201, 2058, 82, + /* 1780 */ 2057, 2056, 2220, 2061, 710, 2060, 204, 387, 2055, 2054, + /* 1790 */ 2052, 2051, 2050, 206, 2170, 2201, 709, 2237, 473, 2049, + /* 1800 */ 113, 2203, 713, 2205, 2206, 708, 475, 703, 2065, 2048, + /* 1810 */ 2047, 2202, 2220, 2046, 2290, 2045, 2044, 388, 2043, 2287, + /* 1820 */ 2042, 710, 2041, 2040, 2170, 2039, 709, 2038, 2037, 2036, + /* 1830 */ 2201, 2035, 2237, 2034, 208, 345, 2203, 713, 2205, 2206, + /* 1840 */ 708, 2202, 703, 2033, 87, 2032, 2031, 2030, 2064, 2220, + /* 1850 */ 2029, 710, 2028, 2027, 1462, 2026, 2025, 505, 2024, 2023, + /* 1860 */ 2201, 2170, 2237, 709, 1332, 345, 2203, 713, 2205, 2206, + /* 1870 */ 708, 1336, 703, 2202, 355, 1874, 215, 1873, 356, 2220, + /* 1880 */ 1872, 217, 1870, 710, 1867, 522, 1328, 1866, 526, 521, + /* 1890 */ 1859, 2170, 525, 709, 1848, 529, 218, 2201, 1824, 2237, + /* 1900 */ 533, 523, 338, 2203, 713, 2205, 2206, 708, 527, 703, + /* 1910 */ 2202, 2220, 530, 531, 220, 76, 394, 182, 2190, 1225, + /* 1920 */ 707, 1823, 77, 2170, 2129, 709, 183, 2201, 541, 2237, + /* 1930 */ 2119, 222, 171, 2203, 713, 2205, 2206, 708, 2107, 703, + /* 1940 */ 2202, 228, 230, 2106, 2083, 1948, 1869, 655, 2220, 1865, + /* 1950 */ 710, 556, 557, 558, 1270, 1863, 561, 560, 562, 2201, + /* 1960 */ 2170, 2237, 709, 619, 345, 2203, 713, 2205, 2206, 708, + /* 1970 */ 1861, 703, 564, 566, 565, 1858, 569, 568, 2220, 570, + /* 1980 */ 1843, 802, 1841, 402, 1842, 1840, 2388, 2202, 1820, 1950, + /* 1990 */ 2170, 1405, 709, 1404, 1949, 315, 2201, 710, 2237, 238, + /* 2000 */ 63, 344, 2203, 713, 2205, 2206, 708, 1319, 703, 1317, + /* 2010 */ 2256, 180, 1315, 2202, 1314, 1306, 1313, 767, 1312, 792, + /* 2020 */ 788, 784, 780, 710, 313, 2220, 2201, 1311, 2237, 1856, + /* 2030 */ 404, 345, 2203, 713, 2205, 2206, 708, 2170, 703, 709, + /* 2040 */ 769, 1308, 1307, 1305, 380, 1847, 381, 1845, 599, 382, + /* 2050 */ 602, 2220, 1819, 604, 1818, 606, 1817, 608, 115, 2128, + /* 2060 */ 1536, 1538, 1540, 2170, 110, 709, 29, 306, 1535, 57, + /* 2070 */ 67, 1516, 1518, 2201, 2202, 2237, 1520, 2118, 345, 2203, + /* 2080 */ 713, 2205, 2206, 708, 710, 703, 164, 2202, 623, 624, + /* 2090 */ 2105, 2104, 261, 629, 31, 1495, 2371, 710, 1494, 614, + /* 2100 */ 689, 2237, 20, 17, 340, 2203, 713, 2205, 2206, 708, + /* 2110 */ 631, 703, 2220, 1757, 267, 6, 7, 639, 641, 21, + /* 2120 */ 22, 269, 274, 33, 2170, 2220, 709, 1738, 275, 2191, + /* 2130 */ 65, 172, 23, 273, 1772, 293, 1730, 2170, 2202, 709, + /* 2140 */ 32, 24, 292, 95, 1771, 1777, 1778, 391, 710, 1776, + /* 2150 */ 1775, 18, 392, 1701, 2202, 1700, 2103, 287, 58, 2082, + /* 2160 */ 2201, 257, 2237, 59, 710, 330, 2203, 713, 2205, 2206, + /* 2170 */ 708, 177, 703, 2201, 96, 2237, 2220, 97, 328, 2203, + /* 2180 */ 713, 2205, 2206, 708, 294, 703, 25, 297, 2170, 295, + /* 2190 */ 709, 1736, 2220, 2081, 99, 302, 684, 68, 101, 105, + /* 2200 */ 307, 26, 11, 2202, 2170, 1653, 709, 304, 1652, 13, + /* 2210 */ 1576, 2240, 179, 710, 1608, 1631, 702, 192, 1663, 714, + /* 2220 */ 1629, 39, 716, 16, 2201, 1628, 2237, 1600, 27, 331, + /* 2230 */ 2203, 713, 2205, 2206, 708, 712, 703, 28, 405, 1390, + /* 2240 */ 2201, 2220, 2237, 718, 720, 337, 2203, 713, 2205, 2206, + /* 2250 */ 708, 1387, 703, 2170, 2202, 709, 1386, 721, 723, 726, + /* 2260 */ 729, 724, 732, 727, 710, 1383, 1377, 730, 1381, 733, + /* 2270 */ 2202, 1380, 1375, 1379, 1378, 106, 310, 107, 1399, 75, + /* 2280 */ 710, 1395, 1268, 2202, 747, 1300, 1299, 1298, 1297, 2201, + /* 2290 */ 1295, 2237, 2220, 710, 341, 2203, 713, 2205, 2206, 708, + /* 2300 */ 1293, 703, 1292, 2202, 2170, 1291, 709, 757, 2220, 1326, + /* 2310 */ 311, 1289, 1288, 710, 1287, 1286, 1323, 1285, 1284, 1283, + /* 2320 */ 2170, 2220, 709, 1321, 1280, 1279, 1276, 1275, 1274, 1864, + /* 2330 */ 1273, 777, 1862, 2170, 778, 709, 779, 781, 783, 1860, + /* 2340 */ 2201, 2220, 2237, 787, 785, 333, 2203, 713, 2205, 2206, + /* 2350 */ 708, 1857, 703, 2170, 789, 709, 2201, 782, 2237, 786, + /* 2360 */ 790, 342, 2203, 713, 2205, 2206, 708, 791, 703, 2201, + /* 2370 */ 1839, 2237, 793, 2202, 334, 2203, 713, 2205, 2206, 708, + /* 2380 */ 1215, 703, 1816, 710, 314, 797, 1791, 1562, 324, 2201, + /* 2390 */ 800, 2237, 801, 1791, 343, 2203, 713, 2205, 2206, 708, + /* 2400 */ 1791, 703, 1791, 1791, 1791, 1791, 2202, 1791, 1791, 1791, + /* 2410 */ 1791, 2220, 1791, 1791, 1791, 1791, 710, 1791, 1791, 1791, + /* 2420 */ 1791, 1791, 2202, 2170, 1791, 709, 1791, 1791, 1791, 1791, + /* 2430 */ 1791, 1791, 710, 1791, 1791, 1791, 1791, 1791, 1791, 1791, + /* 2440 */ 1791, 1791, 1791, 2202, 2220, 1791, 1791, 1791, 1791, 1791, + /* 2450 */ 1791, 1791, 1791, 710, 1791, 1791, 2170, 1791, 709, 2201, + /* 2460 */ 2220, 2237, 1791, 1791, 335, 2203, 713, 2205, 2206, 708, + /* 2470 */ 1791, 703, 2170, 1791, 709, 1791, 1791, 1791, 1791, 1791, + /* 2480 */ 1791, 2220, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, + /* 2490 */ 1791, 1791, 2201, 2170, 2237, 709, 1791, 348, 2203, 713, + /* 2500 */ 2205, 2206, 708, 1791, 703, 1791, 1791, 1791, 2201, 2202, + /* 2510 */ 2237, 1791, 1791, 349, 2203, 713, 2205, 2206, 708, 710, + /* 2520 */ 703, 1791, 2202, 1791, 1791, 1791, 1791, 1791, 1791, 2201, + /* 2530 */ 1791, 2237, 710, 2202, 2214, 2203, 713, 2205, 2206, 708, + /* 2540 */ 1791, 703, 1791, 710, 1791, 1791, 2202, 2220, 1791, 1791, + /* 2550 */ 1791, 1791, 1791, 1791, 1791, 1791, 710, 1791, 1791, 2170, + /* 2560 */ 2220, 709, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, + /* 2570 */ 1791, 2220, 2170, 1791, 709, 1791, 1791, 1791, 1791, 1791, + /* 2580 */ 1791, 1791, 1791, 2170, 2220, 709, 1791, 1791, 1791, 1791, + /* 2590 */ 1791, 1791, 1791, 1791, 1791, 2201, 2170, 2237, 709, 1791, + /* 2600 */ 2213, 2203, 713, 2205, 2206, 708, 1791, 703, 2201, 1791, + /* 2610 */ 2237, 1791, 1791, 2212, 2203, 713, 2205, 2206, 708, 2201, + /* 2620 */ 703, 2237, 1791, 2202, 364, 2203, 713, 2205, 2206, 708, + /* 2630 */ 1791, 703, 2201, 710, 2237, 1791, 2202, 365, 2203, 713, + /* 2640 */ 2205, 2206, 708, 1791, 703, 1791, 710, 2202, 1791, 1791, + /* 2650 */ 1791, 1791, 1791, 1791, 1791, 1791, 1791, 710, 1791, 1791, + /* 2660 */ 1791, 2220, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, + /* 2670 */ 1791, 1791, 1791, 2170, 2220, 709, 1791, 1791, 1791, 1791, + /* 2680 */ 1791, 1791, 1791, 1791, 1791, 2220, 2170, 1791, 709, 1791, + /* 2690 */ 1791, 1791, 1791, 1791, 1791, 1791, 1791, 2170, 2202, 709, + /* 2700 */ 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 710, 2201, + /* 2710 */ 1791, 2237, 1791, 1791, 361, 2203, 713, 2205, 2206, 708, + /* 2720 */ 1791, 703, 2201, 1791, 2237, 1791, 1791, 366, 2203, 713, + /* 2730 */ 2205, 2206, 708, 711, 703, 2237, 2220, 1791, 340, 2203, + /* 2740 */ 713, 2205, 2206, 708, 1791, 703, 1791, 1791, 2170, 1791, + /* 2750 */ 709, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, + /* 2760 */ 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, + /* 2770 */ 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, + /* 2780 */ 1791, 1791, 1791, 1791, 2201, 1791, 2237, 1791, 1791, 339, + /* 2790 */ 2203, 713, 2205, 2206, 708, 1791, 703, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 351, 342, 368, 394, 346, 351, 352, 349, 350, 1, @@ -501,181 +501,181 @@ static const YYCODETYPE yy_lookahead[] = { /* 20 */ 20, 20, 22, 8, 9, 371, 392, 12, 13, 14, /* 30 */ 15, 16, 378, 33, 347, 35, 351, 352, 351, 380, /* 40 */ 353, 412, 8, 9, 20, 396, 12, 13, 14, 15, - /* 50 */ 16, 392, 20, 394, 22, 20, 371, 368, 368, 351, - /* 60 */ 352, 381, 62, 378, 430, 431, 346, 35, 68, 349, - /* 70 */ 350, 382, 382, 358, 440, 75, 390, 351, 352, 393, - /* 80 */ 394, 392, 392, 68, 342, 53, 394, 428, 459, 430, + /* 50 */ 16, 392, 3, 394, 381, 14, 371, 368, 368, 351, + /* 60 */ 352, 20, 62, 378, 430, 431, 448, 449, 68, 20, + /* 70 */ 394, 382, 382, 358, 440, 75, 346, 351, 352, 349, + /* 80 */ 350, 392, 392, 68, 380, 409, 410, 428, 459, 430, /* 90 */ 375, 462, 433, 434, 435, 436, 437, 438, 383, 440, - /* 100 */ 100, 409, 410, 103, 445, 341, 447, 343, 479, 480, + /* 100 */ 100, 380, 35, 103, 445, 401, 447, 372, 479, 480, /* 110 */ 451, 452, 104, 484, 485, 380, 12, 13, 20, 430, - /* 120 */ 430, 20, 351, 352, 20, 466, 22, 112, 100, 440, - /* 130 */ 440, 448, 449, 474, 392, 400, 401, 33, 103, 35, - /* 140 */ 140, 141, 371, 432, 116, 117, 118, 119, 120, 121, - /* 150 */ 122, 123, 124, 125, 380, 127, 128, 129, 130, 131, - /* 160 */ 132, 133, 454, 455, 456, 457, 62, 459, 460, 458, - /* 170 */ 170, 171, 68, 20, 347, 401, 176, 177, 351, 75, - /* 180 */ 353, 455, 456, 457, 169, 459, 460, 20, 462, 351, - /* 190 */ 352, 191, 21, 193, 170, 24, 25, 26, 27, 28, + /* 120 */ 430, 400, 401, 388, 20, 466, 22, 112, 100, 440, + /* 130 */ 440, 390, 347, 474, 393, 394, 351, 33, 353, 35, + /* 140 */ 140, 141, 75, 115, 116, 117, 118, 119, 120, 121, + /* 150 */ 122, 123, 124, 104, 126, 127, 128, 129, 130, 131, + /* 160 */ 132, 361, 454, 455, 456, 457, 62, 459, 460, 369, + /* 170 */ 170, 171, 68, 20, 351, 352, 176, 177, 341, 75, + /* 180 */ 343, 455, 456, 457, 169, 459, 460, 20, 462, 351, + /* 190 */ 352, 191, 21, 193, 371, 24, 25, 26, 27, 28, /* 200 */ 29, 30, 31, 32, 100, 479, 480, 103, 342, 371, /* 210 */ 484, 485, 12, 13, 14, 15, 16, 183, 352, 393, - /* 220 */ 394, 20, 20, 223, 224, 0, 226, 227, 228, 229, + /* 220 */ 394, 172, 20, 223, 224, 0, 226, 227, 228, 229, /* 230 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 240 */ 240, 241, 242, 243, 140, 141, 380, 379, 20, 24, + /* 240 */ 240, 241, 242, 243, 140, 141, 380, 379, 358, 24, /* 250 */ 25, 26, 27, 28, 29, 30, 31, 32, 392, 391, /* 260 */ 394, 0, 247, 248, 249, 250, 251, 252, 253, 254, - /* 270 */ 255, 256, 257, 172, 170, 171, 361, 20, 351, 352, - /* 280 */ 176, 177, 21, 67, 369, 24, 25, 26, 27, 28, + /* 270 */ 255, 256, 257, 383, 170, 171, 169, 67, 351, 352, + /* 280 */ 176, 177, 21, 54, 55, 24, 25, 26, 27, 28, /* 290 */ 29, 30, 31, 32, 428, 191, 430, 193, 371, 433, /* 300 */ 434, 435, 436, 437, 438, 103, 440, 140, 141, 443, - /* 310 */ 351, 445, 446, 447, 380, 342, 35, 451, 452, 339, + /* 310 */ 14, 445, 446, 447, 380, 342, 20, 451, 452, 339, /* 320 */ 286, 387, 135, 170, 171, 352, 139, 223, 224, 395, /* 330 */ 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, /* 340 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 12, - /* 350 */ 13, 380, 0, 380, 351, 352, 75, 20, 387, 22, - /* 360 */ 103, 4, 403, 372, 405, 392, 395, 394, 351, 352, - /* 370 */ 33, 380, 35, 172, 371, 4, 8, 9, 387, 388, - /* 380 */ 12, 13, 14, 15, 16, 20, 395, 200, 20, 351, - /* 390 */ 203, 39, 412, 206, 342, 208, 14, 417, 20, 62, - /* 400 */ 22, 428, 20, 430, 352, 68, 433, 434, 435, 436, + /* 350 */ 13, 12, 13, 380, 247, 351, 352, 20, 20, 22, + /* 360 */ 22, 44, 20, 372, 257, 392, 20, 394, 351, 352, + /* 370 */ 33, 380, 35, 35, 35, 4, 8, 9, 387, 388, + /* 380 */ 12, 13, 14, 15, 16, 133, 395, 200, 20, 137, + /* 390 */ 203, 53, 412, 206, 342, 208, 20, 417, 20, 62, + /* 400 */ 22, 428, 398, 430, 352, 68, 433, 434, 435, 436, /* 410 */ 437, 438, 75, 440, 43, 398, 45, 46, 445, 223, - /* 420 */ 447, 380, 8, 9, 451, 452, 12, 13, 14, 15, - /* 430 */ 16, 53, 380, 3, 351, 352, 395, 100, 352, 459, - /* 440 */ 103, 403, 462, 405, 392, 169, 394, 474, 342, 4, - /* 450 */ 20, 3, 412, 12, 13, 14, 35, 417, 44, 479, - /* 460 */ 480, 20, 260, 22, 484, 485, 380, 271, 272, 273, - /* 470 */ 274, 275, 276, 277, 33, 380, 35, 140, 141, 103, - /* 480 */ 428, 398, 430, 388, 37, 433, 434, 435, 436, 437, - /* 490 */ 438, 439, 440, 441, 442, 14, 351, 352, 392, 459, - /* 500 */ 342, 20, 462, 62, 54, 55, 459, 170, 171, 462, - /* 510 */ 352, 356, 357, 176, 177, 175, 75, 260, 104, 479, - /* 520 */ 480, 435, 380, 247, 484, 485, 479, 480, 191, 387, - /* 530 */ 193, 484, 485, 257, 104, 351, 14, 395, 380, 380, - /* 540 */ 172, 100, 20, 398, 103, 67, 387, 342, 103, 244, - /* 550 */ 392, 246, 394, 106, 395, 108, 109, 352, 111, 354, - /* 560 */ 223, 224, 115, 226, 227, 228, 229, 230, 231, 232, + /* 420 */ 447, 104, 8, 9, 451, 452, 12, 13, 14, 15, + /* 430 */ 16, 53, 380, 20, 351, 352, 244, 100, 246, 459, + /* 440 */ 103, 380, 462, 84, 392, 103, 394, 474, 387, 4, + /* 450 */ 67, 342, 412, 12, 13, 14, 395, 417, 44, 479, + /* 460 */ 480, 20, 37, 22, 484, 485, 170, 271, 272, 273, + /* 470 */ 274, 275, 276, 277, 33, 134, 35, 140, 141, 103, + /* 480 */ 428, 398, 430, 356, 357, 433, 434, 435, 436, 437, + /* 490 */ 438, 439, 440, 441, 442, 360, 21, 351, 352, 459, + /* 500 */ 342, 392, 462, 62, 145, 146, 48, 170, 171, 34, + /* 510 */ 352, 36, 377, 176, 177, 114, 75, 371, 104, 479, + /* 520 */ 480, 386, 380, 175, 484, 485, 44, 168, 191, 387, + /* 530 */ 193, 106, 193, 108, 109, 372, 111, 395, 380, 103, + /* 540 */ 172, 100, 22, 380, 103, 204, 205, 342, 103, 113, + /* 550 */ 392, 388, 394, 140, 141, 35, 412, 352, 133, 354, + /* 560 */ 223, 224, 137, 226, 227, 228, 229, 230, 231, 232, /* 570 */ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - /* 580 */ 243, 140, 141, 0, 137, 380, 428, 403, 430, 405, - /* 590 */ 114, 433, 434, 435, 436, 437, 438, 392, 440, 394, - /* 600 */ 21, 459, 172, 360, 462, 447, 266, 267, 268, 451, - /* 610 */ 452, 170, 171, 34, 193, 36, 48, 176, 177, 262, - /* 620 */ 377, 479, 480, 62, 351, 352, 484, 485, 44, 386, - /* 630 */ 12, 13, 191, 428, 193, 430, 260, 244, 433, 434, - /* 640 */ 435, 436, 437, 438, 371, 440, 443, 20, 2, 446, - /* 650 */ 445, 170, 447, 35, 8, 9, 451, 452, 12, 13, - /* 660 */ 14, 15, 16, 102, 223, 224, 105, 226, 227, 228, + /* 580 */ 243, 140, 141, 0, 244, 380, 428, 432, 430, 176, + /* 590 */ 177, 433, 434, 435, 436, 437, 438, 392, 440, 394, + /* 600 */ 376, 459, 260, 459, 462, 447, 462, 356, 357, 451, + /* 610 */ 452, 170, 171, 458, 266, 267, 268, 176, 177, 75, + /* 620 */ 100, 479, 480, 479, 480, 432, 484, 485, 484, 485, + /* 630 */ 172, 13, 191, 428, 193, 430, 260, 179, 433, 434, + /* 640 */ 435, 436, 437, 438, 342, 440, 351, 352, 2, 425, + /* 650 */ 445, 458, 447, 35, 8, 9, 451, 452, 12, 13, + /* 660 */ 14, 15, 16, 351, 223, 224, 371, 226, 227, 228, /* 670 */ 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - /* 680 */ 239, 240, 241, 242, 243, 12, 13, 412, 104, 342, - /* 690 */ 0, 22, 170, 20, 22, 22, 351, 352, 75, 352, - /* 700 */ 342, 372, 351, 352, 35, 260, 33, 35, 35, 380, - /* 710 */ 352, 380, 70, 71, 72, 114, 371, 388, 387, 77, - /* 720 */ 78, 79, 371, 351, 352, 83, 395, 380, 103, 281, - /* 730 */ 88, 89, 90, 91, 459, 62, 94, 462, 380, 392, - /* 740 */ 172, 394, 159, 371, 75, 134, 84, 179, 75, 369, - /* 750 */ 392, 168, 394, 22, 479, 480, 75, 8, 9, 484, - /* 760 */ 485, 12, 13, 14, 15, 16, 35, 140, 141, 100, - /* 770 */ 351, 352, 100, 100, 186, 428, 103, 430, 351, 352, + /* 680 */ 239, 240, 241, 242, 243, 12, 13, 351, 352, 342, + /* 690 */ 49, 22, 0, 20, 392, 22, 351, 352, 57, 352, + /* 700 */ 342, 60, 61, 14, 35, 260, 33, 371, 35, 20, + /* 710 */ 352, 380, 70, 71, 72, 403, 371, 405, 387, 77, + /* 720 */ 78, 79, 114, 351, 352, 83, 395, 380, 103, 372, + /* 730 */ 88, 89, 90, 91, 0, 62, 94, 380, 380, 392, + /* 740 */ 20, 394, 159, 371, 75, 388, 351, 352, 75, 369, + /* 750 */ 392, 168, 394, 380, 351, 352, 443, 8, 9, 446, + /* 760 */ 387, 12, 13, 14, 15, 16, 371, 285, 395, 100, + /* 770 */ 351, 352, 352, 100, 371, 428, 103, 430, 351, 352, /* 780 */ 433, 434, 435, 436, 437, 438, 428, 440, 430, 12, /* 790 */ 13, 433, 434, 435, 436, 437, 438, 20, 440, 22, - /* 800 */ 14, 213, 214, 176, 177, 115, 20, 145, 146, 49, - /* 810 */ 33, 193, 35, 140, 141, 204, 205, 57, 351, 352, - /* 820 */ 60, 61, 475, 476, 134, 135, 136, 137, 138, 139, - /* 830 */ 168, 100, 372, 381, 476, 115, 134, 135, 371, 62, - /* 840 */ 380, 139, 459, 170, 171, 462, 356, 357, 388, 176, - /* 850 */ 177, 0, 75, 104, 134, 135, 136, 137, 138, 139, - /* 860 */ 191, 103, 193, 480, 191, 381, 193, 484, 485, 459, - /* 870 */ 342, 113, 462, 103, 455, 456, 457, 100, 459, 460, - /* 880 */ 103, 342, 455, 456, 457, 260, 459, 460, 365, 366, - /* 890 */ 480, 352, 223, 224, 484, 485, 223, 224, 0, 226, + /* 800 */ 380, 8, 9, 103, 351, 12, 13, 14, 15, 16, + /* 810 */ 33, 22, 35, 140, 141, 133, 134, 135, 136, 137, + /* 820 */ 138, 139, 475, 476, 35, 133, 134, 135, 136, 137, + /* 830 */ 138, 139, 365, 366, 476, 134, 135, 351, 352, 62, + /* 840 */ 139, 351, 352, 170, 171, 351, 352, 75, 342, 176, + /* 850 */ 177, 0, 75, 104, 381, 435, 403, 371, 405, 170, + /* 860 */ 191, 371, 193, 402, 191, 371, 193, 133, 134, 135, + /* 870 */ 136, 137, 138, 139, 455, 456, 457, 100, 459, 460, + /* 880 */ 103, 342, 455, 456, 457, 260, 459, 460, 20, 100, + /* 890 */ 170, 352, 223, 224, 432, 381, 223, 224, 392, 226, /* 900 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, /* 910 */ 237, 238, 239, 240, 241, 242, 243, 140, 141, 380, - /* 920 */ 392, 70, 71, 72, 351, 352, 351, 352, 77, 78, + /* 920 */ 458, 70, 71, 72, 351, 352, 351, 352, 77, 78, /* 930 */ 79, 392, 342, 394, 83, 4, 14, 15, 16, 88, - /* 940 */ 89, 90, 91, 381, 371, 94, 371, 170, 171, 342, + /* 940 */ 89, 90, 91, 351, 371, 94, 371, 170, 171, 381, /* 950 */ 19, 8, 9, 176, 177, 12, 13, 14, 15, 16, - /* 960 */ 190, 444, 192, 446, 33, 67, 381, 428, 191, 430, - /* 970 */ 193, 358, 433, 434, 435, 436, 437, 438, 381, 440, - /* 980 */ 49, 372, 392, 45, 46, 342, 447, 56, 0, 380, - /* 990 */ 451, 452, 222, 62, 412, 432, 383, 388, 342, 392, + /* 960 */ 260, 351, 352, 459, 33, 172, 462, 428, 191, 430, + /* 970 */ 193, 186, 433, 434, 435, 436, 437, 438, 3, 440, + /* 980 */ 49, 371, 392, 479, 480, 4, 447, 56, 484, 485, + /* 990 */ 451, 452, 62, 62, 412, 403, 381, 405, 213, 214, /* 1000 */ 223, 224, 0, 226, 227, 228, 229, 230, 231, 232, /* 1010 */ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - /* 1020 */ 243, 458, 18, 18, 20, 351, 352, 342, 23, 389, - /* 1030 */ 260, 27, 392, 102, 30, 392, 105, 33, 351, 352, - /* 1040 */ 0, 459, 37, 38, 462, 371, 41, 104, 392, 342, - /* 1050 */ 342, 342, 342, 49, 342, 51, 39, 52, 371, 342, - /* 1060 */ 56, 479, 480, 365, 366, 342, 484, 485, 63, 64, + /* 1020 */ 243, 39, 18, 18, 20, 351, 352, 342, 23, 365, + /* 1030 */ 366, 27, 102, 102, 30, 105, 105, 33, 381, 360, + /* 1040 */ 172, 459, 37, 38, 462, 371, 41, 104, 0, 20, + /* 1050 */ 342, 342, 412, 49, 342, 51, 444, 52, 446, 0, + /* 1060 */ 56, 479, 480, 342, 342, 386, 484, 485, 63, 64, /* 1070 */ 65, 66, 70, 71, 72, 73, 74, 392, 76, 77, /* 1080 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - /* 1090 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 392, - /* 1100 */ 392, 392, 392, 115, 392, 33, 102, 389, 103, 392, - /* 1110 */ 392, 44, 432, 351, 352, 392, 20, 389, 114, 360, - /* 1120 */ 392, 49, 134, 135, 136, 137, 138, 139, 115, 57, - /* 1130 */ 58, 59, 60, 371, 62, 8, 9, 342, 458, 12, - /* 1140 */ 13, 14, 15, 16, 342, 386, 373, 142, 144, 376, - /* 1150 */ 137, 147, 148, 149, 150, 151, 152, 153, 154, 155, - /* 1160 */ 156, 157, 158, 159, 160, 161, 162, 163, 412, 165, - /* 1170 */ 166, 167, 2, 376, 102, 351, 352, 105, 8, 9, - /* 1180 */ 351, 352, 12, 13, 14, 15, 16, 392, 183, 184, - /* 1190 */ 185, 68, 342, 188, 392, 371, 351, 352, 342, 444, - /* 1200 */ 371, 446, 352, 0, 354, 367, 201, 202, 370, 258, - /* 1210 */ 259, 13, 13, 342, 114, 459, 371, 212, 462, 42, - /* 1220 */ 215, 44, 425, 218, 219, 220, 221, 222, 0, 42, - /* 1230 */ 380, 44, 35, 35, 35, 479, 480, 44, 44, 342, - /* 1240 */ 484, 485, 392, 0, 394, 173, 174, 44, 392, 352, - /* 1250 */ 22, 354, 180, 181, 8, 9, 343, 217, 12, 13, - /* 1260 */ 14, 15, 16, 392, 164, 260, 44, 107, 172, 107, - /* 1270 */ 110, 199, 110, 207, 62, 209, 259, 380, 428, 107, - /* 1280 */ 430, 0, 110, 433, 434, 435, 436, 437, 438, 392, - /* 1290 */ 440, 394, 49, 107, 0, 445, 110, 447, 104, 44, - /* 1300 */ 44, 451, 452, 22, 44, 140, 141, 44, 44, 44, - /* 1310 */ 44, 44, 44, 1, 2, 0, 22, 105, 44, 13, - /* 1320 */ 44, 35, 418, 44, 44, 428, 104, 430, 44, 47, - /* 1330 */ 433, 434, 435, 436, 437, 438, 44, 440, 402, 44, - /* 1340 */ 44, 35, 445, 342, 447, 488, 223, 477, 451, 452, - /* 1350 */ 283, 355, 471, 352, 13, 354, 12, 13, 368, 104, - /* 1360 */ 104, 75, 368, 342, 104, 50, 22, 104, 104, 104, - /* 1370 */ 104, 104, 104, 352, 411, 354, 35, 33, 104, 35, - /* 1380 */ 104, 380, 355, 104, 104, 103, 380, 402, 104, 350, - /* 1390 */ 193, 391, 481, 392, 352, 394, 104, 402, 461, 104, - /* 1400 */ 104, 380, 453, 263, 465, 413, 62, 49, 429, 20, - /* 1410 */ 206, 422, 342, 392, 427, 394, 360, 360, 172, 75, - /* 1420 */ 422, 189, 352, 415, 354, 20, 352, 42, 399, 428, - /* 1430 */ 20, 430, 342, 402, 433, 434, 435, 436, 437, 438, - /* 1440 */ 352, 440, 352, 399, 100, 397, 445, 20, 447, 428, + /* 1090 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 459, + /* 1100 */ 392, 392, 462, 343, 392, 33, 102, 380, 103, 103, + /* 1110 */ 444, 20, 446, 392, 392, 67, 45, 46, 114, 479, + /* 1120 */ 480, 49, 395, 342, 484, 485, 342, 380, 44, 57, + /* 1130 */ 58, 59, 60, 389, 62, 388, 392, 342, 8, 9, + /* 1140 */ 488, 342, 12, 13, 14, 15, 16, 142, 144, 342, + /* 1150 */ 342, 147, 148, 149, 150, 151, 152, 153, 154, 155, + /* 1160 */ 156, 157, 158, 159, 160, 161, 162, 163, 342, 165, + /* 1170 */ 166, 167, 2, 392, 102, 14, 392, 105, 8, 9, + /* 1180 */ 35, 20, 12, 13, 14, 15, 16, 392, 183, 184, + /* 1190 */ 185, 392, 342, 188, 389, 0, 190, 392, 192, 392, + /* 1200 */ 392, 172, 352, 35, 354, 342, 201, 202, 342, 418, + /* 1210 */ 459, 389, 459, 462, 392, 462, 373, 212, 392, 376, + /* 1220 */ 215, 258, 259, 218, 219, 220, 221, 222, 222, 367, + /* 1230 */ 380, 480, 370, 480, 39, 484, 485, 484, 485, 342, + /* 1240 */ 13, 259, 392, 262, 394, 173, 174, 0, 42, 352, + /* 1250 */ 44, 354, 180, 181, 114, 392, 281, 42, 392, 44, + /* 1260 */ 44, 44, 35, 172, 0, 260, 260, 107, 44, 107, + /* 1270 */ 110, 199, 110, 207, 62, 209, 217, 380, 428, 107, + /* 1280 */ 430, 44, 110, 433, 434, 435, 436, 437, 438, 392, + /* 1290 */ 440, 394, 0, 0, 0, 445, 49, 447, 44, 44, + /* 1300 */ 107, 451, 452, 110, 164, 140, 141, 477, 44, 44, + /* 1310 */ 44, 44, 44, 355, 22, 22, 22, 105, 44, 68, + /* 1320 */ 104, 104, 1, 2, 44, 428, 44, 430, 104, 44, + /* 1330 */ 433, 434, 435, 436, 437, 438, 47, 440, 193, 44, + /* 1340 */ 44, 104, 445, 342, 447, 44, 13, 44, 451, 452, + /* 1350 */ 44, 35, 13, 352, 0, 354, 12, 13, 104, 104, + /* 1360 */ 471, 193, 368, 342, 368, 380, 22, 283, 35, 104, + /* 1370 */ 104, 104, 104, 352, 35, 354, 411, 33, 104, 35, + /* 1380 */ 355, 380, 402, 350, 104, 402, 104, 352, 391, 104, + /* 1390 */ 461, 75, 103, 392, 481, 394, 263, 453, 465, 104, + /* 1400 */ 104, 380, 413, 429, 50, 104, 62, 104, 49, 20, + /* 1410 */ 104, 206, 342, 392, 422, 394, 360, 427, 360, 75, + /* 1420 */ 422, 189, 352, 415, 354, 20, 352, 42, 20, 428, + /* 1430 */ 399, 430, 342, 352, 433, 434, 435, 436, 437, 438, + /* 1440 */ 402, 440, 352, 399, 100, 169, 445, 397, 447, 428, /* 1450 */ 380, 430, 451, 452, 433, 434, 435, 436, 437, 438, - /* 1460 */ 169, 440, 392, 351, 394, 352, 445, 351, 447, 101, - /* 1470 */ 380, 364, 451, 452, 399, 397, 397, 99, 285, 351, - /* 1480 */ 363, 98, 392, 362, 394, 351, 351, 351, 20, 344, - /* 1490 */ 48, 348, 344, 422, 348, 20, 394, 360, 428, 360, - /* 1500 */ 430, 342, 20, 433, 434, 435, 436, 437, 438, 353, - /* 1510 */ 440, 352, 20, 414, 360, 445, 353, 447, 428, 351, + /* 1460 */ 20, 440, 392, 351, 394, 352, 445, 351, 447, 101, + /* 1470 */ 380, 364, 451, 452, 223, 399, 397, 397, 99, 351, + /* 1480 */ 363, 98, 392, 362, 394, 351, 351, 351, 20, 48, + /* 1490 */ 344, 348, 344, 20, 394, 348, 20, 422, 428, 360, + /* 1500 */ 430, 342, 360, 433, 434, 435, 436, 437, 438, 353, + /* 1510 */ 440, 352, 20, 414, 360, 445, 353, 447, 428, 344, /* 1520 */ 430, 451, 452, 433, 434, 435, 436, 437, 438, 360, - /* 1530 */ 440, 360, 344, 360, 360, 191, 351, 193, 380, 380, - /* 1540 */ 344, 380, 392, 392, 380, 392, 380, 380, 210, 103, - /* 1550 */ 342, 392, 426, 394, 424, 380, 380, 197, 380, 380, - /* 1560 */ 352, 380, 380, 422, 358, 421, 196, 223, 224, 420, - /* 1570 */ 195, 358, 351, 270, 394, 392, 486, 487, 470, 269, + /* 1530 */ 440, 360, 351, 360, 360, 191, 351, 193, 380, 380, + /* 1540 */ 344, 392, 392, 392, 380, 210, 380, 380, 426, 103, + /* 1550 */ 342, 392, 358, 394, 422, 424, 380, 380, 380, 380, + /* 1560 */ 352, 197, 380, 380, 380, 421, 196, 223, 224, 358, + /* 1570 */ 195, 351, 420, 470, 394, 270, 486, 487, 269, 392, /* 1580 */ 236, 237, 238, 239, 240, 241, 242, 428, 380, 430, - /* 1590 */ 470, 402, 433, 434, 435, 436, 437, 438, 407, 440, - /* 1600 */ 392, 392, 394, 419, 445, 413, 447, 402, 407, 392, - /* 1610 */ 451, 452, 392, 278, 280, 473, 182, 264, 279, 472, - /* 1620 */ 342, 489, 470, 413, 469, 468, 284, 287, 282, 352, - /* 1630 */ 352, 259, 20, 114, 432, 261, 428, 20, 430, 405, - /* 1640 */ 342, 433, 434, 435, 436, 437, 438, 358, 440, 407, - /* 1650 */ 352, 358, 353, 445, 392, 447, 407, 467, 380, 451, - /* 1660 */ 452, 392, 392, 392, 392, 392, 358, 174, 352, 358, - /* 1670 */ 392, 464, 394, 376, 463, 103, 450, 482, 380, 404, - /* 1680 */ 103, 351, 392, 483, 384, 358, 36, 370, 345, 344, - /* 1690 */ 392, 359, 394, 408, 374, 374, 408, 374, 0, 416, - /* 1700 */ 0, 340, 0, 42, 0, 35, 428, 216, 430, 342, - /* 1710 */ 423, 433, 434, 435, 436, 437, 438, 35, 440, 352, + /* 1590 */ 392, 402, 433, 434, 435, 436, 437, 438, 407, 440, + /* 1600 */ 392, 413, 394, 402, 445, 419, 447, 470, 278, 407, + /* 1610 */ 451, 452, 182, 392, 392, 264, 280, 279, 287, 259, + /* 1620 */ 342, 284, 413, 282, 483, 468, 473, 472, 20, 352, + /* 1630 */ 352, 114, 261, 358, 353, 432, 428, 358, 430, 20, + /* 1640 */ 342, 433, 434, 435, 436, 437, 438, 405, 440, 392, + /* 1650 */ 352, 407, 392, 445, 392, 447, 407, 467, 380, 451, + /* 1660 */ 452, 392, 470, 392, 392, 174, 469, 404, 464, 358, + /* 1670 */ 392, 358, 394, 463, 352, 376, 103, 103, 380, 450, + /* 1680 */ 392, 384, 482, 351, 370, 358, 36, 345, 489, 344, + /* 1690 */ 392, 374, 394, 423, 408, 408, 340, 374, 374, 416, + /* 1700 */ 0, 0, 359, 0, 42, 0, 428, 35, 430, 342, + /* 1710 */ 216, 433, 434, 435, 436, 437, 438, 35, 440, 352, /* 1720 */ 35, 35, 216, 445, 0, 447, 428, 35, 430, 451, - /* 1730 */ 452, 433, 434, 435, 436, 437, 438, 216, 440, 0, - /* 1740 */ 35, 216, 0, 35, 342, 447, 0, 380, 22, 451, + /* 1730 */ 452, 433, 434, 435, 436, 437, 438, 35, 440, 216, + /* 1740 */ 0, 216, 0, 35, 342, 447, 0, 380, 22, 451, /* 1750 */ 452, 0, 35, 211, 352, 0, 199, 0, 199, 392, - /* 1760 */ 200, 394, 193, 0, 191, 0, 0, 187, 186, 0, + /* 1760 */ 200, 394, 193, 191, 0, 0, 0, 187, 186, 0, /* 1770 */ 0, 0, 47, 35, 342, 0, 49, 47, 0, 42, - /* 1780 */ 0, 0, 380, 0, 352, 0, 0, 385, 47, 0, - /* 1790 */ 0, 0, 0, 159, 392, 428, 394, 430, 0, 35, + /* 1780 */ 0, 0, 380, 0, 352, 0, 47, 385, 0, 0, + /* 1790 */ 0, 0, 0, 159, 392, 428, 394, 430, 35, 0, /* 1800 */ 433, 434, 435, 436, 437, 438, 159, 440, 0, 0, /* 1810 */ 0, 342, 380, 0, 447, 0, 0, 385, 0, 452, /* 1820 */ 0, 352, 0, 0, 392, 0, 394, 0, 0, 0, @@ -722,20 +722,20 @@ static const YYCODETYPE yy_lookahead[] = { /* 2230 */ 434, 435, 436, 437, 438, 225, 440, 103, 35, 104, /* 2240 */ 428, 380, 430, 103, 35, 433, 434, 435, 436, 437, /* 2250 */ 438, 104, 440, 392, 342, 394, 104, 103, 35, 35, - /* 2260 */ 35, 103, 35, 103, 352, 104, 104, 103, 126, 103, - /* 2270 */ 342, 126, 104, 22, 126, 126, 103, 44, 115, 103, - /* 2280 */ 352, 35, 103, 342, 22, 69, 68, 35, 35, 428, + /* 2260 */ 35, 103, 35, 103, 352, 104, 104, 103, 125, 103, + /* 2270 */ 342, 125, 104, 125, 125, 103, 44, 103, 35, 103, + /* 2280 */ 352, 22, 69, 342, 68, 35, 35, 35, 35, 428, /* 2290 */ 35, 430, 380, 352, 433, 434, 435, 436, 437, 438, - /* 2300 */ 35, 440, 35, 342, 392, 35, 394, 35, 380, 35, - /* 2310 */ 75, 97, 44, 352, 35, 35, 75, 35, 22, 35, - /* 2320 */ 392, 380, 394, 35, 35, 35, 35, 35, 35, 22, - /* 2330 */ 35, 0, 35, 392, 35, 394, 49, 39, 0, 35, - /* 2340 */ 428, 380, 430, 0, 35, 433, 434, 435, 436, 437, - /* 2350 */ 438, 49, 440, 392, 39, 394, 428, 49, 430, 39, - /* 2360 */ 0, 433, 434, 435, 436, 437, 438, 35, 440, 428, - /* 2370 */ 49, 430, 39, 342, 433, 434, 435, 436, 437, 438, - /* 2380 */ 0, 440, 35, 352, 35, 0, 22, 21, 21, 428, - /* 2390 */ 22, 430, 22, 20, 433, 434, 435, 436, 437, 438, + /* 2300 */ 35, 440, 35, 342, 392, 35, 394, 97, 380, 75, + /* 2310 */ 44, 35, 35, 352, 35, 22, 75, 35, 35, 35, + /* 2320 */ 392, 380, 394, 35, 35, 35, 35, 35, 22, 0, + /* 2330 */ 35, 35, 0, 392, 49, 394, 39, 35, 39, 0, + /* 2340 */ 428, 380, 430, 39, 35, 433, 434, 435, 436, 437, + /* 2350 */ 438, 0, 440, 392, 35, 394, 428, 49, 430, 49, + /* 2360 */ 49, 433, 434, 435, 436, 437, 438, 39, 440, 428, + /* 2370 */ 0, 430, 35, 342, 433, 434, 435, 436, 437, 438, + /* 2380 */ 35, 440, 0, 352, 22, 21, 490, 22, 22, 428, + /* 2390 */ 21, 430, 20, 490, 433, 434, 435, 436, 437, 438, /* 2400 */ 490, 440, 490, 490, 490, 490, 342, 490, 490, 490, /* 2410 */ 490, 380, 490, 490, 490, 490, 352, 490, 490, 490, /* 2420 */ 490, 490, 342, 392, 490, 394, 490, 490, 490, 490, @@ -811,58 +811,58 @@ static const YYCODETYPE yy_lookahead[] = { /* 3120 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, /* 3130 */ 339, 339, 339, 339, 339, 339, }; -#define YY_SHIFT_COUNT (804) +#define YY_SHIFT_COUNT (802) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2385) +#define YY_SHIFT_MAX (2382) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 1005, 0, 104, 0, 337, 337, 337, 337, 337, 337, /* 10 */ 337, 337, 337, 337, 337, 337, 441, 673, 673, 777, /* 20 */ 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, /* 30 */ 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, /* 40 */ 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, - /* 50 */ 673, 202, 257, 770, 35, 376, 625, 376, 35, 35, - /* 60 */ 376, 1344, 376, 1344, 1344, 445, 376, 1, 627, 98, - /* 70 */ 98, 627, 371, 371, 153, 167, 382, 382, 98, 98, - /* 80 */ 98, 98, 98, 98, 98, 98, 98, 98, 228, 98, - /* 90 */ 98, 216, 1, 98, 98, 365, 1, 98, 228, 98, - /* 100 */ 228, 1, 98, 98, 1, 98, 1, 1, 1, 98, - /* 110 */ 478, 1004, 15, 15, 642, 171, 669, 669, 669, 669, + /* 50 */ 673, 342, 376, 1006, 202, 625, 700, 625, 202, 202, + /* 60 */ 625, 1344, 625, 1344, 1344, 445, 625, 1, 413, 24, + /* 70 */ 24, 413, 371, 371, 153, 167, 41, 41, 24, 24, + /* 80 */ 24, 24, 24, 24, 24, 24, 24, 24, 98, 24, + /* 90 */ 24, 210, 1, 24, 24, 346, 1, 24, 98, 24, + /* 100 */ 98, 1, 24, 24, 1, 24, 1, 1, 1, 24, + /* 110 */ 383, 1004, 15, 15, 642, 171, 669, 669, 669, 669, /* 120 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, - /* 130 */ 669, 669, 669, 669, 669, 447, 430, 153, 167, 450, - /* 140 */ 450, 281, 101, 101, 101, 898, 305, 305, 281, 216, - /* 150 */ 476, 393, 1, 623, 1, 623, 623, 601, 681, 28, + /* 130 */ 669, 669, 669, 669, 669, 425, 49, 153, 167, 229, + /* 140 */ 229, 67, 868, 868, 868, 1048, 192, 192, 67, 210, + /* 150 */ 401, 340, 1, 544, 1, 544, 544, 608, 772, 28, /* 160 */ 28, 28, 28, 28, 28, 28, 28, 1962, 851, 261, - /* 170 */ 368, 34, 196, 32, 340, 618, 618, 481, 568, 522, - /* 180 */ 378, 201, 938, 786, 1013, 1096, 951, 1017, 448, 951, - /* 190 */ 1177, 357, 24, 1140, 1358, 1389, 1204, 216, 1389, 216, - /* 200 */ 1232, 1405, 1385, 1410, 1405, 1385, 1291, 1427, 1405, 1427, - /* 210 */ 1385, 1291, 1291, 1368, 1378, 1427, 1383, 1427, 1427, 1427, - /* 220 */ 1468, 1442, 1468, 1442, 1389, 216, 1475, 216, 1482, 1492, - /* 230 */ 216, 1482, 216, 216, 216, 1427, 216, 1468, 1, 1, - /* 240 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1427, - /* 250 */ 1468, 623, 623, 623, 1338, 1446, 1389, 478, 1360, 1370, - /* 260 */ 1475, 478, 1375, 1140, 1427, 1410, 1410, 623, 1303, 1310, - /* 270 */ 623, 1303, 1310, 623, 623, 1, 1335, 1434, 1303, 1334, - /* 280 */ 1339, 1353, 1140, 1340, 1342, 1346, 1372, 1405, 1612, 1519, - /* 290 */ 1374, 1482, 478, 478, 1617, 1310, 623, 623, 623, 623, - /* 300 */ 623, 1310, 623, 1493, 478, 601, 478, 1405, 1572, 1577, - /* 310 */ 623, 681, 1427, 478, 1650, 1468, 2797, 2797, 2797, 2797, + /* 170 */ 368, 34, 196, 338, 348, 339, 339, 296, 458, 689, + /* 180 */ 378, 1029, 1071, 1161, 252, 1091, 963, 982, 975, 963, + /* 190 */ 1206, 981, 720, 1133, 1359, 1389, 1205, 210, 1389, 210, + /* 200 */ 1232, 1405, 1385, 1408, 1405, 1385, 1276, 1440, 1405, 1440, + /* 210 */ 1385, 1276, 1276, 1368, 1379, 1440, 1383, 1440, 1440, 1440, + /* 220 */ 1468, 1441, 1468, 1441, 1389, 210, 1473, 210, 1476, 1492, + /* 230 */ 210, 1476, 210, 210, 210, 1440, 210, 1468, 1, 1, + /* 240 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1440, + /* 250 */ 1468, 544, 544, 544, 1335, 1446, 1389, 383, 1364, 1370, + /* 260 */ 1473, 383, 1375, 1133, 1440, 1408, 1408, 544, 1305, 1309, + /* 270 */ 544, 1305, 1309, 544, 544, 1, 1330, 1430, 1305, 1336, + /* 280 */ 1338, 1351, 1133, 1331, 1337, 1341, 1360, 1405, 1608, 1517, + /* 290 */ 1371, 1476, 383, 383, 1619, 1309, 544, 544, 544, 544, + /* 300 */ 544, 1309, 544, 1491, 383, 608, 383, 1405, 1573, 1574, + /* 310 */ 544, 772, 1440, 383, 1650, 1468, 2797, 2797, 2797, 2797, /* 320 */ 2797, 2797, 2797, 2797, 2797, 1002, 1072, 225, 414, 931, - /* 330 */ 749, 943, 690, 646, 1170, 1246, 988, 1127, 1127, 1127, - /* 340 */ 1127, 1127, 1127, 1127, 1127, 1127, 720, 187, 200, 200, - /* 350 */ 662, 760, 588, 583, 561, 672, 731, 579, 611, 702, - /* 360 */ 702, 922, 8, 276, 922, 922, 922, 1243, 1040, 584, - /* 370 */ 352, 1187, 1100, 1203, 1160, 1162, 1172, 1186, 1198, 1199, - /* 380 */ 1228, 1281, 1294, 1066, 1194, 1222, 1212, 1255, 1256, 1260, - /* 390 */ 1165, 1067, 1193, 1263, 1264, 1265, 1266, 1267, 1268, 1312, - /* 400 */ 1274, 1123, 1276, 1282, 1279, 1280, 1284, 1292, 1295, 1296, - /* 410 */ 758, 421, 1197, 1306, 1341, 1286, 1315, 1698, 1700, 1702, - /* 420 */ 1661, 1704, 1670, 1491, 1682, 1685, 1686, 1506, 1724, 1692, - /* 430 */ 1705, 1521, 1739, 1525, 1742, 1708, 1746, 1726, 1751, 1717, - /* 440 */ 1542, 1755, 1557, 1757, 1559, 1560, 1569, 1573, 1763, 1765, + /* 330 */ 749, 943, 692, 646, 1170, 793, 734, 1130, 1130, 1130, + /* 340 */ 1130, 1130, 1130, 1130, 1130, 1130, 682, 187, 200, 200, + /* 350 */ 359, 641, 785, 583, 930, 520, 789, 475, 341, 701, + /* 360 */ 701, 922, 8, 107, 922, 922, 922, 1247, 1059, 317, + /* 370 */ 1195, 1215, 1140, 1264, 1160, 1162, 1172, 1193, 618, 1227, + /* 380 */ 1292, 1293, 1294, 1066, 1216, 1217, 1212, 1224, 1237, 1254, + /* 390 */ 1165, 1084, 482, 1255, 1265, 1266, 1267, 1268, 1274, 1321, + /* 400 */ 1280, 1251, 1282, 1289, 1285, 1295, 1296, 1301, 1303, 1306, + /* 410 */ 436, 1145, 1168, 1333, 1339, 1316, 1354, 1700, 1701, 1703, + /* 420 */ 1662, 1705, 1672, 1494, 1682, 1685, 1686, 1506, 1724, 1692, + /* 430 */ 1702, 1523, 1740, 1525, 1742, 1708, 1746, 1726, 1751, 1717, + /* 440 */ 1542, 1755, 1557, 1757, 1559, 1560, 1569, 1572, 1764, 1765, /* 450 */ 1766, 1580, 1582, 1769, 1770, 1725, 1771, 1738, 1727, 1775, - /* 460 */ 1730, 1778, 1737, 1780, 1781, 1783, 1741, 1785, 1786, 1789, - /* 470 */ 1790, 1791, 1792, 1634, 1764, 1798, 1647, 1808, 1809, 1810, + /* 460 */ 1730, 1778, 1737, 1780, 1781, 1783, 1739, 1785, 1788, 1789, + /* 470 */ 1790, 1791, 1792, 1634, 1763, 1799, 1647, 1808, 1809, 1810, /* 480 */ 1813, 1815, 1816, 1818, 1820, 1822, 1823, 1825, 1827, 1828, /* 490 */ 1829, 1831, 1833, 1787, 1843, 1802, 1845, 1846, 1847, 1848, /* 500 */ 1850, 1852, 1832, 1853, 1855, 1856, 1714, 1858, 1859, 1842, @@ -888,14 +888,14 @@ static const unsigned short int yy_shift_ofst[] = { /* 700 */ 1995, 2108, 2111, 2113, 2116, 2118, 2121, 2165, 2120, 2125, /* 710 */ 2170, 2123, 2192, 2010, 2134, 2105, 2135, 2187, 2203, 2140, /* 720 */ 2147, 2209, 2154, 2152, 2223, 2158, 2161, 2224, 2160, 2162, - /* 730 */ 2225, 2164, 2168, 2227, 2166, 2142, 2145, 2148, 2149, 2251, - /* 740 */ 2163, 2173, 2233, 2176, 2246, 2179, 2233, 2233, 2262, 2216, - /* 750 */ 2218, 2252, 2253, 2255, 2265, 2267, 2270, 2272, 2274, 2235, - /* 760 */ 2214, 2268, 2279, 2280, 2282, 2296, 2284, 2288, 2289, 2241, - /* 770 */ 1973, 2290, 1996, 2291, 2292, 2293, 2295, 2307, 2297, 2331, - /* 780 */ 2299, 2287, 2298, 2338, 2304, 2302, 2315, 2343, 2309, 2308, - /* 790 */ 2320, 2360, 2332, 2321, 2333, 2380, 2347, 2349, 2385, 2364, - /* 800 */ 2366, 2368, 2370, 2367, 2373, + /* 730 */ 2225, 2164, 2168, 2227, 2166, 2143, 2146, 2148, 2149, 2172, + /* 740 */ 2232, 2174, 2243, 2176, 2232, 2232, 2259, 2213, 2216, 2250, + /* 750 */ 2251, 2252, 2253, 2255, 2265, 2267, 2270, 2234, 2210, 2266, + /* 760 */ 2276, 2277, 2279, 2293, 2282, 2283, 2284, 2241, 1973, 2288, + /* 770 */ 1996, 2289, 2290, 2291, 2292, 2306, 2295, 2329, 2296, 2285, + /* 780 */ 2297, 2332, 2302, 2308, 2299, 2339, 2309, 2310, 2304, 2351, + /* 790 */ 2319, 2311, 2328, 2370, 2337, 2345, 2382, 2362, 2364, 2365, + /* 800 */ 2366, 2369, 2372, }; #define YY_REDUCE_COUNT (324) #define YY_REDUCE_MIN (-391) @@ -906,117 +906,117 @@ static const short yy_reduce_ofst[] = { /* 20 */ 358, 1402, 1432, 1469, 1499, 1531, 1568, 1598, 1645, 1671, /* 30 */ 1732, 1745, 1796, 1812, 1861, 1912, 1928, 1941, 1961, 2031, /* 40 */ 2064, 2080, 2101, 2167, 2180, 2191, 2204, 2281, 2294, 2305, - /* 50 */ 2356, -274, 142, 40, -292, -371, 275, 582, 419, 427, - /* 60 */ 756, -366, 47, -311, -310, 383, 410, -9, -391, -346, - /* 70 */ -315, -308, -342, -280, -265, -314, -313, -173, -229, -162, - /* 80 */ -73, 3, 17, 83, 273, 345, 351, 145, -41, 372, - /* 90 */ 573, 243, -66, 575, 674, 86, -29, 467, 38, 687, - /* 100 */ 184, 329, 762, 824, 159, 829, 460, 331, 609, 845, - /* 110 */ -285, -351, -317, -317, -85, -236, -258, 106, 528, 590, - /* 120 */ 607, 643, 656, 685, 707, 708, 709, 710, 712, 717, - /* 130 */ 723, 795, 802, 856, 871, -132, -289, -226, -174, 155, - /* 140 */ 490, 523, -289, 563, 680, 613, 517, 755, 698, 759, - /* 150 */ 797, 203, 95, 640, 41, 718, 728, 773, 838, -364, - /* 160 */ -320, 452, 484, 562, 585, 597, 562, 904, 380, 913, - /* 170 */ 936, 857, 870, 996, 881, 990, 994, 1006, 963, 1006, - /* 180 */ 1027, 985, 1039, 1042, 1000, 995, 937, 937, 911, 937, - /* 190 */ 949, 939, 1006, 992, 979, 989, 987, 1056, 998, 1057, - /* 200 */ 1008, 1074, 1029, 1031, 1088, 1044, 1048, 1112, 1113, 1116, - /* 210 */ 1075, 1078, 1079, 1107, 1117, 1128, 1121, 1134, 1135, 1136, - /* 220 */ 1145, 1143, 1148, 1146, 1071, 1137, 1102, 1139, 1156, 1099, - /* 230 */ 1154, 1163, 1169, 1171, 1173, 1168, 1174, 1188, 1158, 1161, - /* 240 */ 1164, 1166, 1167, 1175, 1176, 1178, 1179, 1181, 1182, 1185, - /* 250 */ 1196, 1150, 1151, 1153, 1126, 1130, 1141, 1206, 1144, 1149, - /* 260 */ 1180, 1213, 1184, 1192, 1221, 1189, 1205, 1183, 1108, 1191, - /* 270 */ 1209, 1120, 1201, 1217, 1220, 1006, 1142, 1147, 1152, 1155, - /* 280 */ 1157, 1190, 1210, 1132, 1200, 1195, 937, 1277, 1202, 1207, - /* 290 */ 1211, 1299, 1289, 1293, 1234, 1242, 1262, 1269, 1270, 1271, - /* 300 */ 1272, 1249, 1273, 1275, 1308, 1297, 1311, 1316, 1226, 1300, - /* 310 */ 1290, 1317, 1330, 1327, 1343, 1345, 1283, 1287, 1285, 1288, - /* 320 */ 1320, 1321, 1323, 1332, 1361, + /* 50 */ 2356, -274, 142, 40, -292, -371, 144, 582, 419, 427, + /* 60 */ 640, -366, 504, -311, -310, 751, 753, -9, -391, -346, + /* 70 */ -315, -324, -342, -270, -279, -259, -313, -215, -177, -162, + /* 80 */ -73, 146, 4, 17, 295, 336, 345, 83, 312, 372, + /* 90 */ 395, 135, -66, 403, 486, 420, 61, 490, 453, 494, + /* 100 */ 592, -265, 573, 575, 331, 610, 163, 373, 357, 674, + /* 110 */ -285, -351, -382, -382, -200, -163, 109, 302, 506, 590, + /* 120 */ 685, 708, 709, 712, 721, 722, 781, 784, 795, 799, + /* 130 */ 807, 808, 826, 863, 866, -132, 155, -296, -174, 127, + /* 140 */ 251, 467, 155, 193, 462, -110, 612, 666, 664, 679, + /* 150 */ 224, 313, 747, 744, 727, 805, 822, 843, 862, -364, + /* 160 */ -327, 473, 514, 568, 615, 657, 568, 791, 380, 760, + /* 170 */ 461, 652, 830, 958, 889, 994, 996, 985, 965, 985, + /* 180 */ 1025, 980, 1033, 1035, 997, 983, 929, 929, 913, 929, + /* 190 */ 944, 933, 985, 989, 974, 992, 990, 1056, 998, 1058, + /* 200 */ 1008, 1074, 1031, 1038, 1081, 1044, 1050, 1112, 1113, 1116, + /* 210 */ 1076, 1079, 1080, 1107, 1117, 1128, 1121, 1134, 1135, 1136, + /* 220 */ 1146, 1143, 1148, 1147, 1075, 1139, 1100, 1142, 1156, 1099, + /* 230 */ 1154, 1163, 1169, 1171, 1173, 1181, 1174, 1175, 1158, 1164, + /* 240 */ 1166, 1167, 1176, 1177, 1178, 1179, 1182, 1183, 1184, 1185, + /* 250 */ 1196, 1149, 1150, 1151, 1122, 1131, 1132, 1194, 1144, 1152, + /* 260 */ 1180, 1211, 1186, 1188, 1220, 1189, 1201, 1187, 1103, 1191, + /* 270 */ 1198, 1137, 1202, 1221, 1222, 985, 1153, 1155, 1192, 1197, + /* 280 */ 1157, 1190, 1209, 1199, 1141, 1200, 929, 1277, 1203, 1204, + /* 290 */ 1210, 1281, 1275, 1279, 1242, 1244, 1257, 1260, 1262, 1269, + /* 300 */ 1271, 1249, 1272, 1263, 1311, 1299, 1313, 1322, 1229, 1297, + /* 310 */ 1288, 1314, 1332, 1327, 1342, 1345, 1283, 1270, 1286, 1287, + /* 320 */ 1317, 1323, 1324, 1343, 1356, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 10 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 20 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 30 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 40 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 50 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 60 */ 2104, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 70 */ 1792, 1792, 1792, 1792, 2077, 1792, 1792, 1792, 1792, 1792, - /* 80 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 90 */ 1792, 1881, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 100 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 110 */ 1879, 2070, 2296, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 120 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 130 */ 1792, 1792, 1792, 1792, 1792, 1792, 2308, 1792, 1792, 1855, - /* 140 */ 1855, 1792, 2308, 2308, 2308, 1879, 2268, 2268, 1792, 1881, - /* 150 */ 2138, 1792, 1792, 1792, 1792, 1792, 1792, 2002, 1792, 1792, - /* 160 */ 1792, 1792, 1792, 2026, 1792, 1792, 1792, 2130, 1792, 1792, - /* 170 */ 2337, 2394, 1792, 1792, 2340, 1792, 1792, 1792, 1792, 1792, - /* 180 */ 1792, 2082, 1792, 1792, 1954, 2327, 2300, 2314, 2378, 2301, - /* 190 */ 2298, 2321, 1792, 2331, 1792, 1792, 2152, 1881, 1792, 1881, - /* 200 */ 2117, 1792, 2075, 1792, 1792, 2075, 2072, 1792, 1792, 1792, - /* 210 */ 2075, 2072, 2072, 1943, 1939, 1792, 1937, 1792, 1792, 1792, - /* 220 */ 1792, 1839, 1792, 1839, 1792, 1881, 1792, 1881, 1792, 1792, - /* 230 */ 1881, 1792, 1881, 1881, 1881, 1792, 1881, 1792, 1792, 1792, - /* 240 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 250 */ 1792, 1792, 1792, 1792, 2150, 2136, 1792, 1879, 2128, 2126, - /* 260 */ 1792, 1879, 2124, 2331, 1792, 1792, 1792, 1792, 2348, 2346, - /* 270 */ 1792, 2348, 2346, 1792, 1792, 1792, 2362, 2358, 2348, 2367, - /* 280 */ 2364, 2333, 2331, 2397, 2384, 2380, 2314, 1792, 1792, 2319, - /* 290 */ 2317, 1792, 1879, 1879, 1792, 2346, 1792, 1792, 1792, 1792, - /* 300 */ 1792, 2346, 1792, 1792, 1879, 1792, 1879, 1792, 1792, 1970, - /* 310 */ 1792, 1792, 1792, 1879, 1824, 1792, 2119, 2141, 2100, 2100, - /* 320 */ 2005, 2005, 2005, 1882, 1797, 1792, 1792, 1792, 1792, 1792, - /* 330 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 2361, 2360, 2223, - /* 340 */ 1792, 2272, 2271, 2270, 2261, 2222, 1966, 1792, 2221, 2220, - /* 350 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 2091, - /* 360 */ 2090, 2214, 1792, 1792, 2215, 2213, 2212, 1792, 1792, 1792, - /* 370 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 380 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 390 */ 1792, 2381, 2385, 1792, 1792, 1792, 1792, 1792, 1792, 2297, - /* 400 */ 1792, 1792, 1792, 2196, 1792, 1792, 1792, 1792, 1792, 1792, - /* 410 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 420 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 430 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 440 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 450 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 460 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 470 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 480 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 490 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 500 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 510 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 520 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 530 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1829, 2201, - /* 540 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 550 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 560 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 570 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 580 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 590 */ 1920, 1919, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 600 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 610 */ 1792, 1792, 1792, 1792, 2205, 1792, 1792, 1792, 1792, 1792, - /* 620 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 630 */ 1792, 1792, 1792, 2377, 2334, 1792, 1792, 1792, 1792, 1792, - /* 640 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 650 */ 1792, 1792, 1792, 2196, 1792, 2359, 1792, 1792, 2375, 1792, - /* 660 */ 2379, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 2307, 2303, - /* 670 */ 1792, 1792, 2299, 1792, 1792, 1792, 1792, 1792, 2204, 1792, - /* 680 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 690 */ 1792, 1792, 2195, 1792, 2258, 1792, 1792, 1792, 2292, 1792, - /* 700 */ 1792, 2243, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 710 */ 1792, 2205, 1792, 2208, 1792, 1792, 1792, 1792, 1792, 1999, - /* 720 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 730 */ 1792, 1792, 1792, 1792, 1792, 1983, 1981, 1980, 1979, 1792, - /* 740 */ 1976, 1792, 2012, 1792, 1792, 1792, 2008, 2007, 1792, 1792, - /* 750 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 760 */ 1792, 1900, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 770 */ 1892, 1792, 1891, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 780 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 790 */ 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - /* 800 */ 1792, 1792, 1792, 1792, 1792, + /* 0 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 10 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 20 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 30 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 40 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 50 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 60 */ 2100, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 70 */ 1789, 1789, 1789, 1789, 2073, 1789, 1789, 1789, 1789, 1789, + /* 80 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 90 */ 1789, 1878, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 100 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 110 */ 1876, 2066, 2292, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 120 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 130 */ 1789, 1789, 1789, 1789, 1789, 1789, 2304, 1789, 1789, 1852, + /* 140 */ 1852, 1789, 2304, 2304, 2304, 1876, 2264, 2264, 1789, 1878, + /* 150 */ 2134, 1789, 1789, 1789, 1789, 1789, 1789, 1998, 1789, 1789, + /* 160 */ 1789, 1789, 1789, 2022, 1789, 1789, 1789, 2126, 1789, 1789, + /* 170 */ 2333, 2390, 1789, 1789, 2336, 1789, 1789, 1789, 1789, 1789, + /* 180 */ 1789, 2078, 1789, 1789, 1951, 2323, 2296, 2310, 2374, 2297, + /* 190 */ 2294, 2317, 1789, 2327, 1789, 1789, 2148, 1878, 1789, 1878, + /* 200 */ 2113, 1789, 2071, 1789, 1789, 2071, 2068, 1789, 1789, 1789, + /* 210 */ 2071, 2068, 2068, 1940, 1936, 1789, 1934, 1789, 1789, 1789, + /* 220 */ 1789, 1836, 1789, 1836, 1789, 1878, 1789, 1878, 1789, 1789, + /* 230 */ 1878, 1789, 1878, 1878, 1878, 1789, 1878, 1789, 1789, 1789, + /* 240 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 250 */ 1789, 1789, 1789, 1789, 2146, 2132, 1789, 1876, 2124, 2122, + /* 260 */ 1789, 1876, 2120, 2327, 1789, 1789, 1789, 1789, 2344, 2342, + /* 270 */ 1789, 2344, 2342, 1789, 1789, 1789, 2358, 2354, 2344, 2363, + /* 280 */ 2360, 2329, 2327, 2393, 2380, 2376, 2310, 1789, 1789, 2315, + /* 290 */ 2313, 1789, 1876, 1876, 1789, 2342, 1789, 1789, 1789, 1789, + /* 300 */ 1789, 2342, 1789, 1789, 1876, 1789, 1876, 1789, 1789, 1967, + /* 310 */ 1789, 1789, 1789, 1876, 1821, 1789, 2115, 2137, 2096, 2096, + /* 320 */ 2001, 2001, 2001, 1879, 1794, 1789, 1789, 1789, 1789, 1789, + /* 330 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 2357, 2356, 2219, + /* 340 */ 1789, 2268, 2267, 2266, 2257, 2218, 1963, 1789, 2217, 2216, + /* 350 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 2087, + /* 360 */ 2086, 2210, 1789, 1789, 2211, 2209, 2208, 1789, 1789, 1789, + /* 370 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 380 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 390 */ 1789, 2377, 2381, 1789, 1789, 1789, 1789, 1789, 1789, 2293, + /* 400 */ 1789, 1789, 1789, 2192, 1789, 1789, 1789, 1789, 1789, 1789, + /* 410 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 420 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 430 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 440 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 450 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 460 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 470 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 480 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 490 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 500 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 510 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 520 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 530 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1826, 2197, + /* 540 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 550 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 560 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 570 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 580 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 590 */ 1917, 1916, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 600 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 610 */ 1789, 1789, 1789, 1789, 2201, 1789, 1789, 1789, 1789, 1789, + /* 620 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 630 */ 1789, 1789, 1789, 2373, 2330, 1789, 1789, 1789, 1789, 1789, + /* 640 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 650 */ 1789, 1789, 1789, 2192, 1789, 2355, 1789, 1789, 2371, 1789, + /* 660 */ 2375, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 2303, 2299, + /* 670 */ 1789, 1789, 2295, 1789, 1789, 1789, 1789, 1789, 2200, 1789, + /* 680 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 690 */ 1789, 1789, 2191, 1789, 2254, 1789, 1789, 1789, 2288, 1789, + /* 700 */ 1789, 2239, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 710 */ 1789, 2201, 1789, 2204, 1789, 1789, 1789, 1789, 1789, 1995, + /* 720 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 730 */ 1789, 1789, 1789, 1789, 1789, 1979, 1977, 1976, 1975, 1789, + /* 740 */ 2008, 1789, 1789, 1789, 2004, 2003, 1789, 1789, 1789, 1789, + /* 750 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1897, + /* 760 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1889, 1789, + /* 770 */ 1888, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 780 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 790 */ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, + /* 800 */ 1789, 1789, 1789, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1151,7 +1151,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_EQ => nothing */ 0, /* USING => nothing */ 0, /* TAGS => nothing */ - 0, /* COMMENT => nothing */ 0, /* BOOL => nothing */ 0, /* TINYINT => nothing */ 0, /* SMALLINT => nothing */ @@ -1170,6 +1169,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* VARBINARY => nothing */ 0, /* GEOMETRY => nothing */ 0, /* DECIMAL => nothing */ + 0, /* COMMENT => nothing */ 0, /* MAX_DELAY => nothing */ 0, /* WATERMARK => nothing */ 0, /* ROLLUP => nothing */ @@ -1578,25 +1578,25 @@ static const char *const yyTokenName[] = { /* 112 */ "NK_EQ", /* 113 */ "USING", /* 114 */ "TAGS", - /* 115 */ "COMMENT", - /* 116 */ "BOOL", - /* 117 */ "TINYINT", - /* 118 */ "SMALLINT", - /* 119 */ "INT", - /* 120 */ "INTEGER", - /* 121 */ "BIGINT", - /* 122 */ "FLOAT", - /* 123 */ "DOUBLE", - /* 124 */ "BINARY", - /* 125 */ "NCHAR", - /* 126 */ "UNSIGNED", - /* 127 */ "JSON", - /* 128 */ "VARCHAR", - /* 129 */ "MEDIUMBLOB", - /* 130 */ "BLOB", - /* 131 */ "VARBINARY", - /* 132 */ "GEOMETRY", - /* 133 */ "DECIMAL", + /* 115 */ "BOOL", + /* 116 */ "TINYINT", + /* 117 */ "SMALLINT", + /* 118 */ "INT", + /* 119 */ "INTEGER", + /* 120 */ "BIGINT", + /* 121 */ "FLOAT", + /* 122 */ "DOUBLE", + /* 123 */ "BINARY", + /* 124 */ "NCHAR", + /* 125 */ "UNSIGNED", + /* 126 */ "JSON", + /* 127 */ "VARCHAR", + /* 128 */ "MEDIUMBLOB", + /* 129 */ "BLOB", + /* 130 */ "VARBINARY", + /* 131 */ "GEOMETRY", + /* 132 */ "DECIMAL", + /* 133 */ "COMMENT", /* 134 */ "MAX_DELAY", /* 135 */ "WATERMARK", /* 136 */ "ROLLUP", @@ -2142,429 +2142,428 @@ static const char *const yyRuleName[] = { /* 179 */ "column_def_list ::= column_def", /* 180 */ "column_def_list ::= column_def_list NK_COMMA column_def", /* 181 */ "column_def ::= column_name type_name", - /* 182 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 183 */ "type_name ::= BOOL", - /* 184 */ "type_name ::= TINYINT", - /* 185 */ "type_name ::= SMALLINT", - /* 186 */ "type_name ::= INT", - /* 187 */ "type_name ::= INTEGER", - /* 188 */ "type_name ::= BIGINT", - /* 189 */ "type_name ::= FLOAT", - /* 190 */ "type_name ::= DOUBLE", - /* 191 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 192 */ "type_name ::= TIMESTAMP", - /* 193 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 194 */ "type_name ::= TINYINT UNSIGNED", - /* 195 */ "type_name ::= SMALLINT UNSIGNED", - /* 196 */ "type_name ::= INT UNSIGNED", - /* 197 */ "type_name ::= BIGINT UNSIGNED", - /* 198 */ "type_name ::= JSON", - /* 199 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 200 */ "type_name ::= MEDIUMBLOB", - /* 201 */ "type_name ::= BLOB", - /* 202 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 203 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 204 */ "type_name ::= DECIMAL", - /* 205 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 206 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 207 */ "tags_def_opt ::=", - /* 208 */ "tags_def_opt ::= tags_def", - /* 209 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 210 */ "table_options ::=", - /* 211 */ "table_options ::= table_options COMMENT NK_STRING", - /* 212 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 213 */ "table_options ::= table_options WATERMARK duration_list", - /* 214 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 215 */ "table_options ::= table_options TTL NK_INTEGER", - /* 216 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 217 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 218 */ "alter_table_options ::= alter_table_option", - /* 219 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 220 */ "alter_table_option ::= COMMENT NK_STRING", - /* 221 */ "alter_table_option ::= TTL NK_INTEGER", - /* 222 */ "duration_list ::= duration_literal", - /* 223 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 224 */ "rollup_func_list ::= rollup_func_name", - /* 225 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 226 */ "rollup_func_name ::= function_name", - /* 227 */ "rollup_func_name ::= FIRST", - /* 228 */ "rollup_func_name ::= LAST", - /* 229 */ "col_name_list ::= col_name", - /* 230 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 231 */ "col_name ::= column_name", - /* 232 */ "cmd ::= SHOW DNODES", - /* 233 */ "cmd ::= SHOW USERS", - /* 234 */ "cmd ::= SHOW USER PRIVILEGES", - /* 235 */ "cmd ::= SHOW DATABASES", - /* 236 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 237 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 238 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 239 */ "cmd ::= SHOW MNODES", - /* 240 */ "cmd ::= SHOW QNODES", - /* 241 */ "cmd ::= SHOW FUNCTIONS", - /* 242 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 243 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 244 */ "cmd ::= SHOW STREAMS", - /* 245 */ "cmd ::= SHOW ACCOUNTS", - /* 246 */ "cmd ::= SHOW APPS", - /* 247 */ "cmd ::= SHOW CONNECTIONS", - /* 248 */ "cmd ::= SHOW LICENCES", - /* 249 */ "cmd ::= SHOW GRANTS", - /* 250 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 251 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 252 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 253 */ "cmd ::= SHOW QUERIES", - /* 254 */ "cmd ::= SHOW SCORES", - /* 255 */ "cmd ::= SHOW TOPICS", - /* 256 */ "cmd ::= SHOW VARIABLES", - /* 257 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 258 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 259 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 260 */ "cmd ::= SHOW BNODES", - /* 261 */ "cmd ::= SHOW SNODES", - /* 262 */ "cmd ::= SHOW CLUSTER", - /* 263 */ "cmd ::= SHOW TRANSACTIONS", - /* 264 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 265 */ "cmd ::= SHOW CONSUMERS", - /* 266 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 267 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 268 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 269 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 270 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 271 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 272 */ "cmd ::= SHOW VNODES", - /* 273 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 274 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 275 */ "db_name_cond_opt ::=", - /* 276 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 277 */ "like_pattern_opt ::=", - /* 278 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 279 */ "table_name_cond ::= table_name", - /* 280 */ "from_db_opt ::=", - /* 281 */ "from_db_opt ::= FROM db_name", - /* 282 */ "tag_list_opt ::=", - /* 283 */ "tag_list_opt ::= tag_item", - /* 284 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 285 */ "tag_item ::= TBNAME", - /* 286 */ "tag_item ::= QTAGS", - /* 287 */ "tag_item ::= column_name", - /* 288 */ "tag_item ::= column_name column_alias", - /* 289 */ "tag_item ::= column_name AS column_alias", - /* 290 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 291 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 292 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 293 */ "full_index_name ::= index_name", - /* 294 */ "full_index_name ::= db_name NK_DOT index_name", - /* 295 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 296 */ "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", - /* 297 */ "func_list ::= func", - /* 298 */ "func_list ::= func_list NK_COMMA func", - /* 299 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 300 */ "sma_func_name ::= function_name", - /* 301 */ "sma_func_name ::= COUNT", - /* 302 */ "sma_func_name ::= FIRST", - /* 303 */ "sma_func_name ::= LAST", - /* 304 */ "sma_func_name ::= LAST_ROW", - /* 305 */ "sma_stream_opt ::=", - /* 306 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 307 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 308 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 309 */ "with_meta ::= AS", - /* 310 */ "with_meta ::= WITH META AS", - /* 311 */ "with_meta ::= ONLY META AS", - /* 312 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 313 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 314 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 315 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 316 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 317 */ "cmd ::= DESC full_table_name", - /* 318 */ "cmd ::= DESCRIBE full_table_name", - /* 319 */ "cmd ::= RESET QUERY CACHE", - /* 320 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 321 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 322 */ "analyze_opt ::=", - /* 323 */ "analyze_opt ::= ANALYZE", - /* 324 */ "explain_options ::=", - /* 325 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 326 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 327 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 328 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 329 */ "agg_func_opt ::=", - /* 330 */ "agg_func_opt ::= AGGREGATE", - /* 331 */ "bufsize_opt ::=", - /* 332 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 333 */ "language_opt ::=", - /* 334 */ "language_opt ::= LANGUAGE NK_STRING", - /* 335 */ "or_replace_opt ::=", - /* 336 */ "or_replace_opt ::= OR REPLACE", - /* 337 */ "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", - /* 338 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 339 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 340 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 341 */ "col_list_opt ::=", - /* 342 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 343 */ "tag_def_or_ref_opt ::=", - /* 344 */ "tag_def_or_ref_opt ::= tags_def", - /* 345 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 346 */ "stream_options ::=", - /* 347 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 348 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 349 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 350 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 351 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 352 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 353 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 354 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 355 */ "subtable_opt ::=", - /* 356 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 357 */ "ignore_opt ::=", - /* 358 */ "ignore_opt ::= IGNORE UNTREATED", - /* 359 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 360 */ "cmd ::= KILL QUERY NK_STRING", - /* 361 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 362 */ "cmd ::= BALANCE VGROUP", - /* 363 */ "cmd ::= BALANCE VGROUP LEADER", - /* 364 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 365 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 366 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 367 */ "dnode_list ::= DNODE NK_INTEGER", - /* 368 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 369 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 370 */ "cmd ::= query_or_subquery", - /* 371 */ "cmd ::= insert_query", - /* 372 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 373 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 374 */ "literal ::= NK_INTEGER", - /* 375 */ "literal ::= NK_FLOAT", - /* 376 */ "literal ::= NK_STRING", - /* 377 */ "literal ::= NK_BOOL", - /* 378 */ "literal ::= TIMESTAMP NK_STRING", - /* 379 */ "literal ::= duration_literal", - /* 380 */ "literal ::= NULL", - /* 381 */ "literal ::= NK_QUESTION", - /* 382 */ "duration_literal ::= NK_VARIABLE", - /* 383 */ "signed ::= NK_INTEGER", - /* 384 */ "signed ::= NK_PLUS NK_INTEGER", - /* 385 */ "signed ::= NK_MINUS NK_INTEGER", - /* 386 */ "signed ::= NK_FLOAT", - /* 387 */ "signed ::= NK_PLUS NK_FLOAT", - /* 388 */ "signed ::= NK_MINUS NK_FLOAT", - /* 389 */ "signed_literal ::= signed", - /* 390 */ "signed_literal ::= NK_STRING", - /* 391 */ "signed_literal ::= NK_BOOL", - /* 392 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 393 */ "signed_literal ::= duration_literal", - /* 394 */ "signed_literal ::= NULL", - /* 395 */ "signed_literal ::= literal_func", - /* 396 */ "signed_literal ::= NK_QUESTION", - /* 397 */ "literal_list ::= signed_literal", - /* 398 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 399 */ "db_name ::= NK_ID", - /* 400 */ "table_name ::= NK_ID", - /* 401 */ "column_name ::= NK_ID", - /* 402 */ "function_name ::= NK_ID", - /* 403 */ "table_alias ::= NK_ID", - /* 404 */ "column_alias ::= NK_ID", - /* 405 */ "user_name ::= NK_ID", - /* 406 */ "topic_name ::= NK_ID", - /* 407 */ "stream_name ::= NK_ID", - /* 408 */ "cgroup_name ::= NK_ID", - /* 409 */ "index_name ::= NK_ID", - /* 410 */ "expr_or_subquery ::= expression", - /* 411 */ "expression ::= literal", - /* 412 */ "expression ::= pseudo_column", - /* 413 */ "expression ::= column_reference", - /* 414 */ "expression ::= function_expression", - /* 415 */ "expression ::= case_when_expression", - /* 416 */ "expression ::= NK_LP expression NK_RP", - /* 417 */ "expression ::= NK_PLUS expr_or_subquery", - /* 418 */ "expression ::= NK_MINUS expr_or_subquery", - /* 419 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 420 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 421 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 422 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 423 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 424 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 425 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 426 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 427 */ "expression_list ::= expr_or_subquery", - /* 428 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 429 */ "column_reference ::= column_name", - /* 430 */ "column_reference ::= table_name NK_DOT column_name", - /* 431 */ "pseudo_column ::= ROWTS", - /* 432 */ "pseudo_column ::= TBNAME", - /* 433 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 434 */ "pseudo_column ::= QSTART", - /* 435 */ "pseudo_column ::= QEND", - /* 436 */ "pseudo_column ::= QDURATION", - /* 437 */ "pseudo_column ::= WSTART", - /* 438 */ "pseudo_column ::= WEND", - /* 439 */ "pseudo_column ::= WDURATION", - /* 440 */ "pseudo_column ::= IROWTS", - /* 441 */ "pseudo_column ::= ISFILLED", - /* 442 */ "pseudo_column ::= QTAGS", - /* 443 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 444 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 445 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 446 */ "function_expression ::= literal_func", - /* 447 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 448 */ "literal_func ::= NOW", - /* 449 */ "noarg_func ::= NOW", - /* 450 */ "noarg_func ::= TODAY", - /* 451 */ "noarg_func ::= TIMEZONE", - /* 452 */ "noarg_func ::= DATABASE", - /* 453 */ "noarg_func ::= CLIENT_VERSION", - /* 454 */ "noarg_func ::= SERVER_VERSION", - /* 455 */ "noarg_func ::= SERVER_STATUS", - /* 456 */ "noarg_func ::= CURRENT_USER", - /* 457 */ "noarg_func ::= USER", - /* 458 */ "star_func ::= COUNT", - /* 459 */ "star_func ::= FIRST", - /* 460 */ "star_func ::= LAST", - /* 461 */ "star_func ::= LAST_ROW", - /* 462 */ "star_func_para_list ::= NK_STAR", - /* 463 */ "star_func_para_list ::= other_para_list", - /* 464 */ "other_para_list ::= star_func_para", - /* 465 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 466 */ "star_func_para ::= expr_or_subquery", - /* 467 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 468 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 469 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 470 */ "when_then_list ::= when_then_expr", - /* 471 */ "when_then_list ::= when_then_list when_then_expr", - /* 472 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 473 */ "case_when_else_opt ::=", - /* 474 */ "case_when_else_opt ::= ELSE common_expression", - /* 475 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 476 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 477 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 478 */ "predicate ::= expr_or_subquery IS NULL", - /* 479 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 480 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 481 */ "compare_op ::= NK_LT", - /* 482 */ "compare_op ::= NK_GT", - /* 483 */ "compare_op ::= NK_LE", - /* 484 */ "compare_op ::= NK_GE", - /* 485 */ "compare_op ::= NK_NE", - /* 486 */ "compare_op ::= NK_EQ", - /* 487 */ "compare_op ::= LIKE", - /* 488 */ "compare_op ::= NOT LIKE", - /* 489 */ "compare_op ::= MATCH", - /* 490 */ "compare_op ::= NMATCH", - /* 491 */ "compare_op ::= CONTAINS", - /* 492 */ "in_op ::= IN", - /* 493 */ "in_op ::= NOT IN", - /* 494 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 495 */ "boolean_value_expression ::= boolean_primary", - /* 496 */ "boolean_value_expression ::= NOT boolean_primary", - /* 497 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 498 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 499 */ "boolean_primary ::= predicate", - /* 500 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 501 */ "common_expression ::= expr_or_subquery", - /* 502 */ "common_expression ::= boolean_value_expression", - /* 503 */ "from_clause_opt ::=", - /* 504 */ "from_clause_opt ::= FROM table_reference_list", - /* 505 */ "table_reference_list ::= table_reference", - /* 506 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 507 */ "table_reference ::= table_primary", - /* 508 */ "table_reference ::= joined_table", - /* 509 */ "table_primary ::= table_name alias_opt", - /* 510 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 511 */ "table_primary ::= subquery alias_opt", - /* 512 */ "table_primary ::= parenthesized_joined_table", - /* 513 */ "alias_opt ::=", - /* 514 */ "alias_opt ::= table_alias", - /* 515 */ "alias_opt ::= AS table_alias", - /* 516 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 517 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 518 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 519 */ "join_type ::=", - /* 520 */ "join_type ::= INNER", - /* 521 */ "query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 522 */ "hint_list ::=", - /* 523 */ "hint_list ::= NK_HINT", - /* 524 */ "tag_mode_opt ::=", - /* 525 */ "tag_mode_opt ::= TAGS", - /* 526 */ "set_quantifier_opt ::=", - /* 527 */ "set_quantifier_opt ::= DISTINCT", - /* 528 */ "set_quantifier_opt ::= ALL", - /* 529 */ "select_list ::= select_item", - /* 530 */ "select_list ::= select_list NK_COMMA select_item", - /* 531 */ "select_item ::= NK_STAR", - /* 532 */ "select_item ::= common_expression", - /* 533 */ "select_item ::= common_expression column_alias", - /* 534 */ "select_item ::= common_expression AS column_alias", - /* 535 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 536 */ "where_clause_opt ::=", - /* 537 */ "where_clause_opt ::= WHERE search_condition", - /* 538 */ "partition_by_clause_opt ::=", - /* 539 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 540 */ "partition_list ::= partition_item", - /* 541 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 542 */ "partition_item ::= expr_or_subquery", - /* 543 */ "partition_item ::= expr_or_subquery column_alias", - /* 544 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 545 */ "twindow_clause_opt ::=", - /* 546 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 547 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 548 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 549 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 550 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 551 */ "sliding_opt ::=", - /* 552 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 553 */ "fill_opt ::=", - /* 554 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 555 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 556 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 557 */ "fill_mode ::= NONE", - /* 558 */ "fill_mode ::= PREV", - /* 559 */ "fill_mode ::= NULL", - /* 560 */ "fill_mode ::= NULL_F", - /* 561 */ "fill_mode ::= LINEAR", - /* 562 */ "fill_mode ::= NEXT", - /* 563 */ "group_by_clause_opt ::=", - /* 564 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 565 */ "group_by_list ::= expr_or_subquery", - /* 566 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 567 */ "having_clause_opt ::=", - /* 568 */ "having_clause_opt ::= HAVING search_condition", - /* 569 */ "range_opt ::=", - /* 570 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 571 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 572 */ "every_opt ::=", - /* 573 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 574 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 575 */ "query_simple ::= query_specification", - /* 576 */ "query_simple ::= union_query_expression", - /* 577 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 578 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 579 */ "query_simple_or_subquery ::= query_simple", - /* 580 */ "query_simple_or_subquery ::= subquery", - /* 581 */ "query_or_subquery ::= query_expression", - /* 582 */ "query_or_subquery ::= subquery", - /* 583 */ "order_by_clause_opt ::=", - /* 584 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 585 */ "slimit_clause_opt ::=", - /* 586 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 587 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 588 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 589 */ "limit_clause_opt ::=", - /* 590 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 591 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 592 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 593 */ "subquery ::= NK_LP query_expression NK_RP", - /* 594 */ "subquery ::= NK_LP subquery NK_RP", - /* 595 */ "search_condition ::= common_expression", - /* 596 */ "sort_specification_list ::= sort_specification", - /* 597 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 598 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 599 */ "ordering_specification_opt ::=", - /* 600 */ "ordering_specification_opt ::= ASC", - /* 601 */ "ordering_specification_opt ::= DESC", - /* 602 */ "null_ordering_opt ::=", - /* 603 */ "null_ordering_opt ::= NULLS FIRST", - /* 604 */ "null_ordering_opt ::= NULLS LAST", + /* 182 */ "type_name ::= BOOL", + /* 183 */ "type_name ::= TINYINT", + /* 184 */ "type_name ::= SMALLINT", + /* 185 */ "type_name ::= INT", + /* 186 */ "type_name ::= INTEGER", + /* 187 */ "type_name ::= BIGINT", + /* 188 */ "type_name ::= FLOAT", + /* 189 */ "type_name ::= DOUBLE", + /* 190 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 191 */ "type_name ::= TIMESTAMP", + /* 192 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 193 */ "type_name ::= TINYINT UNSIGNED", + /* 194 */ "type_name ::= SMALLINT UNSIGNED", + /* 195 */ "type_name ::= INT UNSIGNED", + /* 196 */ "type_name ::= BIGINT UNSIGNED", + /* 197 */ "type_name ::= JSON", + /* 198 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 199 */ "type_name ::= MEDIUMBLOB", + /* 200 */ "type_name ::= BLOB", + /* 201 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 202 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 203 */ "type_name ::= DECIMAL", + /* 204 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 205 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 206 */ "tags_def_opt ::=", + /* 207 */ "tags_def_opt ::= tags_def", + /* 208 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 209 */ "table_options ::=", + /* 210 */ "table_options ::= table_options COMMENT NK_STRING", + /* 211 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 212 */ "table_options ::= table_options WATERMARK duration_list", + /* 213 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 214 */ "table_options ::= table_options TTL NK_INTEGER", + /* 215 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 216 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 217 */ "alter_table_options ::= alter_table_option", + /* 218 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 219 */ "alter_table_option ::= COMMENT NK_STRING", + /* 220 */ "alter_table_option ::= TTL NK_INTEGER", + /* 221 */ "duration_list ::= duration_literal", + /* 222 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 223 */ "rollup_func_list ::= rollup_func_name", + /* 224 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 225 */ "rollup_func_name ::= function_name", + /* 226 */ "rollup_func_name ::= FIRST", + /* 227 */ "rollup_func_name ::= LAST", + /* 228 */ "col_name_list ::= col_name", + /* 229 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 230 */ "col_name ::= column_name", + /* 231 */ "cmd ::= SHOW DNODES", + /* 232 */ "cmd ::= SHOW USERS", + /* 233 */ "cmd ::= SHOW USER PRIVILEGES", + /* 234 */ "cmd ::= SHOW DATABASES", + /* 235 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 236 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 237 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 238 */ "cmd ::= SHOW MNODES", + /* 239 */ "cmd ::= SHOW QNODES", + /* 240 */ "cmd ::= SHOW FUNCTIONS", + /* 241 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 242 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 243 */ "cmd ::= SHOW STREAMS", + /* 244 */ "cmd ::= SHOW ACCOUNTS", + /* 245 */ "cmd ::= SHOW APPS", + /* 246 */ "cmd ::= SHOW CONNECTIONS", + /* 247 */ "cmd ::= SHOW LICENCES", + /* 248 */ "cmd ::= SHOW GRANTS", + /* 249 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 250 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 251 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 252 */ "cmd ::= SHOW QUERIES", + /* 253 */ "cmd ::= SHOW SCORES", + /* 254 */ "cmd ::= SHOW TOPICS", + /* 255 */ "cmd ::= SHOW VARIABLES", + /* 256 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 257 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 258 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 259 */ "cmd ::= SHOW BNODES", + /* 260 */ "cmd ::= SHOW SNODES", + /* 261 */ "cmd ::= SHOW CLUSTER", + /* 262 */ "cmd ::= SHOW TRANSACTIONS", + /* 263 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 264 */ "cmd ::= SHOW CONSUMERS", + /* 265 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 266 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 267 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 268 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 269 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 270 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 271 */ "cmd ::= SHOW VNODES", + /* 272 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 273 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 274 */ "db_name_cond_opt ::=", + /* 275 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 276 */ "like_pattern_opt ::=", + /* 277 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 278 */ "table_name_cond ::= table_name", + /* 279 */ "from_db_opt ::=", + /* 280 */ "from_db_opt ::= FROM db_name", + /* 281 */ "tag_list_opt ::=", + /* 282 */ "tag_list_opt ::= tag_item", + /* 283 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 284 */ "tag_item ::= TBNAME", + /* 285 */ "tag_item ::= QTAGS", + /* 286 */ "tag_item ::= column_name", + /* 287 */ "tag_item ::= column_name column_alias", + /* 288 */ "tag_item ::= column_name AS column_alias", + /* 289 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 290 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 291 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 292 */ "full_index_name ::= index_name", + /* 293 */ "full_index_name ::= db_name NK_DOT index_name", + /* 294 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 295 */ "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", + /* 296 */ "func_list ::= func", + /* 297 */ "func_list ::= func_list NK_COMMA func", + /* 298 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 299 */ "sma_func_name ::= function_name", + /* 300 */ "sma_func_name ::= COUNT", + /* 301 */ "sma_func_name ::= FIRST", + /* 302 */ "sma_func_name ::= LAST", + /* 303 */ "sma_func_name ::= LAST_ROW", + /* 304 */ "sma_stream_opt ::=", + /* 305 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 306 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 307 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 308 */ "with_meta ::= AS", + /* 309 */ "with_meta ::= WITH META AS", + /* 310 */ "with_meta ::= ONLY META AS", + /* 311 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 312 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 313 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 314 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 315 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 316 */ "cmd ::= DESC full_table_name", + /* 317 */ "cmd ::= DESCRIBE full_table_name", + /* 318 */ "cmd ::= RESET QUERY CACHE", + /* 319 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 320 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 321 */ "analyze_opt ::=", + /* 322 */ "analyze_opt ::= ANALYZE", + /* 323 */ "explain_options ::=", + /* 324 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 325 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 326 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 327 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 328 */ "agg_func_opt ::=", + /* 329 */ "agg_func_opt ::= AGGREGATE", + /* 330 */ "bufsize_opt ::=", + /* 331 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 332 */ "language_opt ::=", + /* 333 */ "language_opt ::= LANGUAGE NK_STRING", + /* 334 */ "or_replace_opt ::=", + /* 335 */ "or_replace_opt ::= OR REPLACE", + /* 336 */ "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", + /* 337 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 338 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 339 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 340 */ "col_list_opt ::=", + /* 341 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 342 */ "tag_def_or_ref_opt ::=", + /* 343 */ "tag_def_or_ref_opt ::= tags_def", + /* 344 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 345 */ "stream_options ::=", + /* 346 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 347 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 348 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 349 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 350 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 351 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 352 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 353 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 354 */ "subtable_opt ::=", + /* 355 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 356 */ "ignore_opt ::=", + /* 357 */ "ignore_opt ::= IGNORE UNTREATED", + /* 358 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 359 */ "cmd ::= KILL QUERY NK_STRING", + /* 360 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 361 */ "cmd ::= BALANCE VGROUP", + /* 362 */ "cmd ::= BALANCE VGROUP LEADER", + /* 363 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 364 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 365 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 366 */ "dnode_list ::= DNODE NK_INTEGER", + /* 367 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 368 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 369 */ "cmd ::= query_or_subquery", + /* 370 */ "cmd ::= insert_query", + /* 371 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 372 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 373 */ "literal ::= NK_INTEGER", + /* 374 */ "literal ::= NK_FLOAT", + /* 375 */ "literal ::= NK_STRING", + /* 376 */ "literal ::= NK_BOOL", + /* 377 */ "literal ::= TIMESTAMP NK_STRING", + /* 378 */ "literal ::= duration_literal", + /* 379 */ "literal ::= NULL", + /* 380 */ "literal ::= NK_QUESTION", + /* 381 */ "duration_literal ::= NK_VARIABLE", + /* 382 */ "signed ::= NK_INTEGER", + /* 383 */ "signed ::= NK_PLUS NK_INTEGER", + /* 384 */ "signed ::= NK_MINUS NK_INTEGER", + /* 385 */ "signed ::= NK_FLOAT", + /* 386 */ "signed ::= NK_PLUS NK_FLOAT", + /* 387 */ "signed ::= NK_MINUS NK_FLOAT", + /* 388 */ "signed_literal ::= signed", + /* 389 */ "signed_literal ::= NK_STRING", + /* 390 */ "signed_literal ::= NK_BOOL", + /* 391 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 392 */ "signed_literal ::= duration_literal", + /* 393 */ "signed_literal ::= NULL", + /* 394 */ "signed_literal ::= literal_func", + /* 395 */ "signed_literal ::= NK_QUESTION", + /* 396 */ "literal_list ::= signed_literal", + /* 397 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 398 */ "db_name ::= NK_ID", + /* 399 */ "table_name ::= NK_ID", + /* 400 */ "column_name ::= NK_ID", + /* 401 */ "function_name ::= NK_ID", + /* 402 */ "table_alias ::= NK_ID", + /* 403 */ "column_alias ::= NK_ID", + /* 404 */ "user_name ::= NK_ID", + /* 405 */ "topic_name ::= NK_ID", + /* 406 */ "stream_name ::= NK_ID", + /* 407 */ "cgroup_name ::= NK_ID", + /* 408 */ "index_name ::= NK_ID", + /* 409 */ "expr_or_subquery ::= expression", + /* 410 */ "expression ::= literal", + /* 411 */ "expression ::= pseudo_column", + /* 412 */ "expression ::= column_reference", + /* 413 */ "expression ::= function_expression", + /* 414 */ "expression ::= case_when_expression", + /* 415 */ "expression ::= NK_LP expression NK_RP", + /* 416 */ "expression ::= NK_PLUS expr_or_subquery", + /* 417 */ "expression ::= NK_MINUS expr_or_subquery", + /* 418 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 419 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 420 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 421 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 422 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 423 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 424 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 425 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 426 */ "expression_list ::= expr_or_subquery", + /* 427 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 428 */ "column_reference ::= column_name", + /* 429 */ "column_reference ::= table_name NK_DOT column_name", + /* 430 */ "pseudo_column ::= ROWTS", + /* 431 */ "pseudo_column ::= TBNAME", + /* 432 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 433 */ "pseudo_column ::= QSTART", + /* 434 */ "pseudo_column ::= QEND", + /* 435 */ "pseudo_column ::= QDURATION", + /* 436 */ "pseudo_column ::= WSTART", + /* 437 */ "pseudo_column ::= WEND", + /* 438 */ "pseudo_column ::= WDURATION", + /* 439 */ "pseudo_column ::= IROWTS", + /* 440 */ "pseudo_column ::= ISFILLED", + /* 441 */ "pseudo_column ::= QTAGS", + /* 442 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 443 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 444 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 445 */ "function_expression ::= literal_func", + /* 446 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 447 */ "literal_func ::= NOW", + /* 448 */ "noarg_func ::= NOW", + /* 449 */ "noarg_func ::= TODAY", + /* 450 */ "noarg_func ::= TIMEZONE", + /* 451 */ "noarg_func ::= DATABASE", + /* 452 */ "noarg_func ::= CLIENT_VERSION", + /* 453 */ "noarg_func ::= SERVER_VERSION", + /* 454 */ "noarg_func ::= SERVER_STATUS", + /* 455 */ "noarg_func ::= CURRENT_USER", + /* 456 */ "noarg_func ::= USER", + /* 457 */ "star_func ::= COUNT", + /* 458 */ "star_func ::= FIRST", + /* 459 */ "star_func ::= LAST", + /* 460 */ "star_func ::= LAST_ROW", + /* 461 */ "star_func_para_list ::= NK_STAR", + /* 462 */ "star_func_para_list ::= other_para_list", + /* 463 */ "other_para_list ::= star_func_para", + /* 464 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 465 */ "star_func_para ::= expr_or_subquery", + /* 466 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 467 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 468 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 469 */ "when_then_list ::= when_then_expr", + /* 470 */ "when_then_list ::= when_then_list when_then_expr", + /* 471 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 472 */ "case_when_else_opt ::=", + /* 473 */ "case_when_else_opt ::= ELSE common_expression", + /* 474 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 475 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 476 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 477 */ "predicate ::= expr_or_subquery IS NULL", + /* 478 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 479 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 480 */ "compare_op ::= NK_LT", + /* 481 */ "compare_op ::= NK_GT", + /* 482 */ "compare_op ::= NK_LE", + /* 483 */ "compare_op ::= NK_GE", + /* 484 */ "compare_op ::= NK_NE", + /* 485 */ "compare_op ::= NK_EQ", + /* 486 */ "compare_op ::= LIKE", + /* 487 */ "compare_op ::= NOT LIKE", + /* 488 */ "compare_op ::= MATCH", + /* 489 */ "compare_op ::= NMATCH", + /* 490 */ "compare_op ::= CONTAINS", + /* 491 */ "in_op ::= IN", + /* 492 */ "in_op ::= NOT IN", + /* 493 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 494 */ "boolean_value_expression ::= boolean_primary", + /* 495 */ "boolean_value_expression ::= NOT boolean_primary", + /* 496 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 497 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 498 */ "boolean_primary ::= predicate", + /* 499 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 500 */ "common_expression ::= expr_or_subquery", + /* 501 */ "common_expression ::= boolean_value_expression", + /* 502 */ "from_clause_opt ::=", + /* 503 */ "from_clause_opt ::= FROM table_reference_list", + /* 504 */ "table_reference_list ::= table_reference", + /* 505 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 506 */ "table_reference ::= table_primary", + /* 507 */ "table_reference ::= joined_table", + /* 508 */ "table_primary ::= table_name alias_opt", + /* 509 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 510 */ "table_primary ::= subquery alias_opt", + /* 511 */ "table_primary ::= parenthesized_joined_table", + /* 512 */ "alias_opt ::=", + /* 513 */ "alias_opt ::= table_alias", + /* 514 */ "alias_opt ::= AS table_alias", + /* 515 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 516 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 517 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 518 */ "join_type ::=", + /* 519 */ "join_type ::= INNER", + /* 520 */ "query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 521 */ "hint_list ::=", + /* 522 */ "hint_list ::= NK_HINT", + /* 523 */ "tag_mode_opt ::=", + /* 524 */ "tag_mode_opt ::= TAGS", + /* 525 */ "set_quantifier_opt ::=", + /* 526 */ "set_quantifier_opt ::= DISTINCT", + /* 527 */ "set_quantifier_opt ::= ALL", + /* 528 */ "select_list ::= select_item", + /* 529 */ "select_list ::= select_list NK_COMMA select_item", + /* 530 */ "select_item ::= NK_STAR", + /* 531 */ "select_item ::= common_expression", + /* 532 */ "select_item ::= common_expression column_alias", + /* 533 */ "select_item ::= common_expression AS column_alias", + /* 534 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 535 */ "where_clause_opt ::=", + /* 536 */ "where_clause_opt ::= WHERE search_condition", + /* 537 */ "partition_by_clause_opt ::=", + /* 538 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 539 */ "partition_list ::= partition_item", + /* 540 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 541 */ "partition_item ::= expr_or_subquery", + /* 542 */ "partition_item ::= expr_or_subquery column_alias", + /* 543 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 544 */ "twindow_clause_opt ::=", + /* 545 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 546 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 547 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 548 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 549 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 550 */ "sliding_opt ::=", + /* 551 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 552 */ "fill_opt ::=", + /* 553 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 554 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 555 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 556 */ "fill_mode ::= NONE", + /* 557 */ "fill_mode ::= PREV", + /* 558 */ "fill_mode ::= NULL", + /* 559 */ "fill_mode ::= NULL_F", + /* 560 */ "fill_mode ::= LINEAR", + /* 561 */ "fill_mode ::= NEXT", + /* 562 */ "group_by_clause_opt ::=", + /* 563 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 564 */ "group_by_list ::= expr_or_subquery", + /* 565 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 566 */ "having_clause_opt ::=", + /* 567 */ "having_clause_opt ::= HAVING search_condition", + /* 568 */ "range_opt ::=", + /* 569 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 570 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 571 */ "every_opt ::=", + /* 572 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 573 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 574 */ "query_simple ::= query_specification", + /* 575 */ "query_simple ::= union_query_expression", + /* 576 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 577 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 578 */ "query_simple_or_subquery ::= query_simple", + /* 579 */ "query_simple_or_subquery ::= subquery", + /* 580 */ "query_or_subquery ::= query_expression", + /* 581 */ "query_or_subquery ::= subquery", + /* 582 */ "order_by_clause_opt ::=", + /* 583 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 584 */ "slimit_clause_opt ::=", + /* 585 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 586 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 587 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 588 */ "limit_clause_opt ::=", + /* 589 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 590 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 591 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 592 */ "subquery ::= NK_LP query_expression NK_RP", + /* 593 */ "subquery ::= NK_LP subquery NK_RP", + /* 594 */ "search_condition ::= common_expression", + /* 595 */ "sort_specification_list ::= sort_specification", + /* 596 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 597 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 598 */ "ordering_specification_opt ::=", + /* 599 */ "ordering_specification_opt ::= ASC", + /* 600 */ "ordering_specification_opt ::= DESC", + /* 601 */ "null_ordering_opt ::=", + /* 602 */ "null_ordering_opt ::= NULLS FIRST", + /* 603 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3370,429 +3369,428 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 372, /* (179) column_def_list ::= column_def */ 372, /* (180) column_def_list ::= column_def_list NK_COMMA column_def */ 388, /* (181) column_def ::= column_name type_name */ - 388, /* (182) column_def ::= column_name type_name COMMENT NK_STRING */ - 381, /* (183) type_name ::= BOOL */ - 381, /* (184) type_name ::= TINYINT */ - 381, /* (185) type_name ::= SMALLINT */ - 381, /* (186) type_name ::= INT */ - 381, /* (187) type_name ::= INTEGER */ - 381, /* (188) type_name ::= BIGINT */ - 381, /* (189) type_name ::= FLOAT */ - 381, /* (190) type_name ::= DOUBLE */ - 381, /* (191) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 381, /* (192) type_name ::= TIMESTAMP */ - 381, /* (193) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 381, /* (194) type_name ::= TINYINT UNSIGNED */ - 381, /* (195) type_name ::= SMALLINT UNSIGNED */ - 381, /* (196) type_name ::= INT UNSIGNED */ - 381, /* (197) type_name ::= BIGINT UNSIGNED */ - 381, /* (198) type_name ::= JSON */ - 381, /* (199) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 381, /* (200) type_name ::= MEDIUMBLOB */ - 381, /* (201) type_name ::= BLOB */ - 381, /* (202) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 381, /* (203) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 381, /* (204) type_name ::= DECIMAL */ - 381, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 381, /* (206) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 373, /* (207) tags_def_opt ::= */ - 373, /* (208) tags_def_opt ::= tags_def */ - 376, /* (209) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 374, /* (210) table_options ::= */ - 374, /* (211) table_options ::= table_options COMMENT NK_STRING */ - 374, /* (212) table_options ::= table_options MAX_DELAY duration_list */ - 374, /* (213) table_options ::= table_options WATERMARK duration_list */ - 374, /* (214) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 374, /* (215) table_options ::= table_options TTL NK_INTEGER */ - 374, /* (216) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 374, /* (217) table_options ::= table_options DELETE_MARK duration_list */ - 379, /* (218) alter_table_options ::= alter_table_option */ - 379, /* (219) alter_table_options ::= alter_table_options alter_table_option */ - 391, /* (220) alter_table_option ::= COMMENT NK_STRING */ - 391, /* (221) alter_table_option ::= TTL NK_INTEGER */ - 389, /* (222) duration_list ::= duration_literal */ - 389, /* (223) duration_list ::= duration_list NK_COMMA duration_literal */ - 390, /* (224) rollup_func_list ::= rollup_func_name */ - 390, /* (225) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 393, /* (226) rollup_func_name ::= function_name */ - 393, /* (227) rollup_func_name ::= FIRST */ - 393, /* (228) rollup_func_name ::= LAST */ - 387, /* (229) col_name_list ::= col_name */ - 387, /* (230) col_name_list ::= col_name_list NK_COMMA col_name */ - 395, /* (231) col_name ::= column_name */ - 339, /* (232) cmd ::= SHOW DNODES */ - 339, /* (233) cmd ::= SHOW USERS */ - 339, /* (234) cmd ::= SHOW USER PRIVILEGES */ - 339, /* (235) cmd ::= SHOW DATABASES */ - 339, /* (236) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - 339, /* (237) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 339, /* (238) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 339, /* (239) cmd ::= SHOW MNODES */ - 339, /* (240) cmd ::= SHOW QNODES */ - 339, /* (241) cmd ::= SHOW FUNCTIONS */ - 339, /* (242) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 339, /* (243) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 339, /* (244) cmd ::= SHOW STREAMS */ - 339, /* (245) cmd ::= SHOW ACCOUNTS */ - 339, /* (246) cmd ::= SHOW APPS */ - 339, /* (247) cmd ::= SHOW CONNECTIONS */ - 339, /* (248) cmd ::= SHOW LICENCES */ - 339, /* (249) cmd ::= SHOW GRANTS */ - 339, /* (250) cmd ::= SHOW CREATE DATABASE db_name */ - 339, /* (251) cmd ::= SHOW CREATE TABLE full_table_name */ - 339, /* (252) cmd ::= SHOW CREATE STABLE full_table_name */ - 339, /* (253) cmd ::= SHOW QUERIES */ - 339, /* (254) cmd ::= SHOW SCORES */ - 339, /* (255) cmd ::= SHOW TOPICS */ - 339, /* (256) cmd ::= SHOW VARIABLES */ - 339, /* (257) cmd ::= SHOW CLUSTER VARIABLES */ - 339, /* (258) cmd ::= SHOW LOCAL VARIABLES */ - 339, /* (259) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 339, /* (260) cmd ::= SHOW BNODES */ - 339, /* (261) cmd ::= SHOW SNODES */ - 339, /* (262) cmd ::= SHOW CLUSTER */ - 339, /* (263) cmd ::= SHOW TRANSACTIONS */ - 339, /* (264) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 339, /* (265) cmd ::= SHOW CONSUMERS */ - 339, /* (266) cmd ::= SHOW SUBSCRIPTIONS */ - 339, /* (267) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 339, /* (268) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 339, /* (269) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 339, /* (270) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 339, /* (271) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 339, /* (272) cmd ::= SHOW VNODES */ - 339, /* (273) cmd ::= SHOW db_name_cond_opt ALIVE */ - 339, /* (274) cmd ::= SHOW CLUSTER ALIVE */ - 396, /* (275) db_name_cond_opt ::= */ - 396, /* (276) db_name_cond_opt ::= db_name NK_DOT */ - 397, /* (277) like_pattern_opt ::= */ - 397, /* (278) like_pattern_opt ::= LIKE NK_STRING */ - 398, /* (279) table_name_cond ::= table_name */ - 399, /* (280) from_db_opt ::= */ - 399, /* (281) from_db_opt ::= FROM db_name */ - 400, /* (282) tag_list_opt ::= */ - 400, /* (283) tag_list_opt ::= tag_item */ - 400, /* (284) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 401, /* (285) tag_item ::= TBNAME */ - 401, /* (286) tag_item ::= QTAGS */ - 401, /* (287) tag_item ::= column_name */ - 401, /* (288) tag_item ::= column_name column_alias */ - 401, /* (289) tag_item ::= column_name AS column_alias */ - 339, /* (290) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - 339, /* (291) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - 339, /* (292) cmd ::= DROP INDEX exists_opt full_index_name */ - 403, /* (293) full_index_name ::= index_name */ - 403, /* (294) full_index_name ::= db_name NK_DOT index_name */ - 404, /* (295) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 404, /* (296) 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 */ - 406, /* (297) func_list ::= func */ - 406, /* (298) func_list ::= func_list NK_COMMA func */ - 409, /* (299) func ::= sma_func_name NK_LP expression_list NK_RP */ - 410, /* (300) sma_func_name ::= function_name */ - 410, /* (301) sma_func_name ::= COUNT */ - 410, /* (302) sma_func_name ::= FIRST */ - 410, /* (303) sma_func_name ::= LAST */ - 410, /* (304) sma_func_name ::= LAST_ROW */ - 408, /* (305) sma_stream_opt ::= */ - 408, /* (306) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 408, /* (307) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 408, /* (308) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 411, /* (309) with_meta ::= AS */ - 411, /* (310) with_meta ::= WITH META AS */ - 411, /* (311) with_meta ::= ONLY META AS */ - 339, /* (312) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 339, /* (313) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 339, /* (314) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 339, /* (315) cmd ::= DROP TOPIC exists_opt topic_name */ - 339, /* (316) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 339, /* (317) cmd ::= DESC full_table_name */ - 339, /* (318) cmd ::= DESCRIBE full_table_name */ - 339, /* (319) cmd ::= RESET QUERY CACHE */ - 339, /* (320) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 339, /* (321) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 415, /* (322) analyze_opt ::= */ - 415, /* (323) analyze_opt ::= ANALYZE */ - 416, /* (324) explain_options ::= */ - 416, /* (325) explain_options ::= explain_options VERBOSE NK_BOOL */ - 416, /* (326) explain_options ::= explain_options RATIO NK_FLOAT */ - 339, /* (327) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 339, /* (328) cmd ::= DROP FUNCTION exists_opt function_name */ - 419, /* (329) agg_func_opt ::= */ - 419, /* (330) agg_func_opt ::= AGGREGATE */ - 420, /* (331) bufsize_opt ::= */ - 420, /* (332) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 421, /* (333) language_opt ::= */ - 421, /* (334) language_opt ::= LANGUAGE NK_STRING */ - 418, /* (335) or_replace_opt ::= */ - 418, /* (336) or_replace_opt ::= OR REPLACE */ - 339, /* (337) 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 */ - 339, /* (338) cmd ::= DROP STREAM exists_opt stream_name */ - 339, /* (339) cmd ::= PAUSE STREAM exists_opt stream_name */ - 339, /* (340) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 424, /* (341) col_list_opt ::= */ - 424, /* (342) col_list_opt ::= NK_LP col_name_list NK_RP */ - 425, /* (343) tag_def_or_ref_opt ::= */ - 425, /* (344) tag_def_or_ref_opt ::= tags_def */ - 425, /* (345) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 423, /* (346) stream_options ::= */ - 423, /* (347) stream_options ::= stream_options TRIGGER AT_ONCE */ - 423, /* (348) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 423, /* (349) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 423, /* (350) stream_options ::= stream_options WATERMARK duration_literal */ - 423, /* (351) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 423, /* (352) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 423, /* (353) stream_options ::= stream_options DELETE_MARK duration_literal */ - 423, /* (354) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 426, /* (355) subtable_opt ::= */ - 426, /* (356) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 427, /* (357) ignore_opt ::= */ - 427, /* (358) ignore_opt ::= IGNORE UNTREATED */ - 339, /* (359) cmd ::= KILL CONNECTION NK_INTEGER */ - 339, /* (360) cmd ::= KILL QUERY NK_STRING */ - 339, /* (361) cmd ::= KILL TRANSACTION NK_INTEGER */ - 339, /* (362) cmd ::= BALANCE VGROUP */ - 339, /* (363) cmd ::= BALANCE VGROUP LEADER */ - 339, /* (364) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 339, /* (365) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 339, /* (366) cmd ::= SPLIT VGROUP NK_INTEGER */ - 429, /* (367) dnode_list ::= DNODE NK_INTEGER */ - 429, /* (368) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 339, /* (369) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 339, /* (370) cmd ::= query_or_subquery */ - 339, /* (371) cmd ::= insert_query */ - 417, /* (372) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 417, /* (373) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 342, /* (374) literal ::= NK_INTEGER */ - 342, /* (375) literal ::= NK_FLOAT */ - 342, /* (376) literal ::= NK_STRING */ - 342, /* (377) literal ::= NK_BOOL */ - 342, /* (378) literal ::= TIMESTAMP NK_STRING */ - 342, /* (379) literal ::= duration_literal */ - 342, /* (380) literal ::= NULL */ - 342, /* (381) literal ::= NK_QUESTION */ - 392, /* (382) duration_literal ::= NK_VARIABLE */ - 368, /* (383) signed ::= NK_INTEGER */ - 368, /* (384) signed ::= NK_PLUS NK_INTEGER */ - 368, /* (385) signed ::= NK_MINUS NK_INTEGER */ - 368, /* (386) signed ::= NK_FLOAT */ - 368, /* (387) signed ::= NK_PLUS NK_FLOAT */ - 368, /* (388) signed ::= NK_MINUS NK_FLOAT */ - 382, /* (389) signed_literal ::= signed */ - 382, /* (390) signed_literal ::= NK_STRING */ - 382, /* (391) signed_literal ::= NK_BOOL */ - 382, /* (392) signed_literal ::= TIMESTAMP NK_STRING */ - 382, /* (393) signed_literal ::= duration_literal */ - 382, /* (394) signed_literal ::= NULL */ - 382, /* (395) signed_literal ::= literal_func */ - 382, /* (396) signed_literal ::= NK_QUESTION */ - 431, /* (397) literal_list ::= signed_literal */ - 431, /* (398) literal_list ::= literal_list NK_COMMA signed_literal */ - 351, /* (399) db_name ::= NK_ID */ - 352, /* (400) table_name ::= NK_ID */ - 380, /* (401) column_name ::= NK_ID */ - 394, /* (402) function_name ::= NK_ID */ - 432, /* (403) table_alias ::= NK_ID */ - 402, /* (404) column_alias ::= NK_ID */ - 344, /* (405) user_name ::= NK_ID */ - 353, /* (406) topic_name ::= NK_ID */ - 422, /* (407) stream_name ::= NK_ID */ - 414, /* (408) cgroup_name ::= NK_ID */ - 405, /* (409) index_name ::= NK_ID */ - 433, /* (410) expr_or_subquery ::= expression */ - 428, /* (411) expression ::= literal */ - 428, /* (412) expression ::= pseudo_column */ - 428, /* (413) expression ::= column_reference */ - 428, /* (414) expression ::= function_expression */ - 428, /* (415) expression ::= case_when_expression */ - 428, /* (416) expression ::= NK_LP expression NK_RP */ - 428, /* (417) expression ::= NK_PLUS expr_or_subquery */ - 428, /* (418) expression ::= NK_MINUS expr_or_subquery */ - 428, /* (419) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 428, /* (420) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 428, /* (421) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 428, /* (422) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 428, /* (423) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 428, /* (424) expression ::= column_reference NK_ARROW NK_STRING */ - 428, /* (425) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 428, /* (426) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 385, /* (427) expression_list ::= expr_or_subquery */ - 385, /* (428) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 435, /* (429) column_reference ::= column_name */ - 435, /* (430) column_reference ::= table_name NK_DOT column_name */ - 434, /* (431) pseudo_column ::= ROWTS */ - 434, /* (432) pseudo_column ::= TBNAME */ - 434, /* (433) pseudo_column ::= table_name NK_DOT TBNAME */ - 434, /* (434) pseudo_column ::= QSTART */ - 434, /* (435) pseudo_column ::= QEND */ - 434, /* (436) pseudo_column ::= QDURATION */ - 434, /* (437) pseudo_column ::= WSTART */ - 434, /* (438) pseudo_column ::= WEND */ - 434, /* (439) pseudo_column ::= WDURATION */ - 434, /* (440) pseudo_column ::= IROWTS */ - 434, /* (441) pseudo_column ::= ISFILLED */ - 434, /* (442) pseudo_column ::= QTAGS */ - 436, /* (443) function_expression ::= function_name NK_LP expression_list NK_RP */ - 436, /* (444) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 436, /* (445) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 436, /* (446) function_expression ::= literal_func */ - 430, /* (447) literal_func ::= noarg_func NK_LP NK_RP */ - 430, /* (448) literal_func ::= NOW */ - 440, /* (449) noarg_func ::= NOW */ - 440, /* (450) noarg_func ::= TODAY */ - 440, /* (451) noarg_func ::= TIMEZONE */ - 440, /* (452) noarg_func ::= DATABASE */ - 440, /* (453) noarg_func ::= CLIENT_VERSION */ - 440, /* (454) noarg_func ::= SERVER_VERSION */ - 440, /* (455) noarg_func ::= SERVER_STATUS */ - 440, /* (456) noarg_func ::= CURRENT_USER */ - 440, /* (457) noarg_func ::= USER */ - 438, /* (458) star_func ::= COUNT */ - 438, /* (459) star_func ::= FIRST */ - 438, /* (460) star_func ::= LAST */ - 438, /* (461) star_func ::= LAST_ROW */ - 439, /* (462) star_func_para_list ::= NK_STAR */ - 439, /* (463) star_func_para_list ::= other_para_list */ - 441, /* (464) other_para_list ::= star_func_para */ - 441, /* (465) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 442, /* (466) star_func_para ::= expr_or_subquery */ - 442, /* (467) star_func_para ::= table_name NK_DOT NK_STAR */ - 437, /* (468) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 437, /* (469) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 443, /* (470) when_then_list ::= when_then_expr */ - 443, /* (471) when_then_list ::= when_then_list when_then_expr */ - 446, /* (472) when_then_expr ::= WHEN common_expression THEN common_expression */ - 444, /* (473) case_when_else_opt ::= */ - 444, /* (474) case_when_else_opt ::= ELSE common_expression */ - 447, /* (475) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 447, /* (476) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 447, /* (477) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 447, /* (478) predicate ::= expr_or_subquery IS NULL */ - 447, /* (479) predicate ::= expr_or_subquery IS NOT NULL */ - 447, /* (480) predicate ::= expr_or_subquery in_op in_predicate_value */ - 448, /* (481) compare_op ::= NK_LT */ - 448, /* (482) compare_op ::= NK_GT */ - 448, /* (483) compare_op ::= NK_LE */ - 448, /* (484) compare_op ::= NK_GE */ - 448, /* (485) compare_op ::= NK_NE */ - 448, /* (486) compare_op ::= NK_EQ */ - 448, /* (487) compare_op ::= LIKE */ - 448, /* (488) compare_op ::= NOT LIKE */ - 448, /* (489) compare_op ::= MATCH */ - 448, /* (490) compare_op ::= NMATCH */ - 448, /* (491) compare_op ::= CONTAINS */ - 449, /* (492) in_op ::= IN */ - 449, /* (493) in_op ::= NOT IN */ - 450, /* (494) in_predicate_value ::= NK_LP literal_list NK_RP */ - 451, /* (495) boolean_value_expression ::= boolean_primary */ - 451, /* (496) boolean_value_expression ::= NOT boolean_primary */ - 451, /* (497) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 451, /* (498) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 452, /* (499) boolean_primary ::= predicate */ - 452, /* (500) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 445, /* (501) common_expression ::= expr_or_subquery */ - 445, /* (502) common_expression ::= boolean_value_expression */ - 453, /* (503) from_clause_opt ::= */ - 453, /* (504) from_clause_opt ::= FROM table_reference_list */ - 454, /* (505) table_reference_list ::= table_reference */ - 454, /* (506) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 455, /* (507) table_reference ::= table_primary */ - 455, /* (508) table_reference ::= joined_table */ - 456, /* (509) table_primary ::= table_name alias_opt */ - 456, /* (510) table_primary ::= db_name NK_DOT table_name alias_opt */ - 456, /* (511) table_primary ::= subquery alias_opt */ - 456, /* (512) table_primary ::= parenthesized_joined_table */ - 458, /* (513) alias_opt ::= */ - 458, /* (514) alias_opt ::= table_alias */ - 458, /* (515) alias_opt ::= AS table_alias */ - 460, /* (516) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 460, /* (517) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 457, /* (518) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 461, /* (519) join_type ::= */ - 461, /* (520) join_type ::= INNER */ - 462, /* (521) query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 463, /* (522) hint_list ::= */ - 463, /* (523) hint_list ::= NK_HINT */ - 464, /* (524) tag_mode_opt ::= */ - 464, /* (525) tag_mode_opt ::= TAGS */ - 465, /* (526) set_quantifier_opt ::= */ - 465, /* (527) set_quantifier_opt ::= DISTINCT */ - 465, /* (528) set_quantifier_opt ::= ALL */ - 466, /* (529) select_list ::= select_item */ - 466, /* (530) select_list ::= select_list NK_COMMA select_item */ - 474, /* (531) select_item ::= NK_STAR */ - 474, /* (532) select_item ::= common_expression */ - 474, /* (533) select_item ::= common_expression column_alias */ - 474, /* (534) select_item ::= common_expression AS column_alias */ - 474, /* (535) select_item ::= table_name NK_DOT NK_STAR */ - 413, /* (536) where_clause_opt ::= */ - 413, /* (537) where_clause_opt ::= WHERE search_condition */ - 467, /* (538) partition_by_clause_opt ::= */ - 467, /* (539) partition_by_clause_opt ::= PARTITION BY partition_list */ - 475, /* (540) partition_list ::= partition_item */ - 475, /* (541) partition_list ::= partition_list NK_COMMA partition_item */ - 476, /* (542) partition_item ::= expr_or_subquery */ - 476, /* (543) partition_item ::= expr_or_subquery column_alias */ - 476, /* (544) partition_item ::= expr_or_subquery AS column_alias */ - 471, /* (545) twindow_clause_opt ::= */ - 471, /* (546) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - 471, /* (547) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 471, /* (548) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - 471, /* (549) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - 471, /* (550) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 407, /* (551) sliding_opt ::= */ - 407, /* (552) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 470, /* (553) fill_opt ::= */ - 470, /* (554) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 470, /* (555) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 470, /* (556) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 477, /* (557) fill_mode ::= NONE */ - 477, /* (558) fill_mode ::= PREV */ - 477, /* (559) fill_mode ::= NULL */ - 477, /* (560) fill_mode ::= NULL_F */ - 477, /* (561) fill_mode ::= LINEAR */ - 477, /* (562) fill_mode ::= NEXT */ - 472, /* (563) group_by_clause_opt ::= */ - 472, /* (564) group_by_clause_opt ::= GROUP BY group_by_list */ - 478, /* (565) group_by_list ::= expr_or_subquery */ - 478, /* (566) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 473, /* (567) having_clause_opt ::= */ - 473, /* (568) having_clause_opt ::= HAVING search_condition */ - 468, /* (569) range_opt ::= */ - 468, /* (570) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 468, /* (571) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 469, /* (572) every_opt ::= */ - 469, /* (573) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 479, /* (574) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 480, /* (575) query_simple ::= query_specification */ - 480, /* (576) query_simple ::= union_query_expression */ - 484, /* (577) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 484, /* (578) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 485, /* (579) query_simple_or_subquery ::= query_simple */ - 485, /* (580) query_simple_or_subquery ::= subquery */ - 412, /* (581) query_or_subquery ::= query_expression */ - 412, /* (582) query_or_subquery ::= subquery */ - 481, /* (583) order_by_clause_opt ::= */ - 481, /* (584) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 482, /* (585) slimit_clause_opt ::= */ - 482, /* (586) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 482, /* (587) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 482, /* (588) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 483, /* (589) limit_clause_opt ::= */ - 483, /* (590) limit_clause_opt ::= LIMIT NK_INTEGER */ - 483, /* (591) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 483, /* (592) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 459, /* (593) subquery ::= NK_LP query_expression NK_RP */ - 459, /* (594) subquery ::= NK_LP subquery NK_RP */ - 354, /* (595) search_condition ::= common_expression */ - 486, /* (596) sort_specification_list ::= sort_specification */ - 486, /* (597) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 487, /* (598) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 488, /* (599) ordering_specification_opt ::= */ - 488, /* (600) ordering_specification_opt ::= ASC */ - 488, /* (601) ordering_specification_opt ::= DESC */ - 489, /* (602) null_ordering_opt ::= */ - 489, /* (603) null_ordering_opt ::= NULLS FIRST */ - 489, /* (604) null_ordering_opt ::= NULLS LAST */ + 381, /* (182) type_name ::= BOOL */ + 381, /* (183) type_name ::= TINYINT */ + 381, /* (184) type_name ::= SMALLINT */ + 381, /* (185) type_name ::= INT */ + 381, /* (186) type_name ::= INTEGER */ + 381, /* (187) type_name ::= BIGINT */ + 381, /* (188) type_name ::= FLOAT */ + 381, /* (189) type_name ::= DOUBLE */ + 381, /* (190) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 381, /* (191) type_name ::= TIMESTAMP */ + 381, /* (192) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 381, /* (193) type_name ::= TINYINT UNSIGNED */ + 381, /* (194) type_name ::= SMALLINT UNSIGNED */ + 381, /* (195) type_name ::= INT UNSIGNED */ + 381, /* (196) type_name ::= BIGINT UNSIGNED */ + 381, /* (197) type_name ::= JSON */ + 381, /* (198) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 381, /* (199) type_name ::= MEDIUMBLOB */ + 381, /* (200) type_name ::= BLOB */ + 381, /* (201) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 381, /* (202) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 381, /* (203) type_name ::= DECIMAL */ + 381, /* (204) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 381, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 373, /* (206) tags_def_opt ::= */ + 373, /* (207) tags_def_opt ::= tags_def */ + 376, /* (208) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 374, /* (209) table_options ::= */ + 374, /* (210) table_options ::= table_options COMMENT NK_STRING */ + 374, /* (211) table_options ::= table_options MAX_DELAY duration_list */ + 374, /* (212) table_options ::= table_options WATERMARK duration_list */ + 374, /* (213) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 374, /* (214) table_options ::= table_options TTL NK_INTEGER */ + 374, /* (215) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 374, /* (216) table_options ::= table_options DELETE_MARK duration_list */ + 379, /* (217) alter_table_options ::= alter_table_option */ + 379, /* (218) alter_table_options ::= alter_table_options alter_table_option */ + 391, /* (219) alter_table_option ::= COMMENT NK_STRING */ + 391, /* (220) alter_table_option ::= TTL NK_INTEGER */ + 389, /* (221) duration_list ::= duration_literal */ + 389, /* (222) duration_list ::= duration_list NK_COMMA duration_literal */ + 390, /* (223) rollup_func_list ::= rollup_func_name */ + 390, /* (224) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 393, /* (225) rollup_func_name ::= function_name */ + 393, /* (226) rollup_func_name ::= FIRST */ + 393, /* (227) rollup_func_name ::= LAST */ + 387, /* (228) col_name_list ::= col_name */ + 387, /* (229) col_name_list ::= col_name_list NK_COMMA col_name */ + 395, /* (230) col_name ::= column_name */ + 339, /* (231) cmd ::= SHOW DNODES */ + 339, /* (232) cmd ::= SHOW USERS */ + 339, /* (233) cmd ::= SHOW USER PRIVILEGES */ + 339, /* (234) cmd ::= SHOW DATABASES */ + 339, /* (235) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + 339, /* (236) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 339, /* (237) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 339, /* (238) cmd ::= SHOW MNODES */ + 339, /* (239) cmd ::= SHOW QNODES */ + 339, /* (240) cmd ::= SHOW FUNCTIONS */ + 339, /* (241) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 339, /* (242) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 339, /* (243) cmd ::= SHOW STREAMS */ + 339, /* (244) cmd ::= SHOW ACCOUNTS */ + 339, /* (245) cmd ::= SHOW APPS */ + 339, /* (246) cmd ::= SHOW CONNECTIONS */ + 339, /* (247) cmd ::= SHOW LICENCES */ + 339, /* (248) cmd ::= SHOW GRANTS */ + 339, /* (249) cmd ::= SHOW CREATE DATABASE db_name */ + 339, /* (250) cmd ::= SHOW CREATE TABLE full_table_name */ + 339, /* (251) cmd ::= SHOW CREATE STABLE full_table_name */ + 339, /* (252) cmd ::= SHOW QUERIES */ + 339, /* (253) cmd ::= SHOW SCORES */ + 339, /* (254) cmd ::= SHOW TOPICS */ + 339, /* (255) cmd ::= SHOW VARIABLES */ + 339, /* (256) cmd ::= SHOW CLUSTER VARIABLES */ + 339, /* (257) cmd ::= SHOW LOCAL VARIABLES */ + 339, /* (258) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 339, /* (259) cmd ::= SHOW BNODES */ + 339, /* (260) cmd ::= SHOW SNODES */ + 339, /* (261) cmd ::= SHOW CLUSTER */ + 339, /* (262) cmd ::= SHOW TRANSACTIONS */ + 339, /* (263) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 339, /* (264) cmd ::= SHOW CONSUMERS */ + 339, /* (265) cmd ::= SHOW SUBSCRIPTIONS */ + 339, /* (266) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 339, /* (267) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 339, /* (268) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 339, /* (269) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 339, /* (270) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 339, /* (271) cmd ::= SHOW VNODES */ + 339, /* (272) cmd ::= SHOW db_name_cond_opt ALIVE */ + 339, /* (273) cmd ::= SHOW CLUSTER ALIVE */ + 396, /* (274) db_name_cond_opt ::= */ + 396, /* (275) db_name_cond_opt ::= db_name NK_DOT */ + 397, /* (276) like_pattern_opt ::= */ + 397, /* (277) like_pattern_opt ::= LIKE NK_STRING */ + 398, /* (278) table_name_cond ::= table_name */ + 399, /* (279) from_db_opt ::= */ + 399, /* (280) from_db_opt ::= FROM db_name */ + 400, /* (281) tag_list_opt ::= */ + 400, /* (282) tag_list_opt ::= tag_item */ + 400, /* (283) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 401, /* (284) tag_item ::= TBNAME */ + 401, /* (285) tag_item ::= QTAGS */ + 401, /* (286) tag_item ::= column_name */ + 401, /* (287) tag_item ::= column_name column_alias */ + 401, /* (288) tag_item ::= column_name AS column_alias */ + 339, /* (289) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + 339, /* (290) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + 339, /* (291) cmd ::= DROP INDEX exists_opt full_index_name */ + 403, /* (292) full_index_name ::= index_name */ + 403, /* (293) full_index_name ::= db_name NK_DOT index_name */ + 404, /* (294) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 404, /* (295) 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 */ + 406, /* (296) func_list ::= func */ + 406, /* (297) func_list ::= func_list NK_COMMA func */ + 409, /* (298) func ::= sma_func_name NK_LP expression_list NK_RP */ + 410, /* (299) sma_func_name ::= function_name */ + 410, /* (300) sma_func_name ::= COUNT */ + 410, /* (301) sma_func_name ::= FIRST */ + 410, /* (302) sma_func_name ::= LAST */ + 410, /* (303) sma_func_name ::= LAST_ROW */ + 408, /* (304) sma_stream_opt ::= */ + 408, /* (305) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 408, /* (306) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 408, /* (307) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 411, /* (308) with_meta ::= AS */ + 411, /* (309) with_meta ::= WITH META AS */ + 411, /* (310) with_meta ::= ONLY META AS */ + 339, /* (311) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 339, /* (312) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 339, /* (313) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 339, /* (314) cmd ::= DROP TOPIC exists_opt topic_name */ + 339, /* (315) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 339, /* (316) cmd ::= DESC full_table_name */ + 339, /* (317) cmd ::= DESCRIBE full_table_name */ + 339, /* (318) cmd ::= RESET QUERY CACHE */ + 339, /* (319) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 339, /* (320) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 415, /* (321) analyze_opt ::= */ + 415, /* (322) analyze_opt ::= ANALYZE */ + 416, /* (323) explain_options ::= */ + 416, /* (324) explain_options ::= explain_options VERBOSE NK_BOOL */ + 416, /* (325) explain_options ::= explain_options RATIO NK_FLOAT */ + 339, /* (326) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 339, /* (327) cmd ::= DROP FUNCTION exists_opt function_name */ + 419, /* (328) agg_func_opt ::= */ + 419, /* (329) agg_func_opt ::= AGGREGATE */ + 420, /* (330) bufsize_opt ::= */ + 420, /* (331) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 421, /* (332) language_opt ::= */ + 421, /* (333) language_opt ::= LANGUAGE NK_STRING */ + 418, /* (334) or_replace_opt ::= */ + 418, /* (335) or_replace_opt ::= OR REPLACE */ + 339, /* (336) 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 */ + 339, /* (337) cmd ::= DROP STREAM exists_opt stream_name */ + 339, /* (338) cmd ::= PAUSE STREAM exists_opt stream_name */ + 339, /* (339) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 424, /* (340) col_list_opt ::= */ + 424, /* (341) col_list_opt ::= NK_LP col_name_list NK_RP */ + 425, /* (342) tag_def_or_ref_opt ::= */ + 425, /* (343) tag_def_or_ref_opt ::= tags_def */ + 425, /* (344) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 423, /* (345) stream_options ::= */ + 423, /* (346) stream_options ::= stream_options TRIGGER AT_ONCE */ + 423, /* (347) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 423, /* (348) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 423, /* (349) stream_options ::= stream_options WATERMARK duration_literal */ + 423, /* (350) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 423, /* (351) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 423, /* (352) stream_options ::= stream_options DELETE_MARK duration_literal */ + 423, /* (353) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 426, /* (354) subtable_opt ::= */ + 426, /* (355) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 427, /* (356) ignore_opt ::= */ + 427, /* (357) ignore_opt ::= IGNORE UNTREATED */ + 339, /* (358) cmd ::= KILL CONNECTION NK_INTEGER */ + 339, /* (359) cmd ::= KILL QUERY NK_STRING */ + 339, /* (360) cmd ::= KILL TRANSACTION NK_INTEGER */ + 339, /* (361) cmd ::= BALANCE VGROUP */ + 339, /* (362) cmd ::= BALANCE VGROUP LEADER */ + 339, /* (363) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 339, /* (364) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 339, /* (365) cmd ::= SPLIT VGROUP NK_INTEGER */ + 429, /* (366) dnode_list ::= DNODE NK_INTEGER */ + 429, /* (367) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 339, /* (368) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 339, /* (369) cmd ::= query_or_subquery */ + 339, /* (370) cmd ::= insert_query */ + 417, /* (371) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 417, /* (372) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 342, /* (373) literal ::= NK_INTEGER */ + 342, /* (374) literal ::= NK_FLOAT */ + 342, /* (375) literal ::= NK_STRING */ + 342, /* (376) literal ::= NK_BOOL */ + 342, /* (377) literal ::= TIMESTAMP NK_STRING */ + 342, /* (378) literal ::= duration_literal */ + 342, /* (379) literal ::= NULL */ + 342, /* (380) literal ::= NK_QUESTION */ + 392, /* (381) duration_literal ::= NK_VARIABLE */ + 368, /* (382) signed ::= NK_INTEGER */ + 368, /* (383) signed ::= NK_PLUS NK_INTEGER */ + 368, /* (384) signed ::= NK_MINUS NK_INTEGER */ + 368, /* (385) signed ::= NK_FLOAT */ + 368, /* (386) signed ::= NK_PLUS NK_FLOAT */ + 368, /* (387) signed ::= NK_MINUS NK_FLOAT */ + 382, /* (388) signed_literal ::= signed */ + 382, /* (389) signed_literal ::= NK_STRING */ + 382, /* (390) signed_literal ::= NK_BOOL */ + 382, /* (391) signed_literal ::= TIMESTAMP NK_STRING */ + 382, /* (392) signed_literal ::= duration_literal */ + 382, /* (393) signed_literal ::= NULL */ + 382, /* (394) signed_literal ::= literal_func */ + 382, /* (395) signed_literal ::= NK_QUESTION */ + 431, /* (396) literal_list ::= signed_literal */ + 431, /* (397) literal_list ::= literal_list NK_COMMA signed_literal */ + 351, /* (398) db_name ::= NK_ID */ + 352, /* (399) table_name ::= NK_ID */ + 380, /* (400) column_name ::= NK_ID */ + 394, /* (401) function_name ::= NK_ID */ + 432, /* (402) table_alias ::= NK_ID */ + 402, /* (403) column_alias ::= NK_ID */ + 344, /* (404) user_name ::= NK_ID */ + 353, /* (405) topic_name ::= NK_ID */ + 422, /* (406) stream_name ::= NK_ID */ + 414, /* (407) cgroup_name ::= NK_ID */ + 405, /* (408) index_name ::= NK_ID */ + 433, /* (409) expr_or_subquery ::= expression */ + 428, /* (410) expression ::= literal */ + 428, /* (411) expression ::= pseudo_column */ + 428, /* (412) expression ::= column_reference */ + 428, /* (413) expression ::= function_expression */ + 428, /* (414) expression ::= case_when_expression */ + 428, /* (415) expression ::= NK_LP expression NK_RP */ + 428, /* (416) expression ::= NK_PLUS expr_or_subquery */ + 428, /* (417) expression ::= NK_MINUS expr_or_subquery */ + 428, /* (418) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 428, /* (419) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 428, /* (420) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 428, /* (421) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 428, /* (422) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 428, /* (423) expression ::= column_reference NK_ARROW NK_STRING */ + 428, /* (424) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 428, /* (425) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 385, /* (426) expression_list ::= expr_or_subquery */ + 385, /* (427) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 435, /* (428) column_reference ::= column_name */ + 435, /* (429) column_reference ::= table_name NK_DOT column_name */ + 434, /* (430) pseudo_column ::= ROWTS */ + 434, /* (431) pseudo_column ::= TBNAME */ + 434, /* (432) pseudo_column ::= table_name NK_DOT TBNAME */ + 434, /* (433) pseudo_column ::= QSTART */ + 434, /* (434) pseudo_column ::= QEND */ + 434, /* (435) pseudo_column ::= QDURATION */ + 434, /* (436) pseudo_column ::= WSTART */ + 434, /* (437) pseudo_column ::= WEND */ + 434, /* (438) pseudo_column ::= WDURATION */ + 434, /* (439) pseudo_column ::= IROWTS */ + 434, /* (440) pseudo_column ::= ISFILLED */ + 434, /* (441) pseudo_column ::= QTAGS */ + 436, /* (442) function_expression ::= function_name NK_LP expression_list NK_RP */ + 436, /* (443) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 436, /* (444) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 436, /* (445) function_expression ::= literal_func */ + 430, /* (446) literal_func ::= noarg_func NK_LP NK_RP */ + 430, /* (447) literal_func ::= NOW */ + 440, /* (448) noarg_func ::= NOW */ + 440, /* (449) noarg_func ::= TODAY */ + 440, /* (450) noarg_func ::= TIMEZONE */ + 440, /* (451) noarg_func ::= DATABASE */ + 440, /* (452) noarg_func ::= CLIENT_VERSION */ + 440, /* (453) noarg_func ::= SERVER_VERSION */ + 440, /* (454) noarg_func ::= SERVER_STATUS */ + 440, /* (455) noarg_func ::= CURRENT_USER */ + 440, /* (456) noarg_func ::= USER */ + 438, /* (457) star_func ::= COUNT */ + 438, /* (458) star_func ::= FIRST */ + 438, /* (459) star_func ::= LAST */ + 438, /* (460) star_func ::= LAST_ROW */ + 439, /* (461) star_func_para_list ::= NK_STAR */ + 439, /* (462) star_func_para_list ::= other_para_list */ + 441, /* (463) other_para_list ::= star_func_para */ + 441, /* (464) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 442, /* (465) star_func_para ::= expr_or_subquery */ + 442, /* (466) star_func_para ::= table_name NK_DOT NK_STAR */ + 437, /* (467) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 437, /* (468) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 443, /* (469) when_then_list ::= when_then_expr */ + 443, /* (470) when_then_list ::= when_then_list when_then_expr */ + 446, /* (471) when_then_expr ::= WHEN common_expression THEN common_expression */ + 444, /* (472) case_when_else_opt ::= */ + 444, /* (473) case_when_else_opt ::= ELSE common_expression */ + 447, /* (474) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 447, /* (475) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 447, /* (476) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 447, /* (477) predicate ::= expr_or_subquery IS NULL */ + 447, /* (478) predicate ::= expr_or_subquery IS NOT NULL */ + 447, /* (479) predicate ::= expr_or_subquery in_op in_predicate_value */ + 448, /* (480) compare_op ::= NK_LT */ + 448, /* (481) compare_op ::= NK_GT */ + 448, /* (482) compare_op ::= NK_LE */ + 448, /* (483) compare_op ::= NK_GE */ + 448, /* (484) compare_op ::= NK_NE */ + 448, /* (485) compare_op ::= NK_EQ */ + 448, /* (486) compare_op ::= LIKE */ + 448, /* (487) compare_op ::= NOT LIKE */ + 448, /* (488) compare_op ::= MATCH */ + 448, /* (489) compare_op ::= NMATCH */ + 448, /* (490) compare_op ::= CONTAINS */ + 449, /* (491) in_op ::= IN */ + 449, /* (492) in_op ::= NOT IN */ + 450, /* (493) in_predicate_value ::= NK_LP literal_list NK_RP */ + 451, /* (494) boolean_value_expression ::= boolean_primary */ + 451, /* (495) boolean_value_expression ::= NOT boolean_primary */ + 451, /* (496) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 451, /* (497) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 452, /* (498) boolean_primary ::= predicate */ + 452, /* (499) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 445, /* (500) common_expression ::= expr_or_subquery */ + 445, /* (501) common_expression ::= boolean_value_expression */ + 453, /* (502) from_clause_opt ::= */ + 453, /* (503) from_clause_opt ::= FROM table_reference_list */ + 454, /* (504) table_reference_list ::= table_reference */ + 454, /* (505) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 455, /* (506) table_reference ::= table_primary */ + 455, /* (507) table_reference ::= joined_table */ + 456, /* (508) table_primary ::= table_name alias_opt */ + 456, /* (509) table_primary ::= db_name NK_DOT table_name alias_opt */ + 456, /* (510) table_primary ::= subquery alias_opt */ + 456, /* (511) table_primary ::= parenthesized_joined_table */ + 458, /* (512) alias_opt ::= */ + 458, /* (513) alias_opt ::= table_alias */ + 458, /* (514) alias_opt ::= AS table_alias */ + 460, /* (515) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 460, /* (516) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 457, /* (517) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 461, /* (518) join_type ::= */ + 461, /* (519) join_type ::= INNER */ + 462, /* (520) query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 463, /* (521) hint_list ::= */ + 463, /* (522) hint_list ::= NK_HINT */ + 464, /* (523) tag_mode_opt ::= */ + 464, /* (524) tag_mode_opt ::= TAGS */ + 465, /* (525) set_quantifier_opt ::= */ + 465, /* (526) set_quantifier_opt ::= DISTINCT */ + 465, /* (527) set_quantifier_opt ::= ALL */ + 466, /* (528) select_list ::= select_item */ + 466, /* (529) select_list ::= select_list NK_COMMA select_item */ + 474, /* (530) select_item ::= NK_STAR */ + 474, /* (531) select_item ::= common_expression */ + 474, /* (532) select_item ::= common_expression column_alias */ + 474, /* (533) select_item ::= common_expression AS column_alias */ + 474, /* (534) select_item ::= table_name NK_DOT NK_STAR */ + 413, /* (535) where_clause_opt ::= */ + 413, /* (536) where_clause_opt ::= WHERE search_condition */ + 467, /* (537) partition_by_clause_opt ::= */ + 467, /* (538) partition_by_clause_opt ::= PARTITION BY partition_list */ + 475, /* (539) partition_list ::= partition_item */ + 475, /* (540) partition_list ::= partition_list NK_COMMA partition_item */ + 476, /* (541) partition_item ::= expr_or_subquery */ + 476, /* (542) partition_item ::= expr_or_subquery column_alias */ + 476, /* (543) partition_item ::= expr_or_subquery AS column_alias */ + 471, /* (544) twindow_clause_opt ::= */ + 471, /* (545) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + 471, /* (546) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 471, /* (547) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + 471, /* (548) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + 471, /* (549) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 407, /* (550) sliding_opt ::= */ + 407, /* (551) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 470, /* (552) fill_opt ::= */ + 470, /* (553) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 470, /* (554) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 470, /* (555) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 477, /* (556) fill_mode ::= NONE */ + 477, /* (557) fill_mode ::= PREV */ + 477, /* (558) fill_mode ::= NULL */ + 477, /* (559) fill_mode ::= NULL_F */ + 477, /* (560) fill_mode ::= LINEAR */ + 477, /* (561) fill_mode ::= NEXT */ + 472, /* (562) group_by_clause_opt ::= */ + 472, /* (563) group_by_clause_opt ::= GROUP BY group_by_list */ + 478, /* (564) group_by_list ::= expr_or_subquery */ + 478, /* (565) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 473, /* (566) having_clause_opt ::= */ + 473, /* (567) having_clause_opt ::= HAVING search_condition */ + 468, /* (568) range_opt ::= */ + 468, /* (569) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 468, /* (570) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 469, /* (571) every_opt ::= */ + 469, /* (572) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 479, /* (573) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 480, /* (574) query_simple ::= query_specification */ + 480, /* (575) query_simple ::= union_query_expression */ + 484, /* (576) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 484, /* (577) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 485, /* (578) query_simple_or_subquery ::= query_simple */ + 485, /* (579) query_simple_or_subquery ::= subquery */ + 412, /* (580) query_or_subquery ::= query_expression */ + 412, /* (581) query_or_subquery ::= subquery */ + 481, /* (582) order_by_clause_opt ::= */ + 481, /* (583) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 482, /* (584) slimit_clause_opt ::= */ + 482, /* (585) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 482, /* (586) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 482, /* (587) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 483, /* (588) limit_clause_opt ::= */ + 483, /* (589) limit_clause_opt ::= LIMIT NK_INTEGER */ + 483, /* (590) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 483, /* (591) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 459, /* (592) subquery ::= NK_LP query_expression NK_RP */ + 459, /* (593) subquery ::= NK_LP subquery NK_RP */ + 354, /* (594) search_condition ::= common_expression */ + 486, /* (595) sort_specification_list ::= sort_specification */ + 486, /* (596) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 487, /* (597) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 488, /* (598) ordering_specification_opt ::= */ + 488, /* (599) ordering_specification_opt ::= ASC */ + 488, /* (600) ordering_specification_opt ::= DESC */ + 489, /* (601) null_ordering_opt ::= */ + 489, /* (602) null_ordering_opt ::= NULLS FIRST */ + 489, /* (603) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -3980,429 +3978,428 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (179) column_def_list ::= column_def */ -3, /* (180) column_def_list ::= column_def_list NK_COMMA column_def */ -2, /* (181) column_def ::= column_name type_name */ - -4, /* (182) column_def ::= column_name type_name COMMENT NK_STRING */ - -1, /* (183) type_name ::= BOOL */ - -1, /* (184) type_name ::= TINYINT */ - -1, /* (185) type_name ::= SMALLINT */ - -1, /* (186) type_name ::= INT */ - -1, /* (187) type_name ::= INTEGER */ - -1, /* (188) type_name ::= BIGINT */ - -1, /* (189) type_name ::= FLOAT */ - -1, /* (190) type_name ::= DOUBLE */ - -4, /* (191) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (192) type_name ::= TIMESTAMP */ - -4, /* (193) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (194) type_name ::= TINYINT UNSIGNED */ - -2, /* (195) type_name ::= SMALLINT UNSIGNED */ - -2, /* (196) type_name ::= INT UNSIGNED */ - -2, /* (197) type_name ::= BIGINT UNSIGNED */ - -1, /* (198) type_name ::= JSON */ - -4, /* (199) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (200) type_name ::= MEDIUMBLOB */ - -1, /* (201) type_name ::= BLOB */ - -4, /* (202) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (203) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (204) type_name ::= DECIMAL */ - -4, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (206) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (207) tags_def_opt ::= */ - -1, /* (208) tags_def_opt ::= tags_def */ - -4, /* (209) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 0, /* (210) table_options ::= */ - -3, /* (211) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (212) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (213) table_options ::= table_options WATERMARK duration_list */ - -5, /* (214) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (215) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (216) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (217) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (218) alter_table_options ::= alter_table_option */ - -2, /* (219) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (220) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (221) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (222) duration_list ::= duration_literal */ - -3, /* (223) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (224) rollup_func_list ::= rollup_func_name */ - -3, /* (225) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (226) rollup_func_name ::= function_name */ - -1, /* (227) rollup_func_name ::= FIRST */ - -1, /* (228) rollup_func_name ::= LAST */ - -1, /* (229) col_name_list ::= col_name */ - -3, /* (230) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (231) col_name ::= column_name */ - -2, /* (232) cmd ::= SHOW DNODES */ - -2, /* (233) cmd ::= SHOW USERS */ - -3, /* (234) cmd ::= SHOW USER PRIVILEGES */ - -2, /* (235) cmd ::= SHOW DATABASES */ - -4, /* (236) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (237) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (238) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (239) cmd ::= SHOW MNODES */ - -2, /* (240) cmd ::= SHOW QNODES */ - -2, /* (241) cmd ::= SHOW FUNCTIONS */ - -5, /* (242) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (243) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (244) cmd ::= SHOW STREAMS */ - -2, /* (245) cmd ::= SHOW ACCOUNTS */ - -2, /* (246) cmd ::= SHOW APPS */ - -2, /* (247) cmd ::= SHOW CONNECTIONS */ - -2, /* (248) cmd ::= SHOW LICENCES */ - -2, /* (249) cmd ::= SHOW GRANTS */ - -4, /* (250) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (251) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (252) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (253) cmd ::= SHOW QUERIES */ - -2, /* (254) cmd ::= SHOW SCORES */ - -2, /* (255) cmd ::= SHOW TOPICS */ - -2, /* (256) cmd ::= SHOW VARIABLES */ - -3, /* (257) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (258) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (259) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (260) cmd ::= SHOW BNODES */ - -2, /* (261) cmd ::= SHOW SNODES */ - -2, /* (262) cmd ::= SHOW CLUSTER */ - -2, /* (263) cmd ::= SHOW TRANSACTIONS */ - -4, /* (264) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (265) cmd ::= SHOW CONSUMERS */ - -2, /* (266) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (267) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (268) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (269) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (270) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (271) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (272) cmd ::= SHOW VNODES */ - -3, /* (273) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (274) cmd ::= SHOW CLUSTER ALIVE */ - 0, /* (275) db_name_cond_opt ::= */ - -2, /* (276) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (277) like_pattern_opt ::= */ - -2, /* (278) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (279) table_name_cond ::= table_name */ - 0, /* (280) from_db_opt ::= */ - -2, /* (281) from_db_opt ::= FROM db_name */ - 0, /* (282) tag_list_opt ::= */ - -1, /* (283) tag_list_opt ::= tag_item */ - -3, /* (284) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (285) tag_item ::= TBNAME */ - -1, /* (286) tag_item ::= QTAGS */ - -1, /* (287) tag_item ::= column_name */ - -2, /* (288) tag_item ::= column_name column_alias */ - -3, /* (289) tag_item ::= column_name AS column_alias */ - -8, /* (290) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - -9, /* (291) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (292) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (293) full_index_name ::= index_name */ - -3, /* (294) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (295) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (296) 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 */ - -1, /* (297) func_list ::= func */ - -3, /* (298) func_list ::= func_list NK_COMMA func */ - -4, /* (299) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (300) sma_func_name ::= function_name */ - -1, /* (301) sma_func_name ::= COUNT */ - -1, /* (302) sma_func_name ::= FIRST */ - -1, /* (303) sma_func_name ::= LAST */ - -1, /* (304) sma_func_name ::= LAST_ROW */ - 0, /* (305) sma_stream_opt ::= */ - -3, /* (306) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (307) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (308) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (309) with_meta ::= AS */ - -3, /* (310) with_meta ::= WITH META AS */ - -3, /* (311) with_meta ::= ONLY META AS */ - -6, /* (312) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (313) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (314) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (315) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (316) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (317) cmd ::= DESC full_table_name */ - -2, /* (318) cmd ::= DESCRIBE full_table_name */ - -3, /* (319) cmd ::= RESET QUERY CACHE */ - -4, /* (320) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (321) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (322) analyze_opt ::= */ - -1, /* (323) analyze_opt ::= ANALYZE */ - 0, /* (324) explain_options ::= */ - -3, /* (325) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (326) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (327) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (328) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (329) agg_func_opt ::= */ - -1, /* (330) agg_func_opt ::= AGGREGATE */ - 0, /* (331) bufsize_opt ::= */ - -2, /* (332) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (333) language_opt ::= */ - -2, /* (334) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (335) or_replace_opt ::= */ - -2, /* (336) or_replace_opt ::= OR REPLACE */ - -12, /* (337) 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 */ - -4, /* (338) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (339) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (340) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (341) col_list_opt ::= */ - -3, /* (342) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (343) tag_def_or_ref_opt ::= */ - -1, /* (344) tag_def_or_ref_opt ::= tags_def */ - -4, /* (345) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (346) stream_options ::= */ - -3, /* (347) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (348) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (349) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (350) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (351) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (352) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (353) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (354) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (355) subtable_opt ::= */ - -4, /* (356) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (357) ignore_opt ::= */ - -2, /* (358) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (359) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (360) cmd ::= KILL QUERY NK_STRING */ - -3, /* (361) cmd ::= KILL TRANSACTION NK_INTEGER */ - -2, /* (362) cmd ::= BALANCE VGROUP */ - -3, /* (363) cmd ::= BALANCE VGROUP LEADER */ - -4, /* (364) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (365) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (366) cmd ::= SPLIT VGROUP NK_INTEGER */ - -2, /* (367) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (368) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (369) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (370) cmd ::= query_or_subquery */ - -1, /* (371) cmd ::= insert_query */ - -7, /* (372) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (373) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (374) literal ::= NK_INTEGER */ - -1, /* (375) literal ::= NK_FLOAT */ - -1, /* (376) literal ::= NK_STRING */ - -1, /* (377) literal ::= NK_BOOL */ - -2, /* (378) literal ::= TIMESTAMP NK_STRING */ - -1, /* (379) literal ::= duration_literal */ - -1, /* (380) literal ::= NULL */ - -1, /* (381) literal ::= NK_QUESTION */ - -1, /* (382) duration_literal ::= NK_VARIABLE */ - -1, /* (383) signed ::= NK_INTEGER */ - -2, /* (384) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (385) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (386) signed ::= NK_FLOAT */ - -2, /* (387) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (388) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (389) signed_literal ::= signed */ - -1, /* (390) signed_literal ::= NK_STRING */ - -1, /* (391) signed_literal ::= NK_BOOL */ - -2, /* (392) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (393) signed_literal ::= duration_literal */ - -1, /* (394) signed_literal ::= NULL */ - -1, /* (395) signed_literal ::= literal_func */ - -1, /* (396) signed_literal ::= NK_QUESTION */ - -1, /* (397) literal_list ::= signed_literal */ - -3, /* (398) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (399) db_name ::= NK_ID */ - -1, /* (400) table_name ::= NK_ID */ - -1, /* (401) column_name ::= NK_ID */ - -1, /* (402) function_name ::= NK_ID */ - -1, /* (403) table_alias ::= NK_ID */ - -1, /* (404) column_alias ::= NK_ID */ - -1, /* (405) user_name ::= NK_ID */ - -1, /* (406) topic_name ::= NK_ID */ - -1, /* (407) stream_name ::= NK_ID */ - -1, /* (408) cgroup_name ::= NK_ID */ - -1, /* (409) index_name ::= NK_ID */ - -1, /* (410) expr_or_subquery ::= expression */ - -1, /* (411) expression ::= literal */ - -1, /* (412) expression ::= pseudo_column */ - -1, /* (413) expression ::= column_reference */ - -1, /* (414) expression ::= function_expression */ - -1, /* (415) expression ::= case_when_expression */ - -3, /* (416) expression ::= NK_LP expression NK_RP */ - -2, /* (417) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (418) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (419) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (420) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (421) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (422) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (423) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (424) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (425) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (426) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (427) expression_list ::= expr_or_subquery */ - -3, /* (428) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (429) column_reference ::= column_name */ - -3, /* (430) column_reference ::= table_name NK_DOT column_name */ - -1, /* (431) pseudo_column ::= ROWTS */ - -1, /* (432) pseudo_column ::= TBNAME */ - -3, /* (433) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (434) pseudo_column ::= QSTART */ - -1, /* (435) pseudo_column ::= QEND */ - -1, /* (436) pseudo_column ::= QDURATION */ - -1, /* (437) pseudo_column ::= WSTART */ - -1, /* (438) pseudo_column ::= WEND */ - -1, /* (439) pseudo_column ::= WDURATION */ - -1, /* (440) pseudo_column ::= IROWTS */ - -1, /* (441) pseudo_column ::= ISFILLED */ - -1, /* (442) pseudo_column ::= QTAGS */ - -4, /* (443) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (444) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (445) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (446) function_expression ::= literal_func */ - -3, /* (447) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (448) literal_func ::= NOW */ - -1, /* (449) noarg_func ::= NOW */ - -1, /* (450) noarg_func ::= TODAY */ - -1, /* (451) noarg_func ::= TIMEZONE */ - -1, /* (452) noarg_func ::= DATABASE */ - -1, /* (453) noarg_func ::= CLIENT_VERSION */ - -1, /* (454) noarg_func ::= SERVER_VERSION */ - -1, /* (455) noarg_func ::= SERVER_STATUS */ - -1, /* (456) noarg_func ::= CURRENT_USER */ - -1, /* (457) noarg_func ::= USER */ - -1, /* (458) star_func ::= COUNT */ - -1, /* (459) star_func ::= FIRST */ - -1, /* (460) star_func ::= LAST */ - -1, /* (461) star_func ::= LAST_ROW */ - -1, /* (462) star_func_para_list ::= NK_STAR */ - -1, /* (463) star_func_para_list ::= other_para_list */ - -1, /* (464) other_para_list ::= star_func_para */ - -3, /* (465) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (466) star_func_para ::= expr_or_subquery */ - -3, /* (467) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (468) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (469) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (470) when_then_list ::= when_then_expr */ - -2, /* (471) when_then_list ::= when_then_list when_then_expr */ - -4, /* (472) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (473) case_when_else_opt ::= */ - -2, /* (474) case_when_else_opt ::= ELSE common_expression */ - -3, /* (475) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (476) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (477) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (478) predicate ::= expr_or_subquery IS NULL */ - -4, /* (479) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (480) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (481) compare_op ::= NK_LT */ - -1, /* (482) compare_op ::= NK_GT */ - -1, /* (483) compare_op ::= NK_LE */ - -1, /* (484) compare_op ::= NK_GE */ - -1, /* (485) compare_op ::= NK_NE */ - -1, /* (486) compare_op ::= NK_EQ */ - -1, /* (487) compare_op ::= LIKE */ - -2, /* (488) compare_op ::= NOT LIKE */ - -1, /* (489) compare_op ::= MATCH */ - -1, /* (490) compare_op ::= NMATCH */ - -1, /* (491) compare_op ::= CONTAINS */ - -1, /* (492) in_op ::= IN */ - -2, /* (493) in_op ::= NOT IN */ - -3, /* (494) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (495) boolean_value_expression ::= boolean_primary */ - -2, /* (496) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (497) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (498) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (499) boolean_primary ::= predicate */ - -3, /* (500) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (501) common_expression ::= expr_or_subquery */ - -1, /* (502) common_expression ::= boolean_value_expression */ - 0, /* (503) from_clause_opt ::= */ - -2, /* (504) from_clause_opt ::= FROM table_reference_list */ - -1, /* (505) table_reference_list ::= table_reference */ - -3, /* (506) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (507) table_reference ::= table_primary */ - -1, /* (508) table_reference ::= joined_table */ - -2, /* (509) table_primary ::= table_name alias_opt */ - -4, /* (510) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (511) table_primary ::= subquery alias_opt */ - -1, /* (512) table_primary ::= parenthesized_joined_table */ - 0, /* (513) alias_opt ::= */ - -1, /* (514) alias_opt ::= table_alias */ - -2, /* (515) alias_opt ::= AS table_alias */ - -3, /* (516) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (517) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (518) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (519) join_type ::= */ - -1, /* (520) join_type ::= INNER */ - -14, /* (521) query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 0, /* (522) hint_list ::= */ - -1, /* (523) hint_list ::= NK_HINT */ - 0, /* (524) tag_mode_opt ::= */ - -1, /* (525) tag_mode_opt ::= TAGS */ - 0, /* (526) set_quantifier_opt ::= */ - -1, /* (527) set_quantifier_opt ::= DISTINCT */ - -1, /* (528) set_quantifier_opt ::= ALL */ - -1, /* (529) select_list ::= select_item */ - -3, /* (530) select_list ::= select_list NK_COMMA select_item */ - -1, /* (531) select_item ::= NK_STAR */ - -1, /* (532) select_item ::= common_expression */ - -2, /* (533) select_item ::= common_expression column_alias */ - -3, /* (534) select_item ::= common_expression AS column_alias */ - -3, /* (535) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (536) where_clause_opt ::= */ - -2, /* (537) where_clause_opt ::= WHERE search_condition */ - 0, /* (538) partition_by_clause_opt ::= */ - -3, /* (539) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (540) partition_list ::= partition_item */ - -3, /* (541) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (542) partition_item ::= expr_or_subquery */ - -2, /* (543) partition_item ::= expr_or_subquery column_alias */ - -3, /* (544) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (545) twindow_clause_opt ::= */ - -6, /* (546) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - -4, /* (547) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (548) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (549) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (550) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (551) sliding_opt ::= */ - -4, /* (552) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 0, /* (553) fill_opt ::= */ - -4, /* (554) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (555) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (556) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (557) fill_mode ::= NONE */ - -1, /* (558) fill_mode ::= PREV */ - -1, /* (559) fill_mode ::= NULL */ - -1, /* (560) fill_mode ::= NULL_F */ - -1, /* (561) fill_mode ::= LINEAR */ - -1, /* (562) fill_mode ::= NEXT */ - 0, /* (563) group_by_clause_opt ::= */ - -3, /* (564) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (565) group_by_list ::= expr_or_subquery */ - -3, /* (566) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (567) having_clause_opt ::= */ - -2, /* (568) having_clause_opt ::= HAVING search_condition */ - 0, /* (569) range_opt ::= */ - -6, /* (570) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (571) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (572) every_opt ::= */ - -4, /* (573) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (574) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (575) query_simple ::= query_specification */ - -1, /* (576) query_simple ::= union_query_expression */ - -4, /* (577) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (578) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (579) query_simple_or_subquery ::= query_simple */ - -1, /* (580) query_simple_or_subquery ::= subquery */ - -1, /* (581) query_or_subquery ::= query_expression */ - -1, /* (582) query_or_subquery ::= subquery */ - 0, /* (583) order_by_clause_opt ::= */ - -3, /* (584) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (585) slimit_clause_opt ::= */ - -2, /* (586) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (587) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (588) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (589) limit_clause_opt ::= */ - -2, /* (590) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (591) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (592) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (593) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (594) subquery ::= NK_LP subquery NK_RP */ - -1, /* (595) search_condition ::= common_expression */ - -1, /* (596) sort_specification_list ::= sort_specification */ - -3, /* (597) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (598) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (599) ordering_specification_opt ::= */ - -1, /* (600) ordering_specification_opt ::= ASC */ - -1, /* (601) ordering_specification_opt ::= DESC */ - 0, /* (602) null_ordering_opt ::= */ - -2, /* (603) null_ordering_opt ::= NULLS FIRST */ - -2, /* (604) null_ordering_opt ::= NULLS LAST */ + -1, /* (182) type_name ::= BOOL */ + -1, /* (183) type_name ::= TINYINT */ + -1, /* (184) type_name ::= SMALLINT */ + -1, /* (185) type_name ::= INT */ + -1, /* (186) type_name ::= INTEGER */ + -1, /* (187) type_name ::= BIGINT */ + -1, /* (188) type_name ::= FLOAT */ + -1, /* (189) type_name ::= DOUBLE */ + -4, /* (190) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (191) type_name ::= TIMESTAMP */ + -4, /* (192) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (193) type_name ::= TINYINT UNSIGNED */ + -2, /* (194) type_name ::= SMALLINT UNSIGNED */ + -2, /* (195) type_name ::= INT UNSIGNED */ + -2, /* (196) type_name ::= BIGINT UNSIGNED */ + -1, /* (197) type_name ::= JSON */ + -4, /* (198) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (199) type_name ::= MEDIUMBLOB */ + -1, /* (200) type_name ::= BLOB */ + -4, /* (201) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (202) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (203) type_name ::= DECIMAL */ + -4, /* (204) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (206) tags_def_opt ::= */ + -1, /* (207) tags_def_opt ::= tags_def */ + -4, /* (208) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 0, /* (209) table_options ::= */ + -3, /* (210) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (211) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (212) table_options ::= table_options WATERMARK duration_list */ + -5, /* (213) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (214) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (215) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (216) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (217) alter_table_options ::= alter_table_option */ + -2, /* (218) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (219) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (220) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (221) duration_list ::= duration_literal */ + -3, /* (222) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (223) rollup_func_list ::= rollup_func_name */ + -3, /* (224) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (225) rollup_func_name ::= function_name */ + -1, /* (226) rollup_func_name ::= FIRST */ + -1, /* (227) rollup_func_name ::= LAST */ + -1, /* (228) col_name_list ::= col_name */ + -3, /* (229) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (230) col_name ::= column_name */ + -2, /* (231) cmd ::= SHOW DNODES */ + -2, /* (232) cmd ::= SHOW USERS */ + -3, /* (233) cmd ::= SHOW USER PRIVILEGES */ + -2, /* (234) cmd ::= SHOW DATABASES */ + -4, /* (235) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (236) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (237) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (238) cmd ::= SHOW MNODES */ + -2, /* (239) cmd ::= SHOW QNODES */ + -2, /* (240) cmd ::= SHOW FUNCTIONS */ + -5, /* (241) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (242) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (243) cmd ::= SHOW STREAMS */ + -2, /* (244) cmd ::= SHOW ACCOUNTS */ + -2, /* (245) cmd ::= SHOW APPS */ + -2, /* (246) cmd ::= SHOW CONNECTIONS */ + -2, /* (247) cmd ::= SHOW LICENCES */ + -2, /* (248) cmd ::= SHOW GRANTS */ + -4, /* (249) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (250) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (251) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (252) cmd ::= SHOW QUERIES */ + -2, /* (253) cmd ::= SHOW SCORES */ + -2, /* (254) cmd ::= SHOW TOPICS */ + -2, /* (255) cmd ::= SHOW VARIABLES */ + -3, /* (256) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (257) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (258) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (259) cmd ::= SHOW BNODES */ + -2, /* (260) cmd ::= SHOW SNODES */ + -2, /* (261) cmd ::= SHOW CLUSTER */ + -2, /* (262) cmd ::= SHOW TRANSACTIONS */ + -4, /* (263) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (264) cmd ::= SHOW CONSUMERS */ + -2, /* (265) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (266) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (267) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (268) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (269) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (270) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (271) cmd ::= SHOW VNODES */ + -3, /* (272) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (273) cmd ::= SHOW CLUSTER ALIVE */ + 0, /* (274) db_name_cond_opt ::= */ + -2, /* (275) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (276) like_pattern_opt ::= */ + -2, /* (277) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (278) table_name_cond ::= table_name */ + 0, /* (279) from_db_opt ::= */ + -2, /* (280) from_db_opt ::= FROM db_name */ + 0, /* (281) tag_list_opt ::= */ + -1, /* (282) tag_list_opt ::= tag_item */ + -3, /* (283) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (284) tag_item ::= TBNAME */ + -1, /* (285) tag_item ::= QTAGS */ + -1, /* (286) tag_item ::= column_name */ + -2, /* (287) tag_item ::= column_name column_alias */ + -3, /* (288) tag_item ::= column_name AS column_alias */ + -8, /* (289) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + -9, /* (290) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (291) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (292) full_index_name ::= index_name */ + -3, /* (293) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (294) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (295) 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 */ + -1, /* (296) func_list ::= func */ + -3, /* (297) func_list ::= func_list NK_COMMA func */ + -4, /* (298) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (299) sma_func_name ::= function_name */ + -1, /* (300) sma_func_name ::= COUNT */ + -1, /* (301) sma_func_name ::= FIRST */ + -1, /* (302) sma_func_name ::= LAST */ + -1, /* (303) sma_func_name ::= LAST_ROW */ + 0, /* (304) sma_stream_opt ::= */ + -3, /* (305) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (306) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (307) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (308) with_meta ::= AS */ + -3, /* (309) with_meta ::= WITH META AS */ + -3, /* (310) with_meta ::= ONLY META AS */ + -6, /* (311) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (312) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (313) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (314) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (315) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (316) cmd ::= DESC full_table_name */ + -2, /* (317) cmd ::= DESCRIBE full_table_name */ + -3, /* (318) cmd ::= RESET QUERY CACHE */ + -4, /* (319) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (320) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (321) analyze_opt ::= */ + -1, /* (322) analyze_opt ::= ANALYZE */ + 0, /* (323) explain_options ::= */ + -3, /* (324) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (325) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (326) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + -4, /* (327) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (328) agg_func_opt ::= */ + -1, /* (329) agg_func_opt ::= AGGREGATE */ + 0, /* (330) bufsize_opt ::= */ + -2, /* (331) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (332) language_opt ::= */ + -2, /* (333) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (334) or_replace_opt ::= */ + -2, /* (335) or_replace_opt ::= OR REPLACE */ + -12, /* (336) 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 */ + -4, /* (337) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (338) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (339) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (340) col_list_opt ::= */ + -3, /* (341) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (342) tag_def_or_ref_opt ::= */ + -1, /* (343) tag_def_or_ref_opt ::= tags_def */ + -4, /* (344) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 0, /* (345) stream_options ::= */ + -3, /* (346) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (347) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (348) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (349) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (350) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (351) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (352) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (353) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (354) subtable_opt ::= */ + -4, /* (355) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (356) ignore_opt ::= */ + -2, /* (357) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (358) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (359) cmd ::= KILL QUERY NK_STRING */ + -3, /* (360) cmd ::= KILL TRANSACTION NK_INTEGER */ + -2, /* (361) cmd ::= BALANCE VGROUP */ + -3, /* (362) cmd ::= BALANCE VGROUP LEADER */ + -4, /* (363) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (364) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (365) cmd ::= SPLIT VGROUP NK_INTEGER */ + -2, /* (366) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (367) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (368) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (369) cmd ::= query_or_subquery */ + -1, /* (370) cmd ::= insert_query */ + -7, /* (371) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (372) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (373) literal ::= NK_INTEGER */ + -1, /* (374) literal ::= NK_FLOAT */ + -1, /* (375) literal ::= NK_STRING */ + -1, /* (376) literal ::= NK_BOOL */ + -2, /* (377) literal ::= TIMESTAMP NK_STRING */ + -1, /* (378) literal ::= duration_literal */ + -1, /* (379) literal ::= NULL */ + -1, /* (380) literal ::= NK_QUESTION */ + -1, /* (381) duration_literal ::= NK_VARIABLE */ + -1, /* (382) signed ::= NK_INTEGER */ + -2, /* (383) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (384) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (385) signed ::= NK_FLOAT */ + -2, /* (386) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (387) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (388) signed_literal ::= signed */ + -1, /* (389) signed_literal ::= NK_STRING */ + -1, /* (390) signed_literal ::= NK_BOOL */ + -2, /* (391) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (392) signed_literal ::= duration_literal */ + -1, /* (393) signed_literal ::= NULL */ + -1, /* (394) signed_literal ::= literal_func */ + -1, /* (395) signed_literal ::= NK_QUESTION */ + -1, /* (396) literal_list ::= signed_literal */ + -3, /* (397) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (398) db_name ::= NK_ID */ + -1, /* (399) table_name ::= NK_ID */ + -1, /* (400) column_name ::= NK_ID */ + -1, /* (401) function_name ::= NK_ID */ + -1, /* (402) table_alias ::= NK_ID */ + -1, /* (403) column_alias ::= NK_ID */ + -1, /* (404) user_name ::= NK_ID */ + -1, /* (405) topic_name ::= NK_ID */ + -1, /* (406) stream_name ::= NK_ID */ + -1, /* (407) cgroup_name ::= NK_ID */ + -1, /* (408) index_name ::= NK_ID */ + -1, /* (409) expr_or_subquery ::= expression */ + -1, /* (410) expression ::= literal */ + -1, /* (411) expression ::= pseudo_column */ + -1, /* (412) expression ::= column_reference */ + -1, /* (413) expression ::= function_expression */ + -1, /* (414) expression ::= case_when_expression */ + -3, /* (415) expression ::= NK_LP expression NK_RP */ + -2, /* (416) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (417) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (418) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (419) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (420) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (421) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (422) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (423) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (424) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (425) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (426) expression_list ::= expr_or_subquery */ + -3, /* (427) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (428) column_reference ::= column_name */ + -3, /* (429) column_reference ::= table_name NK_DOT column_name */ + -1, /* (430) pseudo_column ::= ROWTS */ + -1, /* (431) pseudo_column ::= TBNAME */ + -3, /* (432) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (433) pseudo_column ::= QSTART */ + -1, /* (434) pseudo_column ::= QEND */ + -1, /* (435) pseudo_column ::= QDURATION */ + -1, /* (436) pseudo_column ::= WSTART */ + -1, /* (437) pseudo_column ::= WEND */ + -1, /* (438) pseudo_column ::= WDURATION */ + -1, /* (439) pseudo_column ::= IROWTS */ + -1, /* (440) pseudo_column ::= ISFILLED */ + -1, /* (441) pseudo_column ::= QTAGS */ + -4, /* (442) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (443) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (444) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (445) function_expression ::= literal_func */ + -3, /* (446) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (447) literal_func ::= NOW */ + -1, /* (448) noarg_func ::= NOW */ + -1, /* (449) noarg_func ::= TODAY */ + -1, /* (450) noarg_func ::= TIMEZONE */ + -1, /* (451) noarg_func ::= DATABASE */ + -1, /* (452) noarg_func ::= CLIENT_VERSION */ + -1, /* (453) noarg_func ::= SERVER_VERSION */ + -1, /* (454) noarg_func ::= SERVER_STATUS */ + -1, /* (455) noarg_func ::= CURRENT_USER */ + -1, /* (456) noarg_func ::= USER */ + -1, /* (457) star_func ::= COUNT */ + -1, /* (458) star_func ::= FIRST */ + -1, /* (459) star_func ::= LAST */ + -1, /* (460) star_func ::= LAST_ROW */ + -1, /* (461) star_func_para_list ::= NK_STAR */ + -1, /* (462) star_func_para_list ::= other_para_list */ + -1, /* (463) other_para_list ::= star_func_para */ + -3, /* (464) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (465) star_func_para ::= expr_or_subquery */ + -3, /* (466) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (467) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (468) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (469) when_then_list ::= when_then_expr */ + -2, /* (470) when_then_list ::= when_then_list when_then_expr */ + -4, /* (471) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (472) case_when_else_opt ::= */ + -2, /* (473) case_when_else_opt ::= ELSE common_expression */ + -3, /* (474) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (475) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (476) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (477) predicate ::= expr_or_subquery IS NULL */ + -4, /* (478) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (479) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (480) compare_op ::= NK_LT */ + -1, /* (481) compare_op ::= NK_GT */ + -1, /* (482) compare_op ::= NK_LE */ + -1, /* (483) compare_op ::= NK_GE */ + -1, /* (484) compare_op ::= NK_NE */ + -1, /* (485) compare_op ::= NK_EQ */ + -1, /* (486) compare_op ::= LIKE */ + -2, /* (487) compare_op ::= NOT LIKE */ + -1, /* (488) compare_op ::= MATCH */ + -1, /* (489) compare_op ::= NMATCH */ + -1, /* (490) compare_op ::= CONTAINS */ + -1, /* (491) in_op ::= IN */ + -2, /* (492) in_op ::= NOT IN */ + -3, /* (493) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (494) boolean_value_expression ::= boolean_primary */ + -2, /* (495) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (496) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (497) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (498) boolean_primary ::= predicate */ + -3, /* (499) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (500) common_expression ::= expr_or_subquery */ + -1, /* (501) common_expression ::= boolean_value_expression */ + 0, /* (502) from_clause_opt ::= */ + -2, /* (503) from_clause_opt ::= FROM table_reference_list */ + -1, /* (504) table_reference_list ::= table_reference */ + -3, /* (505) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (506) table_reference ::= table_primary */ + -1, /* (507) table_reference ::= joined_table */ + -2, /* (508) table_primary ::= table_name alias_opt */ + -4, /* (509) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (510) table_primary ::= subquery alias_opt */ + -1, /* (511) table_primary ::= parenthesized_joined_table */ + 0, /* (512) alias_opt ::= */ + -1, /* (513) alias_opt ::= table_alias */ + -2, /* (514) alias_opt ::= AS table_alias */ + -3, /* (515) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (516) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (517) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (518) join_type ::= */ + -1, /* (519) join_type ::= INNER */ + -14, /* (520) query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (521) hint_list ::= */ + -1, /* (522) hint_list ::= NK_HINT */ + 0, /* (523) tag_mode_opt ::= */ + -1, /* (524) tag_mode_opt ::= TAGS */ + 0, /* (525) set_quantifier_opt ::= */ + -1, /* (526) set_quantifier_opt ::= DISTINCT */ + -1, /* (527) set_quantifier_opt ::= ALL */ + -1, /* (528) select_list ::= select_item */ + -3, /* (529) select_list ::= select_list NK_COMMA select_item */ + -1, /* (530) select_item ::= NK_STAR */ + -1, /* (531) select_item ::= common_expression */ + -2, /* (532) select_item ::= common_expression column_alias */ + -3, /* (533) select_item ::= common_expression AS column_alias */ + -3, /* (534) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (535) where_clause_opt ::= */ + -2, /* (536) where_clause_opt ::= WHERE search_condition */ + 0, /* (537) partition_by_clause_opt ::= */ + -3, /* (538) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (539) partition_list ::= partition_item */ + -3, /* (540) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (541) partition_item ::= expr_or_subquery */ + -2, /* (542) partition_item ::= expr_or_subquery column_alias */ + -3, /* (543) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (544) twindow_clause_opt ::= */ + -6, /* (545) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + -4, /* (546) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (547) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (548) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (549) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (550) sliding_opt ::= */ + -4, /* (551) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 0, /* (552) fill_opt ::= */ + -4, /* (553) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (554) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (555) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (556) fill_mode ::= NONE */ + -1, /* (557) fill_mode ::= PREV */ + -1, /* (558) fill_mode ::= NULL */ + -1, /* (559) fill_mode ::= NULL_F */ + -1, /* (560) fill_mode ::= LINEAR */ + -1, /* (561) fill_mode ::= NEXT */ + 0, /* (562) group_by_clause_opt ::= */ + -3, /* (563) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (564) group_by_list ::= expr_or_subquery */ + -3, /* (565) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (566) having_clause_opt ::= */ + -2, /* (567) having_clause_opt ::= HAVING search_condition */ + 0, /* (568) range_opt ::= */ + -6, /* (569) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (570) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (571) every_opt ::= */ + -4, /* (572) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (573) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (574) query_simple ::= query_specification */ + -1, /* (575) query_simple ::= union_query_expression */ + -4, /* (576) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (577) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (578) query_simple_or_subquery ::= query_simple */ + -1, /* (579) query_simple_or_subquery ::= subquery */ + -1, /* (580) query_or_subquery ::= query_expression */ + -1, /* (581) query_or_subquery ::= subquery */ + 0, /* (582) order_by_clause_opt ::= */ + -3, /* (583) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (584) slimit_clause_opt ::= */ + -2, /* (585) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (586) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (587) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (588) limit_clause_opt ::= */ + -2, /* (589) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (590) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (591) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (592) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (593) subquery ::= NK_LP subquery NK_RP */ + -1, /* (594) search_condition ::= common_expression */ + -1, /* (595) sort_specification_list ::= sort_specification */ + -3, /* (596) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (597) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (598) ordering_specification_opt ::= */ + -1, /* (599) ordering_specification_opt ::= ASC */ + -1, /* (600) ordering_specification_opt ::= DESC */ + 0, /* (601) null_ordering_opt ::= */ + -2, /* (602) null_ordering_opt ::= NULLS FIRST */ + -2, /* (603) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4609,25 +4606,25 @@ static YYACTIONTYPE yy_reduce( case 44: /* with_opt ::= */ case 144: /* start_opt ::= */ yytestcase(yyruleno==144); case 148: /* end_opt ::= */ yytestcase(yyruleno==148); - case 277: /* like_pattern_opt ::= */ yytestcase(yyruleno==277); - case 355: /* subtable_opt ::= */ yytestcase(yyruleno==355); - case 473: /* case_when_else_opt ::= */ yytestcase(yyruleno==473); - case 503: /* from_clause_opt ::= */ yytestcase(yyruleno==503); - case 536: /* where_clause_opt ::= */ yytestcase(yyruleno==536); - case 545: /* twindow_clause_opt ::= */ yytestcase(yyruleno==545); - case 551: /* sliding_opt ::= */ yytestcase(yyruleno==551); - case 553: /* fill_opt ::= */ yytestcase(yyruleno==553); - case 567: /* having_clause_opt ::= */ yytestcase(yyruleno==567); - case 569: /* range_opt ::= */ yytestcase(yyruleno==569); - case 572: /* every_opt ::= */ yytestcase(yyruleno==572); - case 585: /* slimit_clause_opt ::= */ yytestcase(yyruleno==585); - case 589: /* limit_clause_opt ::= */ yytestcase(yyruleno==589); + case 276: /* like_pattern_opt ::= */ yytestcase(yyruleno==276); + case 354: /* subtable_opt ::= */ yytestcase(yyruleno==354); + case 472: /* case_when_else_opt ::= */ yytestcase(yyruleno==472); + case 502: /* from_clause_opt ::= */ yytestcase(yyruleno==502); + case 535: /* where_clause_opt ::= */ yytestcase(yyruleno==535); + case 544: /* twindow_clause_opt ::= */ yytestcase(yyruleno==544); + case 550: /* sliding_opt ::= */ yytestcase(yyruleno==550); + case 552: /* fill_opt ::= */ yytestcase(yyruleno==552); + case 566: /* having_clause_opt ::= */ yytestcase(yyruleno==566); + case 568: /* range_opt ::= */ yytestcase(yyruleno==568); + case 571: /* every_opt ::= */ yytestcase(yyruleno==571); + case 584: /* slimit_clause_opt ::= */ yytestcase(yyruleno==584); + case 588: /* limit_clause_opt ::= */ yytestcase(yyruleno==588); { yymsp[1].minor.yy952 = NULL; } break; case 45: /* with_opt ::= WITH search_condition */ - case 504: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==504); - case 537: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==537); - case 568: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==568); + case 503: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==503); + case 536: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==536); + case 567: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==567); { yymsp[-1].minor.yy952 = yymsp[0].minor.yy952; } break; case 46: /* cmd ::= CREATE DNODE dnode_endpoint */ @@ -4666,54 +4663,54 @@ static YYACTIONTYPE yy_reduce( case 57: /* dnode_endpoint ::= NK_STRING */ case 58: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==58); case 59: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==59); - case 301: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==301); - case 302: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==302); - case 303: /* sma_func_name ::= LAST */ yytestcase(yyruleno==303); - case 304: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==304); - case 399: /* db_name ::= NK_ID */ yytestcase(yyruleno==399); - case 400: /* table_name ::= NK_ID */ yytestcase(yyruleno==400); - case 401: /* column_name ::= NK_ID */ yytestcase(yyruleno==401); - case 402: /* function_name ::= NK_ID */ yytestcase(yyruleno==402); - case 403: /* table_alias ::= NK_ID */ yytestcase(yyruleno==403); - case 404: /* column_alias ::= NK_ID */ yytestcase(yyruleno==404); - case 405: /* user_name ::= NK_ID */ yytestcase(yyruleno==405); - case 406: /* topic_name ::= NK_ID */ yytestcase(yyruleno==406); - case 407: /* stream_name ::= NK_ID */ yytestcase(yyruleno==407); - case 408: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==408); - case 409: /* index_name ::= NK_ID */ yytestcase(yyruleno==409); - case 449: /* noarg_func ::= NOW */ yytestcase(yyruleno==449); - case 450: /* noarg_func ::= TODAY */ yytestcase(yyruleno==450); - case 451: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==451); - case 452: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==452); - case 453: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==453); - case 454: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==454); - case 455: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==455); - case 456: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==456); - case 457: /* noarg_func ::= USER */ yytestcase(yyruleno==457); - case 458: /* star_func ::= COUNT */ yytestcase(yyruleno==458); - case 459: /* star_func ::= FIRST */ yytestcase(yyruleno==459); - case 460: /* star_func ::= LAST */ yytestcase(yyruleno==460); - case 461: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==461); + case 300: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==300); + case 301: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==301); + case 302: /* sma_func_name ::= LAST */ yytestcase(yyruleno==302); + case 303: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==303); + case 398: /* db_name ::= NK_ID */ yytestcase(yyruleno==398); + case 399: /* table_name ::= NK_ID */ yytestcase(yyruleno==399); + case 400: /* column_name ::= NK_ID */ yytestcase(yyruleno==400); + case 401: /* function_name ::= NK_ID */ yytestcase(yyruleno==401); + case 402: /* table_alias ::= NK_ID */ yytestcase(yyruleno==402); + case 403: /* column_alias ::= NK_ID */ yytestcase(yyruleno==403); + case 404: /* user_name ::= NK_ID */ yytestcase(yyruleno==404); + case 405: /* topic_name ::= NK_ID */ yytestcase(yyruleno==405); + case 406: /* stream_name ::= NK_ID */ yytestcase(yyruleno==406); + case 407: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==407); + case 408: /* index_name ::= NK_ID */ yytestcase(yyruleno==408); + case 448: /* noarg_func ::= NOW */ yytestcase(yyruleno==448); + case 449: /* noarg_func ::= TODAY */ yytestcase(yyruleno==449); + case 450: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==450); + case 451: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==451); + case 452: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==452); + case 453: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==453); + case 454: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==454); + case 455: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==455); + case 456: /* noarg_func ::= USER */ yytestcase(yyruleno==456); + case 457: /* star_func ::= COUNT */ yytestcase(yyruleno==457); + case 458: /* star_func ::= FIRST */ yytestcase(yyruleno==458); + case 459: /* star_func ::= LAST */ yytestcase(yyruleno==459); + case 460: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==460); { yylhsminor.yy169 = yymsp[0].minor.yy0; } yymsp[0].minor.yy169 = yylhsminor.yy169; break; case 60: /* force_opt ::= */ case 84: /* not_exists_opt ::= */ yytestcase(yyruleno==84); case 86: /* exists_opt ::= */ yytestcase(yyruleno==86); - case 322: /* analyze_opt ::= */ yytestcase(yyruleno==322); - case 329: /* agg_func_opt ::= */ yytestcase(yyruleno==329); - case 335: /* or_replace_opt ::= */ yytestcase(yyruleno==335); - case 357: /* ignore_opt ::= */ yytestcase(yyruleno==357); - case 524: /* tag_mode_opt ::= */ yytestcase(yyruleno==524); - case 526: /* set_quantifier_opt ::= */ yytestcase(yyruleno==526); + case 321: /* analyze_opt ::= */ yytestcase(yyruleno==321); + case 328: /* agg_func_opt ::= */ yytestcase(yyruleno==328); + case 334: /* or_replace_opt ::= */ yytestcase(yyruleno==334); + case 356: /* ignore_opt ::= */ yytestcase(yyruleno==356); + case 523: /* tag_mode_opt ::= */ yytestcase(yyruleno==523); + case 525: /* set_quantifier_opt ::= */ yytestcase(yyruleno==525); { yymsp[1].minor.yy957 = false; } break; case 61: /* force_opt ::= FORCE */ case 62: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==62); - case 323: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==323); - case 330: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==330); - case 525: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==525); - case 527: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==527); + case 322: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==322); + case 329: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==329); + case 524: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==524); + case 526: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==526); { yymsp[0].minor.yy957 = true; } break; case 63: /* cmd ::= ALTER LOCAL NK_STRING */ @@ -4780,8 +4777,8 @@ static YYACTIONTYPE yy_reduce( { yymsp[-2].minor.yy957 = true; } break; case 85: /* exists_opt ::= IF EXISTS */ - case 336: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==336); - case 358: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==358); + case 335: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==335); + case 357: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==357); { yymsp[-1].minor.yy957 = true; } break; case 87: /* db_options ::= */ @@ -4973,7 +4970,7 @@ static YYACTIONTYPE yy_reduce( yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 136: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 368: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==368); + case 367: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==367); { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy824 = yylhsminor.yy824; break; @@ -4989,31 +4986,31 @@ static YYACTIONTYPE yy_reduce( case 169: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==169); case 172: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==172); case 179: /* column_def_list ::= column_def */ yytestcase(yyruleno==179); - case 224: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==224); - case 229: /* col_name_list ::= col_name */ yytestcase(yyruleno==229); - case 283: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==283); - case 297: /* func_list ::= func */ yytestcase(yyruleno==297); - case 397: /* literal_list ::= signed_literal */ yytestcase(yyruleno==397); - case 464: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==464); - case 470: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==470); - case 529: /* select_list ::= select_item */ yytestcase(yyruleno==529); - case 540: /* partition_list ::= partition_item */ yytestcase(yyruleno==540); - case 596: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==596); + case 223: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==223); + case 228: /* col_name_list ::= col_name */ yytestcase(yyruleno==228); + case 282: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==282); + case 296: /* func_list ::= func */ yytestcase(yyruleno==296); + case 396: /* literal_list ::= signed_literal */ yytestcase(yyruleno==396); + case 463: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==463); + case 469: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==469); + case 528: /* select_list ::= select_item */ yytestcase(yyruleno==528); + case 539: /* partition_list ::= partition_item */ yytestcase(yyruleno==539); + case 595: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==595); { yylhsminor.yy824 = createNodeList(pCxt, yymsp[0].minor.yy952); } yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 140: /* retention_list ::= retention_list NK_COMMA retention */ case 173: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==173); case 180: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==180); - case 225: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==225); - case 230: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==230); - case 284: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==284); - case 298: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==298); - case 398: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==398); - case 465: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==465); - case 530: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==530); - case 541: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==541); - case 597: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==597); + case 224: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==224); + case 229: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==229); + case 283: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==283); + case 297: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==297); + case 397: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==397); + case 464: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==464); + case 529: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==529); + case 540: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==540); + case 596: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==596); { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, yymsp[0].minor.yy952); } yymsp[-2].minor.yy824 = yylhsminor.yy824; break; @@ -5022,11 +5019,11 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 142: /* speed_opt ::= */ - case 331: /* bufsize_opt ::= */ yytestcase(yyruleno==331); + case 330: /* bufsize_opt ::= */ yytestcase(yyruleno==330); { yymsp[1].minor.yy480 = 0; } break; case 143: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 332: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==332); + case 331: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==331); { yymsp[-1].minor.yy480 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 145: /* start_opt ::= START WITH NK_INTEGER */ @@ -5055,8 +5052,8 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy957, yymsp[0].minor.yy952); } break; case 157: /* cmd ::= ALTER TABLE alter_table_clause */ - case 370: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==370); - case 371: /* cmd ::= insert_query */ yytestcase(yyruleno==371); + case 369: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==369); + case 370: /* cmd ::= insert_query */ yytestcase(yyruleno==370); { pCxt->pRootNode = yymsp[0].minor.yy952; } break; case 158: /* cmd ::= ALTER STABLE alter_table_clause */ @@ -5103,7 +5100,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-5].minor.yy952 = yylhsminor.yy952; break; case 170: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 471: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==471); + case 470: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==470); { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-1].minor.yy824, yymsp[0].minor.yy952); } yymsp[-1].minor.yy824 = yylhsminor.yy824; break; @@ -5116,17 +5113,17 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 175: /* specific_cols_opt ::= */ - case 207: /* tags_def_opt ::= */ yytestcase(yyruleno==207); - case 282: /* tag_list_opt ::= */ yytestcase(yyruleno==282); - case 341: /* col_list_opt ::= */ yytestcase(yyruleno==341); - case 343: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==343); - case 538: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==538); - case 563: /* group_by_clause_opt ::= */ yytestcase(yyruleno==563); - case 583: /* order_by_clause_opt ::= */ yytestcase(yyruleno==583); + case 206: /* tags_def_opt ::= */ yytestcase(yyruleno==206); + case 281: /* tag_list_opt ::= */ yytestcase(yyruleno==281); + case 340: /* col_list_opt ::= */ yytestcase(yyruleno==340); + case 342: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==342); + case 537: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==537); + case 562: /* group_by_clause_opt ::= */ yytestcase(yyruleno==562); + case 582: /* order_by_clause_opt ::= */ yytestcase(yyruleno==582); { yymsp[1].minor.yy824 = NULL; } break; case 176: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 342: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==342); + case 341: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==341); { yymsp[-2].minor.yy824 = yymsp[-1].minor.yy824; } break; case 177: /* full_table_name ::= table_name */ @@ -5141,567 +5138,563 @@ static YYACTIONTYPE yy_reduce( { yylhsminor.yy952 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy169, yymsp[0].minor.yy84, NULL); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 182: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy952 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy169, yymsp[-2].minor.yy84, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy952 = yylhsminor.yy952; - break; - case 183: /* type_name ::= BOOL */ + case 182: /* type_name ::= BOOL */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 184: /* type_name ::= TINYINT */ + case 183: /* type_name ::= TINYINT */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 185: /* type_name ::= SMALLINT */ + case 184: /* type_name ::= SMALLINT */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 186: /* type_name ::= INT */ - case 187: /* type_name ::= INTEGER */ yytestcase(yyruleno==187); + case 185: /* type_name ::= INT */ + case 186: /* type_name ::= INTEGER */ yytestcase(yyruleno==186); { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 188: /* type_name ::= BIGINT */ + case 187: /* type_name ::= BIGINT */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 189: /* type_name ::= FLOAT */ + case 188: /* type_name ::= FLOAT */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 190: /* type_name ::= DOUBLE */ + case 189: /* type_name ::= DOUBLE */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 191: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + case 190: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 192: /* type_name ::= TIMESTAMP */ + case 191: /* type_name ::= TIMESTAMP */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 193: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + case 192: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 194: /* type_name ::= TINYINT UNSIGNED */ + case 193: /* type_name ::= TINYINT UNSIGNED */ { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 195: /* type_name ::= SMALLINT UNSIGNED */ + case 194: /* type_name ::= SMALLINT UNSIGNED */ { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 196: /* type_name ::= INT UNSIGNED */ + case 195: /* type_name ::= INT UNSIGNED */ { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 197: /* type_name ::= BIGINT UNSIGNED */ + case 196: /* type_name ::= BIGINT UNSIGNED */ { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 198: /* type_name ::= JSON */ + case 197: /* type_name ::= JSON */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 199: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + case 198: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 200: /* type_name ::= MEDIUMBLOB */ + case 199: /* type_name ::= MEDIUMBLOB */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 201: /* type_name ::= BLOB */ + case 200: /* type_name ::= BLOB */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 202: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + case 201: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 203: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + case 202: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; - case 204: /* type_name ::= DECIMAL */ + case 203: /* type_name ::= DECIMAL */ { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 205: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + case 204: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 206: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + case 205: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 208: /* tags_def_opt ::= tags_def */ - case 344: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==344); - case 463: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==463); + case 207: /* tags_def_opt ::= tags_def */ + case 343: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==343); + case 462: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==462); { yylhsminor.yy824 = yymsp[0].minor.yy824; } yymsp[0].minor.yy824 = yylhsminor.yy824; break; - case 209: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 345: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==345); + case 208: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 344: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==344); { yymsp[-3].minor.yy824 = yymsp[-1].minor.yy824; } break; - case 210: /* table_options ::= */ + case 209: /* table_options ::= */ { yymsp[1].minor.yy952 = createDefaultTableOptions(pCxt); } break; - case 211: /* table_options ::= table_options COMMENT NK_STRING */ + case 210: /* table_options ::= table_options COMMENT NK_STRING */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 212: /* table_options ::= table_options MAX_DELAY duration_list */ + case 211: /* table_options ::= table_options MAX_DELAY duration_list */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy824); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 213: /* table_options ::= table_options WATERMARK duration_list */ + case 212: /* table_options ::= table_options WATERMARK duration_list */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy824); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 214: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + case 213: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-4].minor.yy952, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy824); } yymsp[-4].minor.yy952 = yylhsminor.yy952; break; - case 215: /* table_options ::= table_options TTL NK_INTEGER */ + case 214: /* table_options ::= table_options TTL NK_INTEGER */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 216: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + case 215: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-4].minor.yy952, TABLE_OPTION_SMA, yymsp[-1].minor.yy824); } yymsp[-4].minor.yy952 = yylhsminor.yy952; break; - case 217: /* table_options ::= table_options DELETE_MARK duration_list */ + case 216: /* table_options ::= table_options DELETE_MARK duration_list */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy824); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 218: /* alter_table_options ::= alter_table_option */ + case 217: /* alter_table_options ::= alter_table_option */ { yylhsminor.yy952 = createAlterTableOptions(pCxt); yylhsminor.yy952 = setTableOption(pCxt, yylhsminor.yy952, yymsp[0].minor.yy25.type, &yymsp[0].minor.yy25.val); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 219: /* alter_table_options ::= alter_table_options alter_table_option */ + case 218: /* alter_table_options ::= alter_table_options alter_table_option */ { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy25.type, &yymsp[0].minor.yy25.val); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 220: /* alter_table_option ::= COMMENT NK_STRING */ + case 219: /* alter_table_option ::= COMMENT NK_STRING */ { yymsp[-1].minor.yy25.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } break; - case 221: /* alter_table_option ::= TTL NK_INTEGER */ + case 220: /* alter_table_option ::= TTL NK_INTEGER */ { yymsp[-1].minor.yy25.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } break; - case 222: /* duration_list ::= duration_literal */ - case 427: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==427); + case 221: /* duration_list ::= duration_literal */ + case 426: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==426); { yylhsminor.yy824 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } yymsp[0].minor.yy824 = yylhsminor.yy824; break; - case 223: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 428: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==428); + case 222: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 427: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==427); { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } yymsp[-2].minor.yy824 = yylhsminor.yy824; break; - case 226: /* rollup_func_name ::= function_name */ + case 225: /* rollup_func_name ::= function_name */ { yylhsminor.yy952 = createFunctionNode(pCxt, &yymsp[0].minor.yy169, NULL); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 227: /* rollup_func_name ::= FIRST */ - case 228: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==228); - case 286: /* tag_item ::= QTAGS */ yytestcase(yyruleno==286); + case 226: /* rollup_func_name ::= FIRST */ + case 227: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==227); + case 285: /* tag_item ::= QTAGS */ yytestcase(yyruleno==285); { yylhsminor.yy952 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 231: /* col_name ::= column_name */ - case 287: /* tag_item ::= column_name */ yytestcase(yyruleno==287); + case 230: /* col_name ::= column_name */ + case 286: /* tag_item ::= column_name */ yytestcase(yyruleno==286); { yylhsminor.yy952 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy169); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 232: /* cmd ::= SHOW DNODES */ + case 231: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 233: /* cmd ::= SHOW USERS */ + case 232: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 234: /* cmd ::= SHOW USER PRIVILEGES */ + case 233: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 235: /* cmd ::= SHOW DATABASES */ + case 234: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 236: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + case 235: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, OP_TYPE_LIKE); } break; - case 237: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + case 236: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, OP_TYPE_LIKE); } break; - case 238: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ + case 237: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy952, NULL, OP_TYPE_LIKE); } break; - case 239: /* cmd ::= SHOW MNODES */ + case 238: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 240: /* cmd ::= SHOW QNODES */ + case 239: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 241: /* cmd ::= SHOW FUNCTIONS */ + case 240: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 242: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + case 241: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy952, yymsp[-1].minor.yy952, OP_TYPE_EQUAL); } break; - case 243: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + case 242: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy169), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169), OP_TYPE_EQUAL); } break; - case 244: /* cmd ::= SHOW STREAMS */ + case 243: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 245: /* cmd ::= SHOW ACCOUNTS */ + case 244: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 246: /* cmd ::= SHOW APPS */ + case 245: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 247: /* cmd ::= SHOW CONNECTIONS */ + case 246: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 248: /* cmd ::= SHOW LICENCES */ - case 249: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==249); + case 247: /* cmd ::= SHOW LICENCES */ + case 248: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==248); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 250: /* cmd ::= SHOW CREATE DATABASE db_name */ + case 249: /* cmd ::= SHOW CREATE DATABASE db_name */ { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy169); } break; - case 251: /* cmd ::= SHOW CREATE TABLE full_table_name */ + case 250: /* cmd ::= SHOW CREATE TABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy952); } break; - case 252: /* cmd ::= SHOW CREATE STABLE full_table_name */ + case 251: /* cmd ::= SHOW CREATE STABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy952); } break; - case 253: /* cmd ::= SHOW QUERIES */ + case 252: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 254: /* cmd ::= SHOW SCORES */ + case 253: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 255: /* cmd ::= SHOW TOPICS */ + case 254: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 256: /* cmd ::= SHOW VARIABLES */ - case 257: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==257); + case 255: /* cmd ::= SHOW VARIABLES */ + case 256: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==256); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 258: /* cmd ::= SHOW LOCAL VARIABLES */ + case 257: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 259: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + case 258: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy952); } break; - case 260: /* cmd ::= SHOW BNODES */ + case 259: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 261: /* cmd ::= SHOW SNODES */ + case 260: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 262: /* cmd ::= SHOW CLUSTER */ + case 261: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 263: /* cmd ::= SHOW TRANSACTIONS */ + case 262: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 264: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + case 263: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy952); } break; - case 265: /* cmd ::= SHOW CONSUMERS */ + case 264: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 266: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 265: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 267: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + case 266: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy952, yymsp[-1].minor.yy952, OP_TYPE_EQUAL); } break; - case 268: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + case 267: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy169), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169), OP_TYPE_EQUAL); } break; - case 269: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + case 268: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy952, yymsp[-3].minor.yy824); } break; - case 270: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + case 269: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy169), yymsp[-4].minor.yy824); } break; - case 271: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + case 270: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 272: /* cmd ::= SHOW VNODES */ + case 271: /* cmd ::= SHOW VNODES */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } break; - case 273: /* cmd ::= SHOW db_name_cond_opt ALIVE */ + case 272: /* cmd ::= SHOW db_name_cond_opt ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy952, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 274: /* cmd ::= SHOW CLUSTER ALIVE */ + case 273: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 275: /* db_name_cond_opt ::= */ - case 280: /* from_db_opt ::= */ yytestcase(yyruleno==280); + case 274: /* db_name_cond_opt ::= */ + case 279: /* from_db_opt ::= */ yytestcase(yyruleno==279); { yymsp[1].minor.yy952 = createDefaultDatabaseCondValue(pCxt); } break; - case 276: /* db_name_cond_opt ::= db_name NK_DOT */ + case 275: /* db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy952 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy169); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 278: /* like_pattern_opt ::= LIKE NK_STRING */ + case 277: /* like_pattern_opt ::= LIKE NK_STRING */ { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 279: /* table_name_cond ::= table_name */ + case 278: /* table_name_cond ::= table_name */ { yylhsminor.yy952 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 281: /* from_db_opt ::= FROM db_name */ + case 280: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy952 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169); } break; - case 285: /* tag_item ::= TBNAME */ + case 284: /* tag_item ::= TBNAME */ { yylhsminor.yy952 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 288: /* tag_item ::= column_name column_alias */ + case 287: /* tag_item ::= column_name column_alias */ { yylhsminor.yy952 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy169), &yymsp[0].minor.yy169); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 289: /* tag_item ::= column_name AS column_alias */ + case 288: /* tag_item ::= column_name AS column_alias */ { yylhsminor.yy952 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy169), &yymsp[0].minor.yy169); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 290: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + case 289: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy957, yymsp[-3].minor.yy952, yymsp[-1].minor.yy952, NULL, yymsp[0].minor.yy952); } break; - case 291: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + case 290: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy957, yymsp[-5].minor.yy952, yymsp[-3].minor.yy952, yymsp[-1].minor.yy824, NULL); } break; - case 292: /* cmd ::= DROP INDEX exists_opt full_index_name */ + case 291: /* cmd ::= DROP INDEX exists_opt full_index_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy957, yymsp[0].minor.yy952); } break; - case 293: /* full_index_name ::= index_name */ + case 292: /* full_index_name ::= index_name */ { yylhsminor.yy952 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy169); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 294: /* full_index_name ::= db_name NK_DOT index_name */ + case 293: /* full_index_name ::= db_name NK_DOT index_name */ { yylhsminor.yy952 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 295: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + case 294: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-9].minor.yy952 = createIndexOption(pCxt, yymsp[-7].minor.yy824, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), NULL, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } break; - case 296: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + case 295: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-11].minor.yy952 = createIndexOption(pCxt, yymsp[-9].minor.yy824, releaseRawExprNode(pCxt, yymsp[-5].minor.yy952), releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } break; - case 299: /* func ::= sma_func_name NK_LP expression_list NK_RP */ + case 298: /* func ::= sma_func_name NK_LP expression_list NK_RP */ { yylhsminor.yy952 = createFunctionNode(pCxt, &yymsp[-3].minor.yy169, yymsp[-1].minor.yy824); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 300: /* sma_func_name ::= function_name */ - case 514: /* alias_opt ::= table_alias */ yytestcase(yyruleno==514); + case 299: /* sma_func_name ::= function_name */ + case 513: /* alias_opt ::= table_alias */ yytestcase(yyruleno==513); { yylhsminor.yy169 = yymsp[0].minor.yy169; } yymsp[0].minor.yy169 = yylhsminor.yy169; break; - case 305: /* sma_stream_opt ::= */ - case 346: /* stream_options ::= */ yytestcase(yyruleno==346); + case 304: /* sma_stream_opt ::= */ + case 345: /* stream_options ::= */ yytestcase(yyruleno==345); { yymsp[1].minor.yy952 = createStreamOptions(pCxt); } break; - case 306: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 305: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy952)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = yymsp[-2].minor.yy952; } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 307: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + case 306: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy952)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = yymsp[-2].minor.yy952; } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 308: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + case 307: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy952)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = yymsp[-2].minor.yy952; } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 309: /* with_meta ::= AS */ + case 308: /* with_meta ::= AS */ { yymsp[0].minor.yy480 = 0; } break; - case 310: /* with_meta ::= WITH META AS */ + case 309: /* with_meta ::= WITH META AS */ { yymsp[-2].minor.yy480 = 1; } break; - case 311: /* with_meta ::= ONLY META AS */ + case 310: /* with_meta ::= ONLY META AS */ { yymsp[-2].minor.yy480 = 2; } break; - case 312: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + case 311: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy957, &yymsp[-2].minor.yy169, yymsp[0].minor.yy952); } break; - case 313: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + case 312: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy957, &yymsp[-3].minor.yy169, &yymsp[0].minor.yy169, yymsp[-2].minor.yy480); } break; - case 314: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + case 313: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy957, &yymsp[-4].minor.yy169, yymsp[-1].minor.yy952, yymsp[-3].minor.yy480, yymsp[0].minor.yy952); } break; - case 315: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 314: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } break; - case 316: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + case 315: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy957, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169); } break; - case 317: /* cmd ::= DESC full_table_name */ - case 318: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==318); + case 316: /* cmd ::= DESC full_table_name */ + case 317: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==317); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy952); } break; - case 319: /* cmd ::= RESET QUERY CACHE */ + case 318: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 320: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 321: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==321); + case 319: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 320: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==320); { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy957, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } break; - case 324: /* explain_options ::= */ + case 323: /* explain_options ::= */ { yymsp[1].minor.yy952 = createDefaultExplainOptions(pCxt); } break; - case 325: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 324: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy952 = setExplainVerbose(pCxt, yymsp[-2].minor.yy952, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 326: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 325: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy952 = setExplainRatio(pCxt, yymsp[-2].minor.yy952, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 327: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + case 326: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy957, yymsp[-9].minor.yy957, &yymsp[-6].minor.yy169, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy84, yymsp[-1].minor.yy480, &yymsp[0].minor.yy169, yymsp[-10].minor.yy957); } break; - case 328: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 327: /* cmd ::= DROP FUNCTION exists_opt function_name */ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } break; - case 333: /* language_opt ::= */ + case 332: /* language_opt ::= */ { yymsp[1].minor.yy169 = nil_token; } break; - case 334: /* language_opt ::= LANGUAGE NK_STRING */ + case 333: /* language_opt ::= LANGUAGE NK_STRING */ { yymsp[-1].minor.yy169 = yymsp[0].minor.yy0; } break; - case 337: /* 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 */ + case 336: /* 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 */ { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy957, &yymsp[-8].minor.yy169, yymsp[-5].minor.yy952, yymsp[-7].minor.yy952, yymsp[-3].minor.yy824, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, yymsp[-4].minor.yy824); } break; - case 338: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 337: /* cmd ::= DROP STREAM exists_opt stream_name */ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } break; - case 339: /* cmd ::= PAUSE STREAM exists_opt stream_name */ + case 338: /* cmd ::= PAUSE STREAM exists_opt stream_name */ { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } break; - case 340: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + case 339: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy957, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } break; - case 347: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 348: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==348); + case 346: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 347: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==347); { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 349: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 348: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-3].minor.yy952, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 350: /* stream_options ::= stream_options WATERMARK duration_literal */ + case 349: /* stream_options ::= stream_options WATERMARK duration_literal */ { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 351: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + case 350: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-3].minor.yy952, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 352: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + case 351: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 353: /* stream_options ::= stream_options DELETE_MARK duration_literal */ + case 352: /* stream_options ::= stream_options DELETE_MARK duration_literal */ { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 354: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + case 353: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-3].minor.yy952, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 356: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 552: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==552); - case 573: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==573); + case 355: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 551: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==551); + case 572: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==572); { yymsp[-3].minor.yy952 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy952); } break; - case 359: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 358: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 360: /* cmd ::= KILL QUERY NK_STRING */ + case 359: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 361: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 360: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 362: /* cmd ::= BALANCE VGROUP */ + case 361: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 363: /* cmd ::= BALANCE VGROUP LEADER */ + case 362: /* cmd ::= BALANCE VGROUP LEADER */ { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); } break; - case 364: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 363: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 365: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + case 364: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy824); } break; - case 366: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 365: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 367: /* dnode_list ::= DNODE NK_INTEGER */ + case 366: /* dnode_list ::= DNODE NK_INTEGER */ { yymsp[-1].minor.yy824 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 369: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ + case 368: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } break; - case 372: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + case 371: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ { yymsp[-6].minor.yy952 = createInsertStmt(pCxt, yymsp[-4].minor.yy952, yymsp[-2].minor.yy824, yymsp[0].minor.yy952); } break; - case 373: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ + case 372: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ { yymsp[-3].minor.yy952 = createInsertStmt(pCxt, yymsp[-1].minor.yy952, NULL, yymsp[0].minor.yy952); } break; - case 374: /* literal ::= NK_INTEGER */ + case 373: /* literal ::= NK_INTEGER */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 375: /* literal ::= NK_FLOAT */ + case 374: /* literal ::= NK_FLOAT */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 376: /* literal ::= NK_STRING */ + case 375: /* literal ::= NK_STRING */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 377: /* literal ::= NK_BOOL */ + case 376: /* literal ::= NK_BOOL */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 378: /* literal ::= TIMESTAMP NK_STRING */ + case 377: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 379: /* literal ::= duration_literal */ - case 389: /* signed_literal ::= signed */ yytestcase(yyruleno==389); - case 410: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==410); - case 411: /* expression ::= literal */ yytestcase(yyruleno==411); - case 412: /* expression ::= pseudo_column */ yytestcase(yyruleno==412); - case 413: /* expression ::= column_reference */ yytestcase(yyruleno==413); - case 414: /* expression ::= function_expression */ yytestcase(yyruleno==414); - case 415: /* expression ::= case_when_expression */ yytestcase(yyruleno==415); - case 446: /* function_expression ::= literal_func */ yytestcase(yyruleno==446); - case 495: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==495); - case 499: /* boolean_primary ::= predicate */ yytestcase(yyruleno==499); - case 501: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==501); - case 502: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==502); - case 505: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==505); - case 507: /* table_reference ::= table_primary */ yytestcase(yyruleno==507); - case 508: /* table_reference ::= joined_table */ yytestcase(yyruleno==508); - case 512: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==512); - case 575: /* query_simple ::= query_specification */ yytestcase(yyruleno==575); - case 576: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==576); - case 579: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==579); - case 581: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==581); + case 378: /* literal ::= duration_literal */ + case 388: /* signed_literal ::= signed */ yytestcase(yyruleno==388); + case 409: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==409); + case 410: /* expression ::= literal */ yytestcase(yyruleno==410); + case 411: /* expression ::= pseudo_column */ yytestcase(yyruleno==411); + case 412: /* expression ::= column_reference */ yytestcase(yyruleno==412); + case 413: /* expression ::= function_expression */ yytestcase(yyruleno==413); + case 414: /* expression ::= case_when_expression */ yytestcase(yyruleno==414); + case 445: /* function_expression ::= literal_func */ yytestcase(yyruleno==445); + case 494: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==494); + case 498: /* boolean_primary ::= predicate */ yytestcase(yyruleno==498); + case 500: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==500); + case 501: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==501); + case 504: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==504); + case 506: /* table_reference ::= table_primary */ yytestcase(yyruleno==506); + case 507: /* table_reference ::= joined_table */ yytestcase(yyruleno==507); + case 511: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==511); + case 574: /* query_simple ::= query_specification */ yytestcase(yyruleno==574); + case 575: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==575); + case 578: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==578); + case 580: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==580); { yylhsminor.yy952 = yymsp[0].minor.yy952; } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 380: /* literal ::= NULL */ + case 379: /* literal ::= NULL */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 381: /* literal ::= NK_QUESTION */ + case 380: /* literal ::= NK_QUESTION */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 382: /* duration_literal ::= NK_VARIABLE */ + case 381: /* duration_literal ::= NK_VARIABLE */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 383: /* signed ::= NK_INTEGER */ + case 382: /* signed ::= NK_INTEGER */ { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 384: /* signed ::= NK_PLUS NK_INTEGER */ + case 383: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 385: /* signed ::= NK_MINUS NK_INTEGER */ + case 384: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -5709,14 +5702,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 386: /* signed ::= NK_FLOAT */ + case 385: /* signed ::= NK_FLOAT */ { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 387: /* signed ::= NK_PLUS NK_FLOAT */ + case 386: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 388: /* signed ::= NK_MINUS NK_FLOAT */ + case 387: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -5724,57 +5717,57 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 390: /* signed_literal ::= NK_STRING */ + case 389: /* signed_literal ::= NK_STRING */ { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 391: /* signed_literal ::= NK_BOOL */ + case 390: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 392: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 391: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 393: /* signed_literal ::= duration_literal */ - case 395: /* signed_literal ::= literal_func */ yytestcase(yyruleno==395); - case 466: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==466); - case 532: /* select_item ::= common_expression */ yytestcase(yyruleno==532); - case 542: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==542); - case 580: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==580); - case 582: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==582); - case 595: /* search_condition ::= common_expression */ yytestcase(yyruleno==595); + case 392: /* signed_literal ::= duration_literal */ + case 394: /* signed_literal ::= literal_func */ yytestcase(yyruleno==394); + case 465: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==465); + case 531: /* select_item ::= common_expression */ yytestcase(yyruleno==531); + case 541: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==541); + case 579: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==579); + case 581: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==581); + case 594: /* search_condition ::= common_expression */ yytestcase(yyruleno==594); { yylhsminor.yy952 = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 394: /* signed_literal ::= NULL */ + case 393: /* signed_literal ::= NULL */ { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 396: /* signed_literal ::= NK_QUESTION */ + case 395: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy952 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 416: /* expression ::= NK_LP expression NK_RP */ - case 500: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==500); - case 594: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==594); + case 415: /* expression ::= NK_LP expression NK_RP */ + case 499: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==499); + case 593: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==593); { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 417: /* expression ::= NK_PLUS expr_or_subquery */ + case 416: /* expression ::= NK_PLUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 418: /* expression ::= NK_MINUS expr_or_subquery */ + case 417: /* expression ::= NK_MINUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy952), NULL)); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 419: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 418: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5782,7 +5775,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 420: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 419: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5790,7 +5783,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 421: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 420: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5798,7 +5791,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 422: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 421: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5806,7 +5799,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 423: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 422: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5814,14 +5807,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 424: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 423: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 425: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 424: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5829,7 +5822,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 426: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 425: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5837,71 +5830,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 429: /* column_reference ::= column_name */ + case 428: /* column_reference ::= column_name */ { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy169, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy169)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 430: /* column_reference ::= table_name NK_DOT column_name */ + case 429: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169, createColumnNode(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169)); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 431: /* pseudo_column ::= ROWTS */ - case 432: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==432); - case 434: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==434); - case 435: /* pseudo_column ::= QEND */ yytestcase(yyruleno==435); - case 436: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==436); - case 437: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==437); - case 438: /* pseudo_column ::= WEND */ yytestcase(yyruleno==438); - case 439: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==439); - case 440: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==440); - case 441: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==441); - case 442: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==442); - case 448: /* literal_func ::= NOW */ yytestcase(yyruleno==448); + case 430: /* pseudo_column ::= ROWTS */ + case 431: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==431); + case 433: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==433); + case 434: /* pseudo_column ::= QEND */ yytestcase(yyruleno==434); + case 435: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==435); + case 436: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==436); + case 437: /* pseudo_column ::= WEND */ yytestcase(yyruleno==437); + case 438: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==438); + case 439: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==439); + case 440: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==440); + case 441: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==441); + case 447: /* literal_func ::= NOW */ yytestcase(yyruleno==447); { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 433: /* pseudo_column ::= table_name NK_DOT TBNAME */ + case 432: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy169)))); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 443: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 444: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==444); + case 442: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 443: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==443); { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy169, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy169, yymsp[-1].minor.yy824)); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 445: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 444: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-1].minor.yy84)); } yymsp[-5].minor.yy952 = yylhsminor.yy952; break; - case 447: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 446: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy169, NULL)); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 462: /* star_func_para_list ::= NK_STAR */ + case 461: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy824 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy824 = yylhsminor.yy824; break; - case 467: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 535: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==535); + case 466: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 534: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==534); { yylhsminor.yy952 = createColumnNode(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 468: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ + case 467: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy824, yymsp[-1].minor.yy952)); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 469: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + case 468: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-2].minor.yy824, yymsp[-1].minor.yy952)); } yymsp[-4].minor.yy952 = yylhsminor.yy952; break; - case 472: /* when_then_expr ::= WHEN common_expression THEN common_expression */ + case 471: /* when_then_expr ::= WHEN common_expression THEN common_expression */ { yymsp[-3].minor.yy952 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } break; - case 474: /* case_when_else_opt ::= ELSE common_expression */ + case 473: /* case_when_else_opt ::= ELSE common_expression */ { yymsp[-1].minor.yy952 = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); } break; - case 475: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 480: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==480); + case 474: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 479: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==479); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5909,7 +5902,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 476: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 475: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5917,7 +5910,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy952 = yylhsminor.yy952; break; - case 477: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 476: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5925,71 +5918,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy952 = yylhsminor.yy952; break; - case 478: /* predicate ::= expr_or_subquery IS NULL */ + case 477: /* predicate ::= expr_or_subquery IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), NULL)); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 479: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 478: /* predicate ::= expr_or_subquery IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), NULL)); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 481: /* compare_op ::= NK_LT */ + case 480: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy520 = OP_TYPE_LOWER_THAN; } break; - case 482: /* compare_op ::= NK_GT */ + case 481: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy520 = OP_TYPE_GREATER_THAN; } break; - case 483: /* compare_op ::= NK_LE */ + case 482: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy520 = OP_TYPE_LOWER_EQUAL; } break; - case 484: /* compare_op ::= NK_GE */ + case 483: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy520 = OP_TYPE_GREATER_EQUAL; } break; - case 485: /* compare_op ::= NK_NE */ + case 484: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy520 = OP_TYPE_NOT_EQUAL; } break; - case 486: /* compare_op ::= NK_EQ */ + case 485: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy520 = OP_TYPE_EQUAL; } break; - case 487: /* compare_op ::= LIKE */ + case 486: /* compare_op ::= LIKE */ { yymsp[0].minor.yy520 = OP_TYPE_LIKE; } break; - case 488: /* compare_op ::= NOT LIKE */ + case 487: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy520 = OP_TYPE_NOT_LIKE; } break; - case 489: /* compare_op ::= MATCH */ + case 488: /* compare_op ::= MATCH */ { yymsp[0].minor.yy520 = OP_TYPE_MATCH; } break; - case 490: /* compare_op ::= NMATCH */ + case 489: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy520 = OP_TYPE_NMATCH; } break; - case 491: /* compare_op ::= CONTAINS */ + case 490: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy520 = OP_TYPE_JSON_CONTAINS; } break; - case 492: /* in_op ::= IN */ + case 491: /* in_op ::= IN */ { yymsp[0].minor.yy520 = OP_TYPE_IN; } break; - case 493: /* in_op ::= NOT IN */ + case 492: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy520 = OP_TYPE_NOT_IN; } break; - case 494: /* in_predicate_value ::= NK_LP literal_list NK_RP */ + case 493: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 496: /* boolean_value_expression ::= NOT boolean_primary */ + case 495: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy952), NULL)); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 497: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 496: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -5997,7 +5990,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 498: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 497: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); @@ -6005,43 +5998,43 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 506: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 505: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy952 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, NULL); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 509: /* table_primary ::= table_name alias_opt */ + case 508: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy952 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 510: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 509: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy952 = createRealTableNode(pCxt, &yymsp[-3].minor.yy169, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 511: /* table_primary ::= subquery alias_opt */ + case 510: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy952 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952), &yymsp[0].minor.yy169); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 513: /* alias_opt ::= */ + case 512: /* alias_opt ::= */ { yymsp[1].minor.yy169 = nil_token; } break; - case 515: /* alias_opt ::= AS table_alias */ + case 514: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy169 = yymsp[0].minor.yy169; } break; - case 516: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 517: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==517); + case 515: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 516: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==516); { yymsp[-2].minor.yy952 = yymsp[-1].minor.yy952; } break; - case 518: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 517: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy952 = createJoinTableNode(pCxt, yymsp[-4].minor.yy932, yymsp[-5].minor.yy952, yymsp[-2].minor.yy952, yymsp[0].minor.yy952); } yymsp[-5].minor.yy952 = yylhsminor.yy952; break; - case 519: /* join_type ::= */ + case 518: /* join_type ::= */ { yymsp[1].minor.yy932 = JOIN_TYPE_INNER; } break; - case 520: /* join_type ::= INNER */ + case 519: /* join_type ::= INNER */ { yymsp[0].minor.yy932 = JOIN_TYPE_INNER; } break; - case 521: /* query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 520: /* query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { yymsp[-13].minor.yy952 = createSelectStmt(pCxt, yymsp[-10].minor.yy957, yymsp[-9].minor.yy824, yymsp[-8].minor.yy952, yymsp[-12].minor.yy824); yymsp[-13].minor.yy952 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy952, yymsp[-11].minor.yy957); @@ -6055,92 +6048,92 @@ static YYACTIONTYPE yy_reduce( yymsp[-13].minor.yy952 = addFillClause(pCxt, yymsp[-13].minor.yy952, yymsp[-3].minor.yy952); } break; - case 522: /* hint_list ::= */ + case 521: /* hint_list ::= */ { yymsp[1].minor.yy824 = createHintNodeList(pCxt, NULL); } break; - case 523: /* hint_list ::= NK_HINT */ + case 522: /* hint_list ::= NK_HINT */ { yylhsminor.yy824 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy824 = yylhsminor.yy824; break; - case 528: /* set_quantifier_opt ::= ALL */ + case 527: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy957 = false; } break; - case 531: /* select_item ::= NK_STAR */ + case 530: /* select_item ::= NK_STAR */ { yylhsminor.yy952 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy952 = yylhsminor.yy952; break; - case 533: /* select_item ::= common_expression column_alias */ - case 543: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==543); + case 532: /* select_item ::= common_expression column_alias */ + case 542: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==542); { yylhsminor.yy952 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952), &yymsp[0].minor.yy169); } yymsp[-1].minor.yy952 = yylhsminor.yy952; break; - case 534: /* select_item ::= common_expression AS column_alias */ - case 544: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==544); + case 533: /* select_item ::= common_expression AS column_alias */ + case 543: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==543); { yylhsminor.yy952 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), &yymsp[0].minor.yy169); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 539: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 564: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==564); - case 584: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==584); + case 538: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 563: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==563); + case 583: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==583); { yymsp[-2].minor.yy824 = yymsp[0].minor.yy824; } break; - case 546: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 545: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy952 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } break; - case 547: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + case 546: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy952 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } break; - case 548: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 547: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy952 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), NULL, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } break; - case 549: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 548: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy952 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy952), releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } break; - case 550: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + case 549: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ { yymsp[-6].minor.yy952 = createEventWindowNode(pCxt, yymsp[-3].minor.yy952, yymsp[0].minor.yy952); } break; - case 554: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 553: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy952 = createFillNode(pCxt, yymsp[-1].minor.yy214, NULL); } break; - case 555: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + case 554: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy952 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); } break; - case 556: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + case 555: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy952 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); } break; - case 557: /* fill_mode ::= NONE */ + case 556: /* fill_mode ::= NONE */ { yymsp[0].minor.yy214 = FILL_MODE_NONE; } break; - case 558: /* fill_mode ::= PREV */ + case 557: /* fill_mode ::= PREV */ { yymsp[0].minor.yy214 = FILL_MODE_PREV; } break; - case 559: /* fill_mode ::= NULL */ + case 558: /* fill_mode ::= NULL */ { yymsp[0].minor.yy214 = FILL_MODE_NULL; } break; - case 560: /* fill_mode ::= NULL_F */ + case 559: /* fill_mode ::= NULL_F */ { yymsp[0].minor.yy214 = FILL_MODE_NULL_F; } break; - case 561: /* fill_mode ::= LINEAR */ + case 560: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy214 = FILL_MODE_LINEAR; } break; - case 562: /* fill_mode ::= NEXT */ + case 561: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy214 = FILL_MODE_NEXT; } break; - case 565: /* group_by_list ::= expr_or_subquery */ + case 564: /* group_by_list ::= expr_or_subquery */ { yylhsminor.yy824 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } yymsp[0].minor.yy824 = yylhsminor.yy824; break; - case 566: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + case 565: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } yymsp[-2].minor.yy824 = yylhsminor.yy824; break; - case 570: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + case 569: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ { yymsp[-5].minor.yy952 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } break; - case 571: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + case 570: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy952 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } break; - case 574: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 573: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy952 = addOrderByClause(pCxt, yymsp[-3].minor.yy952, yymsp[-2].minor.yy824); yylhsminor.yy952 = addSlimitClause(pCxt, yylhsminor.yy952, yymsp[-1].minor.yy952); @@ -6148,50 +6141,50 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 577: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + case 576: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ { yylhsminor.yy952 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy952, yymsp[0].minor.yy952); } yymsp[-3].minor.yy952 = yylhsminor.yy952; break; - case 578: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + case 577: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ { yylhsminor.yy952 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy952, yymsp[0].minor.yy952); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 586: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 590: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==590); + case 585: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 589: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==589); { yymsp[-1].minor.yy952 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 587: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 591: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==591); + case 586: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 590: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==590); { yymsp[-3].minor.yy952 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 588: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 592: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==592); + case 587: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 591: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==591); { yymsp[-3].minor.yy952 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 593: /* subquery ::= NK_LP query_expression NK_RP */ + case 592: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy952); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 598: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + case 597: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ { yylhsminor.yy952 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), yymsp[-1].minor.yy498, yymsp[0].minor.yy977); } yymsp[-2].minor.yy952 = yylhsminor.yy952; break; - case 599: /* ordering_specification_opt ::= */ + case 598: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy498 = ORDER_ASC; } break; - case 600: /* ordering_specification_opt ::= ASC */ + case 599: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy498 = ORDER_ASC; } break; - case 601: /* ordering_specification_opt ::= DESC */ + case 600: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy498 = ORDER_DESC; } break; - case 602: /* null_ordering_opt ::= */ + case 601: /* null_ordering_opt ::= */ { yymsp[1].minor.yy977 = NULL_ORDER_DEFAULT; } break; - case 603: /* null_ordering_opt ::= NULLS FIRST */ + case 602: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy977 = NULL_ORDER_FIRST; } break; - case 604: /* null_ordering_opt ::= NULLS LAST */ + case 603: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy977 = NULL_ORDER_LAST; } break; default: diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index 0482a76bdd..4ef323db22 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -210,18 +210,6 @@ class TDTestCase: licences_info = tdSql.queryResult tdSql.checkEqual(grants_info,licences_info) - def show_create_table_with_col_comment(self): - tdSql.execute("create database comment_test_db") - tdSql.execute("use comment_test_db") - tdSql.execute("create table normal_table(ts timestamp, c2 int comment 'c2 comment')") - tdSql.execute("create stable super_table(ts timestamp comment 'ts', c2 int comment 'c2 comment') tags(tg int comment 'tg comment')") - tdSql.query('show create table normal_table') - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int)" - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - tdSql.query('show create table super_table') - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int) tags (`tg` int)" - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - def run(self): self.check_gitinfo() self.show_base() @@ -230,7 +218,6 @@ class TDTestCase: self.show_create_sql() self.show_create_sysdb_sql() self.show_create_systb_sql() - self.show_create_table_with_col_comment() def stop(self): tdSql.close() From 0c768f5beb699b021356d3403e3f7579e4c5a7ec Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 24 Aug 2023 14:02:25 +0800 Subject: [PATCH 051/107] fix(file/stat): fix atime --- source/os/src/osFile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index c4309b2c55..a32417b24a 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -212,7 +212,7 @@ int32_t taosStatFile(const char *path, int64_t *size, int32_t *mtime, int32_t *a } if (atime != NULL) { - *atime = fileStat.st_mtime; + *atime = fileStat.st_atime; } return 0; From f6dbd0b0e40318a78212e5fdc8a08985579093e3 Mon Sep 17 00:00:00 2001 From: slzhou Date: Thu, 24 Aug 2023 14:03:40 +0800 Subject: [PATCH 052/107] fix: select distinct/all tags instead of select tags distinct --- include/common/ttokendef.h | 4 +- source/libs/parser/inc/sql.y | 2 +- source/libs/parser/src/sql.c | 1432 +++++++++++++++++++++++++++++++--- 3 files changed, 1311 insertions(+), 127 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 42b9bc8939..23329154a2 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,6 +16,7 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ + #define TK_OR 1 #define TK_AND 2 #define TK_UNION 3 @@ -356,9 +357,6 @@ #define TK_WAL 338 - - - #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 #define TK_NK_ILLEGAL 602 diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 2501ae8504..1e9e1f8306 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -1009,7 +1009,7 @@ join_type(A) ::= INNER. /************************************************ query_specification *************************************************/ query_specification(A) ::= - SELECT hint_list(M) tag_mode_opt(N) set_quantifier_opt(B) select_list(C) from_clause_opt(D) + SELECT hint_list(M) set_quantifier_opt(B) tag_mode_opt(N) select_list(C) from_clause_opt(D) where_clause_opt(E) partition_by_clause_opt(F) range_opt(J) every_opt(K) fill_opt(L) twindow_clause_opt(G) group_by_clause_opt(H) having_clause_opt(I). { A = createSelectStmt(pCxt, B, C, D, M); diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a19b986732..d4b84aec81 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,3 +1,5 @@ +/* This file is automatically generated by Lemon from input grammar +** source file "sql.y". */ /* ** 2000-05-29 ** @@ -22,9 +24,8 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ -#include -#include /************ Begin %include sections from the grammar ************************/ +#line 11 "sql.y" #include #include @@ -41,12 +42,351 @@ #include "parAst.h" #define YYSTACKDEPTH 0 +#line 46 "sql.c" /**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols -** in a format understandable to "makeheaders". This section is blank unless -** "lemon" is run with the "-m" command-line option. -***************** Begin makeheaders token definitions *************************/ -/**************** End makeheaders token definitions ***************************/ +/* These constants specify the various numeric values for terminal symbols. +***************** Begin token definitions *************************************/ +#ifndef TK_OR +#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_USER 33 +#define TK_ENABLE 34 +#define TK_NK_INTEGER 35 +#define TK_SYSINFO 36 +#define TK_DROP 37 +#define TK_GRANT 38 +#define TK_ON 39 +#define TK_TO 40 +#define TK_REVOKE 41 +#define TK_FROM 42 +#define TK_SUBSCRIBE 43 +#define TK_NK_COMMA 44 +#define TK_READ 45 +#define TK_WRITE 46 +#define TK_NK_DOT 47 +#define TK_WITH 48 +#define TK_DNODE 49 +#define TK_PORT 50 +#define TK_DNODES 51 +#define TK_RESTORE 52 +#define TK_NK_IPTOKEN 53 +#define TK_FORCE 54 +#define TK_UNSAFE 55 +#define TK_LOCAL 56 +#define TK_QNODE 57 +#define TK_BNODE 58 +#define TK_SNODE 59 +#define TK_MNODE 60 +#define TK_VNODE 61 +#define TK_DATABASE 62 +#define TK_USE 63 +#define TK_FLUSH 64 +#define TK_TRIM 65 +#define TK_COMPACT 66 +#define TK_IF 67 +#define TK_NOT 68 +#define TK_EXISTS 69 +#define TK_BUFFER 70 +#define TK_CACHEMODEL 71 +#define TK_CACHESIZE 72 +#define TK_COMP 73 +#define TK_DURATION 74 +#define TK_NK_VARIABLE 75 +#define TK_MAXROWS 76 +#define TK_MINROWS 77 +#define TK_KEEP 78 +#define TK_PAGES 79 +#define TK_PAGESIZE 80 +#define TK_TSDB_PAGESIZE 81 +#define TK_PRECISION 82 +#define TK_REPLICA 83 +#define TK_VGROUPS 84 +#define TK_SINGLE_STABLE 85 +#define TK_RETENTIONS 86 +#define TK_SCHEMALESS 87 +#define TK_WAL_LEVEL 88 +#define TK_WAL_FSYNC_PERIOD 89 +#define TK_WAL_RETENTION_PERIOD 90 +#define TK_WAL_RETENTION_SIZE 91 +#define TK_WAL_ROLL_PERIOD 92 +#define TK_WAL_SEGMENT_SIZE 93 +#define TK_STT_TRIGGER 94 +#define TK_TABLE_PREFIX 95 +#define TK_TABLE_SUFFIX 96 +#define TK_NK_COLON 97 +#define TK_MAX_SPEED 98 +#define TK_START 99 +#define TK_TIMESTAMP 100 +#define TK_END 101 +#define TK_TABLE 102 +#define TK_NK_LP 103 +#define TK_NK_RP 104 +#define TK_STABLE 105 +#define TK_ADD 106 +#define TK_COLUMN 107 +#define TK_MODIFY 108 +#define TK_RENAME 109 +#define TK_TAG 110 +#define TK_SET 111 +#define TK_NK_EQ 112 +#define TK_USING 113 +#define TK_TAGS 114 +#define TK_COMMENT 115 +#define TK_BOOL 116 +#define TK_TINYINT 117 +#define TK_SMALLINT 118 +#define TK_INT 119 +#define TK_INTEGER 120 +#define TK_BIGINT 121 +#define TK_FLOAT 122 +#define TK_DOUBLE 123 +#define TK_BINARY 124 +#define TK_NCHAR 125 +#define TK_UNSIGNED 126 +#define TK_JSON 127 +#define TK_VARCHAR 128 +#define TK_MEDIUMBLOB 129 +#define TK_BLOB 130 +#define TK_VARBINARY 131 +#define TK_GEOMETRY 132 +#define TK_DECIMAL 133 +#define TK_MAX_DELAY 134 +#define TK_WATERMARK 135 +#define TK_ROLLUP 136 +#define TK_TTL 137 +#define TK_SMA 138 +#define TK_DELETE_MARK 139 +#define TK_FIRST 140 +#define TK_LAST 141 +#define TK_SHOW 142 +#define TK_PRIVILEGES 143 +#define TK_DATABASES 144 +#define TK_TABLES 145 +#define TK_STABLES 146 +#define TK_MNODES 147 +#define TK_QNODES 148 +#define TK_FUNCTIONS 149 +#define TK_INDEXES 150 +#define TK_ACCOUNTS 151 +#define TK_APPS 152 +#define TK_CONNECTIONS 153 +#define TK_LICENCES 154 +#define TK_GRANTS 155 +#define TK_QUERIES 156 +#define TK_SCORES 157 +#define TK_TOPICS 158 +#define TK_VARIABLES 159 +#define TK_CLUSTER 160 +#define TK_BNODES 161 +#define TK_SNODES 162 +#define TK_TRANSACTIONS 163 +#define TK_DISTRIBUTED 164 +#define TK_CONSUMERS 165 +#define TK_SUBSCRIPTIONS 166 +#define TK_VNODES 167 +#define TK_ALIVE 168 +#define TK_LIKE 169 +#define TK_TBNAME 170 +#define TK_QTAGS 171 +#define TK_AS 172 +#define TK_INDEX 173 +#define TK_FUNCTION 174 +#define TK_INTERVAL 175 +#define TK_COUNT 176 +#define TK_LAST_ROW 177 +#define TK_META 178 +#define TK_ONLY 179 +#define TK_TOPIC 180 +#define TK_CONSUMER 181 +#define TK_GROUP 182 +#define TK_DESC 183 +#define TK_DESCRIBE 184 +#define TK_RESET 185 +#define TK_QUERY 186 +#define TK_CACHE 187 +#define TK_EXPLAIN 188 +#define TK_ANALYZE 189 +#define TK_VERBOSE 190 +#define TK_NK_BOOL 191 +#define TK_RATIO 192 +#define TK_NK_FLOAT 193 +#define TK_OUTPUTTYPE 194 +#define TK_AGGREGATE 195 +#define TK_BUFSIZE 196 +#define TK_LANGUAGE 197 +#define TK_REPLACE 198 +#define TK_STREAM 199 +#define TK_INTO 200 +#define TK_PAUSE 201 +#define TK_RESUME 202 +#define TK_TRIGGER 203 +#define TK_AT_ONCE 204 +#define TK_WINDOW_CLOSE 205 +#define TK_IGNORE 206 +#define TK_EXPIRED 207 +#define TK_FILL_HISTORY 208 +#define TK_UPDATE 209 +#define TK_SUBTABLE 210 +#define TK_UNTREATED 211 +#define TK_KILL 212 +#define TK_CONNECTION 213 +#define TK_TRANSACTION 214 +#define TK_BALANCE 215 +#define TK_VGROUP 216 +#define TK_LEADER 217 +#define TK_MERGE 218 +#define TK_REDISTRIBUTE 219 +#define TK_SPLIT 220 +#define TK_DELETE 221 +#define TK_INSERT 222 +#define TK_NULL 223 +#define TK_NK_QUESTION 224 +#define TK_NK_ARROW 225 +#define TK_ROWTS 226 +#define TK_QSTART 227 +#define TK_QEND 228 +#define TK_QDURATION 229 +#define TK_WSTART 230 +#define TK_WEND 231 +#define TK_WDURATION 232 +#define TK_IROWTS 233 +#define TK_ISFILLED 234 +#define TK_CAST 235 +#define TK_NOW 236 +#define TK_TODAY 237 +#define TK_TIMEZONE 238 +#define TK_CLIENT_VERSION 239 +#define TK_SERVER_VERSION 240 +#define TK_SERVER_STATUS 241 +#define TK_CURRENT_USER 242 +#define TK_CASE 243 +#define TK_WHEN 244 +#define TK_THEN 245 +#define TK_ELSE 246 +#define TK_BETWEEN 247 +#define TK_IS 248 +#define TK_NK_LT 249 +#define TK_NK_GT 250 +#define TK_NK_LE 251 +#define TK_NK_GE 252 +#define TK_NK_NE 253 +#define TK_MATCH 254 +#define TK_NMATCH 255 +#define TK_CONTAINS 256 +#define TK_IN 257 +#define TK_JOIN 258 +#define TK_INNER 259 +#define TK_SELECT 260 +#define TK_NK_HINT 261 +#define TK_DISTINCT 262 +#define TK_WHERE 263 +#define TK_PARTITION 264 +#define TK_BY 265 +#define TK_SESSION 266 +#define TK_STATE_WINDOW 267 +#define TK_EVENT_WINDOW 268 +#define TK_SLIDING 269 +#define TK_FILL 270 +#define TK_VALUE 271 +#define TK_VALUE_F 272 +#define TK_NONE 273 +#define TK_PREV 274 +#define TK_NULL_F 275 +#define TK_LINEAR 276 +#define TK_NEXT 277 +#define TK_HAVING 278 +#define TK_RANGE 279 +#define TK_EVERY 280 +#define TK_ORDER 281 +#define TK_SLIMIT 282 +#define TK_SOFFSET 283 +#define TK_LIMIT 284 +#define TK_OFFSET 285 +#define TK_ASC 286 +#define TK_NULLS 287 +#define TK_ABORT 288 +#define TK_AFTER 289 +#define TK_ATTACH 290 +#define TK_BEFORE 291 +#define TK_BEGIN 292 +#define TK_BITAND 293 +#define TK_BITNOT 294 +#define TK_BITOR 295 +#define TK_BLOCKS 296 +#define TK_CHANGE 297 +#define TK_COMMA 298 +#define TK_CONCAT 299 +#define TK_CONFLICT 300 +#define TK_COPY 301 +#define TK_DEFERRED 302 +#define TK_DELIMITERS 303 +#define TK_DETACH 304 +#define TK_DIVIDE 305 +#define TK_DOT 306 +#define TK_EACH 307 +#define TK_FAIL 308 +#define TK_FILE 309 +#define TK_FOR 310 +#define TK_GLOB 311 +#define TK_ID 312 +#define TK_IMMEDIATE 313 +#define TK_IMPORT 314 +#define TK_INITIALLY 315 +#define TK_INSTEAD 316 +#define TK_ISNULL 317 +#define TK_KEY 318 +#define TK_MODULES 319 +#define TK_NK_BITNOT 320 +#define TK_NK_SEMI 321 +#define TK_NOTNULL 322 +#define TK_OF 323 +#define TK_PLUS 324 +#define TK_PRIVILEGE 325 +#define TK_RAISE 326 +#define TK_RESTRICT 327 +#define TK_ROW 328 +#define TK_SEMI 329 +#define TK_STAR 330 +#define TK_STATEMENT 331 +#define TK_STRICT 332 +#define TK_STRING 333 +#define TK_TIMES 334 +#define TK_VALUES 335 +#define TK_VARIABLE 336 +#define TK_VIEW 337 +#define TK_WAL 338 +#endif +/**************** End token definitions ***************************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -358,8 +698,8 @@ static const YYACTIONTYPE yy_action[] = { /* 1350 */ 2220, 64, 395, 2286, 14, 13, 2324, 1525, 50, 50, /* 1360 */ 667, 2170, 281, 705, 1528, 713, 1276, 750, 156, 1739, /* 1370 */ 1738, 108, 158, 268, 2202, 671, 138, 659, 156, 751, - /* 1380 */ 278, 105, 1482, 5, 706, 297, 2359, 681, 301, 1294, - /* 1390 */ 1359, 662, 415, 1, 363, 792, 420, 2201, 1590, 2237, + /* 1380 */ 278, 105, 1482, 285, 706, 297, 2359, 681, 301, 1294, + /* 1390 */ 1359, 662, 5, 415, 363, 792, 420, 2201, 1590, 2237, /* 1400 */ 2202, 1292, 112, 2203, 709, 2205, 2206, 704, 437, 699, /* 1410 */ 706, 1677, 2309, 2220, 2386, 195, 2290, 436, 1626, 317, /* 1420 */ 395, 2286, 196, 439, 2170, 1388, 705, 1661, 1392, 1506, @@ -367,8 +707,8 @@ static const YYACTIONTYPE yy_action[] = { /* 1440 */ 457, 1587, 2080, 461, 463, 706, 498, 1582, 468, 488, /* 1450 */ 2170, 481, 705, 2072, 490, 506, 497, 499, 508, 509, /* 1460 */ 2201, 214, 2237, 511, 213, 112, 2203, 709, 2205, 2206, - /* 1470 */ 704, 1588, 699, 216, 2220, 1570, 512, 2386, 514, 2290, - /* 1480 */ 516, 531, 4, 395, 2286, 2170, 2201, 705, 2237, 532, + /* 1470 */ 704, 216, 699, 514, 2220, 1570, 512, 2386, 516, 2290, + /* 1480 */ 1588, 531, 4, 395, 2286, 2170, 2201, 705, 2237, 532, /* 1490 */ 539, 112, 2203, 709, 2205, 2206, 704, 540, 699, 542, /* 1500 */ 224, 408, 407, 2386, 2202, 2290, 1585, 543, 226, 395, /* 1510 */ 2286, 1573, 1589, 544, 706, 1591, 229, 545, 547, 231, @@ -384,19 +724,19 @@ static const YYACTIONTYPE yy_action[] = { /* 1610 */ 634, 274, 632, 395, 2286, 275, 631, 2170, 2201, 705, /* 1620 */ 2237, 277, 276, 112, 2203, 709, 2205, 2206, 704, 1703, /* 1630 */ 699, 386, 2389, 663, 280, 692, 2365, 2290, 1586, 143, - /* 1640 */ 660, 395, 2286, 1708, 2306, 1706, 178, 287, 1592, 191, - /* 1650 */ 98, 2085, 314, 2201, 2202, 2237, 285, 315, 113, 2203, - /* 1660 */ 709, 2205, 2206, 704, 706, 699, 677, 678, 2099, 100, - /* 1670 */ 682, 2098, 2290, 61, 683, 316, 694, 2286, 102, 1969, - /* 1680 */ 1574, 2271, 1569, 104, 2202, 711, 1931, 2097, 319, 391, - /* 1690 */ 2014, 793, 796, 2220, 706, 794, 308, 328, 321, 342, - /* 1700 */ 332, 53, 323, 343, 2170, 2162, 705, 2161, 355, 2160, - /* 1710 */ 356, 78, 1577, 1579, 2157, 417, 418, 1550, 1551, 194, + /* 1640 */ 660, 395, 2286, 1708, 2306, 1706, 178, 287, 1592, 2085, + /* 1650 */ 1, 677, 314, 2201, 2202, 2237, 191, 98, 113, 2203, + /* 1660 */ 709, 2205, 2206, 704, 706, 699, 678, 2099, 2098, 315, + /* 1670 */ 682, 2097, 2290, 316, 683, 100, 694, 2286, 102, 1969, + /* 1680 */ 1574, 61, 1569, 2271, 2202, 104, 711, 391, 1931, 319, + /* 1690 */ 2014, 793, 796, 2220, 706, 308, 794, 328, 321, 342, + /* 1700 */ 355, 53, 323, 343, 2170, 332, 705, 2162, 356, 2161, + /* 1710 */ 2160, 78, 1577, 1579, 2157, 417, 418, 1550, 1551, 194, /* 1720 */ 422, 2155, 424, 2220, 425, 697, 1633, 1634, 1636, 1637, /* 1730 */ 1638, 1639, 426, 2154, 2170, 364, 705, 2152, 430, 2151, /* 1740 */ 707, 432, 2237, 434, 1541, 113, 2203, 709, 2205, 2206, /* 1750 */ 704, 2150, 699, 2131, 197, 2202, 2130, 199, 1509, 2290, - /* 1760 */ 79, 2112, 1508, 358, 2286, 706, 2111, 2110, 446, 447, + /* 1760 */ 79, 1508, 2112, 358, 2286, 706, 2111, 2110, 446, 447, /* 1770 */ 2201, 2109, 2237, 2108, 1459, 170, 2203, 709, 2205, 2206, /* 1780 */ 704, 2062, 699, 452, 453, 2059, 2058, 201, 82, 2057, /* 1790 */ 2056, 2061, 204, 2060, 2220, 2055, 2054, 2052, 383, 2051, @@ -656,8 +996,8 @@ static const YYCODETYPE yy_lookahead[] = { /* 1350 */ 381, 44, 451, 452, 1, 2, 402, 104, 44, 44, /* 1360 */ 461, 392, 481, 394, 104, 44, 75, 13, 44, 104, /* 1370 */ 104, 103, 44, 104, 342, 104, 44, 283, 44, 13, - /* 1380 */ 453, 113, 104, 263, 352, 104, 354, 104, 104, 35, - /* 1390 */ 104, 285, 413, 465, 429, 50, 49, 428, 20, 430, + /* 1380 */ 453, 113, 104, 464, 352, 104, 354, 104, 104, 35, + /* 1390 */ 104, 285, 263, 413, 429, 50, 49, 428, 20, 430, /* 1400 */ 342, 35, 433, 434, 435, 436, 437, 438, 422, 440, /* 1410 */ 352, 104, 354, 381, 445, 427, 447, 206, 104, 104, /* 1420 */ 451, 452, 360, 422, 392, 104, 394, 223, 104, 189, @@ -665,8 +1005,8 @@ static const YYCODETYPE yy_lookahead[] = { /* 1440 */ 399, 20, 402, 352, 399, 352, 169, 20, 397, 352, /* 1450 */ 392, 351, 394, 351, 399, 99, 397, 397, 101, 364, /* 1460 */ 428, 351, 430, 98, 363, 433, 434, 435, 436, 437, - /* 1470 */ 438, 20, 440, 351, 381, 193, 362, 445, 351, 447, - /* 1480 */ 351, 344, 48, 451, 452, 392, 428, 394, 430, 348, + /* 1470 */ 438, 351, 440, 351, 381, 193, 362, 445, 351, 447, + /* 1480 */ 20, 344, 48, 451, 452, 392, 428, 394, 430, 348, /* 1490 */ 344, 433, 434, 435, 436, 437, 438, 348, 440, 422, /* 1500 */ 360, 12, 13, 445, 342, 447, 20, 394, 360, 451, /* 1510 */ 452, 22, 20, 353, 352, 20, 360, 414, 353, 360, @@ -682,19 +1022,19 @@ static const YYCODETYPE yy_lookahead[] = { /* 1610 */ 280, 469, 279, 451, 452, 468, 264, 392, 428, 394, /* 1620 */ 430, 413, 467, 433, 434, 435, 436, 437, 438, 259, /* 1630 */ 440, 287, 489, 284, 482, 445, 483, 447, 20, 352, - /* 1640 */ 282, 451, 452, 114, 432, 261, 353, 358, 20, 464, - /* 1650 */ 358, 405, 407, 428, 342, 430, 463, 407, 433, 434, - /* 1660 */ 435, 436, 437, 438, 352, 440, 392, 392, 392, 358, - /* 1670 */ 174, 392, 447, 103, 404, 376, 451, 452, 358, 352, - /* 1680 */ 191, 450, 193, 103, 342, 384, 370, 392, 351, 392, - /* 1690 */ 392, 36, 344, 381, 352, 345, 358, 374, 359, 374, - /* 1700 */ 374, 416, 340, 423, 392, 0, 394, 0, 408, 0, - /* 1710 */ 408, 42, 223, 224, 0, 35, 216, 35, 35, 35, + /* 1640 */ 282, 451, 452, 114, 432, 261, 353, 358, 20, 405, + /* 1650 */ 465, 392, 407, 428, 342, 430, 463, 358, 433, 434, + /* 1660 */ 435, 436, 437, 438, 352, 440, 392, 392, 392, 407, + /* 1670 */ 174, 392, 447, 376, 404, 358, 451, 452, 358, 352, + /* 1680 */ 191, 103, 193, 450, 342, 103, 384, 392, 370, 351, + /* 1690 */ 392, 36, 344, 381, 352, 358, 345, 374, 359, 374, + /* 1700 */ 408, 416, 340, 423, 392, 374, 394, 0, 408, 0, + /* 1710 */ 0, 42, 223, 224, 0, 35, 216, 35, 35, 35, /* 1720 */ 216, 0, 35, 381, 35, 236, 237, 238, 239, 240, /* 1730 */ 241, 242, 216, 0, 392, 216, 394, 0, 35, 0, /* 1740 */ 428, 22, 430, 35, 211, 433, 434, 435, 436, 437, /* 1750 */ 438, 0, 440, 0, 199, 342, 0, 199, 193, 447, - /* 1760 */ 200, 0, 191, 451, 452, 352, 0, 0, 187, 186, + /* 1760 */ 200, 191, 0, 451, 452, 352, 0, 0, 187, 186, /* 1770 */ 428, 0, 430, 0, 47, 433, 434, 435, 436, 437, /* 1780 */ 438, 0, 440, 35, 49, 0, 0, 47, 42, 0, /* 1790 */ 0, 0, 47, 0, 381, 0, 0, 0, 385, 0, @@ -872,19 +1212,19 @@ static const unsigned short int yy_shift_ofst[] = { /* 160 */ 315, 288, 344, 28, 28, 28, 28, 2031, 448, 225, /* 170 */ 371, 30, 481, 32, 130, 602, 602, 870, 568, 971, /* 180 */ 973, 1019, 1168, 826, 656, 1087, 1003, 1008, 641, 1003, - /* 190 */ 1012, 957, 1116, 1120, 1347, 1378, 1211, 181, 1378, 181, + /* 190 */ 1012, 957, 1116, 1129, 1347, 1378, 1211, 181, 1378, 181, /* 200 */ 1240, 1414, 1395, 1421, 1414, 1395, 1277, 1427, 1414, 1427, /* 210 */ 1395, 1277, 1277, 1357, 1356, 1427, 1365, 1427, 1427, 1427, - /* 220 */ 1451, 1434, 1451, 1434, 1378, 181, 1486, 181, 1492, 1495, - /* 230 */ 181, 1492, 181, 181, 181, 1427, 181, 1451, 35, 35, - /* 240 */ 35, 35, 35, 35, 35, 1427, 1451, 315, 315, 315, - /* 250 */ 1340, 1457, 1378, 247, 1368, 1372, 1486, 247, 1374, 1120, + /* 220 */ 1460, 1434, 1460, 1434, 1378, 181, 1486, 181, 1492, 1495, + /* 230 */ 181, 1492, 181, 181, 181, 1427, 181, 1460, 35, 35, + /* 240 */ 35, 35, 35, 35, 35, 1427, 1460, 315, 315, 315, + /* 250 */ 1340, 1457, 1378, 247, 1368, 1372, 1486, 247, 1374, 1129, /* 260 */ 1427, 1421, 1421, 315, 1308, 1310, 315, 1308, 1310, 315, - /* 270 */ 315, 35, 1313, 1411, 1308, 1330, 1333, 1352, 1120, 1344, + /* 270 */ 315, 35, 1313, 1411, 1308, 1330, 1333, 1352, 1129, 1344, /* 280 */ 1349, 1358, 1370, 1414, 1618, 1529, 1384, 1492, 247, 247, /* 290 */ 1628, 1310, 315, 315, 315, 315, 315, 1310, 315, 1496, - /* 300 */ 247, 288, 247, 1414, 1570, 1580, 315, 344, 1427, 247, - /* 310 */ 1655, 1451, 2957, 2957, 2957, 2957, 2957, 2957, 2957, 2957, + /* 300 */ 247, 288, 247, 1414, 1578, 1582, 315, 344, 1427, 247, + /* 310 */ 1655, 1460, 2957, 2957, 2957, 2957, 2957, 2957, 2957, 2957, /* 320 */ 2957, 1002, 930, 259, 646, 419, 718, 815, 721, 1036, /* 330 */ 1107, 1050, 837, 1164, 1164, 1164, 1164, 1164, 1164, 1164, /* 340 */ 1164, 1164, 821, 1046, 968, 968, 297, 160, 319, 550, @@ -894,10 +1234,10 @@ static const unsigned short int yy_shift_ofst[] = { /* 380 */ 1253, 1260, 1209, 1265, 1266, 1269, 1179, 1094, 1106, 1271, /* 390 */ 1278, 1281, 1283, 1284, 1286, 1353, 1307, 1204, 1314, 918, /* 400 */ 1315, 1321, 1324, 1328, 1332, 1334, 1268, 1151, 1282, 1354, - /* 410 */ 1366, 1291, 1345, 1705, 1707, 1709, 1669, 1714, 1680, 1500, + /* 410 */ 1366, 1291, 1345, 1707, 1709, 1710, 1669, 1714, 1680, 1500, /* 420 */ 1682, 1683, 1684, 1504, 1721, 1687, 1689, 1516, 1733, 1519, /* 430 */ 1737, 1703, 1739, 1719, 1751, 1708, 1533, 1753, 1555, 1756, - /* 440 */ 1558, 1560, 1565, 1571, 1761, 1766, 1767, 1581, 1583, 1771, + /* 440 */ 1558, 1560, 1565, 1570, 1762, 1766, 1767, 1581, 1583, 1771, /* 450 */ 1773, 1727, 1781, 1748, 1735, 1785, 1740, 1786, 1746, 1789, /* 460 */ 1790, 1791, 1745, 1793, 1795, 1796, 1797, 1799, 1800, 1642, /* 470 */ 1768, 1802, 1645, 1806, 1808, 1809, 1810, 1811, 1812, 1814, @@ -958,19 +1298,19 @@ static const short yy_reduce_ofst[] = { /* 160 */ 543, 657, 735, -388, -367, 218, -388, 245, 431, 464, /* 170 */ 430, 377, 414, 565, 523, 693, 956, 888, 614, 888, /* 180 */ 985, 940, 993, 995, 958, 954, 899, 899, 881, 899, - /* 190 */ 927, 928, 888, 979, 965, 986, 988, 1062, 1001, 1070, + /* 190 */ 927, 919, 888, 980, 965, 986, 988, 1062, 1001, 1070, /* 200 */ 1016, 1081, 1041, 1040, 1091, 1045, 1051, 1100, 1097, 1102, - /* 210 */ 1055, 1059, 1060, 1095, 1101, 1110, 1114, 1122, 1127, 1129, + /* 210 */ 1055, 1059, 1060, 1095, 1101, 1110, 1114, 1120, 1122, 1127, /* 220 */ 1137, 1141, 1146, 1149, 1077, 1140, 1113, 1148, 1160, 1103, /* 230 */ 1156, 1165, 1159, 1174, 1175, 1169, 1176, 1181, 1158, 1166, /* 240 */ 1167, 1171, 1172, 1177, 1178, 1186, 1197, 1154, 1157, 1163, /* 250 */ 1131, 1138, 1139, 1205, 1145, 1150, 1180, 1214, 1182, 1170, /* 260 */ 1222, 1173, 1183, 1184, 1117, 1187, 1188, 1118, 1201, 1189, /* 270 */ 1194, 888, 1130, 1132, 1135, 1142, 1147, 1155, 1208, 1143, - /* 280 */ 1153, 1152, 899, 1287, 1212, 1185, 1193, 1293, 1289, 1292, - /* 290 */ 1246, 1245, 1274, 1275, 1276, 1279, 1295, 1250, 1297, 1270, - /* 300 */ 1311, 1299, 1320, 1327, 1231, 1301, 1298, 1316, 1337, 1338, - /* 310 */ 1350, 1348, 1285, 1280, 1300, 1302, 1323, 1325, 1326, 1339, + /* 280 */ 1153, 1152, 899, 1287, 1212, 1185, 1193, 1293, 1289, 1299, + /* 290 */ 1244, 1245, 1259, 1274, 1275, 1276, 1279, 1262, 1295, 1270, + /* 300 */ 1317, 1297, 1320, 1327, 1233, 1302, 1298, 1318, 1338, 1337, + /* 310 */ 1351, 1348, 1285, 1280, 1292, 1300, 1323, 1325, 1331, 1339, /* 320 */ 1362, }; static const YYACTIONTYPE yy_default[] = { @@ -1464,6 +1804,7 @@ struct yyParser { }; typedef struct yyParser yyParser; +#include #ifndef NDEBUG #include static FILE *yyTraceFILE = 0; @@ -1964,8 +2305,8 @@ static const char *const yyTokenName[] = { /* 461 */ "join_type", /* 462 */ "query_specification", /* 463 */ "hint_list", - /* 464 */ "tag_mode_opt", - /* 465 */ "set_quantifier_opt", + /* 464 */ "set_quantifier_opt", + /* 465 */ "tag_mode_opt", /* 466 */ "select_list", /* 467 */ "partition_by_clause_opt", /* 468 */ "range_opt", @@ -2518,7 +2859,7 @@ static const char *const yyRuleName[] = { /* 518 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", /* 519 */ "join_type ::=", /* 520 */ "join_type ::= INNER", - /* 521 */ "query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 521 */ "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", /* 522 */ "hint_list ::=", /* 523 */ "hint_list ::= NK_HINT", /* 524 */ "tag_mode_opt ::=", @@ -2803,7 +3144,9 @@ static void yy_destructor( case 485: /* query_simple_or_subquery */ case 487: /* sort_specification */ { +#line 7 "sql.y" nodesDestroyNode((yypminor->yy952)); +#line 3149 "sql.c" } break; case 340: /* account_options */ @@ -2813,7 +3156,9 @@ static void yy_destructor( case 411: /* with_meta */ case 420: /* bufsize_opt */ { +#line 54 "sql.y" +#line 3161 "sql.c" } break; case 344: /* user_name */ @@ -2834,24 +3179,32 @@ static void yy_destructor( case 440: /* noarg_func */ case 458: /* alias_opt */ { +#line 742 "sql.y" +#line 3184 "sql.c" } break; case 345: /* sysinfo_opt */ { +#line 92 "sql.y" +#line 3191 "sql.c" } break; case 346: /* privileges */ case 349: /* priv_type_list */ case 350: /* priv_type */ { +#line 101 "sql.y" +#line 3200 "sql.c" } break; case 347: /* priv_level */ { +#line 117 "sql.y" +#line 3207 "sql.c" } break; case 356: /* force_opt */ @@ -2862,10 +3215,12 @@ static void yy_destructor( case 418: /* or_replace_opt */ case 419: /* agg_func_opt */ case 427: /* ignore_opt */ - case 464: /* tag_mode_opt */ - case 465: /* set_quantifier_opt */ + case 464: /* set_quantifier_opt */ + case 465: /* tag_mode_opt */ { +#line 146 "sql.y" +#line 3223 "sql.c" } break; case 365: /* integer_list */ @@ -2899,44 +3254,60 @@ static void yy_destructor( case 481: /* order_by_clause_opt */ case 486: /* sort_specification_list */ { +#line 270 "sql.y" nodesDestroyList((yypminor->yy824)); +#line 3259 "sql.c" } break; case 369: /* alter_db_option */ case 391: /* alter_table_option */ { +#line 243 "sql.y" +#line 3267 "sql.c" } break; case 388: /* type_name */ { +#line 364 "sql.y" +#line 3274 "sql.c" } break; case 448: /* compare_op */ case 449: /* in_op */ { +#line 930 "sql.y" +#line 3282 "sql.c" } break; case 461: /* join_type */ { +#line 1006 "sql.y" +#line 3289 "sql.c" } break; case 477: /* fill_mode */ { +#line 1092 "sql.y" +#line 3296 "sql.c" } break; case 488: /* ordering_specification_opt */ { +#line 1177 "sql.y" +#line 3303 "sql.c" } break; case 489: /* null_ordering_opt */ { +#line 1183 "sql.y" +#line 3310 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3103,7 +3474,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); return yy_action[i]; } }while(1); @@ -3746,14 +4117,14 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 457, /* (518) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ 461, /* (519) join_type ::= */ 461, /* (520) join_type ::= INNER */ - 462, /* (521) query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 462, /* (521) 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 */ 463, /* (522) hint_list ::= */ 463, /* (523) hint_list ::= NK_HINT */ - 464, /* (524) tag_mode_opt ::= */ - 464, /* (525) tag_mode_opt ::= TAGS */ - 465, /* (526) set_quantifier_opt ::= */ - 465, /* (527) set_quantifier_opt ::= DISTINCT */ - 465, /* (528) set_quantifier_opt ::= ALL */ + 465, /* (524) tag_mode_opt ::= */ + 465, /* (525) tag_mode_opt ::= TAGS */ + 464, /* (526) set_quantifier_opt ::= */ + 464, /* (527) set_quantifier_opt ::= DISTINCT */ + 464, /* (528) set_quantifier_opt ::= ALL */ 466, /* (529) select_list ::= select_item */ 466, /* (530) select_list ::= select_list NK_COMMA select_item */ 474, /* (531) select_item ::= NK_STAR */ @@ -4356,7 +4727,7 @@ static const signed char yyRuleInfoNRhs[] = { -6, /* (518) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ 0, /* (519) join_type ::= */ -1, /* (520) join_type ::= INNER */ - -14, /* (521) query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + -14, /* (521) 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 */ 0, /* (522) hint_list ::= */ -1, /* (523) hint_list ::= NK_HINT */ 0, /* (524) tag_mode_opt ::= */ @@ -4469,54 +4840,6 @@ static YYACTIONTYPE yy_reduce( (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; - if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } - yymsp = yypParser->yytos; - } -#endif - } switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example @@ -4530,15 +4853,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 4858 "sql.c" yy_destructor(yypParser,340,&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 4864 "sql.c" yy_destructor(yypParser,341,&yymsp[0].minor); break; case 2: /* account_options ::= */ +#line 55 "sql.y" { } +#line 4870 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -4550,18 +4879,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,340,&yymsp[-2].minor); +#line 56 "sql.y" { } +#line 4884 "sql.c" yy_destructor(yypParser,342,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ { yy_destructor(yypParser,343,&yymsp[0].minor); +#line 68 "sql.y" { } +#line 4892 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,341,&yymsp[-1].minor); +#line 69 "sql.y" { } +#line 4899 "sql.c" yy_destructor(yypParser,343,&yymsp[0].minor); } break; @@ -4575,71 +4910,111 @@ 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 4915 "sql.c" yy_destructor(yypParser,342,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ +#line 85 "sql.y" { pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy169, &yymsp[-1].minor.yy0, yymsp[0].minor.yy243); } +#line 4921 "sql.c" break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ +#line 86 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy169, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 4926 "sql.c" break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ +#line 87 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy169, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 4931 "sql.c" break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ +#line 88 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy169, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 4936 "sql.c" break; case 28: /* cmd ::= DROP USER user_name */ +#line 89 "sql.y" { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy169); } +#line 4941 "sql.c" break; case 29: /* sysinfo_opt ::= */ +#line 93 "sql.y" { yymsp[1].minor.yy243 = 1; } +#line 4946 "sql.c" break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ +#line 94 "sql.y" { yymsp[-1].minor.yy243 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 4951 "sql.c" break; case 31: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ +#line 97 "sql.y" { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy949, &yymsp[-3].minor.yy637, &yymsp[0].minor.yy169, yymsp[-2].minor.yy952); } +#line 4956 "sql.c" break; case 32: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ +#line 98 "sql.y" { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy949, &yymsp[-3].minor.yy637, &yymsp[0].minor.yy169, yymsp[-2].minor.yy952); } +#line 4961 "sql.c" break; case 33: /* privileges ::= ALL */ +#line 102 "sql.y" { yymsp[0].minor.yy949 = PRIVILEGE_TYPE_ALL; } +#line 4966 "sql.c" break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); +#line 103 "sql.y" { yylhsminor.yy949 = yymsp[0].minor.yy949; } +#line 4972 "sql.c" yymsp[0].minor.yy949 = yylhsminor.yy949; break; case 35: /* privileges ::= SUBSCRIBE */ +#line 104 "sql.y" { yymsp[0].minor.yy949 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 4978 "sql.c" break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ +#line 109 "sql.y" { yylhsminor.yy949 = yymsp[-2].minor.yy949 | yymsp[0].minor.yy949; } +#line 4983 "sql.c" yymsp[-2].minor.yy949 = yylhsminor.yy949; break; case 38: /* priv_type ::= READ */ +#line 113 "sql.y" { yymsp[0].minor.yy949 = PRIVILEGE_TYPE_READ; } +#line 4989 "sql.c" break; case 39: /* priv_type ::= WRITE */ +#line 114 "sql.y" { yymsp[0].minor.yy949 = PRIVILEGE_TYPE_WRITE; } +#line 4994 "sql.c" break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ +#line 118 "sql.y" { yylhsminor.yy637.first = yymsp[-2].minor.yy0; yylhsminor.yy637.second = yymsp[0].minor.yy0; } +#line 4999 "sql.c" yymsp[-2].minor.yy637 = yylhsminor.yy637; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ +#line 119 "sql.y" { yylhsminor.yy637.first = yymsp[-2].minor.yy169; yylhsminor.yy637.second = yymsp[0].minor.yy0; } +#line 5005 "sql.c" yymsp[-2].minor.yy637 = yylhsminor.yy637; break; case 42: /* priv_level ::= db_name NK_DOT table_name */ +#line 120 "sql.y" { yylhsminor.yy637.first = yymsp[-2].minor.yy169; yylhsminor.yy637.second = yymsp[0].minor.yy169; } +#line 5011 "sql.c" yymsp[-2].minor.yy637 = yylhsminor.yy637; break; case 43: /* priv_level ::= topic_name */ +#line 121 "sql.y" { yylhsminor.yy637.first = yymsp[0].minor.yy169; yylhsminor.yy637.second = nil_token; } +#line 5017 "sql.c" yymsp[0].minor.yy637 = yylhsminor.yy637; break; case 44: /* with_opt ::= */ @@ -4658,46 +5033,72 @@ static YYACTIONTYPE yy_reduce( case 572: /* every_opt ::= */ yytestcase(yyruleno==572); case 585: /* slimit_clause_opt ::= */ yytestcase(yyruleno==585); case 589: /* limit_clause_opt ::= */ yytestcase(yyruleno==589); +#line 123 "sql.y" { yymsp[1].minor.yy952 = NULL; } +#line 5038 "sql.c" break; case 45: /* with_opt ::= WITH search_condition */ case 504: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==504); case 537: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==537); case 568: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==568); +#line 124 "sql.y" { yymsp[-1].minor.yy952 = yymsp[0].minor.yy952; } +#line 5046 "sql.c" break; case 46: /* cmd ::= CREATE DNODE dnode_endpoint */ +#line 127 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy169, NULL); } +#line 5051 "sql.c" break; case 47: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ +#line 128 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy0); } +#line 5056 "sql.c" break; case 48: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ +#line 129 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy957, false); } +#line 5061 "sql.c" break; case 49: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ +#line 130 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy169, yymsp[0].minor.yy957, false); } +#line 5066 "sql.c" break; case 50: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ +#line 131 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy957); } +#line 5071 "sql.c" break; case 51: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ +#line 132 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy169, false, yymsp[0].minor.yy957); } +#line 5076 "sql.c" break; case 52: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ +#line 133 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } +#line 5081 "sql.c" break; case 53: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ +#line 134 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5086 "sql.c" break; case 54: /* cmd ::= ALTER ALL DNODES NK_STRING */ +#line 135 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } +#line 5091 "sql.c" break; case 55: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ +#line 136 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5096 "sql.c" break; case 56: /* cmd ::= RESTORE DNODE NK_INTEGER */ +#line 137 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } +#line 5101 "sql.c" break; case 57: /* dnode_endpoint ::= NK_STRING */ case 58: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==58); @@ -4730,7 +5131,9 @@ static YYACTIONTYPE yy_reduce( case 459: /* star_func ::= FIRST */ yytestcase(yyruleno==459); case 460: /* star_func ::= LAST */ yytestcase(yyruleno==460); case 461: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==461); +#line 141 "sql.y" { yylhsminor.yy169 = yymsp[0].minor.yy0; } +#line 5136 "sql.c" yymsp[0].minor.yy169 = yylhsminor.yy169; break; case 60: /* force_opt ::= */ @@ -4742,7 +5145,9 @@ static YYACTIONTYPE yy_reduce( case 357: /* ignore_opt ::= */ yytestcase(yyruleno==357); case 524: /* tag_mode_opt ::= */ yytestcase(yyruleno==524); case 526: /* set_quantifier_opt ::= */ yytestcase(yyruleno==526); +#line 147 "sql.y" { yymsp[1].minor.yy957 = false; } +#line 5150 "sql.c" break; case 61: /* force_opt ::= FORCE */ case 62: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==62); @@ -4750,275 +5155,419 @@ static YYACTIONTYPE yy_reduce( case 330: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==330); case 525: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==525); case 527: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==527); +#line 148 "sql.y" { yymsp[0].minor.yy957 = true; } +#line 5160 "sql.c" break; case 63: /* cmd ::= ALTER LOCAL NK_STRING */ +#line 155 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 5165 "sql.c" break; case 64: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ +#line 156 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5170 "sql.c" break; case 65: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ +#line 159 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5175 "sql.c" break; case 66: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ +#line 160 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5180 "sql.c" break; case 67: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ +#line 161 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5185 "sql.c" break; case 68: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ +#line 164 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 5190 "sql.c" break; case 69: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ +#line 165 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 5195 "sql.c" break; case 70: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ +#line 168 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 5200 "sql.c" break; case 71: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ +#line 169 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 5205 "sql.c" break; case 72: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ +#line 172 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 5210 "sql.c" break; case 73: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ +#line 173 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 5215 "sql.c" break; case 74: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ +#line 174 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 5220 "sql.c" break; case 75: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ +#line 177 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } +#line 5225 "sql.c" break; case 76: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +#line 180 "sql.y" { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy957, &yymsp[-1].minor.yy169, yymsp[0].minor.yy952); } +#line 5230 "sql.c" break; case 77: /* cmd ::= DROP DATABASE exists_opt db_name */ +#line 181 "sql.y" { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } +#line 5235 "sql.c" break; case 78: /* cmd ::= USE db_name */ +#line 182 "sql.y" { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy169); } +#line 5240 "sql.c" break; case 79: /* cmd ::= ALTER DATABASE db_name alter_db_options */ +#line 183 "sql.y" { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy169, yymsp[0].minor.yy952); } +#line 5245 "sql.c" break; case 80: /* cmd ::= FLUSH DATABASE db_name */ +#line 184 "sql.y" { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy169); } +#line 5250 "sql.c" break; case 81: /* cmd ::= TRIM DATABASE db_name speed_opt */ +#line 185 "sql.y" { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy169, yymsp[0].minor.yy480); } +#line 5255 "sql.c" break; case 82: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +#line 186 "sql.y" { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy169, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 5260 "sql.c" break; case 83: /* not_exists_opt ::= IF NOT EXISTS */ +#line 190 "sql.y" { yymsp[-2].minor.yy957 = true; } +#line 5265 "sql.c" break; case 85: /* exists_opt ::= IF EXISTS */ case 336: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==336); case 358: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==358); +#line 195 "sql.y" { yymsp[-1].minor.yy957 = true; } +#line 5272 "sql.c" break; case 87: /* db_options ::= */ +#line 198 "sql.y" { yymsp[1].minor.yy952 = createDefaultDatabaseOptions(pCxt); } +#line 5277 "sql.c" break; case 88: /* db_options ::= db_options BUFFER NK_INTEGER */ +#line 199 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } +#line 5282 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 89: /* db_options ::= db_options CACHEMODEL NK_STRING */ +#line 200 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } +#line 5288 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 90: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +#line 201 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } +#line 5294 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 91: /* db_options ::= db_options COMP NK_INTEGER */ +#line 202 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_COMP, &yymsp[0].minor.yy0); } +#line 5300 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 92: /* db_options ::= db_options DURATION NK_INTEGER */ case 93: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==93); +#line 203 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } +#line 5307 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 94: /* db_options ::= db_options MAXROWS NK_INTEGER */ +#line 205 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } +#line 5313 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 95: /* db_options ::= db_options MINROWS NK_INTEGER */ +#line 206 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } +#line 5319 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 96: /* db_options ::= db_options KEEP integer_list */ case 97: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==97); +#line 207 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_KEEP, yymsp[0].minor.yy824); } +#line 5326 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 98: /* db_options ::= db_options PAGES NK_INTEGER */ +#line 209 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } +#line 5332 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 99: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +#line 210 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } +#line 5338 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 100: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +#line 211 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } +#line 5344 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 101: /* db_options ::= db_options PRECISION NK_STRING */ +#line 212 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } +#line 5350 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 102: /* db_options ::= db_options REPLICA NK_INTEGER */ +#line 213 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } +#line 5356 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 103: /* db_options ::= db_options VGROUPS NK_INTEGER */ +#line 215 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } +#line 5362 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 104: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +#line 216 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } +#line 5368 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 105: /* db_options ::= db_options RETENTIONS retention_list */ +#line 217 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_RETENTIONS, yymsp[0].minor.yy824); } +#line 5374 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 106: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +#line 218 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } +#line 5380 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 107: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +#line 219 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_WAL, &yymsp[0].minor.yy0); } +#line 5386 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 108: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +#line 220 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } +#line 5392 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 109: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +#line 221 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } +#line 5398 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 110: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 222 "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.yy952 = setDatabaseOption(pCxt, yymsp[-3].minor.yy952, DB_OPTION_WAL_RETENTION_PERIOD, &t); } +#line 5408 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 111: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +#line 227 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } +#line 5414 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 112: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 228 "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.yy952 = setDatabaseOption(pCxt, yymsp[-3].minor.yy952, DB_OPTION_WAL_RETENTION_SIZE, &t); } +#line 5424 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 113: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +#line 233 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } +#line 5430 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 114: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +#line 234 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } +#line 5436 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 115: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +#line 235 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } +#line 5442 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 116: /* db_options ::= db_options TABLE_PREFIX signed */ +#line 236 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy952); } +#line 5448 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 117: /* db_options ::= db_options TABLE_SUFFIX signed */ +#line 237 "sql.y" { yylhsminor.yy952 = setDatabaseOption(pCxt, yymsp[-2].minor.yy952, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy952); } +#line 5454 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 118: /* alter_db_options ::= alter_db_option */ +#line 239 "sql.y" { yylhsminor.yy952 = createAlterDatabaseOptions(pCxt); yylhsminor.yy952 = setAlterDatabaseOption(pCxt, yylhsminor.yy952, &yymsp[0].minor.yy25); } +#line 5460 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 119: /* alter_db_options ::= alter_db_options alter_db_option */ +#line 240 "sql.y" { yylhsminor.yy952 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy952, &yymsp[0].minor.yy25); } +#line 5466 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 120: /* alter_db_option ::= BUFFER NK_INTEGER */ +#line 244 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5472 "sql.c" break; case 121: /* alter_db_option ::= CACHEMODEL NK_STRING */ +#line 245 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5477 "sql.c" break; case 122: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +#line 246 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5482 "sql.c" break; case 123: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +#line 247 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5487 "sql.c" break; case 124: /* alter_db_option ::= KEEP integer_list */ case 125: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==125); +#line 248 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_KEEP; yymsp[-1].minor.yy25.pList = yymsp[0].minor.yy824; } +#line 5493 "sql.c" break; case 126: /* alter_db_option ::= PAGES NK_INTEGER */ +#line 250 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_PAGES; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5498 "sql.c" break; case 127: /* alter_db_option ::= REPLICA NK_INTEGER */ +#line 251 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5503 "sql.c" break; case 128: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +#line 253 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_WAL; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5508 "sql.c" break; case 129: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +#line 254 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5513 "sql.c" break; case 130: /* alter_db_option ::= MINROWS NK_INTEGER */ +#line 255 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5518 "sql.c" break; case 131: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ +#line 256 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5523 "sql.c" break; case 132: /* alter_db_option ::= WAL_RETENTION_PERIOD 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; yymsp[-2].minor.yy25.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy25.val = t; } +#line 5532 "sql.c" break; case 133: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ +#line 262 "sql.y" { yymsp[-1].minor.yy25.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5537 "sql.c" break; case 134: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 263 "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.yy25.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy25.val = t; } +#line 5546 "sql.c" break; case 135: /* integer_list ::= NK_INTEGER */ +#line 271 "sql.y" { yylhsminor.yy824 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 5551 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 136: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 368: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==368); +#line 272 "sql.y" { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 5558 "sql.c" yymsp[-2].minor.yy824 = yylhsminor.yy824; break; case 137: /* variable_list ::= NK_VARIABLE */ +#line 276 "sql.y" { yylhsminor.yy824 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5564 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 138: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +#line 277 "sql.y" { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5570 "sql.c" yymsp[-2].minor.yy824 = yylhsminor.yy824; break; case 139: /* retention_list ::= retention */ @@ -5035,7 +5584,9 @@ static YYACTIONTYPE yy_reduce( case 529: /* select_list ::= select_item */ yytestcase(yyruleno==529); case 540: /* partition_list ::= partition_item */ yytestcase(yyruleno==540); case 596: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==596); +#line 281 "sql.y" { yylhsminor.yy824 = createNodeList(pCxt, yymsp[0].minor.yy952); } +#line 5589 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 140: /* retention_list ::= retention_list NK_COMMA retention */ @@ -5050,105 +5601,157 @@ static YYACTIONTYPE yy_reduce( case 530: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==530); case 541: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==541); case 597: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==597); +#line 282 "sql.y" { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, yymsp[0].minor.yy952); } +#line 5606 "sql.c" yymsp[-2].minor.yy824 = yylhsminor.yy824; break; case 141: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +#line 284 "sql.y" { yylhsminor.yy952 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5612 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 142: /* speed_opt ::= */ case 331: /* bufsize_opt ::= */ yytestcase(yyruleno==331); +#line 288 "sql.y" { yymsp[1].minor.yy480 = 0; } +#line 5619 "sql.c" break; case 143: /* speed_opt ::= MAX_SPEED NK_INTEGER */ case 332: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==332); +#line 289 "sql.y" { yymsp[-1].minor.yy480 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5625 "sql.c" break; case 145: /* start_opt ::= START WITH NK_INTEGER */ case 149: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==149); +#line 292 "sql.y" { yymsp[-2].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 5631 "sql.c" break; case 146: /* start_opt ::= START WITH NK_STRING */ case 150: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==150); +#line 293 "sql.y" { yymsp[-2].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 5637 "sql.c" break; case 147: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 151: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==151); +#line 294 "sql.y" { yymsp[-3].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 5643 "sql.c" break; case 152: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 154: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==154); +#line 303 "sql.y" { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy957, yymsp[-5].minor.yy952, yymsp[-3].minor.yy824, yymsp[-1].minor.yy824, yymsp[0].minor.yy952); } +#line 5649 "sql.c" break; case 153: /* cmd ::= CREATE TABLE multi_create_clause */ +#line 304 "sql.y" { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy824); } +#line 5654 "sql.c" break; case 155: /* cmd ::= DROP TABLE multi_drop_clause */ +#line 307 "sql.y" { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy824); } +#line 5659 "sql.c" break; case 156: /* cmd ::= DROP STABLE exists_opt full_table_name */ +#line 308 "sql.y" { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy957, yymsp[0].minor.yy952); } +#line 5664 "sql.c" break; case 157: /* cmd ::= ALTER TABLE alter_table_clause */ case 370: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==370); case 371: /* cmd ::= insert_query */ yytestcase(yyruleno==371); +#line 310 "sql.y" { pCxt->pRootNode = yymsp[0].minor.yy952; } +#line 5671 "sql.c" break; case 158: /* cmd ::= ALTER STABLE alter_table_clause */ +#line 311 "sql.y" { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy952); } +#line 5676 "sql.c" break; case 159: /* alter_table_clause ::= full_table_name alter_table_options */ +#line 313 "sql.y" { yylhsminor.yy952 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 5681 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 160: /* alter_table_clause ::= full_table_name ADD COLUMN column_def */ +#line 315 "sql.y" { yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_ADD_COLUMN, yymsp[0].minor.yy952); } +#line 5687 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 161: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +#line 316 "sql.y" { yylhsminor.yy952 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy169); } +#line 5693 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 162: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_def */ +#line 318 "sql.y" { yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, yymsp[0].minor.yy952); } +#line 5699 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 163: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +#line 320 "sql.y" { yylhsminor.yy952 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } +#line 5705 "sql.c" yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 164: /* alter_table_clause ::= full_table_name ADD TAG column_def */ +#line 322 "sql.y" { yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_ADD_TAG, yymsp[0].minor.yy952); } +#line 5711 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 165: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +#line 323 "sql.y" { yylhsminor.yy952 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy169); } +#line 5717 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 166: /* alter_table_clause ::= full_table_name MODIFY TAG column_def */ +#line 325 "sql.y" { yylhsminor.yy952 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy952, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, yymsp[0].minor.yy952); } +#line 5723 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 167: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +#line 327 "sql.y" { yylhsminor.yy952 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy952, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } +#line 5729 "sql.c" yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 168: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +#line 329 "sql.y" { yylhsminor.yy952 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy952, &yymsp[-2].minor.yy169, yymsp[0].minor.yy952); } +#line 5735 "sql.c" yymsp[-5].minor.yy952 = yylhsminor.yy952; break; case 170: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 471: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==471); +#line 334 "sql.y" { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-1].minor.yy824, yymsp[0].minor.yy952); } +#line 5742 "sql.c" yymsp[-1].minor.yy824 = yylhsminor.yy824; break; case 171: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ +#line 338 "sql.y" { yylhsminor.yy952 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy957, yymsp[-8].minor.yy952, yymsp[-6].minor.yy952, yymsp[-5].minor.yy824, yymsp[-2].minor.yy824, yymsp[0].minor.yy952); } +#line 5748 "sql.c" yymsp[-9].minor.yy952 = yylhsminor.yy952; break; case 174: /* drop_table_clause ::= exists_opt full_table_name */ +#line 345 "sql.y" { yylhsminor.yy952 = createDropTableClause(pCxt, yymsp[-1].minor.yy957, yymsp[0].minor.yy952); } +#line 5754 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 175: /* specific_cols_opt ::= */ @@ -5159,539 +5762,853 @@ static YYACTIONTYPE yy_reduce( case 538: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==538); case 563: /* group_by_clause_opt ::= */ yytestcase(yyruleno==563); case 583: /* order_by_clause_opt ::= */ yytestcase(yyruleno==583); +#line 349 "sql.y" { yymsp[1].minor.yy824 = NULL; } +#line 5767 "sql.c" break; case 176: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ case 342: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==342); +#line 350 "sql.y" { yymsp[-2].minor.yy824 = yymsp[-1].minor.yy824; } +#line 5773 "sql.c" break; case 177: /* full_table_name ::= table_name */ +#line 352 "sql.y" { yylhsminor.yy952 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy169, NULL); } +#line 5778 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 178: /* full_table_name ::= db_name NK_DOT table_name */ +#line 353 "sql.y" { yylhsminor.yy952 = createRealTableNode(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169, NULL); } +#line 5784 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 181: /* column_def ::= column_name type_name */ +#line 360 "sql.y" { yylhsminor.yy952 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy169, yymsp[0].minor.yy84, NULL); } +#line 5790 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 182: /* column_def ::= column_name type_name COMMENT NK_STRING */ +#line 361 "sql.y" { yylhsminor.yy952 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy169, yymsp[-2].minor.yy84, &yymsp[0].minor.yy0); } +#line 5796 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 183: /* type_name ::= BOOL */ +#line 365 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BOOL); } +#line 5802 "sql.c" break; case 184: /* type_name ::= TINYINT */ +#line 366 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 5807 "sql.c" break; case 185: /* type_name ::= SMALLINT */ +#line 367 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 5812 "sql.c" break; case 186: /* type_name ::= INT */ case 187: /* type_name ::= INTEGER */ yytestcase(yyruleno==187); +#line 368 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_INT); } +#line 5818 "sql.c" break; case 188: /* type_name ::= BIGINT */ +#line 370 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 5823 "sql.c" break; case 189: /* type_name ::= FLOAT */ +#line 371 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 5828 "sql.c" break; case 190: /* type_name ::= DOUBLE */ +#line 372 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 5833 "sql.c" break; case 191: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +#line 373 "sql.y" { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 5838 "sql.c" break; case 192: /* type_name ::= TIMESTAMP */ +#line 374 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +#line 5843 "sql.c" break; case 193: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +#line 375 "sql.y" { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +#line 5848 "sql.c" break; case 194: /* type_name ::= TINYINT UNSIGNED */ +#line 376 "sql.y" { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +#line 5853 "sql.c" break; case 195: /* type_name ::= SMALLINT UNSIGNED */ +#line 377 "sql.y" { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +#line 5858 "sql.c" break; case 196: /* type_name ::= INT UNSIGNED */ +#line 378 "sql.y" { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UINT); } +#line 5863 "sql.c" break; case 197: /* type_name ::= BIGINT UNSIGNED */ +#line 379 "sql.y" { yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +#line 5868 "sql.c" break; case 198: /* type_name ::= JSON */ +#line 380 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_JSON); } +#line 5873 "sql.c" break; case 199: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +#line 381 "sql.y" { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +#line 5878 "sql.c" break; case 200: /* type_name ::= MEDIUMBLOB */ +#line 382 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +#line 5883 "sql.c" break; case 201: /* type_name ::= BLOB */ +#line 383 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BLOB); } +#line 5888 "sql.c" break; case 202: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +#line 384 "sql.y" { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +#line 5893 "sql.c" break; case 203: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +#line 385 "sql.y" { yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +#line 5898 "sql.c" break; case 204: /* type_name ::= DECIMAL */ +#line 386 "sql.y" { yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 5903 "sql.c" break; case 205: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +#line 387 "sql.y" { yymsp[-3].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 5908 "sql.c" break; case 206: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 388 "sql.y" { yymsp[-5].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 5913 "sql.c" break; case 208: /* tags_def_opt ::= tags_def */ case 344: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==344); case 463: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==463); +#line 393 "sql.y" { yylhsminor.yy824 = yymsp[0].minor.yy824; } +#line 5920 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 209: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ case 345: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==345); +#line 397 "sql.y" { yymsp[-3].minor.yy824 = yymsp[-1].minor.yy824; } +#line 5927 "sql.c" break; case 210: /* table_options ::= */ +#line 399 "sql.y" { yymsp[1].minor.yy952 = createDefaultTableOptions(pCxt); } +#line 5932 "sql.c" break; case 211: /* table_options ::= table_options COMMENT NK_STRING */ +#line 400 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } +#line 5937 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 212: /* table_options ::= table_options MAX_DELAY duration_list */ +#line 401 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy824); } +#line 5943 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 213: /* table_options ::= table_options WATERMARK duration_list */ +#line 402 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy824); } +#line 5949 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 214: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +#line 403 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-4].minor.yy952, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy824); } +#line 5955 "sql.c" yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 215: /* table_options ::= table_options TTL NK_INTEGER */ +#line 404 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } +#line 5961 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 216: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +#line 405 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-4].minor.yy952, TABLE_OPTION_SMA, yymsp[-1].minor.yy824); } +#line 5967 "sql.c" yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 217: /* table_options ::= table_options DELETE_MARK duration_list */ +#line 406 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-2].minor.yy952, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy824); } +#line 5973 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 218: /* alter_table_options ::= alter_table_option */ +#line 408 "sql.y" { yylhsminor.yy952 = createAlterTableOptions(pCxt); yylhsminor.yy952 = setTableOption(pCxt, yylhsminor.yy952, yymsp[0].minor.yy25.type, &yymsp[0].minor.yy25.val); } +#line 5979 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 219: /* alter_table_options ::= alter_table_options alter_table_option */ +#line 409 "sql.y" { yylhsminor.yy952 = setTableOption(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy25.type, &yymsp[0].minor.yy25.val); } +#line 5985 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 220: /* alter_table_option ::= COMMENT NK_STRING */ +#line 413 "sql.y" { yymsp[-1].minor.yy25.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5991 "sql.c" break; case 221: /* alter_table_option ::= TTL NK_INTEGER */ +#line 414 "sql.y" { yymsp[-1].minor.yy25.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; } +#line 5996 "sql.c" break; case 222: /* duration_list ::= duration_literal */ case 427: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==427); +#line 418 "sql.y" { yylhsminor.yy824 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } +#line 6002 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 223: /* duration_list ::= duration_list NK_COMMA duration_literal */ case 428: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==428); +#line 419 "sql.y" { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } +#line 6009 "sql.c" yymsp[-2].minor.yy824 = yylhsminor.yy824; break; case 226: /* rollup_func_name ::= function_name */ +#line 426 "sql.y" { yylhsminor.yy952 = createFunctionNode(pCxt, &yymsp[0].minor.yy169, NULL); } +#line 6015 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 227: /* rollup_func_name ::= FIRST */ case 228: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==228); case 286: /* tag_item ::= QTAGS */ yytestcase(yyruleno==286); +#line 427 "sql.y" { yylhsminor.yy952 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6023 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 231: /* col_name ::= column_name */ case 287: /* tag_item ::= column_name */ yytestcase(yyruleno==287); +#line 435 "sql.y" { yylhsminor.yy952 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy169); } +#line 6030 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 232: /* cmd ::= SHOW DNODES */ +#line 438 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } +#line 6036 "sql.c" break; case 233: /* cmd ::= SHOW USERS */ +#line 439 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } +#line 6041 "sql.c" break; case 234: /* cmd ::= SHOW USER PRIVILEGES */ +#line 440 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } +#line 6046 "sql.c" break; case 235: /* cmd ::= SHOW DATABASES */ +#line 441 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } +#line 6051 "sql.c" break; case 236: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +#line 442 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, OP_TYPE_LIKE); } +#line 6056 "sql.c" break; case 237: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +#line 443 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, OP_TYPE_LIKE); } +#line 6061 "sql.c" break; case 238: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +#line 444 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy952, NULL, OP_TYPE_LIKE); } +#line 6066 "sql.c" break; case 239: /* cmd ::= SHOW MNODES */ +#line 445 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } +#line 6071 "sql.c" break; case 240: /* cmd ::= SHOW QNODES */ +#line 447 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } +#line 6076 "sql.c" break; case 241: /* cmd ::= SHOW FUNCTIONS */ +#line 448 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } +#line 6081 "sql.c" break; case 242: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +#line 449 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy952, yymsp[-1].minor.yy952, OP_TYPE_EQUAL); } +#line 6086 "sql.c" break; case 243: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +#line 450 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy169), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169), OP_TYPE_EQUAL); } +#line 6091 "sql.c" break; case 244: /* cmd ::= SHOW STREAMS */ +#line 451 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } +#line 6096 "sql.c" break; case 245: /* cmd ::= SHOW ACCOUNTS */ +#line 452 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 6101 "sql.c" break; case 246: /* cmd ::= SHOW APPS */ +#line 453 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } +#line 6106 "sql.c" break; case 247: /* cmd ::= SHOW CONNECTIONS */ +#line 454 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } +#line 6111 "sql.c" break; case 248: /* cmd ::= SHOW LICENCES */ case 249: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==249); +#line 455 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } +#line 6117 "sql.c" break; case 250: /* cmd ::= SHOW CREATE DATABASE db_name */ +#line 457 "sql.y" { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy169); } +#line 6122 "sql.c" break; case 251: /* cmd ::= SHOW CREATE TABLE full_table_name */ +#line 458 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy952); } +#line 6127 "sql.c" break; case 252: /* cmd ::= SHOW CREATE STABLE full_table_name */ +#line 459 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy952); } +#line 6132 "sql.c" break; case 253: /* cmd ::= SHOW QUERIES */ +#line 460 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } +#line 6137 "sql.c" break; case 254: /* cmd ::= SHOW SCORES */ +#line 461 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } +#line 6142 "sql.c" break; case 255: /* cmd ::= SHOW TOPICS */ +#line 462 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } +#line 6147 "sql.c" break; case 256: /* cmd ::= SHOW VARIABLES */ case 257: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==257); +#line 463 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } +#line 6153 "sql.c" break; case 258: /* cmd ::= SHOW LOCAL VARIABLES */ +#line 465 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } +#line 6158 "sql.c" break; case 259: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +#line 466 "sql.y" { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy952); } +#line 6163 "sql.c" break; case 260: /* cmd ::= SHOW BNODES */ +#line 467 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } +#line 6168 "sql.c" break; case 261: /* cmd ::= SHOW SNODES */ +#line 468 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } +#line 6173 "sql.c" break; case 262: /* cmd ::= SHOW CLUSTER */ +#line 469 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } +#line 6178 "sql.c" break; case 263: /* cmd ::= SHOW TRANSACTIONS */ +#line 470 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } +#line 6183 "sql.c" break; case 264: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +#line 471 "sql.y" { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy952); } +#line 6188 "sql.c" break; case 265: /* cmd ::= SHOW CONSUMERS */ +#line 472 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } +#line 6193 "sql.c" break; case 266: /* cmd ::= SHOW SUBSCRIPTIONS */ +#line 473 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } +#line 6198 "sql.c" break; case 267: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +#line 474 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy952, yymsp[-1].minor.yy952, OP_TYPE_EQUAL); } +#line 6203 "sql.c" break; case 268: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +#line 475 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy169), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169), OP_TYPE_EQUAL); } +#line 6208 "sql.c" break; case 269: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +#line 476 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy952, yymsp[-3].minor.yy824); } +#line 6213 "sql.c" break; case 270: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +#line 477 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy169), yymsp[-4].minor.yy824); } +#line 6218 "sql.c" break; case 271: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ +#line 478 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } +#line 6223 "sql.c" break; case 272: /* cmd ::= SHOW VNODES */ +#line 479 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } +#line 6228 "sql.c" break; case 273: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +#line 481 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy952, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +#line 6233 "sql.c" break; case 274: /* cmd ::= SHOW CLUSTER ALIVE */ +#line 482 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } +#line 6238 "sql.c" break; case 275: /* db_name_cond_opt ::= */ case 280: /* from_db_opt ::= */ yytestcase(yyruleno==280); +#line 484 "sql.y" { yymsp[1].minor.yy952 = createDefaultDatabaseCondValue(pCxt); } +#line 6244 "sql.c" break; case 276: /* db_name_cond_opt ::= db_name NK_DOT */ +#line 485 "sql.y" { yylhsminor.yy952 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy169); } +#line 6249 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 278: /* like_pattern_opt ::= LIKE NK_STRING */ +#line 488 "sql.y" { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 6255 "sql.c" break; case 279: /* table_name_cond ::= table_name */ +#line 490 "sql.y" { yylhsminor.yy952 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169); } +#line 6260 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 281: /* from_db_opt ::= FROM db_name */ +#line 493 "sql.y" { yymsp[-1].minor.yy952 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy169); } +#line 6266 "sql.c" break; case 285: /* tag_item ::= TBNAME */ +#line 501 "sql.y" { yylhsminor.yy952 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } +#line 6271 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 288: /* tag_item ::= column_name column_alias */ +#line 504 "sql.y" { yylhsminor.yy952 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy169), &yymsp[0].minor.yy169); } +#line 6277 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 289: /* tag_item ::= column_name AS column_alias */ +#line 505 "sql.y" { yylhsminor.yy952 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy169), &yymsp[0].minor.yy169); } +#line 6283 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 290: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ +#line 509 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy957, yymsp[-3].minor.yy952, yymsp[-1].minor.yy952, NULL, yymsp[0].minor.yy952); } +#line 6289 "sql.c" break; case 291: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ +#line 511 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy957, yymsp[-5].minor.yy952, yymsp[-3].minor.yy952, yymsp[-1].minor.yy824, NULL); } +#line 6294 "sql.c" break; case 292: /* cmd ::= DROP INDEX exists_opt full_index_name */ +#line 512 "sql.y" { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy957, yymsp[0].minor.yy952); } +#line 6299 "sql.c" break; case 293: /* full_index_name ::= index_name */ +#line 514 "sql.y" { yylhsminor.yy952 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy169); } +#line 6304 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 294: /* full_index_name ::= db_name NK_DOT index_name */ +#line 515 "sql.y" { yylhsminor.yy952 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169); } +#line 6310 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 295: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 518 "sql.y" { yymsp[-9].minor.yy952 = createIndexOption(pCxt, yymsp[-7].minor.yy824, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), NULL, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 6316 "sql.c" break; case 296: /* 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 521 "sql.y" { yymsp[-11].minor.yy952 = createIndexOption(pCxt, yymsp[-9].minor.yy824, releaseRawExprNode(pCxt, yymsp[-5].minor.yy952), releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 6321 "sql.c" break; case 299: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +#line 528 "sql.y" { yylhsminor.yy952 = createFunctionNode(pCxt, &yymsp[-3].minor.yy169, yymsp[-1].minor.yy824); } +#line 6326 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 300: /* sma_func_name ::= function_name */ case 514: /* alias_opt ::= table_alias */ yytestcase(yyruleno==514); +#line 532 "sql.y" { yylhsminor.yy169 = yymsp[0].minor.yy169; } +#line 6333 "sql.c" yymsp[0].minor.yy169 = yylhsminor.yy169; break; case 305: /* sma_stream_opt ::= */ case 346: /* stream_options ::= */ yytestcase(yyruleno==346); +#line 538 "sql.y" { yymsp[1].minor.yy952 = createStreamOptions(pCxt); } +#line 6340 "sql.c" break; case 306: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +#line 539 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy952)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = yymsp[-2].minor.yy952; } +#line 6345 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 307: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +#line 540 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy952)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = yymsp[-2].minor.yy952; } +#line 6351 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 308: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +#line 541 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy952)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = yymsp[-2].minor.yy952; } +#line 6357 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 309: /* with_meta ::= AS */ +#line 546 "sql.y" { yymsp[0].minor.yy480 = 0; } +#line 6363 "sql.c" break; case 310: /* with_meta ::= WITH META AS */ +#line 547 "sql.y" { yymsp[-2].minor.yy480 = 1; } +#line 6368 "sql.c" break; case 311: /* with_meta ::= ONLY META AS */ +#line 548 "sql.y" { yymsp[-2].minor.yy480 = 2; } +#line 6373 "sql.c" break; case 312: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +#line 550 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy957, &yymsp[-2].minor.yy169, yymsp[0].minor.yy952); } +#line 6378 "sql.c" break; case 313: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +#line 552 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy957, &yymsp[-3].minor.yy169, &yymsp[0].minor.yy169, yymsp[-2].minor.yy480); } +#line 6383 "sql.c" break; case 314: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +#line 554 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy957, &yymsp[-4].minor.yy169, yymsp[-1].minor.yy952, yymsp[-3].minor.yy480, yymsp[0].minor.yy952); } +#line 6388 "sql.c" break; case 315: /* cmd ::= DROP TOPIC exists_opt topic_name */ +#line 556 "sql.y" { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } +#line 6393 "sql.c" break; case 316: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +#line 557 "sql.y" { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy957, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169); } +#line 6398 "sql.c" break; case 317: /* cmd ::= DESC full_table_name */ case 318: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==318); +#line 560 "sql.y" { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy952); } +#line 6404 "sql.c" break; case 319: /* cmd ::= RESET QUERY CACHE */ +#line 564 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } +#line 6409 "sql.c" break; case 320: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 321: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==321); +#line 567 "sql.y" { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy957, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 6415 "sql.c" break; case 324: /* explain_options ::= */ +#line 575 "sql.y" { yymsp[1].minor.yy952 = createDefaultExplainOptions(pCxt); } +#line 6420 "sql.c" break; case 325: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +#line 576 "sql.y" { yylhsminor.yy952 = setExplainVerbose(pCxt, yymsp[-2].minor.yy952, &yymsp[0].minor.yy0); } +#line 6425 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 326: /* explain_options ::= explain_options RATIO NK_FLOAT */ +#line 577 "sql.y" { yylhsminor.yy952 = setExplainRatio(pCxt, yymsp[-2].minor.yy952, &yymsp[0].minor.yy0); } +#line 6431 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 327: /* 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 582 "sql.y" { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy957, yymsp[-9].minor.yy957, &yymsp[-6].minor.yy169, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy84, yymsp[-1].minor.yy480, &yymsp[0].minor.yy169, yymsp[-10].minor.yy957); } +#line 6437 "sql.c" break; case 328: /* cmd ::= DROP FUNCTION exists_opt function_name */ +#line 583 "sql.y" { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } +#line 6442 "sql.c" break; case 333: /* language_opt ::= */ +#line 597 "sql.y" { yymsp[1].minor.yy169 = nil_token; } +#line 6447 "sql.c" break; case 334: /* language_opt ::= LANGUAGE NK_STRING */ +#line 598 "sql.y" { yymsp[-1].minor.yy169 = yymsp[0].minor.yy0; } +#line 6452 "sql.c" break; case 337: /* 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 608 "sql.y" { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy957, &yymsp[-8].minor.yy169, yymsp[-5].minor.yy952, yymsp[-7].minor.yy952, yymsp[-3].minor.yy824, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, yymsp[-4].minor.yy824); } +#line 6457 "sql.c" break; case 338: /* cmd ::= DROP STREAM exists_opt stream_name */ +#line 609 "sql.y" { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } +#line 6462 "sql.c" break; case 339: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +#line 610 "sql.y" { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } +#line 6467 "sql.c" break; case 340: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +#line 611 "sql.y" { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy957, yymsp[-1].minor.yy957, &yymsp[0].minor.yy169); } +#line 6472 "sql.c" break; case 347: /* stream_options ::= stream_options TRIGGER AT_ONCE */ case 348: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==348); +#line 625 "sql.y" { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } +#line 6478 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 349: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +#line 627 "sql.y" { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-3].minor.yy952, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } +#line 6484 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 350: /* stream_options ::= stream_options WATERMARK duration_literal */ +#line 628 "sql.y" { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } +#line 6490 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 351: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +#line 629 "sql.y" { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-3].minor.yy952, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } +#line 6496 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 352: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +#line 630 "sql.y" { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +#line 6502 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 353: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +#line 631 "sql.y" { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-2].minor.yy952, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } +#line 6508 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 354: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +#line 632 "sql.y" { yylhsminor.yy952 = setStreamOptions(pCxt, yymsp[-3].minor.yy952, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } +#line 6514 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 356: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ case 552: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==552); case 573: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==573); +#line 635 "sql.y" { yymsp[-3].minor.yy952 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy952); } +#line 6522 "sql.c" break; case 359: /* cmd ::= KILL CONNECTION NK_INTEGER */ +#line 643 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } +#line 6527 "sql.c" break; case 360: /* cmd ::= KILL QUERY NK_STRING */ +#line 644 "sql.y" { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6532 "sql.c" break; case 361: /* cmd ::= KILL TRANSACTION NK_INTEGER */ +#line 645 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } +#line 6537 "sql.c" break; case 362: /* cmd ::= BALANCE VGROUP */ +#line 648 "sql.y" { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } +#line 6542 "sql.c" break; case 363: /* cmd ::= BALANCE VGROUP LEADER */ +#line 649 "sql.y" { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); } +#line 6547 "sql.c" break; case 364: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +#line 650 "sql.y" { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 6552 "sql.c" break; case 365: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +#line 651 "sql.y" { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy824); } +#line 6557 "sql.c" break; case 366: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +#line 652 "sql.y" { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6562 "sql.c" break; case 367: /* dnode_list ::= DNODE NK_INTEGER */ +#line 656 "sql.y" { yymsp[-1].minor.yy824 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6567 "sql.c" break; case 369: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +#line 663 "sql.y" { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 6572 "sql.c" break; case 372: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +#line 672 "sql.y" { yymsp[-6].minor.yy952 = createInsertStmt(pCxt, yymsp[-4].minor.yy952, yymsp[-2].minor.yy824, yymsp[0].minor.yy952); } +#line 6577 "sql.c" break; case 373: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +#line 673 "sql.y" { yymsp[-3].minor.yy952 = createInsertStmt(pCxt, yymsp[-1].minor.yy952, NULL, yymsp[0].minor.yy952); } +#line 6582 "sql.c" break; case 374: /* literal ::= NK_INTEGER */ +#line 676 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } +#line 6587 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 375: /* literal ::= NK_FLOAT */ +#line 677 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } +#line 6593 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 376: /* literal ::= NK_STRING */ +#line 678 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 6599 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 377: /* literal ::= NK_BOOL */ +#line 679 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } +#line 6605 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 378: /* literal ::= TIMESTAMP NK_STRING */ +#line 680 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +#line 6611 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 379: /* literal ::= duration_literal */ @@ -5715,61 +6632,87 @@ static YYACTIONTYPE yy_reduce( case 576: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==576); case 579: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==579); case 581: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==581); +#line 681 "sql.y" { yylhsminor.yy952 = yymsp[0].minor.yy952; } +#line 6637 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 380: /* literal ::= NULL */ +#line 682 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } +#line 6643 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 381: /* literal ::= NK_QUESTION */ +#line 683 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6649 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 382: /* duration_literal ::= NK_VARIABLE */ +#line 685 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6655 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 383: /* signed ::= NK_INTEGER */ +#line 687 "sql.y" { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 6661 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 384: /* signed ::= NK_PLUS NK_INTEGER */ +#line 688 "sql.y" { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 6667 "sql.c" break; case 385: /* signed ::= NK_MINUS NK_INTEGER */ +#line 689 "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.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } +#line 6676 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 386: /* signed ::= NK_FLOAT */ +#line 694 "sql.y" { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 6682 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 387: /* signed ::= NK_PLUS NK_FLOAT */ +#line 695 "sql.y" { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 6688 "sql.c" break; case 388: /* signed ::= NK_MINUS NK_FLOAT */ +#line 696 "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.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } +#line 6697 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 390: /* signed_literal ::= NK_STRING */ +#line 703 "sql.y" { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 6703 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 391: /* signed_literal ::= NK_BOOL */ +#line 704 "sql.y" { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } +#line 6709 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 392: /* signed_literal ::= TIMESTAMP NK_STRING */ +#line 705 "sql.y" { yymsp[-1].minor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6715 "sql.c" break; case 393: /* signed_literal ::= duration_literal */ case 395: /* signed_literal ::= literal_func */ yytestcase(yyruleno==395); @@ -5779,106 +6722,138 @@ static YYACTIONTYPE yy_reduce( case 580: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==580); case 582: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==582); case 595: /* search_condition ::= common_expression */ yytestcase(yyruleno==595); +#line 706 "sql.y" { yylhsminor.yy952 = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); } +#line 6727 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 394: /* signed_literal ::= NULL */ +#line 707 "sql.y" { yylhsminor.yy952 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } +#line 6733 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 396: /* signed_literal ::= NK_QUESTION */ +#line 709 "sql.y" { yylhsminor.yy952 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } +#line 6739 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 416: /* expression ::= NK_LP expression NK_RP */ case 500: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==500); case 594: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==594); +#line 770 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } +#line 6747 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 417: /* expression ::= NK_PLUS expr_or_subquery */ +#line 771 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } +#line 6756 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 418: /* expression ::= NK_MINUS expr_or_subquery */ +#line 775 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy952), NULL)); } +#line 6765 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 419: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ +#line 779 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6775 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 420: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ +#line 784 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6785 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 421: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ +#line 789 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6795 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 422: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ +#line 794 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6805 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 423: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ +#line 799 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6815 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 424: /* expression ::= column_reference NK_ARROW NK_STRING */ +#line 804 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } +#line 6824 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 425: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ +#line 808 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6834 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 426: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ +#line 813 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6844 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 429: /* column_reference ::= column_name */ +#line 824 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy169, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy169)); } +#line 6850 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 430: /* column_reference ::= table_name NK_DOT column_name */ +#line 825 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169, createColumnNode(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy169)); } +#line 6856 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 431: /* pseudo_column ::= ROWTS */ @@ -5893,194 +6868,281 @@ static YYACTIONTYPE yy_reduce( case 441: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==441); case 442: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==442); case 448: /* literal_func ::= NOW */ yytestcase(yyruleno==448); +#line 827 "sql.y" { yylhsminor.yy952 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } +#line 6873 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 433: /* pseudo_column ::= table_name NK_DOT TBNAME */ +#line 829 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy169)))); } +#line 6879 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 443: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 444: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==444); +#line 840 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy169, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy169, yymsp[-1].minor.yy824)); } +#line 6886 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 445: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +#line 843 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-1].minor.yy84)); } +#line 6892 "sql.c" yymsp[-5].minor.yy952 = yylhsminor.yy952; break; case 447: /* literal_func ::= noarg_func NK_LP NK_RP */ +#line 846 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy169, NULL)); } +#line 6898 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 462: /* star_func_para_list ::= NK_STAR */ +#line 870 "sql.y" { yylhsminor.yy824 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 6904 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 467: /* star_func_para ::= table_name NK_DOT NK_STAR */ case 535: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==535); +#line 879 "sql.y" { yylhsminor.yy952 = createColumnNode(pCxt, &yymsp[-2].minor.yy169, &yymsp[0].minor.yy0); } +#line 6911 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 468: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +#line 882 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy824, yymsp[-1].minor.yy952)); } +#line 6917 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 469: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +#line 884 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-2].minor.yy824, yymsp[-1].minor.yy952)); } +#line 6923 "sql.c" yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 472: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +#line 891 "sql.y" { yymsp[-3].minor.yy952 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952)); } +#line 6929 "sql.c" break; case 474: /* case_when_else_opt ::= ELSE common_expression */ +#line 894 "sql.y" { yymsp[-1].minor.yy952 = releaseRawExprNode(pCxt, yymsp[0].minor.yy952); } +#line 6934 "sql.c" break; case 475: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ case 480: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==480); +#line 897 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy520, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6944 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 476: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 904 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy952), releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6954 "sql.c" yymsp[-4].minor.yy952 = yylhsminor.yy952; break; case 477: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 910 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy952), releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 6964 "sql.c" yymsp[-5].minor.yy952 = yylhsminor.yy952; break; case 478: /* predicate ::= expr_or_subquery IS NULL */ +#line 915 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), NULL)); } +#line 6973 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 479: /* predicate ::= expr_or_subquery IS NOT NULL */ +#line 919 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), NULL)); } +#line 6982 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 481: /* compare_op ::= NK_LT */ +#line 931 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_LOWER_THAN; } +#line 6988 "sql.c" break; case 482: /* compare_op ::= NK_GT */ +#line 932 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_GREATER_THAN; } +#line 6993 "sql.c" break; case 483: /* compare_op ::= NK_LE */ +#line 933 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_LOWER_EQUAL; } +#line 6998 "sql.c" break; case 484: /* compare_op ::= NK_GE */ +#line 934 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_GREATER_EQUAL; } +#line 7003 "sql.c" break; case 485: /* compare_op ::= NK_NE */ +#line 935 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_NOT_EQUAL; } +#line 7008 "sql.c" break; case 486: /* compare_op ::= NK_EQ */ +#line 936 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_EQUAL; } +#line 7013 "sql.c" break; case 487: /* compare_op ::= LIKE */ +#line 937 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_LIKE; } +#line 7018 "sql.c" break; case 488: /* compare_op ::= NOT LIKE */ +#line 938 "sql.y" { yymsp[-1].minor.yy520 = OP_TYPE_NOT_LIKE; } +#line 7023 "sql.c" break; case 489: /* compare_op ::= MATCH */ +#line 939 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_MATCH; } +#line 7028 "sql.c" break; case 490: /* compare_op ::= NMATCH */ +#line 940 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_NMATCH; } +#line 7033 "sql.c" break; case 491: /* compare_op ::= CONTAINS */ +#line 941 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_JSON_CONTAINS; } +#line 7038 "sql.c" break; case 492: /* in_op ::= IN */ +#line 945 "sql.y" { yymsp[0].minor.yy520 = OP_TYPE_IN; } +#line 7043 "sql.c" break; case 493: /* in_op ::= NOT IN */ +#line 946 "sql.y" { yymsp[-1].minor.yy520 = OP_TYPE_NOT_IN; } +#line 7048 "sql.c" break; case 494: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +#line 948 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); } +#line 7053 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 496: /* boolean_value_expression ::= NOT boolean_primary */ +#line 952 "sql.y" { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy952), NULL)); } +#line 7062 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 497: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ +#line 957 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 7072 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 498: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +#line 963 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy952); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy952); yylhsminor.yy952 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 7082 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 506: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +#line 981 "sql.y" { yylhsminor.yy952 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy952, yymsp[0].minor.yy952, NULL); } +#line 7088 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 509: /* table_primary ::= table_name alias_opt */ +#line 987 "sql.y" { yylhsminor.yy952 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } +#line 7094 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 510: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +#line 988 "sql.y" { yylhsminor.yy952 = createRealTableNode(pCxt, &yymsp[-3].minor.yy169, &yymsp[-1].minor.yy169, &yymsp[0].minor.yy169); } +#line 7100 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 511: /* table_primary ::= subquery alias_opt */ +#line 989 "sql.y" { yylhsminor.yy952 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952), &yymsp[0].minor.yy169); } +#line 7106 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 513: /* alias_opt ::= */ +#line 994 "sql.y" { yymsp[1].minor.yy169 = nil_token; } +#line 7112 "sql.c" break; case 515: /* alias_opt ::= AS table_alias */ +#line 996 "sql.y" { yymsp[-1].minor.yy169 = yymsp[0].minor.yy169; } +#line 7117 "sql.c" break; case 516: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 517: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==517); +#line 998 "sql.y" { yymsp[-2].minor.yy952 = yymsp[-1].minor.yy952; } +#line 7123 "sql.c" break; case 518: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +#line 1003 "sql.y" { yylhsminor.yy952 = createJoinTableNode(pCxt, yymsp[-4].minor.yy932, yymsp[-5].minor.yy952, yymsp[-2].minor.yy952, yymsp[0].minor.yy952); } +#line 7128 "sql.c" yymsp[-5].minor.yy952 = yylhsminor.yy952; break; case 519: /* join_type ::= */ +#line 1007 "sql.y" { yymsp[1].minor.yy932 = JOIN_TYPE_INNER; } +#line 7134 "sql.c" break; case 520: /* join_type ::= INNER */ +#line 1008 "sql.y" { yymsp[0].minor.yy932 = JOIN_TYPE_INNER; } +#line 7139 "sql.c" break; - case 521: /* query_specification ::= SELECT hint_list tag_mode_opt set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 521: /* 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 1014 "sql.y" { - yymsp[-13].minor.yy952 = createSelectStmt(pCxt, yymsp[-10].minor.yy957, yymsp[-9].minor.yy824, yymsp[-8].minor.yy952, yymsp[-12].minor.yy824); - yymsp[-13].minor.yy952 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy952, yymsp[-11].minor.yy957); + yymsp[-13].minor.yy952 = createSelectStmt(pCxt, yymsp[-11].minor.yy957, yymsp[-9].minor.yy824, yymsp[-8].minor.yy952, yymsp[-12].minor.yy824); + yymsp[-13].minor.yy952 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy952, yymsp[-10].minor.yy957); yymsp[-13].minor.yy952 = addWhereClause(pCxt, yymsp[-13].minor.yy952, yymsp[-7].minor.yy952); yymsp[-13].minor.yy952 = addPartitionByClause(pCxt, yymsp[-13].minor.yy952, yymsp[-6].minor.yy824); yymsp[-13].minor.yy952 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy952, yymsp[-2].minor.yy952); @@ -6090,145 +7152,224 @@ static YYACTIONTYPE yy_reduce( yymsp[-13].minor.yy952 = addEveryClause(pCxt, yymsp[-13].minor.yy952, yymsp[-4].minor.yy952); yymsp[-13].minor.yy952 = addFillClause(pCxt, yymsp[-13].minor.yy952, yymsp[-3].minor.yy952); } +#line 7155 "sql.c" break; case 522: /* hint_list ::= */ +#line 1029 "sql.y" { yymsp[1].minor.yy824 = createHintNodeList(pCxt, NULL); } +#line 7160 "sql.c" break; case 523: /* hint_list ::= NK_HINT */ +#line 1030 "sql.y" { yylhsminor.yy824 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } +#line 7165 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 528: /* set_quantifier_opt ::= ALL */ +#line 1041 "sql.y" { yymsp[0].minor.yy957 = false; } +#line 7171 "sql.c" break; case 531: /* select_item ::= NK_STAR */ +#line 1048 "sql.y" { yylhsminor.yy952 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } +#line 7176 "sql.c" yymsp[0].minor.yy952 = yylhsminor.yy952; break; case 533: /* select_item ::= common_expression column_alias */ case 543: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==543); +#line 1050 "sql.y" { yylhsminor.yy952 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952), &yymsp[0].minor.yy169); } +#line 7183 "sql.c" yymsp[-1].minor.yy952 = yylhsminor.yy952; break; case 534: /* select_item ::= common_expression AS column_alias */ case 544: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==544); +#line 1051 "sql.y" { yylhsminor.yy952 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), &yymsp[0].minor.yy169); } +#line 7190 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 539: /* partition_by_clause_opt ::= PARTITION BY partition_list */ case 564: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==564); case 584: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==584); +#line 1060 "sql.y" { yymsp[-2].minor.yy824 = yymsp[0].minor.yy824; } +#line 7198 "sql.c" break; case 546: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +#line 1073 "sql.y" { yymsp[-5].minor.yy952 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } +#line 7203 "sql.c" break; case 547: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1074 "sql.y" { yymsp[-3].minor.yy952 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } +#line 7208 "sql.c" break; case 548: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +#line 1076 "sql.y" { yymsp[-5].minor.yy952 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), NULL, yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 7213 "sql.c" break; case 549: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +#line 1079 "sql.y" { yymsp[-7].minor.yy952 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy952), releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), yymsp[-1].minor.yy952, yymsp[0].minor.yy952); } +#line 7218 "sql.c" break; case 550: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +#line 1081 "sql.y" { yymsp[-6].minor.yy952 = createEventWindowNode(pCxt, yymsp[-3].minor.yy952, yymsp[0].minor.yy952); } +#line 7223 "sql.c" break; case 554: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +#line 1087 "sql.y" { yymsp[-3].minor.yy952 = createFillNode(pCxt, yymsp[-1].minor.yy214, NULL); } +#line 7228 "sql.c" break; case 555: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +#line 1088 "sql.y" { yymsp[-5].minor.yy952 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); } +#line 7233 "sql.c" break; case 556: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +#line 1089 "sql.y" { yymsp[-5].minor.yy952 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); } +#line 7238 "sql.c" break; case 557: /* fill_mode ::= NONE */ +#line 1093 "sql.y" { yymsp[0].minor.yy214 = FILL_MODE_NONE; } +#line 7243 "sql.c" break; case 558: /* fill_mode ::= PREV */ +#line 1094 "sql.y" { yymsp[0].minor.yy214 = FILL_MODE_PREV; } +#line 7248 "sql.c" break; case 559: /* fill_mode ::= NULL */ +#line 1095 "sql.y" { yymsp[0].minor.yy214 = FILL_MODE_NULL; } +#line 7253 "sql.c" break; case 560: /* fill_mode ::= NULL_F */ +#line 1096 "sql.y" { yymsp[0].minor.yy214 = FILL_MODE_NULL_F; } +#line 7258 "sql.c" break; case 561: /* fill_mode ::= LINEAR */ +#line 1097 "sql.y" { yymsp[0].minor.yy214 = FILL_MODE_LINEAR; } +#line 7263 "sql.c" break; case 562: /* fill_mode ::= NEXT */ +#line 1098 "sql.y" { yymsp[0].minor.yy214 = FILL_MODE_NEXT; } +#line 7268 "sql.c" break; case 565: /* group_by_list ::= expr_or_subquery */ +#line 1107 "sql.y" { yylhsminor.yy824 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 7273 "sql.c" yymsp[0].minor.yy824 = yylhsminor.yy824; break; case 566: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +#line 1108 "sql.y" { yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy952))); } +#line 7279 "sql.c" yymsp[-2].minor.yy824 = yylhsminor.yy824; break; case 570: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +#line 1115 "sql.y" { yymsp[-5].minor.yy952 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy952), releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } +#line 7285 "sql.c" break; case 571: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +#line 1117 "sql.y" { yymsp[-3].minor.yy952 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy952)); } +#line 7290 "sql.c" break; case 574: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ +#line 1124 "sql.y" { yylhsminor.yy952 = addOrderByClause(pCxt, yymsp[-3].minor.yy952, yymsp[-2].minor.yy824); yylhsminor.yy952 = addSlimitClause(pCxt, yylhsminor.yy952, yymsp[-1].minor.yy952); yylhsminor.yy952 = addLimitClause(pCxt, yylhsminor.yy952, yymsp[0].minor.yy952); } +#line 7299 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 577: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +#line 1134 "sql.y" { yylhsminor.yy952 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy952, yymsp[0].minor.yy952); } +#line 7305 "sql.c" yymsp[-3].minor.yy952 = yylhsminor.yy952; break; case 578: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +#line 1136 "sql.y" { yylhsminor.yy952 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy952, yymsp[0].minor.yy952); } +#line 7311 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 586: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ case 590: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==590); +#line 1150 "sql.y" { yymsp[-1].minor.yy952 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 7318 "sql.c" break; case 587: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 591: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==591); +#line 1151 "sql.y" { yymsp[-3].minor.yy952 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +#line 7324 "sql.c" break; case 588: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 592: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==592); +#line 1152 "sql.y" { yymsp[-3].minor.yy952 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +#line 7330 "sql.c" break; case 593: /* subquery ::= NK_LP query_expression NK_RP */ +#line 1160 "sql.y" { yylhsminor.yy952 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy952); } +#line 7335 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 598: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +#line 1174 "sql.y" { yylhsminor.yy952 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy952), yymsp[-1].minor.yy498, yymsp[0].minor.yy977); } +#line 7341 "sql.c" yymsp[-2].minor.yy952 = yylhsminor.yy952; break; case 599: /* ordering_specification_opt ::= */ +#line 1178 "sql.y" { yymsp[1].minor.yy498 = ORDER_ASC; } +#line 7347 "sql.c" break; case 600: /* ordering_specification_opt ::= ASC */ +#line 1179 "sql.y" { yymsp[0].minor.yy498 = ORDER_ASC; } +#line 7352 "sql.c" break; case 601: /* ordering_specification_opt ::= DESC */ +#line 1180 "sql.y" { yymsp[0].minor.yy498 = ORDER_DESC; } +#line 7357 "sql.c" break; case 602: /* null_ordering_opt ::= */ +#line 1184 "sql.y" { yymsp[1].minor.yy977 = NULL_ORDER_DEFAULT; } +#line 7362 "sql.c" break; case 603: /* null_ordering_opt ::= NULLS FIRST */ +#line 1185 "sql.y" { yymsp[-1].minor.yy977 = NULL_ORDER_FIRST; } +#line 7367 "sql.c" break; case 604: /* null_ordering_opt ::= NULLS LAST */ +#line 1186 "sql.y" { yymsp[-1].minor.yy977 = NULL_ORDER_LAST; } +#line 7372 "sql.c" break; default: break; @@ -6290,6 +7431,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) { @@ -6300,6 +7442,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 7445 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE @@ -6385,12 +7528,56 @@ void Parse( } #endif - do{ + while(1){ /* Exit by "break" */ + assert( yypParser->yytos>=yypParser->yystack ); assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, - yyminor ParseCTX_PARAM); + unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ +#ifndef NDEBUG + assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); + if( yyTraceFILE ){ + int yysize = yyRuleInfoNRhs[yyruleno]; + if( yysize ){ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos[yysize].stateno); + }else{ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", + yyTracePrompt, yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == + (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + break; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + break; + } + } +#endif + } + yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY @@ -6446,14 +7633,13 @@ void Parse( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos >= yypParser->yystack - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE - ){ + while( yypParser->yytos > yypParser->yystack ){ + yyact = yy_find_reduce_action(yypParser->yytos->stateno, + YYERRORSYMBOL); + if( yyact<=YY_MAX_SHIFTREDUCE ) break; yy_pop_parser_stack(yypParser); } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY @@ -6503,7 +7689,7 @@ void Parse( break; #endif } - }while( yypParser->yytos>yypParser->yystack ); + } #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; From 09cd6e59ac899fb47826f5cc4727e1e46324d1c6 Mon Sep 17 00:00:00 2001 From: wangjiaming Date: Thu, 24 Aug 2023 14:07:40 +0800 Subject: [PATCH 053/107] Revert "add doc for column comment" --- docs/en/12-taos-sql/03-table.md | 7 ++----- docs/zh/12-taos-sql/03-table.md | 12 +++--------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/docs/en/12-taos-sql/03-table.md b/docs/en/12-taos-sql/03-table.md index b84c17bfac..10c44848c9 100644 --- a/docs/en/12-taos-sql/03-table.md +++ b/docs/en/12-taos-sql/03-table.md @@ -91,15 +91,12 @@ ALTER TABLE [db_name.]tb_name alter_table_clause alter_table_clause: { alter_table_options - | ADD COLUMN col_name column_definition + | ADD COLUMN col_name column_type | DROP COLUMN col_name - | MODIFY COLUMN col_name column_definition + | MODIFY COLUMN col_name column_type | RENAME COLUMN old_col_name new_col_name } -column_definition: - type_name [comment 'string_value'] - alter_table_options: alter_table_option ... diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md index f5540aeb63..9258258263 100644 --- a/docs/zh/12-taos-sql/03-table.md +++ b/docs/zh/12-taos-sql/03-table.md @@ -23,10 +23,7 @@ create_subtable_clause: { } create_definition: - col_name column_definition - -column_definition: - type_name [comment 'string_value'] + col_name column_type table_options: table_option ... @@ -92,15 +89,12 @@ ALTER TABLE [db_name.]tb_name alter_table_clause alter_table_clause: { alter_table_options - | ADD COLUMN col_name column_definition + | ADD COLUMN col_name column_type | DROP COLUMN col_name - | MODIFY COLUMN col_name column_definition + | MODIFY COLUMN col_name column_type | RENAME COLUMN old_col_name new_col_name } -column_definition: - type_name [comment 'string_value'] - alter_table_options: alter_table_option ... From 13baeb1108d007bedc2cd4a5df9a82c369adcb3e Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 24 Aug 2023 14:35:00 +0800 Subject: [PATCH 054/107] fix: add hints comments --- docs/en/12-taos-sql/06-select.md | 30 +++++++++++++++++++++++++++++- docs/zh/12-taos-sql/06-select.md | 30 +++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) mode change 100644 => 100755 docs/en/12-taos-sql/06-select.md mode change 100644 => 100755 docs/zh/12-taos-sql/06-select.md diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md old mode 100644 new mode 100755 index b28d5acb18..5af06fa0db --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -9,7 +9,7 @@ description: This document describes how to query data in TDengine. ```sql SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} -SELECT [DISTINCT] select_list +SELECT [hints] [DISTINCT] select_list from_clause [WHERE condition] [partition_by_clause] @@ -21,6 +21,11 @@ SELECT [DISTINCT] select_list [LIMIT limit_val [OFFSET offset_val]] [>> export_file] +hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */ + +hint: + BATCH_SCAN | NO_BATCH_SCAN + select_list: select_expr [, select_expr] ... @@ -70,6 +75,29 @@ order_expr: {expr | position | c_alias} [DESC | ASC] [NULLS FIRST | NULLS LAST] ``` +## Hints + +Hints are a means of user control over query optimization for individual statements. Hints will be ignore automatically if they are not applicable to the current query statement. The specific instructions are as follows: + +- Hints syntax starts with `/*+` and ends with `*/`, spaces are allowed before or after. +- Hints syntax can only follow the SELECT keyword. +- Each hints can contain multiple hint, separated by spaces. When multiple hints conflict or are identical, whichever comes first takes effect. +- When an error occurs with a hint in hints, the effective hint before the error is still valid, and the current and subsequent hints are ignored. +- hint_param_list are arguments to each hint, which varies according to each hint. + +The list of currently supported Hints is as follows£º + +| **Hint** | **Params** | **Comment** | **Scopt** | +| :-----------: | -------------- | -------------------------- | -------------------------- | +| BATCH_SCAN | None | Batch table scan | JOIN statment for stable | +| NO_BATCH_SCAN | None | Sequential table scan | JOIN statment for stable | + +For example£º + +```sql +SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0 and a.ts = b.ts; +``` + ## Lists A query can be performed on some or all columns. Data and tag columns can all be included in the SELECT list. diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md old mode 100644 new mode 100755 index 9560c3c4df..cb3e0b86b0 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -9,7 +9,7 @@ description: 查询数æ®çš„详细语法 ```sql SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} -SELECT [DISTINCT] select_list +SELECT [hints] [DISTINCT] select_list from_clause [WHERE condition] [partition_by_clause] @@ -21,6 +21,11 @@ SELECT [DISTINCT] select_list [LIMIT limit_val [OFFSET offset_val]] [>> export_file] +hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */ + +hint: + BATCH_SCAN | NO_BATCH_SCAN + select_list: select_expr [, select_expr] ... @@ -70,6 +75,29 @@ order_expr: {expr | position | c_alias} [DESC | ASC] [NULLS FIRST | NULLS LAST] ``` +## Hints + +Hints 是用户控制å•ä¸ªè¯­å¥æŸ¥è¯¢ä¼˜åŒ–çš„ä¸€ç§æ‰‹æ®µï¼Œå½“ Hint ä¸é€‚用于当å‰çš„æŸ¥è¯¢è¯­å¥æ—¶ä¼šè¢«è‡ªåŠ¨å¿½ç•¥ï¼Œå…·ä½“è¯´æ˜Žå¦‚ä¸‹ï¼š + +- Hints 语法以`/*+`开始,终于`*/`,å‰åŽå¯æœ‰ç©ºæ ¼ã€‚ +- Hints 语法åªèƒ½è·Ÿéšåœ¨ SELECT 关键字åŽã€‚ +- æ¯ä¸ª Hints å¯ä»¥åŒ…å«å¤šä¸ª Hint,Hint 间以空格分开,当多个 Hint å†²çªæˆ–ç›¸åŒæ—¶ä»¥å…ˆå‡ºçŽ°çš„ä¸ºå‡†ã€‚ +- 当 Hints 中æŸä¸ª Hint 出现错误时,错误出现之å‰çš„æœ‰æ•ˆ Hint ä»ç„¶æœ‰æ•ˆï¼Œå½“å‰åŠä¹‹åŽçš„ Hint 被忽略。 +- hint_param_list 是æ¯ä¸ª Hint çš„å‚æ•°ï¼Œæ ¹æ®æ¯ä¸ª Hint çš„ä¸åŒè€Œä¸åŒã€‚ + +ç›®å‰æ”¯æŒçš„ Hints 列表如下: + +| **Hint** | **傿•°** | **说明** | **适用范围** | +| :-----------: | -------------- | -------------------------- | -------------------------- | +| BATCH_SCAN | æ—  | 采用批é‡è¯»è¡¨çš„æ–¹å¼ | 超级表 JOIN è¯­å¥ | +| NO_BATCH_SCAN | æ—  | 采用顺åºè¯»è¡¨çš„æ–¹å¼ | 超级表 JOIN è¯­å¥ | + +举例: + +```sql +SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0 and a.ts = b.ts; +``` + ## 列表 查询语å¥å¯ä»¥æŒ‡å®šéƒ¨åˆ†æˆ–全部列作为返回结果。数æ®åˆ—和标签列都å¯ä»¥å‡ºçŽ°åœ¨åˆ—è¡¨ä¸­ã€‚ From f905a77217c6e9b87e4ca27af205eb8c1c2a04d5 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 24 Aug 2023 14:37:16 +0800 Subject: [PATCH 055/107] fix: typo --- docs/en/12-taos-sql/06-select.md | 4 +- docs/en/12-taos-sql/06-select.md.bak | 478 +++++++++++++++++++++++++++ 2 files changed, 480 insertions(+), 2 deletions(-) create mode 100755 docs/en/12-taos-sql/06-select.md.bak diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md index 5af06fa0db..0bb1d7dfcd 100755 --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -85,14 +85,14 @@ Hints are a means of user control over query optimization for individual stateme - When an error occurs with a hint in hints, the effective hint before the error is still valid, and the current and subsequent hints are ignored. - hint_param_list are arguments to each hint, which varies according to each hint. -The list of currently supported Hints is as follows£º +The list of currently supported Hints is as follows: | **Hint** | **Params** | **Comment** | **Scopt** | | :-----------: | -------------- | -------------------------- | -------------------------- | | BATCH_SCAN | None | Batch table scan | JOIN statment for stable | | NO_BATCH_SCAN | None | Sequential table scan | JOIN statment for stable | -For example£º +For example: ```sql SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0 and a.ts = b.ts; diff --git a/docs/en/12-taos-sql/06-select.md.bak b/docs/en/12-taos-sql/06-select.md.bak new file mode 100755 index 0000000000..5af06fa0db --- /dev/null +++ b/docs/en/12-taos-sql/06-select.md.bak @@ -0,0 +1,478 @@ +--- +title: Select +sidebar_label: Select +description: This document describes how to query data in TDengine. +--- + +## Syntax + +```sql +SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} + +SELECT [hints] [DISTINCT] select_list + from_clause + [WHERE condition] + [partition_by_clause] + [interp_clause] + [window_clause] + [group_by_clause] + [order_by_clasue] + [SLIMIT limit_val [SOFFSET offset_val]] + [LIMIT limit_val [OFFSET offset_val]] + [>> export_file] + +hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */ + +hint: + BATCH_SCAN | NO_BATCH_SCAN + +select_list: + select_expr [, select_expr] ... + +select_expr: { + * + | query_name.* + | [schema_name.] {table_name | view_name} .* + | t_alias.* + | expr [[AS] c_alias] +} + +from_clause: { + table_reference [, table_reference] ... + | join_clause [, join_clause] ... +} + +table_reference: + table_expr t_alias + +table_expr: { + table_name + | view_name + | ( subquery ) +} + +join_clause: + table_reference [INNER] JOIN table_reference ON condition + +window_clause: { + SESSION(ts_col, tol_val) + | STATE_WINDOW(col) + | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)] + +interp_clause: + RANGE(ts_val [, ts_val]) EVERY(every_val) FILL(fill_mod_and_val) + +partition_by_clause: + PARTITION BY expr [, expr] ... + +group_by_clause: + GROUP BY expr [, expr] ... HAVING condition + +order_by_clasue: + ORDER BY order_expr [, order_expr] ... + +order_expr: + {expr | position | c_alias} [DESC | ASC] [NULLS FIRST | NULLS LAST] +``` + +## Hints + +Hints are a means of user control over query optimization for individual statements. Hints will be ignore automatically if they are not applicable to the current query statement. The specific instructions are as follows: + +- Hints syntax starts with `/*+` and ends with `*/`, spaces are allowed before or after. +- Hints syntax can only follow the SELECT keyword. +- Each hints can contain multiple hint, separated by spaces. When multiple hints conflict or are identical, whichever comes first takes effect. +- When an error occurs with a hint in hints, the effective hint before the error is still valid, and the current and subsequent hints are ignored. +- hint_param_list are arguments to each hint, which varies according to each hint. + +The list of currently supported Hints is as follows£º + +| **Hint** | **Params** | **Comment** | **Scopt** | +| :-----------: | -------------- | -------------------------- | -------------------------- | +| BATCH_SCAN | None | Batch table scan | JOIN statment for stable | +| NO_BATCH_SCAN | None | Sequential table scan | JOIN statment for stable | + +For example£º + +```sql +SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0 and a.ts = b.ts; +``` + +## Lists + +A query can be performed on some or all columns. Data and tag columns can all be included in the SELECT list. + +### Wildcards + +You can use an asterisk (\*) as a wildcard character to indicate all columns. For normal tables or sub-tables, the asterisk indicates only data columns. For supertables, tag columns are also included when using asterisk (\*). + +```sql +SELECT * FROM d1001; +``` + +You can use a table name as a prefix before an asterisk. For example, the following SQL statements both return all columns from the d1001 table: + +```sql +SELECT * FROM d1001; +SELECT d1001.* FROM d1001; +``` + +However, in a JOIN query, using a table name prefix with an asterisk returns different results. In this case, querying * returns all data in all columns in all tables (not including tags), whereas using a table name prefix returns all data in all columns in the specified table only. + +```sql +SELECT * FROM d1001, d1003 WHERE d1001.ts=d1003.ts; +SELECT d1001.* FROM d1001,d1003 WHERE d1001.ts = d1003.ts; +``` + +The first of the preceding SQL statements returns all columns from the d1001 and d1003 tables, but the second of the preceding SQL statements returns all columns from the d1001 table only. + +With regard to the other SQL functions that support wildcards, the differences are as follows: +`count(*)` only returns one column. `first`, `last`, and `last_row` return all columns. + +### Tag Columns + +You can query tag columns in supertables and subtables and receive results in the same way as querying data columns. + +```sql +SELECT location, groupid, current FROM d1001 LIMIT 2; +``` + +### Distinct Values + +The DISTINCT keyword returns only values that are different over one or more columns. You can use the DISTINCT keyword with tag columns and data columns. + +The following SQL statement returns distinct values from a tag column: + +```sql +SELECT DISTINCT tag_name [, tag_name ...] FROM stb_name; +``` + +The following SQL statement returns distinct values from a data column: + +```sql +SELECT DISTINCT col_name [, col_name ...] FROM tb_name; +``` + +:::info + +1. Configuration parameter `maxNumOfDistinctRes` in `taos.cfg` is used to control the number of rows to output. The minimum configurable value is 100,000, the maximum configurable value is 100,000,000, the default value is 1,000,000. If the actual number of rows exceeds the value of this parameter, only the number of rows specified by this parameter will be output. +2. It can't be guaranteed that the results selected by using `DISTINCT` on columns of `FLOAT` or `DOUBLE` are exactly unique because of the precision errors in floating point numbers. + +::: + +### Column Names + +When using `SELECT`, the column names in the result set will be the same as that in the select clause if `AS` is not used. `AS` can be used to rename the column names in the result set. For example: + +```sql +taos> SELECT ts, ts AS primary_key_ts FROM d1001; +``` + +`AS` can't be used together with `first(*)`, `last(*)`, or `last_row(*)`. + +### Pseudocolumns + +**Pseudocolumn:** A pseudo-column behaves like a table column but is not actually stored in the table. You can select from pseudo-columns, but you cannot insert, update, or delete their values. A pseudo-column is also similar to a function without arguments. This section describes these pseudo-columns: + +**TBNAME** +The TBNAME pseudocolumn in a supertable contains the names of subtables within the supertable. + +The following SQL statement returns all unique subtable names and locations within the meters supertable: + +```mysql +SELECT DISTINCT TBNAME, location FROM meters; +``` + +Use the `INS_TAGS` system table in `INFORMATION_SCHEMA` to query the information for subtables in a supertable. For example, the following statement returns the name and tag values for each subtable in the `meters` supertable. + +```mysql +SELECT table_name, tag_name, tag_type, tag_value FROM information_schema.ins_tags WHERE stable_name='meters'; +``` + +The following SQL statement returns the number of subtables within the meters supertable. + +```mysql +SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters); +``` + +In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause. For example: + +**\_QSTART and \_QEND** + +The \_QSTART and \_QEND pseudocolumns contain the beginning and end of the time range of a query. If the WHERE clause in a statement does not contain valid timestamps, the time range is equal to [-2^63, 2^63 - 1]. + +The \_QSTART and \_QEND pseudocolumns cannot be used in a WHERE clause. + +**\_WSTART, \_WEND, and \_WDURATION** + +The \_WSTART, \_WEND, and \_WDURATION pseudocolumns indicate the beginning, end, and duration of a window. + +These pseudocolumns can be used only in time window-based aggregations and must occur after the aggregation clause. + +**\_c0 and \_ROWTS** + +In TDengine, the first column of all tables must be a timestamp. This column is the primary key of the table. The \_c0 and \_ROWTS pseudocolumns both represent the values of this column. These pseudocolumns enable greater flexibility and standardization. For example, you can use functions such as MAX and MIN with these pseudocolumns. + +```sql +select _rowts, max(current) from meters; +``` + +**\_IROWTS** + +The \_IROWTS pseudocolumn can only be used with INTERP function. This pseudocolumn can be used to retrieve the corresponding timestamp column associated with the interpolation results. + +```sql +select _irowts, interp(current) from meters range('2020-01-01 10:00:00', '2020-01-01 10:30:00') every(1s) fill(linear); +``` + +## Query Objects + +`FROM` can be followed by a number of tables or super tables, or can be followed by a sub-query. +If no database is specified as current database in use, table names must be preceded with database name, for example, `power.d1001`. + +You can perform INNER JOIN statements based on the primary key. The following conditions apply: + +1. You can use FROM table list or an explicit JOIN clause. +2. For standard tables and subtables, you must specify an ON condition and the condition must be equivalent to the primary key. +3. For supertables, the ON condition must be equivalent to the primary key. In addition, the tag columns of the tables on which the INNER JOIN is performed must have a one-to-one relationship. You cannot specify an OR condition. +4. The tables that are included in a JOIN clause must be of the same type (supertable, standard table, or subtable). +5. You can include subqueries before and after the JOIN keyword. +6. You cannot include more than ten tables in a JOIN clause. +7. You cannot include a FILL clause and a JOIN clause in the same statement. + +## GROUP BY + +If you use a GROUP BY clause, the SELECT list can only include the following items: + +1. Constants +2. Aggregate functions +3. Expressions that are consistent with the expression following the GROUP BY clause +4. Expressions that include the preceding expression + +The GROUP BY clause groups each row of data by the value of the expression following the clause and returns a combined result for each group. + +The expressions in a GROUP BY clause can include any column in any table or view. It is not necessary that the expressions appear in the SELECT list. + +The GROUP BY clause does not guarantee that the results are ordered. If you want to ensure that grouped data is ordered, use the ORDER BY clause. + + +## PARTITION BY + +The PARTITION BY clause is a TDengine-specific extension to standard SQL. This clause partitions data based on the part_list and performs computations per partition. + +For more information, see TDengine Extensions. + +## ORDER BY + +The ORDER BY keyword orders query results. If you do not include an ORDER BY clause in a query, the order of the results can be inconsistent. + +You can specify integers after ORDER BY to indicate the order in which you want the items in the SELECT list to be displayed. For example, 1 indicates the first item in the select list. + +You can specify ASC for ascending order or DESC for descending order. + +You can also use the NULLS keyword to specify the position of null values. Ascending order uses NULLS LAST by default. Descending order uses NULLS FIRST by default. + +## LIMIT + +The LIMIT keyword controls the number of results that are displayed. You can also use the OFFSET keyword to specify the result to display first. `LIMIT` and `OFFSET` are executed after `ORDER BY` in the query execution. You can include an offset in a LIMIT clause. For example, LIMIT 5 OFFSET 2 can also be written LIMIT 2, 5. Both of these clauses display the third through the seventh results. + +In a statement that includes a PARTITION BY/GROUP BY clause, the LIMIT keyword is performed on each partition/group, not on the entire set of results. + +## SLIMIT + +The SLIMIT keyword is used with a PARTITION BY/GROUP BY clause to control the number of partitions/groups that are displayed. You can include an offset in a SLIMIT clause. For example, SLIMIT 5 OFFSET 2 can also be written LIMIT 2, 5. Both of these clauses display the third through the seventh partitions/groups. + +Note: If you include an ORDER BY clause, only one partition/group can be displayed. + +## Special Query + +Some special query functions can be invoked without `FROM` sub-clause. + +### Obtain Current Database + +The following SQL statement returns the current database. If a database has not been specified on login or with the `USE` command, a null value is returned. + +```sql +SELECT DATABASE(); +``` + +### Obtain Current Version + +```sql +SELECT CLIENT_VERSION(); +SELECT SERVER_VERSION(); +``` + +### Obtain Server Status + +The following SQL statement returns the status of the TDengine server. An integer indicates that the server is running normally. An error code indicates that an error has occurred. This statement can also detect whether a connection pool or third-party tool is connected to TDengine properly. By using this statement, you can ensure that connections in a pool are not lost due to an incorrect heartbeat detection statement. + +```sql +SELECT SERVER_STATUS(); +``` + +### Obtain Current Time + +```sql +SELECT NOW(); +``` + +### Obtain Current Date + +```sql +SELECT TODAY(); +``` + +### Obtain Current Time Zone + +```sql +SELECT TIMEZONE(); +``` + +## Regular Expression + +### Syntax + +```txt +WHERE (column|tbname) match/MATCH/nmatch/NMATCH _regex_ +``` + +### Specification + +TDengine supports POSIX regular expression syntax. For more information, see [Regular Expressions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html). + +### Restrictions + +Regular expression filtering is supported only on table names (TBNAME), BINARY tags, and NCHAR tags. Regular expression filtering cannot be performed on data columns. + +A regular expression string cannot exceed 128 bytes. You can configure this value by modifying the maxRegexStringLen parameter on the TDengine Client. The modified value takes effect when the client is restarted. + +## CASE Expressions + +### Syntax + +```txt +CASE value WHEN compare_value THEN result [WHEN compare_value THEN result ...] [ELSE result] END +CASE WHEN condition THEN result [WHEN condition THEN result ...] [ELSE result] END +``` + +### Description +CASE expressions let you use IF ... THEN ... ELSE logic in SQL statements without having to invoke procedures. + +The first CASE syntax returns the `result` for the first `value`=`compare_value` comparison that is true. + +The second syntax returns the `result` for the first `condition` that is true. + +If no comparison or condition is true, the result after ELSE is returned, or NULL if there is no ELSE part. + +The return type of the CASE expression is the result type of the first WHEN WHEN part, and the result type of the other WHEN WHEN parts and ELSE parts can be converted to them, otherwise TDengine will report an error. + +### Examples + +A device has three status codes to display its status. The statements are as follows: + +```sql +SELECT CASE dev_status WHEN 1 THEN 'Running' WHEN 2 THEN 'Warning' WHEN 3 THEN 'Downtime' ELSE 'Unknown' END FROM dev_table; +``` + +The average voltage value of the smart meter is counted. When the voltage is less than 200 or more than 250, it is considered that the statistics is wrong, and the value is corrected to 220. The statement is as follows: + +```sql +SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) FROM meters; +``` + +## JOIN + +TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables. + +For standard tables: + +```sql +SELECT * +FROM temp_tb_1 t1, pressure_tb_1 t2 +WHERE t1.ts = t2.ts +``` + +For supertables: + +```sql +SELECT * +FROM temp_stable t1, temp_stable t2 +WHERE t1.ts = t2.ts AND t1.deviceid = t2.deviceid AND t1.status=0; +``` + +For sub-table and super table: + +```sql +SELECT * +FROM temp_ctable t1, temp_stable t2 +WHERE t1.ts = t2.ts AND t1.deviceid = t2.deviceid AND t1.status=0; +``` + +Similarly, join operations can be performed on the result sets of multiple subqueries. + +## Nested Query + +Nested query is also called sub query. This means that in a single SQL statement the result of inner query can be used as the data source of the outer query. + +From 2.2.0.0, unassociated sub query can be used in the `FROM` clause. Unassociated means the sub query doesn't use the parameters in the parent query. More specifically, in the `tb_name_list` of `SELECT` statement, an independent SELECT statement can be used. So a complete nested query looks like: + +``` +SELECT ... FROM (SELECT ... FROM ...) ...; +``` + +:::info + +- The result of a nested query is returned as a virtual table used by the outer query. It's recommended to give an alias to this table for the convenience of using it in the outer query. +- JOIN operation is allowed between tables/STables inside both inner and outer queries. Join operation can be performed on the result set of the inner query. +- The features that can be used in the inner query are the same as those that can be used in a non-nested query. + - `ORDER BY` inside the inner query is unnecessary and will slow down the query performance significantly. It is best to avoid the use of `ORDER BY` inside the inner query. +- Compared to the non-nested query, the functionality that can be used in the outer query has the following restrictions: + - Functions + - If the result set returned by the inner query doesn't contain timestamp column, then functions relying on timestamp can't be used in the outer query, like INTERP,DERIVATIVE, IRATE, LAST_ROW, FIRST, LAST, TWA, STATEDURATION, TAIL, UNIQUE. + - If the result set returned by the inner query are not sorted in order by timestamp, then functions relying on data ordered by timestamp can't be used in the outer query, like LEASTSQUARES, ELAPSED, INTERP, DERIVATIVE, IRATE, TWA, DIFF, STATECOUNT, STATEDURATION, CSUM, MAVG, TAIL, UNIQUE. + - Functions that need to scan the data twice can't be used in the outer query, like PERCENTILE. + +::: + +## UNION ALL + +```txt title=Syntax +SELECT ... +UNION ALL SELECT ... +[UNION ALL SELECT ...] +``` + +TDengine supports the `UNION ALL` operation. `UNION ALL` operator can be used to combine the result set from multiple select statements as long as the result set of these select statements have exactly the same columns. `UNION ALL` doesn't remove redundant rows from multiple result sets. In a single SQL statement, at most 100 `UNION ALL` can be supported. + +### Examples + +table `tb1` is created using below SQL statement: + +``` +CREATE TABLE tb1 (ts TIMESTAMP, col1 INT, col2 FLOAT, col3 BINARY(50)); +``` + +The rows in the past one hour in `tb1` can be selected using below SQL statement: + +``` +SELECT * FROM tb1 WHERE ts >= NOW - 1h; +``` + +The rows between 2018-06-01 08:00:00.000 and 2018-06-02 08:00:00.000 and col3 ends with 'nny' can be selected in the descending order of timestamp using below SQL statement: + +``` +SELECT * FROM tb1 WHERE ts > '2018-06-01 08:00:00.000' AND ts <= '2018-06-02 08:00:00.000' AND col3 LIKE '%nny' ORDER BY ts DESC; +``` + +The sum of col1 and col2 for rows later than 2018-06-01 08:00:00.000 and whose col2 is bigger than 1.2 can be selected and renamed as "complex", while only 10 rows are output from the 5th row, by below SQL statement: + +``` +SELECT (col1 + col2) AS 'complex' FROM tb1 WHERE ts > '2018-06-01 08:00:00.000' AND col2 > 1.2 LIMIT 10 OFFSET 5; +``` + +The rows in the past 10 minutes and whose col2 is bigger than 3.14 are selected and output to the result file `/home/testoutput.csv` with below SQL statement: + +``` +SELECT COUNT(*) FROM tb1 WHERE ts >= NOW - 10m AND col2 > 3.14 >> /home/testoutput.csv; +``` From c5618588a177798ba26a0e7f12cc97befe7eb346 Mon Sep 17 00:00:00 2001 From: dapan1121 <72057773+dapan1121@users.noreply.github.com> Date: Thu, 24 Aug 2023 14:38:23 +0800 Subject: [PATCH 056/107] Delete 06-select.md.bak --- docs/en/12-taos-sql/06-select.md.bak | 478 --------------------------- 1 file changed, 478 deletions(-) delete mode 100755 docs/en/12-taos-sql/06-select.md.bak diff --git a/docs/en/12-taos-sql/06-select.md.bak b/docs/en/12-taos-sql/06-select.md.bak deleted file mode 100755 index 5af06fa0db..0000000000 --- a/docs/en/12-taos-sql/06-select.md.bak +++ /dev/null @@ -1,478 +0,0 @@ ---- -title: Select -sidebar_label: Select -description: This document describes how to query data in TDengine. ---- - -## Syntax - -```sql -SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} - -SELECT [hints] [DISTINCT] select_list - from_clause - [WHERE condition] - [partition_by_clause] - [interp_clause] - [window_clause] - [group_by_clause] - [order_by_clasue] - [SLIMIT limit_val [SOFFSET offset_val]] - [LIMIT limit_val [OFFSET offset_val]] - [>> export_file] - -hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */ - -hint: - BATCH_SCAN | NO_BATCH_SCAN - -select_list: - select_expr [, select_expr] ... - -select_expr: { - * - | query_name.* - | [schema_name.] {table_name | view_name} .* - | t_alias.* - | expr [[AS] c_alias] -} - -from_clause: { - table_reference [, table_reference] ... - | join_clause [, join_clause] ... -} - -table_reference: - table_expr t_alias - -table_expr: { - table_name - | view_name - | ( subquery ) -} - -join_clause: - table_reference [INNER] JOIN table_reference ON condition - -window_clause: { - SESSION(ts_col, tol_val) - | STATE_WINDOW(col) - | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)] - -interp_clause: - RANGE(ts_val [, ts_val]) EVERY(every_val) FILL(fill_mod_and_val) - -partition_by_clause: - PARTITION BY expr [, expr] ... - -group_by_clause: - GROUP BY expr [, expr] ... HAVING condition - -order_by_clasue: - ORDER BY order_expr [, order_expr] ... - -order_expr: - {expr | position | c_alias} [DESC | ASC] [NULLS FIRST | NULLS LAST] -``` - -## Hints - -Hints are a means of user control over query optimization for individual statements. Hints will be ignore automatically if they are not applicable to the current query statement. The specific instructions are as follows: - -- Hints syntax starts with `/*+` and ends with `*/`, spaces are allowed before or after. -- Hints syntax can only follow the SELECT keyword. -- Each hints can contain multiple hint, separated by spaces. When multiple hints conflict or are identical, whichever comes first takes effect. -- When an error occurs with a hint in hints, the effective hint before the error is still valid, and the current and subsequent hints are ignored. -- hint_param_list are arguments to each hint, which varies according to each hint. - -The list of currently supported Hints is as follows£º - -| **Hint** | **Params** | **Comment** | **Scopt** | -| :-----------: | -------------- | -------------------------- | -------------------------- | -| BATCH_SCAN | None | Batch table scan | JOIN statment for stable | -| NO_BATCH_SCAN | None | Sequential table scan | JOIN statment for stable | - -For example£º - -```sql -SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0 and a.ts = b.ts; -``` - -## Lists - -A query can be performed on some or all columns. Data and tag columns can all be included in the SELECT list. - -### Wildcards - -You can use an asterisk (\*) as a wildcard character to indicate all columns. For normal tables or sub-tables, the asterisk indicates only data columns. For supertables, tag columns are also included when using asterisk (\*). - -```sql -SELECT * FROM d1001; -``` - -You can use a table name as a prefix before an asterisk. For example, the following SQL statements both return all columns from the d1001 table: - -```sql -SELECT * FROM d1001; -SELECT d1001.* FROM d1001; -``` - -However, in a JOIN query, using a table name prefix with an asterisk returns different results. In this case, querying * returns all data in all columns in all tables (not including tags), whereas using a table name prefix returns all data in all columns in the specified table only. - -```sql -SELECT * FROM d1001, d1003 WHERE d1001.ts=d1003.ts; -SELECT d1001.* FROM d1001,d1003 WHERE d1001.ts = d1003.ts; -``` - -The first of the preceding SQL statements returns all columns from the d1001 and d1003 tables, but the second of the preceding SQL statements returns all columns from the d1001 table only. - -With regard to the other SQL functions that support wildcards, the differences are as follows: -`count(*)` only returns one column. `first`, `last`, and `last_row` return all columns. - -### Tag Columns - -You can query tag columns in supertables and subtables and receive results in the same way as querying data columns. - -```sql -SELECT location, groupid, current FROM d1001 LIMIT 2; -``` - -### Distinct Values - -The DISTINCT keyword returns only values that are different over one or more columns. You can use the DISTINCT keyword with tag columns and data columns. - -The following SQL statement returns distinct values from a tag column: - -```sql -SELECT DISTINCT tag_name [, tag_name ...] FROM stb_name; -``` - -The following SQL statement returns distinct values from a data column: - -```sql -SELECT DISTINCT col_name [, col_name ...] FROM tb_name; -``` - -:::info - -1. Configuration parameter `maxNumOfDistinctRes` in `taos.cfg` is used to control the number of rows to output. The minimum configurable value is 100,000, the maximum configurable value is 100,000,000, the default value is 1,000,000. If the actual number of rows exceeds the value of this parameter, only the number of rows specified by this parameter will be output. -2. It can't be guaranteed that the results selected by using `DISTINCT` on columns of `FLOAT` or `DOUBLE` are exactly unique because of the precision errors in floating point numbers. - -::: - -### Column Names - -When using `SELECT`, the column names in the result set will be the same as that in the select clause if `AS` is not used. `AS` can be used to rename the column names in the result set. For example: - -```sql -taos> SELECT ts, ts AS primary_key_ts FROM d1001; -``` - -`AS` can't be used together with `first(*)`, `last(*)`, or `last_row(*)`. - -### Pseudocolumns - -**Pseudocolumn:** A pseudo-column behaves like a table column but is not actually stored in the table. You can select from pseudo-columns, but you cannot insert, update, or delete their values. A pseudo-column is also similar to a function without arguments. This section describes these pseudo-columns: - -**TBNAME** -The TBNAME pseudocolumn in a supertable contains the names of subtables within the supertable. - -The following SQL statement returns all unique subtable names and locations within the meters supertable: - -```mysql -SELECT DISTINCT TBNAME, location FROM meters; -``` - -Use the `INS_TAGS` system table in `INFORMATION_SCHEMA` to query the information for subtables in a supertable. For example, the following statement returns the name and tag values for each subtable in the `meters` supertable. - -```mysql -SELECT table_name, tag_name, tag_type, tag_value FROM information_schema.ins_tags WHERE stable_name='meters'; -``` - -The following SQL statement returns the number of subtables within the meters supertable. - -```mysql -SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters); -``` - -In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause. For example: - -**\_QSTART and \_QEND** - -The \_QSTART and \_QEND pseudocolumns contain the beginning and end of the time range of a query. If the WHERE clause in a statement does not contain valid timestamps, the time range is equal to [-2^63, 2^63 - 1]. - -The \_QSTART and \_QEND pseudocolumns cannot be used in a WHERE clause. - -**\_WSTART, \_WEND, and \_WDURATION** - -The \_WSTART, \_WEND, and \_WDURATION pseudocolumns indicate the beginning, end, and duration of a window. - -These pseudocolumns can be used only in time window-based aggregations and must occur after the aggregation clause. - -**\_c0 and \_ROWTS** - -In TDengine, the first column of all tables must be a timestamp. This column is the primary key of the table. The \_c0 and \_ROWTS pseudocolumns both represent the values of this column. These pseudocolumns enable greater flexibility and standardization. For example, you can use functions such as MAX and MIN with these pseudocolumns. - -```sql -select _rowts, max(current) from meters; -``` - -**\_IROWTS** - -The \_IROWTS pseudocolumn can only be used with INTERP function. This pseudocolumn can be used to retrieve the corresponding timestamp column associated with the interpolation results. - -```sql -select _irowts, interp(current) from meters range('2020-01-01 10:00:00', '2020-01-01 10:30:00') every(1s) fill(linear); -``` - -## Query Objects - -`FROM` can be followed by a number of tables or super tables, or can be followed by a sub-query. -If no database is specified as current database in use, table names must be preceded with database name, for example, `power.d1001`. - -You can perform INNER JOIN statements based on the primary key. The following conditions apply: - -1. You can use FROM table list or an explicit JOIN clause. -2. For standard tables and subtables, you must specify an ON condition and the condition must be equivalent to the primary key. -3. For supertables, the ON condition must be equivalent to the primary key. In addition, the tag columns of the tables on which the INNER JOIN is performed must have a one-to-one relationship. You cannot specify an OR condition. -4. The tables that are included in a JOIN clause must be of the same type (supertable, standard table, or subtable). -5. You can include subqueries before and after the JOIN keyword. -6. You cannot include more than ten tables in a JOIN clause. -7. You cannot include a FILL clause and a JOIN clause in the same statement. - -## GROUP BY - -If you use a GROUP BY clause, the SELECT list can only include the following items: - -1. Constants -2. Aggregate functions -3. Expressions that are consistent with the expression following the GROUP BY clause -4. Expressions that include the preceding expression - -The GROUP BY clause groups each row of data by the value of the expression following the clause and returns a combined result for each group. - -The expressions in a GROUP BY clause can include any column in any table or view. It is not necessary that the expressions appear in the SELECT list. - -The GROUP BY clause does not guarantee that the results are ordered. If you want to ensure that grouped data is ordered, use the ORDER BY clause. - - -## PARTITION BY - -The PARTITION BY clause is a TDengine-specific extension to standard SQL. This clause partitions data based on the part_list and performs computations per partition. - -For more information, see TDengine Extensions. - -## ORDER BY - -The ORDER BY keyword orders query results. If you do not include an ORDER BY clause in a query, the order of the results can be inconsistent. - -You can specify integers after ORDER BY to indicate the order in which you want the items in the SELECT list to be displayed. For example, 1 indicates the first item in the select list. - -You can specify ASC for ascending order or DESC for descending order. - -You can also use the NULLS keyword to specify the position of null values. Ascending order uses NULLS LAST by default. Descending order uses NULLS FIRST by default. - -## LIMIT - -The LIMIT keyword controls the number of results that are displayed. You can also use the OFFSET keyword to specify the result to display first. `LIMIT` and `OFFSET` are executed after `ORDER BY` in the query execution. You can include an offset in a LIMIT clause. For example, LIMIT 5 OFFSET 2 can also be written LIMIT 2, 5. Both of these clauses display the third through the seventh results. - -In a statement that includes a PARTITION BY/GROUP BY clause, the LIMIT keyword is performed on each partition/group, not on the entire set of results. - -## SLIMIT - -The SLIMIT keyword is used with a PARTITION BY/GROUP BY clause to control the number of partitions/groups that are displayed. You can include an offset in a SLIMIT clause. For example, SLIMIT 5 OFFSET 2 can also be written LIMIT 2, 5. Both of these clauses display the third through the seventh partitions/groups. - -Note: If you include an ORDER BY clause, only one partition/group can be displayed. - -## Special Query - -Some special query functions can be invoked without `FROM` sub-clause. - -### Obtain Current Database - -The following SQL statement returns the current database. If a database has not been specified on login or with the `USE` command, a null value is returned. - -```sql -SELECT DATABASE(); -``` - -### Obtain Current Version - -```sql -SELECT CLIENT_VERSION(); -SELECT SERVER_VERSION(); -``` - -### Obtain Server Status - -The following SQL statement returns the status of the TDengine server. An integer indicates that the server is running normally. An error code indicates that an error has occurred. This statement can also detect whether a connection pool or third-party tool is connected to TDengine properly. By using this statement, you can ensure that connections in a pool are not lost due to an incorrect heartbeat detection statement. - -```sql -SELECT SERVER_STATUS(); -``` - -### Obtain Current Time - -```sql -SELECT NOW(); -``` - -### Obtain Current Date - -```sql -SELECT TODAY(); -``` - -### Obtain Current Time Zone - -```sql -SELECT TIMEZONE(); -``` - -## Regular Expression - -### Syntax - -```txt -WHERE (column|tbname) match/MATCH/nmatch/NMATCH _regex_ -``` - -### Specification - -TDengine supports POSIX regular expression syntax. For more information, see [Regular Expressions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html). - -### Restrictions - -Regular expression filtering is supported only on table names (TBNAME), BINARY tags, and NCHAR tags. Regular expression filtering cannot be performed on data columns. - -A regular expression string cannot exceed 128 bytes. You can configure this value by modifying the maxRegexStringLen parameter on the TDengine Client. The modified value takes effect when the client is restarted. - -## CASE Expressions - -### Syntax - -```txt -CASE value WHEN compare_value THEN result [WHEN compare_value THEN result ...] [ELSE result] END -CASE WHEN condition THEN result [WHEN condition THEN result ...] [ELSE result] END -``` - -### Description -CASE expressions let you use IF ... THEN ... ELSE logic in SQL statements without having to invoke procedures. - -The first CASE syntax returns the `result` for the first `value`=`compare_value` comparison that is true. - -The second syntax returns the `result` for the first `condition` that is true. - -If no comparison or condition is true, the result after ELSE is returned, or NULL if there is no ELSE part. - -The return type of the CASE expression is the result type of the first WHEN WHEN part, and the result type of the other WHEN WHEN parts and ELSE parts can be converted to them, otherwise TDengine will report an error. - -### Examples - -A device has three status codes to display its status. The statements are as follows: - -```sql -SELECT CASE dev_status WHEN 1 THEN 'Running' WHEN 2 THEN 'Warning' WHEN 3 THEN 'Downtime' ELSE 'Unknown' END FROM dev_table; -``` - -The average voltage value of the smart meter is counted. When the voltage is less than 200 or more than 250, it is considered that the statistics is wrong, and the value is corrected to 220. The statement is as follows: - -```sql -SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) FROM meters; -``` - -## JOIN - -TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables. - -For standard tables: - -```sql -SELECT * -FROM temp_tb_1 t1, pressure_tb_1 t2 -WHERE t1.ts = t2.ts -``` - -For supertables: - -```sql -SELECT * -FROM temp_stable t1, temp_stable t2 -WHERE t1.ts = t2.ts AND t1.deviceid = t2.deviceid AND t1.status=0; -``` - -For sub-table and super table: - -```sql -SELECT * -FROM temp_ctable t1, temp_stable t2 -WHERE t1.ts = t2.ts AND t1.deviceid = t2.deviceid AND t1.status=0; -``` - -Similarly, join operations can be performed on the result sets of multiple subqueries. - -## Nested Query - -Nested query is also called sub query. This means that in a single SQL statement the result of inner query can be used as the data source of the outer query. - -From 2.2.0.0, unassociated sub query can be used in the `FROM` clause. Unassociated means the sub query doesn't use the parameters in the parent query. More specifically, in the `tb_name_list` of `SELECT` statement, an independent SELECT statement can be used. So a complete nested query looks like: - -``` -SELECT ... FROM (SELECT ... FROM ...) ...; -``` - -:::info - -- The result of a nested query is returned as a virtual table used by the outer query. It's recommended to give an alias to this table for the convenience of using it in the outer query. -- JOIN operation is allowed between tables/STables inside both inner and outer queries. Join operation can be performed on the result set of the inner query. -- The features that can be used in the inner query are the same as those that can be used in a non-nested query. - - `ORDER BY` inside the inner query is unnecessary and will slow down the query performance significantly. It is best to avoid the use of `ORDER BY` inside the inner query. -- Compared to the non-nested query, the functionality that can be used in the outer query has the following restrictions: - - Functions - - If the result set returned by the inner query doesn't contain timestamp column, then functions relying on timestamp can't be used in the outer query, like INTERP,DERIVATIVE, IRATE, LAST_ROW, FIRST, LAST, TWA, STATEDURATION, TAIL, UNIQUE. - - If the result set returned by the inner query are not sorted in order by timestamp, then functions relying on data ordered by timestamp can't be used in the outer query, like LEASTSQUARES, ELAPSED, INTERP, DERIVATIVE, IRATE, TWA, DIFF, STATECOUNT, STATEDURATION, CSUM, MAVG, TAIL, UNIQUE. - - Functions that need to scan the data twice can't be used in the outer query, like PERCENTILE. - -::: - -## UNION ALL - -```txt title=Syntax -SELECT ... -UNION ALL SELECT ... -[UNION ALL SELECT ...] -``` - -TDengine supports the `UNION ALL` operation. `UNION ALL` operator can be used to combine the result set from multiple select statements as long as the result set of these select statements have exactly the same columns. `UNION ALL` doesn't remove redundant rows from multiple result sets. In a single SQL statement, at most 100 `UNION ALL` can be supported. - -### Examples - -table `tb1` is created using below SQL statement: - -``` -CREATE TABLE tb1 (ts TIMESTAMP, col1 INT, col2 FLOAT, col3 BINARY(50)); -``` - -The rows in the past one hour in `tb1` can be selected using below SQL statement: - -``` -SELECT * FROM tb1 WHERE ts >= NOW - 1h; -``` - -The rows between 2018-06-01 08:00:00.000 and 2018-06-02 08:00:00.000 and col3 ends with 'nny' can be selected in the descending order of timestamp using below SQL statement: - -``` -SELECT * FROM tb1 WHERE ts > '2018-06-01 08:00:00.000' AND ts <= '2018-06-02 08:00:00.000' AND col3 LIKE '%nny' ORDER BY ts DESC; -``` - -The sum of col1 and col2 for rows later than 2018-06-01 08:00:00.000 and whose col2 is bigger than 1.2 can be selected and renamed as "complex", while only 10 rows are output from the 5th row, by below SQL statement: - -``` -SELECT (col1 + col2) AS 'complex' FROM tb1 WHERE ts > '2018-06-01 08:00:00.000' AND col2 > 1.2 LIMIT 10 OFFSET 5; -``` - -The rows in the past 10 minutes and whose col2 is bigger than 3.14 are selected and output to the result file `/home/testoutput.csv` with below SQL statement: - -``` -SELECT COUNT(*) FROM tb1 WHERE ts >= NOW - 10m AND col2 > 3.14 >> /home/testoutput.csv; -``` From b142979f7fd190c5851d47bd03e0a8c714c6e261 Mon Sep 17 00:00:00 2001 From: liuyao <54liuyao@163.com> Date: Thu, 24 Aug 2023 15:00:09 +0800 Subject: [PATCH 057/107] mem leak --- source/common/src/tdatablock.c | 3 ++- source/libs/executor/src/filloperator.c | 5 ++--- source/libs/executor/src/groupoperator.c | 3 ++- source/libs/executor/src/projectoperator.c | 4 ++++ source/libs/executor/src/scanoperator.c | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 5188b1e27c..f6fce452ed 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1340,8 +1340,9 @@ SSDataBlock* blockCopyOneRow(const SSDataBlock* pDataBlock, int32_t rowIdx) { for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); SColumnInfoData* pSrc = taosArrayGet(pDataBlock->pDataBlock, i); - void* pData = colDataGetData(pSrc, rowIdx); bool isNull = colDataIsNull(pSrc, pDataBlock->info.rows, rowIdx, NULL); + void* pData = NULL; + if (!isNull) pData = colDataGetData(pSrc, rowIdx); colDataSetVal(pDst, 0, pData, isNull); } diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index bf7da7505a..7dbdb547d3 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -838,6 +838,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS (pFillSup->next.key == pFillInfo->nextRowKey && !hasPrevWindow(pFillSup)))) { setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; + resetFillWindow(&pFillSup->prev); pFillSup->prev.key = pFillSup->cur.key; pFillSup->prev.pRowVal = pFillSup->cur.pRowVal; } else if (hasPrevWindow(pFillSup)) { @@ -1230,8 +1231,6 @@ static void doDeleteFillResult(SOperatorInfo* pOperator) { SWinKey nextKey = {.groupId = groupId, .ts = ts}; while (pInfo->srcDelRowIndex < pBlock->info.rows) { - void* nextVal = NULL; - int32_t nextLen = 0; TSKEY delTs = tsStarts[pInfo->srcDelRowIndex]; uint64_t delGroupId = groupIds[pInfo->srcDelRowIndex]; int32_t code = TSDB_CODE_SUCCESS; @@ -1246,7 +1245,7 @@ static void doDeleteFillResult(SOperatorInfo* pOperator) { if (delTs == nextKey.ts) { code = pAPI->stateStore.streamStateCurNext(pOperator->pTaskInfo->streamInfo.pState, pCur); if (code == TSDB_CODE_SUCCESS) { - code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextLen); + code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, NULL, NULL); } // ts will be deleted later if (delTs != ts) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 9228c923a6..7d0fafff73 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -972,7 +972,8 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { SColumnInfoData* pSrcCol = taosArrayGet(pSrc->pDataBlock, slotId); SColumnInfoData* pDestCol = taosArrayGet(pDest->pDataBlock, j); bool isNull = colDataIsNull(pSrcCol, pSrc->info.rows, rowIndex, NULL); - char* pSrcData = colDataGetData(pSrcCol, rowIndex); + char* pSrcData = NULL; + if (!isNull) pSrcData = colDataGetData(pSrcCol, rowIndex); colDataSetVal(pDestCol, pDest->info.rows, pSrcData, isNull); } pDest->info.rows++; diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 1cc377b3ee..7266fb461d 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -372,6 +372,10 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; } + if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { + printDataBlock(p, "project"); + } + return (p->info.rows > 0) ? p : NULL; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index da4bd1e23c..af1740750c 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1247,7 +1247,8 @@ static SSDataBlock* doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32 SColumnInfoData* pSrcCol = taosArrayGet(tmpBlock->pDataBlock, j); SColumnInfoData* pDestCol = taosArrayGet(pResult->pDataBlock, j); bool isNull = colDataIsNull(pSrcCol, tmpBlock->info.rows, i, NULL); - char* pSrcData = colDataGetData(pSrcCol, i); + char* pSrcData = NULL; + if (!isNull) pSrcData = colDataGetData(pSrcCol, i); colDataSetVal(pDestCol, pResult->info.rows, pSrcData, isNull); } pResult->info.rows++; From 523bad3951f2138d9d1298092df3cfa671b8aded Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 24 Aug 2023 15:45:43 +0800 Subject: [PATCH 058/107] fix(stream): continue check wal when meeting empty delete block msg. --- source/dnode/vnode/src/tq/tqRead.c | 107 +++++++++++++++++------------ 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 43f38ade97..d3157dc3b0 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -296,53 +296,70 @@ int32_t tqReaderSeek(STqReader* pReader, int64_t ver, const char* id) { } int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, const char* id) { - int32_t code = walNextValidMsg(pReader); - if (code != TSDB_CODE_SUCCESS) { + int32_t code = 0; + SWalCont* pCont = &pReader->pHead->head; + + while(1) { + code = walNextValidMsg(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + int64_t ver = pCont->version; + if (ver > maxVer) { + tqDebug("maxVer in WAL:%" PRId64 " reached current:%" PRId64 ", do not scan wal anymore, %s", maxVer, ver, id); + return TSDB_CODE_SUCCESS; + } + + if (pCont->msgType == TDMT_VND_SUBMIT) { + void* pBody = POINTER_SHIFT(pCont->body, sizeof(SSubmitReq2Msg)); + int32_t len = pCont->bodyLen - sizeof(SSubmitReq2Msg); + + void* data = taosMemoryMalloc(len); + if (data == NULL) { + // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry + code = TSDB_CODE_OUT_OF_MEMORY; + terrno = code; + + tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", 0); + return code; + } + + memcpy(data, pBody, len); + SPackedData data1 = (SPackedData){.ver = ver, .msgLen = len, .msgStr = data}; + + *pItem = (SStreamQueueItem*)streamDataSubmitNew(&data1, STREAM_INPUT__DATA_SUBMIT); + if (*pItem == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + terrno = code; + tqError("%s failed to create data submit for stream since out of memory", id); + return code; + } + } else if (pCont->msgType == TDMT_VND_DELETE) { + void* pBody = POINTER_SHIFT(pCont->body, sizeof(SMsgHead)); + int32_t len = pCont->bodyLen - sizeof(SMsgHead); + + code = extractDelDataBlock(pBody, len, ver, (SStreamRefDataBlock**)pItem); + if (code == TSDB_CODE_SUCCESS) { + if (*pItem == NULL) { + tqDebug("s-task:%s empty delete msg, discard it, len:%d, ver:%" PRId64, id, len, ver); + // we need to continue check next data in the wal files. + continue; + } else { + tqDebug("s-task:%s delete msg extract from WAL, len:%d, ver:%" PRId64, id, len, ver); + } + } else { + terrno = code; + tqError("s-task:%s extract delete msg from WAL failed, code:%s", id, tstrerror(code)); + return code; + } + + } else { + ASSERT(0); + } + return code; } - - int64_t ver = pReader->pHead->head.version; - if (ver > maxVer) { - tqDebug("maxVer in WAL:%"PRId64" reached current:%"PRId64", do not scan wal anymore, %s", maxVer, ver, id); - return TSDB_CODE_SUCCESS; - } - - if (pReader->pHead->head.msgType == TDMT_VND_SUBMIT) { - void* pBody = POINTER_SHIFT(pReader->pHead->head.body, sizeof(SSubmitReq2Msg)); - int32_t len = pReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg); - - void* data = taosMemoryMalloc(len); - if (data == NULL) { - // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry - terrno = TSDB_CODE_OUT_OF_MEMORY; - tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", 0); - return -1; - } - - memcpy(data, pBody, len); - SPackedData data1 = (SPackedData){.ver = ver, .msgLen = len, .msgStr = data}; - - *pItem = (SStreamQueueItem*)streamDataSubmitNew(&data1, STREAM_INPUT__DATA_SUBMIT); - if (*pItem == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - tqError("%s failed to create data submit for stream since out of memory", id); - return terrno; - } - } else if (pReader->pHead->head.msgType == TDMT_VND_DELETE) { - void* pBody = POINTER_SHIFT(pReader->pHead->head.body, sizeof(SMsgHead)); - int32_t len = pReader->pHead->head.bodyLen - sizeof(SMsgHead); - - code = extractDelDataBlock(pBody, len, ver, (SStreamRefDataBlock**)pItem); - if (code != TSDB_CODE_SUCCESS) { - tqError("s-task:%s extract delete msg from WAL failed, code:%s", id, tstrerror(code)); - } else { - tqDebug("s-task:%s delete msg extract from WAL, len:%d, ver:%"PRId64, id, len, ver); - } - } else { - ASSERT(0); - } - - return 0; } // todo ignore the error in wal? From 4c6bc4d2c3f33686f138d75101371191cf405f5e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 24 Aug 2023 16:10:03 +0800 Subject: [PATCH 059/107] fix(stream): continue check wal when meeting empty delete block msg. --- source/dnode/vnode/src/tq/tqRead.c | 107 +++++++++++++++++------------ 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 43f38ade97..d3157dc3b0 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -296,53 +296,70 @@ int32_t tqReaderSeek(STqReader* pReader, int64_t ver, const char* id) { } int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, const char* id) { - int32_t code = walNextValidMsg(pReader); - if (code != TSDB_CODE_SUCCESS) { + int32_t code = 0; + SWalCont* pCont = &pReader->pHead->head; + + while(1) { + code = walNextValidMsg(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + int64_t ver = pCont->version; + if (ver > maxVer) { + tqDebug("maxVer in WAL:%" PRId64 " reached current:%" PRId64 ", do not scan wal anymore, %s", maxVer, ver, id); + return TSDB_CODE_SUCCESS; + } + + if (pCont->msgType == TDMT_VND_SUBMIT) { + void* pBody = POINTER_SHIFT(pCont->body, sizeof(SSubmitReq2Msg)); + int32_t len = pCont->bodyLen - sizeof(SSubmitReq2Msg); + + void* data = taosMemoryMalloc(len); + if (data == NULL) { + // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry + code = TSDB_CODE_OUT_OF_MEMORY; + terrno = code; + + tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", 0); + return code; + } + + memcpy(data, pBody, len); + SPackedData data1 = (SPackedData){.ver = ver, .msgLen = len, .msgStr = data}; + + *pItem = (SStreamQueueItem*)streamDataSubmitNew(&data1, STREAM_INPUT__DATA_SUBMIT); + if (*pItem == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + terrno = code; + tqError("%s failed to create data submit for stream since out of memory", id); + return code; + } + } else if (pCont->msgType == TDMT_VND_DELETE) { + void* pBody = POINTER_SHIFT(pCont->body, sizeof(SMsgHead)); + int32_t len = pCont->bodyLen - sizeof(SMsgHead); + + code = extractDelDataBlock(pBody, len, ver, (SStreamRefDataBlock**)pItem); + if (code == TSDB_CODE_SUCCESS) { + if (*pItem == NULL) { + tqDebug("s-task:%s empty delete msg, discard it, len:%d, ver:%" PRId64, id, len, ver); + // we need to continue check next data in the wal files. + continue; + } else { + tqDebug("s-task:%s delete msg extract from WAL, len:%d, ver:%" PRId64, id, len, ver); + } + } else { + terrno = code; + tqError("s-task:%s extract delete msg from WAL failed, code:%s", id, tstrerror(code)); + return code; + } + + } else { + ASSERT(0); + } + return code; } - - int64_t ver = pReader->pHead->head.version; - if (ver > maxVer) { - tqDebug("maxVer in WAL:%"PRId64" reached current:%"PRId64", do not scan wal anymore, %s", maxVer, ver, id); - return TSDB_CODE_SUCCESS; - } - - if (pReader->pHead->head.msgType == TDMT_VND_SUBMIT) { - void* pBody = POINTER_SHIFT(pReader->pHead->head.body, sizeof(SSubmitReq2Msg)); - int32_t len = pReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg); - - void* data = taosMemoryMalloc(len); - if (data == NULL) { - // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry - terrno = TSDB_CODE_OUT_OF_MEMORY; - tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", 0); - return -1; - } - - memcpy(data, pBody, len); - SPackedData data1 = (SPackedData){.ver = ver, .msgLen = len, .msgStr = data}; - - *pItem = (SStreamQueueItem*)streamDataSubmitNew(&data1, STREAM_INPUT__DATA_SUBMIT); - if (*pItem == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - tqError("%s failed to create data submit for stream since out of memory", id); - return terrno; - } - } else if (pReader->pHead->head.msgType == TDMT_VND_DELETE) { - void* pBody = POINTER_SHIFT(pReader->pHead->head.body, sizeof(SMsgHead)); - int32_t len = pReader->pHead->head.bodyLen - sizeof(SMsgHead); - - code = extractDelDataBlock(pBody, len, ver, (SStreamRefDataBlock**)pItem); - if (code != TSDB_CODE_SUCCESS) { - tqError("s-task:%s extract delete msg from WAL failed, code:%s", id, tstrerror(code)); - } else { - tqDebug("s-task:%s delete msg extract from WAL, len:%d, ver:%"PRId64, id, len, ver); - } - } else { - ASSERT(0); - } - - return 0; } // todo ignore the error in wal? From 5344efe181f22160a3993051757f9a90aa3c9e8a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 24 Aug 2023 16:22:24 +0800 Subject: [PATCH 060/107] fix(stream): adjust the ptr. --- source/dnode/vnode/src/tq/tqRead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index d3157dc3b0..04e3e8c0df 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -297,7 +297,6 @@ int32_t tqReaderSeek(STqReader* pReader, int64_t ver, const char* id) { int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, const char* id) { int32_t code = 0; - SWalCont* pCont = &pReader->pHead->head; while(1) { code = walNextValidMsg(pReader); @@ -305,7 +304,8 @@ int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, con return code; } - int64_t ver = pCont->version; + SWalCont* pCont = &pReader->pHead->head; + int64_t ver = pCont->version; if (ver > maxVer) { tqDebug("maxVer in WAL:%" PRId64 " reached current:%" PRId64 ", do not scan wal anymore, %s", maxVer, ver, id); return TSDB_CODE_SUCCESS; From 7d9d4ae8505a56e0e2ed1249e9122138718fb0e1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 24 Aug 2023 16:26:30 +0800 Subject: [PATCH 061/107] fix(stream): fix the ptr ref. --- source/dnode/vnode/src/tq/tqRead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index d3157dc3b0..ae150750df 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -297,7 +297,6 @@ int32_t tqReaderSeek(STqReader* pReader, int64_t ver, const char* id) { int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, const char* id) { int32_t code = 0; - SWalCont* pCont = &pReader->pHead->head; while(1) { code = walNextValidMsg(pReader); @@ -305,6 +304,7 @@ int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, con return code; } + SWalCont* pCont = &pReader->pHead->head; int64_t ver = pCont->version; if (ver > maxVer) { tqDebug("maxVer in WAL:%" PRId64 " reached current:%" PRId64 ", do not scan wal anymore, %s", maxVer, ver, id); From a72e6fd2196e2f369efb1c9208e2a4d426e333e8 Mon Sep 17 00:00:00 2001 From: liuyao <54liuyao@163.com> Date: Thu, 24 Aug 2023 16:32:34 +0800 Subject: [PATCH 062/107] mem leak --- source/dnode/mnode/impl/src/mndStream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index a0d53ec780..716d00bcaa 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1564,6 +1564,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) { } if (pStream->status != STREAM_STATUS__PAUSE) { + sdbRelease(pMnode->pSdb, pStream); return 0; } From 7da464d8b7f6545017297878b5cd35d492d1f3dd Mon Sep 17 00:00:00 2001 From: liuyao <54liuyao@163.com> Date: Thu, 24 Aug 2023 16:36:58 +0800 Subject: [PATCH 063/107] mem leak --- source/libs/executor/src/timewindowoperator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 16eaf0649d..ca47cee95c 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2922,6 +2922,7 @@ void destroyStreamSessionAggOperatorInfo(void* param) { blockDataDestroy(pInfo->pUpdateRes); tSimpleHashCleanup(pInfo->pStUpdated); tSimpleHashCleanup(pInfo->pStDeleted); + pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated); taosArrayDestroy(pInfo->historyWins); taosMemoryFreeClear(param); From b83cc11043334f79eac15cf220d406dfdb51205a Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Aug 2023 16:38:53 +0800 Subject: [PATCH 064/107] fix:[TD-25651] reset epoch if consumer changed to avoid consumeing no data --- source/dnode/vnode/src/tq/tq.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 815e9647b5..c8da7e0b46 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -879,20 +879,8 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg } else { tqInfo("vgId:%d switch consumer from Id:0x%" PRIx64 " to Id:0x%" PRIx64, req.vgId, pHandle->consumerId, req.newConsumerId); atomic_store_64(&pHandle->consumerId, req.newConsumerId); - // atomic_add_fetch_32(&pHandle->epoch, 1); + atomic_store_32(&pHandle->epoch, 0); - // kill executing task - // if(tqIsHandleExec(pHandle)) { - // qTaskInfo_t pTaskInfo = pHandle->execHandle.task; - // if (pTaskInfo != NULL) { - // qKillTask(pTaskInfo, TSDB_CODE_SUCCESS); - // } - - // if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { - // qStreamCloseTsdbReader(pTaskInfo); - // } - // } - // remove if it has been register in the push manager, and return one empty block to consumer tqUnregisterPushHandle(pTq, pHandle); ret = tqMetaSaveHandle(pTq, req.subKey, pHandle); } From 3c6870275bdd3162e3d3b204c693805d029997e6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 24 Aug 2023 16:45:47 +0800 Subject: [PATCH 065/107] fix(parser): update the key words for disk io throttling. --- docs/en/12-taos-sql/20-keywords.md | 2 +- docs/zh/12-taos-sql/20-keywords.md | 2 +- include/common/ttokendef.h | 2 +- source/libs/parser/inc/sql.y | 2 +- source/libs/parser/src/parTokenizer.c | 2 +- source/libs/parser/src/sql.c | 12 ++++++------ source/libs/parser/test/parShowToUse.cpp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/en/12-taos-sql/20-keywords.md b/docs/en/12-taos-sql/20-keywords.md index d563181b87..983d4f63c9 100644 --- a/docs/en/12-taos-sql/20-keywords.md +++ b/docs/en/12-taos-sql/20-keywords.md @@ -178,7 +178,7 @@ The following list shows all reserved keywords: - MATCH - MAX_DELAY -- MAX_SPEED +- BWLIMIT - MAXROWS - MERGE - META diff --git a/docs/zh/12-taos-sql/20-keywords.md b/docs/zh/12-taos-sql/20-keywords.md index f52af2f282..e7e926d0b7 100644 --- a/docs/zh/12-taos-sql/20-keywords.md +++ b/docs/zh/12-taos-sql/20-keywords.md @@ -178,7 +178,7 @@ description: TDengine ä¿ç•™å…³é”®å­—的详细列表 - MATCH - MAX_DELAY -- MAX_SPEED +- BWLIMIT - MAXROWS - MERGE - META diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 8a6b7b5020..f74ced9190 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -113,7 +113,7 @@ #define TK_TABLE_PREFIX 95 #define TK_TABLE_SUFFIX 96 #define TK_NK_COLON 97 -#define TK_MAX_SPEED 98 +#define TK_BWLIMIT 98 #define TK_START 99 #define TK_TIMESTAMP 100 #define TK_END 101 diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 6c3f589159..43e75e5c5a 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -286,7 +286,7 @@ retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). %type speed_opt { int32_t } %destructor speed_opt { } speed_opt(A) ::= . { A = 0; } -speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } +speed_opt(A) ::= BWLIMIT NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } start_opt(A) ::= . { A = NULL; } start_opt(A) ::= START WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index ca7ac1a0b6..df01fe5fc8 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -137,7 +137,7 @@ static SKeyword keywordTable[] = { {"MATCH", TK_MATCH}, {"MAXROWS", TK_MAXROWS}, {"MAX_DELAY", TK_MAX_DELAY}, - {"MAX_SPEED", TK_MAX_SPEED}, + {"BWLIMIT", TK_BWLIMIT}, {"MERGE", TK_MERGE}, {"META", TK_META}, {"ONLY", TK_ONLY}, diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a912fb4e71..755102395a 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1150,7 +1150,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLE_PREFIX => nothing */ 0, /* TABLE_SUFFIX => nothing */ 0, /* NK_COLON => nothing */ - 0, /* MAX_SPEED => nothing */ + 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ 287, /* END => ABORT */ @@ -1575,7 +1575,7 @@ static const char *const yyTokenName[] = { /* 95 */ "TABLE_PREFIX", /* 96 */ "TABLE_SUFFIX", /* 97 */ "NK_COLON", - /* 98 */ "MAX_SPEED", + /* 98 */ "BWLIMIT", /* 99 */ "START", /* 100 */ "TIMESTAMP", /* 101 */ "END", @@ -2114,7 +2114,7 @@ static const char *const yyRuleName[] = { /* 140 */ "retention_list ::= retention_list NK_COMMA retention", /* 141 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", /* 142 */ "speed_opt ::=", - /* 143 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 143 */ "speed_opt ::= BWLIMIT NK_INTEGER", /* 144 */ "start_opt ::=", /* 145 */ "start_opt ::= START WITH NK_INTEGER", /* 146 */ "start_opt ::= START WITH NK_STRING", @@ -3335,7 +3335,7 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 366, /* (140) retention_list ::= retention_list NK_COMMA retention */ 369, /* (141) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ 361, /* (142) speed_opt ::= */ - 361, /* (143) speed_opt ::= MAX_SPEED NK_INTEGER */ + 361, /* (143) speed_opt ::= BWLIMIT NK_INTEGER */ 362, /* (144) start_opt ::= */ 362, /* (145) start_opt ::= START WITH NK_INTEGER */ 362, /* (146) start_opt ::= START WITH NK_STRING */ @@ -3940,7 +3940,7 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (140) retention_list ::= retention_list NK_COMMA retention */ -3, /* (141) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ 0, /* (142) speed_opt ::= */ - -2, /* (143) speed_opt ::= MAX_SPEED NK_INTEGER */ + -2, /* (143) speed_opt ::= BWLIMIT NK_INTEGER */ 0, /* (144) start_opt ::= */ -3, /* (145) start_opt ::= START WITH NK_INTEGER */ -3, /* (146) start_opt ::= START WITH NK_STRING */ @@ -5016,7 +5016,7 @@ static YYACTIONTYPE yy_reduce( case 330: /* bufsize_opt ::= */ yytestcase(yyruleno==330); { yymsp[1].minor.yy416 = 0; } break; - case 143: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 143: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 331: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==331); { yymsp[-1].minor.yy416 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; diff --git a/source/libs/parser/test/parShowToUse.cpp b/source/libs/parser/test/parShowToUse.cpp index b7bd0e802c..4396f786ff 100644 --- a/source/libs/parser/test/parShowToUse.cpp +++ b/source/libs/parser/test/parShowToUse.cpp @@ -286,7 +286,7 @@ TEST_F(ParserShowToUseTest, trimDatabase) { run("TRIM DATABASE wxy_db"); setTrimDbReq("wxy_db", 100); - run("TRIM DATABASE wxy_db MAX_SPEED 100"); + run("TRIM DATABASE wxy_db BWLIMIT 100"); } TEST_F(ParserShowToUseTest, useDatabase) { From 70871139bfd214d58f4384418b202b56e6a2afa6 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 24 Aug 2023 17:16:28 +0800 Subject: [PATCH 066/107] enh(tsdb/openfile): lazy file open to read/write --- .../dnode/vnode/src/tsdb/tsdbReaderWriter.c | 61 +++++++++++++------ 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 0a462c21e3..90ea0afb9d 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -16,23 +16,12 @@ #include "tsdb.h" #include "vndCos.h" -// =============== PAGE-WISE FILE =============== -int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD) { - int32_t code = 0; - STsdbFD *pFD = NULL; +static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { + int32_t code = 0; + const char *path = pFD->path; + int32_t szPage = pFD->szPage; + int32_t flag = pFD->flag; - *ppFD = NULL; - - pFD = (STsdbFD *)taosMemoryCalloc(1, sizeof(*pFD) + strlen(path) + 1); - if (pFD == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _exit; - } - - pFD->path = (char *)&pFD[1]; - strcpy(pFD->path, path); - pFD->szPage = szPage; - pFD->flag = flag; pFD->pFD = taosOpenFile(path, flag); if (pFD->pFD == NULL) { const char *object_name = taosDirEntryBaseName((char *)path); @@ -54,8 +43,7 @@ int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **p goto _exit; } } - pFD->szPage = szPage; - pFD->pgno = 0; + pFD->pBuf = taosMemoryCalloc(1, szPage); if (pFD->pBuf == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -78,6 +66,30 @@ int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **p pFD->szFile = pFD->szFile / szPage; } +_exit: + return code; +} + +// =============== PAGE-WISE FILE =============== +int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD) { + int32_t code = 0; + STsdbFD *pFD = NULL; + + *ppFD = NULL; + + pFD = (STsdbFD *)taosMemoryCalloc(1, sizeof(*pFD) + strlen(path) + 1); + if (pFD == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + pFD->path = (char *)&pFD[1]; + strcpy(pFD->path, path); + pFD->szPage = szPage; + pFD->flag = flag; + pFD->szPage = szPage; + pFD->pgno = 0; + *ppFD = pFD; _exit: @@ -97,6 +109,13 @@ void tsdbCloseFile(STsdbFD **ppFD) { static int32_t tsdbWriteFilePage(STsdbFD *pFD) { int32_t code = 0; + if (!pFD->pFD) { + code = tsdbOpenFileImpl(pFD); + if (code) { + goto _exit; + } + } + if (pFD->pgno > 0) { int64_t n = taosLSeekFile(pFD->pFD, PAGE_OFFSET(pFD->pgno, pFD->szPage), SEEK_SET); if (n < 0) { @@ -126,6 +145,12 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) { int32_t code = 0; // ASSERT(pgno <= pFD->szFile); + if (!pFD->pFD) { + code = tsdbOpenFileImpl(pFD); + if (code) { + goto _exit; + } + } // seek int64_t offset = PAGE_OFFSET(pgno, pFD->szPage); From e5049e042f4cdf939ea14b0f00cb75c405990299 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Thu, 24 Aug 2023 17:28:41 +0800 Subject: [PATCH 067/107] undo remove operation for taosx when build taosd --- packaging/tools/make_install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 99315b3311..ea19125bf5 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -158,7 +158,6 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/udfd || : ${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taosdump || : - ${csudo}rm -f ${bin_link_dir}/taosx || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : if [ "$osType" != "Darwin" ]; then From 64959f14e9440049bf4e8e2e39ef95d0230fd8c1 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Aug 2023 18:18:02 +0800 Subject: [PATCH 068/107] fix:dot process in schemaless --- source/client/src/clientSml.c | 14 +++++++++++++- utils/test/c/sml_test.c | 13 +++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index ffff3df5d0..8e5c6e7250 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -218,7 +218,16 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable) { if (strlen(oneTable->childTableName) == 0) { SArray *dst = taosArrayDup(oneTable->tags, NULL); - RandTableName rName = {dst, oneTable->sTableName, (uint8_t)oneTable->sTableNameLen, oneTable->childTableName}; + ASSERT(oneTable->sTableNameLen < TSDB_TABLE_NAME_LEN); + char superName[TSDB_TABLE_NAME_LEN] = {0}; + RandTableName rName = {dst, NULL, (uint8_t)oneTable->sTableNameLen, oneTable->childTableName}; + if(tsSmlDot2Underline){ + memcpy(superName, oneTable->sTableName, oneTable->sTableNameLen); + smlStrReplace(superName, oneTable->sTableNameLen); + rName.stbFullName = superName; + }else{ + rName.stbFullName = oneTable->sTableName; + } buildChildTableName(&rName); taosArrayDestroy(dst); @@ -230,6 +239,9 @@ void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tin char key[TSDB_TABLE_NAME_LEN * 2 + 1] = {0}; size_t nLen = strlen(tinfo->childTableName); memcpy(key, currElement->measure, currElement->measureLen); + if(tsSmlDot2Underline){ + smlStrReplace(key, currElement->measureLen); + } memcpy(key + currElement->measureLen + 1, tinfo->childTableName, nLen); void *uid = taosHashGet(info->tableUids, key, diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index e4ed6037a3..5be9d98a7f 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1533,6 +1533,7 @@ int sml_ts3724_Test() { const char *sql[] = { "stb.2,t1=1 f1=283i32 1632299372000", + "stb_2,t1=1 f1=283i32 1632299372000", ".stb2,t1=1 f1=106i32 1632299378000", "stb2.,t1=1 f1=106i32 1632299378000", }; @@ -1547,6 +1548,18 @@ int sml_ts3724_Test() { printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); taos_free_result(pRes); + pRes = taos_query(taos, "select * from stb_2"); + TAOS_ROW row = taos_fetch_row(pRes); + int numRows = taos_affected_rows(pRes); + ASSERT(numRows == 1); + taos_free_result(pRes); + + pRes = taos_query(taos, "show stables"); + row = taos_fetch_row(pRes); + numRows = taos_affected_rows(pRes); + ASSERT(numRows == 3); + taos_free_result(pRes); + taos_close(taos); return code; From d5cc4155420a2e93b012c56827791ea2cf7810dd Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Aug 2023 18:35:53 +0800 Subject: [PATCH 069/107] fix:test case error --- tests/system-test/7-tmq/subscribeDb0.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/7-tmq/subscribeDb0.py b/tests/system-test/7-tmq/subscribeDb0.py index ed13fcbe06..d4dfe425dc 100644 --- a/tests/system-test/7-tmq/subscribeDb0.py +++ b/tests/system-test/7-tmq/subscribeDb0.py @@ -237,7 +237,7 @@ class TDTestCase: for i in range(expectRows): totalConsumeRows += resultList[i] - if totalConsumeRows != expectrowcnt: + if totalConsumeRows < expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") From 8045f30be8b8d27f82a854f503314cb2431c48fb Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Aug 2023 23:15:35 +0800 Subject: [PATCH 070/107] fix:sml test case error for tbname --- tests/system-test/2-query/sml_TS-3724.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/sml_TS-3724.py b/tests/system-test/2-query/sml_TS-3724.py index a8b16c4662..410e266f10 100644 --- a/tests/system-test/2-query/sml_TS-3724.py +++ b/tests/system-test/2-query/sml_TS-3724.py @@ -67,7 +67,7 @@ class TDTestCase: tdSql.query(f"select distinct tbname from {dbname}.`sys_if_bytes_out`") tdSql.checkRows(2) - tdSql.query(f"select * from {dbname}.t_fc70dec6677d4277c5d9799c4da806da order by times") + tdSql.query(f"select * from {dbname}.t_f67972b49aa8adf8bca5d0d54f0d850d order by times") tdSql.checkRows(2) tdSql.checkData(0, 1, 1.300000000) tdSql.checkData(1, 1, 13.000000000) From f7b42ad41b9a301009749a67c95a20e26a47bce6 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 25 Aug 2023 09:22:29 +0800 Subject: [PATCH 071/107] fix: specify utf-8 in jdbc example pom.xml (#22565) * fix: use latest version of jdbc connector * fix: remove locale and timezone to avoid confusing user * fix: update readme.md * fix: refine demo.c * fix: specify utf-8 in jdbc example pom.xml --- examples/JDBC/taosdemo/pom.xml | 1 + examples/JDBC/taosdemo/readme.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/JDBC/taosdemo/pom.xml b/examples/JDBC/taosdemo/pom.xml index 0d47663bba..ff64d3e1df 100644 --- a/examples/JDBC/taosdemo/pom.xml +++ b/examples/JDBC/taosdemo/pom.xml @@ -133,6 +133,7 @@ 8 8 + UTF-8 diff --git a/examples/JDBC/taosdemo/readme.md b/examples/JDBC/taosdemo/readme.md index edac970399..986eef8a05 100644 --- a/examples/JDBC/taosdemo/readme.md +++ b/examples/JDBC/taosdemo/readme.md @@ -8,4 +8,4 @@ java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -data ``` 如果å‘生错误 Exception in thread "main" java.lang.UnsatisfiedLinkError: no taos in java.library.path -请检查是å¦å®‰è£… TDengine 客户端安装包或编译 TDengine 安装。如果确定已ç»å®‰è£…过还出现这个错误,å¯ä»¥åœ¨å‘½ä»¤è¡Œ java åŽåŠ  -Djava.library.path=/usr/local/lib æ¥æŒ‡å®šå¯»æ‰¾å…±äº«åº“的路径。 +请检查是å¦å®‰è£… TDengine 客户端安装包或编译 TDengine 安装。如果确定已ç»å®‰è£…过还出现这个错误,å¯ä»¥åœ¨å‘½ä»¤è¡Œ java åŽåŠ  -Djava.library.path=/usr/lib æ¥æŒ‡å®šå¯»æ‰¾å…±äº«åº“的路径。 From f3147de8deb5484eb6f0c5cdb05bfd0bfcad18f1 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Fri, 25 Aug 2023 09:35:59 +0800 Subject: [PATCH 072/107] docs: add tags keyword in select clause --- docs/en/12-taos-sql/06-select.md | 10 +++++++++- docs/zh/12-taos-sql/06-select.md | 12 +++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md index 0bb1d7dfcd..c6f83976df 100755 --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -9,7 +9,7 @@ description: This document describes how to query data in TDengine. ```sql SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} -SELECT [hints] [DISTINCT] select_list +SELECT [hints] [DISTINCT] [TAGS] select_list from_clause [WHERE condition] [partition_by_clause] @@ -225,6 +225,14 @@ The \_IROWTS pseudocolumn can only be used with INTERP function. This pseudocolu select _irowts, interp(current) from meters range('2020-01-01 10:00:00', '2020-01-01 10:30:00') every(1s) fill(linear); ``` +### TAGS Query + +The TAGS keyword returns only tag columns from the child tables when only tag columns are specified. One row containing tag columns is returned for each child table. + +```sql +SELECT TAGS tag_name [, tag_name ...] FROM stb_name +``` + ## Query Objects `FROM` can be followed by a number of tables or super tables, or can be followed by a sub-query. diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md index cb3e0b86b0..800b26b00e 100755 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -9,7 +9,7 @@ description: 查询数æ®çš„详细语法 ```sql SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} -SELECT [hints] [DISTINCT] select_list +SELECT [hints] [DISTINCT] [TAGS] select_list from_clause [WHERE condition] [partition_by_clause] @@ -160,6 +160,16 @@ SELECT DISTINCT col_name [, col_name ...] FROM tb_name; ::: +### 标签查询 + +å½“æŸ¥è¯¢çš„åˆ—åªæœ‰æ ‡ç­¾åˆ—时,`TAGS` 关键字å¯ä»¥æŒ‡å®šåªè¿”回所有å­è¡¨çš„æ ‡ç­¾åˆ—。æ¯ä¸ªå­è¡¨åªè¿”回一行标签列。 + +返回所有å­è¡¨çš„æ ‡ç­¾åˆ—: + +```sql +SELECT TAGS tag_name [, tag_name ...] FROM stb_name +``` + ### 结果集列å `SELECT`å­å¥ä¸­ï¼Œå¦‚æžœä¸æŒ‡å®šè¿”回结果集åˆçš„列å,结果集列å称默认使用`SELECT`å­å¥ä¸­çš„表达å¼å称作为列å称。此外,用户å¯ä½¿ç”¨`AS`æ¥é‡å‘½å返回结果集åˆä¸­åˆ—çš„å称。例如: From 250a8a7c39f664678a88973906eab40be33d3076 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Fri, 25 Aug 2023 10:06:59 +0800 Subject: [PATCH 073/107] fix: taosCompressFile mem leak --- source/os/src/osFile.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index dd670595f0..ede1f1fb0e 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -885,13 +885,16 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) { char *data = taosMemoryMalloc(compressSize); gzFile dstFp = NULL; - TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ | TD_FILE_STREAM); + TdFilePtr pFile = NULL; + TdFilePtr pSrcFile = NULL; + + pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ | TD_FILE_STREAM); if (pSrcFile == NULL) { ret = -1; goto cmp_end; } - TdFilePtr pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { ret = -2; goto cmp_end; @@ -910,6 +913,9 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) { } cmp_end: + if (pFile) { + taosCloseFile(&pFile); + } if (pSrcFile) { taosCloseFile(&pSrcFile); } From 29aaf1c86857fb11ef21423da0dc2d81040c4389 Mon Sep 17 00:00:00 2001 From: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:51:17 +0800 Subject: [PATCH 074/107] Update 06-taosdump.md dot replace with '-Q' --- docs/zh/14-reference/06-taosdump.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/zh/14-reference/06-taosdump.md b/docs/zh/14-reference/06-taosdump.md index 12122edd32..9fe3c5af7a 100644 --- a/docs/zh/14-reference/06-taosdump.md +++ b/docs/zh/14-reference/06-taosdump.md @@ -105,6 +105,8 @@ Usage: taosdump [OPTION...] dbname [tbname ...] -L, --loose-mode Using loose mode if the table name and column name use letter and number only. Default is NOT. -n, --no-escape No escape char '`'. Default is using it. + -Q, --dot-replace Repalce dot character with underline character in + the table name. -T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is 8. -C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service From acc12036a561aafebae5f02bde87b9629ac2bfca Mon Sep 17 00:00:00 2001 From: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:53:14 +0800 Subject: [PATCH 075/107] Update 06-taosdump.md dot replace with '-Q' (English) --- docs/en/14-reference/06-taosdump.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/14-reference/06-taosdump.md b/docs/en/14-reference/06-taosdump.md index 6d5547e7a9..baf07d6b9e 100644 --- a/docs/en/14-reference/06-taosdump.md +++ b/docs/en/14-reference/06-taosdump.md @@ -102,6 +102,8 @@ Usage: taosdump [OPTION...] dbname [tbname ...] -L, --loose-mode Use loose mode if the table name and column name use letter and number only. Default is NOT. -n, --no-escape No escape char '`'. Default is using it. + -Q, --dot-replace Repalce dot character with underline character in + the table name. -T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is 8. -C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service From 7958fdf9adbd82fe796d801487484c0292e1442b Mon Sep 17 00:00:00 2001 From: dapan1121 <72057773+dapan1121@users.noreply.github.com> Date: Fri, 25 Aug 2023 11:28:01 +0800 Subject: [PATCH 076/107] Update 06-select.md --- docs/zh/12-taos-sql/06-select.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md index 800b26b00e..49a5cf8f19 100755 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -162,7 +162,7 @@ SELECT DISTINCT col_name [, col_name ...] FROM tb_name; ### 标签查询 -å½“æŸ¥è¯¢çš„åˆ—åªæœ‰æ ‡ç­¾åˆ—时,`TAGS` 关键字å¯ä»¥æŒ‡å®šåªè¿”回所有å­è¡¨çš„æ ‡ç­¾åˆ—。æ¯ä¸ªå­è¡¨åªè¿”回一行标签列。 +å½“æŸ¥è¯¢çš„åˆ—åªæœ‰æ ‡ç­¾åˆ—时,`TAGS` 关键字å¯ä»¥æŒ‡å®šè¿”回所有å­è¡¨çš„æ ‡ç­¾åˆ—。æ¯ä¸ªå­è¡¨åªè¿”回一行标签列。 返回所有å­è¡¨çš„æ ‡ç­¾åˆ—: From 470b37bae45834b90d6b67e13762de091f2b44ef Mon Sep 17 00:00:00 2001 From: dapan1121 <72057773+dapan1121@users.noreply.github.com> Date: Fri, 25 Aug 2023 11:32:12 +0800 Subject: [PATCH 077/107] Update 06-select.md --- docs/en/12-taos-sql/06-select.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md index c6f83976df..687349e31d 100755 --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -227,7 +227,7 @@ select _irowts, interp(current) from meters range('2020-01-01 10:00:00', '2020-0 ### TAGS Query -The TAGS keyword returns only tag columns from the child tables when only tag columns are specified. One row containing tag columns is returned for each child table. +The TAGS keyword returns only tag columns from all child tables when only tag columns are specified. One row containing tag columns is returned for each child table. ```sql SELECT TAGS tag_name [, tag_name ...] FROM stb_name From e1095e7d02fc2f419293f58ffdf082d21d97f117 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 25 Aug 2023 14:40:29 +0800 Subject: [PATCH 078/107] fix: improve upgrade speed --- source/dnode/vnode/src/tsdb/tsdbUpgrade.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c index 59ba51c371..3f1fcb7248 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c +++ b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c @@ -120,7 +120,15 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader * }; if (dataBlk->hasDup) { - code = tsdbReadDataBlockEx(reader, dataBlk, ctx->blockData); + tBlockDataReset(ctx->blockData); + + int16_t aCid = 0; + STSchema tSchema = {0}; + TABLEID tbid = {.suid = pBlockIdx->suid, .uid = pBlockIdx->uid}; + code = tBlockDataInit(ctx->blockData, &tbid, &tSchema, &aCid, 0); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbReadDataBlock(reader, dataBlk, ctx->blockData); TSDB_CHECK_CODE(code, lino, _exit); record.count = 1; @@ -334,6 +342,8 @@ static int32_t tsdbUpgradeFileSet(STsdb *tsdb, SDFileSet *pDFileSet, TFileSetArr int32_t code = 0; int32_t lino = 0; + tsdbInfo("vgId:%d upgrade file set start, fid:%d", TD_VID(tsdb->pVnode), pDFileSet->fid); + SDataFReader *reader; STFileSet *fset; @@ -366,6 +376,8 @@ static int32_t tsdbUpgradeFileSet(STsdb *tsdb, SDFileSet *pDFileSet, TFileSetArr code = TARRAY2_APPEND(fileSetArray, fset); TSDB_CHECK_CODE(code, lino, _exit); + tsdbInfo("vgId:%d upgrade file set end, fid:%d", TD_VID(tsdb->pVnode), pDFileSet->fid); + _exit: if (code) { TSDB_ERROR_LOG(TD_VID(tsdb->pVnode), lino, code); From e24498b0fdf48b4ce69291bf136659c639423761 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 25 Aug 2023 14:59:34 +0800 Subject: [PATCH 079/107] enh: add task notify --- include/common/tmsg.h | 21 ++++- include/common/tmsgdef.h | 1 + include/libs/qworker/qworker.h | 3 + source/client/src/clientEnv.c | 3 +- source/common/src/tmsg.c | 60 ++++++++++++++ source/dnode/mgmt/mgmt_mnode/src/mmHandle.c | 1 + source/dnode/mgmt/mgmt_qnode/src/qmHandle.c | 1 + source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 1 + source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/dnode/mnode/impl/src/mndMain.c | 3 +- source/dnode/mnode/impl/src/mndQuery.c | 4 + source/dnode/qnode/src/qnode.c | 4 + source/dnode/vnode/src/vnd/vnodeSvr.c | 2 + source/libs/function/src/udfd.c | 2 +- source/libs/qworker/inc/qwInt.h | 3 + source/libs/qworker/inc/qwMsg.h | 1 + source/libs/qworker/src/qwMsg.c | 35 ++++++++ source/libs/qworker/src/qwUtil.c | 39 +++++++++ source/libs/qworker/src/qworker.c | 80 ++++++++++++------- source/libs/qworker/test/qworkerTests.cpp | 3 + source/libs/scheduler/inc/schInt.h | 3 +- source/libs/scheduler/src/schJob.c | 4 + source/libs/scheduler/src/schRemote.c | 48 ++++++++++- source/libs/scheduler/src/schTask.c | 54 ++++++++++++- 24 files changed, 339 insertions(+), 39 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index b6684cdd0e..8deec53470 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1418,6 +1418,7 @@ typedef struct { int64_t numOfProcessedCQuery; int64_t numOfProcessedFetch; int64_t numOfProcessedDrop; + int64_t numOfProcessedNotify; int64_t numOfProcessedHb; int64_t numOfProcessedDelete; int64_t cacheDataSize; @@ -2159,8 +2160,24 @@ typedef struct { int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); -int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); -int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); + + +typedef enum { + TASK_NOTIFY_FINISHED = 1, +} ETaskNotifyType; + +typedef struct { + SMsgHead header; + uint64_t sId; + uint64_t queryId; + uint64_t taskId; + int64_t refId; + int32_t execId; + ETaskNotifyType type; +} STaskNotifyReq; + +int32_t tSerializeSTaskNotifyReq(void* buf, int32_t bufLen, STaskNotifyReq* pReq); +int32_t tDeserializeSTaskNotifyReq(void* buf, int32_t bufLen, STaskNotifyReq* pReq); int32_t tSerializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp); int32_t tDeserializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp); diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 323b2de6ba..29f0667dac 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -244,6 +244,7 @@ enum { // WARN: new msg should be appended to segment tail TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "drop-task", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_TASK_NOTIFY, "task-notify", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_MAX_MSG, "sch-max", NULL, NULL) diff --git a/include/libs/qworker/qworker.h b/include/libs/qworker/qworker.h index 60ed94d4de..bbd2d76b59 100644 --- a/include/libs/qworker/qworker.h +++ b/include/libs/qworker/qworker.h @@ -45,6 +45,7 @@ typedef struct { uint64_t cqueryProcessed; uint64_t fetchProcessed; uint64_t dropProcessed; + uint64_t notifyProcessed; uint64_t hbProcessed; uint64_t deleteProcessed; @@ -90,6 +91,8 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts); +int32_t qWorkerProcessNotifyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts); + int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts); int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SDeleteRes *pRes); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 40c27bf164..b555f4e683 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -133,7 +133,8 @@ void closeTransporter(SAppInstInfo *pAppInfo) { static bool clientRpcRfp(int32_t code, tmsg_t msgType) { if (NEED_REDIRECT_ERROR(code)) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || - msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_QUERY_HEARTBEAT || msgType == TDMT_SCH_DROP_TASK) { + msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_QUERY_HEARTBEAT || msgType == TDMT_SCH_DROP_TASK || + msgType == TDMT_SCH_TASK_NOTIFY) { return false; } return true; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 1431cd049a..9a21563abe 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1092,6 +1092,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tEncodeI64(&encoder, pReq->qload.numOfProcessedCQuery) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedFetch) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedDrop) < 0) return -1; + if (tEncodeI64(&encoder, pReq->qload.numOfProcessedNotify) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedHb) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedDelete) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.cacheDataSize) < 0) return -1; @@ -1189,6 +1190,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedCQuery) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedFetch) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedDrop) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedNotify) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedHb) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedDelete) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.cacheDataSize) < 0) return -1; @@ -5874,6 +5876,64 @@ int32_t tDeserializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq) return 0; } +int32_t tSerializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq) { + int32_t headLen = sizeof(SMsgHead); + if (buf != NULL) { + buf = (char *)buf + headLen; + bufLen -= headLen; + } + + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; + if (tEncodeU64(&encoder, pReq->queryId) < 0) return -1; + if (tEncodeU64(&encoder, pReq->taskId) < 0) return -1; + if (tEncodeI64(&encoder, pReq->refId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->execId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->type) < 0) return -1; + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; +} + +int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq) { + int32_t headLen = sizeof(SMsgHead); + + SMsgHead *pHead = buf; + pHead->vgId = pReq->header.vgId; + pHead->contLen = pReq->header.contLen; + + SDecoder decoder = {0}; + tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; + if (tDecodeU64(&decoder, &pReq->queryId) < 0) return -1; + if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->execId) < 0) return -1; + if (tDecodeI32(&decoder, (int32_t*)&pReq->type) < 0) return -1; + + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + + int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index ae1b46a21d..eaa80ba775 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -187,6 +187,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_TASK_NOTIFY, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c index 5017ad7b74..86bc11c616 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c @@ -89,6 +89,7 @@ SArray *qmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_TASK_NOTIFY, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; code = 0; _OVER: diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index e50a75d33a..f43e1f5537 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -755,6 +755,7 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_TABLES_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_TASK_NOTIFY, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index e0f7da3ac4..665f86034d 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -272,7 +272,7 @@ static bool rpcRfp(int32_t code, tmsg_t msgType) { code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || - msgType == TDMT_SCH_MERGE_FETCH) { + msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_TASK_NOTIFY) { return false; } return true; diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index fd4ebf549f..12e28969c9 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -629,7 +629,8 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { if (!IsReq(pMsg)) return 0; if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_MERGE_QUERY || pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || - pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_MERGE_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK) { + pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_MERGE_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK || + pMsg->msgType == TDMT_SCH_TASK_NOTIFY) { return 0; } diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c index 8e95fa3d6d..c03b02c17f 100644 --- a/source/dnode/mnode/impl/src/mndQuery.c +++ b/source/dnode/mnode/impl/src/mndQuery.c @@ -55,6 +55,9 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) { case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pMnode, pMnode->pQuery, pMsg, 0); break; + case TDMT_SCH_TASK_NOTIFY: + code = qWorkerProcessNotifyMsg(pMnode, pMnode->pQuery, pMsg, 0); + break; default: terrno = TSDB_CODE_APP_ERROR; mError("unknown msg type:%d in query queue", pMsg->msgType); @@ -175,6 +178,7 @@ int32_t mndInitQuery(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_CONTINUE, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_FETCH, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_MERGE_FETCH, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_TASK_NOTIFY, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_DROP_TASK, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_HEARTBEAT, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_MND_BATCH_META, mndProcessBatchMetaMsg); diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index 3482355512..9937debb13 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -57,6 +57,7 @@ int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) { pLoad->numOfProcessedCQuery = stat.cqueryProcessed; pLoad->numOfProcessedFetch = stat.fetchProcessed; pLoad->numOfProcessedDrop = stat.dropProcessed; + pLoad->numOfProcessedNotify = stat.notifyProcessed; pLoad->numOfProcessedHb = stat.hbProcessed; pLoad->numOfProcessedDelete = stat.deleteProcessed; @@ -100,6 +101,9 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) { case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pQnode, pQnode->pQuery, pMsg, ts); break; + case TDMT_SCH_TASK_NOTIFY: + code = qWorkerProcessNotifyMsg(pQnode, pQnode->pQuery, pMsg, ts); + break; default: qError("unknown msg type:%d in qnode queue", pMsg->msgType); terrno = TSDB_CODE_APP_ERROR; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index a9399e4db1..737fd03d6f 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -702,6 +702,8 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { // return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_SCH_DROP_TASK: return qWorkerProcessDropMsg(pVnode, pVnode->pQuery, pMsg, 0); + case TDMT_SCH_TASK_NOTIFY: + return qWorkerProcessNotifyMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_SCH_QUERY_HEARTBEAT: return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_VND_TABLE_META: diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 575bce09bb..bd459af9f5 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -971,7 +971,7 @@ static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || - msgType == TDMT_SCH_MERGE_FETCH) { + msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_TASK_NOTIFY) { return false; } return true; diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 8797a8cf6b..b4bd1943c5 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -133,6 +133,7 @@ typedef struct SQWTaskCtx { bool queryContinue; bool queryExecDone; bool queryInQueue; + bool explainRsped; int32_t rspCode; int64_t affectedRows; // for insert ...select stmt @@ -169,6 +170,7 @@ typedef struct SQWMsgStat { uint64_t rspProcessed; uint64_t cancelProcessed; uint64_t dropProcessed; + uint64_t notifyProcessed; uint64_t hbProcessed; uint64_t deleteProcessed; } SQWMsgStat; @@ -406,6 +408,7 @@ int32_t qwAddTaskCtx(QW_FPARAMS_DEF); void qwDbgSimulateRedirect(SQWMsg *qwMsg, SQWTaskCtx *ctx, bool *rsped); void qwDbgSimulateSleep(void); void qwDbgSimulateDead(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *rsped); +int32_t qwSendExplainResponse(QW_FPARAMS_DEF, SQWTaskCtx *ctx); #ifdef __cplusplus } diff --git a/source/libs/qworker/inc/qwMsg.h b/source/libs/qworker/inc/qwMsg.h index f226b223f7..ae68f69802 100644 --- a/source/libs/qworker/inc/qwMsg.h +++ b/source/libs/qworker/inc/qwMsg.h @@ -30,6 +30,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessReady(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg); +int32_t qwProcessNotify(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req); int32_t qwProcessDelete(QW_FPARAMS_DEF, SQWMsg *qwMsg, SDeleteRes *pRes); diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 0cbcf44ed4..9a1c309ab0 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -610,6 +610,41 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6 return TSDB_CODE_SUCCESS; } +int32_t qWorkerProcessNotifyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts) { + if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) { + return TSDB_CODE_QRY_INVALID_INPUT; + } + + int32_t code = 0; + SQWorker *mgmt = (SQWorker *)qWorkerMgmt; + + qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_STAT_INC(mgmt->stat.msgStat.notifyProcessed, 1); + + STaskNotifyReq msg = {0}; + if (tDeserializeSTaskNotifyReq(pMsg->pCont, pMsg->contLen, &msg) < 0) { + QW_ELOG("tDeserializeSTaskNotifyReq failed, contLen:%d", pMsg->contLen); + QW_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + uint64_t sId = msg.sId; + uint64_t qId = msg.queryId; + uint64_t tId = msg.taskId; + int64_t rId = msg.refId; + int32_t eId = msg.execId; + + SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code, .connInfo = pMsg->info, .msgType = msg.type}; + + QW_SCH_TASK_DLOG("processNotify start, node:%p, handle:%p", node, pMsg->info.handle); + + QW_ERR_RET(qwProcessNotify(QW_FPARAMS(), &qwMsg)); + + QW_SCH_TASK_DLOG("processNotify end, node:%p", node); + + return TSDB_CODE_SUCCESS; +} + + int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts) { if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) { return TSDB_CODE_QRY_INVALID_INPUT; diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index 3b127ee780..f00c4aef30 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -316,6 +316,45 @@ void qwFreeTaskCtx(SQWTaskCtx *ctx) { taosArrayDestroy(ctx->tbInfo); } +static void freeExplainExecItem(void *param) { + SExplainExecInfo *pInfo = param; + taosMemoryFree(pInfo->verboseInfo); +} + + +int32_t qwSendExplainResponse(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { + qTaskInfo_t taskHandle = ctx->taskHandle; + + ctx->explainRsped = true; + + SArray *execInfoList = taosArrayInit(4, sizeof(SExplainExecInfo)); + QW_ERR_RET(qGetExplainExecInfo(taskHandle, execInfoList)); + + if (ctx->localExec) { + SExplainLocalRsp localRsp = {0}; + localRsp.rsp.numOfPlans = taosArrayGetSize(execInfoList); + SExplainExecInfo *pExec = taosMemoryCalloc(localRsp.rsp.numOfPlans, sizeof(SExplainExecInfo)); + memcpy(pExec, taosArrayGet(execInfoList, 0), localRsp.rsp.numOfPlans * sizeof(SExplainExecInfo)); + localRsp.rsp.subplanInfo = pExec; + localRsp.qId = qId; + localRsp.tId = tId; + localRsp.rId = rId; + localRsp.eId = eId; + taosArrayPush(ctx->explainRes, &localRsp); + taosArrayDestroy(execInfoList); + } else { + SRpcHandleInfo connInfo = ctx->ctrlConnInfo; + connInfo.ahandle = NULL; + int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList); + taosArrayDestroyEx(execInfoList, freeExplainExecItem); + QW_ERR_RET(code); + } + + return TSDB_CODE_SUCCESS; +} + + + int32_t qwDropTaskCtx(QW_FPARAMS_DEF) { char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; QW_SET_QTID(id, qId, tId, eId); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 1759cc89f5..afce4a496a 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -90,11 +90,6 @@ int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *re QW_RET(TSDB_CODE_SUCCESS); } -static void freeItem(void *param) { - SExplainExecInfo *pInfo = param; - taosMemoryFree(pInfo->verboseInfo); -} - int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { qTaskInfo_t taskHandle = ctx->taskHandle; @@ -102,29 +97,8 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { ctx->queryExecDone = true; if (TASK_TYPE_TEMP == ctx->taskType && taskHandle) { - if (ctx->explain) { - SArray *execInfoList = taosArrayInit(4, sizeof(SExplainExecInfo)); - QW_ERR_RET(qGetExplainExecInfo(taskHandle, execInfoList)); - - if (ctx->localExec) { - SExplainLocalRsp localRsp = {0}; - localRsp.rsp.numOfPlans = taosArrayGetSize(execInfoList); - SExplainExecInfo *pExec = taosMemoryCalloc(localRsp.rsp.numOfPlans, sizeof(SExplainExecInfo)); - memcpy(pExec, taosArrayGet(execInfoList, 0), localRsp.rsp.numOfPlans * sizeof(SExplainExecInfo)); - localRsp.rsp.subplanInfo = pExec; - localRsp.qId = qId; - localRsp.tId = tId; - localRsp.rId = rId; - localRsp.eId = eId; - taosArrayPush(ctx->explainRes, &localRsp); - taosArrayDestroy(execInfoList); - } else { - SRpcHandleInfo connInfo = ctx->ctrlConnInfo; - connInfo.ahandle = NULL; - int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList); - taosArrayDestroyEx(execInfoList, freeItem); - QW_ERR_RET(code); - } + if (ctx->explain && !ctx->explainRsped) { + QW_ERR_RET(qwSendExplainResponse(QW_FPARAMS(), ctx)); } if (!ctx->needFetch) { @@ -1030,6 +1004,55 @@ _return: QW_RET(TSDB_CODE_SUCCESS); } +int32_t qwProcessNotify(QW_FPARAMS_DEF, SQWMsg *qwMsg) { + int32_t code = 0; + SQWTaskCtx *ctx = NULL; + bool locked = false; + + QW_ERR_JRET(qwAcquireTaskCtx(QW_FPARAMS(), &ctx)); + + QW_LOCK(QW_WRITE, &ctx->lock); + + locked = true; + + if (QW_QUERY_RUNNING(ctx)) { + QW_ERR_JRET(qwKillTaskHandle(ctx, TSDB_CODE_TSC_QUERY_CANCELLED)); + qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask); + } + + switch (qwMsg->msgType) { + case TASK_NOTIFY_FINISHED: + if (ctx->explain && !ctx->explainRsped) { + QW_ERR_RET(qwSendExplainResponse(QW_FPARAMS(), ctx)); + } + break; + default: + QW_ELOG("Invalid task notify type %d", qwMsg->msgType); + QW_ERR_JRET(TSDB_CODE_INVALID_MSG); + break; + } + +_return: + + if (code) { + if (ctx) { + QW_UPDATE_RSP_CODE(ctx, code); + qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); + } + } + + if (locked) { + QW_UNLOCK(QW_WRITE, &ctx->lock); + } + + if (ctx) { + qwReleaseTaskCtx(mgmt, ctx); + } + + QW_RET(TSDB_CODE_SUCCESS); +} + + int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { int32_t code = 0; SSchedulerHbRsp rsp = {0}; @@ -1354,6 +1377,7 @@ int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pSt pStat->cqueryProcessed = QW_STAT_GET(mgmt->stat.msgStat.cqueryProcessed); pStat->fetchProcessed = QW_STAT_GET(mgmt->stat.msgStat.fetchProcessed); pStat->dropProcessed = QW_STAT_GET(mgmt->stat.msgStat.dropProcessed); + pStat->notifyProcessed = QW_STAT_GET(mgmt->stat.msgStat.notifyProcessed); pStat->hbProcessed = QW_STAT_GET(mgmt->stat.msgStat.hbProcessed); pStat->deleteProcessed = QW_STAT_GET(mgmt->stat.msgStat.deleteProcessed); diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp index 02b341e28c..4a0d74a6e3 100644 --- a/source/libs/qworker/test/qworkerTests.cpp +++ b/source/libs/qworker/test/qworkerTests.cpp @@ -818,6 +818,9 @@ void *fetchQueueThread(void *param) { case TDMT_SCH_DROP_TASK: qWorkerProcessDropMsg(mockPointer, mgmt, fetchRpc, 0); break; + case TDMT_SCH_TASK_NOTIFY: + qWorkerProcessNotifyMsg(mockPointer, mgmt, fetchRpc, 0); + break; default: printf("unknown msg type:%d in fetch queue", fetchRpc->msgType); assert(0); diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index aecf3d5d91..63efa6bba4 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -531,7 +531,7 @@ void schDeregisterTaskHb(SSchJob *pJob, SSchTask *pTask); void schCleanClusterHb(void *pTrans); int32_t schLaunchTask(SSchJob *job, SSchTask *task); int32_t schDelayLaunchTask(SSchJob *pJob, SSchTask *pTask); -int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, SQueryNodeAddr *addr, int32_t msgType); +int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, SQueryNodeAddr *addr, int32_t msgType, void* param); SSchJob *schAcquireJob(int64_t refId); int32_t schReleaseJob(int64_t refId); void schFreeFlowCtrl(SSchJob *pJob); @@ -598,6 +598,7 @@ int32_t schProcessOnJobFailure(SSchJob *pJob, int32_t errCode); int32_t schProcessOnJobPartialSuccess(SSchJob *pJob); void schFreeTask(SSchJob *pJob, SSchTask *pTask); void schDropTaskInHashList(SSchJob *pJob, SHashObj *list); +int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type); int32_t schLaunchLevelTasks(SSchJob *pJob, SSchLevel *level); int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask); int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel); diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index d2ed26d405..87370e8993 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -638,6 +638,10 @@ void schDropJobAllTasks(SSchJob *pJob) { // schDropTaskInHashList(pJob, pJob->failTasks); } +int32_t schNotifyJobAllTasks(SSchJob *pJob, ETaskNotifyType type) { + SCH_RET(schNotifyTaskInHashList(pJob, pJob->execTasks, type)); +} + void schFreeJobImpl(void *job) { if (NULL == job) { return; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 01b4e7e9e6..10e25cae36 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -481,6 +481,18 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { return TSDB_CODE_SUCCESS; } +int32_t schHandleNotifyCallback(void *param, SDataBuf *pMsg, int32_t code) { + SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; + qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " task notify rsp received, code:0x%x", pParam->queryId, pParam->taskId, + code); + if (pMsg) { + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); + } + return TSDB_CODE_SUCCESS; +} + + int32_t schHandleLinkBrokenCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchCallbackParamHeader *head = (SSchCallbackParamHeader *)param; rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); @@ -646,6 +658,9 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { case TDMT_SCH_DROP_TASK: *fp = schHandleDropCallback; break; + case TDMT_SCH_TASK_NOTIFY: + *fp = schHandleNotifyCallback; + break; case TDMT_SCH_QUERY_HEARTBEAT: *fp = schHandleHbCallback; break; @@ -1027,7 +1042,7 @@ _return: SCH_RET(code); } -int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t msgType) { +int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t msgType, void* param) { int32_t msgSize = 0; void *msg = NULL; int32_t code = 0; @@ -1205,6 +1220,37 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, persistHandle = true; break; } + case TDMT_SCH_TASK_NOTIFY: { + ETaskNotifyType* pType = param; + STaskNotifyReq qMsg; + qMsg.header.vgId = addr->nodeId; + qMsg.header.contLen = 0; + qMsg.sId = schMgmt.sId; + qMsg.queryId = pJob->queryId; + qMsg.taskId = pTask->taskId; + qMsg.refId = pJob->refId; + qMsg.execId = pTask->execId; + qMsg.type = *pType; + + msgSize = tSerializeSTaskNotifyReq(NULL, 0, &qMsg); + if (msgSize < 0) { + SCH_TASK_ELOG("tSerializeSTaskNotifyReq get size, msgSize:%d", msgSize); + SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + msg = taosMemoryCalloc(1, msgSize); + if (NULL == msg) { + SCH_TASK_ELOG("calloc %d failed", msgSize); + SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + if (tSerializeSTaskNotifyReq(msg, msgSize, &qMsg) < 0) { + SCH_TASK_ELOG("tSerializeSTaskNotifyReq failed, msgSize:%d", msgSize); + taosMemoryFree(msg); + SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + break; + } default: SCH_TASK_ELOG("unknown msg type to send, msgType:%d", msgType); SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index 9985e7d6a1..b284edf39a 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -862,7 +862,7 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { while (nodeInfo) { if (nodeInfo->handle) { SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); - schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK); + schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK, NULL); SCH_TASK_DLOG("start to drop task's %dth execNode", i); } else { SCH_TASK_DLOG("no need to drop task %dth execNode", i); @@ -875,6 +875,33 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { SCH_TASK_DLOG("task has been dropped on %d exec nodes", size); } +int32_t schNotifyTaskOnExecNode(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType type) { + int32_t size = (int32_t)taosHashGetSize(pTask->execNodes); + if (size <= 0) { + SCH_TASK_DLOG("task no exec address to notify, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); + return TSDB_CODE_SUCCESS; + } + + int32_t i = 0; + SSchNodeInfo *nodeInfo = taosHashIterate(pTask->execNodes, NULL); + while (nodeInfo) { + if (nodeInfo->handle) { + SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); + SCH_ERR_RET(schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_TASK_NOTIFY, &type)); + SCH_TASK_DLOG("start to notify %d to task's %dth execNode", type, i); + } else { + SCH_TASK_DLOG("no need to notify %d to task %dth execNode", type, i); + } + + ++i; + nodeInfo = taosHashIterate(pTask->execNodes, nodeInfo); + } + + SCH_TASK_DLOG("task has been notified %d on %d exec nodes", type, size); + return TSDB_CODE_SUCCESS; +} + + int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) { int32_t taskNum = (int32_t)taosArrayGetSize(pStatusList); SSchTask *pTask = NULL; @@ -1001,7 +1028,7 @@ int32_t schLaunchRemoteTask(SSchJob *pJob, SSchTask *pTask) { SCH_ERR_RET(schEnsureHbConnection(pJob, pTask)); } - SCH_RET(schBuildAndSendMsg(pJob, pTask, NULL, plan->msgType)); + SCH_RET(schBuildAndSendMsg(pJob, pTask, NULL, plan->msgType, NULL)); } int32_t schLaunchLocalTask(SSchJob *pJob, SSchTask *pTask) { @@ -1238,8 +1265,29 @@ void schDropTaskInHashList(SSchJob *pJob, SHashObj *list) { } } +int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type) { + int32_t code = TSDB_CODE_SUCCESS; + void *pIter = taosHashIterate(list, NULL); + while (pIter) { + SSchTask *pTask = *(SSchTask **)pIter; + + SCH_LOCK_TASK(pTask); + code = schNotifyTaskOnExecNode(pJob, pTask, type); + SCH_UNLOCK_TASK(pTask); + + if (TSDB_CODE_SUCCESS != code) { + break; + } + + pIter = taosHashIterate(list, pIter); + } + + SCH_RET(code); +} + + int32_t schExecRemoteFetch(SSchJob *pJob, SSchTask *pTask) { - SCH_RET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask))); + SCH_RET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask), NULL)); } int32_t schExecLocalFetch(SSchJob *pJob, SSchTask *pTask) { From e0cc4e7ed7fccc325ca8dce43055b04c1501e6a7 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 25 Aug 2023 15:12:28 +0800 Subject: [PATCH 080/107] fix: notify task --- source/libs/scheduler/inc/schInt.h | 1 + source/libs/scheduler/src/schRemote.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 63efa6bba4..c649e645a0 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -613,6 +613,7 @@ int32_t schHandleJobRetry(SSchJob *pJob, SSchTask *pTask, SDataBuf *pMsg, int32 int32_t schChkResetJobRetry(SSchJob *pJob, int32_t rspCode); void schResetTaskForRetry(SSchJob *pJob, SSchTask *pTask); int32_t schChkUpdateRedirectCtx(SSchJob *pJob, SSchTask *pTask, SEpSet *pEpSet, int32_t rspCode); +int32_t schNotifyJobAllTasks(SSchJob *pJob, ETaskNotifyType type); extern SSchDebug gSCHDebug; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 10e25cae36..291a383393 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -88,6 +88,8 @@ int32_t schProcessFetchRsp(SSchJob *pJob, SSchTask *pTask, char *msg, int32_t rs SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp)); if (pRsp) { SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp)); + } else { + SCH_ERR_JRET(schNotifyJobAllTasks(pJob, TASK_NOTIFY_FINISHED)); } taosMemoryFreeClear(msg); From cf50665c209ede9d33f02887544dbcc313a00728 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 25 Aug 2023 15:20:12 +0800 Subject: [PATCH 081/107] fix: dead lock issue --- source/libs/scheduler/inc/schInt.h | 4 ++-- source/libs/scheduler/src/schJob.c | 4 ++-- source/libs/scheduler/src/schRemote.c | 2 +- source/libs/scheduler/src/schTask.c | 20 ++++++++++++-------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index c649e645a0..3b7a76bfc7 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -598,7 +598,7 @@ int32_t schProcessOnJobFailure(SSchJob *pJob, int32_t errCode); int32_t schProcessOnJobPartialSuccess(SSchJob *pJob); void schFreeTask(SSchJob *pJob, SSchTask *pTask); void schDropTaskInHashList(SSchJob *pJob, SHashObj *list); -int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type); +int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type, SSchTask *pTask); int32_t schLaunchLevelTasks(SSchJob *pJob, SSchLevel *level); int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask); int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel); @@ -613,7 +613,7 @@ int32_t schHandleJobRetry(SSchJob *pJob, SSchTask *pTask, SDataBuf *pMsg, int32 int32_t schChkResetJobRetry(SSchJob *pJob, int32_t rspCode); void schResetTaskForRetry(SSchJob *pJob, SSchTask *pTask); int32_t schChkUpdateRedirectCtx(SSchJob *pJob, SSchTask *pTask, SEpSet *pEpSet, int32_t rspCode); -int32_t schNotifyJobAllTasks(SSchJob *pJob, ETaskNotifyType type); +int32_t schNotifyJobAllTasks(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType type); extern SSchDebug gSCHDebug; diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 87370e8993..b565619e75 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -638,8 +638,8 @@ void schDropJobAllTasks(SSchJob *pJob) { // schDropTaskInHashList(pJob, pJob->failTasks); } -int32_t schNotifyJobAllTasks(SSchJob *pJob, ETaskNotifyType type) { - SCH_RET(schNotifyTaskInHashList(pJob, pJob->execTasks, type)); +int32_t schNotifyJobAllTasks(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType type) { + SCH_RET(schNotifyTaskInHashList(pJob, pJob->execTasks, type, pTask)); } void schFreeJobImpl(void *job) { diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 291a383393..7b8decc007 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -89,7 +89,7 @@ int32_t schProcessFetchRsp(SSchJob *pJob, SSchTask *pTask, char *msg, int32_t rs if (pRsp) { SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp)); } else { - SCH_ERR_JRET(schNotifyJobAllTasks(pJob, TASK_NOTIFY_FINISHED)); + SCH_ERR_JRET(schNotifyJobAllTasks(pJob, pTask, TASK_NOTIFY_FINISHED)); } taosMemoryFreeClear(msg); diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index b284edf39a..d96c01fc76 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -1265,18 +1265,22 @@ void schDropTaskInHashList(SSchJob *pJob, SHashObj *list) { } } -int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type) { +int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type, SSchTask *pCurrTask) { int32_t code = TSDB_CODE_SUCCESS; + + SCH_ERR_RET(schNotifyTaskOnExecNode(pJob, pCurrTask, type)); + void *pIter = taosHashIterate(list, NULL); while (pIter) { SSchTask *pTask = *(SSchTask **)pIter; - - SCH_LOCK_TASK(pTask); - code = schNotifyTaskOnExecNode(pJob, pTask, type); - SCH_UNLOCK_TASK(pTask); - - if (TSDB_CODE_SUCCESS != code) { - break; + if (pTask != pCurrTask) { + SCH_LOCK_TASK(pTask); + code = schNotifyTaskOnExecNode(pJob, pTask, type); + SCH_UNLOCK_TASK(pTask); + + if (TSDB_CODE_SUCCESS != code) { + break; + } } pIter = taosHashIterate(list, pIter); From 26e025d78d77bce62c1a792c8197585f38a32194 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 25 Aug 2023 15:43:45 +0800 Subject: [PATCH 082/107] feat:[TD-18789]support varbinary type --- include/libs/parser/parser.h | 1 + include/os/osString.h | 4 +- include/util/taoserror.h | 1 + include/util/tcompare.h | 2 +- include/util/tdef.h | 7 +- source/client/inc/clientSml.h | 1 - source/client/src/clientSml.c | 17 +- source/client/src/clientSmlLine.c | 44 ++- source/client/src/clientTmq.c | 4 + source/dnode/mnode/impl/src/mndTopic.c | 2 +- source/libs/parser/src/parInsertSml.c | 20 +- source/libs/parser/src/parInsertSql.c | 95 +++---- source/libs/parser/src/parInsertUtil.c | 4 +- source/libs/parser/src/parTokenizer.c | 2 +- source/libs/parser/src/parTranslater.c | 39 ++- source/libs/parser/src/parUtil.c | 2 +- source/libs/scalar/src/filter.c | 3 +- source/libs/scalar/src/sclvector.c | 90 +++++-- .../libs/scalar/test/filter/filterTests.cpp | 46 ---- source/os/src/osString.c | 78 ++++-- source/util/src/tcompare.c | 60 +---- source/util/src/terror.c | 1 + tests/parallel_test/cases.task | 1 + tests/system-test/2-query/sml.py | 8 +- tests/system-test/2-query/varbinary.py | 80 ++++++ tools/shell/src/shellEngine.c | 57 ++-- utils/test/c/CMakeLists.txt | 11 + utils/test/c/sml_test.c | 80 ++++++ utils/test/c/varbinary_test.c | 253 ++++++++++++++++++ utils/tsim/src/simExe.c | 1 - 30 files changed, 740 insertions(+), 274 deletions(-) create mode 100644 tests/system-test/2-query/varbinary.py create mode 100644 utils/test/c/varbinary_test.c diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 58bdb77df3..e6a67e68f0 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -119,6 +119,7 @@ int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsS char* msgBuf, int32_t msgBufLen); int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash); int rawBlockBindData(SQuery *query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD *fields, int numFields, bool needChangeLength); +void clearColValArray(SArray* pCols); int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray); SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap); diff --git a/include/os/osString.h b/include/os/osString.h index ed64cbfe3f..4982ac8bfd 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -92,7 +92,9 @@ double taosStr2Double(const char *str, char **pEnd); float taosStr2Float(const char *str, char **pEnd); int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size); int32_t taosAscii2Hex(const char *z, uint32_t n, void** data, uint32_t* size); -int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size); +//int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size); +bool isHex(const char* z, uint32_t n); +bool isValidateHex(const char* z, uint32_t n); #ifdef __cplusplus } diff --git a/include/util/taoserror.h b/include/util/taoserror.h index a5081f2c7d..dbfad8bf8a 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -708,6 +708,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INVALID_OPTR_USAGE TAOS_DEF_ERROR_CODE(0, 0x2667) #define TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2668) #define TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED TAOS_DEF_ERROR_CODE(0, 0x2669) +#define TSDB_CODE_PAR_INVALID_VARBINARY TAOS_DEF_ERROR_CODE(0, 0x266A) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/include/util/tcompare.h b/include/util/tcompare.h index 2fa736f4df..65457b287a 100644 --- a/include/util/tcompare.h +++ b/include/util/tcompare.h @@ -102,6 +102,7 @@ int32_t compareUint64ValDesc(const void *pLeft, const void *pRight); int32_t compareLenPrefixedStrDesc(const void *pLeft, const void *pRight); int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight); +int32_t compareLenBinaryValDesc(const void *pLeft, const void *pRight); int32_t comparestrPatternMatch(const void *pLeft, const void *pRight); int32_t comparestrPatternNMatch(const void *pLeft, const void *pRight); @@ -202,7 +203,6 @@ int32_t compareUint64Uint32(const void *pLeft, const void *pRight); __compar_fn_t getComparFunc(int32_t type, int32_t optr); __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order); -int32_t doCompare(const char *a, const char *b, int32_t type, size_t size); #ifdef __cplusplus } diff --git a/include/util/tdef.h b/include/util/tdef.h index e4af88bf10..6343540724 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -416,9 +416,10 @@ typedef enum ELogicConditionType { #define TSDB_EXPLAIN_RESULT_COLUMN_NAME "QUERY_PLAN" #define TSDB_MAX_FIELD_LEN 65519 // 16384:65519 -#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 -#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 -#define TSDB_MAX_GEOMETRY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_GEOMETRY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_VARBINARY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 #define PRIMARYKEY_TIMESTAMP_COL_ID 1 #define COL_REACH_END(colId, maxColId) ((colId) > (maxColId)) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 1839c14894..30d4792279 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -251,7 +251,6 @@ int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32 int32_t smlClearForRerun(SSmlHandle *info); int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg); uint8_t smlGetTimestampLen(int64_t num); -void clearColValArray(SArray* pCols); void smlDestroyTableInfo(void *para); void freeSSmlKv(void* data); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index a876ff9455..9b2f805675 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -596,7 +596,7 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm return TSDB_CODE_SML_INVALID_DATA; } - if (((colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_GEOMETRY) && + if (((colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_VARBINARY || colField[*index].type == TSDB_DATA_TYPE_GEOMETRY) && (colField[*index].bytes - VARSTR_HEADER_SIZE) < kv->length) || (colField[*index].type == TSDB_DATA_TYPE_NCHAR && ((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) { @@ -1178,21 +1178,12 @@ void smlDestroyTableInfo(void *para) { taosMemoryFree(tag); } -void clearColValArray(SArray *pCols) { - int32_t num = taosArrayGetSize(pCols); - for (int32_t i = 0; i < num; ++i) { - SColVal *pCol = taosArrayGet(pCols, i); - if (TSDB_DATA_TYPE_NCHAR == pCol->type) { - taosMemoryFreeClear(pCol->value.pData); - } - } -} - void freeSSmlKv(void *data) { SSmlKv *kv = (SSmlKv *)data; - if (kv->keyEscaped) taosMemoryFree((void *)(kv->key)); - if (kv->valueEscaped) taosMemoryFree((void *)(kv->value)); + if (kv->keyEscaped) taosMemoryFreeClear(kv->key); + if (kv->valueEscaped) taosMemoryFreeClear(kv->value); if (kv->type == TSDB_DATA_TYPE_GEOMETRY) geosFreeBuffer((void *)(kv->value)); + if (kv->type == TSDB_DATA_TYPE_VARBINARY) taosMemoryFreeClear(kv->value); } void smlDestroyInfo(SSmlHandle *info) { diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index 73622a11cc..e62e018caa 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -109,7 +109,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { return code; } char* tmp = taosMemoryCalloc(pVal->length, 1); - memcpy(tmp, pVal->value + 2, pVal->length - 3); + memcpy(tmp, pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN); code = doGeomFromText(tmp, (unsigned char **)&pVal->value, &pVal->length); taosMemoryFree(tmp); if (code != TSDB_CODE_SUCCESS) { @@ -126,6 +126,44 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { return TSDB_CODE_TSC_INVALID_VALUE; } + if (pVal->value[0] == 'b' || pVal->value[0] == 'B') { // varbinary + if (pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"' && pVal->length >= 3) { + pVal->type = TSDB_DATA_TYPE_VARBINARY; + if(isHex(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN)){ + if(!isValidateHex(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN)){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + + void* data = NULL; + uint32_t size = 0; + if(taosHex2Ascii(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (size + VARSTR_HEADER_SIZE > TSDB_MAX_VARBINARY_LEN) { + taosMemoryFree(data); + return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; + } + pVal->value = data; + pVal->length = size; + }else{ + pVal->length -= NCHAR_ADD_LEN; + if (pVal->length > TSDB_MAX_VARBINARY_LEN - VARSTR_HEADER_SIZE) { + return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; + } + void *data = taosMemoryMalloc(pVal->length); + if(data == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(data, pVal->value + (NCHAR_ADD_LEN - 1), pVal->length); + pVal->value = data; + } + + return TSDB_CODE_SUCCESS; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } + if (pVal->value[0] == 't' || pVal->value[0] == 'T') { if (pVal->length == 1 || (pVal->length == 4 && (pVal->value[1] == 'r' || pVal->value[1] == 'R') && @@ -515,6 +553,10 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin char *tmp = (char *)taosMemoryMalloc(kv.length); memcpy(tmp, kv.value, kv.length); PROCESS_SLASH_IN_FIELD_VALUE(tmp, kv.length); + ASSERT(kv.type != TSDB_DATA_TYPE_GEOMETRY); + if(kv.type == TSDB_DATA_TYPE_VARBINARY){ + taosMemoryFree((void*)kv.value); + } kv.value = tmp; kv.valueEscaped = valueEscaped; } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index b4168046f4..619f144bf9 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -985,6 +985,10 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) { int32_t tmq_unsubscribe(tmq_t* tmq) { if(tmq == NULL) return TSDB_CODE_INVALID_PARA; + if (tmq->status != TMQ_CONSUMER_STATUS__READY) { + tscInfo("consumer:0x%" PRIx64 " not in ready state, close it directly", tmq->consumerId); + return 0; + } if (tmq->autoCommit) { int32_t rsp = tmq_commit_sync(tmq, NULL); if (rsp != 0) { diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 0c8ebd83c9..6250a3dd71 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -4,7 +4,7 @@ * This program is free software: you can use, redistribute, and/or modify * it under the terms of the GNU Affero General Public License, version 3 * or later ("AGPL"), as published by the Free Software Foundation. - * + *f * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index 917848e121..aa10711e3c 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -18,18 +18,6 @@ #include "parToken.h" #include "ttime.h" -static void clearColValArray(SArray* pCols) { - int32_t num = taosArrayGetSize(pCols); - for (int32_t i = 0; i < num; ++i) { - SColVal* pCol = taosArrayGet(pCols, i); - if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type) { - taosMemoryFreeClear(pCol->value.pData); - } - pCol->flag = CV_FLAG_NONE; - pCol->value.val = 0; - } -} - int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf, int32_t msgBufLen) { SMsgBuf msg = {.buf = msgBuf, .len = msgBufLen}; @@ -237,10 +225,10 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32 } pVal->value.pData = pUcs4; pVal->value.nData = len; - } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_VARBINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_BINARY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; - } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) { pVal->value.nData = kv->length; pVal->value.pData = taosMemoryMalloc(kv->length); memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); @@ -368,10 +356,10 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc } pVal->value.pData = pUcs4; pVal->value.nData = len; - } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_VARBINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_BINARY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; - } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) { pVal->value.nData = kv->length; pVal->value.pData = taosMemoryMalloc(kv->length); memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index c58647e540..38afb6ddae 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -326,6 +326,38 @@ static int parseGeometry(SToken *pToken, unsigned char **output, size_t *size) { return code; } +static int32_t parseVarbinary(SToken* pToken, uint8_t **pData, uint32_t *nData, int32_t bytes){ + if(pToken->type != TK_NK_STRING){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + + if(isHex(pToken->z, pToken->n)){ + if(!isValidateHex(pToken->z, pToken->n)){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + + void* data = NULL; + uint32_t size = 0; + if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (size + VARSTR_HEADER_SIZE > bytes) { + taosMemoryFree(data); + return TSDB_CODE_PAR_VALUE_TOO_LONG; + } + *pData = data; + *nData = size; + }else{ + if (pToken->n + VARSTR_HEADER_SIZE > bytes) { + return TSDB_CODE_PAR_VALUE_TOO_LONG; + } + *pData = taosStrdup(pToken->z); + *nData = pToken->n; + } + return TSDB_CODE_SUCCESS; +} + static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, int16_t timePrec, STagVal* val, SMsgBuf* pMsgBuf) { int64_t iv; @@ -478,33 +510,10 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, break; } case TSDB_DATA_TYPE_VARBINARY: { - // Too long values will raise the invalid sql error message - // Too long values will raise the invalid sql error message - void* data = NULL; - uint32_t size = 0; - if (pToken->type == TK_NK_HEX){ - if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){ - return TSDB_CODE_OUT_OF_MEMORY; - } - }else if(pToken->type == TK_NK_BIN){ - if(taosBin2Ascii(pToken->z, pToken->n, &data, &size) < 0){ - return TSDB_CODE_OUT_OF_MEMORY; - } - }else{ - size = pToken->n; + code = parseVarbinary(pToken, &val->pData, &val->nData, pSchema->bytes); + if(code != TSDB_CODE_SUCCESS){ + return generateSyntaxErrMsg(pMsgBuf, code, pSchema->name); } - if (size + VARSTR_HEADER_SIZE > pSchema->bytes) { - if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ - taosMemoryFree(data); - } - return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); - } - if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ - val->pData = data; - }else{ - val->pData = taosStrdup(pToken->z); - } - val->nData = size; break; } case TSDB_DATA_TYPE_GEOMETRY: { @@ -1394,32 +1403,10 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, break; } case TSDB_DATA_TYPE_VARBINARY: { - // Too long values will raise the invalid sql error message - void* data = NULL; - uint32_t size = 0; - if (pToken->type == TK_NK_HEX){ - if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){ - return TSDB_CODE_OUT_OF_MEMORY; - } - }else if(pToken->type == TK_NK_BIN){ - if(taosBin2Ascii(pToken->z, pToken->n, &data, &size) < 0){ - return TSDB_CODE_OUT_OF_MEMORY; - } - }else{ - size = pToken->n; + int32_t code = parseVarbinary(pToken, &pVal->value.pData, &pVal->value.nData, pSchema->bytes); + if(code != TSDB_CODE_SUCCESS){ + return generateSyntaxErrMsg(&pCxt->msg, code, pSchema->name); } - if (size + VARSTR_HEADER_SIZE > pSchema->bytes) { - if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ - taosMemoryFree(data); - } - return generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); - } - if(pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN){ - pVal->value.pData = data; - }else{ - pVal->value.pData = taosStrdup(pToken->z); - } - pVal->value.nData = size; break; } case TSDB_DATA_TYPE_NCHAR: { @@ -1521,13 +1508,15 @@ static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, STo return code; } -static void clearColValArray(SArray* pCols) { +void clearColValArray(SArray* pCols) { int32_t num = taosArrayGetSize(pCols); for (int32_t i = 0; i < num; ++i) { SColVal* pCol = taosArrayGet(pCols, i); - if (IS_VAR_DATA_TYPE(pCol->type)) { + if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type) { taosMemoryFreeClear(pCol->value.pData); } + pCol->flag = CV_FLAG_NONE; + pCol->value.val = 0; } } diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 33699ed857..5ae2cf12c9 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -333,8 +333,8 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta* static void destroyColVal(void* p) { SColVal* pVal = p; - if (TSDB_DATA_TYPE_NCHAR == pVal->type || TSDB_DATA_TYPE_GEOMETRY == pVal->type) { - taosMemoryFree(pVal->value.pData); + if (TSDB_DATA_TYPE_NCHAR == pVal->type || TSDB_DATA_TYPE_GEOMETRY == pVal->type || TSDB_DATA_TYPE_VARBINARY == pVal->type) { + taosMemoryFreeClear(pVal->value.pData); } } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 41f6239455..c06615c083 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -545,7 +545,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { return i; } else if (next == 'x') { // hex number *tokenId = TK_NK_HEX; - for (i = 2; isdigit(z[i]) || (z[i] >= 'a' && z[i] <= 'f') || (z[i] >= 'A' && z[i] <= 'F'); ++i) { + for (i = 2; isxdigit(z[i]) != 0; ++i) { } if (i == 2) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0e8f29e051..fe15e62f9b 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1231,8 +1231,41 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, *(double*)&pVal->typeData = pVal->datum.d; break; } + case TSDB_DATA_TYPE_VARBINARY: { + if (pVal->node.resType.type != TSDB_DATA_TYPE_BINARY){ + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + + void* data = NULL; + uint32_t size = 0; + bool isHexChar = isHex(pVal->literal, strlen(pVal->literal)); + if(isHexChar){ + if(!isValidateHex(pVal->literal, strlen(pVal->literal))){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + if(taosHex2Ascii(pVal->literal, strlen(pVal->literal), &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + }else{ + size = pVal->node.resType.bytes; + data = pVal->literal; + } + + if (size + VARSTR_HEADER_SIZE > targetDt.bytes) { + if(isHexChar) taosMemoryFree(data); + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_VALUE_TOO_LONG, pVal->literal); + } + pVal->datum.p = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE); + if (NULL == pVal->datum.p) { + if(isHexChar) taosMemoryFree(data); + return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + } + varDataSetLen(pVal->datum.p, size + VARSTR_HEADER_SIZE); + memcpy(varDataVal(pVal->datum.p), data, size); + if(isHexChar) taosMemoryFree(data); + break; + } case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { if (strict && (pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); @@ -1296,7 +1329,9 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD res = translateNormalValue(pCxt, pVal, targetDt, strict); } pVal->node.resType.type = targetDt.type; - pVal->node.resType.bytes = targetDt.bytes; + if( targetDt.type == TSDB_DATA_TYPE_VARBINARY || !strict){ + pVal->node.resType.bytes = targetDt.bytes; + } pVal->node.resType.scale = pVal->unit; pVal->translate = true; if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) { diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 1c292b1ec4..b3ec6a6ef6 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -308,7 +308,7 @@ int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen) { dst[j] = '\''; } else if (src[k + 1] == '"') { dst[j] = '"'; - } else if (src[k + 1] == '%' || src[k + 1] == '_') { + } else if (src[k + 1] == '%' || src[k + 1] == '_' || src[k + 1] == 'x') { dst[j++] = src[k]; dst[j] = src[k + 1]; } else { diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 18dbb8d056..6cc235bd06 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -266,6 +266,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { } else { /* normal relational comparFn */ comparFn = 30; } + break; } case TSDB_DATA_TYPE_BINARY: { if (optr == OP_TYPE_MATCH) { @@ -1595,7 +1596,7 @@ int32_t fltConverToStr(char *str, int type, void *buf, int32_t bufSize, int32_t break; case TSDB_DATA_TYPE_BINARY: -// case TSDB_DATA_TYPE_BINARY:// todovar + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index a11a9f9394..e12c62ad87 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -309,6 +309,47 @@ static FORCE_INLINE void varToBool(char *buf, SScalarParam *pOut, int32_t rowInd } // todo remove this malloc +static FORCE_INLINE void varToVarbinary(char *buf, SScalarParam *pOut, int32_t rowIndex, int32_t *overflow) { + terrno = TSDB_CODE_SUCCESS; + + if(isHex(varDataVal(buf), varDataLen(buf))){ + if(!isValidateHex(varDataVal(buf), varDataLen(buf))){ + terrno = TSDB_CODE_PAR_INVALID_VARBINARY; + return; + } + + void* data = NULL; + uint32_t size = 0; + if(taosHex2Ascii(varDataVal(buf), varDataLen(buf), &data, &size) < 0){ + terrno = TSDB_CODE_OUT_OF_MEMORY; + return; + } + int32_t inputLen = size + VARSTR_HEADER_SIZE; + char *t = taosMemoryCalloc(1, inputLen); + if (t == NULL) { + sclError("Out of memory"); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return; + } + varDataSetLen(t, size); + memcpy(varDataVal(t), data, size); + colDataSetVal(pOut->columnData, rowIndex, t, false); + taosMemoryFree(t); + taosMemoryFree(data); + }else{ + int32_t inputLen = varDataTLen(buf); + char *t = taosMemoryCalloc(1, inputLen); + if (t == NULL) { + sclError("Out of memory"); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return; + } + memcpy(t, buf, inputLen); + colDataSetVal(pOut->columnData, rowIndex, t, false); + taosMemoryFree(t); + } +} + static FORCE_INLINE void varToNchar(char *buf, SScalarParam *pOut, int32_t rowIndex, int32_t *overflow) { terrno = TSDB_CODE_SUCCESS; @@ -398,18 +439,21 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { func = varToUnsigned; } else if (IS_FLOAT_TYPE(pCtx->outType)) { func = varToFloat; - } else if (pCtx->outType == TSDB_DATA_TYPE_VARCHAR && + } else if ((pCtx->outType == TSDB_DATA_TYPE_VARCHAR || pCtx->outType == TSDB_DATA_TYPE_VARBINARY) && pCtx->inType == TSDB_DATA_TYPE_NCHAR) { // nchar -> binary func = ncharToVar; vton = true; } else if (pCtx->outType == TSDB_DATA_TYPE_NCHAR && - pCtx->inType == TSDB_DATA_TYPE_VARCHAR) { // binary -> nchar + (pCtx->inType == TSDB_DATA_TYPE_VARCHAR || pCtx->inType == TSDB_DATA_TYPE_VARBINARY)) { // binary -> nchar func = varToNchar; vton = true; } else if (TSDB_DATA_TYPE_TIMESTAMP == pCtx->outType) { func = varToTimestamp; } else if (TSDB_DATA_TYPE_GEOMETRY == pCtx->outType) { func = varToGeometry; + } else if (TSDB_DATA_TYPE_VARBINARY == pCtx->outType) { + func = varToVarbinary; + vton = true; } else { sclError("invalid convert outType:%d, inType:%d", pCtx->outType, pCtx->inType); terrno = TSDB_CODE_APP_ERROR; @@ -885,7 +929,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, break; } case TSDB_DATA_TYPE_BINARY: -// case TSDB_DATA_TYPE_VARBINARY //todovar + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { return vectorConvertToVarData(&cCtx); @@ -901,26 +945,26 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/ /*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 5, 9, 7, 11, 12, 13, 14, 0, 7, 0, 0, 0, -1, - /*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, 0, -1, - /*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, 0, -1, - /*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 5, 9, 7, 4, 4, 5, 7, 0, 7, 0, 0, 0, -1, - /*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 5, 9, 7, 5, 5, 5, 7, 0, 7, 0, 0, 0, -1, - /*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, 7, 0, 0, 0, -1, - /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0, 0, -1, - /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 0, 0, 0, 0, 20, - /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 7, 0, 7, 0, 0, 0, -1, - /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, -1, - /*UTIN*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 0, 7, 0, 0, 0, -1, - /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 0, 7, 0, 0, 0, -1, - /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 7, 0, 0, 0, -1, - /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, -1, - /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + /*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 5, 9, 7, 11, 12, 13, 14, 0, -1, 0, 0, 0, -1, + /*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, -1, 0, 0, 0, -1, + /*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, -1, 0, 0, 0, -1, + /*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 5, 9, 7, 4, 4, 5, 7, 0, -1, 0, 0, 0, -1, + /*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 5, 9, 7, 5, 5, 5, 7, 0, -1, 0, 0, 0, -1, + /*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, -1, 0, 0, 0, -1, + /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, -1, 0, 0, 0, -1, + /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 16, 0, 0, 0, 20, + /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 7, 0, -1, 0, 0, 0, -1, + /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 16, 0, 0, 0, -1, + /*UTIN*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 0, -1, 0, 0, 0, -1, + /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 0, -1, 0, 0, 0, -1, + /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, -1, 0, 0, 0, -1, + /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,-1, -1, + /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0}; int32_t vectorGetConvertType(int32_t type1, int32_t type2) { if (type1 == type2) { diff --git a/source/libs/scalar/test/filter/filterTests.cpp b/source/libs/scalar/test/filter/filterTests.cpp index 51ee9b6570..cd3d681f58 100644 --- a/source/libs/scalar/test/filter/filterTests.cpp +++ b/source/libs/scalar/test/filter/filterTests.cpp @@ -1415,52 +1415,6 @@ void doCompareWithValueRange_OnlyLeftType(__compar_fn_t fp, int32_t rType) { } } -void doCompare(const std::vector &lTypes, const std::vector &rTypes, int32_t oper) { - for (int i = 0; i < lTypes.size(); ++i) { - for (int j = 0; j < rTypes.size(); ++j) { - auto fp = filterGetCompFuncEx(lTypes[i], rTypes[j], oper); - switch (lTypes[i]) { - case TSDB_DATA_TYPE_TINYINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_SMALLINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_INT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_BIGINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_UTINYINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_USMALLINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_UINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_UBIGINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - default: - FAIL(); - } - } - } -} - -TEST(dataCompareTest, signed_and_unsigned_int) { - std::vector lType = {TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, - TSDB_DATA_TYPE_BIGINT}; - std::vector rType = {TSDB_DATA_TYPE_UTINYINT, TSDB_DATA_TYPE_USMALLINT, TSDB_DATA_TYPE_UINT, - TSDB_DATA_TYPE_UBIGINT}; - - doCompare(lType, rType, OP_TYPE_GREATER_THAN); - doCompare(rType, lType, OP_TYPE_GREATER_THAN); -} - int main(int argc, char **argv) { taosSeedRand(taosGetTimestampSec()); testing::InitGoogleTest(&argc, argv); diff --git a/source/os/src/osString.c b/source/os/src/osString.c index cb01332525..8aac606473 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -469,10 +469,28 @@ float taosStr2Float(const char *str, char **pEnd) { return tmp; } +#define HEX_PREFIX_LEN 2 // \x +bool isHex(const char* z, uint32_t n){ + if(n < HEX_PREFIX_LEN) return false; + if(z[0] == '\\' && z[1] == 'x') return true; + return false; +} + +bool isValidateHex(const char* z, uint32_t n){ + if(n % 2 != 0) return false; + for(size_t i = HEX_PREFIX_LEN; i < n; i++){ + if(isxdigit(z[i]) == 0){ + return false; + } + } + return true; +} + int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ - n -= 2; // remove 0x - z += 2; - *size = n%2 == 0 ? n/2 : n/2 + 1; + n -= HEX_PREFIX_LEN; // remove 0x + z += HEX_PREFIX_LEN; + *size = n / HEX_PREFIX_LEN; + if(*size == 0) return 0; uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); if(tmp == NULL) return -1; int8_t num = 0; @@ -497,27 +515,31 @@ int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ return 0; } -int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ - n -= 2; // remove 0b - z += 2; - *size = n%8 == 0 ? n/8 : n/8 + 1; - uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); - if(tmp == NULL) return -1; - int8_t num = 0; - uint8_t *byte = tmp + *size - 1; - - for (int i = n - 1; i >= 0; i--) { - *byte |= ((uint8_t)(z[i] - '0') << num); - if (num == 8) { - byte--; - num = 0; - } else { - num++; - } - } - *data = tmp; - return 0; -} +//int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ +// +// for (i = 2; isdigit(z[i]) || (z[i] >= 'a' && z[i] <= 'f') || (z[i] >= 'A' && z[i] <= 'F'); ++i) { +// } +// +// n -= 2; // remove 0b +// z += 2; +// *size = n%8 == 0 ? n/8 : n/8 + 1; +// uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); +// if(tmp == NULL) return -1; +// int8_t num = 0; +// uint8_t *byte = tmp + *size - 1; +// +// for (int i = n - 1; i >= 0; i--) { +// *byte |= ((uint8_t)(z[i] - '0') << num); +// if (num == 7) { +// byte--; +// num = 0; +// } else { +// num++; +// } +// } +// *data = tmp; +// return 0; +//} static char valueOf(uint8_t symbol) { @@ -547,12 +569,12 @@ static char valueOf(uint8_t symbol) } int32_t taosAscii2Hex(const char *z, uint32_t n, void** data, uint32_t* size){ - *size = n * 2 + 2; - uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); + *size = n * 2 + HEX_PREFIX_LEN; + uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size + 1, 1); if(tmp == NULL) return -1; *data = tmp; - *(tmp++) = '0'; - *(tmp++) = 'X'; + *(tmp++) = '\\'; + *(tmp++) = 'x'; for(int i = 0; i < n; i ++){ uint8_t val = z[i]; tmp[i*2] = valueOf(val >> 4); diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 9e2fc74366..4bacda48d2 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -242,6 +242,10 @@ int32_t compareLenBinaryVal(const void *pLeft, const void *pRight) { } } +int32_t compareLenBinaryValDesc(const void *pLeft, const void *pRight) { + return compareLenBinaryVal(pRight, pLeft); +} + // string > number > bool > null // ref: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-comparison int32_t compareJsonVal(const void *pLeft, const void *pRight) { @@ -1464,6 +1468,8 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { return (order == TSDB_ORDER_ASC) ? compareUint32Val : compareUint32ValDesc; case TSDB_DATA_TYPE_UBIGINT: return (order == TSDB_ORDER_ASC) ? compareUint64Val : compareUint64ValDesc; + case TSDB_DATA_TYPE_VARBINARY: + return (order == TSDB_ORDER_ASC) ? compareLenBinaryVal : compareLenBinaryValDesc; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_GEOMETRY: return (order == TSDB_ORDER_ASC) ? compareLenPrefixedStr : compareLenPrefixedStrDesc; @@ -1475,57 +1481,3 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { return (order == TSDB_ORDER_ASC) ? compareInt32Val : compareInt32ValDesc; } } - -int32_t doCompare(const char *f1, const char *f2, int32_t type, size_t size) { - switch (type) { - case TSDB_DATA_TYPE_INT: - DEFAULT_COMP(GET_INT32_VAL(f1), GET_INT32_VAL(f2)); - case TSDB_DATA_TYPE_DOUBLE: - DEFAULT_DOUBLE_COMP(GET_DOUBLE_VAL(f1), GET_DOUBLE_VAL(f2)); - case TSDB_DATA_TYPE_FLOAT: - DEFAULT_FLOAT_COMP(GET_FLOAT_VAL(f1), GET_FLOAT_VAL(f2)); - case TSDB_DATA_TYPE_BIGINT: - DEFAULT_COMP(GET_INT64_VAL(f1), GET_INT64_VAL(f2)); - case TSDB_DATA_TYPE_SMALLINT: - DEFAULT_COMP(GET_INT16_VAL(f1), GET_INT16_VAL(f2)); - case TSDB_DATA_TYPE_TINYINT: - case TSDB_DATA_TYPE_BOOL: - DEFAULT_COMP(GET_INT8_VAL(f1), GET_INT8_VAL(f2)); - case TSDB_DATA_TYPE_UTINYINT: - DEFAULT_COMP(GET_UINT8_VAL(f1), GET_UINT8_VAL(f2)); - case TSDB_DATA_TYPE_USMALLINT: - DEFAULT_COMP(GET_UINT16_VAL(f1), GET_UINT16_VAL(f2)); - case TSDB_DATA_TYPE_UINT: - DEFAULT_COMP(GET_UINT32_VAL(f1), GET_UINT32_VAL(f2)); - case TSDB_DATA_TYPE_UBIGINT: - DEFAULT_COMP(GET_UINT64_VAL(f1), GET_UINT64_VAL(f2)); - case TSDB_DATA_TYPE_NCHAR: { - tstr *t1 = (tstr *)f1; - tstr *t2 = (tstr *)f2; - - if (t1->len != t2->len) { - return t1->len > t2->len ? 1 : -1; - } - int32_t ret = memcmp((TdUcs4 *)t1, (TdUcs4 *)t2, t2->len); - if (ret == 0) { - return ret; - } - return (ret < 0) ? -1 : 1; - } - default: { // todo refactor - tstr *t1 = (tstr *)f1; - tstr *t2 = (tstr *)f2; - - if (t1->len != t2->len) { - return t1->len > t2->len ? 1 : -1; - } else { - int32_t ret = strncmp(t1->data, t2->data, t1->len); - if (ret == 0) { - return 0; - } else { - return ret < 0 ? -1 : 1; - } - } - } - } -} diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 466b9985e7..998993bf65 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -555,6 +555,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY, "Window query not su TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DROP_COL, "No columns can be dropped") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be json type") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VARBINARY, "Invalidate varbinary type") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must have a definite time window range") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG, "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC, "Fill not allowed") diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 741226f101..e4303b2e15 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -351,6 +351,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/smaTest.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/sma_index.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml_TS-3724.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/varbinary.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/spread.py diff --git a/tests/system-test/2-query/sml.py b/tests/system-test/2-query/sml.py index cae012ece1..53ac85bd8e 100644 --- a/tests/system-test/2-query/sml.py +++ b/tests/system-test/2-query/sml.py @@ -1,18 +1,12 @@ -import taos import sys -import time -import socket import os -import threading from util.log import * from util.sql import * from util.cases import * from util.dnodes import * from util.common import * -sys.path.append("./7-tmq") -from tmqCommon import * class TDTestCase: updatecfgDict = {'clientCfg': {'smlChildTableName': 'dataModelName', 'fqdn': 'localhost', 'smlDot2Underline': 0}, 'fqdn': 'localhost'} @@ -32,7 +26,7 @@ class TDTestCase: tdLog.info(cmdStr) ret = os.system(cmdStr) if ret != 0: - tdLog.info("sml_test ret != 0") + tdLog.exit("sml_test ret != 0") tdSql.query(f"select * from ts3303.stb2") tdSql.query(f"select * from ts3303.meters") diff --git a/tests/system-test/2-query/varbinary.py b/tests/system-test/2-query/varbinary.py new file mode 100644 index 0000000000..8f7032cdc3 --- /dev/null +++ b/tests/system-test/2-query/varbinary.py @@ -0,0 +1,80 @@ +import sys +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.common import * + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def test(self): + tdLog.info(" test") + + buildPath = tdCom.getBuildPath() + cmdStr = '%s/build/bin/varbinary_test'%(buildPath) + print("cmdStr:", cmdStr) + tdLog.info(cmdStr) + ret = os.system(cmdStr) + if ret != 0: + tdLog.exit("varbinary_test ret != 0") + + tdSql.execute(f" create database test") + tdSql.execute(f" use test ") + tdSql.execute(f" create stable stb (ts timestamp, c1 nchar(32), c2 varbinary(16), c3 float) tags (t1 int, t2 binary(8), t3 varbinary(8))") + + tdSql.query(f"desc stb") + tdSql.checkRows(7) + tdSql.checkData(2, 1, 'VARBINARY') + tdSql.checkData(2, 2, 16) + tdSql.checkData(6, 1, 'VARBINARY') + tdSql.checkData(6, 2, 8) + + # tdSql.execute(f" insert into tb1 using stb tags (1, 'tb1_bin1', 'vart1') values (now, 'nchar1', 'varc1', 0.3)") + # tdSql.execute(f" insert into tb1 values (now + 1s, 'nchar2', null, 0.4)") + # + # tdSql.execute(f" insert into tb2 using stb tags (2, 'tb2_bin1', 093) values (now + 2s, 'nchar1', 892, 0.3)") + # tdSql.execute(f" insert into tb3 using stb tags (3, 'tb3_bin1', 0x7f829) values (now + 3s, 'nchar1', 0x7f829, 0.3)") + # tdSql.execute(f" insert into tb4 using stb tags (4, 'tb4_bin1', 0b100000010) values (now + 4s, 'nchar1', 0b110000001, 0.3)") + # tdSql.execute(f" insert into tb4 values (now + 5s, 'nchar1', 0b11000000100000000, 0.3)") + # tdSql.execute(f" insert into tb5 using stb tags (4, 'tb5_bin1', NULL) values (now + 6s, 'nchar1', 0b10100000011000000110000001, 0.3)") + + # basic query + # tdSql.query(f"select c2,t3 from stb order by ts") + # tdSql.checkRows(6) + # tdSql.checkData(0, 0, '0x7661726331') + # tdSql.checkData(0, 1, '0x7661727431') + # tdSql.checkData(1, 0, None) + # tdSql.checkData(1, 1, '0x7661727431') + # tdSql.checkData(2, 0, '0x383932') + # tdSql.checkData(2, 1, '0x303933') + # tdSql.checkData(3, 0, '0x07f829') + # tdSql.checkData(3, 1, '0x07f829') + # tdSql.checkData(4, 0, '0x0181') + # tdSql.checkData(4, 1, '0x0102') + # tdSql.checkData(5, 0, '0x02818181') + # tdSql.checkData(5, 1, None) + + # tdSql.query(f"select ts,c2 from stb order by c2") + # + # tdSql.query(f"select c2,t3 from stb where c2 >= 0 order by ts") + # + # tdSql.query(f"select c2,t3 from stb where c2 >= 0x0181 order by ts") + + + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring + tdSql.prepare() + self.test() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index f1a9a1d2bf..35ab86269d 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -323,13 +323,12 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i return; } - char quotationStr[2]; - quotationStr[0] = '\"'; - quotationStr[1] = 0; + char quotationStr[2] ={'"', 0}; int32_t width; - int n; - char buf[TSDB_MAX_BYTES_PER_ROW]; + int n = 0; +#define LENGTH 64 + char buf[LENGTH] = {0}; switch (field->type) { case TSDB_DATA_TYPE_BOOL: taosFprintfFile(pFile, "%d", ((((int32_t)(*((char *)val))) == 1) ? 1 : 0)); @@ -363,7 +362,7 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i if (tsEnableScience) { taosFprintfFile(pFile, "%*.7e", width, GET_FLOAT_VAL(val)); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.7f", width, GET_FLOAT_VAL(val)); + n = snprintf(buf, LENGTH, "%*.7f", width, GET_FLOAT_VAL(val)); if (n > SHELL_FLOAT_WIDTH) { taosFprintfFile(pFile, "%*.7e", width, GET_FLOAT_VAL(val)); } else { @@ -374,10 +373,10 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i case TSDB_DATA_TYPE_DOUBLE: width = SHELL_DOUBLE_WIDTH; if (tsEnableScience) { - snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15e", width, GET_DOUBLE_VAL(val)); + snprintf(buf, LENGTH, "%*.15e", width, GET_DOUBLE_VAL(val)); taosFprintfFile(pFile, "%s", buf); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15f", width, GET_DOUBLE_VAL(val)); + n = snprintf(buf, LENGTH, "%*.15f", width, GET_DOUBLE_VAL(val)); if (n > SHELL_DOUBLE_WIDTH) { taosFprintfFile(pFile, "%*.15e", width, GET_DOUBLE_VAL(val)); } else { @@ -386,26 +385,42 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i } break; case TSDB_DATA_TYPE_BINARY: -// case TSDB_DATA_TYPE_VARBINARY todovar case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: { int32_t bufIndex = 0; + char* tmp = (char*)taosMemoryCalloc(length * 2 + 1, 1); + if(tmp == NULL) break; for (int32_t i = 0; i < length; i++) { - buf[bufIndex] = val[i]; + tmp[bufIndex] = val[i]; bufIndex++; if (val[i] == '\"') { - buf[bufIndex] = val[i]; + tmp[bufIndex] = val[i]; bufIndex++; } } - buf[bufIndex] = 0; + tmp[bufIndex] = 0; - taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr); + taosFprintfFile(pFile, "%s%s%s", quotationStr, tmp, quotationStr); + taosMemoryFree(tmp); } break; - case TSDB_DATA_TYPE_GEOMETRY: - shellDumpHexValue(buf, val, length); - taosFprintfFile(pFile, "%s", buf); + case TSDB_DATA_TYPE_VARBINARY:{ + void* tmp = NULL; + uint32_t size = 0; + if(taosAscii2Hex(val, length, &tmp, &size) < 0){ + break; + } + taosFprintfFile(pFile, "%s", tmp); + taosMemoryFree(tmp); break; + } + case TSDB_DATA_TYPE_GEOMETRY:{ + char* tmp = (char*)taosMemoryCalloc(length * 2 + 1, 1); + if(tmp == NULL) break; + shellDumpHexValue(tmp, val, length); + taosFprintfFile(pFile, "%s", buf); + taosMemoryFree(tmp); + break; + } case TSDB_DATA_TYPE_TIMESTAMP: shellFormatTimestamp(buf, *(int64_t *)val, precision); taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr); @@ -779,14 +794,20 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) { return TMAX(SHELL_DOUBLE_WIDTH, width); case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: if (field->bytes > shell.args.displayWidth) { return TMAX(shell.args.displayWidth, width); } else { return TMAX(field->bytes + 2, width); } - + case TSDB_DATA_TYPE_VARBINARY:{ + int32_t bytes = field->bytes * 2 + 2; + if (bytes > shell.args.displayWidth) { + return TMAX(shell.args.displayWidth, width); + } else { + return TMAX(bytes + 2, width); + } + } case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: { uint16_t bytes = field->bytes * TSDB_NCHAR_SIZE; diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt index b96814c13b..43e97a3467 100644 --- a/utils/test/c/CMakeLists.txt +++ b/utils/test/c/CMakeLists.txt @@ -8,6 +8,7 @@ add_executable(sml_test sml_test.c) add_executable(get_db_name_test get_db_name_test.c) add_executable(tmq_offset tmqOffset.c) add_executable(tmq_offset_test tmq_offset_test.c) +add_executable(varbinary_test varbinary_test.c) target_link_libraries( tmq_offset PUBLIC taos @@ -65,6 +66,8 @@ target_link_libraries( PUBLIC util PUBLIC common PUBLIC os + PUBLIC geometry + ) target_link_libraries( @@ -74,3 +77,11 @@ target_link_libraries( PUBLIC common PUBLIC os ) + +target_link_libraries( + varbinary_test + PUBLIC taos + PUBLIC util + PUBLIC common + PUBLIC os +) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 237bfc5092..105fdd2ca4 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -21,6 +21,7 @@ #include "taos.h" #include "tlog.h" #include "types.h" +#include "geosWrapper.h" int smlProcess_influx_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1578,6 +1579,83 @@ int sml_td24559_Test() { printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); taos_free_result(pRes); + TAOS_ROW row = NULL; + pRes = taos_query(taos, "select * from stb order by _ts;"); + int rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { + + int32_t* length = taos_fetch_lengths(pRes); + + code = initCtxAsText(); + ASSERT (code == TSDB_CODE_SUCCESS); + char *outputWKT = NULL; + code = doAsText(row[2], length[2], &outputWKT); + ASSERT (code == TSDB_CODE_SUCCESS); + + if (rowIndex == 0) { + ASSERT(strcmp("POINT (4.343000 89.342000)", outputWKT) == 0); + } + if (rowIndex == 3) { + ASSERT(strcmp( "GEOMETRYCOLLECTION (MULTIPOINT ((0.000000 0.000000), (1.000000 1.000000)), POINT (3.000000 4.000000), LINESTRING (2.000000 3.000000, 3.000000 4.000000))", outputWKT) == 0); + } + geosFreeBuffer(outputWKT); + + rowIndex++; + } + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + +int sml_td18789_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists td18789"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists td18789"); + taos_free_result(pRes); + + const char *sql[] = { + "vbin,t1=1 f1=283i32,f2=b\"hello\" 1632299372000", + "vbin,t1=1 f2=B\"\\x98f46e\",f1=106i32 1632299373000", + }; + + pRes = taos_query(taos, "use td18789"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + int code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + taos_free_result(pRes); + + TAOS_ROW row = NULL; + pRes = taos_query(taos, "select *,tbname from vbin order by _ts"); + int rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { + int32_t* length = taos_fetch_lengths(pRes); + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(row[2], length[2], &data, &size) < 0){ + ASSERT(0); + } + + if (rowIndex == 0) { + ASSERT(memcmp(data, "\\x68656C6C6F", size) == 0); + } + if (rowIndex == 1) { + ASSERT(memcmp(data, "\\x98F46E", size) == 0); + } + taosMemoryFree(data); + + rowIndex++; + } + taos_free_result(pRes); + taos_close(taos); return code; @@ -1591,6 +1669,8 @@ int main(int argc, char *argv[]) { int ret = 0; ret = sml_td24559_Test(); ASSERT(!ret); + ret = sml_td18789_Test(); + ASSERT(!ret); ret = sml_td24070_Test(); ASSERT(!ret); ret = sml_td23881_Test(); diff --git a/utils/test/c/varbinary_test.c b/utils/test/c/varbinary_test.c new file mode 100644 index 0000000000..b2fccee63b --- /dev/null +++ b/utils/test/c/varbinary_test.c @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include "taos.h" +#include "types.h" +#include "tlog.h" + +#define GET_ROW_NUM \ + numRows = 0;\ + while(1){\ + row = taos_fetch_row(pRes);\ + if (row != NULL){\ + numRows++;\ + }else{\ + break;\ + }\ + } +int varbinary_test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists varbinary_db"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists varbinary_db"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use varbinary_db"); + int code = taos_errno(pRes); + taos_free_result(pRes); + ASSERT(code == 0); + + pRes = taos_query(taos, "create stable stb (ts timestamp, c1 nchar(32), c2 varbinary(16), c3 float) tags (t1 int, t2 binary(8), t3 varbinary(8))"); + taos_free_result(pRes); + + pRes = taos_query(taos, "desc stb"); + + TAOS_ROW row = NULL; + int32_t rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { + char* type = row[1]; + int32_t length = *(int32_t *)row[2]; + + if (rowIndex == 2) { + ASSERT(strncmp(type, "VARBINARY", sizeof("VARBINARY") - 1) == 0); + ASSERT(length == 16); + } + + if (rowIndex == 6) { + ASSERT(strncmp(type, "VARBINARY", sizeof("VARBINARY") - 1) == 0); + ASSERT(length == 8); + } + rowIndex++; + } + + pRes = taos_query(taos, "insert into tb1 using stb tags (1, 'tb1_bin1', 'vart1') values (now, 'nchar1', 'varc1', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb1 values (now + 1s, 'nchar2', null, 0.4);"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', '\\x7f8290') values (now + 2s, 'nchar1', '\\x7f8290', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb3 values (now + 3s, 'nchar1', '\\x7f829000', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb2 using stb tags (2, 'tb2_bin1', '\\x') values (now + 4s, 'nchar1', '\\x', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb2 values (now + 5s, 'nchar1', '\\x00000000', 0.3)"); + taos_free_result(pRes); + + // test insert + pRes = taos_query(taos, "insert into tb2 using stb tags (2, 'tb2_bin1', 093) values (now + 2s, 'nchar1', 892, 0.3)"); + ASSERT(taos_errno(pRes) != 0); + + pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', 0x7f829) values (now + 3s, 'nchar1', 0x7f829, 0.3)"); + ASSERT(taos_errno(pRes) != 0); + + pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', '\\x7f829') values (now + 3s, 'nchar1', '\\x7f829', 0.3)"); + ASSERT(taos_errno(pRes) != 0); + + pRes = taos_query(taos, "insert into tb4 using stb tags (4, 'tb4_bin1', 0b100000010) values (now + 4s, 'nchar1', 0b110000001, 0.3)"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + + // test error + pRes = taos_query(taos, "select * from tb1 where c2 >= 0x8de6"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from tb1 where c2 >= 0"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 > '\\x7F82900'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select c2+2 from stb"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select c2|2 from stb"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 not like 's%'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 like 's%'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 match 'ssd'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 nmatch 'ssd'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2->'ssd' = 1"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 contains 'ssd'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where sum(c2) = 2"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + +// pRes = taos_query(taos, "select * from stb where c2 contains 'ssd'"); +// ASSERT(taos_errno(pRes) != 0); +// taos_free_result(pRes); +// +// pRes = taos_query(taos, "select * from stb where c2 contains 'ssd'"); +// ASSERT(taos_errno(pRes) != 0); +// taos_free_result(pRes); + + int numRows = 0; + + pRes = taos_query(taos, "select * from stb where c2 > 'varc1'"); + GET_ROW_NUM + ASSERT(numRows == 2); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 > '\\x7F8290'"); + GET_ROW_NUM + ASSERT(numRows == 1); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 in ('\\x7F829000','\\x00000000')"); + GET_ROW_NUM + ASSERT(numRows == 2); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 not in ('\\x00000000')"); + GET_ROW_NUM + ASSERT(numRows == 4); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 is null"); + GET_ROW_NUM + ASSERT(numRows == 1); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 is not null"); + GET_ROW_NUM + ASSERT(numRows == 5); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 between '\\x3e' and '\\x7F8290'"); + GET_ROW_NUM + ASSERT(numRows == 2); + taos_free_result(pRes); + + + pRes = taos_query(taos, "select * from stb where c2 not between '\\x3e' and '\\x7F8290'"); + GET_ROW_NUM + ASSERT(numRows == 3); + taos_free_result(pRes); + + pRes = taos_query(taos, "select ts,c2 from stb order by c2"); + rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { +// int64_t ts = *(int64_t *)row[0]; + if (rowIndex == 0) { + ASSERT(row[1] == NULL); + rowIndex++; + continue; + } + int32_t* length = taos_fetch_lengths(pRes); + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(row[1], length[1], &data, &size) < 0){ + ASSERT(0); + } + + if (rowIndex == 1) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x", size) == 0); + } + if (rowIndex == 2) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x00000000", size) == 0); + } + if (rowIndex == 3) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x7661726331", size) == 0); + } + if (rowIndex == 4) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x7F8290", size) == 0); + } + if (rowIndex == 5) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x7F829000", size) == 0); + } + taosMemoryFree(data); + + rowIndex++; + } + printf("%s result1:%s\n", __FUNCTION__, taos_errstr(pRes)); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + +int main(int argc, char *argv[]) { + int ret = 0; + ret = varbinary_test(); + ASSERT(!ret); + return ret; +} diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 72b8eff27d..9a0a156717 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -751,7 +751,6 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { sprintf(value, "%.9lf", GET_DOUBLE_VAL(row[i])); break; case TSDB_DATA_TYPE_BINARY: -// case TSDB_DATA_TYPE_VARBINARY todovar case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: if (length[i] < 0 || length[i] > 1 << 20) { From 9cd8df12c23d104b943558b9c2fa240d732985a2 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 25 Aug 2023 16:32:01 +0800 Subject: [PATCH 083/107] fix:memory leak --- include/libs/parser/parser.h | 2 +- source/client/src/clientSmlJson.c | 4 ++-- source/client/src/clientSmlLine.c | 2 +- source/client/src/clientSmlTelnet.c | 2 +- source/libs/parser/src/parInsertSml.c | 14 +++++++++++++- source/libs/parser/src/parInsertSql.c | 6 ++---- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index e6a67e68f0..2dc5c8f112 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -114,12 +114,12 @@ int32_t smlBuildRow(STableDataCxt* pTableCxt); int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* kv, int32_t index); STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta); +void clearColValArraySml(SArray* pCols); int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsSchema, SArray* cols, STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl, char* msgBuf, int32_t msgBufLen); int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash); int rawBlockBindData(SQuery *query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD *fields, int numFields, bool needChangeLength); -void clearColValArray(SArray* pCols); int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray); SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap); diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 8c53d4f68a..f9076112c4 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -1012,7 +1012,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo if (ret == TSDB_CODE_SUCCESS) { ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; @@ -1216,7 +1216,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * if (ret == TSDB_CODE_SUCCESS) { ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index e62e018caa..a565fb1a21 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -733,7 +733,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index c378f9b1c3..f9f8602c5a 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -307,7 +307,7 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine if (ret == TSDB_CODE_SUCCESS) { ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index aa10711e3c..517bc630c3 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -181,6 +181,18 @@ STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta) { return pTableCxt; } +void clearColValArraySml(SArray* pCols) { + int32_t num = taosArrayGetSize(pCols); + for (int32_t i = 0; i < num; ++i) { + SColVal* pCol = taosArrayGet(pCols, i); + if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type || TSDB_DATA_TYPE_VARBINARY == pCol->type) { + taosMemoryFreeClear(pCol->value.pData); + } + pCol->flag = CV_FLAG_NONE; + pCol->value.val = 0; + } +} + int32_t smlBuildRow(STableDataCxt* pTableCxt) { SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1); int ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow); @@ -376,7 +388,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc goto end; } insCheckTableDataOrder(pTableCxt, TD_ROW_KEY(*pRow)); - clearColValArray(pTableCxt->pValues); + clearColValArraySml(pTableCxt->pValues); } end: diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 38afb6ddae..0e007e127e 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1508,15 +1508,13 @@ static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, STo return code; } -void clearColValArray(SArray* pCols) { +static void clearColValArray(SArray* pCols) { int32_t num = taosArrayGetSize(pCols); for (int32_t i = 0; i < num; ++i) { SColVal* pCol = taosArrayGet(pCols, i); - if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type) { + if (IS_VAR_DATA_TYPE(pCol->type)) { taosMemoryFreeClear(pCol->value.pData); } - pCol->flag = CV_FLAG_NONE; - pCol->value.val = 0; } } From f0fdbaa3f3dbfcb588ce1303fe6505f6528be9d8 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 25 Aug 2023 16:22:45 +0800 Subject: [PATCH 084/107] fix(tsdb/close): fix uaf with file closing --- source/dnode/vnode/src/tsdb/tsdbReaderWriter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index cd0bd47d47..dcf3770cbd 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -35,12 +35,12 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { if (pFD->pFD == NULL) { code = TAOS_SYSTEM_ERROR(ENOENT); - taosMemoryFree(pFD); + // taosMemoryFree(pFD); goto _exit; } } else { code = TAOS_SYSTEM_ERROR(errsv); - taosMemoryFree(pFD); + // taosMemoryFree(pFD); goto _exit; } } @@ -48,8 +48,8 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { pFD->pBuf = taosMemoryCalloc(1, szPage); if (pFD->pBuf == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; - taosCloseFile(&pFD->pFD); - taosMemoryFree(pFD); + // taosCloseFile(&pFD->pFD); + // taosMemoryFree(pFD); goto _exit; } @@ -57,9 +57,9 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { if (flag != TD_FILE_READ) { if (taosStatFile(path, &pFD->szFile, NULL, NULL) < 0) { code = TAOS_SYSTEM_ERROR(errno); - taosMemoryFree(pFD->pBuf); - taosCloseFile(&pFD->pFD); - taosMemoryFree(pFD); + // taosMemoryFree(pFD->pBuf); + // taosCloseFile(&pFD->pFD); + // taosMemoryFree(pFD); goto _exit; } From 533a7c43f8a221f0f148eb4963247dbd4d8f8390 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 25 Aug 2023 17:28:33 +0800 Subject: [PATCH 085/107] release 3.1.0.3 --- docs/en/28-releases/01-tdengine.md | 4 ++++ docs/zh/28-releases/01-tdengine.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index ff6a36440f..c02b3227ca 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://t import Release from "/components/ReleaseV3"; +## 3.1.0.3 + + + ## 3.1.0.2 diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index d316b3ab68..d4e4b116b7 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x å„版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.1.0.3 + + + ## 3.1.0.2 From ce44b80208bc50be81f8bbd9bec6e8d91a5b50ea Mon Sep 17 00:00:00 2001 From: Wade Zhang Date: Fri, 25 Aug 2023 19:31:58 +0800 Subject: [PATCH 086/107] doc: add enterprise functionalities --- docs/zh/12-taos-sql/25-grant.md | 257 +++-- .../{07-import.md => 04-import.md} | 0 .../{08-export.md => 05-export.md} | 0 .../{10-monitor.md => 06-monitor.md} | 0 docs/zh/17-operation/07-cluster.md | 78 ++ docs/zh/17-operation/08-web.md | 178 ++++ docs/zh/17-operation/09-storage.md | 52 + docs/zh/18-data-transfer/01-taosX.md | 972 ++++++++++++++++++ docs/zh/18-data-transfer/02-explorer.md | 128 +++ 9 files changed, 1587 insertions(+), 78 deletions(-) rename docs/zh/17-operation/{07-import.md => 04-import.md} (100%) rename docs/zh/17-operation/{08-export.md => 05-export.md} (100%) rename docs/zh/17-operation/{10-monitor.md => 06-monitor.md} (100%) create mode 100644 docs/zh/17-operation/07-cluster.md create mode 100644 docs/zh/17-operation/08-web.md create mode 100644 docs/zh/17-operation/09-storage.md create mode 100644 docs/zh/18-data-transfer/01-taosX.md create mode 100644 docs/zh/18-data-transfer/02-explorer.md diff --git a/docs/zh/12-taos-sql/25-grant.md b/docs/zh/12-taos-sql/25-grant.md index d53f951e67..42d740539f 100644 --- a/docs/zh/12-taos-sql/25-grant.md +++ b/docs/zh/12-taos-sql/25-grant.md @@ -4,87 +4,85 @@ title: æƒé™ç®¡ç† description: ä¼ä¸šç‰ˆä¸­æ‰å…·æœ‰çš„æƒé™ç®¡ç†åŠŸèƒ½ --- -本节讲述如何在 TDengine 中进行æƒé™ç®¡ç†çš„相关æ“作。æƒé™ç®¡ç†æ˜¯ TDengine ä¼ä¸šç‰ˆçš„特有功能,本节åªåˆ—举了一些基本的æƒé™ç®¡ç†åŠŸèƒ½ä½œä¸ºç¤ºä¾‹ï¼Œæ›´ä¸°å¯Œçš„æƒé™ç®¡ç†è¯·è”ç³» TDengine 销售或市场团队。 +本节讲述如何在 TDengine 中进行æƒé™ç®¡ç†çš„相关æ“作。æƒé™ç®¡ç†æ˜¯ TDengine ä¼ä¸šç‰ˆçš„特有功能,欲试用 TDengine ä¼ä¸šç‰ˆè¯·è”ç³» TDengine 销售或市场团队。 -## 创建用户 +TDengine 中的æƒé™ç®¡ç†åˆ†ä¸ºç”¨æˆ·ç®¡ç†ã€æ•°æ®åº“授æƒç®¡ç†ä»¥åŠæ¶ˆæ¯è®¢é˜…授æƒç®¡ç†ã€‚ + +当 TDengine 安装并部署æˆåŠŸåŽï¼Œç³»ç»Ÿä¸­å†…置有 "root" ç”¨æˆ·ã€‚æŒæœ‰é»˜è®¤ "root" 用户密ç çš„系统管ç†å‘˜åº”该第一时间修改 root 用户的密ç ï¼Œå¹¶æ ¹æ®ä¸šåŠ¡éœ€è¦åˆ›å»ºæ™®é€šç”¨æˆ·å¹¶ä¸ºè¿™äº›ç”¨æˆ·æŽˆäºˆé€‚当的æƒé™ã€‚在未授æƒçš„æƒ…况下,普通用户å¯ä»¥åˆ›å»º DATABASE,并拥有自己创建的 DATABASE 的所有æƒé™ï¼ŒåŒ…括删除数æ®åº“ã€ä¿®æ”¹æ•°æ®åº“ã€æŸ¥è¯¢æ—¶åºæ•°æ®å’Œå†™å…¥æ—¶åºæ•°æ®ã€‚超级用户å¯ä»¥ç»™æ™®é€šç”¨æˆ·æŽˆäºˆå…¶ä»–(å³éžè¯¥ç”¨æˆ·æ‰€åˆ›å»ºçš„) DATABASE 的读写æƒé™ï¼Œä½¿å…¶å¯ä»¥åœ¨è¿™äº› DATABASE 上读写数æ®ï¼Œä½†ä¸èƒ½å¯¹å…¶è¿›è¡Œåˆ é™¤å’Œä¿®æ”¹æ•°æ®åº“çš„æ“作。超级用户或者 topic 的创建者也å¯ä»¥ç»™å…¶å®ƒç”¨æˆ·æŽˆäºˆå¯¹æŸä¸ª topic 的订阅æƒé™ã€‚ + +## ç”¨æˆ·ç®¡ç† + +ç”¨æˆ·ç®¡ç†æ¶‰åŠç”¨æˆ·çš„æ•´ä¸ªç”Ÿå‘½å‘¨æœŸï¼Œä»Žåˆ›å»ºç”¨æˆ·ã€å¯¹ç”¨æˆ·è¿›è¡ŒæŽˆæƒã€æ’¤é”€å¯¹ç”¨æˆ·çš„æŽˆæƒã€æŸ¥çœ‹ç”¨æˆ·ä¿¡æ¯ã€ç›´åˆ°åˆ é™¤ç”¨æˆ·ã€‚ + +### 创建用户 + +创建用户的æ“作åªèƒ½ç”± root 用户进行,语法如下 + +```sql +CREATE USER user_name PASS 'password' [SYSINFO {1\|0}]; +``` + +说明: + +- user_name 最长为 23 字节。 +- password 最长为 128 å­—èŠ‚ï¼Œåˆæ³•字符包括"a-zA-Z0-9!?\$%\^&\*()_–+={[}]:;@\~\#\|\<,\>.?/",ä¸å¯ä»¥å‡ºçްå•åŒå¼•å·ã€æ’‡å·ã€åæ–œæ å’Œç©ºæ ¼ï¼Œä¸”ä¸å¯ä»¥ä¸ºç©ºã€‚ +- SYSINFO 表示用户是å¦å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚1 表示å¯ä»¥æŸ¥çœ‹ï¼Œ0 表示ä¸å¯ä»¥æŸ¥çœ‹ã€‚系统信æ¯åŒ…括æœåŠ¡ç«¯é…置信æ¯ã€æœåŠ¡ç«¯å„ç§èŠ‚ç‚¹ä¿¡æ¯ï¼ˆå¦‚ DNODEã€QNODE等)ã€å­˜å‚¨ç›¸å…³çš„ä¿¡æ¯ç­‰ã€‚默认为å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚ + +示例:创建密ç ä¸º123456且å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯çš„用户 test + +``` +SQL taos\> create user test pass '123456' sysinfo 1; Query OK, 0 of 0 rows affected (0.001254s) +``` + +### 查看用户 + +查看系统中的用户信æ¯è¯·ä½¿ç”¨ show users 命令,示例如下 + +```sql +show users; +``` + +也å¯ä»¥é€šè¿‡æŸ¥è¯¢ç³»ç»Ÿè¡¨ `INFORMATION_SCHEMA.INS_USERS` 获å–系统中的用户信æ¯ï¼Œç¤ºä¾‹å¦‚下 + +```sql +select * from information_schema.ins_users; +``` + +### 删除用户 + +删除用户请使用 + +```sql +DROP USER user_name; +``` + +### ä¿®æ”¹ç”¨æˆ·ä¿¡æ¯ + +修改用户信æ¯çš„命令如下 + +```sql +ALTER USER user_name alter_user_clause alter_user_clause: { PASS 'literal' \| ENABLE value \| SYSINFO value } +``` + +说明: + +- PASS:修改用户密ç ã€‚ +- ENABLE:修改用户是å¦å¯ç”¨ã€‚1 表示å¯ç”¨æ­¤ç”¨æˆ·ï¼Œ0 表示ç¦ç”¨æ­¤ç”¨æˆ·ã€‚ +- SYSINFO:修改用户是å¦å¯æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚1 表示å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ï¼Œ0 表示ä¸å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚ + +示例:ç¦ç”¨ test 用户 + +```sql +alter user test enable 0; Query OK, 0 of 0 rows affected (0.001160s) +``` ```sql CREATE USER use_name PASS 'password' [SYSINFO {1|0}]; ``` -创建用户。 +## 访问控制 -use_name 最长为 23 字节。 - -password 最长为 31 å­—èŠ‚ï¼Œåˆæ³•字符包括"a-zA-Z0-9!?$%^&*()_–+={[}]:;@~#|<,>.?/",ä¸å¯ä»¥å‡ºçްå•åŒå¼•å·ã€æ’‡å·ã€åæ–œæ å’Œç©ºæ ¼ï¼Œä¸”ä¸å¯ä»¥ä¸ºç©ºã€‚ - -SYSINFO 表示用户是å¦å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚1 表示å¯ä»¥æŸ¥çœ‹ï¼Œ0 表示ä¸å¯ä»¥æŸ¥çœ‹ã€‚系统信æ¯åŒ…括æœåŠ¡ç«¯é…置信æ¯ã€æœåŠ¡ç«¯å„ç§èŠ‚ç‚¹ä¿¡æ¯ï¼ˆå¦‚ DNODEã€QNODE等)ã€å­˜å‚¨ç›¸å…³çš„ä¿¡æ¯ç­‰ã€‚默认为å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚ - -例如,创建密ç ä¸º123456且å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯çš„用户test如下: - -```sql -taos> create user test pass '123456' sysinfo 1; -Query OK, 0 of 0 rows affected (0.001254s) -``` - -## 查看用户 - -```sql -SHOW USERS; -``` - -查看用户信æ¯ã€‚ - -```sql -taos> show users; - name | super | enable | sysinfo | create_time | -================================================================================ - test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 | - root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 | -Query OK, 2 rows in database (0.001657s) -``` - -也å¯ä»¥é€šè¿‡æŸ¥è¯¢INFORMATION_SCHEMA.INS_USERSç³»ç»Ÿè¡¨æ¥æŸ¥çœ‹ç”¨æˆ·ä¿¡æ¯ï¼Œä¾‹å¦‚: - -```sql -taos> select * from information_schema.ins_users; - name | super | enable | sysinfo | create_time | -================================================================================ - test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 | - root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 | -Query OK, 2 rows in database (0.001953s) -``` - -## 删除用户 - -```sql -DROP USER user_name; -``` - -## ä¿®æ”¹ç”¨æˆ·ä¿¡æ¯ - -```sql -ALTER USER user_name alter_user_clause - -alter_user_clause: { - PASS 'literal' - | ENABLE value - | SYSINFO value -} -``` - -- PASS:修改用户密ç ã€‚ -- ENABLE:修改用户是å¦å¯ç”¨ã€‚1 表示å¯ç”¨æ­¤ç”¨æˆ·ï¼Œ0 表示ç¦ç”¨æ­¤ç”¨æˆ·ã€‚ -- SYSINFO:修改用户是å¦å¯æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚1 表示å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ï¼Œ0 表示ä¸å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ã€‚ - -例如,ç¦ç”¨ test 用户: - -```sql -taos> alter user test enable 0; -Query OK, 0 of 0 rows affected (0.001160s) -``` - -## æŽˆæƒ +在 TDengine ä¼ä¸šç‰ˆä¸­ï¼Œç³»ç»Ÿç®¡ç†å‘˜å¯ä»¥æ ¹æ®ä¸šåŠ¡å’Œæ•°æ®å®‰å…¨çš„éœ€è¦æŽ§åˆ¶ä»»æ„一个用户对æ¯ä¸€ä¸ªæ•°æ®åº“ã€è®¢é˜…甚至表级别的访问。 ```sql GRANT privileges ON priv_level TO user_name @@ -105,14 +103,106 @@ priv_level : { } ``` -对用户授æƒã€‚授æƒåŠŸèƒ½åªåŒ…å«åœ¨ä¼ä¸šç‰ˆä¸­ã€‚ +### æ•°æ®åº“æƒé™ -授æƒçº§åˆ«æ”¯æŒåˆ°DATABASE,æƒé™æœ‰READå’ŒWRITE两ç§ã€‚ -TDengine 有超级用户和普通用户两类用户。超级用户缺çœåˆ›å»ºä¸ºroot,拥有所有æƒé™ã€‚使用超级用户创建出æ¥çš„用户为普通用户。在未授æƒçš„æƒ…况下,普通用户å¯ä»¥åˆ›å»ºDATABASE,并拥有自己创建的DATABASE的所有æƒé™ï¼ŒåŒ…括删除数æ®åº“ã€ä¿®æ”¹æ•°æ®åº“ã€æŸ¥è¯¢æ—¶åºæ•°æ®å’Œå†™å…¥æ—¶åºæ•°æ®ã€‚超级用户å¯ä»¥ç»™æ™®é€šç”¨æˆ·æŽˆäºˆå…¶ä»–DATABASE的读写æƒé™ï¼Œä½¿å…¶å¯ä»¥åœ¨æ­¤DATABASE上读写数æ®ï¼Œä½†ä¸èƒ½å¯¹å…¶è¿›è¡Œåˆ é™¤å’Œä¿®æ”¹æ•°æ®åº“çš„æ“作。 +TDengine 有超级用户和普通用户两类用户。超级用户缺çœåˆ›å»ºä¸ºroot,拥有所有æƒé™ã€‚使用超级用户创建出æ¥çš„用户为普通用户。在未授æƒçš„æƒ…况下,普通用户å¯ä»¥åˆ›å»º DATABASE,并拥有自己创建的 DATABASE 的所有æƒé™ï¼ŒåŒ…括删除数æ®åº“ã€ä¿®æ”¹æ•°æ®åº“ã€æŸ¥è¯¢æ—¶åºæ•°æ®å’Œå†™å…¥æ—¶åºæ•°æ®ã€‚超级用户å¯ä»¥ç»™æ™®é€šç”¨æˆ·æŽˆäºˆå…¶ä»– DATABASE 的读写æƒé™ï¼Œä½¿å…¶å¯ä»¥åœ¨æ­¤ DATABASE 上读写数æ®ï¼Œä½†ä¸èƒ½å¯¹å…¶è¿›è¡Œåˆ é™¤å’Œä¿®æ”¹æ•°æ®åº“çš„æ“作。 对于éžDATABASE的对象,如USERã€DNODEã€UDFã€QNODEç­‰ï¼Œæ™®é€šç”¨æˆ·åªæœ‰è¯»æƒé™ï¼ˆä¸€èˆ¬ä¸ºSHOW命令),ä¸èƒ½åˆ›å»ºå’Œä¿®æ”¹ã€‚ +对数æ®åº“的访问æƒé™åŒ…å«è¯»å’Œå†™ä¸¤ç§æƒé™ï¼Œå®ƒä»¬å¯ä»¥è¢«åˆ†åˆ«æŽˆäºˆï¼Œä¹Ÿå¯ä»¥è¢«åŒæ—¶æŽˆäºˆã€‚ + +补充说明 + +- priv_level æ ¼å¼ä¸­ "." 之å‰ä¸ºæ•°æ®åº“å称, "." 之åŽä¸ºè¡¨åç§° +- "dbname.\*" æ„æ€æ˜¯å为 "dbname" 的数æ®åº“中的所有表 +- "\*.\*" æ„æ€æ˜¯æ‰€æœ‰æ•°æ®åº“å中的所有表 + +**下表中总结了数æ®åº“æƒé™çš„å„ç§ç»„åˆ** + +对 root 用户和普通用户的æƒé™çš„说明如下表 + +| 用户 | æè¿° | æƒé™è¯´æ˜Ž | +|----------|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 超级用户 | åªæœ‰ root 是超级用户 | DB 外部 所有æ“作æƒé™ï¼Œä¾‹å¦‚userã€dnodeã€udfã€qnode等的CRUD DB æƒé™ï¼ŒåŒ…括 创建 删除 更新,例如修改 Option,移动 Vgruopç­‰ 读 写 Enable/Disable 用户 | +| 普通用户 | 除 root 以外的其它用户å‡ä¸ºæ™®é€šç”¨æˆ· | 在å¯è¯»çš„ DB 中,普通用户å¯ä»¥è¿›è¡Œè¯»æ“作 select describe show subscribe 在å¯å†™ DB 的内部,用户å¯ä»¥è¿›è¡Œå†™æ“作: 创建ã€åˆ é™¤ã€ä¿®æ”¹ 超级表 创建ã€åˆ é™¤ã€ä¿®æ”¹ å­è¡¨ 创建ã€åˆ é™¤ã€ä¿®æ”¹ topic å†™å…¥æ•°æ® è¢«é™åˆ¶ç³»ç»Ÿä¿¡æ¯æ—¶ï¼Œä¸å¯è¿›è¡Œå¦‚下æ“作 show dnodeã€mnodeã€vgroupsã€qnodeã€snode ä¿®æ”¹ç”¨æˆ·åŒ…æ‹¬è‡ªèº«å¯†ç  show dbæ—¶åªèƒ½çœ‹åˆ°è‡ªå·±çš„db,并且ä¸èƒ½çœ‹åˆ°vgroupsã€å‰¯æœ¬ã€cacheç­‰ä¿¡æ¯ æ— è®ºæ˜¯å¦è¢«é™åˆ¶ç³»ç»Ÿä¿¡æ¯ï¼Œéƒ½å¯ä»¥ ç®¡ç† udf å¯ä»¥åˆ›å»º DB 自己创建的 DB 具备所有æƒé™ éžè‡ªå·±åˆ›å»ºçš„ DB ,å‚照读ã€å†™åˆ—表中的æƒé™ | + +### 消æ¯è®¢é˜…æŽˆæƒ + +ä»»æ„用户都å¯ä»¥åœ¨è‡ªå·±æ‹¥æœ‰è¯»æƒé™çš„æ•°æ®åº“上创建 topic。超级用户 root å¯ä»¥åœ¨ä»»æ„æ•°æ®åº“上创建 topic。æ¯ä¸ª topic 的订阅æƒé™éƒ½å¯ä»¥è¢«ç‹¬ç«‹æŽˆæƒç»™ä»»ä½•用户,ä¸ç®¡è¯¥ç”¨æˆ·æ˜¯å¦æ‹¥æœ‰è¯¥æ•°æ®åº“的访问æƒé™ã€‚删除 topic åªèƒ½ç”± root 用户或者该 topic 的创建者进行。topic åªèƒ½ç”±è¶…级用户ã€topicçš„åˆ›å»ºè€…æˆ–è€…è¢«æ˜¾å¼æŽˆäºˆ subscribe æƒé™çš„用户订阅。 + +授予订阅æƒé™çš„语法如下: + +```sql +GRANT privileges ON priv_level TO user_name privileges : { ALL | priv_type [, priv_type] ... } priv_type : { SUBSCRIBE } priv_level : { topic_name } +``` + +### 基于标签的授æƒï¼ˆè¡¨çº§æŽˆæƒï¼‰ + +从 TDengine 3.0.5.0 å¼€å§‹ï¼Œæˆ‘ä»¬æ”¯æŒæŒ‰æ ‡ç­¾æŽˆæƒæŸä¸ªè¶…级表中部分特定的å­è¡¨ã€‚具体的 SQL 语法如下。 + +```sql +GRANT privileges ON priv_level [WITH tag_condition] TO user_name + +privileges : { + ALL + | SUBSCRIBE + | priv_type [, priv_type] ... +} + +priv_type : { + READ + | WRITE +} + +priv_level : { + dbname.tbname + | dbname.* + | *.* + | topic_name +} + +REVOKE privileges ON priv_level [WITH tag_condition] FROM user_name + +privileges : { + ALL + | priv_type [, priv_type] ... +} + +priv_type : { + READ + | WRITE +} + +priv_level : { + dbname.tbname + | dbname.* + | *.* +} +``` + +ä¸Šé¢ SQL 的语义为: + +- 用户å¯ä»¥é€šè¿‡ dbname.tbname æ¥ä¸ºæŒ‡å®šçš„表(包括超级表和普通表)授予或回收其读写æƒé™ï¼Œä¸æ”¯æŒç›´æŽ¥å¯¹å­è¡¨æŽˆäºˆæˆ–回收æƒé™ã€‚ +- 用户å¯ä»¥é€šè¿‡ dbname.tbname å’Œ WITH å­å¥æ¥ä¸ºç¬¦åˆæ¡ä»¶çš„æ‰€æœ‰å­è¡¨æŽˆäºˆæˆ–回收其读写æƒé™ã€‚使用 WITH å­å¥æ—¶ï¼Œæƒé™çº§åˆ«å¿…须为超级表。 + +**表级æƒé™å’Œæ•°æ®åº“æƒé™çš„关系** + +下表列出了在ä¸åŒçš„æ•°æ®åº“授æƒå’Œè¡¨çº§æŽˆæƒçš„组åˆä¸‹äº§ç”Ÿçš„实际æƒé™ã€‚ + +| |**表无授æƒ** | **表读授æƒ** | **è¡¨è¯»æŽˆæƒæœ‰æ ‡ç­¾æ¡ä»¶** | **表写授æƒ** | **è¡¨å†™æŽˆæƒæœ‰æ ‡ç­¾æ¡ä»¶** | +| -------------- | ---------------- | -------- | ---------- | ------ | ----------- | +| **æ•°æ®åº“无授æƒ** | æ— æŽˆæƒ | 对此表有读æƒé™ï¼Œå¯¹æ•°æ®åº“下的其他表无æƒé™ | å¯¹æ­¤è¡¨ç¬¦åˆæ ‡ç­¾æƒé™çš„å­è¡¨æœ‰è¯»æƒé™ï¼Œå¯¹æ•°æ®åº“下的其他表无æƒé™ | 对此表有写æƒé™ï¼Œå¯¹æ•°æ®åº“下的其他表无æƒé™ | å¯¹æ­¤è¡¨ç¬¦åˆæ ‡ç­¾æƒé™çš„å­è¡¨æœ‰å†™æƒé™ï¼Œå¯¹æ•°æ®åº“下的其他表无æƒé™ | +| **æ•°æ®åº“读授æƒ** | 对所有表有读æƒé™ | 对所有表有读æƒé™ | å¯¹æ­¤è¡¨ç¬¦åˆæ ‡ç­¾æƒé™çš„å­è¡¨æœ‰è¯»æƒé™ï¼Œå¯¹æ•°æ®åº“下的其他表有读æƒé™ | 对此表有写æƒé™ï¼Œå¯¹æ‰€æœ‰è¡¨æœ‰è¯»æƒé™ | å¯¹æ­¤è¡¨ç¬¦åˆæ ‡ç­¾æƒé™çš„å­è¡¨æœ‰å†™æƒé™ï¼Œæ‰€æœ‰è¡¨æœ‰è¯»æƒé™ | +| **æ•°æ®åº“写授æƒ** | 对所有表有写æƒé™ | 对此表有读æƒé™ï¼Œå¯¹æ‰€æœ‰è¡¨æœ‰å†™æƒé™ | å¯¹æ­¤è¡¨ç¬¦åˆæ ‡ç­¾æƒé™çš„å­è¡¨æœ‰è¯»æƒé™ï¼Œå¯¹æ‰€æœ‰è¡¨æœ‰å†™æƒé™ | 对所有表有写æƒé™ | å¯¹æ­¤è¡¨ç¬¦åˆæ ‡ç­¾æƒé™çš„å­è¡¨æœ‰å†™æƒé™ï¼Œæ•°æ®åº“下的其他表有写æƒé™ | + +### æŸ¥çœ‹ç”¨æˆ·æŽˆæƒ + +使用下é¢çš„命令å¯ä»¥æ˜¾ç¤ºä¸€ä¸ªç”¨æˆ·æ‰€æ‹¥æœ‰çš„æŽˆæƒï¼š + +```sql +show user privileges +``` ## æ’¤é”€æŽˆæƒ ```sql @@ -135,4 +225,15 @@ priv_level : { ``` -收回对用户的授æƒã€‚授æƒåŠŸèƒ½åªåŒ…å«åœ¨ä¼ä¸šç‰ˆä¸­ã€‚ +### æ’¤é”€æŽˆæƒ + +1. 撤销数æ®åº“è®¿é—®çš„æŽˆæƒ + +```sql +REVOKE privileges ON priv_level FROM user_name privileges : { ALL \| priv_type [, priv_type] ... } priv_type : { READ \| WRITE } priv_level : { dbname.\* \| \*.\* } +``` + +2. 撤销数æ®è®¢é˜…çš„æŽˆæƒ + +```sql +REVOKE privileges ON priv_level FROM user_name privileges : { ALL \| priv_type [, priv_type] ... } priv_type : { SUBSCRIBE } priv_level : { topi_name } diff --git a/docs/zh/17-operation/07-import.md b/docs/zh/17-operation/04-import.md similarity index 100% rename from docs/zh/17-operation/07-import.md rename to docs/zh/17-operation/04-import.md diff --git a/docs/zh/17-operation/08-export.md b/docs/zh/17-operation/05-export.md similarity index 100% rename from docs/zh/17-operation/08-export.md rename to docs/zh/17-operation/05-export.md diff --git a/docs/zh/17-operation/10-monitor.md b/docs/zh/17-operation/06-monitor.md similarity index 100% rename from docs/zh/17-operation/10-monitor.md rename to docs/zh/17-operation/06-monitor.md diff --git a/docs/zh/17-operation/07-cluster.md b/docs/zh/17-operation/07-cluster.md new file mode 100644 index 0000000000..0b7fb7e53d --- /dev/null +++ b/docs/zh/17-operation/07-cluster.md @@ -0,0 +1,78 @@ +--- +title: 集群è¿ç»´ +description: TDengine æä¾›äº†å¤šç§é›†ç¾¤è¿ç»´æ‰‹æ®µä»¥ä½¿é›†ç¾¤è¿è¡Œæ›´å¥åº·æ›´é«˜æ•ˆ +--- + +为了使集群è¿è¡Œæ›´å¥åº·æ›´é«˜æ•ˆï¼ŒTDengine ä¼ä¸šç‰ˆæä¾›äº†ä¸€äº›è¿ç»´æ‰‹æ®µæ¥å¸®åŠ©ç³»ç»Ÿç®¡ç†å‘˜æ›´å¥½åœ°è¿ç»´é›†ç¾¤ã€‚ + +## æ•°æ®é‡æ•´ + +TDengine é¢å‘多ç§å†™å…¥åœºæ™¯ï¼Œåœ¨æœ‰äº›å†™å…¥åœºæ™¯ä¸‹ï¼ŒTDengine 的存储会导致数æ®å­˜å‚¨çš„æ”¾å¤§æˆ–æ•°æ®æ–‡ä»¶çš„空洞等。这一方é¢å½±å“æ•°æ®çš„存储效率,å¦ä¸€æ–¹é¢ä¹Ÿä¼šå½±å“查询效率。为了解决上述问题,TDengine ä¼ä¸šç‰ˆæä¾›äº†å¯¹æ•°æ®çš„釿•´åŠŸèƒ½ï¼Œå³ DATA COMPACT åŠŸèƒ½ï¼Œå°†å­˜å‚¨çš„æ•°æ®æ–‡ä»¶é‡æ–°æ•´ç†ï¼Œåˆ é™¤æ–‡ä»¶ç©ºæ´žå’Œæ— æ•ˆæ•°æ®ï¼Œæé«˜æ•°æ®çš„组织度,从而æé«˜å­˜å‚¨å’ŒæŸ¥è¯¢çš„æ•ˆçŽ‡ã€‚ + +**语法** + +```sql +COMPACT DATABASE db_name [start with 'XXXX'] [end with 'YYYY']ï¼› +``` + +**效果** + +- 扫æå¹¶åŽ‹ç¼©æŒ‡å®šçš„ DB 中所有 VGROUP 中 VNODE çš„æ‰€æœ‰æ•°æ®æ–‡ä»¶ +- COMPCAT 会删除被删除数æ®ä»¥åŠè¢«åˆ é™¤çš„è¡¨çš„æ•°æ® +- COMPACT 会åˆå¹¶å¤šä¸ª STT 文件 +- å¯é€šè¿‡ start with 关键字指定 COMPACT æ•°æ®çš„èµ·å§‹æ—¶é—´ +- å¯é€šè¿‡ end with 关键字指定 COMPACT æ•°æ®çš„终止时间 + +**补充说明** + +- COMPACT 为异步,执行 COMPACT 命令åŽä¸ä¼šç­‰ COMPACT 结æŸå°±ä¼šè¿”回。如果上一个 COMPACT 没有完æˆåˆ™å†å‘起一个 COMPACT 任务,则会等上一个任务完æˆåŽå†è¿”回。 +- COMPACT å¯èƒ½é˜»å¡žå†™å…¥ï¼Œä½†ä¸é˜»å¡žæŸ¥è¯¢ +- COMPACT 的进度ä¸å¯è§‚测 + +## 集群负载å†å¹³è¡¡ + +当多副本集群中的一个或多个节点因为å‡çº§æˆ–其它原因而é‡å¯åŽï¼Œæœ‰å¯èƒ½å‡ºçŽ°é›†ç¾¤ä¸­å„个 dnode è´Ÿè½½ä¸å‡è¡¡çš„现象,æžç«¯æƒ…况下会出现所有 vgroup çš„ leader 都ä½äºŽåŒä¸€ä¸ª dnode 的情况。为了解决这个问题,å¯ä»¥ä½¿ç”¨ä¸‹é¢çš„命令 + +```sql +balance vgroup leader; +``` + +**功能** + +让所有的 vgroup çš„ leade r在å„自的replica节点上å‡åŒ€åˆ†å¸ƒã€‚这个命令会让 vgroup å¼ºåˆ¶é‡æ–°é€‰ä¸¾ï¼Œé€šè¿‡é‡æ–°é€‰ä¸¾ï¼Œåœ¨é€‰ä¸¾çš„è¿‡ç¨‹ä¸­ï¼Œå˜æ¢ vgroup çš„leader,通过这个方å¼ï¼Œæœ€ç»ˆè®©leaderå‡åŒ€åˆ†å¸ƒã€‚ + +**注æ„** + +Rafté€‰ä¸¾æœ¬èº«å¸¦æœ‰éšæœºæ€§ï¼Œæ‰€ä»¥é€šè¿‡é€‰ä¸¾çš„釿–°åˆ†å¸ƒäº§ç”Ÿçš„å‡åŒ€åˆ†å¸ƒä¹Ÿæ˜¯å¸¦æœ‰ä¸€å®šçš„æ¦‚率,ä¸ä¼šå®Œå…¨çš„å‡åŒ€ã€‚**è¯¥å‘½ä»¤çš„å‰¯ä½œç”¨æ˜¯å½±å“æŸ¥è¯¢å’Œå†™å…¥**,在vgroup釿–°é€‰ä¸¾æ—¶ï¼Œä»Žå¼€å§‹é€‰ä¸¾åˆ°é€‰ä¸¾å‡ºæ–°çš„ leader 这段时间,这 个vgroup 无法写入和查询。选举过程一般在秒级完æˆã€‚所有的vgroupä¼šä¾æ¬¡é€ä¸ªé‡æ–°é€‰ä¸¾ã€‚ + +## æ¢å¤æ•°æ®èŠ‚ç‚¹ + +当集群中的æŸä¸ªæ•°æ®èŠ‚ç‚¹ï¼ˆdnode)的数æ®å…¨éƒ¨ä¸¢å¤±æˆ–被破å,比如ç£ç›˜æŸå或者目录被误删除,å¯ä»¥é€šè¿‡ `restore dnode` å‘½ä»¤æ¥æ¢å¤è¯¥æ•°æ®èŠ‚ç‚¹ä¸Šçš„éƒ¨åˆ†æˆ–å…¨éƒ¨é€»è¾‘èŠ‚ç‚¹ï¼Œè¯¥åŠŸèƒ½ä¾èµ–多副本中的其它副本进行数æ®å¤åˆ¶ï¼Œæ‰€ä»¥åªåœ¨é›†ç¾¤ä¸­ dnode æ•°é‡å¤§äºŽç­‰äºŽ 3 且副本数为 3 的情况下能够工作。 + + +```sql +restore dnode ï¼›# æ¢å¤dnode上的mnode,所有vnodeå’Œqnode +restore mnode on dnode ï¼›# æ¢å¤dnode上的mnode +restore vnode on dnode ï¼›# æ¢å¤dnode上的所有vnode +restore qnode on dnode ï¼›# æ¢å¤dnode上的qnode +``` + +**é™åˆ¶** +- 该功能是基于已有的å¤åˆ¶åŠŸèƒ½çš„æ¢å¤ï¼Œä¸æ˜¯ç¾é𾿢夿ˆ–者备份æ¢å¤ï¼Œæ‰€ä»¥å¯¹äºŽè¦æ¢å¤çš„ mnode å’Œ vnodeæ¥è¯´ï¼Œä½¿ç”¨è¯¥å‘½ä»¤çš„å‰ææ˜¯è¿˜å­˜åœ¨è¯¥ mnode 或 vnode 的其它两个副本ä»ç„¶èƒ½å¤Ÿæ­£å¸¸å·¥ä½œã€‚ +- 该命令ä¸èƒ½ä¿®å¤æ•°æ®ç›®å½•中的个别文件的æŸå或者丢失。例如,如果æŸä¸ª mnode 或者 vnode ä¸­çš„ä¸ªåˆ«æ–‡ä»¶æˆ–æ•°æ®æŸå,无法å•独æ¢å¤æŸåçš„æŸä¸ªæ–‡ä»¶æˆ–者æŸå—æ•°æ®ã€‚此时,å¯ä»¥é€‰æ‹©å°†è¯¥ mnode/vnode 的数æ®å…¨éƒ¨æ¸…空å†è¿›è¡Œæ¢å¤ã€‚ + + +## 虚拟组分裂 (Scale Out) + +当一个 vgroup 因为å­è¡¨æ•°è¿‡å¤šè€Œå¯¼è‡´ CPU 或 Disk 资æºä½¿ç”¨é‡è´Ÿè½½è¿‡é«˜æ—¶ï¼Œå¢žåŠ  dnode 节点åŽï¼Œå¯é€šè¿‡ `split vgroup` 命令把该 vgroup 分裂为两个虚拟组。分裂完æˆåŽï¼Œæ–°äº§ç”Ÿçš„两个 vgroup 承担原æ¥ç”±ä¸€ä¸ª vgroup æä¾›çš„读写æœåŠ¡ã€‚è¿™ä¹Ÿæ˜¯ TDengine 为ä¼ä¸šç‰ˆç”¨æˆ·æä¾›çš„ scale out 集群的能力。 + +```sql +split vgroup +``` + +**注æ„** +- å•副本库虚拟组,在分裂完æˆåŽï¼Œåކ岿—¶åºæ•°æ®æ€»ç£ç›˜ç©ºé—´ä½¿ç”¨é‡ï¼Œå¯èƒ½ä¼šç¿»å€ã€‚所以,在执行该æ“作之å‰ï¼Œé€šè¿‡å¢žåŠ  dnode 节点方å¼ï¼Œç¡®ä¿é›†ç¾¤ä¸­æœ‰è¶³å¤Ÿçš„ CPU å’Œç£ç›˜èµ„æºï¼Œé¿å…资æºä¸è¶³çŽ°è±¡å‘生。 +- 该命令为 DB 级事务;执行过程,当å‰DB的其它管ç†äº‹åŠ¡å°†ä¼šè¢«æ‹’ç»ã€‚集群中,其它DBä¸å—å½±å“。 +- åˆ†è£‚ä»»åŠ¡æ‰§è¡Œè¿‡ç¨‹ä¸­ï¼Œå¯æŒç»­æä¾›è¯»å†™æœåŠ¡ï¼›æœŸé—´ï¼Œå¯èƒ½å­˜åœ¨å¯æ„ŸçŸ¥çš„短暂的读写业务中断。 +- åœ¨åˆ†è£‚è¿‡ç¨‹ä¸­ï¼Œä¸æ”¯æŒæµå’Œè®¢é˜…。分裂结æŸåŽï¼ŒåŽ†å² WAL 会清空。 +- åˆ†è£‚è¿‡ç¨‹ä¸­ï¼Œå¯æ”¯æŒèŠ‚ç‚¹å®•æœºé‡å¯å®¹é”™ï¼›ä½†ä¸æ”¯æŒèŠ‚ç‚¹ç£ç›˜æ•…障容错。 \ No newline at end of file diff --git a/docs/zh/17-operation/08-web.md b/docs/zh/17-operation/08-web.md new file mode 100644 index 0000000000..9923c9912e --- /dev/null +++ b/docs/zh/17-operation/08-web.md @@ -0,0 +1,178 @@ +--- +title: 基于 Web 的系统管ç†å·¥å…· +description: 本节æè¿° TDengine 的图形化管ç†å·¥å…·ï¼Œ taos-explorer, 的基本功能 +--- + +## 简介 + +为了易于ä¼ä¸šç‰ˆç”¨æˆ·æ›´å®¹æ˜“ä½¿ç”¨å’Œç®¡ç†æ•°æ®åº“,TDengine 3.0 ä¼ä¸šç‰ˆæä¾›äº†ä¸€ä¸ªå…¨æ–°çš„å¯è§†åŒ–组件 taosExplorerã€‚ç”¨æˆ·èƒ½å¤Ÿåœ¨å…¶ä¸­æ–¹ä¾¿åœ°ç®¡ç†æ•°æ®åº“管ç†ç³»ç»Ÿä¸­ä¸­å„元素(数æ®åº“ã€è¶…级表ã€å­è¡¨ï¼‰çš„生命周期,执行查询,监控系统状æ€ï¼Œç®¡ç†ç”¨æˆ·å’ŒæŽˆæƒï¼Œå®Œæˆæ•°æ®å¤‡ä»½å’Œæ¢å¤ï¼Œä¸Žå…¶å®ƒé›†ç¾¤ä¹‹é—´è¿›è¡Œæ•°æ®åŒæ­¥ï¼Œå¯¼å‡ºæ•°æ®ï¼Œç®¡ç†ä¸»é¢˜å’Œæµè®¡ç®—。 + +**欲体验基于 Web çš„ TDengine 系统管ç†èƒ½åŠ›ï¼Œè¯·è”ç³» TDengine 市场或销售团队** + +## 部署æœåŠ¡ + +### 准备工作 + +1. taosExplorer 没有独立的安装包,请使用 taosX 安装包进行安装。 +2. 在å¯åЍ taosExplorer 之å‰ï¼Œè¯·å…ˆç¡®è®¤ TDengine é›†ç¾¤å·²ç»æ­£ç¡®è®¾ç½®å¹¶è¿è¡Œï¼ˆå³ taosd æœåŠ¡ï¼‰ï¼ŒtaosAdapter ä¹Ÿå·²ç»æ­£ç¡®è®¾ç½®å’Œè¿è¡Œå¹¶ä¸Ž TDengine é›†ç¾¤ä¿æŒè¿žæŽ¥çжæ€ã€‚如果想è¦ä½¿ç”¨æ•°æ®å¤‡ä»½å’Œæ¢å¤æˆ–者数æ®åŒæ­¥åŠŸèƒ½ï¼Œè¯·ç¡®ä¿ taosX æœåŠ¡å’Œ Agent æœåŠ¡ä¹Ÿå·²ç»æ­£ç¡®è®¾ç½®å’Œè¿è¡Œã€‚ + +### é…ç½® + +在å¯åЍ taosExplorer 之å‰ï¼Œè¯·ç¡®ä¿é…置文件中的内容正确。 + +```TOML +listen = "0.0.0.0:6060" +log_level = "info" +cluster = "http://localhost:6041" +x_api = "http://localhost:6050" +``` + +说明: + +- listen - taosExplorer 对外æä¾›æœåŠ¡çš„åœ°å€ +- log_level - 日志级别,å¯é€‰å€¼ä¸º "debug", "info", "warn", "error", "fatal" +- cluster - TDengine集群的 taosadapter åœ°å€ +- x_api - taosX çš„æœåŠ¡åœ°å€ + +### å¯åЍ + +ç„¶åŽå¯åЍ taosExplorer,å¯ä»¥ç›´æŽ¥åœ¨å‘½ä»¤è¡Œæ‰§è¡Œ taos-explorer 或者使用下é¢çš„ systemctl 脚本用 systemctl æ¥å¯åЍ taosExplorer æœåŠ¡ + +```shell +[Unit] +Description=Explorer for TDengine +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/bin/taos-explorer +Restart=always + +[Install] +WantedBy=multi-user.target +``` + +### 问题排查 + +1. 当通过æµè§ˆå™¨æ‰“å¼€taosExplorer站点é‡åˆ°â€œæ— æ³•访问此网站â€çš„é”™è¯¯ä¿¡æ¯æ—¶ï¼Œè¯·é€šè¿‡å‘½ä»¤è¡Œç™»å½•taosExplorer所在机器,并使用命令systemctl status taos-explorer.service检查æœåŠ¡çš„çŠ¶æ€ï¼Œå¦‚æžœè¿”å›žçš„çŠ¶æ€æ˜¯inactive,请使用命令systemctl start taos-explorer.serviceå¯åЍæœåŠ¡ã€‚ +2. 如果需è¦èŽ·å–taosExplorer的详细日志,å¯é€šè¿‡å‘½ä»¤journalctl -u taos-explorer + +## 登录 + +在 TDengine 管ç†ç³»ç»Ÿçš„登录页é¢ï¼Œè¾“入正确的用户å和密ç åŽï¼Œç‚¹å‡»ç™»å½•按钮,å³å¯ç™»å½•。 + +说明: +- 这里的用户,需è¦åœ¨æ‰€è¿žæŽ¥çš„ TDengine 中创建,TDengine 默认的用户å和密ç ä¸º`root/taosdata`; +- 在 TDengine 中创建用户时,默认会设置用户的 SYSINFO 属性值为1, 表示该用户å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¿¡æ¯ï¼Œåªæœ‰ SYSINFO 属性为 1 的用户æ‰èƒ½æ­£å¸¸ç™»å½• TDengine 管ç†ç³»ç»Ÿã€‚ + +## 颿¿ + +taosExplorer 内置了一个简å•的仪表盘展示以下集群信æ¯ï¼Œç‚¹å‡»å·¦ä¾§åŠŸèƒ½åˆ—è¡¨ä¸­çš„ "颿¿" å¯ä»¥å¯ç”¨æ­¤åŠŸèƒ½ã€‚ + +- 默认的仪表盘会返回对应 Grafana 的安装é…ç½®å‘导 +- é…置过 Grafana 的仪表盘在点击' 颿¿' 时会跳转到对应的é…置地å€ï¼ˆè¯¥åœ°å€æ¥æºäºŽ /profile 接å£çš„返回值) + + +## æ•°æ®æµè§ˆå™¨ + +ç‚¹å‡»åŠŸèƒ½åˆ—è¡¨çš„â€œæ•°æ®æµè§ˆå™¨â€å…¥å£ï¼Œåœ¨â€œæ•°æ®æµè§ˆå™¨â€ä¸­å¯ä»¥åˆ›å»ºå’Œåˆ é™¤æ•°æ®åº“ã€åˆ›å»ºå’Œåˆ é™¤è¶…级表和å­è¡¨ï¼Œæ‰§è¡ŒSQL语å¥ï¼ŒæŸ¥çœ‹SQL语å¥çš„æ‰§è¡Œç»“果。此外,超级管ç†å‘˜è¿˜æœ‰å¯¹æ•°æ®åº“çš„ç®¡ç†æƒé™ï¼Œå…¶ä»–ç”¨æˆ·ä¸æä¾›è¯¥åŠŸèƒ½ã€‚ + +具体æƒé™æœ‰ï¼š + +1.查看(æä¾›æ•°æ®åº“/超级表/普通表的基本信æ¯ï¼‰ + +2.编辑 (编辑数æ®åº“/超级表/普通表的信æ¯) + +3.æ•°æ®åº“ç®¡ç†æƒé™ (仅é™è¶…级管ç†å‘˜ï¼Œè¯¥æ“作å¯ä»¥ç»™æŒ‡å®šç”¨æˆ·é…置数æ®åº“ç®¡ç†æƒé™ï¼‰ + +4.删除 (删除数æ®åº“/超级表/普通表) + +5.追加 (选择对应的数æ®åº“/超级表/普通表å称直接追加到å³ä¾§sql输入区域,é¿å…了手工输入) + + +## ç³»ç»Ÿç®¡ç† + +点击功能列表中的“系统管ç†â€å…¥å£ï¼Œå¯ä»¥åˆ›å»ºç”¨æˆ·ã€å¯¹ç”¨æˆ·è¿›è¡Œè®¿é—®æŽˆæƒã€ä»¥åŠåˆ é™¤ç”¨æˆ·ã€‚è¿˜èƒ½å¤Ÿå¯¹å½“å‰æ‰€ç®¡ç†çš„集群中的数æ®è¿›è¡Œå¤‡ä»½å’Œæ¢å¤ã€‚也å¯ä»¥é…置一个远程 TDengine 的地å€è¿›è¡Œæ•°æ®åŒæ­¥ã€‚åŒæ—¶ä¹Ÿæä¾›äº†é›†ç¾¤ä¿¡æ¯å’Œè®¸å¯è¯çš„ä¿¡æ¯ä»¥åŠä»£ç†ä¿¡æ¯ä»¥ä¾›æŸ¥çœ‹ã€‚ç³»ç»Ÿç®¡ç† èœå•åªæœ‰ root ç”¨æˆ·æ‰æœ‰æƒé™çœ‹åˆ° + +### ç”¨æˆ·ç®¡ç† + +点击“系统管ç†â€åŽï¼Œé»˜è®¤ä¼šè¿›å…¥â€œç”¨æˆ·â€æ ‡ç­¾é¡µã€‚ +在用户列表,å¯ä»¥æŸ¥çœ‹ç³»ç»Ÿä¸­å·²å­˜åœ¨çš„用户åŠå…¶åˆ›å»ºæ—¶é—´ï¼Œå¹¶å¯ä»¥å¯¹ç”¨æˆ·è¿›è¡Œå¯ç”¨ã€ç¦ç”¨ï¼Œç¼–辑(包括修改密ç ï¼Œæ•°æ®åº“的读写æƒé™ç­‰ï¼‰ï¼Œåˆ é™¤ç­‰æ“作。 +点击用户列表å³ä¸Šæ–¹çš„“+æ–°å¢žâ€æŒ‰é’®ï¼Œå³å¯æ‰“开“新增用户â€å¯¹è¯æ¡†ï¼š +1. 输入新增用户的用户å称,必填 +2. 输入新增用户的登录密ç ï¼Œå¿…填,密ç é•¿åº¦è¦æ±‚为8-16ä¸ªå­—ç¬¦ï¼Œä¸”è‡³å°‘è¦æ»¡è¶³ä»¥ä¸‹4个æ¡ä»¶ä¸­çš„3个:大写字æ¯ï¼Œå°å†™å­—æ¯ï¼Œæ•°å­—,特殊字符 +3. 选择新增用户对系统中已存在的数æ®åº“的读写æƒé™ï¼Œéžå¿…填,默认情况下,新增用户对所有已存在的数æ®åº“无读写æƒé™ +4. æå†™å®ŒæˆåŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®ï¼Œå³å¯æ–°å¢žç”¨æˆ·ã€‚ + +### ç³»ç»Ÿä¿¡æ¯ + +ç‚¹å‡»â€œé›†ç¾¤â€æ ‡ç­¾åŽï¼Œå¯ä»¥æŸ¥çœ‹DNodes, MNodeså’ŒQNodes的状æ€ã€åˆ›å»ºæ—¶é—´ç­‰ä¿¡æ¯ï¼Œå¹¶å¯ä»¥å¯¹ä»¥ä¸ŠèŠ‚ç‚¹è¿›è¡Œæ–°å¢žå’Œåˆ é™¤æ“作。 + +### 许å¯è¯ç®¡ç† + +点击“许å¯è¯â€æ ‡ç­¾åŽï¼Œå¯ä»¥æŸ¥çœ‹ç³»ç»Ÿå’Œç³»ç»Ÿå’Œå„连接器的许å¯è¯ä¿¡æ¯ã€‚ +点击ä½äºŽâ€œè®¸å¯è¯â€æ ‡ç­¾é¡µå³ä¸Šè§’的“激活许å¯è¯â€æŒ‰é’®ï¼Œè¾“入“激活ç â€å’Œâ€œè¿žæŽ¥å™¨æ¿€æ´»ç â€åŽï¼Œç‚¹å‡»â€œç¡®å®šâ€æŒ‰é’®ï¼Œå³å¯æ¿€æ´»ï¼Œæ¿€æ´»ç è¯·è”ç³» TDengine 客户æˆåŠŸå›¢é˜ŸèŽ·å–。 + +## æ•°æ®è®¢é˜… + +本章节,将介ç»å¦‚何在 TDengine 集群中,创建主题,并将其分享给其他用户,以åŠå¦‚何查看一个主题的消费者信æ¯ã€‚ + +通过 Explorer, 您å¯ä»¥è½»æ¾åœ°å®Œæˆå¯¹æ•°æ®è®¢é˜…的管ç†ï¼Œä»Žè€Œæ›´å¥½åœ°åˆ©ç”¨ TDengine æä¾›çš„æ•°æ®è®¢é˜…能力。 +点击左侧导航æ ä¸­çš„“数æ®è®¢é˜…â€ï¼Œå³å¯è·³è½¬è‡³æ•°æ®è®¢é˜…é…置管ç†é¡µé¢ã€‚ +您å¯ä»¥é€šè¿‡ä»¥ä¸‹ä¸¤ç§æ–¹å¼åˆ›å»ºä¸»é¢˜ï¼šä½¿ç”¨å‘导和自定义 SQL 语å¥ã€‚通过自定义 SQL 创建主题时,您需è¦äº†è§£ TDengine æä¾›çš„æ•°æ®è®¢é˜… SQL 语å¥çš„语法,并ä¿è¯å…¶æ­£ç¡®æ€§ã€‚ + +注: 对于数æ®è®¢é˜…的详细说明,å¯å‚考官方文档中关于“数æ®è®¢é˜…â€ç« èŠ‚ï¼Œåˆ›å»ºæ•°æ®è®¢é˜…之å‰éœ€è¦å…ˆå‡†å¤‡æºæ•°æ®åº“ï¼ˆæˆ–æºæ•°æ®åº“包å«ç›¸åº”çš„è¶…çº§è¡¨æˆ–è€…è¡¨ï¼‰ï¼Œå…¶ä¸­æºæ•°æ®åº“需é…ç½®wal_retention_period > 0 。 + +åŒ…æ‹¬ä¸»é¢˜ï¼Œæ¶ˆè´¹è€…ï¼Œå…±äº«ä¸»é¢˜å’Œç¤ºä¾‹ä»£ç  + +### 创建主题 + +1. åœ¨â€œä¸»é¢˜â€æ ‡ç­¾é¡µï¼Œç‚¹å‡»â€œæ–°å¢žæ–°ä¸»é¢˜â€æŒ‰é’®ä»¥åŽï¼Œé€‰æ‹©å‘导窗格,然åŽè¾“入“主题åç§°â€ï¼› +2. 在“数æ®åº“â€ä¸‹æ‹‰åˆ—表中,选择相应的数æ®åº“ï¼› +3. åœ¨â€œç±»åž‹â€æ ‡ç­¾ä¸‹ï¼Œé€‰æ‹©â€œæ•°æ®åº“†或 “超级表†或 â€œå­æŸ¥è¯¢â€ï¼Œè¿™é‡Œä»¥é»˜è®¤å€¼â€œæ•°æ®åº“â€ä¸ºä¾‹ï¼› +4. ç„¶åŽç‚¹å‡»â€œåˆ›å»ºâ€ 按钮,å³å¯åˆ›å»ºå¯¹åº”的主题。 + +### 分享主题 + +1. åœ¨â€œå…±äº«ä¸»é¢˜â€æ ‡ç­¾é¡µï¼Œåœ¨â€œä¸»é¢˜â€œä¸‹æ‹‰åˆ—表中,选择将è¦åˆ†äº«çš„主题; +2. ç‚¹å‡»â€œæ·»åŠ å¯æ¶ˆè´¹è¯¥ä¸»é¢˜çš„ç”¨æˆ·â€æŒ‰é’®ï¼Œç„¶åŽåœ¨â€œç”¨æˆ·åâ€ä¸‹æ‹‰åˆ—表中选择相应的用户,然åŽç‚¹å‡»â€œæ–°å¢žâ€ï¼Œå³å¯å°†è¯¥ä¸»é¢˜åˆ†äº«ç»™æ­¤ç”¨æˆ·ã€‚ + + +### æŸ¥çœ‹æ¶ˆè´¹è€…ä¿¡æ¯ + +1. 通过执行下一节“示例代ç â€æ‰€è¿°çš„“完整实例â€ï¼Œå³å¯æ¶ˆè´¹å…±äº«ä¸»é¢˜ +2. åœ¨â€œæ¶ˆè´¹è€…â€æ ‡ç­¾é¡µï¼Œå¯æŸ¥çœ‹åˆ°æ¶ˆè´¹è€…çš„æœ‰å…³ä¿¡æ¯ + +### ç¤ºä¾‹ä»£ç  + +1. 在“示例代ç â€æ ‡ç­¾é¡µï¼Œåœ¨â€œä¸»é¢˜â€œä¸‹æ‹‰åˆ—表中,选择相应的主题; +2. é€‰æ‹©æ‚¨ç†Ÿæ‚‰çš„è¯­è¨€ï¼Œç„¶åŽæ‚¨å¯ä»¥é˜…读以åŠä½¿ç”¨è¿™éƒ¨åˆ†ç¤ºä¾‹ä»£ç ç”¨æ¥â€åˆ›å»ºæ¶ˆè´¹â€œï¼Œâ€è®¢é˜…主题“,通过执行 “完整实例â€ä¸­çš„程åºå³å¯æ¶ˆè´¹å…±äº«ä¸»é¢˜ + +## æµè®¡ç®— + +通过 Explorer, 您å¯ä»¥è½»æ¾åœ°å®Œæˆå¯¹æµçš„管ç†ï¼Œä»Žè€Œæ›´å¥½åœ°åˆ©ç”¨ TDengine æä¾›çš„æµè®¡ç®—èƒ½åŠ›ã€‚ +点击左侧导航æ ä¸­çš„“æµè®¡ç®—â€ï¼Œå³å¯è·³è½¬è‡³æµè®¡ç®—é…置管ç†é¡µé¢ã€‚ +您å¯ä»¥é€šè¿‡ä»¥ä¸‹ä¸¤ç§æ–¹å¼åˆ›å»ºæµï¼šæµè®¡ç®—å‘导和自定义 SQL 语å¥ã€‚当å‰ï¼Œé€šè¿‡æµè®¡ç®—å‘å¯¼åˆ›å»ºæµæ—¶ï¼Œæš‚䏿”¯æŒåˆ†ç»„功能。通过自定义 SQL åˆ›å»ºæµæ—¶ï¼Œæ‚¨éœ€è¦äº†è§£ TDengine æä¾›çš„æµè®¡ç®— SQL 语å¥çš„语法,并ä¿è¯å…¶æ­£ç¡®æ€§ã€‚ + +注: 对于æµè®¡ç®—的详细说明,å¯å‚考官方文档中关于“æµå¼è®¡ç®—â€ç« èŠ‚ï¼Œåˆ›å»ºæµè®¡ç®—之å‰éœ€è¦å…ˆå‡†å¤‡æºæ•°æ®åº“以åŠç›¸åº”的超级表或表ã€è¾“出的数æ®åº“。 + +### æµè®¡ç®—å‘导 + +1. 点击“创建æµè®¡ç®—â€æŒ‰é’®ä»¥åŽï¼Œé€‰æ‹©æµè®¡ç®—å‘导窗格,然åŽè¾“入“æµåç§°â€ï¼› +2. 在“输出â€éƒ¨åˆ†ï¼Œè¾“入相应的“数æ®åº“â€ï¼Œâ€œè¶…级表â€ä»¥åŠâ€œå­è¡¨å‰ç¼€â€ï¼› +3. 在“æºâ€éƒ¨åˆ†ï¼Œé€‰æ‹©ç›¸åº”的“数æ®åº“â€ï¼Œç„¶åŽæ ¹æ®å…·ä½“æƒ…å†µï¼Œé€‰æ‹©ä½¿ç”¨â€œè¶…çº§è¡¨â€æˆ–“表â€ï¼š + 1. 如果使用“超级表“,请从“超级表â€ä¸‹æ‹‰åˆ—表中选择相应的超级表, 并在“字段设置â€åŒºåŸŸï¼Œé€‰æ‹©ç›¸åº”的字段 + 2. 如果使用“表“,请从“表â€ä¸‹æ‹‰åˆ—表中选择相应的表, 并在“字段设置â€åŒºåŸŸï¼Œé€‰æ‹©ç›¸åº”的字段 +4. 对于窗å£è®¾ç½®ï¼Œæ ¹æ®éœ€è¦é€‰æ‹©â€SESSION“, "STATE"或"INTERVAL", å¹¶é…置相应的值; +5. å¯¹äºŽâ€æ‰§è¡Œâ€œéƒ¨åˆ†ï¼Œé€‰æ‹©ç›¸åº”çš„â€è§¦å‘器“类型,并设置“Watermarkâ€, "Ignore Expired", "DELETE_MARK", "FILL_HISTORY", "IGNORE UPDATE"ï¼› +6. ç„¶åŽç‚¹å‡»â€œåˆ›å»ºâ€ 按钮,å³å¯åˆ›å»ºå¯¹åº”çš„æµè®¡ç®—。 + +### 使用 SQL 语å¥å»ºæµ + +1. 点击“创建æµè®¡ç®—â€æŒ‰é’®ä»¥åŽï¼Œé€‰æ‹©æµè®¡ç®—SQL窗格,然åŽè¾“入类似如下的SQL语å¥(å引å·å†…ä¸ºæºæ•°æ®åº“以åŠç›¸åº”的超级表或表ã€è¾“出的数æ®åº“,请按您的环境更新å引å·å†…的内容) + +```shell +CREATE STREAM `test_stream` TRIGGER WINDOW_CLOSE IGNORE EXPIRED 1 INTO `db_name`.`stable1` SUBTABLE(CONCAT('table1',tbname)) AS SELECT count(*) FROM `test_db`.`stable_name` PARTITION BY tbname INTERVAL(1m) +``` +2. ç‚¹å‡»â€œåˆ›å»ºâ€æŒ‰é’®ï¼Œå³å¯åˆ›å»ºå¯¹åº”çš„æµè®¡ç®—。 \ No newline at end of file diff --git a/docs/zh/17-operation/09-storage.md b/docs/zh/17-operation/09-storage.md new file mode 100644 index 0000000000..f6cdb347b4 --- /dev/null +++ b/docs/zh/17-operation/09-storage.md @@ -0,0 +1,52 @@ +--- +title: 多级存储 +--- + +## 多级存储 + +说明:多级存储功能仅ä¼ä¸šç‰ˆæ”¯æŒã€‚ + +在默认é…置下,TDengine 会将所有数æ®ä¿å­˜åœ¨ /var/lib/taos 目录下,而且æ¯ä¸ª vnode çš„æ•°æ®æ–‡ä»¶ä¿å­˜åœ¨è¯¥ç›®å½•下的ä¸åŒç›®å½•。为扩大存储空间,尽é‡å‡å°‘文件读å–的瓶颈,æé«˜æ•°æ®åžå率 TDengine å¯é€šè¿‡é…ç½®ç³»ç»Ÿå‚æ•° dataDir è®©å¤šä¸ªæŒ‚è½½çš„ç¡¬ç›˜è¢«ç³»ç»ŸåŒæ—¶ä½¿ç”¨ã€‚ + +除此之外,TDengine 也æä¾›äº†æ•°æ®åˆ†çº§å­˜å‚¨çš„功能,将ä¸åŒæ—¶é—´æ®µçš„æ•°æ®å­˜å‚¨åœ¨æŒ‚载的ä¸åŒä»‹è´¨ä¸Šçš„目录里,从而实现ä¸åŒâ€œçƒ­åº¦â€çš„æ•°æ®å­˜å‚¨åœ¨ä¸åŒçš„å­˜å‚¨ä»‹è´¨ä¸Šï¼Œå……åˆ†åˆ©ç”¨å­˜å‚¨ï¼ŒèŠ‚çº¦æˆæœ¬ã€‚比如,最新采集的数æ®éœ€è¦ç»å¸¸è®¿é—®ï¼Œå¯¹ç¡¬ç›˜çš„è¯»å–æ€§èƒ½è¦æ±‚高,那么用户å¯ä»¥é…置将这些数æ®å­˜å‚¨åœ¨ SSD 盘上。超过一定期é™çš„æ•°æ®ï¼ŒæŸ¥è¯¢éœ€æ±‚釿²¡æœ‰é‚£ä¹ˆé«˜ï¼Œé‚£ä¹ˆå¯ä»¥å­˜å‚¨åœ¨ç›¸å¯¹ä¾¿å®œçš„ HDD 盘上。 + +å¤šçº§å­˜å‚¨æ”¯æŒ 3 级,æ¯çº§æœ€å¤šå¯é…ç½® 16 个挂载点。 + +TDengine 多级存储é…置方å¼å¦‚下(在é…置文件/etc/taos/taos.cfg 中): + +``` +dataDir [path] +``` + +- path: 挂载点的文件夹路径 +- level: 介质存储等级,å–值为 0,1,2。 + 0 级存储最新的数æ®ï¼Œ1 级存储次新的数æ®ï¼Œ2 级存储最è€çš„æ•°æ®ï¼Œçœç•¥é»˜è®¤ä¸º 0。 + å„çº§å­˜å‚¨ä¹‹é—´çš„æ•°æ®æµå‘:0 级存储 -> 1 级存储 -> 2 级存储。 + åŒä¸€å­˜å‚¨ç­‰çº§å¯æŒ‚载多个硬盘,åŒä¸€å­˜å‚¨ç­‰çº§ä¸Šçš„æ•°æ®æ–‡ä»¶åˆ†å¸ƒåœ¨è¯¥å­˜å‚¨ç­‰çº§çš„æ‰€æœ‰ç¡¬ç›˜ä¸Šã€‚ + 需è¦è¯´æ˜Žçš„æ˜¯ï¼Œæ•°æ®åœ¨ä¸åŒçº§åˆ«çš„存储介质上的移动,是由系统自动完æˆçš„,用户无需干预。 +- primary: 是å¦ä¸ºä¸»æŒ‚载点,0(å¦ï¼‰æˆ– 1(是),çœç•¥é»˜è®¤ä¸º 1。 + +在é…置中,åªå…许一个主挂载点的存在(level=0,primary=1),例如采用如下的é…置方å¼ï¼š + +``` +dataDir /mnt/data1 0 1 +dataDir /mnt/data2 0 0 +dataDir /mnt/data3 1 0 +dataDir /mnt/data4 1 0 +dataDir /mnt/data5 2 0 +dataDir /mnt/data6 2 0 +``` + +:::note + +1. 多级存储ä¸å…许跨级é…ç½®ï¼Œåˆæ³•çš„é…置方案有:仅 0 级,仅 0 级+ 1 çº§ï¼Œä»¥åŠ 0 级+ 1 级+ 2 级。而ä¸å…许åªé…ç½® level=0 å’Œ level=2,而ä¸é…ç½® level=1。 +2. ç¦æ­¢æ‰‹åŠ¨ç§»é™¤ä½¿ç”¨ä¸­çš„æŒ‚è½½ç›˜ï¼ŒæŒ‚è½½ç›˜ç›®å‰ä¸æ”¯æŒéžæœ¬åœ°çš„网络盘。 +3. 多级存储目å‰ä¸æ”¯æŒåˆ é™¤å·²ç»æŒ‚载的硬盘的功能。 + +::: + +## 0 级负载å‡è¡¡ + +åœ¨å¤šçº§å­˜å‚¨ä¸­ï¼Œæœ‰ä¸”åªæœ‰ä¸€ä¸ªä¸»æŒ‚载点,主挂载点承担了系统中最é‡è¦çš„元数æ®åœ¨åº§ï¼ŒåŒæ—¶å„个 vnode 的主目录å‡å­˜åœ¨äºŽå½“å‰ dnode 主挂载点上,从而导致该 dnode 的写入性能å—é™äºŽå•个ç£ç›˜çš„ IO åžå能力。 + +从 TDengine 3.1.0.0 开始,如果一个 dnode é…置了多个 0 级挂载点,我们将该 dnode 上所有 vnode 的主目录å‡è¡¡åˆ†å¸ƒåœ¨æ‰€æœ‰çš„ 0 级挂载点上,由这些 0 çº§æŒ‚è½½ç‚¹å…±åŒæ‰¿æ‹…写入负è·ã€‚在网络 I/O åŠå…¶å®ƒå¤„ç†èµ„æºä¸æˆä¸ºç“¶é¢ˆçš„æƒ…况下,通过优化集群é…ç½®ï¼Œæµ‹è¯•ç»“æžœè¯æ˜Žæ•´ä¸ªç³»ç»Ÿçš„写入能力和 0 级挂载点的数é‡å‘ˆçŽ°çº¿æ€§å…³ç³»ï¼Œå³éšç€ 0 级挂载点数é‡çš„增加,整个系统的写入能力也æˆå€å¢žåŠ ã€‚ diff --git a/docs/zh/18-data-transfer/01-taosX.md b/docs/zh/18-data-transfer/01-taosX.md new file mode 100644 index 0000000000..72d2cb2211 --- /dev/null +++ b/docs/zh/18-data-transfer/01-taosX.md @@ -0,0 +1,972 @@ +--- +title: æ•°æ®æŽ¥å…¥ã€åŒæ­¥å’Œå¤‡ä»½ +--- + +## 简介 + +为了能够方便地将å„ç§æ•°æ®æºä¸­çš„æ•°æ®å¯¼å…¥ TDengine 3.0,TDengine 3.0 ä¼ä¸šç‰ˆæä¾›äº†ä¸€ä¸ªå…¨æ–°çš„工具 taosX ç”¨äºŽå¸®åŠ©ç”¨æˆ·å¿«é€Ÿå°†å…¶å®ƒæ•°æ®æºä¸­çš„æ•°æ®ä¼ è¾“到 TDengine 中。 taosX å®šä¹‰äº†è‡ªå·±çš„é›†æˆæ¡†æž¶ï¼Œæ–¹ä¾¿æ‰©å±•æ–°çš„æ•°æ®æºã€‚ç›®å‰æ”¯æŒçš„æ•°æ®æºæœ‰ TDengine 自身(å³ä»Žä¸€ä¸ª TDengine 集群到å¦ä¸€ä¸ª TDengine 集群),Pi, OPC UAã€‚é™¤äº†æ•°æ®æŽ¥å…¥å¤–ï¼ŒtaosX è¿˜æ”¯æŒæ•°æ®å¤‡ä»½ã€æ•°æ®åŒæ­¥ã€æ•°æ®è¿ç§»ä»¥åŠæ•°æ®å¯¼å‡ºåŠŸèƒ½ã€‚ + +**欲体验 taosX çš„å„ç§æ•°æ®æŽ¥å…¥èƒ½åŠ›ï¼Œè¯·è”ç³» TDengine 市场或销售团队。** + +## ä½¿ç”¨å‰æ + +使用 taosX 需è¦å·²ç»éƒ¨ç½²å¥½ TDengine 中的 taosd å’Œ taosAdapter,具体细节请å‚考 [系统部署](../../deployment/deploy) + +**使用é™åˆ¶**:taosX åªèƒ½ç”¨äºŽä¼ä¸šç‰ˆæ•°æ®åº“æœåŠ¡ç«¯ã€‚ + +## 安装与é…ç½® + +安装 taosX 需è¦ä½¿ç”¨ç‹¬ç«‹çš„ taosX 安装包,其中除了 taosX ä¹‹å¤–ï¼Œè¿˜åŒ…å« Pi è¿žæŽ¥å™¨ï¼ˆé™ Windows), OPC 连接器, InfluxDB 连接器, MQTT 连接器,以åŠå¿…è¦çš„ Agent 组件,taosX + Agent + æŸä¸ªè¿žæŽ¥å™¨å¯ä»¥ç”¨äºŽå°†ç›¸åº”æ•°æ®æºçš„æ•°æ®åŒæ­¥åˆ° TDengine。taosX 安装包中还包å«äº† taos-explorer 这个å¯è§†åŒ–管ç†ç»„ä»¶ + +### Linux 安装 + +下载需è¦çš„ taosX 安装包,下文以安装包 `taosx-1.0.0-linux-x64.tar.gz` 为例展示如何安装: + +``` bash +# 在任æ„目录下解压文件 +tar -zxf taosx-1.0.0-linux-x64.tar.gz +cd taosx-1.0.0-linux-x64 + +# 安装 +sudo ./install.sh + +# éªŒè¯ +taosx -V +# taosx 1.0.0-494d280c (built linux-x86_64 2023-06-21 11:06:00 +08:00) +taosx-agent -V +# taosx-agent 1.0.0-494d280c (built linux-x86_64 2023-06-21 11:06:01 +08:00) + +# å¸è½½ +cd /usr/local/taosx +sudo ./uninstall.sh +``` + +**常è§é—®é¢˜:** + +1. 安装åŽç³»ç»Ÿä¸­å¢žåŠ äº†å“ªäº›æ–‡ä»¶ï¼Ÿ + * /usr/bin: taosx, taosx-agent, taos-explorer + * /usr/local/taosx/plugins: influxdb, mqtt, opc + * /etc/systemd/system:taosx.service, taosx-agent.service, taos-explorer.service + * /usr/local/taosx: uninstall.sh + * /etc/taox: agent.toml, explorer.toml + +2. taosx -V æç¤º "Command not found" 应该如何解决? + * 检验问题1,ä¿è¯æ‰€æœ‰çš„æ–‡ä»¶éƒ½è¢«å¤åˆ¶åˆ°å¯¹åº”的目录 + ``` bash + ls /usr/bin | grep taosx + ``` + +### Windows 安装 + +- 下载需è¦çš„ taosX 安装包,例如 taosx-1.0.0-Windows-x64-installer.exe,执行安装 +- å¯ä½¿ç”¨ uninstall_taosx.exe 进行å¸è½½ +- 命令行执行 ```sc start/stop taosx``` å¯åЍ/åœæ­¢ taosx æœåŠ¡ +- 命令行执行 ```sc start/stop taosx-agent``` å¯åЍ/åœæ­¢ taosx-agent æœåŠ¡ +- 命令行执行 ```sc start/stop taos-explorer``` å¯åЍ/åœæ­¢ taosx-agent æœåŠ¡ +- windows 默认安装在```C:\Program Files\taosX```,目录结构如下: +~~~ +├── bin +│   ├── taosx.exe +│   ├── taosx-srv.exe +│   ├── taosx-srv.xml +│   ├── taosx-agent.exe +│   ├── taosx-agent-srv.exe +│   ├── taosx-agent-srv.xml +│   ├── taos-explorer.exe +│   ├── taos-explorer-srv.exe +│   └── taos-explorer-srv.xml +├── plugins +│   ├── influxdb +│   │   └── taosx-inflxdb.jar +│   ├── mqtt +│   │   └── taosx-mqtt.exe +│   ├── opc +│   | └── taosx-opc.exe +│   ├── pi +│   | └── taosx-pi.exe +│   | └── taosx-pi-backfill.exe +│   | └── ... +└── config +│   ├── agent.toml +│   ├── explorer.toml +├── uninstall_taosx.exe +├── uninstall_taosx.dat +~~~ + +**è¿è¡Œæ¨¡å¼** + +taosX 是进行数æ®åŒæ­¥ä¸Žå¤åˆ¶çš„æ ¸å¿ƒç»„件,以下è¿è¡Œæ¨¡å¼æŒ‡ taosX çš„è¿è¡Œæ¨¡å¼ï¼Œå…¶å®ƒç»„ä»¶çš„è¿è¡Œæ¨¡å¼åœ¨ taosX çš„ä¸åŒè¿è¡Œæ¨¡å¼ä¸‹ä¸Žä¹‹é€‚é…。 + +## å‘½ä»¤è¡Œæ¨¡å¼ + +å¯ä»¥ç›´æŽ¥åœ¨å‘½ä»¤è¡Œä¸Šæ·»åŠ å¿…è¦çš„傿•°ç›´æŽ¥å¯åЍ taosX å³ä¸ºå‘½ä»¤è¡Œæ¨¡å¼è¿è¡Œã€‚å½“å‘½ä»¤è¡Œå‚æ•°æ‰€æŒ‡å®šçš„任务完æˆåŽ taosX ä¼šè‡ªåŠ¨åœæ­¢ã€‚taosX 在è¿è¡Œä¸­å¦‚æžœå‡ºçŽ°é”™è¯¯ä¹Ÿä¼šè‡ªåŠ¨åœæ­¢ã€‚也å¯ä»¥åœ¨ä»»æ„时刻使用 ctrl+c åœæ­¢ taosX çš„è¿è¡Œã€‚本节介ç»å¦‚何使用 taosX çš„å„ç§ä½¿ç”¨åœºæ™¯ä¸‹çš„命令行。 + +### å‘½ä»¤è¡Œå‚æ•°è¯´æ˜Ž + +**注æ„ï¼šéƒ¨åˆ†å‚æ•°æš‚无法通过 explorer设置ã€è§ï¼šå…¶ä»–傿•°è¯´æ˜Žã€‘,之åŽä¼šé€æ­¥å¼€æ”¾ï¼‰ ** + +命令行执行示例: + +```shell +taosx -f -t <其他傿•°> +``` + +以䏋傿•°è¯´æ˜ŽåŠç¤ºä¾‹ä¸­è‹¥æ— ç‰¹æ®Šè¯´æ˜Ž `` 的格å¼å‡ä¸ºå ä½ç¬¦ï¼Œä½¿ç”¨æ—¶éœ€è¦ä½¿ç”¨å®žé™…傿•°è¿›è¡Œæ›¿æ¢ã€‚ + +### DSN (Data Source Name) + +taosX 命令行模å¼ä½¿ç”¨ DSN æ¥è¡¨ç¤ºä¸€ä¸ªæ•°æ®æºï¼ˆæ¥æºæˆ–目的æºï¼‰ï¼Œå…¸åž‹çš„ DSN 如下: + +```bash +# url-like +[+]://[[:@]:][/][?=[&=]] +|------|------------|---|-----------|-----------|------|------|----------|-----------------------| +|driver| protocol | | username | password | host | port | object | params | + +// url 示例 +tmq+ws://root:taosdata@localhost:6030/db1?timeout=never +``` +[] 中的数æ®éƒ½ä¸ºå¯é€‰å‚数。 + +1. ä¸åŒçš„驱动 (driver) 拥有ä¸åŒçš„傿•°ã€‚driver 包å«å¦‚下选项: + +- taos:使用查询接å£ä»Ž TDengine èŽ·å–æ•°æ® +- tmq:å¯ç”¨æ•°æ®è®¢é˜…从 TDengine èŽ·å–æ•°æ® +- local:数æ®å¤‡ä»½æˆ–æ¢å¤ +- pi: å¯ç”¨ pi-connector从 pi æ•°æ®åº“ä¸­èŽ·å–æ•°æ® +- opc:å¯ç”¨ opc-connector 从 opc-server ä¸­èŽ·å–æ•°æ® +- mqtt: å¯ç”¨ mqtt-connector èŽ·å– mqtt-broker ä¸­çš„æ•°æ® +- kafka: å¯ç”¨ Kafka 连接器从 Kafka Topics 中订阅消æ¯å†™å…¥ +- influxdb: å¯ç”¨ influxdb 连接器从 InfluxDB èŽ·å–æ•°æ® +- csv:从 CSV æ–‡ä»¶è§£æžæ•°æ® + +2. +protocol 包å«å¦‚下选项: +- +ws: 当 driver å–值为 taos 或 tmq 时使用,表示使用 rest èŽ·å–æ•°æ®ã€‚ä¸ä½¿ç”¨ +ws åˆ™è¡¨ç¤ºä½¿ç”¨åŽŸç”Ÿè¿žæŽ¥èŽ·å–æ•°æ®ï¼Œæ­¤æ—¶éœ€è¦ taosx 所在的æœåŠ¡å™¨å®‰è£… taosc。 +- +ua: 当 driver å–值为 opc 时使用,表示采集的数æ®çš„ opc-server 为 opc-ua +- +da: 当 driver å–值为 opc 时使用,表示采集的数æ®çš„ opc-server 为 opc-da + +3. host:port è¡¨ç¤ºæ•°æ®æºçš„地å€å’Œç«¯å£ã€‚ +4. object è¡¨ç¤ºå…·ä½“çš„æ•°æ®æºï¼Œå¯ä»¥æ˜¯TDengine的数æ®åº“ã€è¶…级表ã€è¡¨ï¼Œä¹Ÿå¯ä»¥æ˜¯æœ¬åœ°å¤‡ä»½æ–‡ä»¶çš„路径,也å¯ä»¥æ˜¯å¯¹åº”æ•°æ®æºæœåŠ¡å™¨ä¸­çš„æ•°æ®åº“。 +5. username å’Œ password è¡¨ç¤ºè¯¥æ•°æ®æºçš„用户å和密ç ã€‚ +6. params 代表了 dsn çš„å‚æ•°ã€‚ + +### å…¶å®ƒå‚æ•°è¯´æ˜Ž + +1. parser 通过 --parser 或 -p 设置,设置 transform çš„ parser 生效。å¯ä»¥é€šè¿‡ Explorer 在如 CSV,MQTT,KAFKA æ•°æ®æºçš„任务é…置进行设置。 + + é…置示例: + + ```shell + --parser "{\"parse\":{\"ts\":{\"as\":\"timestamp(ms)\"},\"topic\":{\"as\":\"varchar\",\"alias\":\"t\"},\"partition\":{\"as\":\"int\",\"alias\":\"p\"},\"offset\":{\"as\":\"bigint\",\"alias\":\"o\"},\"key\":{\"as\":\"binary\",\"alias\":\"k\"},\"value\":{\"as\":\"binary\",\"alias\":\"v\"}},\"model\":[{\"name\":\"t_{t}\",\"using\":\"kafka_data\",\"tags\":[\"t\",\"p\"],\"columns\":[\"ts\",\"o\",\"k\",\"v\"]}]}" + + ``` + +2. transform 通过 --transform 或 -T 设置,é…置数æ®åŒæ­¥ï¼ˆä»…æ”¯æŒ 2.6 到 3.0 ä»¥åŠ 3.0 ä¹‹é—´åŒæ­¥ï¼‰è¿‡ç¨‹ä¸­å¯¹äºŽè¡¨ååŠè¡¨å­—段的一些æ“作。暂无法通过 Explorer 进行设置。é…置说明如下: + + ```shell + 1.AddTag,为表添加 TAG。设置示例:-T add-tag:=。 + 2.表é‡å‘½å: + 2.1 é‡å‘½å表é™å®š + 2.1.1 RenameTableï¼šå¯¹æ‰€æœ‰ç¬¦åˆæ¡ä»¶çš„表进行é‡å‘½å。 + 2.1.2 RenameChildTableï¼šå¯¹æ‰€æœ‰ç¬¦åˆæ¡ä»¶çš„å­è¡¨è¿›è¡Œé‡å‘½å。 + 2.1.3 RenameSuperTableï¼šå¯¹æ‰€æœ‰ç¬¦åˆæ¡ä»¶çš„超级表进行é‡å‘½å。 + 2.2 é‡å‘½åæ–¹å¼ + 2.2.1 Prefix:添加å‰ç¼€ã€‚ + 2.2.2 Suffix:添加åŽç¼€ã€‚ + 2.2.3 Templateï¼šæ¨¡æ¿æ–¹å¼ã€‚ + 2.2.4 ReplaceWithRegex:正则替æ¢ã€‚taosx 1.1.0 新增。 + é‡å‘½åé…置方å¼ï¼š + <表é™å®š>:<é‡å‘½åæ–¹å¼>:<é‡å‘½å值> + 使用示例: + 1.为所有表添加å‰ç¼€ + --transform rename-table:prefix: + 2.ä¸ºç¬¦åˆæ¡ä»¶çš„表替æ¢å‰ç¼€ï¼šprefix1 替æ¢ä¸º prefix2,以下示例中的 <> 为正则表达å¼çš„ä¸å†æ˜¯å ä½ç¬¦ã€‚ + -T rename-child-table:replace_with_regex:^prefix1(?)::prefix2_$old + + 示例说明:^prefix1(?) 为正则表达å¼ï¼Œè¯¥è¡¨è¾¾å¼ä¼šåŒ¹é…表å中包å«ä»¥ prefix1 开始的表åå¹¶å°†åŽç¼€éƒ¨åˆ†è®°å½•为 old,prefix2$old 则会使用 prefix2 与 old 进行替æ¢ã€‚注æ„:两部分使用关键字符 :: 进行分隔,所以需è¦ä¿è¯æ­£åˆ™è¡¨è¾¾å¼ä¸­ä¸èƒ½åŒ…å«è¯¥å­—符。 + è‹¥æœ‰æ›´å¤æ‚的替æ¢éœ€æ±‚请å‚考:https://docs.rs/regex/latest/regex/#example-replacement-with-named-capture-groups 或咨询 taosx å¼€å‘人员。 + ``` + +3. jobs æŒ‡å®šä»»åŠ¡å¹¶å‘æ•°ï¼Œä»…æ”¯æŒ tmq 任务。暂无法通过 Explorer 进行设置。通过 --jobs `` 或 -j `` 进行设置。 +4. -v 用于指定 taosx 的日志级别,-v 表示å¯ç”¨ info 级别日志,-vv 对应 debug,-vvv 对应 trace。 + + +### 从 TDengine 到 TDengine 的数æ®åŒæ­¥ + +#### TDengine 3.0 -> TDengine 3.0 + +在两个相åŒç‰ˆæœ¬ (都是 3.0.x.y)的 TDengine 集群之间将æºé›†ç¾¤ä¸­çš„å­˜é‡åŠå¢žé‡æ•°æ®åŒæ­¥åˆ°ç›®æ ‡é›†ç¾¤ä¸­ã€‚ + +命令行模å¼ä¸‹æ”¯æŒçš„傿•°å¦‚下: + +| 傿•°åç§° | 说明 | 默认值 | +|-----------|------------------------------------------------------------------|----------------------------| +| group.id | 订阅使用的分组ID | 若为空则使用 hash 生æˆä¸€ä¸ª | +| client.id | 订阅使用的客户端ID | taosx | +| timeout | ç›‘å¬æ•°æ®çš„超时时间,当设置为 never 表示 taosx ä¸ä¼šåœæ­¢æŒç»­ç›‘å¬ã€‚ | 500ms | +| offset | 从指定的 offset 开始订阅,格å¼ä¸º `:`,若有多个 vgroup 则用åŠè§’逗å·éš”å¼€ | 若为空则从 0 开始订阅 | +| token | 目标æºå‚数。 认è¯ä½¿ç”¨å‚数。 | æ—  | + +示例: +```shell +taosx run \ + -f 'tmq://root:taosdata@localhost:6030/db1?group.id=taosx1&client.id=taosx&timeout=never&offset=2:10' \ + -t 'taos://root:taosdata@another.com:6030/db2' +``` + + + +#### TDengine 2.6 -> TDengine 3.0 + +å°† 2.6 版本 TDengine 集群中的数æ®è¿ç§»åˆ° 3.0 版本 TDengine 集群。 + +#### å‘½ä»¤è¡Œå‚æ•° + +| 傿•°åç§° | 说明 | 默认值 | +|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------| +| libraryPath | 在 option 模å¼ä¸‹æŒ‡å®š taos 库路径 | æ—  | +| configDir | 指定 taos.cfg é…置文件路径 | æ—  | +| mode | æ•°æ®æºå‚数。 history è¡¨ç¤ºåŽ†å²æ•°æ®ã€‚ realtime è¡¨ç¤ºå®žæ—¶åŒæ­¥ã€‚ all 表示以上两ç§ã€‚ | history | +| restro | æ•°æ®æºå‚数。 åœ¨åŒæ­¥å®žæ—¶æ•°æ®å‰å›žæº¯æŒ‡å®šæ—¶é—´é•¿åº¦çš„æ•°æ®è¿›è¡ŒåŒæ­¥ã€‚ restro=10m 表示回溯最近 10 分钟的数æ®ä»¥åŽï¼Œå¯åŠ¨å®žæ—¶åŒæ­¥ã€‚ | æ—  | +| interval | æ•°æ®æºå‚数。 轮询间隔 ,mode=realtime&interval=5s 指定轮询间隔为 5s | æ—  | +| excursion | æ•°æ®æºå‚数。 å…è®¸ä¸€æ®µæ—¶é—´çš„ä¹±åºæ•°æ® | 500ms | +| stables | æ•°æ®æºå‚数。 ä»…åŒæ­¥æŒ‡å®šè¶…级表的数æ®ï¼Œå¤šä¸ªè¶…级表åç”¨è‹±æ–‡é€—å· ,分隔 | æ—  | +| tables | æ•°æ®æºå‚数。 ä»…åŒæ­¥æŒ‡å®šå­è¡¨çš„æ•°æ®ï¼Œè¡¨åæ ¼å¼ä¸º {stable}.{table} 或 {table},多个表åç”¨è‹±æ–‡é€—å· , åˆ†éš”ï¼Œæ”¯æŒ @filepath 的方å¼è¾“入一个文件,æ¯è¡Œè§†ä¸ºä¸€ä¸ªè¡¨å,如 tables=@./tables.txt 表示从 ./tables.txt ä¸­æŒ‰è¡Œè¯»å–æ¯ä¸ªè¡¨å,空行将被忽略。 | æ—  | +| select-from-stable | æ•°æ®æºå‚数。 ä»Žè¶…çº§è¡¨èŽ·å– select {columns} from stable where tbname in ({tbnames}) ï¼Œè¿™ç§æƒ…况 tables 使用 {stable}.{table} æ•°æ®æ ¼å¼ï¼Œå¦‚ meters.d0 表示 meters 超级表下é¢çš„ d0 å­è¡¨ã€‚ | 默认使用 select \* from table èŽ·å–æ•°æ® | +| assert | 目标æºå‚数。 taos:///db1?assert 将检测数æ®åº“是å¦å­˜åœ¨ï¼Œå¦‚ä¸å­˜åœ¨ï¼Œå°†è‡ªåŠ¨åˆ›å»ºç›®æ ‡æ•°æ®åº“。 | 默认ä¸è‡ªåŠ¨åˆ›å»ºåº“ã€‚ | +| force-stmt | 目标æºå‚数。 当 TDengine 版本大于 3.0 时,ä»ç„¶ä½¿ç”¨ STMT æ–¹å¼å†™å…¥ã€‚ | 默认为 raw block å†™å…¥æ–¹å¼ | +| batch-size | 目标æºå‚数。 设置 STMT 写入模å¼ä¸‹çš„æœ€å¤§æ‰¹æ¬¡æ’å…¥æ¡æ•°ã€‚ | | +| interval | 目标æºå‚数。 æ¯æ‰¹æ¬¡å†™å…¥åŽçš„休眠时间。 | æ—  | +| max-sql-length | 目标æºå‚数。 用于建表的 SQL 最大长度,å•ä½ä¸º bytes。 | 默认 800_000 字节。 | +| failes-to | 目标æºå‚数。 æ·»åŠ æ­¤å‚æ•°ï¼Œå€¼ä¸ºæ–‡ä»¶è·¯å¾„,将写入错误的表åŠå…¶é”™è¯¯åŽŸå› å†™å…¥è¯¥æ–‡ä»¶ï¼Œæ­£å¸¸æ‰§è¡Œå…¶ä»–è¡¨çš„åŒæ­¥ä»»åŠ¡ã€‚ | 默认写入错误立å³é€€å‡ºã€‚ | +| timeout-per-table | 目标æºå‚数。 为å­è¡¨æˆ–æ™®é€šè¡¨åŒæ­¥ä»»åŠ¡æ·»åŠ è¶…æ—¶ã€‚ | æ—  | +| update-tags | 目标æºå‚数。 检查å­è¡¨å­˜åœ¨ä¸Žå¦ï¼Œä¸å­˜åœ¨æ—¶æ­£å¸¸å»ºè¡¨ï¼Œå­˜åœ¨æ—¶æ£€æŸ¥æ ‡ç­¾å€¼æ˜¯å¦ä¸€è‡´ï¼Œä¸ä¸€è‡´åˆ™æ›´æ–°ã€‚ | æ—  | + +#### 示例 + +1.ä½¿ç”¨åŽŸç”Ÿè¿žæŽ¥åŒæ­¥æ•°æ® + +```shell +taosx run \ + -f 'taos://td1:6030/db1?libraryPath=./libtaos.so.2.6.0.30&mode=all' \ + -t 'taos://td2:6030/db2?libraryPath=./libtaos.so.3.0.1.8&assert \ + -v +``` + +2.使用 WebSocket åŒæ­¥æ•°æ®è¶…级表 stable1 å’Œ stable2 çš„æ•°æ® + +```shell +taosx run \ + -f 'taos+ws://:@td1:6041/db1?stables=stable1,stable2' \ + -t 'taos+wss://td2:6041/db2?assert&token= \ + -v +``` + +### 从 TDengine å¤‡ä»½æ•°æ®æ–‡ä»¶åˆ°æœ¬åœ° + +示例: +```shell +taosx run -f 'tmq://root:taosdata@td1:6030/db1' -t 'local:/path_directory/' + +``` +以上示例执行的结果åŠå‚数说明: + +将集群 td1 中的数æ®åº“ db1 的所有数æ®ï¼Œå¤‡ä»½åˆ° taosx 所在设备的 /path_directory 路径下。 + +æ•°æ®æº(-f 傿•°çš„ DSN)çš„ object 支æŒé…置为 æ•°æ®åº“级(dbname)ã€è¶…级表级(dbname.stablename)ã€å­è¡¨/普通表级(dbname.tablename),对应备份数æ®çš„级别数æ®åº“级ã€è¶…级表级ã€å­è¡¨/普通表级 + + +### ä»Žæœ¬åœ°æ•°æ®æ–‡ä»¶æ¢å¤åˆ° TDengine + +#### 示例 +```shell +taosx run -f 'local:/path_directory/' -t 'taos://root:taosdata@td2:6030/db1?assert' +``` + +以上示例执行的结果: + +å°† taosx 所在设备 /path_directory è·¯å¾„ä¸‹å·²å¤‡ä»½çš„æ•°æ®æ–‡ä»¶ï¼Œæ¢å¤åˆ°é›†ç¾¤ td2 的数æ®åº“ db1 中,如果 db1 ä¸å­˜åœ¨ï¼Œåˆ™è‡ªåŠ¨å»ºåº“ã€‚ + +目标æº(-t 傿•°çš„ DSN)中的 object 支æŒé…置为数æ®åº“(dbname)ã€è¶…级表(dbname.stablename)ã€å­è¡¨/普通表(dbname.tablename),对应备份数æ®çš„级别数æ®åº“级ã€è¶…级表级ã€å­è¡¨/æ™®é€šè¡¨çº§ï¼Œå‰ææ˜¯å¤‡ä»½çš„æ•°æ®æ–‡ä»¶ä¹Ÿæ˜¯å¯¹åº”的数æ®åº“级ã€è¶…级表级ã€å­è¡¨/普通表级数æ®ã€‚ + + +#### 常è§é”™è¯¯æŽ’查 + +(1) 如果使用原生连接,任务å¯åŠ¨å¤±è´¥å¹¶æŠ¥ä»¥ä¸‹é”™è¯¯ï¼š + +```text +Error: tmq to td task exec error + +Caused by: + [0x000B] Unable to establish connection +``` +äº§ç”ŸåŽŸå› æ˜¯ä¸Žæ•°æ®æºçš„端å£é“¾æŽ¥å¼‚å¸¸ï¼Œéœ€æ£€æŸ¥æ•°æ®æº FQDN 是å¦è”通åŠç«¯å£ 6030 是å¦å¯æ­£å¸¸è®¿é—®ã€‚ + +(2) 如果使用 WebSocket 连接,任务å¯åŠ¨å¤±è´¥å¹¶æŠ¥ä»¥ä¸‹é”™è¯¯ï¼š + +```text +Error: tmq to td task exec error + +Caused by: + 0: WebSocket internal error: IO error: failed to lookup address information: Temporary failure in name resolution + 1: IO error: failed to lookup address information: Temporary failure in name resolution + 2: failed to lookup address information: Temporary failure in name resolution +``` + +使用 WebSocket 连接时å¯èƒ½é‡åˆ°å¤šç§é”™è¯¯ç±»åž‹ï¼Œé”™è¯¯ä¿¡æ¯å¯ä»¥åœ¨ â€Caused by“ åŽæŸ¥çœ‹ï¼Œä»¥ä¸‹æ˜¯å‡ ç§å¯èƒ½çš„错误: + +- "Temporary failure in name resolution": DNS è§£æžé”™è¯¯ï¼Œæ£€æŸ¥ IP 或 FQDN 是å¦èƒ½å¤Ÿæ­£å¸¸è®¿é—®ã€‚ +- "IO error: Connection refused (os error 111)": 端å£è®¿é—®å¤±è´¥ï¼Œæ£€æŸ¥ç«¯å£æ˜¯å¦é…置正确或是å¦å·²å¼€å¯å’Œå¯è®¿é—®ã€‚ +- "IO error: received corrupt message": 消æ¯è§£æžå¤±è´¥ï¼Œå¯èƒ½æ˜¯ä½¿ç”¨äº† wss æ–¹å¼å¯ç”¨äº† SSL,但æºç«¯å£ä¸æ”¯æŒã€‚ +- "HTTP error: *": å¯èƒ½è¿žæŽ¥åˆ°é”™è¯¯çš„ taosAdapter ç«¯å£æˆ– LSB/Nginx/Proxy é…置错误。 +- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为é…置的端å£ä¸æ­£ç¡®ã€‚ + +(3) 如果任务å¯åŠ¨å¤±è´¥å¹¶æŠ¥ä»¥ä¸‹é”™è¯¯ï¼š + +```text +Error: tmq to td task exec error + +Caused by: + [0x038C] WAL retention period is zero +``` + +是由于æºç«¯æ•°æ®åº“ WAL é…置错误,无法订阅。 + +解决方å¼ï¼š +ä¿®æ”¹æ•°æ® WAL é…置: + +```sql +alter database test wal_retention_period 3600; +``` + +### 从 OPC-UA åŒæ­¥æ•°æ®åˆ° TDengine + +#### é…ç½®å‚æ•° + +| 傿•°åç§° | 类型 | æè¿° | +|-----------------|--------|-----------------------------------------------------------------------------| +| interval | int | 采集间隔(å•ä½ï¼šç§’),默认为1ç§’ | +| concurrent | int | 采集噍并呿•°ï¼Œé»˜è®¤ä¸º1 | +| batch_size | int | é‡‡é›†å™¨ä¸ŠæŠ¥çš„æ‰¹æ¬¡ç‚¹ä½æ•°ï¼Œé»˜è®¤ä¸º100 | +| batch_timeout | int | 采集器上报的超时时间(å•ä½ï¼šç§’),默认为20ç§’ | +| connect_timeout | int | 连接的超时时间(å•ä½ï¼šç§’),默认为10ç§’ | +| request_timeout | int | 请求的超时时间(å•ä½ï¼šç§’),默认为10ç§’ | +| security_policy | string | OPC-UA连接安全策略(å¯é…置为None/Basic128Rsa15/Basic256/Basic256Sha256) | +| security_mode | string | OPC-UA连接模å¼ï¼ˆå¯é…置为None/Sign/SignAndEncrypt) | +| certificate | string | cert.pemçš„è·¯å¾„ã€‚å½“å®‰å…¨æ¨¡å¼æˆ–ç­–ç•¥ä¸æ˜¯â€æ— â€æ—¶ç”Ÿæ•ˆ | +| private_key | string | key.pem的路径。 å½“å®‰å…¨æ¨¡å¼æˆ–ç­–ç•¥ä¸æ˜¯â€æ— â€æ—¶ç”Ÿæ•ˆ | +| csv_config_file | string | åŒ…å« OPC UA 的点ä½é…置和表é…置。与é…ç½® csv_config_file é…置互斥,csv_config_file 优先生效| +| ua.nodes | string | OPC-UA 测点的 NodeID。和 opc_table_config é…置结åˆä½¿ç”¨ï¼Œä¸¤è€…需è¦åŒæ—¶é…置。与é…ç½® csv_config_file é…置互斥,csv_config_file 优先生效。é…置格å¼ä¸º ::,code 用于建å­è¡¨ã€‚| +| opc_table_config | string | OPCUA å•列模å¼è¡¨é…置。需è¦ä¸Ž ua.nodes é…åˆä½¿ç”¨ã€‚| +| debug | bool | å¯ç”¨ OPC 连接器的 debug 日志。默认为 false。| +| enable | bool | 原始数æ®å­˜å‚¨ã€‚默认为 false| +| path | string | 原始数æ®å­˜å‚¨è·¯å¾„。enable 为 true æ—¶å¿…é¡»é…置。| +| keep | int | 原始数æ®ä¿å­˜å¤©æ•°ã€‚enable 为 true æ—¶å¿…é¡»é…置。| + +补充: +1. opc_table_config 说明: + +```json +{ + "stable_prefix": "meters", // 超级表å‰ç¼€ + "column_configs": + [ + { + "column_name": "received_time", // 存储接收时间 + "column_type": "timestamp", + "column_alias": "ts", // 接收时间建表列用列å为 ts + "is_primary_key": true // 接收时间时间戳作为主键 + }, + { + "column_name": "original_time", + "column_type": "timestamp", + "column_alias": "ts_2", + "is_primary_key": false + }, + { + "column_name": "value", // æ•°æ®åˆ— + "column_alias": "valueaa", // æ•°æ®åˆ—别å + "is_primary_key": false + }, + { + "column_name": "quality", // è´¨é‡ä½åˆ— + "column_type": "int", + "column_alias": "quality11", // è´¨é‡ä½åˆ—别å + "is_primary_key": false + } + ] +} +``` + +#### 示例 + +1. 使用 ua.nodes å’Œ opc_table_config çš„é…置示例: +采集 nodeid 为 ns=2;i=2 å’Œ ns=2;i=3 的点ä½ï¼Œå°†å…¶å†™å…¥åˆ°é›†ç¾¤ tdengine çš„ opc 库中超级表å‰ç¼€ä¸º meters,如果 ns=2;i=2 的点ä½ç±»åž‹ä¸º float 则会创建 meters_float 的超级表,超级表使用 opc 接收的数æ®ä½œä¸ºæ—¶é—´æˆ³ç´¢å¼•列,并且ä¿ç•™åŽŸå§‹æ—¶é—´æˆ³åˆ—ï¼ŒåŽŸå§‹æ—¶é—´æˆ³åˆ—å为 ts_2,æ•°æ®åˆ—存储为 valueaaï¼ŒåŒæ—¶å­˜å‚¨è´¨é‡æ•°æ®åˆ° quality11 列。 + +```shell +taosx run \ + -f "opcua://uauser:uapass@localhost:4840?ua.nodes=ns=2;i=2::DSF1312,ns=2;i=3::DSF1313&opc_table_config={\"stable_prefix\": \"meters\", \"column_configs\": [{\"column_name\": \"received_time\", \"column_type\": \"timestamp\", \"column_alias\": \"ts\", \"is_primary_key\": true }, {\"column_name\": \"original_time\", \"column_type\": \"timestamp\", \"column_alias\": \"ts_2\", \"is_primary_key\": false }, {\"column_name\": \"value\", \"column_alias\": \"valueaa\", \"is_primary_key\": false }, {\"column_name\": \"quality\", \"column_type\": \"int\", \"column_alias\": \"quality11\", \"is_primary_key\": false } ] }" \ + -t "taos://tdengine:6030/opc" + + + +``` + +2. 使用 CSV é…置文件 + +```shell +taosx run -f "opcua://?csv_config_file=@" -t "taos+ws://tdengine:6041/opc" +``` + +#### CSV é…ç½®æ–‡ä»¶æ¨¡æ¿ + + +### 从 OPC-DA åŒæ­¥æ•°æ®åˆ° TDengine (Windows) + +#### é…ç½®å‚æ•° + +| 傿•°åç§° | 类型 | æè¿° | +|-----------------|--------|-----------------------------------------------------------------------------| +| interval | int | 采集间隔(å•ä½ï¼šç§’),默认为1ç§’ | +| concurrent | int | 采集噍并呿•°ï¼Œé»˜è®¤ä¸º1 | +| batch_size | int | é‡‡é›†å™¨ä¸ŠæŠ¥çš„æ‰¹æ¬¡ç‚¹ä½æ•°ï¼Œé»˜è®¤ä¸º100 | +| batch_timeout | int | 采集器上报的超时时间(å•ä½ï¼šç§’),默认为20ç§’ | +| connect_timeout | int | 连接的超时时间(å•ä½ï¼šç§’),默认为10ç§’ | +| request_timeout | int | 请求的超时时间(å•ä½ï¼šç§’),默认为10ç§’ | +| csv_config_file | string | åŒ…å« OPC UA 的点ä½é…置和表é…置。与 ua.nodes 两者之间需è¦é…置一个。CSV çš„é…置模版å‚考:OPC 需求汇总åŠå®ŒæˆçŽ°çŠ¶ | +| da.tags | string | OPC-UA 测点的 NodeID。和 opc_table_config é…置结åˆä½¿ç”¨ï¼Œä¸¤è€…需è¦åŒæ—¶é…置。与é…ç½® csv_config_file é…置互斥,csv_config_file 优先生效。| +| opc_table_config | string | OPCUA å•列模å¼è¡¨é…置。需è¦ä¸Ž da.tags é…åˆä½¿ç”¨| +| debug | bool | å¯ç”¨ OPC 连接器的 debug 日志。默认为 false。| +| enable | bool | 原始数æ®å­˜å‚¨ã€‚默认为 false| +| path | string | 原始数æ®å­˜å‚¨è·¯å¾„。enable 为 true æ—¶å¿…é¡»é…置。| +| keep | int | 原始数æ®ä¿å­˜å¤©æ•°ã€‚enable 为 true æ—¶å¿…é¡»é…置。| + +#### 应用示例 + +```shell +taosx run \ + -f "opc+da://Matrikon.OPC.Simulation.1?nodes=localhost&da.tags=Random.Real8::tb3::c1::int" + -t "taos://tdengine:6030/opc" +``` + +以上示例的执行结果: + +采集 Matrikon.OPC.Simulation.1 æœåŠ¡å™¨ä¸Š OPC DA 中 da.tags 为 Random.Real8的数æ®ï¼Œæ•°æ®ç±»åž‹ä¸ºint,对应在 TDengine 中以表å为 tb3 ,列å为c1,列类型为 int åž‹ schema æ¥åˆ›å»ºè¡¨ï¼ˆå¦‚果对应表已存在,则直接采集数æ®å¹¶å†™å…¥ï¼‰ã€‚ + +#### 常è§é”™è¯¯æŽ’查 + +(1) 如果使用原生连接,任务å¯åŠ¨å¤±è´¥å¹¶æ‰“å°å¦‚下错误: +```text +Error: tmq to td task exec error + +Caused by: + 0: Error occurred while creating a new object: [0x000B] Unable to establish connection +``` +解决方å¼ï¼š + +检查目标端 TDengine çš„ FQDN 是å¦è”通åŠç«¯å£ 6030 是å¦å¯æ­£å¸¸è®¿é—®ã€‚ + +(2) 如果使用 WebSocket 连接任务å¯åŠ¨å¤±è´¥å¹¶æ‰“å°å¦‚下错误:: + +```text +Error: tmq to td task exec error + +Caused by: + 0: WebSocket internal error: IO error: failed to lookup address information: Temporary failure in name resolution + 1: IO error: failed to lookup address information: Temporary failure in name resolution + 2: failed to lookup address information: Temporary failure in name resolution +``` + +使用 WebSocket 连接时å¯èƒ½é‡åˆ°å¤šç§é”™è¯¯ç±»åž‹ï¼Œé”™è¯¯ä¿¡æ¯å¯ä»¥åœ¨ â€Caused by“ åŽæŸ¥çœ‹ï¼Œä»¥ä¸‹æ˜¯å‡ ç§å¯èƒ½çš„错误: + +- "Temporary failure in name resolution": DNS è§£æžé”™è¯¯ï¼Œæ£€æŸ¥ç›®æ ‡ç«¯ TDengineçš„ IP 或 FQDN 是å¦èƒ½å¤Ÿæ­£å¸¸è®¿é—®ã€‚ +- "IO error: Connection refused (os error 111)": 端å£è®¿é—®å¤±è´¥ï¼Œæ£€æŸ¥ç›®æ ‡ç«¯å£æ˜¯å¦é…置正确或是å¦å·²å¼€å¯å’Œå¯è®¿é—®ï¼ˆé€šå¸¸ä¸º6041端å£ï¼‰ã€‚ +- "HTTP error: *": å¯èƒ½è¿žæŽ¥åˆ°é”™è¯¯çš„ taosAdapter ç«¯å£æˆ– LSB/Nginx/Proxy é…置错误。 +- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为é…置的端å£ä¸æ­£ç¡®ã€‚ + +### 从 PI åŒæ­¥æ•°æ®åˆ° TDengine (Windows) + +#### PI DSN é…ç½® + +PI DSN 的完整é…置如下: + +```shell +pi://[:@]PIServerName/AFDatabaseName?[TemplateForPIPoint][&TemplateForAFElement][&PointList][&][&][&UpdateInterval] +``` + +在 taosX CLI è¿è¡Œæ—¶æ”¯æŒçš„傿•°å¦‚下,其中 TemplateForPIPointã€TemplateForAFElementã€PointList ä¸‰ä¸ªå‚æ•°è‡³å°‘é…置一项: +- PISystemName:选填,连接é…ç½® PI 系统æœåŠ¡å,默认值与 PIServerName 一致 +- MaxWaitLenï¼šé€‰å¡«ï¼Œæ•°æ®æœ€å¤§ç¼“å†²æ¡æ•°ï¼Œé»˜è®¤å€¼ä¸º 1000 ,有效å–值范围为 [1,10000] +- UpdateInterval:选填,PI System å–æ•°æ®é¢‘率,默认值为 10000(毫秒:ms),有效å–值范围为 [10,600000] +- TemplateForPIPoint:选填,使用 PI Point 模å¼å°†æ¨¡æ¿æŒ‰ç…§ element çš„æ¯ä¸ª Arrtribution 作为å­è¡¨å¯¼å…¥åˆ° TDengine +- TemplateForAFElement:选填,使用 AF Point 模å¼å°†æ¨¡æ¿æŒ‰ç…§ element çš„ Attribution 集åˆä½œä¸ºä¸€ä¸ªå­è¡¨å¯¼å…¥åˆ° TDengine +- PointList:选填,使用 PointList 模å¼å°†æŒ‡å®šcsv文件中æè¿°çš„点ä½ä¿¡æ¯åœ¨ PI æ•°æ®åº“中的数æ®å¯¼å…¥åˆ° TDengine + + +#### 应用示例 + +å°†ä½äºŽæœåС噍 WIN-2OA23UM12TN 中的 PI æ•°æ®åº“ Met1ï¼Œæ¨¡æ¿ template1ã€template2é…置为 TemplateForPIPoint模å¼ï¼Œæ¨¡æ¿ template3ã€template4 é…置为 TemplateForAFElement 模å¼ï¼ŒæœåС噍 /home/ è·¯å¾„ä¸‹çš„ç‚¹ä½æ–‡ä»¶ points.csv é…置为 PointList 模å¼ï¼Œè¿žæŽ¥é…ç½® PI 系统æœåŠ¡å为 PIï¼Œæ•°æ®æœ€å¤§ç¼“å†²æ¡æ•°ä¸º1000,PI System å–æ•°æ®é¢‘率为10000ms,将该库中的数æ®åŒæ­¥åˆ° æœåС噍 tdengine çš„ pi 库中。完整的示例如下: + +```shell +taosx run \ + -f "pi://WIN-2OA23UM12TN/Met1?TemplateForPIPoint=template1,template2&TemplateForAFElement=template3,template4" \ + -t "taos://tdengine:6030/pi" +``` + + +#### 常è§é”™è¯¯æŽ’查 + +(1) 如果使用原生连接,任务å¯åŠ¨å¤±è´¥å¹¶æ‰“å°å¦‚下错误: +```text +Error: tmq to td task exec error + +Caused by: + 0: Error occurred while creating a new object: [0x000B] Unable to establish connection +``` +解决方å¼ï¼š + +检查目标端 TDengine çš„ FQDN 是å¦è”通åŠç«¯å£ 6030 是å¦å¯æ­£å¸¸è®¿é—®ã€‚ + +(2) 如果使用 WebSocket 连接任务å¯åŠ¨å¤±è´¥å¹¶æ‰“å°å¦‚下错误:: + +```text +Error: tmq to td task exec error + +Caused by: + 0: WebSocket internal error: IO error: failed to lookup address information: Temporary failure in name resolution + 1: IO error: failed to lookup address information: Temporary failure in name resolution + 2: failed to lookup address information: Temporary failure in name resolution +``` + +使用 WebSocket 连接时å¯èƒ½é‡åˆ°å¤šç§é”™è¯¯ç±»åž‹ï¼Œé”™è¯¯ä¿¡æ¯å¯ä»¥åœ¨ â€Caused by“ åŽæŸ¥çœ‹ï¼Œä»¥ä¸‹æ˜¯å‡ ç§å¯èƒ½çš„错误: + +- "Temporary failure in name resolution": DNS è§£æžé”™è¯¯ï¼Œæ£€æŸ¥ç›®æ ‡ç«¯ TDengineçš„ IP 或 FQDN 是å¦èƒ½å¤Ÿæ­£å¸¸è®¿é—®ã€‚ +- "IO error: Connection refused (os error 111)": 端å£è®¿é—®å¤±è´¥ï¼Œæ£€æŸ¥ç›®æ ‡ç«¯å£æ˜¯å¦é…置正确或是å¦å·²å¼€å¯å’Œå¯è®¿é—®ï¼ˆé€šå¸¸ä¸º6041端å£ï¼‰ã€‚ +- "HTTP error: *": å¯èƒ½è¿žæŽ¥åˆ°é”™è¯¯çš„ taosAdapter ç«¯å£æˆ– LSB/Nginx/Proxy é…置错误。 +- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为é…置的端å£ä¸æ­£ç¡®ã€‚ + + +### 从 InfluxDB åŒæ­¥æ•°æ®åˆ° TDengine + +#### å‘½ä»¤è¡Œå‚æ•° + +将数æ®ä»Ž InfluxDB åŒæ­¥è‡³ TDengine 的命令,如下所示: + +```bash +taosx run --from "" --to "" +``` + +其中,InfluxDB DSN ç¬¦åˆ DSN çš„é€šç”¨è§„åˆ™ï¼Œè¿™é‡Œä»…å¯¹å…¶ç‰¹æœ‰çš„å‚æ•°è¿›è¡Œè¯´æ˜Žï¼š +- version: 必填,InfluxDB 的版本,主è¦ç”¨äºŽåŒºåˆ† 1.x 与 2.x 两个版本,二者使用ä¸åŒçš„认è¯å‚æ•°ï¼› +- version = 1.x + - username: 必填,InfluxDB ç”¨æˆ·ï¼Œè¯¥ç”¨æˆ·è‡³å°‘åœ¨è¯¥ç»„ç»‡ä¸­æ‹¥æœ‰è¯»å–æƒé™ï¼› + - password: 必填,InfluxDB 用户的登陆密ç ï¼› +- version = 2.x + - orgId: 必填,InfluxDB 中的 Orgnization IDï¼› + - token: 必填,InfluxDB 中生æˆçš„ API token, 这个 token è‡³å°‘è¦æ‹¥æœ‰ä»¥ä¸Š Bucket çš„ Read æƒé™ï¼› +- bucket: 必填,InfluxDB 中的 Bucket å称,一次åªèƒ½åŒæ­¥ä¸€ä¸ª Bucketï¼› +- measurements: éžå¿…填,å¯ä»¥æŒ‡å®šéœ€è¦åŒæ­¥çš„多个 Measurements(英文逗å·åˆ†å‰²ï¼‰ï¼ŒæœªæŒ‡å®šåˆ™åŒæ­¥å…¨éƒ¨ï¼› +- beginTime: 必填,格å¼ä¸ºï¼šYYYY-MM-DD'T'HH:MM:SS'Z', 时区采用 UTC 时区,例如:2023-06-01T00:00:00+0800, å³åŒ—京时间2023-06-01 00:00:00(东八区时间); +- endTime: éžå¿…填,å¯ä»¥ä¸æŒ‡å®šè¯¥å­—段或值为空,格å¼ä¸ŽbeginTime相åŒï¼›å¦‚果未指定,æäº¤ä»»åŠ¡åŽï¼Œå°†æŒç»­è¿›è¡Œæ•°æ®åŒæ­¥ï¼› +- readWindow: éžå¿…填,å¯ä»¥ä¸æŒ‡å®šè¯¥å­—段或值为空,å¯é€‰é¡¹ä¸ºDã€Hã€Mï¼ˆå¤©ã€æ—¶ã€åˆ†ï¼‰ï¼›å¦‚果未指定,则默认按 M 拆分读å–窗å£ã€‚ + +#### 示例 + +å°†ä½äºŽ 192.168.1.10 çš„ InfluxDB 中, Bucket å称为 test_bucket, 从UTCæ—¶é—´2023å¹´06月01æ—¥00æ—¶00分00秒开始的数æ®ï¼Œé€šè¿‡è¿è¡Œåœ¨ 192.168.1.20 上的 taoskeeper, åŒæ­¥è‡³ TDengine çš„ test_db æ•°æ®åº“中,完整的命令如下所示: +```bash +# version = 1.x +taosx run \ + --from "influxdb+http://192.168.1.10:8086/?version=1.7&username=test&password=123456&bucket=test_bucket&measurements=&beginTime=2023-06-01T00:00:00+0800&readWindow=M" \ + --to "taos+http://192.168.1.20:6041/test_db" \ + -vv + +# version = 2.x +taosx run \ + --from "influxdb+http://192.168.1.10:8086/?version=2.7&orgId=3233855dc7e37d8d&token=OZ2sB6Ie6qcKcYAmcHnL-i3STfLVg_IRPQjPIzjsAQ4aUxCWzYhDesNape1tp8IsX9AH0ld41C-clTgo08CGYA==&bucket=test_bucket&measurements=&beginTime=2023-06-01T00:00:00+0800&readWindow=M" \ + --to "taos+http://192.168.1.20:6041/test_db" \ + -vv +``` + +在这个命令中,未指定endTime, 所以任务会长期è¿è¡Œï¼ŒæŒç»­åŒæ­¥æœ€æ–°çš„æ•°æ®ã€‚ + + +### 从 OpenTSDB åŒæ­¥æ•°æ®åˆ° TDengine + +#### å‘½ä»¤è¡Œå‚æ•° + +将数æ®ä»Ž OpenTSDB åŒæ­¥è‡³ TDengine 的命令,如下所示: + +```bash +taosx run --from "" --to "" +``` + +其中,OpenTSDB DSN ç¬¦åˆ DSN çš„é€šç”¨è§„åˆ™ï¼Œè¿™é‡Œä»…å¯¹å…¶ç‰¹æœ‰çš„å‚æ•°è¿›è¡Œè¯´æ˜Žï¼š +- metrics: éžå¿…填,å¯ä»¥æŒ‡å®šéœ€è¦åŒæ­¥çš„多个 Metrics(英文逗å·åˆ†å‰²ï¼‰ï¼ŒæœªæŒ‡å®šåˆ™åŒæ­¥å…¨éƒ¨ï¼› +- beginTime: 必填,格å¼ä¸ºï¼šYYYY-MM-DD'T'HH:MM:SS'Z', 时区采用 UTC 时区,例如:2023-06-01T00:00:00+0800, å³åŒ—京时间2023-06-01 00:00:00(东八区时间); +- endTime: éžå¿…填,å¯ä»¥ä¸æŒ‡å®šè¯¥å­—段或值为空,格å¼ä¸ŽbeginTime相åŒï¼›å¦‚果未指定,æäº¤ä»»åŠ¡åŽï¼Œå°†æŒç»­è¿›è¡Œæ•°æ®åŒæ­¥ï¼› +- readWindow: éžå¿…填,å¯ä»¥ä¸æŒ‡å®šè¯¥å­—段或值为空,å¯é€‰é¡¹ä¸ºDã€Hã€Mï¼ˆå¤©ã€æ—¶ã€åˆ†ï¼‰ï¼›å¦‚果未指定,则默认按分钟拆分读å–窗å£ã€‚ + +#### 示例 + +å°†ä½äºŽ 192.168.1.10 çš„ OpenTSDB 中, Metric å称为 test_metric1 与 test_metric2 çš„ä¸¤ä¸ªæ•°æ®æº, 从UTCæ—¶é—´2023å¹´06月01æ—¥00æ—¶00分00秒开始的数æ®ï¼Œé€šè¿‡è¿è¡Œåœ¨ 192.168.1.20 上的 taoskeeper, åŒæ­¥è‡³ TDengine çš„ test_db æ•°æ®åº“中,完整的命令如下所示: + +```bash +taosx run \ + --from "opentsdb+http://192.168.1.10:4242/?metrics=test_metric1,test_metric2&beginTime=2023-06-01T00:00:00+0800&readWindow=M" \ + --to "taos+http://192.168.1.20:6041/test_db" \ + -vv +``` + +在这个命令中,未指定endTime, 所以任务会长期è¿è¡Œï¼ŒæŒç»­åŒæ­¥æœ€æ–°çš„æ•°æ®ã€‚ + + +### 从 MQTT åŒæ­¥æ•°æ®åˆ° TDengine + +ç›®å‰ï¼ŒMQTT 连接器仅支æŒä»Ž MQTT æœåŠ¡ç«¯æ¶ˆè´¹ JSON æ ¼å¼çš„æ¶ˆæ¯ï¼Œå¹¶å°†å…¶åŒæ­¥è‡³ TDengine. 命令如下所示: + +```bash +taosx run --from "" --to "" --parser "@" +``` + +其中: +- `--from` 用于指定 MQTT æ•°æ®æºçš„ DSN +- `--to` 用于指定 TDengine çš„ DSN +- `--parser` 用于指定一个 JSON æ ¼å¼çš„é…ç½®æ–‡ä»¶ï¼Œè¯¥æ–‡ä»¶å†³å®šäº†å¦‚ä½•è§£æž JSON æ ¼å¼çš„ MQTT 消æ¯ï¼Œä»¥åŠå†™å…¥ TDengine 时的超级表åã€å­è¡¨åã€å­—段åç§°å’Œç±»åž‹ï¼Œä»¥åŠæ ‡ç­¾å称和类型等。 + +#### MQTT DSN é…ç½® + +MQTT DSN ç¬¦åˆ DSN çš„é€šç”¨è§„åˆ™ï¼Œè¿™é‡Œä»…å¯¹å…¶ç‰¹æœ‰çš„å‚æ•°è¿›è¡Œè¯´æ˜Žï¼š +- topics: 必填,用于é…置监å¬çš„ MQTT 主题å称和连接器支æŒçš„æœ€å¤§ QoS, 采用 `::` 的形å¼ï¼›æ”¯æŒé…置多个主题,使用逗å·åˆ†éš”ï¼›é…置主题时,还å¯ä»¥ä½¿ç”¨ MQTT å议的支æŒçš„通é…符#å’Œ+; +- version: éžå¿…填,用于é…ç½® MQTT å议的版本,支æŒçš„版本包括:3.1/3.1.1/5.0, 默认值为3.1; +- clean_session: éžå¿…填,用于é…置连接器作为 MQTT 客户端连接至 MQTT æœåŠ¡ç«¯æ—¶ï¼ŒæœåŠ¡ç«¯æ˜¯å¦ä¿å­˜è¯¥ä¼šè¯ä¿¡æ¯ï¼Œå…¶é»˜è®¤å€¼ä¸º true, å³ä¸ä¿å­˜ä¼šè¯ä¿¡æ¯ï¼› +- client_id: 必填,用于é…置连接器作为 MQTT 客户端连接至 MQTT æœåŠ¡ç«¯æ—¶çš„å®¢æˆ·ç«¯ id; +- keep_alive: éžå¿…填,用于é…置连接器作为 MQTT å®¢æˆ·ç«¯ï¼Œå‘ MQTT æœåŠ¡ç«¯å‘出 PINGREG 消æ¯åŽçš„等待时间,如果连接器在该时间内,未收到æ¥è‡ª MQTT æœåŠ¡ç«¯çš„ PINGREQ, 连接器则主动断开连接;该é…置的å•ä½ä¸ºç§’,默认值为 60; +- ca: éžå¿…填,用于指定连接器与 MQTT æœåŠ¡ç«¯å»ºç«‹ SSL/TLS 连接时,使用的 CA è¯ä¹¦ï¼Œå…¶å€¼ä¸ºåœ¨è¯ä¹¦æ–‡ä»¶çš„ç»å¯¹è·¯å¾„剿·»åŠ @, 例如:@/home/admin/certs/ca.crt; +- cert: éžå¿…填,用于指定连接器与 MQTT æœåŠ¡ç«¯å»ºç«‹ SSL/TLS 连接时,使用的客户端è¯ä¹¦ï¼Œå…¶å€¼ä¸ºåœ¨è¯ä¹¦æ–‡ä»¶çš„ç»å¯¹è·¯å¾„剿·»åŠ @, 例如:@/home/admin/certs/client.crt; +- cert_key: éžå¿…填,用于指定连接器与 MQTT æœåŠ¡ç«¯å»ºç«‹ SSL/TLS 连接时,使用的客户端ç§é’¥ï¼Œå…¶å€¼ä¸ºåœ¨ç§é’¥æ–‡ä»¶çš„ç»å¯¹è·¯å¾„剿·»åŠ @, 例如:@/home/admin/certs/client.key; +- log_level: éžå¿…填,用于é…ç½®è¿žæŽ¥å™¨çš„æ—¥å¿—çº§åˆ«ï¼Œè¿žæŽ¥å™¨æ”¯æŒ error/warn/info/debug/trace 5ç§æ—¥å¿—级别,默认值为 info. + +一个完整的 MQTT DSN 示例如下: +```bash +mqtt://:@:8883?topics=testtopic/1::2&version=3.1&clean_session=true&log_level=info&client_id=taosdata_1234&keep_alive=60&ca=@/home/admin/certs/ca.crt&cert=@/home/admin/certs/client.crt&cert_key=@/home/admin/certs/client.key +``` + +#### MQTT 连接器的解释器é…ç½® + +连接器的解释器é…置文件,å³`--parser`é…ç½®é¡¹çš„å‚æ•°ï¼Œå®ƒçš„值为一个 JSON 文件,其é…ç½®å¯åˆ†ä¸º`parse`å’Œ`model`两部分,模æ¿å¦‚下所示: + +```json +{ + "parse": { + "payload": { + "json": [ + { + "name": "ts", + "alias": "ts", + "cast": "TIMESTAMP" + }, + ... + ] + } + }, + "model": { + "using": "", + "name": "{alias}", + "columns": [ ... ], + "tags": [ ... ] + } +} +``` + +å„字段的说明如下: +- parse 部分目å‰ä»…æ”¯æŒ json ä¸€ç§ payload, json 字段的值是一个由 JSON Object æž„æˆçš„ JSON Array: + - æ¯ä¸ª JSON Ojbect 包括 name, alias, cast 三个字段; + - name 字段用于指定如何从 MQTT 消æ¯ä¸­æå–字段,如果 MQTT æ¶ˆæ¯æ˜¯ä¸€ä¸ªç®€å•çš„ JSON Object, 这里å¯ä»¥ç›´æŽ¥è®¾ç½®å…¶å­—段å;如果 MQTT æ¶ˆæ¯æ˜¯ä¸€ä¸ªå¤æ‚çš„ JSON Object, 这里å¯ä»¥ä½¿ç”¨ JSON Path æå–字段,例如:`$.data.city`; + - alias 字段用于命å MQTT 消æ¯ä¸­çš„å­—æ®µåŒæ­¥è‡³ TDengine åŽä½¿ç”¨çš„åç§°ï¼› + - cast 字段用于指定 MQTT 消æ¯ä¸­çš„å­—æ®µåŒæ­¥è‡³ TDengine åŽä½¿ç”¨çš„类型。 +- model 部分用于设置 TDengine 超级表ã€å­è¡¨ã€åˆ—和标签等信æ¯ï¼š + - using 字段用于指定超级表åç§°ï¼› + - name 字段用于指定å­è¡¨å称,它的值å¯ä»¥åˆ†ä¸ºå‰ç¼€å’Œå˜é‡ä¸¤éƒ¨åˆ†ï¼Œå˜é‡ä¸º parse 部分设置的 alias 的值,需è¦ä½¿ç”¨{}, 例如:d{id}ï¼› + - columns 字段用于设置 MQTT 消æ¯ä¸­çš„哪些字段作为 TDengine 超级表中的列,å–值为 parse 部分设置的 alias çš„å€¼ï¼›éœ€è¦æ³¨æ„的是,这里的顺åºä¼šå†³å®š TDengine 超级表中列的顺åºï¼Œå› æ­¤ç¬¬ä¸€åˆ—必须为 TIMESTAMP 类型; + - tags 字段用于设置 MQTT 消æ¯ä¸­çš„哪些字段作为 TDengine 超级表中的标签,å–值为 parse 部分设置的 alias 的值。 + +#### 举例说明 + +在 192.168.1.10 çš„ 1883 端å£è¿è¡Œç€ä¸€ä¸ª MQTT broker, 用户åã€å£ä»¤åˆ†åˆ«ä¸ºadmin, 123456; 现欲将其中的消æ¯ï¼Œé€šè¿‡è¿è¡Œåœ¨ 192.168.1.20 çš„ taosadapter åŒæ­¥è‡³ TDengine çš„ test æ•°æ®åº“中。MQTT æ¶ˆæ¯æ ¼å¼ä¸ºï¼š + +```json +{ + "id": 1, + "current": 10.77, + "voltage": 222, + "phase": 0.77, + "groupid": 7, + "location": "California.SanDiego" +} +``` + +MQTT 消æ¯åŒæ­¥è‡³ TDengine æ—¶, 如果采用 meters 作为超级表å,å‰ç¼€â€œdâ€æ‹¼æŽ¥id字段的值作为å­è¡¨å,ts, id, current, voltage, phase作为超级表的列,groupid, location作为超级表的标签,其解释器的é…置如下: +```json +{ + "parse": { + "payload": { + "json": [ + { + "name": "ts", + "alias": "ts", + "cast": "TIMESTAMP" + }, + { + "name": "id", + "alias": "id", + "cast": "INT" + }, + { + "name": "voltage", + "alias": "voltage", + "cast": "INT" + }, + { + "name": "phase", + "alias": "phase", + "cast": "FLOAT" + }, + { + "name": "current", + "alias": "current", + "cast": "FLOAT" + }, + { + "name": "groupid", + "alias": "groupid", + "cast": "INT" + }, + { + "name": "location", + "alias": "location", + "cast": "VARCHAR(20)" + } + ] + } + }, + "model": { + "name": "d{id}", + "using": "meters", + "columns": [ + "ts", + "id", + "current", + "voltage", + "phase" + ], + "tags": [ + "groupid", + "location" + ] + } +} +``` + +如果以上parseré…ç½®ä½äºŽ`/home/admin/parser.json`中,那么完整的命令如下所示: + +```bash +taosx run \ + -f "mqtt://admin:123456@192.168.1.10:1883?topics=testtopic/1::2&version=3.1&clean_session=true&log_level=info&client_id=1234&keep_alive=60" \ + -t "taos+ws://192.168.1.20:6041/test" + --parser "@/home/admin/parser.json" + --verbose +``` + +### 从 Kafka åŒæ­¥æ•°æ®åˆ° TDengine + +#### å‘½ä»¤è¡Œå‚æ•° + +taosx 支æŒä»Ž Kafka 消费数æ®ï¼Œå†™å…¥ TDengine。命令如下所示: +```sehll +taosx run -f "" -t "" +``` +或 +```shell +taosx run -f "" -t "" --parser "@" +``` +其中: +- -f或--from: Kafka çš„ DSN +- -t或--to :TDengine çš„ DSN +- --parser :一个 JSON æ ¼å¼çš„é…置文件,或JSONæ ¼å¼çš„字符串。 + +#### Kafka DSN é…置的é…ç½® + +| 傿•° | 说明 | å¿…å¡«? | 缺çœå€¼ | 适用于 | 示例 | +|-----|---------------|----------|---------|---------|----------| +| group| 消费者的group。å…è®¸ç»„ä¸ºç©ºå­—ç¬¦ä¸²ï¼Œåœ¨è¿™ç§æƒ…况下,生æˆçš„æ¶ˆè´¹è€…将是无组的 | å¦ | "" | æºç«¯ | | +| topics | 指定è¦ä½¿ç”¨çš„主题。指定主题的所有å¯ç”¨åˆ†åŒºéƒ½å°†è¢«ä½¿ç”¨ï¼Œé™¤éžåœ¨æŒ‡å®š topic_partitions 时被覆盖。| è¯¥å‚æ•°æˆ–topic_partitions必须至少指定一个,以便将主题分é…给消费者。| None | æºç«¯ | topics=tp1,tp2 | +| topic_partitions | æ˜¾å¼æŒ‡å®šè¦ä½¿ç”¨çš„主题分区。åªä½¿ç”¨å·²æ ‡è¯†ä¸»é¢˜çš„æŒ‡å®šåˆ†åŒºã€‚ | è¯¥å‚æ•°æˆ–topics必须至少指定一个,以便将主题分é…给消费者。 | None | æºç«¯ | topic_partitions=tp1:0..2,tp2:1 | +| fallback_offset | topicåç§»é‡æ—¶å¯èƒ½çš„值:- Earliest:接收最早的å¯ç”¨åç§»é‡; - Latest:接收最近的åç§»é‡; - ByTime(i64):用于请求在æŸä¸€ç‰¹å®šæ—¶é—´(ms)之å‰çš„æ‰€æœ‰æ¶ˆæ¯;Unix时间戳(毫秒) | å¦ | Earliest | æºç«¯ | fallback_offset=Earliest | +| offset_storage | å®šä¹‰åœ¨èŽ·å–æˆ–æäº¤ç»„åç§»é‡æ—¶ï¼Œè¦ä½¿ç”¨çš„å¯ç”¨å­˜å‚¨ï¼š- Zookeeper:基于Zookeeper的存储(从kafka 0.8.1开始å¯ç”¨)ï¼›- Kafka:基于Kafka的存储(从Kafka 0.8.2开始å¯ç”¨)。这是组存储其åç§»é‡çš„首选方法。 | å¦ | Kafka | æºç«¯ | offset_storage=Kafka | +| timeout | 从kafkaè®¢é˜…æ•°æ®æ—¶ï¼Œå¦‚æžœè¶…æ—¶åŽæ²¡æœ‰èŽ·å–到有效数æ®ï¼Œé€€å‡º | å¦ | 500 | æºç«¯ | timeout=never | +| use_ssl | 是å¦ä½¿ç”¨SSLè®¤è¯ | å¦ | | æºç«¯ | | +| cert | SSLè¯ä¹¦çš„æ–‡ä»¶è·¯å¾„ | å¦ | | | æºç«¯ | | +| cert_key | SSLè¯ä¹¦key的文件路径 | å¦ | | æºç«¯ || + + +#### 示例一 + +从192.168.1.92æœåŠ¡å™¨çš„Kafka实例中消费数æ®ï¼ŒåŒæ­¥åˆ°192.168.1.92上的TDengine,ä¸ä½¿ç”¨parser。 + +1. kafka + +```shell +#!/bin/bash +KAFKA_HOME=/root/zyyang/kafka_2.13-3.1.0 +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 --delete +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 --delete +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 --partitions 5 --replication-factor 1 --create +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 --partitions 1 --replication-factor 1 --create +$KAFKA_HOME/bin/kafka-console-producer.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 << EOF +{"id": 1, "message": "hello"} +{"id": 2, "message": "hello"} +{"id": 3, "message": "hello"} +{"id": 4, "message": "hello"} +{"id": 5, "message": "hello"} +EOF +$KAFKA_HOME/bin/kafka-console-producer.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 << EOF +{"id": 1, "message": "aaa"} +{"id": 2, "message": "aaa"} +{"id": 3, "message": "aaa"} +{"id": 4, "message": "aaa"} +{"id": 5, "message": "aaa"} +EOF +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 --describe +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 --describe +``` + +2. TDengine + +```shell +drop database if exists kafka_to_taos; +create database if not exists kafka_to_taos precision 'ms'; +use kafka_to_taos; +``` + +3. taosx + +```shell +taosx run -f "kafka://192.168.1.92:9092/?topics=tp1,tp2&timeout=5000" -t "taos://192.168.1.92:6030/kafka_to_taos" --parser "{\"parse\":{\"ts\":{\"as\":\"timestamp(ms)\"},\"topic\":{\"as\":\"varchar\",\"alias\":\"t\"},\"partition\":{\"as\":\"int\",\"alias\":\"p\"},\"offset\":{\"as\":\"bigint\",\"alias\":\"o\"},\"key\":{\"as\":\"binary\",\"alias\":\"k\"},\"value\":{\"as\":\"binary\",\"alias\":\"v\"}},\"model\":[{\"name\":\"t_{t}\",\"using\":\"kafka_data\",\"tags\":[\"t\",\"p\"],\"columns\":[\"ts\",\"o\",\"k\",\"v\"]}]}" +``` + +#### 示例2 + +从192.168.1.92æœåŠ¡å™¨çš„Kafka实例中消费数æ®ï¼ŒåŒæ­¥åˆ°192.168.1.92上的TDengine,使用parserè§£æžvalue中的JSONæ•°æ®ã€‚ + +1. kafka,åŒâ€œç¤ºä¾‹1†+2. TDengine,åŒâ€œç¤ºä¾‹1†+3. Taosx + +```shell +taosx run -f "kafka://192.168.1.92:9092/?topics=tp1,tp2&timeout=5000" -t "taos://192.168.0.201:6030/kafka_to_taos" --parser "{\"parse\":{\"ts\":{\"as\":\"timestamp(ms)\"},\"topic\":{\"as\":\"varchar\",\"alias\":\"t\"},\"partition\":{\"as\":\"int\",\"alias\":\"p\"},\"offset\":{\"as\":\"bigint\",\"alias\":\"o\"},\"value\":{\"json\":[\"id::int\",\"message::binary\"]}},\"model\":[{\"name\":\"t_{t}\",\"using\":\"kafka_data\",\"tags\":[\"t\",\"p\"],\"columns\":[\"ts\",\"o\",\"id\",\"message\"]}]}" +``` + +## æœåŠ¡æ¨¡å¼ + +在æœåŠ¡æ¨¡å¼ä¸‹ï¼Œ 一共需è¦ä¸‰ä¸ªç»„ä»¶ååŒå®Œæˆæ•°æ®è¿ç§»ã€‚ taosX,Agent ä»¥åŠ taosExplorer å‡å·²æœåŠ¡æ€è¿è¡Œï¼Œå„ç§æ“作通过 taosExplorer 的图形界é¢è¿›è¡Œã€‚taos-Explorer 组件除了数æ®è¿ç§»ä¹‹å¤–,还æä¾›äº†ä½¿ç”¨ TDengine 的图形化界é¢ã€‚ + +### 部署 taosX + +#### é…ç½® + +taosX 仅支æŒé€šè¿‡å‘½ä»¤è¡Œå‚数进行é…置。æœåŠ¡æ¨¡å¼ä¸‹ï¼ŒtaosX 支æŒçš„å‘½ä»¤è¡Œå‚æ•°å¯ä»¥é€šè¿‡ä»¥ä¸‹æ–¹å¼æŸ¥çœ‹ï¼š + +``` +taosx serve --help +``` + +建议通过 Systemd 的方å¼ï¼Œå¯åЍ taosX çš„æœåŠ¡æ¨¡å¼ï¼Œå…¶ Systemd çš„é…置文件ä½äºŽï¼š`/etc/systemd/system/taosx.service`. 如需修改 taosX çš„å¯åЍ傿•°ï¼Œå¯ä»¥ç¼–辑该文件中的以下行: + +``` +ExecStart=/usr/bin/taosx serve -v +``` + +修改åŽï¼Œéœ€æ‰§è¡Œä»¥ä¸‹å‘½ä»¤é‡å¯ taosX æœåŠ¡ï¼Œä½¿é…置生效: + +``` +systemctl daemon-reload +systemctl restart taosx +``` + +#### å¯åЍ + +Linux 系统上以 Systemd 的方å¼å¯åЍ taosX 的命令如下: + +```shell +systemctl start taosx +``` + +Windows 系统上,请在 "Services" 系统管ç†å·¥å…·ä¸­æ‰¾åˆ° "taosX" æœåŠ¡ï¼Œç„¶åŽç‚¹å‡» "å¯åŠ¨è¿™ä¸ªæœåŠ¡"。 + +#### 问题排查 + +1. 如何修改 taosX 的日志级别? + +taosX çš„æ—¥å¿—çº§åˆ«æ˜¯é€šè¿‡å‘½ä»¤è¡Œå‚æ•°æŒ‡å®šçš„,默认的日志级别为 Info, 具体傿•°å¦‚下: +- INFO: `taosx serve -v` +- DEBUG: `taosx serve -vv` +- TRACE: `taosx serve -vvv` + +Systemd æ–¹å¼å¯åŠ¨æ—¶ï¼Œå¦‚ä½•ä¿®æ”¹å‘½ä»¤è¡Œå‚æ•°ï¼Œè¯·å‚考“é…ç½®â€ç« èŠ‚ã€‚ + +2. 如何查看 taosX 的日志? + +以 Systemd æ–¹å¼å¯åŠ¨æ—¶ï¼Œå¯é€šè¿‡ journalctl 命令查看日志。以滚动方å¼ï¼Œå®žæ—¶æŸ¥çœ‹æœ€æ–°æ—¥å¿—的命令如下: + +``` +journalctl -u taosx -f +``` + +### 部署 Agent + +#### é…ç½® + +Agent 默认的é…置文件ä½äºŽ`/etc/taos/agent.toml`, 包å«ä»¥ä¸‹é…置项: +- endpoint: 必填,taosX çš„ GRPC endpoint +- token: 必填,在 taosExplorer 上创建 agent 时,产生的token +- debug_level: éžå¿…填,默认为 info, è¿˜æ”¯æŒ debug, trace 等级别 + +如下所示: + +```TOML +endpoint = "grpc://:6055" +token = "" +log_level = "debug" +``` + +日志ä¿å­˜æ—¶é—´è®¾ç½® +日志ä¿å­˜çš„天数å¯ä»¥é€šè¿‡çŽ¯å¢ƒå˜é‡è¿›è¡Œè®¾ç½® TAOSX_LOGS_KEEP_DAYS, 默认为 30 天。 + +```shell +export TAOSX_LOGS_KEEP_DAYS=7 +``` + +#### å¯åЍ + +Linux 系统上 Agent å¯ä»¥é€šè¿‡ Systemd 命令å¯åŠ¨ï¼š + +``` +systemctl start taosx-agent +``` + +Windows 系统上通过系统管ç†å·¥å…· "Services" 找到 taosx-agent æœåŠ¡ï¼Œç„¶åŽå¯åŠ¨å®ƒã€‚ + +#### 问题排查 + +å¯ä»¥é€šè¿‡ journalctl 查看 Agent 的日志 + +``` +journalctl -u taosx-agent -f +``` + +### 部署 taosExplorer + + +### æ•°æ®åŒæ­¥åŠŸèƒ½ + +请å‚考 taosExplorer \ No newline at end of file diff --git a/docs/zh/18-data-transfer/02-explorer.md b/docs/zh/18-data-transfer/02-explorer.md new file mode 100644 index 0000000000..6d410c4997 --- /dev/null +++ b/docs/zh/18-data-transfer/02-explorer.md @@ -0,0 +1,128 @@ +--- +title: 基于å¯è§†åŒ–界é¢çš„æ•°æ®è¿ç§» +--- + +本节讲述使用 taos Explorer çš„å¯è§†åŒ–界é¢è¿›è¡Œæ•°æ®è¿ç§»ï¼Œä½¿ç”¨æ­¤åŠŸèƒ½éœ€è¦ä¾èµ– taosd, taosAdapter, taosX, taos-explorer 等几个æœåŠ¡ç»„ä»¶ã€‚å…³äºŽ taosd å’Œ taosAdapter 的部署请å‚考 [系统部署](../../deployment/deploy),[taosX](../taosX)ï¼Œä»¥åŠ [部署 taos-explorer](../../operation/explorer) + +## åŠŸèƒ½å…¥å£ + +点击 explorer 左侧功能列表中的 "æ•°æ®å†™å…¥",å¯ä»¥é…ç½®ä¸åŒç±»åž‹çš„æ•°æ®æºï¼ŒåŒ…括 TDengine Subscription, PI, OPC-UA, OPC-DA, InfluxDB, MQTT,Kafka, CSV 等,将它们的数æ®å†™å…¥åˆ°å½“剿­£åœ¨è¢«ç®¡ç†çš„ TDengine 集群中。 + +## TDengine 订阅 + +进入TDengine订阅任务é…置页é¢ï¼š +1. 在连接åè®®æ ä¸­ï¼Œé…置连接å议,默认为原生连接,å¯é…置为WSã€WSSï¼› +2. 在æœåС噍æ ä¸­é…ç½®æœåŠ¡å™¨çš„ IP 或域åï¼› +3. åœ¨ç«¯å£æ ä¸­é…置连接的端å£å·ï¼Œé»˜è®¤å€¼ä¸º6030ï¼› +4. 在主题æ ä¸­ï¼Œé…ç½®å¯ä»¥é…置订阅一个或多个数æ®åº“,或超级表或普通表,也å¯ä»¥æ˜¯ä¸€ä¸ªå·²åˆ›å»ºçš„ Topicï¼› +5. åœ¨è®¤è¯æ ï¼Œå¯ä»¥é…置访问 TDengine 的用户å密ç ï¼Œç”¨æˆ·å默认值为 root,密ç é»˜è®¤å€¼ä¸º taosdataï¼›å¦‚æžœæ•°æ®æºä¸ºäº‘æœåŠ¡å®žä¾‹ï¼Œåˆ™å¯ä»¥é€‰æ‹©ä»¤ç‰Œè®¤è¯æ–¹å¼å¹¶é…置实例 tokenï¼› +6. 在订阅åˆå§‹ä½ç½®æ ï¼Œå¯é…置从最早数æ®ï¼ˆearliest)或最晚(latest)数æ®å¼€å§‹è®¢é˜…,默认为 earliestï¼› +7. 在超时æ é…置超时时间,å¯é…置为 never: 表示无超时时间,æŒç»­è¿›è¡Œè®¢é˜…ï¼Œä¹Ÿå¯æŒ‡å®šè¶…时时间:5s, 1m 等,支æŒå•ä½ ms(毫秒),s(秒),m(分钟),hï¼ˆå°æ—¶ï¼‰ï¼Œd(天),M(月),y(年)。 +8. 在目标数æ®åº“æ ä¸­ï¼Œé€‰æ‹©æœ¬åœ° TDengine 的库作为目标库,点击 submit,å³å¯å¯åŠ¨ä¸€ä¸ª TDengine 订阅任务。 + +## Pi + +1. 在 PI æ•°æ®æŽ¥å…¥é¡µé¢ï¼Œè®¾ç½® PI æœåŠ¡å™¨çš„åç§°ã€AF æ•°æ®åº“å称。 +2. 在监测点集æ ï¼Œå¯ä»¥é…置选择 Point 模å¼ç›‘测点集åˆã€Point 模å¼ç›‘测的 AF 模æ¿ã€AF 模å¼ç›‘测的 AF 模æ¿ã€‚ +3. 在 PI 系统设置æ ï¼Œå¯ä»¥é…ç½® PI 系统å,默认为 PI æœåС噍å。 +4. 在 Data Queue æ ï¼Œå¯ä»¥é…ç½® PI 连接器è¿è¡Œå‚数:MaxWaitLenï¼ˆæ•°æ®æœ€å¤§ç¼“å†²æ¡æ•°ï¼‰ï¼Œé»˜è®¤å€¼ä¸º 1000 ,有效å–值范围为 [1,10000]ï¼›UpdateInterval(PI System å–æ•°æ®é¢‘率),默认值为 10000(毫秒:ms),有效å–值范围为 [10,600000]ï¼›é‡å¯è¡¥å¿æ—¶é—´ï¼ˆMax Backfill Range,å•ä½ï¼šå¤©ï¼‰ï¼Œæ¯æ¬¡é‡å¯æœåŠ¡æ—¶å‘å‰è¡¥å¿è¯¥å¤©æ•°çš„æ•°æ®ï¼Œé»˜è®¤ä¸º1天。 +5. 在目标数æ®åº“æ ï¼Œé€‰æ‹©éœ€è¦å†™å…¥çš„ TDengine æ•°æ®åº“,点击 submit ,å³å¯å¯åŠ¨ä¸€ä¸ª PI æ•°æ®æŽ¥å…¥ä»»åŠ¡ã€‚ + +## OPC-UA + +1. 在 OPC-UA页é¢ï¼Œé…ç½® OPC-server 的地å€ï¼Œè¾“入格å¼ä¸º 127.0.0.1:6666/OPCUA/ServerPath。 +2. åœ¨è®¤è¯æ ï¼Œé€‰æ‹©è®¿é—®æ–¹å¼ã€‚å¯ä»¥é€‰æ‹©åŒ¿å访问ã€ç”¨æˆ·å密ç è®¿é—®ã€è¯ä¹¦è®¿é—®ã€‚使用è¯ä¹¦è®¿é—®æ—¶ï¼Œéœ€é…ç½®è¯ä¹¦æ–‡ä»¶ä¿¡æ¯ã€ç§é’¥æ–‡ä»¶ä¿¡æ¯ã€OPC-UA 安全å议和 OPC-UA 安全策略 +3. 在 Data Sets æ ï¼Œé…置点ä½ä¿¡æ¯ã€‚(å¯é€šè¿‡â€œé€‰æ‹©â€æŒ‰é’®é€‰æ‹©æ­£åˆ™è¡¨è¾¾å¼è¿‡æ»¤ç‚¹ä½ï¼Œæ¯æ¬¡æœ€å¤šèƒ½è¿‡æ»¤å‡º10æ¡ç‚¹ä½);点ä½é…ç½®æœ‰ä¸¤ç§æ–¹å¼ï¼š1.手动输入点ä½ä¿¡æ¯ 2.上传csv文件é…置点ä½ä¿¡æ¯ +4. 在连接é…ç½®æ ï¼Œé…置连接超时间隔和采集超时间隔(å•ä½ï¼šç§’),默认值为10秒。 +5. 在采集é…ç½®æ ï¼Œé…置采集间隔(å•ä½ï¼šç§’)ã€ç‚¹ä½æ•°é‡ã€é‡‡é›†æ¨¡å¼ã€‚采集模å¼å¯é€‰æ‹©observe(轮询模å¼ï¼‰å’Œsubscribe(订阅模å¼ï¼‰ï¼Œé»˜è®¤å€¼ä¸ºobserve。 +6. 在库表é…ç½®æ ï¼Œé…置目标 TDengine 中存储数æ®çš„超级表ã€å­è¡¨ç»“构信æ¯ã€‚ +7. 在其他é…ç½®æ ï¼Œé…置并行度ã€å•次采集上报批次(默认值100)ã€ä¸ŠæŠ¥è¶…时时间(å•ä½ï¼šç§’,默认值10ï¼‰ã€æ˜¯å¦å¼€å¯debug级别日志。 +8. 在目标数æ®åº“æ ï¼Œé€‰æ‹©éœ€è¦å†™å…¥çš„ TDengine æ•°æ®åº“,点击 submit,å³å¯å¯åŠ¨ä¸€ä¸ª OPC-UA æ•°æ®æŽ¥å…¥ä»»åŠ¡ã€‚ + +## OPC-DA + +1. 在 OPC-DA页é¢ï¼Œé…ç½® OPC-server 的地å€ï¼Œè¾“入格å¼ä¸º 127.0.0.1<,localhost>/Matrikon.OPC.Simulation.1。 +2. 在数æ®ç‚¹æ ï¼Œé…ç½® OPC-DA 采集点信æ¯ã€‚(å¯é€šè¿‡â€œé€‰æ‹©â€æŒ‰é’®é€‰æ‹©æ­£åˆ™è¡¨è¾¾å¼è¿‡æ»¤ç‚¹ä½ï¼Œæ¯æ¬¡æœ€å¤šèƒ½è¿‡æ»¤å‡º10æ¡ç‚¹ä½)。点ä½é…ç½®æœ‰ä¸¤ç§æ–¹å¼ï¼š1.手动输入点ä½ä¿¡æ¯ 2.上传csv文件é…置点ä½ä¿¡æ¯ +3. 在连接æ ï¼Œé…置连接超时时间(å•ä½ï¼šç§’,默认值为10秒)ã€é‡‡é›†è¶…时时间(å•ä½ï¼šç§’,默认值为10秒)。 +4. 在库表é…ç½®æ ï¼Œé…置目标 TDengine 中存储数æ®çš„超级表ã€å­è¡¨ç»“构信æ¯ã€‚ +5. 在其他é…ç½®æ ï¼Œé…置并行度ã€å•次采集上报批次(默认值100)ã€ä¸ŠæŠ¥è¶…时时间(å•ä½ï¼šç§’,默认值10ï¼‰ã€æ˜¯å¦å¼€å¯debug级别日志。 +6. 在目标数æ®åº“æ ï¼Œé€‰æ‹©éœ€è¦å†™å…¥çš„ TDengine æ•°æ®åº“,点击 submit,å³å¯å¯åŠ¨ä¸€ä¸ª OPC-DA æ•°æ®æŽ¥å…¥ä»»åŠ¡ã€‚ + +## InfluxDB + +进入 InfluxDB æ•°æ®æºåŒæ­¥ä»»åŠ¡çš„ç¼–è¾‘é¡µé¢åŽï¼š +1. 在æœåŠ¡å™¨åœ°å€è¾“入框, 输入 InfluxDB æœåŠ¡å™¨çš„åœ°å€ï¼Œå¯ä»¥è¾“å…¥ IP åœ°å€æˆ–域å,此项为必填字段; +2. 在端å£è¾“入框, 输入 InfluxDB æœåŠ¡å™¨ç«¯å£ï¼Œé»˜è®¤æƒ…况下,InfluxDB 监å¬8086端å£çš„ HTTP 请求和8088端å£çš„ HTTPS 请求,此项为必填字段; +3. 在组织 ID 输入框,输入将è¦åŒæ­¥çš„组织 ID,此项为必填字段; +4. 在令牌 Token 输入框,输入一个至少拥有读å–这个组织 ID 下的指定 Bucket æƒé™çš„ Token, 此项为必填字段; +5. åœ¨åŒæ­¥è®¾ç½®çš„èµ·å§‹æ—¶é—´é¡¹ä¸‹ï¼Œé€šè¿‡ç‚¹é€‰é€‰æ‹©ä¸€ä¸ªåŒæ­¥æ•°æ®çš„起始时间,起始时间使用 UTC 时间, 此项为必填字段; +6. åœ¨åŒæ­¥è®¾ç½®çš„ç»“æŸæ—¶é—´é¡¹ä¸‹ï¼Œå½“䏿Œ‡å®šç»“æŸæ—¶é—´æ—¶ï¼Œå°†æŒç»­è¿›è¡Œæœ€æ–°æ•°æ®çš„åŒæ­¥ï¼›å½“æŒ‡å®šç»“æŸæ—¶é—´æ—¶ï¼Œå°†åªåŒæ­¥åˆ°è¿™ä¸ªç»“æŸæ—¶é—´ä¸ºæ­¢; ç»“æŸæ—¶é—´ä½¿ç”¨ UTC 时间,此项为å¯é€‰å­—段; +7. 在桶 Bucket 输入框,输入一个需è¦åŒæ­¥çš„ Bucket,目å‰åªæ”¯æŒåŒæ­¥ä¸€ä¸ª Bucket 至 TDengine æ•°æ®åº“,此项为必填字段; +8. 在目标数æ®åº“下拉列表,选择一个将è¦å†™å…¥çš„ TDengine 目标数æ®åº“ (注æ„:目å‰åªæ”¯æŒåŒæ­¥åˆ°ç²¾åº¦ä¸ºçº³ç§’çš„ TDengine 目标数æ®åº“),此项为必填字段; +9. 填写完æˆä»¥ä¸Šä¿¡æ¯åŽï¼Œç‚¹å‡»æäº¤æŒ‰é’®ï¼Œå³å¯ç›´æŽ¥å¯åŠ¨ä»Ž InfluxDB 到 TDengine 的数æ®åŒæ­¥ã€‚ + +## MQTT + +进入 MQTT æ•°æ®æºåŒæ­¥ä»»åŠ¡çš„ç¼–è¾‘é¡µé¢åŽï¼š +1. 在 MQTT 地å€å¡ç‰‡ï¼Œè¾“å…¥ MQTT 地å€ï¼Œå¿…填字段,包括 IP å’Œ 端å£å·ï¼Œä¾‹å¦‚:192.168.1.10:1883; +2. 在认è¯å¡ç‰‡ï¼Œè¾“å…¥ MQTT 连接器访问 MQTT æœåŠ¡å™¨æ—¶çš„ç”¨æˆ·å和密ç ï¼Œè¿™ä¸¤ä¸ªå­—段为选填字段,如果未输入,å³é‡‡ç”¨åŒ¿å认è¯çš„æ–¹å¼ï¼› +3. 在 SSL è¯ä¹¦å¡ç‰‡ï¼Œå¯ä»¥é€‰æ‹©æ˜¯å¦æ‰“å¼€ SSL/TLS 开关,如果打开此开关,MQTT 连接器和 MQTT æœåŠ¡å™¨ä¹‹é—´çš„é€šä¿¡å°†é‡‡ç”¨ SSL/TLS 的方å¼è¿›è¡ŒåŠ å¯†ï¼›æ‰“å¼€è¿™ä¸ªå¼€å…³åŽï¼Œä¼šå‡ºçް CA, 客户端è¯ä¹¦å’Œå®¢æˆ·ç«¯ç§é’¥ä¸‰ä¸ªå¿…å¡«é…置项,å¯ä»¥åœ¨è¿™é‡Œè¾“å…¥è¯ä¹¦å’Œç§é’¥æ–‡ä»¶çš„内容; +4. 在连接å¡ç‰‡ï¼Œå¯ä»¥é…置以下信æ¯ï¼š + - MQTT å议:支æŒ3.1/3.1.1/5.0三个版本; + - Client ID: MQTT 连接器连接 MQTT æœåŠ¡å™¨æ—¶æ‰€ä½¿ç”¨çš„å®¢æˆ·ç«¯ ID, 用于标识客户端的身份; + - Keep Alive: 用于é…ç½® MQTT 连接器与 MQTT æœåŠ¡å™¨ä¹‹é—´çš„Keep Alive时间,默认值为60ç§’ï¼› + - Clean Session: 用于é…ç½® MQTT 连接器是å¦ä»¥Clean Session的方å¼è¿žæŽ¥è‡³ MQTT æœåŠ¡å™¨ï¼Œé»˜è®¤å€¼ä¸ºTrue; + - è®¢é˜…ä¸»é¢˜åŠ QoS é…置:这里用æ¥é…置监å¬çš„ MQTT 主题,以åŠè¯¥ä¸»é¢˜æ”¯æŒçš„æœ€å¤§QoS, 主题和 QoS çš„é…置之间用::分隔,多个主题之间用,分隔,主题的é…ç½®å¯ä»¥æ”¯æŒ MQTT å议的通é…符#å’Œ+; +5. 在其他å¡ç‰‡ï¼Œå¯ä»¥é…ç½® MQTT è¿žæŽ¥å™¨çš„æ—¥å¿—çº§åˆ«ï¼Œæ”¯æŒ error, warn, info, debug, trace 5个级别,默认值为 info; +6. MQTT Payload è§£æžå¡ç‰‡ï¼Œç”¨äºŽé…ç½®å¦‚ä½•è§£æž MQTT 消æ¯ï¼š + - é…置表的第一行为 ts 字段,该字段为 TIMESTAMP 类型,它的值为 MQTT 连接器收到 MQTT 消æ¯çš„æ—¶é—´ï¼› + - é…置表的第二行为 topic 字段,为该消æ¯çš„主题å称,å¯ä»¥é€‰æ‹©å°†è¯¥å­—æ®µä½œä¸ºåˆ—æˆ–è€…æ ‡ç­¾åŒæ­¥è‡³ TDengine; + - é…置表的第三行为 qos 字段,为该消æ¯çš„ QoS 属性,å¯ä»¥é€‰æ‹©å°†è¯¥å­—æ®µä½œä¸ºåˆ—æˆ–è€…æ ‡ç­¾åŒæ­¥è‡³ TDengine; + - 剩余的é…置项皆为自定义字段,æ¯ä¸ªå­—段都需è¦é…ç½®ï¼šå­—æ®µï¼ˆæ¥æºï¼‰ï¼Œåˆ—ï¼ˆç›®æ ‡ï¼‰ï¼Œåˆ—ç±»åž‹ï¼ˆç›®æ ‡ï¼‰ã€‚å­—æ®µï¼ˆæ¥æºï¼‰æ˜¯æŒ‡è¯¥ MQTT 消æ¯ä¸­çš„字段å称,当å‰ä»…æ”¯æŒ JSON 类型的 MQTT 消æ¯åŒæ­¥ï¼Œå¯ä»¥ä½¿ç”¨ JSON Path 语法从 MQTT 消æ¯ä¸­æå–字段,例如:$.data.id; åˆ—ï¼ˆç›®æ ‡ï¼‰æ˜¯æŒ‡åŒæ­¥è‡³ TDengine åŽçš„字段åç§°ï¼›åˆ—ç±»åž‹ï¼ˆç›®æ ‡ï¼‰æ˜¯æŒ‡åŒæ­¥è‡³ TDengine åŽçš„字段类型,å¯ä»¥ä»Žä¸‹æ‹‰åˆ—表中选择;当且仅当以上3个é…置都填写åŽï¼Œæ‰èƒ½æ–°å¢žä¸‹ä¸€ä¸ªå­—段; + - 如果 MQTT 消æ¯ä¸­åŒ…嫿—¶é—´æˆ³ï¼Œå¯ä»¥é€‰æ‹©æ–°å¢žä¸€ä¸ªè‡ªå®šä¹‰å­—æ®µï¼Œå°†å…¶ä½œä¸ºåŒæ­¥è‡³ TDengine æ—¶çš„ä¸»é”®ï¼›éœ€è¦æ³¨æ„的是,MQTT 消æ¯ä¸­æ—¶é—´æˆ³çš„ä»…æ”¯æŒ Unix Timestampæ ¼å¼ï¼Œä¸”该字段的列类型(目标)的选择,需è¦ä¸Žåˆ›å»º TDengine æ•°æ®åº“æ—¶çš„é…置一致; + - å­è¡¨å‘½å规则:用于é…ç½®å­è¡¨å称,采用“å‰ç¼€+{列类型(目标)}â€çš„æ ¼å¼ï¼Œä¾‹å¦‚:d{id}; + - 超级表å:用于é…ç½®åŒæ­¥è‡³ TDengine 时,采用的超级表åï¼› +7. 在目标数æ®åº“å¡ç‰‡ï¼Œå¯ä»¥é€‰æ‹©åŒæ­¥è‡³ TDengine 的数æ®åº“å称,支æŒç›´æŽ¥ä»Žä¸‹æ‹‰åˆ—表中选择。 +8. 填写完æˆä»¥ä¸Šä¿¡æ¯åŽï¼Œç‚¹å‡»æäº¤æŒ‰é’®ï¼Œå³å¯ç›´æŽ¥å¯åŠ¨ä»Ž MQTT 到 TDengine 的数æ®åŒæ­¥ã€‚ + +## Kafka + +1. 在Kafka页é¢ï¼Œé…ç½®Kafka选项,必填字段,包括:bootstrap_server,例如192.168.1.92:9092ï¼› +2. 如果使用SSL认è¯ï¼Œåœ¨SSL认è¯å¡ä¸­ï¼Œé€‰æ‹©certå’Œcert_key的文件路径; +3. é…ç½®å…¶ä»–å‚æ•°ï¼Œtopicsã€topic_partitionsè¿™2ä¸ªå‚æ•°è‡³å°‘å¡«å†™ä¸€ä¸ªï¼Œå…¶ä»–å‚æ•°æœ‰é»˜è®¤å€¼ï¼› +4. 如果消费的Kafkaæ•°æ®æ˜¯JSONæ ¼å¼ï¼Œå¯ä»¥é…ç½®parserå¡ç‰‡ï¼Œå¯¹æ•°æ®è¿›è¡Œè§£æžè½¬æ¢ï¼› +5. 在目标数æ®åº“å¡ç‰‡ä¸­ï¼Œé€‰æ‹©åŒæ­¥åˆ°TDengine的数æ®åº“å称,支æŒä»Žä¸‹æ‹‰åˆ—表中选择; +6. 填写完以上信æ¯åŽï¼Œç‚¹å‡»æäº¤æŒ‰é’®ï¼Œå³å¯å¯åŠ¨ä»ŽKafka到TDengine的数æ®åŒæ­¥ã€‚ + +## CSV + +1. 在CSV页é¢ï¼Œé…ç½®CSV选项,å¯è®¾ç½®å¿½ç•¥å‰N行,å¯è¾“入具体的数字 +2. CSV的写入é…置,设置批次写入é‡ï¼Œé»˜è®¤æ˜¯1000 +3. CSV文件解æžï¼Œç”¨äºŽèŽ·å–CSV对应的列信æ¯ï¼š + - 上传CSV文件或者输入CSVæ–‡ä»¶çš„åœ°å€ + - 选择是å¦åŒ…包å«Header + - 包å«Header情况下直接执行下一步,查询出对应CSV的列信æ¯ï¼ŒèŽ·å–CSVçš„é…ç½®ä¿¡æ¯ + - ä¸åŒ…å«Header情况,需è¦è¾“入自定列信æ¯ï¼Œå¹¶ä»¥é€—å·åˆ†éš”,然åŽä¸‹ä¸€æ­¥ï¼ŒèŽ·å–CSVçš„é…ç½®ä¿¡æ¯ + - CSVçš„é…置项,æ¯ä¸ªå­—段都需è¦é…置:CSV列,DB列,列类型(目标),主键(整个é…ç½®åªèƒ½æœ‰ä¸€ä¸ªä¸»é”®ï¼Œä¸”主键必须是TIMESTAMP类型),作为列,作为Tag。CSV列是指该 CSV文件中的列或者自定义的列;DB列是对应的数æ®è¡¨çš„列 + - å­è¡¨å‘½å规则:用于é…ç½®å­è¡¨å称,采用“å‰ç¼€+{列类型(目标)}â€çš„æ ¼å¼ï¼Œä¾‹å¦‚:d{id}; + - 超级表å:用于é…ç½®åŒæ­¥è‡³ TDengine 时,采用的超级表åï¼› +4. 在目标数æ®åº“å¡ç‰‡ï¼Œå¯ä»¥é€‰æ‹©åŒæ­¥è‡³ TDengine 的数æ®åº“å称,支æŒç›´æŽ¥ä»Žä¸‹æ‹‰åˆ—表中选择。 +5. 填写完æˆä»¥ä¸Šä¿¡æ¯åŽï¼Œç‚¹å‡»æäº¤æŒ‰é’®ï¼Œå³å¯ç›´æŽ¥å¯åŠ¨ä»Ž CSV到 TDengine 的数æ®åŒæ­¥ã€‚ + + +## 备份和æ¢å¤ + +您å¯ä»¥å°†å½“å‰è¿žæŽ¥çš„ TDengine 集群中的数æ®å¤‡ä»½è‡³ä¸€ä¸ªæˆ–多个本地文件中,ç¨åŽå¯ä»¥é€šè¿‡è¿™äº›æ–‡ä»¶è¿›è¡Œæ•°æ®æ¢å¤ã€‚æœ¬ç« èŠ‚å°†ä»‹ç»æ•°æ®å¤‡ä»½å’Œæ¢å¤çš„具体步骤。 + +### 备份数æ®åˆ°æœ¬åœ°æ–‡ä»¶ + +1. 进入系统管ç†é¡µé¢ï¼Œç‚¹å‡»ã€å¤‡ä»½ã€‘进入数æ®å¤‡ä»½é¡µé¢ï¼Œç‚¹å‡»å³ä¸Šè§’ã€æ–°å¢žå¤‡ä»½ã€‘。 +2. 在数æ®å¤‡ä»½é…置页é¢ä¸­å¯ä»¥é…ç½®ä¸‰ä¸ªå‚æ•°ï¼š + - 备份周期:必填项,é…ç½®æ¯æ¬¡æ‰§è¡Œæ•°æ®å¤‡ä»½çš„æ—¶é—´é—´éš”,å¯é€šè¿‡ä¸‹æ‹‰æ¡†é€‰æ‹©æ¯å¤©ã€æ¯ 7 å¤©ã€æ¯ 30 天执行一次数æ®å¤‡ä»½ï¼Œé…ç½®åŽï¼Œä¼šåœ¨å¯¹åº”的备份周期的0:00æ—¶å¯åŠ¨ä¸€æ¬¡æ•°æ®å¤‡ä»½ä»»åŠ¡ï¼› + - æ•°æ®åº“:必填项,é…置需è¦å¤‡ä»½çš„æ•°æ®åº“å(数æ®åº“çš„ wal_retention_period 傿•°éœ€å¤§äºŽ0); + - 目录:必填项,é…置将数æ®å¤‡ä»½åˆ° taosX 所在è¿è¡ŒçŽ¯å¢ƒä¸­æŒ‡å®šçš„è·¯å¾„ä¸‹ï¼Œå¦‚ /root/data_backupï¼› +3. 点击ã€ç¡®å®šã€‘,å¯åˆ›å»ºæ•°æ®å¤‡ä»½ä»»åŠ¡ã€‚ + +### 从本地文件æ¢å¤ + +1. å®Œæˆæ•°æ®å¤‡ä»½ä»»åŠ¡åˆ›å»ºåŽï¼Œåœ¨é¡µé¢ä¸­å¯¹åº”的数æ®å¤‡ä»½ä»»åŠ¡å³ä¾§ç‚¹å‡»ã€æ•°æ®æ¢å¤ã€‘,å¯å°†å·²ç»å¤‡ä»½åˆ°æŒ‡å®šè·¯å¾„ä¸‹çš„æ•°æ®æ¢å¤åˆ°å½“å‰ TDengine 中。 \ No newline at end of file From 1aa20c96e105d696902a1ea888cc90985e9af556 Mon Sep 17 00:00:00 2001 From: Wade Zhang Date: Fri, 25 Aug 2023 19:58:03 +0800 Subject: [PATCH 087/107] doc: fix broken links --- docs/zh/17-operation/09-storage.md | 4 ++++ docs/zh/18-data-transfer/02-explorer.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/zh/17-operation/09-storage.md b/docs/zh/17-operation/09-storage.md index f6cdb347b4..ca3f3af49b 100644 --- a/docs/zh/17-operation/09-storage.md +++ b/docs/zh/17-operation/09-storage.md @@ -50,3 +50,7 @@ dataDir /mnt/data6 2 0 åœ¨å¤šçº§å­˜å‚¨ä¸­ï¼Œæœ‰ä¸”åªæœ‰ä¸€ä¸ªä¸»æŒ‚载点,主挂载点承担了系统中最é‡è¦çš„元数æ®åœ¨åº§ï¼ŒåŒæ—¶å„个 vnode 的主目录å‡å­˜åœ¨äºŽå½“å‰ dnode 主挂载点上,从而导致该 dnode 的写入性能å—é™äºŽå•个ç£ç›˜çš„ IO åžå能力。 从 TDengine 3.1.0.0 开始,如果一个 dnode é…置了多个 0 级挂载点,我们将该 dnode 上所有 vnode 的主目录å‡è¡¡åˆ†å¸ƒåœ¨æ‰€æœ‰çš„ 0 级挂载点上,由这些 0 çº§æŒ‚è½½ç‚¹å…±åŒæ‰¿æ‹…写入负è·ã€‚在网络 I/O åŠå…¶å®ƒå¤„ç†èµ„æºä¸æˆä¸ºç“¶é¢ˆçš„æƒ…况下,通过优化集群é…ç½®ï¼Œæµ‹è¯•ç»“æžœè¯æ˜Žæ•´ä¸ªç³»ç»Ÿçš„写入能力和 0 级挂载点的数é‡å‘ˆçŽ°çº¿æ€§å…³ç³»ï¼Œå³éšç€ 0 级挂载点数é‡çš„增加,整个系统的写入能力也æˆå€å¢žåŠ ã€‚ + +## åŒçº§æŒ‚载点选择策略 + +一般情况下,当 TDengine è¦ä»ŽåŒçº§æŒ‚è½½ç‚¹ä¸­é€‰æ‹©ä¸€ä¸ªç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶æ—¶ï¼Œé‡‡ç”¨ round robin 策略进行选择。但现实中有å¯èƒ½æ¯ä¸ªç£ç›˜çš„容é‡ä¸ç›¸åŒï¼Œæˆ–者容é‡ç›¸åŒä½†å†™å…¥çš„æ•°æ®é‡ä¸ç›¸åŒï¼Œè¿™å°±å¯¼è‡´ä¼šå‡ºçްæ¯ä¸ªç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´ä¸å‡è¡¡ï¼Œåœ¨å®žé™…进行选择时有å¯èƒ½ä¼šé€‰æ‹©åˆ°ä¸€ä¸ªå‰©ä½™ç©ºé—´å·²ç»å¾ˆå°çš„ç£ç›˜ã€‚为了解决这个问题,从 3.1.1.0 开始引入了一个新的é…ç½® `minDiskFreeSize`,当æŸå—ç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´å°äºŽç­‰äºŽè¿™ä¸ªé˜ˆå€¼æ—¶ï¼Œè¯¥ç£ç›˜å°†ä¸å†è¢«é€‰æ‹©ç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶ã€‚该é…置项的å•ä½ä¸ºå­—节,其值应该大于 `minimalDataDirGB` \ No newline at end of file diff --git a/docs/zh/18-data-transfer/02-explorer.md b/docs/zh/18-data-transfer/02-explorer.md index 6d410c4997..0bc0a0f559 100644 --- a/docs/zh/18-data-transfer/02-explorer.md +++ b/docs/zh/18-data-transfer/02-explorer.md @@ -2,7 +2,7 @@ title: 基于å¯è§†åŒ–界é¢çš„æ•°æ®è¿ç§» --- -本节讲述使用 taos Explorer çš„å¯è§†åŒ–界é¢è¿›è¡Œæ•°æ®è¿ç§»ï¼Œä½¿ç”¨æ­¤åŠŸèƒ½éœ€è¦ä¾èµ– taosd, taosAdapter, taosX, taos-explorer 等几个æœåŠ¡ç»„ä»¶ã€‚å…³äºŽ taosd å’Œ taosAdapter 的部署请å‚考 [系统部署](../../deployment/deploy),[taosX](../taosX)ï¼Œä»¥åŠ [部署 taos-explorer](../../operation/explorer) +本节讲述使用 taos Explorer çš„å¯è§†åŒ–界é¢è¿›è¡Œæ•°æ®è¿ç§»ï¼Œä½¿ç”¨æ­¤åŠŸèƒ½éœ€è¦ä¾èµ– taosd, taosAdapter, taosX, taos-explorer 等几个æœåŠ¡ç»„ä»¶ã€‚å…³äºŽ taosd å’Œ taosAdapter 的部署请å‚考 [系统部署](../../deployment/deploy),[taosX](../taosX)ï¼Œä»¥åŠ [部署 taos-explorer](../../operation/web) ## åŠŸèƒ½å…¥å£ From 9dc7fe051d94e54ef9cbfe970f2d097ca972b48e Mon Sep 17 00:00:00 2001 From: Wade Zhang Date: Fri, 25 Aug 2023 20:19:15 +0800 Subject: [PATCH 088/107] doc: refine enterprise --- docs/zh/17-operation/08-web.md | 4 ++-- docs/zh/17-operation/09-storage.md | 2 +- docs/zh/18-data-transfer/index.md | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 docs/zh/18-data-transfer/index.md diff --git a/docs/zh/17-operation/08-web.md b/docs/zh/17-operation/08-web.md index 9923c9912e..6560bb979f 100644 --- a/docs/zh/17-operation/08-web.md +++ b/docs/zh/17-operation/08-web.md @@ -1,6 +1,6 @@ --- -title: 基于 Web 的系统管ç†å·¥å…· -description: 本节æè¿° TDengine 的图形化管ç†å·¥å…·ï¼Œ taos-explorer, 的基本功能 +title: Web 管ç†å·¥å…· +description: 基于 Web 的系统管ç†å·¥å…· --- ## 简介 diff --git a/docs/zh/17-operation/09-storage.md b/docs/zh/17-operation/09-storage.md index ca3f3af49b..018525861b 100644 --- a/docs/zh/17-operation/09-storage.md +++ b/docs/zh/17-operation/09-storage.md @@ -53,4 +53,4 @@ dataDir /mnt/data6 2 0 ## åŒçº§æŒ‚载点选择策略 -一般情况下,当 TDengine è¦ä»ŽåŒçº§æŒ‚è½½ç‚¹ä¸­é€‰æ‹©ä¸€ä¸ªç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶æ—¶ï¼Œé‡‡ç”¨ round robin 策略进行选择。但现实中有å¯èƒ½æ¯ä¸ªç£ç›˜çš„容é‡ä¸ç›¸åŒï¼Œæˆ–者容é‡ç›¸åŒä½†å†™å…¥çš„æ•°æ®é‡ä¸ç›¸åŒï¼Œè¿™å°±å¯¼è‡´ä¼šå‡ºçްæ¯ä¸ªç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´ä¸å‡è¡¡ï¼Œåœ¨å®žé™…进行选择时有å¯èƒ½ä¼šé€‰æ‹©åˆ°ä¸€ä¸ªå‰©ä½™ç©ºé—´å·²ç»å¾ˆå°çš„ç£ç›˜ã€‚为了解决这个问题,从 3.1.1.0 开始引入了一个新的é…ç½® `minDiskFreeSize`,当æŸå—ç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´å°äºŽç­‰äºŽè¿™ä¸ªé˜ˆå€¼æ—¶ï¼Œè¯¥ç£ç›˜å°†ä¸å†è¢«é€‰æ‹©ç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶ã€‚该é…置项的å•ä½ä¸ºå­—节,其值应该大于 `minimalDataDirGB` \ No newline at end of file +一般情况下,当 TDengine è¦ä»ŽåŒçº§æŒ‚è½½ç‚¹ä¸­é€‰æ‹©ä¸€ä¸ªç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶æ—¶ï¼Œé‡‡ç”¨ round robin 策略进行选择。但现实中有å¯èƒ½æ¯ä¸ªç£ç›˜çš„容é‡ä¸ç›¸åŒï¼Œæˆ–者容é‡ç›¸åŒä½†å†™å…¥çš„æ•°æ®é‡ä¸ç›¸åŒï¼Œè¿™å°±å¯¼è‡´ä¼šå‡ºçްæ¯ä¸ªç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´ä¸å‡è¡¡ï¼Œåœ¨å®žé™…进行选择时有å¯èƒ½ä¼šé€‰æ‹©åˆ°ä¸€ä¸ªå‰©ä½™ç©ºé—´å·²ç»å¾ˆå°çš„ç£ç›˜ã€‚为了解决这个问题,从 3.1.1.0 开始引入了一个新的é…ç½® `minDiskFreeSize`,当æŸå—ç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´å°äºŽç­‰äºŽè¿™ä¸ªé˜ˆå€¼æ—¶ï¼Œè¯¥ç£ç›˜å°†ä¸å†è¢«é€‰æ‹©ç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶ã€‚该é…置项的å•ä½ä¸ºå­—节,其值应该大于 2GB,å³ä¼šè·³è¿‡å¯ç”¨ç©ºé—´å°äºŽ 2GB 的挂载点。 \ No newline at end of file diff --git a/docs/zh/18-data-transfer/index.md b/docs/zh/18-data-transfer/index.md new file mode 100644 index 0000000000..749ad16308 --- /dev/null +++ b/docs/zh/18-data-transfer/index.md @@ -0,0 +1,3 @@ +--- +title: æ•°æ®é›†æˆ +--- \ No newline at end of file From 4f52ae097fe14e1f36236446ae51522ff9f6293a Mon Sep 17 00:00:00 2001 From: Wade Zhang Date: Fri, 25 Aug 2023 20:47:32 +0800 Subject: [PATCH 089/107] doc: refine enterprise --- docs/zh/17-operation/07-cluster.md | 4 +++- docs/zh/18-data-transfer/02-explorer.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/zh/17-operation/07-cluster.md b/docs/zh/17-operation/07-cluster.md index 0b7fb7e53d..cf4bfafd53 100644 --- a/docs/zh/17-operation/07-cluster.md +++ b/docs/zh/17-operation/07-cluster.md @@ -47,7 +47,9 @@ Rafté€‰ä¸¾æœ¬èº«å¸¦æœ‰éšæœºæ€§ï¼Œæ‰€ä»¥é€šè¿‡é€‰ä¸¾çš„釿–°åˆ†å¸ƒäº§ç”Ÿçš„å‡ ## æ¢å¤æ•°æ®èŠ‚ç‚¹ -当集群中的æŸä¸ªæ•°æ®èŠ‚ç‚¹ï¼ˆdnode)的数æ®å…¨éƒ¨ä¸¢å¤±æˆ–被破å,比如ç£ç›˜æŸå或者目录被误删除,å¯ä»¥é€šè¿‡ `restore dnode` å‘½ä»¤æ¥æ¢å¤è¯¥æ•°æ®èŠ‚ç‚¹ä¸Šçš„éƒ¨åˆ†æˆ–å…¨éƒ¨é€»è¾‘èŠ‚ç‚¹ï¼Œè¯¥åŠŸèƒ½ä¾èµ–多副本中的其它副本进行数æ®å¤åˆ¶ï¼Œæ‰€ä»¥åªåœ¨é›†ç¾¤ä¸­ dnode æ•°é‡å¤§äºŽç­‰äºŽ 3 且副本数为 3 的情况下能够工作。 +在多节点三副本的集群环境中,如果æŸä¸ª dnode çš„ç£ç›˜æŸå,该 dnode 会自动退出,但集群中其它的 dnode ä»ç„¶èƒ½å¤Ÿç»§ç»­æä¾›å†™å…¥å’ŒæŸ¥è¯¢æœåŠ¡ã€‚ + +在更æ¢äº†æŸåçš„ç£ç›˜åŽï¼Œå¦‚果想è¦è®©æ›¾ç»ä¸»åŠ¨é€€å‡ºçš„ dnode 釿–°åŠ å…¥é›†ç¾¤æä¾›æœåŠ¡ï¼Œå¯ä»¥é€šè¿‡ `restore dnode` å‘½ä»¤æ¥æ¢å¤è¯¥æ•°æ®èŠ‚ç‚¹ä¸Šçš„éƒ¨åˆ†æˆ–å…¨éƒ¨é€»è¾‘èŠ‚ç‚¹ï¼Œè¯¥åŠŸèƒ½ä¾èµ–多副本中的其它副本进行数æ®å¤åˆ¶ï¼Œæ‰€ä»¥åªåœ¨é›†ç¾¤ä¸­ dnode æ•°é‡å¤§äºŽç­‰äºŽ 3 且副本数为 3 的情况下能够工作。 ```sql diff --git a/docs/zh/18-data-transfer/02-explorer.md b/docs/zh/18-data-transfer/02-explorer.md index 0bc0a0f559..fd374cc734 100644 --- a/docs/zh/18-data-transfer/02-explorer.md +++ b/docs/zh/18-data-transfer/02-explorer.md @@ -1,5 +1,5 @@ --- -title: 基于å¯è§†åŒ–界é¢çš„æ•°æ®è¿ç§» +title: 基于å¯è§†åŒ–界é¢çš„æ•°æ®æŽ¥å…¥å’Œæ•°æ®è¿ç§» --- 本节讲述使用 taos Explorer çš„å¯è§†åŒ–界é¢è¿›è¡Œæ•°æ®è¿ç§»ï¼Œä½¿ç”¨æ­¤åŠŸèƒ½éœ€è¦ä¾èµ– taosd, taosAdapter, taosX, taos-explorer 等几个æœåŠ¡ç»„ä»¶ã€‚å…³äºŽ taosd å’Œ taosAdapter 的部署请å‚考 [系统部署](../../deployment/deploy),[taosX](../taosX)ï¼Œä»¥åŠ [部署 taos-explorer](../../operation/web) From cf417eb31dd42f696b7d12bee91ecc1fb3502544 Mon Sep 17 00:00:00 2001 From: Wade Zhang Date: Fri, 25 Aug 2023 21:00:03 +0800 Subject: [PATCH 090/107] doc: add product description and links --- docs/zh/02-intro.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/zh/02-intro.md b/docs/zh/02-intro.md index 888f779966..68a2541717 100644 --- a/docs/zh/02-intro.md +++ b/docs/zh/02-intro.md @@ -6,7 +6,14 @@ toc_max_heading_level: 2 TDengine 是一款开æºã€é«˜æ€§èƒ½ã€äº‘原生的[æ—¶åºæ•°æ®åº“](https://tdengine.com/tsdb/),且针对物è”网ã€è½¦è”网ã€å·¥ä¸šäº’è”网ã€é‡‘èžã€IT è¿ç»´ç­‰åœºæ™¯è¿›è¡Œäº†ä¼˜åŒ–。TDengine 的代ç ï¼ŒåŒ…括集群功能,都在 GNU AGPL v3.0 下开æºã€‚é™¤æ ¸å¿ƒçš„æ—¶åºæ•°æ®åº“功能外,TDengine 还æä¾›[缓存](../develop/cache/)ã€[æ•°æ®è®¢é˜…](../develop/tmq)ã€[æµå¼è®¡ç®—](../develop/stream)等其它功能以é™ä½Žç³»ç»Ÿå¤æ‚度åŠç ”å‘å’Œè¿ç»´æˆæœ¬ã€‚ -æœ¬ç« èŠ‚ä»‹ç» TDengine 的主è¦åŠŸèƒ½ã€ç«žäº‰ä¼˜åŠ¿ã€é€‚用场景ã€ä¸Žå…¶ä»–æ•°æ®åº“的对比测试等等,让大家对 TDengine 有个整体的了解。 +æœ¬ç« èŠ‚ä»‹ç» TDengine 的主è¦äº§å“和功能ã€ç«žäº‰ä¼˜åŠ¿ã€é€‚用场景ã€ä¸Žå…¶ä»–æ•°æ®åº“的对比测试等等,让大家对 TDengine 有个整体的了解。 + +## 主è¦äº§å“ + +TDengine 有三个主è¦äº§å“:TDengine Pro ï¼ˆå³ TDengine ä¼ä¸šç‰ˆï¼‰ï¼ŒTDengine Cloud,和 TDengine OSS,关于它们的具体定义请å‚考 +- [TDengine ä¼ä¸šç‰ˆ](https://www.taosdata.com/tdengine-pro) +- [TDengine 云æœåŠ¡](https://cloud.taosdata.com/?utm_source=menu&utm_medium=webcn) +- [TDengine å¼€æºç‰ˆ](https://www.taosdata.com/tdengine-oss) ## 主è¦åŠŸèƒ½ From e59536181c9b5111f49cae82e2964c560778a494 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 25 Aug 2023 22:21:33 +0800 Subject: [PATCH 091/107] fix:bytes error --- source/libs/parser/src/parTranslater.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index fe15e62f9b..ad3cfe32c1 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1329,9 +1329,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD res = translateNormalValue(pCxt, pVal, targetDt, strict); } pVal->node.resType.type = targetDt.type; - if( targetDt.type == TSDB_DATA_TYPE_VARBINARY || !strict){ - pVal->node.resType.bytes = targetDt.bytes; - } + pVal->node.resType.bytes = targetDt.bytes; pVal->node.resType.scale = pVal->unit; pVal->translate = true; if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) { From 438b5a521411d2dc5ec59996f365810ece1e8ab0 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 26 Aug 2023 00:44:42 +0800 Subject: [PATCH 092/107] fix:disable varbianry test cases --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index e4303b2e15..53b2e7acd9 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -351,7 +351,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/smaTest.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/sma_index.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml_TS-3724.py -,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/varbinary.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/varbinary.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/spread.py From 1bf2c3421dc5901f8883874355313a60bce6964d Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sun, 27 Aug 2023 00:05:44 +0800 Subject: [PATCH 093/107] docs: kill query command need quote around id (#22588) * docs: add current_user() in function * docs: kill query command need quote around id --- docs/en/12-taos-sql/28-recovery.md | 2 +- docs/zh/12-taos-sql/28-recovery.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/12-taos-sql/28-recovery.md b/docs/en/12-taos-sql/28-recovery.md index b4da25ea0c..1c1838f616 100644 --- a/docs/en/12-taos-sql/28-recovery.md +++ b/docs/en/12-taos-sql/28-recovery.md @@ -17,7 +17,7 @@ You can use the SHOW CONNECTIONS statement to find the conn_id. ## Terminate a Query ```sql -KILL QUERY kill_id; +KILL QUERY 'kill_id'; ``` You can use the SHOW QUERIES statement to find the kill_id. diff --git a/docs/zh/12-taos-sql/28-recovery.md b/docs/zh/12-taos-sql/28-recovery.md index b5088e7982..8e327afe0b 100644 --- a/docs/zh/12-taos-sql/28-recovery.md +++ b/docs/zh/12-taos-sql/28-recovery.md @@ -17,7 +17,7 @@ conn_id å¯ä»¥é€šè¿‡ `SHOW CONNECTIONS` 获å–。 ## 终止查询 ```sql -KILL QUERY kill_id; +KILL QUERY 'kill_id'; ``` kill_id å¯ä»¥é€šè¿‡ `SHOW QUERIES` 获å–。 From 06083e1eb9a344ea79d850f71a66d5f7ba718b13 Mon Sep 17 00:00:00 2001 From: dmchen Date: Mon, 28 Aug 2023 09:15:51 +0800 Subject: [PATCH 094/107] init --- include/common/tglobal.h | 5 +++ include/common/tmsg.h | 44 +++++++++++++++++++++++ include/libs/audit/audit.h | 46 ++++++++++++++++++++++++ source/common/src/tglobal.c | 13 +++++++ source/dnode/mgmt/node_mgmt/src/dmEnv.c | 20 +++++++++++ source/dnode/mnode/impl/CMakeLists.txt | 2 +- source/dnode/mnode/impl/src/mndDb.c | 9 +++++ source/dnode/mnode/impl/src/mndDnode.c | 21 +++++++++++ source/dnode/mnode/impl/src/mndMnode.c | 15 ++++++++ source/dnode/mnode/impl/src/mndProfile.c | 11 ++++++ source/dnode/mnode/impl/src/mndQnode.c | 10 ++++++ source/dnode/mnode/impl/src/mndStb.c | 7 ++++ source/dnode/mnode/impl/src/mndStream.c | 5 +++ source/dnode/mnode/impl/src/mndTopic.c | 5 +++ source/dnode/mnode/impl/src/mndUser.c | 26 ++++++++++++++ source/dnode/mnode/impl/src/mndVgroup.c | 8 +++++ source/dnode/vnode/CMakeLists.txt | 1 + source/dnode/vnode/src/vnd/vnodeSvr.c | 5 +++ source/libs/CMakeLists.txt | 1 + source/libs/audit/CMakeLists.txt | 13 +++++++ source/libs/audit/inc/auditInt.h | 25 +++++++++++++ source/libs/audit/src/auditMain.c | 43 ++++++++++++++++++++++ 22 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 include/libs/audit/audit.h create mode 100644 source/libs/audit/CMakeLists.txt create mode 100644 source/libs/audit/inc/auditInt.h create mode 100644 source/libs/audit/src/auditMain.c diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 3de291cb91..aff5945f9f 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -102,6 +102,11 @@ extern uint16_t tsMonitorPort; extern int32_t tsMonitorMaxLogs; extern bool tsMonitorComp; +// audit +extern bool tsEnableAudit; +extern char tsAuditFqdn[]; +extern uint16_t tsAuditPort; + // telem extern bool tsEnableTelem; extern int32_t tsTelemInterval; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 8deec53470..42a0549024 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -767,6 +767,8 @@ typedef struct { char* pAst2; int64_t deleteMark1; int64_t deleteMark2; + int32_t sqlLen; + char* sql; } SMCreateStbReq; int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq); @@ -787,6 +789,8 @@ typedef struct { int8_t source; // 1-taosX or 0-taosClient int8_t reserved[6]; tb_uid_t suid; + int32_t sqlLen; + char* sql; } SMDropStbReq; int32_t tSerializeSMDropStbReq(void* buf, int32_t bufLen, SMDropStbReq* pReq); @@ -800,6 +804,8 @@ typedef struct { int32_t ttl; int32_t commentLen; char* comment; + int32_t sqlLen; + char* sql; } SMAlterStbReq; int32_t tSerializeSMAlterStbReq(void* buf, int32_t bufLen, SMAlterStbReq* pReq); @@ -869,6 +875,8 @@ int32_t tDeserializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pR typedef struct { char user[TSDB_USER_LEN]; + int32_t sqlLen; + char *sql; } SDropUserReq, SDropAcctReq; int32_t tSerializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq); @@ -881,6 +889,8 @@ typedef struct { int8_t enable; char user[TSDB_USER_LEN]; char pass[TSDB_USET_PASSWORD_LEN]; + int32_t sqlLen; + char* sql; } SCreateUserReq; int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq); @@ -897,6 +907,8 @@ typedef struct { char tabName[TSDB_TABLE_NAME_LEN]; char* tagCond; int32_t tagCondLen; + int32_t sqlLen; + char* sql; } SAlterUserReq; int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq); @@ -1059,6 +1071,8 @@ typedef struct { int16_t hashPrefix; int16_t hashSuffix; int32_t tsdbPageSize; + int32_t sqlLen; + char* sql; } SCreateDbReq; int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq); @@ -1084,6 +1098,8 @@ typedef struct { int32_t minRows; int32_t walRetentionPeriod; int32_t walRetentionSize; + int32_t sqlLen; + char* sql; } SAlterDbReq; int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); @@ -1092,6 +1108,8 @@ int32_t tDeserializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); typedef struct { char db[TSDB_DB_FNAME_LEN]; int8_t ignoreNotExists; + int32_t sqlLen; + char* sql; } SDropDbReq; int32_t tSerializeSDropDbReq(void* buf, int32_t bufLen, SDropDbReq* pReq); @@ -1289,6 +1307,8 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp); typedef struct { char db[TSDB_DB_FNAME_LEN]; STimeWindow timeRange; + int32_t sqlLen; + char* sql; } SCompactDbReq; int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq); @@ -1852,6 +1872,8 @@ void tFreeSExplainRsp(SExplainRsp* pRsp); typedef struct { char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port int32_t port; + int32_t sqlLen; + char* sql; } SCreateDnodeReq; int32_t tSerializeSCreateDnodeReq(void* buf, int32_t bufLen, SCreateDnodeReq* pReq); @@ -1863,6 +1885,8 @@ typedef struct { int32_t port; int8_t force; int8_t unsafe; + int32_t sqlLen; + char* sql; } SDropDnodeReq; int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq); @@ -1878,6 +1902,8 @@ enum { typedef struct { int32_t dnodeId; int8_t restoreType; + int32_t sqlLen; + char* sql; } SRestoreDnodeReq; int32_t tSerializeSRestoreDnodeReq(void* buf, int32_t bufLen, SRestoreDnodeReq* pReq); @@ -1887,6 +1913,8 @@ typedef struct { int32_t dnodeId; char config[TSDB_DNODE_CONFIG_LEN]; char value[TSDB_DNODE_VALUE_LEN]; + int32_t sqlLen; + char* sql; } SMCfgDnodeReq; int32_t tSerializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq); @@ -1902,6 +1930,8 @@ int32_t tDeserializeSDCfgDnodeReq(void* buf, int32_t bufLen, SDCfgDnodeReq* pReq typedef struct { int32_t dnodeId; + int32_t sqlLen; + char *sql; } SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq, SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, SMCreateSnodeReq, SMDropSnodeReq, SDCreateSnodeReq, SDDropSnodeReq; @@ -1942,6 +1972,8 @@ int32_t tDeserializeSKillTransReq(void* buf, int32_t bufLen, SKillTransReq* pReq typedef struct { int32_t useless; // useless + int32_t sqlLen; + char* sql; } SBalanceVgroupReq; int32_t tSerializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq* pReq); @@ -1960,6 +1992,8 @@ typedef struct { int32_t dnodeId1; int32_t dnodeId2; int32_t dnodeId3; + int32_t sqlLen; + char* sql; } SRedistributeVgroupReq; int32_t tSerializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistributeVgroupReq* pReq); @@ -1967,6 +2001,8 @@ int32_t tDeserializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistrib typedef struct { int32_t useless; + int32_t sqlLen; + char* sql; } SBalanceVgroupLeaderReq; int32_t tSerializeSBalanceVgroupLeaderReq(void* buf, int32_t bufLen, SBalanceVgroupLeaderReq* pReq); @@ -2226,6 +2262,7 @@ typedef struct { int64_t deleteMark; int8_t igUpdate; int64_t lastTs; + int32_t sqlLen; } SCMCreateStreamReq; typedef struct { @@ -2262,6 +2299,7 @@ typedef struct { char subDbName[TSDB_DB_FNAME_LEN]; char* ast; char subStbName[TSDB_TABLE_FNAME_LEN]; + int32_t sqlLen; } SCMCreateTopicReq; int32_t tSerializeSCMCreateTopicReq(void* buf, int32_t bufLen, const SCMCreateTopicReq* pReq); @@ -2446,6 +2484,8 @@ typedef struct { typedef struct { char name[TSDB_TOPIC_FNAME_LEN]; int8_t igNotExists; + int32_t sqlLen; + char* sql; } SMDropTopicReq; int32_t tSerializeSMDropTopicReq(void* buf, int32_t bufLen, SMDropTopicReq* pReq); @@ -2545,6 +2585,8 @@ typedef struct SVCreateTbReq { SSchemaWrapper schemaRow; } ntb; }; + int32_t sqlLen; + char* sql; } SVCreateTbReq; int tEncodeSVCreateTbReq(SEncoder* pCoder, const SVCreateTbReq* pReq); @@ -3019,6 +3061,8 @@ typedef struct { typedef struct { char name[TSDB_STREAM_FNAME_LEN]; int8_t igNotExists; + int32_t sqlLen; + char* sql; } SMDropStreamReq; typedef struct { diff --git a/include/libs/audit/audit.h b/include/libs/audit/audit.h new file mode 100644 index 0000000000..1381b6e4a2 --- /dev/null +++ b/include/libs/audit/audit.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_AUDIT_H_ +#define _TD_AUDIT_H_ + +#include "tarray.h" +#include "tdef.h" +#include "tlog.h" +#include "tmsg.h" +#include "tjson.h" +#include "tmsgcb.h" +#include "trpc.h" +#include "mnode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + const char *server; + uint16_t port; + bool comp; +} SAuditCfg; + +int32_t auditInit(const SAuditCfg *pCfg); +void auditSend(SJson *pJson); +void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_MONITOR_H_*/ diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 86a165f14a..e2074bd877 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -95,6 +95,11 @@ uint16_t tsMonitorPort = 6043; int32_t tsMonitorMaxLogs = 100; bool tsMonitorComp = false; +// audit +bool tsEnableAudit = false; +char tsAuditFqdn[TSDB_FQDN_LEN] = {0}; +uint16_t tsAuditPort = 6043; + // telem bool tsEnableTelem = true; int32_t tsTelemInterval = 43200; @@ -600,6 +605,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "monitorMaxLogs", tsMonitorMaxLogs, 1, 1000000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddBool(pCfg, "monitorComp", tsMonitorComp, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddBool(pCfg, "audit", tsEnableAudit, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddString(pCfg, "auditFqdn", tsAuditFqdn, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "auditPort", tsAuditPort, 1, 65056, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_BOTH) != 0) return -1; if (cfgAddBool(pCfg, "telemetryReporting", tsEnableTelem, CFG_SCOPE_BOTH) != 0) return -1; if (cfgAddInt32(pCfg, "telemetryInterval", tsTelemInterval, 1, 200000, CFG_SCOPE_BOTH) != 0) return -1; @@ -1001,6 +1010,10 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsMonitorComp = cfgGetItem(pCfg, "monitorComp")->bval; tsQueryRspPolicy = cfgGetItem(pCfg, "queryRspPolicy")->i32; + tsEnableAudit = cfgGetItem(pCfg, "audit")->bval; + tstrncpy(tsAuditFqdn, cfgGetItem(pCfg, "auditFqdn")->str, TSDB_FQDN_LEN); + tsAuditPort = (uint16_t)cfgGetItem(pCfg, "auditPort")->i32; + tsEnableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval; tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval; tsTtlChangeOnWrite = cfgGetItem(pCfg, "ttlChangeOnWrite")->bval; diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index a34002161d..320c9db37d 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "dmMgmt.h" +#include "audit.h" #define STR_CASE_CMP(s, d) (0 == strcasecmp((s), (d))) #define STR_STR_CMP(s, d) (strstr((s), (d))) @@ -34,6 +35,16 @@ } \ } while (0) +#define DM_INIT_AUDIT() \ + do { \ + auditCfg.port = tsMonitorPort; \ + auditCfg.server = tsMonitorFqdn; \ + auditCfg.comp = tsMonitorComp; \ + if (auditInit(&auditCfg) != 0) { \ + return -1; \ + } \ + } while (0) + #define DM_ERR_RTN(c) \ do { \ code = (c); \ @@ -96,6 +107,14 @@ _exit: return code; } +static int32_t dmInitAudit() { + SAuditCfg auditCfg = {0}; + + DM_INIT_AUDIT(); + + return 0; +} + static bool dmDataSpaceAvailable() { SDnode *pDnode = dmInstance(); if (pDnode->pTfs) { @@ -176,6 +195,7 @@ int32_t dmInit() { if (dmCheckRepeatInit(dmInstance()) != 0) return -1; if (dmInitSystem() != 0) return -1; if (dmInitMonitor() != 0) return -1; + if (dmInitAudit() != 0) return -1; if (dmInitDnode(dmInstance()) != 0) return -1; dInfo("dnode env is initialized"); diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 010067e99f..48dc71a12b 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -16,7 +16,7 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser + mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser audit ) IF (TD_GRANT) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index b0e3dc4331..c58df5c88c 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -29,6 +29,9 @@ #include "mndUser.h" #include "mndVgroup.h" #include "systable.h" +#include "tjson.h" +#include "thttp.h" +#include "audit.h" #define DB_VER_NUMBER 1 #define DB_RESERVE_SIZE 46 @@ -733,6 +736,8 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { code = mndCreateDb(pMnode, pReq, &createReq, pUser); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createDB", createReq.db, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("db:%s, failed to create since %s", createReq.db, terrstr()); @@ -975,6 +980,8 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; } + auditRecord(pReq, pMnode->clusterId, "alterDB", alterReq.db, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { if (terrno != 0) code = terrno; @@ -1264,6 +1271,8 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) { code = TSDB_CODE_ACTION_IN_PROGRESS; } + auditRecord(pReq, pMnode->clusterId, "dropDB", dropReq.db, "", ""); + _OVER: if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("db:%s, failed to drop since %s", dropReq.db, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 917c6a00bc..476d4a4c6e 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -26,6 +26,7 @@ #include "mndVgroup.h" #include "tmisce.h" #include "mndCluster.h" +#include "audit.h" #define TSDB_DNODE_VER_NUMBER 2 #define TSDB_DNODE_RESERVE_SIZE 64 @@ -907,6 +908,13 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) { code = mndCreateDnode(pMnode, pReq, &createReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; tsGrantHBInterval = 5; + + char detail[1000] = {0}; + sprintf(detail, "%s:%d", + createReq.fqdn, createReq.port); + + auditRecord(pReq, pMnode->clusterId, "createDnode", detail, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("dnode:%s:%d, failed to create since %s", createReq.fqdn, createReq.port, terrstr()); @@ -1054,6 +1062,14 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes, force, dropReq.unsafe); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj1[150] = {0}; + sprintf(obj1, "%s:%d", dropReq.fqdn, dropReq.port); + + char obj2[10] = {0}; + sprintf(obj2, "%d", dropReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "dropDnode", obj1, obj2, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("dnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); @@ -1217,6 +1233,11 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { } } + char detail[50] = {0}; + sprintf(detail, "%d", cfgReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "alterDnode", detail, "", ""); + int32_t code = -1; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 2757578d35..8b9deb3988 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -22,6 +22,7 @@ #include "mndSync.h" #include "mndTrans.h" #include "tmisce.h" +#include "audit.h" #define MNODE_VER_NUMBER 2 #define MNODE_RESERVE_SIZE 64 @@ -652,6 +653,15 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) { code = mndCreateMnode(pMnode, pReq, pDnode, &createReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char detail[1000] = {0}; + + char obj[20] = {0}; + sprintf(obj, "%d", createReq.dnodeId); + + sprintf(detail, "dnodeId:%d", createReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "createMnode", obj, detail, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("mnode:%d, failed to create since %s", createReq.dnodeId, terrstr()); @@ -788,6 +798,11 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) { code = mndDropMnode(pMnode, pReq, pObj); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[20] = {0}; + sprintf(obj, "%d", dropReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "dropMnode", obj, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("mnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 524ea1a06b..db1546e33f 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -25,6 +25,7 @@ #include "mndUser.h" #include "tglobal.h" #include "tversion.h" +#include "audit.h" typedef struct { uint32_t id; @@ -308,6 +309,16 @@ _CONNECT: code = 0; + char detail[1000] = {0}; + + char obj[30] = {0}; + sprintf(obj, "%s:%d", ip, pConn->port); + + sprintf(detail, "user:%s, from:%s, connType%d", + connReq.user, obj, connReq.connType); + + auditRecord(pReq, pMnode->clusterId, "login", connReq.app, obj, detail); + _OVER: mndReleaseUser(pMnode, pUser); diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index 5ec81440bb..45efabe97d 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -20,6 +20,7 @@ #include "mndShow.h" #include "mndTrans.h" #include "mndUser.h" +#include "audit.h" #define QNODE_VER_NUMBER 1 #define QNODE_RESERVE_SIZE 64 @@ -306,6 +307,10 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) { code = mndCreateQnode(pMnode, pReq, pDnode, &createReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[33] = {0}; + sprintf(obj, "%d", createReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "createQnode", obj, "", ""); _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr()); @@ -415,6 +420,11 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) { code = mndDropQnode(pMnode, pReq, pObj); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[33] = {0}; + sprintf(obj, "%d", dropReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "createQnode", obj, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index f52ce6582b..3d4e6a9061 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -31,6 +31,7 @@ #include "mndUser.h" #include "mndVgroup.h" #include "tname.h" +#include "audit.h" #define STB_VER_NUMBER 1 #define STB_RESERVE_SIZE 64 @@ -1173,6 +1174,8 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { } if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createStb", pDb->name, createReq.name, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stb:%s, failed to create since %s", createReq.name, terrstr()); @@ -2241,6 +2244,8 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) { code = mndAlterStb(pMnode, pReq, &alterReq, pDb, pStb); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "alterStb", pDb->name, alterReq.name, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stb:%s, failed to alter since %s", alterReq.name, terrstr()); @@ -2502,6 +2507,8 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) { code = mndDropStb(pMnode, pReq, pDb, pStb); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "dropStb", pDb->name, dropReq.name, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stb:%s, failed to drop since %s", dropReq.name, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 427a52af3b..063a5bdce1 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -27,6 +27,7 @@ #include "mndVgroup.h" #include "parser.h" #include "tname.h" +#include "audit.h" #define MND_STREAM_VER_NUMBER 3 #define MND_STREAM_RESERVE_SIZE 64 @@ -828,6 +829,8 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createStream", createStreamReq.name, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); @@ -1073,6 +1076,8 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { return -1; } + auditRecord(pReq, pMnode->clusterId, "dropStream", dropReq.name, "", ""); + sdbRelease(pMnode->pSdb, pStream); mndTransDrop(pTrans); diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 621a80338d..b7089053a8 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -27,6 +27,7 @@ #include "mndVgroup.h" #include "parser.h" #include "tname.h" +#include "audit.h" #define MND_TOPIC_VER_NUMBER 3 #define MND_TOPIC_RESERVE_SIZE 64 @@ -621,6 +622,8 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) { code = TSDB_CODE_ACTION_IN_PROGRESS; } + auditRecord(pReq, pMnode->clusterId, "crateTopic", createTopicReq.name, createTopicReq.subDbName, createTopicReq.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("failed to create topic:%s since %s", createTopicReq.name, terrstr()); @@ -812,6 +815,8 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) { return -1; } + auditRecord(pReq, pMnode->clusterId, "dropTopic", dropReq.name, "", dropReq.sql); + return TSDB_CODE_ACTION_IN_PROGRESS; } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index c59d23d252..8afc73bef6 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -22,6 +22,7 @@ #include "mndTopic.h" #include "mndTrans.h" #include "tbase64.h" +#include "audit.h" #define USER_VER_NUMBER 4 #define USER_RESERVE_SIZE 64 @@ -655,6 +656,8 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) { code = mndCreateUser(pMnode, pOperUser->acct, &createReq, pReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createUser", createReq.user, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("user:%s, failed to create since %s", createReq.user, terrstr()); @@ -970,6 +973,27 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { code = mndAlterUser(pMnode, pUser, &newUser, pReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + if(alterReq.alterType == TSDB_ALTER_USER_PASSWD){ + auditRecord(pReq, pMnode->clusterId, "changePassword", alterReq.user, alterReq.objname, ""); + } + else if(alterReq.alterType == TSDB_ALTER_USER_SUPERUSER || + alterReq.alterType == TSDB_ALTER_USER_ENABLE || + alterReq.alterType == TSDB_ALTER_USER_SYSINFO){ + auditRecord(pReq, pMnode->clusterId, "alterUser", alterReq.user, alterReq.objname, ""); + } + else if(alterReq.alterType == TSDB_ALTER_USER_ADD_READ_DB|| + alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_DB|| + alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_DB|| + alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC|| + alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE|| + alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE|| + alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE){ + auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.user, alterReq.objname, ""); + } + else{ + auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.user, alterReq.objname, ""); + } + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("user:%s, failed to alter since %s", alterReq.user, terrstr()); @@ -1039,6 +1063,8 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) { code = mndDropUser(pMnode, pReq, pUser); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "dropUser", dropReq.user, "", dropReq.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("user:%s, failed to drop since %s", dropReq.user, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 26dc2a3f87..ff621198ff 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -26,6 +26,7 @@ #include "mndTrans.h" #include "mndUser.h" #include "tmisce.h" +#include "audit.h" #define VGROUP_VER_NUMBER 1 #define VGROUP_RESERVE_SIZE 64 @@ -2171,6 +2172,11 @@ static int32_t mndProcessRedistributeVgroupMsg(SRpcMsg *pReq) { if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[33] = {0}; + sprintf(obj, "%d", req.vgId); + + auditRecord(pReq, pMnode->clusterId, "RedistributeVgroup", obj, "", req.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("vgId:%d, failed to redistribute to dnode %d:%d:%d since %s", req.vgId, req.dnodeId1, req.dnodeId2, @@ -2981,6 +2987,8 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) { code = mndBalanceVgroup(pMnode, pReq, pArray); } + auditRecord(pReq, pMnode->clusterId, "balanceVgroup", "", "", req.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("failed to balance vgroup since %s", terrstr()); diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index c70df86e20..c2b41392e8 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -147,6 +147,7 @@ target_link_libraries( PUBLIC executor PUBLIC scheduler PUBLIC tdb + PUBLIC audit # PUBLIC bdb # PUBLIC scalar diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 737fd03d6f..3687756ffc 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -19,6 +19,7 @@ #include "vndCos.h" #include "vnode.h" #include "vnodeInt.h" +#include "audit.h" static int32_t vnodeProcessCreateStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessAlterStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); @@ -930,6 +931,10 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, } taosArrayPush(rsp.pArray, &cRsp); + + int32_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId; + + auditRecord(pReq, clusterId, "createTable", pVnode->config.dbname, pCreateReq->name, ""); } vDebug("vgId:%d, add %d new created tables into query table list", TD_VID(pVnode), (int32_t)taosArrayGetSize(tbUids)); diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index 4a95629d59..9f812517c1 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(sync) add_subdirectory(qcom) add_subdirectory(nodes) add_subdirectory(catalog) +add_subdirectory(audit) add_subdirectory(scalar) add_subdirectory(function) diff --git a/source/libs/audit/CMakeLists.txt b/source/libs/audit/CMakeLists.txt new file mode 100644 index 0000000000..2a04f084f1 --- /dev/null +++ b/source/libs/audit/CMakeLists.txt @@ -0,0 +1,13 @@ +aux_source_directory(src AUDIT_SRC) +IF (TD_ENTERPRISE) + LIST(APPEND AUDIT_SRC ${TD_ENTERPRISE_DIR}/src/plugins/audit/src/audit.c) +ENDIF () + +add_library(audit STATIC ${AUDIT_SRC}) +target_include_directories( + audit + PUBLIC "${TD_SOURCE_DIR}/include/libs/audit" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + +target_link_libraries(audit os util common transport mnode) diff --git a/source/libs/audit/inc/auditInt.h b/source/libs/audit/inc/auditInt.h new file mode 100644 index 0000000000..b6c6ec87e8 --- /dev/null +++ b/source/libs/audit/inc/auditInt.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_AUDIT_INT_H_ +#define _TD_AUDIT_INT_H_ + +#include "audit.h" + +typedef struct { + SAuditCfg cfg; +} SAudit; + +#endif /*_TD_AUDIT_INT_H_*/ diff --git a/source/libs/audit/src/auditMain.c b/source/libs/audit/src/auditMain.c new file mode 100644 index 0000000000..d4b6465ac7 --- /dev/null +++ b/source/libs/audit/src/auditMain.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#define _DEFAULT_SOURCE +#include "auditInt.h" +#include "taoserror.h" +#include "thttp.h" +#include "ttime.h" +#include "tjson.h" +#include "tglobal.h" +#include "mnode.h" + +SAudit tsAudit = {0}; +char* tsAuditUri = "/audit"; + +int32_t auditInit(const SAuditCfg *pCfg) { + tsAudit.cfg = *pCfg; + return 0; +} + +extern void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail); + +void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail) { + auditRecordImp(pReq, clusterId, operation, target1, target2, detail); +} + +#ifndef TD_ENTERPRISE +void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail) { +} +#endif + From 0c28c9aee8a2198f167aa582d12d55c52ea1461d Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Fri, 25 Aug 2023 18:16:57 +0800 Subject: [PATCH 095/107] feat: dynamic 'supportvnodes' --- source/common/src/tglobal.c | 7 +++++++ source/dnode/mnode/impl/src/mndDnode.c | 21 ++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 86a165f14a..539bb57335 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1646,6 +1646,13 @@ void taosCfgDynamicOptions(const char *option, const char *value) { return; } + if (strcasecmp(option, "supportVnodes") == 0) { + int32_t newSupportVnodes = atoi(value); + uInfo("supportVnodes set from %d to %d", tsNumOfSupportVnodes, newSupportVnodes); + tsNumOfSupportVnodes = newSupportVnodes; + return; + } + const char *options[] = { "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag", "tmrDebugFlag", "uDebugFlag", diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 917c6a00bc..291c2a793b 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -517,7 +517,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { bool online = mndIsDnodeOnline(pDnode, curMs); bool dnodeChanged = (statusReq.dnodeVer == 0) || (statusReq.dnodeVer != dnodeVer); bool reboot = (pDnode->rebootTime != statusReq.rebootTime); - bool needCheck = !online || dnodeChanged || reboot; + bool supportVnodesChanged = pDnode->numOfSupportVnodes != statusReq.numOfSupportVnodes; + bool needCheck = !online || dnodeChanged || reboot || supportVnodesChanged; const STraceId *trace = &pReq->info.traceId; mGTrace("dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d", pDnode->id, @@ -1154,6 +1155,24 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { strcpy(dcfgReq.config, "ttlbatchdropnum"); snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); #ifdef TD_ENTERPRISE + } else if (strncasecmp(cfgReq.config, "supportvnodes", 13) == 0) { + int32_t optLen = strlen("supportvnodes"); + int32_t flag = -1; + int32_t code = mndMCfgGetValInt32(&cfgReq, optLen, &flag); + if (code < 0) return code; + + if (flag < 0 || flag > 4096) { + mError("dnode:%d, failed to config supportVnodes since value:%d. Valid range: [0, 4096]", cfgReq.dnodeId, flag); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + if (flag == 0) { + flag = tsNumOfCores * 2; + } + flag = TMAX(flag, 2); + + strcpy(dcfgReq.config, "supportvnodes"); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); } else if (strncasecmp(cfgReq.config, "activeCode", 10) == 0 || strncasecmp(cfgReq.config, "cActiveCode", 11) == 0) { int8_t opt = strncasecmp(cfgReq.config, "a", 1) == 0 ? DND_ACTIVE_CODE : DND_CONN_ACTIVE_CODE; int8_t index = opt == DND_ACTIVE_CODE ? 10 : 11; From ec6ccc45661775322bd9e8ef4fed1a1906c23c96 Mon Sep 17 00:00:00 2001 From: dmchen Date: Mon, 28 Aug 2023 09:30:54 +0800 Subject: [PATCH 096/107] ci merge --- source/libs/audit/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/audit/CMakeLists.txt b/source/libs/audit/CMakeLists.txt index 2a04f084f1..f04fba304c 100644 --- a/source/libs/audit/CMakeLists.txt +++ b/source/libs/audit/CMakeLists.txt @@ -1,7 +1,7 @@ aux_source_directory(src AUDIT_SRC) -IF (TD_ENTERPRISE) - LIST(APPEND AUDIT_SRC ${TD_ENTERPRISE_DIR}/src/plugins/audit/src/audit.c) -ENDIF () +#IF (TD_ENTERPRISE) +# LIST(APPEND AUDIT_SRC ${TD_ENTERPRISE_DIR}/src/plugins/audit/src/audit.c) +#ENDIF () add_library(audit STATIC ${AUDIT_SRC}) target_include_directories( From a7bd7e0a12175da8ae0a1e15b07eb8235f9b1d29 Mon Sep 17 00:00:00 2001 From: dmchen Date: Mon, 28 Aug 2023 10:05:07 +0800 Subject: [PATCH 097/107] ci merge --- source/libs/audit/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/audit/CMakeLists.txt b/source/libs/audit/CMakeLists.txt index f04fba304c..2a04f084f1 100644 --- a/source/libs/audit/CMakeLists.txt +++ b/source/libs/audit/CMakeLists.txt @@ -1,7 +1,7 @@ aux_source_directory(src AUDIT_SRC) -#IF (TD_ENTERPRISE) -# LIST(APPEND AUDIT_SRC ${TD_ENTERPRISE_DIR}/src/plugins/audit/src/audit.c) -#ENDIF () +IF (TD_ENTERPRISE) + LIST(APPEND AUDIT_SRC ${TD_ENTERPRISE_DIR}/src/plugins/audit/src/audit.c) +ENDIF () add_library(audit STATIC ${AUDIT_SRC}) target_include_directories( From adaf7fbdbd3c2da83ab883465639b77039437bbe Mon Sep 17 00:00:00 2001 From: huolibo Date: Mon, 28 Aug 2023 10:11:47 +0800 Subject: [PATCH 098/107] release(driver): jdbc release 3.2.5 version --- docs/en/07-develop/07-tmq.mdx | 12 ++++++++++++ docs/en/14-reference/03-connector/04-java.mdx | 18 ++++++++++++++++++ docs/zh/07-develop/07-tmq.mdx | 12 ++++++++++++ docs/zh/08-connector/14-java.mdx | 18 ++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx index 5af3897afd..42a9f3af5a 100644 --- a/docs/en/07-develop/07-tmq.mdx +++ b/docs/en/07-develop/07-tmq.mdx @@ -113,7 +113,19 @@ Set subscription() throws SQLException; ConsumerRecords poll(Duration timeout) throws SQLException; +Set assignment() throws SQLException; +long position(TopicPartition partition) throws SQLException; +Map position(String topic) throws SQLException; +Map beginningOffsets(String topic) throws SQLException; +Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; + +void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; + void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; void close() throws SQLException; ``` diff --git a/docs/en/14-reference/03-connector/04-java.mdx b/docs/en/14-reference/03-connector/04-java.mdx index b12ef38ea8..7e580a52d4 100644 --- a/docs/en/14-reference/03-connector/04-java.mdx +++ b/docs/en/14-reference/03-connector/04-java.mdx @@ -36,6 +36,7 @@ REST connection supports all platforms that can run Java. | taos-jdbcdriver version | major changes | TDengine version | | :---------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------: | +| 3.2.5 | Subscription add committed() and assignment() method | 3.1.0.3 or later | | 3.2.4 | Subscription add the enable.auto.commit parameter and the unsubscribe() method in the WebSocket connection | - | | 3.2.3 | Fixed resultSet data parsing failure in some cases | - | | 3.2.2 | Subscription add seek function | 3.0.5.0 or later | @@ -1019,14 +1020,19 @@ while(true) { #### Assignment subscription Offset ```java +// get topicPartition +Set assignment() throws SQLException; // get offset long position(TopicPartition partition) throws SQLException; Map position(String topic) throws SQLException; Map beginningOffsets(String topic) throws SQLException; Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; // Overrides the fetch offsets that the consumer will use on the next poll(timeout). void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; ``` Example usage is as follows. @@ -1052,6 +1058,18 @@ try (TaosConsumer consumer = new TaosConsumer<>(properties)) { } ``` +#### Commit offset + +If `enable.auto.commit` is false, offset can be submitted manually. + +```java +void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; +// async commit only support jni connection +void commitAsync(OffsetCommitCallback callback) throws SQLException; +void commitAsync(Map offsets, OffsetCommitCallback callback) throws SQLException; +``` + #### Close subscriptions ```java diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx index 6852d5551e..a73d43cd04 100644 --- a/docs/zh/07-develop/07-tmq.mdx +++ b/docs/zh/07-develop/07-tmq.mdx @@ -115,7 +115,19 @@ Set subscription() throws SQLException; ConsumerRecords poll(Duration timeout) throws SQLException; +Set assignment() throws SQLException; +long position(TopicPartition partition) throws SQLException; +Map position(String topic) throws SQLException; +Map beginningOffsets(String topic) throws SQLException; +Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; + +void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; + void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; void close() throws SQLException; ``` diff --git a/docs/zh/08-connector/14-java.mdx b/docs/zh/08-connector/14-java.mdx index 36eacd26a4..0ff00d1710 100644 --- a/docs/zh/08-connector/14-java.mdx +++ b/docs/zh/08-connector/14-java.mdx @@ -36,6 +36,7 @@ REST è¿žæŽ¥æ”¯æŒæ‰€æœ‰èƒ½è¿è¡Œ Java 的平å°ã€‚ | taos-jdbcdriver 版本 | 主è¦å˜åŒ– | TDengine 版本 | | :------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------: | +| 3.2.5 | æ•°æ®è®¢é˜…增加 committed()ã€assignment() 方法 | 3.1.0.3 åŠæ›´é«˜ç‰ˆæœ¬ | | 3.2.4 | æ•°æ®è®¢é˜…在 WebSocket 连接下增加 enable.auto.commit 傿•°ï¼Œä»¥åŠ unsubscribe() 方法。 | - | | 3.2.3 | ä¿®å¤ ResultSet 在一些情况数æ®è§£æžå¤±è´¥ | - | | 3.2.2 | 新增功能:数æ®è®¢é˜…æ”¯æŒ seek 功能。 | 3.0.5.0 åŠæ›´é«˜ç‰ˆæœ¬ | @@ -1022,14 +1023,19 @@ while(true) { #### 指定订阅 Offset ```java +// 获å–订阅的 topicPartition +Set assignment() throws SQLException; // èŽ·å– offset long position(TopicPartition partition) throws SQLException; Map position(String topic) throws SQLException; Map beginningOffsets(String topic) throws SQLException; Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; // 指定下一次 poll 中使用的 offset void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; ``` 示例代ç ï¼š @@ -1055,6 +1061,18 @@ try (TaosConsumer consumer = new TaosConsumer<>(properties)) { } ``` +#### æäº¤ Offset + +当`enable.auto.commit`为 false 时,å¯ä»¥æ‰‹åЍæäº¤ offset。 + +```java +void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; +// 异步æäº¤ä»…在 native 连接下有效 +void commitAsync(OffsetCommitCallback callback) throws SQLException; +void commitAsync(Map offsets, OffsetCommitCallback callback) throws SQLException; +``` + #### 关闭订阅 ```java From f299ae9bc373a0c0204f2ec8957c6c5f162ae081 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Aug 2023 12:22:53 +0800 Subject: [PATCH 099/107] fix(tsdb/s3): fix scan and fix with s3 files --- source/dnode/vnode/src/tsdb/tsdbFS2.c | 9 +++++++++ source/dnode/vnode/src/tsdb/tsdbReaderWriter.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 7f843070d6..6bdedebe35 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -16,6 +16,7 @@ #include "tsdbFS2.h" #include "tsdbUpgrade.h" #include "vnd.h" +#include "vndCos.h" extern int vnodeScheduleTask(int (*execute)(void *), void *arg); extern int vnodeScheduleTaskEx(int tpid, int (*execute)(void *), void *arg); @@ -365,6 +366,14 @@ static int32_t tsdbFSDoScanAndFixFile(STFileSystem *fs, const STFileObj *fobj) { // check file existence if (!taosCheckExistFile(fobj->fname)) { + if (tsS3Enabled) { + const char *object_name = taosDirEntryBaseName((char *)fobj->fname); + long s3_size = s3Size(object_name); + if (s3_size > 0) { + return 0; + } + } + code = TSDB_CODE_FILE_CORRUPTED; tsdbError("vgId:%d %s failed since file:%s does not exist", TD_VID(fs->tsdb->pVnode), __func__, fobj->fname); return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index dcf3770cbd..974b7f1b76 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -26,8 +26,8 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { if (pFD->pFD == NULL) { int errsv = errno; const char *object_name = taosDirEntryBaseName((char *)path); - long s3_size = s3Size(object_name); - if (!strncmp(path + strlen(path) - 5, ".data", 5) && s3_size > 0) { + long s3_size = tsS3Enabled ? s3Size(object_name) : 0; + if (tsS3Enabled && !strncmp(path + strlen(path) - 5, ".data", 5) && s3_size > 0) { s3EvictCache(path, s3_size); s3Get(object_name, path); From c0002e55ad998537c53d1e364424f552f162d3be Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 28 Aug 2023 14:33:21 +0800 Subject: [PATCH 100/107] fix:sml error because of the config of smlDot2Underline --- utils/test/c/sml_test.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index b1e504f463..64da4f83e3 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1555,12 +1555,6 @@ int sml_ts3724_Test() { ASSERT(numRows == 1); taos_free_result(pRes); - pRes = taos_query(taos, "show stables"); - row = taos_fetch_row(pRes); - numRows = taos_affected_rows(pRes); - ASSERT(numRows == 3); - taos_free_result(pRes); - taos_close(taos); return code; @@ -1684,8 +1678,8 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_td18789_Test(); ASSERT(!ret); - ret = sml_td24070_Test(); - ASSERT(!ret); +// ret = sml_td24070_Test(); +// ASSERT(!ret); ret = sml_td23881_Test(); ASSERT(ret); ret = sml_escape_Test(); From f5256a4091d697b5cb5380398d769e3fe20bccd3 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 28 Aug 2023 14:35:01 +0800 Subject: [PATCH 101/107] fix:sml error because of the config of smlDot2Underline --- utils/test/c/sml_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 64da4f83e3..9153706d23 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1678,8 +1678,8 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_td18789_Test(); ASSERT(!ret); -// ret = sml_td24070_Test(); -// ASSERT(!ret); + ret = sml_td24070_Test(); + ASSERT(!ret); ret = sml_td23881_Test(); ASSERT(ret); ret = sml_escape_Test(); From 5213fc3256e4b3fa992cb87c8394d59e2fc5f39a Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 28 Aug 2023 15:35:36 +0800 Subject: [PATCH 102/107] fix: fix case issue --- tests/system-test/0-others/information_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 0239f41c0a..baf0682fbb 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -217,7 +217,7 @@ class TDTestCase: tdSql.checkEqual(20470,len(tdSql.queryResult)) tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") - tdSql.checkEqual(195, len(tdSql.queryResult)) + tdSql.checkEqual(193, len(tdSql.queryResult)) tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") tdSql.checkEqual(54, len(tdSql.queryResult)) From 9ef455a454a219ccf6047b492c77d3f8209cb6d1 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Aug 2023 15:29:54 +0800 Subject: [PATCH 103/107] enh(s3/evict): evict cache data files for other migrated head, stt, etc. --- source/dnode/vnode/src/tsdb/tsdbRetention.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index 267e8b4117..61be14f9bc 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -338,6 +338,17 @@ static int32_t tsdbDoRetention2(void *arg) { code = tsdbMigrateDataFileS3(rtner, fobj, &did); TSDB_CHECK_CODE(code, lino, _exit); } else { + if (tsS3Enabled) { + int64_t fsize = 0; + if (taosStatFile(fobj->fname, &fsize, NULL, NULL) < 0) { + code = TAOS_SYSTEM_ERROR(terrno); + tsdbError("vgId:%d %s failed since file:%s stat failed, reason:%s", TD_VID(rtner->tsdb->pVnode), __func__, + fobj->fname, tstrerror(code)); + TSDB_CHECK_CODE(code, lino, _exit); + } + s3EvictCache(fobj->fname, fsize * 2); + } + code = tsdbDoMigrateFileObj(rtner, fobj, &did); TSDB_CHECK_CODE(code, lino, _exit); } From b88d79d2efa403dd4ef7ca21acaa98218110ca55 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 29 Aug 2023 10:20:56 +0800 Subject: [PATCH 104/107] fix(tsdb/open fs): fix retval --- source/dnode/vnode/src/tsdb/tsdbFS2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 6bdedebe35..a997c3eea5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -637,7 +637,7 @@ _exit: } else { tsdbInfo("vgId:%d %s success", TD_VID(pTsdb->pVnode), __func__); } - return 0; + return code; } static int32_t close_file_system(STFileSystem *fs) { @@ -730,7 +730,7 @@ _exit: } else { tsdbInfo("vgId:%d %s success", TD_VID(pTsdb->pVnode), __func__); } - return 0; + return code; } static void tsdbDoWaitBgTask(STFileSystem *fs, STFSBgTask *task) { From 667fe69fd1ffea6c121edc2c999a4d0e6b7899bf Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 29 Aug 2023 10:40:32 +0800 Subject: [PATCH 105/107] fix: join on condition split issue --- source/libs/planner/src/planOptimizer.c | 3 +++ tests/system-test/2-query/stbJoin.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 7ce6994ce6..51d5c96c86 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -969,6 +969,9 @@ static int32_t pushDownCondOptDealJoin(SOptimizeContext* pCxt, SJoinLogicNode* p if (NULL == pJoin->node.pConditions) { int32_t code = pushDownCondOptJoinExtractCond(pCxt, pJoin); + if (TSDB_CODE_SUCCESS == code) { + code = pushDownCondOptJoinExtractEqualOnCond(pCxt, pJoin); + } if (TSDB_CODE_SUCCESS == code) { OPTIMIZE_FLAG_SET_MASK(pJoin->node.optimizedFlag, OPTIMIZE_FLAG_PUSH_DOWN_CONDE); pCxt->optimized = true; diff --git a/tests/system-test/2-query/stbJoin.py b/tests/system-test/2-query/stbJoin.py index b4d6301424..e21a875cf2 100644 --- a/tests/system-test/2-query/stbJoin.py +++ b/tests/system-test/2-query/stbJoin.py @@ -106,6 +106,9 @@ class TDTestCase: tdSql.query(f"select a.ts, b.ts from sta a, stb b where a.ts=b.ts and (a.tg1=b.tg1 and a.tg1 > b.tg1);") tdSql.checkRows(0) + tdSql.query(f"select a.* from sta a join stb b on a.tg1=b.tg1 and a.ts=b.ts and a.tg2=b.tg2;") + tdSql.checkRows(12) + # tdSql.checkData(0,1,10) tdSql.error(f"select a.* from sta a join stb b on a.tg1=b.tg1 where a.ts=b.ts or a.tg2=b.tg2;") From 5d04461b79fc76cbda5367e15a758b0c450e5e3b Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:01:32 +0800 Subject: [PATCH 106/107] Update 09-storage.md --- docs/zh/17-operation/09-storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/17-operation/09-storage.md b/docs/zh/17-operation/09-storage.md index ca3f3af49b..185b2c40ec 100644 --- a/docs/zh/17-operation/09-storage.md +++ b/docs/zh/17-operation/09-storage.md @@ -53,4 +53,4 @@ dataDir /mnt/data6 2 0 ## åŒçº§æŒ‚载点选择策略 -一般情况下,当 TDengine è¦ä»ŽåŒçº§æŒ‚è½½ç‚¹ä¸­é€‰æ‹©ä¸€ä¸ªç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶æ—¶ï¼Œé‡‡ç”¨ round robin 策略进行选择。但现实中有å¯èƒ½æ¯ä¸ªç£ç›˜çš„容é‡ä¸ç›¸åŒï¼Œæˆ–者容é‡ç›¸åŒä½†å†™å…¥çš„æ•°æ®é‡ä¸ç›¸åŒï¼Œè¿™å°±å¯¼è‡´ä¼šå‡ºçްæ¯ä¸ªç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´ä¸å‡è¡¡ï¼Œåœ¨å®žé™…进行选择时有å¯èƒ½ä¼šé€‰æ‹©åˆ°ä¸€ä¸ªå‰©ä½™ç©ºé—´å·²ç»å¾ˆå°çš„ç£ç›˜ã€‚为了解决这个问题,从 3.1.1.0 开始引入了一个新的é…ç½® `minDiskFreeSize`,当æŸå—ç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´å°äºŽç­‰äºŽè¿™ä¸ªé˜ˆå€¼æ—¶ï¼Œè¯¥ç£ç›˜å°†ä¸å†è¢«é€‰æ‹©ç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶ã€‚该é…置项的å•ä½ä¸ºå­—节,其值应该大于 `minimalDataDirGB` \ No newline at end of file +一般情况下,当 TDengine è¦ä»ŽåŒçº§æŒ‚è½½ç‚¹ä¸­é€‰æ‹©ä¸€ä¸ªç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶æ—¶ï¼Œé‡‡ç”¨ round robin 策略进行选择。但现实中有å¯èƒ½æ¯ä¸ªç£ç›˜çš„容é‡ä¸ç›¸åŒï¼Œæˆ–者容é‡ç›¸åŒä½†å†™å…¥çš„æ•°æ®é‡ä¸ç›¸åŒï¼Œè¿™å°±å¯¼è‡´ä¼šå‡ºçްæ¯ä¸ªç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´ä¸å‡è¡¡ï¼Œåœ¨å®žé™…进行选择时有å¯èƒ½ä¼šé€‰æ‹©åˆ°ä¸€ä¸ªå‰©ä½™ç©ºé—´å·²ç»å¾ˆå°çš„ç£ç›˜ã€‚为了解决这个问题,从 3.1.1.0 开始引入了一个新的é…ç½® `minDiskFreeSize`,当æŸå—ç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´å°äºŽç­‰äºŽè¿™ä¸ªé˜ˆå€¼æ—¶ï¼Œè¯¥ç£ç›˜å°†ä¸å†è¢«é€‰æ‹©ç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶ã€‚该é…置项的å•ä½ä¸ºå­—节,其值应该大于 2GB,å³ä¼šè·³è¿‡å¯ç”¨ç©ºé—´å°äºŽ 2GB 的挂载点。 From fb5b34184fcee0f3b6d8f448c651a95fd79a512d Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:20:42 +0800 Subject: [PATCH 107/107] Update 09-storage.md --- docs/zh/17-operation/09-storage.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/zh/17-operation/09-storage.md b/docs/zh/17-operation/09-storage.md index 5c06c3cc99..185b2c40ec 100644 --- a/docs/zh/17-operation/09-storage.md +++ b/docs/zh/17-operation/09-storage.md @@ -53,8 +53,4 @@ dataDir /mnt/data6 2 0 ## åŒçº§æŒ‚载点选择策略 -<<<<<<< HEAD 一般情况下,当 TDengine è¦ä»ŽåŒçº§æŒ‚è½½ç‚¹ä¸­é€‰æ‹©ä¸€ä¸ªç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶æ—¶ï¼Œé‡‡ç”¨ round robin 策略进行选择。但现实中有å¯èƒ½æ¯ä¸ªç£ç›˜çš„容é‡ä¸ç›¸åŒï¼Œæˆ–者容é‡ç›¸åŒä½†å†™å…¥çš„æ•°æ®é‡ä¸ç›¸åŒï¼Œè¿™å°±å¯¼è‡´ä¼šå‡ºçްæ¯ä¸ªç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´ä¸å‡è¡¡ï¼Œåœ¨å®žé™…进行选择时有å¯èƒ½ä¼šé€‰æ‹©åˆ°ä¸€ä¸ªå‰©ä½™ç©ºé—´å·²ç»å¾ˆå°çš„ç£ç›˜ã€‚为了解决这个问题,从 3.1.1.0 开始引入了一个新的é…ç½® `minDiskFreeSize`,当æŸå—ç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´å°äºŽç­‰äºŽè¿™ä¸ªé˜ˆå€¼æ—¶ï¼Œè¯¥ç£ç›˜å°†ä¸å†è¢«é€‰æ‹©ç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶ã€‚该é…置项的å•ä½ä¸ºå­—节,其值应该大于 2GB,å³ä¼šè·³è¿‡å¯ç”¨ç©ºé—´å°äºŽ 2GB 的挂载点。 -======= -一般情况下,当 TDengine è¦ä»ŽåŒçº§æŒ‚è½½ç‚¹ä¸­é€‰æ‹©ä¸€ä¸ªç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶æ—¶ï¼Œé‡‡ç”¨ round robin 策略进行选择。但现实中有å¯èƒ½æ¯ä¸ªç£ç›˜çš„容é‡ä¸ç›¸åŒï¼Œæˆ–者容é‡ç›¸åŒä½†å†™å…¥çš„æ•°æ®é‡ä¸ç›¸åŒï¼Œè¿™å°±å¯¼è‡´ä¼šå‡ºçްæ¯ä¸ªç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´ä¸å‡è¡¡ï¼Œåœ¨å®žé™…进行选择时有å¯èƒ½ä¼šé€‰æ‹©åˆ°ä¸€ä¸ªå‰©ä½™ç©ºé—´å·²ç»å¾ˆå°çš„ç£ç›˜ã€‚为了解决这个问题,从 3.1.1.0 开始引入了一个新的é…ç½® `minDiskFreeSize`,当æŸå—ç£ç›˜ä¸Šçš„å¯ç”¨ç©ºé—´å°äºŽç­‰äºŽè¿™ä¸ªé˜ˆå€¼æ—¶ï¼Œè¯¥ç£ç›˜å°†ä¸å†è¢«é€‰æ‹©ç”¨äºŽç”Ÿæˆæ–°çš„æ•°æ®æ–‡ä»¶ã€‚该é…置项的å•ä½ä¸ºå­—节,其值应该大于 2GB,å³ä¼šè·³è¿‡å¯ç”¨ç©ºé—´å°äºŽ 2GB 的挂载点。 ->>>>>>> 5d04461b79fc76cbda5367e15a758b0c450e5e3b