diff --git a/documentation20/cn/02.getting-started/docs.md b/documentation20/cn/02.getting-started/docs.md index f86e616c42..43392e0325 100644 --- a/documentation20/cn/02.getting-started/docs.md +++ b/documentation20/cn/02.getting-started/docs.md @@ -179,19 +179,20 @@ taos> select avg(f1), max(f2), min(f3) from test.t10 interval(10s); ### TDengine服务器支持的平台列表 -| | **CentOS 6/7/8** | **Ubuntu 16/18/20** | **Other Linux** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** | -| -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- | -| X64 | ● | ● | | ○ | ● | ● | -| 树莓派 ARM32 | | ● | ● | | | | -| 龙芯 MIPS64 | | | ● | | | | -| 鲲鹏 ARM64 | | ○ | ○ | | ● | | -| 申威 Alpha64 | | | ○ | ● | | | -| 飞腾 ARM64 | | ○ 优麒麟 | | | | | -| 海光 X64 | ● | ● | ● | ○ | ● | ● | -| 瑞芯微 ARM64/32 | | | ○ | | | | -| 全志 ARM64/32 | | | ○ | | | | -| 炬力 ARM64/32 | | | ○ | | | | -| TI ARM32 | | | ○ | | | | +| | **CentOS 6/7/8** | **Ubuntu 16/18/20** | **Other Linux** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** | **华为 EulerOS** | +| -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- | --------------------- | +| X64 | ● | ● | | ○ | ● | ● | ● | +| 树莓派 ARM32 | | ● | ● | | | | | +| 龙芯 MIPS64 | | | ● | | | | | +| 鲲鹏 ARM64 | | ○ | ○ | | ● | | | +| 申威 Alpha64 | | | ○ | ● | | | | +| 飞腾 ARM64 | | ○ 优麒麟 | | | | | | +| 海光 X64 | ● | ● | ● | ○ | ● | ● | | +| 瑞芯微 ARM64/32 | | | ○ | | | | | +| 全志 ARM64/32 | | | ○ | | | | | +| 炬力 ARM64/32 | | | ○ | | | | | +| TI ARM32 | | | ○ | | | | | +| 华为云 ARM64 | | | | | | | ● | 注: ● 表示经过官方测试验证, ○ 表示非官方测试验证。 diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 3249529b34..0cfcff3a98 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -301,7 +301,7 @@ static void tscAsyncResultCallback(SSchedMsg *pMsg) { taosReleaseRef(tscObjRef, pSql->self); } -void tscAsyncResultOnError(SSqlObj* pSql) { +void tscAsyncResultOnError(SSqlObj* pSql) { SSchedMsg schedMsg = {0}; schedMsg.fp = tscAsyncResultCallback; schedMsg.ahandle = (void *)pSql->self; @@ -505,10 +505,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { return; _error: - if (code != TSDB_CODE_SUCCESS) { - pSql->res.code = code; - tscAsyncResultOnError(pSql); - } - + pRes->code = code; + tscAsyncResultOnError(pSql); taosReleaseRef(tscObjRef, pSql->self); } diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index b0728aa8aa..5841aa0cd5 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3293,7 +3293,8 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC } if (pSchema->type == TSDB_DATA_TYPE_BOOL) { - if (pExpr->tokenId != TK_EQ && pExpr->tokenId != TK_NE) { + int32_t t = pExpr->tokenId; + if (t != TK_EQ && t != TK_NE && t != TK_NOTNULL && t != TK_ISNULL) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); } } @@ -3493,7 +3494,8 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer } pList->ids[pList->num++] = index; - } else if (pExpr->tokenId == TK_FLOAT && (isnan(pExpr->value.dKey) || isinf(pExpr->value.dKey))) { + } else if ((pExpr->tokenId == TK_FLOAT && (isnan(pExpr->value.dKey) || isinf(pExpr->value.dKey))) || + pExpr->tokenId == TK_NULL) { return TSDB_CODE_TSC_INVALID_SQL; } else if (pExpr->type == SQL_NODE_SQLFUNCTION) { if (*type == NON_ARITHMEIC_EXPR) { @@ -3727,6 +3729,39 @@ static int32_t setExprToCond(tSqlExpr** parent, tSqlExpr* pExpr, const char* msg return TSDB_CODE_SUCCESS; } +static int32_t validateNullExpr(tSqlExpr* pExpr, char* msgBuf) { + const char* msg = "only support is [not] null"; + + tSqlExpr* pRight = pExpr->pRight; + if (pRight->tokenId == TK_NULL && (!(pExpr->tokenId == TK_ISNULL || pExpr->tokenId == TK_NOTNULL))) { + return invalidSqlErrMsg(msgBuf, msg); + } + + return TSDB_CODE_SUCCESS; +} + +// check for like expression +static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t index, char* msgBuf) { + const char* msg1 = "wildcard string should be less than 20 characters"; + const char* msg2 = "illegal column name"; + + tSqlExpr* pLeft = pExpr->pLeft; + tSqlExpr* pRight = pExpr->pRight; + + if (pExpr->tokenId == TK_LIKE) { + if (pRight->value.nLen > TSDB_PATTERN_STRING_MAX_LEN) { + return invalidSqlErrMsg(msgBuf, msg1); + } + + SSchema* pSchema = tscGetTableSchema(pTableMeta); + if ((!isTablenameToken(&pLeft->colInfo)) && !IS_VAR_DATA_TYPE(pSchema[index].type)) { + return invalidSqlErrMsg(msgBuf, msg2); + } + } + + return TSDB_CODE_SUCCESS; +} + static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SCondExpr* pCondExpr, int32_t* type, int32_t parentOptr) { const char* msg1 = "table query cannot use tags filter"; @@ -3736,8 +3771,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql const char* msg5 = "not support ordinary column join"; const char* msg6 = "only one query condition on tbname allowed"; const char* msg7 = "only in/like allowed in filter table name"; - const char* msg8 = "wildcard string should be less than 20 characters"; - + tSqlExpr* pLeft = (*pExpr)->pLeft; tSqlExpr* pRight = (*pExpr)->pRight; @@ -3753,6 +3787,18 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex); STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; + // validate the null expression + int32_t code = validateNullExpr(*pExpr, tscGetErrorMsgPayload(pCmd)); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + // validate the like expression + code = validateLikeExpr(*pExpr, pTableMeta, index.columnIndex, tscGetErrorMsgPayload(pCmd)); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (index.columnIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX) { // query on time range if (!validateJoinExprNode(pCmd, pQueryInfo, *pExpr, &index)) { return TSDB_CODE_TSC_INVALID_SQL; @@ -3774,7 +3820,6 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql int16_t leftIdx = index.tableIndex; - SColumnIndex index = COLUMN_INDEX_INITIALIZER; if (getColumnIndexByName(pCmd, &pRight->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -3821,20 +3866,6 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } - // check for like expression - if ((*pExpr)->tokenId == TK_LIKE) { - if (pRight->value.nLen > TSDB_PATTERN_STRING_MAX_LEN) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg8); - } - - SSchema* pSchema = tscGetTableSchema(pTableMetaInfo->pTableMeta); - - if ((!isTablenameToken(&pLeft->colInfo)) && pSchema[index.columnIndex].type != TSDB_DATA_TYPE_BINARY && - pSchema[index.columnIndex].type != TSDB_DATA_TYPE_NCHAR) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); - } - } - // in case of in operator, keep it in a seprate attribute if (index.columnIndex == TSDB_TBNAME_COLUMN_INDEX) { if (!validTableNameOptr(*pExpr)) { diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index ad36246461..57b57dba5a 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -309,7 +309,7 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) { int32_t offset = 0; - for (int32_t i = 0; i < pRes->numOfCols; ++i) { + for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) { SInternalField* pInfo = (SInternalField*)TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.internalField, i); pRes->urow[i] = pRes->data + offset * pRes->numOfRows; diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index ea0ef4655d..410e6bb188 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -238,9 +238,11 @@ static int32_t dnodeInitStorage() { } TDIR *tdir = tfsOpendir("vnode_bak/.staging"); - if (tfsReaddir(tdir) != NULL) { + bool stagingNotEmpty = tfsReaddir(tdir) != NULL; + tfsClosedir(tdir); + + if (stagingNotEmpty) { dError("vnode_bak/.staging dir not empty, fix it first."); - tfsClosedir(tdir); return -1; } diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index 84fd260d91..26084a52eb 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -222,7 +222,7 @@ static void *dnodeProcessVWriteQueue(void *wparam) { dnodeSendRpcVWriteRsp(pVnode, pWrite, pWrite->code); } else { if (qtype == TAOS_QTYPE_FWD) { - vnodeConfirmForward(pVnode, pWrite->pHead.version, 0, pWrite->pHead.msgType != TSDB_MSG_TYPE_SUBMIT); + vnodeConfirmForward(pVnode, pWrite->pHead.version, pWrite->code, pWrite->pHead.msgType != TSDB_MSG_TYPE_SUBMIT); } if (pWrite->rspRet.rsp) { rpcFreeCont(pWrite->rspRet.rsp); diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index df1c7bee26..7cb5f1b76b 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -263,7 +263,6 @@ typedef struct SSuperTable_S { int lenOfTagOfOneRow; char* sampleDataBuf; - int sampleDataBufSize; //int sampleRowCount; //int sampleUsePos; @@ -506,7 +505,7 @@ static int taosRandom() #endif -static int createDatabases(); +static int createDatabasesAndStables(); static void createChildTables(); static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet); @@ -2279,7 +2278,7 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName, } static int createSuperTable(TAOS * taos, char* dbName, - SSuperTable* superTbls, bool use_metric) { + SSuperTable* superTbl) { char command[BUFFER_SIZE] = "\0"; char cols[STRING_LEN] = "\0"; @@ -2287,19 +2286,26 @@ static int createSuperTable(TAOS * taos, char* dbName, int len = 0; int lenOfOneRow = 0; - for (colIndex = 0; colIndex < superTbls->columnCount; colIndex++) { - char* dataType = superTbls->columns[colIndex].dataType; + + if (superTbl->columnCount == 0) { + errorPrint("%s() LN%d, super table column count is %d\n", + __func__, __LINE__, superTbl->columnCount); + return -1; + } + + for (colIndex = 0; colIndex < superTbl->columnCount; colIndex++) { + char* dataType = superTbl->columns[colIndex].dataType; if (strcasecmp(dataType, "BINARY") == 0) { len += snprintf(cols + len, STRING_LEN - len, ", col%d %s(%d)", colIndex, "BINARY", - superTbls->columns[colIndex].dataLen); - lenOfOneRow += superTbls->columns[colIndex].dataLen + 3; + superTbl->columns[colIndex].dataLen); + lenOfOneRow += superTbl->columns[colIndex].dataLen + 3; } else if (strcasecmp(dataType, "NCHAR") == 0) { len += snprintf(cols + len, STRING_LEN - len, ", col%d %s(%d)", colIndex, "NCHAR", - superTbls->columns[colIndex].dataLen); - lenOfOneRow += superTbls->columns[colIndex].dataLen + 3; + superTbl->columns[colIndex].dataLen); + lenOfOneRow += superTbl->columns[colIndex].dataLen + 3; } else if (strcasecmp(dataType, "INT") == 0) { len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "INT"); lenOfOneRow += 11; @@ -2331,92 +2337,99 @@ static int createSuperTable(TAOS * taos, char* dbName, } } - superTbls->lenOfOneRow = lenOfOneRow + 20; // timestamp - //printf("%s.%s column count:%d, column length:%d\n\n", g_Dbs.db[i].dbName, g_Dbs.db[i].superTbls[j].sTblName, g_Dbs.db[i].superTbls[j].columnCount, lenOfOneRow); + superTbl->lenOfOneRow = lenOfOneRow + 20; // timestamp + //printf("%s.%s column count:%d, column length:%d\n\n", g_Dbs.db[i].dbName, g_Dbs.db[i].superTbl[j].sTblName, g_Dbs.db[i].superTbl[j].columnCount, lenOfOneRow); // save for creating child table - superTbls->colsOfCreateChildTable = (char*)calloc(len+20, 1); - if (NULL == superTbls->colsOfCreateChildTable) { - printf("Failed when calloc, size:%d", len+1); + superTbl->colsOfCreateChildTable = (char*)calloc(len+20, 1); + if (NULL == superTbl->colsOfCreateChildTable) { + errorPrint("%s() LN%d, Failed when calloc, size:%d", + __func__, __LINE__, len+1); taos_close(taos); exit(-1); } - snprintf(superTbls->colsOfCreateChildTable, len+20, "(ts timestamp%s)", cols); - verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, superTbls->colsOfCreateChildTable); - if (use_metric) { - char tags[STRING_LEN] = "\0"; - int tagIndex; - len = 0; + snprintf(superTbl->colsOfCreateChildTable, len+20, "(ts timestamp%s)", cols); + verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, superTbl->colsOfCreateChildTable); - int lenOfTagOfOneRow = 0; - len += snprintf(tags + len, STRING_LEN - len, "("); - for (tagIndex = 0; tagIndex < superTbls->tagCount; tagIndex++) { - char* dataType = superTbls->tags[tagIndex].dataType; - - if (strcasecmp(dataType, "BINARY") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex, - "BINARY", superTbls->tags[tagIndex].dataLen); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3; - } else if (strcasecmp(dataType, "NCHAR") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex, - "NCHAR", superTbls->tags[tagIndex].dataLen); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3; - } else if (strcasecmp(dataType, "INT") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, - "INT"); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 11; - } else if (strcasecmp(dataType, "BIGINT") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, - "BIGINT"); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 21; - } else if (strcasecmp(dataType, "SMALLINT") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, - "SMALLINT"); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 6; - } else if (strcasecmp(dataType, "TINYINT") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, - "TINYINT"); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 4; - } else if (strcasecmp(dataType, "BOOL") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, - "BOOL"); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 6; - } else if (strcasecmp(dataType, "FLOAT") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, - "FLOAT"); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 22; - } else if (strcasecmp(dataType, "DOUBLE") == 0) { - len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, - "DOUBLE"); - lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 42; - } else { - taos_close(taos); - printf("config error tag type : %s\n", dataType); - exit(-1); - } - } - len -= 2; - len += snprintf(tags + len, STRING_LEN - len, ")"); - - superTbls->lenOfTagOfOneRow = lenOfTagOfOneRow; - - snprintf(command, BUFFER_SIZE, - "create table if not exists %s.%s (ts timestamp%s) tags %s", - dbName, superTbls->sTblName, cols, tags); - verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, command); - - if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) { - errorPrint( "create supertable %s failed!\n\n", - superTbls->sTblName); - return -1; - } - debugPrint("create supertable %s success!\n\n", superTbls->sTblName); + if (superTbl->tagCount == 0) { + errorPrint("%s() LN%d, super table tag count is %d\n", + __func__, __LINE__, superTbl->tagCount); + return -1; } + + char tags[STRING_LEN] = "\0"; + int tagIndex; + len = 0; + + int lenOfTagOfOneRow = 0; + len += snprintf(tags + len, STRING_LEN - len, "("); + for (tagIndex = 0; tagIndex < superTbl->tagCount; tagIndex++) { + char* dataType = superTbl->tags[tagIndex].dataType; + + if (strcasecmp(dataType, "BINARY") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex, + "BINARY", superTbl->tags[tagIndex].dataLen); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3; + } else if (strcasecmp(dataType, "NCHAR") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex, + "NCHAR", superTbl->tags[tagIndex].dataLen); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3; + } else if (strcasecmp(dataType, "INT") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, + "INT"); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 11; + } else if (strcasecmp(dataType, "BIGINT") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, + "BIGINT"); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 21; + } else if (strcasecmp(dataType, "SMALLINT") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, + "SMALLINT"); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6; + } else if (strcasecmp(dataType, "TINYINT") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, + "TINYINT"); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 4; + } else if (strcasecmp(dataType, "BOOL") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, + "BOOL"); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6; + } else if (strcasecmp(dataType, "FLOAT") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, + "FLOAT"); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 22; + } else if (strcasecmp(dataType, "DOUBLE") == 0) { + len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, + "DOUBLE"); + lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 42; + } else { + taos_close(taos); + printf("config error tag type : %s\n", dataType); + exit(-1); + } + } + + len -= 2; + len += snprintf(tags + len, STRING_LEN - len, ")"); + + superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow; + + snprintf(command, BUFFER_SIZE, + "create table if not exists %s.%s (ts timestamp%s) tags %s", + dbName, superTbl->sTblName, cols, tags); + verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, command); + + if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) { + errorPrint( "create supertable %s failed!\n\n", + superTbl->sTblName); + return -1; + } + debugPrint("create supertable %s success!\n\n", superTbl->sTblName); return 0; } -static int createDatabases() { +static int createDatabasesAndStables() { TAOS * taos = NULL; int ret = 0; taos = taos_connect(g_Dbs.host, g_Dbs.user, g_Dbs.password, NULL, g_Dbs.port); @@ -2434,85 +2447,88 @@ static int createDatabases() { taos_close(taos); return -1; } - } - int dataLen = 0; - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, "create database if not exists %s", g_Dbs.db[i].dbName); + int dataLen = 0; + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, "create database if not exists %s", g_Dbs.db[i].dbName); - if (g_Dbs.db[i].dbCfg.blocks > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " blocks %d", g_Dbs.db[i].dbCfg.blocks); - } - if (g_Dbs.db[i].dbCfg.cache > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " cache %d", g_Dbs.db[i].dbCfg.cache); - } - if (g_Dbs.db[i].dbCfg.days > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " days %d", g_Dbs.db[i].dbCfg.days); - } - if (g_Dbs.db[i].dbCfg.keep > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " keep %d", g_Dbs.db[i].dbCfg.keep); - } - if (g_Dbs.db[i].dbCfg.quorum > 1) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " quorum %d", g_Dbs.db[i].dbCfg.quorum); - } - if (g_Dbs.db[i].dbCfg.replica > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " replica %d", g_Dbs.db[i].dbCfg.replica); - } - if (g_Dbs.db[i].dbCfg.update > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " update %d", g_Dbs.db[i].dbCfg.update); - } - //if (g_Dbs.db[i].dbCfg.maxtablesPerVnode > 0) { - // dataLen += snprintf(command + dataLen, - // BUFFER_SIZE - dataLen, "tables %d ", g_Dbs.db[i].dbCfg.maxtablesPerVnode); - //} - if (g_Dbs.db[i].dbCfg.minRows > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " minrows %d", g_Dbs.db[i].dbCfg.minRows); - } - if (g_Dbs.db[i].dbCfg.maxRows > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " maxrows %d", g_Dbs.db[i].dbCfg.maxRows); - } - if (g_Dbs.db[i].dbCfg.comp > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " comp %d", g_Dbs.db[i].dbCfg.comp); - } - if (g_Dbs.db[i].dbCfg.walLevel > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " wal %d", g_Dbs.db[i].dbCfg.walLevel); - } - if (g_Dbs.db[i].dbCfg.cacheLast > 0) { - dataLen += snprintf(command + dataLen, - BUFFER_SIZE - dataLen, " cachelast %d", g_Dbs.db[i].dbCfg.cacheLast); - } - if (g_Dbs.db[i].dbCfg.fsync > 0) { - dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, - " fsync %d", g_Dbs.db[i].dbCfg.fsync); - } - if ((0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "ms", strlen("ms"))) - || (0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, - "us", strlen("us")))) { - dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, - " precision \'%s\';", g_Dbs.db[i].dbCfg.precision); - } + if (g_Dbs.db[i].dbCfg.blocks > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " blocks %d", g_Dbs.db[i].dbCfg.blocks); + } + if (g_Dbs.db[i].dbCfg.cache > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " cache %d", g_Dbs.db[i].dbCfg.cache); + } + if (g_Dbs.db[i].dbCfg.days > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " days %d", g_Dbs.db[i].dbCfg.days); + } + if (g_Dbs.db[i].dbCfg.keep > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " keep %d", g_Dbs.db[i].dbCfg.keep); + } + if (g_Dbs.db[i].dbCfg.quorum > 1) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " quorum %d", g_Dbs.db[i].dbCfg.quorum); + } + if (g_Dbs.db[i].dbCfg.replica > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " replica %d", g_Dbs.db[i].dbCfg.replica); + } + if (g_Dbs.db[i].dbCfg.update > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " update %d", g_Dbs.db[i].dbCfg.update); + } + //if (g_Dbs.db[i].dbCfg.maxtablesPerVnode > 0) { + // dataLen += snprintf(command + dataLen, + // BUFFER_SIZE - dataLen, "tables %d ", g_Dbs.db[i].dbCfg.maxtablesPerVnode); + //} + if (g_Dbs.db[i].dbCfg.minRows > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " minrows %d", g_Dbs.db[i].dbCfg.minRows); + } + if (g_Dbs.db[i].dbCfg.maxRows > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " maxrows %d", g_Dbs.db[i].dbCfg.maxRows); + } + if (g_Dbs.db[i].dbCfg.comp > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " comp %d", g_Dbs.db[i].dbCfg.comp); + } + if (g_Dbs.db[i].dbCfg.walLevel > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " wal %d", g_Dbs.db[i].dbCfg.walLevel); + } + if (g_Dbs.db[i].dbCfg.cacheLast > 0) { + dataLen += snprintf(command + dataLen, + BUFFER_SIZE - dataLen, " cachelast %d", g_Dbs.db[i].dbCfg.cacheLast); + } + if (g_Dbs.db[i].dbCfg.fsync > 0) { + dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, + " fsync %d", g_Dbs.db[i].dbCfg.fsync); + } + if ((0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "ms", strlen("ms"))) + || (0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, + "us", strlen("us")))) { + dataLen += snprintf(command + dataLen, BUFFER_SIZE - dataLen, + " precision \'%s\';", g_Dbs.db[i].dbCfg.precision); + } - debugPrint("%s() %d command: %s\n", __func__, __LINE__, command); - if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) { - taos_close(taos); - errorPrint( "\ncreate database %s failed!\n\n", g_Dbs.db[i].dbName); - return -1; + debugPrint("%s() %d command: %s\n", __func__, __LINE__, command); + if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) { + taos_close(taos); + errorPrint( "\ncreate database %s failed!\n\n", g_Dbs.db[i].dbName); + return -1; + } + printf("\ncreate database %s success!\n\n", g_Dbs.db[i].dbName); } - printf("\ncreate database %s success!\n\n", g_Dbs.db[i].dbName); debugPrint("%s() %d supertbl count:%d\n", __func__, __LINE__, g_Dbs.db[i].superTblCount); + + int validStbCount = 0; + for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { sprintf(command, "describe %s.%s;", g_Dbs.db[i].dbName, g_Dbs.db[i].superTbls[j].sTblName); @@ -2522,12 +2538,11 @@ static int createDatabases() { if ((ret != 0) || (g_Dbs.db[i].drop)) { ret = createSuperTable(taos, g_Dbs.db[i].dbName, - &g_Dbs.db[i].superTbls[j], g_Dbs.use_metric); + &g_Dbs.db[i].superTbls[j]); if (0 != ret) { - errorPrint("\ncreate super table %d failed!\n\n", j); - taos_close(taos); - return -1; + errorPrint("create super table %d failed!\n\n", j); + continue; } } @@ -2536,10 +2551,13 @@ static int createDatabases() { if (0 != ret) { errorPrint("\nget super table %s.%s info failed!\n\n", g_Dbs.db[i].dbName, g_Dbs.db[i].superTbls[j].sTblName); - taos_close(taos); - return -1; + continue; } + + validStbCount ++; } + + g_Dbs.db[i].superTblCount = validStbCount; } taos_close(taos); @@ -2724,27 +2742,29 @@ static void createChildTables() { int len; for (int i = 0; i < g_Dbs.dbCount; i++) { - if (g_Dbs.db[i].superTblCount > 0) { - // with super table - for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { - if ((AUTO_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) - || (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists)) { - continue; + if (g_Dbs.use_metric) { + if (g_Dbs.db[i].superTblCount > 0) { + // with super table + for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { + if ((AUTO_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) + || (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists)) { + continue; + } + + verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, + g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); + int startFrom = 0; + g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount; + + verbosePrint("%s() LN%d: create %d child tables from %d\n", + __func__, __LINE__, g_totalChildTables, startFrom); + startMultiThreadCreateChildTable( + g_Dbs.db[i].superTbls[j].colsOfCreateChildTable, + g_Dbs.threadCountByCreateTbl, + startFrom, + g_Dbs.db[i].superTbls[j].childTblCount, + g_Dbs.db[i].dbName, &(g_Dbs.db[i].superTbls[j])); } - - verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, - g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); - int startFrom = 0; - g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount; - - verbosePrint("%s() LN%d: create %d child tables from %d\n", - __func__, __LINE__, g_totalChildTables, startFrom); - startMultiThreadCreateChildTable( - g_Dbs.db[i].superTbls[j].colsOfCreateChildTable, - g_Dbs.threadCountByCreateTbl, - startFrom, - g_Dbs.db[i].superTbls[j].childTblCount, - g_Dbs.db[i].dbName, &(g_Dbs.db[i].superTbls[j])); } } else { // normal table @@ -3552,19 +3572,6 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { goto PARSE_OVER; } - cJSON* sampleDataBufSize = cJSON_GetObjectItem(stbInfo, "sample_buf_size"); - if (sampleDataBufSize && sampleDataBufSize->type == cJSON_Number) { - g_Dbs.db[i].superTbls[j].sampleDataBufSize = sampleDataBufSize->valueint; - if (g_Dbs.db[i].superTbls[j].sampleDataBufSize < 1024*1024) { - g_Dbs.db[i].superTbls[j].sampleDataBufSize = 1024*1024 + 1024; - } - } else if (!sampleDataBufSize) { - g_Dbs.db[i].superTbls[j].sampleDataBufSize = 1024*1024 + 1024; - } else { - printf("ERROR: failed to read json, sample_buf_size not found\n"); - goto PARSE_OVER; - } - cJSON *sampleFormat = cJSON_GetObjectItem(stbInfo, "sample_format"); if (sampleFormat && sampleFormat->type == cJSON_String && sampleFormat->valuestring != NULL) { @@ -4682,6 +4689,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { for (int i = 0; i < batchPerTblTimes; i ++) { getTableName(tableName, pThreadInfo, tableSeq); + if (0 == strlen(tableName)) { + errorPrint("[%d] %s() LN%d, getTableName return null\n", + pThreadInfo->threadID, __func__, __LINE__); + return NULL; + exit(-1); + } int headLen; if (i == 0) { @@ -4728,7 +4741,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { remainderBufLen -= dataLen; recOfBatch += batchPerTbl; - startTime += batchPerTbl * superTblInfo->timeStampStep; +// startTime += batchPerTbl * superTblInfo->timeStampStep; pThreadInfo->totalInsertRows += batchPerTbl; verbosePrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n", pThreadInfo->threadID, __func__, __LINE__, @@ -4738,9 +4751,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { if (insertMode == INTERLACE_INSERT_MODE) { if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { // turn to first table - startTime += batchPerTbl * superTblInfo->timeStampStep; tableSeq = pThreadInfo->start_table_from; generatedRecPerTbl += batchPerTbl; + + startTime = pThreadInfo->start_time + + generatedRecPerTbl * superTblInfo->timeStampStep; + flagSleep = true; if (generatedRecPerTbl >= insertRows) break; @@ -5137,16 +5153,14 @@ static void startMultiThreadInsertData(int threads, char* db_name, if (superTblInfo) { int limit, offset; - if (superTblInfo->childTblOffset >= superTblInfo->childTblCount) { - printf("WARNING: specified offset >= child table count! \n"); - if (!g_args.answer_yes) { - printf(" Press enter key to continue or Ctrl-C to stop\n\n"); - (void)getchar(); - } + if ((superTblInfo->childTblExists == TBL_NO_EXISTS) && + ((superTblInfo->childTblOffset != 0) || (superTblInfo->childTblLimit != 0))) { + printf("WARNING: offset and limit will not be used since the child tables are not exists!\n"); } - if (superTblInfo->childTblOffset >= 0) { - if (superTblInfo->childTblLimit <= 0) { + if ((superTblInfo->childTblExists == TBL_ALREADY_EXISTS) + && (superTblInfo->childTblOffset >= 0)) { + if (superTblInfo->childTblLimit < 0) { superTblInfo->childTblLimit = superTblInfo->childTblCount - superTblInfo->childTblOffset; } @@ -5154,13 +5168,32 @@ static void startMultiThreadInsertData(int threads, char* db_name, offset = superTblInfo->childTblOffset; limit = superTblInfo->childTblLimit; } else { - limit = superTblInfo->childTblCount; - offset = 0; + limit = superTblInfo->childTblCount; + offset = 0; } ntables = limit; startFrom = offset; + if ((superTblInfo->childTblExists != TBL_NO_EXISTS) + && ((superTblInfo->childTblOffset + superTblInfo->childTblLimit ) + > superTblInfo->childTblCount)) { + printf("WARNING: specified offset + limit > child table count!\n"); + if (!g_args.answer_yes) { + printf(" Press enter key to continue or Ctrl-C to stop\n\n"); + (void)getchar(); + } + } + + if ((superTblInfo->childTblExists != TBL_NO_EXISTS) + && (0 == superTblInfo->childTblLimit)) { + printf("WARNING: specified limit = 0, which cannot find table name to insert or query! \n"); + if (!g_args.answer_yes) { + printf(" Press enter key to continue or Ctrl-C to stop\n\n"); + (void)getchar(); + } + } + superTblInfo->childTblName = (char*)calloc(1, limit * TSDB_TABLE_NAME_LEN); if (superTblInfo->childTblName == NULL) { @@ -5490,7 +5523,7 @@ static int insertTestProcess() { init_rand_data(); // create database and super tables - if(createDatabases() != 0) { + if(createDatabasesAndStables() != 0) { fclose(g_fpOfInsertResult); return -1; } @@ -5518,18 +5551,21 @@ static int insertTestProcess() { // create sub threads for inserting data //start = getCurrentTime(); for (int i = 0; i < g_Dbs.dbCount; i++) { - if (g_Dbs.db[i].superTblCount > 0) { - for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { - SSuperTable* superTblInfo = &g_Dbs.db[i].superTbls[j]; - if (0 == g_Dbs.db[i].superTbls[j].insertRows) { - continue; - } - startMultiThreadInsertData( - g_Dbs.threadCount, - g_Dbs.db[i].dbName, - g_Dbs.db[i].dbCfg.precision, - superTblInfo); + if (g_Dbs.use_metric) { + if (g_Dbs.db[i].superTblCount > 0) { + for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { + + SSuperTable* superTblInfo = &g_Dbs.db[i].superTbls[j]; + + if (superTblInfo && (superTblInfo->insertRows > 0)) { + startMultiThreadInsertData( + g_Dbs.threadCount, + g_Dbs.db[i].dbName, + g_Dbs.db[i].dbCfg.precision, + superTblInfo); + } } + } } else { startMultiThreadInsertData( g_Dbs.threadCount, diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index 5ff574ec67..c62e78a3a9 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -86,7 +86,8 @@ typedef struct SResultRow { bool closed; // this result status: closed or opened uint32_t numOfRows; // number of rows of current time window SResultRowCellInfo* pCellInfo; // For each result column, there is a resultInfo - union {STimeWindow win; char* key;}; // start key of current result row + STimeWindow win; + char* key; // start key of current result row } SResultRow; typedef struct SGroupResInfo { diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index b026f90235..174b31a9c6 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -675,6 +675,7 @@ expr(A) ::= STRING(X). { A = tSqlExprCreateIdValue(&X, TK_STRING);} expr(A) ::= NOW(X). { A = tSqlExprCreateIdValue(&X, TK_NOW); } expr(A) ::= VARIABLE(X). { A = tSqlExprCreateIdValue(&X, TK_VARIABLE);} expr(A) ::= BOOL(X). { A = tSqlExprCreateIdValue(&X, TK_BOOL);} +expr(A) ::= NULL(X). { A = tSqlExprCreateIdValue(&X, TK_NULL);} // ordinary functions: min(x), max(x), top(k, 20) expr(A) ::= ID(X) LP exprlist(Y) RP(E). { A = tSqlExprCreateFunction(Y, &X, &E, X.type); } diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 7ba629cfc2..ea117ed47b 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -200,6 +200,7 @@ static bool isPointInterpoQuery(SQuery *pQuery); static void setResultBufSize(SQuery* pQuery, SRspResultInfo* pResultInfo); static void setCtxTagForJoin(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx, SExprInfo* pExprInfo, void* pTable); static void setParamForStableStddev(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput, SExprInfo* pExpr); +static void setParamForStableStddevByColData(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput, SExprInfo* pExpr, char* val, int16_t bytes); static void doSetTableGroupOutputBuf(SQueryRuntimeEnv* pRuntimeEnv, SResultRowInfo* pResultRowInfo, SQLFunctionCtx* pCtx, int32_t* rowCellInfoOffset, int32_t numOfOutput, int32_t groupIndex); @@ -1330,6 +1331,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn SColumnInfoData* pColInfoData = taosArrayGet(pSDataBlock->pDataBlock, pInfo->colIndex); int16_t bytes = pColInfoData->info.bytes; int16_t type = pColInfoData->info.type; + SQuery *pQuery = pRuntimeEnv->pQuery; if (type == TSDB_DATA_TYPE_FLOAT || type == TSDB_DATA_TYPE_DOUBLE) { qError("QInfo:%"PRIu64" group by not supported on double/float columns, abort", GET_QID(pRuntimeEnv)); @@ -1350,6 +1352,10 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn memcpy(pInfo->prevData, val, bytes); + if (pQuery->stableQuery && pQuery->stabledev && (pRuntimeEnv->prevResult != NULL)) { + setParamForStableStddevByColData(pRuntimeEnv, pInfo->binfo.pCtx, pOperator->numOfOutput, pOperator->pExpr, val, bytes); + } + int32_t ret = setGroupResultOutputBuf(pRuntimeEnv, pInfo, pOperator->numOfOutput, val, type, bytes, item->groupIndex); if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code @@ -1870,14 +1876,15 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) { taosHashCleanup(pRuntimeEnv->pResultRowHashTable); pRuntimeEnv->pResultRowHashTable = NULL; - pRuntimeEnv->pool = destroyResultRowPool(pRuntimeEnv->pool); - taosArrayDestroyEx(pRuntimeEnv->prevResult, freeInterResult); - pRuntimeEnv->prevResult = NULL; - taosHashCleanup(pRuntimeEnv->pTableRetrieveTsMap); pRuntimeEnv->pTableRetrieveTsMap = NULL; destroyOperatorInfo(pRuntimeEnv->proot); + + pRuntimeEnv->pool = destroyResultRowPool(pRuntimeEnv->pool); + taosArrayDestroyEx(pRuntimeEnv->prevResult, freeInterResult); + pRuntimeEnv->prevResult = NULL; + } static bool needBuildResAfterQueryComplete(SQInfo* pQInfo) { @@ -3396,6 +3403,42 @@ void setParamForStableStddev(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx } +void setParamForStableStddevByColData(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput, SExprInfo* pExpr, char* val, int16_t bytes) { + SQuery* pQuery = pRuntimeEnv->pQuery; + + int32_t numOfExprs = pQuery->numOfOutput; + for(int32_t i = 0; i < numOfExprs; ++i) { + SExprInfo* pExprInfo = &(pExpr[i]); + if (pExprInfo->base.functionId != TSDB_FUNC_STDDEV_DST) { + continue; + } + + SSqlFuncMsg* pFuncMsg = &pExprInfo->base; + + pCtx[i].param[0].arr = NULL; + pCtx[i].param[0].nType = TSDB_DATA_TYPE_INT; // avoid freeing the memory by setting the type to be int + + // TODO use hash to speedup this loop + int32_t numOfGroup = (int32_t)taosArrayGetSize(pRuntimeEnv->prevResult); + for (int32_t j = 0; j < numOfGroup; ++j) { + SInterResult* p = taosArrayGet(pRuntimeEnv->prevResult, j); + if (bytes == 0 || memcmp(p->tags, val, bytes) == 0) { + int32_t numOfCols = (int32_t)taosArrayGetSize(p->pResult); + for (int32_t k = 0; k < numOfCols; ++k) { + SStddevInterResult* pres = taosArrayGet(p->pResult, k); + if (pres->colId == pFuncMsg->colInfo.colId) { + pCtx[i].param[0].arr = pres->pResult; + break; + } + } + } + } + } + +} + + + /* * There are two cases to handle: * @@ -6421,6 +6464,9 @@ void freeQInfo(SQInfo *pQInfo) { SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv; releaseQueryBuf(pRuntimeEnv->tableqinfoGroupInfo.numOfTables); + + doDestroyTableQueryInfo(&pRuntimeEnv->tableqinfoGroupInfo); + teardownQueryRuntimeEnv(&pQInfo->runtimeEnv); SQuery *pQuery = pQInfo->runtimeEnv.pQuery; @@ -6456,7 +6502,6 @@ void freeQInfo(SQInfo *pQInfo) { } } - doDestroyTableQueryInfo(&pRuntimeEnv->tableqinfoGroupInfo); tfree(pQInfo->pBuf); tfree(pQInfo->sql); diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index a5fc45fa9c..dc1be4fe01 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -127,7 +127,12 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) { pSqlExpr->token = *pToken; } - if (optrType == TK_INTEGER || optrType == TK_STRING || optrType == TK_FLOAT || optrType == TK_BOOL) { + if (optrType == TK_NULL) { + pToken->type = TSDB_DATA_TYPE_NULL; + tVariantCreate(&pSqlExpr->value, pToken); + pSqlExpr->tokenId = optrType; + pSqlExpr->type = SQL_NODE_VALUE; + } else if (optrType == TK_INTEGER || optrType == TK_STRING || optrType == TK_FLOAT || optrType == TK_BOOL) { toTSDBType(pToken->type); tVariantCreate(&pSqlExpr->value, pToken); @@ -356,7 +361,11 @@ void tSqlExprCompact(tSqlExpr** pExpr) { bool tSqlExprIsLeaf(tSqlExpr* pExpr) { return (pExpr->pRight == NULL && pExpr->pLeft == NULL) && - (pExpr->tokenId == 0 || pExpr->tokenId == TK_ID || (pExpr->tokenId >= TK_BOOL && pExpr->tokenId <= TK_NCHAR) || pExpr->tokenId == TK_SET); + (pExpr->tokenId == 0 || + (pExpr->tokenId == TK_ID) || + (pExpr->tokenId >= TK_BOOL && pExpr->tokenId <= TK_NCHAR) || + (pExpr->tokenId == TK_NULL) || + (pExpr->tokenId == TK_SET)); } bool tSqlExprIsParentOfLeaf(tSqlExpr* pExpr) { diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c index da7dbcd501..9b0046fda0 100644 --- a/src/query/src/qUtil.c +++ b/src/query/src/qUtil.c @@ -66,8 +66,8 @@ void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) { return; } - if (pResultRowInfo->type == TSDB_DATA_TYPE_BINARY || pResultRowInfo->type == TSDB_DATA_TYPE_NCHAR) { - for(int32_t i = 0; i < pResultRowInfo->size; ++i) { + for(int32_t i = 0; i < pResultRowInfo->size; ++i) { + if (pResultRowInfo->pResult[i]) { tfree(pResultRowInfo->pResult[i]->key); } } @@ -153,11 +153,8 @@ void clearResultRow(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResultRow, int16 pResultRow->offset = -1; pResultRow->closed = false; - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { - tfree(pResultRow->key); - } else { - pResultRow->win = TSWINDOW_INITIALIZER; - } + tfree(pResultRow->key); + pResultRow->win = TSWINDOW_INITIALIZER; } // TODO refactor: use macro diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index 9d2fb70d96..2ff0c9676e 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -372,6 +372,7 @@ int32_t qKillQuery(qinfo_t qinfo) { return TSDB_CODE_QRY_INVALID_QHANDLE; } + qDebug("QInfo:%"PRIu64" query killed", pQInfo->qId); setQueryKilled(pQInfo); // Wait for the query executing thread being stopped/ diff --git a/src/query/src/sql.c b/src/query/src/sql.c index df7aaaf001..28208e532a 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -129,16 +129,16 @@ typedef union { #define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 #define YYNSTATE 315 -#define YYNRULE 266 +#define YYNRULE 267 #define YYNTOKEN 187 #define YY_MAX_SHIFT 314 -#define YY_MIN_SHIFTREDUCE 505 -#define YY_MAX_SHIFTREDUCE 770 -#define YY_ERROR_ACTION 771 -#define YY_ACCEPT_ACTION 772 -#define YY_NO_ACTION 773 -#define YY_MIN_REDUCE 774 -#define YY_MAX_REDUCE 1039 +#define YY_MIN_SHIFTREDUCE 506 +#define YY_MAX_SHIFTREDUCE 772 +#define YY_ERROR_ACTION 773 +#define YY_ACCEPT_ACTION 774 +#define YY_NO_ACTION 775 +#define YY_MIN_REDUCE 776 +#define YY_MAX_REDUCE 1042 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -204,146 +204,146 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (679) +#define YY_ACTTAB_COUNT (680) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 133, 552, 202, 312, 206, 140, 941, 17, 85, 553, - /* 10 */ 772, 314, 179, 47, 48, 140, 51, 52, 30, 181, - /* 20 */ 214, 41, 181, 50, 262, 55, 53, 57, 54, 1020, - /* 30 */ 920, 209, 1021, 46, 45, 185, 181, 44, 43, 42, - /* 40 */ 47, 48, 908, 51, 52, 208, 1021, 214, 41, 552, - /* 50 */ 50, 262, 55, 53, 57, 54, 932, 553, 1017, 203, - /* 60 */ 46, 45, 917, 247, 44, 43, 42, 48, 938, 51, - /* 70 */ 52, 242, 972, 214, 41, 552, 50, 262, 55, 53, - /* 80 */ 57, 54, 973, 553, 257, 278, 46, 45, 298, 225, - /* 90 */ 44, 43, 42, 506, 507, 508, 509, 510, 511, 512, - /* 100 */ 513, 514, 515, 516, 517, 518, 313, 631, 1016, 231, - /* 110 */ 70, 552, 30, 47, 48, 1015, 51, 52, 819, 553, - /* 120 */ 214, 41, 166, 50, 262, 55, 53, 57, 54, 44, - /* 130 */ 43, 42, 717, 46, 45, 288, 287, 44, 43, 42, - /* 140 */ 47, 49, 198, 51, 52, 140, 140, 214, 41, 234, - /* 150 */ 50, 262, 55, 53, 57, 54, 916, 238, 237, 227, + /* 0 */ 133, 553, 202, 312, 206, 140, 943, 226, 140, 554, + /* 10 */ 774, 314, 17, 47, 48, 140, 51, 52, 30, 181, + /* 20 */ 214, 41, 181, 50, 262, 55, 53, 57, 54, 1023, + /* 30 */ 922, 209, 1024, 46, 45, 179, 181, 44, 43, 42, + /* 40 */ 47, 48, 920, 51, 52, 208, 1024, 214, 41, 553, + /* 50 */ 50, 262, 55, 53, 57, 54, 934, 554, 185, 203, + /* 60 */ 46, 45, 919, 247, 44, 43, 42, 48, 940, 51, + /* 70 */ 52, 242, 974, 214, 41, 79, 50, 262, 55, 53, + /* 80 */ 57, 54, 975, 632, 257, 30, 46, 45, 278, 225, + /* 90 */ 44, 43, 42, 507, 508, 509, 510, 511, 512, 513, + /* 100 */ 514, 515, 516, 517, 518, 519, 313, 553, 85, 231, + /* 110 */ 70, 288, 287, 47, 48, 554, 51, 52, 298, 219, + /* 120 */ 214, 41, 553, 50, 262, 55, 53, 57, 54, 918, + /* 130 */ 554, 105, 718, 46, 45, 1020, 298, 44, 43, 42, + /* 140 */ 47, 49, 910, 51, 52, 922, 140, 214, 41, 234, + /* 150 */ 50, 262, 55, 53, 57, 54, 1019, 238, 237, 227, /* 160 */ 46, 45, 285, 284, 44, 43, 42, 23, 276, 307, /* 170 */ 306, 275, 274, 273, 305, 272, 304, 303, 302, 271, - /* 180 */ 301, 300, 880, 30, 868, 869, 870, 871, 872, 873, - /* 190 */ 874, 875, 876, 877, 878, 879, 881, 882, 51, 52, - /* 200 */ 18, 30, 214, 41, 906, 50, 262, 55, 53, 57, - /* 210 */ 54, 259, 79, 78, 25, 46, 45, 190, 199, 44, - /* 220 */ 43, 42, 82, 191, 217, 28, 30, 917, 268, 118, - /* 230 */ 117, 189, 12, 213, 730, 932, 84, 721, 81, 724, - /* 240 */ 74, 727, 218, 213, 730, 917, 80, 721, 36, 724, - /* 250 */ 204, 727, 30, 903, 904, 29, 907, 46, 45, 71, - /* 260 */ 74, 44, 43, 42, 223, 210, 211, 281, 36, 261, - /* 270 */ 917, 23, 914, 307, 306, 210, 211, 723, 305, 726, - /* 280 */ 304, 303, 302, 278, 301, 300, 311, 310, 126, 677, - /* 290 */ 241, 888, 68, 282, 886, 887, 917, 245, 197, 889, - /* 300 */ 219, 891, 892, 890, 670, 893, 894, 55, 53, 57, - /* 310 */ 54, 1, 154, 263, 220, 46, 45, 30, 221, 44, - /* 320 */ 43, 42, 105, 103, 108, 308, 920, 298, 69, 97, - /* 330 */ 107, 113, 116, 106, 224, 655, 56, 280, 652, 110, - /* 340 */ 653, 226, 654, 30, 920, 667, 56, 5, 156, 729, - /* 350 */ 183, 920, 24, 33, 155, 92, 87, 91, 286, 729, - /* 360 */ 905, 917, 174, 170, 719, 728, 228, 229, 172, 169, - /* 370 */ 121, 120, 119, 828, 820, 728, 918, 166, 166, 3, - /* 380 */ 167, 243, 674, 212, 290, 31, 683, 917, 698, 699, - /* 390 */ 135, 689, 690, 750, 731, 60, 20, 19, 19, 722, - /* 400 */ 720, 725, 61, 64, 641, 184, 265, 643, 31, 733, - /* 410 */ 31, 60, 267, 642, 115, 114, 83, 60, 96, 95, - /* 420 */ 186, 14, 13, 65, 62, 180, 187, 6, 102, 101, - /* 430 */ 67, 188, 630, 16, 15, 659, 657, 660, 658, 131, - /* 440 */ 129, 194, 195, 193, 656, 178, 192, 182, 1031, 919, - /* 450 */ 983, 239, 982, 215, 979, 978, 216, 289, 39, 132, - /* 460 */ 940, 948, 950, 130, 134, 933, 138, 246, 965, 964, - /* 470 */ 151, 915, 150, 682, 248, 913, 205, 299, 104, 884, - /* 480 */ 160, 260, 152, 153, 145, 143, 141, 831, 270, 66, - /* 490 */ 250, 930, 63, 255, 37, 176, 34, 279, 58, 142, - /* 500 */ 827, 1036, 93, 1035, 1033, 157, 283, 1030, 99, 1029, - /* 510 */ 1027, 158, 849, 35, 258, 32, 38, 256, 177, 816, - /* 520 */ 109, 814, 111, 112, 254, 812, 811, 230, 168, 252, - /* 530 */ 809, 808, 807, 806, 805, 804, 171, 173, 801, 799, - /* 540 */ 797, 795, 793, 175, 249, 244, 72, 75, 40, 251, - /* 550 */ 966, 291, 292, 293, 294, 295, 296, 297, 309, 200, - /* 560 */ 222, 770, 269, 232, 233, 769, 235, 201, 196, 88, - /* 570 */ 89, 236, 768, 756, 755, 240, 245, 8, 810, 662, - /* 580 */ 122, 161, 123, 165, 163, 803, 850, 159, 162, 164, - /* 590 */ 124, 802, 73, 125, 794, 4, 2, 264, 76, 684, - /* 600 */ 136, 137, 687, 77, 144, 148, 146, 147, 149, 896, - /* 610 */ 207, 253, 26, 691, 139, 27, 9, 732, 10, 7, - /* 620 */ 734, 11, 21, 266, 22, 86, 594, 84, 590, 588, - /* 630 */ 587, 586, 583, 556, 277, 31, 59, 90, 633, 94, - /* 640 */ 632, 629, 578, 98, 100, 576, 568, 574, 570, 572, - /* 650 */ 566, 564, 597, 596, 595, 593, 592, 591, 589, 585, - /* 660 */ 584, 60, 554, 522, 520, 774, 773, 773, 773, 773, - /* 670 */ 773, 773, 773, 773, 773, 773, 773, 127, 128, + /* 180 */ 301, 300, 882, 30, 870, 871, 872, 873, 874, 875, + /* 190 */ 876, 877, 878, 879, 880, 881, 883, 884, 51, 52, + /* 200 */ 821, 1018, 214, 41, 166, 50, 262, 55, 53, 57, + /* 210 */ 54, 259, 18, 78, 82, 46, 45, 198, 223, 44, + /* 220 */ 43, 42, 213, 731, 217, 25, 722, 919, 725, 190, + /* 230 */ 728, 221, 213, 731, 199, 191, 722, 724, 725, 727, + /* 240 */ 728, 118, 117, 189, 263, 905, 906, 29, 909, 44, + /* 250 */ 43, 42, 30, 74, 210, 211, 308, 922, 261, 30, + /* 260 */ 23, 36, 307, 306, 210, 211, 934, 305, 30, 304, + /* 270 */ 303, 302, 74, 301, 300, 890, 908, 183, 888, 889, + /* 280 */ 36, 204, 922, 891, 916, 893, 894, 892, 224, 895, + /* 290 */ 896, 280, 656, 218, 830, 653, 919, 654, 166, 655, + /* 300 */ 281, 69, 241, 919, 68, 55, 53, 57, 54, 282, + /* 310 */ 197, 671, 919, 46, 45, 30, 822, 44, 43, 42, + /* 320 */ 166, 103, 108, 228, 229, 56, 220, 97, 107, 113, + /* 330 */ 116, 106, 732, 907, 723, 56, 726, 110, 730, 30, + /* 340 */ 735, 12, 732, 5, 156, 84, 184, 81, 730, 33, + /* 350 */ 155, 92, 87, 91, 729, 278, 286, 1, 154, 919, + /* 360 */ 174, 170, 186, 212, 729, 80, 172, 169, 121, 120, + /* 370 */ 119, 46, 45, 3, 167, 44, 43, 42, 71, 720, + /* 380 */ 290, 699, 700, 919, 311, 310, 126, 243, 668, 675, + /* 390 */ 678, 31, 684, 690, 180, 24, 135, 60, 245, 691, + /* 400 */ 752, 657, 733, 20, 19, 61, 19, 6, 64, 642, + /* 410 */ 265, 1034, 644, 31, 31, 721, 60, 267, 643, 187, + /* 420 */ 28, 83, 60, 268, 96, 95, 188, 62, 65, 14, + /* 430 */ 13, 102, 101, 660, 67, 661, 631, 194, 16, 15, + /* 440 */ 658, 195, 659, 115, 114, 131, 129, 193, 178, 192, + /* 450 */ 182, 921, 985, 984, 215, 981, 239, 980, 132, 942, + /* 460 */ 216, 289, 39, 950, 952, 967, 134, 966, 138, 935, + /* 470 */ 246, 130, 248, 917, 151, 915, 150, 205, 683, 250, + /* 480 */ 152, 886, 299, 153, 291, 148, 146, 260, 142, 932, + /* 490 */ 141, 58, 833, 270, 66, 255, 143, 37, 63, 176, + /* 500 */ 34, 279, 829, 258, 144, 1039, 93, 256, 1038, 1036, + /* 510 */ 157, 254, 283, 1033, 99, 1032, 1030, 158, 851, 35, + /* 520 */ 252, 145, 32, 38, 177, 818, 109, 816, 111, 40, + /* 530 */ 112, 814, 813, 230, 168, 811, 810, 809, 808, 807, + /* 540 */ 806, 171, 173, 803, 801, 799, 797, 795, 175, 249, + /* 550 */ 244, 72, 75, 104, 251, 968, 292, 293, 294, 295, + /* 560 */ 296, 297, 309, 200, 222, 269, 772, 232, 201, 233, + /* 570 */ 771, 88, 89, 196, 235, 236, 770, 758, 757, 240, + /* 580 */ 245, 8, 264, 73, 812, 663, 805, 161, 852, 159, + /* 590 */ 160, 163, 162, 164, 165, 122, 123, 124, 804, 76, + /* 600 */ 125, 796, 4, 2, 685, 136, 137, 688, 77, 149, + /* 610 */ 147, 207, 253, 86, 692, 898, 139, 9, 10, 26, + /* 620 */ 27, 734, 7, 11, 736, 21, 22, 266, 595, 591, + /* 630 */ 589, 84, 588, 587, 584, 557, 277, 94, 90, 31, + /* 640 */ 634, 633, 59, 630, 579, 577, 98, 569, 575, 571, + /* 650 */ 573, 567, 565, 100, 598, 597, 596, 594, 593, 592, + /* 660 */ 590, 586, 585, 60, 555, 523, 521, 776, 775, 127, + /* 670 */ 775, 775, 775, 775, 775, 775, 775, 775, 775, 128, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 191, 1, 190, 191, 210, 191, 191, 252, 197, 9, + /* 0 */ 191, 1, 190, 191, 210, 191, 191, 191, 191, 9, /* 10 */ 188, 189, 252, 13, 14, 191, 16, 17, 191, 252, /* 20 */ 20, 21, 252, 23, 24, 25, 26, 27, 28, 262, /* 30 */ 236, 261, 262, 33, 34, 252, 252, 37, 38, 39, - /* 40 */ 13, 14, 231, 16, 17, 261, 262, 20, 21, 1, + /* 40 */ 13, 14, 226, 16, 17, 261, 262, 20, 21, 1, /* 50 */ 23, 24, 25, 26, 27, 28, 234, 9, 252, 232, /* 60 */ 33, 34, 235, 254, 37, 38, 39, 14, 253, 16, - /* 70 */ 17, 249, 258, 20, 21, 1, 23, 24, 25, 26, - /* 80 */ 27, 28, 258, 9, 260, 79, 33, 34, 81, 67, + /* 70 */ 17, 249, 258, 20, 21, 258, 23, 24, 25, 26, + /* 80 */ 27, 28, 258, 5, 260, 191, 33, 34, 79, 67, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, - /* 100 */ 52, 53, 54, 55, 56, 57, 58, 5, 252, 61, - /* 110 */ 110, 1, 191, 13, 14, 252, 16, 17, 196, 9, - /* 120 */ 20, 21, 200, 23, 24, 25, 26, 27, 28, 37, - /* 130 */ 38, 39, 105, 33, 34, 33, 34, 37, 38, 39, - /* 140 */ 13, 14, 252, 16, 17, 191, 191, 20, 21, 135, - /* 150 */ 23, 24, 25, 26, 27, 28, 235, 143, 144, 137, + /* 100 */ 52, 53, 54, 55, 56, 57, 58, 1, 197, 61, + /* 110 */ 110, 33, 34, 13, 14, 9, 16, 17, 81, 210, + /* 120 */ 20, 21, 1, 23, 24, 25, 26, 27, 28, 235, + /* 130 */ 9, 76, 105, 33, 34, 252, 81, 37, 38, 39, + /* 140 */ 13, 14, 231, 16, 17, 236, 191, 20, 21, 135, + /* 150 */ 23, 24, 25, 26, 27, 28, 252, 143, 144, 137, /* 160 */ 33, 34, 140, 141, 37, 38, 39, 88, 89, 90, /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 180 */ 101, 102, 209, 191, 211, 212, 213, 214, 215, 216, /* 190 */ 217, 218, 219, 220, 221, 222, 223, 224, 16, 17, - /* 200 */ 44, 191, 20, 21, 0, 23, 24, 25, 26, 27, - /* 210 */ 28, 256, 258, 258, 104, 33, 34, 61, 252, 37, - /* 220 */ 38, 39, 197, 67, 232, 104, 191, 235, 107, 73, - /* 230 */ 74, 75, 104, 1, 2, 234, 108, 5, 110, 7, - /* 240 */ 104, 9, 232, 1, 2, 235, 237, 5, 112, 7, - /* 250 */ 249, 9, 191, 228, 229, 230, 231, 33, 34, 250, - /* 260 */ 104, 37, 38, 39, 67, 33, 34, 232, 112, 37, - /* 270 */ 235, 88, 191, 90, 91, 33, 34, 5, 95, 7, - /* 280 */ 97, 98, 99, 79, 101, 102, 64, 65, 66, 105, - /* 290 */ 134, 209, 136, 232, 212, 213, 235, 113, 142, 217, - /* 300 */ 210, 219, 220, 221, 37, 223, 224, 25, 26, 27, - /* 310 */ 28, 198, 199, 15, 233, 33, 34, 191, 210, 37, - /* 320 */ 38, 39, 76, 62, 63, 210, 236, 81, 197, 68, - /* 330 */ 69, 70, 71, 72, 137, 2, 104, 140, 5, 78, - /* 340 */ 7, 191, 9, 191, 236, 109, 104, 62, 63, 117, - /* 350 */ 252, 236, 116, 68, 69, 70, 71, 72, 232, 117, - /* 360 */ 229, 235, 62, 63, 1, 133, 33, 34, 68, 69, - /* 370 */ 70, 71, 72, 196, 196, 133, 226, 200, 200, 194, - /* 380 */ 195, 105, 115, 60, 232, 109, 105, 235, 124, 125, - /* 390 */ 109, 105, 105, 105, 105, 109, 109, 109, 109, 5, - /* 400 */ 37, 7, 109, 109, 105, 252, 105, 105, 109, 111, - /* 410 */ 109, 109, 105, 105, 76, 77, 109, 109, 138, 139, - /* 420 */ 252, 138, 139, 129, 131, 252, 252, 104, 138, 139, - /* 430 */ 104, 252, 106, 138, 139, 5, 5, 7, 7, 62, - /* 440 */ 63, 252, 252, 252, 111, 252, 252, 252, 236, 236, - /* 450 */ 227, 191, 227, 227, 227, 227, 227, 227, 251, 191, - /* 460 */ 191, 191, 191, 60, 191, 234, 191, 234, 259, 259, - /* 470 */ 191, 234, 238, 117, 255, 191, 255, 103, 87, 225, - /* 480 */ 206, 122, 191, 191, 243, 245, 247, 191, 191, 128, - /* 490 */ 255, 248, 130, 255, 191, 191, 191, 191, 127, 246, - /* 500 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 510 */ 191, 191, 191, 191, 126, 191, 191, 121, 191, 191, - /* 520 */ 191, 191, 191, 191, 120, 191, 191, 191, 191, 119, + /* 200 */ 196, 252, 20, 21, 200, 23, 24, 25, 26, 27, + /* 210 */ 28, 256, 44, 258, 197, 33, 34, 252, 67, 37, + /* 220 */ 38, 39, 1, 2, 232, 104, 5, 235, 7, 61, + /* 230 */ 9, 210, 1, 2, 252, 67, 5, 5, 7, 7, + /* 240 */ 9, 73, 74, 75, 15, 228, 229, 230, 231, 37, + /* 250 */ 38, 39, 191, 104, 33, 34, 210, 236, 37, 191, + /* 260 */ 88, 112, 90, 91, 33, 34, 234, 95, 191, 97, + /* 270 */ 98, 99, 104, 101, 102, 209, 0, 252, 212, 213, + /* 280 */ 112, 249, 236, 217, 191, 219, 220, 221, 137, 223, + /* 290 */ 224, 140, 2, 232, 196, 5, 235, 7, 200, 9, + /* 300 */ 232, 197, 134, 235, 136, 25, 26, 27, 28, 232, + /* 310 */ 142, 37, 235, 33, 34, 191, 196, 37, 38, 39, + /* 320 */ 200, 62, 63, 33, 34, 104, 233, 68, 69, 70, + /* 330 */ 71, 72, 111, 229, 5, 104, 7, 78, 117, 191, + /* 340 */ 111, 104, 111, 62, 63, 108, 252, 110, 117, 68, + /* 350 */ 69, 70, 71, 72, 133, 79, 232, 198, 199, 235, + /* 360 */ 62, 63, 252, 60, 133, 237, 68, 69, 70, 71, + /* 370 */ 72, 33, 34, 194, 195, 37, 38, 39, 250, 1, + /* 380 */ 232, 124, 125, 235, 64, 65, 66, 105, 109, 115, + /* 390 */ 105, 109, 105, 105, 252, 116, 109, 109, 113, 105, + /* 400 */ 105, 111, 105, 109, 109, 109, 109, 104, 109, 105, + /* 410 */ 105, 236, 105, 109, 109, 37, 109, 105, 105, 252, + /* 420 */ 104, 109, 109, 107, 138, 139, 252, 131, 129, 138, + /* 430 */ 139, 138, 139, 5, 104, 7, 106, 252, 138, 139, + /* 440 */ 5, 252, 7, 76, 77, 62, 63, 252, 252, 252, + /* 450 */ 252, 236, 227, 227, 227, 227, 191, 227, 191, 191, + /* 460 */ 227, 227, 251, 191, 191, 259, 191, 259, 191, 234, + /* 470 */ 234, 60, 255, 234, 191, 191, 238, 255, 117, 255, + /* 480 */ 191, 225, 103, 191, 86, 240, 242, 122, 246, 248, + /* 490 */ 247, 127, 191, 191, 128, 255, 245, 191, 130, 191, + /* 500 */ 191, 191, 191, 126, 244, 191, 191, 121, 191, 191, + /* 510 */ 191, 120, 191, 191, 191, 191, 191, 191, 191, 191, + /* 520 */ 119, 243, 191, 191, 191, 191, 191, 191, 191, 132, /* 530 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 540 */ 191, 191, 191, 191, 118, 192, 192, 192, 132, 192, - /* 550 */ 192, 86, 50, 83, 85, 54, 84, 82, 79, 192, - /* 560 */ 192, 5, 192, 145, 5, 5, 145, 192, 192, 197, - /* 570 */ 197, 5, 5, 90, 89, 135, 113, 104, 192, 105, - /* 580 */ 193, 202, 193, 201, 203, 192, 208, 207, 205, 204, - /* 590 */ 193, 192, 114, 193, 192, 194, 198, 107, 109, 105, - /* 600 */ 104, 109, 105, 104, 244, 240, 242, 241, 239, 225, - /* 610 */ 1, 104, 109, 105, 104, 109, 123, 105, 123, 104, - /* 620 */ 111, 104, 104, 107, 104, 76, 9, 108, 5, 5, - /* 630 */ 5, 5, 5, 80, 15, 109, 16, 76, 5, 139, - /* 640 */ 5, 105, 5, 139, 139, 5, 5, 5, 5, 5, - /* 650 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 660 */ 5, 109, 80, 60, 59, 0, 263, 263, 263, 263, - /* 670 */ 263, 263, 263, 263, 263, 263, 263, 21, 21, 263, + /* 540 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 118, + /* 550 */ 192, 192, 192, 87, 192, 192, 50, 83, 85, 54, + /* 560 */ 84, 82, 79, 192, 192, 192, 5, 145, 192, 5, + /* 570 */ 5, 197, 197, 192, 145, 5, 5, 90, 89, 135, + /* 580 */ 113, 104, 107, 114, 192, 105, 192, 202, 208, 207, + /* 590 */ 206, 203, 205, 204, 201, 193, 193, 193, 192, 109, + /* 600 */ 193, 192, 194, 198, 105, 104, 109, 105, 104, 239, + /* 610 */ 241, 1, 104, 76, 105, 225, 104, 123, 123, 109, + /* 620 */ 109, 105, 104, 104, 111, 104, 104, 107, 9, 5, + /* 630 */ 5, 108, 5, 5, 5, 80, 15, 139, 76, 109, + /* 640 */ 5, 5, 16, 105, 5, 5, 139, 5, 5, 5, + /* 650 */ 5, 5, 5, 139, 5, 5, 5, 5, 5, 5, + /* 660 */ 5, 5, 5, 109, 80, 60, 59, 0, 263, 21, + /* 670 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 21, /* 680 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, /* 690 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, /* 700 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, @@ -362,101 +362,101 @@ static const YYCODETYPE yy_lookahead[] = { /* 830 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, /* 840 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, /* 850 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 860 */ 263, 263, 263, 263, 263, 263, + /* 860 */ 263, 263, 263, 263, 263, 263, 263, }; #define YY_SHIFT_COUNT (314) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (665) +#define YY_SHIFT_MAX (667) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 156, 79, 79, 183, 183, 6, 232, 242, 74, 74, - /* 10 */ 74, 74, 74, 74, 74, 74, 74, 0, 48, 242, - /* 20 */ 333, 333, 333, 333, 110, 136, 74, 74, 74, 204, - /* 30 */ 74, 74, 246, 6, 7, 7, 679, 679, 679, 242, - /* 40 */ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - /* 50 */ 242, 242, 242, 242, 242, 242, 242, 242, 242, 333, - /* 60 */ 333, 102, 102, 102, 102, 102, 102, 102, 74, 74, - /* 70 */ 74, 267, 74, 136, 136, 74, 74, 74, 264, 264, - /* 80 */ 236, 136, 74, 74, 74, 74, 74, 74, 74, 74, - /* 90 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - /* 100 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - /* 110 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - /* 120 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - /* 130 */ 74, 74, 403, 403, 403, 356, 356, 356, 403, 356, - /* 140 */ 403, 361, 362, 371, 359, 388, 396, 404, 410, 426, - /* 150 */ 416, 403, 403, 403, 374, 6, 6, 403, 403, 391, - /* 160 */ 465, 502, 470, 469, 501, 472, 475, 374, 403, 479, - /* 170 */ 479, 403, 479, 403, 479, 403, 679, 679, 27, 100, - /* 180 */ 127, 100, 100, 53, 182, 282, 282, 282, 282, 261, - /* 190 */ 285, 300, 224, 224, 224, 224, 22, 14, 92, 92, - /* 200 */ 128, 197, 222, 276, 184, 281, 286, 287, 288, 289, - /* 210 */ 272, 394, 363, 323, 298, 293, 294, 299, 301, 302, - /* 220 */ 307, 308, 121, 280, 283, 290, 326, 295, 430, 431, - /* 230 */ 338, 377, 556, 418, 559, 560, 421, 566, 567, 483, - /* 240 */ 485, 440, 463, 490, 473, 478, 474, 489, 494, 496, - /* 250 */ 497, 492, 499, 609, 507, 508, 510, 503, 493, 506, - /* 260 */ 495, 512, 515, 509, 517, 490, 518, 516, 520, 519, - /* 270 */ 549, 617, 623, 624, 625, 626, 627, 553, 619, 561, - /* 280 */ 500, 526, 526, 620, 504, 505, 526, 633, 635, 536, - /* 290 */ 526, 637, 640, 641, 642, 643, 644, 645, 646, 647, - /* 300 */ 648, 649, 650, 651, 652, 653, 654, 655, 552, 582, - /* 310 */ 656, 657, 603, 605, 665, + /* 0 */ 168, 79, 79, 172, 172, 9, 221, 231, 106, 106, + /* 10 */ 106, 106, 106, 106, 106, 106, 106, 0, 48, 231, + /* 20 */ 290, 290, 290, 290, 121, 149, 106, 106, 106, 276, + /* 30 */ 106, 106, 55, 9, 37, 37, 680, 680, 680, 231, + /* 40 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + /* 50 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 290, + /* 60 */ 290, 78, 78, 78, 78, 78, 78, 78, 106, 106, + /* 70 */ 106, 274, 106, 149, 149, 106, 106, 106, 257, 257, + /* 80 */ 279, 149, 106, 106, 106, 106, 106, 106, 106, 106, + /* 90 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + /* 100 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + /* 110 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + /* 120 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + /* 130 */ 106, 106, 411, 411, 411, 361, 361, 361, 411, 361, + /* 140 */ 411, 366, 368, 364, 365, 377, 386, 391, 401, 431, + /* 150 */ 397, 411, 411, 411, 379, 9, 9, 411, 411, 466, + /* 160 */ 398, 506, 474, 473, 505, 476, 479, 379, 411, 483, + /* 170 */ 483, 411, 483, 411, 483, 411, 680, 680, 27, 100, + /* 180 */ 127, 100, 100, 53, 182, 280, 280, 280, 280, 259, + /* 190 */ 281, 298, 338, 338, 338, 338, 22, 14, 212, 212, + /* 200 */ 237, 151, 320, 282, 285, 287, 288, 294, 295, 297, + /* 210 */ 232, 329, 378, 303, 229, 296, 299, 304, 305, 307, + /* 220 */ 312, 313, 316, 286, 291, 293, 330, 300, 428, 435, + /* 230 */ 367, 383, 561, 422, 564, 565, 429, 570, 571, 487, + /* 240 */ 489, 444, 467, 475, 477, 469, 480, 490, 499, 501, + /* 250 */ 502, 497, 504, 610, 508, 509, 512, 510, 494, 511, + /* 260 */ 495, 516, 518, 513, 519, 475, 521, 520, 522, 523, + /* 270 */ 537, 619, 624, 625, 627, 628, 629, 555, 621, 562, + /* 280 */ 498, 530, 530, 626, 507, 514, 530, 635, 636, 538, + /* 290 */ 530, 639, 640, 642, 643, 644, 645, 646, 647, 649, + /* 300 */ 650, 651, 652, 653, 654, 655, 656, 657, 554, 584, + /* 310 */ 648, 658, 605, 607, 667, }; #define YY_REDUCE_COUNT (177) -#define YY_REDUCE_MIN (-245) -#define YY_REDUCE_MAX (402) +#define YY_REDUCE_MIN (-240) +#define YY_REDUCE_MAX (409) static const short yy_reduce_ofst[] = { - /* 0 */ -178, -27, -27, 82, 82, 25, -230, -216, -173, -176, - /* 10 */ -45, -8, 10, 35, 61, 126, 152, -185, -188, -233, - /* 20 */ -206, 90, 108, 115, -191, 1, -186, -46, 81, -189, - /* 30 */ 150, -79, -78, 131, 177, 178, 9, 113, 185, -245, - /* 40 */ -240, -217, -194, -144, -137, -110, -34, 98, 153, 168, - /* 50 */ 173, 174, 179, 189, 190, 191, 193, 194, 195, 212, - /* 60 */ 213, 223, 225, 226, 227, 228, 229, 230, 260, 268, - /* 70 */ 269, 207, 270, 231, 233, 271, 273, 275, 209, 210, - /* 80 */ 234, 237, 279, 284, 291, 292, 296, 297, 303, 304, - /* 90 */ 305, 306, 309, 310, 311, 312, 313, 314, 315, 316, - /* 100 */ 317, 318, 319, 320, 321, 322, 324, 325, 327, 328, - /* 110 */ 329, 330, 331, 332, 334, 335, 336, 337, 339, 340, - /* 120 */ 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, - /* 130 */ 351, 352, 353, 354, 355, 219, 221, 235, 357, 238, - /* 140 */ 358, 243, 239, 253, 240, 360, 241, 364, 366, 365, - /* 150 */ 369, 367, 368, 370, 254, 372, 373, 375, 376, 378, - /* 160 */ 380, 274, 379, 383, 381, 385, 382, 384, 386, 387, - /* 170 */ 389, 393, 397, 399, 400, 402, 398, 401, + /* 0 */ -178, -27, -27, 66, 66, 17, -230, -216, -173, -176, + /* 10 */ -45, -8, 61, 68, 77, 124, 148, -185, -188, -233, + /* 20 */ -206, -91, 21, 46, -191, 32, -186, -183, 93, -89, + /* 30 */ -184, -106, 4, 104, 98, 120, 128, 159, 179, -240, + /* 40 */ -217, -194, -117, -96, -51, -35, -18, 25, 94, 110, + /* 50 */ 142, 167, 174, 185, 189, 195, 196, 197, 198, 175, + /* 60 */ 215, 225, 226, 227, 228, 230, 233, 234, 265, 267, + /* 70 */ 268, 211, 272, 235, 236, 273, 275, 277, 206, 208, + /* 80 */ 238, 239, 283, 284, 289, 292, 301, 302, 306, 308, + /* 90 */ 309, 310, 311, 314, 315, 317, 318, 319, 321, 322, + /* 100 */ 323, 324, 325, 326, 327, 328, 331, 332, 333, 334, + /* 110 */ 335, 336, 337, 339, 340, 341, 342, 343, 344, 345, + /* 120 */ 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, + /* 130 */ 356, 357, 358, 359, 360, 217, 222, 224, 362, 240, + /* 140 */ 363, 241, 243, 242, 251, 260, 278, 244, 369, 245, + /* 150 */ 370, 371, 372, 373, 256, 374, 375, 376, 381, 380, + /* 160 */ 382, 384, 385, 387, 388, 389, 393, 390, 392, 402, + /* 170 */ 403, 394, 404, 406, 407, 409, 405, 408, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 771, 883, 829, 895, 817, 826, 1023, 1023, 771, 771, - /* 10 */ 771, 771, 771, 771, 771, 771, 771, 942, 790, 1023, - /* 20 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 826, - /* 30 */ 771, 771, 832, 826, 832, 832, 937, 867, 885, 771, - /* 40 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 50 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 60 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 70 */ 771, 944, 947, 771, 771, 949, 771, 771, 969, 969, - /* 80 */ 935, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 90 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 100 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 815, - /* 110 */ 771, 813, 771, 771, 771, 771, 771, 771, 771, 771, - /* 120 */ 771, 771, 771, 771, 771, 771, 800, 771, 771, 771, - /* 130 */ 771, 771, 792, 792, 792, 771, 771, 771, 792, 771, - /* 140 */ 792, 976, 980, 974, 962, 970, 961, 957, 955, 954, - /* 150 */ 984, 792, 792, 792, 830, 826, 826, 792, 792, 848, - /* 160 */ 846, 844, 836, 842, 838, 840, 834, 818, 792, 824, - /* 170 */ 824, 792, 824, 792, 824, 792, 867, 885, 771, 985, - /* 180 */ 771, 1022, 975, 1012, 1011, 1018, 1010, 1009, 1008, 771, - /* 190 */ 771, 771, 1004, 1005, 1007, 1006, 771, 771, 1014, 1013, - /* 200 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 210 */ 771, 771, 771, 987, 771, 981, 977, 771, 771, 771, - /* 220 */ 771, 771, 771, 771, 771, 771, 897, 771, 771, 771, - /* 230 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 240 */ 771, 771, 934, 771, 771, 771, 771, 945, 771, 771, - /* 250 */ 771, 771, 771, 771, 771, 771, 771, 971, 771, 963, - /* 260 */ 771, 771, 771, 771, 771, 909, 771, 771, 771, 771, - /* 270 */ 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 280 */ 771, 1034, 1032, 771, 771, 771, 1028, 771, 771, 771, - /* 290 */ 1026, 771, 771, 771, 771, 771, 771, 771, 771, 771, - /* 300 */ 771, 771, 771, 771, 771, 771, 771, 771, 851, 771, - /* 310 */ 798, 796, 771, 788, 771, + /* 0 */ 773, 885, 831, 897, 819, 828, 1026, 1026, 773, 773, + /* 10 */ 773, 773, 773, 773, 773, 773, 773, 944, 792, 1026, + /* 20 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 828, + /* 30 */ 773, 773, 834, 828, 834, 834, 939, 869, 887, 773, + /* 40 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 50 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 60 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 70 */ 773, 946, 949, 773, 773, 951, 773, 773, 971, 971, + /* 80 */ 937, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 90 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 100 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 817, + /* 110 */ 773, 815, 773, 773, 773, 773, 773, 773, 773, 773, + /* 120 */ 773, 773, 773, 773, 773, 773, 802, 773, 773, 773, + /* 130 */ 773, 773, 794, 794, 794, 773, 773, 773, 794, 773, + /* 140 */ 794, 978, 982, 976, 964, 972, 963, 959, 957, 956, + /* 150 */ 986, 794, 794, 794, 832, 828, 828, 794, 794, 850, + /* 160 */ 848, 846, 838, 844, 840, 842, 836, 820, 794, 826, + /* 170 */ 826, 794, 826, 794, 826, 794, 869, 887, 773, 987, + /* 180 */ 773, 1025, 977, 1015, 1014, 1021, 1013, 1012, 1011, 773, + /* 190 */ 773, 773, 1007, 1008, 1010, 1009, 773, 773, 1017, 1016, + /* 200 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 210 */ 773, 773, 773, 989, 773, 983, 979, 773, 773, 773, + /* 220 */ 773, 773, 773, 773, 773, 773, 899, 773, 773, 773, + /* 230 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 240 */ 773, 773, 936, 773, 773, 773, 773, 947, 773, 773, + /* 250 */ 773, 773, 773, 773, 773, 773, 773, 973, 773, 965, + /* 260 */ 773, 773, 773, 773, 773, 911, 773, 773, 773, 773, + /* 270 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 280 */ 773, 1037, 1035, 773, 773, 773, 1031, 773, 773, 773, + /* 290 */ 1029, 773, 773, 773, 773, 773, 773, 773, 773, 773, + /* 300 */ 773, 773, 773, 773, 773, 773, 773, 773, 853, 773, + /* 310 */ 800, 798, 773, 790, 773, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1245,46 +1245,47 @@ static const char *const yyRuleName[] = { /* 223 */ "expr ::= NOW", /* 224 */ "expr ::= VARIABLE", /* 225 */ "expr ::= BOOL", - /* 226 */ "expr ::= ID LP exprlist RP", - /* 227 */ "expr ::= ID LP STAR RP", - /* 228 */ "expr ::= expr IS NULL", - /* 229 */ "expr ::= expr IS NOT NULL", - /* 230 */ "expr ::= expr LT expr", - /* 231 */ "expr ::= expr GT expr", - /* 232 */ "expr ::= expr LE expr", - /* 233 */ "expr ::= expr GE expr", - /* 234 */ "expr ::= expr NE expr", - /* 235 */ "expr ::= expr EQ expr", - /* 236 */ "expr ::= expr BETWEEN expr AND expr", - /* 237 */ "expr ::= expr AND expr", - /* 238 */ "expr ::= expr OR expr", - /* 239 */ "expr ::= expr PLUS expr", - /* 240 */ "expr ::= expr MINUS expr", - /* 241 */ "expr ::= expr STAR expr", - /* 242 */ "expr ::= expr SLASH expr", - /* 243 */ "expr ::= expr REM expr", - /* 244 */ "expr ::= expr LIKE expr", - /* 245 */ "expr ::= expr IN LP exprlist RP", - /* 246 */ "exprlist ::= exprlist COMMA expritem", - /* 247 */ "exprlist ::= expritem", - /* 248 */ "expritem ::= expr", - /* 249 */ "expritem ::=", - /* 250 */ "cmd ::= RESET QUERY CACHE", - /* 251 */ "cmd ::= SYNCDB ids REPLICA", - /* 252 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 253 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 254 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 255 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 256 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 257 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 258 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 259 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 260 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 261 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 262 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 263 */ "cmd ::= KILL CONNECTION INTEGER", - /* 264 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 265 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 226 */ "expr ::= NULL", + /* 227 */ "expr ::= ID LP exprlist RP", + /* 228 */ "expr ::= ID LP STAR RP", + /* 229 */ "expr ::= expr IS NULL", + /* 230 */ "expr ::= expr IS NOT NULL", + /* 231 */ "expr ::= expr LT expr", + /* 232 */ "expr ::= expr GT expr", + /* 233 */ "expr ::= expr LE expr", + /* 234 */ "expr ::= expr GE expr", + /* 235 */ "expr ::= expr NE expr", + /* 236 */ "expr ::= expr EQ expr", + /* 237 */ "expr ::= expr BETWEEN expr AND expr", + /* 238 */ "expr ::= expr AND expr", + /* 239 */ "expr ::= expr OR expr", + /* 240 */ "expr ::= expr PLUS expr", + /* 241 */ "expr ::= expr MINUS expr", + /* 242 */ "expr ::= expr STAR expr", + /* 243 */ "expr ::= expr SLASH expr", + /* 244 */ "expr ::= expr REM expr", + /* 245 */ "expr ::= expr LIKE expr", + /* 246 */ "expr ::= expr IN LP exprlist RP", + /* 247 */ "exprlist ::= exprlist COMMA expritem", + /* 248 */ "exprlist ::= expritem", + /* 249 */ "expritem ::= expr", + /* 250 */ "expritem ::=", + /* 251 */ "cmd ::= RESET QUERY CACHE", + /* 252 */ "cmd ::= SYNCDB ids REPLICA", + /* 253 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 254 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 255 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 256 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 257 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 258 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 259 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 260 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 261 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 262 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 263 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 264 */ "cmd ::= KILL CONNECTION INTEGER", + /* 265 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 266 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1970,46 +1971,47 @@ static const struct { { 252, -1 }, /* (223) expr ::= NOW */ { 252, -1 }, /* (224) expr ::= VARIABLE */ { 252, -1 }, /* (225) expr ::= BOOL */ - { 252, -4 }, /* (226) expr ::= ID LP exprlist RP */ - { 252, -4 }, /* (227) expr ::= ID LP STAR RP */ - { 252, -3 }, /* (228) expr ::= expr IS NULL */ - { 252, -4 }, /* (229) expr ::= expr IS NOT NULL */ - { 252, -3 }, /* (230) expr ::= expr LT expr */ - { 252, -3 }, /* (231) expr ::= expr GT expr */ - { 252, -3 }, /* (232) expr ::= expr LE expr */ - { 252, -3 }, /* (233) expr ::= expr GE expr */ - { 252, -3 }, /* (234) expr ::= expr NE expr */ - { 252, -3 }, /* (235) expr ::= expr EQ expr */ - { 252, -5 }, /* (236) expr ::= expr BETWEEN expr AND expr */ - { 252, -3 }, /* (237) expr ::= expr AND expr */ - { 252, -3 }, /* (238) expr ::= expr OR expr */ - { 252, -3 }, /* (239) expr ::= expr PLUS expr */ - { 252, -3 }, /* (240) expr ::= expr MINUS expr */ - { 252, -3 }, /* (241) expr ::= expr STAR expr */ - { 252, -3 }, /* (242) expr ::= expr SLASH expr */ - { 252, -3 }, /* (243) expr ::= expr REM expr */ - { 252, -3 }, /* (244) expr ::= expr LIKE expr */ - { 252, -5 }, /* (245) expr ::= expr IN LP exprlist RP */ - { 261, -3 }, /* (246) exprlist ::= exprlist COMMA expritem */ - { 261, -1 }, /* (247) exprlist ::= expritem */ - { 262, -1 }, /* (248) expritem ::= expr */ - { 262, 0 }, /* (249) expritem ::= */ - { 189, -3 }, /* (250) cmd ::= RESET QUERY CACHE */ - { 189, -3 }, /* (251) cmd ::= SYNCDB ids REPLICA */ - { 189, -7 }, /* (252) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 189, -7 }, /* (253) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 189, -7 }, /* (254) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 189, -7 }, /* (255) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 189, -8 }, /* (256) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 189, -9 }, /* (257) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 189, -7 }, /* (258) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 189, -7 }, /* (259) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 189, -7 }, /* (260) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 189, -7 }, /* (261) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 189, -8 }, /* (262) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 189, -3 }, /* (263) cmd ::= KILL CONNECTION INTEGER */ - { 189, -5 }, /* (264) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 189, -5 }, /* (265) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + { 252, -1 }, /* (226) expr ::= NULL */ + { 252, -4 }, /* (227) expr ::= ID LP exprlist RP */ + { 252, -4 }, /* (228) expr ::= ID LP STAR RP */ + { 252, -3 }, /* (229) expr ::= expr IS NULL */ + { 252, -4 }, /* (230) expr ::= expr IS NOT NULL */ + { 252, -3 }, /* (231) expr ::= expr LT expr */ + { 252, -3 }, /* (232) expr ::= expr GT expr */ + { 252, -3 }, /* (233) expr ::= expr LE expr */ + { 252, -3 }, /* (234) expr ::= expr GE expr */ + { 252, -3 }, /* (235) expr ::= expr NE expr */ + { 252, -3 }, /* (236) expr ::= expr EQ expr */ + { 252, -5 }, /* (237) expr ::= expr BETWEEN expr AND expr */ + { 252, -3 }, /* (238) expr ::= expr AND expr */ + { 252, -3 }, /* (239) expr ::= expr OR expr */ + { 252, -3 }, /* (240) expr ::= expr PLUS expr */ + { 252, -3 }, /* (241) expr ::= expr MINUS expr */ + { 252, -3 }, /* (242) expr ::= expr STAR expr */ + { 252, -3 }, /* (243) expr ::= expr SLASH expr */ + { 252, -3 }, /* (244) expr ::= expr REM expr */ + { 252, -3 }, /* (245) expr ::= expr LIKE expr */ + { 252, -5 }, /* (246) expr ::= expr IN LP exprlist RP */ + { 261, -3 }, /* (247) exprlist ::= exprlist COMMA expritem */ + { 261, -1 }, /* (248) exprlist ::= expritem */ + { 262, -1 }, /* (249) expritem ::= expr */ + { 262, 0 }, /* (250) expritem ::= */ + { 189, -3 }, /* (251) cmd ::= RESET QUERY CACHE */ + { 189, -3 }, /* (252) cmd ::= SYNCDB ids REPLICA */ + { 189, -7 }, /* (253) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 189, -7 }, /* (254) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 189, -7 }, /* (255) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 189, -7 }, /* (256) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 189, -8 }, /* (257) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 189, -9 }, /* (258) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 189, -7 }, /* (259) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + { 189, -7 }, /* (260) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + { 189, -7 }, /* (261) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + { 189, -7 }, /* (262) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + { 189, -8 }, /* (263) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + { 189, -3 }, /* (264) cmd ::= KILL CONNECTION INTEGER */ + { 189, -5 }, /* (265) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 189, -5 }, /* (266) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2794,7 +2796,7 @@ static void yy_reduce( break; case 200: /* having_opt ::= */ case 210: /* where_opt ::= */ yytestcase(yyruleno==210); - case 249: /* expritem ::= */ yytestcase(yyruleno==249); + case 250: /* expritem ::= */ yytestcase(yyruleno==250); {yymsp[1].minor.yy118 = 0;} break; case 201: /* having_opt ::= HAVING expr */ @@ -2871,112 +2873,116 @@ static void yy_reduce( { yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} yymsp[0].minor.yy118 = yylhsminor.yy118; break; - case 226: /* expr ::= ID LP exprlist RP */ + case 226: /* expr ::= NULL */ +{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} + yymsp[0].minor.yy118 = yylhsminor.yy118; + break; + case 227: /* expr ::= ID LP exprlist RP */ { yylhsminor.yy118 = tSqlExprCreateFunction(yymsp[-1].minor.yy159, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy118 = yylhsminor.yy118; break; - case 227: /* expr ::= ID LP STAR RP */ + case 228: /* expr ::= ID LP STAR RP */ { yylhsminor.yy118 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy118 = yylhsminor.yy118; break; - case 228: /* expr ::= expr IS NULL */ + case 229: /* expr ::= expr IS NULL */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, NULL, TK_ISNULL);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 229: /* expr ::= expr IS NOT NULL */ + case 230: /* expr ::= expr IS NOT NULL */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-3].minor.yy118, NULL, TK_NOTNULL);} yymsp[-3].minor.yy118 = yylhsminor.yy118; break; - case 230: /* expr ::= expr LT expr */ + case 231: /* expr ::= expr LT expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LT);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 231: /* expr ::= expr GT expr */ + case 232: /* expr ::= expr GT expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_GT);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 232: /* expr ::= expr LE expr */ + case 233: /* expr ::= expr LE expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LE);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 233: /* expr ::= expr GE expr */ + case 234: /* expr ::= expr GE expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_GE);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 234: /* expr ::= expr NE expr */ + case 235: /* expr ::= expr NE expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_NE);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 235: /* expr ::= expr EQ expr */ + case 236: /* expr ::= expr EQ expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_EQ);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 236: /* expr ::= expr BETWEEN expr AND expr */ + case 237: /* expr ::= expr BETWEEN expr AND expr */ { tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy118); yylhsminor.yy118 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy118, yymsp[-2].minor.yy118, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy118, TK_LE), TK_AND);} yymsp[-4].minor.yy118 = yylhsminor.yy118; break; - case 237: /* expr ::= expr AND expr */ + case 238: /* expr ::= expr AND expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_AND);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 238: /* expr ::= expr OR expr */ + case 239: /* expr ::= expr OR expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_OR); } yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 239: /* expr ::= expr PLUS expr */ + case 240: /* expr ::= expr PLUS expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_PLUS); } yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 240: /* expr ::= expr MINUS expr */ + case 241: /* expr ::= expr MINUS expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_MINUS); } yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 241: /* expr ::= expr STAR expr */ + case 242: /* expr ::= expr STAR expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_STAR); } yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 242: /* expr ::= expr SLASH expr */ + case 243: /* expr ::= expr SLASH expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_DIVIDE);} yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 243: /* expr ::= expr REM expr */ + case 244: /* expr ::= expr REM expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_REM); } yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 244: /* expr ::= expr LIKE expr */ + case 245: /* expr ::= expr LIKE expr */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LIKE); } yymsp[-2].minor.yy118 = yylhsminor.yy118; break; - case 245: /* expr ::= expr IN LP exprlist RP */ + case 246: /* expr ::= expr IN LP exprlist RP */ {yylhsminor.yy118 = tSqlExprCreate(yymsp[-4].minor.yy118, (tSqlExpr*)yymsp[-1].minor.yy159, TK_IN); } yymsp[-4].minor.yy118 = yylhsminor.yy118; break; - case 246: /* exprlist ::= exprlist COMMA expritem */ + case 247: /* exprlist ::= exprlist COMMA expritem */ {yylhsminor.yy159 = tSqlExprListAppend(yymsp[-2].minor.yy159,yymsp[0].minor.yy118,0, 0);} yymsp[-2].minor.yy159 = yylhsminor.yy159; break; - case 247: /* exprlist ::= expritem */ + case 248: /* exprlist ::= expritem */ {yylhsminor.yy159 = tSqlExprListAppend(0,yymsp[0].minor.yy118,0, 0);} yymsp[0].minor.yy159 = yylhsminor.yy159; break; - case 248: /* expritem ::= expr */ + case 249: /* expritem ::= expr */ {yylhsminor.yy118 = yymsp[0].minor.yy118;} yymsp[0].minor.yy118 = yylhsminor.yy118; break; - case 250: /* cmd ::= RESET QUERY CACHE */ + case 251: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 251: /* cmd ::= SYNCDB ids REPLICA */ + case 252: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} break; - case 252: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 253: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 253: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 254: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2987,14 +2993,14 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 254: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 255: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 255: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 256: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3005,7 +3011,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 256: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 257: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3019,7 +3025,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 257: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 258: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3031,14 +3037,14 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 258: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 259: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 259: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 260: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3049,14 +3055,14 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 260: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 261: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 261: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 262: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3067,7 +3073,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 262: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 263: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3081,13 +3087,13 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 263: /* cmd ::= KILL CONNECTION INTEGER */ + case 264: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 264: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 265: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 265: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 266: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/src/sync/inc/syncInt.h b/src/sync/inc/syncInt.h index 91613ae351..b4d9315a8e 100644 --- a/src/sync/inc/syncInt.h +++ b/src/sync/inc/syncInt.h @@ -35,7 +35,7 @@ extern "C" { #define SYNC_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead) + sizeof(SSyncHead) + 16) #define SYNC_RECV_BUFFER_SIZE (5*1024*1024) -#define SYNC_MAX_FWDS 512 +#define SYNC_MAX_FWDS 1024 #define SYNC_FWD_TIMER 300 #define SYNC_ROLE_TIMER 15000 // ms #define SYNC_CHECK_INTERVAL 1000 // ms diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c index d21743d40a..42ff02b4c4 100644 --- a/src/sync/src/syncMain.c +++ b/src/sync/src/syncMain.c @@ -1459,7 +1459,12 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle if ((pNode->quorum > 1 || force) && code == 0) { code = syncSaveFwdInfo(pNode, pWalHead->version, mhandle); - if (code >= 0) code = 1; + if (code >= 0) { + code = 1; + } else { + pthread_mutex_unlock(&pNode->mutex); + return code; + } } int32_t retLen = taosWriteMsg(pPeer->peerFd, pSyncHead, fwdLen); diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 8233c45632..0836ade77f 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -364,7 +364,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) { // register the qhandle to connect to quit query immediate if connection is broken if (vnodeNotifyCurrentQhandle(pRead->rpcHandle, pRetrieve->qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) { - vError("vgId:%d, QInfo:%"PRIu64 "-%p, retrieve discarded since link is broken, %p", pVnode->vgId, pRetrieve->qhandle, *handle, pRead->rpcHandle); + vError("vgId:%d, QInfo:%"PRIu64 "-%p, retrieve discarded since link is broken, conn:%p", pVnode->vgId, pRetrieve->qhandle, *handle, pRead->rpcHandle); code = TSDB_CODE_RPC_NETWORK_UNAVAIL; qKillQuery(*handle); qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); @@ -409,7 +409,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) { // client is broken, the query needs to be killed immediately. int32_t vnodeNotifyCurrentQhandle(void *handle, uint64_t qId, void *qhandle, int32_t vgId) { SRetrieveTableMsg *pMsg = rpcMallocCont(sizeof(SRetrieveTableMsg)); - pMsg->qhandle = htobe64((uint64_t)qhandle); + pMsg->qId = htobe64(qId); pMsg->header.vgId = htonl(vgId); pMsg->header.contLen = htonl(sizeof(SRetrieveTableMsg)); diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 92e1ba804b..a0be52db7a 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -91,13 +91,17 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara int32_t syncCode = 0; bool force = (pWrite == NULL ? false : pWrite->pHead.msgType != TSDB_MSG_TYPE_SUBMIT); syncCode = syncForwardToPeer(pVnode->sync, pHead, pWrite, qtype, force); - if (syncCode < 0) return syncCode; + if (syncCode < 0) { + pHead->version = 0; + return syncCode; + } // write into WAL code = walWrite(pVnode->wal, pHead); if (code < 0) { if (syncCode > 0) atomic_sub_fetch_32(&pWrite->processedCount, 1); vError("vgId:%d, hver:%" PRIu64 " vver:%" PRIu64 " code:0x%x", pVnode->vgId, pHead->version, pVnode->version, code); + pHead->version = 0; return code; } diff --git a/tests/examples/go/taosdemo.go b/tests/examples/go/taosdemo.go index 2c3a7d09b6..003f5aeddc 100644 --- a/tests/examples/go/taosdemo.go +++ b/tests/examples/go/taosdemo.go @@ -16,45 +16,47 @@ package main import ( "database/sql" + "flag" "fmt" - _ "github.com/taosdata/driver-go/taosSql" + "math/rand" "os" - "sync" "runtime" "strconv" + "sync" "time" - "flag" - "math/rand" + + _ "github.com/taosdata/driver-go/taosSql" + //"golang.org/x/sys/unix" ) const ( - maxLocationSize = 32 - maxSqlBufSize = 65480 + maxLocationSize = 32 + //maxSqlBufSize = 65480 ) -var locations = [maxLocationSize]string { - "Beijing", "Shanghai", "Guangzhou", "Shenzhen", - "HangZhou", "Tianjin", "Wuhan", "Changsha", - "Nanjing", "Xian"} +var locations = [maxLocationSize]string{ + "Beijing", "Shanghai", "Guangzhou", "Shenzhen", + "HangZhou", "Tianjin", "Wuhan", "Changsha", + "Nanjing", "Xian"} type config struct { - hostName string - serverPort int - user string - password string - dbName string - supTblName string - tablePrefix string - numOftables int - numOfRecordsPerTable int - numOfRecordsPerReq int - numOfThreads int - startTimestamp string - startTs int64 + hostName string + serverPort int + user string + password string + dbName string + supTblName string + tablePrefix string + numOftables int + numOfRecordsPerTable int + numOfRecordsPerReq int + numOfThreads int + startTimestamp string + startTs int64 - keep int - days int + keep int + days int } var configPara config @@ -62,7 +64,7 @@ var taosDriverName = "taosSql" var url string func init() { - flag.StringVar(&configPara.hostName, "h", "127.0.0.1","The host to connect to TDengine server.") + flag.StringVar(&configPara.hostName, "h", "127.0.0.1", "The host to connect to TDengine server.") flag.IntVar(&configPara.serverPort, "p", 6030, "The TCP/IP port number to use for the connection to TDengine server.") flag.StringVar(&configPara.user, "u", "root", "The TDengine user name to use when connecting to the server.") flag.StringVar(&configPara.password, "P", "taosdata", "The password to use when connecting to the server.") @@ -80,14 +82,14 @@ func init() { configPara.supTblName = "meters" startTs, err := time.ParseInLocation("2006-01-02 15:04:05", configPara.startTimestamp, time.Local) - if err==nil { - configPara.startTs = startTs.UnixNano() / 1e6 + if err == nil { + configPara.startTs = startTs.UnixNano() / 1e6 } } func printAllArgs() { fmt.Printf("\n============= args parse result: =============\n") - fmt.Printf("hostName: %v\n", configPara.hostName) + fmt.Printf("hostName: %v\n", configPara.hostName) fmt.Printf("serverPort: %v\n", configPara.serverPort) fmt.Printf("usr: %v\n", configPara.user) fmt.Printf("password: %v\n", configPara.password) @@ -104,10 +106,10 @@ func printAllArgs() { func main() { printAllArgs() fmt.Printf("Please press enter key to continue....\n") - fmt.Scanln() + _, _ = fmt.Scanln() url = "root:taosdata@/tcp(" + configPara.hostName + ":" + strconv.Itoa(configPara.serverPort) + ")/" - //url = fmt.Sprintf("%s:%s@/tcp(%s:%d)/%s?interpolateParams=true", configPara.user, configPara.password, configPara.hostName, configPara.serverPort, configPara.dbName) + //url = fmt.Sprintf("%s:%s@/tcp(%s:%d)/%s?interpolateParams=true", configPara.user, configPara.password, configPara.hostName, configPara.serverPort, configPara.dbName) // open connect to taos server //db, err := sql.Open(taosDriverName, url) //if err != nil { @@ -115,7 +117,7 @@ func main() { // os.Exit(1) //} //defer db.Close() - rand.Seed(time.Now().Unix()) + rand.Seed(time.Now().Unix()) createDatabase(configPara.dbName, configPara.supTblName) fmt.Printf("======== create database success! ========\n\n") @@ -138,7 +140,7 @@ func main() { func createDatabase(dbName string, supTblName string) { db, err := sql.Open(taosDriverName, url) if err != nil { - fmt.Println("Open database error: %s\n", err) + fmt.Printf("Open database error: %s\n", err) os.Exit(1) } defer db.Close() @@ -165,27 +167,27 @@ func createDatabase(dbName string, supTblName string) { checkErr(err, sqlStr) } -func multiThreadCreateTable(threads int, ntables int, dbName string, tablePrefix string) { +func multiThreadCreateTable(threads int, nTables int, dbName string, tablePrefix string) { st := time.Now().UnixNano() - if (threads < 1) { - threads = 1; + if threads < 1 { + threads = 1 } - a := ntables / threads; - if (a < 1) { - threads = ntables; - a = 1; + a := nTables / threads + if a < 1 { + threads = nTables + a = 1 } - b := ntables % threads; + b := nTables % threads - last := 0; + last := 0 endTblId := 0 wg := sync.WaitGroup{} for i := 0; i < threads; i++ { startTblId := last - if (i < b ) { + if i < b { endTblId = last + a } else { endTblId = last + a - 1 @@ -206,42 +208,43 @@ func createTable(dbName string, childTblPrefix string, startTblId int, endTblId db, err := sql.Open(taosDriverName, url) if err != nil { - fmt.Println("Open database error: %s\n", err) + fmt.Printf("Open database error: %s\n", err) os.Exit(1) } defer db.Close() - for i := startTblId; i <= endTblId; i++ { - sqlStr := "create table if not exists " + dbName + "." + childTblPrefix + strconv.Itoa(i) + " using " + dbName + ".meters tags('" + locations[i%maxLocationSize] + "', " + strconv.Itoa(i) + ");" - //fmt.Printf("sqlStr: %v\n", sqlStr) - _, err = db.Exec(sqlStr) - checkErr(err, sqlStr) - } - wg.Done() - runtime.Goexit() + for i := startTblId; i <= endTblId; i++ { + sqlStr := "create table if not exists " + dbName + "." + childTblPrefix + strconv.Itoa(i) + " using " + dbName + ".meters tags('" + locations[i%maxLocationSize] + "', " + strconv.Itoa(i) + ");" + //fmt.Printf("sqlStr: %v\n", sqlStr) + _, err = db.Exec(sqlStr) + checkErr(err, sqlStr) + } + wg.Done() + runtime.Goexit() } func generateRowData(ts int64) string { - voltage := rand.Int() % 1000 - current := 200 + rand.Float32() - phase := rand.Float32() - values := "( " + strconv.FormatInt(ts, 10) + ", " + strconv.FormatFloat(float64(current), 'f', 6, 64) + ", " + strconv.Itoa(voltage) + ", " + strconv.FormatFloat(float64(phase), 'f', 6, 64) + " ) " - return values + voltage := rand.Int() % 1000 + current := 200 + rand.Float32() + phase := rand.Float32() + values := "( " + strconv.FormatInt(ts, 10) + ", " + strconv.FormatFloat(float64(current), 'f', 6, 64) + ", " + strconv.Itoa(voltage) + ", " + strconv.FormatFloat(float64(phase), 'f', 6, 64) + " ) " + return values } + func insertData(dbName string, childTblPrefix string, startTblId int, endTblId int, wg *sync.WaitGroup) { //fmt.Printf("subThread[%d]: insert data to table from %d to %d \n", unix.Gettid(), startTblId, endTblId) // windows.GetCurrentThreadId() db, err := sql.Open(taosDriverName, url) if err != nil { - fmt.Println("Open database error: %s\n", err) + fmt.Printf("Open database error: %s\n", err) os.Exit(1) } defer db.Close() - tmpTs := configPara.startTs; + tmpTs := configPara.startTs //rand.New(rand.NewSource(time.Now().UnixNano())) - for tID := startTblId; tID <= endTblId; tID++{ + for tID := startTblId; tID <= endTblId; tID++ { totalNum := 0 for { sqlStr := "insert into " + dbName + "." + childTblPrefix + strconv.Itoa(tID) + " values " @@ -249,13 +252,13 @@ func insertData(dbName string, childTblPrefix string, startTblId int, endTblId i for { tmpTs += 1000 valuesOfRow := generateRowData(tmpTs) - currRowNum += 1 - totalNum += 1 + currRowNum += 1 + totalNum += 1 sqlStr = fmt.Sprintf("%s %s", sqlStr, valuesOfRow) - if (currRowNum >= configPara.numOfRecordsPerReq || totalNum >= configPara.numOfRecordsPerTable) { - break + if currRowNum >= configPara.numOfRecordsPerReq || totalNum >= configPara.numOfRecordsPerTable { + break } } @@ -265,12 +268,12 @@ func insertData(dbName string, childTblPrefix string, startTblId int, endTblId i count, err := res.RowsAffected() checkErr(err, "rows affected") - if (count != int64(currRowNum)) { - fmt.Printf("insert data, expect affected:%d, actual:%d\n", currRowNum, count) + if count != int64(currRowNum) { + fmt.Printf("insert data, expect affected:%d, actual:%d\n", currRowNum, count) os.Exit(1) } - if (totalNum >= configPara.numOfRecordsPerTable) { + if totalNum >= configPara.numOfRecordsPerTable { break } } @@ -279,44 +282,46 @@ func insertData(dbName string, childTblPrefix string, startTblId int, endTblId i wg.Done() runtime.Goexit() } -func multiThreadInsertData(threads int, ntables int, dbName string, tablePrefix string) { + +func multiThreadInsertData(threads int, nTables int, dbName string, tablePrefix string) { st := time.Now().UnixNano() - if (threads < 1) { - threads = 1; + if threads < 1 { + threads = 1 } - a := ntables / threads; - if (a < 1) { - threads = ntables; - a = 1; + a := nTables / threads + if a < 1 { + threads = nTables + a = 1 } - b := ntables % threads; + b := nTables % threads - last := 0; + last := 0 endTblId := 0 wg := sync.WaitGroup{} for i := 0; i < threads; i++ { startTblId := last - if (i < b ) { + if i < b { endTblId = last + a } else { endTblId = last + a - 1 } last = endTblId + 1 wg.Add(1) - go insertData(dbName, tablePrefix, startTblId , endTblId, &wg) + go insertData(dbName, tablePrefix, startTblId, endTblId, &wg) } wg.Wait() et := time.Now().UnixNano() fmt.Printf("insert data spent duration: %6.6fs\n", (float32(et-st))/1e9) } -func selectTest(dbName string, tbPrefix string, supTblName string){ + +func selectTest(dbName string, tbPrefix string, supTblName string) { db, err := sql.Open(taosDriverName, url) if err != nil { - fmt.Println("Open database error: %s\n", err) + fmt.Printf("Open database error: %s\n", err) os.Exit(1) } defer db.Close() @@ -332,12 +337,12 @@ func selectTest(dbName string, tbPrefix string, supTblName string){ fmt.Printf("query sql: %s\n", sqlStr) for rows.Next() { var ( - ts string - current float32 - voltage int - phase float32 - location string - groupid int + ts string + current float32 + voltage int + phase float32 + location string + groupid int ) err := rows.Scan(&ts, ¤t, &voltage, &phase, &location, &groupid) if err != nil { @@ -352,7 +357,7 @@ func selectTest(dbName string, tbPrefix string, supTblName string){ } // select sql 2 - sqlStr = "select avg(voltage), min(voltage), max(voltage) from " + dbName + "." + tbPrefix + strconv.Itoa( rand.Int() % configPara.numOftables) + sqlStr = "select avg(voltage), min(voltage), max(voltage) from " + dbName + "." + tbPrefix + strconv.Itoa(rand.Int()%configPara.numOftables) rows, err = db.Query(sqlStr) checkErr(err, sqlStr) @@ -360,9 +365,9 @@ func selectTest(dbName string, tbPrefix string, supTblName string){ fmt.Printf("\nquery sql: %s\n", sqlStr) for rows.Next() { var ( - voltageAvg float32 - voltageMin int - voltageMax int + voltageAvg float32 + voltageMin int + voltageMax int ) err := rows.Scan(&voltageAvg, &voltageMin, &voltageMax) if err != nil { @@ -385,10 +390,10 @@ func selectTest(dbName string, tbPrefix string, supTblName string){ fmt.Printf("\nquery sql: %s\n", sqlStr) for rows.Next() { var ( - lastTs string - lastCurrent float32 - lastVoltage int - lastPhase float32 + lastTs string + lastCurrent float32 + lastVoltage int + lastPhase float32 ) err := rows.Scan(&lastTs, &lastCurrent, &lastVoltage, &lastPhase) if err != nil { diff --git a/tests/pytest/tools/insert-tblimit-tboffset-createdb.json b/tests/pytest/tools/insert-tblimit-tboffset-createdb.json new file mode 100644 index 0000000000..8c3b39fb0b --- /dev/null +++ b/tests/pytest/tools/insert-tblimit-tboffset-createdb.json @@ -0,0 +1,57 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "num_of_records_per_req": 100, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 0, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/insert-tblimit-tboffset-insertrec.json b/tests/pytest/tools/insert-tblimit-tboffset-insertrec.json new file mode 100644 index 0000000000..a9efa7c31c --- /dev/null +++ b/tests/pytest/tools/insert-tblimit-tboffset-insertrec.json @@ -0,0 +1,59 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "num_of_records_per_req": 100, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "childtable_count": 100, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1000, + "childtable_limit": 33, + "childtable_offset": 33, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/insert-tblimit-tboffset0.json b/tests/pytest/tools/insert-tblimit-tboffset0.json index 7dcb2e0527..6bf3783cb2 100644 --- a/tests/pytest/tools/insert-tblimit-tboffset0.json +++ b/tests/pytest/tools/insert-tblimit-tboffset0.json @@ -15,7 +15,7 @@ "databases": [{ "dbinfo": { "name": "db", - "drop": "yes", + "drop": "no", "replica": 1, "days": 10, "cache": 16, @@ -33,7 +33,7 @@ }, "super_tables": [{ "name": "stb", - "child_table_exists":"no", + "child_table_exists":"yes", "childtable_count": 100, "childtable_prefix": "stb_", "auto_create_table": "no", diff --git a/tests/pytest/tools/insert-tblimit1-tboffset.json b/tests/pytest/tools/insert-tblimit1-tboffset.json index a33dc22d5d..292902093d 100644 --- a/tests/pytest/tools/insert-tblimit1-tboffset.json +++ b/tests/pytest/tools/insert-tblimit1-tboffset.json @@ -15,7 +15,7 @@ "databases": [{ "dbinfo": { "name": "db", - "drop": "yes", + "drop": "no", "replica": 1, "days": 10, "cache": 16, @@ -33,7 +33,7 @@ }, "super_tables": [{ "name": "stb", - "child_table_exists":"no", + "child_table_exists":"yes", "childtable_count": 100, "childtable_prefix": "stb_", "auto_create_table": "no", diff --git a/tests/pytest/tools/taosdemo-sampledata.json b/tests/pytest/tools/taosdemo-sampledata.json index 473c977773..d543b7e086 100644 --- a/tests/pytest/tools/taosdemo-sampledata.json +++ b/tests/pytest/tools/taosdemo-sampledata.json @@ -16,8 +16,6 @@ "name": "stb", "child_table_exists":"no", "childtable_count": 20, - "childtable_limit": 10, - "childtable_offset": 0, "childtable_prefix": "t_", "auto_create_table": "no", "data_source": "sample", diff --git a/tests/pytest/tools/taosdemoTestLimitOffset.py b/tests/pytest/tools/taosdemoTestLimitOffset.py index bce41e1c75..dd8a1bee70 100644 --- a/tests/pytest/tools/taosdemoTestLimitOffset.py +++ b/tests/pytest/tools/taosdemoTestLimitOffset.py @@ -51,7 +51,8 @@ class TDTestCase: else: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" - os.system("%staosdemo -f tools/insert-tblimit-tboffset.json" % binPath) + os.system("%staosdemo -f tools/insert-tblimit-tboffset-createdb.json" % binPath) + os.system("%staosdemo -f tools/insert-tblimit-tboffset-insertrec.json" % binPath) tdSql.execute("use db") tdSql.query("select count(tbname) from db.stb") @@ -59,6 +60,7 @@ class TDTestCase: tdSql.query("select count(*) from db.stb") tdSql.checkData(0, 0, 33000) + os.system("%staosdemo -f tools/insert-tblimit-tboffset-createdb.json" % binPath) os.system("%staosdemo -f tools/insert-tblimit-tboffset0.json" % binPath) tdSql.execute("reset query cache") @@ -68,6 +70,7 @@ class TDTestCase: tdSql.query("select count(*) from db.stb") tdSql.checkData(0, 0, 20000) + os.system("%staosdemo -f tools/insert-tblimit-tboffset-createdb.json" % binPath) os.system("%staosdemo -f tools/insert-tblimit1-tboffset.json" % binPath) tdSql.execute("reset query cache") diff --git a/tests/pytest/tools/taosdemoTestSampleData.py b/tests/pytest/tools/taosdemoTestSampleData.py index 893c53984d..a8710a9df3 100644 --- a/tests/pytest/tools/taosdemoTestSampleData.py +++ b/tests/pytest/tools/taosdemoTestSampleData.py @@ -57,7 +57,7 @@ class TDTestCase: tdSql.query("select count(tbname) from db.stb") tdSql.checkData(0, 0, 20) tdSql.query("select count(*) from db.stb") - tdSql.checkData(0, 0, 200) + tdSql.checkData(0, 0, 400) def stop(self): tdSql.close() diff --git a/tests/script/general/parser/topbot.sim b/tests/script/general/parser/topbot.sim index e23bbf6724..5c61acb2ba 100644 --- a/tests/script/general/parser/topbot.sim +++ b/tests/script/general/parser/topbot.sim @@ -325,4 +325,56 @@ if $row != 0 then return -1 endi +print ===============================>td-3621 +sql create table ttm2(ts timestamp, k bool); +sql insert into ttm2 values('2021-1-1 1:1:1', true) +sql insert into ttm2 values('2021-1-1 1:1:2', NULL) +sql insert into ttm2 values('2021-1-1 1:1:3', false) +sql select * from ttm2 where k is not null +if $row != 2 then + return -1 +endi + +if $data00 != @21-01-01 01:01:01.000@ then + print expect 21-01-01 01:01:01.000, actual $data00 + return -1 +endi + +sql select * from ttm2 where k is null +if $row != 1 then + return -1 +endi + +if $data00 != @21-01-01 01:01:02.000@ then + return -1 +endi + +sql select * from ttm2 where k=true +if $row != 1 then + return -1 +endi + +if $data00 != @21-01-01 01:01:01.000@ then + return -1 +endi + +sql select * from ttm2 where k=false +if $row != 1 then + return -1 +endi + +if $data00 != @21-01-01 01:01:03.000@ then + return -1 +endi + +sql select * from ttm2 where k<>false +if $row != 1 then + return -1 +endi + +sql_error select * from ttm2 where k=null +sql_error select * from ttm2 where k<>null +sql_error select * from ttm2 where k like null +sql_error select * from ttm2 where k