diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 2a78de0ba49cacd75c0b3e73d9ac2560f9aab31f..9072b6f3491b50f3e236468f93d0e53f74d39042 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -96,6 +96,25 @@ typedef struct STableMetaInfo { SArray *tagColList; // SArray, involved tag columns } STableMetaInfo; + +typedef struct SColumnIndex { + int16_t tableIndex; + int16_t columnIndex; +} SColumnIndex; + + +typedef struct SFieldInfo { + int16_t numOfOutput; // number of column in result + TAOS_FIELD* final; + SArray *internalField; // SArray +} SFieldInfo; + +typedef struct SColumn { + SColumnIndex colIndex; + int32_t numOfFilters; + SColumnFilterInfo *filterInfo; +} SColumn; + /* the structure for sql function in select clause */ typedef struct SSqlExpr { char aliasName[TSDB_COL_NAME_LEN]; // as aliasName @@ -109,18 +128,22 @@ typedef struct SSqlExpr { tVariant param[3]; // parameters are not more than 3 int32_t offset; // sub result column value of arithmetic expression. int16_t resColId; // result column id + SColumn *pFilter; // expr filter } SSqlExpr; -typedef struct SColumnIndex { - int16_t tableIndex; - int16_t columnIndex; -} SColumnIndex; +typedef struct SExprFilter { + tSqlExpr *pExpr; //used for having parse + SSqlExpr *pSqlExpr; + SArray *fp; + SColumn *pFilters; //having filter info +}SExprFilter; typedef struct SInternalField { TAOS_FIELD field; bool visible; SExprInfo *pArithExprInfo; SSqlExpr *pSqlExpr; + SExprFilter *pFieldFilters; } SInternalField; typedef struct SFieldInfo { @@ -242,6 +265,7 @@ typedef struct SQueryInfo { int32_t round; // 0/1/.... int32_t bufLen; char* buf; + int32_t havingFieldNum; } SQueryInfo; typedef struct { @@ -260,10 +284,10 @@ typedef struct { char * curSql; // current sql, resume position of sql after parsing paused int8_t parseFinished; - char reserve2[3]; // fix bus error on arm32 + char reserve2[3]; // fix bus error on arm32 int16_t numOfCols; - char reserve3[2]; // fix bus error on arm32 + char reserve3[2]; // fix bus error on arm32 uint32_t allocSize; char * payload; int32_t payloadLen; @@ -273,9 +297,9 @@ typedef struct { int32_t numOfParams; int8_t dataSourceType; // load data from file or not - char reserve4[3]; // fix bus error on arm32 + char reserve4[3]; // fix bus error on arm32 int8_t submitSchema; // submit block is built with table schema - char reserve5[3]; // fix bus error on arm32 + char reserve5[3]; // fix bus error on arm32 STagData tagData; // NOTE: pTagData->data is used as a variant length array SName **pTableNameList; // all involved tableMeta list of current insert sql statement. diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c index 851f7398db23d04c48c0846a307c715432b73b99..c296072393eec68f7e753fe4a556c745743d2c50 100644 --- a/src/client/src/tscLocalMerge.c +++ b/src/client/src/tscLocalMerge.c @@ -22,6 +22,7 @@ #include "tscUtil.h" #include "tschemautil.h" #include "tsclient.h" +#include "qUtil.h" typedef struct SCompareParam { SLocalDataSource **pLocalData; @@ -1243,6 +1244,76 @@ static bool saveGroupResultInfo(SSqlObj *pSql) { return false; } + +bool doFilterFieldData(char *input, SExprFilter* pFieldFilters, int16_t type, bool* notSkipped) { + bool qualified = false; + + for(int32_t k = 0; k < pFieldFilters->pFilters->numOfFilters; ++k) { + __filter_func_t fp = taosArrayGetP(pFieldFilters->fp, k); + SColumnFilterElem filterElem = {.filterInfo = pFieldFilters->pFilters->filterInfo[k]}; + + bool isnull = isNull(input, type); + if (isnull) { + if (fp == isNullOperator) { + qualified = true; + break; + } else { + continue; + } + } else { + if (fp == notNullOperator) { + qualified = true; + break; + } else if (fp == isNullOperator) { + continue; + } + } + + if (fp(&filterElem, input, input, type)) { + qualified = true; + break; + } + } + + *notSkipped = qualified; + + return TSDB_CODE_SUCCESS; +} + + +int32_t doHavingFilter(SQueryInfo* pQueryInfo, tFilePage* pOutput, bool* notSkipped) { + *notSkipped = true; + + if (pQueryInfo->havingFieldNum <= 0) { + return TSDB_CODE_SUCCESS; + } + + //int32_t exprNum = (int32_t) tscSqlExprNumOfExprs(pQueryInfo); + + size_t numOfOutput = tscNumOfFields(pQueryInfo); + for(int32_t i = 0; i < numOfOutput; ++i) { + SInternalField* pInterField = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, i); + SExprFilter* pFieldFilters = pInterField->pFieldFilters; + + if (pFieldFilters == NULL) { + continue; + } + + int32_t type = pInterField->field.type; + + char* pInput = pOutput->data + pOutput->num* pFieldFilters->pSqlExpr->offset; + + doFilterFieldData(pInput, pFieldFilters, type, notSkipped); + if (*notSkipped == false) { + return TSDB_CODE_SUCCESS; + } + } + + return TSDB_CODE_SUCCESS; +} + + + /** * * @param pSql @@ -1283,6 +1354,22 @@ bool genFinalResults(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool noMoreCurren doArithmeticCalculate(pQueryInfo, pResBuf, pModel->rowSize, pLocalMerge->finalModel->rowSize); } + bool notSkipped = true; + + doHavingFilter(pQueryInfo, pResBuf, ¬Skipped); + + if (!notSkipped) { + pRes->numOfRows = 0; + pLocalMerge->discard = !noMoreCurrentGroupRes; + + if (pLocalMerge->discard) { + SColumnModel *pInternModel = pLocalMerge->pDesc->pColumnModel; + tColModelAppend(pInternModel, pLocalMerge->discardData, pLocalMerge->pTempBuffer->data, 0, 1, 1); + } + + return notSkipped; + } + // no interval query, no fill operation if (pQueryInfo->interval.interval == 0 || pQueryInfo->fillType == TSDB_FILL_NONE) { genFinalResWithoutFill(pRes, pLocalMerge, pQueryInfo); diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e5a55cdfd3d82545e21abf262798146e06b7050b..e8f753f876ea27d9d3d4e312d7a2de2d84e2f066 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -34,6 +34,7 @@ #include "tstoken.h" #include "tstrbuild.h" #include "ttokendef.h" +#include "qUtil.h" #define DEFAULT_PRIMARY_TIMESTAMP_COL_NAME "_c0" @@ -1097,6 +1098,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) { return true; } + static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pCmd) { assert(pTagsList != NULL); @@ -1676,18 +1678,6 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectLis return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } - /* - * transfer sql functions that need secondary merge into another format - * in dealing with super table queries such as: count/first/last - */ - if (isSTable) { - tscTansformFuncForSTableQuery(pQueryInfo); - - if (hasUnsupportFunctionsForSTableQuery(pCmd, pQueryInfo)) { - return TSDB_CODE_TSC_INVALID_SQL; - } - } - return TSDB_CODE_SUCCESS; } @@ -3065,6 +3055,7 @@ int32_t parseGroupbyClause(SQueryInfo* pQueryInfo, SArray* pList, SSqlCmd* pCmd) return TSDB_CODE_SUCCESS; } + static SColumnFilterInfo* addColumnFilterInfo(SColumn* pColumn) { if (pColumn == NULL) { return NULL; @@ -3088,15 +3079,11 @@ static SColumnFilterInfo* addColumnFilterInfo(SColumn* pColumn) { } static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SColumnFilterInfo* pColumnFilter, - SColumnIndex* columnIndex, tSqlExpr* pExpr) { + int16_t colType, tSqlExpr* pExpr) { const char* msg = "not supported filter condition"; tSqlExpr* pRight = pExpr->pRight; - STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, columnIndex->tableIndex); - SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex->columnIndex); - - int16_t colType = pSchema->type; if (colType >= TSDB_DATA_TYPE_TINYINT && colType <= TSDB_DATA_TYPE_BIGINT) { colType = TSDB_DATA_TYPE_BIGINT; } else if (colType == TSDB_DATA_TYPE_FLOAT || colType == TSDB_DATA_TYPE_DOUBLE) { @@ -3301,7 +3288,10 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC } pColumn->colIndex = *pIndex; - return doExtractColumnFilterInfo(pCmd, pQueryInfo, pColFilter, pIndex, pExpr); + + int16_t colType = pSchema->type; + + return doExtractColumnFilterInfo(pCmd, pQueryInfo, pColFilter, colType, pExpr); } static int32_t getTablenameCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pTableCond, SStringBuilder* sb) { @@ -6030,7 +6020,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo if (TSDB_COL_IS_TAG(pColIndex->flag)) { SColumnIndex index = {.tableIndex = pQueryInfo->groupbyExpr.tableIndex, .columnIndex = colIndex}; - SSqlExpr* pExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TAG, &index, type, bytes, getNewResColId(pQueryInfo), bytes, true); + SSqlExpr* pExpr = tscSqlExprInsert(pQueryInfo, (int32_t)size - pQueryInfo->havingFieldNum, TSDB_FUNC_TAG, &index, type, bytes, getNewResColId(pQueryInfo), bytes, true); memset(pExpr->aliasName, 0, sizeof(pExpr->aliasName)); tstrncpy(pExpr->aliasName, name, sizeof(pExpr->aliasName)); @@ -6039,7 +6029,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo // NOTE: tag column does not add to source column list SColumnList ids = getColumnList(1, 0, pColIndex->colIndex); - insertResultField(pQueryInfo, (int32_t)size, &ids, bytes, (int8_t)type, name, pExpr); + insertResultField(pQueryInfo, (int32_t)size - pQueryInfo->havingFieldNum, &ids, bytes, (int8_t)type, name, pExpr); } else { // if this query is "group by" normal column, time window query is not allowed if (isTimeWindowQuery(pQueryInfo)) { @@ -6769,6 +6759,313 @@ static int32_t checkQueryRangeForFill(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { return TSDB_CODE_SUCCESS; } + + int32_t tscInsertExprFields(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr, SInternalField** interField) { + tSqlExprItem item = {.pNode = pExpr, .aliasName = NULL, .distinct = false}; + + int32_t outputIndex = (int32_t)tscSqlExprNumOfExprs(pQueryInfo); + + // ADD TRUE FOR TEST + if (addExprAndResultField(pCmd, pQueryInfo, outputIndex, &item, true) != TSDB_CODE_SUCCESS) { + return TSDB_CODE_TSC_INVALID_SQL; + } + + ++pQueryInfo->havingFieldNum; + + size_t n = tscSqlExprNumOfExprs(pQueryInfo); + SSqlExpr* pSqlExpr = tscSqlExprGet(pQueryInfo, (int32_t)n - 1); + + int32_t slot = tscNumOfFields(pQueryInfo) - 1; + SInternalField* pInfo = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, slot); + pInfo->visible = false; + + if (pInfo->pFieldFilters == NULL) { + SExprFilter* pFieldFilters = calloc(1, sizeof(SExprFilter)); + if (pFieldFilters == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + SColumn* pFilters = calloc(1, sizeof(SColumn)); + if (pFilters == NULL) { + tfree(pFieldFilters); + + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + pFieldFilters->pFilters = pFilters; + pFieldFilters->pSqlExpr = pSqlExpr; + pSqlExpr->pFilter = pFilters; + pInfo->pFieldFilters = pFieldFilters; + } + + pInfo->pFieldFilters->pExpr = pExpr; + + *interField = pInfo; + + return TSDB_CODE_SUCCESS; +} + +int32_t tscGetExprFilters(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr, SInternalField** pField) { + SInternalField* pInfo = NULL; + + for (int32_t i = pQueryInfo->havingFieldNum - 1; i >= 0; --i) { + pInfo = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, pQueryInfo->fieldsInfo.numOfOutput - 1 - i); + + if (pInfo->pFieldFilters && 0 == tSqlExprCompare(pInfo->pFieldFilters->pExpr, pExpr)) { + *pField = pInfo; + return TSDB_CODE_SUCCESS; + } + } + + int32_t ret = tscInsertExprFields(pCmd, pQueryInfo, pExpr, &pInfo); + if (ret) { + return ret; + } + + *pField = pInfo; + + return TSDB_CODE_SUCCESS; +} + +static int32_t genExprFilter(SExprFilter * exprFilter) { + exprFilter->fp = taosArrayInit(4, sizeof(__filter_func_t)); + if (exprFilter->fp == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + for (int32_t i = 0; i < exprFilter->pFilters->numOfFilters; ++i) { + SColumnFilterInfo *filterInfo = &exprFilter->pFilters->filterInfo[i]; + + int32_t lower = filterInfo->lowerRelOptr; + int32_t upper = filterInfo->upperRelOptr; + if (lower == TSDB_RELATION_INVALID && upper == TSDB_RELATION_INVALID) { + tscError("invalid rel optr"); + return TSDB_CODE_TSC_APP_ERROR; + } + + __filter_func_t ffp = getFilterOperator(lower, upper); + if (ffp == NULL) { + tscError("invalid filter info"); + return TSDB_CODE_TSC_APP_ERROR; + } + + taosArrayPush(exprFilter->fp, &ffp); + } + + return TSDB_CODE_SUCCESS; +} + +static int32_t handleExprInHavingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr, int32_t sqlOptr) { + const char* msg1 = "non binary column not support like operator"; + const char* msg2 = "invalid operator for binary column in having clause"; + const char* msg3 = "invalid operator for bool column in having clause"; + + SColumn* pColumn = NULL; + SColumnFilterInfo* pColFilter = NULL; + SInternalField* pInfo = NULL; + + /* + * in case of TK_AND filter condition, we first find the corresponding column and build the query condition together + * the already existed condition. + */ + if (sqlOptr == TK_AND) { + int32_t ret = tscGetExprFilters(pCmd, pQueryInfo, pExpr->pLeft, &pInfo); + if (ret) { + return ret; + } + + pColumn = pInfo->pFieldFilters->pFilters; + + // this is a new filter condition on this column + if (pColumn->numOfFilters == 0) { + pColFilter = addColumnFilterInfo(pColumn); + } else { // update the existed column filter information, find the filter info here + pColFilter = &pColumn->filterInfo[0]; + } + + if (pColFilter == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + } else if (sqlOptr == TK_OR) { + int32_t ret = tscGetExprFilters(pCmd, pQueryInfo, pExpr->pLeft, &pInfo); + if (ret) { + return ret; + } + + pColumn = pInfo->pFieldFilters->pFilters; + + // TODO fixme: failed to invalid the filter expression: "col1 = 1 OR col2 = 2" + pColFilter = addColumnFilterInfo(pColumn); + if (pColFilter == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + } else { // error; + return TSDB_CODE_TSC_INVALID_SQL; + } + + pColFilter->filterstr = + ((pInfo->field.type == TSDB_DATA_TYPE_BINARY || pInfo->field.type == TSDB_DATA_TYPE_NCHAR) ? 1 : 0); + + if (pColFilter->filterstr) { + if (pExpr->tokenId != TK_EQ + && pExpr->tokenId != TK_NE + && pExpr->tokenId != TK_ISNULL + && pExpr->tokenId != TK_NOTNULL + && pExpr->tokenId != TK_LIKE + ) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } + } else { + if (pExpr->tokenId == TK_LIKE) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pInfo->field.type == TSDB_DATA_TYPE_BOOL) { + if (pExpr->tokenId != TK_EQ && pExpr->tokenId != TK_NE) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); + } + } + } + + int32_t ret = doExtractColumnFilterInfo(pCmd, pQueryInfo, pColFilter, pInfo->field.type, pExpr); + if (ret) { + return ret; + } + + return genExprFilter(pInfo->pFieldFilters); +} + +int32_t getHavingExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pExpr, int32_t parentOptr) { + if (pExpr == NULL) { + return TSDB_CODE_SUCCESS; + } + + const char* msg1 = "invalid having clause"; + + tSqlExpr* pLeft = pExpr->pLeft; + tSqlExpr* pRight = pExpr->pRight; + + if (pExpr->tokenId == TK_AND || pExpr->tokenId == TK_OR) { + int32_t ret = getHavingExpr(pCmd, pQueryInfo, pExpr->pLeft, pExpr->tokenId); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + + return getHavingExpr(pCmd, pQueryInfo, pExpr->pRight, pExpr->tokenId); + } + + if (pLeft == NULL || pRight == NULL) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pLeft->type == pRight->type) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + exchangeExpr(pExpr); + + pLeft = pExpr->pLeft; + pRight = pExpr->pRight; + + + if (pLeft->type != SQL_NODE_SQLFUNCTION) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pRight->type != SQL_NODE_VALUE) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pExpr->tokenId >= TK_BITAND) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + //if (pLeft->pParam == NULL || pLeft->pParam->nExpr < 1) { + // return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + //} + + if (pLeft->pParam) { + size_t size = taosArrayGetSize(pLeft->pParam); + for (int32_t i = 0; i < size; i++) { + tSqlExprItem* pParamElem = taosArrayGet(pLeft->pParam, i); + if (pParamElem->pNode->tokenId != TK_ALL && + pParamElem->pNode->tokenId != TK_ID && + pParamElem->pNode->tokenId != TK_STRING && + pParamElem->pNode->tokenId != TK_INTEGER && + pParamElem->pNode->tokenId != TK_FLOAT) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pParamElem->pNode->tokenId == TK_ID && (pParamElem->pNode->colInfo.z == NULL && pParamElem->pNode->colInfo.n == 0)) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pParamElem->pNode->tokenId == TK_ID) { + SColumnIndex index = COLUMN_INDEX_INITIALIZER; + if ((getColumnIndexByName(pCmd, &pParamElem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS)) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex); + STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; + + if (index.columnIndex <= 0 || + index.columnIndex >= tscGetNumOfColumns(pTableMeta)) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + } + } + } + + pLeft->functionId = isValidFunction(pLeft->operand.z, pLeft->operand.n); + if (pLeft->functionId < 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + return handleExprInHavingClause(pCmd, pQueryInfo, pExpr, parentOptr); +} + + + +int32_t parseHavingClause(SQueryInfo* pQueryInfo, tSqlExpr* pExpr, SSqlCmd* pCmd, bool isSTable, int32_t joinQuery, int32_t timeWindowQuery) { + const char* msg1 = "having only works with group by"; + const char* msg2 = "functions or others can not be mixed up"; + const char* msg3 = "invalid expression in having clause"; + + if (pExpr == NULL) { + return TSDB_CODE_SUCCESS; + } + + if (pQueryInfo->groupbyExpr.numOfGroupCols <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pExpr->pLeft == NULL || pExpr->pRight == NULL) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); + } + + if (pQueryInfo->colList == NULL) { + pQueryInfo->colList = taosArrayInit(4, POINTER_BYTES); + } + + int32_t ret = 0; + + if ((ret = getHavingExpr(pCmd, pQueryInfo, pExpr, TK_AND)) != TSDB_CODE_SUCCESS) { + return ret; + } + + //REDO function check + if (!functionCompatibleCheck(pQueryInfo, joinQuery, timeWindowQuery)) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } + + return TSDB_CODE_SUCCESS; +} + + + + + int32_t doValidateSqlNode(SSqlObj* pSql, SQuerySqlNode* pQuerySqlNode, int32_t index) { assert(pQuerySqlNode != NULL && (pQuerySqlNode->from == NULL || taosArrayGetSize(pQuerySqlNode->from->tableList) > 0)); @@ -6934,6 +7231,23 @@ int32_t doValidateSqlNode(SSqlObj* pSql, SQuerySqlNode* pQuerySqlNode, int32_t i } } + // parse the having clause in the first place + if (parseHavingClause(pQueryInfo, pQuerySqlNode->pHaving, pCmd, isSTable, joinQuery, timeWindowQuery) != TSDB_CODE_SUCCESS) { + return TSDB_CODE_TSC_INVALID_SQL; + } + + /* + * transfer sql functions that need secondary merge into another format + * in dealing with super table queries such as: count/first/last + */ + if (isSTable) { + tscTansformFuncForSTableQuery(pQueryInfo); + + if (hasUnsupportFunctionsForSTableQuery(pCmd, pQueryInfo)) { + return TSDB_CODE_TSC_INVALID_SQL; + } + } + if (parseSessionClause(pCmd, pQueryInfo, pQuerySqlNode) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -7125,3 +7439,10 @@ bool hasNormalColumnFilter(SQueryInfo* pQueryInfo) { return false; } + + + + + + + diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 7085318e350a4236c83960368bd1cb813a7df4df..f1c1d2da719d63973953382734489aeca1e58258 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -520,7 +520,7 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) { assert(pVgroupInfo->vgroups[vgIndex].vgId > 0 && vgIndex < pTableMetaInfo->vgroupList->numOfVgroups); pRetrieveMsg->header.vgId = htonl(pVgroupInfo->vgroups[vgIndex].vgId); - tscDebug("%p build fetch msg from vgId:%d, vgIndex:%d, qhandle:%" PRIX64, pSql, pVgroupInfo->vgroups[vgIndex].vgId, vgIndex, pSql->res.qId); + tscDebug("%p build fetch msg from vgId:%d, vgIndex:%d, qId:%" PRIu64, pSql, pVgroupInfo->vgroups[vgIndex].vgId, vgIndex, pSql->res.qId); } else { int32_t numOfVgroups = (int32_t)taosArrayGetSize(pTableMetaInfo->pVgroupTables); assert(vgIndex >= 0 && vgIndex < numOfVgroups); @@ -862,8 +862,44 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pSqlFuncExpr->functionId = htons(pExpr->functionId); pSqlFuncExpr->numOfParams = htons(pExpr->numOfParams); pSqlFuncExpr->resColId = htons(pExpr->resColId); + if (pTableMeta->tableType != TSDB_SUPER_TABLE && pExpr->pFilter && pExpr->pFilter->numOfFilters > 0) { + pSqlFuncExpr->filterNum = htonl(pExpr->pFilter->numOfFilters); + } else { + pSqlFuncExpr->filterNum = 0; + } + pMsg += sizeof(SSqlFuncMsg); + if (pSqlFuncExpr->filterNum) { + pMsg += sizeof(SColumnFilterInfo) * pExpr->pFilter->numOfFilters; + + // append the filter information after the basic column information + for (int32_t f = 0; f < pExpr->pFilter->numOfFilters; ++f) { + SColumnFilterInfo *pColFilter = &pExpr->pFilter->filterInfo[f]; + + SColumnFilterInfo *pFilterMsg = &pSqlFuncExpr->filterInfo[f]; + pFilterMsg->filterstr = htons(pColFilter->filterstr); + + if (pColFilter->filterstr) { + pFilterMsg->len = htobe64(pColFilter->len); + memcpy(pMsg, (void *)pColFilter->pz, (size_t)(pColFilter->len + 1)); + pMsg += (pColFilter->len + 1); // append the additional filter binary info + } else { + pFilterMsg->lowerBndi = htobe64(pColFilter->lowerBndi); + pFilterMsg->upperBndi = htobe64(pColFilter->upperBndi); + } + + pFilterMsg->lowerRelOptr = htons(pColFilter->lowerRelOptr); + pFilterMsg->upperRelOptr = htons(pColFilter->upperRelOptr); + + if (pColFilter->lowerRelOptr == TSDB_RELATION_INVALID && pColFilter->upperRelOptr == TSDB_RELATION_INVALID) { + tscError("invalid filter info"); + return TSDB_CODE_TSC_INVALID_SQL; + } + } + } + + for (int32_t j = 0; j < pExpr->numOfParams; ++j) { // todo add log pSqlFuncExpr->arg[j].argType = htons((uint16_t)pExpr->param[j].nType); pSqlFuncExpr->arg[j].argBytes = htons(pExpr->param[j].nLen); diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 299cf038057bf5ce80c449be41faa484e0a8ef93..484610818e37eaea672d305dec28e0165bf5673c 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -2986,7 +2986,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) { } tscDebug("%p sub:%p query complete, ep:%s, vgId:%d, orderOfSub:%d, retrieve data", trsupport->pParentSql, pSql, - pVgroup->epAddr[0].fqdn, pVgroup->vgId, trsupport->subqueryIndex); + pVgroup->epAddr[pSql->epSet.inUse].fqdn, pVgroup->vgId, trsupport->subqueryIndex); if (pSql->res.qId == 0) { // qhandle is NULL, code is TSDB_CODE_SUCCESS means no results generated from this vnode tscRetrieveFromDnodeCallBack(param, pSql, 0); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 7d6d74b4258341afceb2ebfb1363418d04106d1b..4e8bfdf06481d5026bc935e3e1445a419694b3cd 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1047,6 +1047,7 @@ SInternalField* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField) { .pSqlExpr = NULL, .pArithExprInfo = NULL, .visible = true, + .pFieldFilters = NULL, }; info.field = *pField; @@ -1059,6 +1060,7 @@ SInternalField* tscFieldInfoInsert(SFieldInfo* pFieldInfo, int32_t index, TAOS_F .pSqlExpr = NULL, .pArithExprInfo = NULL, .visible = true, + .pFieldFilters = NULL, }; info.field = *field; @@ -1132,6 +1134,22 @@ int32_t tscGetResRowLength(SArray* pExprList) { return size; } +static void destroyFilterInfo(SColumnFilterInfo* pFilterInfo, int32_t numOfFilters) { + for(int32_t i = 0; i < numOfFilters; ++i) { + if (pFilterInfo[i].filterstr) { + tfree(pFilterInfo[i].pz); + } + } + + tfree(pFilterInfo); +} + +static void tscColumnDestroy(SColumn* pCol) { + destroyFilterInfo(pCol->filterInfo, pCol->numOfFilters); + free(pCol); +} + + void tscFieldInfoClear(SFieldInfo* pFieldInfo) { if (pFieldInfo == NULL) { return; @@ -1152,6 +1170,11 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) { tfree(pInfo->pArithExprInfo); } + + if (pInfo->pFieldFilters != NULL) { + tscColumnDestroy(pInfo->pFieldFilters->pFilters); + tfree(pInfo->pFieldFilters); + } } taosArrayDestroy(pFieldInfo->internalField); @@ -1412,15 +1435,7 @@ SColumn* tscColumnListInsert(SArray* pColumnList, SColumnIndex* pColIndex) { return taosArrayGetP(pColumnList, i); } -static void destroyFilterInfo(SColumnFilterInfo* pFilterInfo, int32_t numOfFilters) { - for(int32_t i = 0; i < numOfFilters; ++i) { - if (pFilterInfo[i].filterstr) { - tfree(pFilterInfo[i].pz); - } - } - - tfree(pFilterInfo); -} + SColumn* tscColumnClone(const SColumn* src) { assert(src != NULL); @@ -1437,10 +1452,6 @@ SColumn* tscColumnClone(const SColumn* src) { return dst; } -static void tscColumnDestroy(SColumn* pCol) { - destroyFilterInfo(pCol->filterInfo, pCol->numOfFilters); - free(pCol); -} void tscColumnListCopy(SArray* dst, const SArray* src, int16_t tableIndex) { assert(src != NULL && dst != NULL); diff --git a/src/inc/query.h b/src/inc/query.h index d4ff811a8d594485aba01f1b52069f39278c2ec0..38078cf21fcededd96dad833bbf1d22de55bb8ac 100644 --- a/src/inc/query.h +++ b/src/inc/query.h @@ -88,7 +88,7 @@ void* qOpenQueryMgmt(int32_t vgId); void qQueryMgmtNotifyClosed(void* pExecutor); void qQueryMgmtReOpen(void *pExecutor); void qCleanupQueryMgmt(void* pExecutor); -void** qRegisterQInfo(void* pMgmt, uint64_t qId, uint64_t qInfo); +void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo); void** qAcquireQInfo(void* pMgmt, uint64_t key); void** qReleaseQInfo(void* pMgmt, void* pQInfo, bool freeHandle); bool checkQIdEqual(void *qHandle, uint64_t qId); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 99f4e1518f1e1536daa30a4b0c8b161acadf5bc3..d7ac7dd277c0487b97096821753c904da137e534 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -399,6 +399,28 @@ typedef struct SColIndex { char name[TSDB_COL_NAME_LEN]; // TODO remove it } SColIndex; + +typedef struct SColumnFilterInfo { + int16_t lowerRelOptr; + int16_t upperRelOptr; + int16_t filterstr; // denote if current column is char(binary/nchar) + + union { + struct { + int64_t lowerBndi; + int64_t upperBndi; + }; + struct { + double lowerBndd; + double upperBndd; + }; + struct { + int64_t pz; + int64_t len; + }; + }; +} SColumnFilterInfo; + /* sql function msg, to describe the message to vnode about sql function * operations in select clause */ typedef struct SSqlFuncMsg { @@ -419,38 +441,22 @@ typedef struct SSqlFuncMsg { char * pz; } argValue; } arg[3]; + + int32_t filterNum; + SColumnFilterInfo filterInfo[]; } SSqlFuncMsg; + typedef struct SExprInfo { - SSqlFuncMsg base; + SColumnFilterInfo * pFilter; struct tExprNode* pExpr; int16_t bytes; int16_t type; int32_t interBytes; int64_t uid; + SSqlFuncMsg base; } SExprInfo; -typedef struct SColumnFilterInfo { - int16_t lowerRelOptr; - int16_t upperRelOptr; - int16_t filterstr; // denote if current column is char(binary/nchar) - - union { - struct { - int64_t lowerBndi; - int64_t upperBndi; - }; - struct { - double lowerBndd; - double upperBndd; - }; - struct { - int64_t pz; - int64_t len; - }; - }; -} SColumnFilterInfo; - /* * for client side struct, we only need the column id, type, bytes are not necessary * But for data in vnode side, we need all the following information. diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index e9f95660f7d6defb6a8dd63b7431bd0ab913b4ab..5f47d9896fa50042ac6b090f4ba53103bb620648 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -205,6 +205,11 @@ #define TK_VALUES 186 + + + + + #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index c62e78a3a9f4d4d6cc734b1005928d919fcd19b1..31ac70d6cdcacfe4271fd69e94369ca71237799b 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -190,6 +190,8 @@ typedef struct SQuery { bool stabledev; // super table stddev query int32_t interBufSize; // intermediate buffer sizse + int32_t havingNum; // having expr number + SOrderVal order; int16_t numOfCols; int16_t numOfTags; @@ -285,6 +287,7 @@ enum OPERATOR_TYPE_E { OP_Fill = 13, OP_MultiTableAggregate = 14, OP_MultiTableTimeInterval = 15, + OP_Having = 16, }; typedef struct SOperatorInfo { @@ -402,6 +405,11 @@ typedef struct SOffsetOperatorInfo { int64_t offset; } SOffsetOperatorInfo; +typedef struct SHavingOperatorInfo { + SArray* fp; +} SHavingOperatorInfo; + + typedef struct SFillOperatorInfo { SFillInfo *pFillInfo; SSDataBlock *pRes; diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index 3ce81787f05b7336d25df39fbd5cad75685e1527..c5ee172c40843674a8b167699edb9e30d15275a8 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -98,6 +98,7 @@ typedef struct SQuerySqlNode { SLimitVal limit; // limit offset [optional] SLimitVal slimit; // group limit offset [optional] SStrToken sqlstr; // sql string in select clause + struct tSqlExpr *pHaving; // having clause [optional] } SQuerySqlNode; typedef struct STableNamePair { @@ -253,6 +254,11 @@ SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder); SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int32_t index); SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t sortOrder); +tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType); + +int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right); + +tSqlExpr *tSqlExprClone(tSqlExpr *pSrc); SFromInfo *setTableNameList(SFromInfo* pFromInfo, SStrToken *pName, SStrToken* pAlias); SFromInfo *setSubquery(SFromInfo* pFromInfo, SQuerySqlNode *pSqlNode); void *destroyFromInfo(SFromInfo* pFromInfo); @@ -272,7 +278,7 @@ void tSqlExprListDestroy(SArray *pList); SQuerySqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelectList, SFromInfo *pFrom, tSqlExpr *pWhere, SArray *pGroupby, SArray *pSortOrder, SIntervalVal *pInterval, SSessionWindowVal *ps, - SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, SLimitVal *pgLimit); + SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, SLimitVal *pgLimit, tSqlExpr *pHaving); SCreateTableSql *tSetCreateTableInfo(SArray *pCols, SArray *pTags, SQuerySqlNode *pSelect, int32_t type); diff --git a/src/query/inc/qUtil.h b/src/query/inc/qUtil.h index cdd8b0707a86404597fc1379e0743173734a1db1..cb8c9679ec9e08be7fdb9f24c2242b3bc93621de 100644 --- a/src/query/inc/qUtil.h +++ b/src/query/inc/qUtil.h @@ -52,11 +52,20 @@ static FORCE_INLINE SResultRow *getResultRow(SResultRowInfo *pResultRowInfo, int return pResultRowInfo->pResult[slot]; } -static FORCE_INLINE char *getPosInResultPage(SQuery *pQuery, tFilePage* page, int32_t rowOffset, int16_t offset) { - assert(rowOffset >= 0 && pQuery != NULL); +static FORCE_INLINE char* getPosInResultPage(SQueryRuntimeEnv* pRuntimeEnv, tFilePage* page, int32_t rowOffset, + int16_t offset, int32_t size) { + assert(rowOffset >= 0 && pRuntimeEnv != NULL); + + SQuery* pQuery = pRuntimeEnv->pQuery; + int64_t pageSize = pRuntimeEnv->pResultBuf->pageSize; int32_t numOfRows = (int32_t)GET_ROW_PARAM_FOR_MULTIOUTPUT(pQuery, pQuery->topBotQuery, pQuery->stableQuery); - return ((char *)page->data) + rowOffset + offset * numOfRows; + + // buffer overflow check + int64_t bufEnd = (rowOffset + offset * numOfRows + size); + assert(page->num <= pageSize && bufEnd <= page->num); + + return ((char*)page->data) + rowOffset + offset * numOfRows; } bool isNullOperator(SColumnFilterElem *pFilter, const char* minval, const char* maxval, int16_t type); diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 174b31a9c6cec7b4c3274b35939fb3773cc6d70d..f9a4f1b51d34b17fddeb07946361f328d4702a1d 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -453,7 +453,7 @@ tagitem(A) ::= PLUS(X) FLOAT(Y). { %type select {SQuerySqlNode*} %destructor select {destroyQuerySqlNode($$);} select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_opt(K) session_option(H) fill_opt(F) sliding_opt(S) groupby_opt(P) orderby_opt(Z) having_opt(N) slimit_opt(G) limit_opt(L). { - A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &S, F, &L, &G); + A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &S, F, &L, &G, N); } select(A) ::= LP select(B) RP. {A = B;} @@ -471,7 +471,7 @@ cmd ::= union(X). { setSqlInfo(pInfo, X, NULL, TSDB_SQL_SELECT); } // select client_version() // select server_state() select(A) ::= SELECT(T) selcollist(W). { - A = tSetQuerySqlNode(&T, W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + A = tSetQuerySqlNode(&T, W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } // selcollist is a list of expressions that are to become the return @@ -842,4 +842,4 @@ 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 - NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT TBNAME JOIN STABLE NULL INSERT INTO VALUES. \ No newline at end of file + NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT TBNAME JOIN STABLE NULL INSERT INTO VALUES. diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index c7e4223db583f1e7e8c0bf1a268c5304070e359d..dc524d95a957f3de13a45315c819b9ae0fe9a4d6 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -205,6 +205,7 @@ static SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntime 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 SOperatorInfo* createHavingOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); static void destroyBasicOperatorInfo(void* param, int32_t numOfOutput); static void destroySFillOperatorInfo(void* param, int32_t numOfOutput); @@ -1843,6 +1844,10 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf } } + if (pQuery->havingNum > 0) { + pRuntimeEnv->proot = createHavingOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQuery->pExpr1, pQuery->numOfOutput); + } + if (pQuery->limit.offset > 0) { pRuntimeEnv->proot = createOffsetOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot); } @@ -3267,7 +3272,7 @@ void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pRe continue; } - pCtx[i].pOutput = getPosInResultPage(pRuntimeEnv->pQuery, bufPage, pResult->offset, offset); + pCtx[i].pOutput = getPosInResultPage(pRuntimeEnv, bufPage, pResult->offset, offset, pCtx[i].outputBytes); offset += pCtx[i].outputBytes; int32_t functionId = pCtx[i].functionId; @@ -3325,7 +3330,7 @@ void setResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult, SQLF int16_t offset = 0; for (int32_t i = 0; i < numOfCols; ++i) { - pCtx[i].pOutput = getPosInResultPage(pRuntimeEnv->pQuery, page, pResult->offset, offset); + pCtx[i].pOutput = getPosInResultPage(pRuntimeEnv, page, pResult->offset, offset, pCtx[i].outputBytes); offset += pCtx[i].outputBytes; int32_t functionId = pCtx[i].functionId; @@ -3533,8 +3538,6 @@ void setIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, TSKEY key) { */ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo* pGroupResInfo, int32_t orderType, SSDataBlock* pBlock) { - SQuery *pQuery = pRuntimeEnv->pQuery; - int32_t numOfRows = getNumOfTotalRes(pGroupResInfo); int32_t numOfResult = pBlock->info.rows; // there are already exists result rows @@ -3569,7 +3572,7 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo* int32_t bytes = pColInfoData->info.bytes; char *out = pColInfoData->pData + numOfResult * bytes; - char *in = getPosInResultPage(pQuery, page, pRow->offset, offset); + char *in = getPosInResultPage(pRuntimeEnv, page, pRow->offset, offset, bytes); memcpy(out, in, bytes * numOfRowsToCopy); offset += bytes; @@ -4691,6 +4694,111 @@ static SSDataBlock* doOffset(void* param) { } } + +bool doFilterData(SColumnInfoData* p, int32_t rid, SColumnFilterElem *filterElem, __filter_func_t fp) { + char* input = p->pData + p->info.bytes * rid; + bool isnull = isNull(input, p->info.type); + if (isnull) { + return (fp == isNullOperator) ? true : false; + } else { + if (fp == notNullOperator) { + return true; + } else if (fp == isNullOperator) { + return false; + } + } + + if (fp(filterElem, input, input, p->info.type)) { + return true; + } + + return false; +} + + +void doHavingImpl(SOperatorInfo *pOperator, SSDataBlock *pBlock) { + SHavingOperatorInfo* pInfo = pOperator->info; + int32_t f = 0; + int32_t allQualified = 1; + int32_t exprQualified = 0; + + for (int32_t r = 0; r < pBlock->info.rows; ++r) { + allQualified = 1; + + for (int32_t i = 0; i < pOperator->numOfOutput; ++i) { + SExprInfo* pExprInfo = &(pOperator->pExpr[i]); + if (pExprInfo->pFilter == NULL) { + continue; + } + + SArray* es = taosArrayGetP(pInfo->fp, i); + assert(es); + + size_t fpNum = taosArrayGetSize(es); + + exprQualified = 0; + for (int32_t m = 0; m < fpNum; ++m) { + __filter_func_t fp = taosArrayGetP(es, m); + + assert(fp); + + //SColIndex* colIdx = &pExprInfo->base.colInfo; + SColumnInfoData* p = taosArrayGet(pBlock->pDataBlock, i); + + SColumnFilterElem filterElem = {.filterInfo = pExprInfo->pFilter[m]}; + + if (doFilterData(p, r, &filterElem, fp)) { + exprQualified = 1; + break; + } + } + + if (exprQualified == 0) { + allQualified = 0; + break; + } + } + + if (allQualified == 0) { + continue; + } + + for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { + SColumnInfoData *pColInfoData = taosArrayGet(pBlock->pDataBlock, i); + + int16_t bytes = pColInfoData->info.bytes; + memmove(pColInfoData->pData + f * bytes, pColInfoData->pData + bytes * r, bytes); + } + + ++f; + } + + pBlock->info.rows = f; +} + +static SSDataBlock* doHaving(void* param) { + SOperatorInfo *pOperator = (SOperatorInfo *)param; + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } + + SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; + + while (1) { + SSDataBlock *pBlock = pOperator->upstream->exec(pOperator->upstream); + if (pBlock == NULL) { + setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); + pOperator->status = OP_EXEC_DONE; + return NULL; + } + + doHavingImpl(pOperator, pBlock); + + return pBlock; + } +} + + static SSDataBlock* doIntervalAgg(void* param) { SOperatorInfo* pOperator = (SOperatorInfo*) param; if (pOperator->status == OP_EXEC_DONE) { @@ -5041,6 +5149,13 @@ static void destroyTagScanOperatorInfo(void* param, int32_t numOfOutput) { pInfo->pRes = destroyOutputBuf(pInfo->pRes); } +static void destroyHavingOperatorInfo(void* param, int32_t numOfOutput) { + SHavingOperatorInfo* pInfo = (SHavingOperatorInfo*) param; + if (pInfo->fp) { + taosArrayDestroy(pInfo->fp); + } +} + SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { SAggOperatorInfo* pInfo = calloc(1, sizeof(SAggOperatorInfo)); @@ -5097,6 +5212,83 @@ SOperatorInfo* createArithOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorI return pOperator; } + +int32_t initFilterFp(SExprInfo* pExpr, int32_t numOfOutput, SArray** fps) { + __filter_func_t fp = NULL; + + *fps = taosArrayInit(numOfOutput, sizeof(SArray*)); + if (*fps == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + for (int32_t i = 0; i < numOfOutput; ++i) { + SExprInfo* pExprInfo = &(pExpr[i]); + SColIndex* colIdx = &pExprInfo->base.colInfo; + + if (pExprInfo->pFilter == NULL || !TSDB_COL_IS_NORMAL_COL(colIdx->flag)) { + taosArrayPush(*fps, &fp); + + continue; + } + + int32_t filterNum = pExprInfo->base.filterNum; + SColumnFilterInfo *filterInfo = pExprInfo->pFilter; + + SArray* es = taosArrayInit(filterNum, sizeof(__filter_func_t)); + + for (int32_t j = 0; j < filterNum; ++j) { + int32_t lower = filterInfo->lowerRelOptr; + int32_t upper = filterInfo->upperRelOptr; + if (lower == TSDB_RELATION_INVALID && upper == TSDB_RELATION_INVALID) { + qError("invalid rel optr"); + taosArrayDestroy(es); + return TSDB_CODE_QRY_APP_ERROR; + } + + __filter_func_t ffp = getFilterOperator(lower, upper); + if (ffp == NULL) { + qError("invalid filter info"); + taosArrayDestroy(es); + return TSDB_CODE_QRY_APP_ERROR; + } + + taosArrayPush(es, &ffp); + + filterInfo += 1; + } + + taosArrayPush(*fps, &es); + } + + return TSDB_CODE_SUCCESS; +} + +SOperatorInfo* createHavingOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { + SHavingOperatorInfo* pInfo = calloc(1, sizeof(SHavingOperatorInfo)); + + initFilterFp(pExpr, numOfOutput, &pInfo->fp); + + assert(pInfo->fp); + + SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); + + pOperator->name = "HavingOperator"; + pOperator->operatorType = OP_Having; + pOperator->blockingOptr = false; + pOperator->status = OP_IN_EXECUTING; + pOperator->numOfOutput = numOfOutput; + pOperator->pExpr = pExpr; + pOperator->upstream = upstream; + pOperator->exec = doHaving; + pOperator->info = pInfo; + pOperator->pRuntimeEnv = pRuntimeEnv; + pOperator->cleanup = destroyHavingOperatorInfo; + + return pOperator; +} + + + SOperatorInfo* createLimitOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream) { SLimitOperatorInfo* pInfo = calloc(1, sizeof(SLimitOperatorInfo)); pInfo->limit = pRuntimeEnv->pQuery->limit.limit; @@ -5668,9 +5860,35 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { pExprMsg->functionId = htons(pExprMsg->functionId); pExprMsg->numOfParams = htons(pExprMsg->numOfParams); pExprMsg->resColId = htons(pExprMsg->resColId); + pExprMsg->filterNum = htonl(pExprMsg->filterNum); pMsg += sizeof(SSqlFuncMsg); + SColumnFilterInfo* pExprFilterInfo = pExprMsg->filterInfo; + + pMsg += sizeof(SColumnFilterInfo) * pExprMsg->filterNum; + + for (int32_t f = 0; f < pExprMsg->filterNum; ++f) { + SColumnFilterInfo *pFilterMsg = (SColumnFilterInfo *)pExprFilterInfo; + + pFilterMsg->filterstr = htons(pFilterMsg->filterstr); + + if (pFilterMsg->filterstr) { + pFilterMsg->len = htobe64(pFilterMsg->len); + + pFilterMsg->pz = (int64_t)pMsg; + pMsg += (pFilterMsg->len + 1); + } else { + pFilterMsg->lowerBndi = htobe64(pFilterMsg->lowerBndi); + pFilterMsg->upperBndi = htobe64(pFilterMsg->upperBndi); + } + + pFilterMsg->lowerRelOptr = htons(pFilterMsg->lowerRelOptr); + pFilterMsg->upperRelOptr = htons(pFilterMsg->upperRelOptr); + + pExprFilterInfo++; + } + for (int32_t j = 0; j < pExprMsg->numOfParams; ++j) { pExprMsg->arg[j].argType = htons(pExprMsg->arg[j].argType); pExprMsg->arg[j].argBytes = htons(pExprMsg->arg[j].argBytes); @@ -5855,6 +6073,42 @@ _cleanup: return code; } +int32_t cloneExprFilterInfo(SColumnFilterInfo **dst, SColumnFilterInfo* src, int32_t filterNum) { + if (filterNum <= 0) { + return TSDB_CODE_SUCCESS; + } + + *dst = calloc(filterNum, sizeof(*src)); + if (*dst == NULL) { + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + + memcpy(*dst, src, sizeof(*src) * filterNum); + + for (int32_t i = 0; i < filterNum; i++) { + if ((*dst)[i].filterstr && dst[i]->len > 0) { + void *pz = calloc(1, (size_t)(*dst)[i].len + 1); + + if (pz == NULL) { + if (i == 0) { + free(*dst); + } else { + freeColumnFilterInfo(*dst, i); + } + + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + + memcpy(pz, (void *)src->pz, (size_t)src->len + 1); + + (*dst)[i].pz = (int64_t)pz; + } + } + + return TSDB_CODE_SUCCESS; +} + + static int32_t buildArithmeticExprFromMsg(SExprInfo *pArithExprInfo, SQueryTableMsg *pQueryMsg) { qDebug("qmsg:%p create arithmetic expr from binary", pQueryMsg); @@ -5968,6 +6222,13 @@ int32_t createQueryFuncExprFromMsg(SQueryTableMsg* pQueryMsg, int32_t numOfOutpu type = s->type; bytes = s->bytes; } + + if (pExprs[i].base.filterNum > 0) { + int32_t ret = cloneExprFilterInfo(&pExprs[i].pFilter, pExprMsg[i]->filterInfo, pExprMsg[i]->filterNum); + if (ret) { + return ret; + } + } } int32_t param = (int32_t)pExprs[i].base.arg[0].argValue.i64; @@ -6259,6 +6520,10 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr if (TSDB_COL_IS_TAG(pExprs[col].base.colInfo.flag)) { pQuery->tagLen += pExprs[col].bytes; } + + if (pExprs[col].pFilter) { + ++pQuery->havingNum; + } } doUpdateExprColumnIndex(pQuery); @@ -6360,6 +6625,10 @@ _cleanup_qinfo: tExprTreeDestroy(pExprInfo->pExpr, NULL); pExprInfo->pExpr = NULL; } + + if (pExprInfo->pFilter) { + freeColumnFilterInfo(pExprInfo->pFilter, pExprInfo->base.filterNum); + } } tfree(pExprs); @@ -6446,7 +6715,7 @@ void freeColumnFilterInfo(SColumnFilterInfo* pFilter, int32_t numOfFilters) { } for (int32_t i = 0; i < numOfFilters; i++) { - if (pFilter[i].filterstr) { + if (pFilter[i].filterstr && pFilter[i].pz) { free((void*)(pFilter[i].pz)); } } @@ -6488,6 +6757,10 @@ static void* destroyQueryFuncExpr(SExprInfo* pExprInfo, int32_t numOfExpr) { if (pExprInfo[i].pExpr != NULL) { tExprTreeDestroy(pExprInfo[i].pExpr, NULL); } + + if (pExprInfo[i].pFilter) { + freeColumnFilterInfo(pExprInfo[i].pFilter, pExprInfo[i].base.filterNum); + } } tfree(pExprInfo); diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index dc1be4fe01a532f9edfa6bfe146adb5d9cce1bf1..b75032967abde595bccea6d6577465b0870791c2 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -310,6 +310,77 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) { return pExpr; } +static FORCE_INLINE int32_t tStrTokenCompare(SStrToken* left, SStrToken* right) { + return (left->type == right->type && left->n == right->n && strncasecmp(left->z, right->z, left->n) == 0) ? 0 : 1; +} + + +int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right) { + if ((left == NULL && right) || (left && right == NULL)) { + return 1; + } + + if (left->type != right->type) { + return 1; + } + + if (left->tokenId != right->tokenId) { + return 1; + } + + if (left->functionId != right->functionId) { + return 1; + } + + if ((left->pLeft && right->pLeft == NULL) + || (left->pLeft == NULL && right->pLeft) + || (left->pRight && right->pRight == NULL) + || (left->pRight == NULL && right->pRight) + || (left->pParam && right->pParam == NULL) + || (left->pParam == NULL && right->pParam)) { + return 1; + } + + if (tVariantCompare(&left->value, &right->value)) { + return 1; + } + + if (tStrTokenCompare(&left->colInfo, &right->colInfo)) { + return 1; + } + + + if (right->pParam && left->pParam) { + size_t size = taosArrayGetSize(right->pParam); + if (left->pParam && taosArrayGetSize(left->pParam) != size) { + return 1; + } + + for (int32_t i = 0; i < size; i++) { + tSqlExprItem* pLeftElem = taosArrayGet(left->pParam, i); + tSqlExpr* pSubLeft = pLeftElem->pNode; + tSqlExprItem* pRightElem = taosArrayGet(left->pParam, i); + tSqlExpr* pSubRight = pRightElem->pNode; + + if (tSqlExprCompare(pSubLeft, pSubRight)) { + return 1; + } + } + } + + if (left->pLeft && tSqlExprCompare(left->pLeft, right->pLeft)) { + return 1; + } + + if (left->pRight && tSqlExprCompare(left->pRight, right->pRight)) { + return 1; + } + + return 0; +} + + + tSqlExpr *tSqlExprClone(tSqlExpr *pSrc) { tSqlExpr *pExpr = calloc(1, sizeof(tSqlExpr)); @@ -640,7 +711,7 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) { SQuerySqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelectList, SFromInfo *pFrom, tSqlExpr *pWhere, SArray *pGroupby, SArray *pSortOrder, SIntervalVal *pInterval, SSessionWindowVal *pSession, SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, - SLimitVal *psLimit) { + SLimitVal *psLimit, tSqlExpr *pHaving) { assert(pSelectList != NULL); SQuerySqlNode *pSqlNode = calloc(1, sizeof(SQuerySqlNode)); @@ -655,6 +726,7 @@ SQuerySqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelectList, SF pSqlNode->pSortOrder = pSortOrder; pSqlNode->pWhere = pWhere; pSqlNode->fillType = pFill; + pSqlNode->pHaving = pHaving; if (pLimit != NULL) { pSqlNode->limit = *pLimit; @@ -717,6 +789,9 @@ void destroyQuerySqlNode(SQuerySqlNode *pQuerySql) { tSqlExprDestroy(pQuerySql->pWhere); pQuerySql->pWhere = NULL; + + tSqlExprDestroy(pQuerySql->pHaving); + pQuerySql->pHaving = NULL; taosArrayDestroyEx(pQuerySql->pSortOrder, freeVariant); pQuerySql->pSortOrder = NULL; diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c index 9b0046fda04861ca39ef39e6e68decc66840e3e7..aa793add840351311bf23d37d39ba06945e583e4 100644 --- a/src/query/src/qUtil.c +++ b/src/query/src/qUtil.c @@ -140,7 +140,7 @@ void clearResultRow(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResultRow, int16 SResultRowCellInfo *pResultInfo = &pResultRow->pCellInfo[i]; int16_t size = pRuntimeEnv->pQuery->pExpr1[i].bytes; - char * s = getPosInResultPage(pRuntimeEnv->pQuery, page, pResultRow->offset, offset); + char * s = getPosInResultPage(pRuntimeEnv, page, pResultRow->offset, offset, size); memset(s, 0, size); offset += size; diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index 838f6aa0c92de2360ab3b305ba0faadc3594e668..84cd7fe93b07c2d20b8d6f2aabd0097d983b402e 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -476,7 +476,7 @@ void qCleanupQueryMgmt(void* pQMgmt) { qDebug("vgId:%d, queryMgmt cleanup completed", vgId); } -void** qRegisterQInfo(void* pMgmt, uint64_t qId, uint64_t qInfo) { +void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo) { if (pMgmt == NULL) { terrno = TSDB_CODE_VND_INVALID_VGROUP_ID; return NULL; @@ -517,8 +517,7 @@ void** qAcquireQInfo(void* pMgmt, uint64_t _key) { return NULL; } - TSDB_CACHE_PTR_TYPE key = (TSDB_CACHE_PTR_TYPE)_key; - void** handle = taosCacheAcquireByKey(pQueryMgmt->qinfoPool, &key, sizeof(TSDB_CACHE_PTR_TYPE)); + void** handle = taosCacheAcquireByKey(pQueryMgmt->qinfoPool, &_key, sizeof(_key)); if (handle == NULL || *handle == NULL) { terrno = TSDB_CODE_QRY_INVALID_QHANDLE; return NULL; diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 28208e532af4c4d7688208c19622a352076e9bc8..3c22bd85cc31b8bb6f8f39585b41f0fed1300b16 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -23,6 +23,7 @@ ** input grammar file: */ #include +#include /************ Begin %include sections from the grammar ************************/ #include @@ -76,8 +77,10 @@ ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser +** ParseCTX_* As ParseARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -97,39 +100,46 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 264 +#define YYNOCODE 262 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SCreateTableSql* yy14; - int yy20; - tSqlExpr* yy118; - SArray* yy159; - SIntervalVal yy184; - SCreatedTableInfo yy206; - SSessionWindowVal yy249; - SQuerySqlNode* yy272; - int64_t yy317; - SCreateDbInfo yy322; - SCreateAcctInfo yy351; - SSubclauseInfo* yy391; - TAOS_FIELD yy407; - SLimitVal yy440; - tVariant yy488; - SFromInfo* yy514; + SLimitVal yy18; + SFromInfo* yy70; + SSessionWindowVal yy87; + SCreateDbInfo yy94; + int yy116; + SSubclauseInfo* yy141; + tSqlExpr* yy170; + SCreateTableSql* yy194; + tVariant yy218; + SIntervalVal yy220; + SCreatedTableInfo yy252; + SQuerySqlNode* yy254; + SCreateAcctInfo yy419; + SArray* yy429; + TAOS_FIELD yy451; + int64_t yy481; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_PDECL ,SSqlInfo* pInfo -#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo -#define ParseARG_STORE yypParser->pInfo = pInfo +#define ParseARG_PARAM ,pInfo +#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; +#define ParseARG_STORE yypParser->pInfo=pInfo; +#define ParseCTX_SDECL +#define ParseCTX_PDECL +#define ParseCTX_PARAM +#define ParseCTX_FETCH +#define ParseCTX_STORE #define YYFALLBACK 1 #define YYNSTATE 315 #define YYNRULE 267 +#define YYNRULE_WITH_ACTION 267 #define YYNTOKEN 187 #define YY_MAX_SHIFT 314 #define YY_MIN_SHIFTREDUCE 506 @@ -140,6 +150,7 @@ typedef union { #define YY_MIN_REDUCE 776 #define YY_MAX_REDUCE 1042 /************* End control #defines *******************************************/ +#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -204,225 +215,226 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (680) +#define YY_ACTTAB_COUNT (681) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 133, 553, 202, 312, 206, 140, 943, 226, 140, 554, - /* 10 */ 774, 314, 17, 47, 48, 140, 51, 52, 30, 181, + /* 0 */ 133, 553, 202, 312, 206, 140, 943, 17, 85, 554, + /* 10 */ 774, 314, 179, 47, 48, 140, 51, 52, 30, 181, /* 20 */ 214, 41, 181, 50, 262, 55, 53, 57, 54, 1023, - /* 30 */ 922, 209, 1024, 46, 45, 179, 181, 44, 43, 42, - /* 40 */ 47, 48, 920, 51, 52, 208, 1024, 214, 41, 553, - /* 50 */ 50, 262, 55, 53, 57, 54, 934, 554, 185, 203, + /* 30 */ 922, 209, 1024, 46, 45, 185, 181, 44, 43, 42, + /* 40 */ 47, 48, 910, 51, 52, 208, 1024, 214, 41, 553, + /* 50 */ 50, 262, 55, 53, 57, 54, 934, 554, 1020, 203, /* 60 */ 46, 45, 919, 247, 44, 43, 42, 48, 940, 51, - /* 70 */ 52, 242, 974, 214, 41, 79, 50, 262, 55, 53, - /* 80 */ 57, 54, 975, 632, 257, 30, 46, 45, 278, 225, + /* 70 */ 52, 242, 974, 214, 41, 553, 50, 262, 55, 53, + /* 80 */ 57, 54, 975, 554, 257, 278, 46, 45, 298, 225, /* 90 */ 44, 43, 42, 507, 508, 509, 510, 511, 512, 513, - /* 100 */ 514, 515, 516, 517, 518, 519, 313, 553, 85, 231, - /* 110 */ 70, 288, 287, 47, 48, 554, 51, 52, 298, 219, - /* 120 */ 214, 41, 553, 50, 262, 55, 53, 57, 54, 918, - /* 130 */ 554, 105, 718, 46, 45, 1020, 298, 44, 43, 42, - /* 140 */ 47, 49, 910, 51, 52, 922, 140, 214, 41, 234, - /* 150 */ 50, 262, 55, 53, 57, 54, 1019, 238, 237, 227, + /* 100 */ 514, 515, 516, 517, 518, 519, 313, 632, 1019, 231, + /* 110 */ 70, 553, 30, 47, 48, 1018, 51, 52, 821, 554, + /* 120 */ 214, 41, 166, 50, 262, 55, 53, 57, 54, 44, + /* 130 */ 43, 42, 718, 46, 45, 288, 287, 44, 43, 42, + /* 140 */ 47, 49, 830, 51, 52, 198, 166, 214, 41, 234, + /* 150 */ 50, 262, 55, 53, 57, 54, 918, 238, 237, 227, /* 160 */ 46, 45, 285, 284, 44, 43, 42, 23, 276, 307, /* 170 */ 306, 275, 274, 273, 305, 272, 304, 303, 302, 271, - /* 180 */ 301, 300, 882, 30, 870, 871, 872, 873, 874, 875, + /* 180 */ 301, 300, 882, 140, 870, 871, 872, 873, 874, 875, /* 190 */ 876, 877, 878, 879, 880, 881, 883, 884, 51, 52, - /* 200 */ 821, 1018, 214, 41, 166, 50, 262, 55, 53, 57, - /* 210 */ 54, 259, 18, 78, 82, 46, 45, 198, 223, 44, - /* 220 */ 43, 42, 213, 731, 217, 25, 722, 919, 725, 190, - /* 230 */ 728, 221, 213, 731, 199, 191, 722, 724, 725, 727, - /* 240 */ 728, 118, 117, 189, 263, 905, 906, 29, 909, 44, - /* 250 */ 43, 42, 30, 74, 210, 211, 308, 922, 261, 30, - /* 260 */ 23, 36, 307, 306, 210, 211, 934, 305, 30, 304, - /* 270 */ 303, 302, 74, 301, 300, 890, 908, 183, 888, 889, - /* 280 */ 36, 204, 922, 891, 916, 893, 894, 892, 224, 895, - /* 290 */ 896, 280, 656, 218, 830, 653, 919, 654, 166, 655, - /* 300 */ 281, 69, 241, 919, 68, 55, 53, 57, 54, 282, - /* 310 */ 197, 671, 919, 46, 45, 30, 822, 44, 43, 42, - /* 320 */ 166, 103, 108, 228, 229, 56, 220, 97, 107, 113, - /* 330 */ 116, 106, 732, 907, 723, 56, 726, 110, 730, 30, - /* 340 */ 735, 12, 732, 5, 156, 84, 184, 81, 730, 33, - /* 350 */ 155, 92, 87, 91, 729, 278, 286, 1, 154, 919, - /* 360 */ 174, 170, 186, 212, 729, 80, 172, 169, 121, 120, - /* 370 */ 119, 46, 45, 3, 167, 44, 43, 42, 71, 720, - /* 380 */ 290, 699, 700, 919, 311, 310, 126, 243, 668, 675, - /* 390 */ 678, 31, 684, 690, 180, 24, 135, 60, 245, 691, - /* 400 */ 752, 657, 733, 20, 19, 61, 19, 6, 64, 642, - /* 410 */ 265, 1034, 644, 31, 31, 721, 60, 267, 643, 187, - /* 420 */ 28, 83, 60, 268, 96, 95, 188, 62, 65, 14, - /* 430 */ 13, 102, 101, 660, 67, 661, 631, 194, 16, 15, - /* 440 */ 658, 195, 659, 115, 114, 131, 129, 193, 178, 192, - /* 450 */ 182, 921, 985, 984, 215, 981, 239, 980, 132, 942, - /* 460 */ 216, 289, 39, 950, 952, 967, 134, 966, 138, 935, - /* 470 */ 246, 130, 248, 917, 151, 915, 150, 205, 683, 250, - /* 480 */ 152, 886, 299, 153, 291, 148, 146, 260, 142, 932, - /* 490 */ 141, 58, 833, 270, 66, 255, 143, 37, 63, 176, - /* 500 */ 34, 279, 829, 258, 144, 1039, 93, 256, 1038, 1036, - /* 510 */ 157, 254, 283, 1033, 99, 1032, 1030, 158, 851, 35, - /* 520 */ 252, 145, 32, 38, 177, 818, 109, 816, 111, 40, - /* 530 */ 112, 814, 813, 230, 168, 811, 810, 809, 808, 807, - /* 540 */ 806, 171, 173, 803, 801, 799, 797, 795, 175, 249, - /* 550 */ 244, 72, 75, 104, 251, 968, 292, 293, 294, 295, - /* 560 */ 296, 297, 309, 200, 222, 269, 772, 232, 201, 233, - /* 570 */ 771, 88, 89, 196, 235, 236, 770, 758, 757, 240, - /* 580 */ 245, 8, 264, 73, 812, 663, 805, 161, 852, 159, - /* 590 */ 160, 163, 162, 164, 165, 122, 123, 124, 804, 76, - /* 600 */ 125, 796, 4, 2, 685, 136, 137, 688, 77, 149, - /* 610 */ 147, 207, 253, 86, 692, 898, 139, 9, 10, 26, - /* 620 */ 27, 734, 7, 11, 736, 21, 22, 266, 595, 591, - /* 630 */ 589, 84, 588, 587, 584, 557, 277, 94, 90, 31, - /* 640 */ 634, 633, 59, 630, 579, 577, 98, 569, 575, 571, - /* 650 */ 573, 567, 565, 100, 598, 597, 596, 594, 593, 592, - /* 660 */ 590, 586, 585, 60, 555, 523, 521, 776, 775, 127, - /* 670 */ 775, 775, 775, 775, 775, 775, 775, 775, 775, 128, + /* 200 */ 822, 219, 214, 41, 166, 50, 262, 55, 53, 57, + /* 210 */ 54, 223, 18, 82, 25, 46, 45, 199, 226, 44, + /* 220 */ 43, 42, 213, 731, 934, 221, 722, 922, 725, 190, + /* 230 */ 728, 183, 213, 731, 140, 191, 722, 908, 725, 204, + /* 240 */ 728, 118, 117, 189, 905, 906, 29, 909, 259, 74, + /* 250 */ 78, 922, 30, 920, 210, 211, 308, 36, 261, 69, + /* 260 */ 23, 916, 307, 306, 210, 211, 61, 305, 30, 304, + /* 270 */ 303, 302, 74, 301, 300, 890, 3, 167, 888, 889, + /* 280 */ 36, 224, 922, 891, 280, 893, 894, 892, 62, 895, + /* 290 */ 896, 907, 656, 217, 12, 653, 919, 654, 84, 655, + /* 300 */ 81, 79, 241, 220, 68, 55, 53, 57, 54, 218, + /* 310 */ 197, 184, 919, 46, 45, 30, 278, 44, 43, 42, + /* 320 */ 80, 103, 108, 228, 229, 56, 263, 97, 107, 113, + /* 330 */ 116, 106, 732, 71, 671, 56, 186, 110, 730, 30, + /* 340 */ 180, 30, 732, 5, 156, 30, 699, 700, 730, 33, + /* 350 */ 155, 92, 87, 91, 729, 668, 281, 678, 105, 919, + /* 360 */ 174, 170, 24, 298, 729, 245, 172, 169, 121, 120, + /* 370 */ 119, 46, 45, 1, 154, 44, 43, 42, 720, 724, + /* 380 */ 282, 727, 286, 919, 243, 919, 290, 187, 31, 919, + /* 390 */ 311, 310, 126, 684, 212, 64, 690, 135, 691, 752, + /* 400 */ 60, 657, 20, 19, 733, 723, 642, 726, 19, 265, + /* 410 */ 31, 188, 675, 31, 721, 65, 96, 95, 194, 644, + /* 420 */ 267, 643, 735, 60, 83, 60, 28, 14, 13, 268, + /* 430 */ 102, 101, 67, 660, 631, 661, 195, 658, 6, 659, + /* 440 */ 16, 15, 115, 114, 131, 129, 193, 178, 192, 182, + /* 450 */ 1034, 921, 985, 984, 215, 981, 980, 239, 216, 289, + /* 460 */ 132, 942, 39, 950, 952, 134, 138, 935, 246, 967, + /* 470 */ 130, 966, 917, 150, 151, 915, 299, 152, 683, 248, + /* 480 */ 886, 104, 291, 149, 147, 153, 833, 142, 932, 141, + /* 490 */ 270, 66, 205, 37, 250, 176, 34, 279, 829, 1039, + /* 500 */ 93, 255, 1038, 1036, 143, 63, 58, 157, 283, 1033, + /* 510 */ 99, 1032, 260, 1030, 158, 851, 256, 35, 258, 32, + /* 520 */ 38, 177, 818, 109, 254, 816, 111, 112, 252, 814, + /* 530 */ 813, 230, 168, 811, 810, 809, 808, 807, 806, 171, + /* 540 */ 173, 803, 801, 799, 797, 795, 175, 249, 244, 72, + /* 550 */ 75, 251, 40, 968, 292, 293, 294, 295, 296, 200, + /* 560 */ 297, 222, 269, 309, 772, 233, 232, 771, 88, 201, + /* 570 */ 235, 196, 89, 236, 770, 758, 757, 240, 245, 8, + /* 580 */ 264, 73, 663, 136, 812, 161, 165, 685, 852, 159, + /* 590 */ 160, 162, 164, 163, 122, 123, 805, 76, 124, 804, + /* 600 */ 4, 688, 137, 125, 796, 77, 146, 144, 148, 145, + /* 610 */ 207, 2, 898, 253, 26, 692, 139, 9, 10, 734, + /* 620 */ 27, 7, 11, 21, 736, 22, 86, 266, 595, 591, + /* 630 */ 84, 589, 588, 587, 584, 557, 277, 90, 94, 31, + /* 640 */ 634, 59, 633, 630, 579, 98, 100, 577, 569, 575, + /* 650 */ 571, 573, 567, 565, 598, 597, 596, 594, 593, 592, + /* 660 */ 590, 586, 585, 60, 555, 523, 521, 776, 775, 775, + /* 670 */ 775, 775, 775, 775, 775, 775, 775, 775, 775, 127, + /* 680 */ 128, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 191, 1, 190, 191, 210, 191, 191, 191, 191, 9, - /* 10 */ 188, 189, 252, 13, 14, 191, 16, 17, 191, 252, - /* 20 */ 20, 21, 252, 23, 24, 25, 26, 27, 28, 262, - /* 30 */ 236, 261, 262, 33, 34, 252, 252, 37, 38, 39, - /* 40 */ 13, 14, 226, 16, 17, 261, 262, 20, 21, 1, - /* 50 */ 23, 24, 25, 26, 27, 28, 234, 9, 252, 232, - /* 60 */ 33, 34, 235, 254, 37, 38, 39, 14, 253, 16, - /* 70 */ 17, 249, 258, 20, 21, 258, 23, 24, 25, 26, - /* 80 */ 27, 28, 258, 5, 260, 191, 33, 34, 79, 67, + /* 0 */ 190, 1, 189, 190, 209, 190, 190, 251, 196, 9, + /* 10 */ 187, 188, 251, 13, 14, 190, 16, 17, 190, 251, + /* 20 */ 20, 21, 251, 23, 24, 25, 26, 27, 28, 261, + /* 30 */ 235, 260, 261, 33, 34, 251, 251, 37, 38, 39, + /* 40 */ 13, 14, 230, 16, 17, 260, 261, 20, 21, 1, + /* 50 */ 23, 24, 25, 26, 27, 28, 233, 9, 251, 231, + /* 60 */ 33, 34, 234, 253, 37, 38, 39, 14, 252, 16, + /* 70 */ 17, 248, 257, 20, 21, 1, 23, 24, 25, 26, + /* 80 */ 27, 28, 257, 9, 259, 79, 33, 34, 81, 67, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, - /* 100 */ 52, 53, 54, 55, 56, 57, 58, 1, 197, 61, - /* 110 */ 110, 33, 34, 13, 14, 9, 16, 17, 81, 210, - /* 120 */ 20, 21, 1, 23, 24, 25, 26, 27, 28, 235, - /* 130 */ 9, 76, 105, 33, 34, 252, 81, 37, 38, 39, - /* 140 */ 13, 14, 231, 16, 17, 236, 191, 20, 21, 135, - /* 150 */ 23, 24, 25, 26, 27, 28, 252, 143, 144, 137, + /* 100 */ 52, 53, 54, 55, 56, 57, 58, 5, 251, 61, + /* 110 */ 110, 1, 190, 13, 14, 251, 16, 17, 195, 9, + /* 120 */ 20, 21, 199, 23, 24, 25, 26, 27, 28, 37, + /* 130 */ 38, 39, 105, 33, 34, 33, 34, 37, 38, 39, + /* 140 */ 13, 14, 195, 16, 17, 251, 199, 20, 21, 135, + /* 150 */ 23, 24, 25, 26, 27, 28, 234, 143, 144, 137, /* 160 */ 33, 34, 140, 141, 37, 38, 39, 88, 89, 90, /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 180 */ 101, 102, 209, 191, 211, 212, 213, 214, 215, 216, - /* 190 */ 217, 218, 219, 220, 221, 222, 223, 224, 16, 17, - /* 200 */ 196, 252, 20, 21, 200, 23, 24, 25, 26, 27, - /* 210 */ 28, 256, 44, 258, 197, 33, 34, 252, 67, 37, - /* 220 */ 38, 39, 1, 2, 232, 104, 5, 235, 7, 61, - /* 230 */ 9, 210, 1, 2, 252, 67, 5, 5, 7, 7, - /* 240 */ 9, 73, 74, 75, 15, 228, 229, 230, 231, 37, - /* 250 */ 38, 39, 191, 104, 33, 34, 210, 236, 37, 191, - /* 260 */ 88, 112, 90, 91, 33, 34, 234, 95, 191, 97, - /* 270 */ 98, 99, 104, 101, 102, 209, 0, 252, 212, 213, - /* 280 */ 112, 249, 236, 217, 191, 219, 220, 221, 137, 223, - /* 290 */ 224, 140, 2, 232, 196, 5, 235, 7, 200, 9, - /* 300 */ 232, 197, 134, 235, 136, 25, 26, 27, 28, 232, - /* 310 */ 142, 37, 235, 33, 34, 191, 196, 37, 38, 39, - /* 320 */ 200, 62, 63, 33, 34, 104, 233, 68, 69, 70, - /* 330 */ 71, 72, 111, 229, 5, 104, 7, 78, 117, 191, - /* 340 */ 111, 104, 111, 62, 63, 108, 252, 110, 117, 68, - /* 350 */ 69, 70, 71, 72, 133, 79, 232, 198, 199, 235, - /* 360 */ 62, 63, 252, 60, 133, 237, 68, 69, 70, 71, - /* 370 */ 72, 33, 34, 194, 195, 37, 38, 39, 250, 1, - /* 380 */ 232, 124, 125, 235, 64, 65, 66, 105, 109, 115, - /* 390 */ 105, 109, 105, 105, 252, 116, 109, 109, 113, 105, - /* 400 */ 105, 111, 105, 109, 109, 109, 109, 104, 109, 105, - /* 410 */ 105, 236, 105, 109, 109, 37, 109, 105, 105, 252, - /* 420 */ 104, 109, 109, 107, 138, 139, 252, 131, 129, 138, - /* 430 */ 139, 138, 139, 5, 104, 7, 106, 252, 138, 139, - /* 440 */ 5, 252, 7, 76, 77, 62, 63, 252, 252, 252, - /* 450 */ 252, 236, 227, 227, 227, 227, 191, 227, 191, 191, - /* 460 */ 227, 227, 251, 191, 191, 259, 191, 259, 191, 234, - /* 470 */ 234, 60, 255, 234, 191, 191, 238, 255, 117, 255, - /* 480 */ 191, 225, 103, 191, 86, 240, 242, 122, 246, 248, - /* 490 */ 247, 127, 191, 191, 128, 255, 245, 191, 130, 191, - /* 500 */ 191, 191, 191, 126, 244, 191, 191, 121, 191, 191, - /* 510 */ 191, 120, 191, 191, 191, 191, 191, 191, 191, 191, - /* 520 */ 119, 243, 191, 191, 191, 191, 191, 191, 191, 132, - /* 530 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 540 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 118, - /* 550 */ 192, 192, 192, 87, 192, 192, 50, 83, 85, 54, - /* 560 */ 84, 82, 79, 192, 192, 192, 5, 145, 192, 5, - /* 570 */ 5, 197, 197, 192, 145, 5, 5, 90, 89, 135, - /* 580 */ 113, 104, 107, 114, 192, 105, 192, 202, 208, 207, - /* 590 */ 206, 203, 205, 204, 201, 193, 193, 193, 192, 109, - /* 600 */ 193, 192, 194, 198, 105, 104, 109, 105, 104, 239, - /* 610 */ 241, 1, 104, 76, 105, 225, 104, 123, 123, 109, - /* 620 */ 109, 105, 104, 104, 111, 104, 104, 107, 9, 5, - /* 630 */ 5, 108, 5, 5, 5, 80, 15, 139, 76, 109, - /* 640 */ 5, 5, 16, 105, 5, 5, 139, 5, 5, 5, - /* 650 */ 5, 5, 5, 139, 5, 5, 5, 5, 5, 5, - /* 660 */ 5, 5, 5, 109, 80, 60, 59, 0, 263, 21, - /* 670 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 21, - /* 680 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 690 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 700 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 710 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 720 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 730 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 740 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 750 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 760 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 770 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 780 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 790 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 800 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 810 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 820 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 830 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 840 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 850 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 860 */ 263, 263, 263, 263, 263, 263, 263, + /* 180 */ 101, 102, 208, 190, 210, 211, 212, 213, 214, 215, + /* 190 */ 216, 217, 218, 219, 220, 221, 222, 223, 16, 17, + /* 200 */ 195, 209, 20, 21, 199, 23, 24, 25, 26, 27, + /* 210 */ 28, 67, 44, 196, 104, 33, 34, 251, 190, 37, + /* 220 */ 38, 39, 1, 2, 233, 209, 5, 235, 7, 61, + /* 230 */ 9, 251, 1, 2, 190, 67, 5, 0, 7, 248, + /* 240 */ 9, 73, 74, 75, 227, 228, 229, 230, 255, 104, + /* 250 */ 257, 235, 190, 225, 33, 34, 209, 112, 37, 196, + /* 260 */ 88, 190, 90, 91, 33, 34, 109, 95, 190, 97, + /* 270 */ 98, 99, 104, 101, 102, 208, 193, 194, 211, 212, + /* 280 */ 112, 137, 235, 216, 140, 218, 219, 220, 131, 222, + /* 290 */ 223, 228, 2, 231, 104, 5, 234, 7, 108, 9, + /* 300 */ 110, 257, 134, 232, 136, 25, 26, 27, 28, 231, + /* 310 */ 142, 251, 234, 33, 34, 190, 79, 37, 38, 39, + /* 320 */ 236, 62, 63, 33, 34, 104, 15, 68, 69, 70, + /* 330 */ 71, 72, 111, 249, 37, 104, 251, 78, 117, 190, + /* 340 */ 251, 190, 111, 62, 63, 190, 124, 125, 117, 68, + /* 350 */ 69, 70, 71, 72, 133, 109, 231, 105, 76, 234, + /* 360 */ 62, 63, 116, 81, 133, 113, 68, 69, 70, 71, + /* 370 */ 72, 33, 34, 197, 198, 37, 38, 39, 1, 5, + /* 380 */ 231, 7, 231, 234, 105, 234, 231, 251, 109, 234, + /* 390 */ 64, 65, 66, 105, 60, 109, 105, 109, 105, 105, + /* 400 */ 109, 111, 109, 109, 105, 5, 105, 7, 109, 105, + /* 410 */ 109, 251, 115, 109, 37, 129, 138, 139, 251, 105, + /* 420 */ 105, 105, 111, 109, 109, 109, 104, 138, 139, 107, + /* 430 */ 138, 139, 104, 5, 106, 7, 251, 5, 104, 7, + /* 440 */ 138, 139, 76, 77, 62, 63, 251, 251, 251, 251, + /* 450 */ 235, 235, 226, 226, 226, 226, 226, 190, 226, 226, + /* 460 */ 190, 190, 250, 190, 190, 190, 190, 233, 233, 258, + /* 470 */ 60, 258, 233, 237, 190, 190, 103, 190, 117, 254, + /* 480 */ 224, 87, 86, 238, 240, 190, 190, 245, 247, 246, + /* 490 */ 190, 128, 254, 190, 254, 190, 190, 190, 190, 190, + /* 500 */ 190, 254, 190, 190, 244, 130, 127, 190, 190, 190, + /* 510 */ 190, 190, 122, 190, 190, 190, 121, 190, 126, 190, + /* 520 */ 190, 190, 190, 190, 120, 190, 190, 190, 119, 190, + /* 530 */ 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, + /* 540 */ 190, 190, 190, 190, 190, 190, 190, 118, 191, 191, + /* 550 */ 191, 191, 132, 191, 50, 83, 85, 54, 84, 191, + /* 560 */ 82, 191, 191, 79, 5, 5, 145, 5, 196, 191, + /* 570 */ 145, 191, 196, 5, 5, 90, 89, 135, 113, 104, + /* 580 */ 107, 114, 105, 104, 191, 201, 200, 105, 207, 206, + /* 590 */ 205, 204, 203, 202, 192, 192, 191, 109, 192, 191, + /* 600 */ 193, 105, 109, 192, 191, 104, 241, 243, 239, 242, + /* 610 */ 1, 197, 224, 104, 109, 105, 104, 123, 123, 105, + /* 620 */ 109, 104, 104, 104, 111, 104, 76, 107, 9, 5, + /* 630 */ 108, 5, 5, 5, 5, 80, 15, 76, 139, 109, + /* 640 */ 5, 16, 5, 105, 5, 139, 139, 5, 5, 5, + /* 650 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /* 660 */ 5, 5, 5, 109, 80, 60, 59, 0, 262, 262, + /* 670 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 21, + /* 680 */ 21, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 690 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 700 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 710 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 720 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 730 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 740 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 750 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 760 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 770 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 780 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 790 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 800 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 810 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 820 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 830 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 840 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 850 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 860 */ 262, 262, 262, 262, 262, 262, 262, 262, }; #define YY_SHIFT_COUNT (314) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (667) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 168, 79, 79, 172, 172, 9, 221, 231, 106, 106, - /* 10 */ 106, 106, 106, 106, 106, 106, 106, 0, 48, 231, - /* 20 */ 290, 290, 290, 290, 121, 149, 106, 106, 106, 276, - /* 30 */ 106, 106, 55, 9, 37, 37, 680, 680, 680, 231, + /* 0 */ 168, 79, 79, 172, 172, 6, 221, 231, 74, 74, + /* 10 */ 74, 74, 74, 74, 74, 74, 74, 0, 48, 231, + /* 20 */ 290, 290, 290, 290, 110, 145, 74, 74, 74, 237, + /* 30 */ 74, 74, 282, 6, 7, 7, 681, 681, 681, 231, /* 40 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, /* 50 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 290, - /* 60 */ 290, 78, 78, 78, 78, 78, 78, 78, 106, 106, - /* 70 */ 106, 274, 106, 149, 149, 106, 106, 106, 257, 257, - /* 80 */ 279, 149, 106, 106, 106, 106, 106, 106, 106, 106, - /* 90 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 100 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 110 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 120 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - /* 130 */ 106, 106, 411, 411, 411, 361, 361, 361, 411, 361, - /* 140 */ 411, 366, 368, 364, 365, 377, 386, 391, 401, 431, - /* 150 */ 397, 411, 411, 411, 379, 9, 9, 411, 411, 466, - /* 160 */ 398, 506, 474, 473, 505, 476, 479, 379, 411, 483, - /* 170 */ 483, 411, 483, 411, 483, 411, 680, 680, 27, 100, + /* 60 */ 290, 102, 102, 102, 102, 102, 102, 102, 74, 74, + /* 70 */ 74, 297, 74, 145, 145, 74, 74, 74, 222, 222, + /* 80 */ 246, 145, 74, 74, 74, 74, 74, 74, 74, 74, + /* 90 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + /* 100 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + /* 110 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + /* 120 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + /* 130 */ 74, 74, 410, 410, 410, 361, 361, 361, 410, 361, + /* 140 */ 410, 363, 375, 379, 390, 392, 395, 404, 409, 429, + /* 150 */ 420, 410, 410, 410, 373, 6, 6, 410, 410, 394, + /* 160 */ 396, 504, 472, 471, 503, 474, 478, 373, 410, 484, + /* 170 */ 484, 410, 484, 410, 484, 410, 681, 681, 27, 100, /* 180 */ 127, 100, 100, 53, 182, 280, 280, 280, 280, 259, - /* 190 */ 281, 298, 338, 338, 338, 338, 22, 14, 212, 212, - /* 200 */ 237, 151, 320, 282, 285, 287, 288, 294, 295, 297, - /* 210 */ 232, 329, 378, 303, 229, 296, 299, 304, 305, 307, - /* 220 */ 312, 313, 316, 286, 291, 293, 330, 300, 428, 435, - /* 230 */ 367, 383, 561, 422, 564, 565, 429, 570, 571, 487, - /* 240 */ 489, 444, 467, 475, 477, 469, 480, 490, 499, 501, - /* 250 */ 502, 497, 504, 610, 508, 509, 512, 510, 494, 511, - /* 260 */ 495, 516, 518, 513, 519, 475, 521, 520, 522, 523, - /* 270 */ 537, 619, 624, 625, 627, 628, 629, 555, 621, 562, - /* 280 */ 498, 530, 530, 626, 507, 514, 530, 635, 636, 538, - /* 290 */ 530, 639, 640, 642, 643, 644, 645, 646, 647, 649, + /* 190 */ 281, 298, 338, 338, 338, 338, 22, 14, 92, 92, + /* 200 */ 190, 144, 326, 279, 252, 288, 291, 293, 294, 299, + /* 210 */ 374, 400, 377, 334, 311, 157, 286, 301, 304, 314, + /* 220 */ 315, 316, 322, 278, 289, 292, 328, 302, 428, 432, + /* 230 */ 366, 382, 559, 421, 560, 562, 425, 568, 569, 485, + /* 240 */ 487, 442, 465, 473, 475, 467, 477, 488, 482, 479, + /* 250 */ 496, 493, 501, 609, 509, 510, 512, 505, 494, 511, + /* 260 */ 495, 514, 517, 513, 518, 473, 519, 520, 521, 522, + /* 270 */ 550, 619, 624, 626, 627, 628, 629, 555, 621, 561, + /* 280 */ 499, 530, 530, 625, 506, 507, 530, 635, 637, 538, + /* 290 */ 530, 639, 642, 643, 644, 645, 646, 647, 648, 649, /* 300 */ 650, 651, 652, 653, 654, 655, 656, 657, 554, 584, - /* 310 */ 648, 658, 605, 607, 667, + /* 310 */ 658, 659, 605, 607, 667, }; #define YY_REDUCE_COUNT (177) -#define YY_REDUCE_MIN (-240) -#define YY_REDUCE_MAX (409) +#define YY_REDUCE_MIN (-244) +#define YY_REDUCE_MAX (414) static const short yy_reduce_ofst[] = { - /* 0 */ -178, -27, -27, 66, 66, 17, -230, -216, -173, -176, - /* 10 */ -45, -8, 61, 68, 77, 124, 148, -185, -188, -233, - /* 20 */ -206, -91, 21, 46, -191, 32, -186, -183, 93, -89, - /* 30 */ -184, -106, 4, 104, 98, 120, 128, 159, 179, -240, - /* 40 */ -217, -194, -117, -96, -51, -35, -18, 25, 94, 110, - /* 50 */ 142, 167, 174, 185, 189, 195, 196, 197, 198, 175, - /* 60 */ 215, 225, 226, 227, 228, 230, 233, 234, 265, 267, - /* 70 */ 268, 211, 272, 235, 236, 273, 275, 277, 206, 208, - /* 80 */ 238, 239, 283, 284, 289, 292, 301, 302, 306, 308, - /* 90 */ 309, 310, 311, 314, 315, 317, 318, 319, 321, 322, - /* 100 */ 323, 324, 325, 326, 327, 328, 331, 332, 333, 334, - /* 110 */ 335, 336, 337, 339, 340, 341, 342, 343, 344, 345, - /* 120 */ 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - /* 130 */ 356, 357, 358, 359, 360, 217, 222, 224, 362, 240, - /* 140 */ 363, 241, 243, 242, 251, 260, 278, 244, 369, 245, - /* 150 */ 370, 371, 372, 373, 256, 374, 375, 376, 381, 380, - /* 160 */ 382, 384, 385, 387, 388, 389, 393, 390, 392, 402, - /* 170 */ 403, 394, 404, 406, 407, 409, 405, 408, + /* 0 */ -177, -26, -26, 67, 67, 17, -229, -215, -172, -175, + /* 10 */ -7, 62, 78, 125, 149, 151, 155, -184, -187, -232, + /* 20 */ -205, -8, 16, 47, -190, -9, -185, 44, 71, -188, + /* 30 */ 28, -78, -77, 63, -53, 5, 84, 176, 83, -244, + /* 40 */ -239, -216, -193, -143, -136, -106, -34, -20, 60, 85, + /* 50 */ 89, 136, 160, 167, 185, 195, 196, 197, 198, 215, + /* 60 */ 216, 226, 227, 228, 229, 230, 232, 233, 267, 270, + /* 70 */ 271, 212, 273, 234, 235, 274, 275, 276, 211, 213, + /* 80 */ 236, 239, 284, 285, 287, 295, 296, 300, 303, 305, + /* 90 */ 306, 307, 308, 309, 310, 312, 313, 317, 318, 319, + /* 100 */ 320, 321, 323, 324, 325, 327, 329, 330, 331, 332, + /* 110 */ 333, 335, 336, 337, 339, 340, 341, 342, 343, 344, + /* 120 */ 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + /* 130 */ 355, 356, 357, 358, 359, 225, 238, 240, 360, 247, + /* 140 */ 362, 241, 243, 242, 260, 364, 367, 365, 244, 369, + /* 150 */ 245, 368, 370, 371, 256, 372, 376, 378, 380, 381, + /* 160 */ 383, 385, 384, 387, 391, 389, 386, 388, 393, 402, + /* 170 */ 403, 405, 406, 408, 411, 413, 414, 407, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 773, 885, 831, 897, 819, 828, 1026, 1026, 773, 773, @@ -702,6 +714,7 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ + ParseCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -936,82 +949,81 @@ static const char *const yyTokenName[] = { /* 184 */ "INSERT", /* 185 */ "INTO", /* 186 */ "VALUES", - /* 187 */ "error", - /* 188 */ "program", - /* 189 */ "cmd", - /* 190 */ "dbPrefix", - /* 191 */ "ids", - /* 192 */ "cpxName", - /* 193 */ "ifexists", - /* 194 */ "alter_db_optr", - /* 195 */ "alter_topic_optr", - /* 196 */ "acct_optr", - /* 197 */ "ifnotexists", - /* 198 */ "db_optr", - /* 199 */ "topic_optr", - /* 200 */ "pps", - /* 201 */ "tseries", - /* 202 */ "dbs", - /* 203 */ "streams", - /* 204 */ "storage", - /* 205 */ "qtime", - /* 206 */ "users", - /* 207 */ "conns", - /* 208 */ "state", - /* 209 */ "keep", - /* 210 */ "tagitemlist", - /* 211 */ "cache", - /* 212 */ "replica", - /* 213 */ "quorum", - /* 214 */ "days", - /* 215 */ "minrows", - /* 216 */ "maxrows", - /* 217 */ "blocks", - /* 218 */ "ctime", - /* 219 */ "wal", - /* 220 */ "fsync", - /* 221 */ "comp", - /* 222 */ "prec", - /* 223 */ "update", - /* 224 */ "cachelast", - /* 225 */ "partitions", - /* 226 */ "typename", - /* 227 */ "signed", - /* 228 */ "create_table_args", - /* 229 */ "create_stable_args", - /* 230 */ "create_table_list", - /* 231 */ "create_from_stable", - /* 232 */ "columnlist", - /* 233 */ "tagNamelist", - /* 234 */ "select", - /* 235 */ "column", - /* 236 */ "tagitem", - /* 237 */ "selcollist", - /* 238 */ "from", - /* 239 */ "where_opt", - /* 240 */ "interval_opt", - /* 241 */ "session_option", - /* 242 */ "fill_opt", - /* 243 */ "sliding_opt", - /* 244 */ "groupby_opt", - /* 245 */ "orderby_opt", - /* 246 */ "having_opt", - /* 247 */ "slimit_opt", - /* 248 */ "limit_opt", - /* 249 */ "union", - /* 250 */ "sclp", - /* 251 */ "distinct", - /* 252 */ "expr", - /* 253 */ "as", - /* 254 */ "tablelist", - /* 255 */ "tmvar", - /* 256 */ "sortlist", - /* 257 */ "sortitem", - /* 258 */ "item", - /* 259 */ "sortorder", - /* 260 */ "grouplist", - /* 261 */ "exprlist", - /* 262 */ "expritem", + /* 187 */ "program", + /* 188 */ "cmd", + /* 189 */ "dbPrefix", + /* 190 */ "ids", + /* 191 */ "cpxName", + /* 192 */ "ifexists", + /* 193 */ "alter_db_optr", + /* 194 */ "alter_topic_optr", + /* 195 */ "acct_optr", + /* 196 */ "ifnotexists", + /* 197 */ "db_optr", + /* 198 */ "topic_optr", + /* 199 */ "pps", + /* 200 */ "tseries", + /* 201 */ "dbs", + /* 202 */ "streams", + /* 203 */ "storage", + /* 204 */ "qtime", + /* 205 */ "users", + /* 206 */ "conns", + /* 207 */ "state", + /* 208 */ "keep", + /* 209 */ "tagitemlist", + /* 210 */ "cache", + /* 211 */ "replica", + /* 212 */ "quorum", + /* 213 */ "days", + /* 214 */ "minrows", + /* 215 */ "maxrows", + /* 216 */ "blocks", + /* 217 */ "ctime", + /* 218 */ "wal", + /* 219 */ "fsync", + /* 220 */ "comp", + /* 221 */ "prec", + /* 222 */ "update", + /* 223 */ "cachelast", + /* 224 */ "partitions", + /* 225 */ "typename", + /* 226 */ "signed", + /* 227 */ "create_table_args", + /* 228 */ "create_stable_args", + /* 229 */ "create_table_list", + /* 230 */ "create_from_stable", + /* 231 */ "columnlist", + /* 232 */ "tagNamelist", + /* 233 */ "select", + /* 234 */ "column", + /* 235 */ "tagitem", + /* 236 */ "selcollist", + /* 237 */ "from", + /* 238 */ "where_opt", + /* 239 */ "interval_opt", + /* 240 */ "session_option", + /* 241 */ "fill_opt", + /* 242 */ "sliding_opt", + /* 243 */ "groupby_opt", + /* 244 */ "orderby_opt", + /* 245 */ "having_opt", + /* 246 */ "slimit_opt", + /* 247 */ "limit_opt", + /* 248 */ "union", + /* 249 */ "sclp", + /* 250 */ "distinct", + /* 251 */ "expr", + /* 252 */ "as", + /* 253 */ "tablelist", + /* 254 */ "tmvar", + /* 255 */ "sortlist", + /* 256 */ "sortitem", + /* 257 */ "item", + /* 258 */ "sortorder", + /* 259 */ "grouplist", + /* 260 */ "exprlist", + /* 261 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1334,28 +1346,29 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -void ParseInit(void *yypParser){ - yyParser *pParser = (yyParser*)yypParser; +void ParseInit(void *yypRawParser ParseCTX_PDECL){ + yyParser *yypParser = (yyParser*)yypRawParser; + ParseCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH - pParser->yyhwm = 0; + yypParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 - pParser->yytos = NULL; - pParser->yystack = NULL; - pParser->yystksz = 0; - if( yyGrowStack(pParser) ){ - pParser->yystack = &pParser->yystk0; - pParser->yystksz = 1; + yypParser->yytos = NULL; + yypParser->yystack = NULL; + yypParser->yystksz = 0; + if( yyGrowStack(yypParser) ){ + yypParser->yystack = &yypParser->yystk0; + yypParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY - pParser->yyerrcnt = -1; + yypParser->yyerrcnt = -1; #endif - pParser->yytos = pParser->yystack; - pParser->yystack[0].stateno = 0; - pParser->yystack[0].major = 0; + yypParser->yytos = yypParser->yystack; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 - pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #endif } @@ -1372,11 +1385,14 @@ void ParseInit(void *yypParser){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( pParser ) ParseInit(pParser); - return pParser; +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ + yyParser *yypParser; + yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( yypParser ){ + ParseCTX_STORE + ParseInit(yypParser ParseCTX_PARAM); + } + return (void*)yypParser; } #endif /* Parse_ENGINEALWAYSONSTACK */ @@ -1393,7 +1409,8 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -1406,52 +1423,52 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 209: /* keep */ - case 210: /* tagitemlist */ - case 232: /* columnlist */ - case 233: /* tagNamelist */ - case 242: /* fill_opt */ - case 244: /* groupby_opt */ - case 245: /* orderby_opt */ - case 256: /* sortlist */ - case 260: /* grouplist */ + case 208: /* keep */ + case 209: /* tagitemlist */ + case 231: /* columnlist */ + case 232: /* tagNamelist */ + case 241: /* fill_opt */ + case 243: /* groupby_opt */ + case 244: /* orderby_opt */ + case 255: /* sortlist */ + case 259: /* grouplist */ { -taosArrayDestroy((yypminor->yy159)); +taosArrayDestroy((yypminor->yy429)); } break; - case 230: /* create_table_list */ + case 229: /* create_table_list */ { -destroyCreateTableSql((yypminor->yy14)); +destroyCreateTableSql((yypminor->yy194)); } break; - case 234: /* select */ + case 233: /* select */ { -destroyQuerySqlNode((yypminor->yy272)); +destroyQuerySqlNode((yypminor->yy254)); } break; - case 237: /* selcollist */ - case 250: /* sclp */ - case 261: /* exprlist */ + case 236: /* selcollist */ + case 249: /* sclp */ + case 260: /* exprlist */ { -tSqlExprListDestroy((yypminor->yy159)); +tSqlExprListDestroy((yypminor->yy429)); } break; - case 239: /* where_opt */ - case 246: /* having_opt */ - case 252: /* expr */ - case 262: /* expritem */ + case 238: /* where_opt */ + case 245: /* having_opt */ + case 251: /* expr */ + case 261: /* expritem */ { -tSqlExprDestroy((yypminor->yy118)); +tSqlExprDestroy((yypminor->yy170)); } break; - case 249: /* union */ + case 248: /* union */ { -destroyAllSelectClause((yypminor->yy391)); +destroyAllSelectClause((yypminor->yy141)); } break; - case 257: /* sortitem */ + case 256: /* sortitem */ { -tVariantDestroy(&(yypminor->yy488)); +tVariantDestroy(&(yypminor->yy218)); } break; /********* End destructor definitions *****************************************/ @@ -1563,13 +1580,12 @@ int ParseCoverage(FILE *out){ ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ -static unsigned int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ +static YYACTIONTYPE yy_find_shift_action( + YYCODETYPE iLookAhead, /* The look-ahead token */ + YYACTIONTYPE stateno /* Current state number */ ){ int i; - int stateno = pParser->yytos->stateno; - + if( stateno>YY_MAX_SHIFT ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); #if defined(YYCOVERAGE) @@ -1577,15 +1593,19 @@ static unsigned int yy_find_shift_action( #endif do{ i = yy_shift_ofst[stateno]; - assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); + assert( i>=0 ); + assert( i<=YY_ACTTAB_COUNT ); + assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; + assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead %s\n", @@ -1600,15 +1620,8 @@ static unsigned int yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j0 - ){ + assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); + if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1622,6 +1635,7 @@ static unsigned int yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ + assert( i>=0 && iyytos; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; + yytos->stateno = yyNewState; + yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -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[] = { - { 188, -1 }, /* (0) program ::= cmd */ - { 189, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 189, -2 }, /* (2) cmd ::= SHOW TOPICS */ - { 189, -2 }, /* (3) cmd ::= SHOW MNODES */ - { 189, -2 }, /* (4) cmd ::= SHOW DNODES */ - { 189, -2 }, /* (5) cmd ::= SHOW ACCOUNTS */ - { 189, -2 }, /* (6) cmd ::= SHOW USERS */ - { 189, -2 }, /* (7) cmd ::= SHOW MODULES */ - { 189, -2 }, /* (8) cmd ::= SHOW QUERIES */ - { 189, -2 }, /* (9) cmd ::= SHOW CONNECTIONS */ - { 189, -2 }, /* (10) cmd ::= SHOW STREAMS */ - { 189, -2 }, /* (11) cmd ::= SHOW VARIABLES */ - { 189, -2 }, /* (12) cmd ::= SHOW SCORES */ - { 189, -2 }, /* (13) cmd ::= SHOW GRANTS */ - { 189, -2 }, /* (14) cmd ::= SHOW VNODES */ - { 189, -3 }, /* (15) cmd ::= SHOW VNODES IPTOKEN */ - { 190, 0 }, /* (16) dbPrefix ::= */ - { 190, -2 }, /* (17) dbPrefix ::= ids DOT */ - { 192, 0 }, /* (18) cpxName ::= */ - { 192, -2 }, /* (19) cpxName ::= DOT ids */ - { 189, -5 }, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 189, -4 }, /* (21) cmd ::= SHOW CREATE DATABASE ids */ - { 189, -3 }, /* (22) cmd ::= SHOW dbPrefix TABLES */ - { 189, -5 }, /* (23) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 189, -3 }, /* (24) cmd ::= SHOW dbPrefix STABLES */ - { 189, -5 }, /* (25) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 189, -3 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS */ - { 189, -4 }, /* (27) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 189, -5 }, /* (28) cmd ::= DROP TABLE ifexists ids cpxName */ - { 189, -5 }, /* (29) cmd ::= DROP STABLE ifexists ids cpxName */ - { 189, -4 }, /* (30) cmd ::= DROP DATABASE ifexists ids */ - { 189, -4 }, /* (31) cmd ::= DROP TOPIC ifexists ids */ - { 189, -3 }, /* (32) cmd ::= DROP DNODE ids */ - { 189, -3 }, /* (33) cmd ::= DROP USER ids */ - { 189, -3 }, /* (34) cmd ::= DROP ACCOUNT ids */ - { 189, -2 }, /* (35) cmd ::= USE ids */ - { 189, -3 }, /* (36) cmd ::= DESCRIBE ids cpxName */ - { 189, -5 }, /* (37) cmd ::= ALTER USER ids PASS ids */ - { 189, -5 }, /* (38) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 189, -4 }, /* (39) cmd ::= ALTER DNODE ids ids */ - { 189, -5 }, /* (40) cmd ::= ALTER DNODE ids ids ids */ - { 189, -3 }, /* (41) cmd ::= ALTER LOCAL ids */ - { 189, -4 }, /* (42) cmd ::= ALTER LOCAL ids ids */ - { 189, -4 }, /* (43) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 189, -4 }, /* (44) cmd ::= ALTER TOPIC ids alter_topic_optr */ - { 189, -4 }, /* (45) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 189, -6 }, /* (46) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 191, -1 }, /* (47) ids ::= ID */ - { 191, -1 }, /* (48) ids ::= STRING */ - { 193, -2 }, /* (49) ifexists ::= IF EXISTS */ - { 193, 0 }, /* (50) ifexists ::= */ - { 197, -3 }, /* (51) ifnotexists ::= IF NOT EXISTS */ - { 197, 0 }, /* (52) ifnotexists ::= */ - { 189, -3 }, /* (53) cmd ::= CREATE DNODE ids */ - { 189, -6 }, /* (54) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 189, -5 }, /* (55) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 189, -5 }, /* (56) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - { 189, -5 }, /* (57) cmd ::= CREATE USER ids PASS ids */ - { 200, 0 }, /* (58) pps ::= */ - { 200, -2 }, /* (59) pps ::= PPS INTEGER */ - { 201, 0 }, /* (60) tseries ::= */ - { 201, -2 }, /* (61) tseries ::= TSERIES INTEGER */ - { 202, 0 }, /* (62) dbs ::= */ - { 202, -2 }, /* (63) dbs ::= DBS INTEGER */ - { 203, 0 }, /* (64) streams ::= */ - { 203, -2 }, /* (65) streams ::= STREAMS INTEGER */ - { 204, 0 }, /* (66) storage ::= */ - { 204, -2 }, /* (67) storage ::= STORAGE INTEGER */ - { 205, 0 }, /* (68) qtime ::= */ - { 205, -2 }, /* (69) qtime ::= QTIME INTEGER */ - { 206, 0 }, /* (70) users ::= */ - { 206, -2 }, /* (71) users ::= USERS INTEGER */ - { 207, 0 }, /* (72) conns ::= */ - { 207, -2 }, /* (73) conns ::= CONNS INTEGER */ - { 208, 0 }, /* (74) state ::= */ - { 208, -2 }, /* (75) state ::= STATE ids */ - { 196, -9 }, /* (76) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 209, -2 }, /* (77) keep ::= KEEP tagitemlist */ - { 211, -2 }, /* (78) cache ::= CACHE INTEGER */ - { 212, -2 }, /* (79) replica ::= REPLICA INTEGER */ - { 213, -2 }, /* (80) quorum ::= QUORUM INTEGER */ - { 214, -2 }, /* (81) days ::= DAYS INTEGER */ - { 215, -2 }, /* (82) minrows ::= MINROWS INTEGER */ - { 216, -2 }, /* (83) maxrows ::= MAXROWS INTEGER */ - { 217, -2 }, /* (84) blocks ::= BLOCKS INTEGER */ - { 218, -2 }, /* (85) ctime ::= CTIME INTEGER */ - { 219, -2 }, /* (86) wal ::= WAL INTEGER */ - { 220, -2 }, /* (87) fsync ::= FSYNC INTEGER */ - { 221, -2 }, /* (88) comp ::= COMP INTEGER */ - { 222, -2 }, /* (89) prec ::= PRECISION STRING */ - { 223, -2 }, /* (90) update ::= UPDATE INTEGER */ - { 224, -2 }, /* (91) cachelast ::= CACHELAST INTEGER */ - { 225, -2 }, /* (92) partitions ::= PARTITIONS INTEGER */ - { 198, 0 }, /* (93) db_optr ::= */ - { 198, -2 }, /* (94) db_optr ::= db_optr cache */ - { 198, -2 }, /* (95) db_optr ::= db_optr replica */ - { 198, -2 }, /* (96) db_optr ::= db_optr quorum */ - { 198, -2 }, /* (97) db_optr ::= db_optr days */ - { 198, -2 }, /* (98) db_optr ::= db_optr minrows */ - { 198, -2 }, /* (99) db_optr ::= db_optr maxrows */ - { 198, -2 }, /* (100) db_optr ::= db_optr blocks */ - { 198, -2 }, /* (101) db_optr ::= db_optr ctime */ - { 198, -2 }, /* (102) db_optr ::= db_optr wal */ - { 198, -2 }, /* (103) db_optr ::= db_optr fsync */ - { 198, -2 }, /* (104) db_optr ::= db_optr comp */ - { 198, -2 }, /* (105) db_optr ::= db_optr prec */ - { 198, -2 }, /* (106) db_optr ::= db_optr keep */ - { 198, -2 }, /* (107) db_optr ::= db_optr update */ - { 198, -2 }, /* (108) db_optr ::= db_optr cachelast */ - { 199, -1 }, /* (109) topic_optr ::= db_optr */ - { 199, -2 }, /* (110) topic_optr ::= topic_optr partitions */ - { 194, 0 }, /* (111) alter_db_optr ::= */ - { 194, -2 }, /* (112) alter_db_optr ::= alter_db_optr replica */ - { 194, -2 }, /* (113) alter_db_optr ::= alter_db_optr quorum */ - { 194, -2 }, /* (114) alter_db_optr ::= alter_db_optr keep */ - { 194, -2 }, /* (115) alter_db_optr ::= alter_db_optr blocks */ - { 194, -2 }, /* (116) alter_db_optr ::= alter_db_optr comp */ - { 194, -2 }, /* (117) alter_db_optr ::= alter_db_optr wal */ - { 194, -2 }, /* (118) alter_db_optr ::= alter_db_optr fsync */ - { 194, -2 }, /* (119) alter_db_optr ::= alter_db_optr update */ - { 194, -2 }, /* (120) alter_db_optr ::= alter_db_optr cachelast */ - { 195, -1 }, /* (121) alter_topic_optr ::= alter_db_optr */ - { 195, -2 }, /* (122) alter_topic_optr ::= alter_topic_optr partitions */ - { 226, -1 }, /* (123) typename ::= ids */ - { 226, -4 }, /* (124) typename ::= ids LP signed RP */ - { 226, -2 }, /* (125) typename ::= ids UNSIGNED */ - { 227, -1 }, /* (126) signed ::= INTEGER */ - { 227, -2 }, /* (127) signed ::= PLUS INTEGER */ - { 227, -2 }, /* (128) signed ::= MINUS INTEGER */ - { 189, -3 }, /* (129) cmd ::= CREATE TABLE create_table_args */ - { 189, -3 }, /* (130) cmd ::= CREATE TABLE create_stable_args */ - { 189, -3 }, /* (131) cmd ::= CREATE STABLE create_stable_args */ - { 189, -3 }, /* (132) cmd ::= CREATE TABLE create_table_list */ - { 230, -1 }, /* (133) create_table_list ::= create_from_stable */ - { 230, -2 }, /* (134) create_table_list ::= create_table_list create_from_stable */ - { 228, -6 }, /* (135) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 229, -10 }, /* (136) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 231, -10 }, /* (137) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 231, -13 }, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - { 233, -3 }, /* (139) tagNamelist ::= tagNamelist COMMA ids */ - { 233, -1 }, /* (140) tagNamelist ::= ids */ - { 228, -5 }, /* (141) create_table_args ::= ifnotexists ids cpxName AS select */ - { 232, -3 }, /* (142) columnlist ::= columnlist COMMA column */ - { 232, -1 }, /* (143) columnlist ::= column */ - { 235, -2 }, /* (144) column ::= ids typename */ - { 210, -3 }, /* (145) tagitemlist ::= tagitemlist COMMA tagitem */ - { 210, -1 }, /* (146) tagitemlist ::= tagitem */ - { 236, -1 }, /* (147) tagitem ::= INTEGER */ - { 236, -1 }, /* (148) tagitem ::= FLOAT */ - { 236, -1 }, /* (149) tagitem ::= STRING */ - { 236, -1 }, /* (150) tagitem ::= BOOL */ - { 236, -1 }, /* (151) tagitem ::= NULL */ - { 236, -2 }, /* (152) tagitem ::= MINUS INTEGER */ - { 236, -2 }, /* (153) tagitem ::= MINUS FLOAT */ - { 236, -2 }, /* (154) tagitem ::= PLUS INTEGER */ - { 236, -2 }, /* (155) tagitem ::= PLUS FLOAT */ - { 234, -13 }, /* (156) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 234, -3 }, /* (157) select ::= LP select RP */ - { 249, -1 }, /* (158) union ::= select */ - { 249, -4 }, /* (159) union ::= union UNION ALL select */ - { 189, -1 }, /* (160) cmd ::= union */ - { 234, -2 }, /* (161) select ::= SELECT selcollist */ - { 250, -2 }, /* (162) sclp ::= selcollist COMMA */ - { 250, 0 }, /* (163) sclp ::= */ - { 237, -4 }, /* (164) selcollist ::= sclp distinct expr as */ - { 237, -2 }, /* (165) selcollist ::= sclp STAR */ - { 253, -2 }, /* (166) as ::= AS ids */ - { 253, -1 }, /* (167) as ::= ids */ - { 253, 0 }, /* (168) as ::= */ - { 251, -1 }, /* (169) distinct ::= DISTINCT */ - { 251, 0 }, /* (170) distinct ::= */ - { 238, -2 }, /* (171) from ::= FROM tablelist */ - { 238, -4 }, /* (172) from ::= FROM LP union RP */ - { 254, -2 }, /* (173) tablelist ::= ids cpxName */ - { 254, -3 }, /* (174) tablelist ::= ids cpxName ids */ - { 254, -4 }, /* (175) tablelist ::= tablelist COMMA ids cpxName */ - { 254, -5 }, /* (176) tablelist ::= tablelist COMMA ids cpxName ids */ - { 255, -1 }, /* (177) tmvar ::= VARIABLE */ - { 240, -4 }, /* (178) interval_opt ::= INTERVAL LP tmvar RP */ - { 240, -6 }, /* (179) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - { 240, 0 }, /* (180) interval_opt ::= */ - { 241, 0 }, /* (181) session_option ::= */ - { 241, -7 }, /* (182) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 242, 0 }, /* (183) fill_opt ::= */ - { 242, -6 }, /* (184) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 242, -4 }, /* (185) fill_opt ::= FILL LP ID RP */ - { 243, -4 }, /* (186) sliding_opt ::= SLIDING LP tmvar RP */ - { 243, 0 }, /* (187) sliding_opt ::= */ - { 245, 0 }, /* (188) orderby_opt ::= */ - { 245, -3 }, /* (189) orderby_opt ::= ORDER BY sortlist */ - { 256, -4 }, /* (190) sortlist ::= sortlist COMMA item sortorder */ - { 256, -2 }, /* (191) sortlist ::= item sortorder */ - { 258, -2 }, /* (192) item ::= ids cpxName */ - { 259, -1 }, /* (193) sortorder ::= ASC */ - { 259, -1 }, /* (194) sortorder ::= DESC */ - { 259, 0 }, /* (195) sortorder ::= */ - { 244, 0 }, /* (196) groupby_opt ::= */ - { 244, -3 }, /* (197) groupby_opt ::= GROUP BY grouplist */ - { 260, -3 }, /* (198) grouplist ::= grouplist COMMA item */ - { 260, -1 }, /* (199) grouplist ::= item */ - { 246, 0 }, /* (200) having_opt ::= */ - { 246, -2 }, /* (201) having_opt ::= HAVING expr */ - { 248, 0 }, /* (202) limit_opt ::= */ - { 248, -2 }, /* (203) limit_opt ::= LIMIT signed */ - { 248, -4 }, /* (204) limit_opt ::= LIMIT signed OFFSET signed */ - { 248, -4 }, /* (205) limit_opt ::= LIMIT signed COMMA signed */ - { 247, 0 }, /* (206) slimit_opt ::= */ - { 247, -2 }, /* (207) slimit_opt ::= SLIMIT signed */ - { 247, -4 }, /* (208) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 247, -4 }, /* (209) slimit_opt ::= SLIMIT signed COMMA signed */ - { 239, 0 }, /* (210) where_opt ::= */ - { 239, -2 }, /* (211) where_opt ::= WHERE expr */ - { 252, -3 }, /* (212) expr ::= LP expr RP */ - { 252, -1 }, /* (213) expr ::= ID */ - { 252, -3 }, /* (214) expr ::= ID DOT ID */ - { 252, -3 }, /* (215) expr ::= ID DOT STAR */ - { 252, -1 }, /* (216) expr ::= INTEGER */ - { 252, -2 }, /* (217) expr ::= MINUS INTEGER */ - { 252, -2 }, /* (218) expr ::= PLUS INTEGER */ - { 252, -1 }, /* (219) expr ::= FLOAT */ - { 252, -2 }, /* (220) expr ::= MINUS FLOAT */ - { 252, -2 }, /* (221) expr ::= PLUS FLOAT */ - { 252, -1 }, /* (222) expr ::= STRING */ - { 252, -1 }, /* (223) expr ::= NOW */ - { 252, -1 }, /* (224) expr ::= VARIABLE */ - { 252, -1 }, /* (225) expr ::= BOOL */ - { 252, -1 }, /* (226) expr ::= NULL */ - { 252, -4 }, /* (227) expr ::= ID LP exprlist RP */ - { 252, -4 }, /* (228) expr ::= ID LP STAR RP */ - { 252, -3 }, /* (229) expr ::= expr IS NULL */ - { 252, -4 }, /* (230) expr ::= expr IS NOT NULL */ - { 252, -3 }, /* (231) expr ::= expr LT expr */ - { 252, -3 }, /* (232) expr ::= expr GT expr */ - { 252, -3 }, /* (233) expr ::= expr LE expr */ - { 252, -3 }, /* (234) expr ::= expr GE expr */ - { 252, -3 }, /* (235) expr ::= expr NE expr */ - { 252, -3 }, /* (236) expr ::= expr EQ expr */ - { 252, -5 }, /* (237) expr ::= expr BETWEEN expr AND expr */ - { 252, -3 }, /* (238) expr ::= expr AND expr */ - { 252, -3 }, /* (239) expr ::= expr OR expr */ - { 252, -3 }, /* (240) expr ::= expr PLUS expr */ - { 252, -3 }, /* (241) expr ::= expr MINUS expr */ - { 252, -3 }, /* (242) expr ::= expr STAR expr */ - { 252, -3 }, /* (243) expr ::= expr SLASH expr */ - { 252, -3 }, /* (244) expr ::= expr REM expr */ - { 252, -3 }, /* (245) expr ::= expr LIKE expr */ - { 252, -5 }, /* (246) expr ::= expr IN LP exprlist RP */ - { 261, -3 }, /* (247) exprlist ::= exprlist COMMA expritem */ - { 261, -1 }, /* (248) exprlist ::= expritem */ - { 262, -1 }, /* (249) expritem ::= expr */ - { 262, 0 }, /* (250) expritem ::= */ - { 189, -3 }, /* (251) cmd ::= RESET QUERY CACHE */ - { 189, -3 }, /* (252) cmd ::= SYNCDB ids REPLICA */ - { 189, -7 }, /* (253) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 189, -7 }, /* (254) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 189, -7 }, /* (255) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 189, -7 }, /* (256) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 189, -8 }, /* (257) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 189, -9 }, /* (258) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 189, -7 }, /* (259) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 189, -7 }, /* (260) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 189, -7 }, /* (261) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 189, -7 }, /* (262) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 189, -8 }, /* (263) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 189, -3 }, /* (264) cmd ::= KILL CONNECTION INTEGER */ - { 189, -5 }, /* (265) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 189, -5 }, /* (266) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +** of that rule */ +static const YYCODETYPE yyRuleInfoLhs[] = { + 187, /* (0) program ::= cmd */ + 188, /* (1) cmd ::= SHOW DATABASES */ + 188, /* (2) cmd ::= SHOW TOPICS */ + 188, /* (3) cmd ::= SHOW MNODES */ + 188, /* (4) cmd ::= SHOW DNODES */ + 188, /* (5) cmd ::= SHOW ACCOUNTS */ + 188, /* (6) cmd ::= SHOW USERS */ + 188, /* (7) cmd ::= SHOW MODULES */ + 188, /* (8) cmd ::= SHOW QUERIES */ + 188, /* (9) cmd ::= SHOW CONNECTIONS */ + 188, /* (10) cmd ::= SHOW STREAMS */ + 188, /* (11) cmd ::= SHOW VARIABLES */ + 188, /* (12) cmd ::= SHOW SCORES */ + 188, /* (13) cmd ::= SHOW GRANTS */ + 188, /* (14) cmd ::= SHOW VNODES */ + 188, /* (15) cmd ::= SHOW VNODES IPTOKEN */ + 189, /* (16) dbPrefix ::= */ + 189, /* (17) dbPrefix ::= ids DOT */ + 191, /* (18) cpxName ::= */ + 191, /* (19) cpxName ::= DOT ids */ + 188, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ + 188, /* (21) cmd ::= SHOW CREATE DATABASE ids */ + 188, /* (22) cmd ::= SHOW dbPrefix TABLES */ + 188, /* (23) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + 188, /* (24) cmd ::= SHOW dbPrefix STABLES */ + 188, /* (25) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + 188, /* (26) cmd ::= SHOW dbPrefix VGROUPS */ + 188, /* (27) cmd ::= SHOW dbPrefix VGROUPS ids */ + 188, /* (28) cmd ::= DROP TABLE ifexists ids cpxName */ + 188, /* (29) cmd ::= DROP STABLE ifexists ids cpxName */ + 188, /* (30) cmd ::= DROP DATABASE ifexists ids */ + 188, /* (31) cmd ::= DROP TOPIC ifexists ids */ + 188, /* (32) cmd ::= DROP DNODE ids */ + 188, /* (33) cmd ::= DROP USER ids */ + 188, /* (34) cmd ::= DROP ACCOUNT ids */ + 188, /* (35) cmd ::= USE ids */ + 188, /* (36) cmd ::= DESCRIBE ids cpxName */ + 188, /* (37) cmd ::= ALTER USER ids PASS ids */ + 188, /* (38) cmd ::= ALTER USER ids PRIVILEGE ids */ + 188, /* (39) cmd ::= ALTER DNODE ids ids */ + 188, /* (40) cmd ::= ALTER DNODE ids ids ids */ + 188, /* (41) cmd ::= ALTER LOCAL ids */ + 188, /* (42) cmd ::= ALTER LOCAL ids ids */ + 188, /* (43) cmd ::= ALTER DATABASE ids alter_db_optr */ + 188, /* (44) cmd ::= ALTER TOPIC ids alter_topic_optr */ + 188, /* (45) cmd ::= ALTER ACCOUNT ids acct_optr */ + 188, /* (46) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + 190, /* (47) ids ::= ID */ + 190, /* (48) ids ::= STRING */ + 192, /* (49) ifexists ::= IF EXISTS */ + 192, /* (50) ifexists ::= */ + 196, /* (51) ifnotexists ::= IF NOT EXISTS */ + 196, /* (52) ifnotexists ::= */ + 188, /* (53) cmd ::= CREATE DNODE ids */ + 188, /* (54) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + 188, /* (55) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + 188, /* (56) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + 188, /* (57) cmd ::= CREATE USER ids PASS ids */ + 199, /* (58) pps ::= */ + 199, /* (59) pps ::= PPS INTEGER */ + 200, /* (60) tseries ::= */ + 200, /* (61) tseries ::= TSERIES INTEGER */ + 201, /* (62) dbs ::= */ + 201, /* (63) dbs ::= DBS INTEGER */ + 202, /* (64) streams ::= */ + 202, /* (65) streams ::= STREAMS INTEGER */ + 203, /* (66) storage ::= */ + 203, /* (67) storage ::= STORAGE INTEGER */ + 204, /* (68) qtime ::= */ + 204, /* (69) qtime ::= QTIME INTEGER */ + 205, /* (70) users ::= */ + 205, /* (71) users ::= USERS INTEGER */ + 206, /* (72) conns ::= */ + 206, /* (73) conns ::= CONNS INTEGER */ + 207, /* (74) state ::= */ + 207, /* (75) state ::= STATE ids */ + 195, /* (76) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + 208, /* (77) keep ::= KEEP tagitemlist */ + 210, /* (78) cache ::= CACHE INTEGER */ + 211, /* (79) replica ::= REPLICA INTEGER */ + 212, /* (80) quorum ::= QUORUM INTEGER */ + 213, /* (81) days ::= DAYS INTEGER */ + 214, /* (82) minrows ::= MINROWS INTEGER */ + 215, /* (83) maxrows ::= MAXROWS INTEGER */ + 216, /* (84) blocks ::= BLOCKS INTEGER */ + 217, /* (85) ctime ::= CTIME INTEGER */ + 218, /* (86) wal ::= WAL INTEGER */ + 219, /* (87) fsync ::= FSYNC INTEGER */ + 220, /* (88) comp ::= COMP INTEGER */ + 221, /* (89) prec ::= PRECISION STRING */ + 222, /* (90) update ::= UPDATE INTEGER */ + 223, /* (91) cachelast ::= CACHELAST INTEGER */ + 224, /* (92) partitions ::= PARTITIONS INTEGER */ + 197, /* (93) db_optr ::= */ + 197, /* (94) db_optr ::= db_optr cache */ + 197, /* (95) db_optr ::= db_optr replica */ + 197, /* (96) db_optr ::= db_optr quorum */ + 197, /* (97) db_optr ::= db_optr days */ + 197, /* (98) db_optr ::= db_optr minrows */ + 197, /* (99) db_optr ::= db_optr maxrows */ + 197, /* (100) db_optr ::= db_optr blocks */ + 197, /* (101) db_optr ::= db_optr ctime */ + 197, /* (102) db_optr ::= db_optr wal */ + 197, /* (103) db_optr ::= db_optr fsync */ + 197, /* (104) db_optr ::= db_optr comp */ + 197, /* (105) db_optr ::= db_optr prec */ + 197, /* (106) db_optr ::= db_optr keep */ + 197, /* (107) db_optr ::= db_optr update */ + 197, /* (108) db_optr ::= db_optr cachelast */ + 198, /* (109) topic_optr ::= db_optr */ + 198, /* (110) topic_optr ::= topic_optr partitions */ + 193, /* (111) alter_db_optr ::= */ + 193, /* (112) alter_db_optr ::= alter_db_optr replica */ + 193, /* (113) alter_db_optr ::= alter_db_optr quorum */ + 193, /* (114) alter_db_optr ::= alter_db_optr keep */ + 193, /* (115) alter_db_optr ::= alter_db_optr blocks */ + 193, /* (116) alter_db_optr ::= alter_db_optr comp */ + 193, /* (117) alter_db_optr ::= alter_db_optr wal */ + 193, /* (118) alter_db_optr ::= alter_db_optr fsync */ + 193, /* (119) alter_db_optr ::= alter_db_optr update */ + 193, /* (120) alter_db_optr ::= alter_db_optr cachelast */ + 194, /* (121) alter_topic_optr ::= alter_db_optr */ + 194, /* (122) alter_topic_optr ::= alter_topic_optr partitions */ + 225, /* (123) typename ::= ids */ + 225, /* (124) typename ::= ids LP signed RP */ + 225, /* (125) typename ::= ids UNSIGNED */ + 226, /* (126) signed ::= INTEGER */ + 226, /* (127) signed ::= PLUS INTEGER */ + 226, /* (128) signed ::= MINUS INTEGER */ + 188, /* (129) cmd ::= CREATE TABLE create_table_args */ + 188, /* (130) cmd ::= CREATE TABLE create_stable_args */ + 188, /* (131) cmd ::= CREATE STABLE create_stable_args */ + 188, /* (132) cmd ::= CREATE TABLE create_table_list */ + 229, /* (133) create_table_list ::= create_from_stable */ + 229, /* (134) create_table_list ::= create_table_list create_from_stable */ + 227, /* (135) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + 228, /* (136) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + 230, /* (137) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + 230, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + 232, /* (139) tagNamelist ::= tagNamelist COMMA ids */ + 232, /* (140) tagNamelist ::= ids */ + 227, /* (141) create_table_args ::= ifnotexists ids cpxName AS select */ + 231, /* (142) columnlist ::= columnlist COMMA column */ + 231, /* (143) columnlist ::= column */ + 234, /* (144) column ::= ids typename */ + 209, /* (145) tagitemlist ::= tagitemlist COMMA tagitem */ + 209, /* (146) tagitemlist ::= tagitem */ + 235, /* (147) tagitem ::= INTEGER */ + 235, /* (148) tagitem ::= FLOAT */ + 235, /* (149) tagitem ::= STRING */ + 235, /* (150) tagitem ::= BOOL */ + 235, /* (151) tagitem ::= NULL */ + 235, /* (152) tagitem ::= MINUS INTEGER */ + 235, /* (153) tagitem ::= MINUS FLOAT */ + 235, /* (154) tagitem ::= PLUS INTEGER */ + 235, /* (155) tagitem ::= PLUS FLOAT */ + 233, /* (156) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + 233, /* (157) select ::= LP select RP */ + 248, /* (158) union ::= select */ + 248, /* (159) union ::= union UNION ALL select */ + 188, /* (160) cmd ::= union */ + 233, /* (161) select ::= SELECT selcollist */ + 249, /* (162) sclp ::= selcollist COMMA */ + 249, /* (163) sclp ::= */ + 236, /* (164) selcollist ::= sclp distinct expr as */ + 236, /* (165) selcollist ::= sclp STAR */ + 252, /* (166) as ::= AS ids */ + 252, /* (167) as ::= ids */ + 252, /* (168) as ::= */ + 250, /* (169) distinct ::= DISTINCT */ + 250, /* (170) distinct ::= */ + 237, /* (171) from ::= FROM tablelist */ + 237, /* (172) from ::= FROM LP union RP */ + 253, /* (173) tablelist ::= ids cpxName */ + 253, /* (174) tablelist ::= ids cpxName ids */ + 253, /* (175) tablelist ::= tablelist COMMA ids cpxName */ + 253, /* (176) tablelist ::= tablelist COMMA ids cpxName ids */ + 254, /* (177) tmvar ::= VARIABLE */ + 239, /* (178) interval_opt ::= INTERVAL LP tmvar RP */ + 239, /* (179) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + 239, /* (180) interval_opt ::= */ + 240, /* (181) session_option ::= */ + 240, /* (182) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 241, /* (183) fill_opt ::= */ + 241, /* (184) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 241, /* (185) fill_opt ::= FILL LP ID RP */ + 242, /* (186) sliding_opt ::= SLIDING LP tmvar RP */ + 242, /* (187) sliding_opt ::= */ + 244, /* (188) orderby_opt ::= */ + 244, /* (189) orderby_opt ::= ORDER BY sortlist */ + 255, /* (190) sortlist ::= sortlist COMMA item sortorder */ + 255, /* (191) sortlist ::= item sortorder */ + 257, /* (192) item ::= ids cpxName */ + 258, /* (193) sortorder ::= ASC */ + 258, /* (194) sortorder ::= DESC */ + 258, /* (195) sortorder ::= */ + 243, /* (196) groupby_opt ::= */ + 243, /* (197) groupby_opt ::= GROUP BY grouplist */ + 259, /* (198) grouplist ::= grouplist COMMA item */ + 259, /* (199) grouplist ::= item */ + 245, /* (200) having_opt ::= */ + 245, /* (201) having_opt ::= HAVING expr */ + 247, /* (202) limit_opt ::= */ + 247, /* (203) limit_opt ::= LIMIT signed */ + 247, /* (204) limit_opt ::= LIMIT signed OFFSET signed */ + 247, /* (205) limit_opt ::= LIMIT signed COMMA signed */ + 246, /* (206) slimit_opt ::= */ + 246, /* (207) slimit_opt ::= SLIMIT signed */ + 246, /* (208) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 246, /* (209) slimit_opt ::= SLIMIT signed COMMA signed */ + 238, /* (210) where_opt ::= */ + 238, /* (211) where_opt ::= WHERE expr */ + 251, /* (212) expr ::= LP expr RP */ + 251, /* (213) expr ::= ID */ + 251, /* (214) expr ::= ID DOT ID */ + 251, /* (215) expr ::= ID DOT STAR */ + 251, /* (216) expr ::= INTEGER */ + 251, /* (217) expr ::= MINUS INTEGER */ + 251, /* (218) expr ::= PLUS INTEGER */ + 251, /* (219) expr ::= FLOAT */ + 251, /* (220) expr ::= MINUS FLOAT */ + 251, /* (221) expr ::= PLUS FLOAT */ + 251, /* (222) expr ::= STRING */ + 251, /* (223) expr ::= NOW */ + 251, /* (224) expr ::= VARIABLE */ + 251, /* (225) expr ::= BOOL */ + 251, /* (226) expr ::= NULL */ + 251, /* (227) expr ::= ID LP exprlist RP */ + 251, /* (228) expr ::= ID LP STAR RP */ + 251, /* (229) expr ::= expr IS NULL */ + 251, /* (230) expr ::= expr IS NOT NULL */ + 251, /* (231) expr ::= expr LT expr */ + 251, /* (232) expr ::= expr GT expr */ + 251, /* (233) expr ::= expr LE expr */ + 251, /* (234) expr ::= expr GE expr */ + 251, /* (235) expr ::= expr NE expr */ + 251, /* (236) expr ::= expr EQ expr */ + 251, /* (237) expr ::= expr BETWEEN expr AND expr */ + 251, /* (238) expr ::= expr AND expr */ + 251, /* (239) expr ::= expr OR expr */ + 251, /* (240) expr ::= expr PLUS expr */ + 251, /* (241) expr ::= expr MINUS expr */ + 251, /* (242) expr ::= expr STAR expr */ + 251, /* (243) expr ::= expr SLASH expr */ + 251, /* (244) expr ::= expr REM expr */ + 251, /* (245) expr ::= expr LIKE expr */ + 251, /* (246) expr ::= expr IN LP exprlist RP */ + 260, /* (247) exprlist ::= exprlist COMMA expritem */ + 260, /* (248) exprlist ::= expritem */ + 261, /* (249) expritem ::= expr */ + 261, /* (250) expritem ::= */ + 188, /* (251) cmd ::= RESET QUERY CACHE */ + 188, /* (252) cmd ::= SYNCDB ids REPLICA */ + 188, /* (253) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 188, /* (254) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 188, /* (255) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 188, /* (256) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 188, /* (257) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 188, /* (258) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 188, /* (259) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 188, /* (260) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 188, /* (261) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 188, /* (262) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 188, /* (263) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 188, /* (264) cmd ::= KILL CONNECTION INTEGER */ + 188, /* (265) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 188, /* (266) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +}; + +/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number +** of symbols on the right-hand side of that rule. */ +static const signed char yyRuleInfoNRhs[] = { + -1, /* (0) program ::= cmd */ + -2, /* (1) cmd ::= SHOW DATABASES */ + -2, /* (2) cmd ::= SHOW TOPICS */ + -2, /* (3) cmd ::= SHOW MNODES */ + -2, /* (4) cmd ::= SHOW DNODES */ + -2, /* (5) cmd ::= SHOW ACCOUNTS */ + -2, /* (6) cmd ::= SHOW USERS */ + -2, /* (7) cmd ::= SHOW MODULES */ + -2, /* (8) cmd ::= SHOW QUERIES */ + -2, /* (9) cmd ::= SHOW CONNECTIONS */ + -2, /* (10) cmd ::= SHOW STREAMS */ + -2, /* (11) cmd ::= SHOW VARIABLES */ + -2, /* (12) cmd ::= SHOW SCORES */ + -2, /* (13) cmd ::= SHOW GRANTS */ + -2, /* (14) cmd ::= SHOW VNODES */ + -3, /* (15) cmd ::= SHOW VNODES IPTOKEN */ + 0, /* (16) dbPrefix ::= */ + -2, /* (17) dbPrefix ::= ids DOT */ + 0, /* (18) cpxName ::= */ + -2, /* (19) cpxName ::= DOT ids */ + -5, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ + -4, /* (21) cmd ::= SHOW CREATE DATABASE ids */ + -3, /* (22) cmd ::= SHOW dbPrefix TABLES */ + -5, /* (23) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + -3, /* (24) cmd ::= SHOW dbPrefix STABLES */ + -5, /* (25) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + -3, /* (26) cmd ::= SHOW dbPrefix VGROUPS */ + -4, /* (27) cmd ::= SHOW dbPrefix VGROUPS ids */ + -5, /* (28) cmd ::= DROP TABLE ifexists ids cpxName */ + -5, /* (29) cmd ::= DROP STABLE ifexists ids cpxName */ + -4, /* (30) cmd ::= DROP DATABASE ifexists ids */ + -4, /* (31) cmd ::= DROP TOPIC ifexists ids */ + -3, /* (32) cmd ::= DROP DNODE ids */ + -3, /* (33) cmd ::= DROP USER ids */ + -3, /* (34) cmd ::= DROP ACCOUNT ids */ + -2, /* (35) cmd ::= USE ids */ + -3, /* (36) cmd ::= DESCRIBE ids cpxName */ + -5, /* (37) cmd ::= ALTER USER ids PASS ids */ + -5, /* (38) cmd ::= ALTER USER ids PRIVILEGE ids */ + -4, /* (39) cmd ::= ALTER DNODE ids ids */ + -5, /* (40) cmd ::= ALTER DNODE ids ids ids */ + -3, /* (41) cmd ::= ALTER LOCAL ids */ + -4, /* (42) cmd ::= ALTER LOCAL ids ids */ + -4, /* (43) cmd ::= ALTER DATABASE ids alter_db_optr */ + -4, /* (44) cmd ::= ALTER TOPIC ids alter_topic_optr */ + -4, /* (45) cmd ::= ALTER ACCOUNT ids acct_optr */ + -6, /* (46) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + -1, /* (47) ids ::= ID */ + -1, /* (48) ids ::= STRING */ + -2, /* (49) ifexists ::= IF EXISTS */ + 0, /* (50) ifexists ::= */ + -3, /* (51) ifnotexists ::= IF NOT EXISTS */ + 0, /* (52) ifnotexists ::= */ + -3, /* (53) cmd ::= CREATE DNODE ids */ + -6, /* (54) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + -5, /* (55) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + -5, /* (56) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + -5, /* (57) cmd ::= CREATE USER ids PASS ids */ + 0, /* (58) pps ::= */ + -2, /* (59) pps ::= PPS INTEGER */ + 0, /* (60) tseries ::= */ + -2, /* (61) tseries ::= TSERIES INTEGER */ + 0, /* (62) dbs ::= */ + -2, /* (63) dbs ::= DBS INTEGER */ + 0, /* (64) streams ::= */ + -2, /* (65) streams ::= STREAMS INTEGER */ + 0, /* (66) storage ::= */ + -2, /* (67) storage ::= STORAGE INTEGER */ + 0, /* (68) qtime ::= */ + -2, /* (69) qtime ::= QTIME INTEGER */ + 0, /* (70) users ::= */ + -2, /* (71) users ::= USERS INTEGER */ + 0, /* (72) conns ::= */ + -2, /* (73) conns ::= CONNS INTEGER */ + 0, /* (74) state ::= */ + -2, /* (75) state ::= STATE ids */ + -9, /* (76) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + -2, /* (77) keep ::= KEEP tagitemlist */ + -2, /* (78) cache ::= CACHE INTEGER */ + -2, /* (79) replica ::= REPLICA INTEGER */ + -2, /* (80) quorum ::= QUORUM INTEGER */ + -2, /* (81) days ::= DAYS INTEGER */ + -2, /* (82) minrows ::= MINROWS INTEGER */ + -2, /* (83) maxrows ::= MAXROWS INTEGER */ + -2, /* (84) blocks ::= BLOCKS INTEGER */ + -2, /* (85) ctime ::= CTIME INTEGER */ + -2, /* (86) wal ::= WAL INTEGER */ + -2, /* (87) fsync ::= FSYNC INTEGER */ + -2, /* (88) comp ::= COMP INTEGER */ + -2, /* (89) prec ::= PRECISION STRING */ + -2, /* (90) update ::= UPDATE INTEGER */ + -2, /* (91) cachelast ::= CACHELAST INTEGER */ + -2, /* (92) partitions ::= PARTITIONS INTEGER */ + 0, /* (93) db_optr ::= */ + -2, /* (94) db_optr ::= db_optr cache */ + -2, /* (95) db_optr ::= db_optr replica */ + -2, /* (96) db_optr ::= db_optr quorum */ + -2, /* (97) db_optr ::= db_optr days */ + -2, /* (98) db_optr ::= db_optr minrows */ + -2, /* (99) db_optr ::= db_optr maxrows */ + -2, /* (100) db_optr ::= db_optr blocks */ + -2, /* (101) db_optr ::= db_optr ctime */ + -2, /* (102) db_optr ::= db_optr wal */ + -2, /* (103) db_optr ::= db_optr fsync */ + -2, /* (104) db_optr ::= db_optr comp */ + -2, /* (105) db_optr ::= db_optr prec */ + -2, /* (106) db_optr ::= db_optr keep */ + -2, /* (107) db_optr ::= db_optr update */ + -2, /* (108) db_optr ::= db_optr cachelast */ + -1, /* (109) topic_optr ::= db_optr */ + -2, /* (110) topic_optr ::= topic_optr partitions */ + 0, /* (111) alter_db_optr ::= */ + -2, /* (112) alter_db_optr ::= alter_db_optr replica */ + -2, /* (113) alter_db_optr ::= alter_db_optr quorum */ + -2, /* (114) alter_db_optr ::= alter_db_optr keep */ + -2, /* (115) alter_db_optr ::= alter_db_optr blocks */ + -2, /* (116) alter_db_optr ::= alter_db_optr comp */ + -2, /* (117) alter_db_optr ::= alter_db_optr wal */ + -2, /* (118) alter_db_optr ::= alter_db_optr fsync */ + -2, /* (119) alter_db_optr ::= alter_db_optr update */ + -2, /* (120) alter_db_optr ::= alter_db_optr cachelast */ + -1, /* (121) alter_topic_optr ::= alter_db_optr */ + -2, /* (122) alter_topic_optr ::= alter_topic_optr partitions */ + -1, /* (123) typename ::= ids */ + -4, /* (124) typename ::= ids LP signed RP */ + -2, /* (125) typename ::= ids UNSIGNED */ + -1, /* (126) signed ::= INTEGER */ + -2, /* (127) signed ::= PLUS INTEGER */ + -2, /* (128) signed ::= MINUS INTEGER */ + -3, /* (129) cmd ::= CREATE TABLE create_table_args */ + -3, /* (130) cmd ::= CREATE TABLE create_stable_args */ + -3, /* (131) cmd ::= CREATE STABLE create_stable_args */ + -3, /* (132) cmd ::= CREATE TABLE create_table_list */ + -1, /* (133) create_table_list ::= create_from_stable */ + -2, /* (134) create_table_list ::= create_table_list create_from_stable */ + -6, /* (135) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + -10, /* (136) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + -10, /* (137) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + -13, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + -3, /* (139) tagNamelist ::= tagNamelist COMMA ids */ + -1, /* (140) tagNamelist ::= ids */ + -5, /* (141) create_table_args ::= ifnotexists ids cpxName AS select */ + -3, /* (142) columnlist ::= columnlist COMMA column */ + -1, /* (143) columnlist ::= column */ + -2, /* (144) column ::= ids typename */ + -3, /* (145) tagitemlist ::= tagitemlist COMMA tagitem */ + -1, /* (146) tagitemlist ::= tagitem */ + -1, /* (147) tagitem ::= INTEGER */ + -1, /* (148) tagitem ::= FLOAT */ + -1, /* (149) tagitem ::= STRING */ + -1, /* (150) tagitem ::= BOOL */ + -1, /* (151) tagitem ::= NULL */ + -2, /* (152) tagitem ::= MINUS INTEGER */ + -2, /* (153) tagitem ::= MINUS FLOAT */ + -2, /* (154) tagitem ::= PLUS INTEGER */ + -2, /* (155) tagitem ::= PLUS FLOAT */ + -13, /* (156) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + -3, /* (157) select ::= LP select RP */ + -1, /* (158) union ::= select */ + -4, /* (159) union ::= union UNION ALL select */ + -1, /* (160) cmd ::= union */ + -2, /* (161) select ::= SELECT selcollist */ + -2, /* (162) sclp ::= selcollist COMMA */ + 0, /* (163) sclp ::= */ + -4, /* (164) selcollist ::= sclp distinct expr as */ + -2, /* (165) selcollist ::= sclp STAR */ + -2, /* (166) as ::= AS ids */ + -1, /* (167) as ::= ids */ + 0, /* (168) as ::= */ + -1, /* (169) distinct ::= DISTINCT */ + 0, /* (170) distinct ::= */ + -2, /* (171) from ::= FROM tablelist */ + -4, /* (172) from ::= FROM LP union RP */ + -2, /* (173) tablelist ::= ids cpxName */ + -3, /* (174) tablelist ::= ids cpxName ids */ + -4, /* (175) tablelist ::= tablelist COMMA ids cpxName */ + -5, /* (176) tablelist ::= tablelist COMMA ids cpxName ids */ + -1, /* (177) tmvar ::= VARIABLE */ + -4, /* (178) interval_opt ::= INTERVAL LP tmvar RP */ + -6, /* (179) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + 0, /* (180) interval_opt ::= */ + 0, /* (181) session_option ::= */ + -7, /* (182) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 0, /* (183) fill_opt ::= */ + -6, /* (184) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + -4, /* (185) fill_opt ::= FILL LP ID RP */ + -4, /* (186) sliding_opt ::= SLIDING LP tmvar RP */ + 0, /* (187) sliding_opt ::= */ + 0, /* (188) orderby_opt ::= */ + -3, /* (189) orderby_opt ::= ORDER BY sortlist */ + -4, /* (190) sortlist ::= sortlist COMMA item sortorder */ + -2, /* (191) sortlist ::= item sortorder */ + -2, /* (192) item ::= ids cpxName */ + -1, /* (193) sortorder ::= ASC */ + -1, /* (194) sortorder ::= DESC */ + 0, /* (195) sortorder ::= */ + 0, /* (196) groupby_opt ::= */ + -3, /* (197) groupby_opt ::= GROUP BY grouplist */ + -3, /* (198) grouplist ::= grouplist COMMA item */ + -1, /* (199) grouplist ::= item */ + 0, /* (200) having_opt ::= */ + -2, /* (201) having_opt ::= HAVING expr */ + 0, /* (202) limit_opt ::= */ + -2, /* (203) limit_opt ::= LIMIT signed */ + -4, /* (204) limit_opt ::= LIMIT signed OFFSET signed */ + -4, /* (205) limit_opt ::= LIMIT signed COMMA signed */ + 0, /* (206) slimit_opt ::= */ + -2, /* (207) slimit_opt ::= SLIMIT signed */ + -4, /* (208) slimit_opt ::= SLIMIT signed SOFFSET signed */ + -4, /* (209) slimit_opt ::= SLIMIT signed COMMA signed */ + 0, /* (210) where_opt ::= */ + -2, /* (211) where_opt ::= WHERE expr */ + -3, /* (212) expr ::= LP expr RP */ + -1, /* (213) expr ::= ID */ + -3, /* (214) expr ::= ID DOT ID */ + -3, /* (215) expr ::= ID DOT STAR */ + -1, /* (216) expr ::= INTEGER */ + -2, /* (217) expr ::= MINUS INTEGER */ + -2, /* (218) expr ::= PLUS INTEGER */ + -1, /* (219) expr ::= FLOAT */ + -2, /* (220) expr ::= MINUS FLOAT */ + -2, /* (221) expr ::= PLUS FLOAT */ + -1, /* (222) expr ::= STRING */ + -1, /* (223) expr ::= NOW */ + -1, /* (224) expr ::= VARIABLE */ + -1, /* (225) expr ::= BOOL */ + -1, /* (226) expr ::= NULL */ + -4, /* (227) expr ::= ID LP exprlist RP */ + -4, /* (228) expr ::= ID LP STAR RP */ + -3, /* (229) expr ::= expr IS NULL */ + -4, /* (230) expr ::= expr IS NOT NULL */ + -3, /* (231) expr ::= expr LT expr */ + -3, /* (232) expr ::= expr GT expr */ + -3, /* (233) expr ::= expr LE expr */ + -3, /* (234) expr ::= expr GE expr */ + -3, /* (235) expr ::= expr NE expr */ + -3, /* (236) expr ::= expr EQ expr */ + -5, /* (237) expr ::= expr BETWEEN expr AND expr */ + -3, /* (238) expr ::= expr AND expr */ + -3, /* (239) expr ::= expr OR expr */ + -3, /* (240) expr ::= expr PLUS expr */ + -3, /* (241) expr ::= expr MINUS expr */ + -3, /* (242) expr ::= expr STAR expr */ + -3, /* (243) expr ::= expr SLASH expr */ + -3, /* (244) expr ::= expr REM expr */ + -3, /* (245) expr ::= expr LIKE expr */ + -5, /* (246) expr ::= expr IN LP exprlist RP */ + -3, /* (247) exprlist ::= exprlist COMMA expritem */ + -1, /* (248) exprlist ::= expritem */ + -1, /* (249) expritem ::= expr */ + 0, /* (250) expritem ::= */ + -3, /* (251) cmd ::= RESET QUERY CACHE */ + -3, /* (252) cmd ::= SYNCDB ids REPLICA */ + -7, /* (253) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (254) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (255) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (256) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (257) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (258) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (259) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (260) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (261) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (262) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (263) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -3, /* (264) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (265) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (266) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2026,30 +2310,34 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ -static void yy_reduce( +static YYACTIONTYPE yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ - int yyact; /* The next action */ + YYACTIONTYPE yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; + ParseARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfo[yyruleno].nrhs; + yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno); + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -2067,13 +2355,19 @@ static void yy_reduce( #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } #else if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } yymsp = yypParser->yytos; } @@ -2258,13 +2552,13 @@ static void yy_reduce( break; case 43: /* cmd ::= ALTER DATABASE ids alter_db_optr */ case 44: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==44); -{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy322, &t);} +{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy94, &t);} break; case 45: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy351);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy419);} break; case 46: /* 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.yy351);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy419);} break; case 47: /* ids ::= ID */ case 48: /* ids ::= STRING */ yytestcase(yyruleno==48); @@ -2286,11 +2580,11 @@ static void yy_reduce( { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 54: /* 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.yy351);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy419);} break; case 55: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ case 56: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==56); -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy322, &yymsp[-2].minor.yy0);} +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy94, &yymsp[-2].minor.yy0);} break; case 57: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2319,20 +2613,20 @@ static void yy_reduce( break; case 76: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy351.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy351.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy351.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy351.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy351.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy351.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy351.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy351.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy351.stat = yymsp[0].minor.yy0; -} - yymsp[-8].minor.yy351 = yylhsminor.yy351; + yylhsminor.yy419.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy419.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy419.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy419.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy419.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy419.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy419.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy419.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy419.stat = yymsp[0].minor.yy0; +} + yymsp[-8].minor.yy419 = yylhsminor.yy419; break; case 77: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy159 = yymsp[0].minor.yy159; } +{ yymsp[-1].minor.yy429 = yymsp[0].minor.yy429; } break; case 78: /* cache ::= CACHE INTEGER */ case 79: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==79); @@ -2352,234 +2646,234 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 93: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy322); yymsp[1].minor.yy322.dbType = TSDB_DB_TYPE_DEFAULT;} +{setDefaultCreateDbOption(&yymsp[1].minor.yy94); yymsp[1].minor.yy94.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 94: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 95: /* db_optr ::= db_optr replica */ case 112: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==112); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 96: /* db_optr ::= db_optr quorum */ case 113: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==113); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 97: /* db_optr ::= db_optr days */ -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 98: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 99: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 100: /* db_optr ::= db_optr blocks */ case 115: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==115); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 101: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 102: /* db_optr ::= db_optr wal */ case 117: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==117); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 103: /* db_optr ::= db_optr fsync */ case 118: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==118); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 104: /* db_optr ::= db_optr comp */ case 116: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==116); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 105: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 106: /* db_optr ::= db_optr keep */ case 114: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==114); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.keep = yymsp[0].minor.yy159; } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.keep = yymsp[0].minor.yy429; } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 107: /* db_optr ::= db_optr update */ case 119: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==119); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 108: /* db_optr ::= db_optr cachelast */ case 120: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==120); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 109: /* topic_optr ::= db_optr */ case 121: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==121); -{ yylhsminor.yy322 = yymsp[0].minor.yy322; yylhsminor.yy322.dbType = TSDB_DB_TYPE_TOPIC; } - yymsp[0].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[0].minor.yy94; yylhsminor.yy94.dbType = TSDB_DB_TYPE_TOPIC; } + yymsp[0].minor.yy94 = yylhsminor.yy94; break; case 110: /* topic_optr ::= topic_optr partitions */ case 122: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==122); -{ yylhsminor.yy322 = yymsp[-1].minor.yy322; yylhsminor.yy322.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy322 = yylhsminor.yy322; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 111: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy322); yymsp[1].minor.yy322.dbType = TSDB_DB_TYPE_DEFAULT;} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy94); yymsp[1].minor.yy94.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 123: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSetColumnType (&yylhsminor.yy407, &yymsp[0].minor.yy0); + tSetColumnType (&yylhsminor.yy451, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy407 = yylhsminor.yy407; + yymsp[0].minor.yy451 = yylhsminor.yy451; break; case 124: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy317 <= 0) { + if (yymsp[-1].minor.yy481 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSetColumnType(&yylhsminor.yy407, &yymsp[-3].minor.yy0); + tSetColumnType(&yylhsminor.yy451, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy317; // negative value of name length - tSetColumnType(&yylhsminor.yy407, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy481; // negative value of name length + tSetColumnType(&yylhsminor.yy451, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy407 = yylhsminor.yy407; + yymsp[-3].minor.yy451 = yylhsminor.yy451; break; case 125: /* 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); - tSetColumnType (&yylhsminor.yy407, &yymsp[-1].minor.yy0); + tSetColumnType (&yylhsminor.yy451, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy407 = yylhsminor.yy407; + yymsp[-1].minor.yy451 = yylhsminor.yy451; break; case 126: /* signed ::= INTEGER */ -{ yylhsminor.yy317 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy317 = yylhsminor.yy317; +{ yylhsminor.yy481 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy481 = yylhsminor.yy481; break; case 127: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy317 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy481 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 128: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy317 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +{ yymsp[-1].minor.yy481 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 132: /* cmd ::= CREATE TABLE create_table_list */ -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy14;} +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy194;} break; case 133: /* create_table_list ::= create_from_stable */ { SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy206); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy252); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yylhsminor.yy14 = pCreateTable; + yylhsminor.yy194 = pCreateTable; } - yymsp[0].minor.yy14 = yylhsminor.yy14; + yymsp[0].minor.yy194 = yylhsminor.yy194; break; case 134: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy14->childTableInfo, &yymsp[0].minor.yy206); - yylhsminor.yy14 = yymsp[-1].minor.yy14; + taosArrayPush(yymsp[-1].minor.yy194->childTableInfo, &yymsp[0].minor.yy252); + yylhsminor.yy194 = yymsp[-1].minor.yy194; } - yymsp[-1].minor.yy14 = yylhsminor.yy14; + yymsp[-1].minor.yy194 = yylhsminor.yy194; break; case 135: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy14 = tSetCreateTableInfo(yymsp[-1].minor.yy159, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy14, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy194 = tSetCreateTableInfo(yymsp[-1].minor.yy429, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy194, 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.yy14 = yylhsminor.yy14; + yymsp[-5].minor.yy194 = yylhsminor.yy194; break; case 136: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy14 = tSetCreateTableInfo(yymsp[-5].minor.yy159, yymsp[-1].minor.yy159, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy14, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy194 = tSetCreateTableInfo(yymsp[-5].minor.yy429, yymsp[-1].minor.yy429, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy194, 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.yy14 = yylhsminor.yy14; + yymsp[-9].minor.yy194 = yylhsminor.yy194; break; case 137: /* 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.yy206 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy159, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy252 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy429, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy206 = yylhsminor.yy206; + yymsp[-9].minor.yy252 = yylhsminor.yy252; break; case 138: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ { yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; - yylhsminor.yy206 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy159, yymsp[-1].minor.yy159, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); + yylhsminor.yy252 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy429, yymsp[-1].minor.yy429, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); } - yymsp[-12].minor.yy206 = yylhsminor.yy206; + yymsp[-12].minor.yy252 = yylhsminor.yy252; break; case 139: /* tagNamelist ::= tagNamelist COMMA ids */ -{taosArrayPush(yymsp[-2].minor.yy159, &yymsp[0].minor.yy0); yylhsminor.yy159 = yymsp[-2].minor.yy159; } - yymsp[-2].minor.yy159 = yylhsminor.yy159; +{taosArrayPush(yymsp[-2].minor.yy429, &yymsp[0].minor.yy0); yylhsminor.yy429 = yymsp[-2].minor.yy429; } + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 140: /* tagNamelist ::= ids */ -{yylhsminor.yy159 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy159, &yymsp[0].minor.yy0);} - yymsp[0].minor.yy159 = yylhsminor.yy159; +{yylhsminor.yy429 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy429, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 141: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy14 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy272, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy14, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy194 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy254, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy194, 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.yy14 = yylhsminor.yy14; + yymsp[-4].minor.yy194 = yylhsminor.yy194; break; case 142: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy159, &yymsp[0].minor.yy407); yylhsminor.yy159 = yymsp[-2].minor.yy159; } - yymsp[-2].minor.yy159 = yylhsminor.yy159; +{taosArrayPush(yymsp[-2].minor.yy429, &yymsp[0].minor.yy451); yylhsminor.yy429 = yymsp[-2].minor.yy429; } + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 143: /* columnlist ::= column */ -{yylhsminor.yy159 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy159, &yymsp[0].minor.yy407);} - yymsp[0].minor.yy159 = yylhsminor.yy159; +{yylhsminor.yy429 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy429, &yymsp[0].minor.yy451);} + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 144: /* column ::= ids typename */ { - tSetColumnInfo(&yylhsminor.yy407, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy407); + tSetColumnInfo(&yylhsminor.yy451, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy451); } - yymsp[-1].minor.yy407 = yylhsminor.yy407; + yymsp[-1].minor.yy451 = yylhsminor.yy451; break; case 145: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy159 = tVariantListAppend(yymsp[-2].minor.yy159, &yymsp[0].minor.yy488, -1); } - yymsp[-2].minor.yy159 = yylhsminor.yy159; +{ yylhsminor.yy429 = tVariantListAppend(yymsp[-2].minor.yy429, &yymsp[0].minor.yy218, -1); } + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 146: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy159 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1); } - yymsp[0].minor.yy159 = yylhsminor.yy159; +{ yylhsminor.yy429 = tVariantListAppend(NULL, &yymsp[0].minor.yy218, -1); } + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 147: /* tagitem ::= INTEGER */ case 148: /* tagitem ::= FLOAT */ yytestcase(yyruleno==148); case 149: /* tagitem ::= STRING */ yytestcase(yyruleno==149); case 150: /* tagitem ::= BOOL */ yytestcase(yyruleno==150); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy218, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy218 = yylhsminor.yy218; break; case 151: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy218, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy218 = yylhsminor.yy218; break; case 152: /* tagitem ::= MINUS INTEGER */ case 153: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==153); @@ -2589,56 +2883,56 @@ 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.yy488, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy218, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy488 = yylhsminor.yy488; + yymsp[-1].minor.yy218 = yylhsminor.yy218; break; case 156: /* select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy272 = tSetQuerySqlNode(&yymsp[-12].minor.yy0, yymsp[-11].minor.yy159, yymsp[-10].minor.yy514, yymsp[-9].minor.yy118, yymsp[-4].minor.yy159, yymsp[-3].minor.yy159, &yymsp[-8].minor.yy184, &yymsp[-7].minor.yy249, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy159, &yymsp[0].minor.yy440, &yymsp[-1].minor.yy440); + yylhsminor.yy254 = tSetQuerySqlNode(&yymsp[-12].minor.yy0, yymsp[-11].minor.yy429, yymsp[-10].minor.yy70, yymsp[-9].minor.yy170, yymsp[-4].minor.yy429, yymsp[-3].minor.yy429, &yymsp[-8].minor.yy220, &yymsp[-7].minor.yy87, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy429, &yymsp[0].minor.yy18, &yymsp[-1].minor.yy18, yymsp[-2].minor.yy170); } - yymsp[-12].minor.yy272 = yylhsminor.yy272; + yymsp[-12].minor.yy254 = yylhsminor.yy254; break; case 157: /* select ::= LP select RP */ -{yymsp[-2].minor.yy272 = yymsp[-1].minor.yy272;} +{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} break; case 158: /* union ::= select */ -{ yylhsminor.yy391 = setSubclause(NULL, yymsp[0].minor.yy272); } - yymsp[0].minor.yy391 = yylhsminor.yy391; +{ yylhsminor.yy141 = setSubclause(NULL, yymsp[0].minor.yy254); } + yymsp[0].minor.yy141 = yylhsminor.yy141; break; case 159: /* union ::= union UNION ALL select */ -{ yylhsminor.yy391 = appendSelectClause(yymsp[-3].minor.yy391, yymsp[0].minor.yy272); } - yymsp[-3].minor.yy391 = yylhsminor.yy391; +{ yylhsminor.yy141 = appendSelectClause(yymsp[-3].minor.yy141, yymsp[0].minor.yy254); } + yymsp[-3].minor.yy141 = yylhsminor.yy141; break; case 160: /* cmd ::= union */ -{ setSqlInfo(pInfo, yymsp[0].minor.yy391, NULL, TSDB_SQL_SELECT); } +{ setSqlInfo(pInfo, yymsp[0].minor.yy141, NULL, TSDB_SQL_SELECT); } break; case 161: /* select ::= SELECT selcollist */ { - yylhsminor.yy272 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy159, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy254 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy429, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy272 = yylhsminor.yy272; + yymsp[-1].minor.yy254 = yylhsminor.yy254; break; case 162: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy159 = yymsp[-1].minor.yy159;} - yymsp[-1].minor.yy159 = yylhsminor.yy159; +{yylhsminor.yy429 = yymsp[-1].minor.yy429;} + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 163: /* sclp ::= */ case 188: /* orderby_opt ::= */ yytestcase(yyruleno==188); -{yymsp[1].minor.yy159 = 0;} +{yymsp[1].minor.yy429 = 0;} break; case 164: /* selcollist ::= sclp distinct expr as */ { - yylhsminor.yy159 = tSqlExprListAppend(yymsp[-3].minor.yy159, yymsp[-1].minor.yy118, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy429 = tSqlExprListAppend(yymsp[-3].minor.yy429, yymsp[-1].minor.yy170, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-3].minor.yy159 = yylhsminor.yy159; + yymsp[-3].minor.yy429 = yylhsminor.yy429; break; case 165: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL); - yylhsminor.yy159 = tSqlExprListAppend(yymsp[-1].minor.yy159, pNode, 0, 0); + yylhsminor.yy429 = tSqlExprListAppend(yymsp[-1].minor.yy429, pNode, 0, 0); } - yymsp[-1].minor.yy159 = yylhsminor.yy159; + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 166: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } @@ -2655,35 +2949,35 @@ static void yy_reduce( yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 171: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy514 = yymsp[0].minor.yy159;} +{yymsp[-1].minor.yy70 = yymsp[0].minor.yy429;} break; case 172: /* from ::= FROM LP union RP */ -{yymsp[-3].minor.yy514 = yymsp[-1].minor.yy391;} +{yymsp[-3].minor.yy70 = yymsp[-1].minor.yy141;} break; case 173: /* tablelist ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy159 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy429 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } - yymsp[-1].minor.yy159 = yylhsminor.yy159; + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 174: /* 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.yy159 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy429 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy159 = yylhsminor.yy159; + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 175: /* tablelist ::= tablelist COMMA ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy159 = setTableNameList(yymsp[-3].minor.yy159, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy429 = setTableNameList(yymsp[-3].minor.yy429, &yymsp[-1].minor.yy0, NULL); } - yymsp[-3].minor.yy159 = yylhsminor.yy159; + yymsp[-3].minor.yy429 = yylhsminor.yy429; break; case 176: /* tablelist ::= tablelist COMMA ids cpxName ids */ { @@ -2691,35 +2985,35 @@ static void yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy159 = setTableNameList(yymsp[-4].minor.yy159, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy429 = setTableNameList(yymsp[-4].minor.yy429, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-4].minor.yy159 = yylhsminor.yy159; + yymsp[-4].minor.yy429 = yylhsminor.yy429; break; case 177: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 178: /* interval_opt ::= INTERVAL LP tmvar RP */ -{yymsp[-3].minor.yy184.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy184.offset.n = 0;} +{yymsp[-3].minor.yy220.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy220.offset.n = 0;} break; case 179: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ -{yymsp[-5].minor.yy184.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy184.offset = yymsp[-1].minor.yy0;} +{yymsp[-5].minor.yy220.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy220.offset = yymsp[-1].minor.yy0;} break; case 180: /* interval_opt ::= */ -{memset(&yymsp[1].minor.yy184, 0, sizeof(yymsp[1].minor.yy184));} +{memset(&yymsp[1].minor.yy220, 0, sizeof(yymsp[1].minor.yy220));} break; case 181: /* session_option ::= */ -{yymsp[1].minor.yy249.col.n = 0; yymsp[1].minor.yy249.gap.n = 0;} +{yymsp[1].minor.yy87.col.n = 0; yymsp[1].minor.yy87.gap.n = 0;} break; case 182: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - yymsp[-6].minor.yy249.col = yymsp[-4].minor.yy0; - yymsp[-6].minor.yy249.gap = yymsp[-1].minor.yy0; + yymsp[-6].minor.yy87.col = yymsp[-4].minor.yy0; + yymsp[-6].minor.yy87.gap = yymsp[-1].minor.yy0; } break; case 183: /* fill_opt ::= */ -{ yymsp[1].minor.yy159 = 0; } +{ yymsp[1].minor.yy429 = 0; } break; case 184: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { @@ -2727,14 +3021,14 @@ static void yy_reduce( toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy159, &A, -1, 0); - yymsp[-5].minor.yy159 = yymsp[-1].minor.yy159; + tVariantListInsert(yymsp[-1].minor.yy429, &A, -1, 0); + yymsp[-5].minor.yy429 = yymsp[-1].minor.yy429; } break; case 185: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy159 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy429 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; case 186: /* sliding_opt ::= SLIDING LP tmvar RP */ @@ -2744,230 +3038,230 @@ static void yy_reduce( {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; case 189: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy159 = yymsp[0].minor.yy159;} +{yymsp[-2].minor.yy429 = yymsp[0].minor.yy429;} break; case 190: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy159 = tVariantListAppend(yymsp[-3].minor.yy159, &yymsp[-1].minor.yy488, yymsp[0].minor.yy20); + yylhsminor.yy429 = tVariantListAppend(yymsp[-3].minor.yy429, &yymsp[-1].minor.yy218, yymsp[0].minor.yy116); } - yymsp[-3].minor.yy159 = yylhsminor.yy159; + yymsp[-3].minor.yy429 = yylhsminor.yy429; break; case 191: /* sortlist ::= item sortorder */ { - yylhsminor.yy159 = tVariantListAppend(NULL, &yymsp[-1].minor.yy488, yymsp[0].minor.yy20); + yylhsminor.yy429 = tVariantListAppend(NULL, &yymsp[-1].minor.yy218, yymsp[0].minor.yy116); } - yymsp[-1].minor.yy159 = yylhsminor.yy159; + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 192: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy488, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy218, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy488 = yylhsminor.yy488; + yymsp[-1].minor.yy218 = yylhsminor.yy218; break; case 193: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy20 = TSDB_ORDER_ASC; } +{ yymsp[0].minor.yy116 = TSDB_ORDER_ASC; } break; case 194: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy20 = TSDB_ORDER_DESC;} +{ yymsp[0].minor.yy116 = TSDB_ORDER_DESC;} break; case 195: /* sortorder ::= */ -{ yymsp[1].minor.yy20 = TSDB_ORDER_ASC; } +{ yymsp[1].minor.yy116 = TSDB_ORDER_ASC; } break; case 196: /* groupby_opt ::= */ -{ yymsp[1].minor.yy159 = 0;} +{ yymsp[1].minor.yy429 = 0;} break; case 197: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy159 = yymsp[0].minor.yy159;} +{ yymsp[-2].minor.yy429 = yymsp[0].minor.yy429;} break; case 198: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy159 = tVariantListAppend(yymsp[-2].minor.yy159, &yymsp[0].minor.yy488, -1); + yylhsminor.yy429 = tVariantListAppend(yymsp[-2].minor.yy429, &yymsp[0].minor.yy218, -1); } - yymsp[-2].minor.yy159 = yylhsminor.yy159; + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 199: /* grouplist ::= item */ { - yylhsminor.yy159 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1); + yylhsminor.yy429 = tVariantListAppend(NULL, &yymsp[0].minor.yy218, -1); } - yymsp[0].minor.yy159 = yylhsminor.yy159; + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 200: /* having_opt ::= */ case 210: /* where_opt ::= */ yytestcase(yyruleno==210); case 250: /* expritem ::= */ yytestcase(yyruleno==250); -{yymsp[1].minor.yy118 = 0;} +{yymsp[1].minor.yy170 = 0;} break; case 201: /* having_opt ::= HAVING expr */ case 211: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==211); -{yymsp[-1].minor.yy118 = yymsp[0].minor.yy118;} +{yymsp[-1].minor.yy170 = yymsp[0].minor.yy170;} break; case 202: /* limit_opt ::= */ case 206: /* slimit_opt ::= */ yytestcase(yyruleno==206); -{yymsp[1].minor.yy440.limit = -1; yymsp[1].minor.yy440.offset = 0;} +{yymsp[1].minor.yy18.limit = -1; yymsp[1].minor.yy18.offset = 0;} break; case 203: /* limit_opt ::= LIMIT signed */ case 207: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==207); -{yymsp[-1].minor.yy440.limit = yymsp[0].minor.yy317; yymsp[-1].minor.yy440.offset = 0;} +{yymsp[-1].minor.yy18.limit = yymsp[0].minor.yy481; yymsp[-1].minor.yy18.offset = 0;} break; case 204: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy440.limit = yymsp[-2].minor.yy317; yymsp[-3].minor.yy440.offset = yymsp[0].minor.yy317;} +{ yymsp[-3].minor.yy18.limit = yymsp[-2].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[0].minor.yy481;} break; case 205: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy440.limit = yymsp[0].minor.yy317; yymsp[-3].minor.yy440.offset = yymsp[-2].minor.yy317;} +{ yymsp[-3].minor.yy18.limit = yymsp[0].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[-2].minor.yy481;} break; case 208: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy440.limit = yymsp[-2].minor.yy317; yymsp[-3].minor.yy440.offset = yymsp[0].minor.yy317;} +{yymsp[-3].minor.yy18.limit = yymsp[-2].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[0].minor.yy481;} break; case 209: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy440.limit = yymsp[0].minor.yy317; yymsp[-3].minor.yy440.offset = yymsp[-2].minor.yy317;} +{yymsp[-3].minor.yy18.limit = yymsp[0].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[-2].minor.yy481;} break; case 212: /* expr ::= LP expr RP */ -{yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy118->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = yymsp[-1].minor.yy170; yylhsminor.yy170->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy170->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 213: /* expr ::= ID */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 214: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 215: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 216: /* expr ::= INTEGER */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 217: /* expr ::= MINUS INTEGER */ case 218: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==218); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy118 = yylhsminor.yy118; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy170 = yylhsminor.yy170; break; case 219: /* expr ::= FLOAT */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 220: /* expr ::= MINUS FLOAT */ case 221: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==221); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy118 = yylhsminor.yy118; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy170 = yylhsminor.yy170; break; case 222: /* expr ::= STRING */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 223: /* expr ::= NOW */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 224: /* expr ::= VARIABLE */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 225: /* expr ::= BOOL */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 226: /* expr ::= NULL */ -{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 227: /* expr ::= ID LP exprlist RP */ -{ yylhsminor.yy118 = tSqlExprCreateFunction(yymsp[-1].minor.yy159, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateFunction(yymsp[-1].minor.yy429, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy170 = yylhsminor.yy170; break; case 228: /* expr ::= ID LP STAR RP */ -{ yylhsminor.yy118 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy118 = yylhsminor.yy118; +{ yylhsminor.yy170 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy170 = yylhsminor.yy170; break; case 229: /* expr ::= expr IS NULL */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, NULL, TK_ISNULL);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, NULL, TK_ISNULL);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 230: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-3].minor.yy118, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-3].minor.yy170, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy170 = yylhsminor.yy170; break; case 231: /* expr ::= expr LT expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LT);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LT);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 232: /* expr ::= expr GT expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_GT);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_GT);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 233: /* expr ::= expr LE expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LE);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 234: /* expr ::= expr GE expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_GE);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_GE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 235: /* expr ::= expr NE expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_NE);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_NE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 236: /* expr ::= expr EQ expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_EQ);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_EQ);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 237: /* expr ::= expr BETWEEN expr AND expr */ -{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy118); yylhsminor.yy118 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy118, yymsp[-2].minor.yy118, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy118, TK_LE), TK_AND);} - yymsp[-4].minor.yy118 = yylhsminor.yy118; +{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy170); yylhsminor.yy170 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy170, yymsp[-2].minor.yy170, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy170, TK_LE), TK_AND);} + yymsp[-4].minor.yy170 = yylhsminor.yy170; break; case 238: /* expr ::= expr AND expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_AND);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_AND);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 239: /* expr ::= expr OR expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_OR); } - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_OR); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 240: /* expr ::= expr PLUS expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_PLUS); } - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_PLUS); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 241: /* expr ::= expr MINUS expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_MINUS); } - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_MINUS); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 242: /* expr ::= expr STAR expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_STAR); } - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_STAR); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 243: /* expr ::= expr SLASH expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_DIVIDE);} - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_DIVIDE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 244: /* expr ::= expr REM expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_REM); } - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_REM); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 245: /* expr ::= expr LIKE expr */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LIKE); } - yymsp[-2].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LIKE); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 246: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy118 = tSqlExprCreate(yymsp[-4].minor.yy118, (tSqlExpr*)yymsp[-1].minor.yy159, TK_IN); } - yymsp[-4].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-4].minor.yy170, (tSqlExpr*)yymsp[-1].minor.yy429, TK_IN); } + yymsp[-4].minor.yy170 = yylhsminor.yy170; break; case 247: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy159 = tSqlExprListAppend(yymsp[-2].minor.yy159,yymsp[0].minor.yy118,0, 0);} - yymsp[-2].minor.yy159 = yylhsminor.yy159; +{yylhsminor.yy429 = tSqlExprListAppend(yymsp[-2].minor.yy429,yymsp[0].minor.yy170,0, 0);} + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 248: /* exprlist ::= expritem */ -{yylhsminor.yy159 = tSqlExprListAppend(0,yymsp[0].minor.yy118,0, 0);} - yymsp[0].minor.yy159 = yylhsminor.yy159; +{yylhsminor.yy429 = tSqlExprListAppend(0,yymsp[0].minor.yy170,0, 0);} + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 249: /* expritem ::= expr */ -{yylhsminor.yy118 = yymsp[0].minor.yy118;} - yymsp[0].minor.yy118 = yylhsminor.yy118; +{yylhsminor.yy170 = yymsp[0].minor.yy170;} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 251: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} @@ -2978,7 +3272,7 @@ static void yy_reduce( case 253: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -2996,7 +3290,7 @@ static void yy_reduce( case 255: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3031,7 +3325,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.yy488, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy218, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -3040,7 +3334,7 @@ static void yy_reduce( case 259: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3058,7 +3352,7 @@ static void yy_reduce( case 261: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3100,9 +3394,9 @@ static void yy_reduce( break; /********** End reduce actions ************************************************/ }; - assert( yyrulenostateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); + return yyact; } /* @@ -3126,7 +3421,8 @@ static void yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -3137,7 +3433,8 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } #endif /* YYNOERRORRECOVERY */ @@ -3149,7 +3446,8 @@ static void yy_syntax_error( int yymajor, /* The major type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ @@ -3175,7 +3473,8 @@ static void yy_syntax_error( assert(len <= outputBufLen); /************ End %syntax_error code ******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* @@ -3184,7 +3483,8 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -3199,7 +3499,8 @@ static void yy_accept( /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* The main parser program. @@ -3228,45 +3529,47 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - unsigned int yyact; /* The parser action. */ + YYACTIONTYPE yyact; /* The parser action. */ #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ #endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif - yyParser *yypParser; /* The parser */ + yyParser *yypParser = (yyParser*)yyp; /* The parser */ + ParseCTX_FETCH + ParseARG_STORE - yypParser = (yyParser*)yyp; assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif - ParseARG_STORE; + yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ - int stateno = yypParser->yytos->stateno; - if( stateno < YY_MIN_REDUCE ){ + if( yyact < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno); + yyTracePrompt,yyTokenName[yymajor],yyact); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); + yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); } } #endif do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + assert( yyact==yypParser->yytos->stateno ); + yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, + yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,yymajor,yyminor); + yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif - yymajor = YYNOCODE; + break; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); @@ -3317,10 +3620,9 @@ void Parse( yymajor = YYNOCODE; }else{ while( yypParser->yytos >= yypParser->yystack - && yymx != YYERRORSYMBOL && (yyact = yy_find_reduce_action( yypParser->yytos->stateno, - YYERRORSYMBOL)) >= YY_MIN_REDUCE + YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE ){ yy_pop_parser_stack(yypParser); } @@ -3337,6 +3639,8 @@ void Parse( } yypParser->yyerrcnt = 3; yyerrorhit = 1; + if( yymajor==YYNOCODE ) break; + yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -3347,8 +3651,7 @@ void Parse( */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - + break; #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -3370,10 +3673,10 @@ void Parse( yypParser->yyerrcnt = -1; #endif } - yymajor = YYNOCODE; + break; #endif } - }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); + }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; @@ -3388,3 +3691,17 @@ void Parse( #endif return; } + +/* +** Return the fallback token corresponding to canonical token iToken, or +** 0 if iToken has no fallback. +*/ +int ParseFallback(int iToken){ +#ifdef YYFALLBACK + assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); + return yyFallback[iToken]; +#else + (void)iToken; + return 0; +#endif +} diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c index 2d33f68af0c8bb7100b8c60ad90ad0c304c37f63..e5f2d94c4a9696500e0aef7b9593c6cc0daf2792 100644 --- a/src/sync/src/syncMain.c +++ b/src/sync/src/syncMain.c @@ -549,7 +549,10 @@ static void syncClosePeerConn(SSyncPeer *pPeer) { if (pPeer->peerFd >= 0) { pPeer->peerFd = -1; void *pConn = pPeer->pConn; - if (pConn != NULL) syncFreeTcpConn(pPeer->pConn); + if (pConn != NULL) { + syncFreeTcpConn(pPeer->pConn); + pPeer->pConn = NULL; + } } } diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 5a7fc52931b8a813e673f9af3b6d1e456dd909d1..2448fada502177a0bcb4cf3deb194cce68e7854e 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -240,7 +240,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) { // current connect is broken if (code == TSDB_CODE_SUCCESS) { - handle = qRegisterQInfo(pVnode->qMgmt, qId, (uint64_t)pQInfo); + handle = qRegisterQInfo(pVnode->qMgmt, qId, pQInfo); if (handle == NULL) { // failed to register qhandle pRsp->code = terrno; terrno = 0; diff --git a/tests/examples/lua/README.md b/tests/examples/lua/README.md index dd9c9d07874e455329e43c7f77e806eb3634622c..32d6a4cace9bd0bf66238ff32af1d3ecf0285046 100644 --- a/tests/examples/lua/README.md +++ b/tests/examples/lua/README.md @@ -19,6 +19,10 @@ Run lua sample: lua test.lua ``` +## Run performance test: +``` +time lua benchmark.lua +``` ## OpenResty Dependencies - OpenResty: ``` diff --git a/tests/examples/lua/benchmark.lua b/tests/examples/lua/benchmark.lua new file mode 100644 index 0000000000000000000000000000000000000000..900e7891d81d5de2d723a9ebd9accf3317b2413a --- /dev/null +++ b/tests/examples/lua/benchmark.lua @@ -0,0 +1,67 @@ +local driver = require "luaconnector" + +local config = { + password = "taosdata", + host = "127.0.0.1", + port = 6030, + database = "", + user = "root", + + max_packet_size = 1024 * 1024 +} + +local conn +local res = driver.connect(config) +if res.code ~=0 then + print("connect--- failed: "..res.error) + return +else + conn = res.conn + print("connect--- pass.") +end + +local res = driver.query(conn,"drop database if exists demo") + +res = driver.query(conn,"create database demo") +if res.code ~=0 then + print("create db--- failed: "..res.error) + return +else + print("create db--- pass.") +end + +res = driver.query(conn,"use demo") +if res.code ~=0 then + print("select db--- failed: "..res.error) + return +else + print("select db--- pass.") +end + +res = driver.query(conn,"create table m1 (ts timestamp, speed int,owner binary(20))") +if res.code ~=0 then + print("create table---failed: "..res.error) + return +else + print("create table--- pass.") +end + +local base = 1617330000000 +local index =0 +local count = 100000 +local t +while( index < count ) +do + t = base + index + local q=string.format([[insert into m1 values (%d,0,'robotspace')]],t) +res = driver.query(conn,q) +if res.code ~=0 then + print("insert records failed: "..res.error) + return +else + +end + index = index+1 +end +print(string.format([["Done. %d records has been stored."]],count)) +driver.close(conn) diff --git a/tests/examples/lua/build.sh b/tests/examples/lua/build.sh index 8018a3b0d87bf622f6f4c815cba7ba3873a736b5..cbd47bdfd24ce210ab77a6a6259f030863dc7c5b 100755 --- a/tests/examples/lua/build.sh +++ b/tests/examples/lua/build.sh @@ -1,2 +1,2 @@ -gcc lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos +gcc -std=c99 lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos diff --git a/tests/examples/lua/lua51/build.sh b/tests/examples/lua/lua51/build.sh index da2981bf7d748a7a42782ad34c0db5b7c666c437..3b52ed14489a636fe7a867ed086199647fa650df 100755 --- a/tests/examples/lua/lua51/build.sh +++ b/tests/examples/lua/lua51/build.sh @@ -1,2 +1,2 @@ -gcc lua_connector51.c -fPIC -shared -o luaconnector51.so -Wall -ltaos +gcc -std=c99 lua_connector51.c -fPIC -shared -o luaconnector51.so -Wall -ltaos diff --git a/tests/examples/lua/lua_connector.c b/tests/examples/lua/lua_connector.c index 920d2cdc35c51c833a4d89448ec7e643f555dbc2..8078ed2665bb30bb8b1d142a21182509dbc49f65 100644 --- a/tests/examples/lua/lua_connector.c +++ b/tests/examples/lua/lua_connector.c @@ -23,7 +23,7 @@ static int l_connect(lua_State *L){ luaL_checktype(L, 1, LUA_TTABLE); - lua_getfield(L,-1,"host"); + lua_getfield(L,1,"host"); if (lua_isstring(L,-1)){ host = lua_tostring(L, -1); // printf("host = %s\n", host); diff --git a/tests/script/general/parser/having.sim b/tests/script/general/parser/having.sim new file mode 100644 index 0000000000000000000000000000000000000000..2e95664d31fd728a6cba3f775e3b9f07b6249ce0 --- /dev/null +++ b/tests/script/general/parser/having.sim @@ -0,0 +1,1841 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 +system sh/exec.sh -n dnode1 -s start + +sleep 100 +sql connect +print ======================== dnode1 start + +$db = testdb + +sql create database $db +sql use $db + +sql create stable st2 (ts timestamp, f1 int, f2 float, f3 double, f4 bigint, f5 smallint, f6 tinyint, f7 bool, f8 binary(10), f9 nchar(10)) tags (id1 int, id2 float, id3 nchar(10), id4 double, id5 smallint, id6 bigint, id7 binary(10)) + +sql create table tb1 using st2 tags (1,1.0,"1",1.0,1,1,"1"); +sql create table tb2 using st2 tags (2,2.0,"2",2.0,2,2,"2"); +sql create table tb3 using st2 tags (3,3.0,"3",3.0,3,3,"3"); +sql create table tb4 using st2 tags (4,4.0,"4",4.0,4,4,"4"); + +sql insert into tb1 values (now-200s,1,1.0,1.0,1,1,1,true ,"1","1") +sql insert into tb1 values (now-150s,1,1.0,1.0,1,1,1,false,"1","1") +sql insert into tb1 values (now-100s,2,2.0,2.0,2,2,2,true ,"2","2") +sql insert into tb1 values (now-50s ,2,2.0,2.0,2,2,2,false,"2","2") +sql insert into tb1 values (now ,3,3.0,3.0,3,3,3,true ,"3","3") +sql insert into tb1 values (now+50s ,3,3.0,3.0,3,3,3,false,"3","3") +sql insert into tb1 values (now+100s,4,4.0,4.0,4,4,4,true ,"4","4") +sql insert into tb1 values (now+150s,4,4.0,4.0,4,4,4,false,"4","4") + + +sql select count(*),f1 from st2 group by f1 having count(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != 2 then + return -1 +endi +if $data31 != 4 then + return -1 +endi + + + + +sql select count(*),f1 from st2 group by f1 having count(*) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != 2 then + return -1 +endi +if $data31 != 4 then + return -1 +endi + + +sql select count(*),f1 from st2 group by f1 having count(f2) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != 2 then + return -1 +endi +if $data31 != 4 then + return -1 +endi + +sql_error select top(f1,2) from st2 group by f1 having count(f2) > 0; + +sql select last(f1) from st2 group by f1 having count(f2) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data20 != 3 then + return -1 +endi +if $data30 != 4 then + return -1 +endi + +sql_error select top(f1,2) from st2 group by f1 having count(f2) > 0; + +sql_error select top(f1,2) from st2 group by f1 having count(f2) > 0; + +sql_error select top(f1,2) from st2 group by f1 having avg(f1) > 0; + +sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi + + +sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2 and sum(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2 and sum(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 2 and sum(f1) < 6; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi + + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having 1 <= sum(f1) and 5 >= sum(f1); +if $rows != 2 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by tbname having twa(f1) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 2.500000000 then + return -1 +endi +if $data01 != 8 then + return -1 +endi +if $data02 != 20 then + return -1 +endi +if $data04 != tb1 then + return -1 +endi + +sql_error select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by f1 having twa(f1) > 0; + +sql select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by tbname having sum(f1) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 2.500000000 then + return -1 +endi +if $data01 != 8 then + return -1 +endi +if $data02 != 20 then + return -1 +endi +if $data04 != tb1 then + return -1 +endi + +sql_error select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by f1 having sum(f1) > 0; + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +###########and issue +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 and sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 4; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +############or issue +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or avg(f1) > 4; +if $rows != 0 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(f1) > 3); +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +sql_error select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(*) > 3); + +sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(st2.f1) > 3); +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1) from st2 group by f1 having (sum(st2.f1) > 3); +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1),stddev(f1) from st2 group by f1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi +if $data34 != 0.000000000 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (stddev(st2.f1) > 3); +if $rows != 0 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (stddev(st2.f1) < 1); +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (LEASTSQUARES(f1) < 1); + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1) < 1; + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1,1,1) < 1; + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1,1,1) > 2; + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from st2 group by f1 having LEASTSQUARES(f1,1,1) > 2; + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from st2 group by f1 having sum(f1) > 2; + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having min(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1) from st2 group by f1 having min(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 3 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 4 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1) from st2 group by f1 having max(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 3 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 4 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1) from st2 group by f1 having max(f1) != 2; +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 3 then + return -1 +endi +if $data15 != 3 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 4 then + return -1 +endi +if $data25 != 4 then + return -1 +endi + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1) from st2 group by f1 having first(f1) != 2; +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 3 then + return -1 +endi +if $data15 != 3 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 4 then + return -1 +endi +if $data25 != 4 then + return -1 +endi + + + +sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1) from st2 group by f1 having first(f1) != 2; +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 1 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 3 then + return -1 +endi +if $data15 != 3 then + return -1 +endi +if $data16 != 3 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 4 then + return -1 +endi +if $data25 != 4 then + return -1 +endi +if $data26 != 4 then + return -1 +endi + + + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from st2 group by f1 having top(f1,1); + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from st2 group by f1 having top(f1,1) > 1; + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from st2 group by f1 having bottom(f1,1) > 1; + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1),top(f1,1),bottom(f1,1) from st2 group by f1 having bottom(f1,1) > 1; + +sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1),top(f1,1),bottom(f1,1) from st2 group by f1 having sum(f1) > 1; + +sql_error select PERCENTILE(f1) from st2 group by f1 having sum(f1) > 1; + +sql_error select PERCENTILE(f1,20) from st2 group by f1 having sum(f1) > 1; + +sql select aPERCENTILE(f1,20) from st2 group by f1 having sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 3; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,3) < 3; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi + +sql_error select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(1) > 1; + +sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from st2 group by f1 having apercentile(1) > 1; + +sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from st2 group by f1 having apercentile(f1,1) > 1; + +sql_error select sum(f1) from st2 group by f1 having last_row(f1) > 1; + +sql_error select avg(f1) from st2 group by f1 having diff(f1) > 0; + +sql_error select avg(f1),diff(f1) from st2 group by f1 having avg(f1) > 0; + +sql_error select avg(f1),diff(f1) from st2 group by f1 having spread(f2) > 0; + +sql select avg(f1) from st2 group by f1 having spread(f2) > 0; +if $rows != 0 then + return -1 +endi + +sql select avg(f1) from st2 group by f1 having spread(f2) = 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi + +sql select avg(f1),spread(f2) from st2 group by f1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) = 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi +if $data32 != 0.000000000 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) != 0; +if $rows != 0 then + return -1 +endi + + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + 1 > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + 1; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) - sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) * sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) / sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) and sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) 0 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + 0 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) - f1 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) - id1 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > id1 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > id1 and sum(f1) > 1; + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > 2 and sum(f1) > 1; +if $rows != 0 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) = 0 and sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi +if $data32 != 0.000000000 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) = 0 and avg(f1) > 1; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by c1 having spread(f1) = 0 and avg(f1) > 1; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(id1) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(f1) > id1; + +sql_error select avg(f1),spread(f1,f2,st2.f1),avg(id1) from st2 group by id1 having avg(f1) > id1; + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(f1) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 2.500000000 then + return -1 +endi +if $data01 != 3.000000000 then + return -1 +endi +if $data02 != 3.000000000 then + return -1 +endi +if $data03 != 3.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(f1) < 2; +if $rows != 0 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f1 > 0 group by f1 having avg(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi +if $data32 != 0.000000000 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f1 > 2 group by f1 having avg(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 2 group by f1 having avg(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f3 > 2 group by f1 having avg(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f1) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(ts) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f7) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f8) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f9) > 0; + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having count(f9) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having last(f9) > 0; + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having last(f2) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having last(f3) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f3) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f4) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f5) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f6) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + + +sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f2 from st2 where f2 > 1 group by f1 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by f1 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by f1,f2 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by f1,id1 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by id1 having last(f6) > 0; + +sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by id1 having last(f6) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2.000000000 then + return -1 +endi +if $data02 != 2.000000000 then + return -1 +endi +if $data03 != 2.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi + +sql_error select top(f1,2) from tb1 group by f1 having count(f1) > 0; + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/having_child.sim b/tests/script/general/parser/having_child.sim new file mode 100644 index 0000000000000000000000000000000000000000..1f29a63b9100c799deb3937dc317c4bcb5326aea --- /dev/null +++ b/tests/script/general/parser/having_child.sim @@ -0,0 +1,1891 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 +system sh/exec.sh -n dnode1 -s start + +sleep 100 +sql connect +print ======================== dnode1 start + +$db = testdb + +sql create database $db +sql use $db + +sql create stable st2 (ts timestamp, f1 int, f2 float, f3 double, f4 bigint, f5 smallint, f6 tinyint, f7 bool, f8 binary(10), f9 nchar(10)) tags (id1 int, id2 float, id3 nchar(10), id4 double, id5 smallint, id6 bigint, id7 binary(10)) + +sql create table tb1 using st2 tags (1,1.0,"1",1.0,1,1,"1"); +sql create table tb2 using st2 tags (2,2.0,"2",2.0,2,2,"2"); +sql create table tb3 using st2 tags (3,3.0,"3",3.0,3,3,"3"); +sql create table tb4 using st2 tags (4,4.0,"4",4.0,4,4,"4"); + +sql insert into tb1 values (now-200s,1,1.0,1.0,1,1,1,true ,"1","1") +sql insert into tb1 values (now-150s,1,1.0,1.0,1,1,1,false,"1","1") +sql insert into tb1 values (now-100s,2,2.0,2.0,2,2,2,true ,"2","2") +sql insert into tb1 values (now-50s ,2,2.0,2.0,2,2,2,false,"2","2") +sql insert into tb1 values (now ,3,3.0,3.0,3,3,3,true ,"3","3") +sql insert into tb1 values (now+50s ,3,3.0,3.0,3,3,3,false,"3","3") +sql insert into tb1 values (now+100s,4,4.0,4.0,4,4,4,true ,"4","4") +sql insert into tb1 values (now+150s,4,4.0,4.0,4,4,4,false,"4","4") + + +sql select count(*),f1 from tb1 group by f1 having count(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != 2 then + return -1 +endi +if $data31 != 4 then + return -1 +endi + + +sql select count(*),f1 from tb1 group by f1 having count(*) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != 2 then + return -1 +endi +if $data31 != 4 then + return -1 +endi + + +sql select count(*),f1 from tb1 group by f1 having count(f2) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != 2 then + return -1 +endi +if $data31 != 4 then + return -1 +endi + +sql_error select top(f1,2) from tb1 group by f1 having count(f2) > 0; + +sql select last(f1) from tb1 group by f1 having count(f2) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data20 != 3 then + return -1 +endi +if $data30 != 4 then + return -1 +endi + +sql_error select top(f1,2) from tb1 group by f1 having count(f2) > 0; + +sql_error select top(f1,2) from tb1 group by f1 having count(f2) > 0; + +sql_error select top(f1,2) from tb1 group by f1 having avg(f1) > 0; + +sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi + + +sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2 and sum(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2 and sum(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 2 and sum(f1) < 6; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi + + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having 1 <= sum(f1) and 5 >= sum(f1); +if $rows != 2 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi + +sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by tbname having twa(f1) > 0; + +sql select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by f1 having twa(f1) > 3; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 8 then + return -1 +endi +if $data03 != 4.000000000 then + return -1 +endi + +sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by tbname having sum(f1) > 0; + +sql select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by f1 having sum(f1) = 4; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data03 != 2.000000000 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +###########and issue +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 and sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 4; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +############or issue +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or avg(f1) > 4; +if $rows != 0 then + return -1 +endi + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(f1) > 3); +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +sql_error select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(*) > 3); + +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(tb1.f1) > 3); +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1) from tb1 group by f1 having (sum(tb1.f1) > 3); +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),stddev(f1) from tb1 group by f1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi +if $data34 != 0.000000000 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (stddev(tb1.f1) > 3); +if $rows != 0 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (stddev(tb1.f1) < 1); +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 4 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 6 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (LEASTSQUARES(f1) < 1); + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1) < 1; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) < 1; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) > 2; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) > 2; + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having sum(f1) > 2; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 4 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having min(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1) from tb1 group by f1 having min(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 3 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 4 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1) from tb1 group by f1 having max(f1) > 2; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 3 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 4 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1) from tb1 group by f1 having max(f1) != 2; +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 3 then + return -1 +endi +if $data15 != 3 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 4 then + return -1 +endi +if $data25 != 4 then + return -1 +endi + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1) from tb1 group by f1 having first(f1) != 2; +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 3 then + return -1 +endi +if $data15 != 3 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 4 then + return -1 +endi +if $data25 != 4 then + return -1 +endi + + + +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1) from tb1 group by f1 having first(f1) != 2; +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 1 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data14 != 3 then + return -1 +endi +if $data15 != 3 then + return -1 +endi +if $data16 != 3 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data24 != 4 then + return -1 +endi +if $data25 != 4 then + return -1 +endi +if $data26 != 4 then + return -1 +endi + + + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from tb1 group by f1 having top(f1,1); + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from tb1 group by f1 having top(f1,1) > 1; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from tb1 group by f1 having bottom(f1,1) > 1; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1),top(f1,1),bottom(f1,1) from tb1 group by f1 having bottom(f1,1) > 1; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1),top(f1,1),bottom(f1,1) from tb1 group by f1 having sum(f1) > 1; + +sql_error select PERCENTILE(f1) from tb1 group by f1 having sum(f1) > 1; + +sql select PERCENTILE(f1,20) from tb1 group by f1 having sum(f1) = 4; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from tb1 group by f1 having sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 3; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi + +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,3) < 3; +if $rows != 1 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi + +sql_error select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(1) > 1; + +sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from tb1 group by f1 having apercentile(1) > 1; + +sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from tb1 group by f1 having apercentile(f1,1) > 1; + +sql_error select sum(f1) from tb1 group by f1 having last_row(f1) > 1; + +sql_error select avg(f1) from tb1 group by f1 having diff(f1) > 0; + +sql_error select avg(f1),diff(f1) from tb1 group by f1 having avg(f1) > 0; + +sql_error select avg(f1),diff(f1) from tb1 group by f1 having spread(f2) > 0; + +sql select avg(f1) from tb1 group by f1 having spread(f2) > 0; +if $rows != 0 then + return -1 +endi + +sql select avg(f1) from tb1 group by f1 having spread(f2) = 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi + +sql select avg(f1),spread(f2) from tb1 group by f1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi +if $data32 != 0.000000000 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) != 0; +if $rows != 0 then + return -1 +endi + + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + 1 > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + 1; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) - sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) * sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) / sum(f1) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) and sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) 0 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + 0 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) - f1 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) - id1 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > id1 and sum(f1); + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > id1 and sum(f1) > 1; + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > 2 and sum(f1) > 1; +if $rows != 0 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and sum(f1) > 1; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi +if $data32 != 0.000000000 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and avg(f1) > 1; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by c1 having spread(f1) = 0 and avg(f1) > 1; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(id1) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) > id1; + +sql_error select avg(f1),spread(f1,f2,tb1.f1),avg(id1) from tb1 group by id1 having avg(f1) > id1; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) > 0; + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having avg(f1) > 0 and avg(f1) = 3; +if $rows != 1 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having avg(f1) < 0 and avg(f1) = 3; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) < 2; + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 0 group by f1 having avg(f1) > 0; +if $rows != 4 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 3.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 0.000000000 then + return -1 +endi +if $data32 != 0.000000000 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 2 group by f1 having avg(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 2 group by f1 having avg(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f3 > 2 group by f1 having avg(f1) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 3.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 4.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f1) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(ts) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f7) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f8) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f9) > 0; + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having count(f9) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f9) > 0; + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f2) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f3) > 0; +if $rows != 1 then + return -1 +endi +if $data00 != 4.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f3) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f4) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f5) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f6) > 0; +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi +if $data20 != 4.000000000 then + return -1 +endi +if $data21 != 0.000000000 then + return -1 +endi +if $data22 != 0.000000000 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 +endi + + +sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f2 from tb1 where f2 > 1 group by f1 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1,f2 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1,id1 having last(f6) > 0; + +sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by id1 having last(f6) > 0; + +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 and f2 < 4 group by f1 having last(f6) > 0; +if $rows != 2 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data01 != 0.000000000 then + return -1 +endi +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 3.000000000 then + return -1 +endi +if $data11 != 0.000000000 then + return -1 +endi +if $data12 != 0.000000000 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi + +sql_error select top(f1,2) from tb1 group by f1 having count(f1) > 0; + +system sh/exec.sh -n dnode1 -s stop -x SIGINT