diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index e78e259eb21ac2bc3a57b261481635c288f328dc..9a1c87c1a915dbaab2ab529c4b5f7f9cab745d60 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -133,6 +133,7 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo); bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex); bool tscQueryTags(SQueryInfo* pQueryInfo); bool tscMultiRoundQuery(SQueryInfo* pQueryInfo, int32_t tableIndex); +bool tscQueryBlockInfo(SQueryInfo* pQueryInfo); SSqlExpr* tscAddFuncInSelectClause(SQueryInfo* pQueryInfo, int32_t outputColIndex, int16_t functionId, SColumnIndex* pIndex, SSchema* pColSchema, int16_t colType); diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c index 4407ed31a02a58eea790a9262d1188f738369205..55b89b2786d178fa0c82a6939d7f24bd3634ebb3 100644 --- a/src/client/src/tscLocalMerge.c +++ b/src/client/src/tscLocalMerge.c @@ -100,6 +100,10 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalMerger *pReducer, tOrderDescr } else if (functionId == TSDB_FUNC_APERCT) { pCtx->param[0].i64 = pExpr->param[0].i64; pCtx->param[0].nType = pExpr->param[0].nType; + } else if (functionId == TSDB_FUNC_BLKINFO) { + pCtx->param[0].i64 = pExpr->param[0].i64; + pCtx->param[0].nType = pExpr->param[0].nType; + pCtx->numOfParams = 1; } pCtx->interBufBytes = pExpr->interBytes; diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index c1ebef5d53d510fff623f22a376fd4d89142baa3..60f2cfb8a0c8449f6043f0e7191a0b6a5c36a051 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1539,6 +1539,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel if (pQueryInfo->colList == NULL) { pQueryInfo->colList = taosArrayInit(4, POINTER_BYTES); } + bool hasDistinct = false; for (int32_t i = 0; i < pSelection->nExpr; ++i) { int32_t outputIndex = (int32_t)tscSqlExprNumOfExprs(pQueryInfo); @@ -1547,25 +1548,26 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel if (hasDistinct == false) { hasDistinct = (pItem->distinct == true); } - // project on all fields - int32_t optr = pItem->pNode->nSQLOptr; - if (optr == TK_ALL || optr == TK_ID || optr == TK_STRING || optr == TK_INTEGER || optr == TK_FLOAT) { - // it is actually a function, but the function name is invalid - if (pItem->pNode->nSQLOptr == TK_ID && (pItem->pNode->colInfo.z == NULL && pItem->pNode->colInfo.n == 0)) { + int32_t optr = pItem->pNode->nSQLOptr; + if (optr == TK_FUNCTION) { + int32_t functId = isValidFunction(pItem->pNode->token.z, pItem->pNode->token.n); + if (functId < 0) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg5); } - // select table_name1.field_name1, table_name2.field_name2 from table_name1, table_name2 - if (addProjectionExprAndResultField(pCmd, pQueryInfo, pItem) != TSDB_CODE_SUCCESS) { - return TSDB_CODE_TSC_INVALID_SQL; - } - } else if (pItem->pNode->nSQLOptr >= TK_COUNT && pItem->pNode->nSQLOptr <= TK_TBID) { + pItem->pNode->nSQLOptr = functId; + // sql function in selection clause, append sql function info in pSqlCmd structure sequentially if (addExprAndResultField(pCmd, pQueryInfo, outputIndex, pItem, true) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_SQL; } - + } else if (optr == TK_ALL || optr == TK_ID || optr == TK_STRING || optr == TK_INTEGER || optr == TK_FLOAT) { + // use the dynamic array list to decide if the function is valid or not + // select table_name1.field_name1, table_name2.field_name2 from table_name1, table_name2 + if (addProjectionExprAndResultField(pCmd, pQueryInfo, pItem) != TSDB_CODE_SUCCESS) { + return TSDB_CODE_TSC_INVALID_SQL; + } } else if (pItem->pNode->nSQLOptr >= TK_PLUS && pItem->pNode->nSQLOptr <= TK_REM) { int32_t code = handleArithmeticExpr(pCmd, clauseIndex, i, pItem); if (code != TSDB_CODE_SUCCESS) { @@ -1589,7 +1591,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel // there is only one user-defined column in the final result field, add the timestamp column. size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList); - if (numOfSrcCols <= 0 && !tscQueryTags(pQueryInfo)) { + if (numOfSrcCols <= 0 && !tscQueryTags(pQueryInfo) && !tscQueryBlockInfo(pQueryInfo)) { addPrimaryTsColIntoResult(pQueryInfo); } @@ -1876,7 +1878,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col const char* msg9 = "invalid function"; switch (optr) { - case TK_COUNT: { + case TSDB_FUNC_COUNT: { /* more than one parameter for count() function */ if (pItem->pNode->pParam != NULL && pItem->pNode->pParam->nExpr != 1) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); @@ -1971,23 +1973,23 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col return TSDB_CODE_SUCCESS; } - case TK_SUM: - case TK_AVG: - case TK_RATE: - case TK_IRATE: - case TK_SUM_RATE: - case TK_SUM_IRATE: - case TK_AVG_RATE: - case TK_AVG_IRATE: - case TK_TWA: - case TK_MIN: - case TK_MAX: - case TK_DIFF: - case TK_STDDEV: - case TK_LEASTSQUARES: { + case TSDB_FUNC_SUM: + case TSDB_FUNC_AVG: + case TSDB_FUNC_RATE: + case TSDB_FUNC_IRATE: + case TSDB_FUNC_SUM_RATE: + case TSDB_FUNC_SUM_IRATE: + case TSDB_FUNC_AVG_RATE: + case TSDB_FUNC_AVG_IRATE: + case TSDB_FUNC_TWA: + case TSDB_FUNC_MIN: + case TSDB_FUNC_MAX: + case TSDB_FUNC_DIFF: + case TSDB_FUNC_STDDEV: + case TSDB_FUNC_LEASTSQR: { // 1. valid the number of parameters - if (pItem->pNode->pParam == NULL || (optr != TK_LEASTSQUARES && pItem->pNode->pParam->nExpr != 1) || - (optr == TK_LEASTSQUARES && pItem->pNode->pParam->nExpr != 3)) { + if (pItem->pNode->pParam == NULL || (optr != TSDB_FUNC_LEASTSQR && pItem->pNode->pParam->nExpr != 1) || + (optr == TSDB_FUNC_LEASTSQR && pItem->pNode->pParam->nExpr != 3)) { /* no parameters or more than one parameter for function */ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -2029,7 +2031,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col } // set the first column ts for diff query - if (optr == TK_DIFF) { + if (optr == TSDB_FUNC_DIFF) { colIndex += 1; SColumnIndex indexTS = {.tableIndex = index.tableIndex, .columnIndex = 0}; SSqlExpr* pExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &indexTS, TSDB_DATA_TYPE_TIMESTAMP, TSDB_KEYSIZE, @@ -2046,7 +2048,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col SSqlExpr* pExpr = tscSqlExprAppend(pQueryInfo, functionID, &index, resultType, resultSize, getNewResColId(pQueryInfo), resultSize, false); - if (optr == TK_LEASTSQUARES) { + if (optr == TSDB_FUNC_LEASTSQR) { /* set the leastsquares parameters */ char val[8] = {0}; if (tVariantDump(&pParamElem[1].pNode->val, val, TSDB_DATA_TYPE_DOUBLE, true) < 0) { @@ -2082,11 +2084,11 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col tscInsertPrimaryTsSourceColumn(pQueryInfo, &index); return TSDB_CODE_SUCCESS; } - case TK_FIRST: - case TK_LAST: - case TK_SPREAD: - case TK_LAST_ROW: - case TK_INTERP: { + case TSDB_FUNC_FIRST: + case TSDB_FUNC_LAST: + case TSDB_FUNC_SPREAD: + case TSDB_FUNC_LAST_ROW: + case TSDB_FUNC_INTERP: { bool requireAllFields = (pItem->pNode->pParam == NULL); int16_t functionID = 0; @@ -2162,7 +2164,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col return TSDB_CODE_TSC_INVALID_SQL; } - if (optr == TK_LAST) { // todo refactor + if (optr == TSDB_FUNC_LAST) { // todo refactor SSqlGroupbyExpr* pGroupBy = &pQueryInfo->groupbyExpr; if (pGroupBy->numOfGroupCols > 0) { for(int32_t k = 0; k < pGroupBy->numOfGroupCols; ++k) { @@ -2210,14 +2212,13 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col numOfFields += tscGetNumOfColumns(pTableMetaInfo->pTableMeta); } - return TSDB_CODE_SUCCESS; } } - case TK_TOP: - case TK_BOTTOM: - case TK_PERCENTILE: - case TK_APERCENTILE: { + case TSDB_FUNC_TOP: + case TSDB_FUNC_BOTTOM: + case TSDB_FUNC_PERCT: + case TSDB_FUNC_APERCT: { // 1. valid the number of parameters if (pItem->pNode->pParam == NULL || pItem->pNode->pParam->nExpr != 2) { /* no parameters or more than one parameter for function */ @@ -2265,7 +2266,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col char val[8] = {0}; SSqlExpr* pExpr = NULL; - if (optr == TK_PERCENTILE || optr == TK_APERCENTILE) { + if (optr == TSDB_FUNC_PERCT || optr == TSDB_FUNC_APERCT) { tVariantDump(pVariant, val, TSDB_DATA_TYPE_DOUBLE, true); double dp = GET_DOUBLE_VAL(val); @@ -2336,7 +2337,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col return TSDB_CODE_SUCCESS; }; - case TK_TBID: { + case TSDB_FUNC_TID_TAG: { pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg7); @@ -2404,6 +2405,30 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col return TSDB_CODE_SUCCESS; } + case TSDB_FUNC_BLKINFO: { + // no parameters or more than one parameter for function + if (pItem->pNode->pParam != NULL && pItem->pNode->pParam->nExpr != 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } + + SColumnIndex index = {.tableIndex = 0, .columnIndex = TSDB_BLOCK_DIST_COLUMN_INDEX,}; + pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex); + + SSchema s = {.name = "block_dist", .type = TSDB_DATA_TYPE_BINARY}; + int32_t inter = 0; + int16_t resType = 0; + int16_t bytes = 0; + getResultDataInfo(TSDB_DATA_TYPE_INT, 4, TSDB_FUNC_BLKINFO, 0, &resType, &bytes, &inter, 0, 0); + + s.bytes = bytes; + s.type = resType; + SSqlExpr* pExpr = tscAddFuncInSelectClause(pQueryInfo, 0, TSDB_FUNC_BLKINFO, &index, &s, TSDB_COL_TAG); + pExpr->numOfParams = 1; + pExpr->param[0].i64 = pTableMetaInfo->pTableMeta->tableInfo.rowSize; + pExpr->param[0].nType = TSDB_DATA_TYPE_BIGINT; + + return TSDB_CODE_SUCCESS; + } default: return TSDB_CODE_TSC_INVALID_SQL; @@ -2572,76 +2597,76 @@ int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQueryInfo* int32_t convertFunctionId(int32_t optr, int16_t* functionId) { switch (optr) { - case TK_COUNT: + case TSDB_FUNC_COUNT: *functionId = TSDB_FUNC_COUNT; break; - case TK_SUM: + case TSDB_FUNC_SUM: *functionId = TSDB_FUNC_SUM; break; - case TK_AVG: + case TSDB_FUNC_AVG: *functionId = TSDB_FUNC_AVG; break; - case TK_RATE: + case TSDB_FUNC_RATE: *functionId = TSDB_FUNC_RATE; break; - case TK_IRATE: + case TSDB_FUNC_IRATE: *functionId = TSDB_FUNC_IRATE; break; - case TK_SUM_RATE: + case TSDB_FUNC_SUM_RATE: *functionId = TSDB_FUNC_SUM_RATE; break; - case TK_SUM_IRATE: + case TSDB_FUNC_SUM_IRATE: *functionId = TSDB_FUNC_SUM_IRATE; break; - case TK_AVG_RATE: + case TSDB_FUNC_AVG_RATE: *functionId = TSDB_FUNC_AVG_RATE; break; - case TK_AVG_IRATE: + case TSDB_FUNC_AVG_IRATE: *functionId = TSDB_FUNC_AVG_IRATE; break; - case TK_MIN: + case TSDB_FUNC_MIN: *functionId = TSDB_FUNC_MIN; break; - case TK_MAX: + case TSDB_FUNC_MAX: *functionId = TSDB_FUNC_MAX; break; - case TK_STDDEV: + case TSDB_FUNC_STDDEV: *functionId = TSDB_FUNC_STDDEV; break; - case TK_PERCENTILE: + case TSDB_FUNC_PERCT: *functionId = TSDB_FUNC_PERCT; break; - case TK_APERCENTILE: + case TSDB_FUNC_APERCT: *functionId = TSDB_FUNC_APERCT; break; - case TK_FIRST: + case TSDB_FUNC_FIRST: *functionId = TSDB_FUNC_FIRST; break; - case TK_LAST: + case TSDB_FUNC_LAST: *functionId = TSDB_FUNC_LAST; break; - case TK_LEASTSQUARES: + case TSDB_FUNC_LEASTSQR: *functionId = TSDB_FUNC_LEASTSQR; break; - case TK_TOP: + case TSDB_FUNC_TOP: *functionId = TSDB_FUNC_TOP; break; - case TK_BOTTOM: + case TSDB_FUNC_BOTTOM: *functionId = TSDB_FUNC_BOTTOM; break; - case TK_DIFF: + case TSDB_FUNC_DIFF: *functionId = TSDB_FUNC_DIFF; break; - case TK_SPREAD: + case TSDB_FUNC_SPREAD: *functionId = TSDB_FUNC_SPREAD; break; - case TK_TWA: + case TSDB_FUNC_TWA: *functionId = TSDB_FUNC_TWA; break; - case TK_INTERP: + case TSDB_FUNC_INTERP: *functionId = TSDB_FUNC_INTERP; break; - case TK_LAST_ROW: + case TSDB_FUNC_LAST_ROW: *functionId = TSDB_FUNC_LAST_ROW; break; default: @@ -3176,7 +3201,7 @@ static int32_t tSQLExprNodeToString(tSQLExpr* pExpr, char** str) { } else if (pExpr->nSQLOptr >= TK_BOOL && pExpr->nSQLOptr <= TK_STRING) { // value *str += tVariantToString(&pExpr->val, *str); - } else if (pExpr->nSQLOptr >= TK_COUNT && pExpr->nSQLOptr <= TK_AVG_IRATE) { + } else if (pExpr->nSQLOptr >= TSDB_FUNC_COUNT && pExpr->nSQLOptr <= TSDB_FUNC_BLKINFO) { /* * arithmetic expression of aggregation, such as count(ts) + count(ts) *2 */ @@ -3579,7 +3604,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSQLExpr* pExpr, SQueryInfo* pQuer pList->ids[pList->num++] = index; } else if (pExpr->nSQLOptr == TK_FLOAT && (isnan(pExpr->val.dKey) || isinf(pExpr->val.dKey))) { return TSDB_CODE_TSC_INVALID_SQL; - } else if (pExpr->nSQLOptr >= TK_COUNT && pExpr->nSQLOptr <= TK_AVG_IRATE) { + } else if (pExpr->nSQLOptr >= TSDB_FUNC_COUNT && pExpr->nSQLOptr <= TSDB_FUNC_AVG_IRATE) { if (*type == NON_ARITHMEIC_EXPR) { *type = AGG_ARIGHTMEIC; } else if (*type == NORMAL_ARITHMETIC) { @@ -3679,7 +3704,7 @@ static bool isValidExpr(tSQLExpr* pLeft, tSQLExpr* pRight, int32_t optr) { * * However, columnA < 4+12 is valid */ - if (pLeft->nSQLOptr >= TK_COUNT && pLeft->nSQLOptr <= TK_AVG_IRATE) { + if (pLeft->nSQLOptr >= TSDB_FUNC_COUNT && pLeft->nSQLOptr <= TSDB_FUNC_AVG_IRATE) { return false; } @@ -3687,7 +3712,7 @@ static bool isValidExpr(tSQLExpr* pLeft, tSQLExpr* pRight, int32_t optr) { return true; } - if (pRight->nSQLOptr >= TK_COUNT && pRight->nSQLOptr <= TK_AVG_IRATE) { + if (pRight->nSQLOptr >= TSDB_FUNC_COUNT && pRight->nSQLOptr <= TSDB_FUNC_AVG_IRATE) { return false; } @@ -6848,7 +6873,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pS tVariantAssign((*pExpr)->pVal, &pSqlExpr->val); return TSDB_CODE_SUCCESS; - } else if (pSqlExpr->nSQLOptr >= TK_COUNT && pSqlExpr->nSQLOptr <= TK_AVG_IRATE) { + } else if (pSqlExpr->nSQLOptr >= TSDB_FUNC_COUNT && pSqlExpr->nSQLOptr <= TSDB_FUNC_BLKINFO) { // arithmetic expression on the results of aggregation functions *pExpr = calloc(1, sizeof(tExprNode)); (*pExpr)->nodeType = TSQL_NODE_COL; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index d8e5fc88b5fa378b28635c9ef8e948f1c206ce81..444bdc025d0b06b9be96e53f761373b5454d9a35 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -700,7 +700,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { STableMeta * pTableMeta = pTableMetaInfo->pTableMeta; size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList); - if (numOfSrcCols <= 0 && !tscQueryTags(pQueryInfo)) { + if (numOfSrcCols <= 0 && !tscQueryTags(pQueryInfo) && !tscQueryBlockInfo(pQueryInfo)) { tscError("%p illegal value of numOfCols in query msg: %" PRIu64 ", table cols:%d", pSql, (uint64_t)numOfSrcCols, tscGetNumOfColumns(pTableMeta)); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index be3bf071975c796aec23b1721f043b69db80a05d..3c5b84a6ad67728f132aa680205a353dc0c33296 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -97,6 +97,22 @@ bool tscQueryTags(SQueryInfo* pQueryInfo) { return true; } +bool tscQueryBlockInfo(SQueryInfo* pQueryInfo) { + int32_t numOfCols = (int32_t) tscSqlExprNumOfExprs(pQueryInfo); + + for (int32_t i = 0; i < numOfCols; ++i) { + SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i); + int32_t functId = pExpr->functionId; + + // "select count(tbname)" query + if (functId == TSDB_FUNC_BLKINFO) { + return true; + } + } + + return false; +} + bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) { if (pQueryInfo == NULL) { return false; diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index a660b9e13f0abb8291f544638001ce0134437e61..3a42f1237037060e33e0f1c750f16ce8662d1d5f 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -182,7 +182,6 @@ typedef struct SDataBlockInfo { } SDataBlockInfo; typedef struct SFileBlockInfo { - int32_t len; int32_t numOfRows; } SFileBlockInfo; @@ -197,6 +196,16 @@ typedef struct { SHashObj *map; // speedup acquire the tableQueryInfo by table uid } STableGroupInfo; +typedef struct { + uint16_t rowSize; + uint16_t numOfFiles; + uint32_t numOfTables; + uint64_t totalSize; + int32_t firstSeekTimeUs; + uint32_t numOfRowsInMemTable; + SArray *dataBlockInfos; +} STableBlockDist; + /** * Get the data block iterator, starting from position according to the query condition * @@ -346,7 +355,7 @@ void tsdbResetQueryHandle(TsdbQueryHandleT queryHandle, STsdbQueryCond *pCond); void tsdbResetQueryHandleForNewTable(TsdbQueryHandleT queryHandle, STsdbQueryCond *pCond, STableGroupInfo* groupList); -int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, SArray* pBlockInfo); +int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist* pTableBlockInfo); /** * get the statistics of repo usage diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 031857df094384bfbc433dea33e00668b0885c03..a33f15267ae371a7f6184a233292123722734835 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -188,44 +188,18 @@ #define TK_STATEMENT 169 #define TK_TRIGGER 170 #define TK_VIEW 171 -#define TK_COUNT 172 -#define TK_SUM 173 -#define TK_AVG 174 -#define TK_MIN 175 -#define TK_MAX 176 -#define TK_FIRST 177 -#define TK_LAST 178 -#define TK_TOP 179 -#define TK_BOTTOM 180 -#define TK_STDDEV 181 -#define TK_PERCENTILE 182 -#define TK_APERCENTILE 183 -#define TK_LEASTSQUARES 184 -#define TK_HISTOGRAM 185 -#define TK_DIFF 186 -#define TK_SPREAD 187 -#define TK_TWA 188 -#define TK_INTERP 189 -#define TK_LAST_ROW 190 -#define TK_RATE 191 -#define TK_IRATE 192 -#define TK_SUM_RATE 193 -#define TK_SUM_IRATE 194 -#define TK_AVG_RATE 195 -#define TK_AVG_IRATE 196 -#define TK_TBID 197 -#define TK_SEMI 198 -#define TK_NONE 199 -#define TK_PREV 200 -#define TK_LINEAR 201 -#define TK_IMPORT 202 -#define TK_METRIC 203 -#define TK_TBNAME 204 -#define TK_JOIN 205 -#define TK_METRICS 206 -#define TK_INSERT 207 -#define TK_INTO 208 -#define TK_VALUES 209 +#define TK_SEMI 172 +#define TK_NONE 173 +#define TK_PREV 174 +#define TK_LINEAR 175 +#define TK_IMPORT 176 +#define TK_METRIC 177 +#define TK_TBNAME 178 +#define TK_JOIN 179 +#define TK_METRICS 180 +#define TK_INSERT 181 +#define TK_INTO 182 +#define TK_VALUES 183 #define TK_SPACE 300 @@ -236,6 +210,7 @@ #define TK_BIN 305 // bin format data 0b111 #define TK_FILE 306 #define TK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query +#define TK_FUNCTION 308 #endif diff --git a/src/query/inc/qAggMain.h b/src/query/inc/qAggMain.h index 17571141a46acc48bb5e084e716e971dc8a0e303..c59067c4b357aa084cd6f31c39f3038075d18a82 100644 --- a/src/query/inc/qAggMain.h +++ b/src/query/inc/qAggMain.h @@ -26,6 +26,7 @@ extern "C" { #include "taosdef.h" #include "trpc.h" #include "tvariant.h" +#include "tsdb.h" #define TSDB_FUNC_INVALID_ID -1 #define TSDB_FUNC_COUNT 0 @@ -70,15 +71,17 @@ extern "C" { #define TSDB_FUNC_AVG_IRATE 34 #define TSDB_FUNC_TID_TAG 35 -#define TSDB_FUNC_HISTOGRAM 36 -#define TSDB_FUNC_HLL 37 -#define TSDB_FUNC_MODE 38 -#define TSDB_FUNC_SAMPLE 39 -#define TSDB_FUNC_CEIL 40 -#define TSDB_FUNC_FLOOR 41 -#define TSDB_FUNC_ROUND 42 -#define TSDB_FUNC_MAVG 43 -#define TSDB_FUNC_CSUM 44 +#define TSDB_FUNC_BLKINFO 36 + +#define TSDB_FUNC_HISTOGRAM 37 +#define TSDB_FUNC_HLL 38 +#define TSDB_FUNC_MODE 39 +#define TSDB_FUNC_SAMPLE 40 +#define TSDB_FUNC_CEIL 41 +#define TSDB_FUNC_FLOOR 42 +#define TSDB_FUNC_ROUND 43 +#define TSDB_FUNC_MAVG 44 +#define TSDB_FUNC_CSUM 45 #define TSDB_FUNCSTATE_SO 0x1u // single output @@ -221,6 +224,7 @@ typedef struct SAggFunctionInfo { int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, int16_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable); +int32_t isValidFunction(const char* name, int32_t len); #define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0) #define IS_MULTIOUTPUT(x) (((x)&TSDB_FUNCSTATE_MO) != 0) @@ -242,6 +246,10 @@ typedef struct STwaInfo { STimeWindow win; } STwaInfo; +struct SBufferWriter; +void blockDistInfoToBinary(STableBlockDist* pDist, struct SBufferWriter* bw); +void blockDistInfoFromBinary(const char* data, int32_t len, STableBlockDist* pDist); + /* global sql function array */ extern struct SAggFunctionInfo aAggs[]; diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index f6d92fb8d12b9e48cddc08ff8b245080c5408da4..7121233cdaab693a600751f86534f48e3cd4f8ae 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -280,15 +280,16 @@ enum OPERATOR_TYPE_E { OP_DataBlocksOptScan = 2, OP_TableSeqScan = 3, OP_TagScan = 4, - OP_Aggregate = 5, - OP_Arithmetic = 6, - OP_Groupby = 7, - OP_Limit = 8, - OP_Offset = 9, - OP_TimeInterval = 10, - OP_Fill = 11, - OP_MultiTableAggregate = 12, - OP_MultiTableTimeInterval = 13, + OP_TableBlockInfoScan= 5, + OP_Aggregate = 6, + OP_Arithmetic = 7, + OP_Groupby = 8, + OP_Limit = 9, + OP_Offset = 10, + OP_TimeInterval = 11, + OP_Fill = 12, + OP_MultiTableAggregate = 13, + OP_MultiTableTimeInterval = 14, }; typedef struct SOperatorInfo { diff --git a/src/query/inc/qUtil.h b/src/query/inc/qUtil.h index c4a2d900d07ce0416c5e297d4afed804811295f0..0ab9e578afb613a681f716845f0d14a06825c9fc 100644 --- a/src/query/inc/qUtil.h +++ b/src/query/inc/qUtil.h @@ -79,16 +79,6 @@ void interResToBinary(SBufferWriter* bw, SArray* pRes, int32_t tagLen); SArray* interResFromBinary(const char* data, int32_t len); void freeInterResult(void* param); -typedef struct { - int64_t numOfTables; - SArray *dataBlockInfos; - int64_t firstSeekTimeUs; - int64_t numOfRowsInMemTable; -} STableBlockDist; - -void blockDistInfoToBinary(SBufferWriter* bw, STableBlockDist* pDist); -void blockDistInfoFromBinary(const char* data, int32_t len, STableBlockDist* pDist); - void initGroupResInfo(SGroupResInfo* pGroupResInfo, SResultRowInfo* pResultInfo); void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo); bool hasRemainDataInCurrentGroup(SGroupResInfo* pGroupResInfo); diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index cd02d4fb002a1810f1b792b64aa8ff522f696796..a6b03f91b18749e1df5cce193ba4e97ab3108cdb 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -805,6 +805,5 @@ cmd ::= KILL QUERY INTEGER(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); s %fallback ID ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CLUSTER CONFLICT COPY DATABASE DEFERRED DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY OF OFFSET RAISE REPLACE RESTRICT ROW STATEMENT TRIGGER VIEW ALL - COUNT SUM AVG MIN MAX FIRST LAST TOP BOTTOM STDDEV PERCENTILE APERCENTILE LEASTSQUARES HISTOGRAM DIFF - SPREAD TWA INTERP LAST_ROW RATE IRATE SUM_RATE SUM_IRATE AVG_RATE AVG_IRATE TBID NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT + NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT METRIC TBNAME JOIN METRICS STABLE NULL INSERT INTO VALUES. diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 2d290af616dfa8a5dd651f160d98d80af6878660..a0e5ea49bd9754f792bc45cceeab71c00de5d015 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -18,6 +18,7 @@ #include "taosmsg.h" #include "texpr.h" #include "ttype.h" +#include "tsdb.h" #include "qAggMain.h" #include "qFill.h" @@ -26,11 +27,9 @@ #include "qTsbuf.h" #include "queryLog.h" -//#define GET_INPUT_DATA_LIST(x) (((char *)((x)->pInput)) + ((x)->startOffset) * ((x)->inputBytes)) #define GET_INPUT_DATA_LIST(x) ((char *)((x)->pInput)) #define GET_INPUT_DATA(x, y) (GET_INPUT_DATA_LIST(x) + (y) * (x)->inputBytes) -//#define GET_TS_LIST(x) ((TSKEY*)&((x)->ptsList[(x)->startOffset])) #define GET_TS_LIST(x) ((TSKEY*)((x)->ptsList)) #define GET_TS_DATA(x, y) (GET_TS_LIST(x)[(y)]) @@ -190,6 +189,11 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI *bytes = (int16_t)(dataBytes + sizeof(int16_t) + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t) + VARSTR_HEADER_SIZE); *interBytes = 0; return TSDB_CODE_SUCCESS; + } else if (functionId == TSDB_FUNC_BLKINFO) { + *type = TSDB_DATA_TYPE_BINARY; + *bytes = 16384; + *interBytes = 0; + return TSDB_CODE_SUCCESS; } if (functionId == TSDB_FUNC_COUNT) { @@ -354,6 +358,22 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI return TSDB_CODE_SUCCESS; } +// TODO use hash table +int32_t isValidFunction(const char* name, int32_t len) { + for(int32_t i = 0; i <= TSDB_FUNC_BLKINFO; ++i) { + int32_t nameLen = strlen(aAggs[i].name); + if (len != nameLen) { + continue; + } + + if (strncasecmp(aAggs[i].name, name, len) == 0) { + return i; + } + } + + return -1; +} + // set the query flag to denote that query is completed static void no_next_step(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); @@ -4600,10 +4620,126 @@ static void sumrate_finalizer(SQLFunctionCtx *pCtx) { doFinalizer(pCtx); } +void blockInfo_func(SQLFunctionCtx* pCtx) { + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); + STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo); + + int32_t len = *(int32_t*) pCtx->pInput; + blockDistInfoFromBinary(pCtx->pInput + sizeof(int32_t), len, pDist); + pDist->rowSize = pCtx->param[0].i64; -///////////////////////////////////////////////////////////////////////////////////////////// + memcpy(pCtx->pOutput, pCtx->pInput, sizeof(int32_t) + len); + pResInfo->numOfRes = 1; + pResInfo->hasResult = DATA_SET_FLAG; +} + +static void mergeTableBlockDist(STableBlockDist* pDist, const STableBlockDist* pSrc) { + assert(pDist != NULL && pSrc != NULL); + pDist->numOfTables += pSrc->numOfTables; + pDist->numOfRowsInMemTable += pSrc->numOfRowsInMemTable; + pDist->numOfFiles += pSrc->numOfFiles; + pDist->totalSize += pSrc->totalSize; + + if (pDist->dataBlockInfos == NULL) { + pDist->dataBlockInfos = taosArrayInit(4, sizeof(SFileBlockInfo)); + } + + taosArrayPushBatch(pDist->dataBlockInfos, pSrc->dataBlockInfos->pData, taosArrayGetSize(pSrc->dataBlockInfos)); +} + +void block_func_merge(SQLFunctionCtx* pCtx) { + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); + + STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo); + STableBlockDist info = {0}; + + int32_t len = *(int32_t*) pCtx->pInput; + blockDistInfoFromBinary(pCtx->pInput + sizeof(int32_t), len, &info); + + mergeTableBlockDist(pDist, &info); +} + +static int32_t doGetPercentile(const SArray* pArray, double rate) { + int32_t len = (int32_t)taosArrayGetSize(pArray); + if (len <= 0) { + return 0; + } + assert(rate >= 0 && rate <= 1.0); + int idx = (int32_t)((len - 1) * rate); + + return ((SFileBlockInfo *)(taosArrayGet(pArray, idx)))->numOfRows; +} + +static int compareBlockInfo(const void *pLeft, const void *pRight) { + int32_t left = ((SFileBlockInfo *)pLeft)->numOfRows; + int32_t right = ((SFileBlockInfo *)pRight)->numOfRows; + + if (left > right) return 1; + if (left < right) return -1; + return 0; +} + +void generateBlockDistResult(STableBlockDist *pTableBlockDist, char* result) { + if (pTableBlockDist == NULL) { + return; + } + + int64_t min = INT64_MAX, max = INT64_MIN, avg = 0; + SArray* blockInfos= pTableBlockDist->dataBlockInfos; + int64_t totalRows = 0, totalBlocks = taosArrayGetSize(blockInfos); + + for (size_t i = 0; i < taosArrayGetSize(blockInfos); i++) { + SFileBlockInfo *blockInfo = taosArrayGet(blockInfos, i); + int64_t rows = blockInfo->numOfRows; + + min = MIN(min, rows); + max = MAX(max, rows); + totalRows += rows; + } + + avg = totalBlocks > 0 ? (int64_t)(totalRows/totalBlocks) : 0; + taosArraySort(blockInfos, compareBlockInfo); + + uint64_t totalLen = pTableBlockDist->totalSize; + int32_t rowSize = pTableBlockDist->rowSize; + + int sz = sprintf(result + VARSTR_HEADER_SIZE, + "summary: \n\t " + "5th=[%d], 10th=[%d], 20th=[%d], 30th=[%d], 40th=[%d], 50th=[%d]\n\t " + "60th=[%d], 70th=[%d], 80th=[%d], 90th=[%d], 95th=[%d], 99th=[%d]\n\t " + "Min=[%"PRId64"(Rows)] Max=[%"PRId64"(Rows)] Avg=[%"PRId64"(Rows)] Stddev=[%.2f] \n\t " + "Rows=[%"PRId64"], Blocks=[%"PRId64"], Size=[%.3f(Kb)] Comp=[%.2f%%]\n\t " + "RowsInMem=[%d] \n\t SeekHeaderTime=[%d(us)]", + doGetPercentile(blockInfos, 0.05), doGetPercentile(blockInfos, 0.10), + doGetPercentile(blockInfos, 0.20), doGetPercentile(blockInfos, 0.30), + doGetPercentile(blockInfos, 0.40), doGetPercentile(blockInfos, 0.50), + doGetPercentile(blockInfos, 0.60), doGetPercentile(blockInfos, 0.70), + doGetPercentile(blockInfos, 0.80), doGetPercentile(blockInfos, 0.90), + doGetPercentile(blockInfos, 0.95), doGetPercentile(blockInfos, 0.99), + min, max, avg, 0.0, + totalRows, totalBlocks, totalLen/1024.0, (double)(totalLen*100.0)/(rowSize*totalRows), + pTableBlockDist->numOfRowsInMemTable, pTableBlockDist->firstSeekTimeUs); + varDataSetLen(result, sz); + UNUSED(sz); +} + +void blockinfo_func_finalizer(SQLFunctionCtx* pCtx) { + SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); + STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo); + + pDist->rowSize = pCtx->param[0].i64; + generateBlockDistResult(pDist, pCtx->pOutput); + + // cannot set the numOfIteratedElems again since it is set during previous iteration + pResInfo->numOfRes = 1; + pResInfo->hasResult = DATA_SET_FLAG; + + doFinalizer(pCtx); +} + +///////////////////////////////////////////////////////////////////////////////////////////// /* * function compatible list. * tag and ts are not involved in the compatibility check @@ -4622,8 +4758,8 @@ int32_t functionCompatList[] = { 4, -1, -1, 1, 1, 1, 1, 1, 1, -1, // tag, colprj, tagprj, arithmetic, diff, first_dist, last_dist, interp rate irate 1, 1, 1, 1, -1, 1, 1, 5, 1, 1, - // sum_rate, sum_irate, avg_rate, avg_irate - 1, 1, 1, 1, + // sum_rate, sum_irate, avg_rate, avg_irate, tid_tag, blk_info + 1, 1, 1, 1, 6, 7 }; SAggFunctionInfo aAggs[] = {{ @@ -5133,4 +5269,18 @@ SAggFunctionInfo aAggs[] = {{ noop1, noop1, dataBlockRequired, - } }; + }, + { + // 35 + "_block_dist", // return table id and the corresponding tags for join match and subscribe + TSDB_FUNC_BLKINFO, + TSDB_FUNC_BLKINFO, + TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_STABLE, + function_setup, + blockInfo_func, + noop2, + no_next_step, + blockinfo_func_finalizer, + block_func_merge, + dataBlockRequired, + }}; diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 3a76df5fa18bf38f3836e571af688a5d94f74f76..d628a69220d663dcab2cb309e3864bbd655028a7 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -26,11 +26,7 @@ #include "queryLog.h" #include "tlosertree.h" #include "ttype.h" - -/** - * check if the primary column is load by default, otherwise, the program will - * forced to load primary column explicitly. - */ +#include "tscompression.h" #define IS_MASTER_SCAN(runtime) ((runtime)->scanFlag == MASTER_SCAN) #define IS_REVERSE_SCAN(runtime) ((runtime)->scanFlag == REVERSE_SCAN) @@ -177,6 +173,7 @@ static SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, S static SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); static SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); static SOperatorInfo* createTagScanOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SExprInfo* pExpr, int32_t numOfOutput); +static SOperatorInfo* createTableBlockInfoScanOperator(void* pTsdbQueryHandle, SQueryRuntimeEnv* pRuntimeEnv); static void destroyBasicOperatorInfo(void* param, int32_t numOfOutput); static void destroySFillOperatorInfo(void* param, int32_t numOfOutput); @@ -1050,12 +1047,13 @@ static void doSetInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, setArithParams((SArithmeticSupport*)pCtx[i].param[1].pz, &pOperator->pExpr[i], pBlock); } else { SColIndex* pCol = &pOperator->pExpr[i].base.colInfo; - if (TSDB_COL_IS_NORMAL_COL(pCol->flag)) { + if (TSDB_COL_IS_NORMAL_COL(pCol->flag) || pCol->colId == TSDB_BLOCK_DIST_COLUMN_INDEX) { SColIndex* pColIndex = &pOperator->pExpr[i].base.colInfo; SColumnInfoData* p = taosArrayGet(pBlock->pDataBlock, pColIndex->colIndex); + // in case of the block distribution query, the inputBytes is not a constant value. pCtx[i].pInput = p->pData; - assert(p->info.colId == pColIndex->colId && pCtx[i].inputType == p->info.type && pCtx[i].inputBytes == p->info.bytes); + assert(p->info.colId == pColIndex->colId && pCtx[i].inputType == p->info.type);// && pCtx[i].inputBytes == p->info.bytes); uint32_t status = aAggs[pCtx[i].functionId].status; if ((status & (TSDB_FUNCSTATE_SELECTIVITY | TSDB_FUNCSTATE_NEED_TS)) != 0) { @@ -3736,6 +3734,7 @@ static void freeTableBlockDist(STableBlockDist *pTableBlockDist) { } } +#if 0 static int32_t getPercentileFromSortedArray(const SArray* pArray, double rate) { int32_t len = (int32_t)taosArrayGetSize(pArray); if (len <= 0) { @@ -3746,42 +3745,17 @@ static int32_t getPercentileFromSortedArray(const SArray* pArray, double rate) { return ((SDataBlockInfo *)(taosArrayGet(pArray, idx)))->rows; } + static int compareBlockInfo(const void *pLeft, const void *pRight) { int32_t left = ((SDataBlockInfo *)pLeft)->rows; int32_t right = ((SDataBlockInfo *)pRight)->rows; if (left > right) return 1; if (left < right) return -1; return 0; -} +} -static void generateBlockDistResult(STableBlockDist *pTableBlockDist) { - if (pTableBlockDist == NULL) { - return; - } -#if 0 - int64_t min = INT64_MAX, max = INT64_MIN, avg = 0; - SArray* blockInfos= pTableBlockDist->dataBlockInfos; - int64_t totalRows = 0, totalBlocks = taosArrayGetSize(blockInfos); - for (size_t i = 0; i < taosArrayGetSize(blockInfos); i++) { - SFileBlockInfo *blockInfo = taosArrayGet(blockInfos, i); - int64_t rows = blockInfo->numOfRows; - min = MIN(min, rows); - max = MAX(max, rows); - totalRows += rows; - } - avg = totalBlocks > 0 ? (int64_t)(totalRows/totalBlocks) : 0; - - taosArraySort(blockInfos, compareBlockInfo); #endif -// int sz = sprintf(pTableBlockDist->result, -// "summary: \n\t 5th=[%d], 25th=[%d], 50th=[%d],75th=[%d], 95th=[%d], 99th=[%d] \n\t min=[%"PRId64"], max=[%"PRId64"], avg = [%"PRId64"] \n\t totalRows=[%"PRId64"], totalBlocks=[%"PRId64"] \n\t seekHeaderTimeCost=[%"PRId64"(us)] \n\t rowsInMem=[%"PRId64"]", -// getPercentileFromSortedArray(blockInfos, 0.05), getPercentileFromSortedArray(blockInfos, 0.25), getPercentileFromSortedArray(blockInfos, 0.50), -// getPercentileFromSortedArray(blockInfos, 0.75), getPercentileFromSortedArray(blockInfos, 0.95), getPercentileFromSortedArray(blockInfos, 0.99), -// min, max, avg, -// totalRows, totalBlocks, -// pTableBlockDist->firstSeekTimeUs, -// pTableBlockDist->numOfRowsInMemTable); -} + //void skipBlocks(SQueryRuntimeEnv *pRuntimeEnv) { // SQuery *pQuery = pRuntimeEnv->pQuery; // @@ -4145,6 +4119,8 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, SArray* prevResult, void *ts // TODO refactor. pRuntimeEnv->resultInfo.capacity = 4096; pRuntimeEnv->proot = createTagScanOperatorInfo(pRuntimeEnv, pQuery->pExpr1, pQuery->numOfOutput); + } else if (pQuery->queryBlockDist) { + pRuntimeEnv->pTableScanner = createTableBlockInfoScanOperator(pRuntimeEnv->pQueryHandle, pRuntimeEnv); } else if (isTsCompQuery(pQuery) || isPointInterpoQuery(pQuery)) { pRuntimeEnv->pTableScanner = createTableSeqScanOperator(pRuntimeEnv->pQueryHandle, pRuntimeEnv, isPointInterpoQuery(pQuery)); } else if (needReverseScan(pQuery)) { @@ -4408,22 +4384,40 @@ static SSDataBlock* doSeqTableBlocksScan(void* param) { static SSDataBlock* doBlockInfoScan(void* param) { SOperatorInfo *pOperator = (SOperatorInfo*)param; + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } STableScanInfo *pTableScanInfo = pOperator->info; STableBlockDist tableBlockDist = {0}; + tableBlockDist.numOfTables = pTableScanInfo->pRuntimeEnv->tableqinfoGroupInfo.numOfTables; tableBlockDist.dataBlockInfos = taosArrayInit(512, sizeof(SFileBlockInfo)); - tsdbGetFileBlocksDistInfo(pTableScanInfo->pQueryHandle, tableBlockDist.dataBlockInfos); + tsdbGetFileBlocksDistInfo(pTableScanInfo->pQueryHandle, &tableBlockDist); tableBlockDist.numOfRowsInMemTable = tsdbGetNumOfRowsInMemTable(pTableScanInfo->pQueryHandle); SSDataBlock* pBlock = &pTableScanInfo->block; pBlock->info.rows = 1; pBlock->info.numOfCols = 1; + SBufferWriter bw = tbufInitWriter(NULL, false); + blockDistInfoToBinary(&tableBlockDist, &bw); + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, 0); + + int32_t len = (int32_t) tbufTell(&bw); + pColInfo->pData = malloc(len + sizeof(int32_t)); + *(int32_t*) pColInfo->pData = len; + memcpy(pColInfo->pData + sizeof(int32_t), tbufGetData(&bw, false), len); + tbufCloseWriter(&bw); + SArray* g = GET_TABLEGROUP(pOperator->pRuntimeEnv, 0); + pOperator->pRuntimeEnv->pQuery->current = taosArrayGetP(g, 0); + + pOperator->status = OP_EXEC_DONE; + return pBlock; } SOperatorInfo* createTableScanOperator(void* pTsdbQueryHandle, SQueryRuntimeEnv* pRuntimeEnv, int32_t repeatTime) { @@ -4471,6 +4465,32 @@ SOperatorInfo* createTableSeqScanOperator(void* pTsdbQueryHandle, SQueryRuntimeE return pOperator; } +SOperatorInfo* createTableBlockInfoScanOperator(void* pTsdbQueryHandle, SQueryRuntimeEnv* pRuntimeEnv) { + STableScanInfo* pInfo = calloc(1, sizeof(STableScanInfo)); + + pInfo->pQueryHandle = pTsdbQueryHandle; + pInfo->pRuntimeEnv = pRuntimeEnv; + pInfo->block.pDataBlock = taosArrayInit(1, sizeof(SColumnInfoData)); + + SColumnInfoData infoData = {{0}}; + infoData.info.type = TSDB_DATA_TYPE_BINARY; + infoData.info.bytes = 1024; + infoData.info.colId = TSDB_BLOCK_DIST_COLUMN_INDEX; + taosArrayPush(pInfo->block.pDataBlock, &infoData); + + SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); + pOperator->name = "TableBlockInfoScanOperator"; + pOperator->operatorType = OP_TableBlockInfoScan; + pOperator->blockingOptr = false; + pOperator->status = OP_IN_EXECUTING; + pOperator->info = pInfo; + pOperator->pRuntimeEnv = pRuntimeEnv; + pOperator->numOfOutput = pRuntimeEnv->pQuery->numOfCols; + pOperator->exec = doBlockInfoScan; + + return pOperator; +} + void setTableScanFilterOperatorInfo(STableScanInfo* pTableScanInfo, SOperatorInfo* pDownstream) { assert(pTableScanInfo != NULL && pDownstream != NULL); @@ -4634,10 +4654,6 @@ static SSDataBlock* doSTableAggregate(void* param) { pOperator->status = OP_RES_TO_RETURN; closeAllResultRows(&pInfo->resultRowInfo); - if (isTsCompQuery(pQuery)) { - finalizeQueryResult_rv(pOperator, pInfo->pCtx, &pInfo->resultRowInfo, pInfo->rowCellInfoOffset); - } - updateWindowResNumOfRes_rv(pRuntimeEnv, pInfo->pCtx, pOperator->numOfOutput, &pInfo->resultRowInfo, pInfo->rowCellInfoOffset); @@ -5415,7 +5431,7 @@ void buildTableBlockDistResult(SQInfo *pQInfo) { SSchema blockDistSchema = tGetBlockDistColumnSchema(); // int64_t startTime = taosGetTimestampUs(); - tsdbGetFileBlocksDistInfo(pQueryHandle, pTableBlockDist->dataBlockInfos); +// tsdbGetFileBlocksDistInfo(pQueryHandle, pTableBlockDist->dataBlockInfos, ); pTableBlockDist->numOfRowsInMemTable = tsdbGetNumOfRowsInMemTable(pQueryHandle); // generateBlockDistResult(pTableBlockDist); @@ -5524,7 +5540,8 @@ static bool validateQuerySourceCols(SQueryTableMsg *pQueryMsg, SSqlFuncMsg** pEx if ((pFuncMsg->functionId == TSDB_FUNC_TAGPRJ) || (pFuncMsg->functionId == TSDB_FUNC_TID_TAG && pFuncMsg->colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) || - (pFuncMsg->functionId == TSDB_FUNC_COUNT && pFuncMsg->colInfo.colId == TSDB_TBNAME_COLUMN_INDEX)) { + (pFuncMsg->functionId == TSDB_FUNC_COUNT && pFuncMsg->colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) || + (pFuncMsg->functionId == TSDB_FUNC_BLKINFO)) { continue; } @@ -6166,6 +6183,9 @@ static void doUpdateExprColumnIndex(SQuery *pQuery) { assert(f < pQuery->numOfCols); } else if (pColIndex->colId <= TSDB_UD_COLUMN_INDEX) { // do nothing for user-defined constant value result columns + } else if (pColIndex->colId == TSDB_BLOCK_DIST_COLUMN_INDEX) { + pColIndex->colIndex = 0;// only one source column, so it must be 0; + assert(pQuery->numOfOutput == 1); } else { int32_t f = 0; for (f = 0; f < pQuery->numOfTags; ++f) { diff --git a/src/query/src/qParserImpl.c b/src/query/src/qParserImpl.c index 2efd4f76ea3f3efbbc1c52df4de2e743b65908f3..dbc926cde157bc60048d3eb6ced4d8e8057d3e23 100644 --- a/src/query/src/qParserImpl.c +++ b/src/query/src/qParserImpl.c @@ -158,19 +158,22 @@ tSQLExpr *tSqlExprIdValueCreate(SStrToken *pToken, int32_t optrType) { * function name is denoted by pFunctionToken */ tSQLExpr *tSqlExprCreateFunction(tSQLExprList *pList, SStrToken *pFuncToken, SStrToken *endToken, int32_t optType) { - if (pFuncToken == NULL) return NULL; + if (pFuncToken == NULL) { + return NULL; + } + + assert(optType == TK_ID); tSQLExpr *pExpr = calloc(1, sizeof(tSQLExpr)); - pExpr->nSQLOptr = optType; + pExpr->nSQLOptr = TK_FUNCTION; pExpr->pParam = pList; int32_t len = (int32_t)((endToken->z + endToken->n) - pFuncToken->z); pExpr->operand.z = pFuncToken->z; - pExpr->operand.n = len; // raw field name pExpr->operand.type = pFuncToken->type; - pExpr->token = pExpr->operand; + pExpr->token = (*pFuncToken); return pExpr; } diff --git a/src/query/src/qTokenizer.c b/src/query/src/qTokenizer.c index b55f813b5b1225d0b8e05b87e11b0d19ed2ce200..cb9ec4b0743192e6112aeb3fd56a0016be9832ba 100644 --- a/src/query/src/qTokenizer.c +++ b/src/query/src/qTokenizer.c @@ -200,25 +200,6 @@ static SKeyword keywordTable[] = { {"TRIGGER", TK_TRIGGER}, {"VIEW", TK_VIEW}, {"ALL", TK_ALL}, - {"COUNT", TK_COUNT}, - {"SUM", TK_SUM}, - {"AVG", TK_AVG}, - {"MIN", TK_MIN}, - {"MAX", TK_MAX}, - {"FIRST", TK_FIRST}, - {"LAST", TK_LAST}, - {"TOP", TK_TOP}, - {"BOTTOM", TK_BOTTOM}, - {"STDDEV", TK_STDDEV}, - {"PERCENTILE", TK_PERCENTILE}, - {"APERCENTILE", TK_APERCENTILE}, - {"LEASTSQUARES", TK_LEASTSQUARES}, - {"HISTOGRAM", TK_HISTOGRAM}, - {"DIFF", TK_DIFF}, - {"SPREAD", TK_SPREAD}, - {"TWA", TK_TWA}, - {"INTERP", TK_INTERP}, - {"LAST_ROW", TK_LAST_ROW}, {"SEMI", TK_SEMI}, {"NONE", TK_NONE}, {"PREV", TK_PREV}, @@ -228,17 +209,10 @@ static SKeyword keywordTable[] = { {"TBNAME", TK_TBNAME}, {"JOIN", TK_JOIN}, {"METRICS", TK_METRICS}, - {"TBID", TK_TBID}, {"STABLE", TK_STABLE}, {"FILE", TK_FILE}, {"VNODES", TK_VNODES}, {"UNION", TK_UNION}, - {"RATE", TK_RATE}, - {"IRATE", TK_IRATE}, - {"SUM_RATE", TK_SUM_RATE}, - {"SUM_IRATE", TK_SUM_IRATE}, - {"AVG_RATE", TK_AVG_RATE}, - {"AVG_IRATE", TK_AVG_IRATE}, {"CACHELAST", TK_CACHELAST}, {"DISTINCT", TK_DISTINCT}, }; diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c index 81f797899b10b757ef9ed74e61787648f8e95dbb..37c890e9c64e9939d404daac6402e469f94794bd 100644 --- a/src/query/src/qUtil.c +++ b/src/query/src/qUtil.c @@ -22,6 +22,7 @@ #include "tbuffer.h" #include "tlosertree.h" #include "queryLog.h" +#include "tscompression.h" typedef struct SCompSupporter { STableQueryInfo **pTableQueryInfo; @@ -243,7 +244,6 @@ void* destroyResultRowPool(SResultRowPool* p) { return NULL; } -// TODO refactor void interResToBinary(SBufferWriter* bw, SArray* pRes, int32_t tagLen) { uint32_t numOfGroup = (uint32_t) taosArrayGetSize(pRes); tbufWriteUint32(bw, numOfGroup); @@ -581,25 +581,70 @@ int32_t mergeIntoGroupResult(SGroupResInfo* pGroupResInfo, SQueryRuntimeEnv* pRu return TSDB_CODE_SUCCESS; } -/* - * typedef struct { - int64_t numOfTables; - SArray *dataBlockInfos; - int64_t firstSeekTimeUs; - int64_t numOfRowsInMemTable; -} STableBlockDist; - * - */ -SBufferWriter* blockDistInfoToBinary(STableBlockDist* pDist) { - SBufferWriter bw = tbufInitWriter(NULL, false); +void blockDistInfoToBinary(STableBlockDist* pDist, struct SBufferWriter* bw) { + tbufWriteUint32(bw, pDist->numOfTables); + tbufWriteUint16(bw, pDist->numOfFiles); + tbufWriteUint64(bw, pDist->totalSize); + tbufWriteUint32(bw, pDist->numOfRowsInMemTable); + tbufWriteUint64(bw, taosArrayGetSize(pDist->dataBlockInfos)); + + // compress the binary string + char* p = TARRAY_GET_START(pDist->dataBlockInfos); + + // compress extra bytes + size_t x = taosArrayGetSize(pDist->dataBlockInfos) * pDist->dataBlockInfos->elemSize; + char* tmp = malloc(x + 2); - tbufWriteUint64(&bw, pDist->numOfTables); - tbufWriteUint64(&bw, pDist->numOfRowsInMemTable); - tbufWriteUint64(&bw, taosArrayGetSize(pDist->dataBlockInfos)); + bool comp = false; + int32_t len = tsCompressString(p, x, 1, tmp, x, ONE_STAGE_COMP, NULL, 0); + if (len == -1 || len >= x) { // compress failed, do not compress this binary data + comp = false; + len = x; + } else { + comp = true; + } - pDist->dataBlockInfos->pData + tbufWriteUint8(bw, comp); + tbufWriteUint32(bw, len); + if (comp) { + tbufWriteBinary(bw, tmp, len); + } else { + tbufWriteBinary(bw, p, len); + } + tfree(tmp); } void blockDistInfoFromBinary(const char* data, int32_t len, STableBlockDist* pDist) { + SBufferReader br = tbufInitReader(data, len, false); + pDist->numOfTables = tbufReadUint32(&br); + pDist->numOfFiles = tbufReadUint16(&br); + pDist->totalSize = tbufReadUint64(&br); + pDist->numOfRowsInMemTable = tbufReadUint32(&br); + int32_t numOfBlocks = tbufReadUint64(&br); + + bool comp = tbufReadUint8(&br); + uint32_t compLen = tbufReadUint32(&br); + + size_t originalLen = numOfBlocks*sizeof(SFileBlockInfo); + + char* outputBuf = NULL; + if (comp) { + outputBuf = malloc(originalLen); + + size_t actualLen = compLen; + const char* compStr = tbufReadBinary(&br, &actualLen); + + int32_t orignalLen = tsDecompressString(compStr, compLen, 1, outputBuf, + originalLen , ONE_STAGE_COMP, NULL, 0); + assert(orignalLen == numOfBlocks*sizeof(SFileBlockInfo)); + } else { + outputBuf = (char*) tbufReadBinary(&br, &originalLen); + } + + pDist->dataBlockInfos = taosArrayFromList(outputBuf, numOfBlocks, sizeof(SFileBlockInfo)); + if (comp) { + tfree(outputBuf); + } } + diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index 1c0b4ab07080bc7d380c883d6180cb5e7e20dec9..6e51e3b5662b9749c44cd48e9b11265cae313636 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -238,8 +238,8 @@ bool qTableQuery(qinfo_t qinfo) { buildTagQueryResult(pQInfo); } else if (pQInfo->query.stableQuery) { stableQueryImpl(pQInfo); - } else if (pQInfo->query.queryBlockDist){ - buildTableBlockDistResult(pQInfo); +// } else if (pQInfo->query.queryBlockDist){ +// buildTableBlockDistResult(pQInfo); } else { tableQueryImpl(pQInfo); } diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 0f945d0230f70943fddc19373ef8b872a127c5b5..27137483e932a1c77fb2ebd6e1820aad2f32938e 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -97,27 +97,27 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 282 +#define YYNOCODE 256 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SCreatedTableInfo yy42; - SCreateAcctInfo yy47; - SQuerySQL* yy114; - TAOS_FIELD yy179; - SLimitVal yy204; - SSubclauseInfo* yy219; - int yy222; - SArray* yy247; - SCreateDbInfo yy262; - tSQLExpr* yy326; - SCreateTableSQL* yy358; - tVariant yy378; - int64_t yy403; - SIntervalVal yy430; - tSQLExprList* yy522; + SCreateAcctInfo yy1; + SCreateTableSQL* yy8; + tSQLExprList* yy9; + SLimitVal yy24; + SSubclauseInfo* yy63; + SArray* yy141; + tSQLExpr* yy220; + SQuerySQL* yy234; + SCreatedTableInfo yy306; + SCreateDbInfo yy322; + tVariant yy326; + SIntervalVal yy340; + TAOS_FIELD yy403; + int64_t yy429; + int yy502; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -129,7 +129,7 @@ typedef union { #define YYFALLBACK 1 #define YYNSTATE 283 #define YYNRULE 250 -#define YYNTOKEN 210 +#define YYNTOKEN 184 #define YY_MAX_SHIFT 282 #define YY_MIN_SHIFTREDUCE 463 #define YY_MAX_SHIFTREDUCE 712 @@ -203,210 +203,207 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (615) +#define YY_ACTTAB_COUNT (614) static const YYACTIONTYPE yy_action[] = { /* 0 */ 872, 507, 159, 714, 282, 159, 15, 580, 183, 508, - /* 10 */ 663, 186, 948, 41, 42, 947, 43, 44, 26, 158, - /* 20 */ 191, 35, 507, 507, 232, 47, 45, 49, 46, 163, + /* 10 */ 158, 186, 948, 41, 42, 947, 43, 44, 26, 163, + /* 20 */ 191, 35, 507, 507, 232, 47, 45, 49, 46, 944, /* 30 */ 508, 508, 850, 40, 39, 257, 256, 38, 37, 36, - /* 40 */ 41, 42, 118, 43, 44, 861, 664, 191, 35, 179, + /* 40 */ 41, 42, 118, 43, 44, 861, 943, 191, 35, 179, /* 50 */ 280, 232, 47, 45, 49, 46, 181, 869, 847, 215, /* 60 */ 40, 39, 957, 123, 38, 37, 36, 464, 465, 466, /* 70 */ 467, 468, 469, 470, 471, 472, 473, 474, 475, 281, /* 80 */ 91, 196, 205, 41, 42, 267, 43, 44, 839, 247, - /* 90 */ 191, 35, 159, 944, 232, 47, 45, 49, 46, 123, + /* 90 */ 191, 35, 159, 942, 232, 47, 45, 49, 46, 123, /* 100 */ 220, 185, 948, 40, 39, 850, 62, 38, 37, 36, /* 110 */ 20, 245, 275, 274, 244, 243, 242, 273, 241, 272, - /* 120 */ 271, 270, 240, 269, 268, 901, 267, 227, 817, 661, + /* 120 */ 271, 270, 240, 269, 268, 901, 233, 227, 817, 661, /* 130 */ 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, - /* 140 */ 815, 816, 818, 819, 42, 208, 43, 44, 642, 643, + /* 140 */ 815, 816, 818, 819, 42, 208, 43, 44, 175, 276, /* 150 */ 191, 35, 212, 211, 232, 47, 45, 49, 46, 229, - /* 160 */ 861, 67, 21, 40, 39, 247, 276, 38, 37, 36, - /* 170 */ 32, 43, 44, 197, 180, 191, 35, 849, 70, 232, + /* 160 */ 861, 67, 21, 40, 39, 247, 72, 38, 37, 36, + /* 170 */ 32, 43, 44, 850, 180, 191, 35, 123, 70, 232, /* 180 */ 47, 45, 49, 46, 16, 38, 37, 36, 40, 39, - /* 190 */ 850, 123, 38, 37, 36, 190, 674, 72, 26, 665, - /* 200 */ 167, 668, 667, 671, 670, 61, 168, 836, 837, 25, - /* 210 */ 840, 103, 102, 166, 190, 674, 758, 199, 665, 147, - /* 220 */ 668, 767, 671, 20, 147, 275, 274, 187, 188, 841, - /* 230 */ 273, 231, 272, 271, 270, 838, 269, 268, 846, 198, - /* 240 */ 823, 21, 249, 821, 822, 943, 187, 188, 824, 32, - /* 250 */ 826, 827, 825, 900, 828, 829, 123, 3, 137, 47, - /* 260 */ 45, 49, 46, 29, 78, 74, 77, 40, 39, 617, - /* 270 */ 214, 38, 37, 36, 233, 601, 759, 174, 598, 147, - /* 280 */ 599, 26, 600, 201, 89, 93, 254, 253, 26, 942, - /* 290 */ 83, 98, 101, 92, 26, 48, 153, 149, 26, 95, - /* 300 */ 175, 26, 151, 106, 105, 104, 202, 203, 673, 26, - /* 310 */ 69, 40, 39, 200, 48, 38, 37, 36, 68, 194, - /* 320 */ 10, 847, 63, 672, 71, 133, 195, 673, 847, 279, - /* 330 */ 278, 110, 250, 666, 847, 669, 251, 614, 847, 255, - /* 340 */ 116, 847, 672, 22, 621, 848, 609, 259, 32, 847, - /* 350 */ 218, 629, 633, 634, 217, 27, 120, 52, 18, 693, - /* 360 */ 675, 189, 53, 176, 17, 17, 590, 677, 56, 235, - /* 370 */ 591, 27, 100, 99, 27, 52, 82, 81, 12, 11, - /* 380 */ 161, 602, 54, 59, 162, 579, 57, 88, 87, 14, - /* 390 */ 13, 605, 603, 606, 604, 115, 113, 164, 165, 171, - /* 400 */ 911, 172, 170, 4, 157, 169, 160, 910, 192, 907, - /* 410 */ 906, 193, 258, 117, 871, 33, 878, 880, 119, 863, - /* 420 */ 893, 892, 134, 135, 132, 136, 769, 32, 239, 155, - /* 430 */ 30, 248, 766, 216, 962, 79, 961, 114, 959, 138, - /* 440 */ 252, 956, 85, 955, 628, 953, 221, 139, 182, 225, - /* 450 */ 787, 31, 28, 58, 156, 756, 94, 860, 55, 50, - /* 460 */ 754, 96, 230, 124, 228, 125, 97, 752, 126, 127, - /* 470 */ 226, 128, 224, 222, 751, 34, 204, 148, 90, 749, - /* 480 */ 260, 261, 262, 748, 747, 746, 745, 263, 150, 152, - /* 490 */ 742, 740, 264, 738, 736, 734, 265, 154, 266, 219, - /* 500 */ 64, 65, 894, 277, 712, 206, 207, 177, 237, 238, - /* 510 */ 711, 178, 173, 209, 75, 210, 710, 698, 217, 213, - /* 520 */ 750, 611, 107, 60, 744, 234, 142, 141, 788, 140, - /* 530 */ 143, 144, 146, 145, 1, 108, 743, 2, 109, 735, - /* 540 */ 66, 6, 184, 630, 845, 121, 223, 131, 129, 130, - /* 550 */ 635, 122, 5, 23, 7, 8, 24, 676, 9, 19, - /* 560 */ 678, 71, 73, 236, 548, 544, 542, 541, 540, 537, - /* 570 */ 511, 246, 76, 27, 51, 582, 80, 84, 581, 578, - /* 580 */ 532, 86, 530, 522, 528, 524, 526, 520, 518, 550, - /* 590 */ 549, 547, 546, 545, 543, 539, 538, 52, 509, 479, + /* 190 */ 69, 123, 38, 37, 36, 190, 674, 200, 841, 665, + /* 200 */ 167, 668, 63, 671, 26, 26, 168, 836, 837, 25, + /* 210 */ 840, 103, 102, 166, 190, 674, 176, 26, 665, 677, + /* 220 */ 668, 617, 671, 20, 61, 275, 274, 187, 188, 848, + /* 230 */ 273, 231, 272, 271, 270, 601, 269, 268, 598, 900, + /* 240 */ 599, 21, 600, 194, 846, 847, 187, 188, 823, 32, + /* 250 */ 267, 821, 822, 68, 838, 195, 824, 847, 826, 827, + /* 260 */ 825, 758, 828, 829, 147, 614, 202, 203, 199, 56, + /* 270 */ 214, 22, 47, 45, 49, 46, 767, 174, 161, 147, + /* 280 */ 40, 39, 89, 93, 38, 37, 36, 57, 83, 98, + /* 290 */ 101, 92, 3, 137, 197, 48, 621, 95, 29, 78, + /* 300 */ 74, 77, 218, 153, 149, 26, 26, 27, 673, 151, + /* 310 */ 106, 105, 104, 26, 48, 40, 39, 26, 162, 38, + /* 320 */ 37, 36, 663, 672, 10, 642, 643, 673, 71, 133, + /* 330 */ 279, 278, 110, 759, 201, 189, 147, 254, 253, 116, + /* 340 */ 164, 602, 672, 250, 251, 847, 847, 32, 609, 165, + /* 350 */ 667, 255, 670, 847, 629, 259, 217, 847, 664, 120, + /* 360 */ 198, 633, 634, 249, 693, 675, 52, 18, 53, 17, + /* 370 */ 17, 666, 171, 669, 590, 235, 591, 4, 172, 27, + /* 380 */ 27, 52, 82, 81, 100, 99, 12, 11, 54, 88, + /* 390 */ 87, 59, 605, 579, 606, 115, 113, 14, 13, 603, + /* 400 */ 170, 604, 849, 157, 169, 160, 911, 910, 192, 907, + /* 410 */ 906, 193, 258, 117, 871, 33, 893, 878, 880, 863, + /* 420 */ 119, 892, 134, 135, 132, 136, 32, 769, 239, 155, + /* 430 */ 216, 30, 248, 766, 114, 58, 962, 628, 79, 961, + /* 440 */ 55, 50, 959, 138, 221, 252, 956, 860, 182, 124, + /* 450 */ 125, 225, 126, 85, 955, 230, 953, 139, 787, 31, + /* 460 */ 228, 226, 128, 28, 224, 156, 756, 94, 754, 96, + /* 470 */ 129, 97, 752, 751, 204, 148, 749, 748, 222, 747, + /* 480 */ 746, 745, 150, 152, 742, 740, 738, 736, 734, 154, + /* 490 */ 34, 219, 64, 65, 894, 90, 260, 261, 262, 263, + /* 500 */ 264, 177, 237, 265, 238, 266, 277, 712, 178, 75, + /* 510 */ 206, 173, 207, 711, 209, 210, 710, 698, 750, 213, + /* 520 */ 611, 107, 142, 788, 2, 144, 140, 141, 143, 145, + /* 530 */ 744, 146, 108, 109, 1, 845, 743, 217, 735, 60, + /* 540 */ 130, 131, 127, 234, 6, 66, 630, 121, 184, 23, + /* 550 */ 223, 7, 635, 122, 8, 676, 5, 9, 24, 19, + /* 560 */ 73, 236, 678, 548, 71, 544, 542, 541, 540, 537, + /* 570 */ 511, 246, 76, 27, 80, 51, 582, 581, 578, 84, + /* 580 */ 532, 530, 522, 528, 524, 526, 520, 518, 550, 549, + /* 590 */ 547, 546, 545, 543, 86, 539, 538, 52, 509, 479, /* 600 */ 477, 716, 715, 715, 715, 715, 715, 715, 715, 715, - /* 610 */ 715, 715, 715, 111, 112, + /* 610 */ 111, 715, 715, 112, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 214, 1, 270, 211, 212, 270, 270, 5, 231, 9, - /* 10 */ 1, 279, 280, 13, 14, 280, 16, 17, 214, 270, - /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 270, - /* 30 */ 9, 9, 255, 33, 34, 33, 34, 37, 38, 39, - /* 40 */ 13, 14, 214, 16, 17, 253, 37, 20, 21, 213, - /* 50 */ 214, 24, 25, 26, 27, 28, 252, 271, 254, 267, - /* 60 */ 33, 34, 255, 214, 37, 38, 39, 45, 46, 47, + /* 0 */ 188, 1, 244, 185, 186, 244, 244, 5, 205, 9, + /* 10 */ 244, 253, 254, 13, 14, 254, 16, 17, 188, 244, + /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 244, + /* 30 */ 9, 9, 229, 33, 34, 33, 34, 37, 38, 39, + /* 40 */ 13, 14, 188, 16, 17, 227, 244, 20, 21, 187, + /* 50 */ 188, 24, 25, 26, 27, 28, 226, 245, 228, 241, + /* 60 */ 33, 34, 229, 188, 37, 38, 39, 45, 46, 47, /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 80 */ 74, 231, 60, 13, 14, 79, 16, 17, 0, 77, - /* 90 */ 20, 21, 270, 270, 24, 25, 26, 27, 28, 214, - /* 100 */ 272, 279, 280, 33, 34, 255, 106, 37, 38, 39, + /* 80 */ 74, 205, 60, 13, 14, 79, 16, 17, 0, 77, + /* 90 */ 20, 21, 244, 244, 24, 25, 26, 27, 28, 188, + /* 100 */ 246, 253, 254, 33, 34, 229, 106, 37, 38, 39, /* 110 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - /* 120 */ 96, 97, 98, 99, 100, 276, 79, 278, 230, 102, - /* 130 */ 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - /* 140 */ 242, 243, 244, 245, 14, 131, 16, 17, 120, 121, - /* 150 */ 20, 21, 138, 139, 24, 25, 26, 27, 28, 274, - /* 160 */ 253, 276, 101, 33, 34, 77, 231, 37, 38, 39, - /* 170 */ 109, 16, 17, 66, 267, 20, 21, 255, 219, 24, + /* 120 */ 96, 97, 98, 99, 100, 250, 15, 252, 204, 102, + /* 130 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + /* 140 */ 216, 217, 218, 219, 14, 131, 16, 17, 244, 205, + /* 150 */ 20, 21, 138, 139, 24, 25, 26, 27, 28, 248, + /* 160 */ 227, 250, 101, 33, 34, 77, 193, 37, 38, 39, + /* 170 */ 109, 16, 17, 229, 241, 20, 21, 188, 193, 24, /* 180 */ 25, 26, 27, 28, 44, 37, 38, 39, 33, 34, - /* 190 */ 255, 214, 37, 38, 39, 1, 2, 219, 214, 5, - /* 200 */ 60, 7, 5, 9, 7, 219, 66, 248, 249, 250, - /* 210 */ 251, 71, 72, 73, 1, 2, 218, 66, 5, 221, - /* 220 */ 7, 218, 9, 86, 221, 88, 89, 33, 34, 251, - /* 230 */ 93, 37, 95, 96, 97, 249, 99, 100, 254, 132, - /* 240 */ 230, 101, 135, 233, 234, 270, 33, 34, 238, 109, - /* 250 */ 240, 241, 242, 276, 244, 245, 214, 61, 62, 25, - /* 260 */ 26, 27, 28, 67, 68, 69, 70, 33, 34, 37, - /* 270 */ 130, 37, 38, 39, 15, 2, 218, 137, 5, 221, - /* 280 */ 7, 214, 9, 132, 61, 62, 135, 136, 214, 270, - /* 290 */ 67, 68, 69, 70, 214, 101, 61, 62, 214, 76, - /* 300 */ 270, 214, 67, 68, 69, 70, 33, 34, 114, 214, - /* 310 */ 256, 33, 34, 214, 101, 37, 38, 39, 276, 252, - /* 320 */ 101, 254, 268, 129, 105, 106, 252, 114, 254, 63, - /* 330 */ 64, 65, 252, 5, 254, 7, 252, 107, 254, 252, - /* 340 */ 101, 254, 129, 113, 112, 246, 102, 252, 109, 254, - /* 350 */ 102, 102, 102, 102, 110, 107, 107, 107, 107, 102, - /* 360 */ 102, 59, 107, 270, 107, 107, 102, 108, 107, 102, - /* 370 */ 102, 107, 74, 75, 107, 107, 133, 134, 133, 134, - /* 380 */ 270, 108, 127, 101, 270, 103, 125, 133, 134, 133, - /* 390 */ 134, 5, 5, 7, 7, 61, 62, 270, 270, 270, - /* 400 */ 247, 270, 270, 101, 270, 270, 270, 247, 247, 247, - /* 410 */ 247, 247, 247, 214, 214, 269, 214, 214, 214, 253, - /* 420 */ 277, 277, 214, 214, 257, 214, 214, 109, 214, 214, - /* 430 */ 214, 214, 214, 253, 214, 214, 214, 59, 214, 214, - /* 440 */ 214, 214, 214, 214, 114, 214, 273, 214, 273, 273, - /* 450 */ 214, 214, 214, 124, 214, 214, 214, 266, 126, 123, - /* 460 */ 214, 214, 118, 265, 122, 264, 214, 214, 263, 262, - /* 470 */ 117, 261, 116, 115, 214, 128, 214, 214, 85, 214, - /* 480 */ 84, 49, 81, 214, 214, 214, 214, 83, 214, 214, - /* 490 */ 214, 214, 53, 214, 214, 214, 82, 214, 80, 215, - /* 500 */ 215, 215, 215, 77, 5, 140, 5, 215, 215, 215, - /* 510 */ 5, 215, 215, 140, 219, 5, 5, 87, 110, 131, - /* 520 */ 215, 102, 216, 111, 215, 104, 223, 227, 229, 228, - /* 530 */ 226, 224, 222, 225, 220, 216, 215, 217, 216, 215, - /* 540 */ 107, 101, 1, 102, 253, 101, 101, 258, 260, 259, - /* 550 */ 102, 101, 101, 107, 119, 119, 107, 102, 101, 101, - /* 560 */ 108, 105, 74, 104, 9, 5, 5, 5, 5, 5, - /* 570 */ 78, 15, 74, 107, 16, 5, 134, 134, 5, 102, - /* 580 */ 5, 134, 5, 5, 5, 5, 5, 5, 5, 5, - /* 590 */ 5, 5, 5, 5, 5, 5, 5, 107, 78, 59, - /* 600 */ 58, 0, 281, 281, 281, 281, 281, 281, 281, 281, - /* 610 */ 281, 281, 281, 21, 21, 281, 281, 281, 281, 281, - /* 620 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 630 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 640 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 650 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 660 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 670 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 680 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 690 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 700 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 710 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 720 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 730 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 740 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 750 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 760 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 770 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 780 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 790 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 800 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 810 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, - /* 820 */ 281, 281, 281, 281, 281, + /* 190 */ 230, 188, 37, 38, 39, 1, 2, 188, 225, 5, + /* 200 */ 60, 7, 242, 9, 188, 188, 66, 222, 223, 224, + /* 210 */ 225, 71, 72, 73, 1, 2, 244, 188, 5, 108, + /* 220 */ 7, 37, 9, 86, 193, 88, 89, 33, 34, 220, + /* 230 */ 93, 37, 95, 96, 97, 2, 99, 100, 5, 250, + /* 240 */ 7, 101, 9, 226, 228, 228, 33, 34, 204, 109, + /* 250 */ 79, 207, 208, 250, 223, 226, 212, 228, 214, 215, + /* 260 */ 216, 192, 218, 219, 195, 107, 33, 34, 66, 107, + /* 270 */ 130, 113, 25, 26, 27, 28, 192, 137, 244, 195, + /* 280 */ 33, 34, 61, 62, 37, 38, 39, 125, 67, 68, + /* 290 */ 69, 70, 61, 62, 66, 101, 112, 76, 67, 68, + /* 300 */ 69, 70, 102, 61, 62, 188, 188, 107, 114, 67, + /* 310 */ 68, 69, 70, 188, 101, 33, 34, 188, 244, 37, + /* 320 */ 38, 39, 1, 129, 101, 120, 121, 114, 105, 106, + /* 330 */ 63, 64, 65, 192, 132, 59, 195, 135, 136, 101, + /* 340 */ 244, 108, 129, 226, 226, 228, 228, 109, 102, 244, + /* 350 */ 5, 226, 7, 228, 102, 226, 110, 228, 37, 107, + /* 360 */ 132, 102, 102, 135, 102, 102, 107, 107, 107, 107, + /* 370 */ 107, 5, 244, 7, 102, 102, 102, 101, 244, 107, + /* 380 */ 107, 107, 133, 134, 74, 75, 133, 134, 127, 133, + /* 390 */ 134, 101, 5, 103, 7, 61, 62, 133, 134, 5, + /* 400 */ 244, 7, 229, 244, 244, 244, 221, 221, 221, 221, + /* 410 */ 221, 221, 221, 188, 188, 243, 251, 188, 188, 227, + /* 420 */ 188, 251, 188, 188, 231, 188, 109, 188, 188, 188, + /* 430 */ 227, 188, 188, 188, 59, 124, 188, 114, 188, 188, + /* 440 */ 126, 123, 188, 188, 247, 188, 188, 240, 247, 239, + /* 450 */ 238, 247, 237, 188, 188, 118, 188, 188, 188, 188, + /* 460 */ 122, 117, 235, 188, 116, 188, 188, 188, 188, 188, + /* 470 */ 234, 188, 188, 188, 188, 188, 188, 188, 115, 188, + /* 480 */ 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + /* 490 */ 128, 189, 189, 189, 189, 85, 84, 49, 81, 83, + /* 500 */ 53, 189, 189, 82, 189, 80, 77, 5, 189, 193, + /* 510 */ 140, 189, 5, 5, 140, 5, 5, 87, 189, 131, + /* 520 */ 102, 190, 197, 203, 191, 198, 202, 201, 200, 199, + /* 530 */ 189, 196, 190, 190, 194, 227, 189, 110, 189, 111, + /* 540 */ 233, 232, 236, 104, 101, 107, 102, 101, 1, 107, + /* 550 */ 101, 119, 102, 101, 119, 102, 101, 101, 107, 101, + /* 560 */ 74, 104, 108, 9, 105, 5, 5, 5, 5, 5, + /* 570 */ 78, 15, 74, 107, 134, 16, 5, 5, 102, 134, + /* 580 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /* 590 */ 5, 5, 5, 5, 134, 5, 5, 107, 78, 59, + /* 600 */ 58, 0, 255, 255, 255, 255, 255, 255, 255, 255, + /* 610 */ 21, 255, 255, 21, 255, 255, 255, 255, 255, 255, + /* 620 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 630 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 640 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 650 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 660 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 670 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 680 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 690 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 700 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 710 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 720 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 730 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 740 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 750 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 760 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 770 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 780 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + /* 790 */ 255, 255, 255, 255, 255, 255, 255, 255, }; #define YY_SHIFT_COUNT (282) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (601) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 140, 24, 137, 12, 194, 213, 21, 21, 21, 21, - /* 10 */ 21, 21, 21, 21, 21, 0, 22, 213, 273, 273, - /* 20 */ 273, 61, 21, 21, 21, 88, 21, 21, 6, 12, - /* 30 */ 47, 47, 615, 213, 213, 213, 213, 213, 213, 213, + /* 10 */ 21, 21, 21, 21, 21, 0, 22, 213, 233, 233, + /* 20 */ 233, 61, 21, 21, 21, 88, 21, 21, 6, 12, + /* 30 */ 171, 171, 614, 213, 213, 213, 213, 213, 213, 213, /* 40 */ 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, - /* 50 */ 213, 273, 273, 2, 2, 2, 2, 2, 2, 2, - /* 60 */ 239, 21, 21, 232, 21, 21, 21, 28, 28, 230, + /* 50 */ 213, 233, 233, 2, 2, 2, 2, 2, 2, 2, + /* 60 */ 238, 21, 21, 184, 21, 21, 21, 205, 205, 158, /* 70 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 80 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 90 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 100 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - /* 110 */ 21, 21, 21, 21, 21, 21, 318, 378, 378, 378, - /* 120 */ 330, 330, 330, 378, 329, 332, 336, 344, 342, 353, - /* 130 */ 356, 358, 347, 318, 378, 378, 378, 12, 378, 378, - /* 140 */ 393, 396, 432, 401, 404, 439, 414, 418, 378, 426, - /* 150 */ 378, 426, 378, 426, 378, 615, 615, 27, 70, 70, - /* 160 */ 70, 130, 155, 234, 234, 234, 223, 196, 235, 278, - /* 170 */ 278, 278, 278, 151, 14, 148, 148, 219, 107, 266, - /* 180 */ 244, 248, 249, 250, 251, 257, 258, 197, 328, 9, - /* 190 */ 302, 259, 255, 261, 264, 267, 268, 243, 245, 254, - /* 200 */ 282, 256, 386, 387, 298, 334, 499, 365, 501, 505, - /* 210 */ 373, 510, 511, 430, 388, 408, 419, 412, 421, 440, - /* 220 */ 433, 441, 444, 541, 445, 448, 450, 446, 435, 449, - /* 230 */ 436, 455, 451, 452, 457, 421, 458, 459, 456, 488, - /* 240 */ 555, 560, 561, 562, 563, 564, 492, 556, 498, 442, - /* 250 */ 466, 466, 558, 443, 447, 466, 570, 573, 477, 466, - /* 260 */ 575, 577, 578, 579, 580, 581, 582, 583, 584, 585, - /* 270 */ 586, 587, 588, 589, 590, 591, 490, 520, 592, 593, + /* 110 */ 21, 21, 21, 21, 21, 21, 317, 375, 375, 375, + /* 120 */ 323, 323, 323, 375, 311, 314, 318, 337, 338, 344, + /* 130 */ 348, 363, 362, 317, 375, 375, 375, 12, 375, 375, + /* 140 */ 410, 412, 448, 417, 416, 447, 421, 425, 375, 429, + /* 150 */ 375, 429, 375, 429, 375, 614, 614, 27, 70, 70, + /* 160 */ 70, 130, 155, 247, 247, 247, 221, 231, 242, 282, + /* 170 */ 282, 282, 282, 202, 14, 148, 148, 223, 228, 267, + /* 180 */ 246, 200, 252, 259, 260, 262, 263, 345, 366, 321, + /* 190 */ 276, 111, 261, 162, 272, 273, 274, 249, 253, 256, + /* 200 */ 290, 264, 387, 394, 310, 334, 502, 370, 507, 508, + /* 210 */ 374, 510, 511, 430, 388, 427, 418, 428, 439, 443, + /* 220 */ 438, 444, 446, 547, 449, 450, 452, 442, 432, 451, + /* 230 */ 435, 453, 455, 454, 456, 439, 458, 457, 459, 486, + /* 240 */ 554, 560, 561, 562, 563, 564, 492, 556, 498, 440, + /* 250 */ 466, 466, 559, 445, 460, 466, 571, 572, 476, 466, + /* 260 */ 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, + /* 270 */ 585, 586, 587, 588, 590, 591, 490, 520, 589, 592, /* 280 */ 540, 542, 601, }; #define YY_REDUCE_COUNT (156) -#define YY_REDUCE_MIN (-268) -#define YY_REDUCE_MAX (324) +#define YY_REDUCE_MIN (-242) +#define YY_REDUCE_MAX (349) static const short yy_reduce_ofst[] = { - /* 0 */ -208, -102, 10, -41, -268, -178, -196, -151, -115, 67, - /* 10 */ 74, 80, 84, 87, 95, -214, -164, -265, -223, -150, - /* 20 */ -65, -93, -172, -23, 42, -22, 99, -16, -2, -14, - /* 30 */ 3, 58, 54, -264, -251, -241, -177, -25, 19, 30, - /* 40 */ 93, 110, 114, 127, 128, 129, 131, 132, 134, 135, - /* 50 */ 136, -193, -78, 153, 160, 161, 162, 163, 164, 165, - /* 60 */ 166, 199, 200, 146, 202, 203, 204, 143, 144, 167, - /* 70 */ 208, 209, 211, 212, 214, 215, 216, 217, 218, 220, - /* 80 */ 221, 222, 224, 225, 226, 227, 228, 229, 231, 233, - /* 90 */ 236, 237, 238, 240, 241, 242, 246, 247, 252, 253, - /* 100 */ 260, 262, 263, 265, 269, 270, 271, 272, 274, 275, - /* 110 */ 276, 277, 279, 280, 281, 283, 180, 284, 285, 286, - /* 120 */ 173, 175, 176, 287, 191, 198, 201, 205, 207, 210, - /* 130 */ 288, 290, 289, 291, 292, 293, 294, 295, 296, 297, - /* 140 */ 299, 301, 300, 303, 304, 307, 308, 310, 305, 306, - /* 150 */ 309, 319, 321, 322, 324, 314, 320, + /* 0 */ -182, -76, 44, -15, -242, -152, -170, -125, -89, 17, + /* 10 */ 29, 117, 118, 125, 129, -188, -138, -239, -197, -124, + /* 20 */ -56, -67, -146, -11, 3, -27, 9, 16, 69, 31, + /* 30 */ 84, 141, -40, -238, -234, -225, -215, -198, -151, -96, + /* 40 */ -28, 34, 74, 96, 105, 128, 134, 156, 159, 160, + /* 50 */ 161, -167, 173, 185, 186, 187, 188, 189, 190, 191, + /* 60 */ 192, 225, 226, 172, 229, 230, 232, 165, 170, 193, + /* 70 */ 234, 235, 237, 239, 240, 241, 243, 244, 245, 248, + /* 80 */ 250, 251, 254, 255, 257, 258, 265, 266, 268, 269, + /* 90 */ 270, 271, 275, 277, 278, 279, 280, 281, 283, 284, + /* 100 */ 285, 286, 287, 288, 289, 291, 292, 293, 294, 295, + /* 110 */ 296, 297, 298, 299, 300, 301, 203, 302, 303, 304, + /* 120 */ 197, 201, 204, 305, 207, 210, 212, 215, 306, 227, + /* 130 */ 236, 307, 309, 308, 312, 313, 315, 316, 319, 322, + /* 140 */ 320, 324, 326, 325, 328, 327, 330, 335, 329, 331, + /* 150 */ 341, 342, 347, 343, 349, 340, 333, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 713, 768, 757, 765, 950, 950, 713, 713, 713, 713, @@ -629,32 +626,6 @@ static const YYCODETYPE yyFallback[] = { 1, /* STATEMENT => ID */ 1, /* TRIGGER => ID */ 1, /* VIEW => ID */ - 1, /* COUNT => ID */ - 1, /* SUM => ID */ - 1, /* AVG => ID */ - 1, /* MIN => ID */ - 1, /* MAX => ID */ - 1, /* FIRST => ID */ - 1, /* LAST => ID */ - 1, /* TOP => ID */ - 1, /* BOTTOM => ID */ - 1, /* STDDEV => ID */ - 1, /* PERCENTILE => ID */ - 1, /* APERCENTILE => ID */ - 1, /* LEASTSQUARES => ID */ - 1, /* HISTOGRAM => ID */ - 1, /* DIFF => ID */ - 1, /* SPREAD => ID */ - 1, /* TWA => ID */ - 1, /* INTERP => ID */ - 1, /* LAST_ROW => ID */ - 1, /* RATE => ID */ - 1, /* IRATE => ID */ - 1, /* SUM_RATE => ID */ - 1, /* SUM_IRATE => ID */ - 1, /* AVG_RATE => ID */ - 1, /* AVG_IRATE => ID */ - 1, /* TBID => ID */ 1, /* SEMI => ID */ 1, /* NONE => ID */ 1, /* PREV => ID */ @@ -925,115 +896,89 @@ static const char *const yyTokenName[] = { /* 169 */ "STATEMENT", /* 170 */ "TRIGGER", /* 171 */ "VIEW", - /* 172 */ "COUNT", - /* 173 */ "SUM", - /* 174 */ "AVG", - /* 175 */ "MIN", - /* 176 */ "MAX", - /* 177 */ "FIRST", - /* 178 */ "LAST", - /* 179 */ "TOP", - /* 180 */ "BOTTOM", - /* 181 */ "STDDEV", - /* 182 */ "PERCENTILE", - /* 183 */ "APERCENTILE", - /* 184 */ "LEASTSQUARES", - /* 185 */ "HISTOGRAM", - /* 186 */ "DIFF", - /* 187 */ "SPREAD", - /* 188 */ "TWA", - /* 189 */ "INTERP", - /* 190 */ "LAST_ROW", - /* 191 */ "RATE", - /* 192 */ "IRATE", - /* 193 */ "SUM_RATE", - /* 194 */ "SUM_IRATE", - /* 195 */ "AVG_RATE", - /* 196 */ "AVG_IRATE", - /* 197 */ "TBID", - /* 198 */ "SEMI", - /* 199 */ "NONE", - /* 200 */ "PREV", - /* 201 */ "LINEAR", - /* 202 */ "IMPORT", - /* 203 */ "METRIC", - /* 204 */ "TBNAME", - /* 205 */ "JOIN", - /* 206 */ "METRICS", - /* 207 */ "INSERT", - /* 208 */ "INTO", - /* 209 */ "VALUES", - /* 210 */ "error", - /* 211 */ "program", - /* 212 */ "cmd", - /* 213 */ "dbPrefix", - /* 214 */ "ids", - /* 215 */ "cpxName", - /* 216 */ "ifexists", - /* 217 */ "alter_db_optr", - /* 218 */ "acct_optr", - /* 219 */ "ifnotexists", - /* 220 */ "db_optr", - /* 221 */ "pps", - /* 222 */ "tseries", - /* 223 */ "dbs", - /* 224 */ "streams", - /* 225 */ "storage", - /* 226 */ "qtime", - /* 227 */ "users", - /* 228 */ "conns", - /* 229 */ "state", - /* 230 */ "keep", - /* 231 */ "tagitemlist", - /* 232 */ "cache", - /* 233 */ "replica", - /* 234 */ "quorum", - /* 235 */ "days", - /* 236 */ "minrows", - /* 237 */ "maxrows", - /* 238 */ "blocks", - /* 239 */ "ctime", - /* 240 */ "wal", - /* 241 */ "fsync", - /* 242 */ "comp", - /* 243 */ "prec", - /* 244 */ "update", - /* 245 */ "cachelast", - /* 246 */ "typename", - /* 247 */ "signed", - /* 248 */ "create_table_args", - /* 249 */ "create_stable_args", - /* 250 */ "create_table_list", - /* 251 */ "create_from_stable", - /* 252 */ "columnlist", - /* 253 */ "select", - /* 254 */ "column", - /* 255 */ "tagitem", - /* 256 */ "selcollist", - /* 257 */ "from", - /* 258 */ "where_opt", - /* 259 */ "interval_opt", - /* 260 */ "fill_opt", - /* 261 */ "sliding_opt", - /* 262 */ "groupby_opt", - /* 263 */ "orderby_opt", - /* 264 */ "having_opt", - /* 265 */ "slimit_opt", - /* 266 */ "limit_opt", - /* 267 */ "union", - /* 268 */ "sclp", - /* 269 */ "distinct", - /* 270 */ "expr", - /* 271 */ "as", - /* 272 */ "tablelist", - /* 273 */ "tmvar", - /* 274 */ "sortlist", - /* 275 */ "sortitem", - /* 276 */ "item", - /* 277 */ "sortorder", - /* 278 */ "grouplist", - /* 279 */ "exprlist", - /* 280 */ "expritem", + /* 172 */ "SEMI", + /* 173 */ "NONE", + /* 174 */ "PREV", + /* 175 */ "LINEAR", + /* 176 */ "IMPORT", + /* 177 */ "METRIC", + /* 178 */ "TBNAME", + /* 179 */ "JOIN", + /* 180 */ "METRICS", + /* 181 */ "INSERT", + /* 182 */ "INTO", + /* 183 */ "VALUES", + /* 184 */ "error", + /* 185 */ "program", + /* 186 */ "cmd", + /* 187 */ "dbPrefix", + /* 188 */ "ids", + /* 189 */ "cpxName", + /* 190 */ "ifexists", + /* 191 */ "alter_db_optr", + /* 192 */ "acct_optr", + /* 193 */ "ifnotexists", + /* 194 */ "db_optr", + /* 195 */ "pps", + /* 196 */ "tseries", + /* 197 */ "dbs", + /* 198 */ "streams", + /* 199 */ "storage", + /* 200 */ "qtime", + /* 201 */ "users", + /* 202 */ "conns", + /* 203 */ "state", + /* 204 */ "keep", + /* 205 */ "tagitemlist", + /* 206 */ "cache", + /* 207 */ "replica", + /* 208 */ "quorum", + /* 209 */ "days", + /* 210 */ "minrows", + /* 211 */ "maxrows", + /* 212 */ "blocks", + /* 213 */ "ctime", + /* 214 */ "wal", + /* 215 */ "fsync", + /* 216 */ "comp", + /* 217 */ "prec", + /* 218 */ "update", + /* 219 */ "cachelast", + /* 220 */ "typename", + /* 221 */ "signed", + /* 222 */ "create_table_args", + /* 223 */ "create_stable_args", + /* 224 */ "create_table_list", + /* 225 */ "create_from_stable", + /* 226 */ "columnlist", + /* 227 */ "select", + /* 228 */ "column", + /* 229 */ "tagitem", + /* 230 */ "selcollist", + /* 231 */ "from", + /* 232 */ "where_opt", + /* 233 */ "interval_opt", + /* 234 */ "fill_opt", + /* 235 */ "sliding_opt", + /* 236 */ "groupby_opt", + /* 237 */ "orderby_opt", + /* 238 */ "having_opt", + /* 239 */ "slimit_opt", + /* 240 */ "limit_opt", + /* 241 */ "union", + /* 242 */ "sclp", + /* 243 */ "distinct", + /* 244 */ "expr", + /* 245 */ "as", + /* 246 */ "tablelist", + /* 247 */ "tmvar", + /* 248 */ "sortlist", + /* 249 */ "sortitem", + /* 250 */ "item", + /* 251 */ "sortorder", + /* 252 */ "grouplist", + /* 253 */ "exprlist", + /* 254 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1411,51 +1356,51 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 230: /* keep */ - case 231: /* tagitemlist */ - case 252: /* columnlist */ - case 260: /* fill_opt */ - case 262: /* groupby_opt */ - case 263: /* orderby_opt */ - case 274: /* sortlist */ - case 278: /* grouplist */ + case 204: /* keep */ + case 205: /* tagitemlist */ + case 226: /* columnlist */ + case 234: /* fill_opt */ + case 236: /* groupby_opt */ + case 237: /* orderby_opt */ + case 248: /* sortlist */ + case 252: /* grouplist */ { -taosArrayDestroy((yypminor->yy247)); +taosArrayDestroy((yypminor->yy141)); } break; - case 250: /* create_table_list */ + case 224: /* create_table_list */ { -destroyCreateTableSql((yypminor->yy358)); +destroyCreateTableSql((yypminor->yy8)); } break; - case 253: /* select */ + case 227: /* select */ { -doDestroyQuerySql((yypminor->yy114)); +doDestroyQuerySql((yypminor->yy234)); } break; - case 256: /* selcollist */ - case 268: /* sclp */ - case 279: /* exprlist */ + case 230: /* selcollist */ + case 242: /* sclp */ + case 253: /* exprlist */ { -tSqlExprListDestroy((yypminor->yy522)); +tSqlExprListDestroy((yypminor->yy9)); } break; - case 258: /* where_opt */ - case 264: /* having_opt */ - case 270: /* expr */ - case 280: /* expritem */ + case 232: /* where_opt */ + case 238: /* having_opt */ + case 244: /* expr */ + case 254: /* expritem */ { -tSqlExprDestroy((yypminor->yy326)); +tSqlExprDestroy((yypminor->yy220)); } break; - case 267: /* union */ + case 241: /* union */ { -destroyAllSelectClause((yypminor->yy219)); +destroyAllSelectClause((yypminor->yy63)); } break; - case 275: /* sortitem */ + case 249: /* sortitem */ { -tVariantDestroy(&(yypminor->yy378)); +tVariantDestroy(&(yypminor->yy326)); } break; /********* End destructor definitions *****************************************/ @@ -1749,256 +1694,256 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 211, -1 }, /* (0) program ::= cmd */ - { 212, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 212, -2 }, /* (2) cmd ::= SHOW MNODES */ - { 212, -2 }, /* (3) cmd ::= SHOW DNODES */ - { 212, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ - { 212, -2 }, /* (5) cmd ::= SHOW USERS */ - { 212, -2 }, /* (6) cmd ::= SHOW MODULES */ - { 212, -2 }, /* (7) cmd ::= SHOW QUERIES */ - { 212, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ - { 212, -2 }, /* (9) cmd ::= SHOW STREAMS */ - { 212, -2 }, /* (10) cmd ::= SHOW VARIABLES */ - { 212, -2 }, /* (11) cmd ::= SHOW SCORES */ - { 212, -2 }, /* (12) cmd ::= SHOW GRANTS */ - { 212, -2 }, /* (13) cmd ::= SHOW VNODES */ - { 212, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - { 213, 0 }, /* (15) dbPrefix ::= */ - { 213, -2 }, /* (16) dbPrefix ::= ids DOT */ - { 215, 0 }, /* (17) cpxName ::= */ - { 215, -2 }, /* (18) cpxName ::= DOT ids */ - { 212, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 212, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */ - { 212, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */ - { 212, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 212, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */ - { 212, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 212, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ - { 212, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 212, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ - { 212, -5 }, /* (28) cmd ::= DROP STABLE ifexists ids cpxName */ - { 212, -4 }, /* (29) cmd ::= DROP DATABASE ifexists ids */ - { 212, -3 }, /* (30) cmd ::= DROP DNODE ids */ - { 212, -3 }, /* (31) cmd ::= DROP USER ids */ - { 212, -3 }, /* (32) cmd ::= DROP ACCOUNT ids */ - { 212, -2 }, /* (33) cmd ::= USE ids */ - { 212, -3 }, /* (34) cmd ::= DESCRIBE ids cpxName */ - { 212, -5 }, /* (35) cmd ::= ALTER USER ids PASS ids */ - { 212, -5 }, /* (36) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 212, -4 }, /* (37) cmd ::= ALTER DNODE ids ids */ - { 212, -5 }, /* (38) cmd ::= ALTER DNODE ids ids ids */ - { 212, -3 }, /* (39) cmd ::= ALTER LOCAL ids */ - { 212, -4 }, /* (40) cmd ::= ALTER LOCAL ids ids */ - { 212, -4 }, /* (41) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 212, -4 }, /* (42) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 212, -6 }, /* (43) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 214, -1 }, /* (44) ids ::= ID */ - { 214, -1 }, /* (45) ids ::= STRING */ - { 216, -2 }, /* (46) ifexists ::= IF EXISTS */ - { 216, 0 }, /* (47) ifexists ::= */ - { 219, -3 }, /* (48) ifnotexists ::= IF NOT EXISTS */ - { 219, 0 }, /* (49) ifnotexists ::= */ - { 212, -3 }, /* (50) cmd ::= CREATE DNODE ids */ - { 212, -6 }, /* (51) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 212, -5 }, /* (52) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 212, -5 }, /* (53) cmd ::= CREATE USER ids PASS ids */ - { 221, 0 }, /* (54) pps ::= */ - { 221, -2 }, /* (55) pps ::= PPS INTEGER */ - { 222, 0 }, /* (56) tseries ::= */ - { 222, -2 }, /* (57) tseries ::= TSERIES INTEGER */ - { 223, 0 }, /* (58) dbs ::= */ - { 223, -2 }, /* (59) dbs ::= DBS INTEGER */ - { 224, 0 }, /* (60) streams ::= */ - { 224, -2 }, /* (61) streams ::= STREAMS INTEGER */ - { 225, 0 }, /* (62) storage ::= */ - { 225, -2 }, /* (63) storage ::= STORAGE INTEGER */ - { 226, 0 }, /* (64) qtime ::= */ - { 226, -2 }, /* (65) qtime ::= QTIME INTEGER */ - { 227, 0 }, /* (66) users ::= */ - { 227, -2 }, /* (67) users ::= USERS INTEGER */ - { 228, 0 }, /* (68) conns ::= */ - { 228, -2 }, /* (69) conns ::= CONNS INTEGER */ - { 229, 0 }, /* (70) state ::= */ - { 229, -2 }, /* (71) state ::= STATE ids */ - { 218, -9 }, /* (72) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 230, -2 }, /* (73) keep ::= KEEP tagitemlist */ - { 232, -2 }, /* (74) cache ::= CACHE INTEGER */ - { 233, -2 }, /* (75) replica ::= REPLICA INTEGER */ - { 234, -2 }, /* (76) quorum ::= QUORUM INTEGER */ - { 235, -2 }, /* (77) days ::= DAYS INTEGER */ - { 236, -2 }, /* (78) minrows ::= MINROWS INTEGER */ - { 237, -2 }, /* (79) maxrows ::= MAXROWS INTEGER */ - { 238, -2 }, /* (80) blocks ::= BLOCKS INTEGER */ - { 239, -2 }, /* (81) ctime ::= CTIME INTEGER */ - { 240, -2 }, /* (82) wal ::= WAL INTEGER */ - { 241, -2 }, /* (83) fsync ::= FSYNC INTEGER */ - { 242, -2 }, /* (84) comp ::= COMP INTEGER */ - { 243, -2 }, /* (85) prec ::= PRECISION STRING */ - { 244, -2 }, /* (86) update ::= UPDATE INTEGER */ - { 245, -2 }, /* (87) cachelast ::= CACHELAST INTEGER */ - { 220, 0 }, /* (88) db_optr ::= */ - { 220, -2 }, /* (89) db_optr ::= db_optr cache */ - { 220, -2 }, /* (90) db_optr ::= db_optr replica */ - { 220, -2 }, /* (91) db_optr ::= db_optr quorum */ - { 220, -2 }, /* (92) db_optr ::= db_optr days */ - { 220, -2 }, /* (93) db_optr ::= db_optr minrows */ - { 220, -2 }, /* (94) db_optr ::= db_optr maxrows */ - { 220, -2 }, /* (95) db_optr ::= db_optr blocks */ - { 220, -2 }, /* (96) db_optr ::= db_optr ctime */ - { 220, -2 }, /* (97) db_optr ::= db_optr wal */ - { 220, -2 }, /* (98) db_optr ::= db_optr fsync */ - { 220, -2 }, /* (99) db_optr ::= db_optr comp */ - { 220, -2 }, /* (100) db_optr ::= db_optr prec */ - { 220, -2 }, /* (101) db_optr ::= db_optr keep */ - { 220, -2 }, /* (102) db_optr ::= db_optr update */ - { 220, -2 }, /* (103) db_optr ::= db_optr cachelast */ - { 217, 0 }, /* (104) alter_db_optr ::= */ - { 217, -2 }, /* (105) alter_db_optr ::= alter_db_optr replica */ - { 217, -2 }, /* (106) alter_db_optr ::= alter_db_optr quorum */ - { 217, -2 }, /* (107) alter_db_optr ::= alter_db_optr keep */ - { 217, -2 }, /* (108) alter_db_optr ::= alter_db_optr blocks */ - { 217, -2 }, /* (109) alter_db_optr ::= alter_db_optr comp */ - { 217, -2 }, /* (110) alter_db_optr ::= alter_db_optr wal */ - { 217, -2 }, /* (111) alter_db_optr ::= alter_db_optr fsync */ - { 217, -2 }, /* (112) alter_db_optr ::= alter_db_optr update */ - { 217, -2 }, /* (113) alter_db_optr ::= alter_db_optr cachelast */ - { 246, -1 }, /* (114) typename ::= ids */ - { 246, -4 }, /* (115) typename ::= ids LP signed RP */ - { 246, -2 }, /* (116) typename ::= ids UNSIGNED */ - { 247, -1 }, /* (117) signed ::= INTEGER */ - { 247, -2 }, /* (118) signed ::= PLUS INTEGER */ - { 247, -2 }, /* (119) signed ::= MINUS INTEGER */ - { 212, -3 }, /* (120) cmd ::= CREATE TABLE create_table_args */ - { 212, -3 }, /* (121) cmd ::= CREATE TABLE create_stable_args */ - { 212, -3 }, /* (122) cmd ::= CREATE STABLE create_stable_args */ - { 212, -3 }, /* (123) cmd ::= CREATE TABLE create_table_list */ - { 250, -1 }, /* (124) create_table_list ::= create_from_stable */ - { 250, -2 }, /* (125) create_table_list ::= create_table_list create_from_stable */ - { 248, -6 }, /* (126) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 249, -10 }, /* (127) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 251, -10 }, /* (128) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 248, -5 }, /* (129) create_table_args ::= ifnotexists ids cpxName AS select */ - { 252, -3 }, /* (130) columnlist ::= columnlist COMMA column */ - { 252, -1 }, /* (131) columnlist ::= column */ - { 254, -2 }, /* (132) column ::= ids typename */ - { 231, -3 }, /* (133) tagitemlist ::= tagitemlist COMMA tagitem */ - { 231, -1 }, /* (134) tagitemlist ::= tagitem */ - { 255, -1 }, /* (135) tagitem ::= INTEGER */ - { 255, -1 }, /* (136) tagitem ::= FLOAT */ - { 255, -1 }, /* (137) tagitem ::= STRING */ - { 255, -1 }, /* (138) tagitem ::= BOOL */ - { 255, -1 }, /* (139) tagitem ::= NULL */ - { 255, -2 }, /* (140) tagitem ::= MINUS INTEGER */ - { 255, -2 }, /* (141) tagitem ::= MINUS FLOAT */ - { 255, -2 }, /* (142) tagitem ::= PLUS INTEGER */ - { 255, -2 }, /* (143) tagitem ::= PLUS FLOAT */ - { 253, -12 }, /* (144) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 267, -1 }, /* (145) union ::= select */ - { 267, -3 }, /* (146) union ::= LP union RP */ - { 267, -4 }, /* (147) union ::= union UNION ALL select */ - { 267, -6 }, /* (148) union ::= union UNION ALL LP select RP */ - { 212, -1 }, /* (149) cmd ::= union */ - { 253, -2 }, /* (150) select ::= SELECT selcollist */ - { 268, -2 }, /* (151) sclp ::= selcollist COMMA */ - { 268, 0 }, /* (152) sclp ::= */ - { 256, -4 }, /* (153) selcollist ::= sclp distinct expr as */ - { 256, -2 }, /* (154) selcollist ::= sclp STAR */ - { 271, -2 }, /* (155) as ::= AS ids */ - { 271, -1 }, /* (156) as ::= ids */ - { 271, 0 }, /* (157) as ::= */ - { 269, -1 }, /* (158) distinct ::= DISTINCT */ - { 269, 0 }, /* (159) distinct ::= */ - { 257, -2 }, /* (160) from ::= FROM tablelist */ - { 272, -2 }, /* (161) tablelist ::= ids cpxName */ - { 272, -3 }, /* (162) tablelist ::= ids cpxName ids */ - { 272, -4 }, /* (163) tablelist ::= tablelist COMMA ids cpxName */ - { 272, -5 }, /* (164) tablelist ::= tablelist COMMA ids cpxName ids */ - { 273, -1 }, /* (165) tmvar ::= VARIABLE */ - { 259, -4 }, /* (166) interval_opt ::= INTERVAL LP tmvar RP */ - { 259, -6 }, /* (167) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - { 259, 0 }, /* (168) interval_opt ::= */ - { 260, 0 }, /* (169) fill_opt ::= */ - { 260, -6 }, /* (170) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 260, -4 }, /* (171) fill_opt ::= FILL LP ID RP */ - { 261, -4 }, /* (172) sliding_opt ::= SLIDING LP tmvar RP */ - { 261, 0 }, /* (173) sliding_opt ::= */ - { 263, 0 }, /* (174) orderby_opt ::= */ - { 263, -3 }, /* (175) orderby_opt ::= ORDER BY sortlist */ - { 274, -4 }, /* (176) sortlist ::= sortlist COMMA item sortorder */ - { 274, -2 }, /* (177) sortlist ::= item sortorder */ - { 276, -2 }, /* (178) item ::= ids cpxName */ - { 277, -1 }, /* (179) sortorder ::= ASC */ - { 277, -1 }, /* (180) sortorder ::= DESC */ - { 277, 0 }, /* (181) sortorder ::= */ - { 262, 0 }, /* (182) groupby_opt ::= */ - { 262, -3 }, /* (183) groupby_opt ::= GROUP BY grouplist */ - { 278, -3 }, /* (184) grouplist ::= grouplist COMMA item */ - { 278, -1 }, /* (185) grouplist ::= item */ - { 264, 0 }, /* (186) having_opt ::= */ - { 264, -2 }, /* (187) having_opt ::= HAVING expr */ - { 266, 0 }, /* (188) limit_opt ::= */ - { 266, -2 }, /* (189) limit_opt ::= LIMIT signed */ - { 266, -4 }, /* (190) limit_opt ::= LIMIT signed OFFSET signed */ - { 266, -4 }, /* (191) limit_opt ::= LIMIT signed COMMA signed */ - { 265, 0 }, /* (192) slimit_opt ::= */ - { 265, -2 }, /* (193) slimit_opt ::= SLIMIT signed */ - { 265, -4 }, /* (194) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 265, -4 }, /* (195) slimit_opt ::= SLIMIT signed COMMA signed */ - { 258, 0 }, /* (196) where_opt ::= */ - { 258, -2 }, /* (197) where_opt ::= WHERE expr */ - { 270, -3 }, /* (198) expr ::= LP expr RP */ - { 270, -1 }, /* (199) expr ::= ID */ - { 270, -3 }, /* (200) expr ::= ID DOT ID */ - { 270, -3 }, /* (201) expr ::= ID DOT STAR */ - { 270, -1 }, /* (202) expr ::= INTEGER */ - { 270, -2 }, /* (203) expr ::= MINUS INTEGER */ - { 270, -2 }, /* (204) expr ::= PLUS INTEGER */ - { 270, -1 }, /* (205) expr ::= FLOAT */ - { 270, -2 }, /* (206) expr ::= MINUS FLOAT */ - { 270, -2 }, /* (207) expr ::= PLUS FLOAT */ - { 270, -1 }, /* (208) expr ::= STRING */ - { 270, -1 }, /* (209) expr ::= NOW */ - { 270, -1 }, /* (210) expr ::= VARIABLE */ - { 270, -1 }, /* (211) expr ::= BOOL */ - { 270, -4 }, /* (212) expr ::= ID LP exprlist RP */ - { 270, -4 }, /* (213) expr ::= ID LP STAR RP */ - { 270, -3 }, /* (214) expr ::= expr IS NULL */ - { 270, -4 }, /* (215) expr ::= expr IS NOT NULL */ - { 270, -3 }, /* (216) expr ::= expr LT expr */ - { 270, -3 }, /* (217) expr ::= expr GT expr */ - { 270, -3 }, /* (218) expr ::= expr LE expr */ - { 270, -3 }, /* (219) expr ::= expr GE expr */ - { 270, -3 }, /* (220) expr ::= expr NE expr */ - { 270, -3 }, /* (221) expr ::= expr EQ expr */ - { 270, -3 }, /* (222) expr ::= expr AND expr */ - { 270, -3 }, /* (223) expr ::= expr OR expr */ - { 270, -3 }, /* (224) expr ::= expr PLUS expr */ - { 270, -3 }, /* (225) expr ::= expr MINUS expr */ - { 270, -3 }, /* (226) expr ::= expr STAR expr */ - { 270, -3 }, /* (227) expr ::= expr SLASH expr */ - { 270, -3 }, /* (228) expr ::= expr REM expr */ - { 270, -3 }, /* (229) expr ::= expr LIKE expr */ - { 270, -5 }, /* (230) expr ::= expr IN LP exprlist RP */ - { 279, -3 }, /* (231) exprlist ::= exprlist COMMA expritem */ - { 279, -1 }, /* (232) exprlist ::= expritem */ - { 280, -1 }, /* (233) expritem ::= expr */ - { 280, 0 }, /* (234) expritem ::= */ - { 212, -3 }, /* (235) cmd ::= RESET QUERY CACHE */ - { 212, -7 }, /* (236) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 212, -7 }, /* (237) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 212, -7 }, /* (238) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 212, -7 }, /* (239) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 212, -8 }, /* (240) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 212, -9 }, /* (241) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 212, -7 }, /* (242) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 212, -7 }, /* (243) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 212, -7 }, /* (244) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 212, -7 }, /* (245) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 212, -8 }, /* (246) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 212, -3 }, /* (247) cmd ::= KILL CONNECTION INTEGER */ - { 212, -5 }, /* (248) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 212, -5 }, /* (249) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + { 185, -1 }, /* (0) program ::= cmd */ + { 186, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 186, -2 }, /* (2) cmd ::= SHOW MNODES */ + { 186, -2 }, /* (3) cmd ::= SHOW DNODES */ + { 186, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ + { 186, -2 }, /* (5) cmd ::= SHOW USERS */ + { 186, -2 }, /* (6) cmd ::= SHOW MODULES */ + { 186, -2 }, /* (7) cmd ::= SHOW QUERIES */ + { 186, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ + { 186, -2 }, /* (9) cmd ::= SHOW STREAMS */ + { 186, -2 }, /* (10) cmd ::= SHOW VARIABLES */ + { 186, -2 }, /* (11) cmd ::= SHOW SCORES */ + { 186, -2 }, /* (12) cmd ::= SHOW GRANTS */ + { 186, -2 }, /* (13) cmd ::= SHOW VNODES */ + { 186, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ + { 187, 0 }, /* (15) dbPrefix ::= */ + { 187, -2 }, /* (16) dbPrefix ::= ids DOT */ + { 189, 0 }, /* (17) cpxName ::= */ + { 189, -2 }, /* (18) cpxName ::= DOT ids */ + { 186, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ + { 186, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */ + { 186, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */ + { 186, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 186, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */ + { 186, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 186, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ + { 186, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 186, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ + { 186, -5 }, /* (28) cmd ::= DROP STABLE ifexists ids cpxName */ + { 186, -4 }, /* (29) cmd ::= DROP DATABASE ifexists ids */ + { 186, -3 }, /* (30) cmd ::= DROP DNODE ids */ + { 186, -3 }, /* (31) cmd ::= DROP USER ids */ + { 186, -3 }, /* (32) cmd ::= DROP ACCOUNT ids */ + { 186, -2 }, /* (33) cmd ::= USE ids */ + { 186, -3 }, /* (34) cmd ::= DESCRIBE ids cpxName */ + { 186, -5 }, /* (35) cmd ::= ALTER USER ids PASS ids */ + { 186, -5 }, /* (36) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 186, -4 }, /* (37) cmd ::= ALTER DNODE ids ids */ + { 186, -5 }, /* (38) cmd ::= ALTER DNODE ids ids ids */ + { 186, -3 }, /* (39) cmd ::= ALTER LOCAL ids */ + { 186, -4 }, /* (40) cmd ::= ALTER LOCAL ids ids */ + { 186, -4 }, /* (41) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 186, -4 }, /* (42) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 186, -6 }, /* (43) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 188, -1 }, /* (44) ids ::= ID */ + { 188, -1 }, /* (45) ids ::= STRING */ + { 190, -2 }, /* (46) ifexists ::= IF EXISTS */ + { 190, 0 }, /* (47) ifexists ::= */ + { 193, -3 }, /* (48) ifnotexists ::= IF NOT EXISTS */ + { 193, 0 }, /* (49) ifnotexists ::= */ + { 186, -3 }, /* (50) cmd ::= CREATE DNODE ids */ + { 186, -6 }, /* (51) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 186, -5 }, /* (52) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 186, -5 }, /* (53) cmd ::= CREATE USER ids PASS ids */ + { 195, 0 }, /* (54) pps ::= */ + { 195, -2 }, /* (55) pps ::= PPS INTEGER */ + { 196, 0 }, /* (56) tseries ::= */ + { 196, -2 }, /* (57) tseries ::= TSERIES INTEGER */ + { 197, 0 }, /* (58) dbs ::= */ + { 197, -2 }, /* (59) dbs ::= DBS INTEGER */ + { 198, 0 }, /* (60) streams ::= */ + { 198, -2 }, /* (61) streams ::= STREAMS INTEGER */ + { 199, 0 }, /* (62) storage ::= */ + { 199, -2 }, /* (63) storage ::= STORAGE INTEGER */ + { 200, 0 }, /* (64) qtime ::= */ + { 200, -2 }, /* (65) qtime ::= QTIME INTEGER */ + { 201, 0 }, /* (66) users ::= */ + { 201, -2 }, /* (67) users ::= USERS INTEGER */ + { 202, 0 }, /* (68) conns ::= */ + { 202, -2 }, /* (69) conns ::= CONNS INTEGER */ + { 203, 0 }, /* (70) state ::= */ + { 203, -2 }, /* (71) state ::= STATE ids */ + { 192, -9 }, /* (72) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 204, -2 }, /* (73) keep ::= KEEP tagitemlist */ + { 206, -2 }, /* (74) cache ::= CACHE INTEGER */ + { 207, -2 }, /* (75) replica ::= REPLICA INTEGER */ + { 208, -2 }, /* (76) quorum ::= QUORUM INTEGER */ + { 209, -2 }, /* (77) days ::= DAYS INTEGER */ + { 210, -2 }, /* (78) minrows ::= MINROWS INTEGER */ + { 211, -2 }, /* (79) maxrows ::= MAXROWS INTEGER */ + { 212, -2 }, /* (80) blocks ::= BLOCKS INTEGER */ + { 213, -2 }, /* (81) ctime ::= CTIME INTEGER */ + { 214, -2 }, /* (82) wal ::= WAL INTEGER */ + { 215, -2 }, /* (83) fsync ::= FSYNC INTEGER */ + { 216, -2 }, /* (84) comp ::= COMP INTEGER */ + { 217, -2 }, /* (85) prec ::= PRECISION STRING */ + { 218, -2 }, /* (86) update ::= UPDATE INTEGER */ + { 219, -2 }, /* (87) cachelast ::= CACHELAST INTEGER */ + { 194, 0 }, /* (88) db_optr ::= */ + { 194, -2 }, /* (89) db_optr ::= db_optr cache */ + { 194, -2 }, /* (90) db_optr ::= db_optr replica */ + { 194, -2 }, /* (91) db_optr ::= db_optr quorum */ + { 194, -2 }, /* (92) db_optr ::= db_optr days */ + { 194, -2 }, /* (93) db_optr ::= db_optr minrows */ + { 194, -2 }, /* (94) db_optr ::= db_optr maxrows */ + { 194, -2 }, /* (95) db_optr ::= db_optr blocks */ + { 194, -2 }, /* (96) db_optr ::= db_optr ctime */ + { 194, -2 }, /* (97) db_optr ::= db_optr wal */ + { 194, -2 }, /* (98) db_optr ::= db_optr fsync */ + { 194, -2 }, /* (99) db_optr ::= db_optr comp */ + { 194, -2 }, /* (100) db_optr ::= db_optr prec */ + { 194, -2 }, /* (101) db_optr ::= db_optr keep */ + { 194, -2 }, /* (102) db_optr ::= db_optr update */ + { 194, -2 }, /* (103) db_optr ::= db_optr cachelast */ + { 191, 0 }, /* (104) alter_db_optr ::= */ + { 191, -2 }, /* (105) alter_db_optr ::= alter_db_optr replica */ + { 191, -2 }, /* (106) alter_db_optr ::= alter_db_optr quorum */ + { 191, -2 }, /* (107) alter_db_optr ::= alter_db_optr keep */ + { 191, -2 }, /* (108) alter_db_optr ::= alter_db_optr blocks */ + { 191, -2 }, /* (109) alter_db_optr ::= alter_db_optr comp */ + { 191, -2 }, /* (110) alter_db_optr ::= alter_db_optr wal */ + { 191, -2 }, /* (111) alter_db_optr ::= alter_db_optr fsync */ + { 191, -2 }, /* (112) alter_db_optr ::= alter_db_optr update */ + { 191, -2 }, /* (113) alter_db_optr ::= alter_db_optr cachelast */ + { 220, -1 }, /* (114) typename ::= ids */ + { 220, -4 }, /* (115) typename ::= ids LP signed RP */ + { 220, -2 }, /* (116) typename ::= ids UNSIGNED */ + { 221, -1 }, /* (117) signed ::= INTEGER */ + { 221, -2 }, /* (118) signed ::= PLUS INTEGER */ + { 221, -2 }, /* (119) signed ::= MINUS INTEGER */ + { 186, -3 }, /* (120) cmd ::= CREATE TABLE create_table_args */ + { 186, -3 }, /* (121) cmd ::= CREATE TABLE create_stable_args */ + { 186, -3 }, /* (122) cmd ::= CREATE STABLE create_stable_args */ + { 186, -3 }, /* (123) cmd ::= CREATE TABLE create_table_list */ + { 224, -1 }, /* (124) create_table_list ::= create_from_stable */ + { 224, -2 }, /* (125) create_table_list ::= create_table_list create_from_stable */ + { 222, -6 }, /* (126) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + { 223, -10 }, /* (127) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + { 225, -10 }, /* (128) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + { 222, -5 }, /* (129) create_table_args ::= ifnotexists ids cpxName AS select */ + { 226, -3 }, /* (130) columnlist ::= columnlist COMMA column */ + { 226, -1 }, /* (131) columnlist ::= column */ + { 228, -2 }, /* (132) column ::= ids typename */ + { 205, -3 }, /* (133) tagitemlist ::= tagitemlist COMMA tagitem */ + { 205, -1 }, /* (134) tagitemlist ::= tagitem */ + { 229, -1 }, /* (135) tagitem ::= INTEGER */ + { 229, -1 }, /* (136) tagitem ::= FLOAT */ + { 229, -1 }, /* (137) tagitem ::= STRING */ + { 229, -1 }, /* (138) tagitem ::= BOOL */ + { 229, -1 }, /* (139) tagitem ::= NULL */ + { 229, -2 }, /* (140) tagitem ::= MINUS INTEGER */ + { 229, -2 }, /* (141) tagitem ::= MINUS FLOAT */ + { 229, -2 }, /* (142) tagitem ::= PLUS INTEGER */ + { 229, -2 }, /* (143) tagitem ::= PLUS FLOAT */ + { 227, -12 }, /* (144) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 241, -1 }, /* (145) union ::= select */ + { 241, -3 }, /* (146) union ::= LP union RP */ + { 241, -4 }, /* (147) union ::= union UNION ALL select */ + { 241, -6 }, /* (148) union ::= union UNION ALL LP select RP */ + { 186, -1 }, /* (149) cmd ::= union */ + { 227, -2 }, /* (150) select ::= SELECT selcollist */ + { 242, -2 }, /* (151) sclp ::= selcollist COMMA */ + { 242, 0 }, /* (152) sclp ::= */ + { 230, -4 }, /* (153) selcollist ::= sclp distinct expr as */ + { 230, -2 }, /* (154) selcollist ::= sclp STAR */ + { 245, -2 }, /* (155) as ::= AS ids */ + { 245, -1 }, /* (156) as ::= ids */ + { 245, 0 }, /* (157) as ::= */ + { 243, -1 }, /* (158) distinct ::= DISTINCT */ + { 243, 0 }, /* (159) distinct ::= */ + { 231, -2 }, /* (160) from ::= FROM tablelist */ + { 246, -2 }, /* (161) tablelist ::= ids cpxName */ + { 246, -3 }, /* (162) tablelist ::= ids cpxName ids */ + { 246, -4 }, /* (163) tablelist ::= tablelist COMMA ids cpxName */ + { 246, -5 }, /* (164) tablelist ::= tablelist COMMA ids cpxName ids */ + { 247, -1 }, /* (165) tmvar ::= VARIABLE */ + { 233, -4 }, /* (166) interval_opt ::= INTERVAL LP tmvar RP */ + { 233, -6 }, /* (167) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + { 233, 0 }, /* (168) interval_opt ::= */ + { 234, 0 }, /* (169) fill_opt ::= */ + { 234, -6 }, /* (170) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 234, -4 }, /* (171) fill_opt ::= FILL LP ID RP */ + { 235, -4 }, /* (172) sliding_opt ::= SLIDING LP tmvar RP */ + { 235, 0 }, /* (173) sliding_opt ::= */ + { 237, 0 }, /* (174) orderby_opt ::= */ + { 237, -3 }, /* (175) orderby_opt ::= ORDER BY sortlist */ + { 248, -4 }, /* (176) sortlist ::= sortlist COMMA item sortorder */ + { 248, -2 }, /* (177) sortlist ::= item sortorder */ + { 250, -2 }, /* (178) item ::= ids cpxName */ + { 251, -1 }, /* (179) sortorder ::= ASC */ + { 251, -1 }, /* (180) sortorder ::= DESC */ + { 251, 0 }, /* (181) sortorder ::= */ + { 236, 0 }, /* (182) groupby_opt ::= */ + { 236, -3 }, /* (183) groupby_opt ::= GROUP BY grouplist */ + { 252, -3 }, /* (184) grouplist ::= grouplist COMMA item */ + { 252, -1 }, /* (185) grouplist ::= item */ + { 238, 0 }, /* (186) having_opt ::= */ + { 238, -2 }, /* (187) having_opt ::= HAVING expr */ + { 240, 0 }, /* (188) limit_opt ::= */ + { 240, -2 }, /* (189) limit_opt ::= LIMIT signed */ + { 240, -4 }, /* (190) limit_opt ::= LIMIT signed OFFSET signed */ + { 240, -4 }, /* (191) limit_opt ::= LIMIT signed COMMA signed */ + { 239, 0 }, /* (192) slimit_opt ::= */ + { 239, -2 }, /* (193) slimit_opt ::= SLIMIT signed */ + { 239, -4 }, /* (194) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 239, -4 }, /* (195) slimit_opt ::= SLIMIT signed COMMA signed */ + { 232, 0 }, /* (196) where_opt ::= */ + { 232, -2 }, /* (197) where_opt ::= WHERE expr */ + { 244, -3 }, /* (198) expr ::= LP expr RP */ + { 244, -1 }, /* (199) expr ::= ID */ + { 244, -3 }, /* (200) expr ::= ID DOT ID */ + { 244, -3 }, /* (201) expr ::= ID DOT STAR */ + { 244, -1 }, /* (202) expr ::= INTEGER */ + { 244, -2 }, /* (203) expr ::= MINUS INTEGER */ + { 244, -2 }, /* (204) expr ::= PLUS INTEGER */ + { 244, -1 }, /* (205) expr ::= FLOAT */ + { 244, -2 }, /* (206) expr ::= MINUS FLOAT */ + { 244, -2 }, /* (207) expr ::= PLUS FLOAT */ + { 244, -1 }, /* (208) expr ::= STRING */ + { 244, -1 }, /* (209) expr ::= NOW */ + { 244, -1 }, /* (210) expr ::= VARIABLE */ + { 244, -1 }, /* (211) expr ::= BOOL */ + { 244, -4 }, /* (212) expr ::= ID LP exprlist RP */ + { 244, -4 }, /* (213) expr ::= ID LP STAR RP */ + { 244, -3 }, /* (214) expr ::= expr IS NULL */ + { 244, -4 }, /* (215) expr ::= expr IS NOT NULL */ + { 244, -3 }, /* (216) expr ::= expr LT expr */ + { 244, -3 }, /* (217) expr ::= expr GT expr */ + { 244, -3 }, /* (218) expr ::= expr LE expr */ + { 244, -3 }, /* (219) expr ::= expr GE expr */ + { 244, -3 }, /* (220) expr ::= expr NE expr */ + { 244, -3 }, /* (221) expr ::= expr EQ expr */ + { 244, -3 }, /* (222) expr ::= expr AND expr */ + { 244, -3 }, /* (223) expr ::= expr OR expr */ + { 244, -3 }, /* (224) expr ::= expr PLUS expr */ + { 244, -3 }, /* (225) expr ::= expr MINUS expr */ + { 244, -3 }, /* (226) expr ::= expr STAR expr */ + { 244, -3 }, /* (227) expr ::= expr SLASH expr */ + { 244, -3 }, /* (228) expr ::= expr REM expr */ + { 244, -3 }, /* (229) expr ::= expr LIKE expr */ + { 244, -5 }, /* (230) expr ::= expr IN LP exprlist RP */ + { 253, -3 }, /* (231) exprlist ::= exprlist COMMA expritem */ + { 253, -1 }, /* (232) exprlist ::= expritem */ + { 254, -1 }, /* (233) expritem ::= expr */ + { 254, 0 }, /* (234) expritem ::= */ + { 186, -3 }, /* (235) cmd ::= RESET QUERY CACHE */ + { 186, -7 }, /* (236) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 186, -7 }, /* (237) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 186, -7 }, /* (238) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 186, -7 }, /* (239) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 186, -8 }, /* (240) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 186, -9 }, /* (241) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 186, -7 }, /* (242) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + { 186, -7 }, /* (243) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + { 186, -7 }, /* (244) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + { 186, -7 }, /* (245) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + { 186, -8 }, /* (246) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + { 186, -3 }, /* (247) cmd ::= KILL CONNECTION INTEGER */ + { 186, -5 }, /* (248) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 186, -5 }, /* (249) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2238,13 +2183,13 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 41: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy262, &t);} +{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy322, &t);} break; case 42: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy47);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy1);} break; case 43: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy47);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy1);} break; case 44: /* ids ::= ID */ case 45: /* ids ::= STRING */ yytestcase(yyruleno==45); @@ -2266,10 +2211,10 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 51: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy47);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy1);} break; case 52: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy262, &yymsp[-2].minor.yy0);} +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy322, &yymsp[-2].minor.yy0);} break; case 53: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2298,20 +2243,20 @@ static void yy_reduce( break; case 72: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy47.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy47.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy47.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy47.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy47.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy47.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy47.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy47.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy47.stat = yymsp[0].minor.yy0; -} - yymsp[-8].minor.yy47 = yylhsminor.yy47; + yylhsminor.yy1.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy1.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy1.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy1.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy1.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy1.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy1.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy1.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy1.stat = yymsp[0].minor.yy0; +} + yymsp[-8].minor.yy1 = yylhsminor.yy1; break; case 73: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy247 = yymsp[0].minor.yy247; } +{ yymsp[-1].minor.yy141 = yymsp[0].minor.yy141; } break; case 74: /* cache ::= CACHE INTEGER */ case 75: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==75); @@ -2330,208 +2275,208 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 88: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy262);} +{setDefaultCreateDbOption(&yymsp[1].minor.yy322);} break; case 89: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 90: /* db_optr ::= db_optr replica */ case 105: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==105); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 91: /* db_optr ::= db_optr quorum */ case 106: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==106); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 92: /* db_optr ::= db_optr days */ -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 93: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 94: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 95: /* db_optr ::= db_optr blocks */ case 108: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==108); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 96: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 97: /* db_optr ::= db_optr wal */ case 110: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==110); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 98: /* db_optr ::= db_optr fsync */ case 111: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==111); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 99: /* db_optr ::= db_optr comp */ case 109: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==109); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 100: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 101: /* db_optr ::= db_optr keep */ case 107: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==107); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.keep = yymsp[0].minor.yy247; } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.keep = yymsp[0].minor.yy141; } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 102: /* db_optr ::= db_optr update */ case 112: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==112); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 103: /* db_optr ::= db_optr cachelast */ case 113: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==113); -{ yylhsminor.yy262 = yymsp[-1].minor.yy262; yylhsminor.yy262.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy262 = yylhsminor.yy262; +{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 104: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy262);} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy322);} break; case 114: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSqlSetColumnType (&yylhsminor.yy179, &yymsp[0].minor.yy0); + tSqlSetColumnType (&yylhsminor.yy403, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy179 = yylhsminor.yy179; + yymsp[0].minor.yy403 = yylhsminor.yy403; break; case 115: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy403 <= 0) { + if (yymsp[-1].minor.yy429 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSqlSetColumnType(&yylhsminor.yy179, &yymsp[-3].minor.yy0); + tSqlSetColumnType(&yylhsminor.yy403, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy403; // negative value of name length - tSqlSetColumnType(&yylhsminor.yy179, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy429; // negative value of name length + tSqlSetColumnType(&yylhsminor.yy403, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy179 = yylhsminor.yy179; + yymsp[-3].minor.yy403 = yylhsminor.yy403; break; case 116: /* typename ::= ids UNSIGNED */ { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSqlSetColumnType (&yylhsminor.yy179, &yymsp[-1].minor.yy0); + tSqlSetColumnType (&yylhsminor.yy403, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy179 = yylhsminor.yy179; + yymsp[-1].minor.yy403 = yylhsminor.yy403; break; case 117: /* signed ::= INTEGER */ -{ yylhsminor.yy403 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy403 = yylhsminor.yy403; +{ yylhsminor.yy429 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 118: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy403 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy429 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 119: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy403 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +{ yymsp[-1].minor.yy429 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 123: /* cmd ::= CREATE TABLE create_table_list */ -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy358;} +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy8;} break; case 124: /* create_table_list ::= create_from_stable */ { SCreateTableSQL* pCreateTable = calloc(1, sizeof(SCreateTableSQL)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy42); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy306); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yylhsminor.yy358 = pCreateTable; + yylhsminor.yy8 = pCreateTable; } - yymsp[0].minor.yy358 = yylhsminor.yy358; + yymsp[0].minor.yy8 = yylhsminor.yy8; break; case 125: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy358->childTableInfo, &yymsp[0].minor.yy42); - yylhsminor.yy358 = yymsp[-1].minor.yy358; + taosArrayPush(yymsp[-1].minor.yy8->childTableInfo, &yymsp[0].minor.yy306); + yylhsminor.yy8 = yymsp[-1].minor.yy8; } - yymsp[-1].minor.yy358 = yylhsminor.yy358; + yymsp[-1].minor.yy8 = yylhsminor.yy8; break; case 126: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy358 = tSetCreateSqlElems(yymsp[-1].minor.yy247, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy358, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy8 = tSetCreateSqlElems(yymsp[-1].minor.yy141, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy8, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy358 = yylhsminor.yy358; + yymsp[-5].minor.yy8 = yylhsminor.yy8; break; case 127: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy358 = tSetCreateSqlElems(yymsp[-5].minor.yy247, yymsp[-1].minor.yy247, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy358, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy8 = tSetCreateSqlElems(yymsp[-5].minor.yy141, yymsp[-1].minor.yy141, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy8, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy358 = yylhsminor.yy358; + yymsp[-9].minor.yy8 = yylhsminor.yy8; break; case 128: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yylhsminor.yy42 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy247, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy306 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy141, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy42 = yylhsminor.yy42; + yymsp[-9].minor.yy306 = yylhsminor.yy306; break; case 129: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy358 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy114, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy358, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy8 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy234, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy8, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); } - yymsp[-4].minor.yy358 = yylhsminor.yy358; + yymsp[-4].minor.yy8 = yylhsminor.yy8; break; case 130: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy247, &yymsp[0].minor.yy179); yylhsminor.yy247 = yymsp[-2].minor.yy247; } - yymsp[-2].minor.yy247 = yylhsminor.yy247; +{taosArrayPush(yymsp[-2].minor.yy141, &yymsp[0].minor.yy403); yylhsminor.yy141 = yymsp[-2].minor.yy141; } + yymsp[-2].minor.yy141 = yylhsminor.yy141; break; case 131: /* columnlist ::= column */ -{yylhsminor.yy247 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy247, &yymsp[0].minor.yy179);} - yymsp[0].minor.yy247 = yylhsminor.yy247; +{yylhsminor.yy141 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy141, &yymsp[0].minor.yy403);} + yymsp[0].minor.yy141 = yylhsminor.yy141; break; case 132: /* column ::= ids typename */ { - tSqlSetColumnInfo(&yylhsminor.yy179, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy179); + tSqlSetColumnInfo(&yylhsminor.yy403, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy403); } - yymsp[-1].minor.yy179 = yylhsminor.yy179; + yymsp[-1].minor.yy403 = yylhsminor.yy403; break; case 133: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy247 = tVariantListAppend(yymsp[-2].minor.yy247, &yymsp[0].minor.yy378, -1); } - yymsp[-2].minor.yy247 = yylhsminor.yy247; +{ yylhsminor.yy141 = tVariantListAppend(yymsp[-2].minor.yy141, &yymsp[0].minor.yy326, -1); } + yymsp[-2].minor.yy141 = yylhsminor.yy141; break; case 134: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy247 = tVariantListAppend(NULL, &yymsp[0].minor.yy378, -1); } - yymsp[0].minor.yy247 = yylhsminor.yy247; +{ yylhsminor.yy141 = tVariantListAppend(NULL, &yymsp[0].minor.yy326, -1); } + yymsp[0].minor.yy141 = yylhsminor.yy141; break; case 135: /* tagitem ::= INTEGER */ case 136: /* tagitem ::= FLOAT */ yytestcase(yyruleno==136); case 137: /* tagitem ::= STRING */ yytestcase(yyruleno==137); case 138: /* tagitem ::= BOOL */ yytestcase(yyruleno==138); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy378, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy378 = yylhsminor.yy378; +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy326, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy326 = yylhsminor.yy326; break; case 139: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy378, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy378 = yylhsminor.yy378; +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy326, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy326 = yylhsminor.yy326; break; case 140: /* tagitem ::= MINUS INTEGER */ case 141: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==141); @@ -2541,59 +2486,59 @@ static void yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy378, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy326, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy378 = yylhsminor.yy378; + yymsp[-1].minor.yy326 = yylhsminor.yy326; break; case 144: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy114 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy522, yymsp[-9].minor.yy247, yymsp[-8].minor.yy326, yymsp[-4].minor.yy247, yymsp[-3].minor.yy247, &yymsp[-7].minor.yy430, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy247, &yymsp[0].minor.yy204, &yymsp[-1].minor.yy204); + yylhsminor.yy234 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy9, yymsp[-9].minor.yy141, yymsp[-8].minor.yy220, yymsp[-4].minor.yy141, yymsp[-3].minor.yy141, &yymsp[-7].minor.yy340, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy141, &yymsp[0].minor.yy24, &yymsp[-1].minor.yy24); } - yymsp[-11].minor.yy114 = yylhsminor.yy114; + yymsp[-11].minor.yy234 = yylhsminor.yy234; break; case 145: /* union ::= select */ -{ yylhsminor.yy219 = setSubclause(NULL, yymsp[0].minor.yy114); } - yymsp[0].minor.yy219 = yylhsminor.yy219; +{ yylhsminor.yy63 = setSubclause(NULL, yymsp[0].minor.yy234); } + yymsp[0].minor.yy63 = yylhsminor.yy63; break; case 146: /* union ::= LP union RP */ -{ yymsp[-2].minor.yy219 = yymsp[-1].minor.yy219; } +{ yymsp[-2].minor.yy63 = yymsp[-1].minor.yy63; } break; case 147: /* union ::= union UNION ALL select */ -{ yylhsminor.yy219 = appendSelectClause(yymsp[-3].minor.yy219, yymsp[0].minor.yy114); } - yymsp[-3].minor.yy219 = yylhsminor.yy219; +{ yylhsminor.yy63 = appendSelectClause(yymsp[-3].minor.yy63, yymsp[0].minor.yy234); } + yymsp[-3].minor.yy63 = yylhsminor.yy63; break; case 148: /* union ::= union UNION ALL LP select RP */ -{ yylhsminor.yy219 = appendSelectClause(yymsp[-5].minor.yy219, yymsp[-1].minor.yy114); } - yymsp[-5].minor.yy219 = yylhsminor.yy219; +{ yylhsminor.yy63 = appendSelectClause(yymsp[-5].minor.yy63, yymsp[-1].minor.yy234); } + yymsp[-5].minor.yy63 = yylhsminor.yy63; break; case 149: /* cmd ::= union */ -{ setSqlInfo(pInfo, yymsp[0].minor.yy219, NULL, TSDB_SQL_SELECT); } +{ setSqlInfo(pInfo, yymsp[0].minor.yy63, NULL, TSDB_SQL_SELECT); } break; case 150: /* select ::= SELECT selcollist */ { - yylhsminor.yy114 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy522, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy234 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy114 = yylhsminor.yy114; + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 151: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy522 = yymsp[-1].minor.yy522;} - yymsp[-1].minor.yy522 = yylhsminor.yy522; +{yylhsminor.yy9 = yymsp[-1].minor.yy9;} + yymsp[-1].minor.yy9 = yylhsminor.yy9; break; case 152: /* sclp ::= */ -{yymsp[1].minor.yy522 = 0;} +{yymsp[1].minor.yy9 = 0;} break; case 153: /* selcollist ::= sclp distinct expr as */ { - yylhsminor.yy522 = tSqlExprListAppend(yymsp[-3].minor.yy522, yymsp[-1].minor.yy326, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy9 = tSqlExprListAppend(yymsp[-3].minor.yy9, yymsp[-1].minor.yy220, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-3].minor.yy522 = yylhsminor.yy522; + yymsp[-3].minor.yy9 = yylhsminor.yy9; break; case 154: /* selcollist ::= sclp STAR */ { tSQLExpr *pNode = tSqlExprIdValueCreate(NULL, TK_ALL); - yylhsminor.yy522 = tSqlExprListAppend(yymsp[-1].minor.yy522, pNode, 0, 0); + yylhsminor.yy9 = tSqlExprListAppend(yymsp[-1].minor.yy9, pNode, 0, 0); } - yymsp[-1].minor.yy522 = yylhsminor.yy522; + yymsp[-1].minor.yy9 = yylhsminor.yy9; break; case 155: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } @@ -2610,61 +2555,61 @@ static void yy_reduce( yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 160: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy247 = yymsp[0].minor.yy247;} +{yymsp[-1].minor.yy141 = yymsp[0].minor.yy141;} break; case 161: /* tablelist ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy247 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy247 = tVariantListAppendToken(yylhsminor.yy247, &yymsp[-1].minor.yy0, -1); // table alias name + yylhsminor.yy141 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy141 = tVariantListAppendToken(yylhsminor.yy141, &yymsp[-1].minor.yy0, -1); // table alias name } - yymsp[-1].minor.yy247 = yylhsminor.yy247; + yymsp[-1].minor.yy141 = yylhsminor.yy141; break; case 162: /* tablelist ::= ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy247 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy247 = tVariantListAppendToken(yylhsminor.yy247, &yymsp[0].minor.yy0, -1); + yylhsminor.yy141 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy141 = tVariantListAppendToken(yylhsminor.yy141, &yymsp[0].minor.yy0, -1); } - yymsp[-2].minor.yy247 = yylhsminor.yy247; + yymsp[-2].minor.yy141 = yylhsminor.yy141; break; case 163: /* tablelist ::= tablelist COMMA ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy247 = tVariantListAppendToken(yymsp[-3].minor.yy247, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy247 = tVariantListAppendToken(yylhsminor.yy247, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy141 = tVariantListAppendToken(yymsp[-3].minor.yy141, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy141 = tVariantListAppendToken(yylhsminor.yy141, &yymsp[-1].minor.yy0, -1); } - yymsp[-3].minor.yy247 = yylhsminor.yy247; + yymsp[-3].minor.yy141 = yylhsminor.yy141; break; case 164: /* tablelist ::= tablelist COMMA ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy247 = tVariantListAppendToken(yymsp[-4].minor.yy247, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy247 = tVariantListAppendToken(yylhsminor.yy247, &yymsp[0].minor.yy0, -1); + yylhsminor.yy141 = tVariantListAppendToken(yymsp[-4].minor.yy141, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy141 = tVariantListAppendToken(yylhsminor.yy141, &yymsp[0].minor.yy0, -1); } - yymsp[-4].minor.yy247 = yylhsminor.yy247; + yymsp[-4].minor.yy141 = yylhsminor.yy141; break; case 165: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 166: /* interval_opt ::= INTERVAL LP tmvar RP */ -{yymsp[-3].minor.yy430.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy430.offset.n = 0; yymsp[-3].minor.yy430.offset.z = NULL; yymsp[-3].minor.yy430.offset.type = 0;} +{yymsp[-3].minor.yy340.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy340.offset.n = 0; yymsp[-3].minor.yy340.offset.z = NULL; yymsp[-3].minor.yy340.offset.type = 0;} break; case 167: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ -{yymsp[-5].minor.yy430.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy430.offset = yymsp[-1].minor.yy0;} +{yymsp[-5].minor.yy340.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy340.offset = yymsp[-1].minor.yy0;} break; case 168: /* interval_opt ::= */ -{memset(&yymsp[1].minor.yy430, 0, sizeof(yymsp[1].minor.yy430));} +{memset(&yymsp[1].minor.yy340, 0, sizeof(yymsp[1].minor.yy340));} break; case 169: /* fill_opt ::= */ -{yymsp[1].minor.yy247 = 0; } +{yymsp[1].minor.yy141 = 0; } break; case 170: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { @@ -2672,14 +2617,14 @@ static void yy_reduce( toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy247, &A, -1, 0); - yymsp[-5].minor.yy247 = yymsp[-1].minor.yy247; + tVariantListInsert(yymsp[-1].minor.yy141, &A, -1, 0); + yymsp[-5].minor.yy141 = yymsp[-1].minor.yy141; } break; case 171: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy247 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy141 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; case 172: /* sliding_opt ::= SLIDING LP tmvar RP */ @@ -2689,225 +2634,225 @@ static void yy_reduce( {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; case 174: /* orderby_opt ::= */ -{yymsp[1].minor.yy247 = 0;} +{yymsp[1].minor.yy141 = 0;} break; case 175: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy247 = yymsp[0].minor.yy247;} +{yymsp[-2].minor.yy141 = yymsp[0].minor.yy141;} break; case 176: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy247 = tVariantListAppend(yymsp[-3].minor.yy247, &yymsp[-1].minor.yy378, yymsp[0].minor.yy222); + yylhsminor.yy141 = tVariantListAppend(yymsp[-3].minor.yy141, &yymsp[-1].minor.yy326, yymsp[0].minor.yy502); } - yymsp[-3].minor.yy247 = yylhsminor.yy247; + yymsp[-3].minor.yy141 = yylhsminor.yy141; break; case 177: /* sortlist ::= item sortorder */ { - yylhsminor.yy247 = tVariantListAppend(NULL, &yymsp[-1].minor.yy378, yymsp[0].minor.yy222); + yylhsminor.yy141 = tVariantListAppend(NULL, &yymsp[-1].minor.yy326, yymsp[0].minor.yy502); } - yymsp[-1].minor.yy247 = yylhsminor.yy247; + yymsp[-1].minor.yy141 = yylhsminor.yy141; break; case 178: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy378, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy326, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy378 = yylhsminor.yy378; + yymsp[-1].minor.yy326 = yylhsminor.yy326; break; case 179: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy222 = TSDB_ORDER_ASC; } +{ yymsp[0].minor.yy502 = TSDB_ORDER_ASC; } break; case 180: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy222 = TSDB_ORDER_DESC;} +{ yymsp[0].minor.yy502 = TSDB_ORDER_DESC;} break; case 181: /* sortorder ::= */ -{ yymsp[1].minor.yy222 = TSDB_ORDER_ASC; } +{ yymsp[1].minor.yy502 = TSDB_ORDER_ASC; } break; case 182: /* groupby_opt ::= */ -{ yymsp[1].minor.yy247 = 0;} +{ yymsp[1].minor.yy141 = 0;} break; case 183: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy247 = yymsp[0].minor.yy247;} +{ yymsp[-2].minor.yy141 = yymsp[0].minor.yy141;} break; case 184: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy247 = tVariantListAppend(yymsp[-2].minor.yy247, &yymsp[0].minor.yy378, -1); + yylhsminor.yy141 = tVariantListAppend(yymsp[-2].minor.yy141, &yymsp[0].minor.yy326, -1); } - yymsp[-2].minor.yy247 = yylhsminor.yy247; + yymsp[-2].minor.yy141 = yylhsminor.yy141; break; case 185: /* grouplist ::= item */ { - yylhsminor.yy247 = tVariantListAppend(NULL, &yymsp[0].minor.yy378, -1); + yylhsminor.yy141 = tVariantListAppend(NULL, &yymsp[0].minor.yy326, -1); } - yymsp[0].minor.yy247 = yylhsminor.yy247; + yymsp[0].minor.yy141 = yylhsminor.yy141; break; case 186: /* having_opt ::= */ case 196: /* where_opt ::= */ yytestcase(yyruleno==196); case 234: /* expritem ::= */ yytestcase(yyruleno==234); -{yymsp[1].minor.yy326 = 0;} +{yymsp[1].minor.yy220 = 0;} break; case 187: /* having_opt ::= HAVING expr */ case 197: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==197); -{yymsp[-1].minor.yy326 = yymsp[0].minor.yy326;} +{yymsp[-1].minor.yy220 = yymsp[0].minor.yy220;} break; case 188: /* limit_opt ::= */ case 192: /* slimit_opt ::= */ yytestcase(yyruleno==192); -{yymsp[1].minor.yy204.limit = -1; yymsp[1].minor.yy204.offset = 0;} +{yymsp[1].minor.yy24.limit = -1; yymsp[1].minor.yy24.offset = 0;} break; case 189: /* limit_opt ::= LIMIT signed */ case 193: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==193); -{yymsp[-1].minor.yy204.limit = yymsp[0].minor.yy403; yymsp[-1].minor.yy204.offset = 0;} +{yymsp[-1].minor.yy24.limit = yymsp[0].minor.yy429; yymsp[-1].minor.yy24.offset = 0;} break; case 190: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy204.limit = yymsp[-2].minor.yy403; yymsp[-3].minor.yy204.offset = yymsp[0].minor.yy403;} +{ yymsp[-3].minor.yy24.limit = yymsp[-2].minor.yy429; yymsp[-3].minor.yy24.offset = yymsp[0].minor.yy429;} break; case 191: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy204.limit = yymsp[0].minor.yy403; yymsp[-3].minor.yy204.offset = yymsp[-2].minor.yy403;} +{ yymsp[-3].minor.yy24.limit = yymsp[0].minor.yy429; yymsp[-3].minor.yy24.offset = yymsp[-2].minor.yy429;} break; case 194: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy204.limit = yymsp[-2].minor.yy403; yymsp[-3].minor.yy204.offset = yymsp[0].minor.yy403;} +{yymsp[-3].minor.yy24.limit = yymsp[-2].minor.yy429; yymsp[-3].minor.yy24.offset = yymsp[0].minor.yy429;} break; case 195: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy204.limit = yymsp[0].minor.yy403; yymsp[-3].minor.yy204.offset = yymsp[-2].minor.yy403;} +{yymsp[-3].minor.yy24.limit = yymsp[0].minor.yy429; yymsp[-3].minor.yy24.offset = yymsp[-2].minor.yy429;} break; case 198: /* expr ::= LP expr RP */ -{yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy326->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = yymsp[-1].minor.yy220; yylhsminor.yy220->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy220->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 199: /* expr ::= ID */ -{ yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 200: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 201: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 202: /* expr ::= INTEGER */ -{ yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 203: /* expr ::= MINUS INTEGER */ case 204: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==204); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy326 = yylhsminor.yy326; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy220 = yylhsminor.yy220; break; case 205: /* expr ::= FLOAT */ -{ yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 206: /* expr ::= MINUS FLOAT */ case 207: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==207); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy326 = yylhsminor.yy326; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy220 = yylhsminor.yy220; break; case 208: /* expr ::= STRING */ -{ yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 209: /* expr ::= NOW */ -{ yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 210: /* expr ::= VARIABLE */ -{ yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 211: /* expr ::= BOOL */ -{ yylhsminor.yy326 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 212: /* expr ::= ID LP exprlist RP */ -{ yylhsminor.yy326 = tSqlExprCreateFunction(yymsp[-1].minor.yy522, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprCreateFunction(yymsp[-1].minor.yy9, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy220 = yylhsminor.yy220; break; case 213: /* expr ::= ID LP STAR RP */ -{ yylhsminor.yy326 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy326 = yylhsminor.yy326; +{ yylhsminor.yy220 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy220 = yylhsminor.yy220; break; case 214: /* expr ::= expr IS NULL */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, NULL, TK_ISNULL);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, NULL, TK_ISNULL);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 215: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-3].minor.yy326, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-3].minor.yy220, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy220 = yylhsminor.yy220; break; case 216: /* expr ::= expr LT expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_LT);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_LT);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 217: /* expr ::= expr GT expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_GT);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_GT);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 218: /* expr ::= expr LE expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_LE);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_LE);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 219: /* expr ::= expr GE expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_GE);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_GE);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 220: /* expr ::= expr NE expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_NE);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_NE);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 221: /* expr ::= expr EQ expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_EQ);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_EQ);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 222: /* expr ::= expr AND expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_AND);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_AND);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 223: /* expr ::= expr OR expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_OR); } - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_OR); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 224: /* expr ::= expr PLUS expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_PLUS); } - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_PLUS); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 225: /* expr ::= expr MINUS expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_MINUS); } - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_MINUS); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 226: /* expr ::= expr STAR expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_STAR); } - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_STAR); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 227: /* expr ::= expr SLASH expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_DIVIDE);} - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_DIVIDE);} + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 228: /* expr ::= expr REM expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_REM); } - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_REM); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 229: /* expr ::= expr LIKE expr */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-2].minor.yy326, yymsp[0].minor.yy326, TK_LIKE); } - yymsp[-2].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-2].minor.yy220, yymsp[0].minor.yy220, TK_LIKE); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 230: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy326 = tSqlExprCreate(yymsp[-4].minor.yy326, (tSQLExpr*)yymsp[-1].minor.yy522, TK_IN); } - yymsp[-4].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = tSqlExprCreate(yymsp[-4].minor.yy220, (tSQLExpr*)yymsp[-1].minor.yy9, TK_IN); } + yymsp[-4].minor.yy220 = yylhsminor.yy220; break; case 231: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy522 = tSqlExprListAppend(yymsp[-2].minor.yy522,yymsp[0].minor.yy326,0, 0);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; +{yylhsminor.yy9 = tSqlExprListAppend(yymsp[-2].minor.yy9,yymsp[0].minor.yy220,0, 0);} + yymsp[-2].minor.yy9 = yylhsminor.yy9; break; case 232: /* exprlist ::= expritem */ -{yylhsminor.yy522 = tSqlExprListAppend(0,yymsp[0].minor.yy326,0, 0);} - yymsp[0].minor.yy522 = yylhsminor.yy522; +{yylhsminor.yy9 = tSqlExprListAppend(0,yymsp[0].minor.yy220,0, 0);} + yymsp[0].minor.yy9 = yylhsminor.yy9; break; case 233: /* expritem ::= expr */ -{yylhsminor.yy326 = yymsp[0].minor.yy326;} - yymsp[0].minor.yy326 = yylhsminor.yy326; +{yylhsminor.yy220 = yymsp[0].minor.yy220;} + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 235: /* cmd ::= RESET QUERY CACHE */ { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} @@ -2915,7 +2860,7 @@ static void yy_reduce( case 236: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy247, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy141, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -2933,7 +2878,7 @@ static void yy_reduce( case 238: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy247, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy141, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -2968,7 +2913,7 @@ static void yy_reduce( toTSDBType(yymsp[-2].minor.yy0.type); SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy378, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy326, -1); SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -2977,7 +2922,7 @@ static void yy_reduce( case 242: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy247, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy141, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -2995,7 +2940,7 @@ static void yy_reduce( case 244: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy247, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy141, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 38129fac38f1a0587a8511e2bdcae77e31ff24df..498122f0fe08cfe20bd4a91dafe220163b9b4334 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -353,7 +353,9 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pC } tsdbMayTakeMemSnapshot(pQueryHandle); - assert(pCond != NULL && pCond->numOfCols > 0 && pMemRef != NULL); + + // In case of data block info retrieval, the pCond->numOfCols is 0. + assert(pCond != NULL && pCond->numOfCols >= 0 && pMemRef != NULL); if (ASCENDING_TRAVERSE(pCond->order)) { assert(pQueryHandle->window.skey <= pQueryHandle->window.ekey); @@ -384,7 +386,9 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(STsdbRepo* tsdb, STsdbQueryCond* pC pQueryHandle->statis[i].colId = colInfo.info.colId; } - pQueryHandle->defaultLoadColumn = getDefaultLoadColumns(pQueryHandle, true); + if (pCond->numOfCols > 0) { + pQueryHandle->defaultLoadColumn = getDefaultLoadColumns(pQueryHandle, true); + } STsdbMeta* pMeta = tsdbGetMeta(tsdb); assert(pMeta != NULL); @@ -2006,9 +2010,10 @@ static void moveToNextDataBlockInCurrentFile(STsdbQueryHandle* pQueryHandle) { cur->blockCompleted = false; } -int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, SArray* pBlockInfo) { +int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist* pTableBlockInfo) { STsdbQueryHandle* pQueryHandle = (STsdbQueryHandle*) queryHandle; + pTableBlockInfo->totalSize = 0; STsdbFS* pFileHandle = REPO_FS(pQueryHandle->pTsdb); // find the start data block in file @@ -2021,8 +2026,9 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, SArray* pBlockI tsdbFSIterSeek(&pQueryHandle->fileIter, fid); tsdbUnLockFS(pFileHandle); - int32_t code = TSDB_CODE_SUCCESS; + pTableBlockInfo->numOfFiles += 1; + int32_t code = TSDB_CODE_SUCCESS; int32_t numOfBlocks = 0; int32_t numOfTables = (int32_t)taosArrayGetSize(pQueryHandle->pTableCheckInfo); STimeWindow win = TSWINDOW_INITIALIZER; @@ -2048,6 +2054,7 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, SArray* pBlockI break; } + pTableBlockInfo->numOfFiles += 1; if (tsdbSetAndOpenReadFSet(&pQueryHandle->rhelper, pQueryHandle->pFileGroup) < 0) { tsdbUnLockFS(REPO_FS(pQueryHandle->pTsdb)); code = terrno; @@ -2072,16 +2079,15 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, SArray* pBlockI continue; } - SFileBlockInfo info = {0}; for (int32_t i = 0; i < numOfTables; ++i) { STableCheckInfo* pCheckInfo = taosArrayGet(pQueryHandle->pTableCheckInfo, i); SBlock* pBlock = pCheckInfo->pCompInfo->blocks; for (int32_t j = 0; j < pCheckInfo->numOfBlocks; ++j) { - info.numOfRows = pBlock[j].numOfRows; - info.len = pBlock[j].len; + pTableBlockInfo->totalSize += pBlock[j].len; - taosArrayPush(pBlockInfo, &info); + int32_t numOfRows = pBlock[j].numOfRows; + taosArrayPush(pTableBlockInfo->dataBlockInfos, &numOfRows); } } } diff --git a/src/util/inc/tarray.h b/src/util/inc/tarray.h index 63e62a54c2f679920100b7137cb49377da90789f..f2e268c2d4dfe210dfbfd9b94ee74a4f87848361 100644 --- a/src/util/inc/tarray.h +++ b/src/util/inc/tarray.h @@ -25,7 +25,8 @@ extern "C" { #define TARRAY_MIN_SIZE 8 #define TARRAY_GET_ELEM(array, index) ((void*)((char*)((array)->pData) + (index) * (array)->elemSize)) -#define TARRAY_ELEM_IDX(array, ele) (POINTER_DISTANCE(ele, (array)->pData) / (array)->elemSize) +#define TARRAY_ELEM_IDX(array, ele) (POINTER_DISTANCE(ele, (array)->pData) / (array)->elemSize) +#define TARRAY_GET_START(array) ((array)->pData) typedef struct SArray { size_t size; diff --git a/src/util/inc/tbuffer.h b/src/util/inc/tbuffer.h index e2bdb815d7ac8ecd09b62a3a62897b78ebf3c4b7..b19984b4be047108fd9848a2a7eddbac2c0b78a4 100644 --- a/src/util/inc/tbuffer.h +++ b/src/util/inc/tbuffer.h @@ -73,14 +73,14 @@ int main( int argc, char** argv ) { } */ -typedef struct { +typedef struct SBufferReader { bool endian; const char* data; size_t pos; size_t size; } SBufferReader; -typedef struct { +typedef struct SBufferWriter { bool endian; char* data; size_t pos;